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
This commit is contained in:
Loïc
2020-05-06 22:59:43 +00:00
committed by GitHub
parent 5597fc56d3
commit 30a4032067
+9 -3
View File
@@ -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;
}