Skip to content

Commit 44ff15c

Browse files
authored
Merge pull request #608 from RickyB505/development
feat(vehicle): overhaul paint/other rgb capable things
2 parents c59fe65 + 484c72b commit 44ff15c

File tree

4 files changed

+499
-150
lines changed

4 files changed

+499
-150
lines changed

vMenu/CommonFunctions.cs

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1445,6 +1445,14 @@ private static async void ApplyVehicleModsDelayed(Vehicle vehicle, VehicleInfo v
14451445
{
14461446
vehicle.Mods.PrimaryColor = (VehicleColor)vehicleInfo.colors["primary"];
14471447
}
1448+
if (vehicleInfo.colors.ContainsKey("PrimaryPaintFinish"))
1449+
{
1450+
var pearlColorReset = 0;
1451+
var wheelColorReset = 0;
1452+
GetVehicleExtraColours(vehicle.Handle, ref pearlColorReset, ref wheelColorReset);
1453+
SetVehicleModColor_1(vehicle.Handle, vehicleInfo.colors["PrimaryPaintFinish"], 0, 0);
1454+
SetVehicleExtraColours(vehicle.Handle, pearlColorReset, wheelColorReset);
1455+
}
14481456

14491457
bool useCustomRgbSecondary = vehicleInfo.colors.ContainsKey("customSecondaryR") && vehicleInfo.colors.ContainsKey("customSecondaryG") && vehicleInfo.colors.ContainsKey("customSecondaryB");
14501458
if (useCustomRgbSecondary && vehicleInfo.colors["customSecondaryR"] > 0 && vehicleInfo.colors["customSecondaryG"] > 0 && vehicleInfo.colors["customSecondaryB"] > 0)
@@ -1455,7 +1463,14 @@ private static async void ApplyVehicleModsDelayed(Vehicle vehicle, VehicleInfo v
14551463
{
14561464
vehicle.Mods.SecondaryColor = (VehicleColor)vehicleInfo.colors["secondary"];
14571465
}
1458-
1466+
if (vehicleInfo.colors.ContainsKey("SecondaryPaintFinish"))
1467+
{
1468+
var pearlColorReset = 0;
1469+
var wheelColorReset = 0;
1470+
GetVehicleExtraColours(vehicle.Handle, ref pearlColorReset, ref wheelColorReset);
1471+
SetVehicleModColor_2(vehicle.Handle, vehicleInfo.colors["SecondaryPaintFinish"], 0);
1472+
SetVehicleExtraColours(vehicle.Handle, pearlColorReset, wheelColorReset);
1473+
}
14591474
SetVehicleInteriorColour(vehicle.Handle, vehicleInfo.colors["trim"]);
14601475
SetVehicleDashboardColour(vehicle.Handle, vehicleInfo.colors["dash"]);
14611476

@@ -1472,6 +1487,11 @@ private static async void ApplyVehicleModsDelayed(Vehicle vehicle, VehicleInfo v
14721487

14731488
VehicleOptions.SetHeadlightsColorForVehicle(vehicle, vehicleInfo.headlightColor);
14741489

1490+
bool useCustomRgbHeadlight = vehicleInfo.colors.ContainsKey("customheadlightR") && vehicleInfo.colors.ContainsKey("customheadlightG") && vehicleInfo.colors.ContainsKey("customheadlightB");
1491+
if (useCustomRgbHeadlight)
1492+
{
1493+
SetVehicleXenonLightsCustomColor(vehicle.Handle, vehicleInfo.colors["customheadlightR"], vehicleInfo.colors["customheadlightG"], vehicleInfo.colors["customheadlightB"]);
1494+
}
14751495
vehicle.Mods.NeonLightsColor = System.Drawing.Color.FromArgb(red: vehicleInfo.colors["neonR"], green: vehicleInfo.colors["neonG"], blue: vehicleInfo.colors["neonB"]);
14761496
vehicle.Mods.SetNeonLightsOn(VehicleNeonLight.Left, vehicleInfo.neonLeft);
14771497
vehicle.Mods.SetNeonLightsOn(VehicleNeonLight.Right, vehicleInfo.neonRight);
@@ -1601,6 +1621,11 @@ public static async void SaveVehicle(string updateExistingSavedVehicleName = nul
16011621
GetVehicleCustomPrimaryColour(veh.Handle, ref customPrimaryR, ref customPrimaryG, ref customPrimaryB);
16021622
}
16031623

1624+
if (veh.State.Get("vMenu:PrimaryPaintFinish") is int primaryPaintFinish)
1625+
{
1626+
colors.Add("PrimaryPaintFinish", primaryPaintFinish);
1627+
}
1628+
16041629
colors.Add("customPrimaryR", customPrimaryR);
16051630
colors.Add("customPrimaryG", customPrimaryG);
16061631
colors.Add("customPrimaryB", customPrimaryB);
@@ -1616,9 +1641,24 @@ public static async void SaveVehicle(string updateExistingSavedVehicleName = nul
16161641
GetVehicleCustomSecondaryColour(veh.Handle, ref customSecondaryR, ref customSecondaryG, ref customSecondaryB);
16171642
}
16181643

1644+
if (veh.State.Get("vMenu:SecondaryPaintFinish") is int secondaryPaintFinish)
1645+
{
1646+
colors.Add("SecondaryPaintFinish", secondaryPaintFinish);
1647+
}
1648+
16191649
colors.Add("customSecondaryR", customSecondaryR);
16201650
colors.Add("customSecondaryG", customSecondaryG);
16211651
colors.Add("customSecondaryB", customSecondaryB);
1652+
1653+
int customheadlightR = -1;
1654+
int customheadlightG = -1;
1655+
int customheadlightB = -1;
1656+
if (GetVehicleXenonLightsCustomColor(veh.Handle, ref customheadlightR, ref customheadlightG, ref customheadlightB))
1657+
{
1658+
colors.Add("customheadlightR", customheadlightR);
1659+
colors.Add("customheadlightG", customheadlightG);
1660+
colors.Add("customheadlightB", customheadlightB);
1661+
}
16221662
#endregion
16231663

16241664
var extras = new Dictionary<int, bool>();

vMenu/data/VehicleData.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ public VehicleColor(int id, string label)
322322
new VehicleColor(133, "OLIVE_GREEN"),
323323
};
324324

325-
// Chameleon Colour List //
326325
public static readonly List<VehicleColor> ChameleonColors = new()
327326
{
328327
new VehicleColor(223, "G9_PAINT01"),
@@ -343,6 +342,23 @@ public VehicleColor(int id, string label)
343342
new VehicleColor(238, "G9_PAINT16"),
344343
};
345344

345+
public static readonly List<int[]> NeonLightColors = new()
346+
{
347+
{ new int[3] { 255, 255, 255 } }, // White
348+
{ new int[3] { 2, 21, 255 } }, // Blue
349+
{ new int[3] { 3, 83, 255 } }, // Electric blue
350+
{ new int[3] { 0, 255, 140 } }, // Mint Green
351+
{ new int[3] { 94, 255, 1 } }, // Lime Green
352+
{ new int[3] { 255, 255, 0 } }, // Yellow
353+
{ new int[3] { 255, 150, 5 } }, // Golden Shower
354+
{ new int[3] { 255, 62, 0 } }, // Orange
355+
{ new int[3] { 255, 0, 0 } }, // Red
356+
{ new int[3] { 255, 50, 100 } }, // Pony Pink
357+
{ new int[3] { 255, 5, 190 } }, // Hot Pink
358+
{ new int[3] { 35, 1, 255 } }, // Purple
359+
{ new int[3] { 15, 3, 255 } }, // Blacklight
360+
};
361+
346362
public static class Vehicles
347363
{
348364
#region Vehicle List Per Class

vMenu/menus/MpPedCustomization.cs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,35 +1099,6 @@ private void CreateMenu()
10991099
inheritanceMenu.AddMenuItem(inheritanceShapeMix);
11001100
inheritanceMenu.AddMenuItem(inheritanceSkinMix);
11011101

1102-
// formula from maintransition.#sc
1103-
float GetMinimum()
1104-
{
1105-
return currentCharacter.IsMale ? 0.05f : 0.3f;
1106-
}
1107-
1108-
float GetMaximum()
1109-
{
1110-
return currentCharacter.IsMale ? 0.7f : 0.95f;
1111-
}
1112-
1113-
float ClampMix(int value)
1114-
{
1115-
var sliderFraction = mixValues[value];
1116-
var min = GetMinimum();
1117-
var max = GetMaximum();
1118-
1119-
return min + (sliderFraction * (max - min));
1120-
}
1121-
1122-
int UnclampMix(float value)
1123-
{
1124-
var min = GetMinimum();
1125-
var max = GetMaximum();
1126-
1127-
var origFraction = (value - min) / (max - min);
1128-
return Math.Max(Math.Min((int)(origFraction * 10), 10), 0);
1129-
}
1130-
11311102
inheritanceMenu.OnListIndexChange += (_menu, listItem, oldSelectionIndex, newSelectionIndex, itemIndex) =>
11321103
{
11331104
_parentOne = inheritanceParentOne.ListIndex;

0 commit comments

Comments
 (0)