Initial commit.

* Beginning reconstruction of Source SDK.

Signed-off-by: aixxe <me@aixxe.net>
This commit is contained in:
aixxe 2016-12-19 16:52:02 +00:00
commit 5d3e60ddd3
19 changed files with 568 additions and 0 deletions

View File

@ -0,0 +1,23 @@
#pragma once
class CSaveRestoreData;
class CGlobalVarsBase {
public:
float realtime;
int framecount;
float absoluteframetime;
float curtime;
float frametime;
int maxClients;
int tickcount;
float interval_per_tick;
float interpolation_amount;
int simTicksThisFrame;
int network_protocol;
CSaveRestoreData* pSaveData;
private:
bool m_bClient;
int nTimestampNetworkingBase;
int nTimestampRandomizeWindow;
};

View File

@ -0,0 +1,10 @@
#pragma once
class CUserCmd;
class CInput {
public:
CUserCmd* GetUserCmd(int index) {
return GetVirtualFunction<CUserCmd*(*)(CInput*, int)>(this, 8)(this, index);
}
};

View File

@ -0,0 +1,21 @@
#pragma once
class CUserCmd {
virtual ~CUserCmd() {};
public:
int command_number;
int tick_count;
QAngle viewangles;
float forwardmove;
float sidemove;
float upmove;
int buttons;
unsigned char impulse;
int weaponselect;
int weaponsubtype;
int random_seed;
short mousedx;
short mousedy;
bool hasbeenpredicted;
};

View File

@ -0,0 +1,20 @@
#pragma once
class IClientNetworkable;
class RecvTable;
typedef IClientNetworkable* (*CreateClientClassFn) (int, int);
typedef IClientNetworkable* (*CreateEventFn) (void);
class ClientClass {
public:
CreateClientClassFn m_pCreateFn;
CreateEventFn m_pCreateEventFn;
char* m_pNetworkName;
RecvTable* m_pRecvTable;
ClientClass* m_pNext;
int m_nClassID;
};

View File

@ -0,0 +1,11 @@
#pragma once
typedef void* (*CreateInterfaceFn) (const char*, int*);
typedef void* (*InstantiateInterfaceFn) ();
class InterfaceReg {
public:
InstantiateInterfaceFn m_CreateFn;
const char* m_pName;
InterfaceReg* m_pNext;
};

View File

@ -0,0 +1,67 @@
#pragma once
class RecvTable;
struct CRecvProxyData;
typedef void (*RecvVarProxyFn) (const CRecvProxyData*, void*, void*);
enum SendPropType: int {
DPT_Int = 0,
DPT_Float,
DPT_Vector,
DPT_VectorXY,
DPT_String,
DPT_Array,
DPT_DataTable,
DPT_Int64,
DPT_NUMSendPropTypes
};
class RecvProp {
public:
char* m_pVarName;
SendPropType m_RecvType;
int m_Flags;
int m_StringBufferSize;
bool m_bInsideArray;
const void* m_pExtraData;
RecvProp* m_pArrayProp;
void* m_ArrayLengthProxy;
void* m_ProxyFn;
void* m_DataTableProxyFn;
RecvTable* m_pDataTable;
int m_Offset;
int m_ElementStride;
int m_nElements;
const char* m_pParentArrayPropName;
};
class RecvTable {
public:
RecvProp* m_pProps;
int m_nProps;
void* m_pDecoder;
char* m_pNetTableName;
bool m_bInitialized;
bool m_bInMainList;
};
struct DVariant {
union {
float m_Float;
long m_Int;
char* m_pString;
void* m_pData;
float m_Vector[3];
int64_t m_Int64;
};
int m_Type;
};
struct CRecvProxyData {
const RecvProp* m_pRecvProp;
DVariant m_Value;
int m_iElement;
int m_ObjectID;
};

View File

@ -0,0 +1,28 @@
#pragma once
#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_ALT2 (1 << 15)
#define IN_SCORE (1 << 16)
#define IN_SPEED (1 << 17)
#define IN_WALK (1 << 18)
#define IN_ZOOM (1 << 19)
#define IN_WEAPON1 (1 << 20)
#define IN_WEAPON2 (1 << 21)
#define IN_BULLRUSH (1 << 22)
#define IN_GRENADE1 (1 << 23)
#define IN_GRENADE2 (1 << 24)
#define IN_ATTACK3 (1 << 25)

View File

