From 532c1326b4956a8909c37d031710e3ba43482225 Mon Sep 17 00:00:00 2001
From: shel <9306996+afwn90cj93201nixr2e1re@users.noreply.github.com>
Date: Sat, 13 Jun 2020 13:39:41 +0400
Subject: [PATCH] Add more flags for round time expired to CVar
mp_round_infinite.
Co-authored-by: shel <2@shelru.ru>
---
README.md | 2 +-
dist/game.cfg | 6 +++++-
regamedll/dlls/gamerules.h | 19 ++++++++++++-------
regamedll/dlls/multiplay_gamerules.cpp | 15 +++++++++++----
4 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
index a49de0fb4..a4341e818 100644
--- a/README.md
+++ b/README.md
@@ -39,7 +39,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| mp_autoteambalance | 1 | 0 | 2 | Auto balancing of teams.
`0` disabled
`1` on after next round
`2` on next round |
| mp_buytime | 1.5 | 0.0 | - | Designate the desired amount of buy time for each round. (in minutes)
`-1` means no time limit
`0` disable buy |
| mp_maxmoney | 16000 | 0 | `999999` | The maximum allowable amount of money in the game |
-| mp_round_infinite | 0 | 0 | 1 | Flags for fine grained control (choose as many as needed)
`0` disabled
`1` enabled
or flags
`a` block round time round end check
`b` block needed players round end check
`c` block VIP assassination/success round end check
`d` block prison escape round end check
`e` block bomb round end check
`f` block team extermination round end check
`g` block hostage rescue round end check
`Example setting:` "ae" blocks round time and bomb round end checks |
+| mp_round_infinite | 0 | 0 | 1 | Flags for fine grained control (choose as many as needed)
`0` disabled
`1` enabled
or flags
`a` block round time round end check
`b` block needed players round end check
`c` block VIP assassination/success round end check
`d` block prison escape round end check
`e` block bomb round end check
`f` block team extermination round end check
`g` block hostage rescue round end check
`h` block VIP assassination/success round time end check
`i` block prison escape round time end check
`j` block bomb round time end check
`k` block hostage rescue round time end check
`Example setting:` "ae" blocks round time and bomb round end checks |
| mp_roundover | 0 | - | - | The round by expired time will be over, if on a map it does not have the scenario of the game.
`0` disabled
`1` enabled |
| mp_round_restart_delay | 5 | - | - | Number of seconds to delay before restarting a round after a win. |
| mp_hegrenade_penetration | 0 | 0 | 1 | Disable grenade damage through walls.
`0` disabled
`1` enabled |
diff --git a/dist/game.cfg b/dist/game.cfg
index 544693a66..d6890b9dd 100644
--- a/dist/game.cfg
+++ b/dist/game.cfg
@@ -33,13 +33,17 @@ mp_maxmoney 16000
// 1 - enabled (never end round)
//
// Flags for fine grained control (choose as many as needed)
-// a - block round time round end check
+// a - block round time round end check, contain "h", "i", "j", "k" flags
// b - block needed players round end check
// c - block VIP assassination/success round end check
// d - block prison escape round end check
// e - block bomb round end check
// f - block team extermination round end check
// g - block hostage rescue round end check
+// h - block VIP assassination/success round time end check
+// i - block prison escape round time end check
+// j - block bomb round time end check
+// k - block hostage rescue round time end check
//
// Example setting: "ae" - blocks round time and bomb round end checks
// Default value: "0"
diff --git a/regamedll/dlls/gamerules.h b/regamedll/dlls/gamerules.h
index 80894003a..ed0111a50 100644
--- a/regamedll/dlls/gamerules.h
+++ b/regamedll/dlls/gamerules.h
@@ -191,13 +191,18 @@ enum
// custom enum
enum
{
- SCENARIO_BLOCK_TIME_EXPRIRED = BIT(0), // flag "a"
- SCENARIO_BLOCK_NEED_PLAYERS = BIT(1), // flag "b"
- SCENARIO_BLOCK_VIP_ESCAPE = BIT(2), // flag "c"
- SCENARIO_BLOCK_PRISON_ESCAPE = BIT(3), // flag "d"
- SCENARIO_BLOCK_BOMB = BIT(4), // flag "e"
- SCENARIO_BLOCK_TEAM_EXTERMINATION = BIT(5), // flag "f"
- SCENARIO_BLOCK_HOSTAGE_RESCUE = BIT(6), // flag "g"
+ SCENARIO_BLOCK_TIME_EXPRIRED = BIT(0), // flag "a"
+ SCENARIO_BLOCK_NEED_PLAYERS = BIT(1), // flag "b"
+ SCENARIO_BLOCK_VIP_ESCAPE = BIT(2), // flag "c"
+ SCENARIO_BLOCK_PRISON_ESCAPE = BIT(3), // flag "d"
+ SCENARIO_BLOCK_BOMB = BIT(4), // flag "e"
+ SCENARIO_BLOCK_TEAM_EXTERMINATION = BIT(5), // flag "f"
+ SCENARIO_BLOCK_HOSTAGE_RESCUE = BIT(6), // flag "g"
+ SCENARIO_BLOCK_VIP_ESCAPE_TIME = BIT(7), // flag "h"
+ SCENARIO_BLOCK_PRISON_ESCAPE_TIME = BIT(8), // flag "i"
+ SCENARIO_BLOCK_BOMB_TIME = BIT(9), // flag "j"
+ SCENARIO_BLOCK_HOSTAGE_RESCUE_TIME = BIT(10), // flag "k"
+
};
// Player relationship return codes
diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp
index 460f5d247..9880ac0ee 100644
--- a/regamedll/dlls/multiplay_gamerules.cpp
+++ b/regamedll/dlls/multiplay_gamerules.cpp
@@ -2980,23 +2980,30 @@ void CHalfLifeMultiplay::CheckRoundTimeExpired()
}
#endif
+#ifdef REGAMEDLL_ADD
+ int scenarioFlags = UTIL_ReadFlags(round_infinite.string);
+#else
+ // the icc compiler will cut out all of the code which refers to it
+ int scenarioFlags = 0;
+#endif
+
// New code to get rid of round draws!!
- if (m_bMapHasBombTarget)
+ if (!(scenarioFlags & SCENARIO_BLOCK_BOMB_TIME) && m_bMapHasBombTarget)
{
if (!OnRoundEnd_Intercept(WINSTATUS_CTS, ROUND_TARGET_SAVED, GetRoundRestartDelay()))
return;
}
- else if (UTIL_FindEntityByClassname(nullptr, "hostage_entity"))
+ else if (!(scenarioFlags & SCENARIO_BLOCK_HOSTAGE_RESCUE) && UTIL_FindEntityByClassname(nullptr, "hostage_entity"))
{
if (!OnRoundEnd_Intercept(WINSTATUS_TERRORISTS, ROUND_HOSTAGE_NOT_RESCUED, GetRoundRestartDelay()))
return;
}
- else if (m_bMapHasEscapeZone)
+ else if (!(scenarioFlags & SCENARIO_BLOCK_PRISON_ESCAPE_TIME) && m_bMapHasEscapeZone)
{
if (!OnRoundEnd_Intercept(WINSTATUS_CTS, ROUND_TERRORISTS_NOT_ESCAPED, GetRoundRestartDelay()))
return;
}
- else if (m_bMapHasVIPSafetyZone)
+ else if (!(scenarioFlags & SCENARIO_BLOCK_VIP_ESCAPE_TIME) && m_bMapHasVIPSafetyZone)
{
if (!OnRoundEnd_Intercept(WINSTATUS_TERRORISTS, ROUND_VIP_NOT_ESCAPED, GetRoundRestartDelay()))
return;