mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-06 08:02:55 +00:00
Prevent entering the cup or level select if there's no valid maps to pick from.
This commit is contained in:
parent
c857153c29
commit
76ea72ceac
1 changed files with 32 additions and 8 deletions
|
|
@ -3561,7 +3561,7 @@ static void M_LevelSelectScrollDest(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Builds the level list we'll be using from the gametype we're choosing and send us to the apropriate menu.
|
// Builds the level list we'll be using from the gametype we're choosing and send us to the apropriate menu.
|
||||||
static void M_LevelListFromGametype(INT16 gt)
|
static boolean M_LevelListFromGametype(INT16 gt)
|
||||||
{
|
{
|
||||||
static boolean first = true;
|
static boolean first = true;
|
||||||
UINT8 temp = 0;
|
UINT8 temp = 0;
|
||||||
|
|
@ -3588,8 +3588,6 @@ static void M_LevelListFromGametype(INT16 gt)
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PLAY_CupSelectDef.prevMenu = currentMenu;
|
|
||||||
|
|
||||||
// Obviously go to Cup Select in gametypes that have cups.
|
// Obviously go to Cup Select in gametypes that have cups.
|
||||||
// Use a really long level select in gametypes that don't use cups.
|
// Use a really long level select in gametypes that don't use cups.
|
||||||
|
|
||||||
|
|
@ -3598,12 +3596,15 @@ static void M_LevelListFromGametype(INT16 gt)
|
||||||
levelsearch_t templevelsearch = levellist.levelsearch; // full copy
|
levelsearch_t templevelsearch = levellist.levelsearch; // full copy
|
||||||
size_t currentid = 0, highestunlockedid = 0;
|
size_t currentid = 0, highestunlockedid = 0;
|
||||||
const size_t unitlen = sizeof(cupheader_t*) * (CUPMENU_COLUMNS * CUPMENU_ROWS);
|
const size_t unitlen = sizeof(cupheader_t*) * (CUPMENU_COLUMNS * CUPMENU_ROWS);
|
||||||
|
boolean foundany = false;
|
||||||
|
|
||||||
templevelsearch.cup = kartcupheaders;
|
templevelsearch.cup = kartcupheaders;
|
||||||
|
|
||||||
// Make sure there's valid cups before going to this menu.
|
#if 0
|
||||||
|
// Make sure there's valid cups before going to this menu. -- rip sweet prince
|
||||||
if (templevelsearch.cup == NULL)
|
if (templevelsearch.cup == NULL)
|
||||||
I_Error("Can you really call this a racing game, I didn't recieve any Cups on my pillow or anything");
|
I_Error("Can you really call this a racing game, I didn't recieve any Cups on my pillow or anything");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!cupgrid.builtgrid)
|
if (!cupgrid.builtgrid)
|
||||||
{
|
{
|
||||||
|
|
@ -3630,6 +3631,8 @@ static void M_LevelListFromGametype(INT16 gt)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foundany = true;
|
||||||
|
|
||||||
if ((currentid * sizeof(cupheader_t*)) >= cupgrid.cappages * unitlen)
|
if ((currentid * sizeof(cupheader_t*)) >= cupgrid.cappages * unitlen)
|
||||||
{
|
{
|
||||||
// Double the size of the buffer, and clear the other stuff.
|
// Double the size of the buffer, and clear the other stuff.
|
||||||
|
|
@ -3665,16 +3668,29 @@ static void M_LevelListFromGametype(INT16 gt)
|
||||||
templevelsearch.cup = templevelsearch.cup->next;
|
templevelsearch.cup = templevelsearch.cup->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (foundany == false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
cupgrid.numpages = (highestunlockedid / (CUPMENU_COLUMNS * CUPMENU_ROWS)) + 1;
|
cupgrid.numpages = (highestunlockedid / (CUPMENU_COLUMNS * CUPMENU_ROWS)) + 1;
|
||||||
if (cupgrid.pageno >= cupgrid.numpages)
|
if (cupgrid.pageno >= cupgrid.numpages)
|
||||||
{
|
{
|
||||||
cupgrid.pageno = 0;
|
cupgrid.pageno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PLAY_CupSelectDef.prevMenu = currentMenu;
|
||||||
PLAY_LevelSelectDef.prevMenu = &PLAY_CupSelectDef;
|
PLAY_LevelSelectDef.prevMenu = &PLAY_CupSelectDef;
|
||||||
M_SetupNextMenu(&PLAY_CupSelectDef, false);
|
M_SetupNextMenu(&PLAY_CupSelectDef, false);
|
||||||
|
|
||||||
return;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Okay, just a list of maps then.
|
||||||
|
|
||||||
|
if (M_GetFirstLevelInList(&temp, &levellist.levelsearch) == NEXTMAP_INVALID)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset position properly if you go back & forth between gametypes
|
// Reset position properly if you go back & forth between gametypes
|
||||||
|
|
@ -3690,6 +3706,7 @@ static void M_LevelListFromGametype(INT16 gt)
|
||||||
PLAY_LevelSelectDef.prevMenu = currentMenu;
|
PLAY_LevelSelectDef.prevMenu = currentMenu;
|
||||||
M_SetupNextMenu(&PLAY_LevelSelectDef, false);
|
M_SetupNextMenu(&PLAY_LevelSelectDef, false);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init level select for use in local play using the last choice we made.
|
// Init level select for use in local play using the last choice we made.
|
||||||
|
|
@ -3731,7 +3748,11 @@ void M_LevelSelectInit(INT32 choice)
|
||||||
gt = menugametype;
|
gt = menugametype;
|
||||||
}
|
}
|
||||||
|
|
||||||
M_LevelListFromGametype(gt);
|
if (!M_LevelListFromGametype(gt))
|
||||||
|
{
|
||||||
|
S_StartSound(NULL, sfx_s3kb2);
|
||||||
|
M_StartMessage(va("No levels available for\n%s Mode!\n\nPress (B)\n", gametypes[gt]->name), NULL, MM_NOTHING);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M_LevelSelected(INT16 add)
|
static void M_LevelSelected(INT16 add)
|
||||||
|
|
@ -4279,8 +4300,11 @@ void M_MPSetupNetgameMapSelect(INT32 choice)
|
||||||
// okay this is REALLY stupid but this fixes the host menu re-folding on itself when we go back.
|
// okay this is REALLY stupid but this fixes the host menu re-folding on itself when we go back.
|
||||||
mpmenu.modewinextend[0][0] = 1;
|
mpmenu.modewinextend[0][0] = 1;
|
||||||
|
|
||||||
M_LevelListFromGametype(menugametype); // Setup the level select.
|
if (!M_LevelListFromGametype(menugametype))
|
||||||
// (This will also automatically send us to the apropriate menu)
|
{
|
||||||
|
S_StartSound(NULL, sfx_s3kb2);
|
||||||
|
M_StartMessage(va("No levels available for\n%s Mode!\n\nPress (B)\n", gametypes[menugametype]->name), NULL, MM_NOTHING);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MULTIPLAYER JOIN BY IP
|
// MULTIPLAYER JOIN BY IP
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue