diff --git a/regamedll/dlls/API/CAPI_Impl.cpp b/regamedll/dlls/API/CAPI_Impl.cpp index 292d0b454..792bc3ef0 100644 --- a/regamedll/dlls/API/CAPI_Impl.cpp +++ b/regamedll/dlls/API/CAPI_Impl.cpp @@ -30,40 +30,133 @@ CReGameHookchains g_ReGameHookchains; -int EXT_FUNC Cmd_Argc_api() { +void EXT_FUNC Regamedll_ChangeString_api(char *&dest, const char *source) +{ + size_t len = Q_strlen(source); + if (dest == nullptr || Q_strlen(dest) != len) { + delete [] dest; + dest = new char [len + 1]; + } + + Q_strcpy(dest, source); +} + +void EXT_FUNC RadiusDamage_api(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType) +{ + RadiusDamage(vecSrc, pevInflictor, pevAttacker, flDamage, flRadius, iClassIgnore, bitsDamageType); +} + +void EXT_FUNC ClearMultiDamage_api() +{ + ClearMultiDamage(); +} + +void EXT_FUNC ApplyMultiDamage_api(entvars_t *pevInflictor, entvars_t *pevAttacker) +{ + ApplyMultiDamage(pevInflictor, pevAttacker); +} + +void EXT_FUNC AddMultiDamage_api(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType) +{ + AddMultiDamage(pevInflictor, pEntity, flDamage, bitsDamageType); +} + +int EXT_FUNC Cmd_Argc_api() +{ return CMD_ARGC_(); } -const char *EXT_FUNC Cmd_Argv_api(int i) { +const char *EXT_FUNC Cmd_Argv_api(int i) +{ return CMD_ARGV_(i); } -CGrenade *PlantBomb_api(entvars_t *pevOwner, Vector &vecStart, Vector &vecVelocity) { +CGrenade *EXT_FUNC PlantBomb_api(entvars_t *pevOwner, Vector &vecStart, Vector &vecVelocity) +{ return CGrenade::ShootSatchelCharge(pevOwner, vecStart, vecVelocity); } -CGib *SpawnHeadGib_api(entvars_t *pevVictim) { +CGib *EXT_FUNC SpawnHeadGib_api(entvars_t *pevVictim) +{ return CGib::SpawnHeadGib(pevVictim); } -void SpawnRandomGibs_api(entvars_t *pevVictim, int cGibs, int human) { +void EXT_FUNC SpawnRandomGibs_api(entvars_t *pevVictim, int cGibs, int human) +{ CGib::SpawnRandomGibs(pevVictim, cGibs, human); } +void EXT_FUNC UTIL_RestartOther_api(const char *szClassname) +{ + UTIL_RestartOther(szClassname); +} + +void EXT_FUNC UTIL_ResetEntities_api() +{ + UTIL_ResetEntities(); +} + +void EXT_FUNC UTIL_RemoveOther_api(const char *szClassname, int nCount) +{ + UTIL_RemoveOther(szClassname, nCount); +} + +void EXT_FUNC UTIL_DecalTrace_api(TraceResult *pTrace, int decalNumber) +{ + UTIL_DecalTrace(pTrace, decalNumber); +} + +void EXT_FUNC UTIL_Remove_api(CBaseEntity *pEntity) +{ + UTIL_Remove(pEntity); +} + +int EXT_FUNC AddAmmoNameToAmmoRegistry_api(const char *szAmmoname) +{ + return AddAmmoNameToAmmoRegistry(szAmmoname); +} + +void EXT_FUNC TextureTypePlaySound_api(TraceResult *ptr, Vector vecSrc, Vector vecEnd, int iBulletType) +{ + TEXTURETYPE_PlaySound(ptr, vecSrc, vecEnd, iBulletType); +} + +CWeaponBox *EXT_FUNC CreateWeaponBox_api(CBasePlayerItem *pItem, CBasePlayer *pPlayerOwner, const char *modelName, Vector &origin, Vector &angles, Vector &velocity, float lifeTime, bool packAmmo) +{ + return CreateWeaponBox(pItem, pPlayerOwner, modelName, origin, angles, velocity, lifeTime < 0.0 ? CGameRules::GetItemKillDelay() : lifeTime, packAmmo); +} + +CGrenade *EXT_FUNC SpawnGrenade_api(WeaponIdType weaponId, entvars_t *pevOwner, Vector &vecSrc, Vector &vecThrow, float time, int iTeam, unsigned short usEvent) +{ + switch (weaponId) + { + case WEAPON_HEGRENADE: + return CGrenade::ShootTimed2(pevOwner, vecSrc, vecThrow, time, iTeam, usEvent); + case WEAPON_FLASHBANG: + return CGrenade::ShootTimed(pevOwner, vecSrc, vecThrow, time); + case WEAPON_SMOKEGRENADE: + return CGrenade::ShootSmokeGrenade(pevOwner, vecSrc, vecThrow, time, usEvent); + case WEAPON_C4: + return CGrenade::ShootSatchelCharge(pevOwner, vecSrc, vecThrow); + } + + return nullptr; +} + ReGameFuncs_t g_ReGameApiFuncs = { - &CREATE_NAMED_ENTITY, + CREATE_NAMED_ENTITY, - &Regamedll_ChangeString_api, + Regamedll_ChangeString_api, - &RadiusDamage_api, - &ClearMultiDamage_api, - &ApplyMultiDamage_api, - &AddMultiDamage_api, + RadiusDamage_api, + ClearMultiDamage_api, + ApplyMultiDamage_api, + AddMultiDamage_api, - &UTIL_FindEntityByString, + UTIL_FindEntityByString, - &AddEntityHashValue, - &RemoveEntityHashValue, + AddEntityHashValue, + RemoveEntityHashValue, Cmd_Argc_api, Cmd_Argv_api, @@ -76,6 +169,13 @@ ReGameFuncs_t g_ReGameApiFuncs = { UTIL_RestartOther_api, UTIL_ResetEntities_api, UTIL_RemoveOther_api, + UTIL_DecalTrace_api, + UTIL_Remove_api, + + AddAmmoNameToAmmoRegistry_api, + TextureTypePlaySound_api, + CreateWeaponBox_api, + SpawnGrenade_api, }; GAMEHOOK_REGISTRY(CBasePlayer_Spawn); @@ -210,6 +310,27 @@ GAMEHOOK_REGISTRY(CBasePlayer_JoiningThink); GAMEHOOK_REGISTRY(FreeGameRules); GAMEHOOK_REGISTRY(PM_LadderMove); +GAMEHOOK_REGISTRY(PM_WaterJump); +GAMEHOOK_REGISTRY(PM_CheckWaterJump); +GAMEHOOK_REGISTRY(PM_Jump); +GAMEHOOK_REGISTRY(PM_Duck); +GAMEHOOK_REGISTRY(PM_UnDuck); +GAMEHOOK_REGISTRY(PM_PlayStepSound); +GAMEHOOK_REGISTRY(PM_AirAccelerate); +GAMEHOOK_REGISTRY(ClearMultiDamage); +GAMEHOOK_REGISTRY(AddMultiDamage); +GAMEHOOK_REGISTRY(ApplyMultiDamage); +GAMEHOOK_REGISTRY(BuyItem); +GAMEHOOK_REGISTRY(CSGameRules_Think); +GAMEHOOK_REGISTRY(CSGameRules_TeamFull); +GAMEHOOK_REGISTRY(CSGameRules_TeamStacked); +GAMEHOOK_REGISTRY(CSGameRules_PlayerGotWeapon); +GAMEHOOK_REGISTRY(CBotManager_OnEvent); +GAMEHOOK_REGISTRY(CBasePlayer_CheckTimeBasedDamage); +GAMEHOOK_REGISTRY(CBasePlayer_EntSelectSpawnPoint); +GAMEHOOK_REGISTRY(CBasePlayerWeapon_ItemPostFrame); +GAMEHOOK_REGISTRY(CBasePlayerWeapon_KickBack); +GAMEHOOK_REGISTRY(CBasePlayerWeapon_SendWeaponAnim); int CReGameApi::GetMajorVersion() { return REGAMEDLL_API_VERSION_MAJOR; @@ -272,48 +393,4 @@ bool CReGameApi::BGetIGameRules(const char *pchVersion) const return false; } -EXT_FUNC void Regamedll_ChangeString_api(char *&dest, const char *source) -{ - size_t len = Q_strlen(source); - if (dest == nullptr || Q_strlen(dest) != len) { - delete [] dest; - dest = new char [len + 1]; - } - - Q_strcpy(dest, source); -} - -EXT_FUNC void RadiusDamage_api(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType) -{ - RadiusDamage(vecSrc, pevInflictor, pevAttacker, flDamage, flRadius, iClassIgnore, bitsDamageType); -} - -EXT_FUNC void ClearMultiDamage_api() -{ - ClearMultiDamage(); -} - -EXT_FUNC void ApplyMultiDamage_api(entvars_t *pevInflictor, entvars_t *pevAttacker) -{ - ApplyMultiDamage(pevInflictor, pevAttacker); -} - -EXT_FUNC void AddMultiDamage_api(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType) -{ - AddMultiDamage(pevInflictor, pEntity, flDamage, bitsDamageType); -} - -EXT_FUNC void UTIL_RestartOther_api(const char *szClassname) { - UTIL_RestartOther(szClassname); -} - -EXT_FUNC void UTIL_ResetEntities_api() { - UTIL_ResetEntities(); -} - -EXT_FUNC void UTIL_RemoveOther_api(const char *szClassname, int nCount) -{ - UTIL_RemoveOther(szClassname, nCount); -} - EXPOSE_SINGLE_INTERFACE(CReGameApi, IReGameApi, VRE_GAMEDLL_API_VERSION); diff --git a/regamedll/dlls/API/CAPI_Impl.h b/regamedll/dlls/API/CAPI_Impl.h index 5c7169ae0..b6bc45dd0 100644 --- a/regamedll/dlls/API/CAPI_Impl.h +++ b/regamedll/dlls/API/CAPI_Impl.h @@ -357,10 +357,6 @@ typedef IHookChainRegistryImpl CReGameHookRegi typedef IHookChainImpl CReGameHook_PM_AirMove; typedef IHookChainRegistryImpl CReGameHookRegistry_PM_AirMove; -// PM_LadderMove hook -typedef IHookChainImpl CReGameHook_PM_LadderMove; -typedef IHookChainRegistryImpl CReGameHookRegistry_PM_LadderMove; - // HandleMenu_ChooseAppearance hook typedef IHookChainImpl CReGameHook_HandleMenu_ChooseAppearance; typedef IHookChainRegistryImpl CReGameHookRegistry_HandleMenu_ChooseAppearance; @@ -649,6 +645,94 @@ typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBase typedef IHookChainImpl CReGameHook_FreeGameRules; typedef IHookChainRegistryImpl CReGameHookRegistry_FreeGameRules; +// PM_LadderMove hook +typedef IHookChainImpl CReGameHook_PM_LadderMove; +typedef IHookChainRegistryImpl CReGameHookRegistry_PM_LadderMove; + +// PM_WaterJump hook +typedef IHookChainImpl CReGameHook_PM_WaterJump; +typedef IHookChainRegistryImpl CReGameHookRegistry_PM_WaterJump; + +// PM_CheckWaterJump hook +typedef IHookChainImpl CReGameHook_PM_CheckWaterJump; +typedef IHookChainRegistryImpl CReGameHookRegistry_PM_CheckWaterJump; + +// PM_Jump hook +typedef IHookChainImpl CReGameHook_PM_Jump; +typedef IHookChainRegistryImpl CReGameHookRegistry_PM_Jump; + +// PM_Duck hook +typedef IHookChainImpl CReGameHook_PM_Duck; +typedef IHookChainRegistryImpl CReGameHookRegistry_PM_Duck; + +// PM_UnDuck hook +typedef IHookChainImpl CReGameHook_PM_UnDuck; +typedef IHookChainRegistryImpl CReGameHookRegistry_PM_UnDuck; + +// PM_PlayStepSound hook +typedef IHookChainImpl CReGameHook_PM_PlayStepSound; +typedef IHookChainRegistryImpl CReGameHookRegistry_PM_PlayStepSound; + +// PM_AirAccelerate hook +typedef IHookChainImpl CReGameHook_PM_AirAccelerate; +typedef IHookChainRegistryImpl CReGameHookRegistry_PM_AirAccelerate; + +// ClearMultiDamage hook +typedef IHookChainImpl CReGameHook_ClearMultiDamage; +typedef IHookChainRegistryImpl CReGameHookRegistry_ClearMultiDamage; + +// AddMultiDamage hook +typedef IHookChainImpl CReGameHook_AddMultiDamage; +typedef IHookChainRegistryImpl CReGameHookRegistry_AddMultiDamage; + +// ApplyMultiDamage hook +typedef IHookChainImpl CReGameHook_ApplyMultiDamage; +typedef IHookChainRegistryImpl CReGameHookRegistry_ApplyMultiDamage; + +// BuyItem hook +typedef IHookChainImpl CReGameHook_BuyItem; +typedef IHookChainRegistryImpl CReGameHookRegistry_BuyItem; + +// CHalfLifeMultiplay::Think hook +typedef IHookChainClassImpl CReGameHook_CSGameRules_Think; +typedef IHookChainRegistryClassEmptyImpl CReGameHookRegistry_CSGameRules_Think; + +// CHalfLifeMultiplay::TeamFull hook +typedef IHookChainClassImpl CReGameHook_CSGameRules_TeamFull; +typedef IHookChainRegistryClassEmptyImpl CReGameHookRegistry_CSGameRules_TeamFull; + +// CHalfLifeMultiplay::TeamStacked hook +typedef IHookChainClassImpl CReGameHook_CSGameRules_TeamStacked; +typedef IHookChainRegistryClassEmptyImpl CReGameHookRegistry_CSGameRules_TeamStacked; + +// CHalfLifeMultiplay::PlayerGotWeapon hook +typedef IHookChainClassImpl CReGameHook_CSGameRules_PlayerGotWeapon; +typedef IHookChainRegistryClassEmptyImpl CReGameHookRegistry_CSGameRules_PlayerGotWeapon; + +// CBotManager::OnEvent hook +typedef IHookChainClassImpl CReGameHook_CBotManager_OnEvent; +typedef IHookChainRegistryClassEmptyImpl CReGameHookRegistry_CBotManager_OnEvent; + +// CBasePlayer::CheckTimeBasedDamage hook +typedef IHookChainClassImpl CReGameHook_CBasePlayer_CheckTimeBasedDamage; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_CheckTimeBasedDamage; + +// CBasePlayer::EntSelectSpawnPoint hook +typedef IHookChainClassImpl CReGameHook_CBasePlayer_EntSelectSpawnPoint; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_EntSelectSpawnPoint; + +// CBasePlayerWeapon::ItemPostFrame hook +typedef IHookChainClassImpl CReGameHook_CBasePlayerWeapon_ItemPostFrame; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayerWeapon_ItemPostFrame; + +// CBasePlayerWeapon::KickBack hook +typedef IHookChainClassImpl CReGameHook_CBasePlayerWeapon_KickBack; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayerWeapon_KickBack; + +// CBasePlayerWeapon::SendWeaponAnim hook +typedef IHookChainClassImpl CReGameHook_CBasePlayerWeapon_SendWeaponAnim; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayerWeapon_SendWeaponAnim; + class CReGameHookchains: public IReGameHookchains { public: // CBasePlayer virtual @@ -782,9 +866,29 @@ class CReGameHookchains: public IReGameHookchains { CReGameHookRegistry_CBasePlayer_DeathSound m_CBasePlayer_DeathSound; CReGameHookRegistry_CBasePlayer_JoiningThink m_CBasePlayer_JoiningThink; - CReGameHookRegistry_PM_LadderMove m_PM_LadderMove; - CReGameHookRegistry_FreeGameRules m_FreeGameRules; + CReGameHookRegistry_PM_LadderMove m_PM_LadderMove; + CReGameHookRegistry_PM_WaterJump m_PM_WaterJump; + CReGameHookRegistry_PM_CheckWaterJump m_PM_CheckWaterJump; + CReGameHookRegistry_PM_Jump m_PM_Jump; + CReGameHookRegistry_PM_Duck m_PM_Duck; + CReGameHookRegistry_PM_UnDuck m_PM_UnDuck; + CReGameHookRegistry_PM_PlayStepSound m_PM_PlayStepSound; + CReGameHookRegistry_PM_AirAccelerate m_PM_AirAccelerate; + CReGameHookRegistry_ClearMultiDamage m_ClearMultiDamage; + CReGameHookRegistry_AddMultiDamage m_AddMultiDamage; + CReGameHookRegistry_ApplyMultiDamage m_ApplyMultiDamage; + CReGameHookRegistry_BuyItem m_BuyItem; + CReGameHookRegistry_CSGameRules_Think m_CSGameRules_Think; + CReGameHookRegistry_CSGameRules_TeamFull m_CSGameRules_TeamFull; + CReGameHookRegistry_CSGameRules_TeamStacked m_CSGameRules_TeamStacked; + CReGameHookRegistry_CSGameRules_PlayerGotWeapon m_CSGameRules_PlayerGotWeapon; + CReGameHookRegistry_CBotManager_OnEvent m_CBotManager_OnEvent; + CReGameHookRegistry_CBasePlayer_CheckTimeBasedDamage m_CBasePlayer_CheckTimeBasedDamage; + CReGameHookRegistry_CBasePlayer_EntSelectSpawnPoint m_CBasePlayer_EntSelectSpawnPoint; + CReGameHookRegistry_CBasePlayerWeapon_ItemPostFrame m_CBasePlayerWeapon_ItemPostFrame; + CReGameHookRegistry_CBasePlayerWeapon_KickBack m_CBasePlayerWeapon_KickBack; + CReGameHookRegistry_CBasePlayerWeapon_SendWeaponAnim m_CBasePlayerWeapon_SendWeaponAnim; public: virtual IReGameHookRegistry_CBasePlayer_Spawn *CBasePlayer_Spawn(); @@ -919,6 +1023,27 @@ class CReGameHookchains: public IReGameHookchains { virtual IReGameHookRegistry_FreeGameRules *FreeGameRules(); virtual IReGameHookRegistry_PM_LadderMove *PM_LadderMove(); + virtual IReGameHookRegistry_PM_WaterJump *PM_WaterJump(); + virtual IReGameHookRegistry_PM_CheckWaterJump *PM_CheckWaterJump(); + virtual IReGameHookRegistry_PM_Jump *PM_Jump(); + virtual IReGameHookRegistry_PM_Duck *PM_Duck(); + virtual IReGameHookRegistry_PM_UnDuck *PM_UnDuck(); + virtual IReGameHookRegistry_PM_PlayStepSound *PM_PlayStepSound(); + virtual IReGameHookRegistry_PM_AirAccelerate *PM_AirAccelerate(); + virtual IReGameHookRegistry_ClearMultiDamage *ClearMultiDamage(); + virtual IReGameHookRegistry_AddMultiDamage *AddMultiDamage(); + virtual IReGameHookRegistry_ApplyMultiDamage *ApplyMultiDamage(); + virtual IReGameHookRegistry_BuyItem *BuyItem(); + virtual IReGameHookRegistry_CSGameRules_Think *CSGameRules_Think(); + virtual IReGameHookRegistry_CSGameRules_TeamFull *CSGameRules_TeamFull(); + virtual IReGameHookRegistry_CSGameRules_TeamStacked *CSGameRules_TeamStacked(); + virtual IReGameHookRegistry_CSGameRules_PlayerGotWeapon *CSGameRules_PlayerGotWeapon(); + virtual IReGameHookRegistry_CBotManager_OnEvent *CBotManager_OnEvent(); + virtual IReGameHookRegistry_CBasePlayer_CheckTimeBasedDamage *CBasePlayer_CheckTimeBasedDamage(); + virtual IReGameHookRegistry_CBasePlayer_EntSelectSpawnPoint *CBasePlayer_EntSelectSpawnPoint(); + virtual IReGameHookRegistry_CBasePlayerWeapon_ItemPostFrame *CBasePlayerWeapon_ItemPostFrame(); + virtual IReGameHookRegistry_CBasePlayerWeapon_KickBack *CBasePlayerWeapon_KickBack(); + virtual IReGameHookRegistry_CBasePlayerWeapon_SendWeaponAnim *CBasePlayerWeapon_SendWeaponAnim(); }; extern CReGameHookchains g_ReGameHookchains; @@ -945,14 +1070,3 @@ class CReGameApi: public IReGameApi { EXT_FUNC virtual bool BGetICSEntity(const char *pchVersion) const; EXT_FUNC virtual bool BGetIGameRules(const char *pchVersion) const; }; - -void Regamedll_ChangeString_api(char *&dest, const char *source); -void RadiusDamage_api(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType); - -void ClearMultiDamage_api(); -void ApplyMultiDamage_api(entvars_t *pevInflictor, entvars_t *pevAttacker); -void AddMultiDamage_api(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType); - -void UTIL_RestartOther_api(const char *szClassname); -void UTIL_ResetEntities_api(); -void UTIL_RemoveOther_api(const char *szClassname, int nCount = 0); diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index 22f58938b..58062fe2d 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -1194,7 +1194,9 @@ void BuyMachineGun(CBasePlayer *pPlayer, int iSlot) BuyWeaponByWeaponID(pPlayer, WEAPON_M249); } -void BuyItem(CBasePlayer *pPlayer, int iSlot) +LINK_HOOK_VOID_CHAIN(BuyItem, (CBasePlayer *pPlayer, int iSlot), pPlayer, iSlot) + +void EXT_FUNC __API_HOOK(BuyItem)(CBasePlayer *pPlayer, int iSlot) { int iItemPrice = 0; const char *pszItem = nullptr; diff --git a/regamedll/dlls/client.h b/regamedll/dlls/client.h index 28f06e41b..d873bd202 100644 --- a/regamedll/dlls/client.h +++ b/regamedll/dlls/client.h @@ -112,6 +112,7 @@ extern unsigned short g_iShadowSprite; void HandleMenu_ChooseAppearance_OrigFunc(CBasePlayer *pPlayer, int slot); BOOL HandleMenu_ChooseTeam_OrigFunc(CBasePlayer *pPlayer, int slot); bool BuyGunAmmo_OrigFunc(CBasePlayer *pPlayer, CBasePlayerItem *weapon, bool bBlinkMoney); +void BuyItem_OrigFunc(CBasePlayer *pPlayer, int iSlot); CBaseEntity *BuyWeaponByWeaponID_OrigFunc(CBasePlayer *pPlayer, WeaponIdType weaponID); void ShowMenu_OrigFunc(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText); void ShowVGUIMenu_OrigFunc(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu); diff --git a/regamedll/dlls/gamerules.h b/regamedll/dlls/gamerules.h index f6c621bd8..00d0116ff 100644 --- a/regamedll/dlls/gamerules.h +++ b/regamedll/dlls/gamerules.h @@ -570,6 +570,10 @@ class CHalfLifeMultiplay: public CGameRules void ChangeLevel_OrigFunc(); void GoToIntermission_OrigFunc(); void BalanceTeams_OrigFunc(); + void Think_OrigFunc(); + BOOL TeamFull_OrigFunc(int team_id); + BOOL TeamStacked_OrigFunc(int newTeam_id, int curTeam_id); + void PlayerGotWeapon_OrigFunc(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon); #endif public: diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index 03948aafa..0c45149cb 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -2122,7 +2122,9 @@ BOOL CHalfLifeMultiplay::IsThereABomb() return FALSE; } -BOOL CHalfLifeMultiplay::TeamFull(int team_id) +LINK_HOOK_CLASS_CUSTOM_CHAIN(BOOL, CHalfLifeMultiplay, CSGameRules, TeamFull, (int team_id), team_id) + +BOOL EXT_FUNC CHalfLifeMultiplay::__API_HOOK(TeamFull)(int team_id) { switch (team_id) { @@ -2136,8 +2138,10 @@ BOOL CHalfLifeMultiplay::TeamFull(int team_id) return FALSE; } +LINK_HOOK_CLASS_CUSTOM_CHAIN(BOOL, CHalfLifeMultiplay, CSGameRules, TeamStacked, (int newTeam_id, int curTeam_id), newTeam_id, curTeam_id) + // checks to see if the desired team is stacked, returns true if it is -BOOL CHalfLifeMultiplay::TeamStacked(int newTeam_id, int curTeam_id) +BOOL EXT_FUNC CHalfLifeMultiplay::__API_HOOK(TeamStacked)(int newTeam_id, int curTeam_id) { // players are allowed to change to their own team if (newTeam_id == curTeam_id) @@ -2370,7 +2374,9 @@ void CHalfLifeMultiplay::PickNextVIP() } } -void CHalfLifeMultiplay::Think() +LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(CHalfLifeMultiplay, CSGameRules, Think) + +void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(Think)() { MonitorTutorStatus(); m_VoiceGameMgr.Update(gpGlobals->frametime); @@ -4201,8 +4207,10 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(DeathNotice)(CBasePlayer *pVictim, MESSAGE_END(); } +LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN(CHalfLifeMultiplay, CSGameRules, PlayerGotWeapon, (CBasePlayer *pPlayer, CBasePlayerItem *pWeapon), pPlayer, pWeapon) + // Player has grabbed a weapon that was sitting in the world -void CHalfLifeMultiplay::PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) +void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(PlayerGotWeapon)(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) { ; } @@ -4888,7 +4896,7 @@ void CHalfLifeMultiplay::ProcessMapVote(CBasePlayer *pPlayer, int iVote) } } -LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(CHalfLifeMultiplay, CSGameRules, ChangeLevel); +LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(CHalfLifeMultiplay, CSGameRules, ChangeLevel) // Server is changing to a new level, check mapcycle.txt for map name and setup info void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(ChangeLevel)() diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 469eb4d6b..550311cb5 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -4778,6 +4778,8 @@ void EXT_FUNC CBasePlayer::__API_HOOK(PreThink)() #endif } +LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, CheckTimeBasedDamage) + // If player is taking time based damage, continue doing damage to player - // this simulates the effect of being poisoned, gassed, dosed with radiation etc - // anything that continues to do damage even after the initial contact stops. @@ -4786,7 +4788,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(PreThink)() // The m_bitsDamageType bit MUST be set if any damage is to be taken. // This routine will detect the initial on value of the m_bitsDamageType // and init the appropriate counter. Only processes damage every second. -void CBasePlayer::CheckTimeBasedDamage() +void EXT_FUNC CBasePlayer::__API_HOOK(CheckTimeBasedDamage)() { int i; byte bDuration = 0; @@ -5353,7 +5355,9 @@ CBaseEntity *g_pLastSpawn; CBaseEntity *g_pLastCTSpawn; CBaseEntity *g_pLastTerroristSpawn; -edict_t *CBasePlayer::EntSelectSpawnPoint() +LINK_HOOK_CLASS_CHAIN2(edict_t *, CBasePlayer, EntSelectSpawnPoint) + +edict_t *EXT_FUNC CBasePlayer::__API_HOOK(EntSelectSpawnPoint)() { CBaseEntity *pSpot; diff --git a/regamedll/dlls/player.h b/regamedll/dlls/player.h index f1e7009d5..77b9ac2c6 100644 --- a/regamedll/dlls/player.h +++ b/regamedll/dlls/player.h @@ -444,6 +444,8 @@ class CBasePlayer: public CBaseMonster { void Pain_OrigFunc(int iLastHitGroup, bool bHasArmour); void DeathSound_OrigFunc(); void JoiningThink_OrigFunc(); + void CheckTimeBasedDamage_OrigFunc(); + edict_t *EntSelectSpawnPoint_OrigFunc(); CCSPlayer *CSPlayer() const; #endif // REGAMEDLL_API diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index e341b1b7e..8acd53602 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -74,16 +74,20 @@ float GetBaseAccuracy(WeaponIdType id) return 0.0f; } +LINK_HOOK_VOID_CHAIN2(ClearMultiDamage) + // Resets the global multi damage accumulator -void ClearMultiDamage() +void EXT_FUNC __API_HOOK(ClearMultiDamage)() { gMultiDamage.pEntity = nullptr; gMultiDamage.amount = 0; gMultiDamage.type = 0; } +LINK_HOOK_VOID_CHAIN(ApplyMultiDamage, (entvars_t *pevInflictor, entvars_t *pevAttacker), pevInflictor, pevAttacker) + // Inflicts contents of global multi damage register on gMultiDamage.pEntity -void ApplyMultiDamage(entvars_t *pevInflictor, entvars_t *pevAttacker) +void EXT_FUNC __API_HOOK(ApplyMultiDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker) { if (!gMultiDamage.pEntity) return; @@ -92,7 +96,9 @@ void ApplyMultiDamage(entvars_t *pevInflictor, entvars_t *pevAttacker) } -void AddMultiDamage(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType) +LINK_HOOK_VOID_CHAIN(AddMultiDamage, (entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType), pevInflictor, pEntity, flDamage, bitsDamageType) + +void EXT_FUNC __API_HOOK(AddMultiDamage)(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType) { if (!pEntity) return; @@ -208,10 +214,16 @@ struct { #endif // Precaches the ammo and queues the ammo info for sending to clients -void AddAmmoNameToAmmoRegistry(const char *szAmmoname) +int AddAmmoNameToAmmoRegistry(const char *szAmmoname) { + // string validation + if (!szAmmoname || !szAmmoname[0]) + { + return -1; + } + // make sure it's not already in the registry - for (int i = 0; i < MAX_AMMO_SLOTS; i++) + for (int i = 1; i < MAX_AMMO_SLOTS; i++) { if (!CBasePlayerItem::m_AmmoInfoArray[i].pszName) continue; @@ -219,7 +231,7 @@ void AddAmmoNameToAmmoRegistry(const char *szAmmoname) if (!Q_stricmp(CBasePlayerItem::m_AmmoInfoArray[i].pszName, szAmmoname)) { // ammo already in registry, just quite - return; + return i; } } @@ -227,7 +239,7 @@ void AddAmmoNameToAmmoRegistry(const char *szAmmoname) assert(giAmmoIndex < MAX_AMMO_SLOTS); if (giAmmoIndex >= MAX_AMMO_SLOTS) - giAmmoIndex = 0; + giAmmoIndex = 1; #ifdef REGAMEDLL_ADD for (auto& ammo : ammoIndex) @@ -246,6 +258,8 @@ void AddAmmoNameToAmmoRegistry(const char *szAmmoname) // Yes, this info is redundant CBasePlayerItem::m_AmmoInfoArray[giAmmoIndex].iId = giAmmoIndex; + + return giAmmoIndex; } // Precaches the weapon and queues the weapon info for sending to clients @@ -269,15 +283,8 @@ void UTIL_PrecacheOtherWeapon(const char *szClassname) { CBasePlayerItem::m_ItemInfoArray[info.iId] = info; - if (info.pszAmmo1 && info.pszAmmo1[0] != '\0') - { - AddAmmoNameToAmmoRegistry(info.pszAmmo1); - } - - if (info.pszAmmo2 && info.pszAmmo2[0] != '\0') - { - AddAmmoNameToAmmoRegistry(info.pszAmmo2); - } + AddAmmoNameToAmmoRegistry(info.pszAmmo1); + AddAmmoNameToAmmoRegistry(info.pszAmmo2); } } @@ -691,7 +698,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; @@ -896,7 +905,9 @@ void CBasePlayerWeapon::HandleInfiniteAmmo() } } -void CBasePlayerWeapon::ItemPostFrame() +LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayerWeapon, ItemPostFrame) + +void EXT_FUNC CBasePlayerWeapon::__API_HOOK(ItemPostFrame)() { int usableButtons = m_pPlayer->pev->button; @@ -1285,7 +1296,9 @@ int CBasePlayerWeapon::UpdateClientData(CBasePlayer *pPlayer) return 1; } -void CBasePlayerWeapon::SendWeaponAnim(int iAnim, int skiplocal) +LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayerWeapon, SendWeaponAnim, (int iAnim, int skiplocal), iAnim, skiplocal) + +void EXT_FUNC CBasePlayerWeapon::__API_HOOK(SendWeaponAnim)(int iAnim, int skiplocal) { m_pPlayer->pev->weaponanim = iAnim; @@ -2644,3 +2657,4 @@ int CBasePlayerItem::iFlags() const { return m_ItemInfoEx.iFlags; } + diff --git a/regamedll/dlls/weapons.h b/regamedll/dlls/weapons.h index ad4662c1b..da2c9be6d 100644 --- a/regamedll/dlls/weapons.h +++ b/regamedll/dlls/weapons.h @@ -403,6 +403,9 @@ 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); + void SendWeaponAnim_OrigFunc(int iAnim, int skiplocal); + void ItemPostFrame_OrigFunc(); CCSPlayerWeapon *CSPlayerWeapon() const; #endif @@ -2162,7 +2165,13 @@ int DamageDecal(CBaseEntity *pEntity, int bitsDamageType); void DecalGunshot(TraceResult *pTrace, int iBulletType, bool ClientOnly, entvars_t *pShooter, bool bHitMetal); void EjectBrass(const Vector &vecOrigin, const Vector &vecLeft, const Vector &vecVelocity, float rotation, int model, int soundtype, int entityIndex); void EjectBrass2(const Vector &vecOrigin, const Vector &vecVelocity, float rotation, int model, int soundtype, entvars_t *pev); -void AddAmmoNameToAmmoRegistry(const char *szAmmoname); +int AddAmmoNameToAmmoRegistry(const char *szAmmoname); void UTIL_PrecacheOtherWeapon(const char *szClassname); BOOL CanAttack(float attack_time, float curtime, BOOL isPredicted); float GetBaseAccuracy(WeaponIdType id); + +#ifdef REGAMEDLL_API +void ClearMultiDamage_OrigFunc(); +void ApplyMultiDamage_OrigFunc(entvars_t *pevInflictor, entvars_t *pevAttacker); +void AddMultiDamage_OrigFunc(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType); +#endif diff --git a/regamedll/game_shared/bot/bot_manager.cpp b/regamedll/game_shared/bot/bot_manager.cpp index 6e75cef75..285a26a36 100644 --- a/regamedll/game_shared/bot/bot_manager.cpp +++ b/regamedll/game_shared/bot/bot_manager.cpp @@ -213,10 +213,12 @@ const char *CBotManager::GetNavMapFilename() const return filename; } +LINK_HOOK_CLASS_VOID_CHAIN(CBotManager, OnEvent, (GameEventType event, CBaseEntity* pEntity, CBaseEntity* pOther), event, pEntity, pOther) + // Invoked when given player does given event (some events have NULL player). // Events are propogated to all bots. // TODO: This has become the game-wide event dispatcher. We should restructure this. -void CBotManager::OnEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther) +void CBotManager::__API_HOOK(OnEvent)(GameEventType event, CBaseEntity* pEntity, CBaseEntity* pOther) { // propogate event to all bots for (int i = 1; i <= gpGlobals->maxClients; i++) diff --git a/regamedll/game_shared/bot/bot_manager.h b/regamedll/game_shared/bot/bot_manager.h index 788c54ca9..dfcfd8edc 100644 --- a/regamedll/game_shared/bot/bot_manager.h +++ b/regamedll/game_shared/bot/bot_manager.h @@ -81,6 +81,10 @@ class CBotManager virtual void OnEvent(GameEventType event, CBaseEntity *pEntity = nullptr, CBaseEntity *pOther = nullptr); // Invoked when event occurs in the game (some events have NULL entity). virtual unsigned int GetPlayerPriority(CBasePlayer *pPlayer) const = 0; // return priority of player (0 = max pri) +#ifdef REGAMEDLL_API + void OnEvent_OrigFunc(GameEventType event, CBaseEntity* pEntity = nullptr, CBaseEntity* pOther = nullptr); +#endif + public: const char *GetNavMapFilename() const; // return the filename for this map's "nav" file diff --git a/regamedll/pm_shared/pm_shared.cpp b/regamedll/pm_shared/pm_shared.cpp index b3b57fa5d..9ab5684cb 100644 --- a/regamedll/pm_shared/pm_shared.cpp +++ b/regamedll/pm_shared/pm_shared.cpp @@ -162,7 +162,9 @@ char EXT_FUNC PM_FindTextureType(char *name) return CHAR_TEX_CONCRETE; } -void PM_PlayStepSound(int step, float fvol) +LINK_HOOK_VOID_CHAIN(PM_PlayStepSound, (int step, float fvol), step, fvol) + +void EXT_FUNC __API_HOOK(PM_PlayStepSound)(int step, float fvol) { static int iSkipStep = 0; int irand; @@ -365,7 +367,7 @@ void PM_CatagorizeTextureType() pmove->chtexturetype = PM_FindTextureType(pmove->sztexturename); } -LINK_HOOK_VOID_CHAIN2(PM_UpdateStepSound); +LINK_HOOK_VOID_CHAIN2(PM_UpdateStepSound) void EXT_FUNC __API_HOOK(PM_UpdateStepSound)() { @@ -1127,7 +1129,9 @@ void PM_Friction() VectorCopy(newvel, pmove->velocity); } -void PM_AirAccelerate(vec_t *wishdir, float wishspeed, float accel) +LINK_HOOK_VOID_CHAIN(PM_AirAccelerate, (vec_t *wishdir, float wishspeed, float accel), wishdir, wishspeed, accel) + +void EXT_FUNC __API_HOOK(PM_AirAccelerate)(vec_t *wishdir, float wishspeed, float accel) { int i; float addspeed; @@ -1274,7 +1278,7 @@ void PM_WaterMove() PM_FlyMove(); } -LINK_HOOK_VOID_CHAIN(PM_AirMove, (int playerIndex = 0), pmove->player_index + 1); +LINK_HOOK_VOID_CHAIN(PM_AirMove, (int playerIndex = 0), pmove->player_index + 1) void EXT_FUNC __API_HOOK(PM_AirMove)(int playerIndex) { @@ -1793,7 +1797,9 @@ void PM_FixPlayerCrouchStuck(int direction) VectorCopy(test, pmove->origin); } -void PM_UnDuck() +LINK_HOOK_VOID_CHAIN2(PM_UnDuck) + +void EXT_FUNC __API_HOOK(PM_UnDuck)() { #ifdef REGAMEDLL_ADD if (unduck_method.value) @@ -1863,7 +1869,9 @@ void PM_UnDuck() } } -void PM_Duck() +LINK_HOOK_VOID_CHAIN2(PM_Duck) + +void EXT_FUNC __API_HOOK(PM_Duck)() { int buttonsChanged = (pmove->oldbuttons ^ pmove->cmd.buttons); // These buttons have changed this frame int nButtonPressed = buttonsChanged & pmove->cmd.buttons; // The changed ones still down are "pressed" @@ -1967,7 +1975,7 @@ void PM_Duck() } } -LINK_HOOK_VOID_CHAIN(PM_LadderMove, (physent_t *pLadder), pLadder); +LINK_HOOK_VOID_CHAIN(PM_LadderMove, (physent_t *pLadder), pLadder) void EXT_FUNC __API_HOOK(PM_LadderMove)(physent_t *pLadder) { @@ -2119,7 +2127,9 @@ physent_t *PM_Ladder() return nullptr; } -void PM_WaterJump() +LINK_HOOK_VOID_CHAIN2(PM_WaterJump) + +void EXT_FUNC __API_HOOK(PM_WaterJump)() { if (pmove->waterjumptime > 10000) { @@ -2344,7 +2354,9 @@ void PM_PreventMegaBunnyJumping() VectorScale(pmove->velocity, fraction, pmove->velocity); } -void PM_Jump() +LINK_HOOK_VOID_CHAIN2(PM_Jump) + +void EXT_FUNC __API_HOOK(PM_Jump)() { if (pmove->dead) { @@ -2516,7 +2528,9 @@ void PM_Jump() pmove->oldbuttons |= IN_JUMP; } -void PM_CheckWaterJump() +LINK_HOOK_VOID_CHAIN2(PM_CheckWaterJump) + +void EXT_FUNC __API_HOOK(PM_CheckWaterJump)() { vec3_t vecStart, vecEnd; vec3_t flatforward; @@ -3209,7 +3223,7 @@ void PM_CreateStuckTable() } } -LINK_HOOK_VOID_CHAIN(PM_Move, (struct playermove_s *ppmove, int server), ppmove, server); +LINK_HOOK_VOID_CHAIN(PM_Move, (struct playermove_s *ppmove, int server), ppmove, server) // This module implements the shared player physics code between any particular game and // the engine. The same PM_Move routine is built into the game .dll and the client .dll and is @@ -3254,7 +3268,7 @@ NOXREF int PM_GetPhysEntInfo(int ent) return -1; } -LINK_HOOK_VOID_CHAIN(PM_Init, (struct playermove_s *ppmove), ppmove); +LINK_HOOK_VOID_CHAIN(PM_Init, (struct playermove_s *ppmove), ppmove) void EXT_FUNC __API_HOOK(PM_Init)(struct playermove_s *ppmove) { diff --git a/regamedll/pm_shared/pm_shared.h b/regamedll/pm_shared/pm_shared.h index da15fb5b0..2c0385f40 100644 --- a/regamedll/pm_shared/pm_shared.h +++ b/regamedll/pm_shared/pm_shared.h @@ -85,6 +85,13 @@ void PM_Move_OrigFunc(struct playermove_s *ppmove, int server); void PM_AirMove_OrigFunc(int playerIndex = 0); void PM_UpdateStepSound_OrigFunc(); void PM_LadderMove_OrigFunc(physent_t *pLadder); +void PM_WaterJump_OrigFunc(); +void PM_CheckWaterJump_OrigFunc(); +void PM_Jump_OrigFunc(); +void PM_Duck_OrigFunc(); +void PM_UnDuck_OrigFunc(); +void PM_PlayStepSound_OrigFunc(int step, float fvol); +void PM_AirAccelerate_OrigFunc(vec_t *wishdir, float wishspeed, float accel); #else void PM_AirMove(int playerIndex = 0); #endif diff --git a/regamedll/public/regamedll/regamedll_api.h b/regamedll/public/regamedll/regamedll_api.h index 43b7825aa..57da8d290 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 22 +#define REGAMEDLL_API_VERSION_MINOR 23 // CBasePlayer::Spawn hook typedef IHookChainClass IReGameHook_CBasePlayer_Spawn; @@ -236,10 +236,6 @@ typedef IHookChainRegistry IReGameHookRegistry typedef IHookChain IReGameHook_PM_AirMove; typedef IHookChainRegistry IReGameHookRegistry_PM_AirMove; -// PM_LadderMove hook -typedef IHookChain IReGameHook_PM_LadderMove; -typedef IHookChainRegistry IReGameHookRegistry_PM_LadderMove; - // HandleMenu_ChooseAppearance hook typedef IHookChain IReGameHook_HandleMenu_ChooseAppearance; typedef IHookChainRegistry IReGameHookRegistry_HandleMenu_ChooseAppearance; @@ -528,6 +524,94 @@ typedef IHookChainRegistryClass IReGameHookRegistry_CBa typedef IHookChain IReGameHook_FreeGameRules; typedef IHookChainRegistry IReGameHookRegistry_FreeGameRules; +// PM_LadderMove hook +typedef IHookChain IReGameHook_PM_LadderMove; +typedef IHookChainRegistry IReGameHookRegistry_PM_LadderMove; + +// PM_WaterJump hook +typedef IHookChain IReGameHook_PM_WaterJump; +typedef IHookChainRegistry IReGameHookRegistry_PM_WaterJump; + +// PM_CheckWaterJump hook +typedef IHookChain IReGameHook_PM_CheckWaterJump; +typedef IHookChainRegistry IReGameHookRegistry_PM_CheckWaterJump; + +// PM_Jump hook +typedef IHookChain IReGameHook_PM_Jump; +typedef IHookChainRegistry IReGameHookRegistry_PM_Jump; + +// PM_Duck hook +typedef IHookChain IReGameHook_PM_Duck; +typedef IHookChainRegistry IReGameHookRegistry_PM_Duck; + +// PM_UnDuck hook +typedef IHookChain IReGameHook_PM_UnDuck; +typedef IHookChainRegistry IReGameHookRegistry_PM_UnDuck; + +// PM_PlayStepSound hook +typedef IHookChain IReGameHook_PM_PlayStepSound; +typedef IHookChainRegistry IReGameHookRegistry_PM_PlayStepSound; + +// PM_AirAccelerate hook +typedef IHookChain IReGameHook_PM_AirAccelerate; +typedef IHookChainRegistry IReGameHookRegistry_PM_AirAccelerate; + +// ClearMultiDamage hook +typedef IHookChain IReGameHook_ClearMultiDamage; +typedef IHookChainRegistry IReGameHookRegistry_ClearMultiDamage; + +// AddMultiDamage hook +typedef IHookChain IReGameHook_AddMultiDamage; +typedef IHookChainRegistry IReGameHookRegistry_AddMultiDamage; + +// ApplyMultiDamage hook +typedef IHookChain IReGameHook_ApplyMultiDamage; +typedef IHookChainRegistry IReGameHookRegistry_ApplyMultiDamage; + +// BuyItem hook +typedef IHookChain IReGameHook_BuyItem; +typedef IHookChainRegistry IReGameHookRegistry_BuyItem; + +// CHalfLifeMultiplay::Think hook +typedef IHookChain IReGameHook_CSGameRules_Think; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_Think; + +// CHalfLifeMultiplay::TeamFull hook +typedef IHookChain IReGameHook_CSGameRules_TeamFull; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_TeamFull; + +// CHalfLifeMultiplay::TeamStacked hook +typedef IHookChain IReGameHook_CSGameRules_TeamStacked; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_TeamStacked; + +// CHalfLifeMultiplay::PlayerGotWeapon hook +typedef IHookChain IReGameHook_CSGameRules_PlayerGotWeapon; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_PlayerGotWeapon; + +// CBotManager::OnEvent hook +typedef IHookChain IReGameHook_CBotManager_OnEvent; +typedef IHookChainRegistry IReGameHookRegistry_CBotManager_OnEvent; + +// CBasePlayer::CheckTimeBasedDamage hook +typedef IHookChainClass IReGameHook_CBasePlayer_CheckTimeBasedDamage; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_CheckTimeBasedDamage; + +// CBasePlayer::EntSelectSpawnPoint hook +typedef IHookChainClass IReGameHook_CBasePlayer_EntSelectSpawnPoint; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_EntSelectSpawnPoint; + +// CBasePlayerWeapon::ItemPostFrame hook +typedef IHookChainClass IReGameHook_CBasePlayerWeapon_ItemPostFrame; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayerWeapon_ItemPostFrame; + +// CBasePlayerWeapon::KickBack hook +typedef IHookChainClass IReGameHook_CBasePlayerWeapon_KickBack; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayerWeapon_KickBack; + +// CBasePlayerWeapon::SendWeaponAnim hook +typedef IHookChainClass IReGameHook_CBasePlayerWeapon_SendWeaponAnim; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayerWeapon_SendWeaponAnim; + class IReGameHookchains { public: virtual ~IReGameHookchains() {} @@ -664,6 +748,27 @@ class IReGameHookchains { virtual IReGameHookRegistry_FreeGameRules *FreeGameRules() = 0; virtual IReGameHookRegistry_PM_LadderMove *PM_LadderMove() = 0; + virtual IReGameHookRegistry_PM_WaterJump *PM_WaterJump() = 0; + virtual IReGameHookRegistry_PM_CheckWaterJump *PM_CheckWaterJump() = 0; + virtual IReGameHookRegistry_PM_Jump *PM_Jump() = 0; + virtual IReGameHookRegistry_PM_Duck *PM_Duck() = 0; + virtual IReGameHookRegistry_PM_UnDuck *PM_UnDuck() = 0; + virtual IReGameHookRegistry_PM_PlayStepSound *PM_PlayStepSound() = 0; + virtual IReGameHookRegistry_PM_AirAccelerate *PM_AirAccelerate() = 0; + virtual IReGameHookRegistry_ClearMultiDamage *ClearMultiDamage() = 0; + virtual IReGameHookRegistry_AddMultiDamage *AddMultiDamage() = 0; + virtual IReGameHookRegistry_ApplyMultiDamage *ApplyMultiDamage() = 0; + virtual IReGameHookRegistry_BuyItem *BuyItem() = 0; + virtual IReGameHookRegistry_CSGameRules_Think *CSGameRules_Think() = 0; + virtual IReGameHookRegistry_CSGameRules_TeamFull *CSGameRules_TeamFull() = 0; + virtual IReGameHookRegistry_CSGameRules_TeamStacked *CSGameRules_TeamStacked() = 0; + virtual IReGameHookRegistry_CSGameRules_PlayerGotWeapon *CSGameRules_PlayerGotWeapon() = 0; + virtual IReGameHookRegistry_CBotManager_OnEvent *CBotManager_OnEvent() = 0; + virtual IReGameHookRegistry_CBasePlayer_CheckTimeBasedDamage *CBasePlayer_CheckTimeBasedDamage() = 0; + virtual IReGameHookRegistry_CBasePlayer_EntSelectSpawnPoint *CBasePlayer_EntSelectSpawnPoint() = 0; + virtual IReGameHookRegistry_CBasePlayerWeapon_ItemPostFrame *CBasePlayerWeapon_ItemPostFrame() = 0; + virtual IReGameHookRegistry_CBasePlayerWeapon_KickBack *CBasePlayerWeapon_KickBack() = 0; + virtual IReGameHookRegistry_CBasePlayerWeapon_SendWeaponAnim *CBasePlayerWeapon_SendWeaponAnim() = 0; }; struct ReGameFuncs_t { @@ -684,6 +789,12 @@ struct ReGameFuncs_t { void (*UTIL_RestartOther)(const char *szClassname); void (*UTIL_ResetEntities)(); void (*UTIL_RemoveOther)(const char *szClassname, int nCount); + void (*UTIL_DecalTrace)(TraceResult *pTrace, int decalNumber); + void (*UTIL_Remove)(CBaseEntity *pEntity); + int (*AddAmmoNameToAmmoRegistry)(const char *szAmmoname); + void (*TextureTypePlaySound)(TraceResult *ptr, Vector vecSrc, Vector vecEnd, int iBulletType); + class CWeaponBox *(*CreateWeaponBox)(CBasePlayerItem *pItem, CBasePlayer *pPlayerOwner, const char *modelName, Vector &origin, Vector &angles, Vector &velocity, float lifeTime, bool packAmmo); + class CGrenade *(*SpawnGrenade)(WeaponIdType weaponId, entvars_t *pevOwner, Vector &vecSrc, Vector &vecThrow, float time, int iTeam, unsigned short usEvent); }; class IReGameApi {