From 0ec952d019aabc2db8ea45afeaf0c2acfd0ef907 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 1 Oct 2018 12:12:48 +0100 Subject: [PATCH] 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. --- src/dehacked.c | 8 ++++++++ src/doomstat.h | 1 + src/p_setup.c | 4 +++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/dehacked.c b/src/dehacked.c index 99d95259..2efdb6bc 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -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}, diff --git a/src/doomstat.h b/src/doomstat.h index fc13b0e8..296c11bf 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -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 diff --git a/src/p_setup.c b/src/p_setup.c index 6c7b6e92..e705a3f0 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -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);