From e51d1442a2c10c50fc0fb408b2767a6c76e637a5 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 27 Apr 2016 03:06:55 +0600 Subject: [PATCH] Refactoring memberlist --- reapi/include/cssdk/dlls/gamerules.h | 2 +- reapi/include/cssdk/dlls/regamedll_api.h | 4 +- reapi/src/hook_callback.cpp | 20 +- reapi/src/hook_callback.h | 6 +- reapi/src/hook_list.cpp | 2 +- reapi/src/member_list.cpp | 670 ++++++++++++----------- reapi/src/member_list.h | 3 +- reapi/src/natives/natives_members.cpp | 63 ++- reapi/src/natives/natives_misc.cpp | 46 +- 9 files changed, 438 insertions(+), 378 deletions(-) diff --git a/reapi/include/cssdk/dlls/gamerules.h b/reapi/include/cssdk/dlls/gamerules.h index a3eef12..95afeb0 100644 --- a/reapi/include/cssdk/dlls/gamerules.h +++ b/reapi/include/cssdk/dlls/gamerules.h @@ -69,7 +69,7 @@ enum // custom enum // used for EndRoundMessage() logged messages -enum ScenarionEventEndRound +enum ScenarioEventEndRound { ROUND_NONE, ROUND_TARGET_BOMB, diff --git a/reapi/include/cssdk/dlls/regamedll_api.h b/reapi/include/cssdk/dlls/regamedll_api.h index 02be70b..1f6ea12 100644 --- a/reapi/include/cssdk/dlls/regamedll_api.h +++ b/reapi/include/cssdk/dlls/regamedll_api.h @@ -171,8 +171,8 @@ typedef IVoidHookChain IReGameHookRegistry_RadiusFlash_TraceLine; // RoundEnd hook -typedef IHookChain IReGameHook_RoundEnd; -typedef IHookChainRegistryClassEmpty IReGameHookRegistry_RoundEnd; +typedef IHookChain IReGameHook_RoundEnd; +typedef IHookChainRegistryClassEmpty IReGameHookRegistry_RoundEnd; class IReGameHookchains { public: diff --git a/reapi/src/hook_callback.cpp b/reapi/src/hook_callback.cpp index b05e9ce..3193df1 100644 --- a/reapi/src/hook_callback.cpp +++ b/reapi/src/hook_callback.cpp @@ -54,7 +54,7 @@ void CBasePlayer_Spawn(IReGameHook_CBasePlayer_Spawn *chain, CBasePlayer *pthis) { chain->callNext(); }; - + callVoidForward(RG_CBasePlayer_Spawn, original, pthis->entindex()); } @@ -92,12 +92,12 @@ void CBasePlayer_TraceAttack(IReGameHook_CBasePlayer_TraceAttack *chain, CBasePl { Vector vecDirCopy(vecDir); - auto original = [chain, &vecDirCopy](int _pthis, int _pevAttacker, float _flDamage, cell _vecDir, int _ptr, int _bitsDamageType) + auto original = [chain, &vecDirCopy](int _pthis, int _pevAttacker, float _flDamage, cell _vecDir, TraceResult *_ptr, int _bitsDamageType) { - chain->callNext(PEV(_pevAttacker), _flDamage, vecDirCopy, (TraceResult *)_ptr, _bitsDamageType); + chain->callNext(PEV(_pevAttacker), _flDamage, vecDirCopy, _ptr, _bitsDamageType); }; - callVoidForward(RG_CBasePlayer_TraceAttack, original, pthis->entindex(), indexOfEdict(pevAttacker), flDamage, g_amxxapi.PrepareCellArrayA(reinterpret_cast(&vecDirCopy), 3, true), int(ptr), bitsDamageType); + callVoidForward(RG_CBasePlayer_TraceAttack, original, pthis->entindex(), indexOfEdict(pevAttacker), flDamage, g_amxxapi.PrepareCellArrayA(reinterpret_cast(&vecDirCopy), 3, true), ptr, bitsDamageType); } int CBasePlayer_TakeDamage(IReGameHook_CBasePlayer_TakeDamage *chain, CBasePlayer *pthis, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) @@ -366,21 +366,21 @@ void RadiusFlash_TraceLine(IReGameHook_RadiusFlash_TraceLine *chain, CBasePlayer { Vector vecSrcCopy(vecSrc), vecSpotCopy(vecSpot); - auto original = [chain, &vecSrcCopy, &vecSpotCopy](int _pPlayer, int _pevInflictor, int _pevAttacker, cell _vecSrc, cell _vecSpot, int _ptr) + auto original = [chain, &vecSrcCopy, &vecSpotCopy](int _pPlayer, int _pevInflictor, int _pevAttacker, cell _vecSrc, cell _vecSpot, TraceResult *_ptr) { - chain->callNext(getPrivate(_pPlayer), PEV(_pevInflictor), PEV(_pevAttacker), vecSrcCopy, vecSpotCopy, (TraceResult *)_ptr); + chain->callNext(getPrivate(_pPlayer), PEV(_pevInflictor), PEV(_pevAttacker), vecSrcCopy, vecSpotCopy, _ptr); }; - callVoidForward(RG_RadiusFlash_TraceLine, original, pPlayer->entindex(), indexOfEdict(pevInflictor), indexOfEdict(pevAttacker), g_amxxapi.PrepareCellArrayA(reinterpret_cast(&vecSrcCopy), 3, true), g_amxxapi.PrepareCellArrayA(reinterpret_cast(&vecSpotCopy), 3, true), int(ptr)); + callVoidForward(RG_RadiusFlash_TraceLine, original, pPlayer->entindex(), indexOfEdict(pevInflictor), indexOfEdict(pevAttacker), g_amxxapi.PrepareCellArrayA(reinterpret_cast(&vecSrcCopy), 3, true), g_amxxapi.PrepareCellArrayA(reinterpret_cast(&vecSpotCopy), 3, true), ptr); } -bool RoundEnd(IReGameHook_RoundEnd *chain, int winStatus, ScenarionEventEndRound event, float tmDelay) +bool RoundEnd(IReGameHook_RoundEnd *chain, int winStatus, ScenarioEventEndRound event, float tmDelay) { - auto original = [chain](int _winStatus, ScenarionEventEndRound _event, float _tmDelay) + auto original = [chain](int _winStatus, ScenarioEventEndRound _event, float _tmDelay) { return chain->callNext(_winStatus, _event, _tmDelay); }; - + return callForward(RG_RoundEnd, original, winStatus, event, tmDelay); } diff --git a/reapi/src/hook_callback.h b/reapi/src/hook_callback.h index aef4072..b9d1605 100644 --- a/reapi/src/hook_callback.h +++ b/reapi/src/hook_callback.h @@ -34,11 +34,13 @@ struct retval_t inline AType getApiType(int) { return ATYPE_INTEGER; } inline AType getApiType(unsigned) { return ATYPE_INTEGER; } -inline AType getApiType(cvar_s *) { return ATYPE_INTEGER; } inline AType getApiType(float) { return ATYPE_FLOAT; } inline AType getApiType(const char *) { return ATYPE_STRING; } inline AType getApiType(CBaseEntity *) { return ATYPE_CLASSPTR; } +template +inline AType getApiType(T *) { return ATYPE_INTEGER; } + #define MAX_ARGS 12u template @@ -200,7 +202,7 @@ void Cvar_DirectSet(IRehldsHook_Cvar_DirectSet *chain, cvar_t *var, const char * int GetForceCamera(IReGameHook_GetForceCamera *chain, CBasePlayer *pObserver); void PlayerBlind(IReGameHook_PlayerBlind *chain, CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars_t *pevAttacker, float fadeTime, float fadeHold, int alpha, Vector& color); void RadiusFlash_TraceLine(IReGameHook_RadiusFlash_TraceLine *chain, CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars_t *pevAttacker, Vector& vecSrc, Vector& vecSpot, TraceResult *ptr); -bool RoundEnd(IReGameHook_RoundEnd *chain, int winStatus, ScenarionEventEndRound event, float tmDelay); +bool RoundEnd(IReGameHook_RoundEnd *chain, int winStatus, ScenarioEventEndRound event, float tmDelay); // regamedll functions - player void CBasePlayer_Spawn(IReGameHook_CBasePlayer_Spawn *chain, CBasePlayer *pthis); diff --git a/reapi/src/hook_list.cpp b/reapi/src/hook_list.cpp index 9925c30..59d1c21 100644 --- a/reapi/src/hook_list.cpp +++ b/reapi/src/hook_list.cpp @@ -4,7 +4,7 @@ inline size_t getFwdParamType(void(*)(int)) { return FP_CELL; } inline size_t getFwdParamType(void(*)(bool)) { return FP_CELL; } inline size_t getFwdParamType(void(*)(Vector&)) { return FP_ARRAY; } inline size_t getFwdParamType(void(*)(PLAYER_ANIM)) { return FP_CELL; } -inline size_t getFwdParamType(void(*)(ScenarionEventEndRound)) { return FP_CELL; } +inline size_t getFwdParamType(void(*)(ScenarioEventEndRound)) { return FP_CELL; } inline size_t getFwdParamType(void(*)(float)) { return FP_FLOAT; } inline size_t getFwdParamType(void(*)(const char *)) { return FP_STRING; } inline size_t getFwdParamType(void(*)(char *)) { return FP_STRING; } diff --git a/reapi/src/member_list.cpp b/reapi/src/member_list.cpp index d0de29a..1af8f66 100644 --- a/reapi/src/member_list.cpp +++ b/reapi/src/member_list.cpp @@ -1,23 +1,63 @@ #include "precompiled.h" +#define CLASS_MEMBERS(cx, mx) ((!(mx & (MAX_REGION_RANGE - 1)) ? regmember::current_cell = 1, true : false) || (mx & (MAX_REGION_RANGE - 1)) == regmember::current_cell++) ? regmember([](member_t* ptr){ decltype(##cx::##mx) f = {};ptr->size = getTypeSize(f);ptr->max_size = sizeof(f);ptr->offset = offsetof(##cx, ##mx);ptr->type = getMemberType(f);}) : regmember(#mx " doesn't match member definition") + +#define GM_MEMBERS(mx) CLASS_MEMBERS(CHalfLifeMultiplay, mx) +#define GM_VOICE_MEMBERS(mx) CLASS_MEMBERS(CVoiceGameMgr, mx) +#define BASE_MEMBERS(mx) CLASS_MEMBERS(CBaseEntity, mx) +#define ANIM_MEMBERS(mx) CLASS_MEMBERS(CBaseAnimating, mx) +#define PL_MEMBERS(mx) CLASS_MEMBERS(CBasePlayer, mx) + +inline MType getMemberType(float*) { return MEMBER_FLOAT; } +inline MType getMemberType(float) { return MEMBER_FLOAT; } + +inline MType getMemberType(double) { return MEMBER_DOUBLE; } + +inline MType getMemberType(CBasePlayer**) { return MEMBER_CLASSPTR; } +inline MType getMemberType(CBasePlayer*) { return MEMBER_CLASSPTR; } +inline MType getMemberType(CBasePlayerItem**) { return MEMBER_CLASSPTR; } +inline MType getMemberType(CBasePlayerItem*) { return MEMBER_CLASSPTR; } +inline MType getMemberType(CBaseEntity*) { return MEMBER_CLASSPTR; } + +inline MType getMemberType(EHANDLE) { return MEMBER_EHANDLE; } +inline MType getMemberType(entvars_t*) { return MEMBER_EVARS; } +inline MType getMemberType(edict_t*) { return MEMBER_EDICT; } + +inline MType getMemberType(Vector*) { return MEMBER_VECTOR; } +inline MType getMemberType(Vector) { return MEMBER_VECTOR; } + +inline MType getMemberType(char*) { return MEMBER_STRING; } + +inline MType getMemberType(int*) { return MEMBER_INTEGER; } +inline MType getMemberType(int) { return MEMBER_INTEGER; } +inline MType getMemberType(unsigned) { return MEMBER_INTEGER; } +inline MType getMemberType(TeamName) { return MEMBER_INTEGER; } +inline MType getMemberType(JoinState) { return MEMBER_INTEGER; } +inline MType getMemberType(ModelName) { return MEMBER_INTEGER; } +inline MType getMemberType(_Menu) { return MEMBER_INTEGER; } +inline MType getMemberType(MusicState) { return MEMBER_INTEGER; } + +inline MType getMemberType(short) { return MEMBER_SHORT; } +inline MType getMemberType(unsigned short) { return MEMBER_SHORT; } + +inline MType getMemberType(char) { return MEMBER_BYTE; } +inline MType getMemberType(bool) { return MEMBER_BOOL; } +inline MType getMemberType(CUnifiedSignals) { return MEMBER_SIGNALS; } +inline MType getMemberType(RebuyStruct) { return MEBMER_REBUYSTRUCT; } + +template +inline MType getMemberType(T) { static_assert(false, "Not implemented overload"); } + +template +inline size_t getTypeSize(T type[]) { return sizeof(T); } + +template +inline size_t getTypeSize(T& type) { return sizeof(T); } + struct regmember { template - regmember(T& type, size_t maxsize, size_t offset, MType member_type) - { - member.size = sizeof(T); - member.max_size = sizeof(T); - member.offset = offset; - member.type = member_type; - } - template - regmember(T type[], size_t maxsize, size_t offset, MType member_type) - { - member.size = sizeof(T); - member.max_size = maxsize; - member.offset = offset; - member.type = member_type; - } + regmember(T lambdaFunc) { lambdaFunc(&member); } regmember(const char *error) { UTIL_SysError(error); } // to cause a amxx module failure. operator member_t() const { return member; } @@ -26,323 +66,317 @@ struct regmember static int current_cell; // the counter of cells }; -static char mem_dummy[0xffff]; int regmember::current_cell = 1; -#define GM_MEMBERS(mx, mtype) ((!(mx & (MAX_REGION_RANGE - 1)) ? regmember::current_cell = 1, true : false) || (mx & (MAX_REGION_RANGE - 1)) == regmember::current_cell++) ? regmember(((CHalfLifeMultiplay *)&mem_dummy)->##mx, sizeof(((CHalfLifeMultiplay *)&mem_dummy)->##mx), offsetof(CHalfLifeMultiplay, mx), mtype) : regmember(#mx " doesn't match member definition") -#define GM_VOICE_MEMBERS(mx, mtype) ((!(mx & (MAX_REGION_RANGE - 1)) ? regmember::current_cell = 1, true : false) || (mx & (MAX_REGION_RANGE - 1)) == regmember::current_cell++) ? regmember(((CVoiceGameMgr *)&mem_dummy)->##mx, sizeof(((CVoiceGameMgr *)&mem_dummy)->##mx), offsetof(CVoiceGameMgr, mx), mtype) : regmember(#mx " doesn't match member definition") member_t memberlist_gamerules[] = { - GM_MEMBERS(m_bFreezePeriod, MEMBER_INTEGER), - GM_MEMBERS(m_bBombDropped, MEMBER_INTEGER), + GM_MEMBERS(m_bFreezePeriod), + GM_MEMBERS(m_bBombDropped), // m_VoiceGameMgr -> - GM_VOICE_MEMBERS(m_msgPlayerVoiceMask, MEMBER_INTEGER), - GM_VOICE_MEMBERS(m_msgRequestState, MEMBER_INTEGER), - GM_VOICE_MEMBERS(m_nMaxPlayers, MEMBER_INTEGER), - GM_VOICE_MEMBERS(m_UpdateInterval, MEMBER_DOUBLE), - GM_MEMBERS(m_fTeamCount, MEMBER_FLOAT), - GM_MEMBERS(m_flCheckWinConditions, MEMBER_FLOAT), - GM_MEMBERS(m_fRoundCount, MEMBER_FLOAT), - GM_MEMBERS(m_iRoundTime, MEMBER_INTEGER), - GM_MEMBERS(m_iRoundTimeSecs, MEMBER_INTEGER), - GM_MEMBERS(m_iIntroRoundTime, MEMBER_INTEGER), - GM_MEMBERS(m_fIntroRoundCount, MEMBER_FLOAT), - GM_MEMBERS(m_iAccountTerrorist, MEMBER_INTEGER), - GM_MEMBERS(m_iAccountCT, MEMBER_INTEGER), - GM_MEMBERS(m_iNumTerrorist, MEMBER_INTEGER), - GM_MEMBERS(m_iNumCT, MEMBER_INTEGER), - GM_MEMBERS(m_iNumSpawnableTerrorist, MEMBER_INTEGER), - GM_MEMBERS(m_iNumSpawnableCT, MEMBER_INTEGER), - GM_MEMBERS(m_iSpawnPointCount_Terrorist, MEMBER_INTEGER), - GM_MEMBERS(m_iSpawnPointCount_CT, MEMBER_INTEGER), - GM_MEMBERS(m_iHostagesRescued, MEMBER_INTEGER), - GM_MEMBERS(m_iHostagesTouched, MEMBER_INTEGER), - GM_MEMBERS(m_iRoundWinStatus, MEMBER_INTEGER), - GM_MEMBERS(m_iNumCTWins, MEMBER_SHORT), - GM_MEMBERS(m_iNumTerroristWins, MEMBER_SHORT), - GM_MEMBERS(m_bTargetBombed, MEMBER_BOOL), - GM_MEMBERS(m_bBombDefused, MEMBER_BOOL), - GM_MEMBERS(m_bMapHasBombTarget, MEMBER_BOOL), - GM_MEMBERS(m_bMapHasBombZone, MEMBER_BOOL), - GM_MEMBERS(m_bMapHasBuyZone, MEMBER_BOOL), - GM_MEMBERS(m_bMapHasRescueZone, MEMBER_BOOL), - GM_MEMBERS(m_bMapHasEscapeZone, MEMBER_BOOL), - GM_MEMBERS(m_iMapHasVIPSafetyZone, MEMBER_INTEGER), - GM_MEMBERS(m_bMapHasCameras, MEMBER_INTEGER), - GM_MEMBERS(m_iC4Timer, MEMBER_INTEGER), - GM_MEMBERS(m_iC4Guy, MEMBER_INTEGER), - GM_MEMBERS(m_iLoserBonus, MEMBER_INTEGER), - GM_MEMBERS(m_iNumConsecutiveCTLoses, MEMBER_INTEGER), - GM_MEMBERS(m_iNumConsecutiveTerroristLoses, MEMBER_INTEGER), - GM_MEMBERS(m_fMaxIdlePeriod, MEMBER_FLOAT), - GM_MEMBERS(m_iLimitTeams, MEMBER_INTEGER), - GM_MEMBERS(m_bLevelInitialized, MEMBER_BOOL), - GM_MEMBERS(m_bRoundTerminating, MEMBER_BOOL), - GM_MEMBERS(m_bCompleteReset, MEMBER_BOOL), - GM_MEMBERS(m_flRequiredEscapeRatio, MEMBER_FLOAT), - GM_MEMBERS(m_iNumEscapers, MEMBER_INTEGER), - GM_MEMBERS(m_iHaveEscaped, MEMBER_INTEGER), - GM_MEMBERS(m_bCTCantBuy, MEMBER_BOOL), - GM_MEMBERS(m_bTCantBuy, MEMBER_BOOL), - GM_MEMBERS(m_flBombRadius, MEMBER_FLOAT), - GM_MEMBERS(m_iConsecutiveVIP, MEMBER_INTEGER), - GM_MEMBERS(m_iTotalGunCount, MEMBER_INTEGER), - GM_MEMBERS(m_iTotalGrenadeCount, MEMBER_INTEGER), - GM_MEMBERS(m_iTotalArmourCount, MEMBER_INTEGER), - GM_MEMBERS(m_iUnBalancedRounds, MEMBER_INTEGER), - GM_MEMBERS(m_iNumEscapeRounds, MEMBER_INTEGER), - GM_MEMBERS(m_iMapVotes, MEMBER_INTEGER), - GM_MEMBERS(m_iLastPick, MEMBER_INTEGER), - GM_MEMBERS(m_iMaxMapTime, MEMBER_INTEGER), - GM_MEMBERS(m_iMaxRounds, MEMBER_INTEGER), - GM_MEMBERS(m_iTotalRoundsPlayed, MEMBER_INTEGER), - GM_MEMBERS(m_iMaxRoundsWon, MEMBER_INTEGER), - GM_MEMBERS(m_iStoredSpectValue, MEMBER_INTEGER), - GM_MEMBERS(m_flForceCameraValue, MEMBER_FLOAT), - GM_MEMBERS(m_flForceChaseCamValue, MEMBER_FLOAT), - GM_MEMBERS(m_flFadeToBlackValue, MEMBER_FLOAT), - GM_MEMBERS(m_pVIP, MEMBER_CLASSPTR), - GM_MEMBERS(VIPQueue, MEMBER_CLASSPTR), - GM_MEMBERS(m_flIntermissionEndTime, MEMBER_FLOAT), - GM_MEMBERS(m_flIntermissionStartTime, MEMBER_FLOAT), - GM_MEMBERS(m_iEndIntermissionButtonHit, MEMBER_INTEGER), - GM_MEMBERS(m_tmNextPeriodicThink, MEMBER_FLOAT), - GM_MEMBERS(m_bFirstConnected, MEMBER_BOOL), - GM_MEMBERS(m_bInCareerGame, MEMBER_BOOL), - GM_MEMBERS(m_fCareerRoundMenuTime, MEMBER_FLOAT), - GM_MEMBERS(m_iCareerMatchWins, MEMBER_INTEGER), - GM_MEMBERS(m_iRoundWinDifference, MEMBER_INTEGER), - GM_MEMBERS(m_fCareerMatchMenuTime, MEMBER_FLOAT), - GM_MEMBERS(m_bSkipSpawn, MEMBER_BOOL), + GM_VOICE_MEMBERS(m_msgPlayerVoiceMask), + GM_VOICE_MEMBERS(m_msgRequestState), + GM_VOICE_MEMBERS(m_nMaxPlayers), + GM_VOICE_MEMBERS(m_UpdateInterval), + GM_MEMBERS(m_fTeamCount), + GM_MEMBERS(m_flCheckWinConditions), + GM_MEMBERS(m_fRoundCount), + GM_MEMBERS(m_iRoundTime), + GM_MEMBERS(m_iRoundTimeSecs), + GM_MEMBERS(m_iIntroRoundTime), + GM_MEMBERS(m_fIntroRoundCount), + GM_MEMBERS(m_iAccountTerrorist), + GM_MEMBERS(m_iAccountCT), + GM_MEMBERS(m_iNumTerrorist), + GM_MEMBERS(m_iNumCT), + GM_MEMBERS(m_iNumSpawnableTerrorist), + GM_MEMBERS(m_iNumSpawnableCT), + GM_MEMBERS(m_iSpawnPointCount_Terrorist), + GM_MEMBERS(m_iSpawnPointCount_CT), + GM_MEMBERS(m_iHostagesRescued), + GM_MEMBERS(m_iHostagesTouched), + GM_MEMBERS(m_iRoundWinStatus), + GM_MEMBERS(m_iNumCTWins), + GM_MEMBERS(m_iNumTerroristWins), + GM_MEMBERS(m_bTargetBombed), + GM_MEMBERS(m_bBombDefused), + GM_MEMBERS(m_bMapHasBombTarget), + GM_MEMBERS(m_bMapHasBombZone), + GM_MEMBERS(m_bMapHasBuyZone), + GM_MEMBERS(m_bMapHasRescueZone), + GM_MEMBERS(m_bMapHasEscapeZone), + GM_MEMBERS(m_iMapHasVIPSafetyZone), + GM_MEMBERS(m_bMapHasCameras), + GM_MEMBERS(m_iC4Timer), + GM_MEMBERS(m_iC4Guy), + GM_MEMBERS(m_iLoserBonus), + GM_MEMBERS(m_iNumConsecutiveCTLoses), + GM_MEMBERS(m_iNumConsecutiveTerroristLoses), + GM_MEMBERS(m_fMaxIdlePeriod), + GM_MEMBERS(m_iLimitTeams), + GM_MEMBERS(m_bLevelInitialized), + GM_MEMBERS(m_bRoundTerminating), + GM_MEMBERS(m_bCompleteReset), + GM_MEMBERS(m_flRequiredEscapeRatio), + GM_MEMBERS(m_iNumEscapers), + GM_MEMBERS(m_iHaveEscaped), + GM_MEMBERS(m_bCTCantBuy), + GM_MEMBERS(m_bTCantBuy), + GM_MEMBERS(m_flBombRadius), + GM_MEMBERS(m_iConsecutiveVIP), + GM_MEMBERS(m_iTotalGunCount), + GM_MEMBERS(m_iTotalGrenadeCount), + GM_MEMBERS(m_iTotalArmourCount), + GM_MEMBERS(m_iUnBalancedRounds), + GM_MEMBERS(m_iNumEscapeRounds), + GM_MEMBERS(m_iMapVotes), + GM_MEMBERS(m_iLastPick), + GM_MEMBERS(m_iMaxMapTime), + GM_MEMBERS(m_iMaxRounds), + GM_MEMBERS(m_iTotalRoundsPlayed), + GM_MEMBERS(m_iMaxRoundsWon), + GM_MEMBERS(m_iStoredSpectValue), + GM_MEMBERS(m_flForceCameraValue), + GM_MEMBERS(m_flForceChaseCamValue), + GM_MEMBERS(m_flFadeToBlackValue), + GM_MEMBERS(m_pVIP), + GM_MEMBERS(VIPQueue), + GM_MEMBERS(m_flIntermissionEndTime), + GM_MEMBERS(m_flIntermissionStartTime), + GM_MEMBERS(m_iEndIntermissionButtonHit), + GM_MEMBERS(m_tmNextPeriodicThink), + GM_MEMBERS(m_bFirstConnected), + GM_MEMBERS(m_bInCareerGame), + GM_MEMBERS(m_fCareerRoundMenuTime), + GM_MEMBERS(m_iCareerMatchWins), + GM_MEMBERS(m_iRoundWinDifference), + GM_MEMBERS(m_fCareerMatchMenuTime), + GM_MEMBERS(m_bSkipSpawn), }; -#define BASE_MEMBERS(mx, mtype) ((!(mx & (MAX_REGION_RANGE - 1)) ? regmember::current_cell = 1, true : false) || (mx & (MAX_REGION_RANGE - 1)) == regmember::current_cell++) ? regmember(((CBaseEntity *)&mem_dummy)->##mx, sizeof(((CBaseEntity *)&mem_dummy)->##mx), offsetof(CBaseEntity, mx), mtype) : regmember(#mx " doesn't match member definition") member_t memberlist_base[] = { - BASE_MEMBERS(currentammo, MEMBER_FLOAT), - BASE_MEMBERS(maxammo_buckshot, MEMBER_INTEGER), - BASE_MEMBERS(ammo_buckshot, MEMBER_INTEGER), - BASE_MEMBERS(maxammo_9mm, MEMBER_INTEGER), - BASE_MEMBERS(ammo_9mm, MEMBER_INTEGER), - BASE_MEMBERS(maxammo_556nato, MEMBER_INTEGER), - BASE_MEMBERS(ammo_556nato, MEMBER_INTEGER), - BASE_MEMBERS(maxammo_556natobox, MEMBER_INTEGER), - BASE_MEMBERS(ammo_556natobox, MEMBER_INTEGER), - BASE_MEMBERS(maxammo_762nato, MEMBER_INTEGER), - BASE_MEMBERS(ammo_762nato, MEMBER_INTEGER), - BASE_MEMBERS(maxammo_45acp, MEMBER_INTEGER), - BASE_MEMBERS(ammo_45acp, MEMBER_INTEGER), - BASE_MEMBERS(maxammo_50ae, MEMBER_INTEGER), - BASE_MEMBERS(ammo_50ae, MEMBER_INTEGER), - BASE_MEMBERS(maxammo_338mag, MEMBER_INTEGER), - BASE_MEMBERS(ammo_338mag, MEMBER_INTEGER), - BASE_MEMBERS(maxammo_57mm, MEMBER_INTEGER), - BASE_MEMBERS(ammo_57mm, MEMBER_INTEGER), - BASE_MEMBERS(maxammo_357sig, MEMBER_INTEGER), - BASE_MEMBERS(ammo_357sig, MEMBER_INTEGER), - BASE_MEMBERS(m_flStartThrow, MEMBER_FLOAT), - BASE_MEMBERS(m_flReleaseThrow, MEMBER_FLOAT), - BASE_MEMBERS(m_iSwing, MEMBER_INTEGER), - BASE_MEMBERS(has_disconnected, MEMBER_BOOL), + BASE_MEMBERS(currentammo), + BASE_MEMBERS(maxammo_buckshot), + BASE_MEMBERS(ammo_buckshot), + BASE_MEMBERS(maxammo_9mm), + BASE_MEMBERS(ammo_9mm), + BASE_MEMBERS(maxammo_556nato), + BASE_MEMBERS(ammo_556nato), + BASE_MEMBERS(maxammo_556natobox), + BASE_MEMBERS(ammo_556natobox), + BASE_MEMBERS(maxammo_762nato), + BASE_MEMBERS(ammo_762nato), + BASE_MEMBERS(maxammo_45acp), + BASE_MEMBERS(ammo_45acp), + BASE_MEMBERS(maxammo_50ae), + BASE_MEMBERS(ammo_50ae), + BASE_MEMBERS(maxammo_338mag), + BASE_MEMBERS(ammo_338mag), + BASE_MEMBERS(maxammo_57mm), + BASE_MEMBERS(ammo_57mm), + BASE_MEMBERS(maxammo_357sig), + BASE_MEMBERS(ammo_357sig), + BASE_MEMBERS(m_flStartThrow), + BASE_MEMBERS(m_flReleaseThrow), + BASE_MEMBERS(m_iSwing), + BASE_MEMBERS(has_disconnected), }; -#define ANIM_MEMBERS(mx, mtype) ((!(mx & (MAX_REGION_RANGE - 1)) ? regmember::current_cell = 1, true : false) || (mx & (MAX_REGION_RANGE - 1)) == regmember::current_cell++) ? regmember(((CBaseAnimating *)&mem_dummy)->##mx, sizeof(((CBaseAnimating *)&mem_dummy)->##mx), offsetof(CBaseAnimating, mx), mtype) : regmember(#mx " doesn't match member definition") member_t memberlist_animating[] = { - ANIM_MEMBERS(m_flFrameRate, MEMBER_FLOAT), - ANIM_MEMBERS(m_flGroundSpeed, MEMBER_FLOAT), - ANIM_MEMBERS(m_flLastEventCheck, MEMBER_FLOAT), - ANIM_MEMBERS(m_fSequenceFinished, MEMBER_INTEGER), - ANIM_MEMBERS(m_fSequenceLoops, MEMBER_INTEGER), + ANIM_MEMBERS(m_flFrameRate), + ANIM_MEMBERS(m_flGroundSpeed), + ANIM_MEMBERS(m_flLastEventCheck), + ANIM_MEMBERS(m_fSequenceFinished), + ANIM_MEMBERS(m_fSequenceLoops), }; -#define PL_MEMBERS(mx, mtype) ((!(mx & (MAX_REGION_RANGE - 1)) ? regmember::current_cell = 1, true : false) || (mx & (MAX_REGION_RANGE - 1)) == regmember::current_cell++) ? regmember(((CBasePlayer *)&mem_dummy)->##mx, sizeof(((CBasePlayer *)&mem_dummy)->##mx), offsetof(CBasePlayer, mx), mtype) : regmember(#mx " doesn't match member definition") member_t memberlist_player[] = { - PL_MEMBERS(random_seed, MEMBER_INTEGER), - PL_MEMBERS(m_usPlayerBleed, MEMBER_SHORT), - PL_MEMBERS(m_hObserverTarget, MEMBER_EHANDLE), - PL_MEMBERS(m_flNextObserverInput, MEMBER_FLOAT), - PL_MEMBERS(m_iObserverWeapon, MEMBER_INTEGER), - PL_MEMBERS(m_iObserverC4State, MEMBER_INTEGER), - PL_MEMBERS(m_bObserverHasDefuser, MEMBER_BOOL), - PL_MEMBERS(m_iObserverLastMode, MEMBER_INTEGER), - PL_MEMBERS(m_flFlinchTime, MEMBER_FLOAT), - PL_MEMBERS(m_flAnimTime, MEMBER_FLOAT), - PL_MEMBERS(m_bHighDamage, MEMBER_BOOL), - PL_MEMBERS(m_flVelocityModifier, MEMBER_FLOAT), - PL_MEMBERS(m_iLastZoom, MEMBER_INTEGER), - PL_MEMBERS(m_bResumeZoom, MEMBER_BOOL), - PL_MEMBERS(m_flEjectBrass, MEMBER_FLOAT), - PL_MEMBERS(m_iKevlar, MEMBER_INTEGER), - PL_MEMBERS(m_bNotKilled, MEMBER_BOOL), - PL_MEMBERS(m_iTeam, MEMBER_INTEGER), - PL_MEMBERS(m_iAccount, MEMBER_INTEGER), - PL_MEMBERS(m_bHasPrimary, MEMBER_BOOL), - PL_MEMBERS(m_flDeathThrowTime, MEMBER_FLOAT), - PL_MEMBERS(m_iThrowDirection, MEMBER_INTEGER), - PL_MEMBERS(m_flLastTalk, MEMBER_FLOAT), - PL_MEMBERS(m_bJustConnected, MEMBER_BOOL), - PL_MEMBERS(m_bContextHelp, MEMBER_BOOL), - PL_MEMBERS(m_iJoiningState, MEMBER_INTEGER), - PL_MEMBERS(m_pIntroCamera, MEMBER_CLASSPTR), - PL_MEMBERS(m_fIntroCamTime, MEMBER_FLOAT), - PL_MEMBERS(m_fLastMovement, MEMBER_FLOAT), - PL_MEMBERS(m_bMissionBriefing, MEMBER_BOOL), - PL_MEMBERS(m_bTeamChanged, MEMBER_BOOL), - PL_MEMBERS(m_iModelName, MEMBER_INTEGER), - PL_MEMBERS(m_iTeamKills, MEMBER_INTEGER), - PL_MEMBERS(m_iIgnoreGlobalChat, MEMBER_INTEGER), - PL_MEMBERS(m_bHasNightVision, MEMBER_BOOL), - PL_MEMBERS(m_bNightVisionOn, MEMBER_BOOL), - PL_MEMBERS(m_vRecentPath, MEMBER_VECTOR), - PL_MEMBERS(m_flIdleCheckTime, MEMBER_FLOAT), - PL_MEMBERS(m_flRadioTime, MEMBER_FLOAT), - PL_MEMBERS(m_iRadioMessages, MEMBER_INTEGER), - PL_MEMBERS(m_bIgnoreRadio, MEMBER_BOOL), - PL_MEMBERS(m_bHasC4, MEMBER_BOOL), - PL_MEMBERS(m_bHasDefuser, MEMBER_BOOL), - PL_MEMBERS(m_bKilledByBomb, MEMBER_BOOL), - PL_MEMBERS(m_vBlastVector, MEMBER_VECTOR), - PL_MEMBERS(m_bKilledByGrenade, MEMBER_BOOL), + PL_MEMBERS(random_seed), + PL_MEMBERS(m_usPlayerBleed), + PL_MEMBERS(m_hObserverTarget), + PL_MEMBERS(m_flNextObserverInput), + PL_MEMBERS(m_iObserverWeapon), + PL_MEMBERS(m_iObserverC4State), + PL_MEMBERS(m_bObserverHasDefuser), + PL_MEMBERS(m_iObserverLastMode), + PL_MEMBERS(m_flFlinchTime), + PL_MEMBERS(m_flAnimTime), + PL_MEMBERS(m_bHighDamage), + PL_MEMBERS(m_flVelocityModifier), + PL_MEMBERS(m_iLastZoom), + PL_MEMBERS(m_bResumeZoom), + PL_MEMBERS(m_flEjectBrass), + PL_MEMBERS(m_iKevlar), + PL_MEMBERS(m_bNotKilled), + PL_MEMBERS(m_iTeam), + PL_MEMBERS(m_iAccount), + PL_MEMBERS(m_bHasPrimary), + PL_MEMBERS(m_flDeathThrowTime), + PL_MEMBERS(m_iThrowDirection), + PL_MEMBERS(m_flLastTalk), + PL_MEMBERS(m_bJustConnected), + PL_MEMBERS(m_bContextHelp), + PL_MEMBERS(m_iJoiningState), + PL_MEMBERS(m_pIntroCamera), + PL_MEMBERS(m_fIntroCamTime), + PL_MEMBERS(m_fLastMovement), + PL_MEMBERS(m_bMissionBriefing), + PL_MEMBERS(m_bTeamChanged), + PL_MEMBERS(m_iModelName), + PL_MEMBERS(m_iTeamKills), + PL_MEMBERS(m_iIgnoreGlobalChat), + PL_MEMBERS(m_bHasNightVision), + PL_MEMBERS(m_bNightVisionOn), + PL_MEMBERS(m_vRecentPath), + PL_MEMBERS(m_flIdleCheckTime), + PL_MEMBERS(m_flRadioTime), + PL_MEMBERS(m_iRadioMessages), + PL_MEMBERS(m_bIgnoreRadio), + PL_MEMBERS(m_bHasC4), + PL_MEMBERS(m_bHasDefuser), + PL_MEMBERS(m_bKilledByBomb), + PL_MEMBERS(m_vBlastVector), + PL_MEMBERS(m_bKilledByGrenade), //PL_MEMBERS(m_hintMessageQueue), - PL_MEMBERS(m_flDisplayHistory, MEMBER_INTEGER), - PL_MEMBERS(m_iMenu, MEMBER_INTEGER), - PL_MEMBERS(m_iChaseTarget, MEMBER_INTEGER), - PL_MEMBERS(m_pChaseTarget, MEMBER_CLASSPTR), - PL_MEMBERS(m_fCamSwitch, MEMBER_FLOAT), - PL_MEMBERS(m_bEscaped, MEMBER_BOOL), - PL_MEMBERS(m_bIsVIP, MEMBER_BOOL), - PL_MEMBERS(m_tmNextRadarUpdate, MEMBER_FLOAT), - PL_MEMBERS(m_vLastOrigin, MEMBER_VECTOR), - PL_MEMBERS(m_iCurrentKickVote, MEMBER_INTEGER), - PL_MEMBERS(m_flNextVoteTime, MEMBER_FLOAT), - PL_MEMBERS(m_bJustKilledTeammate, MEMBER_BOOL), - PL_MEMBERS(m_iHostagesKilled, MEMBER_INTEGER), - PL_MEMBERS(m_iMapVote, MEMBER_INTEGER), - PL_MEMBERS(m_bCanShoot, MEMBER_BOOL), - PL_MEMBERS(m_flLastFired, MEMBER_FLOAT), - PL_MEMBERS(m_flLastAttackedTeammate, MEMBER_FLOAT), - PL_MEMBERS(m_bHeadshotKilled, MEMBER_BOOL), - PL_MEMBERS(m_bPunishedForTK, MEMBER_BOOL), - PL_MEMBERS(m_bReceivesNoMoneyNextRound, MEMBER_BOOL), - PL_MEMBERS(m_iTimeCheckAllowed, MEMBER_INTEGER), - PL_MEMBERS(m_bHasChangedName, MEMBER_BOOL), - PL_MEMBERS(m_szNewName, MEMBER_CHAR_ARRAY), - PL_MEMBERS(m_bIsDefusing, MEMBER_BOOL), - PL_MEMBERS(m_tmHandleSignals, MEMBER_FLOAT), - PL_MEMBERS(m_signals, MEMBER_SIGNALS), - PL_MEMBERS(m_pentCurBombTarget, MEMBER_EDICT), - PL_MEMBERS(m_iPlayerSound, MEMBER_INTEGER), - PL_MEMBERS(m_iTargetVolume, MEMBER_INTEGER), - PL_MEMBERS(m_iWeaponVolume, MEMBER_INTEGER), - PL_MEMBERS(m_iExtraSoundTypes, MEMBER_INTEGER), - PL_MEMBERS(m_iWeaponFlash, MEMBER_INTEGER), - PL_MEMBERS(m_flStopExtraSoundTime, MEMBER_FLOAT), - PL_MEMBERS(m_flFlashLightTime, MEMBER_FLOAT), - PL_MEMBERS(m_iFlashBattery, MEMBER_INTEGER), - PL_MEMBERS(m_afButtonLast, MEMBER_INTEGER), - PL_MEMBERS(m_afButtonPressed, MEMBER_INTEGER), - PL_MEMBERS(m_afButtonReleased, MEMBER_INTEGER), - PL_MEMBERS(m_pentSndLast, MEMBER_EDICT), - PL_MEMBERS(m_flSndRoomtype, MEMBER_FLOAT), - PL_MEMBERS(m_flSndRange, MEMBER_FLOAT), - PL_MEMBERS(m_flFallVelocity, MEMBER_FLOAT), - PL_MEMBERS(m_rgItems, MEMBER_INTEGER), - PL_MEMBERS(m_fNewAmmo, MEMBER_INTEGER), - PL_MEMBERS(m_afPhysicsFlags, MEMBER_INTEGER), - PL_MEMBERS(m_fNextSuicideTime, MEMBER_FLOAT), - PL_MEMBERS(m_flTimeStepSound, MEMBER_FLOAT), - PL_MEMBERS(m_flTimeWeaponIdle, MEMBER_FLOAT), - PL_MEMBERS(m_flSwimTime, MEMBER_FLOAT), - PL_MEMBERS(m_flDuckTime, MEMBER_FLOAT), - PL_MEMBERS(m_flWallJumpTime, MEMBER_FLOAT), - PL_MEMBERS(m_flSuitUpdate, MEMBER_FLOAT), - PL_MEMBERS(m_rgSuitPlayList, MEMBER_INTEGER), - PL_MEMBERS(m_iSuitPlayNext, MEMBER_INTEGER), - PL_MEMBERS(m_rgiSuitNoRepeat, MEMBER_INTEGER), - PL_MEMBERS(m_rgflSuitNoRepeatTime, MEMBER_FLOAT), - PL_MEMBERS(m_lastDamageAmount, MEMBER_INTEGER), - PL_MEMBERS(m_tbdPrev, MEMBER_FLOAT), - PL_MEMBERS(m_flgeigerRange, MEMBER_FLOAT), - PL_MEMBERS(m_flgeigerDelay, MEMBER_FLOAT), - PL_MEMBERS(m_igeigerRangePrev, MEMBER_INTEGER), - PL_MEMBERS(m_iStepLeft, MEMBER_INTEGER), - PL_MEMBERS(m_szTextureName, MEMBER_CHAR_ARRAY), - PL_MEMBERS(m_chTextureType, MEMBER_BYTE), - PL_MEMBERS(m_idrowndmg, MEMBER_INTEGER), - PL_MEMBERS(m_idrownrestored, MEMBER_INTEGER), - PL_MEMBERS(m_bitsHUDDamage, MEMBER_INTEGER), - PL_MEMBERS(m_fInitHUD, MEMBER_INTEGER), - PL_MEMBERS(m_fGameHUDInitialized, MEMBER_INTEGER), - PL_MEMBERS(m_iTrain, MEMBER_INTEGER), - PL_MEMBERS(m_fWeapon, MEMBER_INTEGER), - PL_MEMBERS(m_pTank, MEMBER_EHANDLE), - PL_MEMBERS(m_fDeadTime, MEMBER_FLOAT), - PL_MEMBERS(m_fNoPlayerSound, MEMBER_INTEGER), - PL_MEMBERS(m_fLongJump, MEMBER_INTEGER), - PL_MEMBERS(m_tSneaking, MEMBER_FLOAT), - PL_MEMBERS(m_iUpdateTime, MEMBER_INTEGER), - PL_MEMBERS(m_iClientHealth, MEMBER_INTEGER), - PL_MEMBERS(m_iClientBattery, MEMBER_INTEGER), - PL_MEMBERS(m_iHideHUD, MEMBER_INTEGER), - PL_MEMBERS(m_iClientHideHUD, MEMBER_INTEGER), - PL_MEMBERS(m_iFOV, MEMBER_INTEGER), - PL_MEMBERS(m_iClientFOV, MEMBER_INTEGER), - PL_MEMBERS(m_iNumSpawns, MEMBER_INTEGER), - PL_MEMBERS(m_pObserver, MEMBER_CLASSPTR), - PL_MEMBERS(m_rgpPlayerItems, MEMBER_CLASSPTR), - PL_MEMBERS(m_pActiveItem, MEMBER_CLASSPTR), - PL_MEMBERS(m_pClientActiveItem, MEMBER_CLASSPTR), - PL_MEMBERS(m_pLastItem, MEMBER_CLASSPTR), - PL_MEMBERS(m_rgAmmo, MEMBER_INTEGER), - PL_MEMBERS(m_rgAmmoLast, MEMBER_INTEGER), - PL_MEMBERS(m_vecAutoAim, MEMBER_VECTOR), - PL_MEMBERS(m_fOnTarget, MEMBER_INTEGER), - PL_MEMBERS(m_iDeaths, MEMBER_INTEGER), - PL_MEMBERS(m_izSBarState, MEMBER_INTEGER), - PL_MEMBERS(m_flNextSBarUpdateTime, MEMBER_FLOAT), - PL_MEMBERS(m_flStatusBarDisappearDelay, MEMBER_FLOAT), - PL_MEMBERS(m_SbarString0, MEMBER_CHAR_ARRAY), - PL_MEMBERS(m_lastx, MEMBER_INTEGER), - PL_MEMBERS(m_lasty, MEMBER_INTEGER), - PL_MEMBERS(m_nCustomSprayFrames, MEMBER_INTEGER), - PL_MEMBERS(m_flNextDecalTime, MEMBER_FLOAT), - PL_MEMBERS(m_szTeamName, MEMBER_CHAR_ARRAY), - PL_MEMBERS(m_modelIndexPlayer, MEMBER_INTEGER), - PL_MEMBERS(m_szAnimExtention, MEMBER_CHAR_ARRAY), - PL_MEMBERS(m_iGaitsequence, MEMBER_INTEGER), - PL_MEMBERS(m_flGaitframe, MEMBER_FLOAT), - PL_MEMBERS(m_flGaityaw, MEMBER_FLOAT), - PL_MEMBERS(m_prevgaitorigin, MEMBER_VECTOR), - PL_MEMBERS(m_flPitch, MEMBER_FLOAT), - PL_MEMBERS(m_flYaw, MEMBER_FLOAT), - PL_MEMBERS(m_flGaitMovement, MEMBER_FLOAT), - PL_MEMBERS(m_iAutoWepSwitch, MEMBER_INTEGER), - PL_MEMBERS(m_bVGUIMenus, MEMBER_BOOL), - PL_MEMBERS(m_bShowHints, MEMBER_BOOL), - PL_MEMBERS(m_bShieldDrawn, MEMBER_BOOL), - PL_MEMBERS(m_bOwnsShield, MEMBER_BOOL), - PL_MEMBERS(m_bWasFollowing, MEMBER_BOOL), - PL_MEMBERS(m_flNextFollowTime, MEMBER_FLOAT), - PL_MEMBERS(m_flYawModifier, MEMBER_FLOAT), - PL_MEMBERS(m_blindUntilTime, MEMBER_FLOAT), - PL_MEMBERS(m_blindStartTime, MEMBER_FLOAT), - PL_MEMBERS(m_blindHoldTime, MEMBER_FLOAT), - PL_MEMBERS(m_blindFadeTime, MEMBER_FLOAT), - PL_MEMBERS(m_blindAlpha, MEMBER_INTEGER), - PL_MEMBERS(m_allowAutoFollowTime, MEMBER_FLOAT), - PL_MEMBERS(m_autoBuyString, MEMBER_CHAR_ARRAY), - PL_MEMBERS(m_rebuyString, MEMBER_CHAR_POINTER), - PL_MEMBERS(m_rebuyStruct, MEBMER_REBUYSTRUCT), - PL_MEMBERS(m_bIsInRebuy, MEMBER_BOOL), - PL_MEMBERS(m_flLastUpdateTime, MEMBER_FLOAT), - PL_MEMBERS(m_lastLocation, MEMBER_CHAR_ARRAY), - PL_MEMBERS(m_progressStart, MEMBER_FLOAT), - PL_MEMBERS(m_progressEnd, MEMBER_FLOAT), - PL_MEMBERS(m_bObserverAutoDirector, MEMBER_BOOL), - PL_MEMBERS(m_canSwitchObserverModes, MEMBER_BOOL), - PL_MEMBERS(m_heartBeatTime, MEMBER_FLOAT), - PL_MEMBERS(m_intenseTimestamp, MEMBER_FLOAT), - PL_MEMBERS(m_silentTimestamp, MEMBER_FLOAT), - PL_MEMBERS(m_musicState, MEMBER_INTEGER), - PL_MEMBERS(m_flLastCommandTime, MEMBER_FLOAT), + PL_MEMBERS(m_flDisplayHistory), + PL_MEMBERS(m_iMenu), + PL_MEMBERS(m_iChaseTarget), + PL_MEMBERS(m_pChaseTarget), + PL_MEMBERS(m_fCamSwitch), + PL_MEMBERS(m_bEscaped), + PL_MEMBERS(m_bIsVIP), + PL_MEMBERS(m_tmNextRadarUpdate), + PL_MEMBERS(m_vLastOrigin), + PL_MEMBERS(m_iCurrentKickVote), + PL_MEMBERS(m_flNextVoteTime), + PL_MEMBERS(m_bJustKilledTeammate), + PL_MEMBERS(m_iHostagesKilled), + PL_MEMBERS(m_iMapVote), + PL_MEMBERS(m_bCanShoot), + PL_MEMBERS(m_flLastFired), + PL_MEMBERS(m_flLastAttackedTeammate), + PL_MEMBERS(m_bHeadshotKilled), + PL_MEMBERS(m_bPunishedForTK), + PL_MEMBERS(m_bReceivesNoMoneyNextRound), + PL_MEMBERS(m_iTimeCheckAllowed), + PL_MEMBERS(m_bHasChangedName), + PL_MEMBERS(m_szNewName), + PL_MEMBERS(m_bIsDefusing), + PL_MEMBERS(m_tmHandleSignals), + PL_MEMBERS(m_signals), + PL_MEMBERS(m_pentCurBombTarget), + PL_MEMBERS(m_iPlayerSound), + PL_MEMBERS(m_iTargetVolume), + PL_MEMBERS(m_iWeaponVolume), + PL_MEMBERS(m_iExtraSoundTypes), + PL_MEMBERS(m_iWeaponFlash), + PL_MEMBERS(m_flStopExtraSoundTime), + PL_MEMBERS(m_flFlashLightTime), + PL_MEMBERS(m_iFlashBattery), + PL_MEMBERS(m_afButtonLast), + PL_MEMBERS(m_afButtonPressed), + PL_MEMBERS(m_afButtonReleased), + PL_MEMBERS(m_pentSndLast), + PL_MEMBERS(m_flSndRoomtype), + PL_MEMBERS(m_flSndRange), + PL_MEMBERS(m_flFallVelocity), + PL_MEMBERS(m_rgItems), + PL_MEMBERS(m_fNewAmmo), + PL_MEMBERS(m_afPhysicsFlags), + PL_MEMBERS(m_fNextSuicideTime), + PL_MEMBERS(m_flTimeStepSound), + PL_MEMBERS(m_flTimeWeaponIdle), + PL_MEMBERS(m_flSwimTime), + PL_MEMBERS(m_flDuckTime), + PL_MEMBERS(m_flWallJumpTime), + PL_MEMBERS(m_flSuitUpdate), + PL_MEMBERS(m_rgSuitPlayList), + PL_MEMBERS(m_iSuitPlayNext), + PL_MEMBERS(m_rgiSuitNoRepeat), + PL_MEMBERS(m_rgflSuitNoRepeatTime), + PL_MEMBERS(m_lastDamageAmount), + PL_MEMBERS(m_tbdPrev), + PL_MEMBERS(m_flgeigerRange), + PL_MEMBERS(m_flgeigerDelay), + PL_MEMBERS(m_igeigerRangePrev), + PL_MEMBERS(m_iStepLeft), + PL_MEMBERS(m_szTextureName), + PL_MEMBERS(m_chTextureType), + PL_MEMBERS(m_idrowndmg), + PL_MEMBERS(m_idrownrestored), + PL_MEMBERS(m_bitsHUDDamage), + PL_MEMBERS(m_fInitHUD), + PL_MEMBERS(m_fGameHUDInitialized), + PL_MEMBERS(m_iTrain), + PL_MEMBERS(m_fWeapon), + PL_MEMBERS(m_pTank), + PL_MEMBERS(m_fDeadTime), + PL_MEMBERS(m_fNoPlayerSound), + PL_MEMBERS(m_fLongJump), + PL_MEMBERS(m_tSneaking), + PL_MEMBERS(m_iUpdateTime), + PL_MEMBERS(m_iClientHealth), + PL_MEMBERS(m_iClientBattery), + PL_MEMBERS(m_iHideHUD), + PL_MEMBERS(m_iClientHideHUD), + PL_MEMBERS(m_iFOV), + PL_MEMBERS(m_iClientFOV), + PL_MEMBERS(m_iNumSpawns), + PL_MEMBERS(m_pObserver), + PL_MEMBERS(m_rgpPlayerItems), + PL_MEMBERS(m_pActiveItem), + PL_MEMBERS(m_pClientActiveItem), + PL_MEMBERS(m_pLastItem), + PL_MEMBERS(m_rgAmmo), + PL_MEMBERS(m_rgAmmoLast), + PL_MEMBERS(m_vecAutoAim), + PL_MEMBERS(m_fOnTarget), + PL_MEMBERS(m_iDeaths), + PL_MEMBERS(m_izSBarState), + PL_MEMBERS(m_flNextSBarUpdateTime), + PL_MEMBERS(m_flStatusBarDisappearDelay), + PL_MEMBERS(m_SbarString0), + PL_MEMBERS(m_lastx), + PL_MEMBERS(m_lasty), + PL_MEMBERS(m_nCustomSprayFrames), + PL_MEMBERS(m_flNextDecalTime), + PL_MEMBERS(m_szTeamName), + PL_MEMBERS(m_modelIndexPlayer), + PL_MEMBERS(m_szAnimExtention), + PL_MEMBERS(m_iGaitsequence), + PL_MEMBERS(m_flGaitframe), + PL_MEMBERS(m_flGaityaw), + PL_MEMBERS(m_prevgaitorigin), + PL_MEMBERS(m_flPitch), + PL_MEMBERS(m_flYaw), + PL_MEMBERS(m_flGaitMovement), + PL_MEMBERS(m_iAutoWepSwitch), + PL_MEMBERS(m_bVGUIMenus), + PL_MEMBERS(m_bShowHints), + PL_MEMBERS(m_bShieldDrawn), + PL_MEMBERS(m_bOwnsShield), + PL_MEMBERS(m_bWasFollowing), + PL_MEMBERS(m_flNextFollowTime), + PL_MEMBERS(m_flYawModifier), + PL_MEMBERS(m_blindUntilTime), + PL_MEMBERS(m_blindStartTime), + PL_MEMBERS(m_blindHoldTime), + PL_MEMBERS(m_blindFadeTime), + PL_MEMBERS(m_blindAlpha), + PL_MEMBERS(m_allowAutoFollowTime), + PL_MEMBERS(m_autoBuyString), + PL_MEMBERS(m_rebuyString), + PL_MEMBERS(m_rebuyStruct), + PL_MEMBERS(m_bIsInRebuy), + PL_MEMBERS(m_flLastUpdateTime), + PL_MEMBERS(m_lastLocation), + PL_MEMBERS(m_progressStart), + PL_MEMBERS(m_progressEnd), + PL_MEMBERS(m_bObserverAutoDirector), + PL_MEMBERS(m_canSwitchObserverModes), + PL_MEMBERS(m_heartBeatTime), + PL_MEMBERS(m_intenseTimestamp), + PL_MEMBERS(m_silentTimestamp), + PL_MEMBERS(m_musicState), + PL_MEMBERS(m_flLastCommandTime), }; memberlist_t memberlist; diff --git a/reapi/src/member_list.h b/reapi/src/member_list.h index 2027d70..42f1fca 100644 --- a/reapi/src/member_list.h +++ b/reapi/src/member_list.h @@ -13,8 +13,7 @@ enum MType MEMBER_EVARS, // EVARS * MEMBER_EDICT, // edict_t *, or edict_t * (same thing) MEMBER_VECTOR, // Any vector - MEMBER_CHAR_POINTER, // char * - MEMBER_CHAR_ARRAY, // char [] + MEMBER_STRING, // char *, char [] MEMBER_INTEGER, // Any integer or enum MEMBER_SHORT, // 2 byte integer MEMBER_BYTE, // a byte diff --git a/reapi/src/natives/natives_members.cpp b/reapi/src/natives/natives_members.cpp index 215cdfd..401b8d9 100644 --- a/reapi/src/natives/natives_members.cpp +++ b/reapi/src/natives/natives_members.cpp @@ -80,7 +80,7 @@ static cell AMX_NATIVE_CALL set_member_game(AMX *amx, cell *params) if (g_pCSGameRules == nullptr || *g_pCSGameRules == nullptr) { MF_LogError(amx, AMX_ERR_NATIVE, "get_member_game: gamerules not initialized"); - return 0; + return FALSE; } cell* value = getAmxAddr(amx, params[arg_value]); @@ -97,12 +97,12 @@ static cell AMX_NATIVE_CALL get_member_game(AMX *amx, cell *params) if (member == nullptr) { MF_LogError(amx, AMX_ERR_NATIVE, "get_member_game: unknown member id %i", params[arg_member]); - return 0; + return FALSE; } if (g_pCSGameRules == nullptr || *g_pCSGameRules == nullptr) { MF_LogError(amx, AMX_ERR_NATIVE, "get_member_game: gamerules not initialized"); - return 0; + return FALSE; } cell* dest; @@ -180,22 +180,23 @@ BOOL set_member(void* pdata, const member_t *member, size_t element, cell* value set_member(pdata, member->offset, *pSource, element); return TRUE; } - case MEMBER_CHAR_ARRAY: + case MEMBER_STRING: { // native set_member(_index, any:_member, const source[]); - size_t len; - char *source = getAmxString(value, &len); - char *dest = get_member_direct(pdata, member->offset); - strncpy(dest, source, member->max_size - 1); - dest[member->max_size - 1] = '\0'; - return TRUE; - } - case MEMBER_CHAR_POINTER: - { - // native set_member(_index, any:_member, const source[]); - char *source = getAmxString(value); - char *&dest = get_member(pdata, member->offset); - g_ReGameFuncs->ChangeString(dest, source); + if (member->max_size > sizeof(char*)) { + // char [] + char *source = getAmxString(value); + char *dest = get_member_direct(pdata, member->offset); + strncpy(dest, source, member->max_size - 1); + dest[member->max_size - 1] = '\0'; + + } else { + // char * + char *source = getAmxString(value); + char *&dest = get_member(pdata, member->offset); + g_ReGameFuncs->ChangeString(dest, source); + } + return TRUE; } case MEMBER_FLOAT: @@ -286,28 +287,26 @@ cell get_member(void* pdata, const member_t *member, size_t element, cell* dest) dest[2] = vecSrc[2]; return 1; } - case MEMBER_CHAR_ARRAY: + case MEMBER_STRING: { // native any:get_member(_index, any:_member, any:output[], maxlength); if (!dest) return 0; - const char *src = get_member_direct(pdata, member->offset); - setAmxString(dest, src, element); - return 1; - } - case MEMBER_CHAR_POINTER: - { - // native any:get_member(_index, any:_member, any:output[], maxlength); - if (!dest) - return 0; - - const char *src = get_member(pdata, member->offset); - if (src != nullptr) { + if (member->max_size > sizeof(char*)) { + // char [] + const char *src = get_member_direct(pdata, member->offset); setAmxString(dest, src, element); - return 1; + } else { + // char * + const char *src = get_member(pdata, member->offset); + if (src != nullptr) { + setAmxString(dest, src, element); + return 1; + } + setAmxString(dest, "", 1); } - setAmxString(dest, "", 1); + return 0; } case MEMBER_FLOAT: diff --git a/reapi/src/natives/natives_misc.cpp b/reapi/src/natives/natives_misc.cpp index 524a6e9..5fe3c63 100644 --- a/reapi/src/natives/natives_misc.cpp +++ b/reapi/src/natives/natives_misc.cpp @@ -232,16 +232,28 @@ static cell AMX_NATIVE_CALL rg_fire_bullets(AMX *amx, cell *params) ICSEntity *pInflictor = g_ReGameFuncs->INDEX_TO_CSENTITY(params[arg_inflictor]); cell *pSrc = getAmxAddr(amx, params[arg_vecSrc]); - Vector vecSrc(*(float *)&pSrc[0], *(float *)&pSrc[1], *(float *)&pSrc[2]); - cell *pDir = getAmxAddr(amx, params[arg_dir]); - Vector vecDirShooting(*(float *)&pDir[0], *(float *)&pDir[1], *(float *)&pDir[2]); - cell *pSpread = getAmxAddr(amx, params[arg_spread]); + + Vector vecSrc(*(float *)&pSrc[0], *(float *)&pSrc[1], *(float *)&pSrc[2]); + Vector vecDirShooting(*(float *)&pDir[0], *(float *)&pDir[1], *(float *)&pDir[2]); Vector vecSpread(*(float *)&pSpread[0], *(float *)&pSpread[1], *(float *)&pSpread[2]); entvars_t *pevAttacker = VARS(INDEXENT(params[arg_attacker])); - pInflictor->FireBullets(params[arg_shots], vecSrc, vecDirShooting, vecSpread, *(float *)¶ms[arg_dist], params[arg_bullet_type], params[arg_tracefrq], params[arg_dmg], pevAttacker); + + pInflictor->FireBullets + ( + params[arg_shots], + vecSrc, + vecDirShooting, + vecSpread, + *(float *)¶ms[arg_dist], + params[arg_bullet_type], + params[arg_tracefrq], + params[arg_dmg], + pevAttacker + ); + return TRUE; } @@ -272,15 +284,29 @@ static cell AMX_NATIVE_CALL rg_fire_bullets3(AMX *amx, cell *params) ICSEntity *pInflictor = g_ReGameFuncs->INDEX_TO_CSENTITY(params[arg_inflictor]); cell *pSrc = getAmxAddr(amx, params[arg_vecSrc]); - Vector vecSrc(*(float *)&pSrc[0], *(float *)&pSrc[1], *(float *)&pSrc[2]); - cell *pDir = getAmxAddr(amx, params[arg_dir]); + + Vector vecSrc(*(float *)&pSrc[0], *(float *)&pSrc[1], *(float *)&pSrc[2]); Vector vecDirShooting(*(float *)&pDir[0], *(float *)&pDir[1], *(float *)&pDir[2]); entvars_t *pevAttacker = VARS(INDEXENT(params[arg_attacker])); Vector *pOut = (Vector *)getAmxAddr(amx, params[arg_out]); - *pOut = pInflictor->FireBullets3(vecSrc, vecDirShooting, *(float *)¶ms[arg_spread], *(float *)¶ms[arg_dist], params[arg_penetration], params[arg_bullet_type], params[arg_dmg], *(float *)¶ms[arg_range_mod], pevAttacker, params[arg_pistol] != 0, params[arg_rand]); + + *pOut = pInflictor->FireBullets3 + ( + vecSrc, + vecDirShooting, + *(float *)¶ms[arg_spread], + *(float *)¶ms[arg_dist], + params[arg_penetration], + params[arg_bullet_type], + params[arg_dmg], + *(float *)¶ms[arg_range_mod], + pevAttacker, + params[arg_pistol] != 0, + params[arg_rand] + ); return TRUE; } @@ -320,7 +346,7 @@ struct { * * @noreturn * -* native rg_round_end(Float:tmDelay, WinStatus:st, ScenarionEventEndRound:event = ROUND_NONE, const message[] = "default", const sentence[] = "default"); +* native rg_round_end(Float:tmDelay, WinStatus:st, ScenarioEventEndRound:event = ROUND_NONE, const message[] = "default", const sentence[] = "default"); */ static cell AMX_NATIVE_CALL rg_round_end(AMX *amx, cell *params) { @@ -333,7 +359,7 @@ static cell AMX_NATIVE_CALL rg_round_end(AMX *amx, cell *params) } const char *_sentence, *_message; - ScenarionEventEndRound event = static_cast(params[arg_event]); + ScenarioEventEndRound event = static_cast(params[arg_event]); _sentence = getAmxString(amx, params[arg_sentence]); _message = getAmxString(amx, params[arg_message]);