"Give up" pause menu option

Shows up in GP for any eventmode
Skips to the next stage in the queue
This commit is contained in:
toaster 2023-11-16 21:12:25 +00:00
parent 97996d1a22
commit 9f05c199c2
2 changed files with 62 additions and 10 deletions

View file

@ -451,6 +451,8 @@ typedef enum
#endif #endif
mpause_admin, mpause_admin,
mpause_callvote, mpause_callvote,
mpause_giveup,
mpause_restartmap, mpause_restartmap,
mpause_tryagain, mpause_tryagain,
@ -1104,6 +1106,7 @@ extern consvar_t cv_dummyspectator;
// Bunch of funny functions for the pause menu...~ // Bunch of funny functions for the pause menu...~
void M_RestartMap(INT32 choice); // Restart level (MP) void M_RestartMap(INT32 choice); // Restart level (MP)
void M_TryAgain(INT32 choice); // Try again (SP) void M_TryAgain(INT32 choice); // Try again (SP)
void M_GiveUp(INT32 choice); // Give up (SP)
void M_ConfirmSpectate(INT32 choice); // Spectate confirm when you're alone 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_ConfirmEnterGame(INT32 choice); // Enter game confirm when you're alone
void M_ConfirmSpectateChange(INT32 choice); // Splitscreen spectate/play menu func void M_ConfirmSpectateChange(INT32 choice); // Splitscreen spectate/play menu func

View file

@ -40,6 +40,9 @@ menuitem_t PAUSE_Main[] =
{IT_STRING | IT_ARROWS, "CALL VOTE", "M_ICOVOT", {IT_STRING | IT_ARROWS, "CALL VOTE", "M_ICOVOT",
NULL, {.routine = M_HandlePauseMenuCallVote}, 0, 0}, NULL, {.routine = M_HandlePauseMenuCallVote}, 0, 0},
{IT_STRING | IT_CALL, "GIVE UP", "M_ICOGUP",
NULL, {.routine = M_GiveUp}, 0, 0},
{IT_STRING | IT_CALL, "RESTART MAP", "M_ICORE", {IT_STRING | IT_CALL, "RESTART MAP", "M_ICORE",
NULL, {.routine = M_RestartMap}, 0, 0}, NULL, {.routine = M_RestartMap}, 0, 0},
@ -130,6 +133,8 @@ void M_OpenPauseMenu(void)
#ifdef HAVE_DISCORDRPC #ifdef HAVE_DISCORDRPC
PAUSE_Main[mpause_discordrequests].status = IT_DISABLED; PAUSE_Main[mpause_discordrequests].status = IT_DISABLED;
#endif #endif
PAUSE_Main[mpause_giveup].status = IT_DISABLED;
PAUSE_Main[mpause_restartmap].status = IT_DISABLED; PAUSE_Main[mpause_restartmap].status = IT_DISABLED;
PAUSE_Main[mpause_tryagain].status = IT_DISABLED; PAUSE_Main[mpause_tryagain].status = IT_DISABLED;
@ -172,19 +177,29 @@ void M_OpenPauseMenu(void)
} }
else if (!netgame && !demo.playback) else if (!netgame && !demo.playback)
{ {
boolean retryallowed = (modeattacking != ATTACKING_NONE || gametype == GT_TUTORIAL); boolean retryallowed = (modeattacking != ATTACKING_NONE);
if ( boolean giveup = (
retryallowed == false grandprixinfo.gp == true
&& gamestate == GS_LEVEL && grandprixinfo.eventmode != GPEVENT_NONE
&& G_GametypeUsesLives() && roundqueue.size != 0
) );
{ {
for (i = 0; i <= splitscreen; i++) if (gamestate == GS_LEVEL && !retryallowed)
{
if (gametype == GT_TUTORIAL)
{ {
if (players[g_localplayers[i]].lives <= 1)
continue;
retryallowed = true; retryallowed = true;
break; }
else if (G_GametypeUsesLives())
{
for (i = 0; i <= splitscreen; i++)
{
if (players[g_localplayers[i]].lives <= 1)
continue;
retryallowed = true;
break;
}
} }
} }
@ -192,6 +207,11 @@ void M_OpenPauseMenu(void)
{ {
PAUSE_Main[mpause_tryagain].status = IT_STRING | IT_CALL; PAUSE_Main[mpause_tryagain].status = IT_STRING | IT_CALL;
} }
if (giveup)
{
PAUSE_Main[mpause_giveup].status = IT_STRING | IT_CALL;
}
} }
if (netgame) // && (PAUSE_Main[mpause_admin].status == IT_DISABLED)) if (netgame) // && (PAUSE_Main[mpause_admin].status == IT_DISABLED))
@ -398,6 +418,35 @@ void M_TryAgain(INT32 choice)
} }
} }
static void M_GiveUpResponse(INT32 ch)
{
if (ch != MA_YES)
return;
if (exitcountdown != 1)
{
G_BeginLevelExit();
exitcountdown = 1;
if (server)
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
}
M_ClearMenus(false);
}
void M_GiveUp(INT32 choice)
{
(void)choice;
if (demo.playback)
return;
if (!Playing())
return;
M_StartMessage("Give up", M_GetText("Are you sure you want to\ngive up on this challenge?\n"), &M_GiveUpResponse, MM_YESNO, NULL, NULL);
}
// Pause spectate / join functions // Pause spectate / join functions
void M_ConfirmSpectate(INT32 choice) void M_ConfirmSpectate(INT32 choice)
{ {