Skip to content

Commit

Permalink
CSSDK: Implemented DECLARE_CLASS_TYPES for all game classes
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lentq committed Dec 17, 2020
1 parent defe858 commit 5ab7874
Show file tree
Hide file tree
Showing 36 changed files with 617 additions and 203 deletions.
5 changes: 5 additions & 0 deletions reapi/include/cssdk/dlls/API/CSEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
class CBaseEntity;
class CCSEntity
{
DECLARE_CLASS_TYPES(CCSEntity, CCSEntity);
public:
CCSEntity() :
m_pContainingEntity(nullptr)
Expand All @@ -47,24 +48,28 @@ class CCSEntity

class CCSDelay: public CCSEntity
{
DECLARE_CLASS_TYPES(CCSDelay, CCSEntity);
public:

};

class CCSAnimating: public CCSDelay
{
DECLARE_CLASS_TYPES(CCSAnimating, CCSDelay);
public:

};

class CCSToggle: public CCSAnimating
{
DECLARE_CLASS_TYPES(CCSToggle, CCSAnimating);
public:

};

class CCSMonster: public CCSToggle
{
DECLARE_CLASS_TYPES(CCSMonster, CCSToggle);
public:

};
Expand Down
4 changes: 3 additions & 1 deletion reapi/include/cssdk/dlls/API/CSPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ enum WeaponInfiniteAmmoMode
WPNMODE_INFINITE_BPAMMO
};

