First steps to making battle maps cup-based.

* Permit a map existing in multiple cups, rather than I_Error
    - The reason we didn't permit this before was because of marathon plans/advancemap next.
    - To that end, in that progression type, a map is only considered in its first valid cup.
This commit is contained in:
toaster 2022-12-17 19:10:59 +00:00
parent 5ffcfb558f
commit 5f9854e898
3 changed files with 13 additions and 6 deletions

View file

@ -3078,6 +3078,7 @@ void readcupheader(MYFILE *f, cupheader_t *cup)
if (cup->cachedlevels[cup->numlevels] == NEXTMAP_INVALID) if (cup->cachedlevels[cup->numlevels] == NEXTMAP_INVALID)
continue; continue;
mapheaderinfo[cup->cachedlevels[cup->numlevels]]->cup = NULL; mapheaderinfo[cup->cachedlevels[cup->numlevels]]->cup = NULL;
cup->cachedlevels[cup->numlevels] = NEXTMAP_INVALID;
} }
tmp = strtok(word2,","); tmp = strtok(word2,",");
@ -3100,6 +3101,10 @@ void readcupheader(MYFILE *f, cupheader_t *cup)
cup->numbonus--; cup->numbonus--;
Z_Free(cup->levellist[CUPCACHE_BONUS + cup->numbonus]); Z_Free(cup->levellist[CUPCACHE_BONUS + cup->numbonus]);
cup->levellist[CUPCACHE_BONUS + cup->numbonus] = NULL; cup->levellist[CUPCACHE_BONUS + cup->numbonus] = NULL;
if (cup->cachedlevels[CUPCACHE_BONUS + cup->numbonus] == NEXTMAP_INVALID)
continue;
mapheaderinfo[cup->cachedlevels[CUPCACHE_BONUS + cup->numbonus]]->cup = NULL;
cup->cachedlevels[CUPCACHE_BONUS + cup->numbonus] = NEXTMAP_INVALID;
} }
tmp = strtok(word2,","); tmp = strtok(word2,",");

View file

@ -3891,6 +3891,12 @@ static void G_GetNextMap(void)
|| (!marathonmode && M_MapLocked(cm+1))) || (!marathonmode && M_MapLocked(cm+1)))
continue; continue;
// If the map is in multiple cups, only consider the first one valid.
if (mapheaderinfo[cm]->cup != cup)
{
continue;
}
// Grab the first valid after the map you're on // Grab the first valid after the map you're on
if (gettingresult) if (gettingresult)
{ {

View file

@ -7794,13 +7794,9 @@ UINT8 P_InitMapData(boolean existingmapheaders)
if (strcasecmp(cup->levellist[j], name) != 0) if (strcasecmp(cup->levellist[j], name) != 0)
continue; continue;
// Only panic about back-reference for non-bonus material. // Have a map recognise the first cup it's a part of.
if (j < MAXLEVELLIST) if (!mapheaderinfo[i]->cup)
{
if (mapheaderinfo[i]->cup)
I_Error("P_InitMapData: Map %s cannot appear in cups multiple times! (First in %s, now in %s)", name, mapheaderinfo[i]->cup->name, cup->name);
mapheaderinfo[i]->cup = cup; mapheaderinfo[i]->cup = cup;
}
cup->cachedlevels[j] = i; cup->cachedlevels[j] = i;
} }