Improve RGB Paint (#347)

This commit is contained in:
howdoiusekeyboard 2022-07-17 02:25:31 +05:30 committed by GitHub
parent 1e5b86f0a4
commit bf87449d35
3 changed files with 59 additions and 24 deletions

View File

@ -5,7 +5,6 @@ namespace big
{ {
void looped::vehicle_rainbow_paint() void looped::vehicle_rainbow_paint()
{ {
if (g->vehicle.rainbow_paint) if (g->vehicle.rainbow_paint)
{ {
Vehicle vehicle = self::veh; Vehicle vehicle = self::veh;
@ -20,9 +19,22 @@ namespace big
g->rgb.spasm = true; g->rgb.spasm = true;
g->rgb.fade = false; g->rgb.fade = false;
} }
if (g->vehicle.rainbow_primary) {
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);
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);
}
} }
} }
} }

View File

@ -256,6 +256,10 @@ namespace big
int driving_style_flags = 443; int driving_style_flags = 443;
int driving_style_id = 0; int driving_style_id = 0;
int rainbow_paint = 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{}; speedo_meter speedo_meter{};
fly fly{}; fly fly{};
}; };
@ -575,6 +579,10 @@ namespace big
this->vehicle.instant_brake = j["vehicle"]["instant_brake"]; this->vehicle.instant_brake = j["vehicle"]["instant_brake"];
this->vehicle.is_targetable = j["vehicle"]["is_targetable"]; this->vehicle.is_targetable = j["vehicle"]["is_targetable"];
this->vehicle.rainbow_paint = j["vehicle"]["rainbow_paint"]; 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.seatbelt = j["vehicle"]["seatbelt"];
this->vehicle.turn_signals = j["vehicle"]["turn_signals"]; this->vehicle.turn_signals = j["vehicle"]["turn_signals"];
@ -857,6 +865,10 @@ namespace big
{ "instant_brake", this->vehicle.instant_brake }, { "instant_brake", this->vehicle.instant_brake },
{ "is_targetable", this->vehicle.is_targetable }, { "is_targetable", this->vehicle.is_targetable },
{ "rainbow_paint", this->vehicle.rainbow_paint }, { "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 }, { "turn_signals", this->vehicle.turn_signals },
{ "seatbelt", this->vehicle.seatbelt }, { "seatbelt", this->vehicle.seatbelt },
{ {

View File

@ -133,33 +133,44 @@ namespace big
ImGui::Separator(); ImGui::Separator();
components::small_text("Rainbow Paint"); if (ImGui::TreeNode("Rainbow Paint"))
ImGui::SetNextItemWidth(120);
if (ImGui::BeginCombo("RGB Type", vehicle::rgb_types[g->vehicle.rainbow_paint]))
{ {
for (int i = 0; i < 3; i++) ImGui::Checkbox("Primary", &g->vehicle.rainbow_primary);
{ ImGui::SameLine();
bool itemSelected = g->vehicle.rainbow_paint == i; 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 (g->vehicle.rainbow_paint != 0)
if (itemSelected)
{ {
ImGui::SetItemDefaultFocus(); ImGui::SameLine();
ImGui::SetNextItemWidth(150);
ImGui::SliderInt("RGB Speed", &g->rgb.speed, 1, 10);
} }
} }
ImGui::TreePop();
ImGui::EndCombo();
}
if (g->vehicle.rainbow_paint != 0)
{
ImGui::SameLine();
ImGui::SetNextItemWidth(150);
ImGui::SliderInt("RGB Speed", &g->rgb.speed, 1, 10);
} }
ImGui::Separator(); ImGui::Separator();