feat(Population): Optimised settings

This commit is contained in:
Yimura 2021-01-17 23:26:06 +01:00
parent 7ce2dd69e6
commit 391f8665fa
No known key found for this signature in database
GPG Key ID: 54EFAD29393A6E78
3 changed files with 26 additions and 19 deletions

View File

@ -4,15 +4,14 @@ namespace big
{ {
void features::population_modifiers() void features::population_modifiers()
{ {
if (g_settings.options["population_modifiers"].get<bool>()) auto& population = g_settings.options["world"]["population"];
{
QUEUE_JOB_BEGIN_CLAUSE()
{
PED::SET_PED_DENSITY_MULTIPLIER_THIS_FRAME((float)g_settings.options["pedestrian_population"].get<double>());
VEHICLE::SET_PARKED_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME((float)g_settings.options["parked_vehicle_density"].get<double>()); if (population["enabled"])
VEHICLE::SET_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME((float)g_settings.options["vehicle_density"].get<double>()); {
}QUEUE_JOB_END_CLAUSE PED::SET_PED_DENSITY_MULTIPLIER_THIS_FRAME((float)population["pedestrians"].get<double>());
VEHICLE::SET_PARKED_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME((float)population["parked"].get<double>());
VEHICLE::SET_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME((float)population["vehicles"].get<double>());
} }
} }
} }

View File

@ -42,24 +42,27 @@ namespace big
ImGui::Separator(); ImGui::Separator();
if (ImGui::Checkbox("Population Modifiers", g_settings.options["population_modifiers"].get<bool*>())) if (ImGui::TreeNode("World Population"))
g_settings.save();
if (g_settings.options["population_modifiers"].get<bool>())
{ {
const double min = 0., max = 2.; const double min = 0., max = 2.;
auto& population = g_settings.options["world"]["population"];
if (ImGui::Checkbox("Enable", population["enabled"].get<bool*>()))
g_settings.save();
ImGui::Text("Pedestrian Population"); ImGui::Text("Pedestrian Population");
if (ImGui::SliderScalar("##ped_pop", ImGuiDataType_Double, g_settings.options["pedestrian_population"].get<double*>(), &min, &max)) if (ImGui::SliderScalar("##ped_pop", ImGuiDataType_Double, population["pedestrians"].get<double*>(), &min, &max))
g_settings.save(); g_settings.save();
ImGui::Text("Parked Vehicle Density:"); ImGui::Text("Parked Vehicle Density:");
if (ImGui::SliderScalar("##parked_veh_density", ImGuiDataType_Double, g_settings.options["parked_vehicle_density"].get<double*>(), &min, &max)) if (ImGui::SliderScalar("##parked_veh_density", ImGuiDataType_Double, population["parked"].get<double*>(), &min, &max))
g_settings.save(); g_settings.save();
ImGui::Text("Vehicle Density:"); ImGui::Text("Vehicle Density:");
if (ImGui::SliderScalar("##veh_density", ImGuiDataType_Double, g_settings.options["vehicle_density"].get<double*>(), &min, &max)) if (ImGui::SliderScalar("##veh_density", ImGuiDataType_Double, population["vehicles"].get<double*>(), &min, &max))
g_settings.save(); g_settings.save();
ImGui::TreePop();
} }
ImGui::EndTabItem(); ImGui::EndTabItem();

View File

@ -31,18 +31,15 @@ namespace big
"no_bike_fall": false, "no_bike_fall": false,
"no_idle_kick": false, "no_idle_kick": false,
"off_radar": false, "off_radar": false,
"parked_vehicle_density": 1.0,
"pedestrian_population": 1.0,
"population_modifiers": false,
"ragdoll": false, "ragdoll": false,
"rank": 6969, "rank": 6969,
"speedo_type": 0, "speedo_type": 0,
"spoof_rank": false, "spoof_rank": false,
"sticky_tyres": false, "sticky_tyres": false,
"super_sprint": false, "super_sprint": false,
"vehicle_density": 1.0,
"settings": { "settings": {
"protections": { "protections": {
"attach": false,
"cage": false, "cage": false,
"version_mismatch": false "version_mismatch": false
}, },
@ -71,6 +68,14 @@ namespace big
"get_event_data": false, "get_event_data": false,
"script_events": false "script_events": false
} }
},
"world": {
"population": {
"enabled": false,
"pedestrians": 1.0,
"parked": 1.0,
"vehicles": 1.0
}
} }
})"_json; })"_json;