Add a `SECTIONRACE` map flag. So far, all it does is prevent the number of laps from exceeding the map default, but it's a base to work off of if we want to add any other changes specifically for section races in future.

This commit is contained in:
toaster 2018-10-01 12:12:48 +01:00
parent 487a2ecf2e
commit 0ec952d019
3 changed files with 12 additions and 1 deletions

View File

@ -1308,6 +1308,13 @@ static void readlevelheader(MYFILE *f, INT32 num)
else
mapheaderinfo[num-1]->levelflags &= ~LF_NOZONE;
}
else if (fastcmp(word, "SECTIONRACE"))
{
if (i || word2[0] == 'T' || word2[0] == 'Y')
mapheaderinfo[num-1]->levelflags |= LF_SECTIONRACE;
else
mapheaderinfo[num-1]->levelflags &= ~LF_SECTIONRACE;
}
// Individual triggers for menu flags
else if (fastcmp(word, "HIDDEN"))
@ -7943,6 +7950,7 @@ struct {
{"LF_NOSSMUSIC",LF_NOSSMUSIC},
{"LF_NORELOAD",LF_NORELOAD},
{"LF_NOZONE",LF_NOZONE},
{"LF_SECTIONRACE",LF_SECTIONRACE},
// And map flags
{"LF2_HIDEINMENU",LF2_HIDEINMENU},
{"LF2_HIDEINSTATS",LF2_HIDEINSTATS},

View File

@ -272,6 +272,7 @@ typedef struct
#define LF_NOSSMUSIC 4 ///< Disable Super Sonic music
#define LF_NORELOAD 8 ///< Don't reload level on death
#define LF_NOZONE 16 ///< Don't include "ZONE" on level title
#define LF_SECTIONRACE 32 ///< Section race level
#define LF2_HIDEINMENU 1 ///< Hide in the multiplayer menu
#define LF2_HIDEINSTATS 2 ///< Hide in the statistics screen

View File

@ -2916,7 +2916,9 @@ boolean P_SetupLevel(boolean skipprecip)
}
else if (G_RaceGametype() && server)
CV_StealthSetValue(&cv_numlaps,
((netgame || multiplayer) && cv_basenumlaps.value)
((netgame || multiplayer) && cv_basenumlaps.value
&& (!(mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE)
|| (mapheaderinfo[gamemap - 1]->numlaps > cv_basenumlaps.value)))
? cv_basenumlaps.value
: mapheaderinfo[gamemap - 1]->numlaps);