Reload chunks on reset

This commit is contained in:
Miloslav Ciz 2025-01-23 11:45:19 +01:00
parent 9b31556979
commit 2172fcedd1
3 changed files with 12 additions and 5 deletions

11
game.h
View file

@ -345,6 +345,7 @@ void LCR_gameResetRun(uint8_t replay, uint8_t ghost)
LCR_racingGetCarTransform(carTransform,carTransform + 3,0);
LCR_rendererSetCarTransform(carTransform,carTransform + 3);
LCR_rendererCameraReset();
LCR_rendererLoadMapChunks();
LCR_game.ghost.active = ghost;
LCR_gameSetState(LCR_GAME_STATE_RUN_STARTING);
LCR_game.runTimeMS = 0;
@ -429,13 +430,19 @@ void LCR_gameGhostGetTransform(uint32_t frame,
position[2] += LCR_GAME_UNIT / 16;
}
/**
Prepares ghost, computes position/rotation samples. When calling this, the
correct replay and map have to be already loaded.
*/
void _LCR_gamePrepareGhost(void)
{
LCR_GameUnit carTransform[6];
LCR_LOG1("preparing ghost");
LCR_gameResetRun(1,0);
LCR_replayInitPlaying();
uint8_t *currentSample = LCR_game.ghost.samples;
LCR_game.ghost.stretch = 0;
@ -444,7 +451,7 @@ void _LCR_gamePrepareGhost(void)
(LCR_SETTING_GHOST_STEP << LCR_game.ghost.stretch) *
LCR_SETTING_GHOST_MAX_SAMPLES)
{
LCR_LOG2("stretching replay step");
LCR_LOG1("stretching replay step");
LCR_game.ghost.stretch++;
}