Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -0,0 +1,149 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $Workfile: $
// $Date: $
// $NoKeywords: $
//=============================================================================//

#ifndef BSPFLAGS_H
#define BSPFLAGS_H

#ifdef _WIN32
#pragma once
#endif

// contents flags are seperate bits
// a given brush can contribute multiple content bits
// multiple brushes can be in a single leaf

// these definitions also need to be in q_shared.h!

// lower bits are stronger, and will eat weaker brushes completely
#define CONTENTS_EMPTY 0 // No contents

#define CONTENTS_SOLID 0x1 // an eye is never valid in a solid
#define CONTENTS_WINDOW 0x2 // translucent, but not watery (glass)
#define CONTENTS_AUX 0x4
#define CONTENTS_GRATE 0x8 // alpha-tested "grate" textures. Bullets/sight pass through, but solids don't
#define CONTENTS_SLIME 0x10
#define CONTENTS_WATER 0x20
#define CONTENTS_BLOCKLOS 0x40 // block AI line of sight
#define CONTENTS_OPAQUE 0x80 // things that cannot be seen through (may be non-solid though)
//#define LAST_VISIBLE_CONTENTS 0x80

#define ALL_VISIBLE_CONTENTS (LAST_VISIBLE_CONTENTS | (LAST_VISIBLE_CONTENTS-1))

#define CONTENTS_TESTFOGVOLUME 0x100
#define CONTENTS_UNUSED 0x200

// unused
// NOTE: If it's visible, grab from the top + update LAST_VISIBLE_CONTENTS
// if not visible, then grab from the bottom.
#define CONTENTS_UNUSED6 0x400

#define CONTENTS_TEAM1 0x800 // per team contents used to differentiate collisions
#define CONTENTS_TEAM2 0x1000 // between players and objects on different teams

// ignore CONTENTS_OPAQUE on surfaces that have SURF_NODRAW
#define CONTENTS_IGNORE_NODRAW_OPAQUE 0x2000

// hits entities which are MOVETYPE_PUSH (doors, plats, etc.)
#define CONTENTS_MOVEABLE 0x4000

// remaining contents are non-visible, and don't eat brushes
#define CONTENTS_AREAPORTAL 0x8000

#define CONTENTS_PLAYERCLIP 0x10000
#define CONTENTS_MONSTERCLIP 0x20000

// currents can be added to any other contents, and may be mixed
#define CONTENTS_CURRENT_0 0x40000
#define CONTENTS_CURRENT_90 0x80000
#define CONTENTS_CURRENT_180 0x100000
#define CONTENTS_CURRENT_270 0x200000
#define CONTENTS_CURRENT_UP 0x400000
#define CONTENTS_CURRENT_DOWN 0x800000

#define CONTENTS_ORIGIN 0x1000000 // removed before bsping an entity

#define CONTENTS_MONSTER 0x2000000 // should never be on a brush, only in game
#define CONTENTS_DEBRIS 0x4000000
#define CONTENTS_DETAIL 0x8000000 // brushes to be added after vis leafs
#define CONTENTS_TRANSLUCENT 0x10000000 // auto set if any surface has trans
#define CONTENTS_LADDER 0x20000000
#define CONTENTS_HITBOX 0x40000000 // use accurate hitboxes on trace


// NOTE: These are stored in a short in the engine now. Don't use more than 16 bits
#define SURF_LIGHT 0x0001 // value will hold the light strength
#define SURF_SKY2D 0x0002 // don't draw, indicates we should skylight + draw 2d sky but not draw the 3D skybox
#define SURF_SKY 0x0004 // don't draw, but add to skybox
#define SURF_WARP 0x0008 // turbulent water warp
#define SURF_TRANS 0x0010
#define SURF_NOPORTAL 0x0020 // the surface can not have a portal placed on it
#define SURF_TRIGGER 0x0040 // FIXME: This is an xbox hack to work around elimination of trigger surfaces, which breaks occluders
#define SURF_NODRAW 0x0080 // don't bother referencing the texture

#define SURF_HINT 0x0100 // make a primary bsp splitter

#define SURF_SKIP 0x0200 // completely ignore, allowing non-closed brushes
#define SURF_NOLIGHT 0x0400 // Don't calculate light
#define SURF_BUMPLIGHT 0x0800 // calculate three lightmaps for the surface for bumpmapping
#define SURF_NOSHADOWS 0x1000 // Don't receive shadows
#define SURF_NODECALS 0x2000 // Don't receive decals
#define SURF_NOCHOP 0x4000 // Don't subdivide patches on this surface
#define SURF_HITBOX 0x8000 // surface is part of a hitbox



// -----------------------------------------------------
// spatial content masks - used for spatial queries (traceline,etc.)
// -----------------------------------------------------
#define MASK_ALL (0xFFFFFFFF)
// everything that is normally solid
#define MASK_SOLID (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_MONSTER|CONTENTS_GRATE)
// everything that blocks player movement
#define MASK_PLAYERSOLID (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER|CONTENTS_GRATE)
// blocks npc movement
#define MASK_NPCSOLID (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER|CONTENTS_GRATE)
// water physics in these contents
#define MASK_WATER (CONTENTS_WATER|CONTENTS_MOVEABLE|CONTENTS_SLIME)
// everything that blocks lighting
#define MASK_OPAQUE (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_OPAQUE)
// everything that blocks lighting, but with monsters added.
#define MASK_OPAQUE_AND_NPCS (MASK_OPAQUE|CONTENTS_MONSTER)
// everything that blocks line of sight for AI
#define MASK_BLOCKLOS (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_BLOCKLOS)
// everything that blocks line of sight for AI plus NPCs
#define MASK_BLOCKLOS_AND_NPCS (MASK_BLOCKLOS|CONTENTS_MONSTER)
// everything that blocks line of sight for players
#define MASK_VISIBLE (MASK_OPAQUE|CONTENTS_IGNORE_NODRAW_OPAQUE)
// everything that blocks line of sight for players, but with monsters added.
#define MASK_VISIBLE_AND_NPCS (MASK_OPAQUE_AND_NPCS|CONTENTS_IGNORE_NODRAW_OPAQUE)
// bullets see these as solid
#define MASK_SHOT (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_HITBOX)
// non-raycasted weapons see this as solid (includes grates)
#define MASK_SHOT_HULL (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_GRATE)
// hits solids (not grates) and passes through everything else
#define MASK_SHOT_PORTAL (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_MONSTER)
// everything normally solid, except monsters (world+brush only)
#define MASK_SOLID_BRUSHONLY (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_GRATE)
// everything normally solid for player movement, except monsters (world+brush only)
#define MASK_PLAYERSOLID_BRUSHONLY (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_PLAYERCLIP|CONTENTS_GRATE)
// everything normally solid for npc movement, except monsters (world+brush only)
#define MASK_NPCSOLID_BRUSHONLY (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_MONSTERCLIP|CONTENTS_GRATE)
// just the world, used for route rebuilding
#define MASK_NPCWORLDSTATIC (CONTENTS_SOLID|CONTENTS_WINDOW|CONTENTS_MONSTERCLIP|CONTENTS_GRATE)
// These are things that can split areaportals
#define MASK_SPLITAREAPORTAL (CONTENTS_WATER|CONTENTS_SLIME)

// UNDONE: This is untested, any moving water
#define MASK_CURRENT (CONTENTS_CURRENT_0|CONTENTS_CURRENT_90|CONTENTS_CURRENT_180|CONTENTS_CURRENT_270|CONTENTS_CURRENT_UP|CONTENTS_CURRENT_DOWN)

// everything that blocks corpse movement
// UNDONE: Not used yet / may be deleted
#define MASK_DEADSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW|CONTENTS_GRATE)

#endif // BSPFLAGS_H

Large diffs are not rendered by default.

@@ -0,0 +1,33 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Generic MD5 hashing algo
//
//=============================================================================//

#ifndef CHECKSUM_MD5_H
#define CHECKSUM_MD5_H

#ifdef _WIN32
#pragma once
#endif

// 16 bytes == 128 bit digest
#define MD5_DIGEST_LENGTH 16

// MD5 Hash
typedef struct
{
unsigned int buf[4];
unsigned int bits[2];
unsigned char in[64];
} MD5Context_t;

void MD5Init(MD5Context_t *context);
void MD5Update(MD5Context_t *context, unsigned char const *buf, unsigned int len);
void MD5Final(unsigned char digest[MD5_DIGEST_LENGTH], MD5Context_t *context);

char *MD5_Print(unsigned char *digest, int hashlen);

unsigned int MD5_PseudoRandom(unsigned int nSeed);

#endif // CHECKSUM_MD5_H
@@ -0,0 +1,9 @@
class CClient
{
public:
ClientClass* GetAllClasses()
{
typedef ClientClass* (__thiscall* OriginalFn)(PVOID); //Anything inside a VTable is a __thiscall unless it completly disregards the thisptr. You can also call them as __stdcalls, but you won't have access to the __thisptr.
return CallVFunction<OriginalFn>(this, 8)(this); //Return the pointer to the head CClientClass.
}
};
@@ -0,0 +1,190 @@
class CClientEntityList
{
public:

CBaseEntity* GetClientEntity( int Index )
{
typedef CBaseEntity*(__thiscall* Fn)(void*, int);
return CallVFunction<Fn>(this, 3)(this, Index);
}

int GetHighestEntityIndex()
{
typedef int(__thiscall* Fn)(void*);
return CallVFunction<Fn>(this, 8)(this);
}

CBaseEntity* GetClientEntityFromHandle( HANDLE Handle )
{
typedef CBaseEntity*(__thiscall* Fn)(void*,HANDLE);
return CallVFunction<Fn>(this, 7)(this, Handle);
}
CBaseEntity * GetClientEntityFromHandle(ULONG hEnt)
{
typedef CBaseEntity*(__thiscall* Fn)(void*, ULONG);
return CallVFunction<Fn>(this, 4)(this, hEnt);
}
CBaseEntity * GetClientEntityFromHandle_D(DWORD hEnt)
{
typedef CBaseEntity*(__thiscall* Fn)(void*, int);
return CallVFunction<Fn>(this, 4)(this, hEnt);
}

};

#define TE_BEAMPOINTS 0 // beam effect between two points

class C_Beam;
class Beam_t;

struct BeamInfo_t
{
int m_nType;

// Entities
CBaseEntity* m_pStartEnt;
int m_nStartAttachment;
CBaseEntity* m_pEndEnt;
int m_nEndAttachment;

// Points
Vector m_vecStart;
Vector m_vecEnd;

int m_nModelIndex;
const char *m_pszModelName;

int m_nHaloIndex;
const char *m_pszHaloName;
float m_flHaloScale;

float m_flLife;
float m_flWidth;
float m_flEndWidth;
float m_flFadeLength;
float m_flAmplitude;

float m_flBrightness;
float m_flSpeed;

int m_nStartFrame;
float m_flFrameRate;

float m_flRed;
float m_flGreen;
float m_flBlue;

bool m_bRenderable;

int m_nSegments;

int m_nFlags;

// Rings
Vector m_vecCenter;
float m_flStartRadius;
float m_flEndRadius;

BeamInfo_t()
{
m_nType = TE_BEAMPOINTS;
m_nSegments = -1;
m_pszModelName = NULL;
m_pszHaloName = NULL;
m_nModelIndex = -1;
m_nHaloIndex = -1;
m_bRenderable = true;
m_nFlags = 0;
}
};

class ITraceFilter;
class ITexture;

class IViewRenderBeams
{
public:
// Construction
public:
IViewRenderBeams(void);
virtual ~IViewRenderBeams(void);

// Implement IViewRenderBeams
public:
virtual void InitBeams(void);
virtual void ShutdownBeams(void);
virtual void ClearBeams(void);

// Updates the state of the temp ent beams
virtual void UpdateTempEntBeams();

virtual void DrawBeam(Beam_t *pbeam);
virtual void DrawBeam(C_Beam* pbeam, ITraceFilter *pEntityBeamTraceFilter = NULL);

virtual void KillDeadBeams(CBaseEntity *pDeadEntity);

virtual void CreateBeamEnts(int startEnt, int endEnt, int modelIndex, int haloIndex, float haloScale,
float life, float width, float endWidth, float fadeLength, float amplitude,
float brightness, float speed, int startFrame,
float framerate, float r, float g, float b, int type = -1);
virtual Beam_t *CreateBeamEnts(BeamInfo_t &beamInfo);

virtual void CreateBeamEntPoint(int nStartEntity, const Vector *pStart, int nEndEntity, const Vector* pEnd,
int modelIndex, int haloIndex, float haloScale,
float life, float width, float endWidth, float fadeLength, float amplitude,
float brightness, float speed, int startFrame,
float framerate, float r, float g, float b);
virtual Beam_t *CreateBeamEntPoint(BeamInfo_t &beamInfo);

virtual void CreateBeamPoints(Vector& start, Vector& end, int modelIndex, int haloIndex, float haloScale,
float life, float width, float endWidth, float fadeLength, float amplitude,
float brightness, float speed, int startFrame,
float framerate, float r, float g, float b);
virtual Beam_t *CreateBeamPoints(BeamInfo_t &beamInfo);

virtual void CreateBeamRing(int startEnt, int endEnt, int modelIndex, int haloIndex, float haloScale,
float life, float width, float endWidth, float fadeLength, float amplitude,
float brightness, float speed, int startFrame,
float framerate, float r, float g, float b, int flags);
virtual Beam_t *CreateBeamRing(BeamInfo_t &beamInfo);

virtual void CreateBeamRingPoint(const Vector& center, float start_radius, float end_radius, int modelIndex, int haloIndex, float haloScale,
float life, float width, float m_nEndWidth, float m_nFadeLength, float amplitude,
float brightness, float speed, int startFrame,
float framerate, float r, float g, float b, int flags);
virtual Beam_t *CreateBeamRingPoint(BeamInfo_t &beamInfo);

virtual void CreateBeamCirclePoints(int type, Vector& start, Vector& end,
int modelIndex, int haloIndex, float haloScale, float life, float width,
float endWidth, float fadeLength, float amplitude, float brightness, float speed,
int startFrame, float framerate, float r, float g, float b);
virtual Beam_t *CreateBeamCirclePoints(BeamInfo_t &beamInfo);

virtual void CreateBeamFollow(int startEnt, int modelIndex, int haloIndex, float haloScale,
float life, float width, float endWidth, float fadeLength, float r, float g, float b,
float brightness);
virtual Beam_t *CreateBeamFollow(BeamInfo_t &beamInfo);
/*virtual void InitBeams(void) = 0;
virtual void ShutdownBeams(void) = 0;
virtual void ClearBeams(void) = 0;
// Updates the state of the temp ent beams
virtual void UpdateTempEntBeams() = 0;
virtual void DrawBeam(C_Beam* pbeam, ITraceFilter *pEntityBeamTraceFilter = NULL) = 0;
virtual void DrawBeam(Beam_t *pbeam) = 0;
virtual void KillDeadBeams(IClientEntity* pEnt) = 0;
// New interfaces!
virtual Beam_t *CreateBeamEnts(BeamInfo_t &beamInfo) = 0;
virtual Beam_t *CreateBeamEntPoint(BeamInfo_t &beamInfo) = 0;
virtual Beam_t *CreateBeamPoints(BeamInfo_t &beamInfo) = 0;
virtual Beam_t *CreateBeamRing(BeamInfo_t &beamInfo) = 0;
virtual Beam_t *CreateBeamRingPoint(BeamInfo_t &beamInfo) = 0;
virtual Beam_t *CreateBeamCirclePoints(BeamInfo_t &beamInfo) = 0;
virtual Beam_t *CreateBeamFollow(BeamInfo_t &beamInfo) = 0;
virtual void FreeBeam(Beam_t *pBeam) = 0;
virtual void UpdateBeamInfo(Beam_t *pBeam, BeamInfo_t &beamInfo) = 0;*/
};
@@ -0,0 +1,2 @@
#pragma once
class CClientModeShared{};
@@ -0,0 +1,82 @@
#pragma once

struct RecvProp;

class DVariant
{
public:
union
{
float m_Float;
long m_Int;
char *m_pString;
void *m_pData;
Vector m_Vector;
//float m_Vector[3];
};
};

class CRecvProxyData
{
public:
const RecvProp *m_pRecvProp;
char _pad[4];//csgo ( for l4d keep it commented out :) )
DVariant m_Value;
int m_iElement;
int m_ObjectID;
};

typedef void(*RecvVarProxyFn)(const CRecvProxyData *pData, void *pStruct, void *pOut);

/*struct RecvTable
{
RecvProp *m_pProps;
int m_nProps;
void *m_pDecoder;
char *m_pNetTableName;
bool m_bInitialized;
bool m_bInMainList;
};*/
struct RecvTable
{
RecvProp *m_pProps;
int m_nProps;
void *m_pDecoder;
char *m_pNetTableName;
bool m_bInitialized;
bool m_bInMainList;
};

struct RecvProp
{
char *m_pVarName;
int 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;
};

/*HAVE TO PLACE IT HERE*/
class ClientClass
{
typedef IClientNetworkable* (*CreateClientClassFn)(int entnum, int serialNum);
typedef IClientNetworkable* (*CreateEventFn)();

public:
CreateClientClassFn m_pCreateFn;
CreateEventFn m_pCreateEventFn;
char *m_pNetworkName;
RecvTable *m_pRecvTable;
ClientClass *m_pNext;
int m_ClassID;
};
@@ -0,0 +1,140 @@
#pragma once
typedef void(*FnChangeCallbackV1_t)(void);
typedef void(*FnChangeCallback_t)(void* var, const char *pOldValue, float flOldValue);

struct CVValue_t
{
char* m_pszString;
int m_StringLength;

// Values
float m_fValue;
int m_nValue;
};

class ConVar
{
public:
const char* GetString()
{
typedef const char*(__thiscall* GetString_t)(void*);
return CallVFunction<GetString_t>(this, 11)(this);
}

float GetFloat()
{
typedef float(__thiscall* GetFloat_t)(void*);
return CallVFunction <GetFloat_t>(this, 12)(this);
}

int GetInt()
{
typedef int(__thiscall* GetInt_t)(void*);
return CallVFunction <GetInt_t>(this, 13)(this);
}

void SetValue(const char *value)
{
typedef void(__thiscall* SetValue_t)(void*, const char*);
return CallVFunction<SetValue_t>(this, 14)(this, value);
}

void SetValue(float value)
{
typedef void(__thiscall* SetValue_t)(void*, float);
return CallVFunction<SetValue_t>(this, 15)(this, value);
}

void SetValue(int value)
{
typedef void(__thiscall* SetValue_t)(void*, int);
return CallVFunction<SetValue_t>(this, 16)(this, value);
}

/*void SetValue(Color value)
{
typedef void(__thiscall* SetValue_t)(void*, Color);
return CallVFunction<SetValue_t>(this, 17)(this, value);
}
*/


char* GetName()
{
typedef char*(__thiscall* OriginalFn)(void*);
return CallVFunction<OriginalFn>(this, 5)(this);
}


void* virtualtable;
ConVar* m_pNext;
int m_bRegistered;
char* m_pszName;
char* m_pszHelpString;
int m_nFlags;
FnChangeCallbackV1_t m_fnChangeCallbacksV1;
ConVar* m_pParent;
char* m_pszDefaultValue;
CVValue_t m_Value;
int m_bHasMin;
float m_fMinVal;
int m_bHasMax;
float m_fMaxVal;
CUtlVector<FnChangeCallback_t> m_fnChangeCallbacks; // note: this is also accessible as FnChangeCallback_t* instead of CUtlVector
float GetValue()
{
DWORD xored = *(DWORD*)&m_pParent->m_Value.m_fValue ^ (DWORD)this;
return *(float*)&xored;
}
int GetValueN()
{
return (int)(m_pParent->m_Value.m_nValue^ (DWORD)this);
}

};//Size=0x0048*


/*class ICvar {
public:
ConVar* FindVar(const char* var) {
typedef ConVar*(__thiscall* pFind)(PVOID, const char*);
return CallVFunction<pFind>(this, 15)(this, var);
}
};*/
class IAppSystem
{
public:
virtual ~IAppSystem()
{
}

virtual void func0() = 0;
virtual void func1() = 0;
virtual void func2() = 0;
virtual void func3() = 0;
virtual void func4() = 0;
virtual void func5() = 0;
virtual void func6() = 0;
virtual void func7() = 0;
virtual void func8() = 0;
virtual void func9() = 0;
};

struct CVarDLLIdentifier_t;

class ICvar : public IAppSystem
{
public:
virtual void func10() = 0;
virtual void RegisterConCommand(ConVar *pCommandBase) = 0;
virtual void UnregisterConCommand(ConVar *pCommandBase) = 0;
virtual void func13() = 0;
virtual ConVar *FindVar(const char *var_name) = 0;
virtual void func15() = 0;
virtual void func16() = 0;
virtual void func17() = 0;
virtual void func18() = 0;
virtual void func19() = 0;
virtual void func20() = 0;
};

@@ -0,0 +1,194 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Generic CRC functions
//
// $NoKeywords: $
//=============================================================================//
#ifndef CHECKSUM_CRC_H
#define CHECKSUM_CRC_H
#ifdef _WIN32
#pragma once
#endif

typedef unsigned int CRC32_t;

#define LittleLong( val ) ( val )

#define CRC32_INIT_VALUE 0xFFFFFFFFUL
#define CRC32_XOR_VALUE 0xFFFFFFFFUL

#define NUM_BYTES 256

static const CRC32_t pulCRCTable[NUM_BYTES] =
{
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
};
class CCRC
{
public:
void CRC32_Init(CRC32_t *pulCRC)
{
*pulCRC = CRC32_INIT_VALUE;
}

void CRC32_Final(CRC32_t *pulCRC)
{
*pulCRC ^= CRC32_XOR_VALUE;
}

CRC32_t CRC32_GetTableEntry(unsigned int slot)
{
return pulCRCTable[(unsigned char)slot];
}

void CRC32_ProcessBuffer(CRC32_t *pulCRC, const void *pBuffer, int nBuffer)
{
CRC32_t ulCrc = *pulCRC;
unsigned char *pb = (unsigned char *)pBuffer;
unsigned int nFront;
int nMain;

JustAfew:

switch (nBuffer)
{
case 7:
ulCrc = pulCRCTable[*pb++ ^ (unsigned char)ulCrc] ^ (ulCrc >> 8);

case 6:
ulCrc = pulCRCTable[*pb++ ^ (unsigned char)ulCrc] ^ (ulCrc >> 8);

case 5:
ulCrc = pulCRCTable[*pb++ ^ (unsigned char)ulCrc] ^ (ulCrc >> 8);

case 4:
ulCrc ^= LittleLong(*(CRC32_t *)pb);
ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8);
ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8);
ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8);
ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8);
*pulCRC = ulCrc;
return;

case 3:
ulCrc = pulCRCTable[*pb++ ^ (unsigned char)ulCrc] ^ (ulCrc >> 8);

case 2:
ulCrc = pulCRCTable[*pb++ ^ (unsigned char)ulCrc] ^ (ulCrc >> 8);

case 1:
ulCrc = pulCRCTable[*pb++ ^ (unsigned char)ulCrc] ^ (ulCrc >> 8);

case 0:
*pulCRC = ulCrc;
return;
}

nFront = ((unsigned int)pb) & 3;
nBuffer -= nFront;
switch (nFront)
{
case 3:
ulCrc = pulCRCTable[*pb++ ^ (unsigned char)ulCrc] ^ (ulCrc >> 8);
case 2:
ulCrc = pulCRCTable[*pb++ ^ (unsigned char)ulCrc] ^ (ulCrc >> 8);
case 1:
ulCrc = pulCRCTable[*pb++ ^ (unsigned char)ulCrc] ^ (ulCrc >> 8);
}

nMain = nBuffer >> 3;
while (nMain--)
{
ulCrc ^= LittleLong(*(CRC32_t *)pb);
ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8);
ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8);
ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8);
ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8);
ulCrc ^= LittleLong(*(CRC32_t *)(pb + 4));
ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8);
ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8);
ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8);
ulCrc = pulCRCTable[(unsigned char)ulCrc] ^ (ulCrc >> 8);
pb += 8;
}

nBuffer &= 7;
goto JustAfew;
}

