Enhance item handling and collision detection in remorse

- Introduced new functionality for staging and managing fixed map items, including the ability to build block chains and find candidates for item interactions.
- Updated the main application logic to utilize staged item block chains for improved item finding and grabbing mechanics.
- Added weight attribute to shape type information, allowing for more nuanced item interactions based on weight.
- Enhanced collision tests to cover new item handling scenarios, including gravity sweeps and item grabbing.
- Implemented additional tests for entity dispatch entries and fixed map items to ensure robustness of item spawning and movement logic.
- Improved type flags loading to validate weight against binary data, ensuring consistency in item attributes.
This commit is contained in:
Maddo 2026-09-26 19:20:20 +02:00
commit b99fb59c12
15 changed files with 961 additions and 18 deletions

View file

@ -47,7 +47,7 @@ struct AppState {
remorse::u16 diagnosticGroupCounts[32]{};
remorse::StandProcessEntry* diagnosticStand = nullptr;
remorse::KeyboardProcessEntry* diagnosticKeyboard = nullptr;
std::vector<remorse::StagedFixedMapItem> stagedItems;
std::optional<remorse::LiveFixedMapItems> liveItems;
std::optional<remorse::StagedFixedMapItem> diagnosticItem;
remorse::u16 diagnosticItemProcessId = 0;
remorse::u16 diagnosticReleaseEventItem = 0;
@ -281,7 +281,7 @@ void loadSceneAsync(HWND window, AppState& state)
state.playerFrames = std::move(playerFrames);
state.playerPalette = *palette;
if (stagedItems) {
state.stagedItems = std::move(*stagedItems);
state.liveItems.emplace(std::move(*stagedItems));
}
state.sceneLoaded = true;
}
@ -557,8 +557,8 @@ void paintWindow(HWND window, AppState& state)
RECT diagnosticsBounds{20, 30, viewWidth - 12, 54};
SetTextColor(device, RGB(74, 207, 184));
DrawTextW(device, diagnostics.str().c_str(), -1, &diagnosticsBounds, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS);
const auto nearbyItem = remorse::nearestStagedFixedMapItem(
state.stagedItems, state.playerWorld.x, state.playerWorld.y, diagnosticItemRange);
const auto nearbyItem = state.liveItems ? state.liveItems->nearestItem(
state.playerWorld.x, state.playerWorld.y, diagnosticItemRange) : std::nullopt;
if (state.diagnosticItem || nearbyItem) {
const auto& displayItem = state.diagnosticItem ? state.diagnosticItem : nearbyItem;
std::wostringstream itemStatus;
@ -729,8 +729,8 @@ LRESULT CALLBACK windowProcedure(HWND window, UINT message, WPARAM wParam, LPARA
std::lock_guard<std::mutex> lock(state->sceneMutex);
if (state->sceneLoaded && state->scene && !state->diagnosticItemCompleted &&
state->diagnosticItemProcessId == 0) {
state->diagnosticItem = remorse::nearestStagedFixedMapItem(
state->stagedItems, state->playerWorld.x, state->playerWorld.y, diagnosticItemRange);
state->diagnosticItem = state->liveItems ? state->liveItems->nearestItem(
state->playerWorld.x, state->playerWorld.y, diagnosticItemRange) : std::nullopt;
}
if (state->diagnosticItem && state->diagnosticItemProcessId == 0 &&
state->diagnosticItem->itemNumber <= remorse::ProcessKernel::maxTrackedItemNumber &&