@ -0,0 +1,33 @@
#pragma once
#define FL_ONGROUND (1 << 0)
#define FL_DUCKING (1 << 1)
#define FL_WATERJUMP (1 << 3)
#define FL_ONTRAIN (1 << 4)
#define FL_INRAIN (1 << 5)
#define FL_FROZEN (1 << 6)
#define FL_ATCONTROLS (1 << 7)
#define FL_CLIENT (1 << 8)
#define FL_FAKECLIENT (1 << 9)
#define FL_INWATER (1 << 10)
#define FL_FLY (1 << 11)
#define FL_SWIM (1 << 12)
#define FL_CONVEYOR (1 << 13)
#define FL_NPC (1 << 14)
#define FL_GODMODE (1 << 15)
#define FL_NOTARGET (1 << 16)
#define FL_AIMTARGET (1 << 17)
#define FL_PARTIALGROUND (1 << 18)
#define FL_STATICPROP (1 << 19)
#define FL_GRAPHED (1 << 20)
#define FL_GRENADE (1 << 21)
#define FL_STEPMOVEMENT (1 << 22)
#define FL_DONTTOUCH (1 << 23)
#define FL_BASEVELOCITY (1 << 24)
#define FL_WORLDBRUSH (1 << 25)
#define FL_OBJECT (1 << 26)
#define FL_KILLME (1 << 27)
#define FL_ONFIRE (1 << 28)
#define FL_DISSOLVING (1 << 29)
#define FL_TRANSRAGDOLL (1 << 30)
#define FL_UNBLOCKABLE_BY_PLAYER (1 << 31)

View File

@ -0,0 +1,29 @@
#pragma once
class ClientClass;
enum ClientFrameStage_t: int {
FRAME_UNDEFINED = -1,
FRAME_START,
FRAME_NET_UPDATE_START,
FRAME_NET_UPDATE_POSTDATAUPDATE_START,
FRAME_NET_UPDATE_POSTDATAUPDATE_END,
FRAME_NET_UPDATE_END,
FRAME_RENDER_START,
FRAME_RENDER_END
};
class IBaseClientDLL {
public:
ClientClass* GetAllClasses() {
return GetVirtualFunction<ClientClass*(*)(IBaseClientDLL*)>(this, 8)(this);
}
void CreateMove(int sequence, float frametime, bool active) {
return GetVirtualFunction<void(*)(IBaseClientDLL*, int, float, bool)>(this, 21)(this, sequence, frametime, active);
}
void FrameStageNotify(ClientFrameStage_t stage) {
return GetVirtualFunction<void(*)(IBaseClientDLL*, ClientFrameStage_t)>(this, 35)(this, stage);
}
};

View File

@ -0,0 +1,19 @@
#pragma once
class CBaseHandle;
class IClientEntity;
class IClientNetworkable;
class IClientUnknown;
class IClientEntityList {
public:
virtual IClientNetworkable* GetClientNetworkable(int entindex) = 0;
virtual IClientNetworkable* GetClientNetworkableFromHandle(CBaseHandle handle) = 0;
virtual IClientUnknown* GetClientUnknownFromHandle(CBaseHandle handle) = 0;
virtual IClientEntity* GetClientEntity(int entindex) = 0;
virtual IClientEntity* GetClientEntityFromHandle(CBaseHandle handle) = 0;
virtual int NumberOfEntities(bool include_non_networkable) = 0;
virtual int GetHighestEntityIndex(void) = 0;
virtual void SetMaxEntities(int max_entities) = 0;
virtual int GetMaxEntities() = 0;
};

View File

@ -0,0 +1,12 @@
#pragma once
class ICvar {
public:
template <typename... Values> void ConsoleColorPrintf(const Color& MsgColor, const char* Format, Values... Parameters) {
return GetVirtualFunction<void(*)(ICvar*, const Color&, const char*, ...)>(this, 23)(this, MsgColor, Format, Parameters...);
}
template <typename... Values> void ConsoleDPrintf(const char* Format, Values... Parameters) {
return GetVirtualFunction<void(*)(ICvar*, const char*, ...)>(this, 24)(this, Format, Parameters...);
}
};

View File

