diff --git a/.gitignore b/.gitignore index 6aa9bce05..18d50d6ee 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ regamedll/version/appversion.h regamedll/msvc/PublishPath*.txt publish +/.vs/VSWorkspaceState.json +/.vs/slnx.sqlite +/regamedll/msvc/cpp.hint diff --git a/regamedll/dlls/API/CAPI_Impl.cpp b/regamedll/dlls/API/CAPI_Impl.cpp index 41175c838..8877ddf9a 100644 --- a/regamedll/dlls/API/CAPI_Impl.cpp +++ b/regamedll/dlls/API/CAPI_Impl.cpp @@ -337,6 +337,9 @@ GAMEHOOK_REGISTRY(CBasePlayer_PlayerDeathThink); GAMEHOOK_REGISTRY(CBasePlayer_Observer_Think); GAMEHOOK_REGISTRY(CBasePlayer_RemoveAllItems); +GAMEHOOK_REGISTRY(CBasePlayerItem_Materialize); +GAMEHOOK_REGISTRY(CBasePlayerItem_CheckRespawn); + 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..07c58d00f 100644 --- a/regamedll/dlls/API/CAPI_Impl.h +++ b/regamedll/dlls/API/CAPI_Impl.h @@ -749,6 +749,15 @@ typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBase typedef IHookChainClassImpl CReGameHook_CBasePlayer_RemoveAllItems; typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_RemoveAllItems; +// CBasePlayerItem::Materialize hook +typedef IHookChainClassImpl CReGameHook_CBasePlayerItem_Materialize; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayerItem_Materialize; + +// CBasePlayerItem::CheckRespawn hook +typedef IHookChainClassImpl CReGameHook_CBasePlayerItem_CheckRespawn; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayerItem_CheckRespawn; + + class CReGameHookchains: public IReGameHookchains { public: // CBasePlayer virtual @@ -911,6 +920,10 @@ class CReGameHookchains: public IReGameHookchains { CReGameHookRegistry_CBasePlayer_Observer_Think m_CBasePlayer_Observer_Think; CReGameHookRegistry_CBasePlayer_RemoveAllItems m_CBasePlayer_RemoveAllItems; + CReGameHookRegistry_CBasePlayerItem_Materialize m_CBasePlayerItem_Materialize; + CReGameHookRegistry_CBasePlayerItem_CheckRespawn m_CBasePlayerItem_CheckRespawn; + + public: virtual IReGameHookRegistry_CBasePlayer_Spawn *CBasePlayer_Spawn(); virtual IReGameHookRegistry_CBasePlayer_Precache *CBasePlayer_Precache(); @@ -1070,6 +1083,11 @@ 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_CBasePlayerItem_Materialize *CBasePlayerItem_Materialize(); + virtual IReGameHookRegistry_CBasePlayerItem_CheckRespawn *CBasePlayerItem_CheckRespawn(); + }; extern CReGameHookchains g_ReGameHookchains; diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index 087f45eee..c32fde398 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -497,8 +497,9 @@ void CBasePlayerItem::FallThink() } } +LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayerItem, Materialize) // Materialize - make a CBasePlayerItem visible and tangible -void CBasePlayerItem::Materialize() +void EXT_FUNC CBasePlayerItem::__API_HOOK(Materialize)() { if (pev->effects & EF_NODRAW) { @@ -553,9 +554,10 @@ void CBasePlayerItem::AttemptToMaterialize() pev->nextthink = gpGlobals->time + time; } +LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayerItem, CheckRespawn) // CheckRespawn - a player is taking this weapon, should // it respawn? -void CBasePlayerItem::CheckRespawn() +void EXT_FUNC CBasePlayerItem::__API_HOOK(CheckRespawn)() { switch (g_pGameRules->WeaponShouldRespawn(this)) { diff --git a/regamedll/dlls/weapons.h b/regamedll/dlls/weapons.h index 9266d8434..801a14eb3 100644 --- a/regamedll/dlls/weapons.h +++ b/regamedll/dlls/weapons.h @@ -311,6 +311,8 @@ class CBasePlayerItem: public CBaseAnimating public: #ifdef REGAMEDLL_API + void Materialize_OrigFunc(); + void CheckRespawn_OrigFunc(); CCSPlayerItem *CSPlayerItem() const; #endif diff --git a/regamedll/public/regamedll/regamedll_api.h b/regamedll/public/regamedll/regamedll_api.h index d655ee656..71b9b44ba 100644 --- a/regamedll/public/regamedll/regamedll_api.h +++ b/regamedll/public/regamedll/regamedll_api.h @@ -628,6 +628,14 @@ typedef IHookChainRegistryClass IReGameHookRegistry_CBa typedef IHookChainClass IReGameHook_CBasePlayer_RemoveAllItems; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_RemoveAllItems; +// CBasePlayerItem::Materialize hook +typedef IHookChainClassImpl IReGameHook_CBasePlayerItem_Materialize; +typedef IHookChainRegistryClassImpl IReGameHookRegistry_CBasePlayerItem_Materialize; + +// CBasePlayerItem::CheckRespawn hook +typedef IHookChainClassImpl IReGameHook_CBasePlayerItem_CheckRespawn; +typedef IHookChainRegistryClassImpl IReGameHookRegistry_CBasePlayerItem_CheckRespawn; + class IReGameHookchains { public: virtual ~IReGameHookchains() {} @@ -790,6 +798,10 @@ 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_CBasePlayerItem_Materialize* CBasePlayerItem_Materialize() = 0; + virtual IReGameHookRegistry_CBasePlayerItem_CheckRespawn* CBasePlayerItem_CheckRespawn() = 0; + }; struct ReGameFuncs_t {