From bf87449d3503cb6cf566c4ead51421b9c2d0de78 Mon Sep 17 00:00:00 2001 From: howdoiusekeyboard <90883505+howdoiusekeyboard@users.noreply.github.com> Date: Sun, 17 Jul 2022 02:25:31 +0530 Subject: [PATCH] Improve RGB Paint (#347) --- .../src/backend/looped/vehicle/rgb_paint.cpp | 20 ++++++-- BigBaseV2/src/core/globals.hpp | 12 +++++ .../src/views/vehicle/view_vehicle_fun.cpp | 51 +++++++++++-------- 3 files changed, 59 insertions(+), 24 deletions(-) diff --git a/BigBaseV2/src/backend/looped/vehicle/rgb_paint.cpp b/BigBaseV2/src/backend/looped/vehicle/rgb_paint.cpp index 0358108e..9afe40be 100644 --- a/BigBaseV2/src/backend/looped/vehicle/rgb_paint.cpp +++ b/BigBaseV2/src/backend/looped/vehicle/rgb_paint.cpp @@ -5,7 +5,6 @@ namespace big { void looped::vehicle_rainbow_paint() { - if (g->vehicle.rainbow_paint) { Vehicle vehicle = self::veh; @@ -20,9 +19,22 @@ namespace big g->rgb.spasm = true; g->rgb.fade = false; } - - VEHICLE::SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(vehicle, g->rgb.r, g->rgb.g, g->rgb.b); - VEHICLE::SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(vehicle, g->rgb.r, g->rgb.g, g->rgb.b); + if (g->vehicle.rainbow_primary) { + VEHICLE::SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(vehicle, g->rgb.r, g->rgb.g, g->rgb.b); + } + if (g->vehicle.rainbow_secondary) { + VEHICLE::SET_VEHICLE_CUSTOM_SECONDARY_COLOUR(vehicle, g->rgb.r, g->rgb.g, g->rgb.b); + } + if (g->vehicle.rainbow_neon) { + VEHICLE::SET_VEHICLE_NEON_LIGHT_ENABLED_(vehicle, 0, 1); + VEHICLE::SET_VEHICLE_NEON_LIGHT_ENABLED_(vehicle, 1, 1); + VEHICLE::SET_VEHICLE_NEON_LIGHT_ENABLED_(vehicle, 2, 1); + VEHICLE::SET_VEHICLE_NEON_LIGHT_ENABLED_(vehicle, 3, 1); + VEHICLE::SET_VEHICLE_NEON_LIGHTS_COLOUR_(vehicle, g->rgb.r, g->rgb.g, g->rgb.b); + } + if (g->vehicle.rainbow_smoke) { + VEHICLE::SET_VEHICLE_TYRE_SMOKE_COLOR(vehicle, g->rgb.r, g->rgb.g, g->rgb.b); + } } } } \ No newline at end of file diff --git a/BigBaseV2/src/core/globals.hpp b/BigBaseV2/src/core/globals.hpp index 4716bd27..3de79e2b 100644 --- a/BigBaseV2/src/core/globals.hpp +++ b/BigBaseV2/src/core/globals.hpp @@ -256,6 +256,10 @@ namespace big int driving_style_flags = 443; int driving_style_id = 0; int rainbow_paint = 0; + bool rainbow_primary = false; + bool rainbow_secondary = false; + bool rainbow_neon = false; + bool rainbow_smoke = false; speedo_meter speedo_meter{}; fly fly{}; }; @@ -575,6 +579,10 @@ namespace big this->vehicle.instant_brake = j["vehicle"]["instant_brake"]; this->vehicle.is_targetable = j["vehicle"]["is_targetable"]; this->vehicle.rainbow_paint = j["vehicle"]["rainbow_paint"]; + this->vehicle.rainbow_primary = j["vehicle"]["rainbow_primary"]; + this->vehicle.rainbow_secondary = j["vehicle"]["rainbow_secondary"]; + this->vehicle.rainbow_neon = j["vehicle"]["rainbow_neon"]; + this->vehicle.rainbow_smoke = j["vehicle"]["rainbow_smoke"]; this->vehicle.seatbelt = j["vehicle"]["seatbelt"]; this->vehicle.turn_signals = j["vehicle"]["turn_signals"]; @@ -857,6 +865,10 @@ namespace big { "instant_brake", this->vehicle.instant_brake }, { "is_targetable", this->vehicle.is_targetable }, { "rainbow_paint", this->vehicle.rainbow_paint }, + { "rainbow_primary", this->vehicle.rainbow_primary }, + { "rainbow_secondary", this->vehicle.rainbow_secondary }, + { "rainbow_neon", this->vehicle.rainbow_neon }, + { "rainbow_smoke", this->vehicle.rainbow_smoke }, { "turn_signals", this->vehicle.turn_signals }, { "seatbelt", this->vehicle.seatbelt }, { diff --git a/BigBaseV2/src/views/vehicle/view_vehicle_fun.cpp b/BigBaseV2/src/views/vehicle/view_vehicle_fun.cpp index f302fab5..9bc4cef6 100644 --- a/BigBaseV2/src/views/vehicle/view_vehicle_fun.cpp +++ b/BigBaseV2/src/views/vehicle/view_vehicle_fun.cpp @@ -133,33 +133,44 @@ namespace big ImGui::Separator(); - components::small_text("Rainbow Paint"); - - ImGui::SetNextItemWidth(120); - if (ImGui::BeginCombo("RGB Type", vehicle::rgb_types[g->vehicle.rainbow_paint])) + if (ImGui::TreeNode("Rainbow Paint")) { - for (int i = 0; i < 3; i++) - { - bool itemSelected = g->vehicle.rainbow_paint == i; + ImGui::Checkbox("Primary", &g->vehicle.rainbow_primary); + ImGui::SameLine(); + ImGui::Checkbox("Neon", &g->vehicle.rainbow_neon); + ImGui::Checkbox("Secondary", &g->vehicle.rainbow_secondary); + ImGui::SameLine(); + ImGui::Checkbox("Smoke", &g->vehicle.rainbow_smoke); - if (ImGui::Selectable(vehicle::rgb_types[i], itemSelected)) + if (g->vehicle.rainbow_primary || g->vehicle.rainbow_neon || g->vehicle.rainbow_secondary || g->vehicle.rainbow_smoke) { + ImGui::SetNextItemWidth(120); + if (ImGui::BeginCombo("RGB Type", vehicle::rgb_types[g->vehicle.rainbow_paint])) { - g->vehicle.rainbow_paint = i; + for (int i = 0; i < 3; i++) + { + bool itemSelected = g->vehicle.rainbow_paint == i; + + if (ImGui::Selectable(vehicle::rgb_types[i], itemSelected)) + { + g->vehicle.rainbow_paint = i; + } + + if (itemSelected) + { + ImGui::SetItemDefaultFocus(); + } + } + + ImGui::EndCombo(); } - - if (itemSelected) + if (g->vehicle.rainbow_paint != 0) { - ImGui::SetItemDefaultFocus(); + ImGui::SameLine(); + ImGui::SetNextItemWidth(150); + ImGui::SliderInt("RGB Speed", &g->rgb.speed, 1, 10); } } - - ImGui::EndCombo(); - } - if (g->vehicle.rainbow_paint != 0) - { - ImGui::SameLine(); - ImGui::SetNextItemWidth(150); - ImGui::SliderInt("RGB Speed", &g->rgb.speed, 1, 10); + ImGui::TreePop(); } ImGui::Separator();