Fix time multiplier
This commit is contained in:
parent
60cf16c8de
commit
74013219e5
2 changed files with 18 additions and 12 deletions
20
game.h
20
game.h
|
@ -1246,7 +1246,7 @@ void LCR_gameDraw3DView(void)
|
|||
!(LCR_racing.replay.on && LCR_replayHasFinished()) ?
|
||||
LCR_GAME_UNIT -
|
||||
((LCR_game.nextRacingTickTime - LCR_game.time) * LCR_GAME_UNIT)
|
||||
/ LCR_RACING_TICK_MS
|
||||
/ LCR_RACING_TICK_MS_RT
|
||||
: LCR_GAME_UNIT / 2;
|
||||
|
||||
LCR_racingGetCarTransform(carTransform,carTransform + 3,
|
||||
|
@ -1782,11 +1782,9 @@ uint8_t LCR_gameStep(uint32_t time)
|
|||
if (LCR_game.state != LCR_GAME_STATE_RUN_FINISHED)
|
||||
LCR_game.runTime = LCR_racing.tick;
|
||||
|
||||
LCR_game.nextRacingTickTime += LCR_RACING_TICK_MS;
|
||||
LCR_game.nextRacingTickTime += LCR_RACING_TICK_MS_RT;
|
||||
}
|
||||
|
||||
sleep = (3 * (LCR_game.nextRacingTickTime - time)) / 4;
|
||||
|
||||
// handle rendering:
|
||||
if (time >= LCR_game.nextRenderFrameTime ||
|
||||
LCR_game.state == LCR_GAME_STATE_LOADING)
|
||||
|
@ -1822,11 +1820,6 @@ uint8_t LCR_gameStep(uint32_t time)
|
|||
LCR_game.renderFramesMeasured++;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t tmp = (3 * (LCR_game.nextRenderFrameTime - time)) / 4;
|
||||
sleep = tmp < sleep ? tmp : sleep;
|
||||
}
|
||||
|
||||
if (LCR_game.state == LCR_GAME_STATE_LOADING)
|
||||
{
|
||||
|
@ -1837,6 +1830,15 @@ uint8_t LCR_gameStep(uint32_t time)
|
|||
LCR_gameDrawPopupMessage();
|
||||
}
|
||||
|
||||
if (LCR_game.nextRacingTickTime > time)
|
||||
sleep = LCR_game.nextRenderFrameTime - time;
|
||||
|
||||
if (LCR_game.nextRenderFrameTime > time &&
|
||||
LCR_game.nextRenderFrameTime - time < sleep)
|
||||
sleep = LCR_game.nextRenderFrameTime - time;
|
||||
|
||||
sleep = (sleep * 3) / 4;
|
||||
|
||||
if (sleep)
|
||||
LCR_sleep(sleep);
|
||||
else
|
||||
|
|
10
racing.h
10
racing.h
|
@ -56,7 +56,10 @@ typedef int32_t LCR_GameUnit; ///< Abstract game unit.
|
|||
|
||||
#define LCR_RACING_FPS 30 /**< Physics FPS, i.e. the number of
|
||||
physics ticks per second. */
|
||||
#define LCR_RACING_TICK_MS \
|
||||
|
||||
#define LCR_RACING_TICK_MS (1000 / LCR_RACING_FPS)
|
||||
|
||||
#define LCR_RACING_TICK_MS_RT \
|
||||
(100000 / (LCR_RACING_FPS * LCR_SETTING_TIME_MULTIPLIER))
|
||||
|
||||
#define LCR_RACING_VERSION1 '0' ///< First part of physics eng. version.
|
||||
|
@ -1202,8 +1205,9 @@ int _LCR_racingCarShapeOK(void)
|
|||
}
|
||||
|
||||
/**
|
||||
Updates the racing physics world, call every LCR_RACING_TICK_MS milliseconds.
|
||||
Returns a set of events (logically ORed) that occured during this step.
|
||||
Updates the racing physics world, call every LCR_RACING_TICK_MS_RT
|
||||
milliseconds. Returns a set of events (logically ORed) that occured during
|
||||
this step.
|
||||
*/
|
||||
uint32_t LCR_racingStep(unsigned int input)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue