Implement gravity resolution and fast area calculations in collision handling
This commit is contained in:
parent
b3975ca41b
commit
2e16b2d524
8 changed files with 301 additions and 26 deletions
|
|
@ -72,6 +72,7 @@ struct AppState {
|
|||
std::vector<std::uint8_t> viewPixels;
|
||||
remorse::WorldPoint spawn{};
|
||||
remorse::WorldPoint playerWorld{};
|
||||
remorse::FastAreaRange fastArea{};
|
||||
remorse::s32 minWorldX = 0;
|
||||
remorse::s32 minWorldY = 0;
|
||||
remorse::s32 maxWorldX = 0;
|
||||
|
|
@ -272,6 +273,7 @@ void loadSceneAsync(HWND window, AppState& state)
|
|||
std::lock_guard<std::mutex> lock(state.sceneMutex);
|
||||
state.spawn = spawn;
|
||||
state.playerWorld = spawn;
|
||||
state.fastArea = remorse::calculateFastAreaRange(spawn);
|
||||
state.playerCollisionBody = remorse::makeCollisionBody(spawn, (*shapeTypes)[1]);
|
||||
state.collisionBodies = std::move(collisionBodies);
|
||||
state.shapeTypes = *shapeTypes;
|
||||
|
|
@ -646,6 +648,12 @@ void updatePlayer(HWND window, AppState& state)
|
|||
}
|
||||
}
|
||||
}, &app);
|
||||
} else if (entry.bytes[0] == 0x10 && entry.bytes[1] == 0x06 && app.liveItems) {
|
||||
const remorse::u16 processId = static_cast<remorse::u16>(entry.bytes[2] |
|
||||
(static_cast<remorse::u16>(entry.bytes[3]) << 8));
|
||||
app.diagnosticKernel.runResolvedGravity(processId, *app.liveItems,
|
||||
app.shapeTypes, app.fastArea, 1, app.diagnosticKernel.systemTimerTick(),
|
||||
app.diagnosticGroupCounts);
|
||||
}
|
||||
}, &state);
|
||||
state.diagnosticKernel.refreshActiveGroup(state.diagnosticGroupCounts);
|
||||
|
|
@ -697,6 +705,7 @@ void updatePlayer(HWND window, AppState& state)
|
|||
if (withinMapBounds && withinSceneBounds && remorse::canMoveCollisionBody(
|
||||
state.playerCollisionBody, destination, state.collisionBodies)) {
|
||||
state.playerWorld = destination;
|
||||
state.fastArea = remorse::calculateFastAreaRange(destination);
|
||||
state.playerCollisionBody.location = destination;
|
||||
state.playerOffsetX = nextOffsetX;
|
||||
state.playerOffsetY = nextOffsetY;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue