keybode

old sdk

Feb 21st, 2014
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 11.09 KB | None | 0 0
  1. #ifndef SDK_H
  2. #define SDK_H
  3.  
  4. #include "Math.h"
  5. #include "VMethod.h"
  6. #include "Random.h"
  7.  
  8. #include "checksum_md5.h"
  9. #include "dt_recv.h"
  10.  
  11. typedef void* ( *CreateInterfaceFn )( const char*, int* );
  12.  
  13. #undef CreateFont
  14.  
  15. enum eWeaponId
  16. {
  17.     WEAPON_CSBASE = 0,
  18.     WEAPON_P228,
  19.     WEAPON_GLOCK,
  20.     WEAPON_SCOUT,
  21.     WEAPON_HEGRENADE,
  22.     WEAPON_XM1014,
  23.     WEAPON_C4,
  24.     WEAPON_MAC10,
  25.     WEAPON_AUG,
  26.     WEAPON_SMOKEGRENADE,
  27.     WEAPON_ELITE,
  28.     WEAPON_FIVESEVEN,
  29.     WEAPON_UMP45,
  30.     WEAPON_SG550,
  31.     WEAPON_GALIL,
  32.     WEAPON_FAMAS,
  33.     WEAPON_USP,
  34.     WEAPON_AWP,
  35.     WEAPON_MP5,
  36.     WEAPON_M249,
  37.     WEAPON_M3,
  38.     WEAPON_M4A1,
  39.     WEAPON_TMP,
  40.     WEAPON_G3SG1,
  41.     WEAPON_FLASHBANG,
  42.     WEAPON_DEAGLE,
  43.     WEAPON_SG552,
  44.     WEAPON_AK47,
  45.     WEAPON_KNIFE,
  46.     WEAPON_P90,
  47.     WEAPON_SHIELD,
  48.     WEAPON_KEVLAR,
  49.     WEAPON_ASSAULTSUIT,
  50.     WEAPON_NIGHTVISION
  51. };
  52.  
  53. #define IN_ATTACK   ( 1 << 0 )
  54. #define IN_JUMP     ( 1 << 1 )
  55. #define IN_DUCK     ( 1 << 2 )
  56.  
  57. #define FL_ONGROUND ( 1 << 0 )
  58. #define FL_DUCKING  ( 1 << 1 )
  59.  
  60. class CSPlayer;
  61. class CSWeapon;
  62. class model_t;
  63.  
  64. struct player_info_t
  65. {
  66.     char            name[32];
  67.     int             userID;
  68.     char            guid[32 + 1];
  69.     unsigned int    friendsID;
  70.     char            friendsName[32];
  71.     bool            fakeplayer;
  72.     bool            ishltv;
  73.     unsigned long   customFiles[4];
  74.     unsigned char   filesDownloaded;
  75. };
  76.  
  77. struct mstudiobbox_t
  78. {
  79.     int                 bone;
  80.     int                 group;
  81.     Vector              bbmin;
  82.     Vector              bbmax; 
  83.     int                 szhitboxnameindex;
  84.     int                 unused[8];
  85.  
  86.     char* pszHitboxName( )
  87.     {
  88.         if( szhitboxnameindex == 0 )
  89.             return "";
  90.  
  91.         return ( ( char* )this ) + szhitboxnameindex;
  92.     }
  93. };
  94.  
  95. struct mstudiohitboxset_t
  96. {
  97.     int                     sznameindex;
  98.     inline char* const      pszName( void ) const { return ( ( char* )this ) + sznameindex; }
  99.     int                     numhitboxes;
  100.     int                     hitboxindex;
  101.     inline mstudiobbox_t*   pHitbox( int i ) const { return ( mstudiobbox_t* )( ( ( byte* )this ) + hitboxindex ) + i; };
  102. };
  103.  
  104. struct studiohdr_t
  105. {
  106.     unsigned char       pad[0xAC];
  107.     int                 numhitboxsets;
  108.     int                 hitboxsetindex;
  109.  
  110.     mstudiohitboxset_t* pHitboxSet( int i ) const
  111.     {
  112.         return ( mstudiohitboxset_t* )( ( ( byte* )this ) + hitboxsetindex ) + i;
  113.     };
  114.  
  115.     inline mstudiobbox_t* pHitbox( int i, int set ) const
  116.     {
  117.         mstudiohitboxset_t const* s = pHitboxSet( set );
  118.  
  119.         if( !s )
  120.             return NULL;
  121.  
  122.         return s->pHitbox( i );
  123.     };
  124.  
  125.     inline int iHitboxCount( int set ) const
  126.     {
  127.         mstudiohitboxset_t const* s = pHitboxSet( set );
  128.  
  129.         if( !s )
  130.             return 0;
  131.  
  132.         return s->numhitboxes;
  133.     };
  134. };
  135.  
  136. class ClientClass
  137. {
  138. public:
  139.     const char              __pad0[ 0x8 ];
  140.  
  141.     const char              *m_pNetworkName;
  142.     RecvTable               *m_pRecvTable;
  143.     ClientClass             *m_pNext;
  144.     int                     m_ClassID;
  145. };
  146.  
  147. class CUserCmd
  148. {
  149. public:
  150.     virtual ~CUserCmd( ) { };
  151.  
  152.     int     command_number;
  153.     int     tick_count;
  154.     Vector  viewangles;
  155.     float   forwardmove;
  156.     float   sidemove;
  157.     float   upmove;
  158.     int     buttons;
  159.     BYTE    impulse;
  160.     int     weaponselect;
  161.     int     weaponsubtype;
  162.     int     random_seed;
  163.     short   mousedx;
  164.     short   mousedy;
  165.     bool    hasbeenpredicted;
  166. };
  167.  
  168. class CGlobalVarsBase
  169. {
  170. public:
  171.     float           realtime;
  172.     int             framecount;
  173.     float           absoluteframetime;
  174.     float           curtime;
  175.     float           frametime;
  176.     int             maxClients;
  177.     int             tickcount;
  178.     float           interval_per_tick;
  179.     float           interpolation_amount;
  180.     int             simTicksThisFrame;
  181.     int             network_protocol;
  182. };
  183.  
  184. class IBaseClientDLL
  185. {
  186. public:
  187.     ClientClass* GetAllClasses( )
  188.     {
  189.         typedef ClientClass* ( __thiscall* GetAllClassesFn )( PVOID );
  190.         return GetMethod< GetAllClassesFn >( this, 5 )( this );
  191.     }
  192. };
  193.  
  194. class IClientEntityList
  195. {
  196. public:
  197.     CSPlayer* GetClientEntity( int nIndex )
  198.     {
  199.         typedef CSPlayer* ( __thiscall* GetClientEntityFn )( PVOID, int );
  200.         return GetMethod< GetClientEntityFn >( this, 3 )( this, nIndex );
  201.     }
  202.  
  203.     CSWeapon* GetClientEntityFromHandle( int nHandle )
  204.     {
  205.         typedef CSWeapon* ( __thiscall* GetClientEntityFromHandleFn )( PVOID, int );
  206.         return GetMethod< GetClientEntityFromHandleFn >( this, 4 )( this, nHandle );
  207.     }
  208.  
  209.     int GetHighestEntityIndex( )
  210.     {
  211.         typedef int ( __thiscall* GetHighestEntityIndexFn )( PVOID );
  212.         return GetMethod< GetHighestEntityIndexFn >( this, 6 )( this );
  213.     }
  214. };
  215.  
  216. class CInput
  217. {
  218. public:
  219.     CUserCmd* GetUserCmd( int sequence_number )
  220.     {
  221.         typedef CUserCmd* ( __thiscall* GetUserCmdFn )( PVOID, int );
  222.         return GetMethod< GetUserCmdFn >( this, 8 )( this, sequence_number );
  223.     }
  224.  
  225.     char        __pad0[ 0xC4 ];
  226.     CUserCmd*   m_pCmd;
  227. };
  228.  
  229.  
  230. class IVModelInfoClient
  231. {
  232. public:
  233.     const char* GetModelName( const model_t* model )
  234.     {
  235.         typedef const char* ( __thiscall* GetModelNameFn )( PVOID, const model_t* );
  236.         return GetMethod< GetModelNameFn >( this, 3 )( this, model );
  237.     }
  238.  
  239.     studiohdr_t* GetStudiomodel( const model_t* mod )
  240.     {
  241.         typedef studiohdr_t* ( __thiscall* GetStudiomodelFn )( PVOID, const model_t* );
  242.         return GetMethod< GetStudiomodelFn >( this, 27 )( this, mod );
  243.     }
  244. };
  245.  
  246. class IVEngineClient
  247. {
  248. public:
  249.     void GetScreenSize( int& width, int& height )
  250.     {
  251.         typedef void ( __thiscall* GetScreenSizeFn )( PVOID, int&, int& );
  252.         GetMethod< GetScreenSizeFn >( this, 5 )( this, width, height );
  253.     }
  254.  
  255.     bool GetPlayerInfo( int ent_num, player_info_t *pinfo )
  256.     {
  257.         typedef bool ( __thiscall* GetPlayerInfoFn )( PVOID, int, player_info_t* );
  258.         return GetMethod< GetPlayerInfoFn >( this, 8 )( this, ent_num, pinfo );
  259.     }
  260.  
  261.     int GetLocalPlayer( )
  262.     {
  263.         typedef int ( __thiscall* GetLocalPlayerFn )( PVOID );
  264.         return GetMethod< GetLocalPlayerFn >( this, 12 )( this );
  265.     }
  266.  
  267.     void GetViewAngles( Vector& va )
  268.     {
  269.         typedef void ( __thiscall* GetViewAnglesFn )( PVOID, Vector& );
  270.         GetMethod< GetViewAnglesFn >( this, 19 )( this, va );
  271.     }
  272.  
  273.     void SetViewAngles( Vector& va )
  274.     {
  275.         typedef void ( __thiscall* SetViewAnglesFn )( PVOID, Vector& );
  276.         GetMethod< SetViewAnglesFn >( this, 20 )( this, va );
  277.     }
  278.  
  279.     int GetMaxClients( void )
  280.     {
  281.         typedef int ( __thiscall* GetMaxClientsFn )( PVOID );
  282.         return GetMethod< GetMaxClientsFn >( this, 21 )( this );
  283.     }
  284.  
  285.     const VMatrix& WorldToScreenMatrix( )
  286.     {
  287.         typedef const VMatrix& ( __thiscall* WorldToScreenMatrixFn )( PVOID );
  288.         return GetMethod< WorldToScreenMatrixFn >( this, 38 )( this );
  289.     }
  290.  
  291.     bool IsTakingScreenshot( void )
  292.     {
  293.         typedef bool ( __thiscall* IsTakingScreenshotFn )( PVOID );
  294.         return GetMethod< IsTakingScreenshotFn >( this, 80 )( this );
  295.     }
  296. };
  297.  
  298. struct Ray_t
  299. {
  300.     Vector  m_Start;
  301.     Vector  m_Delta;
  302.     Vector  m_StartOffset;
  303.     Vector  m_Extents;
  304.  
  305.     bool    m_IsRay;
  306.     bool    m_IsSwept;
  307.  
  308.     void Init( Vector& vecStart, Vector& vecEnd )
  309.     {
  310.         m_Delta = vecEnd - vecStart;
  311.  
  312.         m_IsSwept = ( m_Delta.LengthSqr( ) != 0 );
  313.  
  314.         m_Extents.x = m_Extents.y = m_Extents.z = 0.0f;
  315.  
  316.         m_IsRay = true;
  317.  
  318.         m_StartOffset.x = m_StartOffset.y = m_StartOffset.z = 0.0f;
  319.  
  320.         m_Start = vecStart;
  321.     }
  322. };
  323.  
  324. struct cplane_t
  325. {
  326.     Vector  normal;
  327.     float   dist;
  328.     BYTE    type;
  329.     BYTE    signbits;
  330.     BYTE    pad[2];
  331. };
  332.  
  333. class CBaseTrace
  334. {
  335. public:
  336.     Vector          startpos;
  337.     Vector          endpos;
  338.     cplane_t        plane;
  339.     float           fraction;
  340.     int             contents;
  341.     unsigned short  dispFlags;
  342.     bool            allsolid;
  343.     bool            startsolid;
  344. };
  345.  
  346. struct csurface_t
  347. {
  348.     const char*     name;
  349.     short           surfaceProps;
  350.     unsigned short  flags;
  351. };
  352.  
  353. class CGameTrace : public CBaseTrace
  354. {
  355. public:
  356.     bool            DidHitWorld( ) const;
  357.     bool            DidHitNonWorldEntity( ) const;
  358.     int             GetEntityIndex( ) const;
  359.     bool            DidHit( ) const;
  360. public:
  361.     float           fractionleftsolid;
  362.     csurface_t      surface;
  363.     int             hitgroup;
  364.     short           physicsbone;
  365.     CSPlayer*       m_pEnt;
  366.     int             hitbox;
  367. };
  368.  
  369. inline bool CGameTrace::DidHit( ) const
  370. {
  371.     return fraction < 1.0f || allsolid || startsolid;
  372. }
  373.  
  374. typedef CGameTrace trace_t;
  375.  
  376. enum TraceType_t
  377. {
  378.     TRACE_EVERYTHING = 0,
  379.     TRACE_WORLD_ONLY,
  380.     TRACE_ENTITIES_ONLY,
  381.     TRACE_EVERYTHING_FILTER_PROPS,
  382. };
  383.  
  384. class ITraceFilter
  385. {
  386. public:
  387.     virtual bool        ShouldHitEntity( PVOID pEntity, int contentsMask ) = 0;
  388.     virtual TraceType_t GetTraceType( ) const = 0;
  389. };
  390.  
  391. class IEngineTrace
  392. {
  393. public:
  394.     void TraceRay( const Ray_t& ray, unsigned int flMask, ITraceFilter* pTraceFilter, trace_t* pTrace )
  395.     {
  396.         typedef void ( __thiscall* TraceRayFn )( PVOID, const Ray_t&, unsigned int, ITraceFilter*, trace_t* );
  397.         GetMethod< TraceRayFn >( this, 4 )( this, ray, flMask, pTraceFilter, pTrace );
  398.     }
  399. };
  400.  
  401. class IMoveHelper;
  402.  
  403. class CPrediction
  404. {
  405. public:
  406.     void RunSimulation( int current_command, float curtime, CUserCmd *cmd, CSPlayer *localPlayer )
  407.     {
  408.         typedef void ( __thiscall* RunSimulationFn )( PVOID, int, float, CUserCmd*, CSPlayer* );
  409.         GetMethod< RunSimulationFn >( this, 38 )( this, current_command, curtime, cmd, localPlayer );
  410.     }
  411. };
  412.  
  413. class IPanel
  414. {
  415. public:
  416.     const char* GetName( unsigned int vguiPanel )
  417.     {
  418.         typedef const char* ( __thiscall* GetNameFn )( PVOID, unsigned int );
  419.         return GetMethod< GetNameFn >( this, 35 )( this, vguiPanel );
  420.     }
  421. };
  422.  
  423. class ISurface
  424. {
  425. public:
  426.     void DrawSetColor( int r, int g, int b, int a )
  427.     {
  428.         typedef void ( __thiscall* DrawSetColorFn )( PVOID, int, int, int, int );
  429.         GetMethod< DrawSetColorFn >( this, 11 )( this, r, g, b, a );
  430.     }
  431.  
  432.     void DrawFilledRect( int x0, int y0, int x1, int y1 )
  433.     {
  434.         typedef void ( __thiscall* DrawFilledRectFn )( PVOID, int, int, int, int );
  435.         GetMethod< DrawFilledRectFn >( this, 12 )( this, x0, y0, x1, y1 );
  436.     }
  437.  
  438.     void DrawOutlinedRect( int x0, int y0, int x1, int y1 )
  439.     {
  440.         typedef void ( __thiscall* DrawOutlinedFn )( PVOID, int, int, int, int );
  441.         GetMethod< DrawOutlinedFn >( this, 14 )( this, x0, y0, x1, y1 );
  442.     }
  443.  
  444.     void DrawLine( int x0, int y0, int x1, int y1 )
  445.     {
  446.         typedef void ( __thiscall* DrawLineFn )( PVOID, int, int, int, int );
  447.         GetMethod< DrawLineFn >( this, 15 )( this, x0, y0, x1, y1 );
  448.     }
  449.  
  450.     void DrawSetTextFont( unsigned long font )
  451.     {
  452.         typedef void ( __thiscall* DrawSetTextFontFn )( PVOID, unsigned long );
  453.         GetMethod< DrawSetTextFontFn >( this, 17 )( this, font );
  454.     }
  455.  
  456.     void DrawSetTextColor( int r, int g, int b, int a )
  457.     {
  458.         typedef void ( __thiscall* DrawSetTextColorFn )( PVOID, int, int, int, int );
  459.         GetMethod< DrawSetTextColorFn >( this, 19 )( this, r, g, b, a );
  460.     }
  461.  
  462.     void DrawSetTextPos( int x, int y )
  463.     {
  464.         typedef void ( __thiscall* DrawSetTextPosFn )( PVOID, int, int );
  465.         GetMethod< DrawSetTextPosFn >( this, 20 )( this, x, y );
  466.     }
  467.  
  468.     void DrawPrintText( const wchar_t* text, int textLen )
  469.     {
  470.         typedef void ( __thiscall* DrawPrintTextFn )( PVOID, const wchar_t*, int, int );
  471.         return GetMethod< DrawPrintTextFn >( this, 22 )( this, text, textLen, 0 );
  472.     }
  473.  
  474.     unsigned long CreateFont( )
  475.     {
  476.         typedef unsigned int ( __thiscall* CreateFontFn )( PVOID );
  477.         return GetMethod< CreateFontFn >( this, 64 )( this );
  478.     }
  479.  
  480.     void SetFontGlyphSet( unsigned long font, const char* windowsFontName, int tall, int weight, int blur, int scanlines, int flags )
  481.     {
  482.         typedef void ( __thiscall* SetFontGlyphSetFn )( PVOID, unsigned long, const char*, int, int, int, int, int );
  483.         GetMethod< SetFontGlyphSetFn >( this, 65 )( this, font, windowsFontName, tall, weight, blur, scanlines, flags );
  484.     }
  485.  
  486.     void GetTextSize( unsigned long font, const wchar_t* text, int& wide, int& tall )
  487.     {
  488.         typedef void ( __thiscall* GetTextSizeFn )( PVOID, unsigned long, const wchar_t*, int&, int& );
  489.         GetMethod< GetTextSizeFn >( this, 72 )( this, font, text, wide, tall );
  490.     }
  491. };
  492.  
  493. #endif // SDK_H
Advertisement
Add Comment
Please, Sign In to add comment