Regamedll API WIP: Added new api functions

Fix crash-bug with autobuy (CBasePlayer::AddAutoBuyData)
Removed some useless code for CS
Added cssdk
This commit is contained in:
s1lentq 2016-04-05 06:12:05 +06:00
parent 9b955f2672
commit 455f0c6118
220 changed files with 28743 additions and 1081 deletions

View File

@ -1,4 +1,4 @@
# ReGameDLL_CS # ReGameDLL_CS [![Build Status](http://teamcity.rehlds.org/app/rest/builds/buildType:(id:ReGameDLLCs_Publish)/statusIcon)](http://teamcity.rehlds.org/viewType.html?buildTypeId=ReGameDLLCs_Publish&guest=1)
Reverse-engineered gamedll (mp.dll / Counter-Strike) Reverse-engineered gamedll (mp.dll / Counter-Strike)
## What is this? ## What is this?

View File

@ -46,26 +46,12 @@ task publishPrepareFiles {
into 'publish/publishRoot' into 'publish/publishRoot'
} }
//hlsdk //cssdk
//project.file('publish/publishRoot/hlsdk').mkdirs() project.file('publish/publishRoot/cssdk').mkdirs()
//copy { copy {
// from 'regamedll/common' from 'regamedll/extra/cssdk'
// into 'publish/publishRoot/hlsdk/common' into 'publish/publishRoot/cssdk'
//} }
//copy {
// from 'regamedll/dlls'
// into 'publish/publishRoot/hlsdk/dlls'
//}
//copy {
// from 'regamedll/pm_shared'
// into 'publish/publishRoot/hlsdk/pm_shared'
//}
//copy {
// from 'regamedll/public'
// into 'publish/publishRoot/hlsdk/public'
// include 'interface.h', 'interface.cpp', 'FileSystem.h'
//}
} }
} }

View File

@ -104,7 +104,7 @@ void setupToolchain(NativeBinarySpec b)
b.lib LazyNativeDepSet.create(dep_cppunitlite, 'cppunitlite', b.buildType.name, true) b.lib LazyNativeDepSet.create(dep_cppunitlite, 'cppunitlite', b.buildType.name, true)
} }
cfg.singleDefines 'USE_BREAKPAD_HANDLER', 'DEDICATED', 'REGAMEDLL_SELF', 'CLIENT_WEAPONS' cfg.singleDefines 'USE_BREAKPAD_HANDLER', 'DEDICATED', 'REGAMEDLL_SELF', 'REGAMEDLL_API', 'CLIENT_WEAPONS'
if (cfg instanceof MsvcToolchainConfig) if (cfg instanceof MsvcToolchainConfig)
{ {

View File

@ -45,19 +45,11 @@ typedef float float_precision;
#endif // PLAY_GAMEDLL #endif // PLAY_GAMEDLL
/* <42b7f> ../common/mathlib.h:3 */
typedef float vec_t; typedef float vec_t;
/* <42b91> ../common/mathlib.h:6 */
typedef vec_t vec3_t[3]; typedef vec_t vec3_t[3];
/* <80013> ../common/mathlib.h:8 */
typedef vec_t vec4_t[4]; typedef vec_t vec4_t[4];
/* <42bac> ../common/mathlib.h:18 */
typedef int fixed16_t; typedef int fixed16_t;
/* <42bb7> ../common/mathlib.h:60 */
typedef union DLONG_u typedef union DLONG_u
{ {
int i[2]; int i[2];

View File

@ -32,6 +32,19 @@
#pragma once #pragma once
#endif #endif
enum MONSTERSTATE
{
MONSTERSTATE_NONE = 0,
MONSTERSTATE_IDLE,
MONSTERSTATE_COMBAT,
MONSTERSTATE_ALERT,
MONSTERSTATE_HUNT,
MONSTERSTATE_PRONE,
MONSTERSTATE_SCRIPT,
MONSTERSTATE_PLAYDEAD,
MONSTERSTATE_DEAD
};
void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore = 0, int bitsDamageType = 0); void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore = 0, int bitsDamageType = 0);
void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType); void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType);
void RadiusDamage2(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType); void RadiusDamage2(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType);

View File

@ -965,6 +965,7 @@ private:
NUM_LOOK_AT_SPOT_STATES NUM_LOOK_AT_SPOT_STATES
} }
m_lookAtSpotState; m_lookAtSpotState;
Vector m_lookAtSpot; // the spot we're currently looking at Vector m_lookAtSpot; // the spot we're currently looking at
PriorityType m_lookAtSpotPriority; PriorityType m_lookAtSpotPriority;
float m_lookAtSpotDuration; // how long we need to look at the spot float m_lookAtSpotDuration; // how long we need to look at the spot
@ -1108,7 +1109,7 @@ private:
CNavNode *m_currentNode; CNavNode *m_currentNode;
NavDirType m_generationDir; NavDirType m_generationDir;
NavAreaList::iterator m_analyzeIter; NavAreaList::iterator m_analyzeIter;
enum ProcessType enum ProcessType
{ {
PROCESS_NORMAL, PROCESS_NORMAL,
@ -1724,7 +1725,7 @@ public:
//{ //{
// fallDistance = ladder->m_bottom.z - area->GetCenter()->z; // fallDistance = ladder->m_bottom.z - area->GetCenter()->z;
//} //}
float fallDamage = m_bot->GetApproximateFallDamage(fallDistance); float fallDamage = m_bot->GetApproximateFallDamage(fallDistance);
if (fallDamage > 0.0f) if (fallDamage > 0.0f)

View File

@ -376,7 +376,7 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd)
if (FStrEq(pcmd, "bot_about")) if (FStrEq(pcmd, "bot_about"))
{ {
Q_sprintf(buffer, "\n--------------------------------------------------------------------------\nThe Official Counter-Strike Bot V%d.%02d\nCreated by Michael S. Booth\nWeb: www.turtlerockstudios.com\\csbot\nE-mail: csbot@turtlerockstudios.com\n--------------------------------------------------------------------------\n\n", CSBOT_VERSION_MAJOR, CSBOT_VERSION_MINOR); Q_sprintf(buffer, "\n--------------------------------------------------------------------------\nThe Official Counter-Strike Bot V%d.%02d\nCreated by Michael S. Booth\nWeb: www.turtlerockstudios.com\\csbot\nE-mail: csbot@turtlerockstudios.com\n--------------------------------------------------------------------------\n\n", BOT_VERSION_MAJOR, BOT_VERSION_MINOR);
CONSOLE_ECHO(buffer); CONSOLE_ECHO(buffer);
HintMessageToAllPlayers(buffer); HintMessageToAllPlayers(buffer);
} }

View File

@ -285,7 +285,7 @@ void printEntities()
} }
} }
NOINLINE edict_t *CREATE_NAMED_ENTITY(string_t iClass) NOINLINE edict_t *EXT_FUNC CREATE_NAMED_ENTITY(string_t iClass)
{ {
edict_t *named = g_engfuncs.pfnCreateNamedEntity(iClass); edict_t *named = g_engfuncs.pfnCreateNamedEntity(iClass);
if (named != NULL) if (named != NULL)

View File

@ -39,16 +39,19 @@
#undef CREATE_NAMED_ENTITY #undef CREATE_NAMED_ENTITY
#undef REMOVE_ENTITY #undef REMOVE_ENTITY
// These are caps bits to indicate what an object's capabilities (currently used for save/restore and level transitions)
#define FCAP_CUSTOMSAVE 0x00000001 #define FCAP_CUSTOMSAVE 0x00000001
#define FCAP_ACROSS_TRANSITION 0x00000002 #define FCAP_ACROSS_TRANSITION 0x00000002 // should transfer between transitions
#define FCAP_MUST_SPAWN 0x00000004 #define FCAP_MUST_SPAWN 0x00000004 // Spawn after restore
#define FCAP_DONT_SAVE 0x80000000 #define FCAP_DONT_SAVE 0x80000000 // Don't save this
#define FCAP_IMPULSE_USE 0x00000008 #define FCAP_IMPULSE_USE 0x00000008 // can be used by the player
#define FCAP_CONTINUOUS_USE 0x00000010 #define FCAP_CONTINUOUS_USE 0x00000010 // can be used by the player
#define FCAP_ONOFF_USE 0x00000020 #define FCAP_ONOFF_USE 0x00000020 // can be used by the player
#define FCAP_DIRECTIONAL_USE 0x00000040 #define FCAP_DIRECTIONAL_USE 0x00000040 // Player sends +/- 1 when using (currently only tracktrains)
#define FCAP_MASTER 0x00000080 #define FCAP_MASTER 0x00000080 // Can be used to "master" other entities (like multisource)
#define FCAP_FORCE_TRANSITION 0x00000080
// UNDONE: This will ignore transition volumes (trigger_transition), but not the PVS!!!
#define FCAP_FORCE_TRANSITION 0x00000080 // ALWAYS goes across transitions
#define SetThink(a)\ #define SetThink(a)\
m_pfnThink = static_cast<void (CBaseEntity::*)()>(a) m_pfnThink = static_cast<void (CBaseEntity::*)()>(a)
@ -62,6 +65,7 @@
#define SetMoveDone(a)\ #define SetMoveDone(a)\
m_pfnCallWhenMoveDone = static_cast<void (CBaseToggle::*)()>(a) m_pfnCallWhenMoveDone = static_cast<void (CBaseToggle::*)()>(a)
// for Classify
#define CLASS_NONE 0 #define CLASS_NONE 0
#define CLASS_MACHINE 1 #define CLASS_MACHINE 1
#define CLASS_PLAYER 2 #define CLASS_PLAYER 2
@ -74,10 +78,10 @@
#define CLASS_ALIEN_PREDATOR 9 #define CLASS_ALIEN_PREDATOR 9
#define CLASS_INSECT 10 #define CLASS_INSECT 10
#define CLASS_PLAYER_ALLY 11 #define CLASS_PLAYER_ALLY 11
#define CLASS_PLAYER_BIOWEAPON 12 #define CLASS_PLAYER_BIOWEAPON 12 // hornets and snarks.launched by players
#define CLASS_ALIEN_BIOWEAPON 13 #define CLASS_ALIEN_BIOWEAPON 13 // hornets and snarks.launched by the alien menace
#define CLASS_VEHICLE 14 #define CLASS_VEHICLE 14
#define CLASS_BARNACLE 99 #define CLASS_BARNACLE 99 // special because no one pays attention to it, and it eats a wide cross-section of creatures.
#define GIB_HEALTH_VALUE -30 #define GIB_HEALTH_VALUE -30
@ -102,37 +106,43 @@
#define bits_CAP_FLY (1<<15) #define bits_CAP_FLY (1<<15)
#define bits_CAP_DOORS_GROUP (bits_CAP_USE | bits_CAP_AUTO_DOORS | bits_CAP_OPEN_DOORS) #define bits_CAP_DOORS_GROUP (bits_CAP_USE | bits_CAP_AUTO_DOORS | bits_CAP_OPEN_DOORS)
#define DMG_GENERIC 0 #define SF_NORESPAWN (1<<30) // set this bit on guns and stuff that should never respawn.
#define DMG_CRUSH (1<<0)
#define DMG_BULLET (1<<1)
#define DMG_SLASH (1<<2)
#define DMG_BURN (1<<3)
#define DMG_FREEZE (1<<4)
#define DMG_FALL (1<<5)
#define DMG_BLAST (1<<6)
#define DMG_CLUB (1<<7)
#define DMG_SHOCK (1<<8)
#define DMG_SONIC (1<<9)
#define DMG_ENERGYBEAM (1<<10)
#define DMG_NEVERGIB (1<<12)
#define DMG_ALWAYSGIB (1<<13)
#define DMG_DROWN (1<<14)
#define DMG_TIMEBASED (~(0x3FFF))
#define DMG_PARALYZE (1<<15) #define DMG_GENERIC 0 // generic damage was done
#define DMG_NERVEGAS (1<<16) #define DMG_CRUSH (1<<0) // crushed by falling or moving object
#define DMG_POISON (1<<17) #define DMG_BULLET (1<<1) // shot
#define DMG_RADIATION (1<<18) #define DMG_SLASH (1<<2) // cut, clawed, stabbed
#define DMG_DROWNRECOVER (1<<19) #define DMG_BURN (1<<3) // heat burned
#define DMG_ACID (1<<20) #define DMG_FREEZE (1<<4) // frozen
#define DMG_SLOWBURN (1<<21) #define DMG_FALL (1<<5) // fell too far
#define DMG_SLOWFREEZE (1<<22) #define DMG_BLAST (1<<6) // explosive blast damage
#define DMG_MORTAR (1<<23) #define DMG_CLUB (1<<7) // crowbar, punch, headbutt
#define DMG_SHOCK (1<<8) // electric shock
#define DMG_SONIC (1<<9) // sound pulse shockwave
#define DMG_ENERGYBEAM (1<<10) // laser or other high energy beam
#define DMG_NEVERGIB (1<<12) // with this bit OR'd in, no damage type will be able to gib victims upon death
#define DMG_ALWAYSGIB (1<<13) // with this bit OR'd in, any damage type can be made to gib victims upon death
#define DMG_DROWN (1<<14) // Drowning
// time-based damage
#define DMG_TIMEBASED (~(0x3FFF)) // mask for time-based damage
#define DMG_PARALYZE (1<<15) // slows affected creature down
#define DMG_NERVEGAS (1<<16) // nerve toxins, very bad
#define DMG_POISON (1<<17) // blood poisioning
#define DMG_RADIATION (1<<18) // radiation exposure
#define DMG_DROWNRECOVER (1<<19) // drowning recovery
#define DMG_ACID (1<<20) // toxic chemicals or acid burns
#define DMG_SLOWBURN (1<<21) // in an oven
#define DMG_SLOWFREEZE (1<<22) // in a subzero freezer
#define DMG_MORTAR (1<<23) // Hit by air raid (done to distinguish grenade from mortar)
#define DMG_EXPLOSION (1<<24) #define DMG_EXPLOSION (1<<24)
#define DMG_GIB_CORPSE (DMG_CRUSH | DMG_FALL | DMG_BLAST | DMG_SONIC | DMG_CLUB)
#define DMG_SHOWNHUD (DMG_POISON | DMG_ACID | DMG_FREEZE | DMG_SLOWFREEZE | DMG_DROWN | DMG_BURN | DMG_SLOWBURN | DMG_NERVEGAS | DMG_RADIATION | DMG_SHOCK)
#define SF_NORESPAWN (1 << 30) // these are the damage types that are allowed to gib corpses
#define DMG_GIB_CORPSE (DMG_CRUSH | DMG_FALL | DMG_BLAST | DMG_SONIC | DMG_CLUB)
// these are the damage types that have client hud art
#define DMG_SHOWNHUD (DMG_POISON | DMG_ACID | DMG_FREEZE | DMG_SLOWFREEZE | DMG_DROWN | DMG_BURN | DMG_SLOWBURN | DMG_NERVEGAS | DMG_RADIATION | DMG_SHOCK)
#define AIRTIME 12 // lung full of air lasts this many seconds #define AIRTIME 12 // lung full of air lasts this many seconds
#define PARALYZE_DURATION 2 // number of 2 second intervals to take damage #define PARALYZE_DURATION 2 // number of 2 second intervals to take damage
@ -166,9 +176,11 @@
#define itbd_SlowFreeze 7 #define itbd_SlowFreeze 7
#define CDMG_TIMEBASED 8 #define CDMG_TIMEBASED 8
#define GIB_NORMAL 0 // when calling KILLED(), a value that governs gib behavior is expected to be
#define GIB_NEVER 1 // one of these three values
#define GIB_ALWAYS 2 #define GIB_NORMAL 0 // gib if entity was overkilled
#define GIB_NEVER 1 // never gib, no matter how much death damage is done ( freezing, etc )
#define GIB_ALWAYS 2 // always gib ( Houndeye Shock, Barnacle Bite )
#define SF_ITEM_USE_ONLY 256 #define SF_ITEM_USE_ONLY 256
@ -181,49 +193,6 @@
#define EXPORT /**/ #define EXPORT /**/
#endif // _WIN32 #endif // _WIN32
enum hash_types_e { CLASSNAME };
typedef struct hash_item_s
{
entvars_t *pev;
struct hash_item_s *next;
struct hash_item_s *lastHash;
int pevIndex;
} hash_item_t;
typedef struct locksounds
{
string_t sLockedSound;
string_t sLockedSentence;
string_t sUnlockedSound;
string_t sUnlockedSentence;
int iLockedSentence;
int iUnlockedSentence;
float flwaitSound;
float flwaitSentence;
BYTE bEOFLocked;
BYTE bEOFUnlocked;
} locksound_t;
typedef enum
{
USE_OFF,
USE_ON,
USE_SET,
USE_TOGGLE,
} USE_TYPE;
typedef enum
{
TRAIN_SAFE,
TRAIN_BLOCKING,
TRAIN_FOLLOWING
} TRAIN_CODE;
class CGrenade; class CGrenade;
class CBaseEntity; class CBaseEntity;
class CBaseMonster; class CBaseMonster;
@ -234,8 +203,8 @@ class CSquadMonster;
class CCineMonster; class CCineMonster;
class CSound; class CSound;
class EHANDLE // EHANDLE. Safe way to point to CBaseEntities who may die between frames
{ class EHANDLE {
public: public:
edict_t *Get(); edict_t *Get();
edict_t *Set(edict_t *pent); edict_t *Set(edict_t *pent);
@ -252,8 +221,8 @@ private:
int m_serialnumber; int m_serialnumber;
}; };
class CBaseEntity // Base Entity. All entity types derive from this
{ class CBaseEntity {
public: public:
virtual void Spawn() {} virtual void Spawn() {}
virtual void Precache() {} virtual void Precache() {}
@ -299,36 +268,15 @@ public:
virtual BOOL IsNetClient() { return FALSE; } virtual BOOL IsNetClient() { return FALSE; }
virtual const char *TeamID() { return ""; } virtual const char *TeamID() { return ""; }
virtual CBaseEntity *GetNextTarget(); virtual CBaseEntity *GetNextTarget();
virtual void Think() virtual void Think() { if (m_pfnThink) (this->*m_pfnThink)(); }
{ virtual void Touch(CBaseEntity *pOther) { if (m_pfnTouch) (this->*m_pfnTouch)(pOther); }
if (m_pfnThink) virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType = USE_OFF, float value = 0.0f) { if (m_pfnUse) (this->*m_pfnUse)(pActivator, pCaller, useType, value); }
{ virtual void Blocked(CBaseEntity *pOther) { if (m_pfnBlocked) (this->*m_pfnBlocked)(pOther); }
(this->*m_pfnThink)();
}
}
virtual void Touch(CBaseEntity *pOther)
{
if (m_pfnTouch)
{
(this->*m_pfnTouch)(pOther);
}
}
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType = USE_OFF, float value = 0.0f)
{
if (m_pfnUse)
{
(this->*m_pfnUse)(pActivator, pCaller, useType, value);
}
}
virtual void Blocked(CBaseEntity *pOther)
{
if (m_pfnBlocked)
{
(this->*m_pfnBlocked)(pOther);
}
}
virtual CBaseEntity *Respawn() { return NULL; } virtual CBaseEntity *Respawn() { return NULL; }
// used by monsters that are created by the MonsterMaker
virtual void UpdateOwner() {} virtual void UpdateOwner() {}
virtual BOOL FBecomeProne() { return FALSE; } virtual BOOL FBecomeProne() { return FALSE; }
virtual Vector Center() { return (pev->absmax + pev->absmin) * 0.5f; } virtual Vector Center() { return (pev->absmax + pev->absmin) * 0.5f; }
virtual Vector EyePosition() { return (pev->origin + pev->view_ofs); } virtual Vector EyePosition() { return (pev->origin + pev->view_ofs); }
@ -358,6 +306,7 @@ public:
#endif #endif
public: public:
// allow engine to allocate instance data
void *operator new(size_t stAllocateBlock, entvars_t *pevnew) { return ALLOC_PRIVATE(ENT(pevnew), stAllocateBlock); } void *operator new(size_t stAllocateBlock, entvars_t *pevnew) { return ALLOC_PRIVATE(ENT(pevnew), stAllocateBlock); }
void operator delete(void *pMem, entvars_t *pevnew) { pevnew->flags |= FL_KILLME; } void operator delete(void *pMem, entvars_t *pevnew) { pevnew->flags |= FL_KILLME; }
void UpdateOnRemove(); void UpdateOnRemove();
@ -384,28 +333,29 @@ public:
{ {
CBaseEntity *pEntity = Instance(pevMonster); CBaseEntity *pEntity = Instance(pevMonster);
if (pEntity != NULL) if (pEntity != NULL)
{
return pEntity->MyMonsterPointer(); return pEntity->MyMonsterPointer();
}
return NULL; return NULL;
} }
CBaseMonster *GetMonsterPointer(edict_t *pentMonster) CBaseMonster *GetMonsterPointer(edict_t *pentMonster)
{ {
CBaseEntity *pEntity = Instance(pentMonster); CBaseEntity *pEntity = Instance(pentMonster);
if (pEntity) if (pEntity != NULL)
return pEntity->MyMonsterPointer(); return pEntity->MyMonsterPointer();
return NULL; return NULL;
} }
static CBaseEntity *Create(char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner = NULL); static CBaseEntity *Create(char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner = NULL);
edict_t *edict() { return ENT(pev); } edict_t *edict() { return ENT(pev); }
EOFFSET eoffset() { return OFFSET(pev); } EOFFSET eoffset() { return OFFSET(pev); }
int entindex() { return ENTINDEX(edict()); } int entindex() { return ENTINDEX(edict()); }
public: public:
entvars_t *pev; entvars_t *pev; // Don't need to save/restore this pointer, the engine resets it
CBaseEntity *m_pGoalEnt;
CBaseEntity *m_pLink; // path corners
CBaseEntity *m_pGoalEnt; // path corner we are heading towards
CBaseEntity *m_pLink; // used for temporary link-list operations.
static TYPEDESCRIPTION IMPL(m_SaveData)[5]; static TYPEDESCRIPTION IMPL(m_SaveData)[5];
@ -414,6 +364,7 @@ public:
void (CBaseEntity::*m_pfnUse)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void (CBaseEntity::*m_pfnUse)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
void (CBaseEntity::*m_pfnBlocked)(CBaseEntity *pOther); void (CBaseEntity::*m_pfnBlocked)(CBaseEntity *pOther);
// We use this variables to store each ammo count.
int *current_ammo; int *current_ammo;
float currentammo; float currentammo;
int maxammo_buckshot; int maxammo_buckshot;
@ -436,17 +387,20 @@ public:
int ammo_57mm; int ammo_57mm;
int maxammo_357sig; int maxammo_357sig;
int ammo_357sig; int ammo_357sig;
// Special stuff for grenades and knife.
float m_flStartThrow; float m_flStartThrow;
float m_flReleaseThrow; float m_flReleaseThrow;
int m_iSwing; int m_iSwing;
// client has left the game
bool has_disconnected; bool has_disconnected;
}; };
inline int FNullEnt(CBaseEntity *ent) { return (ent == NULL || FNullEnt(ent->edict())); } inline int FNullEnt(CBaseEntity *ent) { return (ent == NULL || FNullEnt(ent->edict())); }
inline int FNullEnt(EHANDLE hent) { return (hent == NULL || FNullEnt(OFFSET(hent.Get()))); } inline int FNullEnt(EHANDLE hent) { return (hent == NULL || FNullEnt(OFFSET(hent.Get()))); }
class CPointEntity: public CBaseEntity class CPointEntity: public CBaseEntity {
{
public: public:
virtual void Spawn(); virtual void Spawn();
virtual int ObjectCaps() { return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION); } virtual int ObjectCaps() { return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION); }
@ -459,8 +413,8 @@ public:
}; };
class CMultiSource: public CPointEntity // MultiSouce
{ class CMultiSource: public CPointEntity {
public: public:
virtual void Spawn(); virtual void Spawn();
virtual void KeyValue(KeyValueData *pkvd); virtual void KeyValue(KeyValueData *pkvd);
@ -493,8 +447,8 @@ public:
string_t m_globalstate; string_t m_globalstate;
}; };
class CBaseDelay: public CBaseEntity // generic Delay entity.
{ class CBaseDelay: public CBaseEntity {
public: public:
virtual void KeyValue(KeyValueData *pkvd); virtual void KeyValue(KeyValueData *pkvd);
virtual int Save(CSave &save); virtual int Save(CSave &save);
@ -518,8 +472,7 @@ public:
int m_iszKillTarget; int m_iszKillTarget;
}; };
class CBaseAnimating: public CBaseDelay class CBaseAnimating: public CBaseDelay {
{
public: public:
virtual int Save(CSave &save); virtual int Save(CSave &save);
virtual int Restore(CRestore &restore); virtual int Restore(CRestore &restore);
@ -533,13 +486,14 @@ public:
#endif #endif
public: public:
float StudioFrameAdvance(float flInterval = 0.0f); // Basic Monster Animation functions
float StudioFrameAdvance(float flInterval = 0.0f); // accumulate animation frame time from last time called until now
BOOL GetSequenceFlags(); BOOL GetSequenceFlags();
int LookupActivity(int activity); int LookupActivity(int activity);
int LookupActivityHeaviest(int activity); int LookupActivityHeaviest(int activity);
int LookupSequence(const char *label); int LookupSequence(const char *label);
void ResetSequenceInfo(); void ResetSequenceInfo();
void DispatchAnimEvents(float flFutureInterval = 0.1f); void DispatchAnimEvents(float flFutureInterval = 0.1f); // Handle events that have happend since last time called up until X seconds into the future
float SetBoneController(int iController, float flValue = 0.0f); float SetBoneController(int iController, float flValue = 0.0f);
void InitBoneControllers(); void InitBoneControllers();
@ -556,15 +510,16 @@ public:
public: public:
static TYPEDESCRIPTION IMPL(m_SaveData)[5]; static TYPEDESCRIPTION IMPL(m_SaveData)[5];
float m_flFrameRate; // animation needs
float m_flGroundSpeed; float m_flFrameRate; // computed FPS for current sequence
float m_flLastEventCheck; float m_flGroundSpeed; // computed linear movement rate for current sequence
BOOL m_fSequenceFinished; float m_flLastEventCheck; // last time the event list was checked
BOOL m_fSequenceLoops; BOOL m_fSequenceFinished; // flag set when StudioAdvanceFrame moves across a frame boundry
BOOL m_fSequenceLoops; // true if the sequence loops
}; };
class CBaseToggle: public CBaseAnimating // generic Toggle entity.
{ class CBaseToggle: public CBaseAnimating {
public: public:
virtual void KeyValue(KeyValueData *pkvd); virtual void KeyValue(KeyValueData *pkvd);
virtual int Save(CSave &save); virtual int Save(CSave &save);
@ -596,37 +551,38 @@ public:
static TYPEDESCRIPTION IMPL(m_SaveData)[19]; static TYPEDESCRIPTION IMPL(m_SaveData)[19];
TOGGLE_STATE m_toggle_state; TOGGLE_STATE m_toggle_state;
float m_flActivateFinished; float m_flActivateFinished; // like attack_finished, but for doors
float m_flMoveDistance; float m_flMoveDistance; // how far a door should slide or rotate
float m_flWait; float m_flWait;
float m_flLip; float m_flLip;
float m_flTWidth; float m_flTWidth; // for plats
float m_flTLength; float m_flTLength; // for plats
Vector m_vecPosition1; Vector m_vecPosition1;
Vector m_vecPosition2; Vector m_vecPosition2;
Vector m_vecAngle1; Vector m_vecAngle1;
Vector m_vecAngle2; Vector m_vecAngle2;
int m_cTriggersLeft;
int m_cTriggersLeft; // trigger_counter only, # of activations remaining
float m_flHeight; float m_flHeight;
EHANDLE m_hActivator; EHANDLE m_hActivator;
void (CBaseToggle::*m_pfnCallWhenMoveDone)(); void (CBaseToggle::*m_pfnCallWhenMoveDone)();
Vector m_vecFinalDest; Vector m_vecFinalDest;
Vector m_vecFinalAngle; Vector m_vecFinalAngle;
int m_bitsDamageInflict;
string_t m_sMaster; int m_bitsDamageInflict; // DMG_ damage type that the door or tigger does
string_t m_sMaster; // If this button has a master switch, this is the targetname.
// A master switch must be of the multisource type. If all
// of the switches in the multisource have been triggered, then
// the button will be allowed to operate. Otherwise, it will be
// deactivated.
}; };
#include "basemonster.h" #include "basemonster.h"
// Generic Button // Generic Button
class CBaseButton: public CBaseToggle class CBaseButton: public CBaseToggle {
{
enum BUTTON_CODE
{
BUTTON_NOTHING,
BUTTON_ACTIVATE,
BUTTON_RETURN
};
public: public:
virtual void Spawn(); virtual void Spawn();
virtual void Precache(); virtual void Precache();
@ -668,6 +624,7 @@ public:
void EXPORT ButtonBackHome(); void EXPORT ButtonBackHome();
void EXPORT ButtonUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void EXPORT ButtonUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
enum BUTTON_CODE { BUTTON_NOTHING, BUTTON_ACTIVATE, BUTTON_RETURN };
BUTTON_CODE ButtonResponseToTouch(); BUTTON_CODE ButtonResponseToTouch();
public: public:
@ -684,8 +641,8 @@ public:
int m_sounds; int m_sounds;
}; };
class CWorld: public CBaseEntity // This spawns first when each level begins.
{ class CWorld: public CBaseEntity {
public: public:
virtual void Spawn(); virtual void Spawn();
virtual void Precache(); virtual void Precache();
@ -705,15 +662,23 @@ public:
extern class CCSEntity **g_GameEntities; extern class CCSEntity **g_GameEntities;
#endif #endif
// Converts a entvars_t * to a class pointer
// It will allocate the class and entity if necessary
template <class TWrap, class T> template <class TWrap, class T>
T *GetClassPtr(T *a) T *GetClassPtr(T *a)
{ {
entvars_t *pev = (entvars_t *)a; entvars_t *pev = (entvars_t *)a;
if (!pev)
// allocate entity if necessary
if (pev == NULL)
pev = VARS(CREATE_ENTITY()); pev = VARS(CREATE_ENTITY());
// get the private data
a = (T *)GET_PRIVATE(ENT(pev)); a = (T *)GET_PRIVATE(ENT(pev));
if (!a) if (!a)
{ {
// allocate private data
a = new(pev) T; a = new(pev) T;
a->pev = pev; a->pev = pev;

View File

@ -142,16 +142,16 @@ BOOL EXT_FUNC ClientConnect(edict_t *pEntity, const char *pszName, const char *p
void EXT_FUNC ClientDisconnect(edict_t *pEntity) void EXT_FUNC ClientDisconnect(edict_t *pEntity)
{ {
CBasePlayer *pPlayer = dynamic_cast<CBasePlayer *>(CBaseEntity::Instance(pEntity)); CBasePlayer *pPlayer = dynamic_cast<CBasePlayer *>(CBaseEntity::Instance(pEntity));
CSPlayer(pPlayer)->OnClientDisconnected();
if (!g_fGameOver) if (!g_fGameOver)
{ {
UTIL_ClientPrintAll(HUD_PRINTNOTIFY, "#Game_disconnected", STRING(pEntity->v.netname)); UTIL_ClientPrintAll(HUD_PRINTNOTIFY, "#Game_disconnected", STRING(pEntity->v.netname));
#ifndef REGAMEDLL_FIXES
CSound *pSound = CSoundEnt::SoundPointerForIndex(CSoundEnt::ClientSoundIndex(pEntity)); CSound *pSound = CSoundEnt::SoundPointerForIndex(CSoundEnt::ClientSoundIndex(pEntity));
if (pSound != NULL) if (pSound != NULL)
pSound->Reset(); pSound->Reset();
#endif
pEntity->v.takedamage = DAMAGE_NO; pEntity->v.takedamage = DAMAGE_NO;
pEntity->v.solid = SOLID_NOT; pEntity->v.solid = SOLID_NOT;
pEntity->v.flags = FL_DORMANT; pEntity->v.flags = FL_DORMANT;
@ -477,7 +477,6 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity)
pPlayer->SetCustomDecalFrames(-1); pPlayer->SetCustomDecalFrames(-1);
pPlayer->SetPrefsFromUserinfo(GET_INFO_BUFFER(pEntity)); pPlayer->SetPrefsFromUserinfo(GET_INFO_BUFFER(pEntity));
CSPlayer(pPlayer)->OnClientConnected();
if (!g_pGameRules->IsMultiplayer()) if (!g_pGameRules->IsMultiplayer())
{ {

View File

@ -613,9 +613,10 @@ void CGib::WaitTillLand()
{ {
SetThink(&CBaseEntity::SUB_StartFadeOut); SetThink(&CBaseEntity::SUB_StartFadeOut);
pev->nextthink = gpGlobals->time + m_lifeTime; pev->nextthink = gpGlobals->time + m_lifeTime;
#ifndef REGAMEDLL_FIXES
if (m_bloodColor != DONT_BLEED) if (m_bloodColor != DONT_BLEED)
CSoundEnt::InsertSound(bits_SOUND_MEAT, pev->origin, 384, 25); CSoundEnt::InsertSound(bits_SOUND_MEAT, pev->origin, 384, 25);
#endif
} }
else else
pev->nextthink = gpGlobals->time + 0.5f; pev->nextthink = gpGlobals->time + 0.5f;

78
regamedll/dlls/extdef.h Normal file
View File

@ -0,0 +1,78 @@
/*
*
* 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
enum hash_types_e { CLASSNAME };
// Things that toggle (buttons/triggers/doors) need this
enum TOGGLE_STATE { TS_AT_TOP, TS_AT_BOTTOM, TS_GOING_UP, TS_GOING_DOWN };
typedef struct hash_item_s
{
entvars_t *pev;
struct hash_item_s *next;
struct hash_item_s *lastHash;
int pevIndex;
} hash_item_t;
typedef struct locksounds
{
string_t sLockedSound;
string_t sLockedSentence;
string_t sUnlockedSound;
string_t sUnlockedSentence;
int iLockedSentence;
int iUnlockedSentence;
float flwaitSound;
float flwaitSentence;
BYTE bEOFLocked;
BYTE bEOFUnlocked;
} locksound_t;
typedef struct hudtextparms_s
{
float x;
float y;
int effect;
byte r1,g1,b1,a1;
byte r2,g2,b2,a2;
float fadeinTime;
float fadeoutTime;
float holdTime;
float fxTime;
int channel;
} hudtextparms_t;
enum USE_TYPE { USE_OFF, USE_ON, USE_SET, USE_TOGGLE };
enum TRAIN_CODE { TRAIN_SAFE, TRAIN_BLOCKING, TRAIN_FOLLOWING };
enum IGNORE_MONSTERS { ignore_monsters = 1, dont_ignore_monsters = 0, missile = 2 };
enum IGNORE_GLASS { ignore_glass = 1, dont_ignore_glass = 0 };
enum { point_hull = 0, human_hull = 1, large_hull = 2, head_hull = 3 };

View File

@ -569,6 +569,14 @@ public:
#ifdef REGAMEDLL_ADD #ifdef REGAMEDLL_ADD
if (friendlyfire.string[0] == '2') if (friendlyfire.string[0] == '2')
return true; return true;
#endif
return false;
}
inline bool HasRoundInfinite(bool time_expired = false) const
{
#ifdef REGAMEDLL_ADD
if (round_infinite.string[0] == '1' || (time_expired && (UTIL_ReadFlags(round_infinite.string) & SCENARIO_BLOCK_TIME_EXPRIRED)))
return true;
#endif #endif
return false; return false;
} }

View File

@ -51,8 +51,10 @@ void CGrenade::Explode(TraceResult *pTrace, int bitsDamageType)
} }
int iContents = UTIL_PointContents(pev->origin); int iContents = UTIL_PointContents(pev->origin);
CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3);
#ifndef REGAMEDLL_FIXES
CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3);
#endif
entvars_t *pevOwner = VARS(pev->owner); entvars_t *pevOwner = VARS(pev->owner);
if (TheBots != NULL) if (TheBots != NULL)
@ -166,8 +168,10 @@ void CGrenade::Explode2(TraceResult *pTrace, int bitsDamageType)
// Sound! for everyone // Sound! for everyone
EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/c4_explode1.wav", VOL_NORM, 0.25); EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/c4_explode1.wav", VOL_NORM, 0.25);
CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3);
#ifndef REGAMEDLL_FIXES
CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3);
#endif
entvars_t *pevOwner = VARS(pev->owner); entvars_t *pevOwner = VARS(pev->owner);
pev->owner = NULL; pev->owner = NULL;
@ -257,8 +261,9 @@ void CGrenade::Explode3(TraceResult *pTrace, int bitsDamageType)
WRITE_BYTE(TE_EXPLFLAG_NONE); // flags WRITE_BYTE(TE_EXPLFLAG_NONE); // flags
MESSAGE_END(); MESSAGE_END();
#ifndef REGAMEDLL_FIXES
CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3); CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3);
#endif
entvars_t *pevOwner = VARS(pev->owner); entvars_t *pevOwner = VARS(pev->owner);
if (TheBots != NULL) if (TheBots != NULL)
@ -310,7 +315,10 @@ NOXREF void CGrenade::SG_Explode(TraceResult *pTrace, int bitsDamageType)
} }
int iContents = UTIL_PointContents(pev->origin); int iContents = UTIL_PointContents(pev->origin);
#ifndef REGAMEDLL_FIXES
CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3); CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3);
#endif
// can't traceline attack owner if this is set // can't traceline attack owner if this is set
pev->owner = NULL; pev->owner = NULL;
@ -517,7 +525,9 @@ void CGrenade::DetonateUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
void CGrenade::PreDetonate() void CGrenade::PreDetonate()
{ {
#ifndef REGAMEDLL_FIXES
CSoundEnt::InsertSound(bits_SOUND_DANGER, pev->origin, 400, 0.3); CSoundEnt::InsertSound(bits_SOUND_DANGER, pev->origin, 400, 0.3);
#endif
SetThink(&CGrenade::Detonate); SetThink(&CGrenade::Detonate);
pev->nextthink = gpGlobals->time + 1.0f; pev->nextthink = gpGlobals->time + 1.0f;
@ -626,7 +636,9 @@ void CGrenade::DangerSoundThink()
return; return;
} }
#ifndef REGAMEDLL_FIXES
CSoundEnt::InsertSound(bits_SOUND_DANGER, pev->origin + pev->velocity * 0.5, pev->velocity.Length(), 0.2); CSoundEnt::InsertSound(bits_SOUND_DANGER, pev->origin + pev->velocity * 0.5, pev->velocity.Length(), 0.2);
#endif
pev->nextthink = gpGlobals->time + 0.2f; pev->nextthink = gpGlobals->time + 0.2f;
if (pev->waterlevel != 0) if (pev->waterlevel != 0)
@ -655,6 +667,7 @@ void CGrenade::BounceTouch(CBaseEntity *pOther)
vecTestVelocity = pev->velocity; vecTestVelocity = pev->velocity;
vecTestVelocity.z *= 0.7f; vecTestVelocity.z *= 0.7f;
#ifndef REGAMEDLL_FIXES
if (!m_fRegisteredSound && vecTestVelocity.Length() <= 60.0f) if (!m_fRegisteredSound && vecTestVelocity.Length() <= 60.0f)
{ {
// grenade is moving really slow. It's probably very close to where it will ultimately stop moving. // grenade is moving really slow. It's probably very close to where it will ultimately stop moving.
@ -664,7 +677,7 @@ void CGrenade::BounceTouch(CBaseEntity *pOther)
CSoundEnt::InsertSound(bits_SOUND_DANGER, pev->origin, pev->dmg / 0.4f, 0.3); CSoundEnt::InsertSound(bits_SOUND_DANGER, pev->origin, pev->dmg / 0.4f, 0.3);
m_fRegisteredSound = TRUE; m_fRegisteredSound = TRUE;
} }
#endif
if (pev->flags & FL_ONGROUND) if (pev->flags & FL_ONGROUND)
{ {
// add a bit of static friction // add a bit of static friction
@ -745,10 +758,12 @@ void CGrenade::TumbleThink()
StudioFrameAdvance(); StudioFrameAdvance();
pev->nextthink = gpGlobals->time + 0.1f; pev->nextthink = gpGlobals->time + 0.1f;
#ifndef REGAMEDLL_FIXES
if (pev->dmgtime - 1 < gpGlobals->time) if (pev->dmgtime - 1 < gpGlobals->time)
{ {
CSoundEnt::InsertSound(bits_SOUND_DANGER, pev->origin + pev->velocity * (pev->dmgtime - gpGlobals->time), 400, 0.1); CSoundEnt::InsertSound(bits_SOUND_DANGER, pev->origin + pev->velocity * (pev->dmgtime - gpGlobals->time), 400, 0.1);
} }
#endif
if (pev->dmgtime <= gpGlobals->time) if (pev->dmgtime <= gpGlobals->time)
{ {
@ -783,10 +798,12 @@ void CGrenade::SG_TumbleThink()
StudioFrameAdvance(); StudioFrameAdvance();
pev->nextthink = gpGlobals->time + 0.1f; pev->nextthink = gpGlobals->time + 0.1f;
#ifndef REGAMEDLL_FIXES
if (pev->dmgtime - 1 < gpGlobals->time) if (pev->dmgtime - 1 < gpGlobals->time)
{ {
CSoundEnt::InsertSound(bits_SOUND_DANGER, pev->origin + pev->velocity * (pev->dmgtime - gpGlobals->time), 400, 0.1); CSoundEnt::InsertSound(bits_SOUND_DANGER, pev->origin + pev->velocity * (pev->dmgtime - gpGlobals->time), 400, 0.1);
} }
#endif
if (pev->dmgtime <= gpGlobals->time) if (pev->dmgtime <= gpGlobals->time)
{ {

View File

@ -393,7 +393,7 @@ public:
const float space = 1.0f; const float space = 1.0f;
Vector to; Vector to;
float range; float range;
if (entity == reinterpret_cast<CBaseEntity *>(m_improv->GetEntity())) if (entity == reinterpret_cast<CBaseEntity *>(m_improv->GetEntity()))
return true; return true;

View File

@ -33,7 +33,7 @@ CLocalNav::CLocalNav(CHostage *pOwner)
CLocalNav::~CLocalNav() CLocalNav::~CLocalNav()
{ {
delete m_nodeArr; delete[] m_nodeArr;
m_nodeArr = NULL; m_nodeArr = NULL;
} }

View File

@ -309,7 +309,7 @@ public:
void SetPerformance(PerformanceType performance) { m_performance = performance; } void SetPerformance(PerformanceType performance) { m_performance = performance; }
void StartSequence(CHostageImprov *improv, const SeqInfo *seqInfo); void StartSequence(CHostageImprov *improv, const SeqInfo *seqInfo);
bool IsDoneHolding(); bool IsDoneHolding();
private: private:
enum { MAX_SEQUENCES = 8 }; enum { MAX_SEQUENCES = 8 };
struct SeqInfo m_sequence[MAX_SEQUENCES]; struct SeqInfo m_sequence[MAX_SEQUENCES];

View File

@ -144,11 +144,12 @@ void CFuncMortarField::FieldUse(CBaseEntity *pActivator, CBaseEntity *pCaller, U
CBaseEntity *pMortar = Create("monster_mortar", tr.vecEndPos, Vector(0, 0, 0), pentOwner); CBaseEntity *pMortar = Create("monster_mortar", tr.vecEndPos, Vector(0, 0, 0), pentOwner);
pMortar->pev->nextthink = gpGlobals->time + t; pMortar->pev->nextthink = gpGlobals->time + t;
t += RANDOM_FLOAT(0.2, 0.5); t += RANDOM_FLOAT(0.2, 0.5);
#ifndef REGAMEDLL_FIXES
if (i == 0) if (i == 0)
{ {
CSoundEnt::InsertSound(bits_SOUND_DANGER, tr.vecEndPos, 400, 0.3); CSoundEnt::InsertSound(bits_SOUND_DANGER, tr.vecEndPos, 400, 0.3);
} }
#endif
} }
} }

View File

@ -942,10 +942,8 @@ void CHalfLifeMultiplay::QueueCareerRoundEndMenu(float tmDelay, int iWinStatus)
// Check if the scenario has been won/lost. // Check if the scenario has been won/lost.
void CHalfLifeMultiplay::__MAKE_VHOOK(CheckWinConditions)() void CHalfLifeMultiplay::__MAKE_VHOOK(CheckWinConditions)()
{ {
#ifdef REGAMEDLL_ADD if (HasRoundInfinite())
if (round_infinite.string[0] == '1')
return; return;
#endif
// If a winner has already been determined and game of started.. then get the heck out of here // If a winner has already been determined and game of started.. then get the heck out of here
if (m_bFirstConnected && m_iRoundWinStatus != WINNER_NONE) if (m_bFirstConnected && m_iRoundWinStatus != WINNER_NONE)
@ -2734,10 +2732,8 @@ void CHalfLifeMultiplay::CheckFreezePeriodExpired()
void CHalfLifeMultiplay::CheckRoundTimeExpired() void CHalfLifeMultiplay::CheckRoundTimeExpired()
{ {
#ifdef REGAMEDLL_ADD if (HasRoundInfinite(true))
if (round_infinite.string[0] == '1' || (UTIL_ReadFlags(round_infinite.string) & SCENARIO_BLOCK_TIME_EXPRIRED))
return; return;
#endif
if (!HasRoundTimeExpired()) if (!HasRoundTimeExpired())
return; return;

View File

@ -1,6 +1,8 @@
#include "precompiled.h" #include "precompiled.h"
int GetForceCamera_api(CBasePlayer *pObserver) LINK_HOOK_CHAIN(int, GetForceCamera, (CBasePlayer *pObserver), pObserver);
int GetForceCamera_internal(CBasePlayer *pObserver)
{ {
int retVal; int retVal;
@ -17,27 +19,20 @@ int GetForceCamera_api(CBasePlayer *pObserver)
return retVal; return retVal;
} }
int GetForceCamera(CBasePlayer *pObserver) LINK_HOOK_CLASS_CHAIN(CBaseEntity *, CBasePlayer, Observer_IsValidTarget, (int iPlayerIndex, bool bSameTeam), iPlayerIndex, bSameTeam);
{
return g_ReGameHookchains.m_GetForceCamera.callChain(GetForceCamera_api, pObserver);
}
CBasePlayer *Observer_IsValidTarget_api(CBasePlayer *pPlayer, CBasePlayer *pEntity, int iPlayerIndex, bool bSameTeam) CBaseEntity *CBasePlayer::__API_HOOK(Observer_IsValidTarget)(int iPlayerIndex, bool bSameTeam)
{
// Don't spec observers or players who haven't picked a class yet
if (!pEntity || pEntity == pPlayer || pEntity->has_disconnected || pEntity->IsObserver() || (pEntity->pev->effects & EF_NODRAW) || pEntity->m_iTeam == UNASSIGNED || (bSameTeam && pEntity->m_iTeam != pPlayer->m_iTeam))
return NULL;
return pEntity;
}
CBaseEntity *CBasePlayer::Observer_IsValidTarget(int iPlayerIndex, bool bSameTeam)
{ {
if (iPlayerIndex > gpGlobals->maxClients || iPlayerIndex < 1) if (iPlayerIndex > gpGlobals->maxClients || iPlayerIndex < 1)
return NULL; return NULL;
CBasePlayer *pEnt = static_cast<CBasePlayer *>(UTIL_PlayerByIndex(iPlayerIndex)); CBasePlayer *pPlayer = static_cast<CBasePlayer *>(UTIL_PlayerByIndex(iPlayerIndex));
return g_ReGameHookchains.m_Observer_IsValidTarget.callChain(Observer_IsValidTarget_api, this, pEnt, iPlayerIndex, bSameTeam);
// Don't spec observers or players who haven't picked a class yet
if (!pPlayer || pPlayer == this || pPlayer->has_disconnected || pPlayer->IsObserver() || (pPlayer->pev->effects & EF_NODRAW) || pPlayer->m_iTeam == UNASSIGNED || (bSameTeam && pPlayer->m_iTeam != m_iTeam))
return NULL;
return pPlayer;
} }
void UpdateClientEffects(CBasePlayer *pObserver, int oldMode) void UpdateClientEffects(CBasePlayer *pObserver, int oldMode)

View File

@ -37,6 +37,7 @@
#define CAMERA_MODE_SPEC_ONLY_FRIST_PERSON 2 #define CAMERA_MODE_SPEC_ONLY_FRIST_PERSON 2
int GetForceCamera(CBasePlayer *pObserver); int GetForceCamera(CBasePlayer *pObserver);
int GetForceCamera_internal(CBasePlayer *pObserver);
void UpdateClientEffects(CBasePlayer *pObserver, int oldMode); void UpdateClientEffects(CBasePlayer *pObserver, int oldMode);
#endif // OBSERVER_H #endif // OBSERVER_H

View File

@ -140,46 +140,6 @@ TYPEDESCRIPTION CBasePlayer::m_playerSaveData[] =
DEFINE_FIELD(CBasePlayer, m_iJoiningState, FIELD_INTEGER), DEFINE_FIELD(CBasePlayer, m_iJoiningState, FIELD_INTEGER),
}; };
WeaponStruct g_weaponStruct[ MAX_WEAPONS ] =
{
{ 0, 0, 0, 0, 0 },
{ WEAPON_P228, P228_PRICE, TERRORIST|CT, AUTOBUYCLASS_SECONDARY, AMMO_357SIG_PRICE },
{ WEAPON_SCOUT, SCOUT_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_762MM_PRICE },
{ WEAPON_XM1014, XM1014_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_BUCKSHOT_PRICE },
{ WEAPON_MAC10, MAC10_PRICE, CT, AUTOBUYCLASS_PRIMARY, AMMO_45ACP_PRICE },
{ WEAPON_AUG, AUG_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
{ WEAPON_ELITE, ELITE_PRICE, CT, AUTOBUYCLASS_SECONDARY, AMMO_9MM_PRICE },
{ WEAPON_FIVESEVEN, FIVESEVEN_PRICE, TERRORIST|CT, AUTOBUYCLASS_SECONDARY, AMMO_57MM_PRICE },
{ WEAPON_UMP45, UMP45_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, AMMO_45ACP_PRICE },
{ WEAPON_SG550, SG550_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
{ WEAPON_USP, USP_PRICE, TERRORIST|CT, AUTOBUYCLASS_SECONDARY, AMMO_45ACP_PRICE },
{ WEAPON_GLOCK18, GLOCK18_PRICE, TERRORIST|CT, AUTOBUYCLASS_SECONDARY, AMMO_9MM_PRICE },
{ WEAPON_MP5N, MP5NAVY_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_9MM_PRICE },
{ WEAPON_AWP, AWP_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_338MAG_PRICE },
{ WEAPON_M249, M249_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
{ WEAPON_M3, M3_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_BUCKSHOT_PRICE },
{ WEAPON_M4A1, M4A1_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
{ WEAPON_TMP, TMP_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, AMMO_9MM_PRICE },
{ WEAPON_G3SG1, G3SG1_PRICE, CT, AUTOBUYCLASS_PRIMARY, AMMO_762MM_PRICE },
{ WEAPON_DEAGLE, DEAGLE_PRICE, TERRORIST|CT, AUTOBUYCLASS_SECONDARY, AMMO_50AE_PRICE },
{ WEAPON_SG552, SG552_PRICE, CT, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
{ WEAPON_AK47, AK47_PRICE, CT, AUTOBUYCLASS_PRIMARY, AMMO_762MM_PRICE },
{ WEAPON_P90, P90_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_57MM_PRICE },
{ WEAPON_FAMAS, FAMAS_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
{ WEAPON_GALIL, GALIL_PRICE, CT, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
// TODO: this have bug, the cost of galil $2000, but not $2250
{ WEAPON_SHIELDGUN, SHIELDGUN_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 }
};
char *CDeadHEV::m_szPoses[] = char *CDeadHEV::m_szPoses[] =
{ {
"deadback", "deadback",
@ -716,9 +676,11 @@ void CBasePlayer::DeathSound()
} }
} }
LINK_HOOK_CLASS_CHAIN(int, CBasePlayer, TakeHealth, (float flHealth, int bitsDamageType), flHealth, bitsDamageType);
// override takehealth // override takehealth
// bitsDamageType indicates type of damage healed. // bitsDamageType indicates type of damage healed.
int CBasePlayer::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType) int CBasePlayer::__API_VHOOK(TakeHealth)(float flHealth, int bitsDamageType)
{ {
return CBaseMonster::TakeHealth(flHealth, bitsDamageType); return CBaseMonster::TakeHealth(flHealth, bitsDamageType);
} }
@ -742,7 +704,9 @@ bool CBasePlayer::IsHittingShield(Vector &vecDirection, TraceResult *ptr)
return false; return false;
} }
void CBasePlayer::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayer, TraceAttack, (entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType), pevAttacker, flDamage, vecDir, ptr, bitsDamageType);
void CBasePlayer::__API_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{ {
bool bShouldBleed = true; bool bShouldBleed = true;
bool bShouldSpark = false; bool bShouldSpark = false;
@ -946,11 +910,13 @@ void LogAttack(CBasePlayer *pAttacker, CBasePlayer *pVictim, int teamAttack, int
} }
} }
LINK_HOOK_CLASS_CHAIN(int, CBasePlayer, TakeDamage, (entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType), pevInflictor, pevAttacker, flDamage, bitsDamageType);
// Take some damage. // Take some damage.
// NOTE: each call to TakeDamage with bitsDamageType set to a time-based damage // NOTE: each call to TakeDamage with bitsDamageType set to a time-based damage
// type will cause the damage time countdown to be reset. Thus the ongoing effects of poison, radiation // type will cause the damage time countdown to be reset. Thus the ongoing effects of poison, radiation
// etc are implemented with subsequent calls to TakeDamage using DMG_GENERIC. // etc are implemented with subsequent calls to TakeDamage using DMG_GENERIC.
int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) int CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{ {
int fTookDamage; int fTookDamage;
float flRatio = ARMOR_RATIO; float flRatio = ARMOR_RATIO;
@ -1831,7 +1797,9 @@ void CBasePlayer::SendFOV(int fov)
MESSAGE_END(); MESSAGE_END();
} }
void CBasePlayer::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayer, Killed, (entvars_t *pevAttacker, int iGib), pevAttacker, iGib);
void CBasePlayer::__API_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
{ {
m_canSwitchObserverModes = false; m_canSwitchObserverModes = false;
@ -1928,13 +1896,14 @@ void CBasePlayer::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
m_pTank = NULL; m_pTank = NULL;
} }
#ifndef REGAMEDLL_FIXES
CSound *pSound = CSoundEnt::SoundPointerForIndex(CSoundEnt::ClientSoundIndex(edict())); CSound *pSound = CSoundEnt::SoundPointerForIndex(CSoundEnt::ClientSoundIndex(edict()));
if (pSound != NULL) if (pSound != NULL)
{ {
pSound->Reset(); pSound->Reset();
} }
#endif
SetAnimation(PLAYER_DIE); SetAnimation(PLAYER_DIE);
if (m_pActiveItem != NULL && m_pActiveItem->m_pPlayer != NULL) if (m_pActiveItem != NULL && m_pActiveItem->m_pPlayer != NULL)
@ -3357,12 +3326,14 @@ void CBasePlayer::Disappear()
m_pTank = NULL; m_pTank = NULL;
} }
#ifndef REGAMEDLL_FIXES
CSound *pSound = CSoundEnt::SoundPointerForIndex(CSoundEnt::ClientSoundIndex(edict())); CSound *pSound = CSoundEnt::SoundPointerForIndex(CSoundEnt::ClientSoundIndex(edict()));
if (pSound) if (pSound)
{ {
pSound->Reset(); pSound->Reset();
} }
#endif
m_fSequenceFinished = TRUE; m_fSequenceFinished = TRUE;
pev->modelindex = m_modelIndexPlayer; pev->modelindex = m_modelIndexPlayer;
@ -3508,7 +3479,9 @@ void CBasePlayer::PlayerDeathThink()
} }
} }
void CBasePlayer::__MAKE_VHOOK(RoundRespawn)() LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, RoundRespawn);
void CBasePlayer::__API_VHOOK(RoundRespawn)()
{ {
m_canSwitchObserverModes = true; m_canSwitchObserverModes = true;
@ -3852,7 +3825,9 @@ void CBasePlayer::HostageUsed()
m_flDisplayHistory |= DHF_HOSTAGE_USED; m_flDisplayHistory |= DHF_HOSTAGE_USED;
} }
void CBasePlayer::__MAKE_VHOOK(Jump)() LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, Jump);
void CBasePlayer::__API_VHOOK(Jump)()
{ {
if (pev->flags & FL_WATERJUMP) if (pev->flags & FL_WATERJUMP)
return; return;
@ -3922,19 +3897,32 @@ NOXREF void FixPlayerCrouchStuck(edict_t *pPlayer)
} }
} }
void CBasePlayer::__MAKE_VHOOK(Duck)() LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, Duck);
void CBasePlayer::__API_VHOOK(Duck)()
{ {
if (pev->button & IN_DUCK) if (pev->button & IN_DUCK)
SetAnimation(PLAYER_WALK); SetAnimation(PLAYER_WALK);
} }
LINK_HOOK_CLASS_CHAIN2(int, CBasePlayer, ObjectCaps);
int CBasePlayer::__API_VHOOK(ObjectCaps)()
{
return (CBaseMonster::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
}
LINK_HOOK_CLASS_CHAIN2(int, CBasePlayer, Classify);
// ID's player as such. // ID's player as such.
int CBasePlayer::__MAKE_VHOOK(Classify)() int CBasePlayer::__API_VHOOK(Classify)()
{ {
return CLASS_PLAYER; return CLASS_PLAYER;
} }
void CBasePlayer::__MAKE_VHOOK(AddPoints)(int score, BOOL bAllowNegativeScore) LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayer, AddPoints, (int score, BOOL bAllowNegativeScore), score, bAllowNegativeScore);
void CBasePlayer::__API_VHOOK(AddPoints)(int score, BOOL bAllowNegativeScore)
{ {
// Positive score always adds // Positive score always adds
if (score < 0 && !bAllowNegativeScore) if (score < 0 && !bAllowNegativeScore)
@ -3961,7 +3949,9 @@ void CBasePlayer::__MAKE_VHOOK(AddPoints)(int score, BOOL bAllowNegativeScore)
MESSAGE_END(); MESSAGE_END();
} }
void CBasePlayer::__MAKE_VHOOK(AddPointsToTeam)(int score, BOOL bAllowNegativeScore) LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayer, AddPointsToTeam, (int score, BOOL bAllowNegativeScore), score, bAllowNegativeScore);
void CBasePlayer::__API_VHOOK(AddPointsToTeam)(int score, BOOL bAllowNegativeScore)
{ {
int index = entindex(); int index = entindex();
@ -4049,7 +4039,9 @@ bool CBasePlayer::CanPlayerBuy(bool display)
return true; return true;
} }
void CBasePlayer::__MAKE_VHOOK(PreThink)() LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, PreThink);
void CBasePlayer::__API_VHOOK(PreThink)()
{ {
// These buttons have changed this frame // These buttons have changed this frame
int buttonsChanged = (m_afButtonLast ^ pev->button); int buttonsChanged = (m_afButtonLast ^ pev->button);
@ -4520,9 +4512,8 @@ void CBasePlayer::UpdatePlayerSound()
{ {
int iBodyVolume; int iBodyVolume;
int iVolume; int iVolume;
CSound *pSound;
pSound = CSoundEnt::SoundPointerForIndex(CSoundEnt::ClientSoundIndex(edict())); CSound *pSound = CSoundEnt::SoundPointerForIndex(CSoundEnt::ClientSoundIndex(edict()));
if (!pSound) if (!pSound)
{ {
@ -4624,7 +4615,9 @@ void CBasePlayer::UpdatePlayerSound()
gpGlobals->v_forward.z = 0; gpGlobals->v_forward.z = 0;
} }
void CBasePlayer::__MAKE_VHOOK(PostThink)() LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, PostThink);
void CBasePlayer::__API_VHOOK(PostThink)()
{ {
// intermission or finale // intermission or finale
if (g_fGameOver) if (g_fGameOver)
@ -4694,10 +4687,12 @@ void CBasePlayer::__MAKE_VHOOK(PostThink)()
if (pev->flags & FL_ONGROUND) if (pev->flags & FL_ONGROUND)
{ {
#ifndef REGAMEDLL_FIXES
if (m_flFallVelocity > 64.0f && !g_pGameRules->IsMultiplayer()) if (m_flFallVelocity > 64.0f && !g_pGameRules->IsMultiplayer())
{ {
CSoundEnt::InsertSound(bits_SOUND_PLAYER, pev->origin, m_flFallVelocity, 0.2); CSoundEnt::InsertSound(bits_SOUND_PLAYER, pev->origin, m_flFallVelocity, 0.2);
} }
#endif
m_flFallVelocity = 0; m_flFallVelocity = 0;
} }
@ -4968,7 +4963,9 @@ void SetScoreAttrib(CBasePlayer *dest, CBasePlayer *src)
} }
} }
void CBasePlayer::__MAKE_VHOOK(Spawn)() LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, Spawn);
void CBasePlayer::__API_VHOOK(Spawn)()
{ {
int i; int i;
@ -5309,8 +5306,11 @@ void CBasePlayer::__MAKE_VHOOK(Spawn)()
m_flLastCommandTime[i] = -1; m_flLastCommandTime[i] = -1;
} }
void CBasePlayer::__MAKE_VHOOK(Precache)() LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, Precache);
void CBasePlayer::__API_VHOOK(Precache)()
{ {
#ifndef REGAMEDLL_FIXES
// in the event that the player JUST spawned, and the level node graph // in the event that the player JUST spawned, and the level node graph
// was loaded, fix all of the node graph pointers before the game starts. // was loaded, fix all of the node graph pointers before the game starts.
@ -5326,7 +5326,7 @@ void CBasePlayer::__MAKE_VHOOK(Precache)()
ALERT(at_console, "**Graph Pointers Set!\n"); ALERT(at_console, "**Graph Pointers Set!\n");
} }
} }
#endif
// SOUNDS / MODELS ARE PRECACHED in ClientPrecache() (game specific) // SOUNDS / MODELS ARE PRECACHED in ClientPrecache() (game specific)
// because they need to precache before any clients have connected // because they need to precache before any clients have connected
@ -5798,7 +5798,9 @@ void CBasePlayer::ForceClientDllUpdate()
HandleSignals(); HandleSignals();
} }
void CBasePlayer::__MAKE_VHOOK(ImpulseCommands)() LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, ImpulseCommands);
void CBasePlayer::__API_VHOOK(ImpulseCommands)()
{ {
TraceResult tr; TraceResult tr;
@ -5986,11 +5988,13 @@ void CBasePlayer::CheatImpulseCommands(int iImpulse)
// show shortest paths for entire level to nearest node // show shortest paths for entire level to nearest node
Create("node_viewer_human", pev->origin, pev->angles); Create("node_viewer_human", pev->origin, pev->angles);
break; break;
#ifndef REGAMEDLL_FIXES
case 199: case 199:
// show nearest node and all connections // show nearest node and all connections
ALERT(at_console, "%d\n", WorldGraph.FindNearestNode(pev->origin, bits_NODE_LAND)); ALERT(at_console, "%d\n", WorldGraph.FindNearestNode(pev->origin, bits_NODE_LAND));
WorldGraph.ShowNodeConnections(WorldGraph.FindNearestNode(pev->origin, bits_NODE_LAND)); WorldGraph.ShowNodeConnections(WorldGraph.FindNearestNode(pev->origin, bits_NODE_LAND));
break; break;
#endif
case 202: case 202:
{ {
// Random blood splatter // Random blood splatter
@ -6146,8 +6150,10 @@ void CBasePlayer::HandleSignals()
} }
} }
LINK_HOOK_CLASS_CHAIN(BOOL, CBasePlayer, AddPlayerItem, (CBasePlayerItem *pItem), pItem);
// Add a weapon to the player (Item == Weapon == Selectable Object) // Add a weapon to the player (Item == Weapon == Selectable Object)
BOOL CBasePlayer::__MAKE_VHOOK(AddPlayerItem)(CBasePlayerItem *pItem) BOOL CBasePlayer::__API_VHOOK(AddPlayerItem)(CBasePlayerItem *pItem)
{ {
CBasePlayerItem *pInsert = m_rgpPlayerItems[ pItem->iItemSlot() ]; CBasePlayerItem *pInsert = m_rgpPlayerItems[ pItem->iItemSlot() ];
while (pInsert != NULL) while (pInsert != NULL)
@ -6209,7 +6215,9 @@ BOOL CBasePlayer::__MAKE_VHOOK(AddPlayerItem)(CBasePlayerItem *pItem)
return FALSE; return FALSE;
} }
BOOL CBasePlayer::__MAKE_VHOOK(RemovePlayerItem)(CBasePlayerItem *pItem) LINK_HOOK_CLASS_CHAIN(BOOL, CBasePlayer, RemovePlayerItem, (CBasePlayerItem *pItem), pItem);
BOOL CBasePlayer::__API_VHOOK(RemovePlayerItem)(CBasePlayerItem *pItem)
{ {
if (m_pActiveItem == pItem) if (m_pActiveItem == pItem)
{ {
@ -6244,8 +6252,10 @@ BOOL CBasePlayer::__MAKE_VHOOK(RemovePlayerItem)(CBasePlayerItem *pItem)
return FALSE; return FALSE;
} }
LINK_HOOK_CLASS_CHAIN(int, CBasePlayer, GiveAmmo, (int iCount, char *szName, int iMax), iCount, szName, iMax);
// Returns the unique ID for the ammo, or -1 if error // Returns the unique ID for the ammo, or -1 if error
int CBasePlayer::__MAKE_VHOOK(GiveAmmo)(int iCount, char *szName, int iMax) int CBasePlayer::__API_VHOOK(GiveAmmo)(int iCount, char *szName, int iMax)
{ {
if (pev->flags & FL_SPECTATOR) if (pev->flags & FL_SPECTATOR)
return -1; return -1;
@ -6455,12 +6465,14 @@ void CBasePlayer::SendWeatherInfo()
} }
} }
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, UpdateClientData);
// resends any changed player HUD info to the client. // resends any changed player HUD info to the client.
// Called every frame by PlayerPreThink // Called every frame by PlayerPreThink
// Also called at start of demo recording and playback by // Also called at start of demo recording and playback by
// ForceClientDllUpdate to ensure the demo gets messages // ForceClientDllUpdate to ensure the demo gets messages
// reflecting all of the HUD state info. // reflecting all of the HUD state info.
void CBasePlayer::__MAKE_VHOOK(UpdateClientData)() void CBasePlayer::__API_VHOOK(UpdateClientData)()
{ {
if (m_fInitHUD) if (m_fInitHUD)
{ {
@ -6827,7 +6839,9 @@ void CBasePlayer::EnableControl(BOOL fControl)
pev->flags &= ~FL_FROZEN; pev->flags &= ~FL_FROZEN;
} }
void CBasePlayer::__MAKE_VHOOK(ResetMaxSpeed)() LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, ResetMaxSpeed);
void CBasePlayer::__API_VHOOK(ResetMaxSpeed)()
{ {
float speed; float speed;
@ -6968,7 +6982,9 @@ int CBasePlayer::GetCustomDecalFrames()
return m_nCustomSprayFrames; return m_nCustomSprayFrames;
} }
void CBasePlayer::__MAKE_VHOOK(Blind)(float duration, float holdTime, float fadeTime, int alpha) LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayer, Blind, (float duration, float holdTime, float fadeTime, int alpha), duration, holdTime, fadeTime, alpha);
void CBasePlayer::__API_VHOOK(Blind)(float duration, float holdTime, float fadeTime, int alpha)
{ {
m_blindUntilTime = gpGlobals->time + duration; m_blindUntilTime = gpGlobals->time + duration;
m_blindStartTime = gpGlobals->time; m_blindStartTime = gpGlobals->time;
@ -8217,12 +8233,14 @@ void CBasePlayer::AddAutoBuyData(const char *str)
if (len < sizeof(m_autoBuyString) - 1) if (len < sizeof(m_autoBuyString) - 1)
{ {
if (len > 0) if (len > 0)
m_autoBuyString[ len ] = ' '; {
Q_strncat(m_autoBuyString, " ", len);
}
#ifndef REGAMEDLL_FIXES #ifndef REGAMEDLL_FIXES
Q_strncat(m_autoBuyString, str, sizeof(m_autoBuyString) - len); Q_strncat(m_autoBuyString, str, sizeof(m_autoBuyString) - Q_strlen(m_autoBuyString));
#else #else
Q_strncat(m_autoBuyString, str, sizeof(m_autoBuyString) - len - 1); Q_strncat(m_autoBuyString, str, sizeof(m_autoBuyString) - Q_strlen(m_autoBuyString) - 1);
#endif #endif
} }
} }
@ -8236,7 +8254,7 @@ void CBasePlayer::InitRebuyData(const char *str)
if (m_rebuyString != NULL) if (m_rebuyString != NULL)
{ {
delete m_rebuyString; delete[] m_rebuyString;
m_rebuyString = NULL; m_rebuyString = NULL;
} }

View File

@ -258,25 +258,9 @@ enum sbar_data
SBAR_END SBAR_END
}; };
typedef enum enum MusicState { SILENT, CALM, INTENSE };
{
SILENT,
CALM,
INTENSE
} MusicState; class CStripWeapons: public CPointEntity {
struct WeaponStruct
{
int m_type;
int m_price;
int m_side;
int m_slot;
int m_ammoPrice;
};
class CStripWeapons: public CPointEntity
{
public: public:
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
@ -288,8 +272,7 @@ public:
}; };
class CInfoIntermission: public CPointEntity class CInfoIntermission: public CPointEntity {
{
public: public:
virtual void Spawn(); virtual void Spawn();
virtual void Think(); virtual void Think();
@ -303,8 +286,7 @@ public:
}; };
class CDeadHEV: public CBaseMonster class CDeadHEV: public CBaseMonster {
{
public: public:
virtual void Spawn(); virtual void Spawn();
virtual void KeyValue(KeyValueData *pkvd); virtual void KeyValue(KeyValueData *pkvd);
@ -323,8 +305,7 @@ public:
static char *m_szPoses[4]; static char *m_szPoses[4];
}; };
class CSprayCan: public CBaseEntity class CSprayCan: public CBaseEntity {
{
public: public:
virtual void Think(); virtual void Think();
virtual int ObjectCaps() virtual int ObjectCaps()
@ -342,21 +323,19 @@ public:
void Spawn(entvars_t *pevOwner); void Spawn(entvars_t *pevOwner);
}; };
class CBloodSplat: public CBaseEntity class CBloodSplat: public CBaseEntity {
{
public: public:
void Spawn(entvars_t *pevOwner); void Spawn(entvars_t *pevOwner);
void Spray(); void Spray();
}; };
class CBasePlayer: public CBaseMonster class CBasePlayer: public CBaseMonster {
{
public: public:
virtual void Spawn(); virtual void Spawn();
virtual void Precache(); virtual void Precache();
virtual int Save(CSave &save); virtual int Save(CSave &save);
virtual int Restore(CRestore &restore); virtual int Restore(CRestore &restore);
virtual int ObjectCaps() { return (CBaseMonster::ObjectCaps() & ~FCAP_ACROSS_TRANSITION); } virtual int ObjectCaps();
virtual int Classify(); virtual int Classify();
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType); virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType); virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
@ -392,12 +371,10 @@ public:
virtual void Blind(float flUntilTime, float flHoldTime, float flFadeTime, int iAlpha); virtual void Blind(float flUntilTime, float flHoldTime, float flFadeTime, int iAlpha);
virtual void OnTouchingWeapon(CWeaponBox *pWeapon) { } virtual void OnTouchingWeapon(CWeaponBox *pWeapon) { }
#ifdef HOOK_GAMEDLL #ifdef REGAMEDLL_API
void Spawn_(); void Spawn_();
void Precache_(); void Precache_();
int Save_(CSave &save); int ObjectCaps_();
int Restore_(CRestore &restore);
int Classify_(); int Classify_();
void TraceAttack_(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType); void TraceAttack_(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType); int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
@ -405,30 +382,36 @@ public:
void Killed_(entvars_t *pevAttacker, int iGib); void Killed_(entvars_t *pevAttacker, int iGib);
void AddPoints_(int score, BOOL bAllowNegativeScore); void AddPoints_(int score, BOOL bAllowNegativeScore);
void AddPointsToTeam_(int score, BOOL bAllowNegativeScore); void AddPointsToTeam_(int score, BOOL bAllowNegativeScore);
BOOL AddPlayerItem_(CBasePlayerItem *pItem); BOOL AddPlayerItem_(CBasePlayerItem *pItem);
BOOL RemovePlayerItem_(CBasePlayerItem *pItem); BOOL RemovePlayerItem_(CBasePlayerItem *pItem);
int GiveAmmo_(int iAmount,char *szName,int iMax); int GiveAmmo_(int iAmount,char *szName,int iMax);
const char *TeamID_();
BOOL FBecomeProne_();
int Illumination_();
void ResetMaxSpeed_(); void ResetMaxSpeed_();
void Jump_(); void Jump_();
void Duck_(); void Duck_();
void PreThink_(); void PreThink_();
void PostThink_(); void PostThink_();
Vector GetGunPosition_();
void UpdateClientData_(); void UpdateClientData_();
void ImpulseCommands_(); void ImpulseCommands_();
void RoundRespawn_(); void RoundRespawn_();
Vector GetAutoaimVector_(float flDelta);
void Blind_(float flUntilTime, float flHoldTime, float flFadeTime, int iAlpha); void Blind_(float flUntilTime, float flHoldTime, float flFadeTime, int iAlpha);
#endif // REGAMEDLL_API
#endif // HOOK_GAMEDLL #ifdef HOOK_GAMEDLL
int Save_(CSave &save);
int Restore_(CRestore &restore);
const char *TeamID_();
BOOL FBecomeProne_();
int Illumination_();
Vector GetGunPosition_();
Vector GetAutoaimVector_(float flDelta);
#endif
public: public:
void SpawnClientSideCorpse(); void SpawnClientSideCorpse();
void Observer_FindNextPlayer(bool bReverse, const char *name = NULL); void Observer_FindNextPlayer(bool bReverse, const char *name = NULL);
CBaseEntity *Observer_IsValidTarget(int iPlayerIndex, bool bSameTeam); CBaseEntity *Observer_IsValidTarget(int iPlayerIndex, bool bSameTeam);
CBaseEntity *Observer_IsValidTarget_(int iPlayerIndex, bool bSameTeam);
void Observer_HandleButtons(); void Observer_HandleButtons();
void Observer_SetMode(int iMode); void Observer_SetMode(int iMode);
void Observer_CheckTarget(); void Observer_CheckTarget();

View File

@ -81,6 +81,7 @@ BOOL CBaseDMStart::__MAKE_VHOOK(IsTriggered)(CBaseEntity *pEntity)
// This updates global tables that need to know about entities being removed // This updates global tables that need to know about entities being removed
void CBaseEntity::UpdateOnRemove() void CBaseEntity::UpdateOnRemove()
{ {
#ifndef REGAMEDLL_FIXES
if (pev->flags & FL_GRAPHED) if (pev->flags & FL_GRAPHED)
{ {
// this entity was a LinkEnt in the world node graph, so we must remove it from // this entity was a LinkEnt in the world node graph, so we must remove it from
@ -94,6 +95,7 @@ void CBaseEntity::UpdateOnRemove()
} }
} }
} }
#endif
if (pev->globalname) if (pev->globalname)
{ {

View File

@ -1456,7 +1456,7 @@ void UTIL_PrecacheOther(const char *szClassname)
REMOVE_ENTITY(pent); REMOVE_ENTITY(pent);
} }
void UTIL_LogPrintf(char *fmt, ...) void UTIL_LogPrintf(const char *fmt, ...)
{ {
va_list argptr; va_list argptr;
static char string[1024]; static char string[1024];

View File

@ -167,68 +167,6 @@ extern globalvars_t *gpGlobals;
GetClassPtr<DLLClassWrapName>((DLLClassName *)pev);\ GetClassPtr<DLLClassWrapName>((DLLClassName *)pev);\
} }
typedef enum
{
ignore_monsters = 1,
dont_ignore_monsters = 0,
missile = 2
} IGNORE_MONSTERS;
typedef enum
{
ignore_glass = 1,
dont_ignore_glass = 0
} IGNORE_GLASS;
enum
{
point_hull = 0,
human_hull = 1,
large_hull = 2,
head_hull = 3
};
typedef enum
{
MONSTERSTATE_NONE = 0,
MONSTERSTATE_IDLE,
MONSTERSTATE_COMBAT,
MONSTERSTATE_ALERT,
MONSTERSTATE_HUNT,
MONSTERSTATE_PRONE,
MONSTERSTATE_SCRIPT,
MONSTERSTATE_PLAYDEAD,
MONSTERSTATE_DEAD
} MONSTERSTATE;
// Things that toggle (buttons/triggers/doors) need this
typedef enum
{
TS_AT_TOP,
TS_AT_BOTTOM,
TS_GOING_UP,
TS_GOING_DOWN,
} TOGGLE_STATE;
typedef struct hudtextparms_s
{
float x;
float y;
int effect;
byte r1,g1,b1,a1;
byte r2,g2,b2,a2;
float fadeinTime;
float fadeoutTime;
float holdTime;
float fxTime;
int channel;
} hudtextparms_t;
class UTIL_GroupTrace class UTIL_GroupTrace
{ {
public: public:
@ -239,35 +177,14 @@ private:
int m_oldgroupop; int m_oldgroupop;
}; };
inline edict_t *FIND_ENTITY_BY_CLASSNAME(edict_t *entStart, const char *pszName) // Inlines
{ inline edict_t *FIND_ENTITY_BY_CLASSNAME(edict_t *entStart, const char *pszName) { return FIND_ENTITY_BY_STRING(entStart, "classname", pszName); }
return FIND_ENTITY_BY_STRING(entStart, "classname", pszName); inline edict_t *FIND_ENTITY_BY_TARGETNAME(edict_t *entStart, const char *pszName) { return FIND_ENTITY_BY_STRING(entStart, "targetname", pszName); }
}
inline edict_t *FIND_ENTITY_BY_TARGETNAME(edict_t *entStart, const char *pszName) inline edict_t *ENT(const entvars_t *pev) { return pev->pContainingEntity; }
{ inline edict_t *ENT(EOFFSET eoffset) { return (*g_engfuncs.pfnPEntityOfEntOffset)(eoffset); }
return FIND_ENTITY_BY_STRING(entStart, "targetname", pszName); inline EOFFSET OFFSET(const edict_t *pent) { return (*g_engfuncs.pfnEntOffsetOfPEntity)(pent); }
} inline EOFFSET OFFSET(const entvars_t *pev) { return OFFSET(ENT(pev)); }
inline edict_t *ENT(const entvars_t *pev)
{
return pev->pContainingEntity;
}
inline edict_t *ENT(EOFFSET eoffset)
{
return (*g_engfuncs.pfnPEntityOfEntOffset)(eoffset);
}
inline EOFFSET OFFSET(const edict_t *pent)
{
return (*g_engfuncs.pfnEntOffsetOfPEntity)(pent);
}
inline EOFFSET OFFSET(const entvars_t *pev)
{
return OFFSET(ENT(pev));
}
inline entvars_t *VARS(edict_t *pent) inline entvars_t *VARS(edict_t *pent)
{ {
@ -277,69 +194,26 @@ inline entvars_t *VARS(edict_t *pent)
return &pent->v; return &pent->v;
} }
inline entvars_t *VARS(EOFFSET eoffset) inline entvars_t *VARS(EOFFSET eoffset) { return VARS(ENT(eoffset)); }
{ inline int ENTINDEX(const edict_t *pEdict) { return (*g_engfuncs.pfnIndexOfEdict)(pEdict); }
return VARS(ENT(eoffset)); inline edict_t *INDEXENT(int iEdictNum) { return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum); }
} 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 int ENTINDEX(const edict_t *pEdict) inline BOOL FNullEnt(entvars_t *pev) { return (pev == NULL || FNullEnt(OFFSET(pev))); }
{ inline BOOL FNullEnt(const edict_t *pent) { return (pent == NULL || FNullEnt(OFFSET(pent))); }
return (*g_engfuncs.pfnIndexOfEdict)(pEdict); inline BOOL FStringNull(int iString) { return (iString == iStringNull); }
} inline BOOL FStrEq(const char *sz1, const char *sz2) { return (strcmp(sz1, sz2) == 0); }
inline BOOL FClassnameIs(entvars_t *pev, const char *szClassname) { return FStrEq(STRING(pev->classname), szClassname); }
inline edict_t *INDEXENT(int iEdictNum) inline BOOL FClassnameIs(edict_t *pent, const char *szClassname) { return FStrEq(STRING(VARS(pent)->classname), szClassname); }
{ inline void UTIL_MakeVectorsPrivate(Vector vecAngles, float *p_vForward, float *p_vRight, float *p_vUp) { g_engfuncs.pfnAngleVectors(vecAngles, p_vForward, p_vRight, p_vUp); }
return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum);
}
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)));
}
inline BOOL FNullEnt(const edict_t *pent)
{
return (pent == NULL || FNullEnt(OFFSET(pent)));
}
inline BOOL FStringNull(int iString)
{
return (iString == iStringNull);
}
inline BOOL FStrEq(const char *sz1, const char *sz2)
{
return (Q_strcmp(sz1, sz2) == 0);
}
inline BOOL FClassnameIs(entvars_t *pev, const char *szClassname)
{
return FStrEq(STRING(pev->classname), szClassname);
}
inline BOOL FClassnameIs(edict_t *pent, const char *szClassname)
{
// TODO: check is null?
return FStrEq(STRING(VARS(pent)->classname), szClassname);
}
inline void UTIL_MakeVectorsPrivate(Vector vecAngles, float *p_vForward, float *p_vRight, float *p_vUp)
{
g_engfuncs.pfnAngleVectors(vecAngles, p_vForward, p_vRight, p_vUp);
}
extern void EMIT_SOUND_DYN(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int flags, int pitch); extern void EMIT_SOUND_DYN(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int flags, int pitch);
// NOTE: use EMIT_SOUND_DYN to set the pitch of a sound. Pitch of 100
// is no pitch shift. Pitch > 100 up to 255 is a higher pitch, pitch < 100
// down to 1 is a lower pitch. 150 to 70 is the realistic range.
// EMIT_SOUND_DYN with pitch != 100 should be used sparingly, as it's not quite as
// fast as EMIT_SOUND (the pitchshift mixer is not native coded).
inline void EMIT_SOUND(edict_t *entity, int channel, const char *sample, float volume, float attenuation) inline void EMIT_SOUND(edict_t *entity, int channel, const char *sample, float volume, float attenuation)
{ {
EMIT_SOUND_DYN(entity, channel, sample, volume, attenuation, 0, PITCH_NORM); EMIT_SOUND_DYN(entity, channel, sample, volume, attenuation, 0, PITCH_NORM);
@ -438,7 +312,7 @@ void UTIL_BubbleTrail(Vector from, Vector to, int count);
void UTIL_Remove(CBaseEntity *pEntity); void UTIL_Remove(CBaseEntity *pEntity);
BOOL UTIL_IsValidEntity(edict_t *pent); BOOL UTIL_IsValidEntity(edict_t *pent);
void UTIL_PrecacheOther(const char *szClassname); void UTIL_PrecacheOther(const char *szClassname);
void UTIL_LogPrintf(char *fmt, ...); void UTIL_LogPrintf(const char *fmt, ...);
float UTIL_DotPoints(const Vector &vecSrc, const Vector &vecCheck, const Vector &vecDir); float UTIL_DotPoints(const Vector &vecSrc, const Vector &vecCheck, const Vector &vecDir);
void UTIL_StripToken(const char *pKey, char *pDest); void UTIL_StripToken(const char *pKey, char *pDest);
void EntvarsKeyvalue(entvars_t *pev, KeyValueData *pkvd); void EntvarsKeyvalue(entvars_t *pev, KeyValueData *pkvd);

View File

@ -32,9 +32,6 @@
#pragma once #pragma once
#endif #endif
#include "weapontype.h"
#include "wpn_shared.h"
class CBasePlayer; class CBasePlayer;
#define MAX_WEAPONS 32 #define MAX_WEAPONS 32
@ -73,6 +70,9 @@ class CBasePlayer;
// spawn flags // spawn flags
#define SF_DETONATE 0x0001 // Grenades flagged with this will be triggered when the owner calls detonateSatchelCharges #define SF_DETONATE 0x0001 // Grenades flagged with this will be triggered when the owner calls detonateSatchelCharges
#include "weapontype.h"
#include "wpn_shared.h"
// custom enum // custom enum
enum ArmouryItemPack enum ArmouryItemPack
{ {
@ -400,17 +400,17 @@ public:
int m_iPlayEmptySound; int m_iPlayEmptySound;
int m_fFireOnEmpty; int m_fFireOnEmpty;
float m_flNextPrimaryAttack; float m_flNextPrimaryAttack; // soonest time ItemPostFrame will call PrimaryAttack
float m_flNextSecondaryAttack; float m_flNextSecondaryAttack; // soonest time ItemPostFrame will call SecondaryAttack
float m_flTimeWeaponIdle; float m_flTimeWeaponIdle; // soonest time ItemPostFrame will call WeaponIdle
int m_iPrimaryAmmoType; int m_iPrimaryAmmoType; // "primary" ammo index into players m_rgAmmo[]
int m_iSecondaryAmmoType; int m_iSecondaryAmmoType; // "secondary" ammo index into players m_rgAmmo[]
int m_iClip; int m_iClip; // number of shots left in the primary weapon clip, -1 it not used
int m_iClientClip; int m_iClientClip; // the last version of m_iClip sent to hud dll
int m_iClientWeaponState; int m_iClientWeaponState; // the last version of the weapon state sent to hud dll (is current weapon, is on target)
int m_fInReload; int m_fInReload; // Are we in the middle of a reload;
int m_fInSpecialReload; int m_fInSpecialReload; // Are we in the middle of a reload for the shotguns
int m_iDefaultAmmo; int m_iDefaultAmmo; // how much ammo you get when you pick up this weapon as placed by a level designer.
int m_iShellId; int m_iShellId;
float m_fMaxSpeed; float m_fMaxSpeed;
bool m_bDelayFire; bool m_bDelayFire;
@ -431,6 +431,8 @@ public:
float m_flDecreaseShotsFired; float m_flDecreaseShotsFired;
unsigned short m_usFireGlock18; unsigned short m_usFireGlock18;
unsigned short m_usFireFamas; unsigned short m_usFireFamas;
// hle time creep vars
float m_flPrevPrimaryAttack; float m_flPrevPrimaryAttack;
float m_flLastFireTime; float m_flLastFireTime;
}; };
@ -1584,6 +1586,7 @@ public:
public: public:
int m_iShell; int m_iShell;
private:
unsigned short m_usFireELITE_LEFT; unsigned short m_usFireELITE_LEFT;
unsigned short m_usFireELITE_RIGHT; unsigned short m_usFireELITE_RIGHT;
}; };
@ -1672,7 +1675,6 @@ public:
public: public:
void UMP45Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim); void UMP45Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim);
public:
int m_iShell; int m_iShell;
int iShellOn; int iShellOn;
@ -1718,8 +1720,6 @@ public:
public: public:
void SG550Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim); void SG550Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim);
public:
int m_iShell; int m_iShell;
private: private:

View File

@ -5,6 +5,46 @@
*/ */
#ifndef HOOK_GAMEDLL #ifndef HOOK_GAMEDLL
WeaponStruct g_weaponStruct[ MAX_WEAPONS ] =
{
{ 0, 0, 0, 0, 0 },
{ WEAPON_P228, P228_PRICE, TERRORIST|CT, AUTOBUYCLASS_SECONDARY, AMMO_357SIG_PRICE },
{ WEAPON_SCOUT, SCOUT_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_762MM_PRICE },
{ WEAPON_XM1014, XM1014_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_BUCKSHOT_PRICE },
{ WEAPON_MAC10, MAC10_PRICE, CT, AUTOBUYCLASS_PRIMARY, AMMO_45ACP_PRICE },
{ WEAPON_AUG, AUG_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
{ WEAPON_ELITE, ELITE_PRICE, CT, AUTOBUYCLASS_SECONDARY, AMMO_9MM_PRICE },
{ WEAPON_FIVESEVEN, FIVESEVEN_PRICE, TERRORIST|CT, AUTOBUYCLASS_SECONDARY, AMMO_57MM_PRICE },
{ WEAPON_UMP45, UMP45_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, AMMO_45ACP_PRICE },
{ WEAPON_SG550, SG550_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
{ WEAPON_USP, USP_PRICE, TERRORIST|CT, AUTOBUYCLASS_SECONDARY, AMMO_45ACP_PRICE },
{ WEAPON_GLOCK18, GLOCK18_PRICE, TERRORIST|CT, AUTOBUYCLASS_SECONDARY, AMMO_9MM_PRICE },
{ WEAPON_MP5N, MP5NAVY_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_9MM_PRICE },
{ WEAPON_AWP, AWP_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_338MAG_PRICE },
{ WEAPON_M249, M249_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
{ WEAPON_M3, M3_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_BUCKSHOT_PRICE },
{ WEAPON_M4A1, M4A1_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
{ WEAPON_TMP, TMP_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, AMMO_9MM_PRICE },
{ WEAPON_G3SG1, G3SG1_PRICE, CT, AUTOBUYCLASS_PRIMARY, AMMO_762MM_PRICE },
{ WEAPON_DEAGLE, DEAGLE_PRICE, TERRORIST|CT, AUTOBUYCLASS_SECONDARY, AMMO_50AE_PRICE },
{ WEAPON_SG552, SG552_PRICE, CT, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
{ WEAPON_AK47, AK47_PRICE, CT, AUTOBUYCLASS_PRIMARY, AMMO_762MM_PRICE },
{ WEAPON_P90, P90_PRICE, TERRORIST|CT, AUTOBUYCLASS_PRIMARY, AMMO_57MM_PRICE },
{ WEAPON_FAMAS, FAMAS_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
{ WEAPON_GALIL, GALIL_PRICE, CT, AUTOBUYCLASS_PRIMARY, AMMO_556MM_PRICE },
// TODO: this have bug, the cost of galil $2000, but not $2250
{ WEAPON_SHIELDGUN, SHIELDGUN_PRICE, TERRORIST, AUTOBUYCLASS_PRIMARY, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 }
};
AutoBuyInfoStruct g_autoBuyInfo[] = AutoBuyInfoStruct g_autoBuyInfo[] =
{ {
{ AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_RIFLE, "galil", "weapon_galil" }, { AUTOBUYCLASS_PRIMARY|AUTOBUYCLASS_RIFLE, "galil", "weapon_galil" },

View File

@ -359,6 +359,15 @@ enum Bullet
BULLET_PLAYER_357SIG, BULLET_PLAYER_357SIG,
}; };
struct WeaponStruct
{
int m_type;
int m_price;
int m_side;
int m_slot;
int m_ammoPrice;
};
struct AutoBuyInfoStruct struct AutoBuyInfoStruct
{ {
AutoBuyClassType m_class; AutoBuyClassType m_class;
@ -398,6 +407,7 @@ struct WeaponInfoStruct
}; };
extern AutoBuyInfoStruct g_autoBuyInfo[35]; extern AutoBuyInfoStruct g_autoBuyInfo[35];
extern WeaponStruct g_weaponStruct[MAX_WEAPONS];
// WeaponType // WeaponType
WeaponIdType AliasToWeaponID(const char *alias); WeaponIdType AliasToWeaponID(const char *alias);

View File

@ -430,7 +430,7 @@ void CWorld::__MAKE_VHOOK(Spawn)()
int flength = 0; int flength = 0;
char *pFile = (char *)LOAD_FILE_FOR_ME(UTIL_VarArgs("maps/%s.txt", STRING(gpGlobals->mapname)), &flength); char *pFile = (char *)LOAD_FILE_FOR_ME(UTIL_VarArgs("maps/%s.txt", STRING(gpGlobals->mapname)), &flength);
if (pFile && flength != NULL) if (pFile != NULL && flength)
{ {
Q_strncpy(g_szMapBriefingText, pFile, ARRAYSIZE(g_szMapBriefingText) - 2); Q_strncpy(g_szMapBriefingText, pFile, ARRAYSIZE(g_szMapBriefingText) - 2);
@ -600,6 +600,7 @@ void CWorld::__MAKE_VHOOK(Precache)()
for (int i = 0; i < ARRAYSIZE(gDecals); ++i) for (int i = 0; i < ARRAYSIZE(gDecals); ++i)
gDecals[i].index = DECAL_INDEX(gDecals[i].name); gDecals[i].index = DECAL_INDEX(gDecals[i].name);
#ifndef REGAMEDLL_FIXES
// init the WorldGraph. // init the WorldGraph.
WorldGraph.InitGraph(); WorldGraph.InitGraph();
@ -623,6 +624,7 @@ void CWorld::__MAKE_VHOOK(Precache)()
ALERT(at_console, "\n*Graph Loaded!\n"); ALERT(at_console, "\n*Graph Loaded!\n");
} }
} }
#endif
if (pev->speed > 0) if (pev->speed > 0)
CVAR_SET_FLOAT("sv_zmax", pev->speed); CVAR_SET_FLOAT("sv_zmax", pev->speed);

View File

@ -0,0 +1,15 @@
#pragma once
#include "maintypes.h"
#include "interface.h"
class IGameServerData : public IBaseInterface {
public:
virtual ~IGameServerData() { };
virtual void WriteDataRequest(const void *buffer, int bufferSize) = 0;
virtual int ReadDataResponse(void *data, int len) = 0;
};
#define GAMESERVERDATA_INTERFACE_VERSION "GameServerData001"

View File

@ -0,0 +1,201 @@
//---------------------------------------------------------------------------
//
// S c r i p t e d S e q u e n c e s
//
//---------------------------------------------------------------------------
#ifndef _INCLUDE_SEQUENCE_H_
#define _INCLUDE_SEQUENCE_H_
#ifndef _DEF_BYTE_
typedef unsigned char byte;
#endif
//---------------------------------------------------------------------------
// client_textmessage_t
//---------------------------------------------------------------------------
typedef struct client_textmessage_s
{
int effect;
byte r1, g1, b1, a1; // 2 colors for effects
byte r2, g2, b2, a2;
float x;
float y;
float fadein;
float fadeout;
float holdtime;
float fxtime;
const char *pName;
const char *pMessage;
} client_textmessage_t;
//--------------------------------------------------------------------------
// sequenceDefaultBits_e
//
// Enumerated list of possible modifiers for a command. This enumeration
// is used in a bitarray controlling what modifiers are specified for a command.
//---------------------------------------------------------------------------
enum sequenceModifierBits
{
SEQUENCE_MODIFIER_EFFECT_BIT = (1 << 1),
SEQUENCE_MODIFIER_POSITION_BIT = (1 << 2),
SEQUENCE_MODIFIER_COLOR_BIT = (1 << 3),
SEQUENCE_MODIFIER_COLOR2_BIT = (1 << 4),
SEQUENCE_MODIFIER_FADEIN_BIT = (1 << 5),
SEQUENCE_MODIFIER_FADEOUT_BIT = (1 << 6),
SEQUENCE_MODIFIER_HOLDTIME_BIT = (1 << 7),
SEQUENCE_MODIFIER_FXTIME_BIT = (1 << 8),
SEQUENCE_MODIFIER_SPEAKER_BIT = (1 << 9),
SEQUENCE_MODIFIER_LISTENER_BIT = (1 << 10),
SEQUENCE_MODIFIER_TEXTCHANNEL_BIT = (1 << 11),
};
typedef enum sequenceModifierBits sequenceModifierBits_e ;
//---------------------------------------------------------------------------
// sequenceCommandEnum_e
//
// Enumerated sequence command types.
//---------------------------------------------------------------------------
enum sequenceCommandEnum_
{
SEQUENCE_COMMAND_ERROR = -1,
SEQUENCE_COMMAND_PAUSE = 0,
SEQUENCE_COMMAND_FIRETARGETS,
SEQUENCE_COMMAND_KILLTARGETS,
SEQUENCE_COMMAND_TEXT,
SEQUENCE_COMMAND_SOUND,
SEQUENCE_COMMAND_GOSUB,
SEQUENCE_COMMAND_SENTENCE,
SEQUENCE_COMMAND_REPEAT,
SEQUENCE_COMMAND_SETDEFAULTS,
SEQUENCE_COMMAND_MODIFIER,
SEQUENCE_COMMAND_POSTMODIFIER,
SEQUENCE_COMMAND_NOOP,
SEQUENCE_MODIFIER_EFFECT,
SEQUENCE_MODIFIER_POSITION,
SEQUENCE_MODIFIER_COLOR,
SEQUENCE_MODIFIER_COLOR2,
SEQUENCE_MODIFIER_FADEIN,
SEQUENCE_MODIFIER_FADEOUT,
SEQUENCE_MODIFIER_HOLDTIME,
SEQUENCE_MODIFIER_FXTIME,
SEQUENCE_MODIFIER_SPEAKER,
SEQUENCE_MODIFIER_LISTENER,
SEQUENCE_MODIFIER_TEXTCHANNEL,
};
typedef enum sequenceCommandEnum_ sequenceCommandEnum_e;
//---------------------------------------------------------------------------
// sequenceCommandType_e
//
// Typeerated sequence command types.
//---------------------------------------------------------------------------
enum sequenceCommandType_
{
SEQUENCE_TYPE_COMMAND,
SEQUENCE_TYPE_MODIFIER,
};
typedef enum sequenceCommandType_ sequenceCommandType_e;
//---------------------------------------------------------------------------
// sequenceCommandMapping_s
//
// A mapping of a command enumerated-value to its name.
//---------------------------------------------------------------------------
typedef struct sequenceCommandMapping_ sequenceCommandMapping_s;
struct sequenceCommandMapping_
{
sequenceCommandEnum_e commandEnum;
const char* commandName;
sequenceCommandType_e commandType;
};
//---------------------------------------------------------------------------
// sequenceCommandLine_s
//
// Structure representing a single command (usually 1 line) from a
// .SEQ file entry.
//---------------------------------------------------------------------------
typedef struct sequenceCommandLine_ sequenceCommandLine_s;
struct sequenceCommandLine_
{
int commandType; // Specifies the type of command
client_textmessage_t clientMessage; // Text HUD message struct
char* speakerName; // Targetname of speaking entity
char* listenerName; // Targetname of entity being spoken to
char* soundFileName; // Name of sound file to play
char* sentenceName; // Name of sentences.txt to play
char* fireTargetNames; // List of targetnames to fire
char* killTargetNames; // List of targetnames to remove
float delay; // Seconds 'till next command
int repeatCount; // If nonzero, reset execution pointer to top of block (N times, -1 = infinite)
int textChannel; // Display channel on which text message is sent
int modifierBitField; // Bit field to specify what clientmessage fields are valid
sequenceCommandLine_s* nextCommandLine; // Next command (linked list)
};
//---------------------------------------------------------------------------
// sequenceEntry_s
//
// Structure representing a single command (usually 1 line) from a
// .SEQ file entry.
//---------------------------------------------------------------------------
typedef struct sequenceEntry_ sequenceEntry_s;
struct sequenceEntry_
{
char* fileName; // Name of sequence file without .SEQ extension
char* entryName; // Name of entry label in file
sequenceCommandLine_s* firstCommand; // Linked list of commands in entry
sequenceEntry_s* nextEntry; // Next loaded entry
qboolean isGlobal; // Is entry retained over level transitions?
};
//---------------------------------------------------------------------------
// sentenceEntry_s
// Structure representing a single sentence of a group from a .SEQ
// file entry. Sentences are identical to entries in sentences.txt, but
// can be unique per level and are loaded/unloaded with the level.
//---------------------------------------------------------------------------
typedef struct sentenceEntry_ sentenceEntry_s;
struct sentenceEntry_
{
char* data; // sentence data (ie "We have hostiles" )
sentenceEntry_s* nextEntry; // Next loaded entry
qboolean isGlobal; // Is entry retained over level transitions?
unsigned int index; // this entry's position in the file.
};
//--------------------------------------------------------------------------
// sentenceGroupEntry_s
// Structure representing a group of sentences found in a .SEQ file.
// A sentence group is defined by all sentences with the same name, ignoring
// the number at the end of the sentence name. Groups enable a sentence
// to be picked at random across a group.
//--------------------------------------------------------------------------
typedef struct sentenceGroupEntry_ sentenceGroupEntry_s;
struct sentenceGroupEntry_
{
char* groupName; // name of the group (ie CT_ALERT )
unsigned int numSentences; // number of sentences in group
sentenceEntry_s* firstSentence; // head of linked list of sentences in group
sentenceGroupEntry_s* nextEntry; // next loaded group
};
//---------------------------------------------------------------------------
// Function declarations
//---------------------------------------------------------------------------
sequenceEntry_s* SequenceGet( const char* fileName, const char* entryName );
void Sequence_ParseFile( const char* fileName, qboolean isGlobal );
void Sequence_OnLevelLoad( const char* mapName );
sentenceEntry_s* SequencePickSentence( const char *groupName, int pickMethod, int *picked );
#endif // _INCLUDE_SEQUENCE_H_

View File

@ -0,0 +1,703 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
/*
** The copyright to the contents herein is the property of Valve Corporation.
** The contents may be used and/or copied only with the written permission of
** Valve, or in accordance with the terms and conditions stipulated in
** the agreement/contract under which the contents have been supplied.
**
*******************************************************************************
**
** Contents:
**
** Common types used in the Steam DLL interface.
**
** This file is distributed to Steam application developers.
**
**
**
*******************************************************************************/
#ifndef INCLUDED_STEAM_COMMON_STEAMCOMMON_H
#define INCLUDED_STEAM_COMMON_STEAMCOMMON_H
#if defined(_MSC_VER) && (_MSC_VER > 1000)
#pragma once
#endif
#ifdef __cplusplus
extern "C"
{
#endif
/* Applications should not define STEAM_EXPORTS. */
#if defined ( _WIN32 )
#ifdef STEAM_EXPORTS
#define STEAM_API __declspec(dllexport)
#else
#define STEAM_API __declspec(dllimport)
#endif
#define STEAM_CALL __cdecl
#else
#define STEAM_API /* */
#define STEAM_CALL /* */
#endif
typedef void (STEAM_CALL *KeyValueIteratorCallback_t )(const char *Key, const char *Val, void *pvParam);
/******************************************************************************
**
** Exported macros and constants
**
******************************************************************************/
/* DEPRECATED -- these are ignored now, all API access is granted on SteamStartup */
#define STEAM_USING_FILESYSTEM (0x00000001)
#define STEAM_USING_LOGGING (0x00000002)
#define STEAM_USING_USERID (0x00000004)
#define STEAM_USING_ACCOUNT (0x00000008)
#define STEAM_USING_ALL (0x0000000f)
/* END DEPRECATED */
#define STEAM_MAX_PATH (255)
#define STEAM_QUESTION_MAXLEN (255)
#define STEAM_SALT_SIZE (8)
#define STEAM_PROGRESS_PERCENT_SCALE (0x00001000)
/* These are maximum significant string lengths, excluding nul-terminator. */
#define STEAM_CARD_NUMBER_SIZE (17)
#define STEAM_CARD_HOLDERNAME_SIZE (100)
#define STEAM_CARD_EXPYEAR_SIZE (4)
#define STEAM_CARD_EXPMONTH_SIZE (2)
#define STEAM_CARD_CVV2_SIZE (5)
#define STEAM_BILLING_ADDRESS1_SIZE (128)
#define STEAM_BILLING_ADDRESS2_SIZE (128)
#define STEAM_BILLING_CITY_SIZE (50)
#define STEAM_BILLING_ZIP_SIZE (16)
#define STEAM_BILLING_STATE_SIZE (32)
#define STEAM_BILLING_COUNTRY_SIZE (32)
#define STEAM_BILLING_PHONE_SIZE (20)
#define STEAM_BILLING_EMAIL_ADDRESS_SIZE (100)
#define STEAM_TYPE_OF_PROOF_OF_PURCHASE_SIZE (20)
#define STEAM_PROOF_OF_PURCHASE_TOKEN_SIZE (200)
#define STEAM_EXTERNAL_ACCOUNTNAME_SIZE (100)
#define STEAM_EXTERNAL_ACCOUNTPASSWORD_SIZE (80)
#define STEAM_BILLING_CONFIRMATION_CODE_SIZE (22)
#define STEAM_BILLING_CARD_APPROVAL_CODE_SIZE (100)
#define STEAM_BILLING_TRANS_DATE_SIZE (9) // mm/dd/yy
#define STEAM_BILLING_TRANS_TIME_SIZE (9) // hh:mm:ss
/******************************************************************************
**
** Scalar type and enumerated type definitions.
**
******************************************************************************/
typedef unsigned int SteamHandle_t;
typedef void * SteamUserIDTicketValidationHandle_t;
typedef unsigned int SteamCallHandle_t;
#if defined(_MSC_VER)
typedef unsigned __int64 SteamUnsigned64_t;
#else
typedef unsigned long long SteamUnsigned64_t;
#endif
typedef enum
{
eSteamSeekMethodSet = 0,
eSteamSeekMethodCur = 1,
eSteamSeekMethodEnd = 2
} ESteamSeekMethod;
typedef enum
{
eSteamBufferMethodFBF = 0,
eSteamBufferMethodNBF = 1
} ESteamBufferMethod;
typedef enum
{
eSteamErrorNone = 0,
eSteamErrorUnknown = 1,
eSteamErrorLibraryNotInitialized = 2,
eSteamErrorLibraryAlreadyInitialized = 3,
eSteamErrorConfig = 4,
eSteamErrorContentServerConnect = 5,
eSteamErrorBadHandle = 6,
eSteamErrorHandlesExhausted = 7,
eSteamErrorBadArg = 8,
eSteamErrorNotFound = 9,
eSteamErrorRead = 10,
eSteamErrorEOF = 11,
eSteamErrorSeek = 12,
eSteamErrorCannotWriteNonUserConfigFile = 13,
eSteamErrorCacheOpen = 14,
eSteamErrorCacheRead = 15,
eSteamErrorCacheCorrupted = 16,
eSteamErrorCacheWrite = 17,
eSteamErrorCacheSession = 18,
eSteamErrorCacheInternal = 19,
eSteamErrorCacheBadApp = 20,
eSteamErrorCacheVersion = 21,
eSteamErrorCacheBadFingerPrint = 22,
eSteamErrorNotFinishedProcessing = 23,
eSteamErrorNothingToDo = 24,
eSteamErrorCorruptEncryptedUserIDTicket = 25,
eSteamErrorSocketLibraryNotInitialized = 26,
eSteamErrorFailedToConnectToUserIDTicketValidationServer = 27,
eSteamErrorBadProtocolVersion = 28,
eSteamErrorReplayedUserIDTicketFromClient = 29,
eSteamErrorReceiveResultBufferTooSmall = 30,
eSteamErrorSendFailed = 31,
eSteamErrorReceiveFailed = 32,
eSteamErrorReplayedReplyFromUserIDTicketValidationServer = 33,
eSteamErrorBadSignatureFromUserIDTicketValidationServer = 34,
eSteamErrorValidationStalledSoAborted = 35,
eSteamErrorInvalidUserIDTicket = 36,
eSteamErrorClientLoginRateTooHigh = 37,
eSteamErrorClientWasNeverValidated = 38,
eSteamErrorInternalSendBufferTooSmall = 39,
eSteamErrorInternalReceiveBufferTooSmall = 40,
eSteamErrorUserTicketExpired = 41,
eSteamErrorCDKeyAlreadyInUseOnAnotherClient = 42,
eSteamErrorNotLoggedIn = 101,
eSteamErrorAlreadyExists = 102,
eSteamErrorAlreadySubscribed = 103,
eSteamErrorNotSubscribed = 104,
eSteamErrorAccessDenied = 105,
eSteamErrorFailedToCreateCacheFile = 106,
eSteamErrorCallStalledSoAborted = 107,
eSteamErrorEngineNotRunning = 108,
eSteamErrorEngineConnectionLost = 109,
eSteamErrorLoginFailed = 110,
eSteamErrorAccountPending = 111,
eSteamErrorCacheWasMissingRetry = 112,
eSteamErrorLocalTimeIncorrect = 113,
eSteamErrorCacheNeedsDecryption = 114,
eSteamErrorAccountDisabled = 115,
eSteamErrorCacheNeedsRepair = 116,
eSteamErrorRebootRequired = 117,
eSteamErrorNetwork = 200,
eSteamErrorOffline = 201
} ESteamError;
typedef enum
{
eNoDetailedErrorAvailable,
eStandardCerrno,
eWin32LastError,
eWinSockLastError,
eDetailedPlatformErrorCount
} EDetailedPlatformErrorType;
typedef enum /* Filter elements returned by SteamFind{First,Next} */
{
eSteamFindLocalOnly, /* limit search to local filesystem */
eSteamFindRemoteOnly, /* limit search to remote repository */
eSteamFindAll /* do not limit search (duplicates allowed) */
} ESteamFindFilter;
/******************************************************************************
**
** Exported structure and complex type definitions.
**
******************************************************************************/
typedef struct
{
ESteamError eSteamError;
EDetailedPlatformErrorType eDetailedErrorType;
int nDetailedErrorCode;
char szDesc[STEAM_MAX_PATH];
} TSteamError;
typedef struct
{
int bIsDir; /* If non-zero, element is a directory; if zero, element is a file */
unsigned int uSizeOrCount; /* If element is a file, this contains size of file in bytes */
int bIsLocal; /* If non-zero, reported item is a standalone element on local filesystem */
char cszName[STEAM_MAX_PATH]; /* Base element name (no path) */
long lLastAccessTime; /* Seconds since 1/1/1970 (like time_t) when element was last accessed */
long lLastModificationTime; /* Seconds since 1/1/1970 (like time_t) when element was last modified */
long lCreationTime; /* Seconds since 1/1/1970 (like time_t) when element was created */
} TSteamElemInfo;
typedef struct
{
unsigned int uNumSubscriptions;
unsigned int uMaxNameChars;
unsigned int uMaxApps;
} TSteamSubscriptionStats;
typedef struct
{
unsigned int uNumApps;
unsigned int uMaxNameChars;
unsigned int uMaxInstallDirNameChars;
unsigned int uMaxVersionLabelChars;
unsigned int uMaxLaunchOptions;
unsigned int uMaxLaunchOptionDescChars;
unsigned int uMaxLaunchOptionCmdLineChars;
unsigned int uMaxNumIcons;
unsigned int uMaxIconSize;
unsigned int uMaxDependencies;
} TSteamAppStats;
typedef struct
{
char *szLabel;
unsigned int uMaxLabelChars;
unsigned int uVersionId;
int bIsNotAvailable;
} TSteamAppVersion;
typedef struct
{
char *szDesc;
unsigned int uMaxDescChars;
char *szCmdLine;
unsigned int uMaxCmdLineChars;
unsigned int uIndex;
unsigned int uIconIndex;
int bNoDesktopShortcut;
int bNoStartMenuShortcut;
int bIsLongRunningUnattended;
} TSteamAppLaunchOption;
typedef struct
{
char *szName;
unsigned int uMaxNameChars;
char *szLatestVersionLabel;
unsigned int uMaxLatestVersionLabelChars;
char *szCurrentVersionLabel;
unsigned int uMaxCurrentVersionLabelChars;
char *szInstallDirName;
unsigned int uMaxInstallDirNameChars;
unsigned int uId;
unsigned int uLatestVersionId;
unsigned int uCurrentVersionId;
unsigned int uMinCacheFileSizeMB;
unsigned int uMaxCacheFileSizeMB;
unsigned int uNumLaunchOptions;
unsigned int uNumIcons;
unsigned int uNumVersions;
unsigned int uNumDependencies;
} TSteamApp;
typedef enum
{
eNoCost = 0,
eBillOnceOnly = 1,
eBillMonthly = 2,
eProofOfPrepurchaseOnly = 3,
eGuestPass = 4,
eHardwarePromo = 5,
eNumBillingTypes,
} EBillingType;
typedef struct
{
char *szName;
unsigned int uMaxNameChars;
unsigned int *puAppIds;
unsigned int uMaxAppIds;
unsigned int uId;
unsigned int uNumApps;
EBillingType eBillingType;
unsigned int uCostInCents;
unsigned int uNumDiscounts;
int bIsPreorder;
int bRequiresShippingAddress;
unsigned int uDomesticShippingCostInCents;
unsigned int uInternationalShippingCostInCents;
bool bIsCyberCafeSubscription;
unsigned int uGameCode;
char szGameCodeDesc[STEAM_MAX_PATH];
bool bIsDisabled;
bool bRequiresCD;
unsigned int uTerritoryCode;
bool bIsSteam3Subscription;
} TSteamSubscription;
typedef struct
{
char szName[STEAM_MAX_PATH];
unsigned int uDiscountInCents;
unsigned int uNumQualifiers;
} TSteamSubscriptionDiscount;
typedef struct
{
char szName[STEAM_MAX_PATH];
unsigned int uRequiredSubscription;
int bIsDisqualifier;
} TSteamDiscountQualifier;
typedef struct TSteamProgress
{
int bValid; /* non-zero if call provides progress info */
unsigned int uPercentDone; /* 0 to 100 * STEAM_PROGRESS_PERCENT_SCALE if bValid */
char szProgress[STEAM_MAX_PATH]; /* additional progress info */
} TSteamProgress;
typedef enum
{
eSteamNotifyTicketsWillExpire,
eSteamNotifyAccountInfoChanged,
eSteamNotifyContentDescriptionChanged,
eSteamNotifyPleaseShutdown,
eSteamNotifyNewContentServer,
eSteamNotifySubscriptionStatusChanged,
eSteamNotifyContentServerConnectionLost,
eSteamNotifyCacheLoadingCompleted,
eSteamNotifyCacheNeedsDecryption,
eSteamNotifyCacheNeedsRepair
} ESteamNotificationCallbackEvent;
typedef void(*SteamNotificationCallback_t)(ESteamNotificationCallbackEvent eEvent, unsigned int nData);
typedef char SteamPersonalQuestion_t[ STEAM_QUESTION_MAXLEN + 1 ];
typedef struct
{
unsigned char uchSalt[STEAM_SALT_SIZE];
} SteamSalt_t;
typedef enum
{
eVisa = 1,
eMaster = 2,
eAmericanExpress = 3,
eDiscover = 4,
eDinnersClub = 5,
eJCB = 6
} ESteamPaymentCardType;
typedef struct
{
ESteamPaymentCardType eCardType;
char szCardNumber[ STEAM_CARD_NUMBER_SIZE +1 ];
char szCardHolderName[ STEAM_CARD_HOLDERNAME_SIZE + 1];
char szCardExpYear[ STEAM_CARD_EXPYEAR_SIZE + 1 ];
char szCardExpMonth[ STEAM_CARD_EXPMONTH_SIZE+ 1 ];
char szCardCVV2[ STEAM_CARD_CVV2_SIZE + 1 ];
char szBillingAddress1[ STEAM_BILLING_ADDRESS1_SIZE + 1 ];
char szBillingAddress2[ STEAM_BILLING_ADDRESS2_SIZE + 1 ];
char szBillingCity[ STEAM_BILLING_CITY_SIZE + 1 ];
char szBillingZip[ STEAM_BILLING_ZIP_SIZE + 1 ];
char szBillingState[ STEAM_BILLING_STATE_SIZE + 1 ];
char szBillingCountry[ STEAM_BILLING_COUNTRY_SIZE + 1 ];
char szBillingPhone[ STEAM_BILLING_PHONE_SIZE + 1 ];
char szBillingEmailAddress[ STEAM_BILLING_EMAIL_ADDRESS_SIZE + 1 ];
unsigned int uExpectedCostInCents;
unsigned int uExpectedTaxInCents;
/* If the TSteamSubscription says that shipping info is required, */
/* then the following fields must be filled out. */
/* If szShippingName is empty, then assumes so are the rest. */
char szShippingName[ STEAM_CARD_HOLDERNAME_SIZE + 1];
char szShippingAddress1[ STEAM_BILLING_ADDRESS1_SIZE + 1 ];
char szShippingAddress2[ STEAM_BILLING_ADDRESS2_SIZE + 1 ];
char szShippingCity[ STEAM_BILLING_CITY_SIZE + 1 ];
char szShippingZip[ STEAM_BILLING_ZIP_SIZE + 1 ];
char szShippingState[ STEAM_BILLING_STATE_SIZE + 1 ];
char szShippingCountry[ STEAM_BILLING_COUNTRY_SIZE + 1 ];
char szShippingPhone[ STEAM_BILLING_PHONE_SIZE + 1 ];
unsigned int uExpectedShippingCostInCents;
} TSteamPaymentCardInfo;
typedef struct
{
char szTypeOfProofOfPurchase[ STEAM_TYPE_OF_PROOF_OF_PURCHASE_SIZE + 1 ];
/* A ProofOfPurchase token is not necessarily a nul-terminated string; it may be binary data
(perhaps encrypted). Hence we need a length and an array of bytes. */
unsigned int uLengthOfBinaryProofOfPurchaseToken;
char cBinaryProofOfPurchaseToken[ STEAM_PROOF_OF_PURCHASE_TOKEN_SIZE + 1 ];
} TSteamPrepurchaseInfo;
typedef struct
{
char szAccountName[ STEAM_EXTERNAL_ACCOUNTNAME_SIZE + 1 ];
char szPassword[ STEAM_EXTERNAL_ACCOUNTPASSWORD_SIZE + 1 ];
} TSteamExternalBillingInfo;
typedef enum
{
ePaymentCardInfo = 1,
ePrepurchasedInfo = 2,
eAccountBillingInfo = 3,
eExternalBillingInfo = 4, /* indirect billing via ISP etc (not supported yet) */
ePaymentCardReceipt = 5,
ePrepurchaseReceipt = 6,
eEmptyReceipt = 7
} ESteamSubscriptionBillingInfoType;
typedef struct
{
ESteamSubscriptionBillingInfoType eBillingInfoType;
union {
TSteamPaymentCardInfo PaymentCardInfo;
TSteamPrepurchaseInfo PrepurchaseInfo;
TSteamExternalBillingInfo ExternalBillingInfo;
char bUseAccountBillingInfo;
};
} TSteamSubscriptionBillingInfo;
typedef enum
{
/* Subscribed */
eSteamSubscriptionOK = 0, /* Subscribed */
eSteamSubscriptionPending = 1, /* Awaiting transaction completion */
eSteamSubscriptionPreorder = 2, /* Is currently a pre-order */
eSteamSubscriptionPrepurchaseTransferred = 3, /* hop to this account */
/* Unusbscribed */
eSteamSubscriptionPrepurchaseInvalid = 4, /* Invalid cd-key */
eSteamSubscriptionPrepurchaseRejected = 5, /* hopped out / banned / etc */
eSteamSubscriptionPrepurchaseRevoked = 6, /* hop away from this account */
eSteamSubscriptionPaymentCardDeclined = 7, /* CC txn declined */
eSteamSubscriptionCancelledByUser = 8, /* Cancelled by client */
eSteamSubscriptionCancelledByVendor = 9, /* Cancelled by us */
eSteamSubscriptionPaymentCardUseLimit = 10, /* Card used too many times, potential fraud */
eSteamSubscriptionPaymentCardAlert = 11, /* Got a "pick up card" or the like from bank */
eSteamSubscriptionFailed = 12, /* Other Error in subscription data or transaction failed/lost */
eSteamSubscriptionPaymentCardAVSFailure = 13, /* Card failed Address Verification check */
eSteamSubscriptionPaymentCardInsufficientFunds = 14, /* Card failed due to insufficient funds */
eSteamSubscriptionRestrictedCountry = 15 /* The subscription is not available in the user's country */
} ESteamSubscriptionStatus;
typedef struct
{
ESteamPaymentCardType eCardType;
char szCardLastFourDigits[ 4 + 1 ];
char szCardHolderName[ STEAM_CARD_HOLDERNAME_SIZE + 1];
char szBillingAddress1[ STEAM_BILLING_ADDRESS1_SIZE + 1 ];
char szBillingAddress2[ STEAM_BILLING_ADDRESS2_SIZE + 1 ];
char szBillingCity[ STEAM_BILLING_CITY_SIZE + 1 ];
char szBillingZip[ STEAM_BILLING_ZIP_SIZE + 1 ];
char szBillingState[ STEAM_BILLING_STATE_SIZE + 1 ];
char szBillingCountry[ STEAM_BILLING_COUNTRY_SIZE + 1 ];
// The following are only available after the subscription leaves "pending" status
char szCardApprovalCode[ STEAM_BILLING_CARD_APPROVAL_CODE_SIZE + 1];
char szTransDate[ STEAM_BILLING_TRANS_DATE_SIZE + 1]; /* mm/dd/yy */
char szTransTime[ STEAM_BILLING_TRANS_TIME_SIZE + 1]; /* hh:mm:ss */
unsigned int uPriceWithoutTax;
unsigned int uTaxAmount;
unsigned int uShippingCost;
} TSteamPaymentCardReceiptInfo;
typedef struct
{
char szTypeOfProofOfPurchase[ STEAM_TYPE_OF_PROOF_OF_PURCHASE_SIZE + 1 ];
} TSteamPrepurchaseReceiptInfo;
typedef struct
{
ESteamSubscriptionStatus eStatus;
ESteamSubscriptionStatus ePreviousStatus;
ESteamSubscriptionBillingInfoType eReceiptInfoType;
char szConfirmationCode[ STEAM_BILLING_CONFIRMATION_CODE_SIZE + 1];
union {
TSteamPaymentCardReceiptInfo PaymentCardReceiptInfo;
TSteamPrepurchaseReceiptInfo PrepurchaseReceiptInfo;
};
} TSteamSubscriptionReceipt;
typedef enum
{
ePhysicalBytesReceivedThisSession = 1,
eAppReadyToLaunchStatus = 2,
eAppPreloadStatus = 3,
eAppEntireDepot = 4,
eCacheBytesPresent = 5
} ESteamAppUpdateStatsQueryType;
typedef struct
{
SteamUnsigned64_t uBytesTotal;
SteamUnsigned64_t uBytesPresent;
} TSteamUpdateStats;
typedef enum
{
eSteamUserAdministrator = 0x00000001, /* May subscribe, unsubscribe, etc */
eSteamUserDeveloper = 0x00000002, /* Steam or App developer */
eSteamUserCyberCafe = 0x00000004 /* CyberCafe, school, etc -- UI should ask for password */
/* before allowing logout, unsubscribe, etc */
} ESteamUserTypeFlags;
typedef enum
{
eSteamAccountStatusDefault = 0x00000000,
eSteamAccountStatusEmailVerified = 0x00000001,
/* Note: Mask value 0x2 is reserved for future use. (Some, but not all, public accounts already have this set.) */
eSteamAccountDisabled = 0x00000004
} ESteamAccountStatusBitFields ;
typedef enum
{
eSteamBootstrapperError = -1,
eSteamBootstrapperDontCheckForUpdate = 0,
eSteamBootstrapperCheckForUpdateAndRerun = 7
} ESteamBootStrapperClientAppResult;
typedef enum
{
eSteamOnline = 0,
eSteamOffline = 1,
eSteamNoAuthMode = 2,
eSteamBillingOffline = 3
} eSteamOfflineStatus;
typedef struct
{
int eOfflineNow;
int eOfflineNextSession;
} TSteamOfflineStatus;
typedef struct
{
unsigned int uAppId;
int bIsSystemDefined;
char szMountPath[STEAM_MAX_PATH];
} TSteamAppDependencyInfo;
typedef enum
{
eSteamOpenFileRegular = 0x0,
eSteamOpenFileIgnoreLocal = 0x1,
eSteamOpenFileChecksumReads = 0x2
} ESteamOpenFileFlags;
typedef enum
{
eSteamValveCDKeyValidationServer = 0,
eSteamHalfLifeMasterServer = 1,
eSteamFriendsServer = 2,
eSteamCSERServer = 3,
eSteamHalfLife2MasterServer = 4,
eSteamRDKFMasterServer = 5,
eMaxServerTypes = 6
} ESteamServerType;
/******************************************************************************
**
** More exported constants
**
******************************************************************************/
#ifdef __cplusplus
const SteamHandle_t STEAM_INVALID_HANDLE = 0;
const SteamCallHandle_t STEAM_INVALID_CALL_HANDLE = 0;
const SteamUserIDTicketValidationHandle_t STEAM_INACTIVE_USERIDTICKET_VALIDATION_HANDLE = 0;
const unsigned int STEAM_USE_LATEST_VERSION = 0xFFFFFFFF;
#else
#define STEAM_INVALID_HANDLE ((SteamHandle_t)(0))
#define STEAM_INVALID_CALL_HANDLE ((SteamCallHandle_t)(0))
#define STEAM_INACTIVE_USERIDTICKET_VALIDATION_HANDLE ((SteamUserIDTicketValidationHandle_t)(0))
#define STEAM_USE_LATEST_VERSION (0xFFFFFFFFu);
#endif
/******************************************************************************
** Each Steam instance (licensed Steam Service Provider) has a unique SteamInstanceID_t.
**
** Each Steam instance as its own DB of users.
** Each user in the DB has a unique SteamLocalUserID_t (a serial number, with possible
** rare gaps in the sequence).
**
******************************************************************************/
typedef unsigned short SteamInstanceID_t; // MUST be 16 bits
#if defined ( _WIN32 )
typedef unsigned __int64 SteamLocalUserID_t; // MUST be 64 bits
#else
typedef unsigned long long SteamLocalUserID_t; // MUST be 64 bits
#endif
/******************************************************************************
**
** Applications need to be able to authenticate Steam users from ANY instance.
** So a SteamIDTicket contains SteamGlobalUserID, which is a unique combination of
** instance and user id.
**
** SteamLocalUserID is an unsigned 64-bit integer.
** For platforms without 64-bit int support, we provide access via a union that splits it into
** high and low unsigned 32-bit ints. Such platforms will only need to compare LocalUserIDs
** for equivalence anyway - not perform arithmetic with them.
**
********************************************************************************/
typedef struct
{
unsigned int Low32bits;
unsigned int High32bits;
} TSteamSplitLocalUserID;
typedef struct
{
SteamInstanceID_t m_SteamInstanceID;
union
{
SteamLocalUserID_t As64bits;
TSteamSplitLocalUserID Split;
} m_SteamLocalUserID;
} TSteamGlobalUserID;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,62 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined ( BEAMDEFH )
#define BEAMDEFH
#ifdef _WIN32
#pragma once
#endif
#define FBEAM_STARTENTITY 0x00000001
#define FBEAM_ENDENTITY 0x00000002
#define FBEAM_FADEIN 0x00000004
#define FBEAM_FADEOUT 0x00000008
#define FBEAM_SINENOISE 0x00000010
#define FBEAM_SOLID 0x00000020
#define FBEAM_SHADEIN 0x00000040
#define FBEAM_SHADEOUT 0x00000080
#define FBEAM_STARTVISIBLE 0x10000000 // Has this client actually seen this beam's start entity yet?
#define FBEAM_ENDVISIBLE 0x20000000 // Has this client actually seen this beam's end entity yet?
#define FBEAM_ISACTIVE 0x40000000
#define FBEAM_FOREVER 0x80000000
typedef struct beam_s BEAM;
struct beam_s
{
BEAM *next;
int type;
int flags;
vec3_t source;
vec3_t target;
vec3_t delta;
float t; // 0 .. 1 over lifetime of beam
float freq;
float die;
float width;
float amplitude;
float r, g, b;
float brightness;
float speed;
float frameRate;
float frame;
int segments;
int startEntity;
int endEntity;
int modelIndex;
int frameCount;
struct model_s *pFollowModel;
struct particle_s *particles;
};
#endif

View File

@ -0,0 +1,115 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
// cl_entity.h
#if !defined( CL_ENTITYH )
#define CL_ENTITYH
#ifdef _WIN32
#pragma once
#endif
typedef struct efrag_s
{
struct mleaf_s *leaf;
struct efrag_s *leafnext;
struct cl_entity_s *entity;
struct efrag_s *entnext;
} efrag_t;
typedef struct
{
byte mouthopen; // 0 = mouth closed, 255 = mouth agape
byte sndcount; // counter for running average
int sndavg; // running average
} mouth_t;
typedef struct
{
float prevanimtime;
float sequencetime;
byte prevseqblending[2];
vec3_t prevorigin;
vec3_t prevangles;
int prevsequence;
float prevframe;
byte prevcontroller[4];
byte prevblending[2];
} latchedvars_t;
typedef struct
{
// Time stamp for this movement
float animtime;
vec3_t origin;
vec3_t angles;
} position_history_t;
typedef struct cl_entity_s cl_entity_t;
#define HISTORY_MAX 64 // Must be power of 2
#define HISTORY_MASK ( HISTORY_MAX - 1 )
#if !defined( ENTITY_STATEH )
#include "entity_state.h"
#endif
#if !defined( PROGS_H )
#include "progs.h"
#endif
struct cl_entity_s
{
int index; // Index into cl_entities ( should match actual slot, but not necessarily )
qboolean player; // True if this entity is a "player"
entity_state_t baseline; // The original state from which to delta during an uncompressed message
entity_state_t prevstate; // The state information from the penultimate message received from the server
entity_state_t curstate; // The state information from the last message received from server
int current_position; // Last received history update index
position_history_t ph[ HISTORY_MAX ]; // History of position and angle updates for this player
mouth_t mouth; // For synchronizing mouth movements.
latchedvars_t latched; // Variables used by studio model rendering routines
// Information based on interplocation, extrapolation, prediction, or just copied from last msg received.
//
float lastmove;
// Actual render position and angles
vec3_t origin;
vec3_t angles;
// Attachment points
vec3_t attachment[4];
// Other entity local information
int trivial_accept;
struct model_s *model; // cl.model_precache[ curstate.modelindes ]; all visible entities have a model
struct efrag_s *efrag; // linked list of efrags
struct mnode_s *topnode; // for bmodels, first world node that splits bmodel, or NULL if not split
float syncbase; // for client-side animations -- used by obsolete alias animation system, remove?
int visframe; // last frame this entity was found in an active leaf
colorVec cvFloorColor;
};
#endif // !CL_ENTITYH

View File

@ -0,0 +1,340 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
// com_model.h
#pragma once
#define STUDIO_RENDER 1
#define STUDIO_EVENTS 2
//#define MAX_MODEL_NAME 64
//#define MAX_MAP_HULLS 4
//#define MIPLEVELS 4
//#define NUM_AMBIENTS 4 // automatic ambient sounds
//#define MAXLIGHTMAPS 4
#define PLANE_ANYZ 5
#define ALIAS_Z_CLIP_PLANE 5
// flags in finalvert_t.flags
#define ALIAS_LEFT_CLIP 0x0001
#define ALIAS_TOP_CLIP 0x0002
#define ALIAS_RIGHT_CLIP 0x0004
#define ALIAS_BOTTOM_CLIP 0x0008
#define ALIAS_Z_CLIP 0x0010
#define ALIAS_ONSEAM 0x0020
#define ALIAS_XY_CLIP_MASK 0x000F
#define ZISCALE ((float)0x8000)
#define CACHE_SIZE 32 // used to align key data structures
//typedef enum
//{
// mod_brush,
// mod_sprite,
// mod_alias,
// mod_studio
//} modtype_t;
// must match definition in modelgen.h
//#ifndef SYNCTYPE_T
//#define SYNCTYPE_T
//
//typedef enum
//{
// ST_SYNC=0,
// ST_RAND
//} synctype_t;
//
//#endif
//typedef struct
//{
// float mins[3], maxs[3];
// float origin[3];
// int headnode[MAX_MAP_HULLS];
// int visleafs; // not including the solid leaf 0
// int firstface, numfaces;
//} dmodel_t;
// plane_t structure
//typedef struct mplane_s
//{
// vec3_t normal; // surface normal
// float dist; // closest appoach to origin
// byte type; // for texture axis selection and fast side tests
// byte signbits; // signx + signy<<1 + signz<<1
// byte pad[2];
//} mplane_t;
//typedef struct
//{
// vec3_t position;
//} mvertex_t;
//typedef struct
//{
// unsigned short v[2];
// unsigned int cachededgeoffset;
//} medge_t;
//typedef struct texture_s
//{
// char name[16];
// unsigned width, height;
// 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
// unsigned paloffset;
//} texture_t;
//typedef struct
//{
// 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
// texture_t *texture;
// int flags; // sky or slime, no lightmap or 256 subdivision
//} mtexinfo_t;
//typedef struct mnode_s
//{
// // common with leaf
// int contents; // 0, to differentiate from leafs
// int visframe; // node needs to be traversed if current
//
// short minmaxs[6]; // for bounding box culling
//
// struct mnode_s *parent;
//
// // node specific
// mplane_t *plane;
// struct mnode_s *children[2];
//
// unsigned short firstsurface;
// unsigned short numsurfaces;
//} mnode_t;
//typedef struct msurface_s msurface_t;
//typedef struct decal_s decal_t;
// JAY: Compress this as much as possible
//struct decal_s
//{
// decal_t *pnext; // linked list for each surface
// msurface_t *psurface; // Surface id for persistence / unlinking
// short dx; // Offsets into surface texture (in texture coordinates, so we don't need floats)
// short dy;
// short texture; // Decal texture
// byte scale; // Pixel scale
// byte flags; // Decal flags
//
// short entityIndex; // Entity this is attached to
//};
//typedef struct mleaf_s
//{
// // common with node
// int contents; // wil be a negative contents number
// int visframe; // node needs to be traversed if current
//
// short minmaxs[6]; // for bounding box culling
//
// struct mnode_s *parent;
//
// // leaf specific
// byte *compressed_vis;
// struct efrag_s *efrags;
//
// msurface_t **firstmarksurface;
// int nummarksurfaces;
// int key; // BSP sequence number for leaf's contents
// byte ambient_sound_level[NUM_AMBIENTS];
//} mleaf_t;
//struct msurface_s
//{
// int visframe; // should be drawn when node is crossed
//
// int dlightframe; // last frame the surface was checked by an animated light
// int dlightbits; // dynamically generated. Indicates if the surface illumination
// // is modified by an animated light.
//
// mplane_t *plane; // pointer to shared plane
// int flags; // see SURF_ #defines
//
// int firstedge; // look up in model->surfedges[], negative numbers
// int numedges; // are backwards edges
//
// // surface generation data
// struct surfcache_s *cachespots[MIPLEVELS];
//
// short texturemins[2]; // smallest s/t position on the surface.
// short extents[2]; // ?? s/t texture size, 1..256 for all non-sky surfaces
//
// mtexinfo_t *texinfo;
//
// // lighting info
// byte styles[MAXLIGHTMAPS]; // index into d_lightstylevalue[] for animated lights
// // no one surface can be effected by more than 4
// // animated lights.
// color24 *samples;
//
// decal_t *pdecals;
//};
//typedef struct
//{
// int planenum;
// short children[2]; // negative numbers are contents
//} dclipnode_t;
//typedef struct hull_s
//{
// dclipnode_t *clipnodes;
// mplane_t *planes;
// int firstclipnode;
// int lastclipnode;
// vec3_t clip_mins;
// vec3_t clip_maxs;
//} hull_t;
typedef struct cache_user_s
{
void *data;
} cache_user_t;
//typedef struct model_s
//{
// char name[ MAX_MODEL_NAME ];
// qboolean needload; // bmodels and sprites don't cache normally
//
// modtype_t type;
// int numframes;
// synctype_t synctype;
//
// int flags;
//
// //
// // volume occupied by the model
// //
// vec3_t mins, maxs;
// float radius;
//
// //
// // brush model
// //
// int firstmodelsurface, nummodelsurfaces;
//
// int numsubmodels;
// dmodel_t *submodels;
//
// int numplanes;
// mplane_t *planes;
//
// int numleafs; // number of visible leafs, not counting 0
// struct mleaf_s *leafs;
//
// int numvertexes;
// mvertex_t *vertexes;
//
// int numedges;
// medge_t *edges;
//
// int numnodes;
// mnode_t *nodes;
//
// int numtexinfo;
// mtexinfo_t *texinfo;
//
// int numsurfaces;
// msurface_t *surfaces;
//
// int numsurfedges;
// int *surfedges;
//
// int numclipnodes;
// dclipnode_t *clipnodes;
//
// int nummarksurfaces;
// msurface_t **marksurfaces;
//
// hull_t hulls[MAX_MAP_HULLS];
//
// int numtextures;
// texture_t **textures;
//
// byte *visdata;
//
// color24 *lightdata;
//
// char *entities;
//
// //
// // additional model data
// //
// cache_user_t cache; // only access through Mod_Extradata
//
//} model_t;
//typedef vec_t vec4_t[4];
typedef struct alight_s
{
int ambientlight; // clip at 128
int shadelight; // clip at 192 - ambientlight
vec3_t color;
float *plightvec;
} alight_t;
typedef struct auxvert_s
{
float fv[3]; // viewspace x, y
} auxvert_t;
#include "custom.h"
//#define MAX_SCOREBOARDNAME 32
// Defined in client.h differently
//typedef struct player_info_s
//{
// // User id on server
// int userid;
//
// // User info string
// char userinfo[ MAX_INFO_STRING ];
//
// // Name
// char name[ MAX_SCOREBOARDNAME ];
//
// // Spectator or not, unused
// int spectator;
//
// int ping;
// int packet_loss;
//
// // skin information
// char model[MAX_QPATH];
// int topcolor;
// int bottomcolor;
//
// // last frame rendered
// int renderframe;
//
// // Gait frame estimation
// int gaitsequence;
// float gaitframe;
// float gaityaw;
// vec3_t prevgaitorigin;
//
// customization_t customdata;
//} player_info_t;

View File

@ -0,0 +1,38 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( CON_NPRINTH )
#define CON_NPRINTH
#ifdef _WIN32
#pragma once
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct con_nprint_s
{
int index; // Row #
float time_to_live; // # of seconds before it dissappears
float color[ 3 ]; // RGB colors ( 0.0 -> 1.0 scale )
} con_nprint_t;
void Con_NPrintf( int idx, const char *fmt, ... );
void Con_NXPrintf( struct con_nprint_s *info, const char *fmt, ... );
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,803 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef CONST_H
#define CONST_H
#ifdef _WIN32
#pragma once
#endif
// Max # of clients allowed in a server.
#define MAX_CLIENTS 32
// How many bits to use to encode an edict.
#define MAX_EDICT_BITS 11 // # of bits needed to represent max edicts
// Max # of edicts in a level (2048)
#define MAX_EDICTS (1<<MAX_EDICT_BITS)
// How many data slots to use when in multiplayer (must be power of 2)
#define MULTIPLAYER_BACKUP 64
// Same for single player
#define SINGLEPLAYER_BACKUP 8
//
// Constants shared by the engine and dlls
// This header file included by engine files and DLL files.
// Most came from server.h
// edict->flags
#define FL_FLY (1<<0) // Changes the SV_Movestep() behavior to not need to be on ground
#define FL_SWIM (1<<1) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water)
#define FL_CONVEYOR (1<<2)
#define FL_CLIENT (1<<3)
#define FL_INWATER (1<<4)
#define FL_MONSTER (1<<5)
#define FL_GODMODE (1<<6)
#define FL_NOTARGET (1<<7)
#define FL_SKIPLOCALHOST (1<<8) // Don't send entity to local host, it's predicting this entity itself
#define FL_ONGROUND (1<<9) // At rest / on the ground
#define FL_PARTIALGROUND (1<<10) // not all corners are valid
#define FL_WATERJUMP (1<<11) // player jumping out of water
#define FL_FROZEN (1<<12) // Player is frozen for 3rd person camera
#define FL_FAKECLIENT (1<<13) // JAC: fake client, simulated server side; don't send network messages to them
#define FL_DUCKING (1<<14) // Player flag -- Player is fully crouched
#define FL_FLOAT (1<<15) // Apply floating force to this entity when in water
#define FL_GRAPHED (1<<16) // worldgraph has this ent listed as something that blocks a connection
// UNDONE: Do we need these?
#define FL_IMMUNE_WATER (1<<17)
#define FL_IMMUNE_SLIME (1<<18)
#define FL_IMMUNE_LAVA (1<<19)
#define FL_PROXY (1<<20) // This is a spectator proxy
#define FL_ALWAYSTHINK (1<<21) // Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path)
#define FL_BASEVELOCITY (1<<22) // Base velocity has been applied this frame (used to convert base velocity into momentum)
#define FL_MONSTERCLIP (1<<23) // Only collide in with monsters who have FL_MONSTERCLIP set
#define FL_ONTRAIN (1<<24) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction.
#define FL_WORLDBRUSH (1<<25) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something)
#define FL_SPECTATOR (1<<26) // This client is a spectator, don't run touch functions, etc.
#define FL_CUSTOMENTITY (1<<29) // This is a custom entity
#define FL_KILLME (1<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time
#define FL_DORMANT (1<<31) // Entity is dormant, no updates to client
// Engine edict->spawnflags
#define SF_NOTINDEATHMATCH 0x0800 // Do not spawn when deathmatch and loading entities from a file
// Goes into globalvars_t.trace_flags
#define FTRACE_SIMPLEBOX (1<<0) // Traceline with a simple box
// walkmove modes
#define WALKMOVE_NORMAL 0 // normal walkmove
#define WALKMOVE_WORLDONLY 1 // doesn't hit ANY entities, no matter what the solid type
#define WALKMOVE_CHECKONLY 2 // move, but don't touch triggers
// edict->movetype values
#define MOVETYPE_NONE 0 // never moves
//#define MOVETYPE_ANGLENOCLIP 1
//#define MOVETYPE_ANGLECLIP 2
#define MOVETYPE_WALK 3 // Player only - moving on the ground
#define MOVETYPE_STEP 4 // gravity, special edge handling -- monsters use this
#define MOVETYPE_FLY 5 // No gravity, but still collides with stuff
#define MOVETYPE_TOSS 6 // gravity/collisions
#define MOVETYPE_PUSH 7 // no clip to world, push and crush
#define MOVETYPE_NOCLIP 8 // No gravity, no collisions, still do velocity/avelocity
#define MOVETYPE_FLYMISSILE 9 // extra size to monsters
#define MOVETYPE_BOUNCE 10 // Just like Toss, but reflect velocity when contacting surfaces
#define MOVETYPE_BOUNCEMISSILE 11 // bounce w/o gravity
#define MOVETYPE_FOLLOW 12 // track movement of aiment
#define MOVETYPE_PUSHSTEP 13 // BSP model that needs physics/world collisions (uses nearest hull for world collision)
// edict->solid values
// NOTE: Some movetypes will cause collisions independent of SOLID_NOT/SOLID_TRIGGER when the entity moves
// SOLID only effects OTHER entities colliding with this one when they move - UGH!
#define SOLID_NOT 0 // no interaction with other objects
#define SOLID_TRIGGER 1 // touch on edge, but not blocking
#define SOLID_BBOX 2 // touch on edge, block
#define SOLID_SLIDEBOX 3 // touch on edge, but not an onground
#define SOLID_BSP 4 // bsp clip, touch on edge, block
// edict->deadflag values
#define DEAD_NO 0 // alive
#define DEAD_DYING 1 // playing death animation or still falling off of a ledge waiting to hit ground
#define DEAD_DEAD 2 // dead. lying still.
#define DEAD_RESPAWNABLE 3
#define DEAD_DISCARDBODY 4
#define DAMAGE_NO 0
#define DAMAGE_YES 1
#define DAMAGE_AIM 2
// entity effects
#define EF_BRIGHTFIELD 1 // swirling cloud of particles
#define EF_MUZZLEFLASH 2 // single frame ELIGHT on entity attachment 0
#define EF_BRIGHTLIGHT 4 // DLIGHT centered at entity origin
#define EF_DIMLIGHT 8 // player flashlight
#define EF_INVLIGHT 16 // get lighting from ceiling
#define EF_NOINTERP 32 // don't interpolate the next frame
#define EF_LIGHT 64 // rocket flare glow sprite
#define EF_NODRAW 128 // don't draw entity
#define EF_NIGHTVISION 256 // player nightvision
#define EF_SNIPERLASER 512 // sniper laser effect
#define EF_FIBERCAMERA 1024// fiber camera
// entity flags
#define EFLAG_SLERP 1 // do studio interpolation of this entity
//
// temp entity events
//
#define TE_BEAMPOINTS 0 // beam effect between two points
// coord coord coord (start position)
// coord coord coord (end position)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_BEAMENTPOINT 1 // beam effect between point and entity
// short (start entity)
// coord coord coord (end position)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_GUNSHOT 2 // particle effect plus ricochet sound
// coord coord coord (position)
#define TE_EXPLOSION 3 // additive sprite, 2 dynamic lights, flickering particles, explosion sound, move vertically 8 pps
// coord coord coord (position)
// short (sprite index)
// byte (scale in 0.1's)
// byte (framerate)
// byte (flags)
//
// The Explosion effect has some flags to control performance/aesthetic features:
#define TE_EXPLFLAG_NONE 0 // all flags clear makes default Half-Life explosion
#define TE_EXPLFLAG_NOADDITIVE 1 // sprite will be drawn opaque (ensure that the sprite you send is a non-additive sprite)
#define TE_EXPLFLAG_NODLIGHTS 2 // do not render dynamic lights
#define TE_EXPLFLAG_NOSOUND 4 // do not play client explosion sound
#define TE_EXPLFLAG_NOPARTICLES 8 // do not draw particles
#define TE_TAREXPLOSION 4 // Quake1 "tarbaby" explosion with sound
// coord coord coord (position)
#define TE_SMOKE 5 // alphablend sprite, move vertically 30 pps
// coord coord coord (position)
// short (sprite index)
// byte (scale in 0.1's)
// byte (framerate)
#define TE_TRACER 6 // tracer effect from point to point
// coord, coord, coord (start)
// coord, coord, coord (end)
#define TE_LIGHTNING 7 // TE_BEAMPOINTS with simplified parameters
// coord, coord, coord (start)
// coord, coord, coord (end)
// byte (life in 0.1's)
// byte (width in 0.1's)
// byte (amplitude in 0.01's)
// short (sprite model index)
#define TE_BEAMENTS 8
// short (start entity)
// short (end entity)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_SPARKS 9 // 8 random tracers with gravity, ricochet sprite
// coord coord coord (position)
#define TE_LAVASPLASH 10 // Quake1 lava splash
// coord coord coord (position)
#define TE_TELEPORT 11 // Quake1 teleport splash
// coord coord coord (position)
#define TE_EXPLOSION2 12 // Quake1 colormaped (base palette) particle explosion with sound
// coord coord coord (position)
// byte (starting color)
// byte (num colors)
#define TE_BSPDECAL 13 // Decal from the .BSP file
// coord, coord, coord (x,y,z), decal position (center of texture in world)
// short (texture index of precached decal texture name)
// short (entity index)
// [optional - only included if previous short is non-zero (not the world)] short (index of model of above entity)
#define TE_IMPLOSION 14 // tracers moving toward a point
// coord, coord, coord (position)
// byte (radius)
// byte (count)
// byte (life in 0.1's)
#define TE_SPRITETRAIL 15 // line of moving glow sprites with gravity, fadeout, and collisions
// coord, coord, coord (start)
// coord, coord, coord (end)
// short (sprite index)
// byte (count)
// byte (life in 0.1's)
// byte (scale in 0.1's)
// byte (velocity along vector in 10's)
// byte (randomness of velocity in 10's)
#define TE_BEAM 16 // obsolete
#define TE_SPRITE 17 // additive sprite, plays 1 cycle
// coord, coord, coord (position)
// short (sprite index)
// byte (scale in 0.1's)
// byte (brightness)
#define TE_BEAMSPRITE 18 // A beam with a sprite at the end
// coord, coord, coord (start position)
// coord, coord, coord (end position)
// short (beam sprite index)
// short (end sprite index)
#define TE_BEAMTORUS 19 // screen aligned beam ring, expands to max radius over lifetime
// coord coord coord (center position)
// coord coord coord (axis and radius)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_BEAMDISK 20 // disk that expands to max radius over lifetime
// coord coord coord (center position)
// coord coord coord (axis and radius)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_BEAMCYLINDER 21 // cylinder that expands to max radius over lifetime
// coord coord coord (center position)
// coord coord coord (axis and radius)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_BEAMFOLLOW 22 // create a line of decaying beam segments until entity stops moving
// short (entity:attachment to follow)
// short (sprite index)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte,byte,byte (color)
// byte (brightness)
#define TE_GLOWSPRITE 23
// coord, coord, coord (pos) short (model index) byte (scale / 10)
#define TE_BEAMRING 24 // connect a beam ring to two entities
// short (start entity)
// short (end entity)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_STREAK_SPLASH 25 // oriented shower of tracers
// coord coord coord (start position)
// coord coord coord (direction vector)
// byte (color)
// short (count)
// short (base speed)
// short (ramdon velocity)
#define TE_BEAMHOSE 26 // obsolete
#define TE_DLIGHT 27 // dynamic light, effect world, minor entity effect
// coord, coord, coord (pos)
// byte (radius in 10's)
// byte byte byte (color)
// byte (brightness)
// byte (life in 10's)
// byte (decay rate in 10's)
#define TE_ELIGHT 28 // point entity light, no world effect
// short (entity:attachment to follow)
// coord coord coord (initial position)
// coord (radius)
// byte byte byte (color)
// byte (life in 0.1's)
// coord (decay rate)
#define TE_TEXTMESSAGE 29
// short 1.2.13 x (-1 = center)
// short 1.2.13 y (-1 = center)
// byte Effect 0 = fade in/fade out
// 1 is flickery credits
// 2 is write out (training room)
// 4 bytes r,g,b,a color1 (text color)
// 4 bytes r,g,b,a color2 (effect color)
// ushort 8.8 fadein time
// ushort 8.8 fadeout time
// ushort 8.8 hold time
// optional ushort 8.8 fxtime (time the highlight lags behing the leading text in effect 2)
// string text message (512 chars max sz string)
#define TE_LINE 30
// coord, coord, coord startpos
// coord, coord, coord endpos
// short life in 0.1 s
// 3 bytes r, g, b
#define TE_BOX 31
// coord, coord, coord boxmins
// coord, coord, coord boxmaxs
// short life in 0.1 s
// 3 bytes r, g, b
#define TE_KILLBEAM 99 // kill all beams attached to entity
// short (entity)
#define TE_LARGEFUNNEL 100
// coord coord coord (funnel position)
// short (sprite index)
// short (flags)
#define TE_BLOODSTREAM 101 // particle spray
// coord coord coord (start position)
// coord coord coord (spray vector)
// byte (color)
// byte (speed)
#define TE_SHOWLINE 102 // line of particles every 5 units, dies in 30 seconds
// coord coord coord (start position)
// coord coord coord (end position)
#define TE_BLOOD 103 // particle spray
// coord coord coord (start position)
// coord coord coord (spray vector)
// byte (color)
// byte (speed)
#define TE_DECAL 104 // Decal applied to a brush entity (not the world)
// coord, coord, coord (x,y,z), decal position (center of texture in world)
// byte (texture index of precached decal texture name)
// short (entity index)
#define TE_FIZZ 105 // create alpha sprites inside of entity, float upwards
// short (entity)
// short (sprite index)
// byte (density)
#define TE_MODEL 106 // create a moving model that bounces and makes a sound when it hits
// coord, coord, coord (position)
// coord, coord, coord (velocity)
// angle (initial yaw)
// short (model index)
// byte (bounce sound type)
// byte (life in 0.1's)
#define TE_EXPLODEMODEL 107 // spherical shower of models, picks from set
// coord, coord, coord (origin)
// coord (velocity)
// short (model index)
// short (count)
// byte (life in 0.1's)
#define TE_BREAKMODEL 108 // box of models or sprites
// coord, coord, coord (position)
// coord, coord, coord (size)
// coord, coord, coord (velocity)
// byte (random velocity in 10's)
// short (sprite or model index)
// byte (count)
// byte (life in 0.1 secs)
// byte (flags)
#define TE_GUNSHOTDECAL 109 // decal and ricochet sound
// coord, coord, coord (position)
// short (entity index???)
// byte (decal???)
#define TE_SPRITE_SPRAY 110 // spay of alpha sprites
// coord, coord, coord (position)
// coord, coord, coord (velocity)
// short (sprite index)
// byte (count)
// byte (speed)
// byte (noise)
#define TE_ARMOR_RICOCHET 111 // quick spark sprite, client ricochet sound.
// coord, coord, coord (position)
// byte (scale in 0.1's)
#define TE_PLAYERDECAL 112 // ???
// byte (playerindex)
// coord, coord, coord (position)
// short (entity???)
// byte (decal number???)
// [optional] short (model index???)
#define TE_BUBBLES 113 // create alpha sprites inside of box, float upwards
// coord, coord, coord (min start position)
// coord, coord, coord (max start position)
// coord (float height)
// short (model index)
// byte (count)
// coord (speed)
#define TE_BUBBLETRAIL 114 // create alpha sprites along a line, float upwards
// coord, coord, coord (min start position)
// coord, coord, coord (max start position)
// coord (float height)
// short (model index)
// byte (count)
// coord (speed)
#define TE_BLOODSPRITE 115 // spray of opaque sprite1's that fall, single sprite2 for 1..2 secs (this is a high-priority tent)
// coord, coord, coord (position)
// short (sprite1 index)
// short (sprite2 index)
// byte (color)
// byte (scale)
#define TE_WORLDDECAL 116 // Decal applied to the world brush
// coord, coord, coord (x,y,z), decal position (center of texture in world)
// byte (texture index of precached decal texture name)
#define TE_WORLDDECALHIGH 117 // Decal (with texture index > 256) applied to world brush
// coord, coord, coord (x,y,z), decal position (center of texture in world)
// byte (texture index of precached decal texture name - 256)
#define TE_DECALHIGH 118 // Same as TE_DECAL, but the texture index was greater than 256
// coord, coord, coord (x,y,z), decal position (center of texture in world)
// byte (texture index of precached decal texture name - 256)
// short (entity index)
#define TE_PROJECTILE 119 // Makes a projectile (like a nail) (this is a high-priority tent)
// coord, coord, coord (position)
// coord, coord, coord (velocity)
// short (modelindex)
// byte (life)
// byte (owner) projectile won't collide with owner (if owner == 0, projectile will hit any client).
#define TE_SPRAY 120 // Throws a shower of sprites or models
// coord, coord, coord (position)
// coord, coord, coord (direction)
// short (modelindex)
// byte (count)
// byte (speed)
// byte (noise)
// byte (rendermode)
#define TE_PLAYERSPRITES 121 // sprites emit from a player's bounding box (ONLY use for players!)
// byte (playernum)
// short (sprite modelindex)
// byte (count)
// byte (variance) (0 = no variance in size) (10 = 10% variance in size)
#define TE_PARTICLEBURST 122 // very similar to lavasplash.
// coord (origin)
// short (radius)
// byte (particle color)
// byte (duration * 10) (will be randomized a bit)
#define TE_FIREFIELD 123 // makes a field of fire.
// coord (origin)
// short (radius) (fire is made in a square around origin. -radius, -radius to radius, radius)
// short (modelindex)
// byte (count)
// byte (flags)
// byte (duration (in seconds) * 10) (will be randomized a bit)
//
// to keep network traffic low, this message has associated flags that fit into a byte:
#define TEFIRE_FLAG_ALLFLOAT 1 // all sprites will drift upwards as they animate
#define TEFIRE_FLAG_SOMEFLOAT 2 // some of the sprites will drift upwards. (50% chance)
#define TEFIRE_FLAG_LOOP 4 // if set, sprite plays at 15 fps, otherwise plays at whatever rate stretches the animation over the sprite's duration.
#define TEFIRE_FLAG_ALPHA 8 // if set, sprite is rendered alpha blended at 50% else, opaque
#define TEFIRE_FLAG_PLANAR 16 // if set, all fire sprites have same initial Z instead of randomly filling a cube.
#define TEFIRE_FLAG_ADDITIVE 32 // if set, sprite is rendered non-opaque with additive
#define TE_PLAYERATTACHMENT 124 // attaches a TENT to a player (this is a high-priority tent)
// byte (entity index of player)
// coord (vertical offset) ( attachment origin.z = player origin.z + vertical offset )
// short (model index)
// short (life * 10 );
#define TE_KILLPLAYERATTACHMENTS 125 // will expire all TENTS attached to a player.
// byte (entity index of player)
#define TE_MULTIGUNSHOT 126 // much more compact shotgun message
// This message is used to make a client approximate a 'spray' of gunfire.
// Any weapon that fires more than one bullet per frame and fires in a bit of a spread is
// a good candidate for MULTIGUNSHOT use. (shotguns)
//
// NOTE: This effect makes the client do traces for each bullet, these client traces ignore
// entities that have studio models.Traces are 4096 long.
//
// coord (origin)
// coord (origin)
// coord (origin)
// coord (direction)
// coord (direction)
// coord (direction)
// coord (x noise * 100)
// coord (y noise * 100)
// byte (count)
// byte (bullethole decal texture index)
#define TE_USERTRACER 127 // larger message than the standard tracer, but allows some customization.
// coord (origin)
// coord (origin)
// coord (origin)
// coord (velocity)
// coord (velocity)
// coord (velocity)
// byte ( life * 10 )
// byte ( color ) this is an index into an array of color vectors in the engine. (0 - )
// byte ( length * 10 )
#define MSG_BROADCAST 0 // unreliable to all
#define MSG_ONE 1 // reliable to one (msg_entity)
#define MSG_ALL 2 // reliable to all
#define MSG_INIT 3 // write to the init string
#define MSG_PVS 4 // Ents in PVS of org
#define MSG_PAS 5 // Ents in PAS of org
#define MSG_PVS_R 6 // Reliable to PVS
#define MSG_PAS_R 7 // Reliable to PAS
#define MSG_ONE_UNRELIABLE 8 // Send to one client, but don't put in reliable stream, put in unreliable datagram ( could be dropped )
#define MSG_SPEC 9 // Sends to all spectator proxies
// contents of a spot in the world
#define CONTENTS_EMPTY -1
#define CONTENTS_SOLID -2
#define CONTENTS_WATER -3
#define CONTENTS_SLIME -4
#define CONTENTS_LAVA -5
#define CONTENTS_SKY -6
/* These additional contents constants are defined in bspfile.h
#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_180 -11
#define CONTENTS_CURRENT_270 -12
#define CONTENTS_CURRENT_UP -13
#define CONTENTS_CURRENT_DOWN -14
#define CONTENTS_TRANSLUCENT -15
*/
#define CONTENTS_LADDER -16
#define CONTENT_FLYFIELD -17
#define CONTENT_GRAVITY_FLYFIELD -18
#define CONTENT_FOG -19
#define CONTENT_EMPTY -1
#define CONTENT_SOLID -2
#define CONTENT_WATER -3
#define CONTENT_SLIME -4
#define CONTENT_LAVA -5
#define CONTENT_SKY -6
// channels
#define CHAN_AUTO 0
#define CHAN_WEAPON 1
#define CHAN_VOICE 2
#define CHAN_ITEM 3
#define CHAN_BODY 4
#define CHAN_STREAM 5 // allocate stream channel from the static or dynamic area
#define CHAN_STATIC 6 // allocate channel from the static area
#define CHAN_NETWORKVOICE_BASE 7 // voice data coming across the network
#define CHAN_NETWORKVOICE_END 500 // network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END).
#define CHAN_BOT 501 // channel used for bot chatter.
// attenuation values
#define ATTN_NONE 0
#define ATTN_NORM (float)0.8
#define ATTN_IDLE (float)2
#define ATTN_STATIC (float)1.25
// pitch values
#define PITCH_NORM 100 // non-pitch shifted
#define PITCH_LOW 95 // other values are possible - 0-255, where 255 is very high
#define PITCH_HIGH 120
// volume values
#define VOL_NORM 1.0
// plats
#define PLAT_LOW_TRIGGER 1
// Trains
#define SF_TRAIN_WAIT_RETRIGGER 1
#define SF_TRAIN_START_ON 4 // Train is initially moving
#define SF_TRAIN_PASSABLE 8 // Train is not solid -- used to make water trains
// buttons
#ifndef IN_BUTTONS_H
#include "in_buttons.h"
#endif
// Break Model Defines
#define BREAK_TYPEMASK 0x4F
#define BREAK_GLASS 0x01
#define BREAK_METAL 0x02
#define BREAK_FLESH 0x04
#define BREAK_WOOD 0x08
#define BREAK_SMOKE 0x10
#define BREAK_TRANS 0x20
#define BREAK_CONCRETE 0x40
#define BREAK_2 0x80
// Colliding temp entity sounds
#define BOUNCE_GLASS BREAK_GLASS
#define BOUNCE_METAL BREAK_METAL
#define BOUNCE_FLESH BREAK_FLESH
#define BOUNCE_WOOD BREAK_WOOD
#define BOUNCE_SHRAP 0x10
#define BOUNCE_SHELL 0x20
#define BOUNCE_CONCRETE BREAK_CONCRETE
#define BOUNCE_SHOTSHELL 0x80
// Temp entity bounce sound types
#define TE_BOUNCE_NULL 0
#define TE_BOUNCE_SHELL 1
#define TE_BOUNCE_SHOTSHELL 2
// Rendering constants
enum
{
kRenderNormal, // src
kRenderTransColor, // c*a+dest*(1-a)
kRenderTransTexture, // src*a+dest*(1-a)
kRenderGlow, // src*a+dest -- No Z buffer checks
kRenderTransAlpha, // src*srca+dest*(1-srca)
kRenderTransAdd, // src*a+dest
};
enum
{
kRenderFxNone = 0,
kRenderFxPulseSlow,
kRenderFxPulseFast,
kRenderFxPulseSlowWide,
kRenderFxPulseFastWide,
kRenderFxFadeSlow,
kRenderFxFadeFast,
kRenderFxSolidSlow,
kRenderFxSolidFast,
kRenderFxStrobeSlow,
kRenderFxStrobeFast,
kRenderFxStrobeFaster,
kRenderFxFlickerSlow,
kRenderFxFlickerFast,
kRenderFxNoDissipation,
kRenderFxDistort, // Distort/scale/translate flicker
kRenderFxHologram, // kRenderFxDistort + distance fade
kRenderFxDeadPlayer, // kRenderAmt is the player index
kRenderFxExplode, // Scale up really big!
kRenderFxGlowShell, // Glowing Shell
kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!)
kRenderFxLightMultiplier, //CTM !!!CZERO added to tell the studiorender that the value in iuser2 is a lightmultiplier
};
typedef unsigned int func_t;
typedef unsigned int string_t;
typedef unsigned char byte;
typedef unsigned short word;
#define _DEF_BYTE_
#undef true
#undef false
#ifndef __cplusplus
typedef enum {false, true} qboolean;
#else
typedef int qboolean;
#endif
typedef struct
{
byte r, g, b;
} color24;
typedef struct
{
unsigned r, g, b, a;
} colorVec;
#ifdef _WIN32
#pragma pack(push,2)
#endif
typedef struct
{
unsigned short r, g, b, a;
} PackedColorVec;
#ifdef _WIN32
#pragma pack(pop)
#endif
typedef struct link_s
{
struct link_s *prev, *next;
} link_t;
typedef struct edict_s edict_t;
typedef struct
{
vec3_t normal;
float dist;
} plane_t;
typedef struct
{
qboolean allsolid; // if true, plane is not valid
qboolean startsolid; // if true, the initial point was in a solid area
qboolean inopen, inwater;
float fraction; // time completed, 1.0 = didn't hit anything
vec3_t endpos; // final position
plane_t plane; // surface normal at impact
edict_t * ent; // entity the surface is on
int hitgroup; // 0 == generic, non zero is specific body part
} trace_t;
#endif // CONST_H

View File

@ -0,0 +1,55 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
/* crc.h */
#pragma once
#include "quakedef.h"
// MD5 Hash
typedef struct
{
unsigned int buf[4];
unsigned int bits[2];
unsigned char in[64];
} MD5Context_t;
typedef unsigned int CRC32_t;
#ifdef __cplusplus
extern "C"
{
#endif
void CRC32_Init(CRC32_t *pulCRC);
CRC32_t CRC32_Final(CRC32_t pulCRC);
void CRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch);
void CRC32_ProcessBuffer(CRC32_t *pulCRC, void *pBuffer, int nBuffer);
BOOL CRC_File(CRC32_t *crcvalue, char *pszFileName);
#ifdef __cplusplus
}
#endif
byte COM_BlockSequenceCRCByte(byte *base, int length, int sequence);
int CRC_MapFile(CRC32_t *crcvalue, char *pszFileName);
void MD5Init(MD5Context_t *ctx);
void MD5Update(MD5Context_t *ctx, const unsigned char *buf, unsigned int len);
void MD5Final(unsigned char digest[16], MD5Context_t *ctx);
void MD5Transform(unsigned int buf[4], const unsigned int in[16]);
BOOL MD5_Hash_File(unsigned char digest[16], char *pszFileName, BOOL bUsefopen, BOOL bSeed, unsigned int seed[4]);
char *MD5_Print(unsigned char hash[16]);

View File

@ -0,0 +1,39 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef CVARDEF_H
#define CVARDEF_H
#define FCVAR_ARCHIVE (1<<0) // set to cause it to be saved to vars.rc
#define FCVAR_USERINFO (1<<1) // changes the client's info string
#define FCVAR_SERVER (1<<2) // notifies players when changed
#define FCVAR_EXTDLL (1<<3) // defined by external DLL
#define FCVAR_CLIENTDLL (1<<4) // defined by the client dll
#define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value
#define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server.
#define FCVAR_PRINTABLEONLY (1<<7) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ).
#define FCVAR_UNLOGGED (1<<8) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log
#define FCVAR_NOEXTRAWHITEPACE (1<<9) // strip trailing/leading white space from this cvar
typedef struct cvar_s
{
const char *name;
char *string;
int flags;
float value;
struct cvar_s *next;
} cvar_t;
#endif // CVARDEF_H

View File

@ -0,0 +1,31 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined ( DEMO_APIH )
#define DEMO_APIH
#ifdef _WIN32
#pragma once
#endif
typedef struct demo_api_s
{
int ( *IsRecording ) ( void );
int ( *IsPlayingback ) ( void );
int ( *IsTimeDemo ) ( void );
void ( *WriteBuffer ) ( int size, unsigned char *buffer );
} demo_api_t;
extern demo_api_t demoapi;
#endif

View File

@ -0,0 +1,38 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
// director_cmds.h
// sub commands for svc_director
#define DRC_ACTIVE 0 // tells client that he's an spectator and will get director command
#define DRC_STATUS 1 // send status infos about proxy
#define DRC_CAMERA 2 // set the actual director camera position
#define DRC_EVENT 3 // informs the dircetor about ann important game event
#define DRC_FLAG_PRIO_MASK 0x0F // priorities between 0 and 15 (15 most important)
#define DRC_FLAG_SIDE (1<<4)
#define DRC_FLAG_DRAMATIC (1<<5)
// commands of the director API function CallDirectorProc(...)
#define DRCAPI_NOP 0 // no operation
#define DRCAPI_ACTIVE 1 // de/acivates director mode in engine
#define DRCAPI_STATUS 2 // request proxy information
#define DRCAPI_SETCAM 3 // set camera n to given position and angle
#define DRCAPI_GETCAM 4 // request camera n position and angle
#define DRCAPI_DIRPLAY 5 // set director time and play with normal speed
#define DRCAPI_DIRFREEZE 6 // freeze directo at this time
#define DRCAPI_SETVIEWMODE 7 // overview or 4 cameras
#define DRCAPI_SETOVERVIEWPARAMS 8 // sets parameter for overview mode
#define DRCAPI_SETFOCUS 9 // set the camera which has the input focus
#define DRCAPI_GETTARGETS 10 // queries engine for player list
#define DRCAPI_SETVIEWPOINTS 11 // gives engine all waypoints

View File

@ -0,0 +1,33 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined ( DLIGHTH )
#define DLIGHTH
#ifdef _WIN32
#pragma once
#endif
typedef struct dlight_s
{
vec3_t origin;
float radius;
color24 color;
float die; // stop lighting after this time
float decay; // drop this each second
float minlight; // don't add when contributing less
int key;
qboolean dark; // subtracts light instead of adding
} dlight_t;
#endif

View File

@ -0,0 +1,23 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
//DLL State Flags
#define DLL_INACTIVE 0 // no dll
#define DLL_ACTIVE 1 // dll is running
#define DLL_PAUSED 2 // dll is paused
#define DLL_CLOSE 3 // closing down dll
#define DLL_TRANS 4 // Level Transition
// DLL Pause reasons
#define DLL_NORMAL 0 // User hit Esc or something.
#define DLL_QUIT 4 // Quit now
#define DLL_RESTART 5 // Switch to launcher for linux, does a quit but returns 1
// DLL Substate info ( not relevant )
#define ENG_NORMAL (1<<0)

View File

@ -0,0 +1,197 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef ENTITY_STATE_H
#define ENTITY_STATE_H
#ifdef _WIN32
#pragma once
#endif
#include "const.h"
// For entityType below
#define ENTITY_NORMAL (1<<0)
#define ENTITY_BEAM (1<<1)
// Entity state is used for the baseline and for delta compression of a packet of
// entities that is sent to a client.
typedef struct entity_state_s entity_state_t;
struct entity_state_s
{
// Fields which are filled in by routines outside of delta compression
int entityType;
// Index into cl_entities array for this entity.
int number;
float msg_time;
// Message number last time the player/entity state was updated.
int messagenum;
// Fields which can be transitted and reconstructed over the network stream
vec3_t origin;
vec3_t angles;
int modelindex;
int sequence;
float frame;
int colormap;
short skin;
short solid;
int effects;
float scale;
byte eflags;
// Render information
int rendermode;
int renderamt;
color24 rendercolor;
int renderfx;
int movetype;
float animtime;
float framerate;
int body;
byte controller[4];
byte blending[4];
vec3_t velocity;
// Send bbox down to client for use during prediction.
vec3_t mins;
vec3_t maxs;
int aiment;
// If owned by a player, the index of that player ( for projectiles ).
int owner;
// Friction, for prediction.
float friction;
// Gravity multiplier
float gravity;
// PLAYER SPECIFIC
int team;
int playerclass;
int health;
qboolean spectator;
int weaponmodel;
int gaitsequence;
// If standing on conveyor, e.g.
vec3_t basevelocity;
// Use the crouched hull, or the regular player hull.
int usehull;
// Latched buttons last time state updated.
int oldbuttons;
// -1 = in air, else pmove entity number
int onground;
int iStepLeft;
// How fast we are falling
float flFallVelocity;
float fov;
int weaponanim;
// Parametric movement overrides
vec3_t startpos;
vec3_t endpos;
float impacttime;
float starttime;
// For mods
int iuser1;
int iuser2;
int iuser3;
int iuser4;
float fuser1;
float fuser2;
float fuser3;
float fuser4;
vec3_t vuser1;
vec3_t vuser2;
vec3_t vuser3;
vec3_t vuser4;
};
#include "pm_info.h"
typedef struct clientdata_s
{
vec3_t origin;
vec3_t velocity;
int viewmodel;
vec3_t punchangle;
int flags;
int waterlevel;
int watertype;
vec3_t view_ofs;
float health;
int bInDuck;
int weapons; // remove?
int flTimeStepSound;
int flDuckTime;
int flSwimTime;
int waterjumptime;
float maxspeed;
float fov;
int weaponanim;
int m_iId;
int ammo_shells;
int ammo_nails;
int ammo_cells;
int ammo_rockets;
float m_flNextAttack;
int tfstate;
int pushmsec;
int deadflag;
char physinfo[ MAX_PHYSINFO_STRING ];
// For mods
int iuser1;
int iuser2;
int iuser3;
int iuser4;
float fuser1;
float fuser2;
float fuser3;
float fuser4;
vec3_t vuser1;
vec3_t vuser2;
vec3_t vuser3;
vec3_t vuser4;
} clientdata_t;
#include "weaponinfo.h"
typedef struct local_state_s
{
entity_state_t playerstate;
clientdata_t client;
weapon_data_t weapondata[ 64 ];
} local_state_t;
#endif // ENTITY_STATE_H

View File

@ -0,0 +1,26 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
// entity_types.h
#if !defined( ENTITY_TYPESH )
#define ENTITY_TYPESH
#define ET_NORMAL 0
#define ET_PLAYER 1
#define ET_TEMPENTITY 2
#define ET_BEAM 3
// BMODEL or SPRITE that was split across BSP nodes
#define ET_FRAGMENTED 4
#endif // !ENTITY_TYPESH

View File

@ -0,0 +1,27 @@
/***
*
* Copyright (c) 2009, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef ENUMS_H
#define ENUMS_H
typedef enum netsrc_s
{
NS_CLIENT,
NS_SERVER,
NS_MULTICAST // xxxMO
} netsrc_t;
#endif

View File

@ -0,0 +1,51 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined ( EVENT_APIH )
#define EVENT_APIH
#ifdef _WIN32
#pragma once
#endif
#define EVENT_API_VERSION 1
typedef struct event_api_s
{
int version;
void ( *EV_PlaySound ) ( int ent, float *origin, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch );
void ( *EV_StopSound ) ( int ent, int channel, const char *sample );
int ( *EV_FindModelIndex )( const char *pmodel );
int ( *EV_IsLocal ) ( int playernum );
int ( *EV_LocalPlayerDucking ) ( void );
void ( *EV_LocalPlayerViewheight ) ( float * );
void ( *EV_LocalPlayerBounds ) ( int hull, float *mins, float *maxs );
int ( *EV_IndexFromTrace) ( struct pmtrace_s *pTrace );
struct physent_s *( *EV_GetPhysent ) ( int idx );
void ( *EV_SetUpPlayerPrediction ) ( int dopred, int bIncludeLocalClient );
void ( *EV_PushPMStates ) ( void );
void ( *EV_PopPMStates ) ( void );
void ( *EV_SetSolidPlayers ) (int playernum);
void ( *EV_SetTraceHull ) ( int hull );
void ( *EV_PlayerTrace ) ( float *start, float *end, int traceFlags, int ignore_pe, struct pmtrace_s *tr );
void ( *EV_WeaponAnimation ) ( int sequence, int body );
unsigned short ( *EV_PrecacheEvent ) ( int type, const char* psz );
void ( *EV_PlaybackEvent ) ( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
const char *( *EV_TraceTexture ) ( int ground, float *vstart, float *vend );
void ( *EV_StopAllSounds ) ( int entnum, int entchannel );
void ( *EV_KillEvents ) ( int entnum, const char *eventname );
} event_api_t;
extern event_api_t eventapi;
#endif

View File

@ -0,0 +1,50 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( EVENT_ARGSH )
#define EVENT_ARGSH
#ifdef _WIN32
#pragma once
#endif
// Event was invoked with stated origin
#define FEVENT_ORIGIN ( 1<<0 )
// Event was invoked with stated angles
#define FEVENT_ANGLES ( 1<<1 )
typedef struct event_args_s
{
int flags;
// Transmitted
int entindex;
float origin[3];
float angles[3];
float velocity[3];
int ducking;
float fparam1;
float fparam2;
int iparam1;
int iparam2;
int bparam1;
int bparam2;
} event_args_t;
#endif

View File

@ -0,0 +1,47 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( EVENT_FLAGSH )
#define EVENT_FLAGSH
#ifdef _WIN32
#pragma once
#endif
// Skip local host for event send.
#define FEV_NOTHOST (1<<0)
// Send the event reliably. You must specify the origin and angles and use
// PLAYBACK_EVENT_FULL for this to work correctly on the server for anything
// that depends on the event origin/angles. I.e., the origin/angles are not
// taken from the invoking edict for reliable events.
#define FEV_RELIABLE (1<<1)
// Don't restrict to PAS/PVS, send this event to _everybody_ on the server ( useful for stopping CHAN_STATIC
// sounds started by client event when client is not in PVS anymore ( hwguy in TFC e.g. ).
#define FEV_GLOBAL (1<<2)
// If this client already has one of these events in its queue, just update the event instead of sending it as a duplicate
//
#define FEV_UPDATE (1<<3)
// Only send to entity specified as the invoker
#define FEV_HOSTONLY (1<<4)
// Only send if the event was created on the server.
#define FEV_SERVER (1<<5)
// Only issue event client side ( from shared code )
#define FEV_CLIENT (1<<6)
#endif

View File

@ -0,0 +1,61 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
// hltv.h
// all shared consts between server, clients and proxy
#ifndef HLTV_H
#define HLTV_H
#define TYPE_CLIENT 0 // client is a normal HL client (default)
#define TYPE_PROXY 1 // client is another proxy
#define TYPE_COMMENTATOR 3 // client is a commentator
#define TYPE_DEMO 4 // client is a demo file
// sub commands of svc_hltv:
#define HLTV_ACTIVE 0 // tells client that he's an spectator and will get director commands
#define HLTV_STATUS 1 // send status infos about proxy
#define HLTV_LISTEN 2 // tell client to listen to a multicast stream
// director command types:
#define DRC_CMD_NONE 0 // NULL director command
#define DRC_CMD_START 1 // start director mode
#define DRC_CMD_EVENT 2 // informs about director command
#define DRC_CMD_MODE 3 // switches camera modes
#define DRC_CMD_CAMERA 4 // set fixed camera
#define DRC_CMD_TIMESCALE 5 // sets time scale
#define DRC_CMD_MESSAGE 6 // send HUD centerprint
#define DRC_CMD_SOUND 7 // plays a particular sound
#define DRC_CMD_STATUS 8 // HLTV broadcast status
#define DRC_CMD_BANNER 9 // set GUI banner
#define DRC_CMD_STUFFTEXT 10 // like the normal svc_stufftext but as director command
#define DRC_CMD_CHASE 11 // chase a certain player
#define DRC_CMD_INEYE 12 // view player through own eyes
#define DRC_CMD_MAP 13 // show overview map
#define DRC_CMD_CAMPATH 14 // define camera waypoint
#define DRC_CMD_WAYPOINTS 15 // start moving camera, inetranl message
#define DRC_CMD_LAST 15
// DRC_CMD_EVENT event flags
#define DRC_FLAG_PRIO_MASK 0x0F // priorities between 0 and 15 (15 most important)
#define DRC_FLAG_SIDE (1<<4) //
#define DRC_FLAG_DRAMATIC (1<<5) // is a dramatic scene
#define DRC_FLAG_SLOWMOTION (1<<6) // would look good in SloMo
#define DRC_FLAG_FACEPLAYER (1<<7) // player is doning something (reload/defuse bomb etc)
#define DRC_FLAG_INTRO (1<<8) // is a introduction scene
#define DRC_FLAG_FINAL (1<<9) // is a final scene
#define DRC_FLAG_NO_RANDOM (1<<10) // don't randomize event data
// DRC_CMD_WAYPOINT flags
#define DRC_FLAG_STARTPATH 1 // end with speed 0.0
#define DRC_FLAG_SLOWSTART 2 // start with speed 0.0
#define DRC_FLAG_SLOWEND 4 // end with speed 0.0
#endif // HLTV_H

View File

@ -0,0 +1,38 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef IN_BUTTONS_H
#define IN_BUTTONS_H
#ifdef _WIN32
#pragma once
#endif
#define IN_ATTACK (1 << 0)
#define IN_JUMP (1 << 1)
#define IN_DUCK (1 << 2)
#define IN_FORWARD (1 << 3)
#define IN_BACK (1 << 4)
#define IN_USE (1 << 5)
#define IN_CANCEL (1 << 6)
#define IN_LEFT (1 << 7)
#define IN_RIGHT (1 << 8)
#define IN_MOVELEFT (1 << 9)
#define IN_MOVERIGHT (1 << 10)
#define IN_ATTACK2 (1 << 11)
#define IN_RUN (1 << 12)
#define IN_RELOAD (1 << 13)
#define IN_ALT1 (1 << 14)
#define IN_SCORE (1 << 15) // Used by client.dll for when scoreboard is held down
#endif // IN_BUTTONS_H

View File

@ -0,0 +1,38 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef IVOICETWEAK_H
#define IVOICETWEAK_H
#ifdef _WIN32
#pragma once
#endif
// These provide access to the voice controls.
typedef enum
{
MicrophoneVolume=0, // values 0-1.
OtherSpeakerScale, // values 0-1. Scales how loud other players are.
MicBoost, // 20 db gain to voice input
} VoiceTweakControl;
typedef struct IVoiceTweak_s
{
// These turn voice tweak mode on and off. While in voice tweak mode, the user's voice is echoed back
// without sending to the server.
int (*StartVoiceTweakMode)(); // Returns 0 on error.
void (*EndVoiceTweakMode)();
// Get/set control values.
void (*SetControlFloat)(VoiceTweakControl iControl, float value);
float (*GetControlFloat)(VoiceTweakControl iControl);
int (*GetSpeakingVolume)();
} IVoiceTweak;
#endif // IVOICETWEAK_H

View File

@ -0,0 +1,44 @@
/*
*
* 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.
*
*/
#ifndef KBUTTON_H
#define KBUTTON_H
#ifdef _WIN32
#pragma once
#endif
/* <31b2a> ../common/kbutton.h:7 */
typedef struct kbutton_s
{
int down[2];
int state;
} kbutton_t;
#endif // KBUTTON_H

View File

@ -0,0 +1,99 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef MATHLIB_H
#define MATHLIB_H
/* <42b7f> ../common/mathlib.h:3 */
typedef float vec_t;
/* <42b91> ../common/mathlib.h:6 */
#if !defined DID_VEC3_T_DEFINE && !defined vec3_t
#define DID_VEC3_T_DEFINE
typedef vec_t vec3_t[3];
#endif
/* <80013> ../common/mathlib.h:8 */
typedef vec_t vec4_t[4];
/* <42bac> ../common/mathlib.h:18 */
typedef int fixed16_t; /* size: 4 */
/* <42bb7> ../common/mathlib.h:60 */
typedef union DLONG_u
{
int i[2];
double d;
float f;
} DLONG;
#define M_PI 3.14159265358979323846
#ifdef __cplusplus
#ifdef min
#undef min
#endif
#ifdef max
#undef max
#endif
#ifdef clamp
#undef clamp
#endif
template <typename T>
inline T min(T a, T b) {
return (a < b) ? a : b;
}
template <typename T>
inline T max(T a, T b) {
return (a < b) ? b : a;
}
template <typename T>
inline T clamp(T a, T min, T max) {
return (a > max) ? max : (a < min) ? min : a;
}
template <typename T>
inline T bswap(T s) {
switch (sizeof(T)) {
#ifdef _WIN32
case 2: {auto res = _byteswap_ushort(*(uint16 *)&s); return *(T *)&res;}
case 4: {auto res = _byteswap_ulong(*(uint32 *)(&s)); return *(T *)&res;}
case 8: {auto res = _byteswap_uint64(*(uint64 *)&s); return *(T *)&res;}
#else
case 2: {auto res = _bswap16(*(uint16 *)&s); return *(T *)&res;}
case 4: {auto res = _bswap(*(uint32 *)&s); return *(T *)&res;}
case 8: {auto res = _bswap64(*(uint64 *)&s); return *(T *)&res;}
#endif
default: return s;
}
}
#else // __cplusplus
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#define clamp(val, min, max) (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val)))
#endif // __cplusplus
#endif // MATHLIB_H

View File

@ -0,0 +1,99 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#if !defined( NET_APIH )
#define NET_APIH
#ifdef _WIN32
#pragma once
#endif
#if !defined ( NETADRH )
#include "netadr.h"
#endif
#define NETAPI_REQUEST_SERVERLIST ( 0 ) // Doesn't need a remote address
#define NETAPI_REQUEST_PING ( 1 )
#define NETAPI_REQUEST_RULES ( 2 )
#define NETAPI_REQUEST_PLAYERS ( 3 )
#define NETAPI_REQUEST_DETAILS ( 4 )
// Set this flag for things like broadcast requests, etc. where the engine should not
// kill the request hook after receiving the first response
#define FNETAPI_MULTIPLE_RESPONSE ( 1<<0 )
typedef void ( *net_api_response_func_t ) ( struct net_response_s *response );
#define NET_SUCCESS ( 0 )
#define NET_ERROR_TIMEOUT ( 1<<0 )
#define NET_ERROR_PROTO_UNSUPPORTED ( 1<<1 )
#define NET_ERROR_UNDEFINED ( 1<<2 )
typedef struct net_adrlist_s
{
struct net_adrlist_s *next;
netadr_t remote_address;
} net_adrlist_t;
typedef struct net_response_s
{
// NET_SUCCESS or an error code
int error;
// Context ID
int context;
// Type
int type;
// Server that is responding to the request
netadr_t remote_address;
// Response RTT ping time
double ping;
// Key/Value pair string ( separated by backlash \ characters )
// WARNING: You must copy this buffer in the callback function, because it is freed
// by the engine right after the call!!!!
// ALSO: For NETAPI_REQUEST_SERVERLIST requests, this will be a pointer to a linked list of net_adrlist_t's
void *response;
} net_response_t;
typedef struct net_status_s
{
// Connected to remote server? 1 == yes, 0 otherwise
int connected;
// Client's IP address
netadr_t local_address;
// Address of remote server
netadr_t remote_address;
// Packet Loss ( as a percentage )
int packet_loss;
// Latency, in seconds ( multiply by 1000.0 to get milliseconds )
double latency;
// Connection time, in seconds
double connection_time;
// Rate setting ( for incoming data )
double rate;
} net_status_t;
typedef struct net_api_s
{
// APIs
void ( *InitNetworking )( void );
void ( *Status ) ( struct net_status_s *status );
void ( *SendRequest) ( int context, int request, int flags, double timeout, struct netadr_s *remote_address, net_api_response_func_t response );
void ( *CancelRequest ) ( int context );
void ( *CancelAllRequests ) ( void );
char *( *AdrToString ) ( struct netadr_s *a );
int ( *CompareAdr ) ( struct netadr_s *a, struct netadr_s *b );
int ( *StringToAdr ) ( char *s, struct netadr_s *a );
const char *( *ValueForKey ) ( const char *s, const char *key );
void ( *RemoveKey ) ( char *s, const char *key );
void ( *SetValueForKey ) (char *s, const char *key, const char *value, int maxsize );
} net_api_t;
extern net_api_t netapi;
#endif // NET_APIH

View File

@ -0,0 +1,40 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
// netadr.h
#ifndef NETADR_H
#define NETADR_H
#ifdef _WIN32
#pragma once
#endif
typedef enum
{
NA_UNUSED,
NA_LOOPBACK,
NA_BROADCAST,
NA_IP,
NA_IPX,
NA_BROADCAST_IPX,
} netadrtype_t;
typedef struct netadr_s
{
netadrtype_t type;
unsigned char ip[4];
unsigned char ipx[10];
unsigned short port;
} netadr_t;
#endif // NETADR_H

View File

@ -0,0 +1,16 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef INC_NOWIN_H
#define INC_NOWIN_H
#ifndef _WIN32
#include <unistd.h>
#include <sys/types.h>
#endif //!_WIN32
#endif //INC_NOWIN_H

View File

@ -0,0 +1,259 @@
/***
*
* Copyright (c) 1999, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
//
// parsemsg.cpp
//
//--------------------------------------------------------------------------------------------------------------
#include "parsemsg.h"
#include <port.h>
typedef unsigned char byte;
#define true 1
static byte *gpBuf;
static int giSize;
static int giRead;
static int giBadRead;
int READ_OK( void )
{
return !giBadRead;
}
void BEGIN_READ( void *buf, int size )
{
giRead = 0;
giBadRead = 0;
giSize = size;
gpBuf = (byte*)buf;
}
int READ_CHAR( void )
{
int c;
if (giRead + 1 > giSize)
{
giBadRead = true;
return -1;
}
c = (signed char)gpBuf[giRead];
giRead++;
return c;
}
int READ_BYTE( void )
{
int c;
if (giRead+1 > giSize)
{
giBadRead = true;
return -1;
}
c = (unsigned char)gpBuf[giRead];
giRead++;
return c;
}
int READ_SHORT( void )
{
int c;
if (giRead+2 > giSize)
{
giBadRead = true;
return -1;
}
c = (short)( gpBuf[giRead] + ( gpBuf[giRead+1] << 8 ) );
giRead += 2;
return c;
}
int READ_WORD( void )
{
return READ_SHORT();
}
int READ_LONG( void )
{
int c;
if (giRead+4 > giSize)
{
giBadRead = true;
return -1;
}
c = gpBuf[giRead] + (gpBuf[giRead + 1] << 8) + (gpBuf[giRead + 2] << 16) + (gpBuf[giRead + 3] << 24);
giRead += 4;
return c;
}
float READ_FLOAT( void )
{
union
{
byte b[4];
float f;
int l;
} dat;
dat.b[0] = gpBuf[giRead];
dat.b[1] = gpBuf[giRead+1];
dat.b[2] = gpBuf[giRead+2];
dat.b[3] = gpBuf[giRead+3];
giRead += 4;
// dat.l = LittleLong (dat.l);
return dat.f;
}
char* READ_STRING( void )
{
static char string[2048];
int l,c;
string[0] = 0;
l = 0;
do
{
if ( giRead+1 > giSize )
break; // no more characters
c = READ_CHAR();
if (c == -1 || c == 0)
break;
string[l] = c;
l++;
} while (l < sizeof(string)-1);
string[l] = 0;
return string;
}
float READ_COORD( void )
{
return (float)(READ_SHORT() * (1.0/8));
}
float READ_ANGLE( void )
{
return (float)(READ_CHAR() * (360.0/256));
}
float READ_HIRESANGLE( void )
{
return (float)(READ_SHORT() * (360.0/65536));
}
//--------------------------------------------------------------------------------------------------------------
BufferWriter::BufferWriter()
{
Init( NULL, 0 );
}
//--------------------------------------------------------------------------------------------------------------
BufferWriter::BufferWriter( unsigned char *buffer, int bufferLen )
{
Init( buffer, bufferLen );
}
//--------------------------------------------------------------------------------------------------------------
void BufferWriter::Init( unsigned char *buffer, int bufferLen )
{
m_overflow = false;
m_buffer = buffer;
m_remaining = bufferLen;
m_overallLength = bufferLen;
}
//--------------------------------------------------------------------------------------------------------------
void BufferWriter::WriteByte( unsigned char data )
{
if (!m_buffer || !m_remaining)
{
m_overflow = true;
return;
}
*m_buffer = data;
++m_buffer;
--m_remaining;
}
//--------------------------------------------------------------------------------------------------------------
void BufferWriter::WriteLong( int data )
{
if (!m_buffer || m_remaining < 4)
{
m_overflow = true;
return;
}
m_buffer[0] = data&0xff;
m_buffer[1] = (data>>8)&0xff;
m_buffer[2] = (data>>16)&0xff;
m_buffer[3] = data>>24;
m_buffer += 4;
m_remaining -= 4;
}
//--------------------------------------------------------------------------------------------------------------
void BufferWriter::WriteString( const char *str )
{
if (!m_buffer || !m_remaining)
{
m_overflow = true;
return;
}
if (!str)
str = "";
int len = strlen(str)+1;
if ( len > m_remaining )
{
m_overflow = true;
str = "";
len = 1;
}
strcpy((char *)m_buffer, str);
m_remaining -= len;
m_buffer += len;
}
//--------------------------------------------------------------------------------------------------------------
int BufferWriter::GetSpaceUsed()
{
return m_overallLength - m_remaining;
}
//--------------------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,66 @@
/***
*
* Copyright (c) 1999, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
//
// parsemsg.h
// MDC - copying from cstrike\cl_dll so career-mode stuff can catch messages
// in this dll. (and C++ifying it)
//
#ifndef PARSEMSG_H
#define PARSEMSG_H
#define ASSERT( x )
//--------------------------------------------------------------------------------------------------------------
void BEGIN_READ( void *buf, int size );
int READ_CHAR( void );
int READ_BYTE( void );
int READ_SHORT( void );
int READ_WORD( void );
int READ_LONG( void );
float READ_FLOAT( void );
char* READ_STRING( void );
float READ_COORD( void );
float READ_ANGLE( void );
float READ_HIRESANGLE( void );
int READ_OK( void );
//--------------------------------------------------------------------------------------------------------------
class BufferWriter
{
public:
BufferWriter();
BufferWriter( unsigned char *buffer, int bufferLen );
void Init( unsigned char *buffer, int bufferLen );
void WriteByte( unsigned char data );
void WriteLong( int data );
void WriteString( const char *str );
bool HasOverflowed();
int GetSpaceUsed();
protected:
unsigned char *m_buffer;
int m_remaining;
bool m_overflow;
int m_overallLength;
};
//--------------------------------------------------------------------------------------------------------------
#endif // PARSEMSG_H

View File

@ -0,0 +1,57 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( PARTICLEDEFH )
#define PARTICLEDEFH
#ifdef _WIN32
#pragma once
#endif
typedef enum {
pt_static,
pt_grav,
pt_slowgrav,
pt_fire,
pt_explode,
pt_explode2,
pt_blob,
pt_blob2,
pt_vox_slowgrav,
pt_vox_grav,
pt_clientcustom // Must have callback function specified
} ptype_t;
// !!! if this is changed, it must be changed in d_ifacea.h too !!!
typedef struct particle_s
{
// driver-usable fields
vec3_t org;
short color;
short packedColor;
// drivers never touch the following fields
struct particle_s *next;
vec3_t vel;
float ramp;
float die;
ptype_t type;
void (*deathfunc)( struct particle_s *particle );
// for pt_clientcusttom, we'll call this function each frame
void (*callback)( struct particle_s *particle, float frametime );
// For deathfunc, etc.
unsigned char context;
} particle_t;
#endif

View File

@ -0,0 +1,43 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( PMTRACEH )
#define PMTRACEH
#ifdef _WIN32
#pragma once
#endif
typedef struct
{
vec3_t normal;
float dist;
} pmplane_t;
typedef struct pmtrace_s pmtrace_t;
struct pmtrace_s
{
qboolean allsolid; // if true, plane is not valid
qboolean startsolid; // if true, the initial point was in a solid area
qboolean inopen, inwater; // End point is in empty space or in water
float fraction; // time completed, 1.0 = didn't hit anything
vec3_t endpos; // final position
pmplane_t plane; // surface normal at impact
int ent; // entity at impact
vec3_t deltavelocity; // Change in player's velocity caused by impact.
// Only run on server.
int hitgroup;
};
#endif

View File

@ -0,0 +1,119 @@
// port.h: portability helper
//
//////////////////////////////////////////////////////////////////////
#pragma once
#include "archtypes.h" // DAL
#ifdef _WIN32
// Insert your headers here
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define WIN32_EXTRA_LEAN
#include "winsani_in.h"
#include <windows.h>
#include "winsani_out.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#else // _WIN32
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h> // exit()
#include <string.h> // strncpy()
#include <ctype.h> // tolower()
#include <limits.h>
#include <sys/time.h>
#include <errno.h>
#include <sys/ioctl.h>
typedef unsigned char BYTE;
typedef int32 LONG;
//typedef uint32 ULONG;
#ifndef ARCHTYPES_H
typedef uint32 ULONG;
#endif
typedef void *HANDLE;
#ifndef HMODULE
typedef void *HMODULE;
#endif
typedef char * LPSTR;
#define __cdecl
#ifdef __linux__
typedef struct POINT_s
{
int x;
int y;
} POINT;
typedef void *HINSTANCE;
typedef void *HWND;
typedef void *HDC;
typedef void *HGLRC;
typedef struct RECT_s
{
int left;
int right;
int top;
int bottom;
} RECT;
#endif
#ifdef __cplusplus
//#undef FALSE
//#undef TRUE
#ifdef OSX
//#else
//const bool FALSE = false;
//const bool TRUE = true;
#endif
#endif
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
#ifdef __cplusplus
inline int ioctlsocket( int d, int cmd, uint32 *argp ) { return ioctl( d, cmd, argp ); }
inline int closesocket( int fd ) { return close( fd ); }
inline char * GetCurrentDirectory( size_t size, char * buf ) { return getcwd( buf, size ); }
inline int WSAGetLastError() { return errno; }
inline void DebugBreak( void ) { exit( 1 ); }
#endif
extern char g_szEXEName[ 4096 ];
#define _snprintf snprintf
#if defined(OSX)
#define SO_ARCH_SUFFIX ".dylib"
#else
#if defined ( __x86_64__ )
#define SO_ARCH_SUFFIX "_amd64.so"
#else
#define SO_ARCH_SUFFIX ".so"
#endif
#endif
#endif

View File

@ -0,0 +1,41 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( QFONTH )
#define QFONTH
#ifdef _WIN32
#pragma once
#endif
// Font stuff
#define NUM_GLYPHS 256
// does not exist: // #include "basetypes.h"
typedef struct
{
short startoffset;
short charwidth;
} charinfo;
typedef struct qfont_s
{
int width, height;
int rowcount;
int rowheight;
charinfo fontinfo[ NUM_GLYPHS ];
unsigned char data[4];
} qfont_t;
#endif // qfont.h

View File

@ -0,0 +1,39 @@
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ==========
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef QLIMITS_H
#define QLIMITS_H
#if defined( _WIN32 )
#pragma once
#endif
// DATA STRUCTURE INFO
#define MAX_NUM_ARGVS 50
// SYSTEM INFO
#define MAX_QPATH 64 // max length of a game pathname
#define MAX_OSPATH 260 // max length of a filesystem pathname
#define ON_EPSILON 0.1 // point on plane side epsilon
#define MAX_LIGHTSTYLE_INDEX_BITS 6
#define MAX_LIGHTSTYLES (1<<MAX_LIGHTSTYLE_INDEX_BITS)
// Resource counts;
#define MAX_MODEL_INDEX_BITS 9 // sent as a short
#define MAX_MODELS (1<<MAX_MODEL_INDEX_BITS)
#define MAX_SOUND_INDEX_BITS 9
#define MAX_SOUNDS (1<<MAX_SOUND_INDEX_BITS)
#define MAX_GENERIC_INDEX_BITS 9
#define MAX_GENERIC (1<<MAX_GENERIC_INDEX_BITS)
#define MAX_DECAL_INDEX_BITS 9
#define MAX_BASE_DECALS (1<<MAX_DECAL_INDEX_BITS)
#endif // QLIMITS_H

View File

@ -0,0 +1,44 @@
/*
*
* 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
/* <19039> ../common/quakedef.h:29 */
typedef int BOOL; /* size: 4 */
// user message
#define MAX_USER_MSG_DATA 192
/* <627f> ../common/quakedef.h:137 */
//moved to com_model.h
//typedef struct cache_user_s
//{
// void *data;
//} cache_user_t;
/* <4313b> ../common/quakedef.h:162 */
typedef int (*pfnUserMsgHook)(const char *, int, void *);

View File

@ -0,0 +1,197 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined ( R_EFXH )
#define R_EFXH
#ifdef _WIN32
#pragma once
#endif
// particle_t
#if !defined( PARTICLEDEFH )
#include "particledef.h"
#endif
// BEAM
#if !defined( BEAMDEFH )
#include "beamdef.h"
#endif
// dlight_t
#if !defined ( DLIGHTH )
#include "dlight.h"
#endif
// cl_entity_t
#if !defined( CL_ENTITYH )
#include "cl_entity.h"
#endif
/*
// FOR REFERENCE, These are the built-in tracer colors. Note, color 4 is the one
// that uses the tracerred/tracergreen/tracerblue and traceralpha cvar settings
color24 gTracerColors[] =
{
{ 255, 255, 255 }, // White
{ 255, 0, 0 }, // Red
{ 0, 255, 0 }, // Green
{ 0, 0, 255 }, // Blue
{ 0, 0, 0 }, // Tracer default, filled in from cvars, etc.
{ 255, 167, 17 }, // Yellow-orange sparks
{ 255, 130, 90 }, // Yellowish streaks (garg)
{ 55, 60, 144 }, // Blue egon streak
{ 255, 130, 90 }, // More Yellowish streaks (garg)
{ 255, 140, 90 }, // More Yellowish streaks (garg)
{ 200, 130, 90 }, // More red streaks (garg)
{ 255, 120, 70 }, // Darker red streaks (garg)
};
*/
// Temporary entity array
#define TENTPRIORITY_LOW 0
#define TENTPRIORITY_HIGH 1
// TEMPENTITY flags
#define FTENT_NONE 0x00000000
#define FTENT_SINEWAVE 0x00000001
#define FTENT_GRAVITY 0x00000002
#define FTENT_ROTATE 0x00000004
#define FTENT_SLOWGRAVITY 0x00000008
#define FTENT_SMOKETRAIL 0x00000010
#define FTENT_COLLIDEWORLD 0x00000020
#define FTENT_FLICKER 0x00000040
#define FTENT_FADEOUT 0x00000080
#define FTENT_SPRANIMATE 0x00000100
#define FTENT_HITSOUND 0x00000200
#define FTENT_SPIRAL 0x00000400
#define FTENT_SPRCYCLE 0x00000800
#define FTENT_COLLIDEALL 0x00001000 // will collide with world and slideboxes
#define FTENT_PERSIST 0x00002000 // tent is not removed when unable to draw
#define FTENT_COLLIDEKILL 0x00004000 // tent is removed upon collision with anything
#define FTENT_PLYRATTACHMENT 0x00008000 // tent is attached to a player (owner)
#define FTENT_SPRANIMATELOOP 0x00010000 // animating sprite doesn't die when last frame is displayed
#define FTENT_SPARKSHOWER 0x00020000
#define FTENT_NOMODEL 0x00040000 // Doesn't have a model, never try to draw ( it just triggers other things )
#define FTENT_CLIENTCUSTOM 0x00080000 // Must specify callback. Callback function is responsible for killing tempent and updating fields ( unless other flags specify how to do things )
typedef struct tempent_s
{
int flags;
float die;
float frameMax;
float x;
float y;
float z;
float fadeSpeed;
float bounceFactor;
int hitSound;
void ( *hitcallback ) ( struct tempent_s *ent, struct pmtrace_s *ptr );
void ( *callback ) ( struct tempent_s *ent, float frametime, float currenttime );
struct tempent_s *next;
int priority;
short clientIndex; // if attached, this is the index of the client to stick to
// if COLLIDEALL, this is the index of the client to ignore
// TENTS with FTENT_PLYRATTACHMENT MUST set the clientindex!
vec3_t tentOffset; // if attached, client origin + tentOffset = tent origin.
cl_entity_t entity;
// baseline.origin - velocity
// baseline.renderamt - starting fadeout intensity
// baseline.angles - angle velocity
} TEMPENTITY;
typedef struct efx_api_s efx_api_t;
struct efx_api_s
{
particle_t *( *R_AllocParticle ) ( void ( *callback ) ( struct particle_s *particle, float frametime ) );
void ( *R_BlobExplosion ) ( float * org );
void ( *R_Blood ) ( float * org, float * dir, int pcolor, int speed );
void ( *R_BloodSprite ) ( float * org, int colorindex, int modelIndex, int modelIndex2, float size );
void ( *R_BloodStream ) ( float * org, float * dir, int pcolor, int speed );
void ( *R_BreakModel ) ( float *pos, float *size, float *dir, float random, float life, int count, int modelIndex, char flags );
void ( *R_Bubbles ) ( float * mins, float * maxs, float height, int modelIndex, int count, float speed );
void ( *R_BubbleTrail ) ( float * start, float * end, float height, int modelIndex, int count, float speed );
void ( *R_BulletImpactParticles ) ( float * pos );
void ( *R_EntityParticles ) ( struct cl_entity_s *ent );
void ( *R_Explosion ) ( float *pos, int model, float scale, float framerate, int flags );
void ( *R_FizzEffect ) ( struct cl_entity_s *pent, int modelIndex, int density );
void ( *R_FireField ) ( float * org, int radius, int modelIndex, int count, int flags, float life );
void ( *R_FlickerParticles ) ( float * org );
void ( *R_FunnelSprite ) ( float *org, int modelIndex, int reverse );
void ( *R_Implosion ) ( float * end, float radius, int count, float life );
void ( *R_LargeFunnel ) ( float * org, int reverse );
void ( *R_LavaSplash ) ( float * org );
void ( *R_MultiGunshot ) ( float * org, float * dir, float * noise, int count, int decalCount, int *decalIndices );
void ( *R_MuzzleFlash ) ( float *pos1, int type );
void ( *R_ParticleBox ) ( float *mins, float *maxs, unsigned char r, unsigned char g, unsigned char b, float life );
void ( *R_ParticleBurst ) ( float * pos, int size, int color, float life );
void ( *R_ParticleExplosion ) ( float * org );
void ( *R_ParticleExplosion2 ) ( float * org, int colorStart, int colorLength );
void ( *R_ParticleLine ) ( float * start, float *end, unsigned char r, unsigned char g, unsigned char b, float life );
void ( *R_PlayerSprites ) ( int client, int modelIndex, int count, int size );
void ( *R_Projectile ) ( float * origin, float * velocity, int modelIndex, int life, int owner, void (*hitcallback)( struct tempent_s *ent, struct pmtrace_s *ptr ) );
void ( *R_RicochetSound ) ( float * pos );
void ( *R_RicochetSprite ) ( float *pos, struct model_s *pmodel, float duration, float scale );
void ( *R_RocketFlare ) ( float *pos );
void ( *R_RocketTrail ) ( float * start, float * end, int type );
void ( *R_RunParticleEffect ) ( float * org, float * dir, int color, int count );
void ( *R_ShowLine ) ( float * start, float * end );
void ( *R_SparkEffect ) ( float *pos, int count, int velocityMin, int velocityMax );
void ( *R_SparkShower ) ( float *pos );
void ( *R_SparkStreaks ) ( float * pos, int count, int velocityMin, int velocityMax );
void ( *R_Spray ) ( float * pos, float * dir, int modelIndex, int count, int speed, int spread, int rendermode );
void ( *R_Sprite_Explode ) ( TEMPENTITY *pTemp, float scale, int flags );
void ( *R_Sprite_Smoke ) ( TEMPENTITY *pTemp, float scale );
void ( *R_Sprite_Spray ) ( float * pos, float * dir, int modelIndex, int count, int speed, int iRand );
void ( *R_Sprite_Trail ) ( int type, float * start, float * end, int modelIndex, int count, float life, float size, float amplitude, int renderamt, float speed );
void ( *R_Sprite_WallPuff ) ( TEMPENTITY *pTemp, float scale );
void ( *R_StreakSplash ) ( float * pos, float * dir, int color, int count, float speed, int velocityMin, int velocityMax );
void ( *R_TracerEffect ) ( float * start, float * end );
void ( *R_UserTracerParticle ) ( float * org, float * vel, float life, int colorIndex, float length, unsigned char deathcontext, void ( *deathfunc)( struct particle_s *particle ) );
particle_t *( *R_TracerParticles ) ( float * org, float * vel, float life );
void ( *R_TeleportSplash ) ( float * org );
void ( *R_TempSphereModel ) ( float *pos, float speed, float life, int count, int modelIndex );
TEMPENTITY *( *R_TempModel ) ( float *pos, float *dir, float *angles, float life, int modelIndex, int soundtype );
TEMPENTITY *( *R_DefaultSprite ) ( float *pos, int spriteIndex, float framerate );
TEMPENTITY *( *R_TempSprite ) ( float *pos, float *dir, float scale, int modelIndex, int rendermode, int renderfx, float a, float life, int flags );
int ( *Draw_DecalIndex ) ( int id );
int ( *Draw_DecalIndexFromName ) ( char *name );
void ( *R_DecalShoot ) ( int textureIndex, int entity, int modelIndex, float * position, int flags );
void ( *R_AttachTentToPlayer ) ( int client, int modelIndex, float zoffset, float life );
void ( *R_KillAttachedTents ) ( int client );
BEAM *( *R_BeamCirclePoints ) ( int type, float * start, float * end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
BEAM *( *R_BeamEntPoint ) ( int startEnt, float * end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
BEAM *( *R_BeamEnts ) ( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
BEAM *( *R_BeamFollow ) ( int startEnt, int modelIndex, float life, float width, float r, float g, float b, float brightness );
void ( *R_BeamKill ) ( int deadEntity );
BEAM *( *R_BeamLightning ) ( float * start, float * end, int modelIndex, float life, float width, float amplitude, float brightness, float speed );
BEAM *( *R_BeamPoints ) ( float * start, float * end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
BEAM *( *R_BeamRing ) ( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
dlight_t *( *CL_AllocDlight ) ( int key );
dlight_t *( *CL_AllocElight ) ( int key );
TEMPENTITY *( *CL_TempEntAlloc ) ( float * org, struct model_s *model );
TEMPENTITY *( *CL_TempEntAllocNoModel ) ( float * org );
TEMPENTITY *( *CL_TempEntAllocHigh ) ( float * org, struct model_s *model );
TEMPENTITY *( *CL_TentEntAllocCustom ) ( float *origin, struct model_s *model, int high, void ( *callback ) ( struct tempent_s *ent, float frametime, float currenttime ) );
void ( *R_GetPackedColor ) ( short *packed, short color );
short ( *R_LookupColor ) ( unsigned char r, unsigned char g, unsigned char b );
void ( *R_DecalRemoveAll ) ( int textureIndex ); //textureIndex points to the decal index in the array, not the actual texture index.
void ( *R_FireCustomDecal ) ( int textureIndex, int entity, int modelIndex, float * position, int flags, float scale );
};
extern efx_api_t efx;
#endif

View File

@ -0,0 +1,151 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#if !defined( R_STUDIOINT_H )
#define R_STUDIOINT_H
#if defined( _WIN32 )
#pragma once
#endif
#define STUDIO_INTERFACE_VERSION 1
typedef struct engine_studio_api_s
{
// Allocate number*size bytes and zero it
void *( *Mem_Calloc ) ( int number, size_t size );
// Check to see if pointer is in the cache
void *( *Cache_Check ) ( struct cache_user_s *c );
// Load file into cache ( can be swapped out on demand )
void ( *LoadCacheFile ) ( char *path, struct cache_user_s *cu );
// Retrieve model pointer for the named model
struct model_s *( *Mod_ForName ) ( const char *name, int crash_if_missing );
// Retrieve pointer to studio model data block from a model
void *( *Mod_Extradata ) ( struct model_s *mod );
// Retrieve indexed model from client side model precache list
struct model_s *( *GetModelByIndex ) ( int index );
// Get entity that is set for rendering
struct cl_entity_s * ( *GetCurrentEntity ) ( void );
// Get referenced player_info_t
struct player_info_s *( *PlayerInfo ) ( int index );
// Get most recently received player state data from network system
struct entity_state_s *( *GetPlayerState ) ( int index );
// Get viewentity
struct cl_entity_s * ( *GetViewEntity ) ( void );
// Get current frame count, and last two timestampes on client
void ( *GetTimes ) ( int *framecount, double *current, double *old );
// Get a pointer to a cvar by name
struct cvar_s *( *GetCvar ) ( const char *name );
// Get current render origin and view vectors ( up, right and vpn )
void ( *GetViewInfo ) ( float *origin, float *upv, float *rightv, float *vpnv );
// Get sprite model used for applying chrome effect
struct model_s *( *GetChromeSprite ) ( void );
// Get model counters so we can incement instrumentation
void ( *GetModelCounters ) ( int **s, int **a );
// Get software scaling coefficients
void ( *GetAliasScale ) ( float *x, float *y );
// Get bone, light, alias, and rotation matrices
float ****( *StudioGetBoneTransform ) ( void );
float ****( *StudioGetLightTransform )( void );
float ***( *StudioGetAliasTransform ) ( void );
float ***( *StudioGetRotationMatrix ) ( void );
// Set up body part, and get submodel pointers
void ( *StudioSetupModel ) ( int bodypart, void **ppbodypart, void **ppsubmodel );
// Check if entity's bbox is in the view frustum
int ( *StudioCheckBBox ) ( void );
// Apply lighting effects to model
void ( *StudioDynamicLight ) ( struct cl_entity_s *ent, struct alight_s *plight );
void ( *StudioEntityLight ) ( struct alight_s *plight );
void ( *StudioSetupLighting ) ( struct alight_s *plighting );
// Draw mesh vertices
void ( *StudioDrawPoints ) ( void );
// Draw hulls around bones
void ( *StudioDrawHulls ) ( void );
// Draw bbox around studio models
void ( *StudioDrawAbsBBox ) ( void );
// Draws bones
void ( *StudioDrawBones ) ( void );
// Loads in appropriate texture for model
void ( *StudioSetupSkin ) ( void *ptexturehdr, int index );
// Sets up for remapped colors
void ( *StudioSetRemapColors ) ( int top, int bottom );
// Set's player model and returns model pointer
struct model_s *( *SetupPlayerModel ) ( int index );
// Fires any events embedded in animation
void ( *StudioClientEvents ) ( void );
// Retrieve/set forced render effects flags
int ( *GetForceFaceFlags ) ( void );
void ( *SetForceFaceFlags ) ( int flags );
// Tell engine the value of the studio model header
void ( *StudioSetHeader ) ( void *header );
// Tell engine which model_t * is being renderered
void ( *SetRenderModel ) ( struct model_s *model );
// Final state setup and restore for rendering
void ( *SetupRenderer ) ( int rendermode );
void ( *RestoreRenderer ) ( void );
// Set render origin for applying chrome effect
void ( *SetChromeOrigin ) ( void );
// True if using D3D/OpenGL
int ( *IsHardware ) ( void );
// Only called by hardware interface
void ( *GL_StudioDrawShadow ) ( void );
void ( *GL_SetRenderMode ) ( int mode );
void ( *StudioSetRenderamt ) (int iRenderamt); //!!!CZERO added for rendering glass on viewmodels
void ( *StudioSetCullState ) ( int iCull );
void ( *StudioRenderShadow ) ( int iSprite, float *p1, float *p2, float *p3, float *p4 );
} engine_studio_api_t;
typedef struct server_studio_api_s
{
// Allocate number*size bytes and zero it
void *( *Mem_Calloc ) ( int number, size_t size );
// Check to see if pointer is in the cache
void *( *Cache_Check ) ( struct cache_user_s *c );
// Load file into cache ( can be swapped out on demand )
void ( *LoadCacheFile ) ( char *path, struct cache_user_s *cu );
// Retrieve pointer to studio model data block from a model
void *( *Mod_Extradata ) ( struct model_s *mod );
} server_studio_api_t;
// client blending
typedef struct r_studio_interface_s
{
int version;
int ( *StudioDrawModel ) ( int flags );
int ( *StudioDrawPlayer ) ( int flags, struct entity_state_s *pplayer );
} r_studio_interface_t;
extern r_studio_interface_t *pStudioAPI;
// server blending
#define SV_BLENDING_INTERFACE_VERSION 1
typedef struct sv_blending_interface_s
{
int version;
void ( *SV_StudioSetupBones )( struct model_s *pModel,
float frame,
int sequence,
const vec3_t angles,
const vec3_t origin,
const byte *pcontroller,
const byte *pblending,
int iBone,
const edict_t *pEdict );
} sv_blending_interface_t;
#endif // R_STUDIOINT_H

View File

@ -0,0 +1,75 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( REF_PARAMSH )
#define REF_PARAMSH
typedef struct ref_params_s
{
// Output
float vieworg[3];
float viewangles[3];
float forward[3];
float right[3];
float up[3];
// Client frametime;
float frametime;
// Client time
float time;
// Misc
int intermission;
int paused;
int spectator;
int onground;
int waterlevel;
float simvel[3];
float simorg[3];
float viewheight[3];
float idealpitch;
float cl_viewangles[3];
int health;
float crosshairangle[3];
float viewsize;
float punchangle[3];
int maxclients;
int viewentity;
int playernum;
int max_entities;
int demoplayback;
int hardware;
int smoothing;
// Last issued usercmd
struct usercmd_s *cmd;
// Movevars
struct movevars_s *movevars;
int viewport[4]; // the viewport coordinates x ,y , width, height
int nextView; // the renderer calls ClientDLL_CalcRefdef() and Renderview
// so long in cycles until this value is 0 (multiple views)
int onlyClientDraw; // if !=0 nothing is drawn by the engine except clientDraw functions
} ref_params_t;
#endif // !REF_PARAMSH

View File

@ -0,0 +1,24 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#if !defined( SCREENFADEH )
#define SCREENFADEH
#ifdef _WIN32
#pragma once
#endif
typedef struct screenfade_s
{
float fadeSpeed; // How fast to fade (tics / second) (+ fade in, - fade out)
float fadeEnd; // When the fading hits maximum
float fadeTotalEnd; // Total End Time of the fade (used for FFADE_OUT)
float fadeReset; // When to reset to not fading (for fadeout and hold)
byte fader, fadeg, fadeb, fadealpha; // Fade color
int fadeFlags; // Fading flags
} screenfade_t;
#endif // !SCREENFADEH

View File

@ -0,0 +1,29 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( STUDIO_EVENTH )
#define STUDIO_EVENTH
#ifdef _WIN32
#pragma once
#endif
typedef struct mstudioevent_s
{
int frame;
int event;
int type;
char options[64];
} mstudioevent_t;
#endif // STUDIO_EVENTH

View File

@ -0,0 +1,64 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( TRIANGLEAPIH )
#define TRIANGLEAPIH
#ifdef _WIN32
#pragma once
#endif
typedef enum
{
TRI_FRONT = 0,
TRI_NONE = 1,
} TRICULLSTYLE;
#define TRI_API_VERSION 1
#define TRI_TRIANGLES 0
#define TRI_TRIANGLE_FAN 1
#define TRI_QUADS 2
#define TRI_POLYGON 3
#define TRI_LINES 4
#define TRI_TRIANGLE_STRIP 5
#define TRI_QUAD_STRIP 6
typedef struct triangleapi_s
{
int version;
void ( *RenderMode )( int mode );
void ( *Begin )( int primitiveCode );
void ( *End ) ( void );
void ( *Color4f ) ( float r, float g, float b, float a );
void ( *Color4ub ) ( unsigned char r, unsigned char g, unsigned char b, unsigned char a );
void ( *TexCoord2f ) ( float u, float v );
void ( *Vertex3fv ) ( float *worldPnt );
void ( *Vertex3f ) ( float x, float y, float z );
void ( *Brightness ) ( float brightness );
void ( *CullFace ) ( TRICULLSTYLE style );
int ( *SpriteTexture ) ( struct model_s *pSpriteModel, int frame );
int ( *WorldToScreen ) ( float *world, float *screen ); // Returns 1 if it's z clipped
void ( *Fog ) ( float flFogColor[3], float flStart, float flEnd, int bOn ); // Works just like GL_FOG, flFogColor is r/g/b.
void ( *ScreenToWorld ) ( float *screen, float *world );
void ( *GetMatrix ) ( const int pname, float *matrix );
int ( *BoxInPVS ) ( float *mins, float *maxs );
void ( *LightAtPoint ) ( float *pos, float *value );
void ( *Color4fRendermode ) ( float r, float g, float b, float a, int rendermode );
void ( *FogParams ) ( float flDensity, int iFogSkybox ); // Used with Fog()...sets fog density and whether the fog should be applied to the skybox
} triangleapi_t;
#endif // !TRIANGLEAPIH

View File

@ -0,0 +1,41 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef USERCMD_H
#define USERCMD_H
#ifdef _WIN32
#pragma once
#endif
typedef struct usercmd_s
{
short lerp_msec; // Interpolation time on client
byte msec; // Duration in ms of command
vec3_t viewangles; // Command view angles.
// intended velocities
float forwardmove; // Forward velocity.
float sidemove; // Sideways velocity.
float upmove; // Upward velocity.
byte lightlevel; // Light level at spot where we are standing.
unsigned short buttons; // Attack buttons
byte impulse; // Impulse command issued.
byte weaponselect; // Current weapon id
// Experimental player impact stuff.
int impact_index;
vec3_t impact_position;
} usercmd_t;
#endif // USERCMD_H

View File

@ -0,0 +1,35 @@
/*
*
* 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
/* <430ee> ../common/vmodes.h:40 */
typedef struct rect_s
{
int left, right, top, bottom;
} wrect_t;

View File

@ -0,0 +1,53 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef WEAPONINFO_H
#define WEAPONINFO_H
#ifdef _WIN32
#pragma once
#endif
// Info about weapons player might have in his/her possession
typedef struct weapon_data_s
{
int m_iId;
int m_iClip;
float m_flNextPrimaryAttack;
float m_flNextSecondaryAttack;
float m_flTimeWeaponIdle;
int m_fInReload;
int m_fInSpecialReload;
float m_flNextReload;
float m_flPumpTime;
float m_fReloadTime;
float m_fAimedDamage;
float m_fNextAimBonus;
int m_fInZoom;
int m_iWeaponState;
int iuser1;
int iuser2;
int iuser3;
int iuser4;
float fuser1;
float fuser2;
float fuser3;
float fuser4;
} weapon_data_t;
#endif // WEAPONINFO_H

View File

@ -0,0 +1,7 @@
#if _MSC_VER >= 1500 // MSVC++ 9.0 (Visual Studio 2008)
#pragma push_macro("ARRAYSIZE")
#ifdef ARRAYSIZE
#undef ARRAYSIZE
#endif
#define HSPRITE WINDOWS_HSPRITE
#endif

View File

@ -0,0 +1,4 @@
#if _MSC_VER >= 1500 // MSVC++ 9.0 (Visual Studio 2008)
#undef HSPRITE
#pragma pop_macro("ARRAYSIZE")
#endif

View File

@ -0,0 +1,145 @@
/*
*
* 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
typedef enum Activity_s
{
ACT_INVALID = -1,
ACT_RESET = 0, // Set m_Activity to this invalid value to force a reset to m_IdealActivity
ACT_IDLE,
ACT_GUARD,
ACT_WALK,
ACT_RUN,
ACT_FLY,
ACT_SWIM,
ACT_HOP,
ACT_LEAP,
ACT_FALL,
ACT_LAND,
ACT_STRAFE_LEFT,
ACT_STRAFE_RIGHT,
ACT_ROLL_LEFT,
ACT_ROLL_RIGHT,
ACT_TURN_LEFT,
ACT_TURN_RIGHT,
ACT_CROUCH,
ACT_CROUCHIDLE,
ACT_STAND,
ACT_USE,
ACT_SIGNAL1,
ACT_SIGNAL2,
ACT_SIGNAL3,
ACT_TWITCH,
ACT_COWER,
ACT_SMALL_FLINCH,
ACT_BIG_FLINCH,
ACT_RANGE_ATTACK1,
ACT_RANGE_ATTACK2,
ACT_MELEE_ATTACK1,
ACT_MELEE_ATTACK2,
ACT_RELOAD,
ACT_ARM,
ACT_DISARM,
ACT_EAT,
ACT_DIESIMPLE,
ACT_DIEBACKWARD,
ACT_DIEFORWARD,
ACT_DIEVIOLENT,
ACT_BARNACLE_HIT,
ACT_BARNACLE_PULL,
ACT_BARNACLE_CHOMP,
ACT_BARNACLE_CHEW,
ACT_SLEEP,
ACT_INSPECT_FLOOR,
ACT_INSPECT_WALL,
ACT_IDLE_ANGRY,
ACT_WALK_HURT,
ACT_RUN_HURT,
ACT_HOVER,
ACT_GLIDE,
ACT_FLY_LEFT,
ACT_FLY_RIGHT,
ACT_DETECT_SCENT,
ACT_SNIFF,
ACT_BITE,
ACT_THREAT_DISPLAY,
ACT_FEAR_DISPLAY,
ACT_EXCITED,
ACT_SPECIAL_ATTACK1,
ACT_SPECIAL_ATTACK2,
ACT_COMBAT_IDLE,
ACT_WALK_SCARED,
ACT_RUN_SCARED,
ACT_VICTORY_DANCE,
ACT_DIE_HEADSHOT,
ACT_DIE_CHESTSHOT,
ACT_DIE_GUTSHOT,
ACT_DIE_BACKSHOT,
ACT_FLINCH_HEAD,
ACT_FLINCH_CHEST,
ACT_FLINCH_STOMACH,
ACT_FLINCH_LEFTARM,
ACT_FLINCH_RIGHTARM,
ACT_FLINCH_LEFTLEG,
ACT_FLINCH_RIGHTLEG,
ACT_FLINCH,
ACT_LARGE_FLINCH,
ACT_HOLDBOMB,
ACT_IDLE_FIDGET,
ACT_IDLE_SCARED,
ACT_IDLE_SCARED_FIDGET,
ACT_FOLLOW_IDLE,
ACT_FOLLOW_IDLE_FIDGET,
ACT_FOLLOW_IDLE_SCARED,
ACT_FOLLOW_IDLE_SCARED_FIDGET,
ACT_CROUCH_IDLE,
ACT_CROUCH_IDLE_FIDGET,
ACT_CROUCH_IDLE_SCARED,
ACT_CROUCH_IDLE_SCARED_FIDGET,
ACT_CROUCH_WALK,
ACT_CROUCH_WALK_SCARED,
ACT_CROUCH_DIE,
ACT_WALK_BACK,
ACT_IDLE_SNEAKY,
ACT_IDLE_SNEAKY_FIDGET,
ACT_WALK_SNEAKY,
ACT_WAVE,
ACT_YES,
ACT_NO,
} Activity;
typedef struct
{
int type;
char *name;
} activity_map_t;
extern activity_map_t activity_map[];

View File

@ -0,0 +1,111 @@
/*
*
* 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.
*
*/
#define _A(a)\
{ a, #a }
activity_map_t activity_map[] =
{
_A(ACT_IDLE),
_A(ACT_GUARD),
_A(ACT_WALK),
_A(ACT_RUN),
_A(ACT_FLY),
_A(ACT_SWIM),
_A(ACT_HOP),
_A(ACT_LEAP),
_A(ACT_FALL),
_A(ACT_LAND),
_A(ACT_STRAFE_LEFT),
_A(ACT_STRAFE_RIGHT),
_A(ACT_ROLL_LEFT),
_A(ACT_ROLL_RIGHT),
_A(ACT_TURN_LEFT),
_A(ACT_TURN_RIGHT),
_A(ACT_CROUCH),
_A(ACT_CROUCHIDLE),
_A(ACT_STAND),
_A(ACT_USE),
_A(ACT_SIGNAL1),
_A(ACT_SIGNAL2),
_A(ACT_SIGNAL3),
_A(ACT_TWITCH),
_A(ACT_COWER),
_A(ACT_SMALL_FLINCH),
_A(ACT_BIG_FLINCH),
_A(ACT_RANGE_ATTACK1),
_A(ACT_RANGE_ATTACK2),
_A(ACT_MELEE_ATTACK1),
_A(ACT_MELEE_ATTACK2),
_A(ACT_RELOAD),
_A(ACT_ARM),
_A(ACT_DISARM),
_A(ACT_EAT),
_A(ACT_DIESIMPLE),
_A(ACT_DIEBACKWARD),
_A(ACT_DIEFORWARD),
_A(ACT_DIEVIOLENT),
_A(ACT_BARNACLE_HIT),
_A(ACT_BARNACLE_PULL),
_A(ACT_BARNACLE_CHOMP),
_A(ACT_BARNACLE_CHEW),
_A(ACT_SLEEP),
_A(ACT_INSPECT_FLOOR),
_A(ACT_INSPECT_WALL),
_A(ACT_IDLE_ANGRY),
_A(ACT_WALK_HURT),
_A(ACT_RUN_HURT),
_A(ACT_HOVER),
_A(ACT_GLIDE),
_A(ACT_FLY_LEFT),
_A(ACT_FLY_RIGHT),
_A(ACT_DETECT_SCENT),
_A(ACT_SNIFF),
_A(ACT_BITE),
_A(ACT_THREAT_DISPLAY),
_A(ACT_FEAR_DISPLAY),
_A(ACT_EXCITED),
_A(ACT_SPECIAL_ATTACK1),
_A(ACT_SPECIAL_ATTACK2),
_A(ACT_COMBAT_IDLE),
_A(ACT_WALK_SCARED),
_A(ACT_RUN_SCARED),
_A(ACT_VICTORY_DANCE),
_A(ACT_DIE_HEADSHOT),
_A(ACT_DIE_CHESTSHOT),
_A(ACT_DIE_GUTSHOT),
_A(ACT_DIE_BACKSHOT),
_A(ACT_FLINCH_HEAD),
_A(ACT_FLINCH_CHEST),
_A(ACT_FLINCH_STOMACH),
_A(ACT_FLINCH_LEFTARM),
_A(ACT_FLINCH_RIGHTARM),
_A(ACT_FLINCH_LEFTLEG),
_A(ACT_FLINCH_RIGHTLEG),
0, NULL
};

View File

@ -0,0 +1,42 @@
/*
*
* 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
class CAirtank: public CGrenade {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual void Killed(entvars_t *pevAttacker, int iGib) = 0;
virtual int BloodColor() = 0;
int GetState() const { return m_state; }
private:
int m_state;
};

View File

@ -0,0 +1,98 @@
/*
*
* 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
class C9MMAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};
class CBuckShotAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};
class C556NatoAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};
class C556NatoBoxAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};
class C762NatoAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};
class C45ACPAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};
class C50AEAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};
class C338MagnumAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};
class C57MMAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};
class C357SIGAmmo: public CBasePlayerAmmo {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};

View File

@ -0,0 +1,105 @@
/*
*
* 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
#include "activity.h"
class EHANDLE;
enum MONSTERSTATE
{
MONSTERSTATE_NONE = 0,
MONSTERSTATE_IDLE,
MONSTERSTATE_COMBAT,
MONSTERSTATE_ALERT,
MONSTERSTATE_HUNT,
MONSTERSTATE_PRONE,
MONSTERSTATE_SCRIPT,
MONSTERSTATE_PLAYDEAD,
MONSTERSTATE_DEAD
};
class CBaseToggle;
class CBaseMonster: public CBaseToggle {
public:
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual int TakeHealth(float flHealth, int bitsDamageType) = 0;
virtual void Killed(entvars_t *pevAttacker, int iGib) = 0;
virtual int BloodColor() = 0;
virtual BOOL IsAlive() = 0;
virtual float ChangeYaw(int speed) = 0;
virtual BOOL HasHumanGibs() = 0;
virtual BOOL HasAlienGibs() = 0;
virtual void FadeMonster() = 0;
virtual void GibMonster() = 0;
virtual Activity GetDeathActivity() = 0;
virtual void BecomeDead() = 0;
virtual BOOL ShouldFadeOnDeath() = 0;
virtual int IRelationship(CBaseEntity *pTarget) = 0;
virtual void PainSound() = 0;
virtual void ResetMaxSpeed() = 0;
virtual void ReportAIState() = 0;
virtual void MonsterInitDead() = 0;
virtual void Look(int iDistance) = 0;
virtual CBaseEntity *BestVisibleEnemy() = 0;
virtual BOOL FInViewCone(CBaseEntity *pEntity) = 0;
virtual BOOL FInViewCone(const Vector *pOrigin) = 0;
public:
void SetConditions(int iConditions) { m_afConditions |= iConditions; }
void ClearConditions(int iConditions) { m_afConditions &= ~iConditions; }
BOOL HasConditions(int iConditions) { return (m_afConditions & iConditions) ? TRUE : FALSE; }
BOOL HasAllConditions(int iConditions) { return ((m_afConditions & iConditions) == iConditions) ? TRUE : FALSE; }
void Remember(int iMemory) { m_afMemory |= iMemory; }
void Forget(int iMemory) { m_afMemory &= ~iMemory; }
BOOL HasMemory(int iMemory) { return (m_afMemory & iMemory) ? TRUE : FALSE; }
BOOL HasAllMemories(int iMemory) { return ((m_afMemory & iMemory) == iMemory) ? TRUE : FALSE; }
void StopAnimation() { pev->framerate = 0.0f; }
public:
Activity m_Activity; // what the monster is doing (animation)
Activity m_IdealActivity; // monster should switch to this activity
int m_LastHitGroup; // the last body region that took damage
int m_bitsDamageType; // what types of damage has monster (player) taken
BYTE m_rgbTimeBasedDamage[8];
MONSTERSTATE m_MonsterState; // monster's current state
MONSTERSTATE m_IdealMonsterState; // monster should change to this state
int m_afConditions;
int m_afMemory;
float m_flNextAttack; // cannot attack again until this time
EHANDLE m_hEnemy; // the entity that the monster is fighting.
EHANDLE m_hTargetEnt; // the entity that the monster is trying to reach
float m_flFieldOfView; // width of monster's field of view ( dot product )
int m_bloodColor; // color of blood particless
Vector m_HackedGunPos; // HACK until we can query end of gun
Vector m_vecEnemyLKP; // last known position of enemy. (enemy's origin)
};

View File

@ -0,0 +1,131 @@
/*
*
* 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
#define SF_PENDULUM_SWING 2 // spawnflag that makes a pendulum a rope swing.
#define SF_BRUSH_ACCDCC 16 // brush should accelerate and decelerate when toggled
#define SF_BRUSH_HURT 32 // rotating brush that inflicts pain based on rotation speed
#define SF_ROTATING_NOT_SOLID 64 // some special rotating objects are not solid.
#define SF_WALL_START_OFF 0x0001
#define SF_CONVEYOR_VISUAL 0x0001
#define SF_CONVEYOR_NOTSOLID 0x0002
#define SF_WORLD_DARK 0x0001 // Fade from black at startup
#define SF_WORLD_TITLE 0x0002 // Display game title at startup
#define SF_WORLD_FORCETEAM 0x0004 // Force teams
#define FANPITCHMIN 30
#define FANPITCHMAX 100
// This is just a solid wall if not inhibited
class CFuncWall: public CBaseEntity {
public:
virtual void Spawn() = 0;
// Bmodels don't go across transitions
virtual int ObjectCaps() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
};
class CFuncWallToggle: public CFuncWall {
public:
virtual void Spawn() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
};
class CFuncConveyor: public CFuncWall {
public:
virtual void Spawn() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
};
// A simple entity that looks solid but lets you walk through it.
class CFuncIllusionary: public CBaseToggle {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int ObjectCaps() = 0;
};
// Monster only clip brush
//
// This brush will be solid for any entity who has the FL_MONSTERCLIP flag set
// in pev->flags
//
// otherwise it will be invisible and not solid. This can be used to keep
// specific monsters out of certain areas
class CFuncMonsterClip: public CFuncWall {
public:
virtual void Spawn() = 0;
// Clear out func_wall's use function
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
};
class CFuncRotating: public CBaseEntity {
public:
// basic functions
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual void Blocked(CBaseEntity *pOther) = 0;
public:
float m_flFanFriction;
float m_flAttenuation;
float m_flVolume;
float m_pitch;
int m_sounds;
};
class CPendulum: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual void Touch(CBaseEntity *pOther) = 0;
virtual void Blocked(CBaseEntity *pOther) = 0;
public:
float m_accel; // Acceleration
float m_distance;
float m_time;
float m_damp;
float m_maxSpeed;
float m_dampSpeed;
Vector m_center;
Vector m_start;
};

View File

@ -0,0 +1,641 @@
/*
*
* 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
#include "bot/cs_gamestate.h"
#include "bot/cs_bot_manager.h"
#include "bot/cs_bot_chatter.h"
#define PRIMARY_WEAPON_BUY_COUNT 13
#define SECONDARY_WEAPON_BUY_COUNT 3
#define FLAG_PROGRESS_DRAW 0x0 // draw status bar progress
#define FLAG_PROGRESS_START 0x1 // init status bar progress
#define FLAG_PROGRESS_HIDE 0x2 // hide status bar progress
#define HI_X 0x01
#define LO_X 0x02
#define HI_Y 0x04
#define LO_Y 0x08
#define HI_Z 0x10
#define LO_Z 0x20
extern int _navAreaCount;
extern int _currentIndex;
extern struct BuyInfo primaryWeaponBuyInfoCT[PRIMARY_WEAPON_BUY_COUNT];
extern struct BuyInfo secondaryWeaponBuyInfoCT[SECONDARY_WEAPON_BUY_COUNT];
extern struct BuyInfo primaryWeaponBuyInfoT[PRIMARY_WEAPON_BUY_COUNT];
extern struct BuyInfo secondaryWeaponBuyInfoT[SECONDARY_WEAPON_BUY_COUNT];
class CCSBot;
class BotChatterInterface;
class BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const = 0;
};
class IdleState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual const char *GetName() const { return "Idle"; }
};
class HuntState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "Hunt"; }
public:
CNavArea *m_huntArea;
};
class AttackState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "Attack"; }
public:
enum DodgeStateType
{
STEADY_ON,
SLIDE_LEFT,
SLIDE_RIGHT,
JUMP,
NUM_ATTACK_STATES
} m_dodgeState;
float m_nextDodgeStateTimestamp;
CountdownTimer m_repathTimer;
float m_scopeTimestamp;
bool m_haveSeenEnemy;
bool m_isEnemyHidden;
float m_reacquireTimestamp;
float m_shieldToggleTimestamp;
bool m_shieldForceOpen;
float m_pinnedDownTimestamp;
bool m_crouchAndHold;
bool m_didAmbushCheck;
bool m_dodge;
bool m_firstDodge;
bool m_isCoward;
CountdownTimer m_retreatTimer;
};
class InvestigateNoiseState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "InvestigateNoise"; }
private:
void AttendCurrentNoise(CCSBot *me);
Vector m_checkNoisePosition;
};
class BuyState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "Buy"; }
public:
bool m_isInitialDelay;
int m_prefRetries;
int m_prefIndex;
int m_retries;
bool m_doneBuying;
bool m_buyDefuseKit;
bool m_buyGrenade;
bool m_buyShield;
bool m_buyPistol;
};
class MoveToState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "MoveTo"; }
void SetGoalPosition(const Vector &pos) { m_goalPosition = pos; }
void SetRouteType(RouteType route) { m_routeType = route; }
private:
Vector m_goalPosition;
RouteType m_routeType;
bool m_radioedPlan;
bool m_askedForCover;
};
class FetchBombState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual const char *GetName() const { return "FetchBomb"; }
};
class PlantBombState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "PlantBomb"; }
};
class DefuseBombState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "DefuseBomb"; }
};
class HideState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "Hide"; }
public:
void SetHidingSpot(const Vector &pos) { m_hidingSpot = pos; }
const Vector &GetHidingSpot() const { return m_hidingSpot; }
void SetSearchArea(CNavArea *area) { m_searchFromArea = area; }
void SetSearchRange(float range) { m_range = range; }
void SetDuration(float time) { m_duration = time; }
void SetHoldPosition(bool hold) { m_isHoldingPosition = hold; }
bool IsAtSpot() const { return m_isAtSpot; }
public:
CNavArea *m_searchFromArea;
float m_range;
Vector m_hidingSpot;
bool m_isAtSpot;
float m_duration;
bool m_isHoldingPosition;
float m_holdPositionTime;
bool m_heardEnemy;
float m_firstHeardEnemyTime;
int m_retry;
Vector m_leaderAnchorPos;
};
class EscapeFromBombState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "EscapeFromBomb"; }
};
class FollowState: public BotState
{
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "Follow"; }
void SetLeader(CBaseEntity *leader) { m_leader = leader; }
public:
EHANDLE m_leader;
Vector m_lastLeaderPos;
bool m_isStopped;
float m_stoppedTimestamp;
enum LeaderMotionStateType
{
INVALID,
STOPPED,
WALKING,
RUNNING
} m_leaderMotionState;
IntervalTimer m_leaderMotionStateTime;
bool m_isSneaking;
float m_lastSawLeaderTime;
CountdownTimer m_repathInterval;
IntervalTimer m_walkTime;
bool m_isAtWalkSpeed;
float m_waitTime;
CountdownTimer m_idleTimer;
};
class UseEntityState: public BotState {
public:
virtual void OnEnter(CCSBot *me) {}
virtual void OnUpdate(CCSBot *me) {}
virtual void OnExit(CCSBot *me) {}
virtual const char *GetName() const { return "UseEntity"; }
void SetEntity(CBaseEntity *entity) { m_entity = entity; }
private:
EHANDLE m_entity;
};
// The Counter-strike Bot
class CCSBot: public CBot {
public:
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; // invoked when injured by something (EXTEND) - returns the amount of damage inflicted
virtual void Killed(entvars_t *pevAttacker, int iGib) = 0; // invoked when killed (EXTEND)
virtual void RoundRespawn() = 0;
virtual void Blind(float duration, float holdTime, float fadeTime, int alpha = 255) = 0; // player blinded by a flashbang
virtual void OnTouchingWeapon(CWeaponBox *box) = 0; // invoked when in contact with a CWeaponBox
virtual bool Initialize(const BotProfile *profile) = 0; // (EXTEND) prepare bot for action
virtual void SpawnBot() = 0; // (EXTEND) spawn the bot into the game
virtual void Upkeep() = 0; // lightweight maintenance, invoked frequently
virtual void Update() = 0; // heavyweight algorithms, invoked less often
virtual void Walk() = 0;
virtual bool Jump(bool mustJump = false) = 0; // returns true if jump was started
virtual void OnEvent(GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL) = 0; // invoked when event occurs in the game (some events have NULL entity)
#define CHECK_FOV true
virtual bool IsVisible(const Vector *pos, bool testFOV = false) const = 0; // return true if we can see the point
virtual bool IsVisible(CBasePlayer *player, bool testFOV = false, unsigned char *visParts = NULL) const = 0; // return true if we can see any part of the player
virtual bool IsEnemyPartVisible(VisiblePartType part) const = 0; // if enemy is visible, return the part we see for our current enemy
public:
const Vector &GetEyePosition() const
{
m_eyePos = pev->origin + pev->view_ofs;
return m_eyePos;
}
public:
friend class CCSBotManager;
// TODO: Get rid of these
friend class AttackState;
friend class BuyState;
char m_name[64]; // copied from STRING(pev->netname) for debugging
// behavior properties
float m_combatRange; // desired distance between us and them during gunplay
mutable bool m_isRogue; // if true, the bot is a "rogue" and listens to no-one
mutable CountdownTimer m_rogueTimer;
enum MoraleType
{
TERRIBLE = -3,
BAD = -2,
NEGATIVE = -1,
NEUTRAL = 0,
POSITIVE = 1,
GOOD = 2,
EXCELLENT = 3,
};
MoraleType m_morale; // our current morale, based on our win/loss history
bool m_diedLastRound; // true if we died last round
float m_safeTime; // duration at the beginning of the round where we feel "safe"
bool m_wasSafe; // true if we were in the safe time last update
NavRelativeDirType m_blindMoveDir; // which way to move when we're blind
bool m_blindFire; // if true, fire weapon while blinded
// TODO: implement through CountdownTimer
float m_surpriseDelay; // when we were surprised
float m_surpriseTimestamp;
bool m_isFollowing; // true if we are following someone
EHANDLE m_leader; // the ID of who we are following
float m_followTimestamp; // when we started following
float m_allowAutoFollowTime; // time when we can auto follow
CountdownTimer m_hurryTimer; // if valid, bot is in a hurry
// instances of each possible behavior state, to avoid dynamic memory allocation during runtime
IdleState m_idleState;
HuntState m_huntState;
AttackState m_attackState;
InvestigateNoiseState m_investigateNoiseState;
BuyState m_buyState;
MoveToState m_moveToState;
FetchBombState m_fetchBombState;
PlantBombState m_plantBombState;
DefuseBombState m_defuseBombState;
HideState m_hideState;
EscapeFromBombState m_escapeFromBombState;
FollowState m_followState;
UseEntityState m_useEntityState;
// TODO: Allow multiple simultaneous state machines (look around, etc)
BotState *m_state; // current behavior state
float m_stateTimestamp; // time state was entered
bool m_isAttacking; // if true, special Attack state is overriding the state machine
// high-level tasks
enum TaskType
{
SEEK_AND_DESTROY,
PLANT_BOMB,
FIND_TICKING_BOMB,
DEFUSE_BOMB,
GUARD_TICKING_BOMB,
GUARD_BOMB_DEFUSER,
GUARD_LOOSE_BOMB,
GUARD_BOMB_ZONE,
ESCAPE_FROM_BOMB,
HOLD_POSITION,
FOLLOW,
VIP_ESCAPE,
GUARD_VIP_ESCAPE_ZONE,
COLLECT_HOSTAGES,
RESCUE_HOSTAGES,
GUARD_HOSTAGES,
GUARD_HOSTAGE_RESCUE_ZONE,
MOVE_TO_LAST_KNOWN_ENEMY_POSITION,
MOVE_TO_SNIPER_SPOT,
SNIPING,
NUM_TASKS
};
TaskType m_task; // our current task
EHANDLE m_taskEntity; // an entity used for our task
// navigation
Vector m_goalPosition;
EHANDLE m_goalEntity;
CNavArea *m_currentArea; // the nav area we are standing on
CNavArea *m_lastKnownArea; // the last area we were in
EHANDLE m_avoid; // higher priority player we need to make way for
float m_avoidTimestamp;
bool m_isJumpCrouching;
bool m_isJumpCrouched;
float m_jumpCrouchTimestamp;
// path navigation data
enum { _MAX_PATH_LENGTH = 256 };
struct ConnectInfo
{
CNavArea *area; // the area along the path
NavTraverseType how; // how to enter this area from the previous one
Vector pos; // our movement goal position at this point in the path
const CNavLadder *ladder; // if "how" refers to a ladder, this is it
}
m_path[_MAX_PATH_LENGTH];
int m_pathLength;
int m_pathIndex;
float m_areaEnteredTimestamp;
CountdownTimer m_repathTimer; // must have elapsed before bot can pathfind again
mutable CountdownTimer m_avoidFriendTimer; // used to throttle how often we check for friends in our path
mutable bool m_isFriendInTheWay; // true if a friend is blocking our path
CountdownTimer m_politeTimer; // we'll wait for friend to move until this runs out
bool m_isWaitingBehindFriend; // true if we are waiting for a friend to move
enum LadderNavState
{
APPROACH_ASCENDING_LADDER, // prepare to scale a ladder
APPROACH_DESCENDING_LADDER, // prepare to go down ladder
FACE_ASCENDING_LADDER,
FACE_DESCENDING_LADDER,
MOUNT_ASCENDING_LADDER, // move toward ladder until "on" it
MOUNT_DESCENDING_LADDER, // move toward ladder until "on" it
ASCEND_LADDER, // go up the ladder
DESCEND_LADDER, // go down the ladder
DISMOUNT_ASCENDING_LADDER, // get off of the ladder
DISMOUNT_DESCENDING_LADDER, // get off of the ladder
MOVE_TO_DESTINATION, // dismount ladder and move to destination area
}
m_pathLadderState;
bool m_pathLadderFaceIn; // if true, face towards ladder, otherwise face away
const CNavLadder *m_pathLadder; // the ladder we need to use to reach the next area
NavRelativeDirType m_pathLadderDismountDir; // which way to dismount
float m_pathLadderDismountTimestamp; // time when dismount started
float m_pathLadderEnd; // if ascending, z of top, if descending z of bottom
float m_pathLadderTimestamp; // time when we started using ladder - for timeout check
CountdownTimer m_mustRunTimer; // if nonzero, bot cannot walk
// game scenario mechanisms
CSGameState m_gameState;
// hostages mechanism
byte m_hostageEscortCount;
float m_hostageEscortCountTimestamp;
bool m_isWaitingForHostage;
CountdownTimer m_inhibitWaitingForHostageTimer;
CountdownTimer m_waitForHostageTimer;
// listening mechanism
Vector m_noisePosition; // position we last heard non-friendly noise
float m_noiseTimestamp; // when we heard it (can get zeroed)
CNavArea *m_noiseArea; // the nav area containing the noise
float m_noiseCheckTimestamp;
PriorityType m_noisePriority; // priority of currently heard noise
bool m_isNoiseTravelRangeChecked;
// "looking around" mechanism
float m_lookAroundStateTimestamp; // time of next state change
float m_lookAheadAngle; // our desired forward look angle
float m_forwardAngle; // our current forward facing direction
float m_inhibitLookAroundTimestamp; // time when we can look around again
enum LookAtSpotState
{
NOT_LOOKING_AT_SPOT, // not currently looking at a point in space
LOOK_TOWARDS_SPOT, // in the process of aiming at m_lookAtSpot
LOOK_AT_SPOT, // looking at m_lookAtSpot
NUM_LOOK_AT_SPOT_STATES
}
m_lookAtSpotState;
Vector m_lookAtSpot; // the spot we're currently looking at
PriorityType m_lookAtSpotPriority;
float m_lookAtSpotDuration; // how long we need to look at the spot
float m_lookAtSpotTimestamp; // when we actually began looking at the spot
float m_lookAtSpotAngleTolerance; // how exactly we must look at the spot
bool m_lookAtSpotClearIfClose; // if true, the look at spot is cleared if it gets close to us
const char *m_lookAtDesc; // for debugging
float m_peripheralTimestamp;
enum { MAX_APPROACH_POINTS = 16 };
Vector m_approachPoint[MAX_APPROACH_POINTS];
unsigned char m_approachPointCount;
Vector m_approachPointViewPosition; // the position used when computing current approachPoint set
bool m_isWaitingToTossGrenade; // lining up throw
CountdownTimer m_tossGrenadeTimer; // timeout timer for grenade tossing
SpotEncounter *m_spotEncounter; // the spots we will encounter as we move thru our current area
float m_spotCheckTimestamp; // when to check next encounter spot
// TODO: Add timestamp for each possible client to hiding spots
enum { MAX_CHECKED_SPOTS = 64 };
struct HidingSpotCheckInfo
{
HidingSpot *spot;
float timestamp;
}
m_checkedHidingSpot[MAX_CHECKED_SPOTS];
int m_checkedHidingSpotCount;
// view angle mechanism
float m_lookPitch; // our desired look pitch angle
float m_lookPitchVel;
float m_lookYaw; // our desired look yaw angle
float m_lookYawVel;
// aim angle mechanism
mutable Vector m_eyePos;
Vector m_aimOffset; // current error added to victim's position to get actual aim spot
Vector m_aimOffsetGoal; // desired aim offset
float m_aimOffsetTimestamp; // time of next offset adjustment
float m_aimSpreadTimestamp; // time used to determine max spread as it begins to tighten up
Vector m_aimSpot; // the spot we are currently aiming to fire at
// attack state data
// behavior modifiers
enum DispositionType
{
ENGAGE_AND_INVESTIGATE, // engage enemies on sight and investigate enemy noises
OPPORTUNITY_FIRE, // engage enemies on sight, but only look towards enemy noises, dont investigate
SELF_DEFENSE, // only engage if fired on, or very close to enemy
IGNORE_ENEMIES, // ignore all enemies - useful for ducking around corners, running away, etc
NUM_DISPOSITIONS
};
DispositionType m_disposition; // how we will react to enemies
CountdownTimer m_ignoreEnemiesTimer; // how long will we ignore enemies
mutable EHANDLE m_enemy; // our current enemy
bool m_isEnemyVisible; // result of last visibility test on enemy
unsigned char m_visibleEnemyParts; // which parts of the visible enemy do we see
Vector m_lastEnemyPosition; // last place we saw the enemy
float m_lastSawEnemyTimestamp;
float m_firstSawEnemyTimestamp;
float m_currentEnemyAcquireTimestamp;
float m_enemyDeathTimestamp; // if m_enemy is dead, this is when he died
bool m_isLastEnemyDead; // true if we killed or saw our last enemy die
int m_nearbyEnemyCount; // max number of enemies we've seen recently
unsigned int m_enemyPlace; // the location where we saw most of our enemies
struct WatchInfo
{
float timestamp;
bool isEnemy;
}
m_watchInfo[MAX_CLIENTS];
mutable EHANDLE m_bomber; // points to bomber if we can see him
int m_nearbyFriendCount; // number of nearby teammates
mutable EHANDLE m_closestVisibleFriend; // the closest friend we can see
mutable EHANDLE m_closestVisibleHumanFriend; // the closest human friend we can see
CBasePlayer *m_attacker; // last enemy that hurt us (may not be same as m_enemy)
float m_attackedTimestamp; // when we were hurt by the m_attacker
int m_lastVictimID; // the entindex of the last victim we killed, or zero
bool m_isAimingAtEnemy; // if true, we are trying to aim at our enemy
bool m_isRapidFiring; // if true, RunUpkeep() will toggle our primary attack as fast as it can
IntervalTimer m_equipTimer; // how long have we had our current weapon equipped
float m_fireWeaponTimestamp;
// reaction time system
enum { MAX_ENEMY_QUEUE = 20 };
struct ReactionState
{
// NOTE: player position & orientation is not currently stored separately
EHANDLE player;
bool isReloading;
bool isProtectedByShield;
}
m_enemyQueue[MAX_ENEMY_QUEUE]; // round-robin queue for simulating reaction times
byte m_enemyQueueIndex;
byte m_enemyQueueCount;
byte m_enemyQueueAttendIndex; // index of the timeframe we are "conscious" of
// stuck detection
bool m_isStuck;
float m_stuckTimestamp; // time when we got stuck
Vector m_stuckSpot; // the location where we became stuck
NavRelativeDirType m_wiggleDirection;
float m_wiggleTimestamp;
float m_stuckJumpTimestamp; // time for next jump when stuck
enum { MAX_VEL_SAMPLES = 5 };
float m_avgVel[MAX_VEL_SAMPLES];
int m_avgVelIndex;
int m_avgVelCount;
Vector m_lastOrigin;
// chatter mechanism
GameEventType m_lastRadioCommand; // last radio command we recieved
float m_lastRadioRecievedTimestamp; // time we recieved a radio message
float m_lastRadioSentTimestamp; // time when we send a radio message
EHANDLE m_radioSubject; // who issued the radio message
Vector m_radioPosition; // position referred to in radio message
float m_voiceFeedbackStartTimestamp;
float m_voiceFeedbackEndTimestamp; // new-style "voice" chatter gets voice feedback
BotChatterInterface m_chatter;
// learn map mechanism
const CNavNode *m_navNodeList;
CNavNode *m_currentNode;
NavDirType m_generationDir;
NavAreaList::iterator m_analyzeIter;
enum ProcessType
{
PROCESS_NORMAL,
PROCESS_LEARN,
PROCESS_ANALYZE_ALPHA,
PROCESS_ANALYZE_BETA,
PROCESS_SAVE,
}
m_processMode;
CountdownTimer m_mumbleTimer;
CountdownTimer m_booTimer;
CountdownTimer m_relocateTimer;
};

View File

@ -0,0 +1,337 @@
/*
*
* 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
#define UNDEFINED_COUNT 0xFFFF
#define MAX_PLACES_PER_MAP 64
#define UNDEFINED_SUBJECT (-1)
#define COUNT_MANY 4 // equal to or greater than this is "many"
class CCSBot;
class BotChatterInterface;
typedef unsigned int PlaceCriteria;
typedef unsigned int CountCriteria;
// A meme is a unit information that bots use to
// transmit information to each other via the radio
class BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const = 0; // cause the given bot to act on this meme
};
class BotAllHostagesGoneMeme: public BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
};
class BotHostageBeingTakenMeme: public BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
};
class BotHelpMeme: public BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
public:
Place m_place;
};
class BotBombsiteStatusMeme: public BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
public:
enum StatusType { CLEAR, PLANTED };
int m_zoneIndex; // the bombsite
StatusType m_status; // whether it is cleared or the bomb is there (planted)
};
class BotBombStatusMeme: public BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
public:
CSGameState::BombState m_state;
Vector m_pos;
};
class BotFollowMeme: public BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
};
class BotDefendHereMeme: public BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
public:
Vector m_pos;
};
class BotWhereBombMeme: public BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
};
class BotRequestReportMeme: public BotMeme {
public:
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
};
enum BotStatementType
{
REPORT_VISIBLE_ENEMIES,
REPORT_ENEMY_ACTION,
REPORT_MY_CURRENT_TASK,
REPORT_MY_INTENTION,
REPORT_CRITICAL_EVENT,
REPORT_REQUEST_HELP,
REPORT_REQUEST_INFORMATION,
REPORT_ROUND_END,
REPORT_MY_PLAN,
REPORT_INFORMATION,
REPORT_EMOTE,
REPORT_ACKNOWLEDGE, // affirmative or negative
REPORT_ENEMIES_REMAINING,
REPORT_FRIENDLY_FIRE,
REPORT_KILLED_FRIEND,
//REPORT_ENEMY_LOST
NUM_BOT_STATEMENT_TYPES,
};
// BotSpeakables are the smallest unit of bot chatter.
// They represent a specific wav file of a phrase, and the criteria for which it is useful
class BotSpeakable {
public:
char *m_phrase;
float m_duration;
PlaceCriteria m_place;
CountCriteria m_count;
};
typedef std::vector<BotSpeakable *> BotSpeakableVector;
typedef std::vector<BotSpeakableVector *> BotVoiceBankVector;
// The BotPhrase class is a collection of Speakables associated with a name, ID, and criteria
class BotPhrase {
public:
const char *GetName() const { return m_name; }
Place GetID() const { return m_id; }
GameEventType GetRadioEquivalent() const { return m_radioEvent; }
bool IsImportant() const { return m_isImportant; } // return true if this phrase is part of an important statement
bool IsPlace() const { return m_isPlace; }
public:
friend class BotPhraseManager;
char *m_name;
Place m_id;
bool m_isPlace; // true if this is a Place phrase
GameEventType m_radioEvent;
bool m_isImportant; // mission-critical statement
mutable BotVoiceBankVector m_voiceBank; // array of voice banks (arrays of speakables)
std::vector<int> m_count; // number of speakables
mutable std::vector< int > m_index; // index of next speakable to return
int m_numVoiceBanks; // number of voice banks that have been initialized
mutable PlaceCriteria m_placeCriteria;
mutable CountCriteria m_countCriteria;
};
typedef std::list<BotPhrase *> BotPhraseList;
// The BotPhraseManager is a singleton that provides an interface to all BotPhrase collections
class BotPhraseManager {
public:
const BotPhraseList *GetPlaceList() const { return &m_placeList; }
// return time last statement of given type was emitted by a teammate for the given place
float GetPlaceStatementInterval(Place place) const;
// set time of last statement of given type was emitted by a teammate for the given place
void ResetPlaceStatementInterval(Place place) const;
public:
int FindPlaceIndex(Place where) const;
// master list of all phrase collections
BotPhraseList m_list;
// master list of all Place phrases
BotPhraseList m_placeList;
struct PlaceTimeInfo
{
Place placeID;
IntervalTimer timer;
};
mutable PlaceTimeInfo m_placeStatementHistory[MAX_PLACES_PER_MAP];
mutable int m_placeCount;
};
inline int BotPhraseManager::FindPlaceIndex(Place where) const
{
for (int i = 0; i < m_placeCount; ++i)
{
if (m_placeStatementHistory[i].placeID == where)
return i;
}
if (m_placeCount < MAX_PLACES_PER_MAP)
{
m_placeStatementHistory[++m_placeCount].placeID = where;
m_placeStatementHistory[++m_placeCount].timer.Invalidate();
return m_placeCount - 1;
}
return -1;
}
inline float BotPhraseManager::GetPlaceStatementInterval(Place place) const
{
int index = FindPlaceIndex(place);
if (index < 0)
return 999999.9f;
if (index >= m_placeCount)
return 999999.9f;
return m_placeStatementHistory[index].timer.GetElapsedTime();
}
inline void BotPhraseManager::ResetPlaceStatementInterval(Place place) const
{
int index = FindPlaceIndex(place);
if (index < 0)
return;
if (index >= m_placeCount)
return;
m_placeStatementHistory[index].timer.Reset();
}
// Statements are meaningful collections of phrases
class BotStatement {
public:
BotChatterInterface *GetChatter() const { return m_chatter; }
BotStatementType GetType() const { return m_type; } // return the type of statement this is
bool HasSubject() const { return (m_subject != UNDEFINED_SUBJECT); }
void SetSubject(int playerID) { m_subject = playerID; } // who this statement is about
int GetSubject() const { return m_subject; } // who this statement is about
void SetPlace(Place where) { m_place = where; } // explicitly set place
void SetStartTime(float timestamp) { m_startTime = timestamp; } // define the earliest time this statement can be spoken
float GetStartTime() const { return m_startTime; }
bool IsSpeaking() const { return m_isSpeaking; } // return true if this statement is currently being spoken
float GetTimestamp() const { return m_timestamp; } // get time statement was created (but not necessarily started talking)
public:
friend class BotChatterInterface;
BotChatterInterface *m_chatter; // the chatter system this statement is part of
BotStatement *m_next, *m_prev; // linked list hooks
BotStatementType m_type; // what kind of statement this is
int m_subject; // who this subject is about
Place m_place; // explicit place - note some phrases have implicit places as well
BotMeme *m_meme; // a statement can only have a single meme for now
float m_timestamp; // time when message was created
float m_startTime; // the earliest time this statement can be spoken
float m_expireTime; // time when this statement is no longer valid
float m_speakTimestamp; // time when message began being spoken
bool m_isSpeaking; // true if this statement is current being spoken
float m_nextTime; // time for next phrase to begin
enum { MAX_BOT_PHRASES = 4 };
enum ContextType
{
CURRENT_ENEMY_COUNT,
REMAINING_ENEMY_COUNT,
SHORT_DELAY,
LONG_DELAY,
ACCUMULATE_ENEMIES_DELAY,
};
struct
{
bool isPhrase;
union
{
const BotPhrase *phrase;
ContextType context;
};
}
m_statement[MAX_BOT_PHRASES];
enum { MAX_BOT_CONDITIONS = 4 };
enum ConditionType
{
IS_IN_COMBAT,
RADIO_SILENCE,
ENEMIES_REMAINING,
NUM_CONDITIONS,
};
ConditionType m_condition[MAX_BOT_CONDITIONS]; // conditions that must be true for the statement to be said
int m_conditionCount;
int m_index; // m_index refers to the phrase currently being spoken, or -1 if we havent started yet
int m_count;
};
// This class defines the interface to the bot radio chatter system
class BotChatterInterface {
public:
CCSBot *GetOwner() const { return m_me; }
int GetPitch() const { return m_pitch; }
bool SeesAtLeastOneEnemy() const { return m_seeAtLeastOneEnemy; }
public:
BotStatement *m_statementList; // list of all active/pending messages for this bot
void ReportEnemies(); // track nearby enemy count and generate enemy activity statements
bool ShouldSpeak() const; // return true if we speaking makes sense now
CCSBot *m_me; // the bot this chatter is for
bool m_seeAtLeastOneEnemy;
float m_timeWhenSawFirstEnemy;
bool m_reportedEnemies;
bool m_requestedBombLocation; // true if we already asked where the bomb has been planted
int m_pitch;
IntervalTimer m_needBackupInterval;
IntervalTimer m_spottedBomberInterval;
IntervalTimer m_scaredInterval;
IntervalTimer m_planInterval;
CountdownTimer m_spottedLooseBombTimer;
CountdownTimer m_heardNoiseTimer;
CountdownTimer m_escortingHostageTimer;
};
extern BotPhraseManager *TheBotPhrases;

View File

@ -0,0 +1,145 @@
/*
*
* 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
extern CBotManager *TheBots;
// The manager for Counter-Strike specific bots
class CCSBotManager: public CBotManager {
public:
virtual void ClientDisconnect(CBasePlayer *pPlayer) = 0;
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0;
virtual void ServerActivate() = 0;
virtual void ServerDeactivate() = 0;
virtual void ServerCommand(const char *pcmd) = 0;
virtual void AddServerCommand(const char *cmd) = 0;
virtual void AddServerCommands() = 0;
virtual void RestartRound() = 0; // (EXTEND) invoked when a new round begins
virtual void StartFrame() = 0; // (EXTEND) called each frame
virtual void OnEvent(GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL) = 0;
virtual unsigned int GetPlayerPriority(CBasePlayer *player) const = 0; // return priority of player (0 = max pri)
virtual bool IsImportantPlayer(CBasePlayer *player) const = 0; // return true if player is important to scenario (VIP, bomb carrier, etc)
public:
// the supported game scenarios
enum GameScenarioType
{
SCENARIO_DEATHMATCH,
SCENARIO_DEFUSE_BOMB,
SCENARIO_RESCUE_HOSTAGES,
SCENARIO_ESCORT_VIP
};
GameScenarioType GetScenario() const { return m_gameScenario; }
// "zones"
// depending on the game mode, these are bomb zones, rescue zones, etc.
enum { MAX_ZONES = 4 }; // max # of zones in a map
enum { MAX_ZONE_NAV_AREAS = 16 }; // max # of nav areas in a zone
struct Zone
{
CBaseEntity *m_entity; // the map entity
CNavArea *m_area[MAX_ZONE_NAV_AREAS]; // nav areas that overlap this zone
int m_areaCount;
Vector m_center;
bool m_isLegacy; // if true, use pev->origin and 256 unit radius as zone
int m_index;
Extent m_extent;
};
const Zone *GetZone(int i) const { return &m_zone[i]; }
int GetZoneCount() const { return m_zoneCount; }
// pick a zone at random and return it
const Zone *GetRandomZone() const
{
if (!m_zoneCount)
return NULL;
return &m_zone[RANDOM_LONG(0, m_zoneCount - 1)];
}
bool IsBombPlanted() const { return m_isBombPlanted; } // returns true if bomb has been planted
float GetBombPlantTimestamp() const { return m_bombPlantTimestamp; } // return time bomb was planted
bool IsTimeToPlantBomb() const { return (gpGlobals->time >= m_earliestBombPlantTimestamp); } // return true if it's ok to try to plant bomb
CBasePlayer *GetBombDefuser() const { return m_bombDefuser; } // return the player currently defusing the bomb, or NULL
CBaseEntity *GetLooseBomb() { return m_looseBomb; } // return the bomb if it is loose on the ground
CNavArea *GetLooseBombArea() const { return m_looseBombArea; } // return area that bomb is in/near
float GetLastSeenEnemyTimestamp() const { return m_lastSeenEnemyTimestamp; } // return the last time anyone has seen an enemy
void SetLastSeenEnemyTimestamp() { m_lastSeenEnemyTimestamp = gpGlobals->time; }
float GetRoundStartTime() const { return m_roundStartTimestamp; }
float GetElapsedRoundTime() const { return gpGlobals->time - m_roundStartTimestamp; } // return the elapsed time since the current round began
bool IsDefenseRushing() const { return m_isDefenseRushing; } // returns true if defense team has "decided" to rush this round
bool IsRoundOver() const { return m_isRoundOver; } // return true if the round has ended
unsigned int GetNavPlace() const { return m_navPlace; }
void SetNavPlace(unsigned int place) { m_navPlace = place; }
public:
GameScenarioType m_gameScenario; // what kind of game are we playing
Zone m_zone[MAX_ZONES];
int m_zoneCount;
bool m_isBombPlanted; // true if bomb has been planted
float m_bombPlantTimestamp; // time bomb was planted
float m_earliestBombPlantTimestamp; // don't allow planting until after this time has elapsed
CBasePlayer *m_bombDefuser; // the player currently defusing a bomb
EHANDLE m_looseBomb; // will be non-NULL if bomb is loose on the ground
CNavArea *m_looseBombArea; // area that bomb is is/near
bool m_isRoundOver; // true if the round has ended
float m_radioMsgTimestamp[24][2];
float m_lastSeenEnemyTimestamp;
float m_roundStartTimestamp; // the time when the current round began
bool m_isDefenseRushing; // whether defensive team is rushing this round or not
unsigned int m_navPlace;
CountdownTimer m_respawnTimer;
bool m_isRespawnStarted;
bool m_canRespawn;
bool m_bServerActive;
};
inline int OtherTeam(int team)
{
return (team == TERRORIST) ? CT : TERRORIST;
}
inline CCSBotManager *TheCSBots()
{
return reinterpret_cast<CCSBotManager *>(TheBots);
}

View File

@ -0,0 +1,90 @@
/*
*
* 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
class CCSBot;
// This class represents the game state as known by a particular bot
class CSGameState {
public:
// bomb defuse scenario
enum BombState
{
MOVING, // being carried by a Terrorist
LOOSE, // loose on the ground somewhere
PLANTED, // planted and ticking
DEFUSED, // the bomb has been defused
EXPLODED, // the bomb has exploded
};
bool IsBombMoving() const { return (m_bombState == MOVING); }
bool IsBombLoose() const { return (m_bombState == LOOSE); }
bool IsBombPlanted() const { return (m_bombState == PLANTED); }
bool IsBombDefused() const { return (m_bombState == DEFUSED); }
bool IsBombExploded() const { return (m_bombState == EXPLODED); }
public:
CCSBot *m_owner; // who owns this gamestate
bool m_isRoundOver; // true if round is over, but no yet reset
// bomb defuse scenario
BombState GetBombState() { return m_bombState; }
BombState m_bombState; // what we think the bomb is doing
IntervalTimer m_lastSawBomber;
Vector m_bomberPos;
IntervalTimer m_lastSawLooseBomb;
Vector m_looseBombPos;
bool m_isBombsiteClear[4]; // corresponds to zone indices in CCSBotManager
int m_bombsiteSearchOrder[4]; // randomized order of bombsites to search
int m_bombsiteCount;
int m_bombsiteSearchIndex; // the next step in the search
int m_plantedBombsite; // zone index of the bombsite where the planted bomb is
bool m_isPlantedBombPosKnown; // if true, we know the exact location of the bomb
Vector m_plantedBombPos;
// hostage rescue scenario
struct HostageInfo
{
CHostage *hostage;
Vector knownPos;
bool isValid;
bool isAlive;
bool isFree; // not being escorted by a CT
}
m_hostage[MAX_HOSTAGES];
int m_hostageCount; // number of hostages left in map
CountdownTimer m_validateInterval;
bool m_allHostagesRescued; // if true, so every hostages been is rescued
bool m_haveSomeHostagesBeenTaken; // true if a hostage has been moved by a CT (and we've seen it)
};

View File

@ -0,0 +1,104 @@
/*
*
* 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
#define SF_BUTTON_DONTMOVE 1
#define SF_ROTBUTTON_NOTSOLID 1
#define SF_BUTTON_TOGGLE 32 // button stays pushed until reactivated
#define SF_BUTTON_SPARK_IF_OFF 64 // button sparks in OFF state
#define SF_BUTTON_TOUCH_ONLY 256 // button only fires as a result of USE key.
#define SF_GLOBAL_SET 1 // Set global state to initial state on spawn
#define SF_MULTI_INIT 1
// Make this button behave like a door (HACKHACK)
// This will disable use and make the button solid
// rotating buttons were made SOLID_NOT by default since their were some
// collision problems with them...
#define SF_MOMENTARY_DOOR 0x0001
#define SF_SPARK_TOOGLE 32
#define SF_SPARK_IF_OFF 64
#define SF_BTARGET_USE 0x0001
#define SF_BTARGET_ON 0x0002
class CEnvGlobal: public CPointEntity {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
string_t m_globalstate;
int m_triggermode;
int m_initialstate;
};
class CRotButton: public CBaseButton {
public:
virtual void Spawn() = 0;
};
class CMomentaryRotButton: public CBaseToggle {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
int m_lastUsed;
int m_direction;
float m_returnSpeed;
Vector m_start;
Vector m_end;
int m_sounds;
};
class CEnvSpark: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
public:
float m_flDelay;
};
class CButtonTarget: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual int ObjectCaps() = 0;
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
};

View File

@ -0,0 +1,373 @@
/*
*
* 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
#include "util.h"
#include "monsterevent.h"
class CSave;
class CRestore;
class CBasePlayer;
class CBaseEntity;
class CBaseMonster;
class CBasePlayerItem;
class CSquadMonster;
class CBaseEntity {
public:
// Constructor. Set engine to use C/C++ callback functions
// pointers to engine data
entvars_t *pev; // Don't need to save/restore this pointer, the engine resets it
// path corners
CBaseEntity *m_pGoalEnt; // path corner we are heading towards
CBaseEntity *m_pLink; // used for temporary link-list operations.
// initialization functions
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 void Activate() = 0;
// Setup the object->object collision box (pev->mins / pev->maxs is the object->world collision box)
virtual void SetObjectCollisionBox() = 0;
// Classify - returns the type of group (i.e, "houndeye", or "human military" so that monsters with different classnames
// still realize that they are teammates. (overridden for monsters that form groups)
virtual int Classify() = 0;
virtual void DeathNotice(entvars_t *pevChild) = 0;
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual int TakeHealth(float flHealth, int bitsDamageType) = 0;
virtual void Killed(entvars_t *pevAttacker, int iGib) = 0;
virtual int BloodColor() = 0;
virtual void TraceBleed(float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
virtual BOOL IsTriggered(CBaseEntity *pActivator) = 0;
virtual CBaseMonster *MyMonsterPointer() = 0;
virtual CSquadMonster *MySquadMonsterPointer() = 0;
virtual int GetToggleState() = 0;
virtual void AddPoints(int score, BOOL bAllowNegativeScore) = 0;
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 float GetDelay() = 0;
virtual int IsMoving() = 0;
virtual void OverrideReset() = 0;
virtual int DamageDecal(int bitsDamageType) = 0;
// 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 BOOL OnControls(entvars_t *onpev) = 0;
virtual BOOL IsSneaking() = 0;
virtual BOOL IsAlive() = 0;
virtual BOOL IsBSPModel() = 0;
virtual BOOL ReflectGauss() = 0;
virtual BOOL HasTarget(string_t targetname) = 0;
virtual BOOL IsInWorld() = 0;
virtual BOOL IsPlayer() = 0;
virtual BOOL IsNetClient() = 0;
virtual const char *TeamID() = 0;
virtual CBaseEntity *GetNextTarget() = 0;
// fundamental callbacks
void (CBaseEntity::*m_pfnThink)();
void (CBaseEntity::*m_pfnTouch)(CBaseEntity *pOther);
void (CBaseEntity::*m_pfnUse)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
void (CBaseEntity::*m_pfnBlocked)(CBaseEntity *pOther);
virtual void Think() = 0;
virtual void Touch(CBaseEntity *pOther) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType = USE_OFF, float value = 0.0f) = 0;
virtual void Blocked(CBaseEntity *pOther) = 0;
virtual CBaseEntity *Respawn() = 0;
virtual void UpdateOwner() = 0;
virtual BOOL FBecomeProne() = 0;
virtual Vector Center() = 0; // center point of entity
virtual Vector EyePosition() = 0; // position of eyes
virtual Vector EarPosition() = 0; // position of ears
virtual Vector BodyTarget(const Vector &posSrc) = 0; // position to shoot at
virtual int Illumination() = 0;
virtual BOOL FVisible(CBaseEntity *pEntity) = 0;
virtual BOOL FVisible(const Vector &vecOrigin) = 0;
public:
static CBaseEntity *Instance(edict_t *pent) { return (CBaseEntity *)GET_PRIVATE(pent ? pent : ENT(0)); }
static CBaseEntity *Instance(entvars_t *pev) { return Instance(ENT(pev)); }
static CBaseEntity *Instance(int offset) { return Instance(ENT(offset)); }
edict_t *edict() { return ENT(pev); }
EOFFSET eoffset() { return OFFSET(pev); }
int entindex() { return ENTINDEX(edict()); }
public:
// We use this variables to store each ammo count.
int *current_ammo;
float currentammo;
int maxammo_buckshot;
int ammo_buckshot;
int maxammo_9mm;
int ammo_9mm;
int maxammo_556nato;
int ammo_556nato;
int maxammo_556natobox;
int ammo_556natobox;
int maxammo_762nato;
int ammo_762nato;
int maxammo_45acp;
int ammo_45acp;
int maxammo_50ae;
int ammo_50ae;
int maxammo_338mag;
int ammo_338mag;
int maxammo_57mm;
int ammo_57mm;
int maxammo_357sig;
int ammo_357sig;
// Special stuff for grenades and knife.
float m_flStartThrow;
float m_flReleaseThrow;
int m_iSwing;
// client has left the game
bool has_disconnected;
};
class CPointEntity: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual int ObjectCaps() = 0;
};
// generic Delay entity
class CBaseDelay: public CBaseEntity {
public:
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
public:
float m_flDelay;
int m_iszKillTarget;
};
class CBaseAnimating: public CBaseDelay {
public:
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual void HandleAnimEvent(MonsterEvent_t *pEvent) = 0;
public:
// animation needs
float m_flFrameRate; // computed FPS for current sequence
float m_flGroundSpeed; // computed linear movement rate for current sequence
float m_flLastEventCheck; // last time the event list was checked
BOOL m_fSequenceFinished; // flag set when StudioAdvanceFrame moves across a frame boundry
BOOL m_fSequenceLoops; // true if the sequence loops
};
// EHANDLE. Safe way to point to CBaseEntities who may die between frames
class EHANDLE {
public:
edict_t *Get();
edict_t *Set(edict_t *pent);
operator int();
operator CBaseEntity*();
operator CBasePlayer*();
CBaseEntity *operator=(CBaseEntity *pEntity);
CBaseEntity *operator->();
private:
edict_t *m_pent;
int m_serialnumber;
};
// generic Toggle entity.
class CBaseToggle: public CBaseAnimating {
public:
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int GetToggleState() = 0;
virtual float GetDelay() = 0;
public:
TOGGLE_STATE m_toggle_state;
float m_flActivateFinished; // like attack_finished, but for doors
float m_flMoveDistance; // how far a door should slide or rotate
float m_flWait;
float m_flLip;
float m_flTWidth; // for plats
float m_flTLength; // for plats
Vector m_vecPosition1;
Vector m_vecPosition2;
Vector m_vecAngle1;
Vector m_vecAngle2;
int m_cTriggersLeft; // trigger_counter only, # of activations remaining
float m_flHeight;
EHANDLE m_hActivator;
void (CBaseToggle::*m_pfnCallWhenMoveDone)();
Vector m_vecFinalDest;
Vector m_vecFinalAngle;
int m_bitsDamageInflict; // DMG_ damage type that the door or tigger does
string_t m_sMaster; // If this button has a master switch, this is the targetname.
// A master switch must be of the multisource type. If all
// of the switches in the multisource have been triggered, then
// the button will be allowed to operate. Otherwise, it will be
// deactivated.
};
#include "basemonster.h"
#include "weapons.h"
#include "player.h"
// Generic Button
class CBaseButton: public CBaseToggle {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0; // Buttons that don't take damage can be IMPULSE used
public:
BOOL m_fStayPushed; // button stays pushed in until touched again?
BOOL m_fRotating; // a rotating button? default is a sliding button.
string_t m_strChangeTarget; // if this field is not null, this is an index into the engine string array.
// when this button is touched, it's target entity's TARGET field will be set
// to the button's ChangeTarget. This allows you to make a func_train switch paths, etc.
locksound_t m_ls; // door lock sounds
BYTE m_bLockedSound; // ordinals from entity selection
BYTE m_bLockedSentence;
BYTE m_bUnlockedSound;
BYTE m_bUnlockedSentence;
int m_sounds;
};
// MultiSouce
#define MAX_MULTI_TARGETS 16 // maximum number of targets a single multi_manager entity may be assigned.
#define MS_MAX_TARGETS 32
class CMultiSource: public CPointEntity {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual BOOL IsTriggered(CBaseEntity *pActivator) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
EHANDLE m_rgEntities[MS_MAX_TARGETS];
int m_rgTriggered[MS_MAX_TARGETS];
int m_iTotal;
string_t m_globalstate;
};
// This spawns first when each level begins.
class CWorld: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
};
// Inlines
inline edict_t *EHANDLE::Get()
{
if (!m_pent || m_pent->serialnumber != m_serialnumber)
return NULL;
return m_pent;
}
inline edict_t *EHANDLE::Set(edict_t *pent)
{
m_pent = pent;
if (pent)
m_serialnumber = pent->serialnumber;
return pent;
}
inline EHANDLE::operator int()
{
return Get() != NULL;
}
inline EHANDLE::operator CBaseEntity *()
{
return (CBaseEntity *)GET_PRIVATE(Get());
}
inline EHANDLE::operator CBasePlayer *()
{
return static_cast<CBasePlayer *>(GET_PRIVATE(Get()));
}
inline CBaseEntity *EHANDLE::operator=(CBaseEntity *pEntity)
{
if (pEntity != NULL)
{
m_pent = ENT(pEntity->pev);
if (m_pent)
m_serialnumber = m_pent->serialnumber;
}
else
{
m_pent = NULL;
m_serialnumber = 0;
}
return pEntity;
}
inline CBaseEntity *EHANDLE::operator->()
{
return (CBaseEntity *)GET_PRIVATE(Get());
}

View File

@ -0,0 +1,126 @@
/*
*
* 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
#define MAX_WEAPON_SLOTS 5 // hud item selection slots
#define MAX_ITEM_TYPES 6 // hud item selection slots
#define MAX_ITEMS 4 // hard coded item types
#define DEFAULT_FOV 90 // the default field of view
#define HIDEHUD_WEAPONS (1<<0)
#define HIDEHUD_FLASHLIGHT (1<<1)
#define HIDEHUD_ALL (1<<2)
#define HIDEHUD_HEALTH (1<<3)
#define HIDEHUD_TIMER (1<<4)
#define HIDEHUD_MONEY (1<<5)
#define HIDEHUD_CROSSHAIR (1<<6)
#define STATUSICON_HIDE 0
#define STATUSICON_SHOW 1
#define STATUSICON_FLASH 2
#define HUD_PRINTNOTIFY 1
#define HUD_PRINTCONSOLE 2
#define HUD_PRINTTALK 3
#define HUD_PRINTCENTER 4
#define HUD_PRINTRADIO 5
#define STATUS_NIGHTVISION_ON 1
#define STATUS_NIGHTVISION_OFF 0
#define ITEM_STATUS_NIGHTVISION (1<<0)
#define ITEM_STATUS_DEFUSER (1<<1)
#define SCORE_STATUS_DEAD (1<<0)
#define SCORE_STATUS_BOMB (1<<1)
#define SCORE_STATUS_VIP (1<<2)
#define SIGNAL_BUY (1<<0)
#define SIGNAL_BOMB (1<<1)
#define SIGNAL_RESCUE (1<<2)
#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)
#define MENU_KEY_1 (1<<0)
#define MENU_KEY_2 (1<<1)
#define MENU_KEY_3 (1<<2)
#define MENU_KEY_4 (1<<3)
#define MENU_KEY_5 (1<<4)
#define MENU_KEY_6 (1<<5)
#define MENU_KEY_7 (1<<6)
#define MENU_KEY_8 (1<<7)
#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
#define HUD_PRINTCONSOLE 2
#define HUD_PRINTTALK 3
#define HUD_PRINTCENTER 4
#define WEAPON_SUIT 31
#define WEAPON_ALLWEAPONS (~(1 << WEAPON_SUIT))
// custom enum
enum VGUIMenu
{
VGUI_Menu_Team = 2,
VGUI_Menu_MapBriefing = 4,
VGUI_Menu_Class_T = 26,
VGUI_Menu_Class_CT,
VGUI_Menu_Buy,
VGUI_Menu_Buy_Pistol,
VGUI_Menu_Buy_ShotGun,
VGUI_Menu_Buy_Rifle,
VGUI_Menu_Buy_SubMachineGun,
VGUI_Menu_Buy_MachineGun,
VGUI_Menu_Buy_Item,
};
// custom enum
enum VGUIMenuSlot
{
VGUI_MenuSlot_Buy_Pistol = 1,
VGUI_MenuSlot_Buy_ShotGun,
VGUI_MenuSlot_Buy_SubMachineGun,
VGUI_MenuSlot_Buy_Rifle,
VGUI_MenuSlot_Buy_MachineGun,
VGUI_MenuSlot_Buy_PrimAmmo,
VGUI_MenuSlot_Buy_SecAmmo,
VGUI_MenuSlot_Buy_Item,
};

View File

@ -0,0 +1,97 @@
/*
*
* 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
// custom enum
enum ChooseTeamMenuSlot
{
MENU_SLOT_TEAM_UNDEFINED = -1,
MENU_SLOT_TEAM_TERRORIST = 1,
MENU_SLOT_TEAM_CT,
MENU_SLOT_TEAM_VIP,
MENU_SLOT_TEAM_RANDOM = 5,
MENU_SLOT_TEAM_SPECT
};
// custom enum
enum BuyItemMenuSlot
{
MENU_SLOT_ITEM_VEST = 1,
MENU_SLOT_ITEM_VESTHELM,
MENU_SLOT_ITEM_FLASHGREN,
MENU_SLOT_ITEM_HEGREN,
MENU_SLOT_ITEM_SMOKEGREN,
MENU_SLOT_ITEM_NVG,
MENU_SLOT_ITEM_DEFUSEKIT,
MENU_SLOT_ITEM_SHIELD,
};
#define CS_NUM_SKIN 4
#define CZ_NUM_SKIN 5
#define FIELD_ORIGIN0 0
#define FIELD_ORIGIN1 1
#define FIELD_ORIGIN2 2
#define FIELD_ANGLES0 3
#define FIELD_ANGLES1 4
#define FIELD_ANGLES2 5
#define CUSTOMFIELD_ORIGIN0 0
#define CUSTOMFIELD_ORIGIN1 1
#define CUSTOMFIELD_ORIGIN2 2
#define CUSTOMFIELD_ANGLES0 3
#define CUSTOMFIELD_ANGLES1 4
#define CUSTOMFIELD_ANGLES2 5
#define CUSTOMFIELD_SKIN 6
#define CUSTOMFIELD_SEQUENCE 7
#define CUSTOMFIELD_ANIMTIME 8
typedef struct
{
float m_fTimeEnteredPVS;
} ENTITYPVSSTATUS;
struct PLAYERPVSSTATUS
{
ENTITYPVSSTATUS m_Status[1380];
int headnode;
int num_leafs;
short int leafnums[ MAX_ENT_LEAFS ];
};
struct entity_field_alias_t
{
char name[32];
int field;
};

View File

@ -0,0 +1,50 @@
/*
*
* 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
#include "../game_shared/GameEvent.h"
#include "../game_shared/bot/bot_util.h"
#include "../game_shared/bot/simple_state_machine.h"
#include "../game_shared/steam_util.h"
#include "../game_shared/perf_counter.h"
#include "../game_shared/bot/bot_manager.h"
#include "../game_shared/bot/bot_constants.h"
#include "../game_shared/bot/bot.h"
#include "../game_shared/shared_util.h"
#include "../game_shared/bot/bot_profile.h"
#include "../game_shared/bot/improv.h"
#include "../game_shared/bot/nav.h"
#include "../game_shared/bot/nav_node.h"
#include "../game_shared/bot/nav_area.h"
#include "../game_shared/bot/nav_path.h"
#include "../dlls/hostage/hostage.h"
#include "../dlls/hostage/hostage_localnav.h"
#include "../dlls/bot/cs_bot.h"

View File

@ -0,0 +1,83 @@
/*
*
* 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
enum decal_e
{
DECAL_GUNSHOT1 = 0,
DECAL_GUNSHOT2,
DECAL_GUNSHOT3,
DECAL_GUNSHOT4,
DECAL_GUNSHOT5,
DECAL_LAMBDA1,
DECAL_LAMBDA2,
DECAL_LAMBDA3,
DECAL_LAMBDA4,
DECAL_LAMBDA5,
DECAL_LAMBDA6,
DECAL_SCORCH1,
DECAL_SCORCH2,
DECAL_BLOOD1,
DECAL_BLOOD2,
DECAL_BLOOD3,
DECAL_BLOOD4,
DECAL_BLOOD5,
DECAL_BLOOD6,
DECAL_YBLOOD1,
DECAL_YBLOOD2,
DECAL_YBLOOD3,
DECAL_YBLOOD4,
DECAL_YBLOOD5,
DECAL_YBLOOD6,
DECAL_GLASSBREAK1,
DECAL_GLASSBREAK2,
DECAL_GLASSBREAK3,
DECAL_BIGSHOT1,
DECAL_BIGSHOT2,
DECAL_BIGSHOT3,
DECAL_BIGSHOT4,
DECAL_BIGSHOT5,
DECAL_SPIT1,
DECAL_SPIT2,
DECAL_BPROOF1, // Bulletproof glass decal
DECAL_GARGSTOMP1, // Gargantua stomp crack
DECAL_SMALLSCORCH1, // Small scorch mark
DECAL_SMALLSCORCH2, // Small scorch mark
DECAL_SMALLSCORCH3, // Small scorch mark
DECAL_MOMMABIRTH, // Big momma birth splatter
DECAL_MOMMASPLAT,
};
typedef struct
{
char *name;
int index;
} DLL_DECALLIST;
extern DLL_DECALLIST gDecals[42];

View File

@ -0,0 +1,92 @@
/*
*
* 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
#define DOOR_SENTENCEWAIT 6
#define DOOR_SOUNDWAIT 3
#define BUTTON_SOUNDWAIT 0.5
#define SF_DOOR_ROTATE_Y 0
#define SF_DOOR_START_OPEN 1
#define SF_DOOR_ROTATE_BACKWARDS 2
#define SF_DOOR_PASSABLE 8
#define SF_DOOR_ONEWAY 16
#define SF_DOOR_NO_AUTO_RETURN 32
#define SF_DOOR_ROTATE_Z 64
#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_SILENT 0x80000000
class CBaseDoor: public CBaseToggle {
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 void SetToggleState(int state) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
virtual void Blocked(CBaseEntity *pOther) = 0;
public:
BYTE m_bHealthValue; // some doors are medi-kit doors, they give players health
BYTE m_bMoveSnd; // sound a door makes while moving
BYTE m_bStopSnd; // sound a door makes when it stops
locksound_t m_ls; // door lock sounds
BYTE m_bLockedSound; // ordinals from entity selection
BYTE m_bLockedSentence;
BYTE m_bUnlockedSound;
BYTE m_bUnlockedSentence;
float m_lastBlockedTimestamp;
};
class CRotDoor: public CBaseDoor {
public:
virtual void Spawn() = 0;
virtual void Restart() = 0;
virtual void SetToggleState(int state) = 0;
};
class CMomentaryDoor: public CBaseToggle {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
BYTE m_bMoveSnd; // sound a door makes while moving
};

View File

@ -0,0 +1,407 @@
/*
*
* 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
#define SF_BEAM_STARTON 0x0001
#define SF_BEAM_TOGGLE 0x0002
#define SF_BEAM_RANDOM 0x0004
#define SF_BEAM_RING 0x0008
#define SF_BEAM_SPARKSTART 0x0010
#define SF_BEAM_SPARKEND 0x0020
#define SF_BEAM_DECALS 0x0040
#define SF_BEAM_SHADEIN 0x0080
#define SF_BEAM_SHADEOUT 0x0100
#define SF_BEAM_TEMPORARY 0x8000
#define SF_GIBSHOOTER_REPEATABLE 1
#define SF_FUNNEL_REVERSE 1
#define SF_BUBBLES_STARTOFF 0x0001
#define SF_BLOOD_RANDOM 0x0001
#define SF_BLOOD_STREAM 0x0002
#define SF_BLOOD_PLAYER 0x0004
#define SF_BLOOD_DECAL 0x0008
#define SF_SHAKE_EVERYONE 0x0001
#define SF_SHAKE_DISRUPT 0x0002
#define SF_SHAKE_INAIR 0x0004
#define SF_FADE_IN 0x0001
#define SF_FADE_MODULATE 0x0002
#define SF_FADE_ONLYONE 0x0004
#define SF_SPRITE_STARTON 0x0001
#define SF_SPRITE_ONCE 0x0002
#define SF_SPRITE_TEMPORARY 0x8000
#define SF_MESSAGE_ONCE 0x0001 // Fade in, not out
#define SF_MESSAGE_ALL 0x0002 // Send to all clients
class CSprite: public CPointEntity {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void Restart() = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
void SetAttachment(edict_t *pEntity, int attachment)
{
if (pEntity != NULL)
{
pev->skin = ENTINDEX(pEntity);
pev->body = attachment;
pev->aiment = pEntity;
pev->movetype = MOVETYPE_FOLLOW;
}
}
float Frames() const { return m_maxFrame; }
void SetTransparency(int rendermode, int r, int g, int b, int a, int fx)
{
pev->rendermode = rendermode;
pev->rendercolor.x = r;
pev->rendercolor.y = g;
pev->rendercolor.z = b;
pev->renderamt = a;
pev->renderfx = fx;
}
void SetTexture(int spriteIndex) { pev->modelindex = spriteIndex; }
void SetScale(float scale) { pev->scale = scale; }
void SetColor(int r, int g, int b) { pev->rendercolor.x = r; pev->rendercolor.y = g; pev->rendercolor.z = b; }
void SetBrightness(int brightness) { pev->renderamt = brightness; }
void AnimateAndDie(float framerate)
{
SetThink(&CSprite::AnimateUntilDead);
pev->framerate = framerate;
pev->dmgtime = gpGlobals->time + (m_maxFrame / framerate);
pev->nextthink = gpGlobals->time;
}
private:
float m_lastTime;
float m_maxFrame;
};
class CBeam: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual int ObjectCaps() = 0;
virtual Vector Center() = 0;
public:
void SetType(int type) { pev->rendermode = (pev->rendermode & 0xF0) | (type & 0x0F); }
void SetFlags(int flags) { pev->rendermode = (pev->rendermode & 0x0F) | (flags & 0xF0); }
void SetStartPos(const Vector &pos) { pev->origin = pos; }
void SetEndPos(const Vector &pos) { pev->angles = pos; }
void SetStartEntity(int entityIndex);
void SetEndEntity(int entityIndex);
void SetStartAttachment(int attachment) { pev->sequence = (pev->sequence & 0x0FFF) | ((attachment & 0xF) << 12); }
void SetEndAttachment(int attachment) { pev->skin = (pev->skin & 0x0FFF) | ((attachment & 0xF) << 12); }
void SetTexture(int spriteIndex) { pev->modelindex = spriteIndex; }
void SetWidth(int width) { pev->scale = width; }
void SetNoise(int amplitude) { pev->body = amplitude; }
void SetColor(int r, int g, int b) { pev->rendercolor.x = r; pev->rendercolor.y = g; pev->rendercolor.z = b; }
void SetBrightness(int brightness) { pev->renderamt = brightness; }
void SetFrame(float frame) { pev->frame = frame; }
void SetScrollRate(int speed) { pev->animtime = speed; }
int GetType() const { return pev->rendermode & 0x0F; }
int GetFlags() const { return pev->rendermode & 0xF0; }
int GetStartEntity() const { return pev->sequence & 0xFFF; }
int GetEndEntity() const { return pev->skin & 0xFFF; }
const Vector &GetStartPos();
const Vector &GetEndPos();
int GetTexture() const { return pev->modelindex; }
int GetWidth() const { return pev->scale; }
int GetNoise() const { return pev->body; }
int GetBrightness() const { return pev->renderamt; }
int GetFrame() const { return pev->frame; }
int GetScrollRate() const { return pev->animtime; }
void LiveForTime(float time)
{
SetThink(&CBeam::SUB_Remove);
pev->nextthink = gpGlobals->time + time;
}
void BeamDamageInstant(TraceResult *ptr, float damage)
{
pev->dmg = damage;
pev->dmgtime = gpGlobals->time - 1;
BeamDamage(ptr);
}
};
class CLaser: public CBeam {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
CSprite *m_pSprite;
int m_iszSpriteName;
Vector m_firePosition;
};
class CBubbling: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
int m_density;
int m_frequency;
int m_bubbleModel;
int m_state;
};
class CLightning: public CBeam {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual void Activate() = 0;
public:
inline BOOL ServerSide() const
{
if (!m_life && !(pev->spawnflags & SF_BEAM_RING))
return TRUE;
return FALSE;
}
public:
int m_active;
int m_iszStartEntity;
int m_iszEndEntity;
float m_life;
int m_boltWidth;
int m_noiseAmplitude;
int m_brightness;
int m_speed;
float m_restrike;
int m_spriteTexture;
int m_iszSpriteName;
int m_frameStart;
float m_radius;
};
class CGlow: public CPointEntity {
public:
virtual void Spawn() = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual void Think() = 0;
public:
float m_lastTime;
float m_maxFrame;
};
class CBombGlow: public CSprite {
public:
virtual void Spawn() = 0;
virtual void Think() = 0;
public:
float m_lastTime;
float m_tmBeepPeriod;
bool m_bSetModel;
};
class CGibShooter: public CBaseDelay {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
virtual CGib *CreateGib() = 0;
public:
int m_iGibs;
int m_iGibCapacity;
int m_iGibMaterial;
int m_iGibModelIndex;
float m_flGibVelocity;
float m_flVariance;
float m_flGibLife;
};
class CEnvShooter: public CGibShooter {
public:
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual CGib *CreateGib() = 0;
};
#define MAX_BEAM 24
class CTestEffect: public CBaseDelay {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
int m_iLoop;
int m_iBeam;
CBeam *m_pBeam[MAX_BEAM];
float m_flBeamTime[MAX_BEAM];
float m_flStartTime;
};
class CBlood: public CPointEntity {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
int Color() const { return pev->impulse; }
float BloodAmount() const { return pev->dmg; }
void SetColor(int color) { pev->impulse = color; }
void SetBloodAmount(float amount) { pev->dmg = amount; }
};
class CShake: public CPointEntity {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
float Amplitude() const { return pev->scale; }
float Frequency() const { return pev->dmg_save; }
float Duration() const { return pev->dmg_take; }
float Radius() const { return pev->dmg; }
void SetAmplitude(float amplitude) { pev->scale = amplitude; }
void SetFrequency(float frequency) { pev->dmg_save = frequency; }
void SetDuration(float duration) { pev->dmg_take = duration; }
void SetRadius(float radius) { pev->dmg = radius; }
};
class CFade: public CPointEntity {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
float Duration() const { return pev->dmg_take; }
float HoldTime() const { return pev->dmg_save; }
void SetDuration(float duration) { pev->dmg_take = duration; }
void SetHoldTime(float hold) { pev->dmg_save = hold; }
};
class CMessage: public CPointEntity {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
};
class CEnvFunnel: public CBaseDelay {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
int m_iSprite;
};
class CEnvBeverage: public CBaseDelay {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
};
class CItemSoda: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
};
// Inlines
inline void CBeam::SetStartEntity(int entityIndex)
{
pev->sequence = (entityIndex & 0x0FFF) | ((pev->sequence & 0xF000) << 12);
pev->owner = INDEXENT(entityIndex);
}
inline void CBeam::SetEndEntity(int entityIndex)
{
pev->skin = (entityIndex & 0x0FFF) | ((pev->skin & 0xF000) << 12);
pev->aiment = INDEXENT(entityIndex);
}
inline const Vector &CBeam::GetStartPos()
{
if (GetType() == BEAM_ENTS)
{
edict_t *pent = INDEXENT(GetStartEntity());
return pent->v.origin;
}
return pev->origin;
}
inline const Vector &CBeam::GetEndPos()
{
int type = GetType();
if (type == BEAM_POINTS || type == BEAM_HOSE)
{
return pev->angles;
}
edict_t *pent = INDEXENT(GetEndEntity());
if (pent != NULL)
{
return pent->v.origin;
}
return pev->angles;
}

View File

@ -0,0 +1,178 @@
/*
*
* 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
#include "event_flags.h"
// Must be provided by user of this code
extern enginefuncs_t g_engfuncs;
// The actual engine callbacks
#define GETPLAYERUSERID (*g_engfuncs.pfnGetPlayerUserId)
#define PRECACHE_MODEL (*g_engfuncs.pfnPrecacheModel)
#define PRECACHE_SOUND (*g_engfuncs.pfnPrecacheSound)
#define PRECACHE_GENERIC (*g_engfuncs.pfnPrecacheGeneric)
#define SET_MODEL (*g_engfuncs.pfnSetModel)
#define MODEL_INDEX (*g_engfuncs.pfnModelIndex)
#define MODEL_FRAMES (*g_engfuncs.pfnModelFrames)
#define SET_SIZE (*g_engfuncs.pfnSetSize)
#define CHANGE_LEVEL (*g_engfuncs.pfnChangeLevel)
#define GET_SPAWN_PARMS (*g_engfuncs.pfnGetSpawnParms)
#define SAVE_SPAWN_PARMS (*g_engfuncs.pfnSaveSpawnParms)
#define VEC_TO_YAW (*g_engfuncs.pfnVecToYaw)
#define VEC_TO_ANGLES (*g_engfuncs.pfnVecToAngles)
#define MOVE_TO_ORIGIN (*g_engfuncs.pfnMoveToOrigin)
#define oldCHANGE_YAW (*g_engfuncs.pfnChangeYaw)
#define CHANGE_PITCH (*g_engfuncs.pfnChangePitch)
#define MAKE_VECTORS (*g_engfuncs.pfnMakeVectors)
#define CREATE_ENTITY (*g_engfuncs.pfnCreateEntity)
#define REMOVE_ENTITY (*g_engfuncs.pfnRemoveEntity)
#define CREATE_NAMED_ENTITY (*g_engfuncs.pfnCreateNamedEntity)
#define MAKE_STATIC (*g_engfuncs.pfnMakeStatic)
#define ENT_IS_ON_FLOOR (*g_engfuncs.pfnEntIsOnFloor)
#define DROP_TO_FLOOR (*g_engfuncs.pfnDropToFloor)
#define WALK_MOVE (*g_engfuncs.pfnWalkMove)
#define SET_ORIGIN (*g_engfuncs.pfnSetOrigin)
#define EMIT_SOUND_DYN2 (*g_engfuncs.pfnEmitSound)
#define BUILD_SOUND_MSG (*g_engfuncs.pfnBuildSoundMsg)
#define TRACE_LINE (*g_engfuncs.pfnTraceLine)
#define TRACE_TOSS (*g_engfuncs.pfnTraceToss)
#define TRACE_MONSTER_HULL (*g_engfuncs.pfnTraceMonsterHull)
#define TRACE_HULL (*g_engfuncs.pfnTraceHull)
#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 CLIENT_COMMAND (*g_engfuncs.pfnClientCommand)
#define PARTICLE_EFFECT (*g_engfuncs.pfnParticleEffect)
#define LIGHT_STYLE (*g_engfuncs.pfnLightStyle)
#define DECAL_INDEX (*g_engfuncs.pfnDecalIndex)
#define POINT_CONTENTS (*g_engfuncs.pfnPointContents)
#define CRC32_INIT (*g_engfuncs.pfnCRC32_Init)
#define CRC32_PROCESS_BUFFER (*g_engfuncs.pfnCRC32_ProcessBuffer)
#define CRC32_PROCESS_BYTE (*g_engfuncs.pfnCRC32_ProcessByte)
#define CRC32_FINAL (*g_engfuncs.pfnCRC32_Final)
#define RANDOM_LONG (*g_engfuncs.pfnRandomLong)
#define RANDOM_FLOAT (*g_engfuncs.pfnRandomFloat)
#define ADD_SERVER_COMMAND (*g_engfuncs.pfnAddServerCommand)
#define SET_CLIENT_LISTENING (*g_engfuncs.pfnVoice_SetClientListening)
#define GETPLAYERAUTHID (*g_engfuncs.pfnGetPlayerAuthId)
#define GET_FILE_SIZE (*g_engfuncs.pfnGetFileSize)
#define GET_APPROX_WAVE_PLAY_LEN (*g_engfuncs.pfnGetApproxWavePlayLen)
#define IS_CAREER_MATCH (*g_engfuncs.pfnIsCareerMatch)
#define GET_LOCALIZED_STRING_LENGTH (*g_engfuncs.pfnGetLocalizedStringLength)
#define REGISTER_TUTOR_MESSAGE_SHOWN (*g_engfuncs.pfnRegisterTutorMessageShown)
#define GET_TIMES_TUTOR_MESSAGE_SHOWN (*g_engfuncs.pfnGetTimesTutorMessageShown)
#define ENG_CHECK_PARM (*g_engfuncs.pfnEngCheckParm)
inline void MESSAGE_BEGIN(int msg_dest, int msg_type, const float *pOrigin = NULL, edict_t *ed = NULL) { (*g_engfuncs.pfnMessageBegin)(msg_dest, msg_type, pOrigin, ed); }
inline void *GET_PRIVATE(edict_t *pent)
{
if (pent)
return pent->pvPrivateData;
return NULL;
}
#define MESSAGE_END (*g_engfuncs.pfnMessageEnd)
#define WRITE_BYTE (*g_engfuncs.pfnWriteByte)
#define WRITE_CHAR (*g_engfuncs.pfnWriteChar)
#define WRITE_SHORT (*g_engfuncs.pfnWriteShort)
#define WRITE_LONG (*g_engfuncs.pfnWriteLong)
#define WRITE_ANGLE (*g_engfuncs.pfnWriteAngle)
#define WRITE_COORD (*g_engfuncs.pfnWriteCoord)
#define WRITE_STRING (*g_engfuncs.pfnWriteString)
#define WRITE_ENTITY (*g_engfuncs.pfnWriteEntity)
#define CVAR_REGISTER (*g_engfuncs.pfnCVarRegister)
#define CVAR_GET_FLOAT (*g_engfuncs.pfnCVarGetFloat)
#define CVAR_GET_STRING (*g_engfuncs.pfnCVarGetString)
#define CVAR_SET_FLOAT (*g_engfuncs.pfnCVarSetFloat)
#define CVAR_SET_STRING (*g_engfuncs.pfnCVarSetString)
#define CVAR_GET_POINTER (*g_engfuncs.pfnCVarGetPointer)
#define ALERT (*g_engfuncs.pfnAlertMessage)
#define ENGINE_FPRINTF (*g_engfuncs.pfnEngineFprintf)
#define ALLOC_PRIVATE (*g_engfuncs.pfnPvAllocEntPrivateData)
#define FREE_PRIVATE (*g_engfuncs.pfnFreeEntPrivateData)
//#define STRING (*g_engfuncs.pfnSzFromIndex)
#define ALLOC_STRING (*g_engfuncs.pfnAllocString)
#define FIND_ENTITY_BY_STRING (*g_engfuncs.pfnFindEntityByString)
#define GETENTITYILLUM (*g_engfuncs.pfnGetEntityIllum)
#define FIND_ENTITY_IN_SPHERE (*g_engfuncs.pfnFindEntityInSphere)
#define FIND_CLIENT_IN_PVS (*g_engfuncs.pfnFindClientInPVS)
#define FIND_ENTITY_IN_PVS (*g_engfuncs.pfnEntitiesInPVS)
#define EMIT_AMBIENT_SOUND (*g_engfuncs.pfnEmitAmbientSound)
#define GET_MODEL_PTR (*g_engfuncs.pfnGetModelPtr)
#define REG_USER_MSG (*g_engfuncs.pfnRegUserMsg)
#define GET_BONE_POSITION (*g_engfuncs.pfnGetBonePosition)
#define FUNCTION_FROM_NAME (*g_engfuncs.pfnFunctionFromName)
#define NAME_FOR_FUNCTION (*g_engfuncs.pfnNameForFunction)
#define TRACE_TEXTURE (*g_engfuncs.pfnTraceTexture)
#define CLIENT_PRINTF (*g_engfuncs.pfnClientPrintf)
#define SERVER_PRINT (*g_engfuncs.pfnServerPrint)
#define CMD_ARGS (*g_engfuncs.pfnCmd_Args)
#define CMD_ARGC (*g_engfuncs.pfnCmd_Argc)
#define CMD_ARGV (*g_engfuncs.pfnCmd_Argv)
#define GET_ATTACHMENT (*g_engfuncs.pfnGetAttachment)
#define SET_VIEW (*g_engfuncs.pfnSetView)
#define SET_CROSSHAIRANGLE (*g_engfuncs.pfnCrosshairAngle)
#define LOAD_FILE_FOR_ME (*g_engfuncs.pfnLoadFileForMe)
#define FREE_FILE (*g_engfuncs.pfnFreeFile)
#define END_SECTION (*g_engfuncs.pfnEndSection)
#define COMPARE_FILE_TIME (*g_engfuncs.pfnCompareFileTime)
#define GET_GAME_DIR (*g_engfuncs.pfnGetGameDir)
#define SET_CLIENT_MAXSPEED (*g_engfuncs.pfnSetClientMaxspeed)
#define CREATE_FAKE_CLIENT (*g_engfuncs.pfnCreateFakeClient)
#define PLAYER_RUN_MOVE (*g_engfuncs.pfnRunPlayerMove)
#define NUMBER_OF_ENTITIES (*g_engfuncs.pfnNumberOfEntities)
#define GET_INFO_BUFFER (*g_engfuncs.pfnGetInfoKeyBuffer)
#define GET_KEY_VALUE (*g_engfuncs.pfnInfoKeyValue)
#define SET_KEY_VALUE (*g_engfuncs.pfnSetKeyValue)
#define SET_CLIENT_KEY_VALUE (*g_engfuncs.pfnSetClientKeyValue)
#define IS_MAP_VALID (*g_engfuncs.pfnIsMapValid)
#define STATIC_DECAL (*g_engfuncs.pfnStaticDecal)
#define IS_DEDICATED_SERVER (*g_engfuncs.pfnIsDedicatedServer)
#define PRECACHE_EVENT (*g_engfuncs.pfnPrecacheEvent)
#define PLAYBACK_EVENT_FULL (*g_engfuncs.pfnPlaybackEvent)
#define ENGINE_SET_PVS (*g_engfuncs.pfnSetFatPVS)
#define ENGINE_SET_PAS (*g_engfuncs.pfnSetFatPAS)
#define ENGINE_CHECK_VISIBILITY (*g_engfuncs.pfnCheckVisibility)
#define DELTA_SET (*g_engfuncs.pfnDeltaSetField)
#define DELTA_UNSET (*g_engfuncs.pfnDeltaUnsetField)
#define DELTA_ADDENCODER (*g_engfuncs.pfnDeltaAddEncoder)
#define ENGINE_CURRENT_PLAYER (*g_engfuncs.pfnGetCurrentPlayer)
#define ENGINE_CANSKIP (*g_engfuncs.pfnCanSkipPlayer)
#define DELTA_FINDFIELD (*g_engfuncs.pfnDeltaFindField)
#define DELTA_SETBYINDEX (*g_engfuncs.pfnDeltaSetFieldByIndex)
#define DELTA_UNSETBYINDEX (*g_engfuncs.pfnDeltaUnsetFieldByIndex)
#define REMOVE_KEY_VALUE (*g_engfuncs.pfnInfo_RemoveKey)
#define SET_PHYSICS_KEY_VALUE (*g_engfuncs.pfnSetPhysicsKeyValue)
#define ENGINE_GETPHYSINFO (*g_engfuncs.pfnGetPhysicsInfoString)
#define ENGINE_SETGROUPMASK (*g_engfuncs.pfnSetGroupMask)
#define ENGINE_INSTANCE_BASELINE (*g_engfuncs.pfnCreateInstancedBaseline)
#define ENGINE_FORCE_UNMODIFIED (*g_engfuncs.pfnForceUnmodified)
#define PLAYER_CNX_STATS (*g_engfuncs.pfnGetPlayerStats)

View File

@ -0,0 +1,55 @@
/*
*
* 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
#define SF_ENVEXPLOSION_NODAMAGE (1<<0) // when set, ENV_EXPLOSION will not actually inflict damage
#define SF_ENVEXPLOSION_REPEATABLE (1<<1) // can this entity be refired?
#define SF_ENVEXPLOSION_NOFIREBALL (1<<2) // don't draw the fireball
#define SF_ENVEXPLOSION_NOSMOKE (1<<3) // don't draw the smoke
#define SF_ENVEXPLOSION_NODECAL (1<<4) // don't make a scorch mark
#define SF_ENVEXPLOSION_NOSPARKS (1<<5) // don't make a scorch mark
class CShower: public CBaseEntity {
public:
virtual void Spawn() = 0;
virtual int ObjectCaps() = 0;
virtual void Think() = 0;
virtual void Touch(CBaseEntity *pOther) = 0;
};
class CEnvExplosion: public CBaseMonster {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
int m_iMagnitude;
int m_spriteScale;
};

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
#include "regamedll_const.h"
enum hash_types_e { CLASSNAME };
// Things that toggle (buttons/triggers/doors) need this
enum TOGGLE_STATE { TS_AT_TOP, TS_AT_BOTTOM, TS_GOING_UP, TS_GOING_DOWN };
typedef struct hash_item_s
{
entvars_t *pev;
struct hash_item_s *next;
struct hash_item_s *lastHash;
int pevIndex;
} hash_item_t;
typedef struct locksounds
{
string_t sLockedSound;
string_t sLockedSentence;
string_t sUnlockedSound;
string_t sUnlockedSentence;
int iLockedSentence;
int iUnlockedSentence;
float flwaitSound;
float flwaitSentence;
BYTE bEOFLocked;
BYTE bEOFUnlocked;
} locksound_t;
typedef struct hudtextparms_s
{
float x;
float y;
int effect;
byte r1,g1,b1,a1;
byte r2,g2,b2,a2;
float fadeinTime;
float fadeoutTime;
float holdTime;
float fxTime;
int channel;
} hudtextparms_t;
enum USE_TYPE { USE_OFF, USE_ON, USE_SET, USE_TOGGLE };
enum TRAIN_CODE { TRAIN_SAFE, TRAIN_BLOCKING, TRAIN_FOLLOWING };
enum IGNORE_MONSTERS { ignore_monsters = 1, dont_ignore_monsters = 0, missile = 2 };
enum IGNORE_GLASS { ignore_glass = 1, dont_ignore_glass = 0 };
enum { point_hull = 0, human_hull = 1, large_hull = 2, head_hull = 3 };

View File

@ -0,0 +1,83 @@
/*
*
* 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
#pragma warning(disable:4244) // int or float down-conversion
#pragma warning(disable:4305) // int or float data truncation
#pragma warning(disable:4201) // nameless struct/union
#pragma warning(disable:4514) // unreferenced inline function removed
#pragma warning(disable:4100) // unreferenced formal parameter
#include "archtypes.h"
#include "maintypes.h"
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#define NOWINRES
#define NOSERVICE
#define NOMCX
#define NOIME
#include "winsani_in.h"
#include "windows.h"
#include "winsani_out.h"
#undef PlaySound
#else
#include <limits.h>
#include <stdarg.h>
#include <string.h>
#endif // _WIN32
// Misc C-runtime library headers
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
// Header file containing definition of globalvars_t and entvars_t
typedef int EOFFSET; // More explicit than "int"
typedef unsigned int func_t;
typedef unsigned int string_t; // from engine's pr_comp.h;
typedef float vec_t; // needed before including progdefs.h
// Vector class
#include "vector.h"
//#include "vector.h"
// Defining it as a (bogus) struct helps enforce type-checking
#define vec3_t Vector
// Shared engine/DLL constants
#include "const.h"
#include "edict.h"
// Shared header describing protocol between engine and DLLs
#include "eiface.h"
// Shared header between the client DLL and the game DLLs
#include "cdll_dll.h"
#include "extdef.h"

View File

@ -0,0 +1,119 @@
/*
*
* 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
// this many shards spawned when breakable objects break;
#define NUM_SHARDS 6
// func breakable
#define SF_BREAK_TRIGGER_ONLY 1 // may only be broken by trigger
#define SF_BREAK_TOUCH 2 // can be 'crashed through' by running player (plate glass)
#define SF_BREAK_PRESSURE 4 // can be broken by a player standing on it
#define SF_BREAK_CROWBAR 256 // instant break if hit with crowbar
// func_pushable (it's also func_breakable, so don't collide with those flags)
#define SF_PUSH_BREAKABLE 128
typedef enum
{
expRandom = 0,
expDirected,
} Explosions;
typedef enum
{
matGlass = 0,
matWood,
matMetal,
matFlesh,
matCinderBlock,
matCeilingTile,
matComputer,
matUnbreakableGlass,
matRocks,
matNone,
matLastMaterial,
} Materials;
class CBreakable: public CBaseDelay {
public:
// basic functions
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;
// To spark when hit
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
// breakables use an overridden takedamage
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual int DamageDecal(int bitsDamageType) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
public:
BOOL Explodable() const { return ExplosionMagnitude() > 0; }
int ExplosionMagnitude() const { return pev->impulse; }
void ExplosionSetMagnitude(int magnitude) { pev->impulse = magnitude; }
public:
Materials m_Material;
Explosions m_Explosion;
int m_idShard;
float m_angle;
int m_iszGibModel;
int m_iszSpawnObject;
float m_flHealth;
};
class CPushable: public CBreakable {
public:
virtual void Spawn() = 0;
virtual void Precache() = 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 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;
public:
float MaxSpeed() const { return m_maxSpeed; }
public:
int m_lastSound;
float m_maxSpeed;
float m_soundTime;
};

Some files were not shown because too many files have changed in this diff Show More