diff --git a/src/services/gui/gui_service.hpp b/src/services/gui/gui_service.hpp index d6c07a47..f9cc9105 100644 --- a/src/services/gui/gui_service.hpp +++ b/src/services/gui/gui_service.hpp @@ -22,8 +22,6 @@ namespace big HANDLING_CURRENT_PROFILE, LSC, SPAWN_VEHICLE, - PV, - PERSIST_CAR, FUN_VEHICLE, WORLD, @@ -58,7 +56,7 @@ namespace big struct navigation_struct { - char name[48] = ""; + char name[48] = ""; std::function func = nullptr; std::map sub_nav{}; rage::joaat_t hash = rage::joaat(name); @@ -103,8 +101,6 @@ namespace big }, {tabs::LSC, {"GUI_TAB_LSC", view::lsc}}, {tabs::SPAWN_VEHICLE, {"GUI_TAB_SPAWN_VEHICLE", view::spawn_vehicle}}, - {tabs::PV, {"GUI_TAB_PERSONAL_VEHICLE", view::pv}}, - {tabs::PERSIST_CAR, {"GUI_TAB_PERSIST_CAR", view::persist_car}}, {tabs::FUN_VEHICLE, {"GUI_TAB_VEHICLE_FUN_FEATURES", view::fun_vehicle}}, }, }, diff --git a/src/views/vehicle/view_persist_car.cpp b/src/views/vehicle/spawn/view_persist_car.cpp similarity index 80% rename from src/views/vehicle/view_persist_car.cpp rename to src/views/vehicle/spawn/view_persist_car.cpp index d0148c14..6cae36ac 100644 --- a/src/views/vehicle/view_persist_car.cpp +++ b/src/views/vehicle/spawn/view_persist_car.cpp @@ -52,7 +52,9 @@ namespace big for (const auto& pair : vehicle_files) { if (ImGui::Selectable(pair.c_str(), selected_vehicle_file == pair)) - selected_vehicle_file = pair; + selected_vehicle_file = pair, g_fiber_pool->queue_job([] { + load_vehicle(selected_vehicle_file); + }); } ImGui::EndListBox(); @@ -63,10 +65,9 @@ namespace big ImGui::BeginGroup(); static char vehicle_file_name_input[50]{}; + components::small_text("VEHICLE_FILE_NAME"_T); ImGui::PushItemWidth(250); - components::input_text_with_hint("VEHICLE_FILE_NAME"_T, "VEHICLE_FILE_NAME_EXAMPLE"_T, vehicle_file_name_input, IM_ARRAYSIZE(vehicle_file_name_input)); - - ImGui::SameLine(); + components::input_text_with_hint("##vehiclefilename", "VEHICLE_FILE_NAME_EXAMPLE"_T, vehicle_file_name_input, IM_ARRAYSIZE(vehicle_file_name_input)); components::button("SAVE_VEHICLE"_T, [] { if (!self::veh) @@ -75,13 +76,6 @@ namespace big save_vehicle(vehicle_file_name_input); }); - components::button("LOAD_VEHICLE"_T, [] { - if (self::veh) - return g_notification_service->push_warning("PERSIST_CAR"_T.data(), "You must not be in a vehicle. Please exit your vehicle before using load."); - - load_vehicle(selected_vehicle_file); - }); - ImGui::EndGroup(); } } diff --git a/src/views/vehicle/view_pv.cpp b/src/views/vehicle/spawn/view_pv.cpp similarity index 100% rename from src/views/vehicle/view_pv.cpp rename to src/views/vehicle/spawn/view_pv.cpp diff --git a/src/views/vehicle/view_spawn_vehicle.cpp b/src/views/vehicle/view_spawn_vehicle.cpp index 3a24e1b5..ac77a4cd 100644 --- a/src/views/vehicle/view_spawn_vehicle.cpp +++ b/src/views/vehicle/view_spawn_vehicle.cpp @@ -7,7 +7,7 @@ namespace big { - void view::spawn_vehicle() + void render_spawn_new_vehicle() { ImGui::SetWindowSize({0.f, (float)*g_pointers->m_gta.m_resolution_y}, ImGuiCond_Always); @@ -36,7 +36,7 @@ namespace big ImGui::SetNextItemWidth(300.f); if (ImGui::BeginCombo("VEHICLE_CLASS"_T.data(), - selected_class == -1 ? "ALL"_T.data() : class_arr[selected_class].c_str())) + selected_class == -1 ? "ALL"_T.data() : class_arr[selected_class].c_str())) { if (ImGui::Selectable("ALL"_T.data(), selected_class == -1)) { @@ -196,4 +196,21 @@ namespace big ImGui::EndListBox(); } } + + void view::spawn_vehicle() + { + static int spawn_type = 0; + ImGui::RadioButton("New", &spawn_type, 0); + ImGui::SameLine(); + ImGui::RadioButton("Personal", &spawn_type, 1); + ImGui::SameLine(); + ImGui::RadioButton("Persistent", &spawn_type, 2); + + switch (spawn_type) + { + case 0: render_spawn_new_vehicle(); break; + case 1: view::pv(); break; + case 2: view::persist_car(); break; + } + } }