mirror of
https://github.com/rehlds/reapi.git
synced 2024-12-29 08:05:36 +03:00
Update ReHLDS API 3.x, ReGameDLL API 5.x
This commit is contained in:
parent
d00489b0f2
commit
61460e962b
@ -626,7 +626,7 @@ enum CSGameRules_Members
|
||||
* Get params: Float:get_member_game(member);
|
||||
* Set params: set_member_game(member, Float:value);
|
||||
*/
|
||||
m_fTeamCount,
|
||||
m_flRestartRoundTime,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
@ -637,12 +637,12 @@ enum CSGameRules_Members
|
||||
m_flCheckWinConditions,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Description: Time round has started
|
||||
* Member type: float
|
||||
* Get params: Float:get_member_game(member);
|
||||
* Set params: set_member_game(member, Float:value);
|
||||
*/
|
||||
m_fRoundCount,
|
||||
m_fRoundStartTime,
|
||||
|
||||
/*
|
||||
* Description: How many seconds long this round is.
|
||||
@ -669,12 +669,12 @@ enum CSGameRules_Members
|
||||
m_iIntroRoundTime,
|
||||
|
||||
/*
|
||||
* Description: The global time when the intro round ends
|
||||
* Description: The global time when the intro round ends and the real one starts wrote the original "m_flRoundTime" comment for this variable).
|
||||
* Member type: float
|
||||
* Get params: Float:get_member_game(member);
|
||||
* Set params: set_member_game(member, Float:value);
|
||||
*/
|
||||
m_fIntroRoundCount,
|
||||
m_fRoundStartTimeReal,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
@ -838,11 +838,11 @@ enum CSGameRules_Members
|
||||
|
||||
/*
|
||||
* Description: 0 = uninitialized, 1 = has VIP safety zone, 2 = DOES not have VIP safetyzone
|
||||
* Member type: int
|
||||
* Member type: qboolean
|
||||
* Get params: get_member_game(member);
|
||||
* Set params: set_member_game(member, value);
|
||||
*/
|
||||
m_iMapHasVIPSafetyZone,
|
||||
m_bMapHasVIPSafetyZone,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
@ -1158,12 +1158,12 @@ enum CSGameRules_Members
|
||||
m_tmNextPeriodicThink,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Description: TRUE = the game commencing when there is at least one CT and T, FALSE = scoring will not start until both teams have players (deprecated name m_bFirstConnected)
|
||||
* Member type: bool
|
||||
* Get params: get_member_game(member);
|
||||
* Set params: set_member_game(member, value);
|
||||
*/
|
||||
m_bFirstConnected,
|
||||
m_bGameStarted,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) = 0;
|
||||
virtual BOOL AddPlayerItem(CBasePlayerItem *pItem) = 0;
|
||||
virtual BOOL RemovePlayerItem(CBasePlayerItem *pItem) = 0;
|
||||
virtual int GiveAmmo(int iAmount, char *szName, int iMax) = 0;
|
||||
virtual int GiveAmmo(int iAmount, char *szName, int iMax = -1) = 0;
|
||||
virtual float GetDelay() = 0;
|
||||
virtual int IsMoving() = 0;
|
||||
virtual void OverrideReset() = 0;
|
||||
@ -90,7 +90,7 @@ public:
|
||||
// This is ONLY used by the node graph to test movement through a door
|
||||
virtual void SetToggleState(int state) = 0;
|
||||
virtual void StartSneaking() = 0;
|
||||
virtual void StopSneaking() = 0;
|
||||
virtual void UpdateOnRemove() = 0;
|
||||
virtual BOOL OnControls(entvars_t *onpev) = 0;
|
||||
virtual BOOL IsSneaking() = 0;
|
||||
virtual BOOL IsAlive() = 0;
|
||||
@ -135,6 +135,8 @@ public:
|
||||
edict_t *edict() { return ENT(pev); }
|
||||
EOFFSET eoffset() { return OFFSET(pev); }
|
||||
int entindex() { return ENTINDEX(edict()); }
|
||||
int IsDormant() { return (pev->flags & FL_DORMANT) == FL_DORMANT; }
|
||||
|
||||
public:
|
||||
CCSEntity *m_pEntity; // NOTE: it was replaced on member "int *current_ammo" because it is useless.
|
||||
|
||||
@ -267,6 +269,7 @@ class CBaseButton: public CBaseToggle {
|
||||
public:
|
||||
virtual void Spawn() = 0;
|
||||
virtual void Precache() = 0;
|
||||
virtual void Restart() = 0;
|
||||
virtual void KeyValue(KeyValueData *pkvd) = 0;
|
||||
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual int Save(CSave &save) = 0;
|
||||
@ -297,6 +300,7 @@ public:
|
||||
class CMultiSource: public CPointEntity {
|
||||
public:
|
||||
virtual void Spawn() = 0;
|
||||
virtual void Restart() = 0;
|
||||
virtual void KeyValue(KeyValueData *pkvd) = 0;
|
||||
virtual int Save(CSave &save) = 0;
|
||||
virtual int Restore(CRestore &restore) = 0;
|
||||
|
@ -41,6 +41,7 @@
|
||||
#define HIDEHUD_TIMER (1<<4)
|
||||
#define HIDEHUD_MONEY (1<<5)
|
||||
#define HIDEHUD_CROSSHAIR (1<<6)
|
||||
#define HIDEHUD_OBSERVER_CROSSHAIR (1<<7)
|
||||
|
||||
#define STATUSICON_HIDE 0
|
||||
#define STATUSICON_SHOW 1
|
||||
@ -68,10 +69,11 @@
|
||||
#define SIGNAL_ESCAPE (1<<3)
|
||||
#define SIGNAL_VIPSAFETY (1<<4)
|
||||
|
||||
#define DATA_IUSER3_CANSHOOT (1<<0)
|
||||
#define DATA_IUSER3_FREEZETIMEOVER (1<<1)
|
||||
#define DATA_IUSER3_INBOMBZONE (1<<2)
|
||||
#define DATA_IUSER3_HOLDINGSHIELD (1<<3)
|
||||
// player data iuser3
|
||||
#define PLAYER_CAN_SHOOT (1<<0)
|
||||
#define PLAYER_FREEZE_TIME_OVER (1<<1)
|
||||
#define PLAYER_IN_BOMB_ZONE (1<<2)
|
||||
#define PLAYER_HOLDING_SHIELD (1<<3)
|
||||
|
||||
#define MENU_KEY_1 (1<<0)
|
||||
#define MENU_KEY_2 (1<<1)
|
||||
|
@ -41,6 +41,7 @@
|
||||
#define SF_DOOR_ROTATE_X 128
|
||||
#define SF_DOOR_USE_ONLY 256 // door must be opened by player's use button.
|
||||
#define SF_DOOR_NOMONSTERS 512 // Monster can't open
|
||||
#define SF_DOOR_TOUCH_ONLY_CLIENTS 1024 // Only clients can touch
|
||||
#define SF_DOOR_SILENT 0x80000000
|
||||
|
||||
class CBaseDoor: public CBaseToggle {
|
||||
|
@ -29,19 +29,30 @@
|
||||
|
||||
#include "regamedll_const.h"
|
||||
|
||||
#undef DLLEXPORT
|
||||
#ifdef _WIN32
|
||||
// Attributes to specify an "exported" function, visible from outside the
|
||||
// DLL.
|
||||
#undef DLLEXPORT
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
// WINAPI should be provided in the windows compiler headers.
|
||||
// It's usually defined to something like "__stdcall".
|
||||
|
||||
#define NOINLINE __declspec(noinline)
|
||||
#else
|
||||
#undef DLLEXPORT
|
||||
#define DLLEXPORT __attribute__((visibility("default")))
|
||||
#define WINAPI /* */
|
||||
#define NOINLINE __attribute__((noinline))
|
||||
#endif // _WIN32
|
||||
|
||||
// Manual branch optimization for GCC 3.0.0 and newer
|
||||
#if !defined(__GNUC__) || __GNUC__ < 3
|
||||
#define likely(x) (x)
|
||||
#define unlikely(x) (x)
|
||||
#else
|
||||
#define likely(x) __builtin_expect(!!(x), 1)
|
||||
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||
#endif
|
||||
|
||||
// Simplified macro for declaring/defining exported DLL functions. They
|
||||
// need to be 'extern "C"' so that the C++ compiler enforces parameter
|
||||
// type-matching, rather than considering routines with mis-matched
|
||||
|
@ -101,6 +101,7 @@ class CPushable: public CBreakable {
|
||||
public:
|
||||
virtual void Spawn() = 0;
|
||||
virtual void Precache() = 0;
|
||||
virtual void Restart() = 0;
|
||||
virtual void KeyValue(KeyValueData *pkvd) = 0;
|
||||
virtual int Save(CSave &save) = 0;
|
||||
virtual int Restore(CRestore &restore) = 0;
|
||||
|
@ -35,13 +35,6 @@
|
||||
|
||||
#define MAX_BOMB_RADIUS 2048
|
||||
|
||||
#define MAP_VIP_SAFETYZONE_UNINITIALIZED 0 // uninitialized
|
||||
#define MAP_HAVE_VIP_SAFETYZONE_YES 1 // has VIP safety zone
|
||||
#define MAP_HAVE_VIP_SAFETYZONE_NO 2 // does not have VIP safetyzone
|
||||
|
||||
#define MAP_HAS_CAMERAS_INIT 2 // initial
|
||||
#define MAP_HAS_CAMERAS_YES 1 // on map have of camera's
|
||||
|
||||
#define ITEM_RESPAWN_TIME 30
|
||||
#define WEAPON_RESPAWN_TIME 20
|
||||
#define AMMO_RESPAWN_TIME 20
|
||||
@ -88,6 +81,8 @@ enum ScenarioEventEndRound
|
||||
ROUND_TERRORISTS_NOT_ESCAPED,
|
||||
ROUND_VIP_NOT_ESCAPED,
|
||||
ROUND_GAME_COMMENCE,
|
||||
ROUND_GAME_RESTART,
|
||||
ROUND_GAME_OVER
|
||||
};
|
||||
|
||||
enum RewardRules
|
||||
@ -149,8 +144,9 @@ enum RewardAccount
|
||||
REWARD_KILLED_VIP = 2500,
|
||||
REWARD_VIP_HAVE_SELF_RESCUED = 2500,
|
||||
|
||||
REWARD_TAKEN_HOSTAGE = 1000
|
||||
|
||||
REWARD_TAKEN_HOSTAGE = 1000,
|
||||
REWARD_TOOK_HOSTAGE_ACC = 100,
|
||||
REWARD_TOOK_HOSTAGE = 150,
|
||||
};
|
||||
|
||||
// custom enum
|
||||
@ -194,13 +190,13 @@ enum
|
||||
// custom enum
|
||||
enum
|
||||
{
|
||||
SCENARIO_BLOCK_TIME_EXPRIRED = (1 << 0),
|
||||
SCENARIO_BLOCK_NEED_PLAYERS = (1 << 1),
|
||||
SCENARIO_BLOCK_VIP_ESCAPRE = (1 << 2),
|
||||
SCENARIO_BLOCK_PRISON_ESCAPRE = (1 << 3),
|
||||
SCENARIO_BLOCK_BOMB = (1 << 4),
|
||||
SCENARIO_BLOCK_TEAM_EXTERMINATION = (1 << 5),
|
||||
SCENARIO_BLOCK_HOSTAGE_RESCUE = (1 << 6),
|
||||
SCENARIO_BLOCK_TIME_EXPRIRED = (1 << 0), // flag "a"
|
||||
SCENARIO_BLOCK_NEED_PLAYERS = (1 << 1), // flag "b"
|
||||
SCENARIO_BLOCK_VIP_ESCAPE = (1 << 2), // flag "c"
|
||||
SCENARIO_BLOCK_PRISON_ESCAPE = (1 << 3), // flag "d"
|
||||
SCENARIO_BLOCK_BOMB = (1 << 4), // flag "e"
|
||||
SCENARIO_BLOCK_TEAM_EXTERMINATION = (1 << 5), // flag "f"
|
||||
SCENARIO_BLOCK_HOSTAGE_RESCUE = (1 << 6), // flag "g"
|
||||
};
|
||||
|
||||
// Player relationship return codes
|
||||
@ -322,12 +318,18 @@ public:
|
||||
virtual BOOL IsFreezePeriod() = 0;
|
||||
virtual void ServerDeactivate() = 0;
|
||||
virtual void CheckMapConditions() = 0;
|
||||
|
||||
// inline function's
|
||||
inline bool IsGameOver() const { return m_bGameOver; }
|
||||
inline void SetGameOver() { m_bGameOver = true; }
|
||||
|
||||
public:
|
||||
BOOL m_bFreezePeriod;
|
||||
BOOL m_bFreezePeriod; // TRUE at beginning of round, set to FALSE when the period expires
|
||||
BOOL m_bBombDropped;
|
||||
|
||||
// custom
|
||||
char *m_GameDesc;
|
||||
bool m_bGameOver; // intermission or finale (deprecated name g_fGameOver)
|
||||
};
|
||||
|
||||
// CHalfLifeRules - rules for the single player Half-Life game.
|
||||
@ -549,24 +551,22 @@ public:
|
||||
bool ShouldSkipSpawn() const { return m_bSkipSpawn; }
|
||||
void MarkSpawnSkipped() { m_bSkipSpawn = false; }
|
||||
|
||||
float TimeRemaining() { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundCount; }
|
||||
bool IsMatchStarted() { return (m_fTeamCount != 0.0f || m_fCareerRoundMenuTime != 0.0f || m_fCareerMatchMenuTime != 0.0f); }
|
||||
float GetRoundRemainingTime() const { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundStartTime; }
|
||||
float GetRoundRemainingTimeReal() const { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundStartTimeReal; }
|
||||
float GetTimeLeft() const { return m_flTimeLimit - gpGlobals->time; }
|
||||
bool IsMatchStarted() { return (m_flRestartRoundTime != 0.0f || m_fCareerRoundMenuTime != 0.0f || m_fCareerMatchMenuTime != 0.0f); }
|
||||
|
||||
void TerminateRound(float tmDelay, int iWinStatus);
|
||||
|
||||
inline void TerminateRound(float tmDelay, int iWinStatus)
|
||||
{
|
||||
m_iRoundWinStatus = iWinStatus;
|
||||
m_fTeamCount = gpGlobals->time + tmDelay;
|
||||
m_bRoundTerminating = true;
|
||||
}
|
||||
public:
|
||||
CVoiceGameMgr m_VoiceGameMgr;
|
||||
float m_fTeamCount; // m_flRestartRoundTime, the global time when the round is supposed to end, if this is not 0
|
||||
float m_flRestartRoundTime; // The global time when the round is supposed to end, if this is not 0 (deprecated name m_fTeamCount)
|
||||
float m_flCheckWinConditions;
|
||||
float m_fRoundCount;
|
||||
float m_fRoundStartTime; // Time round has started (deprecated name m_fRoundCount)
|
||||
int m_iRoundTime; // (From mp_roundtime) - How many seconds long this round is.
|
||||
int m_iRoundTimeSecs;
|
||||
int m_iIntroRoundTime; // (From mp_freezetime) - How many seconds long the intro round (when players are frozen) is.
|
||||
float m_fIntroRoundCount; // The global time when the intro round ends and the real one starts
|
||||
float m_fRoundStartTimeReal; // The global time when the intro round ends and the real one starts
|
||||
// wrote the original "m_flRoundTime" comment for this variable).
|
||||
int m_iAccountTerrorist;
|
||||
int m_iAccountCT;
|
||||
@ -592,8 +592,8 @@ public:
|
||||
bool m_bMapHasRescueZone;
|
||||
bool m_bMapHasEscapeZone;
|
||||
|
||||
int m_iMapHasVIPSafetyZone; // 0 = uninitialized; 1 = has VIP safety zone; 2 = DOES not have VIP safetyzone
|
||||
int m_bMapHasCameras;
|
||||
BOOL m_bMapHasVIPSafetyZone; // TRUE = has VIP safety zone, FALSE = does not have VIP safetyzone
|
||||
BOOL m_bMapHasCameras;
|
||||
int m_iC4Timer;
|
||||
int m_iC4Guy; // The current Terrorist who has the C4.
|
||||
int m_iLoserBonus; // the amount of money the losing team gets. This scales up as they lose more rounds in a row
|
||||
@ -634,7 +634,7 @@ public:
|
||||
float m_flIntermissionStartTime;
|
||||
BOOL m_iEndIntermissionButtonHit;
|
||||
float m_tmNextPeriodicThink;
|
||||
bool m_bFirstConnected;
|
||||
bool m_bGameStarted; // TRUE = the game commencing when there is at least one CT and T, FALSE = scoring will not start until both teams have players (deprecated name m_bFirstConnected)
|
||||
bool m_bInCareerGame;
|
||||
float m_fCareerRoundMenuTime;
|
||||
int m_iCareerMatchWins;
|
||||
@ -646,6 +646,8 @@ public:
|
||||
bool m_bSkipShowMenu;
|
||||
bool m_bNeededPlayers;
|
||||
float m_flEscapeRatio;
|
||||
float m_flTimeLimit;
|
||||
float m_flGameStartTime;
|
||||
};
|
||||
|
||||
typedef struct mapcycle_item_s
|
||||
@ -672,7 +674,15 @@ public:
|
||||
|
||||
extern CGameRules *g_pGameRules;
|
||||
|
||||
// Gets us at the CS game rules
|
||||
inline CHalfLifeMultiplay *CSGameRules()
|
||||
{
|
||||
return reinterpret_cast<CHalfLifeMultiplay *>(g_pGameRules);
|
||||
return static_cast<CHalfLifeMultiplay *>(g_pGameRules);
|
||||
}
|
||||
|
||||
inline void CHalfLifeMultiplay::TerminateRound(float tmDelay, int iWinStatus)
|
||||
{
|
||||
m_iRoundWinStatus = iWinStatus;
|
||||
m_flRestartRoundTime = gpGlobals->time + tmDelay;
|
||||
m_bRoundTerminating = true;
|
||||
}
|
||||
|
@ -69,13 +69,24 @@ public:
|
||||
virtual void callOriginal(t_class *, t_args... args) = 0;
|
||||
};
|
||||
|
||||
// Specifies priorities for hooks call order in the chain.
|
||||
// For equal priorities first registered hook will be called first.
|
||||
enum HookChainPriority
|
||||
{
|
||||
HC_PRIORITY_UNINTERRUPTABLE = 255, // Hook will be called before other hooks.
|
||||
HC_PRIORITY_HIGH = 192, // Hook will be called before hooks with default priority.
|
||||
HC_PRIORITY_DEFAULT = 128, // Default hook call priority.
|
||||
HC_PRIORITY_MEDIUM = 64, // Hook will be called after hooks with default priority.
|
||||
HC_PRIORITY_LOW = 0, // Hook will be called after all other hooks.
|
||||
};
|
||||
|
||||
// Hook chain registry(for hooks [un]registration)
|
||||
template<typename t_ret, typename ...t_args>
|
||||
class IHookChainRegistry {
|
||||
public:
|
||||
typedef t_ret(*hookfunc_t)(IHookChain<t_ret, t_args...>*, t_args...);
|
||||
|
||||
virtual void registerHook(hookfunc_t hook) = 0;
|
||||
virtual void registerHook(hookfunc_t hook, int priority = HC_PRIORITY_DEFAULT) = 0;
|
||||
virtual void unregisterHook(hookfunc_t hook) = 0;
|
||||
};
|
||||
|
||||
@ -85,7 +96,7 @@ class IHookChainRegistryClass {
|
||||
public:
|
||||
typedef t_ret(*hookfunc_t)(IHookChainClass<t_ret, t_class, t_args...>*, t_class *, t_args...);
|
||||
|
||||
virtual void registerHook(hookfunc_t hook) = 0;
|
||||
virtual void registerHook(hookfunc_t hook, int priority = HC_PRIORITY_DEFAULT) = 0;
|
||||
virtual void unregisterHook(hookfunc_t hook) = 0;
|
||||
};
|
||||
|
||||
@ -95,7 +106,7 @@ class IVoidHookChainRegistry {
|
||||
public:
|
||||
typedef void(*hookfunc_t)(IVoidHookChain<t_args...>*, t_args...);
|
||||
|
||||
virtual void registerHook(hookfunc_t hook) = 0;
|
||||
virtual void registerHook(hookfunc_t hook, int priority = HC_PRIORITY_DEFAULT) = 0;
|
||||
virtual void unregisterHook(hookfunc_t hook) = 0;
|
||||
};
|
||||
|
||||
@ -105,6 +116,6 @@ class IVoidHookChainRegistryClass {
|
||||
public:
|
||||
typedef void(*hookfunc_t)(IVoidHookChainClass<t_class, t_args...>*, t_class *, t_args...);
|
||||
|
||||
virtual void registerHook(hookfunc_t hook) = 0;
|
||||
virtual void registerHook(hookfunc_t hook, int priority = HC_PRIORITY_DEFAULT) = 0;
|
||||
virtual void unregisterHook(hookfunc_t hook) = 0;
|
||||
};
|
||||
|
@ -27,9 +27,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
// Improved the hostages from CZero
|
||||
#include "hostage/hostage_improv.h"
|
||||
|
||||
#define MAX_NODES 100
|
||||
#define MAX_HOSTAGES 12
|
||||
#define MAX_HOSTAGES_NAV 20
|
||||
@ -75,6 +72,9 @@ enum HostageChatterType
|
||||
NUM_HOSTAGE_CHATTER_TYPES,
|
||||
};
|
||||
|
||||
// Improved the hostages from CZero
|
||||
#include "hostage/hostage_improv.h"
|
||||
|
||||
extern CHostageManager *g_pHostages;
|
||||
extern int g_iHostageNumber;
|
||||
|
||||
@ -85,6 +85,7 @@ public:
|
||||
virtual void Precache() = 0;
|
||||
virtual int ObjectCaps() = 0; // make hostage "useable"
|
||||
virtual int Classify() = 0;
|
||||
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
|
||||
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
|
||||
virtual int BloodColor() = 0;
|
||||
virtual void Touch(CBaseEntity *pOther) = 0;
|
||||
@ -118,10 +119,10 @@ public:
|
||||
|
||||
return true;
|
||||
}
|
||||
bool IsValid() { return (pev->takedamage == DAMAGE_YES); }
|
||||
bool IsDead() { return (pev->deadflag == DEAD_DEAD); }
|
||||
bool IsAtHome() { return (pev->origin - m_vStart).IsLengthGreaterThan(20) != true; }
|
||||
const Vector *GetHomePosition() { return &m_vStart; }
|
||||
bool IsValid() const { return (pev->takedamage == DAMAGE_YES); }
|
||||
bool IsDead() const { return (pev->deadflag == DEAD_DEAD); }
|
||||
bool IsAtHome() const { return (pev->origin - m_vStart).IsLengthGreaterThan(20) != true; }
|
||||
const Vector *GetHomePosition() const { return &m_vStart; }
|
||||
public:
|
||||
int m_Activity;
|
||||
BOOL m_bTouched;
|
||||
|
@ -33,6 +33,7 @@ class CMapInfo: public CPointEntity
|
||||
public:
|
||||
virtual void Spawn() = 0;
|
||||
virtual void KeyValue(KeyValueData *pkvd) = 0;
|
||||
virtual void UpdateOnRemove() = 0;
|
||||
|
||||
public:
|
||||
InfoMapBuyParam m_iBuyingStatus;
|
||||
|
@ -138,6 +138,8 @@ enum RewardType
|
||||
RT_NONE,
|
||||
RT_ROUND_BONUS,
|
||||
RT_PLAYER_RESET,
|
||||
RT_PLAYER_JOIN,
|
||||
RT_PLAYER_SPEC_JOIN,
|
||||
RT_PLAYER_BOUGHT_SOMETHING,
|
||||
RT_HOSTAGE_TOOK,
|
||||
RT_HOSTAGE_RESCUED,
|
||||
@ -318,9 +320,9 @@ public:
|
||||
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) = 0;
|
||||
virtual BOOL AddPlayerItem(CBasePlayerItem *pItem) = 0;
|
||||
virtual BOOL RemovePlayerItem(CBasePlayerItem *pItem) = 0;
|
||||
virtual int GiveAmmo(int iAmount, char *szName, int iMax) = 0;
|
||||
virtual int GiveAmmo(int iAmount, char *szName, int iMax = -1) = 0;
|
||||
virtual void StartSneaking() = 0;
|
||||
virtual void StopSneaking() = 0;
|
||||
virtual void UpdateOnRemove() = 0;
|
||||
virtual BOOL IsSneaking() = 0;
|
||||
virtual BOOL IsAlive() = 0;
|
||||
virtual BOOL IsPlayer() = 0;
|
||||
@ -359,6 +361,36 @@ public:
|
||||
void SetObserverAutoDirector(bool val) { m_bObserverAutoDirector = val; }
|
||||
bool CanSwitchObserverModes() const { return m_canSwitchObserverModes; }
|
||||
CCSPlayer *CSPlayer() const;
|
||||
|
||||
// templates
|
||||
template<typename Functor>
|
||||
CBasePlayerItem *ForEachItem(int slot, const Functor &func)
|
||||
{
|
||||
auto item = m_rgpPlayerItems[ slot ];
|
||||
while (item)
|
||||
{
|
||||
if (func(item))
|
||||
return item;
|
||||
|
||||
item = item->m_pNext;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
template<typename Functor>
|
||||
CBasePlayerItem *ForEachItem(const Functor &func)
|
||||
{
|
||||
for (auto item : m_rgpPlayerItems)
|
||||
{
|
||||
while (item)
|
||||
{
|
||||
if (func(item))
|
||||
return item;
|
||||
|
||||
item = item->m_pNext;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
public:
|
||||
enum { MaxLocationLen = 32 };
|
||||
|
||||
@ -566,8 +598,7 @@ public:
|
||||
inline bool CBasePlayer::IsReloading() const
|
||||
{
|
||||
CBasePlayerWeapon *weapon = static_cast<CBasePlayerWeapon *>(m_pActiveItem);
|
||||
|
||||
if (weapon != NULL && weapon->m_fInReload)
|
||||
if (weapon && weapon->m_fInReload)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -576,3 +607,19 @@ inline bool CBasePlayer::IsReloading() const
|
||||
inline CCSPlayer *CBasePlayer::CSPlayer() const {
|
||||
return reinterpret_cast<CCSPlayer *>(this->m_pEntity);
|
||||
}
|
||||
|
||||
// returns a CBaseEntity pointer to a player by index. Only returns if the player is spawned and connected otherwise returns NULL
|
||||
// Index is 1 based
|
||||
inline CBasePlayer *UTIL_PlayerByIndex(int playerIndex)
|
||||
{
|
||||
return (CBasePlayer *)GET_PRIVATE(INDEXENT(playerIndex));
|
||||
}
|
||||
|
||||
inline CBasePlayer *UTIL_PlayerByIndexSafe(int playerIndex)
|
||||
{
|
||||
CBasePlayer *player = nullptr;
|
||||
if (likely(playerIndex > 0 && playerIndex <= gpGlobals->maxClients))
|
||||
player = UTIL_PlayerByIndex(playerIndex);
|
||||
|
||||
return player;
|
||||
}
|
||||
|
@ -35,8 +35,8 @@
|
||||
#include "client.h"
|
||||
#include "items.h"
|
||||
|
||||
#define REGAMEDLL_API_VERSION_MAJOR 4
|
||||
#define REGAMEDLL_API_VERSION_MINOR 1
|
||||
#define REGAMEDLL_API_VERSION_MAJOR 5
|
||||
#define REGAMEDLL_API_VERSION_MINOR 0
|
||||
|
||||
// CBasePlayer::Spawn hook
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_Spawn;
|
||||
@ -139,8 +139,8 @@ typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_GiveDefau
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_GiveDefaultItems;
|
||||
|
||||
// CBasePlayer::GiveNamedItem hook
|
||||
typedef IVoidHookChainClass<class CBasePlayer, const char *> IReGameHook_CBasePlayer_GiveNamedItem;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_GiveNamedItem;
|
||||
typedef IHookChainClass<class CBaseEntity *, class CBasePlayer, const char *> IReGameHook_CBasePlayer_GiveNamedItem;
|
||||
typedef IHookChainRegistryClass<class CBaseEntity *, class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_GiveNamedItem;
|
||||
|
||||
// CBasePlayer::AddAccount hook
|
||||
typedef IVoidHookChainClass<class CBasePlayer, int, RewardType, bool> IReGameHook_CBasePlayer_AddAccount;
|
||||
@ -155,8 +155,8 @@ typedef IVoidHookChainClass<class CBasePlayer, char *, char *> IReGameHook_CBase
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, char *, char *> IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel;
|
||||
|
||||
// CBasePlayer:SetClientUserInfoName hook
|
||||
typedef IVoidHookChainClass<class CBasePlayer, char *, char *> IReGameHook_CBasePlayer_SetClientUserInfoName;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, char *, char *> IReGameHookRegistry_CBasePlayer_SetClientUserInfoName;
|
||||
typedef IHookChainClass<bool, class CBasePlayer, char *, char *> IReGameHook_CBasePlayer_SetClientUserInfoName;
|
||||
typedef IHookChainRegistryClass<bool, class CBasePlayer, char *, char *> IReGameHookRegistry_CBasePlayer_SetClientUserInfoName;
|
||||
|
||||
// CBasePlayer::HasRestrictItem hook
|
||||
typedef IHookChainClass<bool, class CBasePlayer, ItemID, ItemRestType> IReGameHook_CBasePlayer_HasRestrictItem;
|
||||
@ -166,6 +166,38 @@ typedef IHookChainRegistryClass<bool, class CBasePlayer, ItemID, ItemRestType> I
|
||||
typedef IVoidHookChainClass<class CBasePlayer, const char *> IReGameHook_CBasePlayer_DropPlayerItem;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_DropPlayerItem;
|
||||
|
||||
// CBasePlayer::DropShield hook
|
||||
typedef IVoidHookChainClass<class CBasePlayer, bool> IReGameHook_CBasePlayer_DropShield;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, bool> IReGameHookRegistry_CBasePlayer_DropShield;
|
||||
|
||||
// CBasePlayer::OnSpawnEquip hook
|
||||
typedef IVoidHookChainClass<class CBasePlayer, bool, bool> IReGameHook_CBasePlayer_OnSpawnEquip;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, bool, bool> IReGameHookRegistry_CBasePlayer_OnSpawnEquip;
|
||||
|
||||
// CBasePlayer::Radio hook
|
||||
typedef IVoidHookChainClass<class CBasePlayer, const char *, const char *, short, bool> IReGameHook_CBasePlayer_Radio;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, const char *, const char *, short, bool> IReGameHookRegistry_CBasePlayer_Radio;
|
||||
|
||||
// CBasePlayer::Disappear hook
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_Disappear;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_Disappear;
|
||||
|
||||
// CBasePlayer::MakeVIP hook
|
||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_MakeVIP;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_MakeVIP;
|
||||
|
||||
// CBasePlayer::MakeBomber hook
|
||||
typedef IHookChainClass<bool, class CBasePlayer> IReGameHook_CBasePlayer_MakeBomber;
|
||||
typedef IHookChainRegistryClass<bool, class CBasePlayer> IReGameHookRegistry_CBasePlayer_MakeBomber;
|
||||
|
||||
// CBasePlayer::StartObserver hook
|
||||
typedef IVoidHookChainClass<class CBasePlayer, Vector &, Vector &> IReGameHook_CBasePlayer_StartObserver;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, Vector &, Vector &> IReGameHookRegistry_CBasePlayer_StartObserver;
|
||||
|
||||
// CBasePlayer::GetIntoGame hook
|
||||
typedef IHookChainClass<bool, class CBasePlayer> IReGameHook_CBasePlayer_GetIntoGame;
|
||||
typedef IHookChainRegistryClass<bool, class CBasePlayer> IReGameHookRegistry_CBasePlayer_GetIntoGame;
|
||||
|
||||
// CBaseAnimating::ResetSequenceInfo hook
|
||||
typedef IVoidHookChainClass<class CBaseAnimating> IReGameHook_CBaseAnimating_ResetSequenceInfo;
|
||||
typedef IVoidHookChainRegistryClass<class CBaseAnimating> IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo;
|
||||
@ -218,6 +250,18 @@ typedef IVoidHookChainRegistry<class CBasePlayer *, int, int, BOOL, char *> IReG
|
||||
typedef IVoidHookChain<class CBasePlayer *, int, int, char *> IReGameHook_ShowVGUIMenu;
|
||||
typedef IVoidHookChainRegistry<class CBasePlayer *, int, int, char *> IReGameHookRegistry_ShowVGUIMenu;
|
||||
|
||||
// BuyGunAmmo hook
|
||||
typedef IHookChain<bool, class CBasePlayer *, class CBasePlayerItem *, bool> IReGameHook_BuyGunAmmo;
|
||||
typedef IHookChainRegistry<bool, class CBasePlayer *, class CBasePlayerItem *, bool> IReGameHookRegistry_BuyGunAmmo;
|
||||
|
||||
// BuyWeaponByWeaponID hook
|
||||
typedef IHookChain<class CBaseEntity *, class CBasePlayer *, WeaponIdType> IReGameHook_BuyWeaponByWeaponID;
|
||||
typedef IHookChainRegistry<class CBaseEntity *, class CBasePlayer *, WeaponIdType> IReGameHookRegistry_BuyWeaponByWeaponID;
|
||||
|
||||
// InternalCommand hook
|
||||
typedef IHookChain<bool, edict_t *, const char *> IReGameHook_InternalCommand;
|
||||
typedef IHookChainRegistry<bool, edict_t *, const char *> IReGameHookRegistry_InternalCommand;
|
||||
|
||||
// CHalfLifeMultiplay::FShouldSwitchWeapon hook
|
||||
typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_FShouldSwitchWeapon;
|
||||
typedef IHookChainRegistry<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon;
|
||||
@ -306,9 +350,14 @@ typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_GoToIntermissio
|
||||
typedef IVoidHookChain<> IReGameHook_CSGameRules_BalanceTeams;
|
||||
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_BalanceTeams;
|
||||
|
||||
// CHalfLifeMultiplay::OnRoundFreezeEnd hook
|
||||
typedef IVoidHookChain<> IReGameHook_CSGameRules_OnRoundFreezeEnd;
|
||||
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd;
|
||||
|
||||
class IReGameHookchains {
|
||||
public:
|
||||
virtual ~IReGameHookchains() {}
|
||||
|
||||
// CBasePlayer virtual
|
||||
virtual IReGameHookRegistry_CBasePlayer_Spawn* CBasePlayer_Spawn() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_Precache* CBasePlayer_Precache() = 0;
|
||||
@ -343,6 +392,15 @@ public:
|
||||
virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CBasePlayer_SetClientUserInfoName() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_HasRestrictItem* CBasePlayer_HasRestrictItem() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem* CBasePlayer_DropPlayerItem() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_DropShield* CBasePlayer_DropShield() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_OnSpawnEquip* CBasePlayer_OnSpawnEquip() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_Radio* CBasePlayer_Radio() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_Disappear* CBasePlayer_Disappear() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_MakeVIP* CBasePlayer_MakeVIP() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_MakeBomber* CBasePlayer_MakeBomber() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_StartObserver* CBasePlayer_StartObserver() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_GetIntoGame* CBasePlayer_GetIntoGame() = 0;
|
||||
|
||||
virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CBaseAnimating_ResetSequenceInfo() = 0;
|
||||
|
||||
virtual IReGameHookRegistry_GetForceCamera* GetForceCamera() = 0;
|
||||
@ -357,6 +415,9 @@ public:
|
||||
virtual IReGameHookRegistry_HandleMenu_ChooseTeam* HandleMenu_ChooseTeam() = 0;
|
||||
virtual IReGameHookRegistry_ShowMenu* ShowMenu() = 0;
|
||||
virtual IReGameHookRegistry_ShowVGUIMenu* ShowVGUIMenu() = 0;
|
||||
virtual IReGameHookRegistry_BuyGunAmmo* BuyGunAmmo() = 0;
|
||||
virtual IReGameHookRegistry_BuyWeaponByWeaponID* BuyWeaponByWeaponID() = 0;
|
||||
virtual IReGameHookRegistry_InternalCommand* InternalCommand() = 0;
|
||||
|
||||
virtual IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon* CSGameRules_FShouldSwitchWeapon() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_GetNextBestWeapon* CSGameRules_GetNextBestWeapon() = 0;
|
||||
@ -380,10 +441,10 @@ public:
|
||||
virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd* CSGameRules_OnRoundFreezeEnd() = 0;
|
||||
};
|
||||
|
||||
struct ReGameFuncs_t {
|
||||
class CBasePlayer *(*UTIL_PlayerByIndex)(int playerIndex);
|
||||
struct edict_s *(*CREATE_NAMED_ENTITY2)(string_t iClass);
|
||||
void (*ChangeString)(char *&dest, const char *source);
|
||||
void (*RadiusDamage)(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType);
|
||||
@ -391,6 +452,10 @@ struct ReGameFuncs_t {
|
||||
void (*ApplyMultiDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker);
|
||||
void (*AddMultiDamage)(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType);
|
||||
class CBaseEntity *(*UTIL_FindEntityByString)(class CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue);
|
||||
void (*AddEntityHashValue)(entvars_t *pev, const char *value, hash_types_e fieldType);
|
||||
void (*RemoveEntityHashValue)(entvars_t *pev, const char *value, hash_types_e fieldType);
|
||||
int (*Cmd_Argc)();
|
||||
const char *(*Cmd_Argv)(int i);
|
||||
};
|
||||
|
||||
class IReGameApi {
|
||||
@ -408,6 +473,8 @@ public:
|
||||
virtual struct playermove_s* GetPlayerMove() = 0;
|
||||
virtual struct WeaponSlotInfo* GetWeaponSlot(WeaponIdType weaponID) = 0;
|
||||
virtual struct WeaponSlotInfo* GetWeaponSlot(const char* weaponName) = 0;
|
||||
virtual struct ItemInfo* GetItemInfo(WeaponIdType weaponID) = 0;
|
||||
virtual struct AmmoInfo* GetAmmoInfo(AmmoType ammoID) = 0;
|
||||
};
|
||||
|
||||
#define VRE_GAMEDLL_API_VERSION "VRE_GAMEDLL_API_VERSION001"
|
||||
|
@ -85,6 +85,7 @@
|
||||
#define Q_pow pow
|
||||
#define Q_fmod fmod
|
||||
#define Q_fopen fopen
|
||||
#define Q_fwrite fwrite
|
||||
#define Q_fprintf fprintf
|
||||
#define Q_fclose fclose
|
||||
|
||||
|
@ -59,8 +59,8 @@ public:
|
||||
virtual bool IsConnected() const;
|
||||
virtual void SetAnimation(PLAYER_ANIM playerAnim);
|
||||
virtual void AddAccount(int amount, RewardType type = RT_NONE, bool bTrackChange = true);
|
||||
virtual void GiveNamedItem(const char *pszName);
|
||||
virtual void GiveNamedItemEx(const char *pszName);
|
||||
virtual CBaseEntity *GiveNamedItem(const char *pszName);
|
||||
virtual CBaseEntity *GiveNamedItemEx(const char *pszName);
|
||||
virtual void GiveDefaultItems();
|
||||
virtual void GiveShield(bool bDeploy = true);
|
||||
virtual void DropShield(bool bDeploy = true);
|
||||
@ -90,6 +90,11 @@ public:
|
||||
virtual void DropPrimary();
|
||||
virtual bool HasPlayerItem(CBasePlayerItem *pCheckItem);
|
||||
virtual bool HasNamedPlayerItem(const char *pszItemName);
|
||||
virtual CBasePlayerItem *GetItemById(WeaponIdType weaponID);
|
||||
virtual CBasePlayerItem *GetItemByName(const char *itemName);
|
||||
virtual void Disappear();
|
||||
virtual void MakeVIP();
|
||||
virtual bool MakeBomber();
|
||||
|
||||
CBasePlayer *BasePlayer() const;
|
||||
public:
|
||||
|
@ -37,8 +37,11 @@
|
||||
#define SF_TRIGGER_ALLOWMONSTERS 1 // monsters allowed to fire this trigger
|
||||
#define SF_TRIGGER_NOCLIENTS 2 // players not allowed to fire this trigger
|
||||
#define SF_TRIGGER_PUSHABLES 4 // only pushables can fire this trigger
|
||||
#define SF_TRIGGER_NO_RESET 64 // it is not allowed to be restarted on a new round
|
||||
|
||||
#define SF_TRIGGER_PUSH_ONCE 1
|
||||
#define SF_TRIGGER_PUSH_START_OFF 2 // spawnflag that makes trigger_push spawn turned OFF
|
||||
|
||||
#define SF_TRIGGER_HURT_TARGETONCE 1 // Only fire hurt target once
|
||||
#define SF_TRIGGER_HURT_START_OFF 2 // spawnflag that makes trigger_push spawn turned OFF
|
||||
#define SF_TRIGGER_HURT_NO_CLIENTS 8 // spawnflag that makes trigger_push spawn turned OFF
|
||||
@ -46,6 +49,8 @@
|
||||
#define SF_TRIGGER_HURT_CLIENTONLYTOUCH 32 // only clients may touch this trigger.
|
||||
|
||||
#define SF_AUTO_FIREONCE 0x0001
|
||||
#define SF_AUTO_NO_RESET 0x0002
|
||||
|
||||
#define SF_RELAY_FIREONCE 0x0001
|
||||
#define SF_ENDSECTION_USEONLY 0x0001
|
||||
|
||||
@ -80,6 +85,7 @@ class CAutoTrigger: public CBaseDelay {
|
||||
public:
|
||||
virtual void Spawn() = 0;
|
||||
virtual void Precache() = 0;
|
||||
virtual void Restart() = 0;
|
||||
virtual void KeyValue(KeyValueData *pkvd) = 0;
|
||||
virtual int Save(CSave &save) = 0;
|
||||
virtual int Restore(CRestore &restore) = 0;
|
||||
@ -144,6 +150,8 @@ public:
|
||||
class CTriggerHurt: public CBaseTrigger {
|
||||
public:
|
||||
virtual void Spawn() = 0;
|
||||
virtual void Restart() = 0;
|
||||
virtual int ObjectCaps() = 0;
|
||||
};
|
||||
|
||||
class CTriggerMonsterJump: public CBaseTrigger {
|
||||
@ -203,6 +211,7 @@ public:
|
||||
class CTriggerOnce: public CTriggerMultiple {
|
||||
public:
|
||||
virtual void Spawn() = 0;
|
||||
virtual void Restart() = 0;
|
||||
};
|
||||
|
||||
// QUAKED trigger_counter (.5 .5 .5) ? nomessage
|
||||
|
@ -79,8 +79,6 @@ extern globalvars_t *gpGlobals;
|
||||
#define SVC_ROOMTYPE 37
|
||||
#define SVC_DIRECTOR 51
|
||||
|
||||
#define SF_TRIG_PUSH_ONCE 1
|
||||
|
||||
// func_rotating
|
||||
#define SF_BRUSH_ROTATE_Y_AXIS 0
|
||||
#define SF_BRUSH_ROTATE_INSTANT 1
|
||||
@ -130,10 +128,20 @@ inline entvars_t *VARS(edict_t *pent)
|
||||
return &pent->v;
|
||||
}
|
||||
|
||||
inline entvars_t *VARS(EOFFSET eoffset) { return VARS(ENT(eoffset)); }
|
||||
inline entvars_t *VARS(EOFFSET eoffset)
|
||||
{
|
||||
return VARS(ENT(eoffset));
|
||||
}
|
||||
|
||||
#ifndef ENTINDEX
|
||||
inline int ENTINDEX(const edict_t *pEdict) { return (*g_engfuncs.pfnIndexOfEdict)(pEdict); }
|
||||
inline int ENTINDEX(const entvars_t *pev) { return (*g_engfuncs.pfnIndexOfEdict)(ENT(pev)); }
|
||||
#endif // ENTINDEX
|
||||
|
||||
#ifndef INDEXENT
|
||||
inline edict_t *INDEXENT(int iEdictNum) { return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum); }
|
||||
#endif // INDEXENT
|
||||
|
||||
inline void MESSAGE_BEGIN(int msg_dest, int msg_type, const float *pOrigin, entvars_t *ent) { MESSAGE_BEGIN(msg_dest, msg_type, pOrigin, ENT(ent)); }
|
||||
inline BOOL FNullEnt(EOFFSET eoffset) { return (eoffset == 0); }
|
||||
inline BOOL FNullEnt(entvars_t *pev) { return (pev == NULL || FNullEnt(OFFSET(pev))); }
|
||||
|
@ -92,7 +92,18 @@ enum ArmouryItemPack
|
||||
ARMOURY_HEGRENADE,
|
||||
ARMOURY_KEVLAR,
|
||||
ARMOURY_ASSAULT,
|
||||
ARMOURY_SMOKEGRENADE
|
||||
ARMOURY_SMOKEGRENADE,
|
||||
ARMOURY_GLOCK18,
|
||||
ARMOURY_USP,
|
||||
ARMOURY_ELITE,
|
||||
ARMOURY_FIVESEVEN,
|
||||
ARMOURY_P228,
|
||||
ARMOURY_DEAGLE,
|
||||
ARMOURY_FAMAS,
|
||||
ARMOURY_SG550,
|
||||
ARMOURY_GALIL,
|
||||
ARMOURY_UMP45,
|
||||
ARMOURY_SHIELD
|
||||
};
|
||||
|
||||
struct ItemInfo
|
||||
@ -431,6 +442,10 @@ private:
|
||||
unsigned short m_usFireAWP;
|
||||
};
|
||||
|
||||
// for usermsg BombDrop
|
||||
#define BOMB_FLAG_DROPPED 0 // if the bomb was dropped due to voluntary dropping or death/disconnect
|
||||
#define BOMB_FLAG_PLANTED 1 // if the bomb has been planted will also trigger the round timer to hide will also show where the dropped bomb on the Terrorist team's radar.
|
||||
|
||||
class CC4: public CBasePlayerWeapon {
|
||||
public:
|
||||
virtual void Spawn() = 0;
|
||||
|
@ -27,46 +27,47 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#define BSPVERSION 30
|
||||
// header
|
||||
#define Q1BSP_VERSION 29 // quake1 regular version (beta is 28)
|
||||
#define HLBSP_VERSION 30 // half-life regular version
|
||||
|
||||
#define MAX_MAP_HULLS 4
|
||||
|
||||
#define CONTENTS_ORIGIN -7 // removed at csg time
|
||||
#define CONTENTS_CLIP -8 // changed to contents_solid
|
||||
#define CONTENTS_CURRENT_0 -9
|
||||
#define CONTENTS_CURRENT_90 -10
|
||||
#define CONTENTS_CURRENT_0 -9
|
||||
#define CONTENTS_CURRENT_90 -10
|
||||
#define CONTENTS_CURRENT_180 -11
|
||||
#define CONTENTS_CURRENT_270 -12
|
||||
#define CONTENTS_CURRENT_UP -13
|
||||
#define CONTENTS_CURRENT_UP -13
|
||||
#define CONTENTS_CURRENT_DOWN -14
|
||||
|
||||
#define CONTENTS_TRANSLUCENT -15
|
||||
|
||||
#define LUMP_ENTITIES 0
|
||||
#define LUMP_ENTITIES 0
|
||||
#define LUMP_PLANES 1
|
||||
#define LUMP_TEXTURES 2
|
||||
#define LUMP_VERTEXES 3
|
||||
#define LUMP_VISIBILITY 4
|
||||
#define LUMP_TEXTURES 2
|
||||
#define LUMP_VERTEXES 3
|
||||
#define LUMP_VISIBILITY 4
|
||||
#define LUMP_NODES 5
|
||||
#define LUMP_TEXINFO 6
|
||||
#define LUMP_TEXINFO 6
|
||||
#define LUMP_FACES 7
|
||||
#define LUMP_LIGHTING 8
|
||||
#define LUMP_CLIPNODES 9
|
||||
#define LUMP_LIGHTING 8
|
||||
#define LUMP_CLIPNODES 9
|
||||
#define LUMP_LEAFS 10
|
||||
#define LUMP_MARKSURFACES 11
|
||||
#define LUMP_MARKSURFACES 11
|
||||
#define LUMP_EDGES 12
|
||||
#define LUMP_SURFEDGES 13
|
||||
#define LUMP_SURFEDGES 13
|
||||
#define LUMP_MODELS 14
|
||||
|
||||
#define HEADER_LUMPS 15
|
||||
#define HEADER_LUMPS 15
|
||||
|
||||
/* <a1fc> ../engine/bspfile.h:41 */
|
||||
typedef struct lump_s
|
||||
typedef struct lump_s
|
||||
{
|
||||
int fileofs;
|
||||
int filelen;
|
||||
} lump_t;
|
||||
|
||||
/* <a22c> ../engine/bspfile.h:64 */
|
||||
typedef struct dmodel_s
|
||||
{
|
||||
float mins[3], maxs[3];
|
||||
@ -76,21 +77,18 @@ typedef struct dmodel_s
|
||||
int firstface, numfaces;
|
||||
} dmodel_t;
|
||||
|
||||
/* <a2c2> ../engine/bspfile.h:73 */
|
||||
typedef struct dheader_s
|
||||
{
|
||||
int version;
|
||||
lump_t lumps[15];
|
||||
} dheader_t;
|
||||
|
||||
/* <485b2> ../engine/bspfile.h:79 */
|
||||
typedef struct dmiptexlump_s
|
||||
{
|
||||
int _nummiptex;
|
||||
int dataofs[4];
|
||||
} dmiptexlump_t;
|
||||
|
||||
/* <1ce18> ../engine/bspfile.h:86 */
|
||||
typedef struct miptex_s
|
||||
{
|
||||
char name[16];
|
||||
@ -99,13 +97,11 @@ typedef struct miptex_s
|
||||
unsigned offsets[4];
|
||||
} miptex_t;
|
||||
|
||||
/* <48652> ../engine/bspfile.h:94 */
|
||||
typedef struct dvertex_s
|
||||
{
|
||||
float point[3];
|
||||
} dvertex_t;
|
||||
|
||||
/* <48674> ../engine/bspfile.h:110 */
|
||||
typedef struct dplane_s
|
||||
{
|
||||
float normal[3];
|
||||
@ -113,7 +109,6 @@ typedef struct dplane_s
|
||||
int type;
|
||||
} dplane_t;
|
||||
|
||||
/* <486b2> ../engine/bspfile.h:132 */
|
||||
typedef struct dnode_s
|
||||
{
|
||||
int planenum;
|
||||
@ -124,14 +119,12 @@ typedef struct dnode_s
|
||||
unsigned short numfaces;
|
||||
} dnode_t;
|
||||
|
||||
/* <a332> ../engine/bspfile.h:142 */
|
||||
typedef struct dclipnode_s
|
||||
{
|
||||
int planenum;
|
||||
short children[2]; // negative numbers are contents
|
||||
} dclipnode_t;
|
||||
|
||||
/* <4876a> ../engine/bspfile.h:149 */
|
||||
typedef struct texinfo_s
|
||||
{
|
||||
float vecs[2][4];
|
||||
@ -139,13 +132,11 @@ typedef struct texinfo_s
|
||||
int flags;
|
||||
} texinfo_t;
|
||||
|
||||
/* <487c2> ../engine/bspfile.h:159 */
|
||||
typedef struct dedge_s
|
||||
{
|
||||
unsigned short v[2];
|
||||
} dedge_t;
|
||||
|
||||
/* <487f2> ../engine/bspfile.h:165 */
|
||||
typedef struct dface_s
|
||||
{
|
||||
short planenum;
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "archtypes.h"
|
||||
|
||||
typedef void(*xcommand_t)(void);
|
||||
|
||||
typedef struct cmd_function_s
|
||||
{
|
||||
struct cmd_function_s *next;
|
||||
|
@ -25,22 +25,27 @@
|
||||
* version.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "const.h"
|
||||
#include "qlimits.h"
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
#define COM_TOKEN_LEN 2048
|
||||
#else
|
||||
#define COM_TOKEN_LEN 1024
|
||||
#endif
|
||||
|
||||
// Don't allow overflow
|
||||
#define SIZEBUF_CHECK_OVERFLOW 0
|
||||
#define SIZEBUF_ALLOW_OVERFLOW BIT(0)
|
||||
#define SIZEBUF_CHECK_OVERFLOW 0
|
||||
#define SIZEBUF_ALLOW_OVERFLOW BIT(0)
|
||||
#define SIZEBUF_OVERFLOWED BIT(1)
|
||||
|
||||
#define MAX_NUM_ARGVS 50
|
||||
#define NUM_SAFE_ARGVS 7
|
||||
#define MAX_NUM_ARGVS 50
|
||||
#define NUM_SAFE_ARGVS 7
|
||||
|
||||
#define COM_COPY_CHUNK_SIZE 1024
|
||||
#define COM_MAX_CMD_LINE 256
|
||||
#define COM_COPY_CHUNK_SIZE 1024
|
||||
#define COM_MAX_CMD_LINE 256
|
||||
|
||||
typedef struct sizebuf_s
|
||||
{
|
||||
|
@ -28,19 +28,16 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
|
||||
/* <82286> ../engine/d_local.h:20 */
|
||||
typedef struct surfcache_s
|
||||
{
|
||||
struct surfcache_s *next;
|
||||
struct surfcache_s **owner;
|
||||
int lightadj[4];
|
||||
int dlight;
|
||||
int size;
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
float mipscale;
|
||||
int lightadj[4];
|
||||
int dlight;
|
||||
int size;
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
float mipscale;
|
||||
struct texture_s *texture;
|
||||
unsigned char data[4];
|
||||
unsigned char data[4];
|
||||
} surfcache_t;
|
||||
|
@ -94,7 +94,7 @@ typedef struct
|
||||
int fEnabled;
|
||||
int fPlayLooping;
|
||||
float cdvolume;
|
||||
//byte remap[100];
|
||||
//BYTE remap[100];
|
||||
int fCDRom;
|
||||
int fPlayTrack;
|
||||
} CDStatus;
|
||||
@ -298,8 +298,12 @@ typedef struct enginefuncs_s
|
||||
// Added 2005/11/21 (no SDK update):
|
||||
void(*pfnQueryClientCvarValue2) (const edict_t *player, const char *cvarName, int requestID);
|
||||
|
||||
// Comment out this, for compatibility with older versions metamod - s1lent
|
||||
#if !defined(CSSDK_COMPAT_OLD_METAMOD)
|
||||
// Added 2009/06/19 (no SDK update):
|
||||
// int(*pfnEngCheckParm) (const char *pchCmdLineToken, char **ppnext); // s1lent: comment out this, for compatibility with older versions metamod
|
||||
int(*pfnEngCheckParm) (const char *pchCmdLineToken, char **ppnext);
|
||||
#endif
|
||||
|
||||
} enginefuncs_t;
|
||||
|
||||
|
||||
|
@ -33,14 +33,21 @@
|
||||
#include "bspfile.h"
|
||||
#include "crc.h"
|
||||
#include "com_model.h"
|
||||
#include "commonmacros.h"
|
||||
|
||||
#define SURF_PLANEBACK 2
|
||||
#define SURF_DRAWSKY 4
|
||||
// header
|
||||
#define ALIAS_MODEL_VERSION 0x006
|
||||
#define IDPOLYHEADER MAKEID('I', 'D', 'P', 'O') // little-endian "IDPO"
|
||||
|
||||
#define MAX_LBM_HEIGHT 480
|
||||
#define MAX_ALIAS_MODEL_VERTS 2000
|
||||
|
||||
#define SURF_PLANEBACK 2
|
||||
#define SURF_DRAWSKY 4
|
||||
#define SURF_DRAWSPRITE 8
|
||||
#define SURF_DRAWTURB 0x10
|
||||
#define SURF_DRAWTILED 0x20
|
||||
#define SURF_DRAWBACKGROUND 0x40
|
||||
#define ALIAS_MODEL_VERSION 0x006
|
||||
|
||||
#define MAX_MODEL_NAME 64
|
||||
#define MIPLEVELS 4
|
||||
@ -48,13 +55,11 @@
|
||||
#define MAXLIGHTMAPS 4
|
||||
#define MAX_KNOWN_MODELS 1024
|
||||
|
||||
/* <6816> ../engine/model.h:27 */
|
||||
typedef struct mvertex_s
|
||||
{
|
||||
vec3_t position;
|
||||
} mvertex_t;
|
||||
|
||||
/* <6838> ../engine/model.h:39 */
|
||||
typedef struct mplane_s
|
||||
{
|
||||
vec3_t normal; // surface normal
|
||||
@ -64,27 +69,36 @@ typedef struct mplane_s
|
||||
byte pad[2];
|
||||
} mplane_t;
|
||||
|
||||
/* <68a6> ../engine/model.h:48 */
|
||||
typedef struct texture_s
|
||||
{
|
||||
char name[16];
|
||||
unsigned width, height;
|
||||
|
||||
#ifndef SWDS
|
||||
int gl_texturenum;
|
||||
struct msurface_s * texturechain;
|
||||
#endif
|
||||
|
||||
int anim_total; // total tenths in sequence ( 0 = no)
|
||||
int anim_min, anim_max; // time for this frame min <=time< max
|
||||
struct texture_s *anim_next; // in the animation sequence
|
||||
struct texture_s *alternate_anims; // bmodels in frame 1 use these
|
||||
unsigned offsets[MIPLEVELS]; // four mip maps stored
|
||||
|
||||
#ifdef SWDS
|
||||
unsigned paloffset;
|
||||
#else
|
||||
byte *pPal;
|
||||
#endif
|
||||
|
||||
} texture_t;
|
||||
|
||||
/* <6950> ../engine/model.h:71 */
|
||||
typedef struct medge_s
|
||||
{
|
||||
unsigned short v[2];
|
||||
unsigned int cachededgeoffset;
|
||||
} medge_t;
|
||||
|
||||
/* <697e> ../engine/model.h:78 */
|
||||
typedef struct mtexinfo_s
|
||||
{
|
||||
float vecs[2][4]; // [s/t] unit vectors in world space.
|
||||
@ -96,13 +110,10 @@ typedef struct mtexinfo_s
|
||||
} mtexinfo_t;
|
||||
#define TEX_SPECIAL 1 // sky or slime, no lightmap or 256 subdivision
|
||||
|
||||
/* <69d0> ../engine/model.h:91 */
|
||||
typedef struct msurface_s msurface_t;
|
||||
/* <1db66> ../engine/model.h:92 */
|
||||
typedef struct decal_s decal_t;
|
||||
|
||||
// JAY: Compress this as much as possible
|
||||
/* <1db71> ../engine/model.h:96 */
|
||||
struct decal_s
|
||||
{
|
||||
decal_t *pnext; // linked list for each surface
|
||||
@ -116,7 +127,6 @@ struct decal_s
|
||||
short entityIndex; // Entity this is attached to
|
||||
};
|
||||
|
||||
/* <69db> ../engine/model.h:118 */
|
||||
struct msurface_s
|
||||
{
|
||||
int visframe; // should be drawn when node is crossed
|
||||
@ -148,7 +158,6 @@ struct msurface_s
|
||||
decal_t *pdecals;
|
||||
};
|
||||
|
||||
/* <6b6c> ../engine/model.h:149 */
|
||||
typedef struct mnode_s
|
||||
{
|
||||
// common with leaf
|
||||
@ -167,7 +176,6 @@ typedef struct mnode_s
|
||||
unsigned short numsurfaces;
|
||||
} mnode_t;
|
||||
|
||||
/* <1dcd4> ../engine/model.h:169 */
|
||||
typedef struct mleaf_s
|
||||
{
|
||||
// common with node
|
||||
@ -188,7 +196,6 @@ typedef struct mleaf_s
|
||||
byte ambient_sound_level[NUM_AMBIENTS];
|
||||
} mleaf_t;
|
||||
|
||||
/* <1ddbe> ../engine/model.h:190 */
|
||||
typedef struct hull_s
|
||||
{
|
||||
dclipnode_t *clipnodes;
|
||||
@ -198,7 +205,6 @@ typedef struct hull_s
|
||||
vec3_t clip_mins, clip_maxs;
|
||||
} hull_t;
|
||||
|
||||
/* <4b3fe> ../engine/model.h:210 */
|
||||
typedef struct mspriteframe_t
|
||||
{
|
||||
int width;
|
||||
@ -208,7 +214,6 @@ typedef struct mspriteframe_t
|
||||
byte pixels[4];
|
||||
} mspriteframe_s;
|
||||
|
||||
/* <4b485> ../engine/model.h:219 */
|
||||
typedef struct mspritegroup_s
|
||||
{
|
||||
int numframes;
|
||||
@ -216,14 +221,12 @@ typedef struct mspritegroup_s
|
||||
mspriteframe_t *frames[1];
|
||||
} mspritegroup_t;
|
||||
|
||||
/* <4b4df> ../engine/model.h:226 */
|
||||
typedef struct mspriteframedesc_s
|
||||
{
|
||||
spriteframetype_t type;
|
||||
mspriteframe_t *frameptr;
|
||||
} mspriteframedesc_t;
|
||||
|
||||
/* <4b50f> ../engine/model.h:232 */
|
||||
typedef struct msprite_s
|
||||
{
|
||||
short int type;
|
||||
@ -236,7 +239,6 @@ typedef struct msprite_s
|
||||
mspriteframedesc_t frames[1];
|
||||
} msprite_t;
|
||||
|
||||
/* <4b5b5> ../engine/model.h:255 */
|
||||
typedef struct maliasframedesc_s
|
||||
{
|
||||
aliasframetype_t type;
|
||||
@ -245,7 +247,6 @@ typedef struct maliasframedesc_s
|
||||
char name[16];
|
||||
} maliasframedesc_t;
|
||||
|
||||
/* <4b615> ../engine/model.h:264 */
|
||||
typedef struct maliasskindesc_s
|
||||
{
|
||||
aliasskintype_t type;
|
||||
@ -253,14 +254,12 @@ typedef struct maliasskindesc_s
|
||||
int skin;
|
||||
} maliasskindesc_t;
|
||||
|
||||
/* <4b658> ../engine/model.h:271 */
|
||||
typedef struct maliasgroupframedesc_s
|
||||
{
|
||||
trivertx_t bboxmin, bboxmax;
|
||||
int frame;
|
||||
} maliasgroupframedesc_t;
|
||||
|
||||
/* <4b69b> ../engine/model.h:278 */
|
||||
typedef struct maliasgroup_s
|
||||
{
|
||||
int numframes;
|
||||
@ -268,7 +267,6 @@ typedef struct maliasgroup_s
|
||||
maliasgroupframedesc_t frames[1];
|
||||
} maliasgroup_t;
|
||||
|
||||
/* <4b6ee> ../engine/model.h:285 */
|
||||
typedef struct maliasskingroup_s
|
||||
{
|
||||
int numskins;
|
||||
@ -276,14 +274,12 @@ typedef struct maliasskingroup_s
|
||||
maliasskindesc_t skindescs[1];
|
||||
} maliasskingroup_t;
|
||||
|
||||
/* <4b741> ../engine/model.h:293 */
|
||||
typedef struct mtriangle_s
|
||||
{
|
||||
int facesfront;
|
||||
int vertindex[3];
|
||||
} mtriangle_t;
|
||||
|
||||
/* <4b779> ../engine/model.h:298 */
|
||||
typedef struct aliashdr_s
|
||||
{
|
||||
int model;
|
||||
@ -294,21 +290,19 @@ typedef struct aliashdr_s
|
||||
maliasframedesc_t frames[1];
|
||||
} aliashdr_t;
|
||||
|
||||
/* <1de30> ../engine/model.h:315 */
|
||||
typedef enum modtype_e
|
||||
{
|
||||
mod_bad = -1,
|
||||
mod_brush,
|
||||
mod_sprite,
|
||||
mod_alias,
|
||||
mod_studio,
|
||||
} modtype_t;
|
||||
|
||||
/* <1de5e> ../engine/model.h:331 */
|
||||
typedef struct model_s
|
||||
{
|
||||
char name[MAX_MODEL_NAME];
|
||||
|
||||
//TODO: qboolean? seriously?
|
||||
int needload; // bmodels and sprites don't cache normally
|
||||
|
||||
modtype_t type;
|
||||
|
@ -32,30 +32,24 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
/* <67f6> ../engine/modelgen.h:37 */
|
||||
typedef enum synctype_e
|
||||
{
|
||||
ST_SYNC = 0,
|
||||
ST_RAND = 1,
|
||||
} synctype_t;
|
||||
|
||||
/* <4abae> ../engine/modelgen.h:40 */
|
||||
typedef enum aliasframetype_s
|
||||
{
|
||||
ALIAS_SINGLE = 0,
|
||||
ALIAS_GROUP = 1,
|
||||
} aliasframetype_t;
|
||||
|
||||
/* 203 */
|
||||
/* <4abce> ../engine/modelgen.h:42 */
|
||||
typedef enum aliasskintype_s
|
||||
{
|
||||
ALIAS_SKIN_SINGLE = 0,
|
||||
ALIAS_SKIN_GROUP = 1,
|
||||
} aliasskintype_t;
|
||||
|
||||
/* <4abee> ../engine/modelgen.h:44 */
|
||||
typedef struct mdl_s
|
||||
{
|
||||
int ident;
|
||||
@ -75,7 +69,6 @@ typedef struct mdl_s
|
||||
float size;
|
||||
} mdl_t;
|
||||
|
||||
/* <4acd4> ../engine/modelgen.h:64 */
|
||||
typedef struct stvert_s
|
||||
{
|
||||
int onseam;
|
||||
@ -83,59 +76,50 @@ typedef struct stvert_s
|
||||
int t;
|
||||
} stvert_t;
|
||||
|
||||
/* <4ad0e> ../engine/modelgen.h:70 */
|
||||
typedef struct dtriangle_s
|
||||
{
|
||||
int facesfront;
|
||||
int vertindex[3];
|
||||
} dtriangle_t;
|
||||
|
||||
/* <4ad42> ../engine/modelgen.h:80 */
|
||||
typedef struct trivertx_s
|
||||
{
|
||||
byte v[3];
|
||||
byte lightnormalindex;
|
||||
} trivertx_t;
|
||||
|
||||
/* <4ad80> ../engine/modelgen.h:85 */
|
||||
typedef struct daliasframe_s
|
||||
{
|
||||
trivertx_t bboxmin, bboxmax;
|
||||
char name[16];
|
||||
} daliasframe_t;
|
||||
|
||||
/* <4adbe> ../engine/modelgen.h:91 */
|
||||
typedef struct daliasgroup_s
|
||||
{
|
||||
int numframes;
|
||||
trivertx_t bboxmin, bboxmax;
|
||||
} daliasgroup_t;
|
||||
|
||||
/* <4adfc> ../engine/modelgen.h:97 */
|
||||
typedef struct daliasskingroup_s
|
||||
{
|
||||
int numskins;
|
||||
} daliasskingroup_t;
|
||||
|
||||
/* <4ae1e> ../engine/modelgen.h:101 */
|
||||
typedef struct daliasinterval_s
|
||||
{
|
||||
float interval;
|
||||
} daliasinterval_t;
|
||||
|
||||
/* <4ae40> ../engine/modelgen.h:105 */
|
||||
typedef struct daliasskininterval_s
|
||||
{
|
||||
float interval;
|
||||
} daliasskininterval_t;
|
||||
|
||||
/* <4ae62> ../engine/modelgen.h:109 */
|
||||
typedef struct daliasframetype_s
|
||||
{
|
||||
aliasframetype_t type;
|
||||
} daliasframetype_t;
|
||||
|
||||
/* <4ae84> ../engine/modelgen.h:113 */
|
||||
typedef struct daliasskintype_s
|
||||
{
|
||||
aliasskintype_t type;
|
||||
|
@ -103,6 +103,7 @@
|
||||
#define HIDDEN
|
||||
#define NOINLINE __declspec(noinline)
|
||||
#define ALIGN16 __declspec(align(16))
|
||||
#define NORETURN __declspec(noreturn)
|
||||
#define FORCE_STACK_ALIGN
|
||||
|
||||
//inline bool SOCKET_FIONBIO(SOCKET s, int m) { return (ioctlsocket(s, FIONBIO, (u_long*)&m) == 0); }
|
||||
@ -148,6 +149,7 @@
|
||||
#define HIDDEN __attribute__((visibility("hidden")))
|
||||
#define NOINLINE __attribute__((noinline))
|
||||
#define ALIGN16 __attribute__((aligned(16)))
|
||||
#define NORETURN __attribute__((noreturn))
|
||||
#define FORCE_STACK_ALIGN __attribute__((force_align_arg_pointer))
|
||||
|
||||
//inline bool SOCKET_FIONBIO(SOCKET s, int m) { return (ioctl(s, FIONBIO, (int*)&m) == 0); }
|
||||
@ -189,6 +191,4 @@
|
||||
|
||||
#define EXT_FUNC FORCE_STACK_ALIGN
|
||||
|
||||
extern void __declspec(noreturn) rehlds_syserror(const char* fmt, ...);
|
||||
|
||||
#endif // _OSCONFIG_H
|
||||
|
@ -34,8 +34,8 @@
|
||||
#include "interface.h"
|
||||
#include "model.h"
|
||||
|
||||
#define REHLDS_API_VERSION_MAJOR 2
|
||||
#define REHLDS_API_VERSION_MINOR 13
|
||||
#define REHLDS_API_VERSION_MAJOR 3
|
||||
#define REHLDS_API_VERSION_MINOR 0
|
||||
|
||||
//Steam_NotifyClientConnect hook
|
||||
typedef IHookChain<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
|
||||
@ -122,8 +122,8 @@ typedef IVoidHookChain<IGameClient *, struct packet_entities_s *, sizebuf_t *> I
|
||||
typedef IVoidHookChainRegistry<IGameClient *, struct packet_entities_s *, sizebuf_t *> IRehldsHookRegistry_SV_EmitEvents;
|
||||
|
||||
//EV_PlayReliableEvent hook
|
||||
typedef IVoidHookChain<IGameClient *, int, short unsigned int, float, struct event_args_s *> IRehldsHook_EV_PlayReliableEvent;
|
||||
typedef IVoidHookChainRegistry<IGameClient *, int, short unsigned int, float, struct event_args_s *> IRehldsHookRegistry_EV_PlayReliableEvent;
|
||||
typedef IVoidHookChain<IGameClient *, int, unsigned short, float, struct event_args_s *> IRehldsHook_EV_PlayReliableEvent;
|
||||
typedef IVoidHookChainRegistry<IGameClient *, int, unsigned short, float, struct event_args_s *> IRehldsHookRegistry_EV_PlayReliableEvent;
|
||||
|
||||
//SV_StartSound hook
|
||||
typedef IVoidHookChain<int , edict_t *, int, const char *, int, float, int, int> IRehldsHook_SV_StartSound;
|
||||
@ -257,7 +257,7 @@ struct RehldsFuncs_t {
|
||||
cmd_source_t*(*GetCmdSource)();
|
||||
void(*Log)(const char* prefix, const char* msg);
|
||||
DLL_FUNCTIONS *(*GetEntityInterface)();
|
||||
void(*EV_PlayReliableEvent)(IGameClient *cl, int entindex, short unsigned int eventindex, float delay, struct event_args_s *pargs);
|
||||
void(*EV_PlayReliableEvent)(IGameClient *cl, int entindex, unsigned short eventindex, float delay, struct event_args_s *pargs);
|
||||
int(*SV_LookupSoundIndex)(const char *sample);
|
||||
void(*MSG_StartBitWriting)(sizebuf_t *buf);
|
||||
void(*MSG_WriteBits)(uint32 data, int numbits);
|
||||
@ -280,7 +280,8 @@ struct RehldsFuncs_t {
|
||||
void(*Steam_NotifyClientDisconnect)(IGameClient* cl);
|
||||
void(*SV_StartSound)(int recipients, edict_t *entity, int channel, const char *sample, int volume, float attenuation, int flags, int pitch);
|
||||
bool(*SV_EmitSound2)(edict_t *entity, IGameClient *receiver, int channel, const char *sample, float volume, float attenuation, int flags, int pitch, int emitFlags, const float *pOrigin);
|
||||
void (* SV_UpdateUserInfo)(IGameClient *pGameClient);
|
||||
void(*SV_UpdateUserInfo)(IGameClient *pGameClient);
|
||||
bool(*StripUnprintableAndSpace)(char *pch);
|
||||
};
|
||||
|
||||
class IRehldsApi {
|
||||
|
@ -33,11 +33,10 @@
|
||||
#endif
|
||||
|
||||
#include "modelgen.h"
|
||||
#include "commonmacros.h"
|
||||
|
||||
|
||||
#define IDSPRITEHEADER (('P'<<24)+('S'<<16)+('D'<<8)+'I')
|
||||
#define SPRITE_VERSION 2
|
||||
|
||||
#define SPRITE_VERSION 2 // Half-Life sprites
|
||||
#define IDSPRITEHEADER MAKEID('I', 'D', 'S', 'P') // little-endian "IDSP"
|
||||
|
||||
typedef enum spriteframetype_e
|
||||
{
|
||||
@ -46,7 +45,6 @@ typedef enum spriteframetype_e
|
||||
SPR_ANGLED
|
||||
} spriteframetype_t;
|
||||
|
||||
/* <4aea6> ../engine/spritegn.h:50 */
|
||||
typedef struct dsprite_s
|
||||
{
|
||||
int ident;
|
||||
@ -61,7 +59,6 @@ typedef struct dsprite_s
|
||||
synctype_t synctype;
|
||||
} dsprite_t;
|
||||
|
||||
/* <4af46> ../engine/spritegn.h:74 */
|
||||
typedef struct dspriteframe_s
|
||||
{
|
||||
int origin[2];
|
||||
@ -69,19 +66,16 @@ typedef struct dspriteframe_s
|
||||
int height;
|
||||
} dspriteframe_t;
|
||||
|
||||
/* <4af84> ../engine/spritegn.h:80 */
|
||||
typedef struct dspritegroup_s
|
||||
{
|
||||
int numframes;
|
||||
} dspritegroup_t;
|
||||
|
||||
/* <4afa6> ../engine/spritegn.h:84 */
|
||||
typedef struct dspriteinterval_s
|
||||
{
|
||||
float interval;
|
||||
} dspriteinterval_t;
|
||||
|
||||
/* <4afe8> ../engine/spritegn.h:90 */
|
||||
typedef struct dspriteframetype_s
|
||||
{
|
||||
spriteframetype_t type;
|
||||
|
@ -44,7 +44,7 @@ private:
|
||||
// this was a root node
|
||||
unsigned int rootId = GetRoodNodeId(node->key);
|
||||
if (m_RootNodes[rootId] != node) {
|
||||
util_syserror("%s: invlid root node", __FUNCTION__);
|
||||
Sys_Error(__FUNCTION__ ": invalid root node");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -310,10 +310,13 @@ typedef struct
|
||||
} mstudiotrivert_t;
|
||||
#endif
|
||||
|
||||
#define STUDIO_DYNAMIC_LIGHT 0x0100 // dynamically get lighting from floor or ceil (flying monsters)
|
||||
#define STUDIO_TRACE_HITBOX 0x0200 // always use hitbox trace instead of bbox
|
||||
|
||||
// lighting options
|
||||
#define STUDIO_NF_FLATSHADE 0x0001
|
||||
#define STUDIO_NF_CHROME 0x0002
|
||||
#define STUDIO_NF_FULLBRIGHT 0x0004
|
||||
#define STUDIO_NF_FULLBRIGHT 0x0004
|
||||
#define STUDIO_NF_NOMIPS 0x0008
|
||||
#define STUDIO_NF_ALPHA 0x0010
|
||||
#define STUDIO_NF_ADDITIVE 0x0020
|
||||
|
@ -38,7 +38,6 @@ enum AUTH_IDTYPE
|
||||
AUTH_IDTYPE_LOCAL = 3
|
||||
};
|
||||
|
||||
/* <2e915> ../engine/userid.h:22 */
|
||||
typedef struct USERID_s
|
||||
{
|
||||
int idtype;
|
||||
|
@ -47,6 +47,8 @@ typedef std::list<ActiveGrenade *> ActiveGrenadeList;
|
||||
|
||||
class CBotManager {
|
||||
public:
|
||||
virtual ~CBotManager() {}
|
||||
|
||||
virtual void ClientDisconnect(CBasePlayer *pPlayer) = 0;
|
||||
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0;
|
||||
|
||||
|
@ -23,8 +23,8 @@
|
||||
#define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0]))
|
||||
|
||||
// Keeps clutter down a bit, when using a float as a bit-vector
|
||||
#define SETBITS(flBitVector, bits) ((flBitVector) = (int)(flBitVector) | (bits))
|
||||
#define CLEARBITS(flBitVector, bits) ((flBitVector) = (int)(flBitVector) & ~(bits))
|
||||
#define FBitSet(flBitVector, bit) ((flBitVector) & (bit))
|
||||
#define SetBits(flBitVector, bits) ((flBitVector) = (int)(flBitVector) | (bits))
|
||||
#define ClearBits(flBitVector, bits) ((flBitVector) = (int)(flBitVector) & ~(bits))
|
||||
#define FBitSet(flBitVector, bit) ((int)(flBitVector) & (bit))
|
||||
|
||||
#endif // COMMONMACROS_H
|
||||
|
@ -12,26 +12,15 @@
|
||||
//=============================================================================
|
||||
|
||||
#include "precompiled.h"
|
||||
#include <assert.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include "tier0/dbg.h"
|
||||
#include <math.h>
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// internal structures
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#define MAX_GROUP_NAME_LENGTH 48
|
||||
//enum
|
||||
//{
|
||||
// MAX_GROUP_NAME_LENGTH = 48
|
||||
//};
|
||||
enum
|
||||
{
|
||||
MAX_GROUP_NAME_LENGTH = 48
|
||||
};
|
||||
|
||||
struct SpewGroup_t
|
||||
{
|
||||
@ -180,6 +169,8 @@ SpewRetval_t _SpewMessage(SpewType_t spewType, char const* pMsgFormat, va_list
|
||||
case SPEW_ABORT:
|
||||
// MessageBox(NULL,"Error in _SpewMessage","Error",MB_OK);
|
||||
exit(0);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// dll export stuff
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -441,6 +442,7 @@ private:
|
||||
//
|
||||
// Purpose: Embed debug info in each file.
|
||||
//
|
||||
|
||||
//#ifdef _WIN32
|
||||
//#ifdef _DEBUG
|
||||
//#pragma comment(compiler)
|
||||
|
@ -215,6 +215,7 @@
|
||||
<ClInclude Include="..\src\natives\natives_addons.h" />
|
||||
<ClInclude Include="..\src\precompiled.h" />
|
||||
<ClInclude Include="..\src\reapi_utils.h" />
|
||||
<ClInclude Include="..\src\type_conversion.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\include\cssdk\common\parsemsg.cpp">
|
||||
|
@ -657,6 +657,9 @@
|
||||
<ClInclude Include="..\include\reunion_api.h">
|
||||
<Filter>include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\type_conversion.h">
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\include\cssdk\common\parsemsg.cpp">
|
||||
|
@ -301,14 +301,14 @@ void CBasePlayer_GiveDefaultItems(IReGameHook_CBasePlayer_GiveDefaultItems *chai
|
||||
callVoidForward(RG_CBasePlayer_GiveDefaultItems, original, indexOfEdict(pthis->pev));
|
||||
}
|
||||
|
||||
void CBasePlayer_GiveNamedItem(IReGameHook_CBasePlayer_GiveNamedItem *chain, CBasePlayer *pthis, const char *pszName)
|
||||
CBaseEntity *CBasePlayer_GiveNamedItem(IReGameHook_CBasePlayer_GiveNamedItem *chain, CBasePlayer *pthis, const char *pszName)
|
||||
{
|
||||
auto original = [chain](int _pthis, const char *_pszName)
|
||||
{
|
||||
chain->callNext(getPrivate<CBasePlayer>(_pthis), _pszName);
|
||||
return indexOfPDataAmx(chain->callNext(getPrivate<CBasePlayer>(_pthis), _pszName));
|
||||
};
|
||||
|
||||
callVoidForward(RG_CBasePlayer_GiveNamedItem, original, indexOfEdict(pthis->pev), pszName);
|
||||
return getPrivate<CBaseEntity>(callForward<size_t>(RG_CBasePlayer_GiveNamedItem, original, indexOfEdict(pthis->pev), pszName));
|
||||
}
|
||||
|
||||
void CBasePlayer_AddAccount(IReGameHook_CBasePlayer_AddAccount *chain, CBasePlayer *pthis, int amount, RewardType type, bool bTrackChange)
|
||||
@ -341,14 +341,14 @@ void CBasePlayer_SetClientUserInfoModel(IReGameHook_CBasePlayer_SetClientUserInf
|
||||
callVoidForward(RG_CBasePlayer_SetClientUserInfoModel, original, indexOfEdict(pthis->pev), infobuffer, szNewModel);
|
||||
}
|
||||
|
||||
void CBasePlayer_SetClientUserInfoName(IReGameHook_CBasePlayer_SetClientUserInfoName *chain, CBasePlayer *pthis, char *infobuffer, char *szNewName)
|
||||
bool CBasePlayer_SetClientUserInfoName(IReGameHook_CBasePlayer_SetClientUserInfoName *chain, CBasePlayer *pthis, char *infobuffer, char *szNewName)
|
||||
{
|
||||
auto original = [chain](int _pthis, char *_infobuffer, char *_szNewName)
|
||||
{
|
||||
chain->callNext(getPrivate<CBasePlayer>(_pthis), _infobuffer, _szNewName);
|
||||
return chain->callNext(getPrivate<CBasePlayer>(_pthis), _infobuffer, _szNewName);
|
||||
};
|
||||
|
||||
callVoidForward(RG_CBasePlayer_SetClientUserInfoName, original, indexOfEdict(pthis->pev), infobuffer, szNewName);
|
||||
return callForward<bool>(RG_CBasePlayer_SetClientUserInfoName, original, indexOfEdict(pthis->pev), infobuffer, szNewName);
|
||||
}
|
||||
|
||||
bool CBasePlayer_HasRestrictItem(IReGameHook_CBasePlayer_HasRestrictItem *chain, CBasePlayer *pthis, ItemID item, ItemRestType type)
|
||||
|
@ -320,11 +320,11 @@ void CBasePlayer_Blind(IReGameHook_CBasePlayer_Blind *chain, CBasePlayer *pthis,
|
||||
CBasePlayer *CBasePlayer_Observer_IsValidTarget(IReGameHook_CBasePlayer_Observer_IsValidTarget *chain, CBasePlayer *pthis, int iPlayerIndex, bool bSameTeam);
|
||||
void CBasePlayer_SetAnimation(IReGameHook_CBasePlayer_SetAnimation *chain, CBasePlayer *pthis, PLAYER_ANIM playerAnim);
|
||||
void CBasePlayer_GiveDefaultItems(IReGameHook_CBasePlayer_GiveDefaultItems *chain, CBasePlayer *pthis);
|
||||
void CBasePlayer_GiveNamedItem(IReGameHook_CBasePlayer_GiveNamedItem *chain, CBasePlayer *pthis, const char *pszName);
|
||||
CBaseEntity *CBasePlayer_GiveNamedItem(IReGameHook_CBasePlayer_GiveNamedItem *chain, CBasePlayer *pthis, const char *pszName);
|
||||
void CBasePlayer_AddAccount(IReGameHook_CBasePlayer_AddAccount *chain, CBasePlayer *pthis, int amount, RewardType type, bool bTrackChange);
|
||||
void CBasePlayer_GiveShield(IReGameHook_CBasePlayer_GiveShield *chain, CBasePlayer *pthis, bool bDeploy);
|
||||
void CBasePlayer_SetClientUserInfoModel(IReGameHook_CBasePlayer_SetClientUserInfoModel *chain, CBasePlayer *pthis, char *infobuffer, char *szNewModel);
|
||||
void CBasePlayer_SetClientUserInfoName(IReGameHook_CBasePlayer_SetClientUserInfoName *chain, CBasePlayer *pthis, char *infobuffer, char *szNewName);
|
||||
bool CBasePlayer_SetClientUserInfoName(IReGameHook_CBasePlayer_SetClientUserInfoName *chain, CBasePlayer *pthis, char *infobuffer, char *szNewName);
|
||||
bool CBasePlayer_HasRestrictItem(IReGameHook_CBasePlayer_HasRestrictItem *chain, CBasePlayer *pthis, ItemID item, ItemRestType type);
|
||||
void CBasePlayer_DropPlayerItem(IReGameHook_CBasePlayer_DropPlayerItem *chain, CBasePlayer *pthis, const char *pszItemName);
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
extern char g_szMapName[32];
|
||||
extern edict_t* g_pEdicts;
|
||||
extern playermove_t* g_pMove;
|
||||
extern int gmsgSendAudio;
|
||||
extern int gmsgStatusIcon;
|
||||
|
@ -100,13 +100,13 @@ member_t memberlist_gamerules[] = {
|
||||
GM_VOICE_MEMBERS(m_msgRequestState),
|
||||
GM_VOICE_MEMBERS(m_nMaxPlayers),
|
||||
GM_VOICE_MEMBERS(m_UpdateInterval),
|
||||
GM_MEMBERS(m_fTeamCount),
|
||||
GM_MEMBERS(m_flRestartRoundTime),
|
||||
GM_MEMBERS(m_flCheckWinConditions),
|
||||
GM_MEMBERS(m_fRoundCount),
|
||||
GM_MEMBERS(m_fRoundStartTime),
|
||||
GM_MEMBERS(m_iRoundTime),
|
||||
GM_MEMBERS(m_iRoundTimeSecs),
|
||||
GM_MEMBERS(m_iIntroRoundTime),
|
||||
GM_MEMBERS(m_fIntroRoundCount),
|
||||
GM_MEMBERS(m_fRoundStartTimeReal),
|
||||
GM_MEMBERS(m_iAccountTerrorist),
|
||||
GM_MEMBERS(m_iAccountCT),
|
||||
GM_MEMBERS(m_iNumTerrorist),
|
||||
@ -127,7 +127,7 @@ member_t memberlist_gamerules[] = {
|
||||
GM_MEMBERS(m_bMapHasBuyZone),
|
||||
GM_MEMBERS(m_bMapHasRescueZone),
|
||||
GM_MEMBERS(m_bMapHasEscapeZone),
|
||||
GM_MEMBERS(m_iMapHasVIPSafetyZone),
|
||||
GM_MEMBERS(m_bMapHasVIPSafetyZone),
|
||||
GM_MEMBERS(m_bMapHasCameras),
|
||||
GM_MEMBERS(m_iC4Timer),
|
||||
GM_MEMBERS(m_iC4Guy),
|
||||
@ -167,7 +167,7 @@ member_t memberlist_gamerules[] = {
|
||||
GM_MEMBERS(m_flIntermissionStartTime),
|
||||
GM_MEMBERS(m_iEndIntermissionButtonHit),
|
||||
GM_MEMBERS(m_tmNextPeriodicThink),
|
||||
GM_MEMBERS(m_bFirstConnected),
|
||||
GM_MEMBERS(m_bGameStarted),
|
||||
GM_MEMBERS(m_bInCareerGame),
|
||||
GM_MEMBERS(m_fCareerRoundMenuTime),
|
||||
GM_MEMBERS(m_iCareerMatchWins),
|
||||
|
@ -74,13 +74,13 @@ enum CSGameRules_Members
|
||||
m_nMaxPlayers,
|
||||
m_UpdateInterval,
|
||||
|
||||
m_fTeamCount, // m_flRestartRoundTime, the global time when the round is supposed to end, if this is not 0
|
||||
m_flRestartRoundTime, // The global time when the round is supposed to end, if this is not 0 (deprecated name m_fTeamCount)
|
||||
m_flCheckWinConditions,
|
||||
m_fRoundCount,
|
||||
m_fRoundStartTime, // Time round has started (deprecated name m_fRoundCount)
|
||||
m_iRoundTime, // (From mp_roundtime) - How many seconds long this round is.
|
||||
m_iRoundTimeSecs,
|
||||
m_iIntroRoundTime, // (From mp_freezetime) - How many seconds long the intro round (when players are frozen) is.
|
||||
m_fIntroRoundCount, // The global time when the intro round ends and the real one starts
|
||||
m_fRoundStartTimeReal, // The global time when the intro round ends and the real one starts
|
||||
// wrote the original "m_flRoundTime" comment for this variable).
|
||||
m_iAccountTerrorist,
|
||||
m_iAccountCT,
|
||||
@ -102,7 +102,7 @@ enum CSGameRules_Members
|
||||
m_bMapHasBuyZone,
|
||||
m_bMapHasRescueZone,
|
||||
m_bMapHasEscapeZone,
|
||||
m_iMapHasVIPSafetyZone, // 0 = uninitialized, 1 = has VIP safety zone, 2 = DOES not have VIP safetyzone
|
||||
m_bMapHasVIPSafetyZone, // 0 = uninitialized, 1 = has VIP safety zone, 2 = DOES not have VIP safetyzone
|
||||
m_bMapHasCameras,
|
||||
m_iC4Timer,
|
||||
m_iC4Guy, // The current Terrorist who has the C4.
|
||||
@ -142,7 +142,7 @@ enum CSGameRules_Members
|
||||
m_flIntermissionStartTime,
|
||||
m_iEndIntermissionButtonHit,
|
||||
m_tmNextPeriodicThink,
|
||||
m_bFirstConnected,
|
||||
m_bGameStarted,
|
||||
m_bInCareerGame,
|
||||
m_fCareerRoundMenuTime,
|
||||
m_iCareerMatchWins,
|
||||
|
@ -7,7 +7,7 @@ CGameRules *g_pGameRules = nullptr;
|
||||
|
||||
bool RegamedllApi_Init()
|
||||
{
|
||||
const char *szGameDLLModule = GET_GAME_INFO(PLID, GINFO_REALDLL_FULLPATH);
|
||||
const char *szGameDLLModule = GET_GAME_INFO(PLID, GINFO_DLL_FULLPATH);
|
||||
if (!szGameDLLModule)
|
||||
return false;
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#define CHECK_ISPLAYER(x) if (unlikely(params[x] <= 0 || params[x] > gpGlobals->maxClients)) { MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid player index %i [%s]", __FUNCTION__, params[x], #x); return FALSE; }
|
||||
#define CHECK_ISENTITY(x) if (unlikely(params[x] > gpGlobals->maxEntities)) { MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid entity index %i [%s]", __FUNCTION__, params[x], #x); return FALSE; }
|
||||
#define CHECK_GAMERULES() if (unlikely(!g_pGameRules)) { MF_LogError(amx, AMX_ERR_NATIVE, "%s: gamerules not initialized", __FUNCTION__); return FALSE; }
|
||||
#define CHECK_CONNECTED(x, y) if (unlikely(x == nullptr || x->has_disconnected)) { MF_LogError(amx, AMX_ERR_NATIVE, "%s: player %i is not connected", __FUNCTION__, params[y]); return FALSE; }
|
||||
#define CHECK_CONNECTED(x, y) if (unlikely(x == nullptr || x->has_disconnected)) { MF_LogError(amx, AMX_ERR_NATIVE, "%s: player %i is not connected", __FUNCTION__, params[y]); return FALSE; }
|
||||
|
||||
class CAmxArg
|
||||
{
|
||||
@ -44,7 +44,7 @@ public:
|
||||
{
|
||||
if (m_value < 0)
|
||||
return nullptr;
|
||||
return g_ReGameFuncs->UTIL_PlayerByIndex(m_value);
|
||||
return UTIL_PlayerByIndex(m_value);
|
||||
}
|
||||
operator IGameClient *() const
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ cell AMX_NATIVE_CALL set_member(AMX *amx, cell *params)
|
||||
|
||||
const auto table = memberlist_t::members_tables_e(params[arg_member] / MAX_REGION_RANGE);
|
||||
if (table == memberlist_t::mt_csplayer) {
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(indexOfEdict(pEdict));
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(indexOfEdict(pEdict));
|
||||
if (unlikely(!pPlayer || !pPlayer->CSPlayer())) {
|
||||
return FALSE;
|
||||
}
|
||||
@ -90,7 +90,7 @@ cell AMX_NATIVE_CALL get_member(AMX *amx, cell *params)
|
||||
|
||||
const auto table = memberlist_t::members_tables_e(params[arg_member] / MAX_REGION_RANGE);
|
||||
if (table == memberlist_t::mt_csplayer) {
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(indexOfEdict(pEdict));
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(indexOfEdict(pEdict));
|
||||
if (!pPlayer || !pPlayer->CSPlayer()) {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ cell AMX_NATIVE_CALL rg_set_animation(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
pPlayer->CSPlayer()->SetAnimation(CAmxArg(amx, params[arg_anim]));
|
||||
@ -42,7 +42,7 @@ cell AMX_NATIVE_CALL rg_add_account(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
if (static_cast<AccountSet>(params[arg_typeSet]) == AS_SET) {
|
||||
@ -72,7 +72,7 @@ cell AMX_NATIVE_CALL rg_give_item(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
GiveType type = static_cast<GiveType>(params[arg_type]);
|
||||
@ -128,7 +128,7 @@ cell AMX_NATIVE_CALL rg_give_default_items(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
pPlayer->CSPlayer()->GiveDefaultItems();
|
||||
@ -151,7 +151,7 @@ cell AMX_NATIVE_CALL rg_give_shield(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
pPlayer->CSPlayer()->GiveShield(params[arg_deploy] != 0);
|
||||
@ -566,7 +566,7 @@ cell AMX_NATIVE_CALL rg_find_weapon_bpack_by_name(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
const char *pszWeaponName = getAmxString(amx, params[arg_weapon]);
|
||||
@ -614,7 +614,7 @@ cell AMX_NATIVE_CALL rg_has_item_by_name(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
const char *pszItemName = getAmxString(amx, params[arg_item]);
|
||||
@ -801,7 +801,7 @@ cell AMX_NATIVE_CALL rg_remove_all_items(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
pPlayer->CSPlayer()->RemoveAllItems(params[arg_suit] != 0);
|
||||
@ -824,7 +824,7 @@ cell AMX_NATIVE_CALL rg_remove_item(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
const char* szItemName = getAmxString(amx, params[arg_item_name]);
|
||||
@ -851,7 +851,7 @@ cell AMX_NATIVE_CALL rg_get_user_bpammo(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
WeaponIdType weaponId = static_cast<WeaponIdType>(params[arg_weapon]);
|
||||
@ -893,7 +893,7 @@ cell AMX_NATIVE_CALL rg_set_user_bpammo(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
WeaponIdType weaponId = static_cast<WeaponIdType>(params[arg_weapon]);
|
||||
@ -939,7 +939,7 @@ cell AMX_NATIVE_CALL rg_give_defusekit(AMX *amx, cell *params)
|
||||
CHECK_GAMERULES();
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
// on the map there is not bomb places
|
||||
@ -989,7 +989,7 @@ cell AMX_NATIVE_CALL rg_get_user_armor(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
*getAmxAddr(amx, params[arg_armortype]) = pPlayer->m_iKevlar;
|
||||
@ -1013,7 +1013,7 @@ cell AMX_NATIVE_CALL rg_set_user_armor(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
ArmorType armorType = static_cast<ArmorType>(params[arg_armortype]);
|
||||
@ -1052,7 +1052,7 @@ cell AMX_NATIVE_CALL rg_set_user_team(AMX *amx, cell *params)
|
||||
CHECK_GAMERULES();
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
CAmxArgs args(amx, params);
|
||||
@ -1075,7 +1075,7 @@ cell AMX_NATIVE_CALL rg_set_user_team(AMX *amx, cell *params)
|
||||
switch (prevTeam) {
|
||||
case TERRORIST:
|
||||
CSGameRules()->m_iNumTerrorist--;
|
||||
if (pPlayer->m_bHasC4 && !CSGameRules()->m_fTeamCount && CSGameRules()->m_bMapHasBombTarget)
|
||||
if (pPlayer->m_bHasC4 && !CSGameRules()->m_flRestartRoundTime && CSGameRules()->m_bMapHasBombTarget)
|
||||
{
|
||||
if (CSGameRules()->m_iNumTerrorist > 0 && pPlayer->CSPlayer()->RemovePlayerItem("weapon_c4")) {
|
||||
pPlayer->m_bHasC4 = false;
|
||||
@ -1140,7 +1140,7 @@ cell AMX_NATIVE_CALL rg_set_user_model(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
const char* newModel = getAmxString(amx, params[arg_model]);
|
||||
@ -1177,7 +1177,7 @@ cell AMX_NATIVE_CALL rg_reset_user_model(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
pPlayer->CSPlayer()->SetPlayerModelEx("");
|
||||
@ -1202,7 +1202,7 @@ cell AMX_NATIVE_CALL rg_transfer_c4(AMX *amx, cell *params)
|
||||
CHECK_GAMERULES();
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
if (!pPlayer->m_bHasC4 || !pPlayer->CSPlayer()->RemovePlayerItem("weapon_c4"))
|
||||
@ -1214,7 +1214,7 @@ cell AMX_NATIVE_CALL rg_transfer_c4(AMX *amx, cell *params)
|
||||
pPlayer->CSPlayer()->SetProgressBarTime(0);
|
||||
|
||||
if (params[arg_receiver] != 0 && params[arg_receiver] <= gpGlobals->maxClients) {
|
||||
CBasePlayer *pReceiver = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_receiver]);
|
||||
CBasePlayer *pReceiver = UTIL_PlayerByIndex(params[arg_receiver]);
|
||||
CHECK_CONNECTED(pReceiver, arg_receiver);
|
||||
|
||||
pReceiver->m_bHasC4 = true;
|
||||
@ -1247,7 +1247,7 @@ cell AMX_NATIVE_CALL rg_instant_reload_weapons(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
CBasePlayerWeapon *pWeapon = nullptr;
|
||||
@ -1332,7 +1332,7 @@ cell AMX_NATIVE_CALL rg_join_team(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
return (cell)pPlayer->CSPlayer()->JoinTeam(static_cast<TeamName>(params[arg_team]));
|
||||
@ -1384,7 +1384,7 @@ cell AMX_NATIVE_CALL rg_switch_team(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
pPlayer->CSPlayer()->SwitchTeam();
|
||||
@ -1407,7 +1407,7 @@ cell AMX_NATIVE_CALL rg_switch_weapon(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
auto pWeapon = getPrivate<CBasePlayerWeapon>(params[arg_weapon]);
|
||||
@ -1450,7 +1450,7 @@ cell AMX_NATIVE_CALL rg_is_player_can_takedamage(AMX *amx, cell *params)
|
||||
CHECK_GAMERULES();
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
CBaseEntity *pAttacker = getPrivate<CBaseEntity>(params[arg_attacker]);
|
||||
@ -1505,7 +1505,7 @@ cell AMX_NATIVE_CALL rg_round_respawn(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index };
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
pPlayer->RoundRespawn();
|
||||
@ -1525,7 +1525,7 @@ cell AMX_NATIVE_CALL rg_reset_maxspeed(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index };
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
pPlayer->ResetMaxSpeed();
|
||||
@ -1548,7 +1548,7 @@ cell AMX_NATIVE_CALL rg_send_bartime(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_time, arg_observer };
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
CAmxArgs args(amx, params);
|
||||
@ -1579,7 +1579,7 @@ cell AMX_NATIVE_CALL rg_send_bartime2(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_time, arg_start_percent, arg_observer };
|
||||
|
||||
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
CAmxArgs args(amx, params);
|
||||
|
@ -17,6 +17,9 @@
|
||||
#include <extdll.h>
|
||||
#include <eiface.h>
|
||||
|
||||
// rewrite on own custom preprocessor definitions INDEXENT and ENTINDEX from cbase.h
|
||||
#include "type_conversion.h"
|
||||
|
||||
#include <cbase.h>
|
||||
#include <pm_defs.h>
|
||||
#include <pm_movevars.h>
|
||||
|
@ -4,10 +4,6 @@ template <typename T, size_t N>
|
||||
char(&ArraySizeHelper(T(&array)[N]))[N];
|
||||
#define arraysize(array) (sizeof(ArraySizeHelper(array)))
|
||||
|
||||
#define INDEXENT edictByIndex
|
||||
#define ENTINDEX indexOfEdict
|
||||
#define AMX_NULLENT -1
|
||||
|
||||
extern enginefuncs_t* g_pengfuncsTable;
|
||||
extern DLL_FUNCTIONS *g_pFunctionTable;
|
||||
|
||||
@ -26,109 +22,6 @@ inline void EWRITE_ENTITY(int iValue) { (*g_pengfuncsTable->pfnWriteEntity)(iVal
|
||||
#define _strlwr(p) for (int i = 0; p[i] != 0; i++) p[i] = tolower(p[i]);
|
||||
#endif
|
||||
|
||||
inline size_t indexOfEdict(edict_t* ed)
|
||||
{
|
||||
return ed - g_pEdicts;
|
||||
}
|
||||
|
||||
inline size_t indexOfEdict(entvars_t* pev)
|
||||
{
|
||||
return indexOfEdict(pev->pContainingEntity);
|
||||
}
|
||||
|
||||
// safe to nullptr
|
||||
inline size_t indexOfEdictAmx(entvars_t* pev)
|
||||
{
|
||||
size_t index = AMX_NULLENT;
|
||||
if (likely(pev != nullptr))
|
||||
index = indexOfEdict(pev);
|
||||
return index;
|
||||
}
|
||||
|
||||
// fast
|
||||
inline edict_t* edictByIndex(int index)
|
||||
{
|
||||
return g_pEdicts + index;
|
||||
}
|
||||
|
||||
// safe to index -1
|
||||
inline edict_t* edictByIndexAmx(int index)
|
||||
{
|
||||
auto ed = g_pEdicts + index;
|
||||
if (unlikely(index < 0)) // == AMX_NULLENT
|
||||
ed = nullptr;
|
||||
return ed;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T* getPrivate(int index)
|
||||
{
|
||||
T* pdata = nullptr;
|
||||
if (likely(index >= 0)) // != AMX_NULLENT
|
||||
pdata = (T *)g_pEdicts[index].pvPrivateData;
|
||||
return pdata;
|
||||
}
|
||||
|
||||
inline entvars_t* PEV(int index)
|
||||
{
|
||||
entvars_t* pvars = nullptr;
|
||||
if (likely(index >= 0)) // != AMX_NULLENT
|
||||
pvars = &g_pEdicts[index].v;
|
||||
return pvars;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline size_t indexOfPDataAmx(T* pdata)
|
||||
{
|
||||
size_t index = AMX_NULLENT;
|
||||
if (likely(pdata != nullptr))
|
||||
index = indexOfEdict(pdata->pev);
|
||||
return index;
|
||||
}
|
||||
|
||||
// HLTypeConversion.h -> AMXModX
|
||||
template <typename T>
|
||||
inline T &ref_member(void *ptr, int offset, int element = 0)
|
||||
{
|
||||
return *reinterpret_cast<T *>((reinterpret_cast<int8 *>(ptr) + offset + (element * sizeof(T))));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T &get_member(void *ptr, int offset, int element = 0)
|
||||
{
|
||||
return ref_member<T>(ptr, offset, element);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T &get_member(edict_t *pEntity, int offset, int element = 0)
|
||||
{
|
||||
return get_member<T>(pEntity->pvPrivateData, offset, element);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void set_member(void *ptr, int offset, T value, int element = 0)
|
||||
{
|
||||
ref_member<T>(ptr, offset, element) = value;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void set_member(edict_t *pEntity, int offset, T value, int element = 0)
|
||||
{
|
||||
set_member<T>(pEntity->pvPrivateData, offset, value, element);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T* get_member_direct(void *ptr, int offset, int element = 0, int size = sizeof(T))
|
||||
{
|
||||
return reinterpret_cast<T *>(reinterpret_cast<int8 *>(ptr) + offset + (element * size));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T get_member_direct(edict_t *pEntity, int offset, int element = 0, int size = 0)
|
||||
{
|
||||
return get_member_direct<T>(pEntity->pvPrivateData, offset, element, size);
|
||||
}
|
||||
|
||||
inline bool GetWeaponInfoRange(WeaponIdType wpnid)
|
||||
{
|
||||
if (wpnid == WEAPON_SHIELDGUN)
|
||||
@ -161,22 +54,3 @@ ModelName GetModelAuto(TeamName team);
|
||||
void UTIL_ServerPrint(const char *fmt, ...);
|
||||
|
||||
extern void __declspec(noreturn) UTIL_SysError(const char *fmt, ...);
|
||||
|
||||
class CTempStrings
|
||||
{
|
||||
public:
|
||||
CTempStrings();
|
||||
char* push(AMX* amx);
|
||||
void pop(size_t count);
|
||||
|
||||
enum
|
||||
{
|
||||
STRINGS_MAX = 16,
|
||||
STRING_SIZE = 1024,
|
||||
STRING_LEN = STRING_SIZE - 1
|
||||
};
|
||||
|
||||
private:
|
||||
size_t m_current;
|
||||
char m_strings[STRINGS_MAX][STRING_SIZE];
|
||||
};
|
||||
|
@ -4,5 +4,5 @@
|
||||
#define _reapi_version_included
|
||||
|
||||
// reapi version
|
||||
#define REAPI_VERSION_MAJOR 4
|
||||
#define REAPI_VERSION_MINOR 4
|
||||
#define REAPI_VERSION_MAJOR 5
|
||||
#define REAPI_VERSION_MINOR 0
|
||||
|
129
reapi/src/type_conversion.h
Normal file
129
reapi/src/type_conversion.h
Normal file
@ -0,0 +1,129 @@
|
||||
#pragma once
|
||||
|
||||
#define INDEXENT edictByIndex
|
||||
#define ENTINDEX indexOfEdict
|
||||
#define AMX_NULLENT -1
|
||||
|
||||
extern edict_t* g_pEdicts;
|
||||
|
||||
inline size_t indexOfEdict(edict_t* ed)
|
||||
{
|
||||
return ed - g_pEdicts;
|
||||
}
|
||||
|
||||
inline size_t indexOfEdict(entvars_t* pev)
|
||||
{
|
||||
return indexOfEdict(pev->pContainingEntity);
|
||||
}
|
||||
|
||||
// safe to nullptr
|
||||
inline size_t indexOfEdictAmx(entvars_t* pev)
|
||||
{
|
||||
size_t index = AMX_NULLENT;
|
||||
if (likely(pev != nullptr))
|
||||
index = indexOfEdict(pev);
|
||||
return index;
|
||||
}
|
||||
|
||||
// fast
|
||||
inline edict_t* edictByIndex(int index)
|
||||
{
|
||||
return g_pEdicts + index;
|
||||
}
|
||||
|
||||
// safe to index -1
|
||||
inline edict_t* edictByIndexAmx(int index)
|
||||
{
|
||||
auto ed = g_pEdicts + index;
|
||||
if (unlikely(index < 0)) // == AMX_NULLENT
|
||||
ed = nullptr;
|
||||
return ed;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T* getPrivate(int index)
|
||||
{
|
||||
T* pdata = nullptr;
|
||||
if (likely(index >= 0)) // != AMX_NULLENT
|
||||
pdata = (T *)g_pEdicts[index].pvPrivateData;
|
||||
return pdata;
|
||||
}
|
||||
|
||||
inline entvars_t* PEV(int index)
|
||||
{
|
||||
entvars_t* pvars = nullptr;
|
||||
if (likely(index >= 0)) // != AMX_NULLENT
|
||||
pvars = &g_pEdicts[index].v;
|
||||
return pvars;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline size_t indexOfPDataAmx(T* pdata)
|
||||
{
|
||||
size_t index = AMX_NULLENT;
|
||||
if (likely(pdata != nullptr))
|
||||
index = indexOfEdict(pdata->pev);
|
||||
return index;
|
||||
}
|
||||
|
||||
// HLTypeConversion.h -> AMXModX
|
||||
template <typename T>
|
||||
inline T &ref_member(void *ptr, int offset, int element = 0)
|
||||
{
|
||||
return *reinterpret_cast<T *>((reinterpret_cast<int8 *>(ptr) + offset + (element * sizeof(T))));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T &get_member(void *ptr, int offset, int element = 0)
|
||||
{
|
||||
return ref_member<T>(ptr, offset, element);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T &get_member(edict_t *pEntity, int offset, int element = 0)
|
||||
{
|
||||
return get_member<T>(pEntity->pvPrivateData, offset, element);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void set_member(void *ptr, int offset, T value, int element = 0)
|
||||
{
|
||||
ref_member<T>(ptr, offset, element) = value;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void set_member(edict_t *pEntity, int offset, T value, int element = 0)
|
||||
{
|
||||
set_member<T>(pEntity->pvPrivateData, offset, value, element);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T* get_member_direct(void *ptr, int offset, int element = 0, int size = sizeof(T))
|
||||
{
|
||||
return reinterpret_cast<T *>(reinterpret_cast<int8 *>(ptr) + offset + (element * size));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T get_member_direct(edict_t *pEntity, int offset, int element = 0, int size = 0)
|
||||
{
|
||||
return get_member_direct<T>(pEntity->pvPrivateData, offset, element, size);
|
||||
}
|
||||
|
||||
class CTempStrings
|
||||
{
|
||||
public:
|
||||
CTempStrings();
|
||||
char* push(struct tagAMX* amx);
|
||||
void pop(size_t count);
|
||||
|
||||
enum
|
||||
{
|
||||
STRINGS_MAX = 16,
|
||||
STRING_SIZE = 1024,
|
||||
STRING_LEN = STRING_SIZE - 1
|
||||
};
|
||||
|
||||
private:
|
||||
size_t m_current;
|
||||
char m_strings[STRINGS_MAX][STRING_SIZE];
|
||||
};
|
Loading…
Reference in New Issue
Block a user