diff --git a/regamedll/dlls/API/CAPI_Impl.cpp b/regamedll/dlls/API/CAPI_Impl.cpp index dd13c263..c4ee42a1 100644 --- a/regamedll/dlls/API/CAPI_Impl.cpp +++ b/regamedll/dlls/API/CAPI_Impl.cpp @@ -116,6 +116,7 @@ GAMEHOOK_REGISTRY(ShowVGUIMenu); GAMEHOOK_REGISTRY(BuyGunAmmo); GAMEHOOK_REGISTRY(BuyWeaponByWeaponID); GAMEHOOK_REGISTRY(InternalCommand); +GAMEHOOK_REGISTRY(IsPenetrableEntity); GAMEHOOK_REGISTRY(CSGameRules_FShouldSwitchWeapon); GAMEHOOK_REGISTRY(CSGameRules_GetNextBestWeapon); diff --git a/regamedll/dlls/API/CAPI_Impl.h b/regamedll/dlls/API/CAPI_Impl.h index 6f958171..eef4519a 100644 --- a/regamedll/dlls/API/CAPI_Impl.h +++ b/regamedll/dlls/API/CAPI_Impl.h @@ -361,6 +361,10 @@ typedef IHookChainRegistryImpl CReGa typedef IHookChainImpl CReGameHook_InternalCommand; typedef IHookChainRegistryImpl CReGameHookRegistry_InternalCommand; +// IsPenetrableEntity hook +typedef IHookChainImpl CReGameHook_IsPenetrableEntity; +typedef IHookChainRegistryImpl CReGameHookRegistry_IsPenetrableEntity; + // CHalfLifeMultiplay::FShouldSwitchWeapon hook typedef IHookChainClassImpl CReGameHook_CSGameRules_FShouldSwitchWeapon; typedef IHookChainRegistryClassEmptyImpl CReGameHookRegistry_CSGameRules_FShouldSwitchWeapon; @@ -591,6 +595,7 @@ public: CReGameHookRegistry_BuyGunAmmo m_BuyGunAmmo; CReGameHookRegistry_BuyWeaponByWeaponID m_BuyWeaponByWeaponID; CReGameHookRegistry_InternalCommand m_InternalCommand; + CReGameHookRegistry_IsPenetrableEntity m_IsPenetrableEntity; CReGameHookRegistry_CSGameRules_FShouldSwitchWeapon m_CSGameRules_FShouldSwitchWeapon; CReGameHookRegistry_CSGameRules_GetNextBestWeapon m_CSGameRules_GetNextBestWeapon; @@ -695,7 +700,8 @@ public: virtual IReGameHookRegistry_BuyGunAmmo *BuyGunAmmo(); virtual IReGameHookRegistry_BuyWeaponByWeaponID *BuyWeaponByWeaponID(); virtual IReGameHookRegistry_InternalCommand *InternalCommand(); - + virtual IReGameHookRegistry_IsPenetrableEntity *IsPenetrableEntity(); + virtual IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon *CSGameRules_FShouldSwitchWeapon(); virtual IReGameHookRegistry_CSGameRules_GetNextBestWeapon *CSGameRules_GetNextBestWeapon(); virtual IReGameHookRegistry_CSGameRules_FlPlayerFallDamage *CSGameRules_FlPlayerFallDamage(); diff --git a/regamedll/dlls/cbase.cpp b/regamedll/dlls/cbase.cpp index e8474954..d312947f 100644 --- a/regamedll/dlls/cbase.cpp +++ b/regamedll/dlls/cbase.cpp @@ -1131,6 +1131,11 @@ void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting ApplyMultiDamage(pev, pevAttacker); } +bool EXT_FUNC IsPenetrableEntity_default(Vector &vecSrc, Vector &vecEnd, entvars_t *pevAttacker, edict_t *pHit) +{ + return true; +} + // Go to the trouble of combining multiple pellets into a single damage call. // This version is used by Players, uses the random seed generator to sync client and server side shots. Vector CBaseEntity::FireBullets3(Vector vecSrc, Vector vecDirShooting, float vecSpread, float flDistance, int iPenetration, int iBulletType, int iDamage, float flRangeModifier, entvars_t *pevAttacker, bool bPistol, int shared_rand) @@ -1295,6 +1300,11 @@ Vector CBaseEntity::FireBullets3(Vector vecSrc, Vector vecDirShooting, float vec iPenetration = 0; } + bool bIsPenatrable = g_ReGameHookchains.m_IsPenetrableEntity.callChain(IsPenetrableEntity_default, vecSrc, tr.vecEndPos, pevAttacker, tr.pHit); + + if (!bIsPenatrable) + iPenetration = 0; + if (tr.iHitgroup == HITGROUP_SHIELD) { EMIT_SOUND(pEntity->edict(), CHAN_VOICE, (RANDOM_LONG(0, 1) == 1) ? "weapons/ric_metal-1.wav" : "weapons/ric_metal-2.wav", VOL_NORM, ATTN_NORM); diff --git a/regamedll/public/regamedll/regamedll_api.h b/regamedll/public/regamedll/regamedll_api.h index 82cfd15c..2754ebc1 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 7 +#define REGAMEDLL_API_VERSION_MINOR 8 // CBasePlayer::Spawn hook typedef IHookChainClass IReGameHook_CBasePlayer_Spawn; @@ -264,6 +264,10 @@ typedef IHookChainRegistry IReGameHook_InternalCommand; typedef IHookChainRegistry IReGameHookRegistry_InternalCommand; +// IsPenetrableEntity hook +typedef IHookChain IReGameHook_IsPenetrableEntity; +typedef IHookChainRegistry IReGameHookRegistry_IsPenetrableEntity; + // CHalfLifeMultiplay::FShouldSwitchWeapon hook typedef IHookChain IReGameHook_CSGameRules_FShouldSwitchWeapon; typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon; @@ -496,6 +500,7 @@ public: virtual IReGameHookRegistry_BuyGunAmmo *BuyGunAmmo() = 0; virtual IReGameHookRegistry_BuyWeaponByWeaponID *BuyWeaponByWeaponID() = 0; virtual IReGameHookRegistry_InternalCommand *InternalCommand() = 0; + virtual IReGameHookRegistry_IsPenetrableEntity *IsPenetrableEntity() = 0; virtual IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon *CSGameRules_FShouldSwitchWeapon() = 0; virtual IReGameHookRegistry_CSGameRules_GetNextBestWeapon *CSGameRules_GetNextBestWeapon() = 0;