class CCSPlayer: public CCSMonster {
class CCSPlayer: public CCSMonster
{
DECLARE_CLASS_TYPES(CCSPlayer, CCSMonster);
public:
CCSPlayer() :
m_bForceShowMenu(false),
Expand Down
1 change: 1 addition & 0 deletions reapi/include/cssdk/dlls/API/CSPlayerItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
class CBasePlayerItem;
class CCSPlayerItem: public CCSAnimating
{
DECLARE_CLASS_TYPES(CCSPlayerItem, CCSAnimating);
public:
CCSPlayerItem()
{
Expand Down
4 changes: 3 additions & 1 deletion reapi/include/cssdk/dlls/airtank.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
*/
#pragma once

class CAirtank: public CGrenade {
class CAirtank: public CGrenade
{
DECLARE_CLASS_TYPES(CAirtank, CGrenade);
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
Expand Down
40 changes: 30 additions & 10 deletions reapi/include/cssdk/dlls/ammo.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,70 +27,90 @@
*/
#pragma once

class C9MMAmmo: public CBasePlayerAmmo {
class C9MMAmmo: public CBasePlayerAmmo
{
DECLARE_CLASS_TYPES(C9MMAmmo, CBasePlayerAmmo);
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};

class CBuckShotAmmo: public CBasePlayerAmmo {
class CBuckShotAmmo: public CBasePlayerAmmo
{
DECLARE_CLASS_TYPES(CBuckShotAmmo, CBasePlayerAmmo);
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};

class C556NatoAmmo: public CBasePlayerAmmo {
class C556NatoAmmo: public CBasePlayerAmmo
{
DECLARE_CLASS_TYPES(C556NatoAmmo, CBasePlayerAmmo);
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};

class C556NatoBoxAmmo: public CBasePlayerAmmo {
class C556NatoBoxAmmo: public CBasePlayerAmmo
{
DECLARE_CLASS_TYPES(C556NatoBoxAmmo, CBasePlayerAmmo);
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};

class C762NatoAmmo: public CBasePlayerAmmo {
class C762NatoAmmo: public CBasePlayerAmmo
{
DECLARE_CLASS_TYPES(C762NatoAmmo, CBasePlayerAmmo);
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};

class C45ACPAmmo: public CBasePlayerAmmo {
class C45ACPAmmo: public CBasePlayerAmmo
{
DECLARE_CLASS_TYPES(C45ACPAmmo, CBasePlayerAmmo);
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};

class C50AEAmmo: public CBasePlayerAmmo {
class C50AEAmmo: public CBasePlayerAmmo
{
DECLARE_CLASS_TYPES(C50AEAmmo, CBasePlayerAmmo);
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};

class C338MagnumAmmo: public CBasePlayerAmmo {
class C338MagnumAmmo: public CBasePlayerAmmo
{
DECLARE_CLASS_TYPES(C338MagnumAmmo, CBasePlayerAmmo);
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};

class C57MMAmmo: public CBasePlayerAmmo {
class C57MMAmmo: public CBasePlayerAmmo
{
DECLARE_CLASS_TYPES(C57MMAmmo, CBasePlayerAmmo);
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual BOOL AddAmmo(CBaseEntity *pOther) = 0;
};

class C357SIGAmmo: public CBasePlayerAmmo {
class C357SIGAmmo: public CBasePlayerAmmo
{
DECLARE_CLASS_TYPES(C357SIGAmmo, CBasePlayerAmmo);
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
Expand Down
4 changes: 3 additions & 1 deletion reapi/include/cssdk/dlls/basemonster.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ enum MONSTERSTATE
};

class CBaseToggle;
class CBaseMonster: public CBaseToggle {
class CBaseMonster: public CBaseToggle
{
DECLARE_CLASS_TYPES(CBaseMonster, CBaseToggle);
public:
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0;
Expand Down
28 changes: 21 additions & 7 deletions reapi/include/cssdk/dlls/bmodels.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@
#define SF_CONVEYOR_NOTSOLID 0x0002

// This is just a solid wall if not inhibited
class CFuncWall: public CBaseEntity {
class CFuncWall: public CBaseEntity
{
DECLARE_CLASS_TYPES(CFuncWall, CBaseEntity);
public:
virtual void Spawn() = 0;

Expand All @@ -68,20 +70,26 @@ class CFuncWall: public CBaseEntity {
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
};

class CFuncWallToggle: public CFuncWall {
class CFuncWallToggle: public CFuncWall
{
DECLARE_CLASS_TYPES(CFuncWallToggle, CFuncWall);
public:
virtual void Spawn() = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
};

class CFuncConveyor: public CFuncWall {
class CFuncConveyor: public CFuncWall
{
DECLARE_CLASS_TYPES(CFuncConveyor, 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 {
class CFuncIllusionary: public CBaseToggle
{
DECLARE_CLASS_TYPES(CFuncIllusionary, CBaseToggle);
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
Expand All @@ -95,15 +103,19 @@ class CFuncIllusionary: public CBaseToggle {
//
// otherwise it will be invisible and not solid. This can be used to keep
// specific monsters out of certain areas
class CFuncMonsterClip: public CFuncWall {
class CFuncMonsterClip: public CFuncWall
{
DECLARE_CLASS_TYPES(CFuncMonsterClip, 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 {
class CFuncRotating: public CBaseEntity
{
DECLARE_CLASS_TYPES(CFuncRotating, CBaseEntity);
public:
// basic functions
virtual void Spawn() = 0;
Expand All @@ -125,7 +137,9 @@ class CFuncRotating: public CBaseEntity {
Vector m_angles;
};

class CPendulum: public CBaseEntity {
class CPendulum: public CBaseEntity
{
DECLARE_CLASS_TYPES(CPendulum, CBaseEntity);
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
Expand Down
20 changes: 15 additions & 5 deletions reapi/include/cssdk/dlls/buttons.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
#define SF_BTARGET_USE 0x0001
#define SF_BTARGET_ON 0x0002

class CEnvGlobal: public CPointEntity {
class CEnvGlobal: public CPointEntity
{
DECLARE_CLASS_TYPES(CEnvGlobal, CPointEntity);
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
Expand All @@ -62,12 +64,16 @@ class CEnvGlobal: public CPointEntity {
int m_initialstate;
};

class CRotButton: public CBaseButton {
class CRotButton: public CBaseButton
{
DECLARE_CLASS_TYPES(CRotButton, CBaseButton);
public:
virtual void Spawn() = 0;
};

class CMomentaryRotButton: public CBaseToggle {
class CMomentaryRotButton: public CBaseToggle
{
DECLARE_CLASS_TYPES(CMomentaryRotButton, CBaseToggle);
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
Expand All @@ -84,7 +90,9 @@ class CMomentaryRotButton: public CBaseToggle {
int m_sounds;
};

class CEnvSpark: public CBaseEntity {
class CEnvSpark: public CBaseEntity
{
DECLARE_CLASS_TYPES(CEnvSpark, CBaseEntity);
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
Expand All @@ -95,7 +103,9 @@ class CEnvSpark: public CBaseEntity {
float m_flDelay;
};

class CButtonTarget: public CBaseEntity {
class CButtonTarget: public CBaseEntity
{
DECLARE_CLASS_TYPES(CButtonTarget, CBaseEntity);
public:
virtual void Spawn() = 0;
virtual int ObjectCaps() = 0;
Expand Down
38 changes: 29 additions & 9 deletions reapi/include/cssdk/dlls/cbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@ class CBasePlayerItem;
class CSquadMonster;
class CCSEntity;

class CBaseEntity {
#define DECLARE_CLASS_TYPES(className, baseClassName)\
public: \
using BaseClass = baseClassName; \
using ThisClass = className; \

class CBaseEntity
{
DECLARE_CLASS_TYPES(CBaseEntity, CBaseEntity);
public:
// Constructor. Set engine to use C/C++ callback functions
// pointers to engine data
Expand Down Expand Up @@ -246,15 +253,18 @@ inline void CBaseEntity::SetBlocked(std::nullptr_t)
m_pfnBlocked = nullptr;
}

class CPointEntity: public CBaseEntity {
class CPointEntity: public CBaseEntity
{
DECLARE_CLASS_TYPES(CPointEntity, CBaseEntity);
public:
virtual void Spawn() = 0;
virtual int ObjectCaps() = 0;
};


// generic Delay entity
class CBaseDelay: public CBaseEntity {
class CBaseDelay: public CBaseEntity
{
DECLARE_CLASS_TYPES(CBaseDelay, CBaseEntity);
public:
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
Expand All @@ -264,7 +274,9 @@ class CBaseDelay: public CBaseEntity {
int m_iszKillTarget;
};

class CBaseAnimating: public CBaseDelay {
class CBaseAnimating: public CBaseDelay
{
DECLARE_CLASS_TYPES(CBaseAnimating, CBaseDelay);
public:
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
Expand Down Expand Up @@ -297,7 +309,9 @@ class EHANDLE {
};

// generic Toggle entity.
class CBaseToggle: public CBaseAnimating {
class CBaseToggle: public CBaseAnimating
{
DECLARE_CLASS_TYPES(CBaseToggle, CBaseAnimating);
public:
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
Expand Down Expand Up @@ -357,7 +371,9 @@ inline void CBaseToggle::SetMoveDone(std::nullptr_t)
#include "player.h"

// Generic Button
class CBaseButton: public CBaseToggle {
class CBaseButton: public CBaseToggle
{
DECLARE_CLASS_TYPES(CBaseButton, CBaseToggle);
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
Expand Down Expand Up @@ -389,7 +405,9 @@ class CBaseButton: public CBaseToggle {
#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 {
class CMultiSource: public CPointEntity
{
DECLARE_CLASS_TYPES(CMultiSource, CPointEntity);
public:
virtual void Spawn() = 0;
virtual void Restart() = 0;
Expand All @@ -412,7 +430,9 @@ class CMultiSource: public CPointEntity {
#define SF_WORLD_FORCETEAM 0x0004 // Force teams

// This spawns first when each level begins.
class CWorld: public CBaseEntity {
class CWorld: public CBaseEntity
{
DECLARE_CLASS_TYPES(CWorld, CBaseEntity);
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
Expand Down
Loading

0 comments on commit 5ab7874

Please sign in to comment.