Untitled
unknown
c_cpp
2 months ago
2.9 kB
5
Indexable
/// TODO: refactor bones to just pass variables into it. void DrawBones(ImDrawList* drawList, const PlayerData& player, size_t playerIndex, const VisualParams& params) { const auto bone_base_pos = BO6::decryption::get_bone_base_pos(client_info); /// TODO: refactor to allow easier maintainability and more games std::string game = selectedCheat.gameName; const auto bone_index = (game == "BO6") ? offsets::BO6::decrypt_bone_index(playerIndex) : offsets::MW3::decrypt_bone_index(playerIndex); const auto bone_ptr = BO6::get_bone_ptr(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"} }; DMA::ScatterMemory scatterMemory; auto scatterHandle = scatterMemory.Initialize(); std::unordered_map<int, vec3_t> bone_positions; for (const auto& bone : bones) { uintptr_t bone_addr = bone_ptr + (static_cast<uint64_t>(bone.id) * 0x20) + 0x10; scatterMemory.PrepareEX(scatterHandle, bone_addr, &bone_positions[bone.id], sizeof(vec3_t)); } if (!scatterMemory.ExecuteRead(scatterHandle)) { std::cerr << "ScatterMemory ExecuteRead failed." << std::endl; } scatterMemory.Close(scatterHandle); 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); } } // then somewhere in your render loop if (settings::visualsSettings::boneesp) { DrawBones(draw, player, i, params); }
Editor is loading...
Leave a Comment