Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef SDK_H
- #define SDK_H
- #include "Math.h"
- #include "WinCustom.h"
- #include "CRC32.h"
- #include "dt_recv.h"
- #include "checksum_crc.h"
- #include "checksum_md5.h"
- typedef void* (*CreateInterfaceFn)( const char*, int* );
- #undef CreateFont
- #define clamp(val, min, max) (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val)))
- #define CHAR_TEX_CONCRETE 'C'
- #define CHAR_TEX_METAL 'M'
- #define CHAR_TEX_DIRT 'D'
- #define CHAR_TEX_VENT 'V'
- #define CHAR_TEX_GRATE 'G'
- #define CHAR_TEX_TILE 'T'
- #define CHAR_TEX_SLOSH 'S'
- #define CHAR_TEX_WOOD 'W'
- #define CHAR_TEX_COMPUTER 'P'
- #define CHAR_TEX_GLASS 'Y'
- #define CHAR_TEX_FLESH 'F'
- #define CHAR_TEX_BLOODYFLESH 'B'
- #define CHAR_TEX_CLIP 'I'
- #define CHAR_TEX_ANTLION 'A'
- #define CHAR_TEX_ALIENFLESH 'H'
- #define CHAR_TEX_FOLIAGE 'O'
- #define CHAR_TEX_SAND 'N'
- #define CHAR_TEX_PLASTIC 'L'
- #define IN_ATTACK ( 1 << 0 )
- #define IN_JUMP ( 1 << 1 )
- #define IN_DUCK ( 1 << 2 )
- #define FL_ONGROUND ( 1 << 0 )
- #define FL_DUCKING ( 1 << 1 )
- enum WeaponId_t
- {
- WEAPON_CSBASE = 0,
- WEAPON_P228,
- WEAPON_GLOCK,
- WEAPON_SCOUT,
- WEAPON_HEGRENADE,
- WEAPON_XM1014,
- WEAPON_C4,
- WEAPON_MAC10,
- WEAPON_AUG,
- WEAPON_SMOKEGRENADE,
- WEAPON_ELITE,
- WEAPON_FIVESEVEN,
- WEAPON_UMP45,
- WEAPON_SG550,
- WEAPON_GALIL,
- WEAPON_FAMAS,
- WEAPON_USP,
- WEAPON_AWP,
- WEAPON_MP5,
- WEAPON_M249,
- WEAPON_M3,
- WEAPON_M4A1,
- WEAPON_TMP,
- WEAPON_G3SG1,
- WEAPON_FLASHBANG,
- WEAPON_DEAGLE,
- WEAPON_SG552,
- WEAPON_AK47,
- WEAPON_KNIFE,
- WEAPON_P90,
- WEAPON_SHIELD,
- WEAPON_KEVLAR,
- WEAPON_ASSAULTSUIT,
- WEAPON_NIGHTVISION
- };
- class CSPlayer;
- class CSWeapon;
- class model_t;
- struct player_info_t
- {
- char name[32];
- int userID;
- char guid[32 + 1];
- unsigned int friendsID;
- char friendsName[32];
- bool fakeplayer;
- bool ishltv;
- unsigned long customFiles[4];
- unsigned char filesDownloaded;
- };
- struct surfacephysicsparams_t
- {
- float friction;
- float elasticity;
- float density;
- float thickness;
- float dampening;
- };
- struct surfaceaudioparams_t
- {
- float reflectivity;
- float hardnessFactor;
- float roughnessFactor;
- float roughThreshold;
- float hardThreshold;
- float hardVelocityThreshold;
- };
- 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 surfacesoundhandles_t
- {
- short stepleft;
- short stepright;
- short impactSoft;
- short impactHard;
- short scrapeSmooth;
- short scrapeRough;
- short bulletImpact;
- short rolling;
- short breakSound;
- short strainSound;
- };
- struct surfacegameprops_t
- {
- float maxSpeedFactor;
- float jumpFactor;
- unsigned short material;
- unsigned char climbable;
- unsigned char pad;
- };
- struct surfacedata_t
- {
- surfacephysicsparams_t physics;
- surfaceaudioparams_t audio;
- surfacesoundnames_t sounds;
- surfacegameprops_t game;
- surfacesoundhandles_t soundhandles;
- };
- struct mstudiobbox_t
- {
- int bone;
- int group;
- Vector bbmin;
- Vector bbmax;
- int szhitboxnameindex;
- int unused[8];
- char* pszHitboxName( )
- {
- if( szhitboxnameindex == 0 )
- return "";
- return ( ( char* )this ) + szhitboxnameindex;
- }
- };
- 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
- {
- unsigned char pad[0xAC];
- int numhitboxsets;
- int hitboxsetindex;
- mstudiohitboxset_t* pHitboxSet( int i ) const
- {
- return ( mstudiohitboxset_t* )( ( ( byte* )this ) + hitboxsetindex ) + i;
- };
- inline mstudiobbox_t* pHitbox( int i, int set ) const
- {
- mstudiohitboxset_t const* s = pHitboxSet( set );
- if( !s )
- return NULL;
- return s->pHitbox( i );
- };
- inline int iHitboxCount( int set ) const
- {
- mstudiohitboxset_t const* s = pHitboxSet( set );
- if( !s )
- return 0;
- return s->numhitboxes;
- };
- };
- class CUserCmd
- {
- public:
- virtual ~CUserCmd () {};
- int command_number;
- int tick_count;
- Vector viewangles;
- float forwardmove;
- float sidemove;
- float upmove;
- int buttons;
- BYTE impulse;
- int weaponselect;
- int weaponsubtype;
- int random_seed;
- short mousedx;
- short mousedy;
- bool hasbeenpredicted;
- CRC32_t GetChecksum ()
- {
- return CRC32_ProcessSingleBuffer ( &*this, sizeof(CUserCmd) );
- }
- };
- class CGlobalVarsBase
- {
- public:
- float realtime;
- int framecount;
- float absoluteframetime;
- float curtime;
- float frametime;
- int maxClients;
- int tickcount;
- float interval_per_tick;
- float interpolation_amount;
- int simTicksThisFrame;
- int network_protocol;
- };
- class ClientClass
- {
- public:
- const char __pad0[ 0x8 ];
- const char *m_pNetworkName;
- RecvTable *m_pRecvTable;
- ClientClass *m_pNext;
- int m_ClassID;
- };
- class IBaseClientDLL
- {
- public:
- ClientClass* GetAllClasses( )
- {
- typedef ClientClass* ( __thiscall* GetAllClassesFn )( PVOID );
- return GetMethod< GetAllClassesFn >( this, 8 )( this );
- }
- };
- class IClientEntityList
- {
- public:
- CSPlayer* GetClientEntity( int nIndex )
- {
- typedef CSPlayer* ( __thiscall* GetClientEntityFn )( PVOID, int );
- return GetMethod< GetClientEntityFn >( this, 3 )( this, nIndex );
- }
- CSWeapon* GetClientEntityFromHandle( int nHandle )
- {
- typedef CSWeapon* ( __thiscall* GetClientEntityFromHandleFn )( PVOID, int );
- return GetMethod< GetClientEntityFromHandleFn >( this, 4 )( this, nHandle );
- }
- int GetHighestEntityIndex( )
- {
- typedef int ( __thiscall* GetHighestEntityIndexFn )( PVOID );
- return GetMethod< GetHighestEntityIndexFn >( this, 6 )( this );
- }
- };
- class CVerifiedUserCmd
- {
- public:
- CUserCmd m_cmd;
- DWORD_PTR m_crc;
- };
- class CInput
- {
- public:
- CUserCmd* GetUserCmd( int sequence_number )
- {
- typedef CUserCmd* ( __thiscall* GetUserCmdFn )( PVOID, int );
- return GetMethod< GetUserCmdFn >( this, 8 )( this, sequence_number );
- }
- CVerifiedUserCmd* GetVerifiedCmd ( int sequence_number )
- {
- return &m_pVerified[ sequence_number % 90 ];
- }
- char __pad0[ 0xC4 ];
- CUserCmd* m_pCmd;
- CVerifiedUserCmd* m_pVerified;
- };
- class IVModelInfoClient
- {
- public:
- const char* GetModelName( const model_t* model )
- {
- typedef const char* ( __thiscall* GetModelNameFn )( PVOID, const model_t* );
- return GetMethod< GetModelNameFn >( this, 3 )( this, model );
- }
- studiohdr_t* GetStudiomodel( const model_t* mod )
- {
- typedef studiohdr_t* ( __thiscall* GetStudiomodelFn )( PVOID, const model_t* );
- return GetMethod< GetStudiomodelFn >( this, 28 )( this, mod );
- }
- };
- class IVEngineClient
- {
- public:
- void GetScreenSize( int& width, int& height )
- {
- typedef void ( __thiscall* GetScreenSizeFn )( PVOID, int&, int& );
- GetMethod< GetScreenSizeFn >( this, 5 )( this, width, height );
- }
- bool GetPlayerInfo( int ent_num, player_info_t *pinfo )
- {
- typedef bool ( __thiscall* GetPlayerInfoFn )( PVOID, int, player_info_t* );
- return GetMethod< GetPlayerInfoFn >( this, 8 )( this, ent_num, pinfo );
- }
- int GetLocalPlayer( )
- {
- typedef int ( __thiscall* GetLocalPlayerFn )( PVOID );
- return GetMethod< GetLocalPlayerFn >( this, 12 )( this );
- }
- void GetViewAngles( Vector& va )
- {
- typedef void ( __thiscall* GetViewAnglesFn )( PVOID, Vector& );
- GetMethod< GetViewAnglesFn >( this, 19 )( this, va );
- }
- void SetViewAngles( Vector& va )
- {
- typedef void ( __thiscall* SetViewAnglesFn )( PVOID, Vector& );
- GetMethod< SetViewAnglesFn >( this, 20 )( this, va );
- }
- int GetMaxClients( void )
- {
- typedef int ( __thiscall* GetMaxClientsFn )( PVOID );
- return GetMethod< GetMaxClientsFn >( this, 21 )( this );
- }
- const VMatrix& WorldToScreenMatrix( )
- {
- typedef const VMatrix& ( __thiscall* WorldToScreenMatrixFn )( PVOID );
- return GetMethod< WorldToScreenMatrixFn >( this, 36 )( this );
- }
- };
- struct Ray_t
- {
- VectorAligned m_Start;
- VectorAligned m_Delta;
- VectorAligned m_StartOffset;
- VectorAligned m_Extents;
- bool m_IsRay;
- bool m_IsSwept;
- void Init( Vector& vecStart, Vector& vecEnd )
- {
- m_Delta = vecEnd - vecStart;
- m_IsSwept = ( m_Delta.LengthSqr( ) != 0 );
- m_Extents.x = m_Extents.y = m_Extents.z = 0.0f;
- m_IsRay = true;
- m_StartOffset.x = m_StartOffset.y = m_StartOffset.z = 0.0f;
- m_Start = vecStart;
- }
- };
- struct cplane_t
- {
- Vector normal;
- float dist;
- BYTE type;
- BYTE signbits;
- BYTE pad[2];
- };
- class CBaseTrace
- {
- public:
- Vector startpos;
- Vector endpos;
- cplane_t plane;
- float fraction;
- int contents;
- unsigned short dispFlags;
- bool allsolid;
- bool startsolid;
- };
- struct csurface_t
- {
- const char* name;
- short surfaceProps;
- unsigned short flags;
- };
- class CGameTrace : public CBaseTrace
- {
- public:
- bool DidHitWorld( ) const;
- bool DidHitNonWorldEntity( ) const;
- int GetEntityIndex( ) const;
- bool DidHit( ) const;
- public:
- float fractionleftsolid;
- csurface_t surface;
- int hitgroup;
- short physicsbone;
- CSPlayer* m_pEnt;
- int hitbox;
- };
- inline bool CGameTrace::DidHit( ) const
- {
- return fraction < 1.0f || allsolid || startsolid;
- }
- typedef CGameTrace trace_t;
- enum TraceType_t
- {
- TRACE_EVERYTHING = 0,
- TRACE_WORLD_ONLY,
- TRACE_ENTITIES_ONLY,
- TRACE_EVERYTHING_FILTER_PROPS,
- };
- class ITraceFilter
- {
- public:
- virtual bool ShouldHitEntity( PVOID pEntity, int contentsMask ) = 0;
- virtual TraceType_t GetTraceType( ) const = 0;
- };
- class IEngineTrace
- {
- public:
- virtual int GetPointContents( const Vector &vecAbsPosition, void** ppEntity = NULL ) = 0;
- virtual int __pad0( ) = 0;
- virtual void ClipRayToEntity( const Ray_t &ray, unsigned int fMask, CSPlayer* pEnt, trace_t* pTrace ) = 0;
- void TraceRay( const Ray_t& ray, unsigned int flMask, ITraceFilter* pTraceFilter, trace_t* pTrace )
- {
- typedef void ( __thiscall* TraceRayFn )( PVOID, const Ray_t&, unsigned int, ITraceFilter*, trace_t* );
- GetMethod< TraceRayFn >( this, 4 )( this, ray, flMask, pTraceFilter, pTrace );
- }
- };
- class IPanel
- {
- public:
- const char* GetName( unsigned int vguiPanel )
- {
- typedef const char* ( __thiscall* GetPanelNameFn )( void*, unsigned int );
- return GetMethod< GetPanelNameFn >( this, 36 )( this, vguiPanel );
- }
- };
- class ISurface
- {
- public:
- void DrawSetColor( int r, int g, int b, int a )
- {
- typedef void ( __thiscall* DrawSetColorFn )( PVOID, int, int, int, int );
- GetMethod< DrawSetColorFn >( this, 11 )( this, r, g, b, a );
- }
- void DrawFilledRect( int x0, int y0, int x1, int y1 )
- {
- typedef void ( __thiscall* DrawFilledRectFn )( PVOID, int, int, int, int );
- GetMethod< DrawFilledRectFn >( this, 12 )( this, x0, y0, x1, y1 );
- }
- void DrawOutlinedRect( int x0, int y0, int x1, int y1 )
- {
- typedef void ( __thiscall* DrawOutlinedFn )( PVOID, int, int, int, int );
- GetMethod< DrawOutlinedFn >( this, 14 )( this, x0, y0, x1, y1 );
- }
- void DrawLine( int x0, int y0, int x1, int y1 )
- {
- typedef void ( __thiscall* DrawLineFn )( PVOID, int, int, int, int );
- GetMethod< DrawLineFn >( this, 15 )( this, x0, y0, x1, y1 );
- }
- void DrawSetTextFont( unsigned long font )
- {
- typedef void ( __thiscall* DrawSetTextFontFn )( PVOID, unsigned long );
- GetMethod< DrawSetTextFontFn >( this, 17 )( this, font );
- }
- void DrawSetTextColor( int r, int g, int b, int a )
- {
- typedef void ( __thiscall* DrawSetTextColorFn )( PVOID, int, int, int, int );
- GetMethod< DrawSetTextColorFn >( this, 19 )( this, r, g, b, a );
- }
- void DrawSetTextPos( int x, int y )
- {
- typedef void ( __thiscall* DrawSetTextPosFn )( PVOID, int, int );
- GetMethod< DrawSetTextPosFn >( this, 20 )( this, x, y );
- }
- void DrawPrintText( const wchar_t* text, int textLen )
- {
- typedef void ( __thiscall* DrawPrintTextFn )( PVOID, const wchar_t*, int, int );
- return GetMethod< DrawPrintTextFn >( this, 22 )( this, text, textLen, 0 );
- }
- unsigned long CreateFont( )
- {
- typedef unsigned int ( __thiscall* CreateFontFn )( PVOID );
- return GetMethod< CreateFontFn >( this, 66 )( this );
- }
- void SetFontGlyphSet( unsigned long font, const char* windowsFontName, int tall, int weight, int blur, int scanlines, int flags )
- {
- typedef void ( __thiscall* SetFontGlyphSetFn )( PVOID, unsigned long, const char*, int, int, int, int, int, int, int );
- GetMethod< SetFontGlyphSetFn >( this, 67 )( this, font, windowsFontName, tall, weight, blur, scanlines, flags, 0, 0 );
- }
- void GetTextSize( unsigned long font, const wchar_t* text, int& wide, int& tall )
- {
- typedef void ( __thiscall* GetTextSizeFn )( PVOID, unsigned long, const wchar_t*, int&, int& );
- GetMethod< GetTextSizeFn >( this, 75 )( this, font, text, wide, tall );
- }
- };
- class IPhysicsSurfaceProps
- {
- public:
- surfacedata_t* GetSurfaceData ( int surfaceDataIndex )
- {
- typedef surfacedata_t* ( __thiscall* GetSurfaceDataFn )( void*, int );
- return GetMethod< GetSurfaceDataFn >( this, 5 )( this, surfaceDataIndex );
- }
- };
- #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)
- class CMoveData
- {
- public:
- bool m_bFirstRunOfFunctions : 1;
- bool m_bGameCodeMovedPlayer : 1;
- int m_nPlayerHandle; // edict index on server, client entity handle on client
- int m_nImpulseCommand; // Impulse command issued.
- Vector m_vecViewAngles; // Command view angles (local space)
- Vector m_vecAbsViewAngles; // Command view angles (world space)
- int m_nButtons; // Attack buttons.
- int m_nOldButtons; // From host_client->oldbuttons;
- float m_flForwardMove;
- float m_flSideMove;
- float m_flUpMove;
- float m_flMaxSpeed;
- float m_flClientMaxSpeed;
- // Variables from the player edict (sv_player) or entvars on the client.
- // These are copied in here before calling and copied out after calling.
- Vector m_vecVelocity; // edict::velocity // Current movement direction.
- Vector m_vecAngles; // edict::angles
- Vector m_vecOldAngles;
- // Output only
- float m_outStepHeight; // how much you climbed this move
- Vector m_outWishVel; // This is where you tried
- Vector m_outJumpVel; // This is your jump velocity
- // Movement constraints (radius 0 means no constraint)
- Vector m_vecConstraintCenter;
- float m_flConstraintRadius;
- float m_flConstraintWidth;
- float m_flConstraintSpeedFactor;
- void SetAbsOrigin( const Vector &vec );
- const Vector &GetAbsOrigin() const;
- Vector m_vecAbsOrigin; // edict::origin
- private:
- };
- class IGameMovement
- {
- public:
- virtual ~IGameMovement ( void ) {}
- virtual void ProcessMovement ( CSPlayer* pPlayer, CMoveData* pMove ) = 0;
- virtual void StartTrackPredictionErrors ( CSPlayer* pPlayer ) = 0;
- virtual void FinishTrackPredictionErrors ( CSPlayer* pPlayer ) = 0;
- virtual void DiffPrint ( const char* fmt, ... ) = 0;
- virtual Vector GetPlayerMins ( bool ducked ) const = 0;
- virtual Vector GetPlayerMaxs ( bool ducked ) const = 0;
- virtual Vector GetPlayerViewOffset ( bool ducked ) const = 0;
- };
- class CGameMovement : public IGameMovement
- {
- public:
- CGameMovement ( void );
- virtual ~CGameMovement ( void );
- virtual void ProcessMovement ( CSPlayer* pPlayer, CMoveData* pMove );
- virtual void StartTrackPredictionErrors ( CSPlayer* pPlayer );
- virtual void FinishTrackPredictionErrors ( CSPlayer* pPlayer );
- virtual void DiffPrint ( const char* fmt, ... );
- virtual Vector GetPlayerMins ( bool ducked ) const;
- virtual Vector GetPlayerMaxs ( bool ducked ) const;
- virtual Vector GetPlayerViewOffset ( bool ducked ) const;
- virtual void TracePlayerBBox ();
- virtual unsigned int PlayerSolidMask ();
- CSPlayer* player;
- CMoveData* mv;
- int m_nOldWaterLevel;
- float m_flWaterEntryTime;
- int m_nOnLadder;
- Vector m_vecForward;
- Vector m_vecRight;
- Vector m_vecUp;
- virtual void PlayerMove ( void );
- virtual void CalcRoll ( const Vector& angles, const Vector& velocity, float rollangle, float rollspeed );
- virtual void DecayPunchAngle ( void );
- };
- class IPrediction
- {
- public:
- virtual ~IPrediction( void ) {};
- virtual void Init( void ) = 0;
- virtual void Shutdown( void ) = 0;
- // Run prediction
- virtual void Update
- (
- int startframe, // World update ( un-modded ) most recently received
- bool validframe, // Is frame data valid
- int incoming_acknowledged, // Last command acknowledged to have been run by server (un-modded)
- int outgoing_command // Last command (most recent) sent to server (un-modded)
- ) = 0;
- // We are about to get a network update from the server. We know the update #, so we can pull any
- // data purely predicted on the client side and transfer it to the new from data state.
- virtual void PreEntityPacketReceived( int commands_acknowledged, int current_world_update_packet ) = 0;
- virtual void PostEntityPacketReceived( void ) = 0;
- virtual void PostNetworkDataReceived( int commands_acknowledged ) = 0;
- virtual void OnReceivedUncompressedPacket( void ) = 0;
- // The engine needs to be able to access a few predicted values
- virtual void GetViewOrigin( Vector& org ) = 0;
- virtual void SetViewOrigin( Vector& org ) = 0;
- virtual void GetViewAngles( Vector& ang ) = 0;
- virtual void SetViewAngles( Vector& ang ) = 0;
- virtual void GetLocalViewAngles( Vector& ang ) = 0;
- virtual void SetLocalViewAngles( Vector& ang ) = 0;
- };
- class IMoveHelper;
- class CPrediction : public IPrediction
- {
- public:
- CPrediction( void );
- virtual ~CPrediction( void );
- virtual void Init( void );
- virtual void Shutdown( void );
- // Implement IPrediction
- public:
- virtual void Update
- (
- int startframe, // World update ( un-modded ) most recently received
- bool validframe, // Is frame data valid
- int incoming_acknowledged, // Last command acknowledged to have been run by server (un-modded)
- int outgoing_command // Last command (most recent) sent to server (un-modded)
- );
- virtual void OnReceivedUncompressedPacket( void );
- virtual void PreEntityPacketReceived( int commands_acknowledged, int current_world_update_packet );
- virtual void PostEntityPacketReceived( void );
- virtual void PostNetworkDataReceived( int commands_acknowledged );
- virtual bool InPrediction( void ) const;
- virtual bool IsFirstTimePredicted( void ) const;
- virtual int GetIncomingPacketNumber( void ) const;
- // The engine needs to be able to access a few predicted values
- virtual void GetViewOrigin( Vector& org );
- virtual void SetViewOrigin( Vector& org );
- virtual void GetViewAngles( Vector& ang );
- virtual void SetViewAngles( Vector& ang );
- virtual void GetLocalViewAngles( Vector& ang );
- virtual void SetLocalViewAngles( Vector& ang );
- virtual void RunCommand( CSPlayer *player, CUserCmd *ucmd, IMoveHelper *moveHelper );
- // Internal
- public:
- virtual void SetupMove( CSPlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move );
- virtual void FinishMove( CSPlayer *player, CUserCmd *ucmd, CMoveData *move );
- };
- #endif // SDK_H
Advertisement
Add Comment
Please, Sign In to add comment