Advertisement
keybode

h1z1 mini sdk

Jan 17th, 2015
475
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.59 KB | None | 0 0
  1. enum ObjectType_t {
  2.     TYPE_PLAYER     = 4,
  3.     TYPE_OFFROADER  = 17,
  4.     TYPE_DEER       = 19,
  5.     TYPE_WOLF       = 20,
  6.     TYPE_RAVEN      = 89,
  7.     TYPE_ZOMBIE     = 91,
  8.     TYPE_PICKUP     = 114
  9. };
  10.  
  11. class CGameClient;
  12. class CGraphics;
  13. class CObject;
  14. class CCamera;
  15. class CCameraMatrix;
  16. class CDisplay;
  17.  
  18. class CGameClient {
  19. public:
  20.     char                __pad0[0x1020];
  21.     __int32             m_nObjectListSize;  // 0x1020
  22.     char                __pad1[0x1B4];
  23.     CObject*            m_pFirstObject;     // 0x11D8
  24. };
  25.  
  26. class CObject {
  27. public:
  28.     char                __pad0[0x1D0];
  29.     Vector3             m_vOrigin;          // 0x01D0
  30.     char                __pad1[0x24];
  31.     Vector3             m_vVelocity;        // 0x0200
  32.     char                __pad2[0x144];
  33.     CObject*            m_pNextObject;      // 0x0350
  34.     char                __pad3[0x74];
  35.     char                m_pName[32];        // 0x03CC
  36.     char                __pad4[0x114];
  37.     int                 m_nType;            // 0x0500
  38. };
  39.  
  40. class CCameraMatrix {
  41. public:
  42.     char                __pad0[0x1A0];
  43.     Matrix4x4           m_Matrix;           // 0x01B0
  44. };
  45.  
  46. class CCamera {
  47. public:
  48.     char                __pad0[0x20];
  49.     CCameraMatrix*      m_pCameraMatrix;    // 0x20
  50. };
  51.  
  52. class CDisplay {
  53. public:
  54.     char                __pad0[0x588];
  55.     IDirect3D9*         m_pDirect3D;        // 0x0588
  56.     char                __pad1[0x130];
  57.     IDirect3DDevice9*   m_pDevice;          // 0x06C0
  58. };
  59.  
  60. class CGraphics {
  61. public:
  62.     char                __pad0[0x28];
  63.     int                 m_nScreenWidth;     // 0x0028
  64.     int                 m_nScreenHeight;    // 0x002C
  65.     char                __pad1[0x18];
  66.     CCamera*            m_pCamera;          // 0x0048
  67.     char                __pad2[0x298];
  68.     CDisplay*           m_pDisplay;         // 0x02E8
  69.  
  70.     bool WorldToScreen(const Vector3& vOrigin, Vector3& vOut) {
  71.         float world[4];
  72.  
  73.         world[0] = vOrigin.x;
  74.         world[1] = vOrigin.y;
  75.         world[2] = vOrigin.z;
  76.         world[3] = 0.0f;
  77.  
  78.         int x = 0, y = 0;
  79.  
  80.         typedef bool (__thiscall* World2ScreenFn)(void*, float*, int*, int*);
  81.  
  82.         World2ScreenFn World2Screen = (World2ScreenFn)0x14030B180;
  83.        
  84.         if (!World2Screen(this, world, &x, &y)) {
  85.             return false;
  86.         }
  87.  
  88.         vOut.x = x;
  89.         vOut.y = y;
  90.  
  91.         return true;
  92.     }
  93.  
  94.     /*bool WorldToScreen(const Vector3& vOrigin, Vector3& vOut) {
  95.         if (!m_pCamera) {
  96.             return false;
  97.         }
  98.  
  99.         if (!m_pCamera->m_pCameraMatrix) {
  100.             return false;
  101.         }
  102.  
  103.         CCameraMatrix* pCameraMatrix = (CCameraMatrix*)(m_pCamera->m_pCameraMatrix + 0x10);
  104.  
  105.         Matrix4x4 Matrix = pCameraMatrix->m_Matrix;
  106.  
  107.         Matrix.Transpose();
  108.  
  109.         Matrix._21 *= -1;
  110.         Matrix._22 *= -1;
  111.         Matrix._23 *= -1;
  112.         Matrix._24 *= -1;
  113.  
  114.         float w = Matrix.GetAxis(3).Dot(vOrigin) + Matrix.m[3][3];
  115.  
  116.         if ( w < 0.098 ) {
  117.             return false;
  118.         }
  119.  
  120.         float x = Matrix.GetAxis(0).Dot(vOrigin) + Matrix.m[0][3];
  121.         float y = Matrix.GetAxis(1).Dot(vOrigin) + Matrix.m[1][3];
  122.  
  123.         vOut.x = (m_nScreenWidth / 2) * (1.0 + x / w);
  124.         vOut.y = (m_nScreenHeight / 2) * (1.0 - y / w);
  125.  
  126.         return true;
  127.     }*/
  128. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement