Review: Fix incorrect levelsearch apparatus

- M_LevelListFromGametype: Correctly wipe tutorial status when changing from tutorial to gametype with cups
- G_GetFirstMapOfGametype: Fix tutorial handling, gametype's datatype
- M_InitExtras: to prevent duplicated code, use G_GetFirstMapOfGametype
This commit is contained in:
toaster 2023-11-18 11:44:59 +00:00
parent dc4e14d9d9
commit 1ef427631e
5 changed files with 14 additions and 26 deletions

View file

@ -3358,7 +3358,7 @@ UINT32 G_TOLFlag(INT32 pgametype)
return 0;
}
UINT16 G_GetFirstMapOfGametype(UINT8 pgametype)
UINT16 G_GetFirstMapOfGametype(UINT16 pgametype)
{
UINT8 i = 0;
UINT16 mapnum = NEXTMAP_INVALID;
@ -3368,7 +3368,7 @@ UINT16 G_GetFirstMapOfGametype(UINT8 pgametype)
templevelsearch.typeoflevel = G_TOLFlag(pgametype);
templevelsearch.cupmode = (!(gametypes[pgametype]->rules & GTR_NOCUPSELECT));
templevelsearch.timeattack = false;
templevelsearch.tutorial = false;
templevelsearch.tutorial = (pgametype == GT_TUTORIAL);
templevelsearch.checklocked = true;
if (templevelsearch.cupmode)

View file

@ -280,7 +280,7 @@ FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics);
// Don't split up TOL handling
UINT32 G_TOLFlag(INT32 pgametype);
UINT16 G_GetFirstMapOfGametype(UINT8 pgametype);
UINT16 G_GetFirstMapOfGametype(UINT16 pgametype);
UINT16 G_RandMap(UINT32 tolflags, UINT16 pprevmap, boolean ignoreBuffers, boolean callAgainSoon, UINT16 *extBuffer);
void G_AddMapToBuffer(UINT16 map);

View file

@ -90,18 +90,7 @@ void M_InitExtras(INT32 choice)
// Tutorial
{
levelsearch_t templevelsearch;
UINT8 i = 0;
INT16 map;
templevelsearch.cup = NULL;
templevelsearch.typeoflevel = G_TOLFlag(GT_TUTORIAL);
templevelsearch.cupmode = false;
templevelsearch.timeattack = false;
templevelsearch.tutorial = true;
templevelsearch.checklocked = true;
map = M_GetFirstLevelInList(&i, &templevelsearch);
UINT16 map = G_GetFirstMapOfGametype(GT_TUTORIAL);
EXTRAS_Main[extras_tutorial].status = (IT_STRING |
((map == NEXTMAP_INVALID) ? IT_TRANSTEXT : IT_CALL));

View file

@ -110,7 +110,6 @@ void M_MPSetupNetgameMapSelect(INT32 choice)
levellist.netgame = true;
// Make sure we reset those
levellist.levelsearch.timeattack = false;
levellist.levelsearch.tutorial = false;
levellist.levelsearch.checklocked = true;
cupgrid.grandprix = false;

View file

@ -238,6 +238,7 @@ boolean M_LevelListFromGametype(INT16 gt)
{
static boolean first = true;
UINT8 temp = 0;
boolean invalidatedcursor = false;
if (gt != -1)
{
@ -267,6 +268,15 @@ boolean M_LevelListFromGametype(INT16 gt)
}
levellist.levelsearch.cupmode = (!(gametypes[gt]->rules & GTR_NOCUPSELECT));
if (!levellist.levelsearch.cupmode)
{
invalidatedcursor = (
levellist.levelsearch.cup != NULL
|| levellist.levelsearch.tutorial != (gt == GT_TUTORIAL)
);
}
levellist.levelsearch.tutorial = (gt == GT_TUTORIAL);
CV_SetValue(&cv_dummyspbattack, 0);
}
@ -435,16 +445,6 @@ boolean M_LevelListFromGametype(INT16 gt)
// Okay, just a list of maps then.
boolean invalidatedcursor = false;
if (gt != -1)
{
invalidatedcursor = (
levellist.levelsearch.cup != NULL
|| levellist.levelsearch.tutorial != (gt == GT_TUTORIAL)
);
levellist.levelsearch.tutorial = (gt == GT_TUTORIAL);
}
levellist.levelsearch.cup = NULL;
UINT16 test = M_GetFirstLevelInList(&temp, &levellist.levelsearch);