From 391f8665faed83669c9632cc1474934aff8bce07 Mon Sep 17 00:00:00 2001 From: Yimura Date: Sun, 17 Jan 2021 23:26:06 +0100 Subject: [PATCH] feat(Population): Optimised settings --- .../looped/world/population_modifiers.cpp | 15 +++++++-------- BigBaseV2/src/gui/tab_bar/main/world.cpp | 17 ++++++++++------- BigBaseV2/src/settings.h | 13 +++++++++---- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/BigBaseV2/src/features/looped/world/population_modifiers.cpp b/BigBaseV2/src/features/looped/world/population_modifiers.cpp index a08225b8..c8c6ae6a 100644 --- a/BigBaseV2/src/features/looped/world/population_modifiers.cpp +++ b/BigBaseV2/src/features/looped/world/population_modifiers.cpp @@ -4,15 +4,14 @@ namespace big { void features::population_modifiers() { - if (g_settings.options["population_modifiers"].get()) - { - QUEUE_JOB_BEGIN_CLAUSE() - { - PED::SET_PED_DENSITY_MULTIPLIER_THIS_FRAME((float)g_settings.options["pedestrian_population"].get()); + auto& population = g_settings.options["world"]["population"]; - VEHICLE::SET_PARKED_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME((float)g_settings.options["parked_vehicle_density"].get()); - VEHICLE::SET_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME((float)g_settings.options["vehicle_density"].get()); - }QUEUE_JOB_END_CLAUSE + if (population["enabled"]) + { + PED::SET_PED_DENSITY_MULTIPLIER_THIS_FRAME((float)population["pedestrians"].get()); + + VEHICLE::SET_PARKED_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME((float)population["parked"].get()); + VEHICLE::SET_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME((float)population["vehicles"].get()); } } } \ No newline at end of file diff --git a/BigBaseV2/src/gui/tab_bar/main/world.cpp b/BigBaseV2/src/gui/tab_bar/main/world.cpp index 7dd6f017..f311a66c 100644 --- a/BigBaseV2/src/gui/tab_bar/main/world.cpp +++ b/BigBaseV2/src/gui/tab_bar/main/world.cpp @@ -42,24 +42,27 @@ namespace big ImGui::Separator(); - if (ImGui::Checkbox("Population Modifiers", g_settings.options["population_modifiers"].get())) - g_settings.save(); - - if (g_settings.options["population_modifiers"].get()) + if (ImGui::TreeNode("World Population")) { const double min = 0., max = 2.; + auto& population = g_settings.options["world"]["population"]; + + if (ImGui::Checkbox("Enable", population["enabled"].get())) + g_settings.save(); ImGui::Text("Pedestrian Population"); - if (ImGui::SliderScalar("##ped_pop", ImGuiDataType_Double, g_settings.options["pedestrian_population"].get(), &min, &max)) + if (ImGui::SliderScalar("##ped_pop", ImGuiDataType_Double, population["pedestrians"].get(), &min, &max)) g_settings.save(); ImGui::Text("Parked Vehicle Density:"); - if (ImGui::SliderScalar("##parked_veh_density", ImGuiDataType_Double, g_settings.options["parked_vehicle_density"].get(), &min, &max)) + if (ImGui::SliderScalar("##parked_veh_density", ImGuiDataType_Double, population["parked"].get(), &min, &max)) g_settings.save(); ImGui::Text("Vehicle Density:"); - if (ImGui::SliderScalar("##veh_density", ImGuiDataType_Double, g_settings.options["vehicle_density"].get(), &min, &max)) + if (ImGui::SliderScalar("##veh_density", ImGuiDataType_Double, population["vehicles"].get(), &min, &max)) g_settings.save(); + + ImGui::TreePop(); } ImGui::EndTabItem(); diff --git a/BigBaseV2/src/settings.h b/BigBaseV2/src/settings.h index 66d7e572..85f239ab 100644 --- a/BigBaseV2/src/settings.h +++ b/BigBaseV2/src/settings.h @@ -31,18 +31,15 @@ namespace big "no_bike_fall": false, "no_idle_kick": false, "off_radar": false, - "parked_vehicle_density": 1.0, - "pedestrian_population": 1.0, - "population_modifiers": false, "ragdoll": false, "rank": 6969, "speedo_type": 0, "spoof_rank": false, "sticky_tyres": false, "super_sprint": false, - "vehicle_density": 1.0, "settings": { "protections": { + "attach": false, "cage": false, "version_mismatch": false }, @@ -71,6 +68,14 @@ namespace big "get_event_data": false, "script_events": false } + }, + "world": { + "population": { + "enabled": false, + "pedestrians": 1.0, + "parked": 1.0, + "vehicles": 1.0 + } } })"_json;