Skip to content

Commit

Permalink
split cbase into multiple files
Browse files Browse the repository at this point in the history
  • Loading branch information
wootguy committed Nov 19, 2024
1 parent 80dd678 commit 815558d
Show file tree
Hide file tree
Showing 295 changed files with 1,442 additions and 1,767 deletions.
2 changes: 2 additions & 0 deletions cl_dll/hl/hl_baseentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ This file contains "stubs" of class member implementations so that we can predic
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "CWorld.h"
#include "CBasePlayer.h"
#include "CMultiSource.h"
#include "weapon/weapons.h"
#include "nodes.h"
#include "env/CSoundEnt.h"
Expand Down
175 changes: 175 additions & 0 deletions common/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,181 @@
#define TE_BOUNCE_SHELL 1
#define TE_BOUNCE_SHOTSHELL 2

#define MAX_PATH_SIZE 10 // max number of nodes available for a path.

// 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_ACROSS_TRANSITION 0x00000002 // should transfer between transitions
#define FCAP_MUST_SPAWN 0x00000004 // Spawn after restore
#define FCAP_DONT_SAVE 0x80000000 // Don't save this
#define FCAP_IMPULSE_USE 0x00000008 // can be used by the player
#define FCAP_CONTINUOUS_USE 0x00000010 // can be used by the player
#define FCAP_ONOFF_USE 0x00000020 // can be used by the player
#define FCAP_DIRECTIONAL_USE 0x00000040 // Player sends +/- 1 when using (currently only tracktrains)
#define FCAP_MASTER 0x00000080 // Can be used to "master" other entities (like multisource)

// UNDONE: This will ignore transition volumes (trigger_transition), but not the PVS!!!
#define FCAP_FORCE_TRANSITION 0x00000080 // ALWAYS goes across transitions

// For CLASSIFY
#define CLASS_NONE 0
#define CLASS_MACHINE 1
#define CLASS_PLAYER 2
#define CLASS_HUMAN_PASSIVE 3
#define CLASS_HUMAN_MILITARY 4
#define CLASS_ALIEN_MILITARY 5
#define CLASS_ALIEN_PASSIVE 6
#define CLASS_ALIEN_MONSTER 7
#define CLASS_ALIEN_PREY 8
#define CLASS_ALIEN_PREDATOR 9
#define CLASS_INSECT 10
#define CLASS_PLAYER_ALLY 11
#define CLASS_PLAYER_BIOWEAPON 12 // hornets and snarks.launched by players
#define CLASS_ALIEN_BIOWEAPON 13 // hornets and snarks.launched by the alien menace
#define CLASS_ALIEN_RACE_X 14
#define CLASS_ALIEN_RACE_X_PITDRONE 15 // TODO: use this
#define CLASS_VEHICLE 16
#define CLASS_BARNACLE 99 // special because no one pays attention to it, and it eats a wide cross-section of creatures.

#define SF_NORESPAWN ( 1 << 10 )// !!!set this bit on guns and stuff that should never respawn.

#define MAX_MULTI_TARGETS 64 // maximum number of targets a single multi_manager entity may be assigned.
#define MS_MAX_TARGETS 32

// people gib if their health is <= this at the time of death
#define GIB_HEALTH_VALUE -30

#define ROUTE_SIZE 8 // how many waypoints a monster can store at one time
#define MAX_OLD_ENEMIES 4 // how many old enemies to remember

#define bits_CAP_DUCK ( 1 << 0 )// crouch
#define bits_CAP_JUMP ( 1 << 1 )// jump/leap
#define bits_CAP_STRAFE ( 1 << 2 )// strafe ( walk/run sideways)
#define bits_CAP_SQUAD ( 1 << 3 )// can form squads
#define bits_CAP_SWIM ( 1 << 4 )// proficiently navigate in water
#define bits_CAP_CLIMB ( 1 << 5 )// climb ladders/ropes
#define bits_CAP_USE ( 1 << 6 )// open doors/push buttons/pull levers
#define bits_CAP_HEAR ( 1 << 7 )// can hear forced sounds
#define bits_CAP_AUTO_DOORS ( 1 << 8 )// can trigger auto doors
#define bits_CAP_OPEN_DOORS ( 1 << 9 )// can open manual doors
#define bits_CAP_TURN_HEAD ( 1 << 10)// can turn head, always bone controller 0

#define bits_CAP_RANGE_ATTACK1 ( 1 << 11)// can do a range attack 1
#define bits_CAP_RANGE_ATTACK2 ( 1 << 12)// can do a range attack 2
#define bits_CAP_MELEE_ATTACK1 ( 1 << 13)// can do a melee attack 1
#define bits_CAP_MELEE_ATTACK2 ( 1 << 14)// can do a melee attack 2

#define bits_CAP_FLY ( 1 << 15)// can fly, move all around

#define bits_CAP_DOORS_GROUP (bits_CAP_USE | bits_CAP_AUTO_DOORS | bits_CAP_OPEN_DOORS)

// used by suit voice to indicate damage sustained and repaired type to player

// instant damage

#define DMG_GENERIC 0 // generic damage was done
#define DMG_CRUSH (1 << 0) // crushed by falling or moving object
#define DMG_BULLET (1 << 1) // shot
#define DMG_SLASH (1 << 2) // cut, clawed, stabbed
#define DMG_BURN (1 << 3) // heat burned
#define DMG_FREEZE (1 << 4) // frozen
#define DMG_FALL (1 << 5) // fell too far
#define DMG_BLAST (1 << 6) // explosive blast damage
#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)