inline CRC32_t CRC32_ProcessSingleBuffer(const void *p, int len)
{
CRC32_t crc;

CRC32_Init(&crc);
CRC32_ProcessBuffer(&crc, p, len);
CRC32_Final(&crc);

return crc;
}
};
extern CCRC gCRC;
#endif // CHECKSUM_CRC_H
@@ -0,0 +1,60 @@
#pragma once
/*class CDebugOverlay
{
public:
int ScreenPosition(const Vector& point, Vector& screen)
{
typedef int(__thiscall* OriginalFn)(PVOID, const Vector&, Vector&);
return VMT.CallVFunction<OriginalFn>(this, 13)(this, point, screen);
}
void AddBoxOverlay(const Vector& origin, const Vector& mins, const Vector& max, QAngle const& orientation, int r, int g, int b, int a, float duration)
{
typedef void(__thiscall* Fn)(PVOID, const Vector&, const Vector&, const Vector&, QAngle const&, int, int, int, int, float);
}
}; */
#define FMTFUNCTION( a, b ) // baim

class OverlayText_t;

class CDebugOverlay
{
public:
virtual void AddCBaseEntityTextOverlay(int ent_index, int line_offset, float duration, int r, int g, int b, int a, const char *format, ...) FMTFUNCTION(9, 10) = 0;
virtual void AddBoxOverlay(const Vector& origin, const Vector& mins, const Vector& max, QAngle const& orientation, int r, int g, int b, int a, float duration = 0) = 0;
virtual void AddSphereOverlay(const Vector& vOrigin, float flRadius, int nTheta, int nPhi, int r, int g, int b, int a, float flDuration = 0) = 0;
virtual void AddTriangleOverlay(const Vector& p1, const Vector& p2, const Vector& p3, int r, int g, int b, int a, bool noDepthTest, float duration = 0) = 0;

// New virtual added on the 26 MAY 15 update
virtual void AddBoxOverlayNew(const Vector& v1, const Vector& v2, const Vector& v3, const Vector& v4, int r, int g, int b, int a) = 0;

virtual void AddLineOverlay(const Vector& origin, const Vector& dest, int r, int g, int b, bool noDepthTest, float duration = 0) = 0;
virtual void AddTextOverlay(const Vector& origin, float duration, const char *format, ...) FMTFUNCTION(4, 5) = 0;
virtual void AddTextOverlay(const Vector& origin, int line_offset, float duration, const char *format, ...) FMTFUNCTION(5, 6) = 0;
virtual void AddScreenTextOverlay(float flXPos, float flYPos, float flDuration, int r, int g, int b, int a, const char *text) = 0;
virtual void AddSweptBoxOverlay(const Vector& start, const Vector& end, const Vector& mins, const Vector& max, const QAngle & angles, int r, int g, int b, int a, float flDuration = 0) = 0;
virtual void AddGridOverlay(const Vector& origin) = 0;
virtual void AddCoordFrameOverlay(const matrix3x4_t& frame, float flScale, int vColorTable[3][3] = NULL) = 0;

virtual int ScreenPosition(const Vector& point, Vector& screen) = 0;
virtual int ScreenPosition(float flXPos, float flYPos, Vector& screen) = 0;

virtual OverlayText_t *GetFirst(void) = 0;
virtual OverlayText_t *GetNext(OverlayText_t *current) = 0;
virtual void ClearDeadOverlays(void) = 0;
virtual void ClearAllOverlays() = 0;

virtual void AddTextOverlayRGB(const Vector& origin, int line_offset, float duration, float r, float g, float b, float alpha, const char *format, ...) FMTFUNCTION(9, 10) = 0;
virtual void AddTextOverlayRGB(const Vector& origin, int line_offset, float duration, int r, int g, int b, int a, const char *format, ...) FMTFUNCTION(9, 10) = 0;

virtual void AddLineOverlayAlpha(const Vector& origin, const Vector& dest, int r, int g, int b, int a, bool noDepthTest, float duration) = 0;
virtual void AddBoxOverlay2(const Vector& origin, const Vector& mins, const Vector& max, QAngle const& orientation, const Color& faceColor, const Color& edgeColor, float duration) = 0;

virtual void PurgeTextOverlays() = 0;

virtual void NewOverlay(const Vector& origin1, const Vector& origin2, int a3, int r, int g, int b, int a, int unusedParam) = 0;

private:
inline void AddTextOverlay(const Vector& origin, int line_offset, float duration, int r, int g, int b, int a, const char *format, ...) {} /* catch improper use of bad interface. Needed because '0' duration can be resolved by compiler to NULL format string (i.e., compiles but calls wrong function) */
};
@@ -0,0 +1,184 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//

#pragma once

//#include <stddef.h>
#include <cstdio>

// Max number of properties in a datatable and its children.
#define MAX_DATATABLES 1024 // must be a power of 2.
#define MAX_DATATABLE_PROPS 4096

#define MAX_ARRAY_ELEMENTS 2048 // a network array should have more that 1024 elements

#define HIGH_DEFAULT -121121.121121f

#define BITS_FULLRES -1 // Use the full resolution of the type being encoded.
#define BITS_WORLDCOORD -2 // Encode as a world coordinate.

#define DT_MAX_STRING_BITS 9
#define DT_MAX_STRING_BUFFERSIZE (1<<DT_MAX_STRING_BITS) // Maximum length of a string that can be sent.

#define STRINGBUFSIZE(className, varName) sizeof( ((className*)0)->varName )

// Gets the size of a variable in a class.
#define PROPSIZEOF(className, varName) sizeof(((className*)0)->varName)


// SendProp::m_Flags.
#define SPROP_UNSIGNED (1<<0) // Unsigned integer data.

#define SPROP_COORD (1<<1) // If this is set, the float/vector is treated like a world coordinate.
// Note that the bit count is ignored in this case.

#define SPROP_NOSCALE (1<<2) // For floating point, don't scale into range, just take value as is.

#define SPROP_ROUNDDOWN (1<<3) // For floating point, limit high value to range minus one bit unit

#define SPROP_ROUNDUP (1<<4) // For floating point, limit low value to range minus one bit unit

#define SPROP_NORMAL (1<<5) // If this is set, the vector is treated like a normal (only valid for vectors)

#define SPROP_EXCLUDE (1<<6) // This is an exclude prop (not excludED, but it points at another prop to be excluded).

#define SPROP_XYZE (1<<7) // Use XYZ/Exponent encoding for vectors.

#define SPROP_INSIDEARRAY (1<<8) // This tells us that the property is inside an array, so it shouldn't be put into the
// flattened property list. Its array will point at it when it needs to.

#define SPROP_PROXY_ALWAYS_YES (1<<9) // Set for datatable props using one of the default datatable proxies like
// SendProxy_DataTableToDataTable that always send the data to all clients.

#define SPROP_CHANGES_OFTEN (1<<10) // this is an often changed field, moved to head of sendtable so it gets a small index

#define SPROP_IS_A_VECTOR_ELEM (1<<11) // Set automatically if SPROP_VECTORELEM is used.

#define SPROP_COLLAPSIBLE (1<<12) // Set automatically if it's a datatable with an offset of 0 that doesn't change the pointer
// (ie: for all automatically-chained base classes).
// In this case, it can get rid of this SendPropDataTable altogether and spare the
// trouble of walking the hierarchy more than necessary.

#define SPROP_COORD_MP (1<<13) // Like SPROP_COORD, but special handling for multiplayer games
#define SPROP_COORD_MP_LOWPRECISION (1<<14) // Like SPROP_COORD, but special handling for multiplayer games where the fractional component only gets a 3 bits instead of 5
#define SPROP_COORD_MP_INTEGRAL (1<<15) // SPROP_COORD_MP, but coordinates are rounded to integral boundaries
#define SPROP_NUMFLAGBITS_NETWORKED 16

// This is server side only, it's used to mark properties whose SendProxy_* functions encode against gpGlobals->tickcount (the only ones that currently do this are
// m_flAnimTime and m_flSimulationTime. MODs shouldn't need to mess with this probably
#define SPROP_ENCODED_AGAINST_TICKCOUNT (1<<16)

// See SPROP_NUMFLAGBITS_NETWORKED for the ones which are networked
#define SPROP_NUMFLAGBITS 17

// Used by the SendProp and RecvProp functions to disable debug checks on type sizes.
#define SIZEOF_IGNORE -1


// Use this to extern send and receive datatables, and reference them.
#define EXTERN_SEND_TABLE(tableName) namespace tableName {extern SendTable g_SendTable;}
#define EXTERN_RECV_TABLE(tableName) namespace tableName {extern RecvTable g_RecvTable;}

#define REFERENCE_SEND_TABLE(tableName) tableName::g_SendTable
#define REFERENCE_RECV_TABLE(tableName) tableName::g_RecvTable


class SendProp;


typedef enum
{
DPT_Int = 0,
DPT_Float,
DPT_Vector,
DPT_VectorXY,
DPT_String,
DPT_Array, // An array of the base types (can't be of datatables).
DPT_DataTable,
#if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!!
DPT_Quaternion,
#endif
DPT_NUMSendPropTypes
} SendPropType;


/*class DVariant
{
public:
DVariant() { m_Type = DPT_Float; }
DVariant(float val) { m_Type = DPT_Float; m_Float = val; }
const char *ToString()
{
static char text[128];
switch (m_Type)
{
case DPT_Int:
sprintf_s(text, sizeof(text), "%i", m_Int);
break;
case DPT_Float:
sprintf_s(text, sizeof(text), "%.3f", m_Float);
break;
case DPT_Vector:
sprintf_s(text, sizeof(text), "(%.3f,%.3f,%.3f)",
m_Vector[0], m_Vector[1], m_Vector[2]);
break;
#if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!!
case DPT_Quaternion:
sprintf_s(text, sizeof(text), "(%.3f,%.3f,%.3f %.3f)",
m_Vector[0], m_Vector[1], m_Vector[2], m_Vector[3]);
break;
#endif
case DPT_String:
if (m_pString)
return m_pString;
else
return "NULL";
break;
case DPT_Array:
sprintf_s(text, sizeof(text), "Array");
break;
case DPT_DataTable:
sprintf_s(text, sizeof(text), "DataTable");
break;
default:
sprintf_s(text, sizeof(text), "DVariant type %i unknown", m_Type);
break;
}
return text;
}
union
{
float m_Float;
long m_Int;
char *m_pString;
void *m_pData; // For DataTables.
#if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!!
float m_Vector[4];
#else
float m_Vector[3];
#endif
};
SendPropType m_Type;
};
*/

// This can be used to set the # of bits used to transmit a number between 0 and nMaxElements-1.
inline int NumBitsForCount(int nMaxElements)
{
int nBits = 0;
while (nMaxElements > 0)
{
++nBits;
nMaxElements >>= 1;
}
return nBits;
}

Large diffs are not rendered by default.

@@ -0,0 +1,205 @@
enum FlowType_t
{
FLOW_OUTGOING = 0,
FLOW_INCOMING = 1,
FLOW_MAX = 2
};
enum Typetype_t
{
TYPE_GENERIC = 0,
TYPE_LOCALPLAYER = 1
};
class NET_SetConVar
{
public:
NET_SetConVar(const char* name, const char* value);
~NET_SetConVar();
private:
DWORD pad[13];
};
class INetChannelInfo
{
public:
float GetLatency(int flow)
{
typedef float(__thiscall* Fn)(void*, int);
return CallVFunction<Fn>(this, 9)(this, flow);
}
float GetAvgLatency(int type)
{
typedef float(__thiscall* Fn)(void*, int);
return CallVFunction<Fn>(this, 10)(this, type);
}
void SendNetMsg(NET_SetConVar& convar)
{
typedef void(__thiscall* oSendNetMsg)(PVOID, NET_SetConVar&, int, int);
CallVFunction<oSendNetMsg>(this, 42)(this, convar, 0, 0);
}

virtual float GetAvgLatency(int flow) const = 0; // average packet latency in seconds

};

class CClientState
{
public:
void ForceFullUpdate()
{
m_nDeltaTick = -1;
}
void ForceFullUpdate_test()
{
static bool aa;
static int ticks = 0;
if (ticks >= 14)
{
ticks = 0;
aa = true;
}
else
{
aa = false;
ticks++;
}
// static auto CL_FullUpdatae = reinterpret_cast<CL_FullUpdatea_t>(FindPatatearn("engine.dll", reinterpret_cast<PBYTE>("\xA1\x00\x00\x00\x00\xB9\x00\x00\x00\x00\x56\xFF\x50\x14\x8B\x34\x85"), "x????x????xxxxxxx"));

// if (GetKeyState('C') & 0x1) {
if (*(uint32_t*)((uintptr_t)this + 0x174) != -1 && aa) {
*(uint32_t*)((uintptr_t)this + 0x174) = -1;
//CL_FullUpdatae();
}

//}


}
char pad_0000[156]; //0x0000
class INetChannel* m_pNetChannel; //0x0094
char pad_0098[16]; //0x0098
unsigned int m_nRetryNumber; //0x00A8
char pad_00AC[84]; //0x00AC
int m_nSignonState; //0x0100
char pad_0104[8]; //0x0104
float m_flNextCmdTime; //0x010C
int m_nServerCount; //0x0110
int m_nCurrentSequence; //0x0114
char pad_0118[75]; //0x0118
int m_nServerTick; //0x0163
int m_nClientTick; //0x0167
int m_nDeltaTick; //0x016B
char pad_016F[4]; //0x016F
int m_nViewEntity; //0x0173
char pad_0177[8]; //0x0177
char m_szLevelName[260]; //0x017F
char m_szLevelNameShort[40]; //0x0283
char pad_02AB[18940]; //0x02AB
char pad_0x2DA0; //0x4CA7
int lastoutgoingcommand; //0x4CA8
int chokedcommands; //0x4CAC
int last_command_ack; //0x4CB0
int command_ack; //0x4CB4
int m_nSoundSequence; //0x4CB8
char pad_4CBC[8]; //0x4CBC
bool ishltv; //0x4CC4
bool aaa;
// CBaseHudChat *m_pChatElement;
};
class CEngine
{
public:
void SetName(std::string name);
INetChannelInfo* GetNetChannelInfo()
{
typedef INetChannelInfo* (__thiscall* Fn)(void*);
return CallVFunction<Fn>(this, 78)(this);
}
void GetScreenSize( int& Width, int& Height )
{
typedef void( __thiscall* Fn )(void*, int&, int&);
return CallVFunction<Fn>(this, 5)(this, Width, Height);
}

bool GetPlayerInfo( int Index, player_info_t* PlayerInfo )
{
typedef bool(__thiscall* Fn)(void*, int, player_info_t*);
return CallVFunction<Fn>(this, 8)(this, Index, PlayerInfo);
}

int GetLocalPlayer()
{
typedef int(__thiscall* Fn)(void*);
return CallVFunction<Fn>(this, 12)(this);
}
int GetPlayerForUserID(int userid)
{
typedef int(__thiscall* Fn)(void*, int);
return CallVFunction<Fn>(this, 9)(this, userid);
}
void ClientCmd( const char* Command )
{
typedef void(__thiscall* Fn)(void*, const char*);
return CallVFunction<Fn>(this, 108)(this, Command);
}

void SetViewAngles(QAngle& Angles)
{
typedef void(__thiscall* Fn)(void*, QAngle&);
return CallVFunction<Fn>(this, 19)(this, Angles);
}

void GetViewAngles(QAngle& angle)
{
typedef void(__thiscall* Fn)(void*, QAngle&);
return CallVFunction<Fn>(this, 18)(this,angle);
}

matrix3x4_t& WorldToScreenMatrix()
{
typedef matrix3x4_t& (__thiscall* Fn)(void*);
return CallVFunction<Fn>(this, 37)(this);


}
bool IsConnected()
{
typedef bool(__thiscall* Fn)(PVOID);
return CallVFunction<Fn>(this, 27)(this);
}

bool IsInGame()
{
typedef bool(__thiscall* Fn)(PVOID);
return CallVFunction<Fn>(this, 26)(this);
}

int GetMaxClients()
{
typedef bool(__thiscall* Fn)(PVOID);
return CallVFunction<Fn>(this, 20)(this);
}

float Time()
{
typedef float(__thiscall* Fn)(PVOID);
return CallVFunction<Fn>(this, 14)(this);
}


void ClientCmd_Unrestricted(char const* cmd)
{
typedef void(__thiscall* oClientCmdUnres)(PVOID, const char*, char);
return CallVFunction<oClientCmdUnres>(this, 114)(this, cmd, 0);
}
//52
char const GetLevelName()
{
typedef char const(__thiscall* oClientCmdUnres)(PVOID);
return CallVFunction<oClientCmdUnres>(this, 52)(this);
}
unsigned int GetEngineBuildNumber()
{
typedef unsigned int(__thiscall* OriginalFn)(PVOID);
return CallVFunction< OriginalFn >(this, 104)(this);
}

};
@@ -0,0 +1,27 @@
#pragma once

enum VGuiPanel_t
{
PANEL_ROOT = 0,
PANEL_GAMEUIDLL,
PANEL_CLIENTDLL,
PANEL_TOOLS,
PANEL_INGAMESCREENS,
PANEL_GAMEDLL,
PANEL_CLIENTDLL_TOOLS
};

enum PaintMode_t
{
PAINT_UIPANELS = (1 << 0),
PAINT_INGAMEPANELS = (1 << 1),
PAINT_CURSOR = (1 << 2)
};

class IEngineVGui
{
public:
virtual ~IEngineVGui(void) {}
virtual unsigned int/*VPANEL*/ GetPanel(VGuiPanel_t type) = 0;
virtual bool IsGameUIVisible() = 0;
};
@@ -0,0 +1,15 @@
#pragma once

class C_TEFireBullets
{
public:
char pad[12];
int m_iPlayer; //12
int _m_iItemDefinitionIndex;
Vector _m_vecOrigin;
QAngle m_vecAngles;
int _m_iWeaponID;
int m_iMode;
int m_iSeed;
float m_flSpread;
};
@@ -0,0 +1,78 @@
class CGlobalVarsBase
{
public:

CGlobalVarsBase(bool bIsClient);

// This can be used to filter debug output or to catch the client or server in the act.
bool IsClient() const;

bool IsRemoteClient() const;

// for encoding m_flSimulationTime, m_flAnimTime
int GetNetworkBase(int nTick, int nCBaseEntity);

public:

// Absolute time (per frame still - Use Plat_FloatTime() for a high precision real time
// perf clock, but not that it doesn't obey host_timescale/host_framerate)
float realtime;
// Absolute frame counter - continues to increase even if game is paused
int framecount;
// Non-paused frametime
float absoluteframetime;

float absoluteframestarttimestddev;

// Current time
//
// On the client, this (along with tickcount) takes a different meaning based on what
// piece of code you're in:
//
// - While receiving network packets (like in PreDataUpdate/PostDataUpdate and proxies),
// this is set to the SERVER TICKCOUNT for that packet. There is no interval between
// the server ticks.
// [server_current_Tick * tick_interval]
//
// - While rendering, this is the exact client clock
// [client_current_tick * tick_interval + interpolation_amount]
//
// - During prediction, this is based on the client's current tick:
// [client_current_tick * tick_interval]
float curtime;

// Time spent on last server or client frame (has nothing to do with think intervals)
float frametime;
// current maxplayers setting
int maxClients;

// Simulation ticks - does not increase when game is paused
int tickcount;

// Simulation tick interval
float interval_per_tick;

// interpolation amount ( client-only ) based on fraction of next tick which has elapsed
float interpolation_amount;
int simTicksThisFrame;

int network_protocol;

// current saverestore data
void *pSaveData;

private:
// Set to true in client code.
bool m_bClient;

public:
bool m_bRemoteClient;

private:
// 100 (i.e., tickcount is rounded down to this base and then the "delta" from this base is networked
int nTimestampNetworkingBase;
// 32 (entindex() % nTimestampRandomizeWindow ) is subtracted from gpGlobals->tickcount to set the networking basis, prevents
// all of the entities from forcing a new PackedCBaseEntity on the same tick (i.e., prevents them from getting lockstepped on this)
int nTimestampRandomizeWindow;

};
@@ -0,0 +1,50 @@
class CInputSystem
{
public:
void EnableInput(bool enable)
{
typedef void(__thiscall* fn)(void*, bool);
CallVFunction<fn>(this, 10)(this, enable); //11
}
void ResetInputState()
{
typedef void(__thiscall* fn)(void*);
CallVFunction<fn>(this, 38)(this); //39
}
};


class CInput
{
public:
void* pvftable; //0x00
bool m_fTrackIRAvailable; //0x04
bool m_fMouseInitialized; //0x05
bool m_fMouseActive; //0x06
bool m_fJoystickAdvancedInit; //0x07
char pad_0x08[0x2C]; //0x08
void* m_pKeys; //0x34
char pad_0x38[0x64]; //0x38
bool m_fCameraInterceptingMouse; //0x9C
bool m_fCameraInThirdPerson; //0x9D
bool m_fCameraMovingWithMouse; //0x9E
Vector m_vecCameraOffset; //0xA0
bool m_fCameraDistanceMove; //0xAC
int m_nCameraOldX; //0xB0
int m_nCameraOldY; //0xB4
int m_nCameraX; //0xB8
int m_nCameraY; //0xBC
bool m_CameraIsOrthographic; //0xC0
QAngle m_angPreviousViewAngles; //0xC4
QAngle m_angPreviousViewAnglesTilt; //0xD0
float m_flLastForwardMove; //0xDC
int m_nClearInputState; //0xE0
char pad_0xE4[0x8]; //0xE4
CUserCmd* m_pCommands; //0xEC
CVerifiedUserCmd* m_pVerifiedCommands; //0xF0
CUserCmd *GetUserCmd(int sqnum)
{
typedef CUserCmd*(__thiscall* Fn)(void*, int, int);
return CallVFunction<Fn>(this, 8)(this, 0,sqnum);
}
};
@@ -0,0 +1,345 @@
#pragma once

enum OverrideType_t
{
OVERRIDE_NORMAL = 0,
OVERRIDE_BUILD_SHADOWS,
OVERRIDE_DEPTH_WRITE,
};
struct ModelRenderInfo_t
{
Vector origin;
Vector angles;
char pad[0x4]; // <- new
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;
}
};
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_UNUSED = (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), // OBSOLETE
// MATERIAL_VAR_UNUSED = (1 << 18),
MATERIAL_VAR_ENVMAPCAMERASPACE = (1 << 19), // OBSOLETE
MATERIAL_VAR_BASEALPHAENVMAPMASK = (1 << 20),
MATERIAL_VAR_TRANSLUCENT = (1 << 21),
MATERIAL_VAR_NORMALMAPALPHAENVMAPMASK = (1 << 22),
MATERIAL_VAR_NEEDS_SOFTWARE_SKINNING = (1 << 23), // OBSOLETE
MATERIAL_VAR_OPAQUETEXTURE = (1 << 24),
MATERIAL_VAR_ENVMAPMODE = (1 << 25), // OBSOLETE
MATERIAL_VAR_SUPPRESS_DECALS = (1 << 26),
MATERIAL_VAR_HALFLAMBERT = (1 << 27),
MATERIAL_VAR_WIREFRAME = (1 << 28),
MATERIAL_VAR_ALLOWALPHATOCOVERAGE = (1 << 29),
MATERIAL_VAR_ALPHA_MODIFIED_BY_PROXY = (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
};


//-----------------------------------------------------------------------------
// Internal flags not accessible from outside the material system. Stored in Flags2
//-----------------------------------------------------------------------------
enum MaterialVarFlags2_t
{
// NOTE: These are for $flags2!!!!!
// UNUSED = (1 << 0),

MATERIAL_VAR2_LIGHTING_UNLIT = 0,
MATERIAL_VAR2_LIGHTING_VERTEX_LIT = (1 << 1),
MATERIAL_VAR2_LIGHTING_LIGHTMAP = (1 << 2),
MATERIAL_VAR2_LIGHTING_BUMPED_LIGHTMAP = (1 << 3),
MATERIAL_VAR2_LIGHTING_MASK =
(MATERIAL_VAR2_LIGHTING_VERTEX_LIT |
MATERIAL_VAR2_LIGHTING_LIGHTMAP |
MATERIAL_VAR2_LIGHTING_BUMPED_LIGHTMAP),

// FIXME: Should this be a part of the above lighting enums?
MATERIAL_VAR2_DIFFUSE_BUMPMAPPED_MODEL = (1 << 4),
MATERIAL_VAR2_USES_ENV_CUBEMAP = (1 << 5),
MATERIAL_VAR2_NEEDS_TANGENT_SPACES = (1 << 6),
MATERIAL_VAR2_NEEDS_SOFTWARE_LIGHTING = (1 << 7),
// GR - HDR path puts lightmap alpha in separate texture...
MATERIAL_VAR2_BLEND_WITH_LIGHTMAP_ALPHA = (1 << 8),
MATERIAL_VAR2_NEEDS_BAKED_LIGHTING_SNAPSHOTS = (1 << 9),
MATERIAL_VAR2_USE_FLASHLIGHT = (1 << 10),
MATERIAL_VAR2_USE_FIXED_FUNCTION_BAKED_LIGHTING = (1 << 11),
MATERIAL_VAR2_NEEDS_FIXED_FUNCTION_FLASHLIGHT = (1 << 12),
MATERIAL_VAR2_USE_EDITOR = (1 << 13),
MATERIAL_VAR2_NEEDS_POWER_OF_TWO_FRAME_BUFFER_TEXTURE = (1 << 14),
MATERIAL_VAR2_NEEDS_FULL_FRAME_BUFFER_TEXTURE = (1 << 15),
MATERIAL_VAR2_IS_SPRITECARD = (1 << 16),
MATERIAL_VAR2_USES_VERTEXID = (1 << 17),
MATERIAL_VAR2_SUPPORTS_HW_SKINNING = (1 << 18),
MATERIAL_VAR2_SUPPORTS_FLASHLIGHT = (1 << 19),
MATERIAL_VAR2_USE_GBUFFER0 = (1 << 20),
MATERIAL_VAR2_USE_GBUFFER1 = (1 << 21),
MATERIAL_VAR2_SELFILLUMMASK = (1 << 22),
MATERIAL_VAR2_SUPPORTS_TESSELLATION = (1 << 23)
};


class KeyValues
{
public:
char _pad[0x20];//csgo, for css its a diff size
};
class IMaterial
{
public:
// Get the name of the material. This is a full path to
// the vmt file starting from "hl2/materials" (or equivalent) without
// a file extension.
virtual const char * GetName() const = 0;
virtual const char * GetTextureGroupName() const = 0;

// Get the preferred size/bitDepth of a preview image of a material.
// This is the sort of image that you would use for a thumbnail view
// of a material, or in WorldCraft until it uses materials to render.
// separate this for the tools maybe
virtual void* GetPreviewImageProperties(int *width, int *height,
void* *imageFormat, bool* isTranslucent) const = 0;

// Get a preview image at the specified width/height and bitDepth.
// Will do resampling if necessary.(not yet!!! :) )
// Will do color format conversion. (works now.)
virtual void* GetPreviewImage(unsigned char *data,
int width, int height,
void* imageFormat) const = 0;
//
virtual int GetMappingWidth() = 0;
virtual int GetMappingHeight() = 0;

virtual int GetNumAnimationFrames() = 0;

// For material subrects (material pages). Offset(u,v) and scale(u,v) are normalized to texture.
virtual bool InMaterialPage(void) = 0;
virtual void GetMaterialOffset(float *pOffset) = 0;
virtual void GetMaterialScale(float *pScale) = 0;
virtual IMaterial *GetMaterialPage(void) = 0;

// find a vmt variable.
// This is how game code affects how a material is rendered.
// The game code must know about the params that are used by
// the shader for the material that it is trying to affect.
virtual void* * FindVar(const char *varName, bool *found, bool complain = true) = 0;

// The user never allocates or deallocates materials. Reference counting is
// used instead. Garbage collection is done upon a call to
// IMaterialSystem::UncacheUnusedMaterials.
virtual void IncrementReferenceCount(void) = 0;
virtual void DecrementReferenceCount(void) = 0;

inline void AddRef() { IncrementReferenceCount(); }
inline void Release() { DecrementReferenceCount(); }

// Each material is assigned a number that groups it with like materials
// for sorting in the application.
virtual int GetEnumerationID(void) const = 0;

virtual void GetLowResColorSample(float s, float t, float *color) const = 0;

// This computes the state snapshots for this material
virtual void RecomputeStateSnapshots() = 0;

// Are we translucent?
virtual bool IsTranslucent() = 0;

// Are we alphatested?
virtual bool IsAlphaTested() = 0;

// Are we vertex lit?
virtual bool IsVertexLit() = 0;

// Gets the vertex format
virtual void* GetVertexFormat() const = 0;

// returns true if this material uses a material proxy
virtual bool HasProxy(void) const = 0;

virtual bool UsesEnvCubemap(void) = 0;

virtual bool NeedsTangentSpace(void) = 0;

virtual bool NeedsPowerOfTwoFrameBufferTexture(bool bCheckSpecificToThisFrame = true) = 0;
virtual bool NeedsFullFrameBufferTexture(bool bCheckSpecificToThisFrame = true) = 0;

// returns true if the shader doesn't do skinning itself and requires
// the data that is sent to it to be preskinned.
virtual bool NeedsSoftwareSkinning(void) = 0;

// Apply constant color or alpha modulation
virtual void AlphaModulate(float alpha) = 0;
virtual void ColorModulate(float r, float g, float b) = 0;

// Material Var flags...
virtual void SetMaterialVarFlag(MaterialVarFlags_t flag, bool on) = 0;
virtual bool GetMaterialVarFlag(MaterialVarFlags_t flag) const = 0;

// Gets material reflectivity
virtual void GetReflectivity(Vector& reflect) = 0;

// Gets material property flags
virtual bool GetPropertyFlag(void* type) = 0;

// Is the material visible from both sides?
virtual bool IsTwoSided() = 0;

// Sets the shader associated with the material
virtual void SetShader(const char *pShaderName) = 0;

// Can't be const because the material might have to precache itself.
virtual int GetNumPasses(void) = 0;

// Can't be const because the material might have to precache itself.
virtual int GetTextureMemoryBytes(void) = 0;

// Meant to be used with materials created using CreateMaterial
// It updates the materials to reflect the current values stored in the material vars
virtual void Refresh() = 0;

// GR - returns true is material uses lightmap alpha for blending
virtual bool NeedsLightmapBlendAlpha(void) = 0;

// returns true if the shader doesn't do lighting itself and requires
// the data that is sent to it to be prelighted
virtual bool NeedsSoftwareLighting(void) = 0;

// Gets at the shader parameters
virtual int ShaderParamCount() const = 0;
virtual void* **GetShaderParams(void) = 0;

// Returns true if this is the error material you get back from IMaterialSystem::FindMaterial if
// the material can't be found.
virtual bool IsErrorMaterial() const = 0;

virtual void Unused() = 0;

// Gets the current alpha modulation
virtual float GetAlphaModulation() = 0;
virtual void GetColorModulation(float *r, float *g, float *b) = 0;

// Is this translucent given a particular alpha modulation?
virtual bool IsTranslucentUnderModulation(float fAlphaModulation = 1.0f) const = 0;

// fast find that stores the index of the found var in the string table in local cache
virtual void * FindVarFast(char const *pVarName, unsigned int *pToken) = 0;

// Sets new VMT shader parameters for the material
virtual void SetShaderAndParams(KeyValues *pKeyValues) = 0;
virtual const char * GetShaderName() const = 0;

virtual void DeleteIfUnreferenced() = 0;

virtual bool IsSpriteCard() = 0;

virtual void CallBindProxy(void *proxyData) = 0;

virtual void RefreshPreservingMaterialVars() = 0;

virtual bool WasReloadedFromWhitelist() = 0;

virtual bool SetTempExcluded(bool bSet, int nExcludedDimensionLimit) = 0;

virtual int GetReferenceCount() const = 0;
};

typedef unsigned short MaterialHandle_t;
class CMaterialSystem
{
public:
IMaterial* FindMaterial(char const* pMaterialName, const char *pTextureGroupName, bool complain = true, const char *pComplainPrefix = NULL)
{
typedef IMaterial*(__thiscall* oFindMaterial)(PVOID, char const*, char const*, bool, char const*);
return CallVFunction< oFindMaterial >(this,84)(this, pMaterialName, pTextureGroupName, complain, pComplainPrefix);
}

IMaterial* CreateMaterial(const char *pMaterialName, KeyValues *pVMTKeyValues)
{
typedef IMaterial* (__thiscall* oCreateMaterial)(PVOID, const char *, KeyValues*);
return CallVFunction<oCreateMaterial>(this, 83)(this, pMaterialName, pVMTKeyValues);
}
MaterialHandle_t FirstMaterial()
{
typedef MaterialHandle_t(__thiscall* FirstMaterialFn)(void*);
return CallVFunction<FirstMaterialFn>(this, 86)(this);
}

MaterialHandle_t NextMaterial(MaterialHandle_t h)
{
typedef MaterialHandle_t(__thiscall* NextMaterialFn)(void*, MaterialHandle_t);
return CallVFunction<NextMaterialFn>(this, 87)(this, h);
}

MaterialHandle_t InvalidMaterial()
{
typedef MaterialHandle_t(__thiscall* InvalidMaterialFn)(void*);
return CallVFunction<InvalidMaterialFn>(this, 88)(this);
}

IMaterial* GetMaterial(MaterialHandle_t h)
{
typedef IMaterial*(__thiscall* GetMaterialFn)(void*, MaterialHandle_t);
return CallVFunction<GetMaterialFn>(this, 89)(this, h);
}
};
class CModelRender
{
public:
void ForcedMaterialOverride(IMaterial *material, OverrideType_t type = OVERRIDE_NORMAL, int idk = NULL)
{
typedef void(__thiscall* Fn)(void*, IMaterial*, OverrideType_t, int);
return CallVFunction<Fn>(this, 1)(this, material, type, idk);
}

};
class CRenderView
{
public:
void SetBlend(float alpha)
{
typedef void(__thiscall* oDrawModelExecute)(PVOID, float);
return CallVFunction< oDrawModelExecute >(this, 4)(this, alpha);
}

void SetColorModulation(float const* colors)
{
typedef void(__thiscall* oDrawModelExecute)(PVOID, float const*);
return CallVFunction< oDrawModelExecute >(this, 6)(this, colors);
}
};
@@ -0,0 +1,355 @@
struct mstudiobbox_t
{
int bone;
int group; // intersection group
Vector bbmin; // bounding box
Vector bbmax;
int szhitboxnameindex; // offset to the name of the hitbox.
int unused[3];
float radius;
int unused2[4];

const char* pszHitboxName()
{
if (szhitboxnameindex == 0)
return "";

return ((char*)this) + szhitboxnameindex;
}

mstudiobbox_t() {}

private:
mstudiobbox_t(const mstudiobbox_t& vOther);
};

struct mstudiobone_t
{
int sznameindex;
inline char * const pszName(void) const { return ((char *)this) + sznameindex; }
int parent; // parent bone
int bonecontroller[6]; // bone controller index, -1 == none

// default values
Vector pos;
Quaternion quat;
Vector rot;
// compression scale
Vector posscale;
Vector rotscale;

VMatrix poseToBone;
Quaternion qAlignment;
int flags;
int proctype;
int procindex; // procedural rule
mutable int physicsbone; // index into physically simulated bone
inline void *pProcedure() const { if (procindex == 0) return NULL; else return (void *)(((byte *)this) + procindex); };
int surfacepropidx; // index into string tablefor property name
inline char * const pszSurfaceProp(void) const { return ((char *)this) + surfacepropidx; }
int contents; // See BSPFlags.h for the contents flags

int unused[8]; // remove as appropriate

mstudiobone_t() {}
private:
// No copy constructors allowed
mstudiobone_t(const mstudiobone_t& vOther);
};

