2
0
mirror of https://github.com/rehlds/metamod-r.git synced 2025-01-26 05:28:19 +03:00

Update rehlsdk

This commit is contained in:
s1lentq 2017-01-18 23:16:56 +07:00
parent 5e0e048cff
commit 05c839d295
38 changed files with 456 additions and 211 deletions

View File

@ -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;

View File

@ -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)
@ -84,7 +86,6 @@
#define MENU_KEY_9 (1<<8)
#define MENU_KEY_0 (1<<9)
#define MAX_AMMO_TYPES 32 // ???
#define MAX_AMMO_SLOTS 32 // not really slots
#define HUD_PRINTNOTIFY 1

View File

@ -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 {

View File

@ -67,7 +67,7 @@ extern enginefuncs_t g_engfuncs;
#define TRACE_MODEL (*g_engfuncs.pfnTraceModel)
#define GET_AIM_VECTOR (*g_engfuncs.pfnGetAimVector)
#define SERVER_COMMAND (*g_engfuncs.pfnServerCommand)
//#define SERVER_EXECUTE (*g_engfuncs.pfnServerExecute)
#define SERVER_EXECUTE (*g_engfuncs.pfnServerExecute)
#define CLIENT_COMMAND (*g_engfuncs.pfnClientCommand)
#define PARTICLE_EFFECT (*g_engfuncs.pfnParticleEffect)
#define LIGHT_STYLE (*g_engfuncs.pfnLightStyle)

View File

@ -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

View File

@ -101,10 +101,11 @@ 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;
virtual int ObjectCaps() = 0
virtual int ObjectCaps() = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual void Touch(CBaseEntity *pOther) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;

View File

@ -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;
}

View File

@ -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;
};

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -35,7 +35,7 @@
#include "client.h"
#include "items.h"
#define REGAMEDLL_API_VERSION_MAJOR 4
#define REGAMEDLL_API_VERSION_MAJOR 5
#define REGAMEDLL_API_VERSION_MINOR 1
// CBasePlayer::Spawn hook
@ -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,18 @@ 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;
// PM_UpdateStepSound hook
typedef IVoidHookChain<> IReGameHook_PM_UpdateStepSound;
typedef IVoidHookChainRegistry<> IReGameHookRegistry_PM_UpdateStepSound;
class IReGameHookchains {
public:
virtual ~IReGameHookchains() {}
// CBasePlayer virtual
virtual IReGameHookRegistry_CBasePlayer_Spawn* CBasePlayer_Spawn() = 0;
virtual IReGameHookRegistry_CBasePlayer_Precache* CBasePlayer_Precache() = 0;
@ -343,6 +396,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 +419,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 +445,11 @@ 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;
virtual IReGameHookRegistry_PM_UpdateStepSound* PM_UpdateStepSound() = 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 +457,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 +478,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"

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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))); }

View File

@ -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;

View File

@ -251,18 +251,23 @@ enum MaxAmmoType
enum AmmoType
{
AMMO_NONE = -1,
AMMO_BUCKSHOT,
AMMO_9MM,
AMMO_556NATO,
AMMO_556NATOBOX,
AMMO_762NATO,
AMMO_45ACP,
AMMO_50AE,
AMMO_NONE,
AMMO_338MAGNUM,
AMMO_762NATO,
AMMO_556NATOBOX,
AMMO_556NATO,
AMMO_BUCKSHOT,
AMMO_45ACP,
AMMO_57MM,
AMMO_50AE,
AMMO_357SIG,
AMMO_MAX_TYPES,
AMMO_9MM,
AMMO_FLASHBANG,
AMMO_HEGRENADE,
AMMO_SMOKEGRENADE,
AMMO_C4,
AMMO_MAX_TYPES
};
enum WeaponClassType

View File

@ -28,6 +28,10 @@
#ifndef ARCHTYPES_H
#define ARCHTYPES_H
#ifdef __x86_64__
#define X64BITS
#endif
#if defined( _WIN32 ) && (! defined( __MINGW32__ ))
typedef __int8 int8;

View File

@ -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;

View File

@ -30,7 +30,6 @@
#include "archtypes.h"
typedef void(*xcommand_t)(void);
typedef struct cmd_function_s
{
struct cmd_function_s *next;

View File

@ -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
{

View File

@ -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;

View File

@ -94,7 +94,7 @@ typedef struct
int fEnabled;
int fPlayLooping;
float cdvolume;
//byte remap[100];
//BYTE remap[100];
int fCDRom;
int fPlayTrack;
} CDStatus;

View File

@ -0,0 +1,80 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
template<typename t_ret, typename ...t_args>
class IHookChain {
protected:
virtual ~IHookChain() {}
public:
virtual t_ret callNext(t_args... args) = 0;
virtual t_ret callOriginal(t_args... args) = 0;
};
template<typename ...t_args>
class IVoidHookChain
{
protected:
virtual ~IVoidHookChain() {}
public:
virtual void callNext(t_args... args) = 0;
virtual void callOriginal(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, int priority = HC_PRIORITY_DEFAULT) = 0;
virtual void unregisterHook(hookfunc_t hook) = 0;
};
// Hook chain registry(for hooks [un]registration)
template<typename ...t_args>
class IVoidHookChainRegistry {
public:
typedef void(*hookfunc_t)(IVoidHookChain<t_args...>*, t_args...);
virtual void registerHook(hookfunc_t hook, int priority = HC_PRIORITY_DEFAULT) = 0;
virtual void unregisterHook(hookfunc_t hook) = 0;
};

View File

@ -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 SURF_DRAWBACKGROUND 0x40
#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,30 +69,39 @@ 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.
float vecs[2][4]; // [s/t] unit vectors in world space.
// [i][3] is the s/t offset relative to the origin.
// s or t = dot(3Dpoint,vecs[i])+vecs[i][3]
float mipadjust; // ?? mipmap limits for very small surfaces
@ -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,23 +290,21 @@ 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;
int numframes;
synctype_t synctype;

View File

@ -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;

View File

@ -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

View File

@ -1,5 +0,0 @@
#include "precompiled.h"
#include "sys_shared.cpp"
#include "interface.cpp"
#include "crc32c.cpp"

View File

@ -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;

View File

@ -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;
}

View File

@ -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
@ -321,7 +324,7 @@ typedef struct
// motion flags
#define STUDIO_X 0x0001
#define STUDIO_Y 0x0002
#define STUDIO_Y 0x0002
#define STUDIO_Z 0x0004
#define STUDIO_XR 0x0008
#define STUDIO_YR 0x0010

View File

@ -29,6 +29,8 @@
#if defined(__GNUC__)
#include <cpuid.h>
#elif _MSC_VER >= 1400 && !defined(ASMLIB_H)
#include <intrin.h> // __cpuidex
#endif
#define SSE3_FLAG (1<<0)

View File

@ -38,7 +38,6 @@ enum AUTH_IDTYPE
AUTH_IDTYPE_LOCAL = 3
};
/* <2e915> ../engine/userid.h:22 */
typedef struct USERID_s
{
int idtype;

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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)