Use more popups
This commit is contained in:
parent
f44204ce26
commit
d794784bab
4 changed files with 28 additions and 32 deletions
46
game.h
46
game.h
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue