Start crash sound

This commit is contained in:
Miloslav Ciz 2024-12-25 22:28:46 +01:00
parent 367112dbd9
commit b90f5bbfc8
4 changed files with 103 additions and 46 deletions

17
game.h
View file

@ -146,8 +146,6 @@ struct
uint32_t nextRacingTickTime;
uint8_t controlMode;
uint8_t debugDraw;
uint32_t runTime;
uint8_t musicVolume;
} LCR_game;
@ -224,7 +222,6 @@ void LCR_gameResetRun(void)
LCR_rendererSetCarTransform(carTransform,carTransform + 3);
LCR_rendererCameraReset();
LCR_gameSetState(LCR_GAME_STATE_RUN_STARTING);
LCR_game.runTime = 0;
}
void LCR_gameStartRun(const char *mapStr)
@ -305,7 +302,17 @@ uint8_t LCR_gameStep(uint32_t time)
LCR_LOG1("finished");
}
LCR_game.runTime++;
if (events & LCR_RACING_EVENT_CRASH_SMALL)
{
LCR_audioPlaySound(LCR_SOUND_CRASH_SMALL);
LCR_LOG1("crash (small)");
}
else if (events & LCR_RACING_EVENT_CRASH_BIG)
{
LCR_audioPlaySound(LCR_SOUND_CRASH_BIG);
LCR_LOG1("crash (big)");
}
LCR_game.nextRacingTickTime += LCR_RACING_TICK_MS;
}
@ -391,7 +398,7 @@ LCR_audioSetEngineIntensity((2 * val) < 256 ? (2 * val) : 255);
LCR_EFFECTIVE_RESOLUTION_Y -
LCR_rendererComputeTextHeight(2) - 20,0,2);
val = ((LCR_game.runTime * LCR_RACING_TICK_MS)) / 1000; // seconds
val = LCR_racingGetRunTimeMS() / 1000; // seconds
str[3] = '0' + (val % 60) / 10;
str[4] = '0' + val % 10;