-
Notifications
You must be signed in to change notification settings - Fork 5
Reimplement stockpile footprint cleanup (native byte match) #217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Krarilotus
wants to merge
5
commits into
sourcehold:main
Choose a base branch
from
Krarilotus:reimplement/stockpile-footprint-cleanup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
adfd078
Reimplement stockpile footprint cleanup with native verification
Krarilotus 2914614
Record full DLL match and focus stockpile wiki on vanilla behavior
Krarilotus ba14b9b
Use existing stockpile logic flags and address review cleanup
Krarilotus 4596df5
Describe stockpile cleanup in terms of game behavior
Krarilotus 22fb73d
docs: group and link stockpile gameplay article
Krarilotus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Stockpile | ||
|
|
||
| Removing a stockpile clears its nine walkable tiles. Its four building parts | ||
| are removed separately. | ||
|
|
||
| For each walkable tile, cleanup: | ||
|
|
||
| 1. Clears the stockpile and wall/gatehouse map-logic flags and restores the | ||
| default terrain height. | ||
| 2. Updates the former-building and display information according to the | ||
| building's rubble setting. The exact visual effect of one display flag | ||
| remains unidentified. | ||
| 3. Removes the tile's building reference. | ||
|
|
||
| ## Placement | ||
|
|
||
| Placing a keep creates a starting stockpile for both human and AI players. | ||
|
|
||
| The first stockpile needs no adjacent existing stockpile. Further stockpiles | ||
| require available capacity and adjacency to the owner's stockpile, as well as | ||
| suitable terrain. AI castle placement uses the same placement rules. |
32 changes: 32 additions & 0 deletions
32
src/OpenSHC/Map/TileMapState/clearStockpileFootprintTiles.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #include "../TileMapState.func.hpp" | ||
|
|
||
| #include "OpenSHC/Globals/DAT_BuildingsState.hpp" | ||
| #include "OpenSHC/Globals/DAT_TerrainDefinedData.hpp" | ||
| #include "OpenSHC/Globals/DAT_ViewportRenderState.hpp" | ||
| #include "OpenSHC/Map/LogicHelpers/Logic1.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace Map { | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x004FAF70 | ||
| void TileMapState::clearStockpileFootprintTiles(int x, int y) | ||
| { | ||
| for (int i = 0; i < 9; ++i) { | ||
| int tile = DAT_ViewportRenderState::instance | ||
| .translationMatrix[y + DAT_TerrainDefinedData::instance.StockpilePathableOffsets[i].y] | ||
| .addXgetTile | ||
| + x + DAT_TerrainDefinedData::instance.StockpilePathableOffsets[i].x; | ||
|
|
||
| this->LogicLayer[tile] &= ~(LogicHelpers::L_STOCKPILEUnk | LogicHelpers::L_WALL_OR_GATEHOUSE); | ||
| this->HeightLayer[tile] = this->DefaultHeightLayer[tile]; | ||
| if (DAT_BuildingsState::instance.buildings[this->AlphaGFXLayer[tile]].noRubble == 0) { | ||
| this->BuildingWasLayer[tile] = 0; | ||
| } else { | ||
| this->MiscDisplayLayer[tile] |= 0x4000; | ||
| } | ||
| this->AlphaGFXLayer[tile] = 0; | ||
| } | ||
| } | ||
|
|
||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.