mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Fix cup select & level select to both use the new input handling systems
This commit is contained in:
parent
0179466107
commit
a7022af93f
1 changed files with 242 additions and 224 deletions
106
src/k_menufunc.c
106
src/k_menufunc.c
|
|
@ -1163,17 +1163,11 @@ static void M_HandleMenuInput(void)
|
|||
routine = currentMenu->menuitems[itemOn].itemaction;
|
||||
|
||||
// Handle menuitems which need a specific key handling
|
||||
|
||||
/*
|
||||
// NOPE, we need a generic "typing" menu
|
||||
// (sort of like the generic message menu)
|
||||
// so that it can be gamepad friendly.
|
||||
if (routine && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_KEYHANDLER)
|
||||
{
|
||||
routine(-1);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
// TODO: Move this to message menu code
|
||||
if (currentMenu->menuitems[itemOn].status == IT_MSGHANDLER)
|
||||
|
|
@ -2553,6 +2547,9 @@ void M_LevelSelectInit(INT32 choice)
|
|||
void M_CupSelectHandler(INT32 choice)
|
||||
{
|
||||
cupheader_t *newcup = kartcupheaders;
|
||||
const UINT8 pid = 0;
|
||||
|
||||
(void)choice;
|
||||
|
||||
while (newcup)
|
||||
{
|
||||
|
|
@ -2561,9 +2558,8 @@ void M_CupSelectHandler(INT32 choice)
|
|||
newcup = newcup->next;
|
||||
}
|
||||
|
||||
switch (choice)
|
||||
if (menucmd[pid].dpad_lr > 0)
|
||||
{
|
||||
case KEY_RIGHTARROW:
|
||||
cupgrid.x++;
|
||||
if (cupgrid.x >= CUPMENU_COLUMNS)
|
||||
{
|
||||
|
|
@ -2573,8 +2569,10 @@ void M_CupSelectHandler(INT32 choice)
|
|||
cupgrid.pageno = 0;
|
||||
}
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
break;
|
||||
case KEY_LEFTARROW:
|
||||
M_SetMenuDelay(pid);
|
||||
}
|
||||
else if (menucmd[pid].dpad_lr < 0)
|
||||
{
|
||||
cupgrid.x--;
|
||||
if (cupgrid.x < 0)
|
||||
{
|
||||
|
|
@ -2584,24 +2582,34 @@ void M_CupSelectHandler(INT32 choice)
|
|||
cupgrid.pageno = cupgrid.numpages-1;
|
||||
}
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
break;
|
||||
case KEY_UPARROW:
|
||||
M_SetMenuDelay(pid);
|
||||
}
|
||||
|
||||
if (menucmd[pid].dpad_ud > 0)
|
||||
{
|
||||
cupgrid.y++;
|
||||
if (cupgrid.y >= CUPMENU_ROWS)
|
||||
cupgrid.y = 0;
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
break;
|
||||
case KEY_DOWNARROW:
|
||||
M_SetMenuDelay(pid);
|
||||
}
|
||||
else if (menucmd[pid].dpad_ud < 0)
|
||||
{
|
||||
cupgrid.y--;
|
||||
if (cupgrid.y < 0)
|
||||
cupgrid.y = CUPMENU_ROWS-1;
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
break;
|
||||
case KEY_ENTER:
|
||||
M_SetMenuDelay(pid);
|
||||
}
|
||||
|
||||
if (M_MenuButtonPressed(pid, MBT_A) || M_MenuButtonPressed(pid, MBT_X) /*|| M_MenuButtonPressed(pid, MBT_START)*/)
|
||||
{
|
||||
M_SetMenuDelay(pid);
|
||||
|
||||
if ((!newcup) || (newcup && newcup->unlockrequired != -1 && !unlockables[newcup->unlockrequired].unlocked))
|
||||
{
|
||||
S_StartSound(NULL, sfx_s3kb2);
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
if (cupgrid.grandprix == true)
|
||||
|
|
@ -2665,15 +2673,15 @@ void M_CupSelectHandler(INT32 choice)
|
|||
M_SetupNextMenu(&PLAY_LevelSelectDef, false);
|
||||
S_StartSound(NULL, sfx_s3k63);
|
||||
}
|
||||
break;
|
||||
case KEY_ESCAPE:
|
||||
}
|
||||
else if (M_MenuButtonPressed(pid, MBT_B) || M_MenuButtonPressed(pid, MBT_Y))
|
||||
{
|
||||
M_SetMenuDelay(pid);
|
||||
|
||||
if (currentMenu->prevMenu)
|
||||
M_SetupNextMenu(currentMenu->prevMenu, false);
|
||||
else
|
||||
M_ClearMenus(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2686,29 +2694,41 @@ void M_LevelSelectHandler(INT32 choice)
|
|||
{
|
||||
INT16 start = M_GetFirstLevelInList(levellist.newgametype);
|
||||
INT16 maxlevels = M_CountLevelsToShowInList(levellist.newgametype);
|
||||
const UINT8 pid = 0;
|
||||
|
||||
(void)choice;
|
||||
|
||||
if (levellist.y != levellist.dest)
|
||||
return;
|
||||
|
||||
switch (choice)
|
||||
{
|
||||
case KEY_UPARROW:
|
||||
levellist.cursor--;
|
||||
if (levellist.cursor < 0)
|
||||
levellist.cursor = maxlevels-1;
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
break;
|
||||
case KEY_DOWNARROW:
|
||||
return;
|
||||
}
|
||||
|
||||
if (menucmd[pid].dpad_ud > 0)
|
||||
{
|
||||
levellist.cursor++;
|
||||
if (levellist.cursor >= maxlevels)
|
||||
levellist.cursor = 0;
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
break;
|
||||
case KEY_ENTER:
|
||||
M_SetMenuDelay(pid);
|
||||
}
|
||||
else if (menucmd[pid].dpad_ud < 0)
|
||||
{
|
||||
levellist.cursor--;
|
||||
if (levellist.cursor < 0)
|
||||
levellist.cursor = maxlevels-1;
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
M_SetMenuDelay(pid);
|
||||
}
|
||||
|
||||
M_LevelSelectScrollDest();
|
||||
|
||||
if (M_MenuButtonPressed(pid, MBT_A) || M_MenuButtonPressed(pid, MBT_X) /*|| M_MenuButtonPressed(pid, MBT_START)*/)
|
||||
{
|
||||
INT16 map = start;
|
||||
INT16 add = levellist.cursor;
|
||||
|
||||
M_SetMenuDelay(pid);
|
||||
|
||||
while (add > 0)
|
||||
{
|
||||
map++;
|
||||
|
|
@ -2723,7 +2743,10 @@ void M_LevelSelectHandler(INT32 choice)
|
|||
}
|
||||
|
||||
if (map >= NUMMAPS)
|
||||
break;
|
||||
{
|
||||
// This shouldn't happen
|
||||
return;
|
||||
}
|
||||
|
||||
levellist.choosemap = map;
|
||||
|
||||
|
|
@ -2792,18 +2815,15 @@ void M_LevelSelectHandler(INT32 choice)
|
|||
M_ClearMenus(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KEY_ESCAPE:
|
||||
else if (M_MenuButtonPressed(pid, MBT_B) || M_MenuButtonPressed(pid, MBT_Y))
|
||||
{
|
||||
M_SetMenuDelay(pid);
|
||||
|
||||
if (currentMenu->prevMenu)
|
||||
M_SetupNextMenu(currentMenu->prevMenu, false);
|
||||
else
|
||||
M_ClearMenus(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
M_LevelSelectScrollDest();
|
||||
}
|
||||
|
||||
void M_LevelSelectTick(void)
|
||||
|
|
@ -2824,8 +2844,6 @@ void M_LevelSelectTick(void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct mpmenu_s mpmenu;
|
||||
|
||||
// MULTIPLAYER OPTION SELECT
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue