Merge branch 'cup-preview-final' into 'master'

Show Prison Break in GP cup preview

See merge request KartKrew/Kart!2251
This commit is contained in:
Sal 2024-04-10 00:57:21 +00:00
commit 5cec579f50
8 changed files with 26 additions and 19 deletions

View file

@ -3558,6 +3558,7 @@ UINT16 G_GetFirstMapOfGametype(UINT16 pgametype)
templevelsearch.typeoflevel = G_TOLFlag(pgametype); templevelsearch.typeoflevel = G_TOLFlag(pgametype);
templevelsearch.cupmode = (!(gametypes[pgametype]->rules & GTR_NOCUPSELECT)); templevelsearch.cupmode = (!(gametypes[pgametype]->rules & GTR_NOCUPSELECT));
templevelsearch.timeattack = false; templevelsearch.timeattack = false;
templevelsearch.grandprix = false;
templevelsearch.tutorial = (pgametype == GT_TUTORIAL); templevelsearch.tutorial = (pgametype == GT_TUTORIAL);
templevelsearch.checklocked = true; templevelsearch.checklocked = true;

View file

@ -863,7 +863,6 @@ extern struct cupgrid_s {
size_t numpages; size_t numpages;
size_t cappages; size_t cappages;
tic_t previewanim; tic_t previewanim;
boolean grandprix; // Setup grand prix server after picking
boolean cache_secondrowlocked; boolean cache_secondrowlocked;
} cupgrid; } cupgrid;
@ -872,6 +871,7 @@ typedef struct levelsearch_s {
cupheader_t *cup; cupheader_t *cup;
boolean timeattack; boolean timeattack;
boolean tutorial; boolean tutorial;
boolean grandprix;
boolean cupmode; boolean cupmode;
boolean checklocked; boolean checklocked;
} levelsearch_t; } levelsearch_t;

View file

@ -3222,7 +3222,7 @@ void M_DrawCupSelect(void)
if (cupgrid.cache_secondrowlocked == true) if (cupgrid.cache_secondrowlocked == true)
y += 28; y += 28;
const boolean isGP = (cupgrid.grandprix && (cv_dummygpdifficulty.value >= 0 && cv_dummygpdifficulty.value < KARTGP_MAX)); const boolean isGP = (templevelsearch.grandprix && (cv_dummygpdifficulty.value >= 0 && cv_dummygpdifficulty.value < KARTGP_MAX));
if (isGP) if (isGP)
{ {
windata = &templevelsearch.cup->windata[cv_dummygpdifficulty.value]; windata = &templevelsearch.cup->windata[cv_dummygpdifficulty.value];
@ -3236,7 +3236,7 @@ void M_DrawCupSelect(void)
windata ? windata->best_placement : 0 windata ? windata->best_placement : 0
); );
if (cupgrid.grandprix == true if (templevelsearch.grandprix == true
&& templevelsearch.cup == cupsavedata.cup && templevelsearch.cup == cupsavedata.cup
&& id != CUPMENU_CURSORID) && id != CUPMENU_CURSORID)
{ {
@ -3284,7 +3284,7 @@ void M_DrawCupSelect(void)
templevelsearch.cup = cupgrid.builtgrid[CUPMENU_CURSORID]; templevelsearch.cup = cupgrid.builtgrid[CUPMENU_CURSORID];
if (cupgrid.grandprix == true if (templevelsearch.grandprix == true
&& templevelsearch.cup != NULL && templevelsearch.cup != NULL
&& templevelsearch.cup == cupsavedata.cup) && templevelsearch.cup == cupsavedata.cup)
{ {
@ -6982,7 +6982,8 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
break; break;
templevelsearch.cup = temp; templevelsearch.cup = temp;
templevelsearch.typeoflevel = G_TOLFlag(GT_RACE)|G_TOLFlag(GT_BATTLE); templevelsearch.typeoflevel = 0; // doesn't matter...
templevelsearch.grandprix = true; // this will overwrite
templevelsearch.cupmode = true; templevelsearch.cupmode = true;
templevelsearch.timeattack = false; templevelsearch.timeattack = false;
templevelsearch.tutorial = false; templevelsearch.tutorial = false;

View file

@ -639,7 +639,7 @@ menu_t *M_SpecificMenuRestore(menu_t *torestore)
if (levellist.newgametype == GT_RACE) if (levellist.newgametype == GT_RACE)
{ {
M_SetupRaceMenu(-1); M_SetupRaceMenu(-1);
M_SetupDifficultyOptions((cupgrid.grandprix == false)); M_SetupDifficultyOptions((levellist.levelsearch.grandprix == false));
} }
} }

View file

@ -1254,7 +1254,7 @@ void M_GonerTutorial(INT32 choice)
// Please also see M_LevelSelectInit as called in extras-1.c // Please also see M_LevelSelectInit as called in extras-1.c
levellist.netgame = false; levellist.netgame = false;
levellist.levelsearch.checklocked = true; levellist.levelsearch.checklocked = true;
cupgrid.grandprix = false; levellist.levelsearch.grandprix = false;
levellist.levelsearch.timeattack = false; levellist.levelsearch.timeattack = false;
if (!M_LevelListFromGametype(GT_TUTORIAL) && gamedata->gonerlevel < GDGONER_OUTRO) if (!M_LevelListFromGametype(GT_TUTORIAL) && gamedata->gonerlevel < GDGONER_OUTRO)

View file

@ -175,7 +175,7 @@ void M_MPSetupNetgameMapSelect(INT32 choice)
// Make sure we reset those // Make sure we reset those
levellist.levelsearch.timeattack = false; levellist.levelsearch.timeattack = false;
levellist.levelsearch.checklocked = true; levellist.levelsearch.checklocked = true;
cupgrid.grandprix = false; levellist.levelsearch.grandprix = false;
// 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;

View file

@ -289,7 +289,7 @@ void M_CupSelectHandler(INT32 choice)
if (count == 0 if (count == 0
|| ( || (
cupgrid.grandprix == true levellist.levelsearch.grandprix == true
&& newcup->cachedlevels[0] == NEXTMAP_INVALID && newcup->cachedlevels[0] == NEXTMAP_INVALID
) )
) )
@ -298,7 +298,7 @@ void M_CupSelectHandler(INT32 choice)
return; return;
} }
if (cupgrid.grandprix == true) if (levellist.levelsearch.grandprix == true)
{ {
if (newcup == cupsavedata.cup if (newcup == cupsavedata.cup
&& FIL_FileExists(gpbackup)) && FIL_FileExists(gpbackup))

View file

@ -76,7 +76,9 @@ boolean M_CanShowLevelInList(INT16 mapnum, levelsearch_t *levelsearch)
return false; return false;
// Check for TOL (permits TEST RUN outside of time attack) // Check for TOL (permits TEST RUN outside of time attack)
if ((levelsearch->timeattack || levelsearch->tutorial || mapheaderinfo[mapnum]->typeoflevel) // (grand prix can contain anything, we limit in a different way)
if (levelsearch->grandprix == false
&& (levelsearch->timeattack || levelsearch->tutorial || mapheaderinfo[mapnum]->typeoflevel)
&& !(mapheaderinfo[mapnum]->typeoflevel & levelsearch->typeoflevel)) && !(mapheaderinfo[mapnum]->typeoflevel & levelsearch->typeoflevel))
return false; return false;
@ -133,7 +135,8 @@ UINT16 M_CountLevelsToShowInList(levelsearch_t *levelsearch)
if (levelsearch->checklocked && M_CupLocked(levelsearch->cup)) if (levelsearch->checklocked && M_CupLocked(levelsearch->cup))
return 0; return 0;
for (i = 0; i < CUPCACHE_PODIUM; i++) const INT16 limit = (levelsearch->grandprix ? CUPCACHE_SPECIAL : CUPCACHE_PODIUM);
for (i = 0; i < limit; i++)
{ {
if (!M_CanShowLevelInList(levelsearch->cup->cachedlevels[i], levelsearch)) if (!M_CanShowLevelInList(levelsearch->cup->cachedlevels[i], levelsearch))
continue; continue;
@ -170,7 +173,8 @@ UINT16 M_GetFirstLevelInList(UINT8 *i, levelsearch_t *levelsearch)
*i = 0; *i = 0;
mapnum = NEXTMAP_INVALID; mapnum = NEXTMAP_INVALID;
for (; *i < CUPCACHE_PODIUM; (*i)++) const INT16 limit = (levelsearch->grandprix ? CUPCACHE_SPECIAL : CUPCACHE_PODIUM);
for (; *i < limit; (*i)++)
{ {
if (!M_CanShowLevelInList(levelsearch->cup->cachedlevels[*i], levelsearch)) if (!M_CanShowLevelInList(levelsearch->cup->cachedlevels[*i], levelsearch))
continue; continue;
@ -200,7 +204,8 @@ UINT16 M_GetNextLevelInList(UINT16 mapnum, UINT8 *i, levelsearch_t *levelsearch)
{ {
mapnum = NEXTMAP_INVALID; mapnum = NEXTMAP_INVALID;
(*i)++; (*i)++;
for (; *i < CUPCACHE_PODIUM; (*i)++) const INT16 limit = (levelsearch->grandprix ? CUPCACHE_SPECIAL : CUPCACHE_PODIUM);
for (; *i < limit; (*i)++)
{ {
if (!M_CanShowLevelInList(levelsearch->cup->cachedlevels[*i], levelsearch)) if (!M_CanShowLevelInList(levelsearch->cup->cachedlevels[*i], levelsearch))
continue; continue;
@ -357,7 +362,7 @@ boolean M_LevelListFromGametype(INT16 gt)
size_t deltaid = 0; size_t deltaid = 0;
G_GetBackupCupData( G_GetBackupCupData(
cupgrid.grandprix == true templevelsearch.grandprix == true
&& cv_splitplayers.value <= 1 && cv_splitplayers.value <= 1
); );
@ -436,7 +441,7 @@ boolean M_LevelListFromGametype(INT16 gt)
} }
size_t olddelta = deltaid; size_t olddelta = deltaid;
if (cupgrid.grandprix == false) if (templevelsearch.grandprix == false)
{ {
cupheader_t *restore = templevelsearch.cup; cupheader_t *restore = templevelsearch.cup;
@ -646,15 +651,15 @@ void M_LevelSelectInit(INT32 choice)
switch (currentMenu->menuitems[itemOn].mvar1) switch (currentMenu->menuitems[itemOn].mvar1)
{ {
case 0: case 0:
cupgrid.grandprix = false; levellist.levelsearch.grandprix = false;
levellist.levelsearch.timeattack = false; levellist.levelsearch.timeattack = false;
break; break;
case 1: case 1:
cupgrid.grandprix = false; levellist.levelsearch.grandprix = false;
levellist.levelsearch.timeattack = true; levellist.levelsearch.timeattack = true;
break; break;
case 2: case 2:
cupgrid.grandprix = true; levellist.levelsearch.grandprix = true;
levellist.levelsearch.timeattack = false; levellist.levelsearch.timeattack = false;
break; break;
default: default: