mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-28 04:51:42 +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;
|
break;
|
||||||
}
|
}
|
||||||
case IT_KEYHANDLER:
|
case IT_ARROWS:
|
||||||
{
|
{
|
||||||
if (currentMenu->menuitems[i].itemaction.routine != M_HandleHostMenuGametype)
|
if (currentMenu->menuitems[i].itemaction.routine != M_HandleHostMenuGametype)
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -80,8 +80,8 @@ void M_MPOptSelectInit(INT32 choice)
|
||||||
memcpy(&mpmenu.modewinextend, &arrcpy, sizeof(mpmenu.modewinextend));
|
memcpy(&mpmenu.modewinextend, &arrcpy, sizeof(mpmenu.modewinextend));
|
||||||
|
|
||||||
// Guarantee menugametype is good
|
// Guarantee menugametype is good
|
||||||
M_NextMenuGametype(forbidden);
|
|
||||||
M_PrevMenuGametype(forbidden);
|
M_PrevMenuGametype(forbidden);
|
||||||
|
M_NextMenuGametype(forbidden);
|
||||||
|
|
||||||
if (choice != -1)
|
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.",
|
{IT_STRING | IT_CVAR, "Max. Players", "Set how many players can play at once. Others will spectate.",
|
||||||
NULL, {.cvar = &cv_maxplayers}, 0, 0},
|
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},
|
NULL, {.routine = M_HandleHostMenuGametype}, 0, 0},
|
||||||
|
|
||||||
{IT_STRING | IT_CALL, "GO", "Select a map with the currently selected gamemode",
|
{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)
|
void M_HandleHostMenuGametype(INT32 choice)
|
||||||
{
|
{
|
||||||
const UINT8 pid = 0;
|
|
||||||
const UINT32 forbidden = GTR_FORBIDMP;
|
const UINT32 forbidden = GTR_FORBIDMP;
|
||||||
|
|
||||||
(void)choice;
|
if (choice > 0)
|
||||||
|
|
||||||
if (M_MenuBackPressed(pid))
|
|
||||||
{
|
|
||||||
M_GoBack(0);
|
|
||||||
M_SetMenuDelay(pid);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (menucmd[pid].dpad_lr > 0 || M_MenuConfirmPressed(pid))
|
|
||||||
{
|
{
|
||||||
M_NextMenuGametype(forbidden);
|
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);
|
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",
|
{IT_STRING | IT_CALL, "STEREO MODE", "M_ICOSTM",
|
||||||
NULL, {.routine = M_SoundTest}, 0, 0},
|
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},
|
NULL, {.routine = M_HandlePauseMenuGametype}, 0, 0},
|
||||||
|
|
||||||
{IT_STRING | IT_CALL, "CHANGE MAP", "M_ICOMAP",
|
{IT_STRING | IT_CALL, "CHANGE MAP", "M_ICOMAP",
|
||||||
|
|
@ -71,7 +71,7 @@ menu_t PAUSE_MainDef = {
|
||||||
PAUSE_Main,
|
PAUSE_Main,
|
||||||
0, 0,
|
0, 0,
|
||||||
0, 0,
|
0, 0,
|
||||||
0,
|
MBF_SOUNDLESS,
|
||||||
NULL,
|
NULL,
|
||||||
1, 10, // For transition with some menus!
|
1, 10, // For transition with some menus!
|
||||||
M_DrawPause,
|
M_DrawPause,
|
||||||
|
|
@ -146,7 +146,7 @@ void M_OpenPauseMenu(void)
|
||||||
|
|
||||||
if (server || IsPlayerAdmin(consoleplayer))
|
if (server || IsPlayerAdmin(consoleplayer))
|
||||||
{
|
{
|
||||||
PAUSE_Main[mpause_changegametype].status = IT_STRING | IT_KEYHANDLER;
|
PAUSE_Main[mpause_changegametype].status = IT_STRING | IT_ARROWS;
|
||||||
menugametype = gametype;
|
menugametype = gametype;
|
||||||
|
|
||||||
PAUSE_Main[mpause_switchmap].status = IT_STRING | IT_CALL;
|
PAUSE_Main[mpause_switchmap].status = IT_STRING | IT_CALL;
|
||||||
|
|
@ -267,12 +267,9 @@ boolean M_PauseInputs(INT32 ch)
|
||||||
// Change gametype
|
// Change gametype
|
||||||
void M_HandlePauseMenuGametype(INT32 choice)
|
void M_HandlePauseMenuGametype(INT32 choice)
|
||||||
{
|
{
|
||||||
const UINT8 pid = 0;
|
|
||||||
const UINT32 forbidden = GTR_FORBIDMP;
|
const UINT32 forbidden = GTR_FORBIDMP;
|
||||||
|
|
||||||
(void)choice;
|
if (choice == 2)
|
||||||
|
|
||||||
if (M_MenuConfirmPressed(pid))
|
|
||||||
{
|
{
|
||||||
if (menugametype != gametype)
|
if (menugametype != gametype)
|
||||||
{
|
{
|
||||||
|
|
@ -281,26 +278,27 @@ void M_HandlePauseMenuGametype(INT32 choice)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
M_SetMenuDelay(pid);
|
|
||||||
S_StartSound(NULL, sfx_s3k7b);
|
S_StartSound(NULL, sfx_s3k7b);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (M_MenuExtraPressed(pid))
|
|
||||||
|
if (choice == -1)
|
||||||
{
|
{
|
||||||
menugametype = gametype;
|
menugametype = gametype;
|
||||||
M_SetMenuDelay(pid);
|
|
||||||
S_StartSound(NULL, sfx_s3k7b);
|
S_StartSound(NULL, sfx_s3k7b);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (menucmd[pid].dpad_lr > 0)
|
|
||||||
{
|
if (choice == 0)
|
||||||
M_NextMenuGametype(forbidden);
|
|
||||||
S_StartSound(NULL, sfx_s3k5b);
|
|
||||||
M_SetMenuDelay(pid);
|
|
||||||
}
|
|
||||||
else if (menucmd[pid].dpad_lr < 0)
|
|
||||||
{
|
{
|
||||||
M_PrevMenuGametype(forbidden);
|
M_PrevMenuGametype(forbidden);
|
||||||
S_StartSound(NULL, sfx_s3k5b);
|
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