// sven-specific damages
#define DMG_SNIPER (1 << 24) // hit by a Sniper
#define DMG_MEDKITHEAL (1 << 25) // medkit healing
#define DMG_LAUNCH (1 << 26) // launch into air
#define DMG_SHOCK_GLOW (1 << 27) // shock glow effect

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

// damage types that draw blood from the victim
#define DMG_BLOOD (DMG_BULLET | DMG_SLASH | DMG_BLAST | DMG_CLUB | DMG_ACID | DMG_MORTAR | DMG_SNIPER | DMG_ENERGYBEAM)

// NOTE: tweak these values based on gameplay feedback:

#define PARALYZE_DURATION 2 // number of 2 second intervals to take damage
#define PARALYZE_DAMAGE 1.0 // damage to take each 2 second interval

#define NERVEGAS_DURATION 2
#define NERVEGAS_DAMAGE 5.0

#define POISON_DURATION 5
#define POISON_DAMAGE 2.0

#define RADIATION_DURATION 2
#define RADIATION_DAMAGE 1.0

#define ACID_DURATION 2
#define ACID_DAMAGE 5.0

#define SLOWBURN_DURATION 2
#define SLOWBURN_DAMAGE 1.0

#define SLOWFREEZE_DURATION 2
#define SLOWFREEZE_DAMAGE 1.0


#define itbd_Paralyze 0
#define itbd_NerveGas 1
#define itbd_Poison 2
#define itbd_Radiation 3
#define itbd_DrownRecover 4
#define itbd_Acid 5
#define itbd_SlowBurn 6
#define itbd_SlowFreeze 7
#define CDMG_TIMEBASED 8

// when calling KILLED(), a value that governs gib behavior is expected to be
// one of these three values
#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 WATERLEVEL_DRY 0
#define WATERLEVEL_FEET 1
#define WATERLEVEL_WAIST 2
#define WATERLEVEL_HEAD 3

#define SF_ITEM_TOUCH_ONLY 128 // Pick this item up only by touching it.
#define SF_ITEM_USE_ONLY 256 // Pick this item up only by using it ('USE' key).
#define SF_ITEM_USE_WITHOUT_LOS 512 // Player can pick up this item even when it's not within his line of sight.

typedef enum { USE_OFF = 0, USE_ON = 1, USE_SET = 2, USE_TOGGLE = 3 } USE_TYPE;

// Things that toggle (buttons/triggers/doors) need this
typedef enum
{
TS_AT_TOP,
TS_AT_BOTTOM,
TS_GOING_UP,
TS_GOING_DOWN
} TOGGLE_STATE;

// Rendering constants
enum
{
Expand Down
1 change: 0 additions & 1 deletion dlls/CBaseAnimating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "animation.h"
#include "saverestore.h"
#include "monster/CBaseMonster.h"
Expand Down
44 changes: 44 additions & 0 deletions dlls/CBaseAnimating.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#pragma once
#include "CBaseDelay.h"
#include "monster/monsterevent.h"

class EXPORT CBaseAnimating : public CBaseDelay
{
public:
virtual int GetEntindexPriority() { return ENTIDX_PRIORITY_NORMAL; }
virtual int Save(CSave& save);
virtual int Restore(CRestore& restore);
virtual CBaseAnimating* MyAnimatingPointer(void) { return this; }

static TYPEDESCRIPTION m_SaveData[];

// Basic Monster Animation functions
float StudioFrameAdvance(float flInterval = 0.0); // accumulate animation frame time from last time called until now
int GetSequenceFlags(void);
virtual int LookupActivity(int activity);
int LookupActivityHeaviest(int activity);
int LookupSequence(const char* label);
void ResetSequenceInfo();
void DispatchAnimEvents(float flFutureInterval = 0.1); // Handle events that have happend since last time called up until X seconds into the future
virtual void HandleAnimEvent(MonsterEvent_t* pEvent) { return; };
float SetBoneController(int iController, float flValue);
void InitBoneControllers(void);
float SetBlending(int iBlender, float flValue);
void GetBonePosition(int iBone, Vector& origin, Vector& angles);
void GetAutomovement(Vector& origin, Vector& angles, float flInterval = 0.1);
int FindTransition(int iEndingSequence, int iGoalSequence, int* piDir);
void GetAttachment(int iAttachment, Vector& origin, Vector& angles);
int GetAttachmentCount();
void SetBodygroup(int iGroup, int iValue);
int GetBodygroup(int iGroup);
int ExtractBbox(int sequence, float* mins, float* maxs);
void SetSequenceBox(void);
bool ActivityHasEvent(int activity, int event);

// 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
};
1 change: 0 additions & 1 deletion dlls/CBaseDelay.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "saverestore.h"
#include "nodes.h"
#include "CBaseDoor.h"
Expand Down
22 changes: 22 additions & 0 deletions dlls/CBaseDelay.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#pragma once
#include "CBaseEntity.h"

//
// generic Delay entity.
//
class EXPORT CBaseDelay : public CBaseEntity
{
public:
float m_flDelay;
int m_iszKillTarget;

virtual int GetEntindexPriority() { return ENTIDX_PRIORITY_LOW; }
virtual void KeyValue(KeyValueData* pkvd);
virtual int Save(CSave& save);
virtual int Restore(CRestore& restore);

static TYPEDESCRIPTION m_SaveData[];
// common member functions
void SUB_UseTargets(CBaseEntity* pActivator, USE_TYPE useType, float value);
void DelayThink(void);
};
1 change: 0 additions & 1 deletion dlls/CBaseEntity.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "saverestore.h"
#include "hlds_hooks.h"
#include "decals.h"
Expand Down
Loading

0 comments on commit 815558d

Please sign in to comment.