Feat ptr cache continued (#1227)

This commit is contained in:
Quentin E. / iDeath
2023-04-14 18:54:07 +02:00
committed by GitHub
parent be5bb50c87
commit 74c3931209
134 changed files with 2490 additions and 1624 deletions

View File

@ -320,7 +320,7 @@ namespace big
const auto vehicle_rotation = ENTITY::GET_ENTITY_ROTATION(vehicle, 0);
bool has_collision = ENTITY::GET_ENTITY_COLLISION_DISABLED(object);
bool is_visible = ENTITY::IS_ENTITY_VISIBLE(object);
CObject* cobject = (CObject*)g_pointers->m_handle_to_ptr(vehicle);
CObject* cobject = (CObject*)g_pointers->m_gta.m_handle_to_ptr(vehicle);
bool is_invincible = misc::has_bit_set(&(int&)cobject->m_damage_bits, 8);
Vector3 rotation;
@ -335,7 +335,7 @@ namespace big
nlohmann::json persist_car_service::get_model_attachments(Vehicle vehicle, bool is_towed_vehicle)
{
const auto replay_interface = *g_pointers->m_replay_interface;
const auto replay_interface = *g_pointers->m_gta.m_replay_interface;
std::vector<nlohmann::json> attached_objects;
@ -346,7 +346,7 @@ namespace big
if (!object_ptr)
continue;
const auto object = g_pointers->m_ptr_to_handle(object_ptr);
const auto object = g_pointers->m_gta.m_ptr_to_handle(object_ptr);
if (!object)
break;
@ -365,7 +365,7 @@ namespace big
nlohmann::json persist_car_service::get_vehicle_attachents(Vehicle vehicle)
{
const auto replay_interface = *g_pointers->m_replay_interface;
const auto replay_interface = *g_pointers->m_gta.m_replay_interface;
const auto vehicle_interface = replay_interface->m_vehicle_interface;
@ -380,7 +380,7 @@ namespace big
if (!vehicle_ptr)
continue;
const auto object = g_pointers->m_ptr_to_handle(vehicle_ptr);
const auto object = g_pointers->m_gta.m_ptr_to_handle(vehicle_ptr);
if (!object)
break;
@ -445,7 +445,7 @@ namespace big
vehicle_json[pearlescent_color_key] = pearlescent_color;
bool has_collision = ENTITY::GET_ENTITY_COLLISION_DISABLED(vehicle);
bool is_visible = ENTITY::IS_ENTITY_VISIBLE(vehicle);
CVehicle* cvehicle = (CVehicle*)g_pointers->m_handle_to_ptr(vehicle);
CVehicle* cvehicle = (CVehicle*)g_pointers->m_gta.m_handle_to_ptr(vehicle);
bool is_invincible = misc::has_bit_set(&(int&)cvehicle->m_damage_bits, 8);
vehicle_json[has_collision_key] = !has_collision;
vehicle_json[is_visible_key] = is_visible;

View File

@ -73,7 +73,7 @@ namespace big
controlled_vehicle new_veh{};
new_veh.handle = veh;
new_veh.ptr = (CVehicle*)g_pointers->m_handle_to_ptr(veh);
new_veh.ptr = (CVehicle*)g_pointers->m_gta.m_handle_to_ptr(veh);
strcpy(new_veh.model_name, HUD::GET_FILENAME_FOR_AUDIO_CONVERSATION(VEHICLE::GET_DISPLAY_NAME_FROM_VEHICLE_MODEL(ENTITY::GET_ENTITY_MODEL(veh))));
new_veh.doorCount = VEHICLE::GET_NUMBER_OF_VEHICLE_DOORS(veh);
new_veh.lockstate = (eVehicleLockState)VEHICLE::GET_VEHICLE_DOOR_LOCK_STATUS(veh);
@ -377,7 +377,7 @@ namespace big
{
if (g_local_player->m_vehicle)
{
if (m_controlled_vehicle.handle != g_pointers->m_ptr_to_handle(g_local_player->m_vehicle))
if (m_controlled_vehicle.handle != g_pointers->m_gta.m_ptr_to_handle(g_local_player->m_vehicle))
m_controlled_vehicle = vehicle_control::update_vehicle(self::veh);
}
}