From 28dcc802d4021dd28dcc81d1f28d7ccabb144916 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 8 Jun 2016 17:21:58 +0700 Subject: [PATCH] Update SDK regamedll --- reapi/include/cssdk/dlls/gamerules.h | 46 +++++++++++- reapi/include/cssdk/dlls/hookchains.h | 25 ++++++- reapi/include/cssdk/dlls/player.h | 12 ++- reapi/include/cssdk/dlls/regamedll_api.h | 73 +++++++++---------- .../include/cssdk/dlls/regamedll_interfaces.h | 6 +- reapi/src/hook_callback.cpp | 62 ++++++++-------- reapi/src/main.cpp | 5 +- reapi/src/member_list.cpp | 2 +- reapi/src/member_list.h | 2 +- reapi/src/natives/natives_misc.cpp | 2 +- 10 files changed, 148 insertions(+), 87 deletions(-) diff --git a/reapi/include/cssdk/dlls/gamerules.h b/reapi/include/cssdk/dlls/gamerules.h index 95afeb0..a7d0d33 100644 --- a/reapi/include/cssdk/dlls/gamerules.h +++ b/reapi/include/cssdk/dlls/gamerules.h @@ -90,6 +90,33 @@ enum ScenarioEventEndRound ROUND_GAME_COMMENCE, }; +enum RewardRules +{ + RR_CTS_WIN, + RR_TERRORISTS_WIN, + RR_TARGET_BOMB, + RR_VIP_ESCAPED, + RR_VIP_ASSASSINATED, + RR_TERRORISTS_ESCAPED, + RR_CTS_PREVENT_ESCAPE, + RR_ESCAPING_TERRORISTS_NEUTRALIZED, + RR_BOMB_DEFUSED, + RR_BOMB_PLANTED, + RR_BOMB_EXPLODED, + RR_ALL_HOSTAGES_RESCUED, + RR_TARGET_BOMB_SAVED, + RR_HOSTAGE_NOT_RESCUED, + RR_VIP_NOT_ESCAPED, + RR_LOSER_BONUS_DEFAULT, + RR_LOSER_BONUS_MIN, + RR_LOSER_BONUS_MAX, + RR_LOSER_BONUS_ADD, + RR_RESCUED_HOSTAGE, + RR_TOOK_HOSTAGE_ACC, + RR_TOOK_HOSTAGE, + RR_END +}; + // custom enum enum RewardAccount { @@ -371,6 +398,23 @@ public: virtual void GiveC4() = 0; virtual void ChangeLevel() = 0; virtual void GoToIntermission() = 0; + + // Setup counts for m_iNumTerrorist, m_iNumCT, m_iNumSpawnableTerrorist, m_iNumSpawnableCT, etc. + virtual void InitializePlayerCounts(int &NumAliveTerrorist, int &NumAliveCT, int &NumDeadTerrorist, int &NumDeadCT) = 0; + + virtual void BalanceTeams() = 0; + virtual void SwapAllPlayers() = 0; + virtual void UpdateTeamScores() = 0; + virtual void EndRoundMessage(const char *sentence, int event) = 0; + virtual void SetAccountRules(RewardRules rules, int amount) = 0; + + // BOMB MAP FUNCTIONS + virtual BOOL IsThereABomber() = 0; + virtual BOOL IsThereABomb() = 0; + + virtual bool HasRoundTimeExpired() = 0; + virtual bool IsBombPlanted() = 0; + public: bool ShouldSkipSpawn() const { return m_bSkipSpawn; } void MarkSpawnSkipped() { m_bSkipSpawn = false; } @@ -454,7 +498,7 @@ public: float m_flForceChaseCamValue; float m_flFadeToBlackValue; CBasePlayer *m_pVIP; - CBasePlayer *VIPQueue[MAX_VIP_QUEUES]; + CBasePlayer *m_pVIPQueue[MAX_VIP_QUEUES]; float m_flIntermissionEndTime; float m_flIntermissionStartTime; BOOL m_iEndIntermissionButtonHit; diff --git a/reapi/include/cssdk/dlls/hookchains.h b/reapi/include/cssdk/dlls/hookchains.h index f2993e8..408d8a4 100644 --- a/reapi/include/cssdk/dlls/hookchains.h +++ b/reapi/include/cssdk/dlls/hookchains.h @@ -37,6 +37,16 @@ public: virtual t_ret callOriginal(t_args... args) = 0; }; +template +class IHookChainClass { +protected: + virtual ~IHookChainClass() {} + +public: + virtual t_ret callNext(t_class *, t_args... args) = 0; + virtual t_ret callOriginal(t_class *, t_args... args) = 0; +}; + template class IVoidHookChain { @@ -48,6 +58,17 @@ public: virtual void callOriginal(t_args... args) = 0; }; +template +class IVoidHookChainClass +{ +protected: + virtual ~IVoidHookChainClass() {} + +public: + virtual void callNext(t_class *, t_args... args) = 0; + virtual void callOriginal(t_class *, t_args... args) = 0; +}; + // Hook chain registry(for hooks [un]registration) template class IHookChainRegistry { @@ -62,7 +83,7 @@ public: template class IHookChainRegistryClass { public: - typedef t_ret(*hookfunc_t)(IHookChain*, t_class *, t_args...); + typedef t_ret(*hookfunc_t)(IHookChainClass*, t_class *, t_args...); virtual void registerHook(hookfunc_t hook) = 0; virtual void unregisterHook(hookfunc_t hook) = 0; @@ -82,7 +103,7 @@ public: template class IVoidHookChainRegistryClass { public: - typedef void(*hookfunc_t)(IVoidHookChain*, t_class *, t_args...); + typedef void(*hookfunc_t)(IVoidHookChainClass*, t_class *, t_args...); virtual void registerHook(hookfunc_t hook) = 0; virtual void unregisterHook(hookfunc_t hook) = 0; diff --git a/reapi/include/cssdk/dlls/player.h b/reapi/include/cssdk/dlls/player.h index 44fece9..33984f5 100644 --- a/reapi/include/cssdk/dlls/player.h +++ b/reapi/include/cssdk/dlls/player.h @@ -67,13 +67,15 @@ // NOTE: It works for CZ #define MONEY_BLINK_AMOUNT 30 +// Player physics flags bits +// CBasePlayer::m_afPhysicsFlags #define PFLAG_ONLADDER (1<<0) #define PFLAG_ONSWING (1<<0) #define PFLAG_ONTRAIN (1<<1) #define PFLAG_ONBARNACLE (1<<2) -#define PFLAG_DUCKING (1<<3) -#define PFLAG_USING (1<<4) -#define PFLAG_OBSERVER (1<<5) +#define PFLAG_DUCKING (1<<3) // In the process of ducking, but totally squatted yet +#define PFLAG_USING (1<<4) // Using a continuous entity +#define PFLAG_OBSERVER (1<<5) // player is locked in stationary cam mode. Spectators can move, observers can't. #define TRAIN_OFF 0x00 #define TRAIN_NEUTRAL 0x01 @@ -215,7 +217,6 @@ enum JoinState SHOWTEAMSELECT, PICKINGTEAM, GETINTOGAME - }; enum TrackCommands @@ -229,7 +230,6 @@ enum TrackCommands CMD_LISTPLAYERS, CMD_NIGHTVISION, COMMANDS_TO_TRACK, - }; struct RebuyStruct @@ -244,7 +244,6 @@ struct RebuyStruct int m_defuser; int m_nightVision; int m_armor; - }; enum ThrowDirection @@ -256,7 +255,6 @@ enum ThrowDirection THROW_BOMB, THROW_GRENADE, THROW_HITVEL_MINUS_AIRVEL - }; enum sbar_data diff --git a/reapi/include/cssdk/dlls/regamedll_api.h b/reapi/include/cssdk/dlls/regamedll_api.h index 21a9d0f..7286b76 100644 --- a/reapi/include/cssdk/dlls/regamedll_api.h +++ b/reapi/include/cssdk/dlls/regamedll_api.h @@ -33,138 +33,134 @@ #include "player.h" #include "gamerules.h" -#define REGAMEDLL_API_VERSION_MAJOR 2 +#define REGAMEDLL_API_VERSION_MAJOR 3 #define REGAMEDLL_API_VERSION_MINOR 1 // CBasePlayer::Spawn hook -typedef IVoidHookChain<> IReGameHook_CBasePlayer_Spawn; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_Spawn; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Spawn; // CBasePlayer::Precache hook -typedef IVoidHookChain<> IReGameHook_CBasePlayer_Precache; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_Precache; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Precache; // CBasePlayer::ObjectCaps hook -typedef IHookChain IReGameHook_CBasePlayer_ObjectCaps; +typedef IHookChainClass IReGameHook_CBasePlayer_ObjectCaps; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_ObjectCaps; // CBasePlayer::Classify hook -typedef IHookChain IReGameHook_CBasePlayer_Classify; +typedef IHookChainClass IReGameHook_CBasePlayer_Classify; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Classify; // CBasePlayer::TraceAttack hook -typedef IVoidHookChain IReGameHook_CBasePlayer_TraceAttack; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_TraceAttack; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_TraceAttack; // CBasePlayer::TakeDamage hook -typedef IHookChain IReGameHook_CBasePlayer_TakeDamage; +typedef IHookChainClass IReGameHook_CBasePlayer_TakeDamage; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_TakeDamage; // CBasePlayer::TakeHealth hook -typedef IHookChain IReGameHook_CBasePlayer_TakeHealth; +typedef IHookChainClass IReGameHook_CBasePlayer_TakeHealth; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_TakeHealth; // CBasePlayer::Killed hook -typedef IVoidHookChain IReGameHook_CBasePlayer_Killed; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_Killed; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Killed; // CBasePlayer::AddPoints hook -typedef IVoidHookChain IReGameHook_CBasePlayer_AddPoints; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_AddPoints; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_AddPoints; // CBasePlayer::AddPointsToTeam hook -typedef IVoidHookChain IReGameHook_CBasePlayer_AddPointsToTeam; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_AddPointsToTeam; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_AddPointsToTeam; // CBasePlayer::AddPlayerItem hook -typedef IHookChain IReGameHook_CBasePlayer_AddPlayerItem; +typedef IHookChainClass IReGameHook_CBasePlayer_AddPlayerItem; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_AddPlayerItem; // CBasePlayer::RemovePlayerItem hook -typedef IHookChain IReGameHook_CBasePlayer_RemovePlayerItem; +typedef IHookChainClass IReGameHook_CBasePlayer_RemovePlayerItem; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_RemovePlayerItem; // CBasePlayer::GiveAmmo hook -typedef IHookChain IReGameHook_CBasePlayer_GiveAmmo; +typedef IHookChainClass IReGameHook_CBasePlayer_GiveAmmo; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GiveAmmo; // CBasePlayer::ResetMaxSpeed hook -typedef IVoidHookChain<> IReGameHook_CBasePlayer_ResetMaxSpeed; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_ResetMaxSpeed; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_ResetMaxSpeed; // CBasePlayer::Jump hook -typedef IVoidHookChain<> IReGameHook_CBasePlayer_Jump; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_Jump; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Jump; // CBasePlayer::Duck hook -typedef IVoidHookChain<> IReGameHook_CBasePlayer_Duck; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_Duck; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Duck; // CBasePlayer::PreThink hook -typedef IVoidHookChain<> IReGameHook_CBasePlayer_PreThink; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_PreThink; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_PreThink; // CBasePlayer::PostThink hook -typedef IVoidHookChain<> IReGameHook_CBasePlayer_PostThink; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_PostThink; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_PostThink; // CBasePlayer::UpdateClientData hook -typedef IVoidHookChain<> IReGameHook_CBasePlayer_UpdateClientData; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_UpdateClientData; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_UpdateClientData; // CBasePlayer::ImpulseCommands hook -typedef IVoidHookChain<> IReGameHook_CBasePlayer_ImpulseCommands; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_ImpulseCommands; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_ImpulseCommands; // CBasePlayer::RoundRespawn hook -typedef IVoidHookChain<> IReGameHook_CBasePlayer_RoundRespawn; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_RoundRespawn; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_RoundRespawn; // CBasePlayer::Blind hook -typedef IVoidHookChain IReGameHook_CBasePlayer_Blind; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_Blind; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Blind; // CBasePlayer::Observer_IsValidTarget hook -typedef IHookChain IReGameHook_CBasePlayer_Observer_IsValidTarget; +typedef IHookChainClass IReGameHook_CBasePlayer_Observer_IsValidTarget; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Observer_IsValidTarget; // CBasePlayer::SetAnimation hook -typedef IVoidHookChain IReGameHook_CBasePlayer_SetAnimation; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_SetAnimation; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_SetAnimation; // CBasePlayer::GiveDefaultItems hook -typedef IVoidHookChain<> IReGameHook_CBasePlayer_GiveDefaultItems; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_GiveDefaultItems; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GiveDefaultItems; // CBasePlayer::GiveNamedItem hook -typedef IVoidHookChain IReGameHook_CBasePlayer_GiveNamedItem; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_GiveNamedItem; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GiveNamedItem; // CBasePlayer::AddAccount hook -typedef IVoidHookChain IReGameHook_CBasePlayer_AddAccount; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_AddAccount; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_AddAccount; // CBasePlayer::GiveShield hook -typedef IVoidHookChain IReGameHook_CBasePlayer_GiveShield; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_GiveShield; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GiveShield; // CBasePlayer:SetClientUserInfoModel hook -typedef IVoidHookChain IReGameHook_CBasePlayer_SetClientUserInfoModel; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_SetClientUserInfoModel; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel; // CBasePlayer:SetClientUserInfoName hook -typedef IVoidHookChain IReGameHook_CBasePlayer_SetClientUserInfoName; +typedef IVoidHookChainClass IReGameHook_CBasePlayer_SetClientUserInfoName; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_SetClientUserInfoName; // CBaseAnimating::ResetSequenceInfo hook -typedef IVoidHookChain<> IReGameHook_CBaseAnimating_ResetSequenceInfo; +typedef IVoidHookChainClass IReGameHook_CBaseAnimating_ResetSequenceInfo; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo; - - - - // GetForceCamera hook typedef IHookChain IReGameHook_GetForceCamera; typedef IHookChainRegistry IReGameHookRegistry_GetForceCamera; @@ -339,6 +335,7 @@ public: virtual IReGameHookRegistry_CBasePlayer_AddAccount* CBasePlayer_AddAccount() = 0; virtual IReGameHookRegistry_CBasePlayer_GiveShield* CBasePlayer_GiveShield() = 0; virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel* CBasePlayer_SetClientUserInfoModel() = 0; + virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CBasePlayer_SetClientUserInfoName() = 0; virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CBaseAnimating_ResetSequenceInfo() = 0; virtual IReGameHookRegistry_GetForceCamera* GetForceCamera() = 0; @@ -377,9 +374,6 @@ public: virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel() = 0; virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission() = 0; virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0; - - // later sort them on the positions and change the major version - virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CBasePlayer_SetClientUserInfoName() = 0; }; struct ReGameFuncs_t { @@ -393,7 +387,6 @@ struct ReGameFuncs_t { void (*ApplyMultiDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker); void (*AddMultiDamage)(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType); - void (*EndRoundMessage)(const char *sentence, int event); class CBaseEntity *(*UTIL_FindEntityByString)(class CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue); }; diff --git a/reapi/include/cssdk/dlls/regamedll_interfaces.h b/reapi/include/cssdk/dlls/regamedll_interfaces.h index adbeea0..4d7b100 100644 --- a/reapi/include/cssdk/dlls/regamedll_interfaces.h +++ b/reapi/include/cssdk/dlls/regamedll_interfaces.h @@ -49,10 +49,12 @@ class CCSMonster: public CCSToggle {}; class CCSWeaponBox: public CCSEntity {}; class CCSArmoury: public CCSEntity {}; -#pragma warning(disable:4351) // new behavior: elements of array 'CCSPlayer::m_szModel' will be default initialized class CCSPlayer: public CCSMonster { public: - CCSPlayer() : m_szModel() {} + CCSPlayer() + { + m_szModel[0] = '\0'; + } virtual bool IsConnected() const; virtual void SetAnimation(PLAYER_ANIM playerAnim); diff --git a/reapi/src/hook_callback.cpp b/reapi/src/hook_callback.cpp index c1d2ffe..5952f41 100644 --- a/reapi/src/hook_callback.cpp +++ b/reapi/src/hook_callback.cpp @@ -52,7 +52,7 @@ void CBasePlayer_Spawn(IReGameHook_CBasePlayer_Spawn *chain, CBasePlayer *pthis) { auto original = [chain](int _pthis) { - chain->callNext(); + chain->callNext(getPrivate(_pthis)); }; callVoidForward(RG_CBasePlayer_Spawn, original, indexOfEdict(pthis->pev)); @@ -62,7 +62,7 @@ void CBasePlayer_Precache(IReGameHook_CBasePlayer_Precache *chain, CBasePlayer * { auto original = [chain](int _pthis) { - chain->callNext(); + chain->callNext(getPrivate(_pthis)); }; callVoidForward(RG_CBasePlayer_Precache, original, indexOfEdict(pthis->pev)); @@ -72,7 +72,7 @@ int CBasePlayer_ObjectCaps(IReGameHook_CBasePlayer_ObjectCaps *chain, CBasePlaye { auto original = [chain](int _pthis) { - return chain->callNext(); + return chain->callNext(getPrivate(_pthis)); }; return callForward(RG_CBasePlayer_ObjectCaps, original, indexOfEdict(pthis->pev)); @@ -82,7 +82,7 @@ int CBasePlayer_Classify(IReGameHook_CBasePlayer_Classify *chain, CBasePlayer *p { auto original = [chain](int _pthis) { - return chain->callNext(); + return chain->callNext(getPrivate(_pthis)); }; return callForward(RG_CBasePlayer_Classify, original, indexOfEdict(pthis->pev)); @@ -94,7 +94,7 @@ void CBasePlayer_TraceAttack(IReGameHook_CBasePlayer_TraceAttack *chain, CBasePl auto original = [chain, &vecDirCopy](int _pthis, int _pevAttacker, float _flDamage, cell _vecDir, TraceResult *_ptr, int _bitsDamageType) { - chain->callNext(PEV(_pevAttacker), _flDamage, vecDirCopy, _ptr, _bitsDamageType); + chain->callNext(getPrivate(_pthis), PEV(_pevAttacker), _flDamage, vecDirCopy, _ptr, _bitsDamageType); }; callVoidForward(RG_CBasePlayer_TraceAttack, original, indexOfEdict(pthis->pev), indexOfEdict(pevAttacker), flDamage, g_amxxapi.PrepareCellArrayA(reinterpret_cast(&vecDirCopy), 3, true), ptr, bitsDamageType); @@ -104,7 +104,7 @@ int CBasePlayer_TakeDamage(IReGameHook_CBasePlayer_TakeDamage *chain, CBasePlaye { auto original = [chain](int _pthis, int _pevInflictor, int _pevAttacker, volatile float& _flDamage, int _bitsDamageType) { - return chain->callNext(PEV(_pevInflictor), PEV(_pevAttacker), const_cast(_flDamage), _bitsDamageType); + return chain->callNext(getPrivate(_pthis), PEV(_pevInflictor), PEV(_pevAttacker), const_cast(_flDamage), _bitsDamageType); }; return callForward(RG_CBasePlayer_TakeDamage, original, indexOfEdict(pthis->pev), indexOfEdict(pevInflictor), indexOfEdict(pevAttacker), flDamage, bitsDamageType); @@ -114,7 +114,7 @@ int CBasePlayer_TakeHealth(IReGameHook_CBasePlayer_TakeHealth *chain, CBasePlaye { auto original = [chain](int _pthis, float _flHealth, int _bitsDamageType) { - return chain->callNext(_flHealth, _bitsDamageType); + return chain->callNext(getPrivate(_pthis), _flHealth, _bitsDamageType); }; return callForward(RG_CBasePlayer_TakeHealth, original, indexOfEdict(pthis->pev), flHealth, bitsDamageType); @@ -124,7 +124,7 @@ void CBasePlayer_Killed(IReGameHook_CBasePlayer_Killed *chain, CBasePlayer *pthi { auto original = [chain](int _pthis, int _pevAttacker, int _iGib) { - chain->callNext(PEV(_pevAttacker), _iGib); + chain->callNext(getPrivate(_pthis), PEV(_pevAttacker), _iGib); }; callVoidForward(RG_CBasePlayer_Killed, original, indexOfEdict(pthis->pev), indexOfEdict(pevAttacker), iGib); @@ -134,7 +134,7 @@ void CBasePlayer_AddPoints(IReGameHook_CBasePlayer_AddPoints *chain, CBasePlayer { auto original = [chain](int _pthis, int _score, BOOL _bAllowNegativeScore) { - chain->callNext(_score, _bAllowNegativeScore); + chain->callNext(getPrivate(_pthis), _score, _bAllowNegativeScore); }; callVoidForward(RG_CBasePlayer_AddPoints, original, indexOfEdict(pthis->pev), score, bAllowNegativeScore); @@ -144,7 +144,7 @@ void CBasePlayer_AddPointsToTeam(IReGameHook_CBasePlayer_AddPointsToTeam *chain, { auto original = [chain](int _pthis, int _score, BOOL _bAllowNegativeScore) { - chain->callNext(_score, _bAllowNegativeScore); + chain->callNext(getPrivate(_pthis), _score, _bAllowNegativeScore); }; callVoidForward(RG_CBasePlayer_AddPointsToTeam, original, indexOfEdict(pthis->pev), score, bAllowNegativeScore); @@ -154,7 +154,7 @@ BOOL CBasePlayer_AddPlayerItem(IReGameHook_CBasePlayer_AddPlayerItem *chain, CBa { auto original = [chain](int _pthis, int _pItem) { - return chain->callNext(getPrivate(_pItem)); + return chain->callNext(getPrivate(_pthis), getPrivate(_pItem)); }; return callForward(RG_CBasePlayer_AddPlayerItem, original, indexOfEdict(pthis->pev), indexOfEdict(pItem->pev)); @@ -164,7 +164,7 @@ BOOL CBasePlayer_RemovePlayerItem(IReGameHook_CBasePlayer_RemovePlayerItem *chai { auto original = [chain](int _pthis, int _pItem) { - return chain->callNext(getPrivate(_pItem)); + return chain->callNext(getPrivate(_pthis), getPrivate(_pItem)); }; return callForward(RG_CBasePlayer_RemovePlayerItem, original, indexOfEdict(pthis->pev), indexOfEdict(pItem->pev)); @@ -174,7 +174,7 @@ int CBasePlayer_GiveAmmo(IReGameHook_CBasePlayer_GiveAmmo *chain, CBasePlayer *p { auto original = [chain](int _pthis, int _iAmount, char *_szName, int _iMax) { - return chain->callNext(_iAmount, _szName, _iMax); + return chain->callNext(getPrivate(_pthis), _iAmount, _szName, _iMax); }; return callForward(RG_CBasePlayer_GiveAmmo, original, indexOfEdict(pthis->pev), iAmount, szName, iMax); @@ -184,7 +184,7 @@ void CBasePlayer_ResetMaxSpeed(IReGameHook_CBasePlayer_ResetMaxSpeed *chain, CBa { auto original = [chain](int _pthis) { - chain->callNext(); + chain->callNext(getPrivate(_pthis)); }; callVoidForward(RG_CBasePlayer_ResetMaxSpeed, original, indexOfEdict(pthis->pev)); @@ -194,7 +194,7 @@ void CBasePlayer_Jump(IReGameHook_CBasePlayer_Jump *chain, CBasePlayer *pthis) { auto original = [chain](int _pthis) { - chain->callNext(); + chain->callNext(getPrivate(_pthis)); }; callVoidForward(RG_CBasePlayer_Jump, original, indexOfEdict(pthis->pev)); @@ -204,7 +204,7 @@ void CBasePlayer_Duck(IReGameHook_CBasePlayer_Duck *chain, CBasePlayer *pthis) { auto original = [chain](int _pthis) { - chain->callNext(); + chain->callNext(getPrivate(_pthis)); }; callVoidForward(RG_CBasePlayer_Duck, original, indexOfEdict(pthis->pev)); @@ -214,7 +214,7 @@ void CBasePlayer_PreThink(IReGameHook_CBasePlayer_PreThink *chain, CBasePlayer * { auto original = [chain](int _pthis) { - chain->callNext(); + chain->callNext(getPrivate(_pthis)); }; callVoidForward(RG_CBasePlayer_PreThink, original, indexOfEdict(pthis->pev)); @@ -224,7 +224,7 @@ void CBasePlayer_PostThink(IReGameHook_CBasePlayer_PostThink *chain, CBasePlayer { auto original = [chain](int _pthis) { - chain->callNext(); + chain->callNext(getPrivate(_pthis)); }; callVoidForward(RG_CBasePlayer_PostThink, original, indexOfEdict(pthis->pev)); @@ -234,7 +234,7 @@ void CBasePlayer_UpdateClientData(IReGameHook_CBasePlayer_UpdateClientData *chai { auto original = [chain](int _pthis) { - chain->callNext(); + chain->callNext(getPrivate(_pthis)); }; callVoidForward(RG_CBasePlayer_UpdateClientData, original, indexOfEdict(pthis->pev)); @@ -244,7 +244,7 @@ void CBasePlayer_ImpulseCommands(IReGameHook_CBasePlayer_ImpulseCommands *chain, { auto original = [chain](int _pthis) { - chain->callNext(); + chain->callNext(getPrivate(_pthis)); }; callVoidForward(RG_CBasePlayer_ImpulseCommands, original, indexOfEdict(pthis->pev)); @@ -254,7 +254,7 @@ void CBasePlayer_RoundRespawn(IReGameHook_CBasePlayer_RoundRespawn *chain, CBase { auto original = [chain](int _pthis) { - chain->callNext(); + chain->callNext(getPrivate(_pthis)); }; callVoidForward(RG_CBasePlayer_RoundRespawn, original, indexOfEdict(pthis->pev)); @@ -264,7 +264,7 @@ void CBasePlayer_Blind(IReGameHook_CBasePlayer_Blind *chain, CBasePlayer *pthis, { auto original = [chain](int _pthis, float _flUntilTime, float _flHoldTime, float _flFadeTime, int _iAlpha) { - chain->callNext(_flUntilTime, _flHoldTime, _flFadeTime, _iAlpha); + chain->callNext(getPrivate(_pthis), _flUntilTime, _flHoldTime, _flFadeTime, _iAlpha); }; callVoidForward(RG_CBasePlayer_Blind, original, indexOfEdict(pthis->pev), flUntilTime, flHoldTime, flFadeTime, iAlpha); @@ -274,7 +274,7 @@ CBasePlayer *CBasePlayer_Observer_IsValidTarget(IReGameHook_CBasePlayer_Observer { auto original = [chain](int _pthis, int _iPlayerIndex, bool _bSameTeam) { - return indexOfEdict(chain->callNext(_iPlayerIndex, _bSameTeam)->pev); + return indexOfEdict(chain->callNext(getPrivate(_pthis), _iPlayerIndex, _bSameTeam)->pev); }; return getPrivate(callForward(RG_CBasePlayer_Observer_IsValidTarget, original, indexOfEdict(pthis->pev), iPlayerIndex, bSameTeam)); @@ -284,7 +284,7 @@ void CBasePlayer_SetAnimation(IReGameHook_CBasePlayer_SetAnimation *chain, CBase { auto original = [chain](int _pthis, PLAYER_ANIM _playerAnim) { - chain->callNext(_playerAnim); + chain->callNext(getPrivate(_pthis), _playerAnim); }; callVoidForward(RG_CBasePlayer_SetAnimation, original, indexOfEdict(pthis->pev), playerAnim); @@ -294,7 +294,7 @@ void CBasePlayer_GiveDefaultItems(IReGameHook_CBasePlayer_GiveDefaultItems *chai { auto original = [chain](int _pthis) { - chain->callNext(); + chain->callNext(getPrivate(_pthis)); }; callVoidForward(RG_CBasePlayer_GiveDefaultItems, original, indexOfEdict(pthis->pev)); @@ -304,7 +304,7 @@ void CBasePlayer_GiveNamedItem(IReGameHook_CBasePlayer_GiveNamedItem *chain, CBa { auto original = [chain](int _pthis, const char *_pszName) { - chain->callNext(_pszName); + chain->callNext(getPrivate(_pthis), _pszName); }; callVoidForward(RG_CBasePlayer_GiveNamedItem, original, indexOfEdict(pthis->pev), pszName); @@ -314,7 +314,7 @@ void CBasePlayer_AddAccount(IReGameHook_CBasePlayer_AddAccount *chain, CBasePlay { auto original = [chain](int _pthis, int _amount, RewardType _type, bool _bTrackChange) { - chain->callNext(_amount, _type, _bTrackChange); + chain->callNext(getPrivate(_pthis), _amount, _type, _bTrackChange); }; callVoidForward(RG_CBasePlayer_AddAccount, original, indexOfEdict(pthis->pev), amount, type, bTrackChange); @@ -324,7 +324,7 @@ void CBasePlayer_GiveShield(IReGameHook_CBasePlayer_GiveShield *chain, CBasePlay { auto original = [chain](int _pthis, bool _bDeploy) { - chain->callNext(_bDeploy); + chain->callNext(getPrivate(_pthis), _bDeploy); }; callVoidForward(RG_CBasePlayer_GiveShield, original, indexOfEdict(pthis->pev), bDeploy); @@ -334,7 +334,7 @@ void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceIn { auto original = [chain](int _pthis) { - chain->callNext(); + chain->callNext(getPrivate(_pthis)); }; callVoidForward(RG_CBaseAnimating_ResetSequenceInfo, original, indexOfEdict(pthis->pev)); @@ -638,7 +638,7 @@ void CBasePlayer_SetClientUserInfoModel(IReGameHook_CBasePlayer_SetClientUserInf { auto original = [chain](int _pthis, char *_infobuffer, char *_szNewModel) { - chain->callNext(_infobuffer, _szNewModel); + chain->callNext(getPrivate(_pthis), _infobuffer, _szNewModel); }; callVoidForward(RG_CBasePlayer_SetClientUserInfoModel, original, indexOfEdict(pthis->pev), infobuffer, szNewModel); @@ -648,7 +648,7 @@ void CBasePlayer_SetClientUserInfoName(IReGameHook_CBasePlayer_SetClientUserInfo { auto original = [chain](int _pthis, char *_infobuffer, char *_szNewName) { - chain->callNext(_infobuffer, _szNewName); + chain->callNext(getPrivate(_pthis), _infobuffer, _szNewName); }; callVoidForward(RG_CBasePlayer_SetClientUserInfoName, original, indexOfEdict(pthis->pev), infobuffer, szNewName); diff --git a/reapi/src/main.cpp b/reapi/src/main.cpp index a03ba9e..2eb19e8 100644 --- a/reapi/src/main.cpp +++ b/reapi/src/main.cpp @@ -74,7 +74,10 @@ int DispatchSpawn(edict_t* pEntity) g_szMapName[sizeof(g_szMapName) - 1] = '\0'; g_pEdicts = g_engfuncs.pfnPEntityOfEntIndex(0); - g_pMove = g_ReGameApi->GetPlayerMove(); + if (api_cfg.hasReGameDLL()) { + g_pMove = g_ReGameApi->GetPlayerMove(); + } + g_pFunctionTable->pfnSpawn = nullptr; RETURN_META_VALUE(MRES_IGNORED, 0); } diff --git a/reapi/src/member_list.cpp b/reapi/src/member_list.cpp index fe2f38a..19fc3ba 100644 --- a/reapi/src/member_list.cpp +++ b/reapi/src/member_list.cpp @@ -153,7 +153,7 @@ member_t memberlist_gamerules[] = { GM_MEMBERS(m_flForceChaseCamValue), GM_MEMBERS(m_flFadeToBlackValue), GM_MEMBERS(m_pVIP), - GM_MEMBERS(VIPQueue), + GM_MEMBERS(m_pVIPQueue), GM_MEMBERS(m_flIntermissionEndTime), GM_MEMBERS(m_flIntermissionStartTime), GM_MEMBERS(m_iEndIntermissionButtonHit), diff --git a/reapi/src/member_list.h b/reapi/src/member_list.h index 4ce0385..8a790f3 100644 --- a/reapi/src/member_list.h +++ b/reapi/src/member_list.h @@ -130,7 +130,7 @@ enum CSGameRules_Members m_flForceChaseCamValue, m_flFadeToBlackValue, m_pVIP, - VIPQueue, + m_pVIPQueue, m_flIntermissionEndTime, m_flIntermissionStartTime, m_iEndIntermissionButtonHit, diff --git a/reapi/src/natives/natives_misc.cpp b/reapi/src/natives/natives_misc.cpp index aa27b06..e6eaeeb 100644 --- a/reapi/src/natives/natives_misc.cpp +++ b/reapi/src/natives/natives_misc.cpp @@ -420,7 +420,7 @@ cell AMX_NATIVE_CALL rg_round_end(AMX *amx, cell *params) Broadcast(_sentence); if (_message[0]) - g_ReGameFuncs->EndRoundMessage(_message, event); + CSGameRules()->EndRoundMessage(_message, event); CSGameRules()->TerminateRound(CAmxArg(amx, params[arg_delay]), winstatus); return TRUE;