Skip to content

fix(render): show water on latest-Reforged maps - #37

Merged
StephenSHorton merged 2 commits into
mainfrom
fix/issue-35-water
Sep 5, 2026
Merged

StephenSHorton merged 2 commits into
mainfrom
fix/issue-35-water

Conversation

@StephenSHorton

Copy link
Copy Markdown
Owner

Fixes #35 — maps from current Reforged WE could report Has water: yes in the Terrain Cell inspector while the viewport drew none.

Two independent causes, both hit by latest-patch maps:

  1. 16-bit water indices. water.ts used UNSIGNED_SHORT and returned null when width * height > 65535 (anything around 256x256 and up). Terrain and pathing already promote to uint32; water now does the same.
  2. Missing CASC tileset mounts. Reforged 2.0.3+ stores animated water frames under war3.w3mod:_hd.w3mod:_tilesets/<letter>.w3mod: (and the SD _tilesets/<letter>.w3mod: sibling). ReadFile never tried those prefixes, so frames 404'd and the leftover color-only plane was nearly invisible (Water.slk shallow alpha is 10/255). Lookups now follow HiveWE's tileset-mount order, driven by the loaded map's w3e tileset letter. Water frames are requested as .dds (Classic .blp still works via the sibling swap).

Test plan

  • go test ./internal/casc — prefix order, tileset letter, Water00.dds with tilesets A/X/L
  • go test ./internal/...
  • Open a 256x256 (or larger) map with water — inspector Has water: yes and the surface is visible
  • Open a latest-WE map (w3e v12, tileset X or A) — water frames load ([water] loaded N/45 frame textures)
  • Toggle SD/HD — water stays visible

The Terrain Cell inspector could say Has water: yes while the viewport
drew none. Two causes, both hit by maps from current Reforged WE:

- water.ts used 16-bit indices and returned null on maps with more than
  65535 corners (around 256x256 and up). Use uint32 indices like terrain
  and pathing.
- CASC ReadFile never tried the per-tileset _tilesets/<letter>.w3mod:
  mounts that 2.0.3+ stores animated water under. Wire SetTileset from
  the loaded map and request water frames as .dds.

Closes #35.
@StephenSHorton StephenSHorton self-assigned this Sep 5, 2026
@StephenSHorton
StephenSHorton merged commit 96b0423 into main Sep 5, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

I don't see water on my map even with tick "yes" on it :( Map from last reforge patch.

1 participant