Refactor collision handling and item management in the Remorse project

- Introduced new structures for handling sweep impacts and collision results, including SweepItemImpact, SweepCandidateImpact, and SweepCollisionResult.
- Implemented functions to check if a world point or sweep footprint is within a defined fast area.
- Enhanced LiveFixedMapItems to manage contained items and support item allocation with parent-child relationships.
- Updated collision detection logic to handle solid item impacts and collect sweep impacts from live items.
- Added tests for new collision functionalities, including sweep impact resolution and candidate selection.
- Modified existing tests to validate new item management features and ensure proper integration with the collision system.
This commit is contained in:
Maddo 2026-09-26 19:50:26 +02:00
commit b3975ca41b
8 changed files with 467 additions and 8 deletions

View file

@ -160,6 +160,16 @@ void loadSceneAsync(HWND window, AppState& state)
PostMessageW(window, sceneReadyMessage, 0, 0);
return;
}
std::vector<remorse::StagedContainedFixedMapItem> containedItems;
if (map->index != 0) {
const auto contained = remorse::stageContainedFixedMapItems(*map, *shapeTypes);
if (!contained) {
setLoadFailure(state, L"Contained map items could not be staged.");
PostMessageW(window, sceneReadyMessage, 0, 0);
return;
}
containedItems = std::move(*contained);
}
auto collisionBodies = remorse::collectMapCollisionBodies(*map, *shapeTypes, *globObjects);
const auto usecodePath = remorse::resolveGameDataPath(
state.root, std::filesystem::path("USECODE") / "EUSECODE.FLX");
@ -281,7 +291,7 @@ void loadSceneAsync(HWND window, AppState& state)
state.playerFrames = std::move(playerFrames);
state.playerPalette = *palette;
if (stagedItems) {
state.liveItems.emplace(std::move(*stagedItems));
state.liveItems.emplace(std::move(*stagedItems), std::move(containedItems));
}
state.sceneLoaded = true;
}