@ -0,0 +1,48 @@
#pragma once
#define EVENT_DEBUG_ID_INIT 42
#define EVENT_DEBUG_ID_SHUTDOWN 13
class bf_read;
class bf_write;
class IGameEvent {
public:
virtual ~IGameEvent() {};
virtual const char* GetName() const = 0;
virtual bool IsReliable() const = 0;
virtual bool IsLocal() const = 0;
virtual bool IsEmpty(const char* key = 0) = 0;
virtual bool GetBool(const char* key = 0, bool default_value = false) = 0;
virtual int GetInt(const char* key = 0, int default_value = 0) = 0;
virtual float GetFloat(const char* key = 0, float default_value = 0.0f) = 0;
virtual const char* GetString(const char* key = 0, const char* default_value = "") = 0;
virtual void SetBool(const char* key, bool value) = 0;
virtual void SetInt(const char* key, int value) = 0;
virtual void SetFloat(const char* key, float value) = 0;
virtual void SetString(const char* key, const char* value) = 0;
};
class IGameEventListener2 {
public:
virtual ~IGameEventListener2() {};
virtual void FireGameEvent(IGameEvent* event) = 0;
virtual int GetEventDebugID(void) = 0;
};
class IGameEventManager2 {
public:
virtual ~IGameEventManager2() {};
virtual int LoadEventsFromFile(const char* filename) = 0;
virtual void Reset() = 0;
virtual bool AddListener(IGameEventListener2* listener, const char* name, bool serverside) = 0;
virtual bool FindListener(IGameEventListener2* listener, const char* name) = 0;
virtual void RemoveListener(IGameEventListener2* listener) = 0;
virtual IGameEvent* CreateEvent(const char* name, bool force = false) = 0;
virtual bool FireEvent(IGameEvent* event, bool dont_broadcast = false) = 0;
virtual bool FireEventClientSide(IGameEvent* event) = 0;
virtual IGameEvent* DuplicateEvent(IGameEvent* event) = 0;
virtual void FreeEvent(IGameEvent* event) = 0;
virtual bool SerializeEvent(IGameEvent* event, bf_write* buf) = 0;
virtual IGameEvent* UnserializeEvent(bf_read* buf) = 0;
};

View File

@ -0,0 +1,36 @@
#pragma once
class CShowPixelsParams;
typedef void* PseudoGLContextPtr;
class ILauncherMgr {
public:
void PumpWindowsMessageLoop() {
return GetVirtualFunction<void(*)(ILauncherMgr*)>(this, 15)(this);
}
PseudoGLContextPtr GetMainContext() {
return GetVirtualFunction<PseudoGLContextPtr(*)(ILauncherMgr*)>(this, 22)(this);
}
PseudoGLContextPtr CreateExtraContext() {
return GetVirtualFunction<PseudoGLContextPtr(*)(ILauncherMgr*)>(this, 24)(this);
}
void DeleteContext(PseudoGLContextPtr context) {
return GetVirtualFunction<void(*)(ILauncherMgr*, PseudoGLContextPtr)>(this, 27)(this, context);
}
bool MakeContextCurrent(PseudoGLContextPtr context) {
return GetVirtualFunction<bool(*)(ILauncherMgr*, PseudoGLContextPtr)>(this, 26)(this, context);
}
void PumpWindowsMessageLoop(CShowPixelsParams* params) {
return GetVirtualFunction<void(*)(ILauncherMgr*, CShowPixelsParams*)>(this, 29)(this, params);
}
void* GetWindowRef() {
return GetVirtualFunction<void*(*)(ILauncherMgr*)>(this, 32)(this);
}
};

View File

@ -0,0 +1,139 @@
#pragma once
#define TEXTURE_GROUP_LIGHTMAP "Lightmaps"
#define TEXTURE_GROUP_WORLD "World textures"
#define TEXTURE_GROUP_MODEL "Model textures"
#define TEXTURE_GROUP_VGUI "VGUI textures"
#define TEXTURE_GROUP_PARTICLE "Particle textures"
#define TEXTURE_GROUP_DECAL "Decal textures"
#define TEXTURE_GROUP_SKYBOX "SkyBox textures"
#define TEXTURE_GROUP_CLIENT_EFFECTS "ClientEffect textures"
#define TEXTURE_GROUP_OTHER "Other textures"
#define TEXTURE_GROUP_PRECACHED "Precached"
#define TEXTURE_GROUP_CUBE_MAP "CubeMap textures"
#define TEXTURE_GROUP_RENDER_TARGET "RenderTargets"
#define TEXTURE_GROUP_RUNTIME_COMPOSITE "Runtime Composite"
#define TEXTURE_GROUP_UNACCOUNTED "Unaccounted textures"
#define TEXTURE_GROUP_STATIC_VERTEX_BUFFER "Static Vertex"
#define TEXTURE_GROUP_STATIC_INDEX_BUFFER "Static Indices"
#define TEXTURE_GROUP_STATIC_VERTEX_BUFFER_DISP "Displacement Verts"
#define TEXTURE_GROUP_STATIC_VERTEX_BUFFER_COLOR "Lighting Verts"
#define TEXTURE_GROUP_STATIC_VERTEX_BUFFER_WORLD "World Verts"
#define TEXTURE_GROUP_STATIC_VERTEX_BUFFER_MODELS "Model Verts"
#define TEXTURE_GROUP_STATIC_VERTEX_BUFFER_OTHER "Other Verts"
#define TEXTURE_GROUP_DYNAMIC_INDEX_BUFFER "Dynamic Indices"
#define TEXTURE_GROUP_DYNAMIC_VERTEX_BUFFER "Dynamic Verts"
#define TEXTURE_GROUP_DEPTH_BUFFER "DepthBuffer"
#define TEXTURE_GROUP_VIEW_MODEL "ViewModel"
#define TEXTURE_GROUP_PIXEL_SHADERS "Pixel Shaders"
#define TEXTURE_GROUP_VERTEX_SHADERS "Vertex Shaders"
#define TEXTURE_GROUP_RENDER_TARGET_SURFACE "RenderTarget Surfaces"
#define TEXTURE_GROUP_MORPH_TARGETS "Morph Targets"
enum MaterialVarFlags_t {
MATERIAL_VAR_DEBUG = (1 << 0),
MATERIAL_VAR_NO_DEBUG_OVERRIDE = (1 << 1),
MATERIAL_VAR_NO_DRAW = (1 << 2),
MATERIAL_VAR_USE_IN_FILLRATE_MODE = (1 << 3),
MATERIAL_VAR_VERTEXCOLOR = (1 << 4),
MATERIAL_VAR_VERTEXALPHA = (1 << 5),
MATERIAL_VAR_SELFILLUM = (1 << 6),
MATERIAL_VAR_ADDITIVE = (1 << 7),
MATERIAL_VAR_ALPHATEST = (1 << 8),
MATERIAL_VAR_MULTIPASS = (1 << 9),
MATERIAL_VAR_ZNEARER = (1 << 10),
MATERIAL_VAR_MODEL = (1 << 11),
MATERIAL_VAR_FLAT = (1 << 12),
MATERIAL_VAR_NOCULL = (1 << 13),
MATERIAL_VAR_NOFOG = (1 << 14),
MATERIAL_VAR_IGNOREZ = (1 << 15),
MATERIAL_VAR_DECAL = (1 << 16),
MATERIAL_VAR_ENVMAPSPHERE = (1 << 17),
MATERIAL_VAR_NOALPHAMOD = (1 << 18),
MATERIAL_VAR_ENVMAPCAMERASPACE = (1 << 19),
MATERIAL_VAR_BASEALPHAENVMAPMASK = (1 << 20),
MATERIAL_VAR_TRANSLUCENT = (1 << 21),
MATERIAL_VAR_NORMALMAPALPHAENVMAPMASK = (1 << 22),
MATERIAL_VAR_NEEDS_SOFTWARE_SKINNING = (1 << 23),
MATERIAL_VAR_OPAQUETEXTURE = (1 << 24),
MATERIAL_VAR_ENVMAPMODE = (1 << 25),
MATERIAL_VAR_SUPPRESS_DECALS = (1 << 26),
MATERIAL_VAR_HALFLAMBERT = (1 << 27),
MATERIAL_VAR_WIREFRAME = (1 << 28),
MATERIAL_VAR_ALLOWALPHATOCOVERAGE = (1 << 29),
MATERIAL_VAR_IGNORE_ALPHA_MODULATION = (1 << 30)
};
typedef unsigned short MaterialHandle_t;
class KeyValues;
class IMaterial {
public:
const char* GetName() {
return GetVirtualFunction<const char*(*)(IMaterial*)>(this, 0)(this);
}
const char* GetTextureGroupName() {
return GetVirtualFunction<const char*(*)(IMaterial*)>(this, 1)(this);
}
void IncrementReferenceCount() {
return GetVirtualFunction<void(*)(IMaterial*)>(this, 12)(this);
}
void DecrementReferenceCount() {
return GetVirtualFunction<void(*)(IMaterial*)>(this, 13)(this);
}
void AlphaModulate(float alpha) {
return GetVirtualFunction<void(*)(IMaterial*, float)>(this, 27)(this, alpha);
}
void ColorModulate(float red, float green, float blue) {
return GetVirtualFunction<void(*)(IMaterial*, float, float, float)>(this, 28)(this, red, green, blue);
}
void SetMaterialVarFlag(MaterialVarFlags_t flags, bool state) {
return GetVirtualFunction<void(*)(IMaterial*, MaterialVarFlags_t, bool)>(this, 29)(this, flags, state);
}
bool GetMaterialVarFlag(MaterialVarFlags_t flags) {
return GetVirtualFunction<bool(*)(IMaterial*, MaterialVarFlags_t)>(this, 30)(this, flags);
}
bool IsErrorMaterial() {
return GetVirtualFunction<bool(*)(IMaterial*)>(this, 42)(this);
}
};
class IMaterialSystem {
public:
IMaterial* CreateMaterial(const char* name, KeyValues* keyvalues) {
return GetVirtualFunction<IMaterial*(*)(IMaterialSystem*, const char*, KeyValues*)>(this, 70)(this, name, keyvalues);
}
IMaterial* FindMaterial(char const* name, const char* group, bool complain = true, const char* complain_prefix = NULL) {
return GetVirtualFunction<IMaterial*(*)(IMaterialSystem*, const char*, const char*, bool, const char*)>(this, 71)(this, name, group, complain, complain_prefix);
}
bool IsMaterialLoaded(char const* name) {
return GetVirtualFunction<bool(*)(IMaterialSystem*, const char*)>(this, 72)(this, name);
}
MaterialHandle_t FirstMaterial() {
return GetVirtualFunction<MaterialHandle_t(*)(IMaterialSystem*)>(this, 73)(this);
}
MaterialHandle_t NextMaterial(MaterialHandle_t material) {
return GetVirtualFunction<MaterialHandle_t(*)(IMaterialSystem*, MaterialHandle_t)>(this, 74)(this, material);
}
MaterialHandle_t InvalidMaterial() {
return GetVirtualFunction<MaterialHandle_t(*)(IMaterialSystem*)>(this, 75)(this);
}
IMaterial* GetMaterial(MaterialHandle_t material) {
return GetVirtualFunction<IMaterial*(*)(IMaterialSystem*, MaterialHandle_t)>(this, 76)(this, material);
}
};

View File

@ -0,0 +1,14 @@
#pragma once
typedef unsigned long VPANEL;
class IPanel {
public:
const char* GetName(VPANEL vpanel) {
return GetVirtualFunction<const char*(*)(IPanel*, VPANEL)>(this, 37)(this, vpanel);
}
void PaintTraverse(VPANEL vpanel, bool force_repaint, bool allow_force) {
GetVirtualFunction<void(*)(IPanel*, VPANEL, bool, bool)>(this, 37)(this, vpanel, force_repaint, allow_force);
}
};

View File

@ -0,0 +1,10 @@
#pragma once
class model_t;
class IVModelInfoClient {
public:
const char* GetModelName(const model_t* model) {
return GetVirtualFunction<const char*(*)(IVModelInfoClient*, const model_t*)>(this, 4)(this, model);
}
};

View File

@ -0,0 +1,12 @@
#pragma once
struct Color {
Color(int r, int g, int b, int a = 255) {
value[0] = static_cast<unsigned char>(r);
value[1] = static_cast<unsigned char>(g);
value[2] = static_cast<unsigned char>(b);
value[3] = static_cast<unsigned char>(a);
}
unsigned char value[4];
};

View File

@ -0,0 +1,23 @@
#pragma once
typedef float VMatrix[4][4];
class matrix3x4_t {
public:
matrix3x4_t() {};
matrix3x4_t(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23) {
m_flMatVal[0][0] = m00; m_flMatVal[0][1] = m01; m_flMatVal[0][2] = m02; m_flMatVal[0][3] = m03;
m_flMatVal[1][0] = m10; m_flMatVal[1][1] = m11; m_flMatVal[1][2] = m12; m_flMatVal[1][3] = m13;
m_flMatVal[2][0] = m20; m_flMatVal[2][1] = m21; m_flMatVal[2][2] = m22; m_flMatVal[2][3] = m23;
};
float* operator[](int i) {
return m_flMatVal[i];
}
const float* operator[](int i) const {
return m_flMatVal[i];
}
float m_flMatVal[3][4];
};

View File

@ -0,0 +1,13 @@
#pragma once
inline void**& GetVirtualTable(void* baseclass) {
return *reinterpret_cast<void***>(baseclass);
}
inline void* GetVirtualFunction(void* vftable, size_t index) {
return reinterpret_cast<void*>(GetVirtualTable(vftable)[index]);
}
template <typename Fn> inline Fn GetVirtualFunction(void* vftable, size_t index) {
return reinterpret_cast<Fn>(GetVirtualTable(vftable)[index]);
}