1. enum CharacterStance
    2. {
    3. Standing,
    4. Crouching,
    5. Crawling,
    6. Downed
    7. };
    8. enum Bone {
    9. Head = 7,
    10. Neck = 6,
    11. Chest = 5,
    12. Mid = 4,
    13. Tummy = 3,
    14. RightFoot1 = 21,
    15. RightFoot2 = 22,
    16. RightFoot3 = 23,
    17. RightFoot4 = 24,
    18. LeftFoot1 = 17,
    19. LeftFoot2 = 18,
    20. LeftFoot3 = 19,
    21. LeftFoot4 = 20,
    22. LeftHand1 = 13,
    23. LeftHand2 = 14,
    24. LeftHand3 = 15,
    25. LeftHand4 = 16,
    26. RightHand1 = 9,
    27. RightHand2 = 10,
    28. RightHand3 = 11,
    29. RightHand4 = 12
    30. }
    31. pub static BONE_CONNECTIONS: &[(Bone, Bone)] = &[
    32. (Head, Neck),
    33. (Neck, Chest),
    34. (Chest, Mid),
    35. (Mid, Tummy),
    36. (Tummy, LeftFoot1),
    37. (LeftFoot1, LeftFoot2),
    38. (LeftFoot2, LeftFoot3),
    39. (LeftFoot3, LeftFoot4),
    40. (Tummy, RightFoot1),
    41. (RightFoot1, RightFoot2),
    42. (RightFoot2, RightFoot3),
    43. (RightFoot3, RightFoot4),
    44. (Neck, LeftHand1),
    45. (LeftHand1, LeftHand2),
    46. (LeftHand2, LeftHand3),
    47. (LeftHand3, LeftHand4),
    48. (Neck, RightHand1),
    49. (RightHand1, RightHand2),
    50. (RightHand2, RightHand3),
    51. (RightHand3, RightHand4),
    52. ];
    53. class RefdefView {
    54. public:
    55. ImVec2 tanHalfFov; // 0x00
    56. ImVec3 vieworg; // 0x08
    57. ImVec3 axis[3]; // 0x14
    58. ImVec3 origin; // 0x6C
    59. };
    60. class refdef_t {
    61. public:
    62. int x; // 0x00
    63. int y; // 0x04
    64. int width; // 0x08
    65. int height; // 0x0C
    66. RefdefView view; // 0x10
    67. };
    68. class PosInfo {
    69. public:
    70. ImVec3 Origin; //0x40
    71. float Rotation; //0x58
    72. };
    73. class refdefKeyStruct {
    74. public:
    75. DWORD ref0; // 0x00
    76. DWORD ref1; // 0x04
    77. DWORD ref2; // 0x08
    78. };
    79. uint64_t DecryptRefDef()
    80. {
    81. refdefKeyStruct crypt = driver::read<refdefKeyStruct>(g_Sock, process_id, module_base + offsets::ref_def);
    82. DWORD lower = crypt.ref0 ^ (crypt.ref2 ^ (unsigned __int64)(module_base + offsets::ref_def)) * ((crypt.ref2 ^ (unsigned __int64)(module_base + offsets::ref_def)) + 2);
    83. DWORD upper = crypt.ref1 ^ (crypt.ref2 ^ (unsigned __int64)(module_base + offsets::ref_def + 0x4)) * ((crypt.ref2 ^ (unsigned __int64)(module_base + offsets::ref_def + 0x4)) + 2);
    84. uint64_t refDefKey = (uint64_t)upper << 32 | lower;
    85. return refDefKey;
    86. }
    87. bool WorldToScreen(ImVec3 vOrigin, refdef_t refdef, ImVec2* vOut)
    88. {
    89. ImVec3 vLocal, vTrans;
    90. vLocal = ImVec3(vOrigin.x - refdef.view.vieworg.x, vOrigin.y - refdef.view.vieworg.y, vOrigin.z - refdef.view.vieworg.z);
    91. vTrans.x = vLocal.x * refdef.view.axis[1].x + vLocal.y * refdef.view.axis[1].y + vLocal.z * refdef.view.axis[1].z;
    92. vTrans.y = vLocal.x * refdef.view.axis[2].x + vLocal.y * refdef.view.axis[2].y + vLocal.z * refdef.view.axis[2].z;
    93. vTrans.z = vLocal.x * refdef.view.axis[0].x + vLocal.y * refdef.view.axis[0].y + vLocal.z * refdef.view.axis[0].z;
    94. if (vTrans.z < 0.01f)
    95. return false;
    96. vOut->x = ((refdef.width / 2) * (1 - (vTrans.x / refdef.view.tanHalfFov.x / vTrans.z)));
    97. vOut->y = ((refdef.height / 2) * (1 - (vTrans.y / refdef.view.tanHalfFov.y / vTrans.z)));
    98. return true;
    99. }