Reload chunks on reset
This commit is contained in:
parent
9b31556979
commit
2172fcedd1
3 changed files with 12 additions and 5 deletions
2
TODO.txt
2
TODO.txt
|
@ -1,6 +1,5 @@
|
||||||
=========== GENERAL ==============
|
=========== GENERAL ==============
|
||||||
|
|
||||||
- force chunk reload upon map restart so that there's no blinking at start
|
|
||||||
- make a small txt game menual
|
- make a small txt game menual
|
||||||
- test if the replay stretching works
|
- test if the replay stretching works
|
||||||
- replay validation
|
- replay validation
|
||||||
|
@ -32,6 +31,7 @@
|
||||||
=========== HANDLED ==============
|
=========== HANDLED ==============
|
||||||
|
|
||||||
- allow stopping car rotation in air like in Trackmania
|
- 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
|
- ghost visible distance -- maybe even car should have this (watching rep with
|
||||||
free camera)? maybe generalize setCar/GhostVisibility to
|
free camera)? maybe generalize setCar/GhostVisibility to
|
||||||
setCarGhostVisibilityDistance where 0 means make invisible?
|
setCarGhostVisibilityDistance where 0 means make invisible?
|
||||||
|
|
11
game.h
11
game.h
|
@ -345,6 +345,7 @@ void LCR_gameResetRun(uint8_t replay, uint8_t ghost)
|
||||||
LCR_racingGetCarTransform(carTransform,carTransform + 3,0);
|
LCR_racingGetCarTransform(carTransform,carTransform + 3,0);
|
||||||
LCR_rendererSetCarTransform(carTransform,carTransform + 3);
|
LCR_rendererSetCarTransform(carTransform,carTransform + 3);
|
||||||
LCR_rendererCameraReset();
|
LCR_rendererCameraReset();
|
||||||
|
LCR_rendererLoadMapChunks();
|
||||||
LCR_game.ghost.active = ghost;
|
LCR_game.ghost.active = ghost;
|
||||||
LCR_gameSetState(LCR_GAME_STATE_RUN_STARTING);
|
LCR_gameSetState(LCR_GAME_STATE_RUN_STARTING);
|
||||||
LCR_game.runTimeMS = 0;
|
LCR_game.runTimeMS = 0;
|
||||||
|
@ -429,13 +430,19 @@ void LCR_gameGhostGetTransform(uint32_t frame,
|
||||||
position[2] += LCR_GAME_UNIT / 16;
|
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)
|
void _LCR_gamePrepareGhost(void)
|
||||||
{
|
{
|
||||||
LCR_GameUnit carTransform[6];
|
LCR_GameUnit carTransform[6];
|
||||||
LCR_LOG1("preparing ghost");
|
LCR_LOG1("preparing ghost");
|
||||||
|
|
||||||
LCR_gameResetRun(1,0);
|
LCR_gameResetRun(1,0);
|
||||||
|
|
||||||
|
LCR_replayInitPlaying();
|
||||||
|
|
||||||
uint8_t *currentSample = LCR_game.ghost.samples;
|
uint8_t *currentSample = LCR_game.ghost.samples;
|
||||||
|
|
||||||
LCR_game.ghost.stretch = 0;
|
LCR_game.ghost.stretch = 0;
|
||||||
|
@ -444,7 +451,7 @@ void _LCR_gamePrepareGhost(void)
|
||||||
(LCR_SETTING_GHOST_STEP << LCR_game.ghost.stretch) *
|
(LCR_SETTING_GHOST_STEP << LCR_game.ghost.stretch) *
|
||||||
LCR_SETTING_GHOST_MAX_SAMPLES)
|
LCR_SETTING_GHOST_MAX_SAMPLES)
|
||||||
{
|
{
|
||||||
LCR_LOG2("stretching replay step");
|
LCR_LOG1("stretching replay step");
|
||||||
LCR_game.ghost.stretch++;
|
LCR_game.ghost.stretch++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
Loads the map models with 8 chunks that are nearest to a certain point towards
|
||||||
which the camera is looking.
|
which the camera is looking.
|
||||||
*/
|
*/
|
||||||
void _LCR_rendererLoadMapChunks(void)
|
void LCR_rendererLoadMapChunks(void)
|
||||||
{
|
{
|
||||||
LCR_LOG2("loading map chunks");
|
LCR_LOG2("loading map chunks");
|
||||||
|
|
||||||
|
@ -1925,7 +1925,7 @@ void LCR_rendererDraw3D(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (LCR_renderer.frame % LCR_SETTING_MAP_CHUNK_RELOAD_INTERVAL == 0)
|
if (LCR_renderer.frame % LCR_SETTING_MAP_CHUNK_RELOAD_INTERVAL == 0)
|
||||||
_LCR_rendererLoadMapChunks();
|
LCR_rendererLoadMapChunks();
|
||||||
|
|
||||||
LCR_rendererDrawSky(LCR_currentMap.environment,
|
LCR_rendererDrawSky(LCR_currentMap.environment,
|
||||||
LCR_renderer.scene.camera.transform.rotation.y,
|
LCR_renderer.scene.camera.transform.rotation.y,
|
||||||
|
|
Loading…
Reference in a new issue