Untitled
void DrawBone(vec3_t from, vec3_t to, vec3_t m_location, ImU32 col, const PlayerData& player) { if (Distance3D(m_location, from) > 118 || Distance3D(m_location, to) > 118 || Distance3D(from, to) > 39) { return; } vec2_t W2S_from, W2S_to; if (!w2s(from, W2S_from) || !w2s(to, W2S_to)) { return; } auto draw = ImGui::GetForegroundDrawList(); draw->AddLine(ImVec2(W2S_from.x, W2S_from.y), ImVec2(W2S_to.x, W2S_to.y), col, 2.0f); } /// TODO: refactor bones to just pass variables into it. void DrawBones(ImDrawList* drawList, const PlayerData& player, size_t playerIndex, const VisualParams& params) { //auto bone_base = offsets::BO6::decrypt_bone_base(sdk::module_base, sdk::peb); const auto bone_base_pos = BO6::decryption::get_bone_base_pos(sdk::client_info); /// TODO: refactor to allow easier maintainability and more games std::string game = selectedCheat.gameName; const auto bone_index = offsets::BO6::decrypt_bone_index(playerIndex, sdk::module_base); const auto bone_ptr = BO6::get_bone_ptr(sdk::bone_base, bone_index); if (!bone_ptr) { return; } struct Bone { int id; const char* name; }; // cleaned up for better management in the future const Bone bones[] = { {7, "Head"}, {2, "Pelvis"}, {6, "Neck"}, {5, "Chest"}, {14, "L Shoulder"}, {16, "L Hand"}, {4, "LowerChest"}, {10, "R Shoulder"}, {12, "R Hand"}, {3, "Stomach"}, {17, "L Thigh"}, {20, "L Foot"}, {21, "R Thigh"}, {24, "R Foot"} }; std::unordered_map<int, vec3_t> bone_positions; /*for (const auto& bone : bones) { uintptr_t bone_addr = bone_ptr + (driver::read<uint64_t>(bone.id) * 0x20) + 0x10; }*/ for (const auto& bone : bones) { uintptr_t bone_addr = bone_ptr + (bone.id * 0x20) + 0x10; vec3_t bone_pos = driver::read<vec3_t>(bone_addr); bone_positions[bone.id] = bone_pos; } for (auto& [bone_id, bone_pos] : bone_positions) { bone_pos.x += bone_base_pos.x; bone_pos.y += bone_base_pos.y; bone_pos.z += bone_base_pos.z; } ImU32 boneColorU32 = player.isVisible ? ImGui::GetColorU32(ImVec4(settings::visualsSettings::boneColorVisible[0], settings::visualsSettings::boneColorVisible[1], settings::visualsSettings::boneColorVisible[2], params.alpha)) : ImGui::GetColorU32(ImVec4(settings::visualsSettings::boneColorNotVisible[0], settings::visualsSettings::boneColorNotVisible[1], settings::visualsSettings::boneColorNotVisible[2], params.alpha)); // cleaned up for better management in the future const std::pair<int, int> bone_pairs[] = { {6, 7}, {2, 6}, {2, 17}, {17, 20}, {2, 21}, {21, 24}, {6, 14}, {14, 16}, {16, 4}, {6, 10}, {10, 12}, {10, 3} }; for (const auto& bone_pair : bone_pairs) { DrawBone(bone_positions[bone_pair.first], bone_positions[bone_pair.second], player.position, boneColorU32, player); } }
Leave a Comment