mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-03-01 00:41:16 +00:00
Restart Map/Try Again pause menu entry
Closer to parity with pre-newmenus behaviour. - Clinical term for server admins, colloquial for SP contexts (GP/modeattacking) - Won't show up in GP if you're out of lives - Also fixes lives going negative in K_PlayerLoseLife
This commit is contained in:
parent
0c8c3df6a3
commit
962393f7b9
5 changed files with 82 additions and 6 deletions
|
|
@ -676,7 +676,7 @@ void K_PlayerLoseLife(player_t *player)
|
|||
return;
|
||||
}
|
||||
|
||||
if (player->spectator || player->exiting || player->bot || (player->pflags & PF_LOSTLIFE))
|
||||
if (player->spectator || player->exiting || player->bot || player->lives <= 0 || (player->pflags & PF_LOSTLIFE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -410,6 +410,8 @@ typedef enum
|
|||
{
|
||||
mpause_addons = 0,
|
||||
mpause_switchmap,
|
||||
mpause_restartmap,
|
||||
mpause_tryagain,
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
mpause_discordrequests,
|
||||
#endif
|
||||
|
|
@ -978,6 +980,8 @@ extern consvar_t cv_dummymenuplayer;
|
|||
extern consvar_t cv_dummyspectator;
|
||||
|
||||
// Bunch of funny functions for the pause menu...~
|
||||
void M_RestartMap(INT32 choice); // Restart level (MP)
|
||||
void M_TryAgain(INT32 choice); // Try again (SP)
|
||||
void M_ConfirmSpectate(INT32 choice); // Spectate confirm when you're alone
|
||||
void M_ConfirmEnterGame(INT32 choice); // Enter game confirm when you're alone
|
||||
void M_ConfirmSpectateChange(INT32 choice); // Splitscreen spectate/play menu func
|
||||
|
|
|
|||
|
|
@ -1594,6 +1594,12 @@ menuitem_t PAUSE_Main[] =
|
|||
{IT_STRING | IT_SUBMENU, "CHANGE MAP", "M_ICOMAP",
|
||||
NULL, {.submenu = &PAUSE_GamemodesDef}, 0, 0},
|
||||
|
||||
{IT_STRING | IT_CALL, "RESTART MAP", "M_ICORE",
|
||||
NULL, {.routine = M_RestartMap}, 0, 0},
|
||||
|
||||
{IT_STRING | IT_CALL, "TRY AGAIN", "M_ICORE",
|
||||
NULL, {.routine = M_TryAgain}, 0, 0},
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
{IT_STRING | IT_CALL, "DISCORD REQUESTS", "M_ICODIS",
|
||||
NULL, {NULL}, 0, 0},
|
||||
|
|
|
|||
|
|
@ -3659,19 +3659,29 @@ void M_DrawPause(void)
|
|||
{
|
||||
case IT_STRING:
|
||||
{
|
||||
|
||||
char iconame[9]; // 8 chars + \0
|
||||
patch_t *pp;
|
||||
|
||||
if (i == itemOn)
|
||||
{
|
||||
strcpy(iconame, currentMenu->menuitems[i].tooltip);
|
||||
iconame[7] = '2'; // Yes this is a stupid hack. Replace the last character with a 2 when we're selecting this graphic.
|
||||
if (i == mpause_restartmap || i == mpause_tryagain)
|
||||
{
|
||||
pp = W_CachePatchName(
|
||||
va("M_ICOR2%c", ('A'+(pausemenu.ticker & 1))),
|
||||
PU_CACHE);
|
||||
}
|
||||
else
|
||||
{
|
||||
char iconame[9]; // 8 chars + \0
|
||||
strcpy(iconame, currentMenu->menuitems[i].tooltip);
|
||||
iconame[7] = '2'; // Yes this is a stupid hack. Replace the last character with a 2 when we're selecting this graphic.
|
||||
|
||||
pp = W_CachePatchName(iconame, PU_CACHE);
|
||||
pp = W_CachePatchName(iconame, PU_CACHE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pp = W_CachePatchName(currentMenu->menuitems[i].tooltip, PU_CACHE);
|
||||
}
|
||||
|
||||
// 294 - 261 = 33
|
||||
// We need to move 33 px in 50 tics which means we move 33/50 = 0.66 px every tic = 2/3 of the offset.
|
||||
|
|
|
|||
|
|
@ -5870,6 +5870,8 @@ struct pausemenu_s pausemenu;
|
|||
// Pause menu!
|
||||
void M_OpenPauseMenu(void)
|
||||
{
|
||||
INT32 i = 0;
|
||||
|
||||
currentMenu = &PAUSE_MainDef;
|
||||
|
||||
// Ready the variables
|
||||
|
|
@ -5886,6 +5888,8 @@ void M_OpenPauseMenu(void)
|
|||
|
||||
PAUSE_Main[mpause_addons].status = IT_DISABLED;
|
||||
PAUSE_Main[mpause_switchmap].status = IT_DISABLED;
|
||||
PAUSE_Main[mpause_restartmap].status = IT_DISABLED;
|
||||
PAUSE_Main[mpause_tryagain].status = IT_DISABLED;
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
PAUSE_Main[mpause_discordrequests].status = IT_DISABLED;
|
||||
#endif
|
||||
|
|
@ -5905,9 +5909,29 @@ void M_OpenPauseMenu(void)
|
|||
if (server || IsPlayerAdmin(consoleplayer))
|
||||
{
|
||||
PAUSE_Main[mpause_switchmap].status = IT_STRING | IT_SUBMENU;
|
||||
PAUSE_Main[mpause_restartmap].status = IT_STRING | IT_CALL;
|
||||
PAUSE_Main[mpause_addons].status = IT_STRING | IT_CALL;
|
||||
}
|
||||
}
|
||||
else if (!netgame && !demo.playback)
|
||||
{
|
||||
boolean retryallowed = (modeattacking != ATTACKING_NONE);
|
||||
if (G_GametypeUsesLives())
|
||||
{
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (players[g_localplayers[i]].lives <= 1)
|
||||
continue;
|
||||
retryallowed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (retryallowed)
|
||||
{
|
||||
PAUSE_Main[mpause_tryagain].status = IT_STRING | IT_CALL;
|
||||
}
|
||||
}
|
||||
|
||||
if (G_GametypeHasSpectators())
|
||||
{
|
||||
|
|
@ -5936,6 +5960,7 @@ void M_QuitPauseMenu(INT32 choice)
|
|||
void M_PauseTick(void)
|
||||
{
|
||||
pausemenu.offset /= 2;
|
||||
pausemenu.ticker++;
|
||||
|
||||
if (pausemenu.closing)
|
||||
{
|
||||
|
|
@ -5984,6 +6009,37 @@ boolean M_PauseInputs(INT32 ch)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Restart map
|
||||
void M_RestartMap(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
M_ClearMenus(false);
|
||||
COM_ImmedExecute("restartlevel");
|
||||
}
|
||||
|
||||
// Try again
|
||||
void M_TryAgain(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
if (demo.playback)
|
||||
return;
|
||||
|
||||
if (netgame || !Playing()) // Should never happen!
|
||||
return;
|
||||
|
||||
M_ClearMenus(false);
|
||||
|
||||
if (modeattacking != ATTACKING_NONE)
|
||||
{
|
||||
G_CheckDemoStatus(); // Cancel recording
|
||||
M_StartTimeAttack(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
G_SetRetryFlag();
|
||||
}
|
||||
}
|
||||
|
||||
// Pause spectate / join functions
|
||||
void M_ConfirmSpectate(INT32 choice)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue