diff --git a/regamedll/dlls/API/CAPI_Impl.cpp b/regamedll/dlls/API/CAPI_Impl.cpp index 0fe10a490..4358015f4 100644 --- a/regamedll/dlls/API/CAPI_Impl.cpp +++ b/regamedll/dlls/API/CAPI_Impl.cpp @@ -204,6 +204,8 @@ GAMEHOOK_REGISTRY(CBasePlayer_Pain); GAMEHOOK_REGISTRY(CBasePlayer_DeathSound); GAMEHOOK_REGISTRY(CBasePlayer_JoiningThink); +GAMEHOOK_REGISTRY(CBasePlayerWeapon_KickBack); + 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 1be3dd232..809a03e2f 100644 --- a/regamedll/dlls/API/CAPI_Impl.h +++ b/regamedll/dlls/API/CAPI_Impl.h @@ -581,6 +581,10 @@ typedef IHookChainRegistryClassImpl CRe typedef IHookChainClassImpl CReGameHook_CBasePlayerWeapon_DefaultShotgunReload; typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayerWeapon_DefaultShotgunReload; +// CBasePlayerWeapon::KickBack hook +typedef IHookChainClassImpl CReGameHook_CBasePlayerWeapon_KickBack; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayerWeapon_KickBack; + // CBasePlayer::DropIdlePlayer hook typedef IHookChainClassImpl CReGameHook_CBasePlayer_DropIdlePlayer; typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_DropIdlePlayer; @@ -773,6 +777,8 @@ class CReGameHookchains: public IReGameHookchains { CReGameHookRegistry_CBasePlayer_Pain m_CBasePlayer_Pain; CReGameHookRegistry_CBasePlayer_DeathSound m_CBasePlayer_DeathSound; CReGameHookRegistry_CBasePlayer_JoiningThink m_CBasePlayer_JoiningThink; + + CReGameHookRegistry_CBasePlayerWeapon_KickBack m_CBasePlayerWeapon_KickBack; public: virtual IReGameHookRegistry_CBasePlayer_Spawn *CBasePlayer_Spawn(); @@ -904,6 +910,8 @@ class CReGameHookchains: public IReGameHookchains { virtual IReGameHookRegistry_CBasePlayer_Pain *CBasePlayer_Pain(); virtual IReGameHookRegistry_CBasePlayer_DeathSound *CBasePlayer_DeathSound(); virtual IReGameHookRegistry_CBasePlayer_JoiningThink *CBasePlayer_JoiningThink(); + + virtual IReGameHookRegistry_CBasePlayerWeapon_KickBack *CBasePlayerWeapon_KickBack(); }; extern CReGameHookchains g_ReGameHookchains; diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index 22d61fc9f..1cc6b15b9 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -54,22 +54,24 @@ float GetBaseAccuracy(WeaponIdType id) { switch (id) { - case WEAPON_M4A1: - case WEAPON_AK47: - case WEAPON_AUG: - case WEAPON_SG552: - case WEAPON_FAMAS: - case WEAPON_GALIL: - case WEAPON_M249: - case WEAPON_P90: - case WEAPON_TMP: - return 0.2f; - case WEAPON_MAC10: - return 0.15f; - case WEAPON_UMP45: - case WEAPON_MP5N: - return 0.0f; - } + case WEAPON_M4A1: + case WEAPON_AK47: + case WEAPON_AUG: + case WEAPON_SG552: + case WEAPON_FAMAS: + case WEAPON_GALIL: + case WEAPON_M249: + case WEAPON_P90: + case WEAPON_TMP: + return 0.2f; + case WEAPON_MAC10: + return 0.15f; + case WEAPON_UMP45: + case WEAPON_MP5N: + return 0.0f; + } + + return 0.0f; } // Resets the global multi damage accumulator @@ -689,7 +691,9 @@ bool CBasePlayerWeapon::ShieldSecondaryFire(int iUpAnim, int iDownAnim) return true; } -void CBasePlayerWeapon::KickBack(float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change) +LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayerWeapon, KickBack, (float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change), up_base, lateral_base, up_modifier, lateral_modifier, up_max, lateral_max, direction_change) + +void EXT_FUNC CBasePlayerWeapon::__API_HOOK(KickBack)(float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change) { real_t flKickUp; float flKickLateral; diff --git a/regamedll/dlls/weapons.h b/regamedll/dlls/weapons.h index bd22989e3..391316cbc 100644 --- a/regamedll/dlls/weapons.h +++ b/regamedll/dlls/weapons.h @@ -403,6 +403,7 @@ class CBasePlayerWeapon: public CBasePlayerItem BOOL DefaultDeploy_OrigFunc(char *szViewModel, char *szWeaponModel, int iAnim, char *szAnimExt, int skiplocal); BOOL DefaultReload_OrigFunc(int iClipSize, int iAnim, float fDelay); bool DefaultShotgunReload_OrigFunc(int iAnim, int iStartAnim, float fDelay, float fStartDelay, const char *pszReloadSound1, const char *pszReloadSound2); + void KickBack_OrigFunc(float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change); CCSPlayerWeapon *CSPlayerWeapon() const; #endif diff --git a/regamedll/public/regamedll/regamedll_api.h b/regamedll/public/regamedll/regamedll_api.h index ba7a8517c..50fa3878e 100644 --- a/regamedll/public/regamedll/regamedll_api.h +++ b/regamedll/public/regamedll/regamedll_api.h @@ -38,7 +38,7 @@ #include #define REGAMEDLL_API_VERSION_MAJOR 5 -#define REGAMEDLL_API_VERSION_MINOR 21 +#define REGAMEDLL_API_VERSION_MINOR 22 // CBasePlayer::Spawn hook typedef IHookChainClass IReGameHook_CBasePlayer_Spawn; @@ -460,6 +460,10 @@ typedef IHookChainRegistryClass I typedef IHookChainClass IReGameHook_CBasePlayerWeapon_DefaultShotgunReload; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayerWeapon_DefaultShotgunReload; +// CBasePlayerWeapon::KickBack hook +typedef IHookChainClass IReGameHook_CBasePlayerWeapon_KickBack; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayerWeapon_KickBack; + // CBasePlayer::DropIdlePlayer hook typedef IHookChainClass IReGameHook_CBasePlayer_DropIdlePlayer; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_DropIdlePlayer; @@ -653,6 +657,8 @@ class IReGameHookchains { virtual IReGameHookRegistry_CBasePlayer_Pain *CBasePlayer_Pain() = 0; virtual IReGameHookRegistry_CBasePlayer_DeathSound *CBasePlayer_DeathSound() = 0; virtual IReGameHookRegistry_CBasePlayer_JoiningThink *CBasePlayer_JoiningThink() = 0; + + virtual IReGameHookRegistry_CBasePlayerWeapon_KickBack *CBasePlayerWeapon_KickBack() = 0; }; struct ReGameFuncs_t { diff --git a/regamedll/version/version.h b/regamedll/version/version.h index ba22bb751..b65ba1ab2 100644 --- a/regamedll/version/version.h +++ b/regamedll/version/version.h @@ -6,5 +6,5 @@ #pragma once #define VERSION_MAJOR 5 -#define VERSION_MINOR 21 +#define VERSION_MINOR 22 #define VERSION_MAINTENANCE 0