-
Notifications
You must be signed in to change notification settings - Fork 5
/
MiscDefinitions.h
382 lines (331 loc) · 11.5 KB
/
MiscDefinitions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
#pragma once
#include "CommonIncludes.h"
#include "NetVars.h"
#include "Vector.h"
//-------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------
typedef unsigned int VPANEL;
typedef void(*pfnDemoCustomDataCallback)(unsigned char *pData, size_t iSize);
// For calling VMT functions in our classes
template< typename Function > Function call_vfunc(PVOID Base, DWORD Index)
{
PDWORD* VTablePointer = (PDWORD*)Base;
PDWORD VTableFunctionBase = *VTablePointer;
DWORD dwAddress = VTableFunctionBase[Index];
return (Function)(dwAddress);
}
inline void**& getvtable(void* inst, size_t offset = 0)
{
return *reinterpret_cast<void***>((size_t)inst + offset);
}
inline const void** getvtable(const void* inst, size_t offset = 0)
{
if (!inst && !offset)
return NULL;
return *reinterpret_cast<const void***>((size_t)inst + offset);
}
template< typename Fn >
inline Fn getvfunc(const void* inst, size_t index, size_t offset = 0)
{
if (!inst && offset == 0)
return NULL;
return reinterpret_cast<Fn>(getvtable(inst, offset)[index]);
}
// Netvar shit
#define dwThis (DWORD)this
#define NETVAR(type,offset) *(type*)(dwThis + offset)
#define CNETVAR(type,offset) (type)(dwThis + offset)
#define nigvar( x, x1, x2 ) *(x*)( (DWORD)x1 + (DWORD)x2 )
//CNETVAR_FUNC - creates a netvar function in a class that returns value(s) [type=class type & return type] [name=function name] [netvar_crc=crc32 of netvar of choice]
#define CNETVAR_FUNC(type,name,netvar_crc) \
type name() \
{ \
static DWORD dwObserverTarget=NetVar.GetNetVar(netvar_crc); \
return NETVAR(type,dwObserverTarget); \
}
//CPNETVAR_FUNC - creates a netvar function in a class that returns a pointer [type=class type & return type] [name=function name] [netvar_crc=crc32 of netvar of choice]
#define CPNETVAR_FUNC(type,name,netvar_crc) \
type name() \
{ \
static DWORD dwObserverTarget=NetVar.GetNetVar(netvar_crc); \
return CNETVAR(type,dwObserverTarget); \
}
enum
{
PITCH = 0, // up / down
YAW, // left / right
ROLL // fall over
};
// Lifestates
enum source_lifestates
{
LIFE_ALIVE,
LIFE_DYING,
LIFE_DEAD,
LIFE_RESPAWNABLE,
LIFE_DISCARDBODY,
};
// Player Controls for CS:GO
enum playercontrols
{
IN_ATTACK = (1 << 0),
IN_JUMP = (1 << 1),
IN_DUCK = (1 << 2),
IN_FORWARD = (1 << 3),
IN_BACK = (1 << 4),
IN_USE = (1 << 5),
IN_CANCEL = (1 << 6),
IN_LEFT = (1 << 7),
IN_RIGHT = (1 << 8),
IN_MOVELEFT = (1 << 9),
IN_MOVERIGHT = (1 << 10),
IN_ATTACK2 = (1 << 11),
IN_RUN = (1 << 12),
IN_RELOAD = (1 << 13),
IN_ALT1 = (1 << 14),
IN_ALT2 = (1 << 15),
IN_SCORE = (1 << 16), // Used by client.dll for when scoreboard is held down
IN_SPEED = (1 << 17), // Player is holding the speed key
IN_WALK = (1 << 18), // Player holding walk key
IN_ZOOM = (1 << 19), // Zoom key for HUD zoom
IN_WEAPON1 = (1 << 20), // weapon defines these bits
IN_WEAPON2 = (1 << 21), // weapon defines these bits
IN_BULLRUSH = (1 << 22),
};
typedef float matrix3x4[3][4];
struct matrix3x4_t
{
float m_flMatVal[3][4];
};
typedef struct player_info_s {
private:
DWORD __pad0[2];
public:
int m_nXuidLow;
int m_nXuidHigh;
char name[128];
int m_nUserID;
char m_szSteamID[33];
UINT m_nSteam3ID;
char m_szFriendsName[128];
bool m_bIsFakePlayer;
bool m_bIsHLTV;
DWORD m_dwCustomFiles[4];
BYTE m_FilesDownloaded;
private:
int __pad1;
} player_info_t;
typedef void* (*CreateInterfaceFn)(const char* szInterface, int* pReturnCode);
enum class FontFeature
{
FONT_FEATURE_ANTIALIASED_FONTS = 1,
FONT_FEATURE_DROPSHADOW_FONTS = 2,
FONT_FEATURE_OUTLINE_FONTS = 6,
};
enum class FontDrawType
{
FONT_DRAW_DEFAULT = 0,
FONT_DRAW_NONADDITIVE,
FONT_DRAW_ADDITIVE,
FONT_DRAW_TYPE_COUNT = 2,
};
enum SolidType_t
{
SOLID_NONE = 0, // no solid model
SOLID_BSP = 1, // a BSP tree
SOLID_BBOX = 2, // an AABB
SOLID_OBB = 3, // an OBB (not implemented yet)
SOLID_OBB_YAW = 4, // an OBB, constrained so that it can only yaw
SOLID_CUSTOM = 5, // Always call into the entity for tests
SOLID_VPHYSICS = 6, // solid vphysics object, get vcollide from the model and collide with that
SOLID_LAST,
};
enum SolidFlags_t
{
FSOLID_CUSTOMRAYTEST = 0x0001, // Ignore solid type + always call into the entity for ray tests
FSOLID_CUSTOMBOXTEST = 0x0002, // Ignore solid type + always call into the entity for swept box tests
FSOLID_NOT_SOLID = 0x0004, // Are we currently not solid?
FSOLID_TRIGGER = 0x0008, // This is something may be collideable but fires touch functions
// even when it's not collideable (when the FSOLID_NOT_SOLID flag is set)
FSOLID_NOT_STANDABLE = 0x0010, // You can't stand on this
FSOLID_VOLUME_CONTENTS = 0x0020, // Contains volumetric contents (like water)
FSOLID_FORCE_WORLD_ALIGNED = 0x0040, // Forces the collision rep to be world-aligned even if it's SOLID_BSP or SOLID_VPHYSICS
FSOLID_USE_TRIGGER_BOUNDS = 0x0080, // Uses a special trigger bounds separate from the normal OBB
FSOLID_ROOT_PARENT_ALIGNED = 0x0100, // Collisions are defined in root parent's local coordinate space
FSOLID_TRIGGER_TOUCH_DEBRIS = 0x0200, // This trigger will touch debris objects
FSOLID_MAX_BITS = 10
};
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),
MATERIAL_VAR_VERTEXFOG = (1 << 31),
// NOTE: Only add flags here that either should be read from
// .vmts or can be set directly from client code. Other, internal
// flags should to into the flag enum in imaterialinternal.h
};
enum PreviewImageRetVal_t
{
MATERIAL_PREVIEW_IMAGE_BAD = 0,
MATERIAL_PREVIEW_IMAGE_OK,
MATERIAL_NO_PREVIEW_IMAGE,
};
enum MaterialPropertyTypes_t
{
MATERIAL_PROPERTY_NEEDS_LIGHTMAP = 0, // bool
MATERIAL_PROPERTY_OPACITY, // int (enum MaterialPropertyOpacityTypes_t)
MATERIAL_PROPERTY_REFLECTIVITY, // vec3_t
MATERIAL_PROPERTY_NEEDS_BUMPED_LIGHTMAPS // bool
};
// KeyValues
class KeyValues
{
public:
char _pad[0x20];//csgo, for css its a diff size
};
typedef unsigned short ModelInstanceHandle_t;
// Memes
struct ModelRenderInfo_t
{
Vector origin;
Vector angles;
void *pRenderable;
const void *pModel;
const matrix3x4 *pModelToWorld;
const matrix3x4 *pLightingOffset;
const Vector *pLightingOrigin;
int flags;
int entity_index;
int skin;
int body;
int hitboxset;
unsigned short instance;
ModelRenderInfo_t()
{
pModelToWorld = NULL;
pLightingOffset = NULL;
pLightingOrigin = NULL;
}
};
typedef float vec_t;
inline unsigned long& FloatBits(vec_t& f)
{
return *reinterpret_cast<unsigned long*>(&f);
}
inline bool IsFinite(vec_t f)
{
return ((FloatBits(f) & 0x7F800000) != 0x7F800000);
}
class model_t;
class IMatRenderContext;
enum OverrideType_t
{
OVERRIDE_NORMAL = 0,
OVERRIDE_BUILD_SHADOWS,
OVERRIDE_DEPTH_WRITE,
};
#define FL_ONGROUND (1<<0) // At rest / on the ground
#define FL_DUCKING (1<<1) // Player flag -- Player is fully crouched
#define FL_WATERJUMP (1<<2) // player jumping out of water
#define FL_ONTRAIN (1<<3) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction.
#define FL_INRAIN (1<<4) // Indicates the entity is standing in rain
#define FL_FROZEN (1<<5) // Player is frozen for 3rd person camera
#define FL_ATCONTROLS (1<<6) // Player can't move, but keeps key inputs for controlling another entity
#define FL_CLIENT (1<<7) // Is a player
#define FL_FAKECLIENT (1<<8) // Fake client, simulated server side; don't send network messages to them
// NON-PLAYER SPECIFIC (i.e., not used by GameMovement or the client .dll ) -- Can still be applied to players, though
#define FL_INWATER (1<<9) // In water
// NOTE if you move things up, make sure to change this value
#define PLAYER_FLAG_BITS 10
#define FL_FLY (1<<10) // Changes the SV_Movestep() behavior to not need to be on ground
#define FL_SWIM (1<<11) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water)
#define FL_CONVEYOR (1<<12)
#define FL_NPC (1<<13)
#define FL_GODMODE (1<<14)
#define FL_NOTARGET (1<<15)
#define FL_AIMTARGET (1<<16) // set if the crosshair needs to aim onto the entity
#define FL_PARTIALGROUND (1<<17) // not all corners are valid
#define FL_STATICPROP (1<<18) // Eetsa static prop!
#define FL_GRAPHED (1<<19) // worldgraph has this ent listed as something that blocks a connection
#define FL_GRENADE (1<<20)
#define FL_STEPMOVEMENT (1<<21) // Changes the SV_Movestep() behavior to not do any processing
#define FL_DONTTOUCH (1<<22) // Doesn't generate touch functions, generates Untouch() for anything it was touching when this flag was set
#define FL_BASEVELOCITY (1<<23) // Base velocity has been applied this frame (used to convert base velocity into momentum)
#define FL_WORLDBRUSH (1<<24) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something)
#define FL_OBJECT (1<<25) // Terrible name. This is an object that NPCs should see. Missiles, for example.
#define FL_KILLME (1<<26) // This entity is marked for death -- will be freed by game DLL
#define FL_ONFIRE (1<<27) // You know...
#define FL_DISSOLVING (1<<28) // We're dissolving!
#define FL_TRANSRAGDOLL (1<<29) // In the process of turning into a client side ragdoll.
#define FL_UNBLOCKABLE_BY_PLAYER (1<<30) // pusher that can't be blocked by the player
enum ClientFrameStage_t
{
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 ICollideable
{
public:
virtual void pad0();
virtual const Vector& OBBMins() const;
virtual const Vector& OBBMaxs() const;
};
#define FCVAR_NONE 0
#define FCVAR_UNREGISTERED (1<<0)
#define FCVAR_DEVELOPMENTONLY (1<<1)
#define FCVAR_GAMEDLL (1<<2)
#define FCVAR_CLIENTDLL (1<<3)
#define FCVAR_HIDDEN (1<<4)
#define FCVAR_PROTECTED (1<<5)
#define FCVAR_SPONLY (1<<6)
#define FCVAR_ARCHIVE (1<<7)
#define FCVAR_NOTIFY (1<<8)
#define FCVAR_USERINFO (1<<9)
#define FCVAR_CHEAT (1<<14)
#define FCVAR_PRINTABLEONLY (1<<10)
#define FCVAR_UNLOGGED (1<<11)
#define FCVAR_NEVER_AS_STRING (1<<12)
#define FCVAR_RELEASE (1<<19)
#define FCVAR_REPLICATED (1<<13)
#define FCVAR_DEMO (1<<16)
#define FCVAR_DONTRECORD (1<<17)
#define FCVAR_NOT_CONNECTED (1<<22)
#define FCVAR_ARCHIVE_XBOX (1<<24)
#define FCVAR_SERVER_CAN_EXECUTE (1<<28)
#define FCVAR_SERVER_CANNOT_QUERY (1<<29)
#define FCVAR_CLIENTCMD_CAN_EXECUTE (1<<30)