diff --git a/regamedll/dlls/API/CAPI_Impl.cpp b/regamedll/dlls/API/CAPI_Impl.cpp index 41175c838..d2154947e 100644 --- a/regamedll/dlls/API/CAPI_Impl.cpp +++ b/regamedll/dlls/API/CAPI_Impl.cpp @@ -337,6 +337,12 @@ GAMEHOOK_REGISTRY(CBasePlayer_PlayerDeathThink); GAMEHOOK_REGISTRY(CBasePlayer_Observer_Think); GAMEHOOK_REGISTRY(CBasePlayer_RemoveAllItems); +GAMEHOOK_REGISTRY(CSGameRules_CheckGameOver); +GAMEHOOK_REGISTRY(CSGameRules_CheckTimeLimit); +GAMEHOOK_REGISTRY(CSGameRules_CheckFragLimit); +GAMEHOOK_REGISTRY(CSGameRules_CheckMaxRounds); +GAMEHOOK_REGISTRY(CSGameRules_CheckWinLimit); + int CReGameApi::GetMajorVersion() { return REGAMEDLL_API_VERSION_MAJOR; } diff --git a/regamedll/dlls/API/CAPI_Impl.h b/regamedll/dlls/API/CAPI_Impl.h index 2635be5b9..2bd76cb56 100644 --- a/regamedll/dlls/API/CAPI_Impl.h +++ b/regamedll/dlls/API/CAPI_Impl.h @@ -749,6 +749,26 @@ typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBase typedef IHookChainClassImpl CReGameHook_CBasePlayer_RemoveAllItems; typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_RemoveAllItems; +// CHalfLifeMultiplay::CheckGameOver hook +typedef IHookChainClassImpl CReGameHook_CSGameRules_CheckGameOver; +typedef IHookChainRegistryClassEmptyImpl CReGameHookRegistry_CSGameRules_CheckGameOver; + +// CHalfLifeMultiplay::CheckTimeLimit hook +typedef IHookChainClassImpl CReGameHook_CSGameRules_CheckTimeLimit; +typedef IHookChainRegistryClassEmptyImpl CReGameHookRegistry_CSGameRules_CheckTimeLimit; + +// CHalfLifeMultiplay::CheckFragLimit hook +typedef IHookChainClassImpl CReGameHook_CSGameRules_CheckFragLimit; +typedef IHookChainRegistryClassEmptyImpl CReGameHookRegistry_CSGameRules_CheckFragLimit; + +// CHalfLifeMultiplay::CheckMaxRounds hook +typedef IHookChainClassImpl CReGameHook_CSGameRules_CheckMaxRounds; +typedef IHookChainRegistryClassEmptyImpl CReGameHookRegistry_CSGameRules_CheckMaxRounds; + +// CHalfLifeMultiplay::CheckWinLimit hook +typedef IHookChainClassImpl CReGameHook_CSGameRules_CheckWinLimit; +typedef IHookChainRegistryClassEmptyImpl CReGameHookRegistry_CSGameRules_CheckWinLimit; + class CReGameHookchains: public IReGameHookchains { public: // CBasePlayer virtual @@ -911,6 +931,12 @@ class CReGameHookchains: public IReGameHookchains { CReGameHookRegistry_CBasePlayer_Observer_Think m_CBasePlayer_Observer_Think; CReGameHookRegistry_CBasePlayer_RemoveAllItems m_CBasePlayer_RemoveAllItems; + CReGameHookRegistry_CSGameRules_CheckGameOver m_CSGameRules_CheckGameOver; + CReGameHookRegistry_CSGameRules_CheckTimeLimit m_CSGameRules_CheckTimeLimit; + CReGameHookRegistry_CSGameRules_CheckFragLimit m_CSGameRules_CheckFragLimit; + CReGameHookRegistry_CSGameRules_CheckMaxRounds m_CSGameRules_CheckMaxRounds; + CReGameHookRegistry_CSGameRules_CheckWinLimit m_CSGameRules_CheckWinLimit; + public: virtual IReGameHookRegistry_CBasePlayer_Spawn *CBasePlayer_Spawn(); virtual IReGameHookRegistry_CBasePlayer_Precache *CBasePlayer_Precache(); @@ -1070,6 +1096,12 @@ class CReGameHookchains: public IReGameHookchains { virtual IReGameHookRegistry_CBasePlayer_PlayerDeathThink *CBasePlayer_PlayerDeathThink(); virtual IReGameHookRegistry_CBasePlayer_Observer_Think *CBasePlayer_Observer_Think(); virtual IReGameHookRegistry_CBasePlayer_RemoveAllItems *CBasePlayer_RemoveAllItems(); + + virtual IReGameHookRegistry_CSGameRules_CheckGameOver *CSGameRules_CheckGameOver(); + virtual IReGameHookRegistry_CSGameRules_CheckTimeLimit *CSGameRules_CheckTimeLimit(); + virtual IReGameHookRegistry_CSGameRules_CheckFragLimit *CSGameRules_CheckFragLimit(); + virtual IReGameHookRegistry_CSGameRules_CheckMaxRounds *CSGameRules_CheckMaxRounds(); + virtual IReGameHookRegistry_CSGameRules_CheckWinLimit *CSGameRules_CheckWinLimit(); }; extern CReGameHookchains g_ReGameHookchains; diff --git a/regamedll/dlls/gamerules.h b/regamedll/dlls/gamerules.h index cc6e9ec8f..a2b083204 100644 --- a/regamedll/dlls/gamerules.h +++ b/regamedll/dlls/gamerules.h @@ -618,6 +618,11 @@ class CHalfLifeMultiplay: public CGameRules BOOL TeamStacked_OrigFunc(int newTeam_id, int curTeam_id); void PlayerGotWeapon_OrigFunc(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon); void SendDeathMessage_OrigFunc(CBaseEntity *pKiller, CBasePlayer *pVictim, CBasePlayer *pAssister, entvars_t *pevInflictor, const char *killerWeaponName, int iDeathMessageFlags, int iRarityOfKill); + BOOL CheckGameOver_OrigFunc(); + BOOL CheckTimeLimit_OrigFunc(); + BOOL CheckFragLimit_OrigFunc(); + BOOL CheckMaxRounds_OrigFunc(); + BOOL CheckWinLimit_OrigFunc(); #endif public: @@ -672,11 +677,11 @@ class CHalfLifeMultiplay: public CGameRules bool Hostage_NotRescued(float tmDelay); // Check various conditions to end the map. - bool CheckGameOver(); - bool CheckTimeLimit(); - bool CheckFragLimit(); - bool CheckMaxRounds(); - bool CheckWinLimit(); + BOOL CheckGameOver(); + BOOL CheckTimeLimit(); + BOOL CheckFragLimit(); + BOOL CheckMaxRounds(); + BOOL CheckWinLimit(); void CheckFreezePeriodExpired(); void CheckRoundTimeExpired(); diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index f9aaa8c30..d788a3933 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -2612,7 +2612,9 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(Think)() } } -bool CHalfLifeMultiplay::CheckGameOver() +LINK_HOOK_CLASS_CUSTOM_CHAIN2(BOOL, CHalfLifeMultiplay, CSGameRules, CheckGameOver) + +BOOL EXT_FUNC CHalfLifeMultiplay::__API_HOOK(CheckGameOver)() { // someone else quit the game already if (m_bGameOver) @@ -2649,7 +2651,9 @@ bool CHalfLifeMultiplay::CheckGameOver() return false; } -bool CHalfLifeMultiplay::CheckTimeLimit() +LINK_HOOK_CLASS_CUSTOM_CHAIN2(BOOL, CHalfLifeMultiplay, CSGameRules, CheckTimeLimit) + +BOOL EXT_FUNC CHalfLifeMultiplay::__API_HOOK(CheckTimeLimit)() { if (timelimit.value < 0) { @@ -2687,7 +2691,9 @@ bool CHalfLifeMultiplay::CheckTimeLimit() return false; } -bool CHalfLifeMultiplay::CheckMaxRounds() +LINK_HOOK_CLASS_CUSTOM_CHAIN2(BOOL, CHalfLifeMultiplay, CSGameRules, CheckMaxRounds) + +BOOL EXT_FUNC CHalfLifeMultiplay::__API_HOOK(CheckMaxRounds)() { if (m_iMaxRounds != 0 && m_iTotalRoundsPlayed >= m_iMaxRounds) { @@ -2699,7 +2705,9 @@ bool CHalfLifeMultiplay::CheckMaxRounds() return false; } -bool CHalfLifeMultiplay::CheckWinLimit() +LINK_HOOK_CLASS_CUSTOM_CHAIN2(BOOL, CHalfLifeMultiplay, CSGameRules, CheckWinLimit) + +BOOL EXT_FUNC CHalfLifeMultiplay::__API_HOOK(CheckWinLimit)() { // has one team won the specified number of rounds? if (m_iMaxRoundsWon != 0 && (m_iNumCTWins >= m_iMaxRoundsWon || m_iNumTerroristWins >= m_iMaxRoundsWon)) @@ -2715,7 +2723,9 @@ bool CHalfLifeMultiplay::CheckWinLimit() return false; } -bool CHalfLifeMultiplay::CheckFragLimit() +LINK_HOOK_CLASS_CUSTOM_CHAIN2(BOOL, CHalfLifeMultiplay, CSGameRules, CheckFragLimit) + +BOOL EXT_FUNC CHalfLifeMultiplay::__API_HOOK(CheckFragLimit)() { #ifdef REGAMEDLL_ADD int fragsRemaining = 0; diff --git a/regamedll/public/regamedll/regamedll_api.h b/regamedll/public/regamedll/regamedll_api.h index d655ee656..dbadcc4e9 100644 --- a/regamedll/public/regamedll/regamedll_api.h +++ b/regamedll/public/regamedll/regamedll_api.h @@ -628,6 +628,26 @@ typedef IHookChainRegistryClass IReGameHookRegistry_CBa typedef IHookChainClass IReGameHook_CBasePlayer_RemoveAllItems; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_RemoveAllItems; +// CHalfLifeMultiplay::CheckGameOver hook +typedef IHookChain IReGameHook_CSGameRules_CheckGameOver; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_CheckGameOver; + +// CHalfLifeMultiplay::CheckTimeLimit hook +typedef IHookChain IReGameHook_CSGameRules_CheckTimeLimit; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_CheckTimeLimit; + +// CHalfLifeMultiplay::CheckFragLimit hook +typedef IHookChain IReGameHook_CSGameRules_CheckFragLimit; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_CheckFragLimit; + +// CHalfLifeMultiplay::CheckMaxRounds hook +typedef IHookChain IReGameHook_CSGameRules_CheckMaxRounds; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_CheckMaxRounds; + +// CHalfLifeMultiplay::CheckWinLimit hook +typedef IHookChain IReGameHook_CSGameRules_CheckWinLimit; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_CheckWinLimit; + class IReGameHookchains { public: virtual ~IReGameHookchains() {} @@ -790,6 +810,12 @@ class IReGameHookchains { virtual IReGameHookRegistry_CBasePlayer_PlayerDeathThink *CBasePlayer_PlayerDeathThink() = 0; virtual IReGameHookRegistry_CBasePlayer_Observer_Think *CBasePlayer_Observer_Think() = 0; virtual IReGameHookRegistry_CBasePlayer_RemoveAllItems *CBasePlayer_RemoveAllItems() = 0; + + virtual IReGameHookRegistry_CSGameRules_CheckGameOver *CSGameRules_CheckGameOver() = 0; + virtual IReGameHookRegistry_CSGameRules_CheckTimeLimit *CSGameRules_CheckTimeLimit() = 0; + virtual IReGameHookRegistry_CSGameRules_CheckFragLimit *CSGameRules_CheckFragLimit() = 0; + virtual IReGameHookRegistry_CSGameRules_CheckMaxRounds *CSGameRules_CheckMaxRounds() = 0; + virtual IReGameHookRegistry_CSGameRules_CheckWinLimit *CSGameRules_CheckWinLimit() = 0; }; struct ReGameFuncs_t {