Act 4 lava draws all animation frames at once, over the rock (River of Flame, Chaos Sanctum)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start in components/drlg/room_tiles.hpp, where animated Act 4 lava tiles get their extra frames appended to room.tiles, then follow the pick data through components/game/gamedata/gamedata.hpp and gamedata.cpp. The drawing is in apps/d2d/world_view.cpp, where all frames of a lava tile currently get blitted. Done when, in River of Flame, the rock stairs at the entry show and only one lava frame draws per cell at a time.
Written by the indexing model from the issue text.
Description
Version: v0.12.3 (macOS arm64). room_tiles.hpp and world_view.cpp look the same in main at c5c3edda83 (2026-11-22).
What happens
In River of Flame and Chaos Sanctum, lava covers the rock. The stairs at the River of Flame entry from City of the Damned are not visible, and the Sanctum's floor is lava diamonds over everything. The lava also does not move.
Cause
LvlPrest presets with Animate (the Act 4 lava rooms) go through room_tiles.hpp (FUN_0066d700 / FUN_0066d440). Each animated tile becomes its key's rarity-0 tile, and frames 1..n-1 are appended to room.tiles, as in game.exe.
In game.exe, FUN_0066d440 also builds an animation record {frames, count, pos, speed (0x50 when 0 is passed), next} and flags the extra frames (+0x14 |= 8). The draw code (0x4dee52) skips tiles flagged 0x408, and FUN_0066d3b0, called from 0x61aefd via 0x66d410, shows one frame at a time:
- hide the current frame;
- pos = (pos + speed) % (n << 8);
- show frame pos >> 8.
d2d draws every frame, so all 10 lava frames are stacked, and the last one sits over the rock of the second floor layer. On the levels I checked, River of Flame has 17192 such cells and Chaos Sanctum has 12960; levels 104–106 have none.
Fix that worked here
PlacedTile/Level::Pickcarryframeandframes.world_view.cppdraws the current frame in frame 0's place and skips the others. All rooms run in step at 25 ticks/s with speed 0x50; this is my reading, I did not trace the speed argument from 0x666d7d.
Checked headless: the River of Flame entry shows the rock stairs, and 82.5% of a lava band changes within 0.5 s (1.8% before). The Chaos Sanctum floor is rock with lava pools.
diff against v0.12.3
--- a/components/drlg/room_tiles.hpp
+++ b/components/drlg/room_tiles.hpp
@@ -49,6 +49,9 @@
// layer + 1 OR'd in (not a shadow's); bit 0, any of the words had 0x80.
int layers = 0;
bool keep = false;
+ // LOCAL PATCH (lava): an Animate preset's tile (FUN_0066d440): its frame
+ // (rarity) and its key's frame count; 0 frames when it isn't animated.
+ std::uint8_t frame = 0, frames = 0;
};
// A room's area (FUN_0066ca50's entry): level-relative tiles, right /
// bottom exclusive; id its flood label, skip (+0x20) where it began on a blank floor.
@@ -670,9 +673,13 @@
return found == frames.end() ? std::pair<const Dt1File*, int>{ nullptr, -1 } : *found;
};
std::tie(room.tiles[i].file, room.tiles[i].index) = frame(0);
+ const auto count = std::uint8_t(std::min<std::size_t>(frames.size(), 255));
+ if (count > 1) room.tiles[i].frames = count; // LOCAL PATCH (lava)
for (int number = 1; number < int(frames.size()); ++number) {
const auto [file, index] = frame(number);
room.tiles.push_back({ layer, tile.x, tile.y, tile.orient, file, index, key });
+ room.tiles.back().frame = std::uint8_t(std::min(number, 255)); // LOCAL PATCH (lava): flagged 8, hidden till its turn
+ room.tiles.back().frames = count;
}
}
}
--- a/components/game/gamedata/gamedata.hpp
+++ b/components/game/gamedata/gamedata.hpp
@@ -212,7 +212,8 @@
// `stamp`: what collision took of it (set_level_tiles): the tile as it
// was when the room it lies in came up, none if that was before its own.
// no_fade: the tile's flag 4 (never_fades): a wall in front stays opaque.
- struct Pick { std::uint8_t layer, orient; const d2d::dt1::Tile* tile; bool hidden = false; std::uint8_t cell = 0; const d2d::dt1::Tile* stamp = nullptr; bool no_fade = false; };
+ // LOCAL PATCH (lava): frame / frames, an Animate preset's frame (PlacedTile::frame).
+ struct Pick { std::uint8_t layer, orient; const d2d::dt1::Tile* tile; bool hidden = false; std::uint8_t cell = 0; const d2d::dt1::Tile* stamp = nullptr; bool no_fade = false; std::uint8_t frame = 0, frames = 0; };
// A tile's flag 4 as the DRLG makes it (FUN_0066dc50): the DS1 word's bit 3
// or bit 26, or the DT1 tile's material flags bit 0; FUN_004dd180 then
// never fades it (walls.md).
--- a/components/game/gamedata/gamedata.cpp
+++ b/components/game/gamedata/gamedata.cpp
@@ -956,7 +956,7 @@
cell_picks.push_back(
{ std::uint8_t(tile.layer), std::uint8_t(tile.orient), drawn,
tile.layer != 2 && (tile.word & 0x80000000u) != 0,
- cell, stamp, Level::never_fades(tile.word, drawn->material_flags) });
+ cell, stamp, Level::never_fades(tile.word, drawn->material_flags), tile.frame, tile.frames });
}
return built;
}
--- a/apps/d2d/world_view.cpp
+++ b/apps/d2d/world_view.cpp
@@ -291,6 +291,29 @@
const auto found = tile_level.tile_lookup.find(tile_key(style, seq, type));
return found == tile_level.tile_lookup.end() ? nullptr : found->second;
};
+ // LOCAL PATCH (lava): an Animate preset's tile (Act 4's lava) is its
+ // frame 0's pick plus frames 1..n-1 listed after every other tile of the
+ // room. game.exe hides those (tile flag 8, FUN_0066d440) and its room
+ // tick (FUN_0066d3b0) hides the shown one and shows the next: position
+ // += 0x50 (the default speed) mod n << 8, the frame its high bits. So one
+ // frame shows, and drawn where frame 0 is listed it stays under the
+ // floors after it (the rock over the lava). d2d drew every frame, the
+ // last over the rock. My reading: 25 ticks a second, every room in step.
+ const auto anim_pos = std::uint64_t(elapsed_ms / 40) * 0x50;
+ auto pick_tile = [&](const std::vector<Level::Pick>& cell_picks, std::size_t i) -> const d2d::dt1::Tile* {
+ const auto& pick = cell_picks[i];
+ if (pick.frames == 0) return pick.tile;
+ if (pick.frame != 0) return nullptr;
+ const auto want = std::uint8_t(anim_pos / 256 % pick.frames);
+ if (want == 0) return pick.tile;
+ // The nth animated tile of its layer here owns the nth run of frames.
+ std::size_t nth = 0;
+ for (std::size_t k = 0; k < i; ++k)
+ if (cell_picks[k].frames && cell_picks[k].frame == 0 && cell_picks[k].layer == pick.layer) ++nth;
+ for (const auto& other : cell_picks)
+ if (other.frames && other.layer == pick.layer && other.frame == want && nth-- == 0) return other.tile;
+ return pick.tile;
+ };
// Cell (gx, gy) of this level or, past its edge, of the level next to
// it in the act (Level::nearby): D2 draws the neighbour's rooms too.
auto cell_at = [&](int cell_x, int cell_y) -> std::pair<const Level*, std::size_t> {
@@ -313,8 +336,12 @@
const auto [cell_level, off] = cell_at(cell_x, cell_y);
if (!cell_level) continue;
if (!cell_level->picks.empty()) {
- for (const auto& pick : cell_level->shown()[off])
- if (pick.layer == 0 && pick.orient >= 16 && !pick.hidden) blit_cell(cell_x, cell_y, *pick.tile, 0, &pick);
+ const auto& cell_picks = cell_level->shown()[off];
+ for (std::size_t i = 0; i < cell_picks.size(); ++i) {
+ const auto& pick = cell_picks[i];
+ if (pick.layer == 0 && pick.orient >= 16 && !pick.hidden)
+ if (const auto* tile = pick_tile(cell_picks, i)) blit_cell(cell_x, cell_y, *tile, 0, &pick);
+ }
continue;
}
for (const auto& wall_layer : cell_level->ds1.walls()) {
@@ -347,8 +374,12 @@
}
};
if (!cell_level->picks.empty()) { // the floors game.exe picked
- for (const auto& pick : cell_level->shown()[off])
- if (pick.layer == 1 && !pick.hidden) splash(*pick.tile, blit_cell(cell_x, cell_y, *pick.tile, 1, &pick));
+ const auto& cell_picks = cell_level->shown()[off];
+ for (std::size_t i = 0; i < cell_picks.size(); ++i) {
+ const auto& pick = cell_picks[i];
+ if (pick.layer == 1 && !pick.hidden)
+ if (const auto* tile = pick_tile(cell_picks, i)) splash(*tile, blit_cell(cell_x, cell_y, *tile, 1, &pick));
+ }
continue;
}
@@ -402,8 +433,12 @@
const auto [cell_level, off] = cell_at(cell_x, cell_y);
if (!cell_level) continue;
if (!cell_level->picks.empty()) {
- for (const auto& pick : cell_level->shown()[off])
- if (pick.layer == 2 && !pick.hidden) blit_cell(cell_x, cell_y, *pick.tile, 2, &pick);
+ const auto& cell_picks = cell_level->shown()[off];
+ for (std::size_t i = 0; i < cell_picks.size(); ++i) {
+ const auto& pick = cell_picks[i];
+ if (pick.layer == 2 && !pick.hidden)
+ if (const auto* tile = pick_tile(cell_picks, i)) blit_cell(cell_x, cell_y, *tile, 2, &pick);
+ }
continue;
}
for (const auto& shadow_layer : cell_level->ds1.shadows()) {
@@ -578,8 +613,12 @@
};
if (!cell_level->picks.empty()) {
int wall_index = 0;
- for (const auto& pick : cell_level->shown()[off])
- if (pick.layer == 0 && pick.orient != 13 && pick.orient < 16 && !pick.hidden) draw_wall(pick.orient, *pick.tile, wall_index++, &pick, pick.no_fade);
+ const auto& cell_picks = cell_level->shown()[off];
+ for (std::size_t i = 0; i < cell_picks.size(); ++i) {
+ const auto& pick = cell_picks[i];
+ if (pick.layer == 0 && pick.orient != 13 && pick.orient < 16 && !pick.hidden)
+ if (const auto* tile = pick_tile(cell_picks, i)) draw_wall(pick.orient, *tile, wall_index++, &pick, pick.no_fade);
+ }
continue;
}
int wall_index = 0;
- Dominant language
- C++
- Stars
- 17
- Forks
- 6
- Avg merge
- 6h 14m
- Merged PRs (30d)
- 570
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from psi29a/d2decomped
-
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
psi29a/d2decomped#691 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
psi29a/d2decomped#690 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 Half a day Newbie friendliness 45/100
psi29a/d2decomped#689 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 18/100
psi29a/d2decomped#687 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 1-2 days Newbie friendliness 48/100
psi29a/d2decomped#685 ·
Maintainers usually reply within 1 day
All issues in psi29a/d2decomped
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
CachyOS/packageinstaller#144 ·
Maintainers usually reply within 1 day
-
prio:low type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NatronGitHub/Natron#1638 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 82/100
TomerAberbach/profiler-md#951 ·
Maintainers usually reply within 1 day
-
area:readers low-priority
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
NatronGitHub/openfx-arena#214 ·
Maintainers usually reply within 1 day