More things use the menu map selection rules

* G_GetFirstMapOfGametype now uses the menu functions instead of repeating the effort
* GTR_NOCUPSELECT - allows gametypes to opt out of cup selection
This commit is contained in:
toaster 2022-12-18 13:57:39 +00:00
parent ed85fb2e79
commit b9f18ffc24
3 changed files with 16 additions and 17 deletions

View file

@ -502,6 +502,8 @@ enum GameTypeRules
GTR_LIVES = 1<<18, // Lives system, players are forced to spectate during Game Over. GTR_LIVES = 1<<18, // Lives system, players are forced to spectate during Game Over.
GTR_SPECIALBOTS = 1<<19, // Bot difficulty gets stronger between rounds, and the rival system is enabled. GTR_SPECIALBOTS = 1<<19, // Bot difficulty gets stronger between rounds, and the rival system is enabled.
GTR_NOCUPSELECT = 1<<20, // Your maps are not selected via cup. ...mutually exclusive with GTR_CAMPAIGN.
// free: to and including 1<<31 // free: to and including 1<<31
}; };

View file

@ -3416,29 +3416,26 @@ UINT32 G_TOLFlag(INT32 pgametype)
INT16 G_GetFirstMapOfGametype(UINT8 pgametype) INT16 G_GetFirstMapOfGametype(UINT8 pgametype)
{ {
UINT8 i = 0;
INT16 mapnum = NEXTMAP_INVALID; INT16 mapnum = NEXTMAP_INVALID;
UINT32 tol = G_TOLFlag(pgametype);
if ((gametypedefaultrules[pgametype] & GTR_CAMPAIGN) && kartcupheaders) levellist.cupmode = (!(gametypedefaultrules[pgametype] & GTR_NOCUPSELECT));
{ levellist.timeattack = false;
mapnum = kartcupheaders->cachedlevels[0];
}
if (mapnum >= nummapheaders) if (levellist.cupmode)
{ {
UINT32 tolflag = G_TOLFlag(pgametype); cupheader_t *cup = kartcupheaders;
for (mapnum = 0; mapnum < nummapheaders; mapnum++) while (cup && mapnum >= nummapheaders)
{ {
if (!mapheaderinfo[mapnum]) mapnum = M_GetFirstLevelInList(&i, tol, cup);
continue; i = 0;
if (mapheaderinfo[mapnum]->lumpnum == LUMPERROR)
continue;
if (!(mapheaderinfo[mapnum]->typeoflevel & tolflag))
continue;
if (mapheaderinfo[mapnum]->menuflags & LF2_HIDEINMENU)
continue;
break;
} }
} }
else
{
mapnum = M_GetFirstLevelInList(&i, tol, NULL);
}
return mapnum; return mapnum;
} }

View file

@ -3475,7 +3475,7 @@ static void M_LevelListFromGametype(INT16 gt)
{ {
levellist.newgametype = gt; levellist.newgametype = gt;
levellist.typeoflevel = G_TOLFlag(gt); levellist.typeoflevel = G_TOLFlag(gt);
levellist.cupmode = true; // todo some way to choose going direct to a long consecutive list..? levellist.cupmode = (!(gametypedefaultrules[gt] & GTR_NOCUPSELECT));
levellist.selectedcup = NULL; levellist.selectedcup = NULL;
first = false; first = false;
} }