Skip to content

Reimplement stockpile footprint cleanup (native byte match) - #217

Open
Krarilotus wants to merge 4 commits into
sourcehold:mainfrom
Krarilotus:reimplement/stockpile-footprint-cleanup
Open

Reimplement stockpile footprint cleanup (native byte match)#217
Krarilotus wants to merge 4 commits into
sourcehold:mainfrom
Krarilotus:reimplement/stockpile-footprint-cleanup

Conversation

@Krarilotus

@Krarilotus Krarilotus commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

TL;DR: Recreates the original cleanup of a stockpile's nine walkable tiles, including the building's rubble behavior. The implementation uses existing map and building structures and matches the original function at 100% in reccmp.

Reimplements TileMapState::clearStockpileFootprintTiles at 0x004FAF70. Each tile loses the existing L_STOCKPILEUnk and L_WALL_OR_GATEHOUSE logic flags, regains its default height, follows its referenced building's noRubble branch, and finally clears AlphaGFXLayer.

MiscDisplayLayer is a separate ushort layer without a corresponding flag enum in the current headers. Its 0x4000 value remains literal until its meaning is identified. The wiki documents this limitation and the ownership of the map layers and global inputs.

Validation: full x86 RelWithDebInfo DLL build with VS2005 SP1 passes after the flag-name change; linked reccmp still reports 100% at 0x004FAF70. The local build uses a current Windows SDK manifest tool because the legacy tool crashes. No DLL deployment or gameplay test was performed. The emulation script was removed from this PR as requested in review.

@@ -0,0 +1,81 @@
"""Compare a VS2005 /O2 DLL-mode object with original SHC 1.41 under x86 emulation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in other places: Please remove the emulation scripts if you matched 100%. They are optional in case you did not.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in ba14b9b. The full DLL rebuild and linked reccmp comparison still give 100% at 0x004FAF70; the PR now contains the implementation and its behavior documentation.

Comment thread src/OpenSHC/Map/TileMapState/clearStockpileFootprintTiles.cpp Outdated
Comment thread src/OpenSHC/Map/TileMapState/clearStockpileFootprintTiles.cpp
Comment on lines +20 to +24
These logic names come from the existing `Logic1` enum; their combination here
does not establish additional stockpile semantics. `MiscDisplayLayer` is a
separate `ushort` layer with no corresponding flag enum in the current headers.
Its `0x4000` bit is kept literal pending identification of its consumers; a
same-valued flag from another layer would not establish its meaning.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is far to technical again. That extends to the wiki entry itself.
I personally think the other text part are also too technical in the way that they talk a bit much about what the code does.
Do not get me wrong, these entries can state stuff like the three points, like "it clears that and that flag on the map logic layer and restores the height", but things like the part after, talking about where these infos come from, are pure code information and provide no information about what the game does on a game logic level.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewrote the article in 4596df5 around the visible game behavior: clearing the walkable tiles, updating rubble/display information, and the shared placement rules. Removed addresses, enum provenance and discussion of how the evidence was obtained. The unidentified display effect remains stated briefly without guessing its meaning.

Comment thread src/OpenSHC/Map/TileMapState/clearStockpileFootprintTiles.cpp
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.

2 participants