mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-06-18 23:17:52 +08:00

* feat(Spoofing): add spoofing * feat(Spoofing): prepare code for player attach * remove(PlayerAttach): isn't going to work due to netsync architecture * fix(GUI): fix scaling * feat(Project): add clang-format file * feat(Classes): update classes * fix(BlackHole): remove unnecessary cleanup * fix(Formatting): fix formatting for initializer lists * feat(clang-format): Set tab width and 1 space before comment Co-authored-by: Yimura <24669514+Yimura@users.noreply.github.com>
27 lines
913 B
C++
27 lines
913 B
C++
#include "handling_profile.hpp"
|
|
|
|
namespace big
|
|
{
|
|
handling_profile::handling_profile(CVehicle* vehicle)
|
|
{
|
|
m_gravity = vehicle->m_gravity;
|
|
m_handling_data = *vehicle->m_handling_data;
|
|
|
|
if (std::isinf(m_handling_data.m_traction_spring_delta_max_ratio))
|
|
m_handling_data.m_traction_spring_delta_max_ratio = 0.f;
|
|
}
|
|
|
|
void handling_profile::apply_to(CVehicle* vehicle, bool restore_hash) const
|
|
{
|
|
const auto hash = vehicle->m_handling_data->m_model_hash;
|
|
|
|
vehicle->m_gravity = m_gravity;
|
|
|
|
// cursed but works perfectly without overriding members that we shouldn't override
|
|
nlohmann::json j = m_handling_data;// exports our binary object so we can apply it field by field instead of copying the whole object
|
|
from_json(j, *vehicle->m_handling_data);// macro is defined in global scope of which CHandlingData is part of
|
|
|
|
if (restore_hash)
|
|
vehicle->m_handling_data->m_model_hash = hash;
|
|
}
|
|
} |