struct mstudioseqdesc_t
{
int szlabelindex;
inline char * const pszLabel(void) const { return ((char *)this) + szlabelindex; }

int szactivitynameindex;
inline char * const pszActivityName(void) const { return ((char *)this) + szactivitynameindex; }

int flags; // looping/non-looping flags

int activity; // initialized at loadtime to game DLL values
int actweight;

int numevents;
int eventindex;
inline void *pEvent(int i) const { return (((byte *)this) + eventindex) + i; };

Vector bbmin; // per sequence bounding box
Vector bbmax;

//-------------------------------------------------------------------------
// Purpose: returns a model animation from the sequence group size and
// blend index
// Note: this replaces GetAnimValue() that was previously in bone_setup
// Note: this also acts as a SetAnimValue() as it returns a reference to
// the anim value in question
//-------------------------------------------------------------------------
inline unsigned short& pAnimValue(int nIndex0, int nIndex1) const
{
// Clamp indexes
if (nIndex0 >= groupsize[0])
nIndex0 = groupsize[0] - 1;

if (nIndex1 >= groupsize[1])
nIndex1 = groupsize[1] - 1;

return *pBlend(nIndex1 * groupsize[0] + nIndex0);
}

int numblends;

int blendindex;
inline unsigned short *pBlend(int i) const { return (unsigned short *)(((byte *)this) + blendindex) + i; };

int seqgroup; // sequence group for demand loading

int groupsize[2];
int paramindex[2]; // X, Y, Z, XR, YR, ZR
float paramstart[2]; // local (0..1) starting value
float paramend[2]; // local (0..1) ending value
int paramparent;

float fadeintime; // ideal cross fate in time (0.2 default)
float fadeouttime; // ideal cross fade out time (0.2 default)

int entrynode; // transition node at entry
int exitnode; // transition node at exit
int nodeflags; // transition rules

float entryphase; // used to match entry gait
float exitphase; // used to match exit gait

float lastframe; // frame that should generation EndOfSequence

int nextseq; // auto advancing sequences
int pose; // index of delta animation between end and nextseq

int numikrules;

int numautolayers;
int autolayerindex;
inline void *pAutolayer(int i) const { return (((byte *)this) + autolayerindex) + i; };

int weightlistindex;
float *pBoneweight(int i) const { return ((float *)(((byte *)this) + weightlistindex) + i); };
float weight(int i) const { return *(pBoneweight(i)); };

int posekeyindex;
float *pPoseKey(int iParam, int iAnim) const { return (float *)(((byte *)this) + posekeyindex) + iParam * groupsize[0] + iAnim; }
float poseKey(int iParam, int iAnim) const { return *(pPoseKey(iParam, iAnim)); }

int numiklocks;
int iklockindex;
inline void *pIKLock(int i) const { return (((byte *)this) + iklockindex) + i; };

// Key values
int keyvalueindex;
int keyvaluesize;
inline const char * KeyValueText(void) const { return keyvaluesize != 0 ? ((char *)this) + keyvalueindex : NULL; }

int unused[3]; // remove/add as appropriate
};

struct mstudiohitboxset_t
{
int sznameindex;
inline char * const pszName(void) const { return ((char *)this) + sznameindex; }
int numhitboxes;
int hitboxindex;
inline mstudiobbox_t *pHitbox(int i) const { return (mstudiobbox_t *)(((byte *)this) + hitboxindex) + i; };
};

struct studiohdr_t
{
int id;
int version;

long checksum; // this has to be the same in the phy and vtx files to load!

char name[64];
int length;

Vector eyeposition; // ideal eye position

Vector illumposition; // illumination center

Vector hull_min; // ideal movement hull size
Vector hull_max;

Vector view_bbmin; // clipping bounding box
Vector view_bbmax;

int flags;

int numbones; // bones
int boneindex;
inline mstudiobone_t *pBone(int i) const { return (mstudiobone_t *)(((byte *)this) + boneindex) + i; };

int numbonecontrollers; // bone controllers
int bonecontrollerindex;
inline void *pBonecontroller(int i) const { return (((byte *)this) + bonecontrollerindex) + i; };

int numhitboxsets;
int hitboxsetindex;

// Look up hitbox set by index
mstudiohitboxset_t *pHitboxSet(int i) const
{
return (mstudiohitboxset_t *)(((byte *)this) + hitboxsetindex) + i;
};

// Calls through to hitbox to determine size of specified set
inline mstudiobbox_t *pHitbox(int i, int set) const
{
mstudiohitboxset_t *s = pHitboxSet(set);

if (!s)
return NULL;

return s->pHitbox(i);
};

// Calls through to set to get hitbox count for set
inline int iHitboxCount(int set) const
{
mstudiohitboxset_t const *s = pHitboxSet(set);
if (!s)
return 0;

return s->numhitboxes;
};

int numanim; // animations/poses
int animdescindex; // animation descriptions
inline void *pAnimdesc(int i) const { return (((byte *)this) + animdescindex) + i; };

int numanimgroup;
int animgroupindex;
inline void *pAnimGroup(int i) const { return (((byte *)this) + animgroupindex) + i; };

int numbonedesc;
int bonedescindex;
inline void *pBoneDesc(int i) const { return (((byte *)this) + bonedescindex) + i; };

int numseq; // sequences
int seqindex;
inline mstudioseqdesc_t *pSeqdesc(int i) const { if (i < 0 || i >= numseq) i = 0; return (mstudioseqdesc_t *)(((byte *)this) + seqindex) + i; };
int sequencesindexed; // initialization flag - have the sequences been indexed?

int numseqgroups; // demand loaded sequences
int seqgroupindex;
inline void *pSeqgroup(int i) const { return (((byte *)this) + seqgroupindex) + i; };

int numtextures; // raw textures
int textureindex;
inline void *pTexture(int i) const { return (((byte *)this) + textureindex) + i; };

int numcdtextures; // raw textures search paths
int cdtextureindex;
inline char *pCdtexture(int i) const { return (((char *)this) + *((int *)(((byte *)this) + cdtextureindex) + i)); };

int numskinref; // replaceable textures tables
int numskinfamilies;
int skinindex;
inline short *pSkinref(int i) const { return (short *)(((byte *)this) + skinindex) + i; };

int numbodyparts;
int bodypartindex;
inline void *pBodypart(int i) const { return (((byte *)this) + bodypartindex) + i; };

int numattachments; // queryable attachable points
int attachmentindex;
inline void *pAttachment(int i) const { return (((byte *)this) + attachmentindex) + i; };

int numtransitions; // animation node to animation node transition graph
int transitionindex;
inline byte *pTransition(int i) const { return (byte *)(((byte *)this) + transitionindex) + i; };

int numflexdesc;
int flexdescindex;
inline void *pFlexdesc(int i) const { return (((byte *)this) + flexdescindex) + i; };

int numflexcontrollers;
int flexcontrollerindex;
inline void *pFlexcontroller(int i) const { return (((byte *)this) + flexcontrollerindex) + i; };

int numflexrules;
int flexruleindex;
inline void *pFlexRule(int i) const { return (((byte *)this) + flexruleindex) + i; };

int numikchains;
int ikchainindex;
inline void *pIKChain(int i) const { return (((byte *)this) + ikchainindex) + i; };

int nummouths;
int mouthindex;
inline void *pMouth(int i) const { return (((byte *)this) + mouthindex) + i; };

int numposeparameters;
int poseparamindex;
inline void *pPoseParameter(int i) const { return (((byte *)this) + poseparamindex) + i; };

int surfacepropindex;
inline char * const pszSurfaceProp(void) const { return ((char *)this) + surfacepropindex; }

// Key values
int keyvalueindex;
int keyvaluesize;
inline const char * KeyValueText(void) const { return keyvaluesize != 0 ? ((char *)this) + keyvalueindex : NULL; }

int numikautoplaylocks;
int ikautoplaylockindex;
inline void *pIKAutoplayLock(int i) const { return (((byte *)this) + ikautoplaylockindex) + i; };

float mass; // The collision model mass that jay wanted
int contents;
int unused[9]; // remove as appropriate
};
struct model_t;
//0x3F00FB33
class CModelInfo
{
public:
studiohdr_t* GetStudioModel(const model_t* Model)
{

typedef studiohdr_t*(__thiscall* Fn)(void*, const model_t*);
return CallVFunction<Fn>(this, 32)(this, Model);

}
void GetModelRenderBounds(const model_t *model, Vector& mins, Vector& maxs)
{
typedef void(__thiscall* Fn)(void*, const model_t*, Vector&, Vector&);
return CallVFunction<Fn>(this, 7)(this, model, mins, maxs);
}
int GetModelIndex(const char* ModelName)
{
typedef int(__thiscall* OriginalFn)(PVOID, const char*);
return CallVFunction<OriginalFn>(this, 2)(this, ModelName);
}
const char* GetModelName(const model_t *model)
{
typedef const char* (__thiscall* OriginalFn)(PVOID, const model_t*);
return CallVFunction<OriginalFn>(this, 3)(this, model);
}
std::string GetModelNameString(const model_t* pModel)
{
typedef const char*(__thiscall* OriginalFn)(PVOID, const model_t*);
return std::string(CallVFunction< OriginalFn >(this, 3)(this, pModel));
}
void GetModelMaterials(const model_t *model, int count, IMaterial** ppMaterial)
{
typedef void(__thiscall* OriginalFn)(PVOID, const model_t*, int, IMaterial**);
CallVFunction<OriginalFn>(this, 17)(this, model, count, ppMaterial);
}/*
void SetMaterialVarFlag(MaterialVarFlags_t flag, bool on)
{
typedef void(__thiscall* OriginalFn)(PVOID, MaterialVarFlags_t, bool);
CallVFunction<OriginalFn>(this, 29)(this, flag, on);
}
void SetColorModulation(float const* blend)
{
typedef void(__thiscall* OriginalFn)(PVOID, float const*);
return CallVFunction<OriginalFn>(this, 6)(this, blend);
}*/
};
@@ -0,0 +1,2 @@
typedef void(__cdecl *MsgFn)(char const* pMsg, va_list);
extern void __cdecl Msg(char const* msg, ...);
@@ -0,0 +1,114 @@
#pragma once

#include <windows.h>
#define GetNetVarOffset(x, y){return g_pNetVars->GetOffset(x, y)}
struct offsets_t
{
public:




DWORD m_fThrowTime;
DWORD m_bPinPulled;

DWORD m_flC4Blow;
DWORD m_bBombDefused;
DWORD m_hOwnerEntity;

DWORD m_flPoseParameter;
DWORD m_flCycle;
DWORD m_nSequence;
DWORD m_flSimulationTime;
DWORD m_flAnimTime;
DWORD m_flLowerBodyYawTarget;
DWORD m_flFlashMaxAlpha;

DWORD m_vecBaseVelocity;
DWORD m_vecVelocity;
DWORD m_flFallVelocity;
DWORD m_flMaxspeed;
DWORD m_flStepSize;

DWORD m_bHasHelmet;
DWORD m_bHasHeavyArmor;
DWORD m_ArmorValue;

DWORD nWriteableBones;
DWORD m_angRotation;
DWORD dwOcclusionArray;
DWORD bDidCheckForOcclusion;
DWORD InvalidateBoneCache;

DWORD m_fAccuracyPenalty;
DWORD m_bReloadVisuallyComplete;
DWORD m_iPrimaryReserveAmmoCount;

DWORD m_CollisionGroup;

DWORD dw_CSPlayerResource;
DWORD m_iCompetetiveRanking;
DWORD m_iCompetetiveWins;
DWORD m_iKills;
DWORD m_iAssists;
DWORD m_iDeaths;
DWORD m_iPing;
DWORD m_iScore;
DWORD m_szClan;

DWORD m_vecOrigin;
DWORD m_vecViewOffset;
DWORD m_flNextPrimaryAttack;
DWORD m_nTickBase;

DWORD m_angEyeAngles;

DWORD m_hMyWearables;

DWORD m_flFriction;
DWORD m_fFlags;

DWORD m_hMyWeapons;
DWORD m_hActiveWeapon;

DWORD m_flMaxSpeed;

DWORD m_bGunGameImmunity;

DWORD m_flPostponeFireReadyTime;

DWORD m_iShotsFired;

DWORD m_bIsValveDS;

/*Skinchanger*/

DWORD m_iItemDefinitionIndex;
DWORD m_iItemIDHigh;
DWORD m_iItemIDLow;
DWORD m_iEntityQuality;
DWORD m_szCustomName;
DWORD m_OriginalOwnerXuidLow;
DWORD m_OriginalOwnerXuidHigh;
DWORD m_nFallbackPaintKit;
DWORD m_nFallbackSeed;
DWORD m_flFallbackWear;
DWORD m_nFallbackStatTrak;
DWORD m_nAccountID;

DWORD m_iViewModelIndex;
DWORD m_iWorldModelIndex;
DWORD m_hWeaponWorldModel;

DWORD m_nModeIndex;
DWORD m_hViewModel;
DWORD m_hWeapon;
DWORD m_bIsScoped;

DWORD dwLoadFromBuffer;
DWORD dwInitKeyValues;
};
extern void SetupOffsets();
extern offsets_t offys;
extern uint64_t FindPatternIDA(const char* szModule, const char* szSignature);
extern DWORD FindPattern(std::string moduleName, BYTE* Mask, char* szMask);
@@ -0,0 +1,10 @@
class CPanel
{
public:
const char* GetName( unsigned int Panel )
{
typedef const char*(__thiscall* Fn)(void*, unsigned int);
return CallVFunction<Fn>(this, 36)(this, Panel );
}

};
@@ -0,0 +1,184 @@
#define PHYSICS_MULTIPLAYER_AUTODETECT 0 // use multiplayer physics mode as defined in model prop data

