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

View file

@ -1,6 +1,5 @@
=========== GENERAL ==============
- force chunk reload upon map restart so that there's no blinking at start
- make a small txt game menual
- test if the replay stretching works
- replay validation
@ -32,6 +31,7 @@
=========== HANDLED ==============
- allow stopping car rotation in air like in Trackmania
- force chunk reload upon map restart so that there's no blinking at start
- ghost visible distance -- maybe even car should have this (watching rep with
free camera)? maybe generalize setCar/GhostVisibility to
setCarGhostVisibilityDistance where 0 means make invisible?

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++;
}

View file

@ -1531,7 +1531,7 @@ S3L_Unit _LCR_rendererSmoothRot(S3L_Unit angleOld, S3L_Unit angleNew,
Loads the map models with 8 chunks that are nearest to a certain point towards
which the camera is looking.
*/
void _LCR_rendererLoadMapChunks(void)
void LCR_rendererLoadMapChunks(void)
{
LCR_LOG2("loading map chunks");
@ -1925,7 +1925,7 @@ void LCR_rendererDraw3D(void)
#endif
if (LCR_renderer.frame % LCR_SETTING_MAP_CHUNK_RELOAD_INTERVAL == 0)
_LCR_rendererLoadMapChunks();
LCR_rendererLoadMapChunks();
LCR_rendererDrawSky(LCR_currentMap.environment,
LCR_renderer.scene.camera.transform.rotation.y,