From 70594c4c39c7c76feb14ca6e2d4b017a79a78c43 Mon Sep 17 00:00:00 2001 From: Adidasman1 Date: Wed, 4 Jan 2017 02:52:03 +0500 Subject: [PATCH] ReGameDLL API: Add PM_UpdateStepSound (#93) Fixes #90 Fix: not ending of the round when the hostages rescued --- regamedll/dlls/hostage/hostage.cpp | 4 ++++ regamedll/dlls/multiplay_gamerules.cpp | 9 +++++++++ regamedll/extra/cssdk/dlls/regamedll_api.h | 7 ++++++- regamedll/pm_shared/pm_shared.cpp | 4 +++- regamedll/pm_shared/pm_shared.h | 1 + regamedll/public/regamedll/regamedll_api.h | 7 ++++++- regamedll/regamedll/regamedll_api_impl.cpp | 1 + regamedll/regamedll/regamedll_api_impl.h | 6 ++++++ 8 files changed, 36 insertions(+), 3 deletions(-) diff --git a/regamedll/dlls/hostage/hostage.cpp b/regamedll/dlls/hostage/hostage.cpp index fd04cbc4..2f3c972c 100644 --- a/regamedll/dlls/hostage/hostage.cpp +++ b/regamedll/dlls/hostage/hostage.cpp @@ -516,6 +516,10 @@ void CHostage::Remove() pev->solid = SOLID_NOT; pev->takedamage = DAMAGE_NO; +#ifdef REGAMEDLL_FIXES + pev->deadflag = DEAD_DEAD; +#endif + UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0)); pev->nextthink = -1; m_flNextFullThink = -1; diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index 9bef6872..60d69a58 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -1681,7 +1681,10 @@ void EXT_FUNC CHalfLifeMultiplay::__API_VHOOK(RestartRound)() g_pHostages->RestartRound(); } +#ifndef REGAMEDLL_FIXES ++m_iTotalRoundsPlayed; +#endif + ClearBodyQue(); // Hardlock the player accelaration to 5.0 @@ -1810,6 +1813,12 @@ void EXT_FUNC CHalfLifeMultiplay::__API_VHOOK(RestartRound)() TheBots->OnEvent(EVENT_NEW_MATCH); } } +#ifdef REGAMEDLL_FIXES + else + { + m_iTotalRoundsPlayed++; + } +#endif m_bFreezePeriod = TRUE; m_bRoundTerminating = false; diff --git a/regamedll/extra/cssdk/dlls/regamedll_api.h b/regamedll/extra/cssdk/dlls/regamedll_api.h index 165f5b2d..c60cac47 100644 --- a/regamedll/extra/cssdk/dlls/regamedll_api.h +++ b/regamedll/extra/cssdk/dlls/regamedll_api.h @@ -36,7 +36,7 @@ #include "items.h" #define REGAMEDLL_API_VERSION_MAJOR 5 -#define REGAMEDLL_API_VERSION_MINOR 0 +#define REGAMEDLL_API_VERSION_MINOR 1 // CBasePlayer::Spawn hook typedef IVoidHookChainClass IReGameHook_CBasePlayer_Spawn; @@ -354,6 +354,10 @@ typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_BalanceTeams; typedef IVoidHookChain<> IReGameHook_CSGameRules_OnRoundFreezeEnd; typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd; +// PM_UpdateStepSound hook +typedef IVoidHookChain<> IReGameHook_PM_UpdateStepSound; +typedef IVoidHookChainRegistry<> IReGameHookRegistry_PM_UpdateStepSound; + class IReGameHookchains { public: virtual ~IReGameHookchains() {} @@ -442,6 +446,7 @@ public: virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission() = 0; virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0; virtual IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd* CSGameRules_OnRoundFreezeEnd() = 0; + virtual IReGameHookRegistry_PM_UpdateStepSound* PM_UpdateStepSound() = 0; }; struct ReGameFuncs_t { diff --git a/regamedll/pm_shared/pm_shared.cpp b/regamedll/pm_shared/pm_shared.cpp index e8feb409..f692241b 100644 --- a/regamedll/pm_shared/pm_shared.cpp +++ b/regamedll/pm_shared/pm_shared.cpp @@ -373,7 +373,9 @@ void PM_CatagorizeTextureType() pmove->chtexturetype = PM_FindTextureType(pmove->sztexturename); } -void PM_UpdateStepSound() +LINK_HOOK_VOID_CHAIN2(PM_UpdateStepSound); + +void EXT_FUNC __API_HOOK(PM_UpdateStepSound)() { float fvol; vec3_t knee; diff --git a/regamedll/pm_shared/pm_shared.h b/regamedll/pm_shared/pm_shared.h index 7fac3a8e..a92f71df 100644 --- a/regamedll/pm_shared/pm_shared.h +++ b/regamedll/pm_shared/pm_shared.h @@ -85,6 +85,7 @@ void PM_Init_(struct playermove_s *ppmove); void PM_Move_(struct playermove_s *ppmove, int server); void PM_AirMove_(int playerIndex); void PM_AirMove_internal(); +void PM_UpdateStepSound_(); extern struct playermove_s *pmove; diff --git a/regamedll/public/regamedll/regamedll_api.h b/regamedll/public/regamedll/regamedll_api.h index 165f5b2d..c60cac47 100644 --- a/regamedll/public/regamedll/regamedll_api.h +++ b/regamedll/public/regamedll/regamedll_api.h @@ -36,7 +36,7 @@ #include "items.h" #define REGAMEDLL_API_VERSION_MAJOR 5 -#define REGAMEDLL_API_VERSION_MINOR 0 +#define REGAMEDLL_API_VERSION_MINOR 1 // CBasePlayer::Spawn hook typedef IVoidHookChainClass IReGameHook_CBasePlayer_Spawn; @@ -354,6 +354,10 @@ typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_BalanceTeams; typedef IVoidHookChain<> IReGameHook_CSGameRules_OnRoundFreezeEnd; typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd; +// PM_UpdateStepSound hook +typedef IVoidHookChain<> IReGameHook_PM_UpdateStepSound; +typedef IVoidHookChainRegistry<> IReGameHookRegistry_PM_UpdateStepSound; + class IReGameHookchains { public: virtual ~IReGameHookchains() {} @@ -442,6 +446,7 @@ public: virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission() = 0; virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0; virtual IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd* CSGameRules_OnRoundFreezeEnd() = 0; + virtual IReGameHookRegistry_PM_UpdateStepSound* PM_UpdateStepSound() = 0; }; struct ReGameFuncs_t { diff --git a/regamedll/regamedll/regamedll_api_impl.cpp b/regamedll/regamedll/regamedll_api_impl.cpp index 00034aa0..6eb1c72e 100644 --- a/regamedll/regamedll/regamedll_api_impl.cpp +++ b/regamedll/regamedll/regamedll_api_impl.cpp @@ -139,6 +139,7 @@ GAMEHOOK_REGISTRY(CSGameRules_ChangeLevel); GAMEHOOK_REGISTRY(CSGameRules_GoToIntermission); GAMEHOOK_REGISTRY(CSGameRules_BalanceTeams); GAMEHOOK_REGISTRY(CSGameRules_OnRoundFreezeEnd); +GAMEHOOK_REGISTRY(PM_UpdateStepSound); int EXT_FUNC CReGameApi::GetMajorVersion() { return REGAMEDLL_API_VERSION_MAJOR; diff --git a/regamedll/regamedll/regamedll_api_impl.h b/regamedll/regamedll/regamedll_api_impl.h index 1c37eccb..49885eda 100644 --- a/regamedll/regamedll/regamedll_api_impl.h +++ b/regamedll/regamedll/regamedll_api_impl.h @@ -350,6 +350,10 @@ typedef IVoidHookChainRegistryClassEmptyImpl CReGameHo typedef IVoidHookChainClassImpl CReGameHook_CSGameRules_OnRoundFreezeEnd; typedef IVoidHookChainRegistryClassEmptyImpl CReGameHookRegistry_CSGameRules_OnRoundFreezeEnd; +// PM_UpdateStepSound hook +typedef IVoidHookChainImpl<> CReGameHook_PM_UpdateStepSound; +typedef IVoidHookChainRegistryImpl<> CReGameHookRegistry_PM_UpdateStepSound; + class CReGameHookchains: public IReGameHookchains { public: // CBasePlayer virtual @@ -436,6 +440,7 @@ public: CReGameHookRegistry_CSGameRules_GoToIntermission m_CSGameRules_GoToIntermission; CReGameHookRegistry_CSGameRules_BalanceTeams m_CSGameRules_BalanceTeams; CReGameHookRegistry_CSGameRules_OnRoundFreezeEnd m_CSGameRules_OnRoundFreezeEnd; + CReGameHookRegistry_PM_UpdateStepSound m_PM_UpdateStepSound; public: virtual IReGameHookRegistry_CBasePlayer_Spawn* CBasePlayer_Spawn(); @@ -521,6 +526,7 @@ public: virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission(); virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams(); virtual IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd* CSGameRules_OnRoundFreezeEnd(); + virtual IReGameHookRegistry_PM_UpdateStepSound* PM_UpdateStepSound(); }; extern CReGameHookchains g_ReGameHookchains;