mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-02 13:12:50 +00:00
Improve M_HandlePauseMenuGametype and M_HandleHostMenuGametype
Simplify massively by using IT_ARROWS
This commit is contained in:
parent
8a4cca8518
commit
721d5d9da9
4 changed files with 27 additions and 49 deletions
|
|
@ -3065,7 +3065,7 @@ void M_DrawMPHost(void)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case IT_KEYHANDLER:
|
||||
case IT_ARROWS:
|
||||
{
|
||||
if (currentMenu->menuitems[i].itemaction.routine != M_HandleHostMenuGametype)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ void M_MPOptSelectInit(INT32 choice)
|
|||
memcpy(&mpmenu.modewinextend, &arrcpy, sizeof(mpmenu.modewinextend));
|
||||
|
||||
// Guarantee menugametype is good
|
||||
M_NextMenuGametype(forbidden);
|
||||
M_PrevMenuGametype(forbidden);
|
||||
M_NextMenuGametype(forbidden);
|
||||
|
||||
if (choice != -1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ menuitem_t PLAY_MP_Host[] =
|
|||
{IT_STRING | IT_CVAR, "Max. Players", "Set how many players can play at once. Others will spectate.",
|
||||
NULL, {.cvar = &cv_maxplayers}, 0, 0},
|
||||
|
||||
{IT_STRING | IT_KEYHANDLER, "Gamemode", "Choose the type of play on your server.",
|
||||
{IT_STRING | IT_ARROWS, "Gamemode", "Choose the type of play on your server.",
|
||||
NULL, {.routine = M_HandleHostMenuGametype}, 0, 0},
|
||||
|
||||
{IT_STRING | IT_CALL, "GO", "Select a map with the currently selected gamemode",
|
||||
|
|
@ -54,41 +54,21 @@ void M_MPHostInit(INT32 choice)
|
|||
|
||||
void M_HandleHostMenuGametype(INT32 choice)
|
||||
{
|
||||
const UINT8 pid = 0;
|
||||
const UINT32 forbidden = GTR_FORBIDMP;
|
||||
|
||||
(void)choice;
|
||||
|
||||
if (M_MenuBackPressed(pid))
|
||||
{
|
||||
M_GoBack(0);
|
||||
M_SetMenuDelay(pid);
|
||||
return;
|
||||
}
|
||||
else if (menucmd[pid].dpad_lr > 0 || M_MenuConfirmPressed(pid))
|
||||
if (choice > 0)
|
||||
{
|
||||
M_NextMenuGametype(forbidden);
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
M_SetMenuDelay(pid);
|
||||
}
|
||||
else if (menucmd[pid].dpad_lr < 0)
|
||||
else if (choice == -1)
|
||||
{
|
||||
menugametype = GT_RACE;
|
||||
M_PrevMenuGametype(forbidden);
|
||||
M_NextMenuGametype(forbidden);
|
||||
}
|
||||
else
|
||||
{
|
||||
M_PrevMenuGametype(forbidden);
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
M_SetMenuDelay(pid);
|
||||
}
|
||||
|
||||
if (menucmd[pid].dpad_ud > 0)
|
||||
{
|
||||
M_NextOpt();
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
M_SetMenuDelay(pid);
|
||||
}
|
||||
else if (menucmd[pid].dpad_ud < 0)
|
||||
{
|
||||
M_PrevOpt();
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
M_SetMenuDelay(pid);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ menuitem_t PAUSE_Main[] =
|
|||
{IT_STRING | IT_CALL, "STEREO MODE", "M_ICOSTM",
|
||||
NULL, {.routine = M_SoundTest}, 0, 0},
|
||||
|
||||
{IT_STRING | IT_KEYHANDLER, "GAMETYPE", "M_ICOGAM",
|
||||
{IT_STRING | IT_ARROWS, "GAMETYPE", "M_ICOGAM",
|
||||
NULL, {.routine = M_HandlePauseMenuGametype}, 0, 0},
|
||||
|
||||
{IT_STRING | IT_CALL, "CHANGE MAP", "M_ICOMAP",
|
||||
|
|
@ -71,7 +71,7 @@ menu_t PAUSE_MainDef = {
|
|||
PAUSE_Main,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0,
|
||||
MBF_SOUNDLESS,
|
||||
NULL,
|
||||
1, 10, // For transition with some menus!
|
||||
M_DrawPause,
|
||||
|
|
@ -146,7 +146,7 @@ void M_OpenPauseMenu(void)
|
|||
|
||||
if (server || IsPlayerAdmin(consoleplayer))
|
||||
{
|
||||
PAUSE_Main[mpause_changegametype].status = IT_STRING | IT_KEYHANDLER;
|
||||
PAUSE_Main[mpause_changegametype].status = IT_STRING | IT_ARROWS;
|
||||
menugametype = gametype;
|
||||
|
||||
PAUSE_Main[mpause_switchmap].status = IT_STRING | IT_CALL;
|
||||
|
|
@ -267,12 +267,9 @@ boolean M_PauseInputs(INT32 ch)
|
|||
// Change gametype
|
||||
void M_HandlePauseMenuGametype(INT32 choice)
|
||||
{
|
||||
const UINT8 pid = 0;
|
||||
const UINT32 forbidden = GTR_FORBIDMP;
|
||||
|
||||
(void)choice;
|
||||
|
||||
if (M_MenuConfirmPressed(pid))
|
||||
if (choice == 2)
|
||||
{
|
||||
if (menugametype != gametype)
|
||||
{
|
||||
|
|
@ -281,26 +278,27 @@ void M_HandlePauseMenuGametype(INT32 choice)
|
|||
return;
|
||||
}
|
||||
|
||||
M_SetMenuDelay(pid);
|
||||
S_StartSound(NULL, sfx_s3k7b);
|
||||
|
||||
return;
|
||||
}
|
||||
else if (M_MenuExtraPressed(pid))
|
||||
|
||||
if (choice == -1)
|
||||
{
|
||||
menugametype = gametype;
|
||||
M_SetMenuDelay(pid);
|
||||
S_StartSound(NULL, sfx_s3k7b);
|
||||
return;
|
||||
}
|
||||
else if (menucmd[pid].dpad_lr > 0)
|
||||
{
|
||||
M_NextMenuGametype(forbidden);
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
M_SetMenuDelay(pid);
|
||||
}
|
||||
else if (menucmd[pid].dpad_lr < 0)
|
||||
|
||||
if (choice == 0)
|
||||
{
|
||||
M_PrevMenuGametype(forbidden);
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
M_SetMenuDelay(pid);
|
||||
}
|
||||
else
|
||||
{
|
||||
M_NextMenuGametype(forbidden);
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue