g_game.c: Outside of dedicated, don't visit Courses that aren't menu-selectable

Applies to the following
- G_RandMap
    - Voting
    - Title Demos
    - Challenge Board
    - `advancemap random`
- G_GetNextMap
    - `advancemap next`
        - This was previously completely broken for gametypes other than Race!?
This commit is contained in:
toaster 2024-01-07 21:46:59 +00:00
parent 8f2c8b4a5d
commit cb133da7e2

View file

@ -3434,10 +3434,32 @@ static INT32 TOLMaps(UINT8 pgametype)
continue;
}
if (M_MapLocked(i + 1))
// Only care about restrictions if the host is a listen server.
if (!dedicated)
{
// Don't include locked
continue;
if (!(mapheaderinfo[i]->menuflags & LF2_NOVISITNEEDED)
&& !(mapheaderinfo[i]->records.mapvisited & MV_VISITED)
&& !(
mapheaderinfo[i]->cup
&& mapheaderinfo[i]->cup->cachedlevels[0] == i
))
{
// Not visited OR head of cup
continue;
}
if ((mapheaderinfo[i]->menuflags & LF2_FINISHNEEDED)
&& !(mapheaderinfo[i]->records.mapvisited & MV_BEATEN))
{
// Not completed
continue;
}
if (M_MapLocked(i + 1) == true)
{
// We haven't earned this one.
continue;
}
}
num++;
@ -3519,10 +3541,32 @@ tryAgain:
continue;
}
if (M_MapLocked(i + 1) == true)
// Only care about restrictions if the host is a listen server.
if (!dedicated)
{
// We haven't earned this one.
continue;
if (!(mapheaderinfo[i]->menuflags & LF2_NOVISITNEEDED)
&& !(mapheaderinfo[i]->records.mapvisited & MV_VISITED)
&& !(
mapheaderinfo[i]->cup
&& mapheaderinfo[i]->cup->cachedlevels[0] == i
))
{
// Not visited OR head of cup
continue;
}
if ((mapheaderinfo[i]->menuflags & LF2_FINISHNEEDED)
&& !(mapheaderinfo[i]->records.mapvisited & MV_BEATEN))
{
// Not completed
continue;
}
if (M_MapLocked(i + 1) == true)
{
// We haven't earned this one.
continue;
}
}
if (ignoreBuffers == false)
@ -3957,7 +4001,7 @@ void G_GetNextMap(void)
continue;
}
for (i = 0; i < cup->numlevels; i++)
for (i = 0; i < CUPCACHE_PODIUM; i++)
{
cm = cup->cachedlevels[i];
@ -3965,9 +4009,35 @@ void G_GetNextMap(void)
if (cm >= nummapheaders
|| !mapheaderinfo[cm]
|| mapheaderinfo[cm]->lumpnum == LUMPERROR
|| !(mapheaderinfo[cm]->typeoflevel & tolflag)
|| (!marathonmode && M_MapLocked(cm+1)))
|| !(mapheaderinfo[cm]->typeoflevel & tolflag))
{
continue;
}
// Only care about restrictions if the host is a listen server.
if (!dedicated && !marathonmode)
{
if (!(mapheaderinfo[cm]->menuflags & LF2_NOVISITNEEDED)
&& !(mapheaderinfo[cm]->records.mapvisited & MV_VISITED)
&& i != 0)
{
// Not visited OR head of cup
continue;
}
if ((mapheaderinfo[cm]->menuflags & LF2_FINISHNEEDED)
&& !(mapheaderinfo[cm]->records.mapvisited & MV_BEATEN))
{
// Not completed
continue;
}
if (M_MapLocked(cm + 1) == true)
{
// We haven't earned this one.
continue;
}
}
// If the map is in multiple cups, only consider the first one valid.
if (mapheaderinfo[cm]->cup != cup)
@ -4012,24 +4082,50 @@ void G_GetNextMap(void)
else
{
cm = prevmap;
if (++cm >= nummapheaders)
cm = 0;
while (cm != prevmap)
do
{
if (++cm >= nummapheaders)
cm = 0;
if (!mapheaderinfo[cm]
|| mapheaderinfo[cm]->lumpnum == LUMPERROR
|| !(mapheaderinfo[cm]->typeoflevel & tolflag)
|| (mapheaderinfo[cm]->menuflags & LF2_HIDEINMENU)
|| M_MapLocked(cm+1))
|| (mapheaderinfo[cm]->menuflags & LF2_HIDEINMENU))
{
if (++cm >= nummapheaders)
cm = 0;
continue;
}
// Only care about restrictions if the host is a listen server.
if (!dedicated && !marathonmode)
{
if (!(mapheaderinfo[cm]->menuflags & LF2_NOVISITNEEDED)
&& !(mapheaderinfo[cm]->records.mapvisited & MV_VISITED)
&& !(
mapheaderinfo[cm]->cup
&& mapheaderinfo[cm]->cup->cachedlevels[0] == cm
))
{
// Not visited OR head of cup
continue;
}
if ((mapheaderinfo[cm]->menuflags & LF2_FINISHNEEDED)
&& !(mapheaderinfo[cm]->records.mapvisited & MV_BEATEN))
{
// Not completed
continue;
}
if (M_MapLocked(cm + 1) == true)
{
// We haven't earned this one.
continue;
}
}
break;
}
} while (cm != prevmap);
nextmap = cm;
}