Fix problems exposed by a Round Star potentially being the first entry in a Cup

- Don't assume that the first Round in a Cup defines the default gametype for it
    - Now consistently uses GT_RACE
    - It was written this way to try and permit non-Race cups in future...
    - But there are much more solid ways to approach this down the line, instead of overloading this pre-existing data.
- cup-select.c: Don't assume `roundqueue.position == 1` means starting a fresh Cup from scratch
- G_HandleSaveLevel: Allow saving GP backups for overridden Courses at the front of the roundqueue
This commit is contained in:
toaster 2024-03-08 00:24:53 +00:00
parent 161b46f3aa
commit 4aa13105c4
3 changed files with 8 additions and 7 deletions

View file

@ -3841,7 +3841,7 @@ void G_HandleSaveLevel(boolean removecondition)
|| roundqueue.size == 0)
return;
if (roundqueue.position == 1
if ((roundqueue.position == 1 && roundqueue.entries[0].overridden == false)
|| players[consoleplayer].lives <= 1) // because a life is lost on reload
goto doremove;
@ -4144,7 +4144,7 @@ void G_GetNextMap(void)
// Handle primary queue position update.
roundqueue.position++;
if (grandprixinfo.gp == false || gametype == roundqueue.entries[0].gametype)
if (grandprixinfo.gp == false || gametype == GT_RACE) // roundqueue.entries[0].gametype
{
roundqueue.roundnum++;
}

View file

@ -68,8 +68,9 @@ static void M_StartCup(UINT8 entry)
SplitScreen_OnChange();
}
if (entry == 0)
if (entry == UINT8_MAX)
{
entry = 0;
memset(&grandprixinfo, 0, sizeof(struct grandprixinfo));
// read our dummy cvars
@ -116,7 +117,7 @@ static void M_StartCup(UINT8 entry)
}
// Skip Bonus rounds.
if (roundqueue.entries[entry].gametype != roundqueue.entries[0].gametype
if (roundqueue.entries[entry].gametype != GT_RACE // roundqueue.entries[0].gametype
&& roundqueue.entries[entry].rankrestricted == false)
{
G_GetNextMap(); // updates position in the roundqueue
@ -187,7 +188,7 @@ static void M_GPBackup(INT32 choice)
return;
}
M_StartCup(0);
M_StartCup(UINT8_MAX);
}
void M_CupSelectHandler(INT32 choice)
@ -306,7 +307,7 @@ void M_CupSelectHandler(INT32 choice)
return;
}
M_StartCup(0);
M_StartCup(UINT8_MAX);
}
else if (count == 1 && levellist.levelsearch.timeattack == true)
{

View file

@ -1328,7 +1328,7 @@ void Y_RoundQueueDrawer(y_data_t *standings, INT32 offset, boolean doanimations,
else if (
roundqueue.entries[i].overridden == true
|| (grandprixinfo.gp == true
&& roundqueue.entries[i].gametype != roundqueue.entries[0].gametype)
&& roundqueue.entries[i].gametype != GT_RACE) // roundqueue.entries[0].gametype
)
{
if ((gametypes[roundqueue.entries[i].gametype]->rules & GTR_PRISONS) == GTR_PRISONS)