Advertisement
keybode

css sdk

Sep 21st, 2014
1,289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 21.19 KB | None | 0 0
  1. #ifndef SDK_H
  2. #define SDK_H
  3.  
  4. #include "Math.h"
  5. #include "Util.h"
  6.  
  7. #include "dt_recv.h"
  8. #include "checksum_crc.h"
  9. #include "checksum_md5.h"
  10.  
  11. // ================================
  12. // C_BaseEntity::m_fFlags flags
  13. // ================================
  14. #define FL_ONGROUND         (1 << 0)
  15. #define FL_DUCKING          (1 << 1)
  16.  
  17. // ================================
  18. // CUserCmd::buttons flags
  19. // ================================
  20. #define IN_ATTACK           (1 << 0)
  21. #define IN_JUMP             (1 << 1)
  22. #define IN_DUCK             (1 << 2)
  23.  
  24. // ================================
  25. // CUserCmd::m_pCommands size
  26. // ================================
  27. #define MULTIPLAYER_BACKUP  90
  28.  
  29. // ================================
  30. // Max player name size
  31. // Used in player_info_t
  32. // ================================
  33. #define MAX_PLAYER_NAME_LENGTH  32
  34.  
  35. #undef CreateFont
  36.  
  37. // ================================
  38. // CreateInterface
  39. // Used to get interface pointers
  40. // ================================
  41. typedef void* (*CreateInterfaceFn)( const char*, int* );
  42.  
  43. // ================================
  44. // CreateMove
  45. // Called each tick (hook for aim/triggerbot/bhop/etc.)
  46. // ================================
  47. typedef void (__thiscall* CreateMoveFn)( void*, int, float, bool );
  48.  
  49. // ================================
  50. // FrameStageNotify
  51. // Called several times each frame (hook it for no visual recoil)
  52. // ================================
  53. typedef void (__thiscall* FrameStageNotifyFn)( void*, unsigned int );
  54.  
  55. // ================================
  56. // PaintTraverse
  57. // Called several times each frame to render panels (hook it for 2d drawing)
  58. // ================================
  59. typedef void (__thiscall* PaintTraverseFn)( void*, unsigned int, bool, bool );
  60.  
  61. // ================================
  62. // C_BaseEntity class
  63. // ================================
  64. class C_BaseEntity;
  65.  
  66. // ================================
  67. // C_BaseWeapon class
  68. // ================================
  69. class C_BaseWeapon;
  70.  
  71. // ================================
  72. // IMoveHelper class
  73. // ================================
  74. class IMoveHelper;
  75.  
  76. // ================================
  77. // CUserCmd class
  78. // ================================
  79. class CUserCmd;
  80.  
  81. // ================================
  82. // Weapon ID's enum
  83. // ================================
  84. enum WeaponID_t
  85. {
  86.     WEAPON_NONE = 0,
  87.     WEAPON_P228,
  88.     WEAPON_GLOCK18,
  89.     WEAPON_SCOUT,
  90.     WEAPON_HEGRENADE,
  91.     WEAPON_XM1014,
  92.     WEAPON_C4,
  93.     WEAPON_MAC10,
  94.     WEAPON_AUG,
  95.     WEAPON_SMOKEGRENADE,
  96.     WEAPON_ELITE,
  97.     WEAPON_FIVESEVEN,
  98.     WEAPON_UMP45,
  99.     WEAPON_SG550,
  100.     WEAPON_GALIL,
  101.     WEAPON_FAMAS,
  102.     WEAPON_USP45,
  103.     WEAPON_AWP,
  104.     WEAPON_MP5,
  105.     WEAPON_M249,
  106.     WEAPON_M3,
  107.     WEAPON_M4A1,
  108.     WEAPON_TMP,
  109.     WEAPON_G3SG1,
  110.     WEAPON_FLASHBANG,
  111.     WEAPON_DEAGLE,
  112.     WEAPON_SG552,
  113.     WEAPON_AK47,
  114.     WEAPON_KNIFE,
  115.     WEAPON_P90,
  116.     WEAPON_SHIELD,
  117.     WEAPON_KEVLAR,
  118.     WEAPON_ASSAULTSUIT,
  119.     WEAPON_NIGHTVISION
  120. };
  121.  
  122. struct model_t
  123. {
  124.     void*           fnHandle;
  125.     char            szName[96];
  126.     int             nLoadFlags;
  127.     int             nServerCount;
  128.     unsigned int    type;
  129.     int             flags;
  130.     Vector          mins, maxs;
  131.     float           radius;
  132. };
  133.  
  134. // ================================
  135. // player_info_t struct
  136. // Holds usefull information about player entities
  137. // ================================
  138. struct player_info_t
  139. {
  140.     char            name[MAX_PLAYER_NAME_LENGTH];
  141.     int             userID;
  142.     char            guid[MAX_PLAYER_NAME_LENGTH + 1];
  143.     unsigned int    friendsID;
  144.     char            friendsName[MAX_PLAYER_NAME_LENGTH];
  145.     bool            fakeplayer;
  146.     bool            ishltv;
  147.     unsigned long   customFiles[4];
  148.     unsigned char   filesDownloaded;
  149. };
  150.  
  151. // ================================
  152. // mstudiobbox_t struct
  153. // Holds info about model hitboxes
  154. // ================================
  155. struct mstudiobbox_t
  156. {
  157.     int     bone;
  158.     int     group;
  159.     Vector  bbmin;
  160.     Vector  bbmax;
  161.     int     szhitboxnameindex;
  162.     int     unused[8];
  163.  
  164.     char* GetHitboxName ( void )
  165.     {
  166.         if ( szhitboxnameindex == 0 )
  167.             return "";
  168.  
  169.         return ((char*)this) + szhitboxnameindex;
  170.     }
  171. };
  172.  
  173. struct mstudiohitboxset_t
  174. {
  175.     int                     sznameindex;
  176.     inline char* const      GetName ( void ) const { return ( ( char* )this ) + sznameindex; }
  177.     int                     numhitboxes;
  178.     int                     hitboxindex;
  179.     inline mstudiobbox_t*   GetHitbox ( int i ) const { return ( mstudiobbox_t* )( ( ( byte* )this ) + hitboxindex ) + i; };
  180. };
  181.  
  182. struct mstudiobone_t
  183. {
  184.     int                 sznameindex;
  185.     inline char * const GetName( void ) const { return ((char *)this) + sznameindex; }
  186.     int                 parent;
  187.     int                 bonecontroller[6];
  188.  
  189.     Vector              pos;
  190.     float               quat[4];
  191.     Vector              rot;
  192.     Vector              posscale;
  193.     Vector              rotscale;
  194.  
  195.     matrix3x4_t         poseToBone;
  196.     float               qAlignment[4];
  197.     int                 flags;
  198.     int                 proctype;
  199.     int                 procindex;      // procedural rule
  200.     mutable int         physicsbone;    // index into physically simulated bone
  201.     inline void *       GetProcedure( ) const { if (procindex == 0) return NULL; else return  (void *)(((byte *)this) + procindex); };
  202.     int                 surfacepropidx; // index into string tablefor property name
  203.     inline char * const GetSurfaceProps( void ) const { return ((char *)this) + surfacepropidx; }
  204.     int                 contents;       // See BSPFlags.h for the contents flags
  205.  
  206.     int                 unused[8];      // remove as appropriate
  207. };
  208.  
  209. struct studiohdr_t
  210. {
  211.     int                 id;
  212.     int                 version;
  213.  
  214.     int                 checksum;
  215.  
  216.     char                name[64];
  217.     int                 length;
  218.  
  219.  
  220.     Vector              eyeposition;
  221.  
  222.     Vector              illumposition;
  223.    
  224.     Vector              hull_min;
  225.     Vector              hull_max;
  226.  
  227.     Vector              view_bbmin;
  228.     Vector              view_bbmax;    
  229.  
  230.     int                 flags;
  231.  
  232.     int                 numbones;
  233.     int                 boneindex;
  234.  
  235.     inline mstudiobone_t *GetBone( int i ) const { return (mstudiobone_t *)(((byte *)this) + boneindex) + i; };
  236.    
  237.     int                 numbonecontrollers;
  238.     int                 bonecontrollerindex;
  239.  
  240.     int                 numhitboxsets;
  241.     int                 hitboxsetindex;
  242.  
  243.     mstudiohitboxset_t* GetHitboxSet( int i ) const
  244.     {
  245.         return ( mstudiohitboxset_t* )( ( ( byte* )this ) + hitboxsetindex ) + i;
  246.     }
  247.  
  248.     inline mstudiobbox_t* GetHitbox( int i, int set ) const
  249.     {
  250.         mstudiohitboxset_t const* s = GetHitboxSet( set );
  251.  
  252.         if( !s )
  253.             return NULL;
  254.  
  255.         return s->GetHitbox( i );
  256.     }
  257.  
  258.     inline int GetHitboxCount( int set ) const
  259.     {
  260.         mstudiohitboxset_t const* s = GetHitboxSet( set );
  261.  
  262.         if( !s )
  263.             return 0;
  264.  
  265.         return s->numhitboxes;
  266.     }
  267.  
  268.     int                 numlocalanim;
  269.     int                 localanimindex;
  270.  
  271.     int                 numlocalseq;
  272.     int                 localseqindex;
  273.  
  274.     mutable int         activitylistversion;
  275.     mutable int         eventsindexed;
  276.  
  277.     int                 numtextures;
  278.     int                 textureindex;
  279.  
  280.     int                 numcdtextures;
  281.     int                 cdtextureindex;
  282.  
  283.     int                 numskinref;
  284.     int                 numskinfamilies;
  285.     int                 skinindex;
  286.  
  287.     int                 numbodyparts;      
  288.     int                 bodypartindex;
  289.  
  290.     int                 numlocalattachments;
  291.     int                 localattachmentindex;
  292.  
  293.     int                 numlocalnodes;
  294.     int                 localnodeindex;
  295.     int                 localnodenameindex;
  296.    
  297.     int                 numflexdesc;
  298.     int                 flexdescindex;
  299.    
  300.     int                 numflexcontrollers;
  301.     int                 flexcontrollerindex;
  302.    
  303.     int                 numflexrules;
  304.     int                 flexruleindex;
  305.    
  306.     int                 numikchains;
  307.     int                 ikchainindex;
  308.    
  309.     int                 nummouths;
  310.     int                 mouthindex;
  311.  
  312.     int                 numlocalposeparameters;
  313.     int                 localposeparamindex;
  314.    
  315.     int                 surfacepropindex;
  316.  
  317.     int                 keyvalueindex;
  318.     int                 keyvaluesize;
  319.    
  320.  
  321.     int                 numlocalikautoplaylocks;
  322.     int                 localikautoplaylockindex;
  323.  
  324.     float               mass;
  325.     int                 contents;
  326.  
  327.     int                 numincludemodels;
  328.     int                 includemodelindex;
  329.  
  330.     mutable void        *virtualModel;
  331.  
  332.     int                 szanimblocknameindex;  
  333.     int                 numanimblocks;
  334.     int                 animblockindex;
  335.    
  336.     mutable void        *animblockModel;
  337.  
  338.     int                 bonetablebynameindex;
  339.  
  340.     void                *pVertexBase;
  341.     void                *pIndexBase;
  342.  
  343.     byte                constdirectionallightdot;
  344.  
  345.     byte                rootLOD;
  346.  
  347.     byte                numAllowedRootLODs;
  348.  
  349.     byte                unused[1];
  350.  
  351.     int                 unused4;
  352.  
  353.     int                 numflexcontrollerui;
  354.     int                 flexcontrolleruiindex;
  355.     float               flVertAnimFixedPointScale;
  356.     int                 unused3[1];
  357.     int                 studiohdr2index;
  358.     int                 unused2[1];
  359. };
  360.  
  361. class CUserCmd
  362. {
  363. public:
  364.     CUserCmd ( void ) { Reset (); }
  365.  
  366.     virtual ~CUserCmd ( void );
  367.  
  368.     void Reset ( void )
  369.     {
  370.         command_number = 0;
  371.         tick_count = 0;
  372.         viewangles.Init ();
  373.         forwardmove = 0.0f;
  374.         sidemove = 0.0f;
  375.         upmove = 0.0f;
  376.         buttons = 0;
  377.         impulse = 0;
  378.         weaponselect = 0;
  379.         weaponsubtype = 0;
  380.         random_seed = 0;
  381.         mousedx = 0;
  382.         mousedy = 0;
  383.         hasbeenpredicted = false;
  384.     }
  385.  
  386.     CUserCmd& operator = ( const CUserCmd& src )
  387.     {
  388.         if ( this == &src )
  389.             return *this;
  390.  
  391.         command_number      = src.command_number;
  392.         tick_count          = src.tick_count;
  393.         viewangles          = src.viewangles;
  394.         forwardmove         = src.forwardmove;
  395.         sidemove            = src.sidemove;
  396.         upmove              = src.upmove;
  397.         buttons             = src.buttons;
  398.         impulse             = src.impulse;
  399.         weaponselect        = src.weaponselect;
  400.         weaponsubtype       = src.weaponsubtype;
  401.         random_seed         = src.random_seed;
  402.         mousedx             = src.mousedx;
  403.         mousedy             = src.mousedy;
  404.         hasbeenpredicted    = src.hasbeenpredicted;
  405.  
  406.         return *this;
  407.     }
  408.  
  409.     CUserCmd ( const CUserCmd& src )
  410.     {
  411.         *this = src;
  412.     }
  413.  
  414.     CRC32_t GetChecksum ( void )
  415.     {
  416.         CRC32_t crc;
  417.  
  418.         CRC32_Init ( &crc );
  419.         CRC32_ProcessBuffer ( &crc, &command_number, sizeof(command_number) );
  420.         CRC32_ProcessBuffer ( &crc, &tick_count, sizeof(tick_count) );
  421.         CRC32_ProcessBuffer ( &crc, &viewangles, sizeof(viewangles) );
  422.         CRC32_ProcessBuffer ( &crc, &forwardmove, sizeof(forwardmove) );
  423.         CRC32_ProcessBuffer ( &crc, &sidemove, sizeof(sidemove) );
  424.         CRC32_ProcessBuffer ( &crc, &upmove, sizeof(upmove) );
  425.         CRC32_ProcessBuffer ( &crc, &buttons, sizeof(buttons) );
  426.         CRC32_ProcessBuffer ( &crc, &impulse, sizeof(impulse) );
  427.         CRC32_ProcessBuffer ( &crc, &weaponselect, sizeof(weaponselect) );
  428.         CRC32_ProcessBuffer ( &crc, &weaponsubtype, sizeof(weaponsubtype) );
  429.         CRC32_ProcessBuffer ( &crc, &random_seed, sizeof(random_seed) );
  430.         CRC32_ProcessBuffer ( &crc, &mousedx, sizeof(mousedx) );
  431.         CRC32_ProcessBuffer ( &crc, &mousedy, sizeof(mousedy) );
  432.         CRC32_Final ( &crc );
  433.  
  434.         return crc;
  435.     }
  436.  
  437.     int     command_number;
  438.     int     tick_count;
  439.     Vector  viewangles;
  440.     float   forwardmove;
  441.     float   sidemove;
  442.     float   upmove;
  443.     int     buttons;
  444.     byte    impulse;
  445.     int     weaponselect;
  446.     int     weaponsubtype;
  447.     int     random_seed;
  448.     short   mousedx;
  449.     short   mousedy;
  450.     bool    hasbeenpredicted;
  451. };
  452.  
  453. class CVerifiedUserCmd
  454. {
  455. public:
  456.     CUserCmd    m_cmd;
  457.     CRC32_t     m_crc;
  458. };
  459.  
  460. class ClientClass
  461. {
  462. public:
  463.     const char* GetNetworkName ( void )
  464.     {
  465.         return m_pNetworkName;
  466.     }
  467.  
  468.     RecvTable* GetTable ( void )
  469.     {
  470.         return m_pRecvTable;
  471.     }
  472.  
  473.     ClientClass* GetNext ( void )
  474.     {
  475.         return m_pNext;
  476.     }
  477.  
  478.     int GetID ( void )
  479.     {
  480.         return m_iClassID;
  481.     }
  482.  
  483. private:
  484.     unsigned char   __pad0[0x8];
  485.  
  486.     const char*     m_pNetworkName;
  487.     RecvTable*      m_pRecvTable;
  488.     ClientClass*    m_pNext;
  489.     int             m_iClassID;
  490. };
  491.  
  492. class IBaseClientDLL
  493. {
  494. public:
  495.     ClientClass* GetAllClasses ( void )
  496.     {
  497.         typedef ClientClass* (__thiscall* GetAllClassesFn)( void* );
  498.         return GetMethod<GetAllClassesFn> ( this, 8 )( this );
  499.     }
  500. };
  501.  
  502. class IClientEntityList
  503. {
  504. public:
  505.     C_BaseEntity* GetClientEntity ( int nIndex )
  506.     {
  507.         typedef C_BaseEntity* (__thiscall* GetClientEntityFn)( void*, int );
  508.         return GetMethod<GetClientEntityFn> ( this, 3 )( this, nIndex );
  509.     }
  510.  
  511.     C_BaseEntity* GetClientEntityFromHandle ( int nHandle )
  512.     {
  513.         typedef C_BaseEntity* (__thiscall* GetClientEntityFromHandleFn)( void*, int );
  514.         return GetMethod<GetClientEntityFromHandleFn> ( this, 4 )( this, nHandle );
  515.     }
  516.  
  517.     int GetHighestEntityIndex ( void )
  518.     {
  519.         typedef int (__thiscall* GetHighestEntityIndexFn)( void* );
  520.         return GetMethod<GetHighestEntityIndexFn> ( this, 6 )( this );
  521.     }
  522. };
  523.  
  524. class IVEngineClient
  525. {
  526. public:
  527.     void GetScreenSize ( int& width, int& height )
  528.     {
  529.         typedef void (__thiscall* GetScreenSizeFn)( void*, int&, int& );
  530.         return GetMethod<GetScreenSizeFn> ( this, 5 )( this, width, height );
  531.     }
  532.  
  533.     bool GetPlayerInfo ( int ent_num, player_info_t* info )
  534.     {
  535.         typedef bool (__thiscall* GetPlayerInfoFn)( void*, int, player_info_t* );
  536.         return GetMethod<GetPlayerInfoFn> ( this, 8 )( this, ent_num, info );
  537.     }
  538.  
  539.     bool Con_IsVisible ( void )
  540.     {
  541.         typedef bool (__thiscall* Con_IsVisibleFn)( void* );
  542.         return GetMethod<Con_IsVisibleFn> ( this, 11 )( this );
  543.     }
  544.  
  545.     int GetLocalPlayer ( void )
  546.     {
  547.         typedef int (__thiscall* GetLocalPlayerFn)( void* );
  548.         return GetMethod<GetLocalPlayerFn> ( this, 12 )( this );
  549.     }
  550.  
  551.     float Time ( void )
  552.     {
  553.         typedef float (__thiscall* TimeFn)( void* );
  554.         return GetMethod<TimeFn> ( this, 14 )( this );
  555.     }
  556.  
  557.     void GetViewAngles ( Vector& va )
  558.     {
  559.         typedef void (__thiscall* GetViewAnglesFn)( void*, Vector& );
  560.         GetMethod<GetViewAnglesFn> ( this, 19 )( this, va );
  561.     }
  562.  
  563.     void SetViewAngles ( const Vector& va )
  564.     {
  565.         typedef void (__thiscall* SetViewAnglesFn)( void*, const Vector& );
  566.         GetMethod<SetViewAnglesFn> ( this, 20 )( this, va );
  567.     }
  568.  
  569.     int GetMaxClients ( void )
  570.     {
  571.         typedef int (__thiscall* GetMaxClientsFn)( void* );
  572.         return GetMethod<GetMaxClientsFn> ( this, 21 )( this );
  573.     }
  574.  
  575.     const VMatrix& WorldToScreenMatrix ( void )
  576.     {
  577.         typedef const VMatrix& (__thiscall* WorldToScreenMatrixFn)( void* );
  578.         return GetMethod<WorldToScreenMatrixFn> ( this, 36 )( this );
  579.     }
  580. };
  581.  
  582. enum TraceType_t
  583. {
  584.     TRACE_EVERYTHING = 0,
  585.     TRACE_WORLD_ONLY,
  586.     TRACE_ENTITIES_ONLY,
  587.     TRACE_EVERYTHING_FILTER_PROPS
  588. };
  589.  
  590. struct cplane_t
  591. {
  592.     Vector  normal;
  593.     float   dist;
  594.     byte    type;
  595.     byte    signbits;
  596.     byte    pad[2];
  597. };
  598.  
  599. struct csurface_t
  600. {
  601.     const char*     name;
  602.     short           surfaceProps;
  603.     unsigned short  flags;
  604. };
  605.  
  606. class CBaseTrace
  607. {
  608. public:
  609.     Vector          startpos;
  610.     Vector          endpos;
  611.     cplane_t        plane;
  612.     float           fraction;
  613.     int             contents;
  614.     unsigned short  dispFlags;
  615.     bool            allsolid;
  616.     bool            startsolid;
  617. };
  618.  
  619. class CGameTrace : public CBaseTrace
  620. {
  621. public:
  622.     float           fractionleftsolid;
  623.     csurface_t      surface;
  624.     int             hitgroup;
  625.     short           physicsbone;
  626.     C_BaseEntity*   ent;
  627.     int             hitbox;
  628. };
  629.  
  630. typedef CGameTrace trace_t;
  631.  
  632. struct Ray_t
  633. {
  634.     VectorAligned   m_Start;
  635.     VectorAligned   m_Delta;
  636.     VectorAligned   m_StartOffset;
  637.     VectorAligned   m_Extents;
  638.  
  639.     bool            m_IsRay;
  640.     bool            m_IsSwept;
  641.  
  642.     void Init ( const Vector& start, const Vector& end )
  643.     {
  644.         m_Delta = end - start;
  645.  
  646.         m_IsSwept = (m_Delta.LengthSqr () != 0);
  647.  
  648.         m_Extents.Init ();
  649.  
  650.         m_IsRay = true;
  651.  
  652.         m_StartOffset.Init ();
  653.  
  654.         m_Start = start;
  655.     }
  656. };
  657.  
  658. class ITraceFilter
  659. {
  660. public:
  661.     virtual bool        ShouldHitEntity ( C_BaseEntity* pEntity, int contentsMask ) = 0;
  662.     virtual TraceType_t GetTraceType ( void ) const = 0;
  663. };
  664.  
  665. class CTraceFilter : public ITraceFilter
  666. {
  667. public:
  668.     CTraceFilter ( C_BaseEntity* pEntity )
  669.         :   m_pEntity ( pEntity )
  670.     {
  671.        
  672.     }
  673.  
  674.     bool ShouldHitEntity ( C_BaseEntity* pEntity, int contentsMask )
  675.     {
  676.         return !(pEntity == m_pEntity);
  677.     }
  678.  
  679.     virtual TraceType_t GetTraceType ( void ) const
  680.     {
  681.         return TRACE_EVERYTHING;
  682.     }
  683.  
  684. private:
  685.     C_BaseEntity* m_pEntity;
  686. };
  687.  
  688. class IEngineTrace
  689. {
  690. public:
  691.     int GetPointContents ( const Vector& vecAbsPosition, C_BaseEntity** ppEntity = 0 )
  692.     {
  693.         typedef int (__thiscall* GetPointContentsFn)( void*, const Vector&, C_BaseEntity** );
  694.         return GetMethod<GetPointContentsFn> ( this, 0 )( this, vecAbsPosition, ppEntity );
  695.     }
  696.  
  697.     void TraceRay ( const Ray_t& ray, unsigned int fMask, ITraceFilter* pTraceFilter, trace_t* pTrace )
  698.     {
  699.         typedef void (__thiscall* TraceRayFn)( void*, const Ray_t&, unsigned int, ITraceFilter*, trace_t* );
  700.         GetMethod<TraceRayFn> ( this, 4 )( this, ray, fMask, pTraceFilter, pTrace );
  701.     }
  702. };
  703.  
  704. class IVModelInfo
  705. {
  706. public:
  707.     const char* GetModelName ( const model_t* pModel )
  708.     {
  709.         typedef const char* (__thiscall* GetModelNameFn)( void*, const model_t* );
  710.         return GetMethod<GetModelNameFn> ( this, 3 )( this, pModel );
  711.     }
  712.  
  713.     studiohdr_t* GetStudioModel ( const model_t* pModel )
  714.     {
  715.         typedef studiohdr_t* (__thiscall* GetStudioModelFn)( void*, const model_t* );
  716.         return GetMethod<GetStudioModelFn> ( this, 28 )( this, pModel );
  717.     }
  718. };
  719.  
  720. class IPanel
  721. {
  722. public:
  723.     const char* GetName ( unsigned int vguiPanel )
  724.     {
  725.         typedef const char* (__thiscall* GetNameFn)( void*, unsigned int );
  726.         return GetMethod<GetNameFn> ( this, 36 )( this, vguiPanel );
  727.     }
  728. };
  729.  
  730. class ISurface
  731. {
  732. public:
  733.     void DrawSetColor ( int r, int g, int b, int a )
  734.     {
  735.         typedef void (__thiscall* DrawSetColorFn)( void*, int, int, int, int );
  736.         GetMethod< DrawSetColorFn > ( this, 11 )( this, r, g, b, a );
  737.     }
  738.  
  739.     void DrawFilledRect ( int x0, int y0, int x1, int y1 )
  740.     {
  741.         typedef void (__thiscall* DrawFilledRectFn)( void*, int, int, int, int );
  742.         GetMethod< DrawFilledRectFn > ( this, 12 )( this, x0, y0, x1, y1 );
  743.     }
  744.  
  745.     void DrawOutlinedRect ( int x0, int y0, int x1, int y1 )
  746.     {
  747.         typedef void (__thiscall* DrawOutlinedFn)( void*, int, int, int, int );
  748.         GetMethod< DrawOutlinedFn > ( this, 14 )( this, x0, y0, x1, y1 );
  749.     }
  750.  
  751.     void DrawLine ( int x0, int y0, int x1, int y1 )
  752.     {
  753.         typedef void (__thiscall* DrawLineFn)( void*, int, int, int, int );
  754.         GetMethod< DrawLineFn > ( this, 15 )( this, x0, y0, x1, y1 );
  755.     }
  756.  
  757.     void DrawSetTextFont ( unsigned long font )
  758.     {
  759.         typedef void (__thiscall* DrawSetTextFontFn)( void*, unsigned long );
  760.         GetMethod< DrawSetTextFontFn > ( this, 17 )( this, font );
  761.     }
  762.  
  763.     void DrawSetTextColor ( int r, int g, int b, int a )
  764.     {
  765.         typedef void (__thiscall* DrawSetTextColorFn)( void*, int, int, int, int );
  766.         GetMethod< DrawSetTextColorFn > ( this, 19 )( this, r, g, b, a );
  767.     }
  768.  
  769.     void DrawSetTextPos ( int x, int y )
  770.     {
  771.         typedef void (__thiscall* DrawSetTextPosFn)( void*, int, int );
  772.         GetMethod< DrawSetTextPosFn > ( this, 20 )( this, x, y );
  773.     }
  774.  
  775.     void DrawPrintText ( const wchar_t* text, int textLen )
  776.     {
  777.         typedef void (__thiscall* DrawPrintTextFn)( void*, const wchar_t*, int, int );
  778.         return GetMethod< DrawPrintTextFn > ( this, 22 )( this, text, textLen, 0 );
  779.     }
  780.  
  781.     unsigned long CreateFont ()
  782.     {
  783.         typedef unsigned int (__thiscall* CreateFontFn)( void* );
  784.         return GetMethod< CreateFontFn > ( this, 66 )( this );
  785.     }
  786.  
  787.     void SetFontGlyphSet ( unsigned long font, const char* windowsFontName, int tall, int weight, int blur, int scanlines, int flags )
  788.     {
  789.         typedef void (__thiscall* SetFontGlyphSetFn)( void*, unsigned long, const char*, int, int, int, int, int, int, int );
  790.         GetMethod< SetFontGlyphSetFn > ( this, 67 )( this, font, windowsFontName, tall, weight, blur, scanlines, flags, 0, 0 );
  791.     }
  792.  
  793.     void GetTextSize ( unsigned long font, const wchar_t* text, int& wide, int& tall )
  794.     {
  795.         typedef void (__thiscall* GetTextSizeFn)( void*, unsigned long, const wchar_t*, int&, int& );
  796.         GetMethod< GetTextSizeFn > ( this, 75 )( this, font, text, wide, tall );
  797.     }
  798. };
  799.  
  800. class CGlobalVarsBase
  801. {
  802. public:
  803.     float   realtime;
  804.     int     framecount;
  805.     float   absoluteframetime;
  806.     float   curtime;
  807.     float   frametime;
  808.     int     maxClients;
  809.     int     tickcount;
  810.     float   interval_per_tick;
  811.     float   interpolation_amount;
  812.     int     simTicksThisFrame;
  813.     int     network_protocol;
  814.     void*   pSaveData;
  815.     bool    m_bClient;
  816.     int     nTimestampNetworkingBase;
  817.     int     nTimestampRandomizeWindow;
  818. };
  819.  
  820. class CInput
  821. {
  822. public:
  823.     CUserCmd* GetUserCmd ( int sequence_number )
  824.     {
  825.         return &m_pCommands[sequence_number % MULTIPLAYER_BACKUP];
  826.     }
  827.  
  828.     CVerifiedUserCmd* GetVerifiedUserCmd ( int sequence_number )
  829.     {
  830.         return &m_pVerified[sequence_number % MULTIPLAYER_BACKUP];
  831.     }
  832.  
  833.     unsigned char       __pad0[0xC4];
  834.     CUserCmd*           m_pCommands;
  835.     CVerifiedUserCmd*   m_pVerified;
  836. };
  837.  
  838. class CMoveData
  839. {
  840. public:
  841.     bool    m_bFirstRunOfFunctions : 1;
  842.     bool    m_bGameCodeMovedPlayer : 1;
  843.  
  844.     int     m_nPlayerHandle;
  845.  
  846.     int     m_nImpulseCommand;
  847.     Vector  m_vecViewAngles;
  848.     Vector  m_vecAbsViewAngles;
  849.     int     m_nButtons;
  850.     int     m_nOldButtons;
  851.     float   m_flForwadrMove;
  852.     float   m_flSideMove;
  853.     float   m_flUpMove;
  854.  
  855.     float   m_flMaxSpeed;
  856.     float   m_flClientMaxSpeed;
  857.  
  858.     Vector  m_vecVelocity;
  859.     Vector  m_vecAngles;
  860.     Vector  m_vecOldAngles;
  861.  
  862.     float   m_outStepHeight;
  863.     Vector  m_outWishVel;
  864.     Vector  m_outJumpVel;
  865.  
  866.     Vector  m_vecConstraintCenter;
  867.     float   m_flConstraintRadius;
  868.     float   m_flConstraintWidth;
  869.     float   m_flConstraintSpeedFactor;
  870.  
  871.     void SetAbsOrigin ( const Vector& vec )
  872.     {
  873.         m_vecAbsOrigin = vec;
  874.     }
  875.  
  876.     const Vector& GetAbsOrigin () const
  877.     {
  878.         return m_vecAbsOrigin;
  879.     }
  880.  
  881.     Vector  m_vecAbsOrigin;
  882. };
  883.  
  884. class CGameMovement
  885. {
  886. public:
  887.     void ProcessMovement ( C_BaseEntity* pPlayer, CMoveData* pMove )
  888.     {
  889.         typedef void (__thiscall* ProcessMovementFn)( void*, C_BaseEntity*, CMoveData* );
  890.         GetMethod<ProcessMovementFn> ( this, 1 )( this, pPlayer, pMove );
  891.     }
  892.  
  893.     void StartTrackPredictionErrors ( C_BaseEntity* pPlayer )
  894.     {
  895.         typedef void (__thiscall* StartTrackPredictionErrorsFn)( void*, C_BaseEntity* );
  896.         GetMethod<StartTrackPredictionErrorsFn> ( this, 2 )( this, pPlayer );
  897.     }
  898.  
  899.     void FinishTrackPredictionErrors ( C_BaseEntity* pPlayer )
  900.     {
  901.         typedef void (__thiscall* FinishTrackPredictionErrorsFn)( void*, C_BaseEntity* );
  902.         GetMethod<FinishTrackPredictionErrorsFn> ( this, 3 )( this, pPlayer );
  903.     }
  904.  
  905.     void DecayPunchAngle ( void )
  906.     {
  907.         typedef void (__thiscall* DecayPunchAngleFn)( void* );
  908.         GetMethod<DecayPunchAngleFn> ( this, 13 )( this );
  909.     }
  910. };
  911.  
  912. class CPrediction
  913. {
  914. public:
  915.     void SetupMove ( C_BaseEntity* player, CUserCmd* ucmd, IMoveHelper* pHelper, CMoveData* move )
  916.     {
  917.         typedef void (__thiscall* SetupMoveFn)( void*, C_BaseEntity*, CUserCmd*, IMoveHelper*, CMoveData* );
  918.         GetMethod<SetupMoveFn> ( this, 18 )( this, player, ucmd, pHelper, move );
  919.     }
  920.  
  921.     void FinishMove ( C_BaseEntity* player, CUserCmd* ucmd, CMoveData* move )
  922.     {
  923.         typedef void (__thiscall* FinishMoveFn)( void*, C_BaseEntity*, CUserCmd*, CMoveData* );
  924.         GetMethod<FinishMoveFn> ( this, 19 )( this, player, ucmd, move );
  925.     }
  926. };
  927.  
  928. #endif // SDK_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement