Add map target time

This commit is contained in:
Miloslav Ciz 2025-01-15 21:29:38 +01:00
parent ea57ecd470
commit 9d2c6108b1
3 changed files with 60 additions and 35 deletions

53
game.h
View file

@ -560,6 +560,31 @@ void LCR_gameEnd(void)
LCR_LOG0("ending");
}
void LCR_gameTimeToStr(uint32_t timeMS, char *str)
{
str[9] = 0;
str[6] = '0' + timeMS % 10; // milliseconds
timeMS /= 10;
str[7] = '0' + timeMS % 10;
timeMS /= 10;
str[8] = '0' + timeMS % 10;
timeMS /= 10;
str[3] = '0' + (timeMS % 60) / 10; // seconds
str[4] = '0' + timeMS % 10;
str[5] = '\'';
timeMS = (timeMS / 60) % 100; // minutes
str[0] = '0' + timeMS / 10;
str[1] = '0' + timeMS % 10;
str[2] = '\'';
}
void LCR_gameDraw3DView(void)
{
LCR_GameUnit carTransform[6];
@ -626,29 +651,15 @@ void LCR_gameDraw3DView(void)
LCR_EFFECTIVE_RESOLUTION_Y -
LCR_rendererComputeTextHeight(2) - 20,0,2);
val = LCR_game.runTimeMS;
str[9] = 0;
str[6] = '0' + val % 10; // milliseconds
val /= 10;
str[7] = '0' + val % 10;
val /= 10;
str[8] = '0' + val % 10;
val /= 10;
str[3] = '0' + (val % 60) / 10; // seconds
str[4] = '0' + val % 10;
str[5] = '\'';
val = (val / 60) % 100; // minutes
str[0] = '0' + val / 10;
str[1] = '0' + val % 10;
str[2] = '\'';
LCR_gameTimeToStr(LCR_game.runTimeMS,str);
LCR_rendererDrawText(str,20,LCR_EFFECTIVE_RESOLUTION_Y -
LCR_rendererComputeTextHeight(2) - 20,0,2);
LCR_rendererComputeTextHeight(2) - 45,0,2);
LCR_gameTimeToStr(LCR_currentMap.targetTime,str);
LCR_rendererDrawText(str,20,LCR_EFFECTIVE_RESOLUTION_Y -
LCR_rendererComputeTextHeight(2) - 20,0x4208,2);
break;
}