From 30a4032067765f51816c14f82f1a6685e3eb7bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc?= Date: Thu, 7 May 2020 00:59:43 +0200 Subject: [PATCH] Fix timelimit not correct for Black Mesa (#1262) * Fix timelimit not correct for Black Mesa Black Mesa is particular and use timelimit in seconds instead of minutes * Update TimerSys.cpp * Update TimerSys.cpp * Update TimerSys.cpp * Update TimerSys.cpp --- core/TimerSys.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/TimerSys.cpp b/core/TimerSys.cpp index fbadcc40..2084b153 100644 --- a/core/TimerSys.cpp +++ b/core/TimerSys.cpp @@ -69,6 +69,13 @@ class DefaultMapTimer : public IConVarChangeListener { public: + +#if SOURCE_ENGINE == SE_BMS + static constexpr int kMapTimeScaleFactor = 60; +#else + static constexpr int kMapTimeScaleFactor = 1; +#endif + DefaultMapTimer() { m_bInUse = false; @@ -81,7 +88,7 @@ public: int GetMapTimeLimit() { - return mp_timelimit->GetInt(); + return (mp_timelimit->GetInt() / kMapTimeScaleFactor); } void SetMapTimerStatus(bool enabled) @@ -105,7 +112,7 @@ public: return; } - extra_time /= 60; + extra_time /= (60 / kMapTimeScaleFactor); mp_timelimit->SetValue(mp_timelimit->GetInt() + extra_time); } @@ -484,4 +491,3 @@ bool TimerSystem::GetMapTimeLeft(float *time_left) return true; } -