Fix bug, add input display

This commit is contained in:
Miloslav Ciz 2025-05-28 22:05:50 +02:00
parent 19a2aff2cc
commit 0bbbc26f2a
5 changed files with 41 additions and 11 deletions

31
game.h
View file

@ -482,6 +482,7 @@ void LCR_gameResetRun(uint8_t replay, uint8_t ghost)
LCR_LOG0("resetting run");
LCR_mapReset();
LCR_racingRestart(replay);
LCR_rendererUnmarkCPs();
LCR_racingGetCarTransform(carTransform,carTransform + 3,0);
@ -833,6 +834,7 @@ uint8_t LCR_gameLoadMap(unsigned int mapIndex)
result = LCR_mapLoadFromStr(LCR_gameGetNextDataStrChar,name);
LCR_game.mapBeaten = LCR_mapIsBeaten(LCR_currentMap.name);
return result;
}
@ -1228,9 +1230,12 @@ void LCR_gameDraw3DView(void)
{
LCR_GameUnit carTransform[6];
LCR_GameUnit physicsInterpolationParam = LCR_GAME_UNIT -
((LCR_game.nextRacingTickTime - LCR_game.time) * LCR_GAME_UNIT)
/ LCR_RACING_TICK_MS;
LCR_GameUnit physicsInterpolationParam =
!(LCR_racing.playingReplay && LCR_replayHasFinished()) ?
LCR_GAME_UNIT -
((LCR_game.nextRacingTickTime - LCR_game.time) * LCR_GAME_UNIT)
/ LCR_RACING_TICK_MS
: LCR_GAME_UNIT / 2;
LCR_racingGetCarTransform(carTransform,carTransform + 3,
physicsInterpolationParam);
@ -1285,6 +1290,19 @@ void LCR_gameDraw3DView(void)
LCR_EFFECTIVE_RESOLUTION_Y - LCR_rendererComputeTextHeight(_FONT_SIZE) -
LCR_GUI_GAP,0,_FONT_SIZE);
#if LCR_SETTING_DISPLAY_INPUTS
str[0] = (LCR_racing.currentInputs & LCR_RACING_INPUT_LEFT) ? 'L' : '.';
str[1] = (LCR_racing.currentInputs & LCR_RACING_INPUT_BACK) ? 'D' : '.';
str[2] = (LCR_racing.currentInputs & LCR_RACING_INPUT_FORW) ? 'U' : '.';
str[3] = (LCR_racing.currentInputs & LCR_RACING_INPUT_RIGHT) ? 'R' : '.';
str[4] = 0;
LCR_rendererDrawText(str,LCR_EFFECTIVE_RESOLUTION_X -
LCR_rendererComputeTextWidth(str,_FONT_SIZE) - LCR_GUI_GAP,
LCR_EFFECTIVE_RESOLUTION_Y - 2 *
(LCR_rendererComputeTextHeight(_FONT_SIZE) + LCR_GUI_GAP),0,_FONT_SIZE);
#endif
LCR_gameTimeToStr(LCR_game.runTime,str);
if (LCR_game.state != LCR_GAME_STATE_RUN_FINISHED)
@ -1622,9 +1640,10 @@ uint8_t LCR_gameStep(uint32_t time)
else
{
LCR_gameHandleInput();
int paused = LCR_game.state == LCR_GAME_STATE_MENU ||
LCR_game.state == LCR_GAME_STATE_RUN_STARTING;
int paused =
LCR_game.state != LCR_GAME_STATE_RUN &&
LCR_game.state != LCR_GAME_STATE_RUN_FINISHED;
// handle simulation:
while (time >= LCR_game.nextRacingTickTime)