Use more popups

This commit is contained in:
Miloslav Ciz 2025-02-21 16:20:43 +01:00
parent f44204ce26
commit d794784bab
4 changed files with 28 additions and 32 deletions

View file

@ -1,7 +1,5 @@
=========== GENERAL ==============
- maybe remove setting string from menu (like music: 1) and use popups instead
(have just music and show "on" or "off" in popup)
- on 1st map the camera is obscured by the wall at the start, fix it somehow
(not the best first impression)
- culling is very slow now, it showed that distance bailout can accelerate it
@ -37,7 +35,6 @@
- replay validation
- maybe each map could have a target time embedded: when beaten, the map would
be marked as such
- player name (modifiable via resource file)
- make the racing module usable by itself, e.g. to allow making tools for
verifying replays etc., i.e. make the module measure time, count checkpoints
etc.
@ -54,6 +51,9 @@
=========== HANDLED ==============
- player name (modifiable via resource file) <-- prolly not
- maybe remove setting string from menu (like music: 1) and use popups instead
(have just music and show "on" or "off" in popup)
- add indication when CP is taken: in 1st man view it may be unclear if CP was
taken or not otherwise
- popup messages? would be useful for several things: showing checkpoint times,

View file

@ -35,9 +35,9 @@ static const char *LCR_texts[] =
"race repl",
#define LCR_TEXTS_MAIN_MENU 5
"camera: $",
"music: $",
"sound: $",
"camera",
"music",
"sound",
"save repl",
"exit",

46
game.h
View file

@ -365,6 +365,13 @@ void LCR_gamePopupMessage(const char *str)
(LCR_SETTING_POPUP_DURATION * LCR_SETTING_FPS) / 1000;
}
void LCR_gamePopupNumber(uint8_t num)
{
LCR_game.popupStr[0] = '0' + num;
LCR_game.popupStr[1] = 0;
LCR_gamePopupMessage(LCR_game.popupStr);
}
void LCR_gameDrawPixelXYUnsafe(unsigned int x, unsigned int y,
uint16_t color)
{
@ -801,24 +808,14 @@ void LCR_gameEraseMenuItemNames(void)
LCR_game.menu.itemCount = 0;
}
void LCR_gameSetMenuItemStr(uint8_t item, const char *str, char replaceChar)
{
for (int i = 0; i < LCR_MENU_STRING_SIZE - 1; ++i)
{
LCR_game.menu.itemNames[item][i] = str[i] == '$' ? replaceChar : str[i];
LCR_game.menu.itemNames[item][i + 1] = 0;
}
}
void LCR_gameLoadMainMenuItems(void)
{
for (int i = 0; i < 5; ++i)
{
char replaceChar = i == 0 ? '0' + LCR_game.cameraMode :
(i == 1 ? '0' + LCR_game.musicOn : ('0' + LCR_audio.on));
LCR_gameSetMenuItemStr(i,LCR_texts[LCR_TEXTS_MAIN_MENU + i],replaceChar);
}
for (int j = 0; j < 5; ++j)
for (int i = 0; i < LCR_MENU_STRING_SIZE - 1; ++i)
{
LCR_game.menu.itemNames[j][i] = LCR_texts[LCR_TEXTS_MAIN_MENU + j][i];
LCR_game.menu.itemNames[j][i + 1] = 0;
}
LCR_game.menu.itemCount = 4;
}
@ -1054,14 +1051,14 @@ void LCR_gameTimeToStr(uint32_t timeMS, char *str)
LCR_gameDrawPopupMessage(void)
{
int textH = LCR_rendererComputeTextHeight(4);
int textW = LCR_rendererComputeTextWidth(LCR_game.popupStr,4);
int textH = LCR_rendererComputeTextHeight(5);
int textW = LCR_rendererComputeTextWidth(LCR_game.popupStr,5);
LCR_rendererDrawRect((LCR_EFFECTIVE_RESOLUTION_X - textW) / 2 - 6,4,
textW + 12,textH + 8,0xffff,1);
LCR_rendererDrawText(LCR_game.popupStr,(LCR_EFFECTIVE_RESOLUTION_X - textW)
/ 2,8,0x0700,4);
/ 2,8,0x0300,5);
}
void LCR_gameDraw3DView(void)
@ -1246,16 +1243,19 @@ void LCR_gameHandleInput(void)
LCR_rendererSetCarVisibility(
LCR_game.cameraMode != LCR_CAMERA_MODE_INSIDE);
LCR_rendererCameraReset();
LCR_gamePopupNumber(LCR_game.cameraMode);
break;
#if LCR_SETTING_MUSIC
case 1:
LCR_game.musicOn = !LCR_game.musicOn;
LCR_gamePopupNumber(LCR_game.musicOn);
break;
#endif
case 2:
LCR_audio.on = !LCR_audio.on;
LCR_gamePopupNumber(LCR_audio.on);
break;
case 4:
@ -1314,12 +1314,8 @@ void LCR_gameHandleInput(void)
LCR_gamePopupMessage("");
}
else
{
LCR_game.popupStr[0] = '0' + LCR_SETTING_COUNTDOWN_SECONDS -
(LCR_game.time - LCR_game.stateStartTime) / 1000;
LCR_game.popupStr[1] = 0;
LCR_gamePopupMessage(LCR_game.popupStr);
}
LCR_gamePopupNumber(LCR_SETTING_COUNTDOWN_SECONDS -
(LCR_game.time - LCR_game.stateStartTime) / 1000);
// fall through
default:

View file

@ -178,7 +178,7 @@
#ifndef LCR_SETTING_COUNTDOWN_SECONDS
/** Run start countdown length in seconds. */
#define LCR_SETTING_COUNTDOWN_SECONDS 3 // for release make 3
#define LCR_SETTING_COUNTDOWN_SECONDS 1 // for release make 3
#endif
#ifndef LCR_SETTING_MAP_CHUNK_RELOAD_INTERVAL