#define PHYSICS_MULTIPLAYER_SOLID 1 // soild, pushes player away

#define PHYSICS_MULTIPLAYER_NON_SOLID 2 // nonsolid, but pushed by player

#define PHYSICS_MULTIPLAYER_CLIENTSIDE 3 // Clientside only, nonsolid
enum Collision_Group_t
{
COLLISION_GROUP_NONE = 0,
COLLISION_GROUP_DEBRIS, // Collides with nothing but world and static stuff
COLLISION_GROUP_DEBRIS_TRIGGER, // Same as debris, but hits triggers
COLLISION_GROUP_INTERACTIVE_DEB, // RIS, // Collides with everything except other interactive debris or debris
COLLISION_GROUP_INTERACTIVE, // Collides with everything except interactive debris or debris
COLLISION_GROUP_PLAYER,
COLLISION_GROUP_BREAKABLE_GLASS,
COLLISION_GROUP_VEHICLE,
COLLISION_GROUP_PLAYER_MOVEMENT, // For HL2, same as Collision_Group_Player
COLLISION_GROUP_NPC, // Generic NPC group
COLLISION_GROUP_IN_VEHICLE, // for any entity inside a vehicle
COLLISION_GROUP_WEAPON, // for any weapons that need collision detection
COLLISION_GROUP_VEHICLE_CLIP, // vehicle clip brush to restrict vehicle movement
COLLISION_GROUP_PROJECTILE, // Projectiles!
COLLISION_GROUP_DOOR_BLOCKER, // Blocks entities not permitted to get near moving doors
COLLISION_GROUP_PASSABLE_DOOR, // Doors that the player shouldn't collide with
COLLISION_GROUP_DISSOLVING, // Things that are dissolving are in this group
COLLISION_GROUP_PUSHAWAY, // Nonsolid on client and server, pushaway in player code
COLLISION_GROUP_NPC_ACTOR, // Used so NPCs in scripts ignore the player.
LAST_SHARED_COLLISION_GROUP
};
struct surfacephysicsparams_t
{
float friction;
float elasticity; // collision elasticity - used to compute coefficient of restitution
float density; // physical density (in kg / m^3)
float thickness; // material thickness if not solid (sheet materials) in inches
float dampening;
};

struct surfaceaudioparams_t
{
float reflectivity; // like elasticity, but how much sound should be reflected by this surface
float hardnessFactor; // like elasticity, but only affects impact sound choices
float roughnessFactor; // like friction, but only affects scrape sound choices
float roughThreshold; // surface roughness > this causes "rough" scrapes, < this causes "smooth" scrapes
float hardThreshold; // surface hardness > this causes "hard" impacts, < this causes "soft" impacts
float hardVelocityThreshold; // collision velocity > this causes "hard" impacts, < this causes "soft" impacts
float highPitchOcclusion; //a value betweeen 0 and 100 where 0 is not occluded at all and 100 is silent (except for any additional reflected sound)
float midPitchOcclusion;
float lowPitchOcclusion;
};

struct surfacesoundnames_t
{
unsigned short stepleft;
unsigned short stepright;
unsigned short impactSoft;
unsigned short impactHard;
unsigned short scrapeSmooth;
unsigned short scrapeRough;
unsigned short bulletImpact;
unsigned short rolling;
unsigned short breakSound;
unsigned short strainSound;
};

struct surfacegameprops_t
{
public:
float maxSpeedFactor; //0x0000
float jumpFactor; //0x0004
char pad00[0x4]; //0x0008
float flPenetrationModifier; //0x000C
float flDamageModifier; //0x0010
unsigned short material; //0x0014
char pad01[0x3];

};//Size=0x0019

struct surfacedata_t
{
surfacephysicsparams_t physics;
surfaceaudioparams_t audio;
surfacesoundnames_t sounds;
surfacegameprops_t game;
};

class IPhysicsSurfaceProps
{
public:
/*virtual ~IPhysicsSurfaceProps(void) {}
virtual int ParseSurfaceData(const char *pFilename, const char *pTextfile) = 0;
virtual int SurfacePropCount(void) const = 0;
virtual int GetSurfaceIndex(const char *pSurfacePropName) const = 0;
virtual void GetPhysicsProperties(int surfaceDataIndex, float *density, float *thickness, float *friction, float *elasticity) const = 0;
virtual surfacedata_t* GetSurfaceData(int surfaceDataIndex) = 0;
virtual const char* GetString(unsigned short stringTableIndex) const = 0;
virtual const char* GetPropName(int surfaceDataIndex) const = 0;
virtual void SetWorldMaterialIndexTable(int *pMapArray, int mapSize) = 0;
virtual void GetPhysicsParameters(int surfaceDataIndex, surfacephysicsparams_t *pParamsOut) const = 0;*/

surfacedata_t *GetSurfaceData(int surfaceDataIndex)
{
typedef surfacedata_t*(__thiscall* fnGetSurfaceData)(void*, int);
return CallVFunction<fnGetSurfaceData>(this, 5)(this, surfaceDataIndex);
}
};

class IMultiplayerPhysics
{
public:
virtual int GetMultiplayerPhysicsMode(void) = 0;
virtual float GetMass(void) = 0;
virtual bool IsAsleep(void) = 0;
};
enum mp_break_t
{
MULTIPLAYER_BREAK_DEFAULT,
MULTIPLAYER_BREAK_SERVERSIDE,
MULTIPLAYER_BREAK_CLIENTSIDE,
MULTIPLAYER_BREAK_BOTH
};
enum propdata_interactions_t
{
PROPINTER_PHYSGUN_WORLD_STICK, // "onworldimpact" "stick"
PROPINTER_PHYSGUN_FIRST_BREAK, // "onfirstimpact" "break"
PROPINTER_PHYSGUN_FIRST_PAINT, // "onfirstimpact" "paintsplat"
PROPINTER_PHYSGUN_FIRST_IMPALE, // "onfirstimpact" "impale"
PROPINTER_PHYSGUN_LAUNCH_SPIN_NONE, // "onlaunch" "spin_none"
PROPINTER_PHYSGUN_LAUNCH_SPIN_Z, // "onlaunch" "spin_zaxis"
PROPINTER_PHYSGUN_BREAK_EXPLODE, // "onbreak" "explode_fire"
PROPINTER_PHYSGUN_DAMAGE_NONE, // "damage" "none"
PROPINTER_FIRE_FLAMMABLE, // "flammable" "yes"
PROPINTER_FIRE_EXPLOSIVE_RESIST, // "explosive_resist" "yes"
PROPINTER_FIRE_IGNITE_HALFHEALTH, // "ignite" "halfhealth"
PROPINTER_PHYSGUN_CREATE_FLARE, // "onpickup" "create_flare"
PROPINTER_PHYSGUN_ALLOW_OVERHEAD, // "allow_overhead" "yes"
PROPINTER_WORLD_BLOODSPLAT, // "onworldimpact", "bloodsplat"
PROPINTER_PHYSGUN_NOTIFY_CHILDREN, // "onfirstimpact" cause attached flechettes to explode
PROPINTER_NUM_INTERACTIONS, // If we get more than 32 of these, we'll need a different system
};
class IBreakableWithPropData
{
public:
// Damage modifiers
virtual void SetDmgModBullet(float flDmgMod) = 0;
virtual void SetDmgModClub(float flDmgMod) = 0;
virtual void SetDmgModExplosive(float flDmgMod) = 0;
virtual float GetDmgModBullet(void) = 0;
virtual float GetDmgModClub(void) = 0;
virtual float GetDmgModExplosive(void) = 0;
// Explosive
virtual void SetExplosiveRadius(float flRadius) = 0;
virtual void SetExplosiveDamage(float flDamage) = 0;
virtual float GetExplosiveRadius(void) = 0;
virtual float GetExplosiveDamage(void) = 0;
// Physics damage tables
virtual void SetPhysicsDamageTable(char* iszTableName) = 0;
virtual char* GetPhysicsDamageTable(void) = 0;
// Breakable chunks
virtual void SetBreakableModel(char* iszModel) = 0;
virtual char* GetBreakableModel(void) = 0;
virtual void SetBreakableSkin(int iSkin) = 0;
virtual int GetBreakableSkin(void) = 0;
virtual void SetBreakableCount(int iCount) = 0;
virtual int GetBreakableCount(void) = 0;
virtual void SetMaxBreakableSize(int iSize) = 0;
virtual int GetMaxBreakableSize(void) = 0;
// LOS blocking
virtual void SetPropDataBlocksLOS(bool bBlocksLOS) = 0;
virtual void SetPropDataIsAIWalkable(bool bBlocksLOS) = 0;
// Interactions
virtual void SetInteraction(propdata_interactions_t Interaction) = 0;
virtual bool HasInteraction(propdata_interactions_t Interaction) = 0;
// Multi player physics mode
virtual void SetPhysicsMode(int iMode) = 0;
virtual int GetPhysicsMode() = 0;
// Multi player breakable spawn behavior
virtual void SetMultiplayerBreakMode(mp_break_t mode) = 0;
virtual mp_break_t GetMultiplayerBreakMode(void) const = 0;
// Used for debugging
virtual void SetBasePropData(char* iszBase) = 0;
virtual char* GetBasePropData(void) = 0;
};
@@ -0,0 +1,19 @@

typedef struct player_info_s {
private:
DWORD __pad0[2];
public:
int m_nXuidLow;
int m_nXuidHigh;
char m_szPlayerName[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;
@@ -0,0 +1,13 @@
class Quaternion
{
public:
float x, y, z, w;
float operator[](int i) const { if (i == 1) return x; if (i == 2) return y; if (y == 3) return z; return w; };
float& operator[](int i) { if (i == 1) return x; if (i == 2) return y; if (y == 3) return z; return w; };
};

class RadianEuler
{
public:
float x, y, z;
};

Large diffs are not rendered by default.

@@ -0,0 +1,365 @@

#include <math.h>
enum TraceType_t
{
TRACE_EVERYTHING = 0,
TRACE_WORLD_ONLY,
TRACE_ENTITIES_ONLY,
TRACE_EVERYTHING_FILTER_PROPS,
};
struct cplane_t
{
Vector normal;
float dist;
BYTE type;
BYTE signbits;
BYTE pad[2];
};
struct csurface_t
{
const char* name;
short surfaceProps;
unsigned short flags;
};


class CBaseTrace
{
public:
Vector startpos;
Vector endpos;
cplane_t plane;
float fraction;
int contents;
unsigned short dispFlags;
bool allsolid;
bool startsolid;
};



class CGameTrace : public CBaseTrace
{
public:


float fractionleftsolid; // time we left a solid, only valid if we started in solid
csurface_t surface; // surface hit (impact surface)

int hitgroup; // 0 == generic, non-zero is specific body part

short physicsbone; // physics bone hit by trace in studio
unsigned short worldSurfaceIndex; // Index of the msurface2_t, if applicable

CBaseEntity* m_pEnt;
int hitbox;

bool DidHitWorld() const;


bool DidHitNonWorldCBaseEntity() const;

bool DidHit() const;


};

struct trace_t
{
Vector start;
Vector endpos;
cplane_t plane;
float fraction;
int contents;
WORD dispFlags;
bool allSolid;
bool startSolid;
float fractionLeftSolid;
csurface_t surface;
int hitgroup;
short physicsBone;
WORD m_nWorldSurfaceIndex;
CBaseEntity* m_pEnt;
int hitbox;
};

typedef float vec_t;
class VectorAligned : public Vector
{
public:
inline VectorAligned(void) {};
inline VectorAligned(vec_t X, vec_t Y, vec_t Z)
{
// Init(X,Y,Z);
// X = 0.0f; Y=0.0f ;Z =0.0f;
}

#ifdef VECTOR_NO_SLOW_OPERATIONS

private:
// No copy constructors allowed if we're in optimal mode
VectorAligned(const VectorAligned& vOther);
VectorAligned(const Vector &vOther);

#else
public:
explicit VectorAligned(const Vector &vOther)
{
// Init(vOther.X, vOther.Y, vOther.Z);
// vOther.X=0.0f;vOther.Y=0.0f;vOther.Z =0.0;
}

VectorAligned& operator=(const Vector &vOther)
{
// Init(vOther.X, vOther.Y, vOther.Z);
x = vOther.x; y = vOther.y; z = vOther.z;
return *this;
}

#endif
float w; // this space is used anyway
};
struct Ray_t {
VectorAligned m_Start; // starting point, centered within the extents
VectorAligned m_Delta; // direction + length of the ray
VectorAligned m_StartOffset; // Add this to m_Start to get the actual ray start
VectorAligned m_Extents; // Describes an axis aligned box extruded along a ray
const matrix3x4_t *m_pWorldAxisTransform;
bool m_IsRay; // are the extents zero?
bool m_IsSwept; // is delta != 0?

Ray_t() : m_pWorldAxisTransform(NULL) {}

void Init(Vector const& start, Vector const& end) {
m_Delta = end - start;

m_IsSwept = (m_Delta.LengthSqr() != 0);

m_Extents.Init();

m_pWorldAxisTransform = NULL;
m_IsRay = true;

// Offset m_Start to be in the center of the box...
m_StartOffset.Init();
VectorCopy(start, m_Start);
}

void Init(Vector const& start, Vector const& end, Vector const& mins, Vector const& maxs) {
m_Delta = end - start;

m_pWorldAxisTransform = NULL;
m_IsSwept = (m_Delta.LengthSqr() != 0);

m_Extents = maxs - mins;
m_Extents *= 0.5f;
m_IsRay = (m_Extents.LengthSqr() < 1e-6);

// Offset m_Start to be in the center of the box...
m_StartOffset = maxs + mins;
m_StartOffset *= 0.5f;
m_Start = start + m_StartOffset;
m_StartOffset *= -1.0f;
}
Vector InvDelta() const {
Vector vecInvDelta;
for (int iAxis = 0; iAxis < 3; ++iAxis) {
if (m_Delta[iAxis] != 0.0f) {
vecInvDelta[iAxis] = 1.0f / m_Delta[iAxis];
}
else {
vecInvDelta[iAxis] = FLT_MAX;
}
}
return vecInvDelta;
}

private:
};
class ITraceFilter
{
public:
virtual bool ShouldHitCBaseEntity(CBaseEntity *pCBaseEntity, int contentsMask) = 0;
virtual TraceType_t GetTraceType() const = 0;
};

class CTraceFilterWorldAndPropsOnly : public ITraceFilter
{
public:
bool ShouldHitCBaseEntity(CBaseEntity* pCBaseEntityHandle, int contentsMask)
{
return false;
}
virtual TraceType_t GetTraceType() const
{
return TRACE_EVERYTHING;
}
};

class CTraceWorldOnly : public ITraceFilter
{
public:
bool ShouldHitCBaseEntity(CBaseEntity* pCBaseEntityHandle, int contentsMask)
{
return false;
}

TraceType_t GetTraceType() const
{
return TRACE_WORLD_ONLY;
}
};

class CTraceFilter : public ITraceFilter
{
public:
bool ShouldHitCBaseEntity(CBaseEntity* pCBaseEntityHandle, int contentsMask)
{
return !(pCBaseEntityHandle == pSkip);
}

virtual TraceType_t GetTraceType() const
{
return TRACE_EVERYTHING;
}

void* pSkip;
};
class CTraceCBaseEntity : public ITraceFilter
{
public:
bool ShouldHitCBaseEntity(CBaseEntity* pCBaseEntityHandle, int contentsMask)
{
return (pCBaseEntityHandle == pHit);
}
virtual TraceType_t GetTraceType() const
{
return TRACE_ENTITIES_ONLY;
}
void* pHit;
};
class CTraceFilterNoPlayer : public CTraceFilter
{
public:
CTraceFilterNoPlayer() {}
virtual bool ShouldHitCBaseEntity(CBaseEntity *pServerCBaseEntity, int contentsMask)
{
if (pServerCBaseEntity)
return !pServerCBaseEntity->IsPlayer();
return false;
}
};
class CEngineTrace
{
public:

void TraceRay(const Ray_t &ray, unsigned int fMask, CTraceFilter *pTraceFilter, trace_t *pTrace)
{
typedef void(__thiscall* oTraceRay)(PVOID, const Ray_t&, unsigned int, CTraceFilter *, trace_t*);
CallVFunction<oTraceRay>(this, 5)(this, ray, fMask, pTraceFilter, pTrace);
}
void TraceRay_NEW(const Ray_t &ray, unsigned int fMask, ITraceFilter* pTraceFilter, trace_t* pTrace)
{
typedef void(__thiscall* oTraceRay)(void*, const Ray_t&, unsigned int, ITraceFilter*, trace_t*);
CallVFunction<oTraceRay>(this, 5)(this, ray, fMask, pTraceFilter, pTrace);
}
void ClipRayToCBaseEntity(const Ray_t& ray, unsigned int nMask, CBaseEntity* pCBaseEntity, trace_t* pTrace)
{
typedef void(__thiscall* oClipRayToTrace)(PVOID, const Ray_t&, unsigned int, CBaseEntity*, trace_t*);
CallVFunction<oClipRayToTrace>(this, 3)(this, ray, nMask, pCBaseEntity, pTrace);
}
void CBaseEntityTraceRay(const Ray_t &ray, unsigned int fMask, CTraceCBaseEntity *pTraceFilter, trace_t *pTrace)
{
typedef void(__thiscall* oTraceRay)(PVOID, const Ray_t&, unsigned int, CTraceCBaseEntity*, trace_t*);
CallVFunction<oTraceRay>(this, 5)(this, ray, fMask, pTraceFilter, pTrace);
}
int GetPointContents(const Vector &vecAbsPosition, int contentsMask = MASK_ALL, CBaseEntity* ppCBaseEntity = NULL)
{
typedef int(__thiscall* fnGetPointContents)(void*, const Vector&, int, CBaseEntity*);
return CallVFunction<fnGetPointContents>(this, 0)(this, vecAbsPosition, contentsMask, ppCBaseEntity);
}
void BestPointX(CBaseEntity *targetPlayer, Vector &final, bool negative, float pointscale)
{
trace_t tr;
Ray_t ray;
CTraceCBaseEntity* filter = new CTraceCBaseEntity();

float Hit = 10 / 100;
Hit *= pointscale;

if (negative)
Hit *= -1;

filter->pHit = targetPlayer;
ray.Init(final + Vector(Hit, 0, 0), final);
CBaseEntityTraceRay(ray, MASK_SHOT, filter, &tr);

final = tr.endpos;

}
void BestPointY(CBaseEntity *targetPlayer, Vector &final, bool negative, float pointscale)
{
trace_t tr;
Ray_t ray;
CTraceCBaseEntity* filter = new CTraceCBaseEntity();

float Hit = 10 / 100;
Hit *= pointscale;

if (negative)
Hit *= -1;

filter->pHit = targetPlayer;
ray.Init(final + Vector(0, Hit, 0), final);
CBaseEntityTraceRay(ray, MASK_SHOT, filter, &tr);

final = tr.endpos;
}
void BestPointZ(CBaseEntity *targetPlayer, Vector &final, bool negative, float pointscale)
{
trace_t tr;
Ray_t ray;
CTraceCBaseEntity* filter = new CTraceCBaseEntity();

float Hit = 10 / 100;
Hit *= pointscale;

if (negative)
Hit *= -1;

filter->pHit = targetPlayer;
ray.Init(final + Vector(0, 0, Hit), final);
CBaseEntityTraceRay(ray, MASK_SHOT, filter, &tr);

final = tr.endpos;
}
bool IsVisible(CBaseEntity* pLocalClientBaseCBaseEntity, Vector vecOrigin, Vector vecFinal, CBaseEntity* pClientBaseCBaseEntity)
{
Ray_t ray;
ray.Init(vecOrigin, vecFinal);

CTraceFilter TraceFilter;
TraceFilter.pSkip = pLocalClientBaseCBaseEntity;

trace_t trace;
TraceRay(ray, MASK_SHOT, &TraceFilter, &trace);

return (trace.m_pEnt == pClientBaseCBaseEntity || trace.fraction >= 1.0f);
}
bool IsVisible(CBaseEntity* pLocalClientBaseCBaseEntity, Vector vecOrigin, Vector vecFinal, CBaseEntity* pClientBaseCBaseEntity, int& hitgroup)
{
Ray_t ray;
ray.Init(vecOrigin, vecFinal);

CTraceFilter* TraceFilter = new CTraceFilter();
TraceFilter->pSkip = pLocalClientBaseCBaseEntity;

trace_t trace;
TraceRay(ray, MASK_SHOT, TraceFilter, &trace);
hitgroup = trace.hitgroup;
delete TraceFilter;
return (trace.m_pEnt == pClientBaseCBaseEntity || trace.fraction >= 1.0f);
}

};

@@ -0,0 +1,64 @@
#pragma once
#include "crc32.h"
class CUserCmd
{
public:
CRC32_t GetChecksum(void)
{
CRC32_t crc;

gCRC.CRC32_Init(&crc);
gCRC.CRC32_ProcessBuffer(&crc, &command_number, sizeof(command_number));
gCRC.CRC32_ProcessBuffer(&crc, &tick_count, sizeof(tick_count));
gCRC.CRC32_ProcessBuffer(&crc, &viewangles, sizeof(viewangles));
gCRC.CRC32_ProcessBuffer(&crc, &aimdirection, sizeof(aimdirection));
gCRC.CRC32_ProcessBuffer(&crc, &forwardmove, sizeof(forwardmove));
gCRC.CRC32_ProcessBuffer(&crc, &sidemove, sizeof(sidemove));
gCRC.CRC32_ProcessBuffer(&crc, &upmove, sizeof(upmove));
gCRC.CRC32_ProcessBuffer(&crc, &buttons, sizeof(buttons));
gCRC.CRC32_ProcessBuffer(&crc, &impulse, sizeof(impulse));
gCRC.CRC32_ProcessBuffer(&crc, &weaponselect, sizeof(weaponselect));
gCRC.CRC32_ProcessBuffer(&crc, &weaponsubtype, sizeof(weaponsubtype));
gCRC.CRC32_ProcessBuffer(&crc, &random_seed, sizeof(random_seed));
gCRC.CRC32_ProcessBuffer(&crc, &mousedx, sizeof(mousedx));
gCRC.CRC32_ProcessBuffer(&crc, &mousedy, sizeof(mousedy));
//CRC32_ProcessBuffer( &crc, &hasbeenpredicted, sizeof( hasbeenpredicted ) );
//CRC32_ProcessBuffer( &crc, &headangles, sizeof( headangles ) );
//CRC32_ProcessBuffer( &crc, &headoffset, sizeof( headoffset ) );
gCRC.CRC32_Final(&crc);

return crc;
}
char pad_0x0000[0x4]; //0x0000
int command_number; // 0x04 For matching server and client commands for debugging
int tick_count; // 0x08 the tick the client created this command
QAngle viewangles; // 0x0C Player instantaneous view angles.
Vector aimdirection; // 0x18
float forwardmove; // 0x24
float sidemove; // 0x28
float upmove; // 0x2C
int buttons; // 0x30 Attack button states
byte impulse; // 0x34
int weaponselect; // 0x38 Current weapon id
int weaponsubtype; // 0x3C
int random_seed; // 0x40 For shared random functions
short mousedx; // 0x44 mouse accum in x from create move
short mousedy; // 0x46 mouse accum in y from create move
bool hasbeenpredicted; // 0x48 Client only, tracks whether we've predicted this command at least once
char pad_0x4C[0x18]; // 0x4C Current sizeof( usercmd ) = 100 = 0x64

};
/*
class CVerifiedUserCmd
{
public:
void* m_cmd; //0x0000
__int32 m_crc; //0x0004
};//Size=0x0008*/
class CVerifiedUserCmd
{
public:
CUserCmd m_cmd;
unsigned long m_crc;
};