cstrike: Fix wrong timeleft calculation (#1072)
* Fix wrong timeleft calculation * reorder function calls
This commit is contained in:
parent
207584818f
commit
d93f6984cc
@ -51,6 +51,7 @@ IGameConfig *g_pGameConf = NULL;
|
|||||||
IGameEventManager2 *gameevents = NULL;
|
IGameEventManager2 *gameevents = NULL;
|
||||||
bool hooked_everything = false;
|
bool hooked_everything = false;
|
||||||
int g_msgHintText = -1;
|
int g_msgHintText = -1;
|
||||||
|
CGlobalVars *gpGlobals;
|
||||||
|
|
||||||
SMEXT_LINK(&g_CStrike);
|
SMEXT_LINK(&g_CStrike);
|
||||||
|
|
||||||
@ -107,6 +108,7 @@ bool CStrike::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool
|
|||||||
{
|
{
|
||||||
GET_V_IFACE_CURRENT(GetEngineFactory, gameevents, IGameEventManager2, INTERFACEVERSION_GAMEEVENTSMANAGER2);
|
GET_V_IFACE_CURRENT(GetEngineFactory, gameevents, IGameEventManager2, INTERFACEVERSION_GAMEEVENTSMANAGER2);
|
||||||
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
|
gpGlobals = ismm->GetCGlobals();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -166,6 +166,7 @@ private:
|
|||||||
extern IBinTools *g_pBinTools;
|
extern IBinTools *g_pBinTools;
|
||||||
extern IGameConfig *g_pGameConf;
|
extern IGameConfig *g_pGameConf;
|
||||||
extern ISDKTools *g_pSDKTools;
|
extern ISDKTools *g_pSDKTools;
|
||||||
|
extern CGlobalVars *gpGlobals;
|
||||||
extern int g_msgHintText;
|
extern int g_msgHintText;
|
||||||
extern bool g_pIgnoreTerminateDetour;
|
extern bool g_pIgnoreTerminateDetour;
|
||||||
extern bool g_pIgnoreCSWeaponDropDetour;
|
extern bool g_pIgnoreCSWeaponDropDetour;
|
||||||
|
@ -58,7 +58,19 @@ void TimeLeftEvents::FireGameEvent(IGameEvent *event)
|
|||||||
if (get_new_timeleft_offset || !round_end_found)
|
if (get_new_timeleft_offset || !round_end_found)
|
||||||
{
|
{
|
||||||
get_new_timeleft_offset = false;
|
get_new_timeleft_offset = false;
|
||||||
timersys->NotifyOfGameStart();
|
|
||||||
|
float flGameStartTime = gpGlobals->curtime;
|
||||||
|
uintptr_t gamerules = (uintptr_t)g_pSDKTools->GetGameRules();
|
||||||
|
if (gamerules)
|
||||||
|
{
|
||||||
|
sm_sendprop_info_t info;
|
||||||
|
if (gamehelpers->FindSendPropInfo("CCSGameRulesProxy", "m_flGameStartTime", &info))
|
||||||
|
{
|
||||||
|
flGameStartTime = *(float *)(gamerules + info.actual_offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
timersys->NotifyOfGameStart(flGameStartTime - gpGlobals->curtime);
|
||||||
timersys->MapTimeLeftChanged();
|
timersys->MapTimeLeftChanged();
|
||||||
}
|
}
|
||||||
round_end_found = false;
|
round_end_found = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user