diff --git a/src/core/settings.hpp b/src/core/settings.hpp index c56b803c..9ef5e21f 100644 --- a/src/core/settings.hpp +++ b/src/core/settings.hpp @@ -868,9 +868,9 @@ namespace big bool opened = false; bool operation_animation = true; bool render_distance_on_veh = false; - float max_summon_range = 200.f; + bool show_info = false; - NLOHMANN_DEFINE_TYPE_INTRUSIVE(vehicle_control, operation_animation, max_summon_range, render_distance_on_veh) + NLOHMANN_DEFINE_TYPE_INTRUSIVE(vehicle_control, operation_animation, render_distance_on_veh, show_info) } vehicle_control{}; NLOHMANN_DEFINE_TYPE_INTRUSIVE(window, background_color, demo, text_color, button_color, frame_color, gui_scale, switched_view, ingame_overlay, vehicle_control, ingame_overlay_indicators) diff --git a/src/services/vehicle/vehicle_control_service.cpp b/src/services/vehicle/vehicle_control_service.cpp index 54f06702..4e2d738a 100644 --- a/src/services/vehicle/vehicle_control_service.cpp +++ b/src/services/vehicle/vehicle_control_service.cpp @@ -7,6 +7,7 @@ #include "util/pathfind.hpp" #include "util/ped.hpp" #include "util/vehicle.hpp" +#include "util/mobile.hpp" namespace big { @@ -70,6 +71,9 @@ namespace big controlled_vehicle vehicle_control::update_vehicle(Vehicle veh) { + if(!ENTITY::DOES_ENTITY_EXIST(veh)) + return {}; + controlled_vehicle new_veh{}; new_veh.handle = veh; @@ -78,6 +82,7 @@ namespace big new_veh.doorCount = VEHICLE::GET_NUMBER_OF_VEHICLE_DOORS(veh); new_veh.lockstate = (eVehicleLockState)VEHICLE::GET_VEHICLE_DOOR_LOCK_STATUS(veh); new_veh.isconvertible = VEHICLE::IS_VEHICLE_A_CONVERTIBLE(veh, 0); + update_controlled_vehicle_doors(new_veh); update_controlled_vehicle_lights(new_veh); @@ -94,9 +99,7 @@ namespace big veh.convertibelstate = VEHICLE::GET_CONVERTIBLE_ROOF_STATE(veh.handle); veh.engine = VEHICLE::GET_IS_VEHICLE_ENGINE_RUNNING(veh.handle); - veh.radio = AUDIO::IS_VEHICLE_RADIO_ON(veh.handle); - veh.radiochannel = AUDIO::GET_PLAYER_RADIO_STATION_INDEX(); - + if (g.window.vehicle_control.render_distance_on_veh && math::distance_between_vectors(self::pos, ENTITY::GET_ENTITY_COORDS(m_controlled_vehicle.handle, true)) > 10.f) vehicle_control::render_distance_on_vehicle(); @@ -106,47 +109,21 @@ namespace big * Imitated from freemode.c script, findable by searching for MISC::GET_HASH_KEY("BONEMASK_HEAD_NECK_AND_R_ARM"); * Script uses TASK::TASK_SCRIPTED_ANIMATION but can be dissected to use as follows */ - void vehicle_control::animated_vehicle_operation(Ped ped) + void vehicle_control::vehicle_operation(std::function operation) { - ped::ped_play_animation(ped, VEH_OP_ANIM_DICT, VEH_OP_ANIM, 4, -4, -1, 48, 0, false); - AUDIO::PLAY_SOUND_FROM_ENTITY(-1, "Remote_Control_Fob", self::ped, "PI_Menu_Sounds", true, 0); - script::get_current()->yield(100ms); - for (int i = 0; i < 35 && ENTITY::IS_ENTITY_PLAYING_ANIM(self::ped, VEH_OP_ANIM_DICT, VEH_OP_ANIM, 3); i++) + if (g.window.vehicle_control.operation_animation) { - script::get_current()->yield(10ms); + ped::ped_play_animation(self::ped, VEH_OP_ANIM_DICT, VEH_OP_ANIM, 4, -4, -1, 48, 0, false); + AUDIO::PLAY_SOUND_FROM_ENTITY(-1, "Remote_Control_Fob", self::ped, "PI_Menu_Sounds", true, 0); + script::get_current()->yield(100ms); + for (int i = 0; i < 35 && ENTITY::IS_ENTITY_PLAYING_ANIM(self::ped, VEH_OP_ANIM_DICT, VEH_OP_ANIM, 3); i++) + { + script::get_current()->yield(10ms); + } } - } - void vehicle_control::operate_door(eDoorId door, bool open) - { - if (g.window.vehicle_control.operation_animation) - animated_vehicle_operation(self::ped); - - vehicle::operate_vehicle_door(m_controlled_vehicle.handle, door, open); - } - - void vehicle_control::operate_window(eWindowId window, bool open) - { - if (g.window.vehicle_control.operation_animation) - animated_vehicle_operation(self::ped); - - vehicle::operate_vehicle_window(m_controlled_vehicle.handle, window, open); - } - - void vehicle_control::operate_lights(bool headlights, bool highbeams) - { - if (g.window.vehicle_control.operation_animation) - animated_vehicle_operation(self::ped); - - vehicle::operate_vehicle_headlights(m_controlled_vehicle.handle, headlights, highbeams); - } - - void vehicle_control::operate_neons(int index, bool toggle) - { - if (g.window.vehicle_control.operation_animation) - animated_vehicle_operation(self::ped); - - vehicle::operate_vehicle_neons(m_controlled_vehicle.handle, index, toggle); + if (entity::take_control_of(m_controlled_vehicle.handle)) + operation(); } void vehicle_control::driver_tick() @@ -321,15 +298,6 @@ namespace big behind_pos = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0.f, 4.f, 0.f); } - if (math::distance_between_vectors(self::pos, ENTITY::GET_ENTITY_COORDS(m_controlled_vehicle.handle, true)) - > g.window.vehicle_control.max_summon_range) - { - //LOG(INFO) << "Vehicle is too far, teleporting"; - m_destination = behind_pos; - ENTITY::SET_ENTITY_COORDS(m_controlled_vehicle.handle, behind_pos.x, behind_pos.y, behind_pos.z, 0, 0, 0, false); - return; - } - m_driver_performing_task = true; if (ensure_driver()) @@ -376,13 +344,8 @@ namespace big } } - void vehicle_control::tick() + void vehicle_control::get_last_driven_vehicle() { - m_controlled_vehicle_exists = m_controlled_vehicle.ptr && ENTITY::DOES_ENTITY_EXIST(m_controlled_vehicle.handle) - && VEHICLE::IS_THIS_MODEL_A_CAR(ENTITY::GET_ENTITY_MODEL(m_controlled_vehicle.handle)); - - driver_tick(); - //Check in memory for vehicle if (g_local_player) { @@ -399,13 +362,42 @@ namespace big m_controlled_vehicle = vehicle_control::update_vehicle(self::veh); } - if (!g.window.vehicle_control.opened) - return; - //Manual check if there is a last driven vehicle if (!m_controlled_vehicle_exists && ENTITY::DOES_ENTITY_EXIST(VEHICLE::GET_LAST_DRIVEN_VEHICLE())) m_controlled_vehicle = vehicle_control::update_vehicle(VEHICLE::GET_LAST_DRIVEN_VEHICLE()); + } + void vehicle_control::get_personal_vehicle() + { + if(ENTITY::DOES_ENTITY_EXIST(mobile::mechanic::get_personal_vehicle())) + m_controlled_vehicle = vehicle_control::update_vehicle(mobile::mechanic::get_personal_vehicle()); + } + + void vehicle_control::get_closest_vehicle() + { + if(PED::IS_PED_IN_ANY_VEHICLE(self::ped, true)) + m_controlled_vehicle = vehicle_control::update_vehicle(PED::GET_VEHICLE_PED_IS_USING(self::ped)); + else + { + m_controlled_vehicle = vehicle_control::update_vehicle(vehicle::get_closest_to_location(self::pos, 1000)); + } + } + + void vehicle_control::tick() + { + m_controlled_vehicle_exists = m_controlled_vehicle.ptr && ENTITY::DOES_ENTITY_EXIST(m_controlled_vehicle.handle); + + driver_tick(); keep_controlled_vehicle_data_updated(m_controlled_vehicle); + + if (!g.window.vehicle_control.opened) + return; + + switch (m_selection_mode) + { + case eControlledVehSelectionMode::LAST_DRIVEN: get_last_driven_vehicle(); break; + case eControlledVehSelectionMode::PERSONAL: get_personal_vehicle(); break; + case eControlledVehSelectionMode::CLOSEST: get_closest_vehicle(); break; + } } } \ No newline at end of file diff --git a/src/services/vehicle/vehicle_control_service.hpp b/src/services/vehicle/vehicle_control_service.hpp index c4060d0d..e6b49e52 100644 --- a/src/services/vehicle/vehicle_control_service.hpp +++ b/src/services/vehicle/vehicle_control_service.hpp @@ -9,6 +9,13 @@ namespace big constexpr auto VEH_OP_ANIM_DICT = "ANIM@MP_PLAYER_INTMENU@KEY_FOB@"; constexpr auto VEH_OP_ANIM = "FOB_CLICK"; + enum class eControlledVehSelectionMode + { + LAST_DRIVEN, + PERSONAL, + CLOSEST + }; + struct vehicle_door { eDoorId id; @@ -36,8 +43,6 @@ namespace big bool engine; bool neons[4]; bool isconvertible; - bool radio; - int radiochannel; int convertibelstate; int headlights, highbeams; }; @@ -47,6 +52,9 @@ namespace big private: controlled_vehicle update_vehicle(Vehicle veh); void keep_controlled_vehicle_data_updated(controlled_vehicle& veh); + void get_last_driven_vehicle(); + void get_personal_vehicle(); + void get_closest_vehicle(); //Autonomy void driver_tick(); @@ -60,17 +68,14 @@ namespace big public: controlled_vehicle m_controlled_vehicle; bool m_controlled_vehicle_exists; + eControlledVehSelectionMode m_selection_mode = eControlledVehSelectionMode::LAST_DRIVEN; //Autonomy bool m_driver_performing_task; int m_distance_to_destination; char m_currentask[100]; - void animated_vehicle_operation(Ped ped); - void operate_door(eDoorId, bool); - void operate_window(eWindowId, bool); - void operate_lights(bool headlights, bool highbeams); - void operate_neons(int index, bool toggle); + void vehicle_operation(std::function operation); void summon_vehicle(); void tick(); diff --git a/src/views/view_vehicle_control.cpp b/src/views/view_vehicle_control.cpp index da852001..e62afc67 100644 --- a/src/views/view_vehicle_control.cpp +++ b/src/views/view_vehicle_control.cpp @@ -42,31 +42,29 @@ namespace big { for (int lockindex = 0; lockindex < MAX_VEHICLE_LOCK_STATES; lockindex++) { - if (ImGui::Selectable(locknames[lockindex])) - { - g_fiber_pool->queue_job([=] { + components::selectable(locknames[lockindex], false, [lockindex] { + g_vehicle_control_service.vehicle_operation([lockindex] { vehicle::change_vehicle_door_lock_state(g_vehicle_control_service.m_controlled_vehicle.handle, eDoorId::VEH_EXT_DOOR_INVALID_ID, (eVehicleLockState)lockindex); }); - }; + }); } ImGui::EndCombo(); } ImGui::SameLine(); - if (components::button("OPEN_ALL_DOORS"_T)) - { - g_fiber_pool->queue_job([=] { - g_vehicle_control_service.operate_door(eDoorId::VEH_EXT_DOOR_INVALID_ID, true); + components::button("OPEN_ALL_DOORS"_T, [] { + g_vehicle_control_service.vehicle_operation([] { + vehicle::operate_vehicle_door(g_vehicle_control_service.m_controlled_vehicle.handle, eDoorId::VEH_EXT_DOOR_INVALID_ID, true); }); - } + }); + ImGui::SameLine(); - if (components::button("CLOSE_ALL_DOORS"_T)) - { - g_fiber_pool->queue_job([=] { - g_vehicle_control_service.operate_door(eDoorId::VEH_EXT_DOOR_INVALID_ID, false); + components::button("CLOSE_ALL_DOORS"_T, [] { + g_vehicle_control_service.vehicle_operation([] { + vehicle::operate_vehicle_door(g_vehicle_control_service.m_controlled_vehicle.handle, eDoorId::VEH_EXT_DOOR_INVALID_ID, false); }); - } + }); ImGui::EndGroup(); @@ -84,12 +82,11 @@ namespace big { for (int lockindex = 0; lockindex < MAX_VEHICLE_LOCK_STATES; lockindex++) { - if (ImGui::Selectable(locknames[lockindex])) - { - g_fiber_pool->queue_job([=] { + components::selectable(locknames[lockindex], false, [i, lockindex] { + g_vehicle_control_service.vehicle_operation([i, lockindex] { vehicle::change_vehicle_door_lock_state(g_vehicle_control_service.m_controlled_vehicle.handle, (eDoorId)i, (eVehicleLockState)lockindex); }); - }; + }); } ImGui::EndCombo(); } @@ -97,17 +94,17 @@ namespace big ImGui::SameLine(300); const auto button_label = g_vehicle_control_service.m_controlled_vehicle.doors[i].open ? "CLOSE"_T : "OPEN"_T; - if (components::button(button_label)) - { - g_fiber_pool->queue_job([=] { - g_vehicle_control_service.operate_door((eDoorId)i, + components::button(button_label, [i] { + g_vehicle_control_service.vehicle_operation([i] { + vehicle::operate_vehicle_door(g_vehicle_control_service.m_controlled_vehicle.handle, + (eDoorId)i, !g_vehicle_control_service.m_controlled_vehicle.doors[i].open); }); - } + }); + ImGui::PopID(); } - ImGui::EndGroup(); } @@ -124,11 +121,11 @@ namespace big ImGui::Spacing(); ImGui::SetNextItemWidth(200); components::button("VIEW_VEHICLE_CONTROL_ROLL_DOWN_ALL"_T, [] { - g_vehicle_control_service.operate_window(eWindowId::WINDOW_INVALID_ID, true); + vehicle::operate_vehicle_window(g_vehicle_control_service.m_controlled_vehicle.handle, eWindowId::WINDOW_INVALID_ID, true); }); ImGui::SameLine(); components::button("VIEW_VEHICLE_CONTROL_ROLL_UP_ALL"_T, [] { - g_vehicle_control_service.operate_window(eWindowId::WINDOW_INVALID_ID, false); + vehicle::operate_vehicle_window(g_vehicle_control_service.m_controlled_vehicle.handle, eWindowId::WINDOW_INVALID_ID, false); }); ImGui::EndGroup(); @@ -143,11 +140,11 @@ namespace big ImGui::Text(windownames[i]); ImGui::SameLine(300); components::button("VIEW_VEHICLE_CONTROL_ROLL_DOWN"_T, [i] { - g_vehicle_control_service.operate_window((eWindowId)i, true); + vehicle::operate_vehicle_window(g_vehicle_control_service.m_controlled_vehicle.handle, (eWindowId)i, true); }); ImGui::SameLine(); components::button("VIEW_VEHICLE_CONTROL_ROLL_UP"_T, [i] { - g_vehicle_control_service.operate_window((eWindowId)i, false); + vehicle::operate_vehicle_window(g_vehicle_control_service.m_controlled_vehicle.handle, (eWindowId)i, false); }); ImGui::PopID(); } @@ -162,37 +159,36 @@ namespace big "BACK"_T.data(), }; - if (components::button("VEHICLE_CONTROLLER_TOGGLE_LIGHTS"_T)) - { - g_fiber_pool->queue_job([=] { - g_vehicle_control_service.operate_lights(!g_vehicle_control_service.m_controlled_vehicle.headlights, false); + components::button("VEHICLE_CONTROLLER_TOGGLE_LIGHTS"_T, [] { + g_vehicle_control_service.vehicle_operation([=] { + vehicle::operate_vehicle_headlights(g_vehicle_control_service.m_controlled_vehicle.handle, + !g_vehicle_control_service.m_controlled_vehicle.headlights, + false); }); - } + }); + ImGui::SameLine(); - if (components::button("VEHICLE_CONTROLLER_TOGGLE_HIGH_BEAMS"_T)) - { - g_fiber_pool->queue_job([=] { - g_vehicle_control_service.operate_lights(g_vehicle_control_service.m_controlled_vehicle.headlights, + components::button("VEHICLE_CONTROLLER_TOGGLE_HIGH_BEAMS"_T, [] { + g_vehicle_control_service.vehicle_operation([=] { + vehicle::operate_vehicle_headlights(g_vehicle_control_service.m_controlled_vehicle.handle, + g_vehicle_control_service.m_controlled_vehicle.headlights, !g_vehicle_control_service.m_controlled_vehicle.highbeams); }); - } - if (components::button("VEHICLE_CONTROLLER_INTERIOR_LIGHTS_ON"_T)) - { - g_fiber_pool->queue_job([=] { - if (g.window.vehicle_control.operation_animation) - g_vehicle_control_service.animated_vehicle_operation(self::ped); + }); + + components::button("VEHICLE_CONTROLLER_INTERIOR_LIGHTS_ON"_T, [] { + g_vehicle_control_service.vehicle_operation([] { VEHICLE::SET_VEHICLE_INTERIORLIGHT(g_vehicle_control_service.m_controlled_vehicle.handle, true); }); - } + }); + ImGui::SameLine(); - if (components::button("VEHICLE_CONTROLLER_INTERIOR_LIGHTS_OFF"_T)) - { - g_fiber_pool->queue_job([=] { - if (g.window.vehicle_control.operation_animation) - g_vehicle_control_service.animated_vehicle_operation(self::ped); + + components::button("VEHICLE_CONTROLLER_INTERIOR_LIGHTS_OFF"_T, [] { + g_vehicle_control_service.vehicle_operation([] { VEHICLE::SET_VEHICLE_INTERIORLIGHT(g_vehicle_control_service.m_controlled_vehicle.handle, false); }); - } + }); ImGui::Text("VEHICLE_CONTROLLER_NEON_LIGHTS"_T.data()); ImGui::Separator(); @@ -202,7 +198,11 @@ namespace big if (ImGui::Checkbox(neonnames[i], &g_vehicle_control_service.m_controlled_vehicle.neons[i])) { g_fiber_pool->queue_job([=] { - g_vehicle_control_service.operate_neons(i, g_vehicle_control_service.m_controlled_vehicle.neons[i]); + g_vehicle_control_service.vehicle_operation([i] { + vehicle::operate_vehicle_neons(g_vehicle_control_service.m_controlled_vehicle.handle, + i, + !g_vehicle_control_service.m_controlled_vehicle.neons[i]); + }); }); } } @@ -258,49 +258,47 @@ namespace big if (g_vehicle_control_service.m_controlled_vehicle.isconvertible) { - if (components::button(g_vehicle_control_service.m_controlled_vehicle.convertibelstate ? "VIEW_VEHICLE_CONTROL_RAISE"_T : "VIEW_VEHICLE_CONTROL_LOWER"_T)) - { - g_fiber_pool->queue_job([=] { - if (g.window.vehicle_control.operation_animation) - g_vehicle_control_service.animated_vehicle_operation(self::ped); - + components::button(g_vehicle_control_service.m_controlled_vehicle.convertibelstate ? "VIEW_VEHICLE_CONTROL_RAISE"_T : "VIEW_VEHICLE_CONTROL_LOWER"_T, [] { + g_vehicle_control_service.vehicle_operation([] { if (g_vehicle_control_service.m_controlled_vehicle.convertibelstate > 0) VEHICLE::RAISE_CONVERTIBLE_ROOF(g_vehicle_control_service.m_controlled_vehicle.handle, false); else VEHICLE::LOWER_CONVERTIBLE_ROOF(g_vehicle_control_service.m_controlled_vehicle.handle, false); }); - } + }); ImGui::SameLine(); - ImGui::Text(std::format("{}: {}", "VIEW_VEHICLE_CONTROL_CONVERTIBLE_STATE"_T, convertiblestates[g_vehicle_control_service.m_controlled_vehicle.convertibelstate]).c_str()); + ImGui::Text(std::format("{}: {}", + "VIEW_VEHICLE_CONTROL_CONVERTIBLE_STATE"_T, + convertiblestates[g_vehicle_control_service.m_controlled_vehicle.convertibelstate]) + .c_str()); } - if (ImGui::Checkbox(g_vehicle_control_service.m_controlled_vehicle.engine ? "VIEW_DEBUG_ANIMATIONS_STOP"_T.data() : "SETTINGS_NOTIFY_GTA_THREADS_START"_T.data(), + if (ImGui::Checkbox(g_vehicle_control_service.m_controlled_vehicle.engine ? + "VIEW_DEBUG_ANIMATIONS_STOP"_T.data() : + "SETTINGS_NOTIFY_GTA_THREADS_START"_T.data(), &g_vehicle_control_service.m_controlled_vehicle.engine)) { g_fiber_pool->queue_job([=] { - if (g.window.vehicle_control.operation_animation) - g_vehicle_control_service.animated_vehicle_operation(self::ped); - - if (entity::take_control_of(g_vehicle_control_service.m_controlled_vehicle.handle)) + g_vehicle_control_service.vehicle_operation([] { VEHICLE::SET_VEHICLE_ENGINE_ON(g_vehicle_control_service.m_controlled_vehicle.handle, !g_vehicle_control_service.m_controlled_vehicle.engine, true, false); + }); }); } ImGui::SameLine(); - ImGui::Text(std::format("{}: {}", "VIEW_VEHICLE_CONTROL_ENGINE"_T, g_vehicle_control_service.m_controlled_vehicle.engine ? "VIEW_VEHICLE_CONTROL_ENGINE_RUNNING"_T : "OFF"_T).c_str()); + ImGui::Text( + std::format("{}: {}", "VIEW_VEHICLE_CONTROL_ENGINE"_T, g_vehicle_control_service.m_controlled_vehicle.engine ? "VIEW_VEHICLE_CONTROL_ENGINE_RUNNING"_T : "OFF"_T) + .c_str()); components::button(g_vehicle_control_service.m_driver_performing_task ? "CANCEL"_T : "VIEW_VEHICLE_CONTROL_SUMMON"_T, [] { if (!g_vehicle_control_service.m_driver_performing_task) - { - if (g.window.vehicle_control.operation_animation) - g_vehicle_control_service.animated_vehicle_operation(self::ped); - - g_vehicle_control_service.summon_vehicle(); - } + g_vehicle_control_service.vehicle_operation([] { + g_vehicle_control_service.summon_vehicle(); + }); else g_vehicle_control_service.m_driver_performing_task = false; }); @@ -308,7 +306,9 @@ namespace big if (g_vehicle_control_service.m_driver_performing_task) { ImGui::SameLine(); - ImGui::Text(std::format("{}: {}", "VIEW_SELF_CUSTOM_TELEPORT_DISTANCE"_T, g_vehicle_control_service.m_distance_to_destination).c_str()); + ImGui::Text(std::format("{}: {}", "VIEW_SELF_CUSTOM_TELEPORT_DISTANCE"_T, g_vehicle_control_service.m_distance_to_destination) + .c_str()); + ImGui::Text(std::format("{}: {}", "OUTFIT_TASK"_T, g_vehicle_control_service.m_currentask).c_str()); } @@ -318,14 +318,23 @@ namespace big g.window.vehicle_control.operation_animation); bool_command render_veh_dist("vehcontrolrendervehdist", "VIEW_VEHICLE_CONTROL_RENDER_DISTANCE_ON_VEHICLE", "VIEW_VEHICLE_CONTROL_RENDER_DISTANCE_ON_VEHICLE_DESC", g.window.vehicle_control.render_distance_on_veh); - float_command max_summon_dist("vehcontrolmaxsummondist", "VIEW_VEHICLE_CONTROL_MAX_SUMMON_DISTANCE", "VIEW_VEHICLE_CONTROL_MAX_SUMMON_DISTANCE_DESC", - g.window.vehicle_control.max_summon_range, 10.f, 250.f); + bool_command show_vehicle_info("vehcontrolshowvehinfo", "VIEW_VEHICLE_CONTROL_SHOW_VEHICLE_INFO", "VIEW_VEHICLE_CONTROL_SHOW_VEHICLE_INFO_DESC", + g.window.vehicle_control.show_info); void render_settings_tab() { components::command_checkbox<"vehcontroluseanims">(); components::command_checkbox<"vehcontrolrendervehdist">(); - components::command_float_slider<"vehcontrolmaxsummondist">(); + components::command_checkbox<"vehcontrolshowvehinfo">(); + + ImGui::SeparatorText("VIEW_VEHICLE_CONTROL_SELECTION_MODE"_T.data()); + ImGui::RadioButton("VIEW_VEHICLE_CONTROL_SELECTION_MODE_LAST_DRIVEN"_T.data(), (int*)&g_vehicle_control_service.m_selection_mode, (int)eControlledVehSelectionMode::LAST_DRIVEN); + ImGui::SameLine(); + ImGui::RadioButton("VIEW_VEHICLE_CONTROL_SELECTION_MODE_PERSONAL_VEHICLE"_T.data(), + (int*)&g_vehicle_control_service.m_selection_mode, + (int)eControlledVehSelectionMode::PERSONAL); + ImGui::SameLine(); + ImGui::RadioButton("VIEW_VEHICLE_CONTROL_SELECTION_MODE_CLOSEST"_T.data(), (int*)&g_vehicle_control_service.m_selection_mode, (int)eControlledVehSelectionMode::CLOSEST); } void view::vehicle_control() @@ -340,6 +349,15 @@ namespace big if (g_vehicle_control_service.m_controlled_vehicle_exists) { ImGui::Text(g_vehicle_control_service.m_controlled_vehicle.model_name); + if (g.window.vehicle_control.show_info) + { + ImGui::Text(std::vformat("VIEW_VEHICLE_CONTROL_HEALTH_N_PASSENGERS"_T, + std::make_format_args(g_vehicle_control_service.m_controlled_vehicle.ptr->m_health, + g_vehicle_control_service.m_controlled_vehicle.ptr->m_num_of_passengers, + g_vehicle_control_service.m_controlled_vehicle.ptr->m_max_passengers)) + .c_str()); + } + ImGui::Separator(); ImGui::Spacing(); if (ImGui::BeginTabBar("##vehiclecontroltabbar")) @@ -386,7 +404,6 @@ namespace big ImGui::EndTabItem(); } - ImGui::EndTabBar(); } }