Advertisement
Guest User

Untitled

a guest
Oct 29th, 2017
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.97 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include "MiscDefinitions.h"
  4. #include "ClientRecvProps.h"
  5. #include "offsets.h"
  6. #include "Vector.h"
  7. #include "bspflags.h"
  8. #include "winwindef.h"
  9.  
  10. // Entity List
  11. class IClientModeShared
  12. {
  13. public:
  14. };
  15. class IClientEntityList
  16. {
  17. public:
  18. virtual void Function0();
  19. virtual void Function1();
  20. virtual void Function2();
  21. virtual IClientEntity * GetClientEntity(int entnum);
  22. virtual IClientEntity * GetClientEntityFromHandle(HANDLE hEnt) = 0;
  23. virtual int NumberOfEntities(bool bIncludeNonNetworkable) = 0;
  24. virtual int GetHighestEntityIndex(void);
  25. virtual void SetMaxEntities(int maxents);
  26. virtual int GetMaxEntities();
  27. };
  28.  
  29. struct CViewSetup
  30. {
  31. char _0x0000[16];
  32. __int32 x;
  33. __int32 x_old;
  34. __int32 y;
  35. __int32 y_old;
  36. __int32 width;
  37. __int32 width_old;
  38. __int32 height;
  39. __int32 height_old;
  40. char _0x0030[128];
  41. float fov;
  42. float fovViewmodel;
  43. Vector origin;
  44. Vector angles;
  45. float zNear;
  46. float zFar;
  47. float zNearViewmodel;
  48. float zFarViewmodel;
  49. float m_flAspectRatio;
  50. float m_flNearBlurDepth;
  51. float m_flNearFocusDepth;
  52. float m_flFarFocusDepth;
  53. float m_flFarBlurDepth;
  54. float m_flNearBlurRadius;
  55. float m_flFarBlurRadius;
  56. float m_nDoFQuality;
  57. __int32 m_nMotionBlurMode;
  58. char _0x0104[68];
  59. __int32 m_EdgeBlur;
  60. };
  61.  
  62. // Panels
  63. class IPanel
  64. {
  65. public:
  66. const char *GetName(unsigned int vguiPanel)
  67. {
  68. typedef const char* (__thiscall* OriginalFn)(PVOID, unsigned int);
  69. return call_vfunc<OriginalFn>(this, Offsets::VMT::Panel_GetName)(this, vguiPanel);
  70. }
  71. };
  72.  
  73. class IGameEvent {
  74. public:
  75. virtual ~IGameEvent() {};
  76. virtual const char *GetName() const = 0; // get event name
  77.  
  78. virtual bool IsReliable() const = 0; // if event handled reliable
  79. virtual bool IsLocal() const = 0; // if event is never networked
  80. virtual bool IsEmpty(const char *keyName = NULL) = 0; // check if data field exists
  81.  
  82. // Data access
  83. virtual bool GetBool(const char *keyName = NULL, bool defaultValue = false) = 0;
  84. virtual int GetInt(const char *keyName = NULL, int defaultValue = 0) = 0;
  85. virtual unsigned __int64 GetUint64(const char *keyName = NULL, unsigned __int64 defaultValue = 0) = 0;
  86. virtual float GetFloat(const char *keyName = NULL, float defaultValue = 0.0f) = 0;
  87. virtual const char *GetString(const char *keyName = NULL, const char *defaultValue = "") = 0;
  88. virtual const wchar_t * GetWString(char const *keyName = NULL, const wchar_t *defaultValue = L"") = 0;
  89.  
  90. virtual void SetBool(const char *keyName, bool value) = 0;
  91. virtual void SetInt(const char *keyName, int value) = 0;
  92. virtual void SetUint64(const char *keyName, unsigned __int64 value) = 0;
  93. virtual void SetFloat(const char *keyName, float value) = 0;
  94. virtual void SetString(const char *keyName, const char *value) = 0;
  95. virtual void SetWString(const char *keyName, const wchar_t *value) = 0;
  96. };
  97.  
  98. class IGameEventListener2 {
  99. public:
  100. virtual ~IGameEventListener2(void) {};
  101.  
  102. virtual void FireGameEvent(IGameEvent *event) = 0;
  103.  
  104. virtual int GetEventDebugID(void) = 0;
  105. };
  106.  
  107. class bf_read;
  108. class bf_write;
  109.  
  110. class IGameEventManager2 {
  111. public:
  112. virtual ~IGameEventManager2(void) {};
  113.  
  114. virtual int LoadEventsFromFile(const char *filename) = 0;
  115.  
  116. virtual void Reset() = 0;
  117.  
  118. virtual bool AddListener(IGameEventListener2 *listener, const char *name, bool bServerSide) = 0;
  119.  
  120. virtual bool FindListener(IGameEventListener2 *listener, const char *name) = 0;
  121.  
  122. virtual void RemoveListener(IGameEventListener2 *listener) = 0;
  123.  
  124.  
  125. virtual IGameEvent *CreateEvent(const char *name, bool bForce = false, int *pCookie = NULL) = 0;
  126.  
  127. virtual bool FireEvent(IGameEvent *event, bool bDontBroadcast = false) = 0;
  128.  
  129. virtual bool FireEventClientSide(IGameEvent *event) = 0;
  130.  
  131. virtual IGameEvent *DuplicateEvent(IGameEvent *event) = 0;
  132.  
  133. virtual void FreeEvent(IGameEvent *event) = 0;
  134.  
  135. virtual bool SerializeEvent(IGameEvent *event, bf_write *buf) = 0;
  136. virtual IGameEvent *UnserializeEvent(bf_read *buf) = 0;
  137. };
  138.  
  139. class Color
  140. {
  141. public:
  142. Color()
  143. {
  144. *((int *)this) = 0;
  145. }
  146. Color(int r, int g, int b)
  147. {
  148. SetColor(r, g, b, 0);
  149. }
  150. Color(int r, int g, int b, int a)
  151. {
  152. SetColor(r, g, b, a);
  153. }
  154. void SetColor(int r, int g, int b, int a = 0)
  155. {
  156. _color[0] = (unsigned char)r;
  157. _color[1] = (unsigned char)g;
  158. _color[2] = (unsigned char)b;
  159. _color[3] = (unsigned char)a;
  160. }
  161.  
  162. void GetColor(int &r, int &g, int &b, int &a) const
  163. {
  164. r = _color[0];
  165. g = _color[1];
  166. b = _color[2];
  167. a = _color[3];
  168. }
  169.  
  170. void SetRawColor(int color32)
  171. {
  172. *((int *)this) = color32;
  173. }
  174.  
  175. int GetRawColor() const
  176. {
  177. return *((int *)this);
  178. }
  179.  
  180. inline int r() const { return _color[0]; }
  181. inline int g() const { return _color[1]; }
  182. inline int b() const { return _color[2]; }
  183. inline int a() const { return _color[3]; }
  184.  
  185. inline float rBase() const { return _color[0] / 255.0f; }
  186. inline float gBase() const { return _color[1] / 255.0f; }
  187. inline float bBase() const { return _color[2] / 255.0f; }
  188. inline float aBase() const { return _color[3] / 255.0f; }
  189.  
  190. void SetAlpha(int a) { _color[0] = (unsigned char)a; }
  191. int GetAlpha() { return _color[0]; }
  192.  
  193.  
  194. unsigned char &operator[](int index)
  195. {
  196. return _color[index];
  197. }
  198.  
  199. const unsigned char &operator[](int index) const
  200. {
  201. return _color[index];
  202. }
  203.  
  204. bool operator == (const Color &rhs) const
  205. {
  206. return (*((int *)this) == *((int *)&rhs));
  207. }
  208.  
  209. bool operator != (const Color &rhs) const
  210. {
  211. return !(operator==(rhs));
  212. }
  213.  
  214. Color &operator=(const Color &rhs)
  215. {
  216. SetRawColor(rhs.GetRawColor());
  217. return *this;
  218. }
  219.  
  220. private:
  221. unsigned char _color[4];
  222. };
  223.  
  224. class IVDebugOverlay
  225. {
  226. public:
  227. virtual void AddEntityTextOverlay(int ent_index, int line_offset, float duration, int r, int g, int b, int a, const char *format, ...) = 0;
  228. virtual void AddBoxOverlay(const Vector& origin, const Vector& mins, const Vector& max, Vector const& orientation, int r, int g, int b, int a, float duration) = 0;
  229. virtual void AddSphereOverlay(const Vector& vOrigin, float flRadius, int nTheta, int nPhi, int r, int g, int b, int a, float flDuration) = 0;
  230. 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;
  231. virtual void AddLineOverlay(const Vector& origin, const Vector& dest, int r, int g, int b, bool noDepthTest, float duration) = 0;
  232. virtual void AddTextOverlay(const Vector& origin, float duration, const char *format, ...) = 0;
  233. virtual void AddTextOverlay(const Vector& origin, int line_offset, float duration, const char *format, ...) = 0;
  234. virtual void AddScreenTextOverlay(float flXPos, float flYPos, float flDuration, int r, int g, int b, int a, const char *text) = 0;
  235. virtual void AddSweptBoxOverlay(const Vector& start, const Vector& end, const Vector& mins, const Vector& max, const Vector & angles, int r, int g, int b, int a, float flDuration) = 0;
  236. virtual void AddGridOverlay(const Vector& origin) = 0;
  237. virtual void AddCoordFrameOverlay(const matrix3x4& frame, float flScale, int vColorTable[3][3] = NULL) = 0;
  238.  
  239. virtual int ScreenPosition(const Vector& point, Vector& screen) = 0;
  240. virtual int ScreenPosition(float flXPos, float flYPos, Vector& screen) = 0;
  241.  
  242. virtual void *GetFirst(void) = 0;
  243. virtual void *GetNext(void *current) = 0;
  244. virtual void ClearDeadOverlays(void) = 0;
  245. virtual void ClearAllOverlays() = 0;
  246.  
  247. virtual void AddTextOverlayRGB(const Vector& origin, int line_offset, float duration, float r, float g, float b, float alpha, const char *format, ...) = 0;
  248. virtual void AddTextOverlayRGB(const Vector& origin, int line_offset, float duration, int r, int g, int b, int a, const char *format, ...) = 0;
  249.  
  250. virtual void AddLineOverlayAlpha(const Vector& origin, const Vector& dest, int r, int g, int b, int a, bool noDepthTest, float duration) = 0;
  251. virtual void AddBoxOverlay2(const Vector& origin, const Vector& mins, const Vector& max, Vector const& orientation, const Color& faceColor, const Color& edgeColor, float duration) = 0;
  252.  
  253. virtual void PurgeTextOverlays() = 0;
  254. };
  255.  
  256. // User Cmd's
  257. class CUserCmd
  258. {
  259. public:
  260. virtual ~CUserCmd() {}; //Destructor 0
  261. CUserCmd()
  262. {
  263. Reset();
  264. }
  265.  
  266. void Reset()
  267. {
  268. command_number = 0;
  269. tick_count = 0;
  270. viewangles.Init();
  271. forwardmove = 0.0f;
  272. sidemove = 0.0f;
  273. upmove = 0.0f;
  274. buttons = 0;
  275. impulse = 0;
  276. weaponselect = 0;
  277. weaponsubtype = 0;
  278. random_seed = 0;
  279. mousedx = 0;
  280. mousedy = 0;
  281. headangles.Init();
  282. headoffset.Init();
  283.  
  284. hasbeenpredicted = false;
  285. }
  286.  
  287. CUserCmd& operator =(const CUserCmd& src)
  288. {
  289. if (this == &src)
  290. return *this;
  291.  
  292. command_number = src.command_number;
  293. tick_count = src.tick_count;
  294. viewangles = src.viewangles;
  295. forwardmove = src.forwardmove;
  296. sidemove = src.sidemove;
  297. upmove = src.upmove;
  298. buttons = src.buttons;
  299. impulse = src.impulse;
  300. weaponselect = src.weaponselect;
  301. weaponsubtype = src.weaponsubtype;
  302. random_seed = src.random_seed;
  303. mousedx = src.mousedx;
  304. mousedy = src.mousedy;
  305.  
  306. hasbeenpredicted = src.hasbeenpredicted;
  307. headangles = src.headangles;
  308. headoffset = src.headoffset;
  309. return *this;
  310. }
  311.  
  312. CUserCmd(const CUserCmd& src)
  313. {
  314. *this = src;
  315. }
  316.  
  317.  
  318. int command_number;
  319. int tick_count;
  320. Vector viewangles;
  321. Vector aimdirection;
  322. float forwardmove;
  323. float sidemove;
  324. float upmove;
  325. int buttons;
  326. BYTE impulse;
  327. int weaponselect;
  328. int weaponsubtype;
  329. int random_seed;
  330. short mousedx;
  331. short mousedy;
  332. bool hasbeenpredicted;
  333. Vector headangles;
  334. Vector headoffset;
  335. };
  336.  
  337. class CVerifiedUserCmd
  338. {
  339. public:
  340. CUserCmd m_cmd;
  341. unsigned long m_crc;
  342. };
  343.  
  344. //========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
  345. //
  346. // Purpose: Generic CRC functions
  347. //
  348. // $NoKeywords: $
  349. //=============================================================================//
  350. #ifndef CHECKSUM_CRC_H
  351. #define CHECKSUM_CRC_H
  352. #ifdef _WIN32
  353. #pragma once
  354. #endif
  355.  
  356. typedef unsigned long CRC32_t;
  357.  
  358. void CRC32_Init(CRC32_t *pulCRC);
  359. void CRC32_ProcessBuffer(CRC32_t *pulCRC, const void *p, int len);
  360. void CRC32_Final(CRC32_t *pulCRC);
  361. CRC32_t CRC32_GetTableEntry(unsigned int slot);
  362.  
  363. inline CRC32_t CRC32_ProcessSingleBuffer(const void *p, int len)
  364. {
  365. CRC32_t crc;
  366.  
  367. CRC32_Init(&crc);
  368. CRC32_ProcessBuffer(&crc, p, len);
  369. CRC32_Final(&crc);
  370.  
  371. return crc;
  372. }
  373.  
  374. #endif // CHECKSUM_CRC_H
  375.  
  376. class CInput
  377. {
  378. public:
  379. void* pvftable; //0x00
  380. bool m_fTrackIRAvailable; //0x04
  381. bool m_fMouseInitialized; //0x05
  382. bool m_fMouseActive; //0x06
  383. bool m_fJoystickAdvancedInit; //0x07
  384. char pad_0x08[0x2C]; //0x08
  385. void* m_pKeys; //0x34
  386. char pad_0x38[0x64]; //0x38
  387. int pad_0x41;
  388. int pad_0x42;
  389. bool m_fCameraInterceptingMouse; //0x9C
  390. bool m_fCameraInThirdPerson; //0x9D
  391. bool m_fCameraMovingWithMouse; //0x9E
  392. Vector m_vecCameraOffset; //0xA0
  393. bool m_fCameraDistanceMove; //0xAC
  394. int m_nCameraOldX; //0xB0
  395. int m_nCameraOldY; //0xB4
  396. int m_nCameraX; //0xB8
  397. int m_nCameraY; //0xBC
  398. bool m_CameraIsOrthographic; //0xC0
  399. Vector m_angPreviousViewAngles; //0xC4
  400. Vector m_angPreviousViewAnglesTilt; //0xD0
  401. float m_flLastForwardMove; //0xDC
  402. int m_nClearInputState; //0xE0
  403. char pad_0xE4[0x8]; //0xE4
  404. CUserCmd* m_pCommands; //0xEC
  405. //CVerifiedUserCmd* m_pVerifiedCommands; //0xF0
  406. class CUserCmd
  407. {
  408. public:
  409. CRC32_t GetChecksum(void) const
  410. {
  411. CRC32_t crc;
  412. CRC32_Init(&crc);
  413. CRC32_ProcessBuffer(&crc, &command_number, sizeof(command_number));
  414. CRC32_ProcessBuffer(&crc, &tick_count, sizeof(tick_count));
  415. CRC32_ProcessBuffer(&crc, &viewangles, sizeof(viewangles));
  416. CRC32_ProcessBuffer(&crc, &aimdirection, sizeof(aimdirection));
  417. CRC32_ProcessBuffer(&crc, &forwardmove, sizeof(forwardmove));
  418. CRC32_ProcessBuffer(&crc, &sidemove, sizeof(sidemove));
  419. CRC32_ProcessBuffer(&crc, &upmove, sizeof(upmove));
  420. CRC32_ProcessBuffer(&crc, &buttons, sizeof(buttons));
  421. CRC32_ProcessBuffer(&crc, &impulse, sizeof(impulse));
  422. CRC32_ProcessBuffer(&crc, &weaponselect, sizeof(weaponselect));
  423. CRC32_ProcessBuffer(&crc, &weaponsubtype, sizeof(weaponsubtype));
  424. CRC32_ProcessBuffer(&crc, &random_seed, sizeof(random_seed));
  425. CRC32_ProcessBuffer(&crc, &mousedx, sizeof(mousedx));
  426. CRC32_ProcessBuffer(&crc, &mousedy, sizeof(mousedy));
  427. CRC32_Final(&crc);
  428. return crc;
  429. }
  430. BYTE u1[4];
  431. int command_number;
  432. int tick_count;
  433. Vector viewangles;
  434. Vector aimdirection;
  435. float forwardmove;
  436. float sidemove;
  437. float upmove;
  438. int buttons;
  439. BYTE impulse;
  440. int weaponselect;
  441. int weaponsubtype;
  442. int random_seed;
  443. short mousedx;
  444. short mousedy;
  445. bool hasbeenpredicted;
  446. Vector headangles;
  447. Vector headoffset;
  448. };
  449. class CVerifiedUserCmd
  450. {
  451. public:
  452. CUserCmd m_cmd;
  453. unsigned long m_crc;
  454. };
  455. CUserCmd* GetUserCmd(int slot, int seq)
  456. {
  457. typedef CUserCmd* (__thiscall* OriginalFn)(PVOID, int, int);
  458. return call_vfunc<OriginalFn>(this, 9)(this, slot, seq);
  459. }
  460. };
  461.  
  462. class CGlobalVarsBase
  463. {
  464. public:
  465. float realtime;
  466. int framecount;
  467. float absoluteframetime;
  468. float absoluteframestarttimestddev;
  469. float curtime;
  470. float frametime;
  471. int maxClients;
  472. int tickcount;
  473. float interval_per_tick;
  474. float interpolation_amount;
  475. int simTicksThisFrame;
  476. int network_protocol;
  477. void* pSaveData;
  478. bool m_bClient;
  479. int nTimestampNetworkingBase;
  480. int nTimestampRandomizeWindow;
  481. };
  482.  
  483. struct Ray_t
  484. {
  485. __declspec(align(16)) Vector m_Start;
  486. __declspec(align(16)) Vector m_Delta;
  487. __declspec(align(16)) Vector m_StartOffset;
  488. __declspec(align(16)) Vector m_Extents;
  489. //without your matrix3x4
  490. bool m_IsRay;
  491. bool m_IsSwept;
  492.  
  493. void Init(Vector& vecStart, Vector& vecEnd)
  494. {
  495. m_Delta = vecEnd - vecStart;
  496.  
  497. m_IsSwept = (m_Delta.LengthSqr() != 0);
  498.  
  499. m_Extents.x = m_Extents.y = m_Extents.z = 0.0f;
  500.  
  501. m_IsRay = true;
  502.  
  503. m_StartOffset.x = m_StartOffset.y = m_StartOffset.z = 0.0f;
  504.  
  505. m_Start = vecStart;
  506. }
  507. };
  508.  
  509. struct cplane_t
  510. {
  511. Vector normal;
  512. float dist;
  513. BYTE type;
  514. BYTE signbits;
  515. BYTE pad[2];
  516. };
  517.  
  518. class CBaseTrace
  519. {
  520. public:
  521. Vector startpos;
  522. Vector endpos;
  523. cplane_t plane;
  524. float fraction;
  525. int contents;
  526. unsigned short dispFlags;
  527. bool allsolid;
  528. bool startsolid;
  529. };
  530.  
  531. struct csurface_t
  532. {
  533. const char* name;
  534. short surfaceProps;
  535. unsigned short flags;
  536. };
  537.  
  538. class CGameTrace : public CBaseTrace
  539. {
  540. public:
  541. bool DidHitWorld() const;
  542. bool DidHitNonWorldEntity() const;
  543. int GetEntityIndex() const;
  544. bool DidHit() const;
  545. public:
  546. float fractionleftsolid;
  547. csurface_t surface;
  548. int hitgroup;
  549. short physicsbone;
  550. unsigned short worldSurfaceIndex;
  551. IClientEntity* m_pEnt;
  552. int hitbox;
  553. char shit[0x24];
  554. };
  555.  
  556. inline bool CGameTrace::DidHit() const
  557. {
  558. return fraction < 1.0f || allsolid || startsolid;
  559. }
  560.  
  561. typedef CGameTrace trace_t;
  562.  
  563. enum TraceType_t
  564. {
  565. TRACE_EVERYTHING = 0,
  566. TRACE_WORLD_ONLY,
  567. TRACE_ENTITIES_ONLY,
  568. TRACE_EVERYTHING_FILTER_PROPS,
  569. };
  570.  
  571. class ITraceFilter
  572. {
  573. public:
  574. virtual bool ShouldHitEntity(IClientEntity* pEntity, int contentsMask) = 0;
  575. virtual TraceType_t GetTraceType() const = 0;
  576. };
  577.  
  578. class CTraceFilter : public ITraceFilter
  579. {
  580. public:
  581. bool ShouldHitEntity(IClientEntity* pEntityHandle, int contentsMask)
  582. {
  583. return !(pEntityHandle == pSkip);
  584. }
  585.  
  586. TraceType_t GetTraceType() const
  587. {
  588. return TRACE_EVERYTHING;
  589. }
  590.  
  591. void* pSkip;
  592. };
  593.  
  594. class IEngineTrace
  595. {
  596. public:
  597. int GetPointContents(const Vector &vecAbsPosition, int contentsMask = MASK_ALL, IClientEntity** ppEntity = NULL)
  598. {
  599. typedef int(__thiscall* fnGetPointContents)(void*, const Vector&, int, IClientEntity**);
  600. return call_vfunc<fnGetPointContents>(this, 0)(this, vecAbsPosition, contentsMask, ppEntity);
  601. }
  602.  
  603. void TraceRay(const Ray_t &ray, unsigned int fMask, ITraceFilter* pTraceFilter, trace_t* pTrace)
  604. {
  605. typedef void(__thiscall* fnTraceRay)(void*, const Ray_t&, unsigned int, ITraceFilter*, trace_t*);
  606. call_vfunc<fnTraceRay>(this, 5)(this, ray, fMask, pTraceFilter, pTrace);
  607. }
  608. void EdgeTraceRay(Ray_t &ray, CTraceFilter &filt, CGameTrace &trace, bool wall = false)
  609. {
  610. typedef void(__thiscall *OrigFn)(void *, Ray_t &, unsigned int, CTraceFilter &, CGameTrace &);
  611. call_vfunc<OrigFn>(this, 5)(this, ray, wall ? 0x200400B : 0x46004003, filt, trace); // 0x46004003 0x4600400B
  612. }
  613. };
  614.  
  615. struct mstudiobbox_t
  616. {
  617. int bone;
  618. int group;
  619. Vector bbmin;
  620. Vector bbmax;
  621. int szhitboxnameindex;
  622. int unused[8];
  623. //float radius;
  624.  
  625. char* GetHitboxName(void)
  626. {
  627. if (szhitboxnameindex == 0)
  628. return "";
  629.  
  630. return ((char*)this) + szhitboxnameindex;
  631. }
  632. };
  633. struct mstudiohitboxset_t
  634. {
  635. int sznameindex;
  636. inline char* const GetName(void) const { return ((char*)this) + sznameindex; }
  637. int numhitboxes;
  638. int hitboxindex;
  639. inline mstudiobbox_t* GetHitbox(int i) const { return (mstudiobbox_t*)(((byte*)this) + hitboxindex) + i; };
  640. };
  641. struct mstudiobone_t
  642. {
  643. int sznameindex;
  644. inline char * const GetName(void) const { return ((char *)this) + sznameindex; }
  645. int parent;
  646. int bonecontroller[6];
  647.  
  648. Vector pos;
  649. float quat[4];
  650. Vector rot;
  651. Vector posscale;
  652. Vector rotscale;
  653.  
  654. matrix3x4 poseToBone;
  655. float qAlignment[4];
  656. int flags;
  657. int proctype;
  658. int procindex; // procedural rule
  659. mutable int physicsbone; // index into physically simulated bone
  660. inline void * GetProcedure() const { if (procindex == 0) return NULL; else return (void *)(((byte *)this) + procindex); };
  661. int surfacepropidx; // index into string tablefor property name
  662. inline char * const GetSurfaceProps(void) const { return ((char *)this) + surfacepropidx; }
  663. int contents; // See BSPFlags.h for the contents flags
  664.  
  665. int unused[8]; // remove as appropriate
  666. };
  667. struct studiohdr_t
  668. {
  669. int id;
  670. int version;
  671.  
  672. int checksum;
  673.  
  674. char name[64];
  675. int length;
  676.  
  677.  
  678. Vector eyeposition;
  679.  
  680. Vector illumposition;
  681.  
  682. Vector hull_min;
  683. Vector hull_max;
  684.  
  685. Vector view_bbmin;
  686. Vector view_bbmax;
  687.  
  688. int flags;
  689.  
  690. int numbones;
  691. int boneindex;
  692.  
  693. inline mstudiobone_t *GetBone(int i) const { return (mstudiobone_t *)(((byte *)this) + boneindex) + i; };
  694. // inline mstudiobone_t *pBone(int i) const { Assert(i >= 0 && i < numbones); return (mstudiobone_t *)(((byte *)this) + boneindex) + i; };
  695.  
  696. int numbonecontrollers;
  697. int bonecontrollerindex;
  698.  
  699. int numhitboxsets;
  700. int hitboxsetindex;
  701.  
  702. mstudiohitboxset_t* GetHitboxSet(int i) const
  703. {
  704. return (mstudiohitboxset_t*)(((byte*)this) + hitboxsetindex) + i;
  705. }
  706.  
  707. inline mstudiobbox_t* GetHitbox(int i, int set) const
  708. {
  709. mstudiohitboxset_t const* s = GetHitboxSet(set);
  710.  
  711. if (!s)
  712. return NULL;
  713.  
  714. return s->GetHitbox(i);
  715. }
  716.  
  717. inline int GetHitboxCount(int set) const
  718. {
  719. mstudiohitboxset_t const* s = GetHitboxSet(set);
  720.  
  721. if (!s)
  722. return 0;
  723.  
  724. return s->numhitboxes;
  725. }
  726.  
  727. int numlocalanim;
  728. int localanimindex;
  729.  
  730. int numlocalseq;
  731. int localseqindex;
  732.  
  733. mutable int activitylistversion;
  734. mutable int eventsindexed;
  735.  
  736. int numtextures;
  737. int textureindex;
  738.  
  739. int numcdtextures;
  740. int cdtextureindex;
  741.  
  742. int numskinref;
  743. int numskinfamilies;
  744. int skinindex;
  745.  
  746. int numbodyparts;
  747. int bodypartindex;
  748.  
  749. int numlocalattachments;
  750. int localattachmentindex;
  751.  
  752. int numlocalnodes;
  753. int localnodeindex;
  754. int localnodenameindex;
  755.  
  756. int numflexdesc;
  757. int flexdescindex;
  758.  
  759. int numflexcontrollers;
  760. int flexcontrollerindex;
  761.  
  762. int numflexrules;
  763. int flexruleindex;
  764.  
  765. int numikchains;
  766. int ikchainindex;
  767.  
  768. int nummouths;
  769. int mouthindex;
  770.  
  771. int numlocalposeparameters;
  772. int localposeparamindex;
  773.  
  774. int surfacepropindex;
  775.  
  776. int keyvalueindex;
  777. int keyvaluesize;
  778.  
  779.  
  780. int numlocalikautoplaylocks;
  781. int localikautoplaylockindex;
  782.  
  783. float mass;
  784. int contents;
  785.  
  786. int numincludemodels;
  787. int includemodelindex;
  788.  
  789. mutable void *virtualModel;
  790.  
  791. int szanimblocknameindex;
  792. int numanimblocks;
  793. int animblockindex;
  794.  
  795. mutable void *animblockModel;
  796.  
  797. int bonetablebynameindex;
  798.  
  799. void *pVertexBase;
  800. void *pIndexBase;
  801.  
  802. byte constdirectionallightdot;
  803.  
  804. byte rootLOD;
  805.  
  806. byte numAllowedRootLODs;
  807.  
  808. byte unused[1];
  809.  
  810. int unused4;
  811.  
  812. int numflexcontrollerui;
  813. int flexcontrolleruiindex;
  814. float flVertAnimFixedPointScale;
  815. int unused3[1];
  816. int studiohdr2index;
  817. int unused2[1];
  818. };
  819.  
  820. struct surfacephysicsparams_t
  821. {
  822. float friction;
  823. float elasticity;
  824. float density;
  825. float thickness;
  826. float dampening;
  827. };
  828.  
  829. struct surfaceaudioparams_t
  830. {
  831. float reflectivity; // like elasticity, but how much sound should be reflected by this surface
  832. float hardnessFactor; // like elasticity, but only affects impact sound choices
  833. float roughnessFactor; // like friction, but only affects scrape sound choices
  834. float roughThreshold; // surface roughness > this causes "rough" scrapes, < this causes "smooth" scrapes
  835. float hardThreshold; // surface hardness > this causes "hard" impacts, < this causes "soft" impacts
  836. float hardVelocityThreshold; // collision velocity > this causes "hard" impacts, < this causes "soft" impacts
  837. 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)
  838. float midPitchOcclusion;
  839. float lowPitchOcclusion;
  840. };
  841.  
  842. struct surfacesoundnames_t
  843. {
  844. unsigned short walkStepLeft;
  845. unsigned short walkStepRight;
  846. unsigned short runStepLeft;
  847. unsigned short runStepRight;
  848. unsigned short impactSoft;
  849. unsigned short impactHard;
  850. unsigned short scrapeSmooth;
  851. unsigned short scrapeRough;
  852. unsigned short bulletImpact;
  853. unsigned short rolling;
  854. unsigned short breakSound;
  855. unsigned short strainSound;
  856. };
  857.  
  858. struct surfacegameprops_t
  859. {
  860. public:
  861. float maxSpeedFactor;
  862. float jumpFactor;
  863. float flPenetrationModifier;
  864. float flDamageModifier;
  865. unsigned short material;
  866. byte climbable;
  867. char pad00[0x4];
  868.  
  869. };
  870.  
  871. struct surfacedata_t
  872. {
  873. surfacephysicsparams_t physics;
  874. surfaceaudioparams_t audio;
  875. surfacesoundnames_t sounds;
  876. surfacegameprops_t game;
  877. };
  878.  
  879.  
  880. class IPhysicsSurfaceProps
  881. {
  882. public:
  883.  
  884. surfacedata_t *GetSurfaceData(int surfaceDataIndex)
  885. {
  886. typedef surfacedata_t*(__thiscall* fnGetSurfaceData)(void*, int);
  887. return call_vfunc<fnGetSurfaceData>(this, 5)(this, surfaceDataIndex);
  888. }
  889. };
  890.  
  891. class ConVar
  892. {
  893. public:
  894. void SetValue(const char *value);
  895. void SetValue(float value);
  896. void SetValue(int value);
  897. void SetValue(Color value);
  898. void InternalSetString(const char* str);
  899. char* GetName();
  900. char* GetDefault();
  901. float GetFloat(void) const;
  902. int GetInt(void) const;
  903. Color GetColor(void) const;
  904. const char* GetString(void) const;
  905.  
  906. char pad_0x0000[0x4]; //0x0000
  907. ConVar* pNext; //0x0004
  908. __int32 bRegistered; //0x0008
  909. char* pszName; //0x000C
  910. char* pszHelpString; //0x0010
  911. __int32 nFlags; //0x0014
  912. char pad_0x0018[0x4]; //0x0018
  913. ConVar* pParent; //0x001C
  914. char* pszDefaultValue; //0x0020
  915. char* strString; //0x0024
  916. __int32 StringLength; //0x0028
  917. float fValue; //0x002C
  918. __int32 nValue; //0x0030
  919. __int32 bHasMin; //0x0034
  920. float fMinVal; //0x0038
  921. __int32 bHasMax; //0x003C
  922. float fMaxVal; //0x0040
  923. void* fnChangeCallback; //0x0044
  924.  
  925. };//Size=0x0048
  926.  
  927. class SpoofedConvar {
  928. public:
  929. SpoofedConvar();
  930. SpoofedConvar(const char* szCVar);
  931. SpoofedConvar(ConVar* pCVar);
  932.  
  933. ~SpoofedConvar();
  934.  
  935. bool IsSpoofed();
  936. void Spoof();
  937.  
  938. void SetFlags(int flags);
  939. int GetFlags();
  940.  
  941. void SetBool(bool bValue);
  942. void SetInt(int iValue);
  943. void SetFloat(float flValue);
  944. void SetString(const char* szValue);
  945.  
  946. private:
  947. ConVar* m_pOriginalCVar = NULL;
  948. ConVar* m_pDummyCVar = NULL;
  949.  
  950. char m_szDummyName[128];
  951. char m_szDummyValue[128];
  952. char m_szOriginalName[128];
  953. char m_szOriginalValue[128];
  954. int m_iOriginalFlags;
  955. };
  956.  
  957. class MinspecCvar
  958. {
  959. public:
  960. MinspecCvar(const char* szCVar, char* newname, float newvalue);
  961. ~MinspecCvar();
  962.  
  963. bool ValidCvar();
  964. void Spoof();
  965.  
  966. template<typename T>
  967. void SetValue(T value);
  968.  
  969. int GetInt();
  970. float GetFloat();
  971. const char* GetString();
  972. private:
  973. ConVar* m_pConVar;
  974.  
  975. char* m_szOriginalName;
  976. char* m_szReplacementName;
  977. float m_OriginalValue;
  978. float m_newvalue;
  979. };
  980.  
  981. class IAppSystem
  982. {
  983. public:
  984. virtual ~IAppSystem()
  985. {
  986. }
  987.  
  988. virtual void func0() = 0;
  989. virtual void func1() = 0;
  990. virtual void func2() = 0;
  991. virtual void func3() = 0;
  992. virtual void func4() = 0;
  993. virtual void func5() = 0;
  994. virtual void func6() = 0;
  995. virtual void func7() = 0;
  996. virtual void func8() = 0;
  997. virtual void func9() = 0;
  998. };
  999.  
  1000. struct CVarDLLIdentifier_t;
  1001.  
  1002. class ICVar : public IAppSystem
  1003. {
  1004. public:
  1005. virtual void func10() = 0;
  1006. virtual void RegisterConCommand(ConVar *pCommandBase) = 0;
  1007. virtual void UnregisterConCommand(ConVar *pCommandBase) = 0;
  1008. virtual void func13() = 0;
  1009. virtual ConVar *FindVar(const char *var_name) = 0;
  1010. // virtual void ConsoleColorPrintf(const Color& clr, const char *pFormat, ...) const = 0;
  1011. virtual void func15() = 0;
  1012. virtual void func16() = 0;
  1013. virtual void func17() = 0;
  1014. virtual void func18() = 0;
  1015. virtual void func19() = 0;
  1016. virtual void func20() = 0;
  1017.  
  1018. void const ConsoleColorPrintf(const Color& clr, const char *pFormat, ...)
  1019. {
  1020. typedef void(__cdecl *OriginalFn)(void*, const Color&, const char *, ...);
  1021.  
  1022. if (pFormat == nullptr)
  1023. return;
  1024.  
  1025. char buf[8192];
  1026.  
  1027. va_list list;
  1028. va_start(list, pFormat);
  1029. _vsnprintf_s(buf, sizeof(buf) - 1, pFormat, list);
  1030. va_end(list);
  1031. buf[sizeof(buf) - 1] = 0;
  1032.  
  1033. call_vfunc<OriginalFn>(this, 25)(this, clr, buf, list);
  1034. }
  1035. };
  1036.  
  1037. class CTraceFilterNoPlayer : public CTraceFilter
  1038. {
  1039. public:
  1040. CTraceFilterNoPlayer() {}
  1041. virtual bool ShouldHitEntity(IClientEntity *pServerEntity, int contentsMask)
  1042. {
  1043. if (pServerEntity)
  1044. return !pServerEntity->IsPlayer();
  1045. return false;
  1046. }
  1047. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement