Skip over locked maps/cups when getting nextmap

(carve out an exception for marathon mode, although we will probably want to lock that behind all cups available)
This commit is contained in:
toaster 2022-09-23 20:52:51 +01:00 committed by GenericHeroGuy
parent 44defb4a86
commit bde16b96a0
2 changed files with 25 additions and 14 deletions

View file

@ -3841,15 +3841,23 @@ static INT16 G_GetNextMap(boolean advancemap)
else
{
UINT32 tolflag = G_TOLFlag(gametype);
register INT16 cm;
if (grandprixinfo.gp == true)
{
register INT16 cm;
cupheader_t *cup = mapheaderinfo[gamemap-1]->cup;
UINT8 gettingresult = 0;
while (cup)
{
// Not unlocked? Grab the next result afterwards
if (!marathonmode && cup->unlockrequired != -1 && !unlockables[cup->unlockrequired].unlocked)
{
cup = cup->next;
gettingresult = 1;
continue;
}
for (i = 0; i < cup->numlevels; i++)
{
cm = cup->cachedlevels[i];
@ -3858,7 +3866,8 @@ static INT16 G_GetNextMap(boolean advancemap)
if (cm >= nummapheaders
|| !mapheaderinfo[cm]
|| mapheaderinfo[cm]->lumpnum == LUMPERROR
|| !(mapheaderinfo[cm]->typeoflevel & tolflag))
|| !(mapheaderinfo[cm]->typeoflevel & tolflag)
|| (!marathonmode && M_MapLocked(cm+1)))
continue;
// Grab the first valid after the map you're on
@ -3904,26 +3913,27 @@ static INT16 G_GetNextMap(boolean advancemap)
}
else
{
i = curmap;
if (++i >= nummapheaders)
i = 0;
cm = curmap;
if (++cm >= nummapheaders)
cm = 0;
while (i != curmap)
while (cm != curmap)
{
if (!mapheaderinfo[i]
|| mapheaderinfo[i]->lumpnum == LUMPERROR
|| !(mapheaderinfo[i]->typeoflevel & tolflag)
|| (mapheaderinfo[i]->menuflags & LF2_HIDEINMENU))
if (!mapheaderinfo[cm]
|| mapheaderinfo[cm]->lumpnum == LUMPERROR
|| !(mapheaderinfo[cm]->typeoflevel & tolflag)
|| (mapheaderinfo[cm]->menuflags & LF2_HIDEINMENU)
|| M_MapLocked(cm+1))
{
if (++i >= nummapheaders)
i = 0;
if (++cm >= nummapheaders)
cm = 0;
continue;
}
break;
}
newmap = i;
newmap = cm;
}
if (advancemap && !marathonmode)

View file

@ -479,7 +479,8 @@ UINT8 M_MapLocked(INT32 mapnum)
if (1)
return false;
#endif
if (!mapnum || mapnum > nummapheaders)
return false;
if (!mapheaderinfo[mapnum-1] || mapheaderinfo[mapnum-1]->unlockrequired < 0)
return false;
if (!unlockables[mapheaderinfo[mapnum-1]->unlockrequired].unlocked)