Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions RLBotCS/Conversion/ColorSwatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ internal static Color GetSecondary(uint colorId) =>
{ 6, 44, 127 },
{ 6, 22, 127 },
{ 38, 6, 127 },
{ 48, 6, 127 }
{ 48, 6, 127 },
};

private static readonly int[,] OrangeSwatches =
Expand Down Expand Up @@ -170,7 +170,7 @@ internal static Color GetSecondary(uint colorId) =>
{ 127, 30, 6 },
{ 127, 6, 6 },
{ 127, 6, 48 },
{ 127, 6, 66 }
{ 127, 6, 66 },
};

private static readonly int[,] SecondarySwatches =
Expand Down Expand Up @@ -279,6 +279,6 @@ internal static Color GetSecondary(uint colorId) =>
{ 18, 0, 51 },
{ 40, 0, 51 },
{ 51, 0, 32 },
{ 51, 0, 8 }
{ 51, 0, 8 },
};
}
42 changes: 21 additions & 21 deletions RLBotCS/Conversion/FlatToCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private static string MapGameMode(GameMode gameMode) =>
GameMode.Heatseeker => "?game=TAGame.GameInfo_GodBall_TA",
GameMode.Gridiron => "?game=TAGame.GameInfo_Football_TA",
GameMode.Knockout => "?game=TAGame.GameInfo_KnockOut_TA",
_ => throw new ArgumentOutOfRangeException(nameof(gameMode), gameMode, null)
_ => throw new ArgumentOutOfRangeException(nameof(gameMode), gameMode, null),
};

private static string MapMatchLength(MatchLength matchLength) =>
Expand All @@ -29,7 +29,7 @@ private static string MapMatchLength(MatchLength matchLength) =>
MatchLength.Ten_Minutes => "10Minutes",
MatchLength.Twenty_Minutes => "20Minutes",
MatchLength.Unlimited => "UnlimitedTime",
_ => throw new ArgumentOutOfRangeException(nameof(matchLength), matchLength, null)
_ => throw new ArgumentOutOfRangeException(nameof(matchLength), matchLength, null),
};

private static string MapMaxScore(MaxScore maxScore) =>
Expand All @@ -41,7 +41,7 @@ private static string MapMaxScore(MaxScore maxScore) =>
MaxScore.Five_Goals => "Max5",
MaxScore.Seven_Goals => "Max7",
MaxScore.Unlimited => "UnlimitedScore",
_ => throw new ArgumentOutOfRangeException(nameof(maxScore), maxScore, null)
_ => throw new ArgumentOutOfRangeException(nameof(maxScore), maxScore, null),
};

private static string MapMultiBall(MultiBall multiBall) =>
Expand All @@ -51,7 +51,7 @@ private static string MapMultiBall(MultiBall multiBall) =>
MultiBall.Two => "TwoBalls",
MultiBall.Four => "FourBalls",
MultiBall.Six => "SixBalls",
_ => throw new ArgumentOutOfRangeException(nameof(multiBall), multiBall, null)
_ => throw new ArgumentOutOfRangeException(nameof(multiBall), multiBall, null),
};

private static string MapOvertime(OvertimeOption option) =>
Expand All @@ -60,7 +60,7 @@ private static string MapOvertime(OvertimeOption option) =>
OvertimeOption.Unlimited => "",
OvertimeOption.Five_Max_First_Score => "Overtime5MinutesFirstScore",
OvertimeOption.Five_Max_Random_Team => "Overtime5MinutesRandom",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null),
};

private static string MapSeriesLength(SeriesLengthOption option) =>
Expand All @@ -70,7 +70,7 @@ private static string MapSeriesLength(SeriesLengthOption option) =>
SeriesLengthOption.Three_Games => "3Games",
SeriesLengthOption.Five_Games => "5Games",
SeriesLengthOption.Seven_Games => "7Games",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null),
};

private static string MapGameSpeed(GameSpeedOption option) =>
Expand All @@ -79,7 +79,7 @@ private static string MapGameSpeed(GameSpeedOption option) =>
GameSpeedOption.Default => "",
GameSpeedOption.Slo_Mo => "SloMoGameSpeed",
GameSpeedOption.Time_Warp => "SloMoDistanceBall",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null),
};

private static string MapBallMaxSpeed(BallMaxSpeedOption option) =>
Expand All @@ -89,7 +89,7 @@ private static string MapBallMaxSpeed(BallMaxSpeedOption option) =>
BallMaxSpeedOption.Slow => "SlowBall",
BallMaxSpeedOption.Fast => "FastBall",
BallMaxSpeedOption.Super_Fast => "SuperFastBall",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null),
};

private static string MapBallType(BallTypeOption option) =>
Expand All @@ -104,7 +104,7 @@ private static string MapBallType(BallTypeOption option) =>
BallTypeOption.Haunted => "Ball_Haunted",
BallTypeOption.Ekin => "Ball_Ekin",
BallTypeOption.SpookyCube => "Ball_SpookyCube",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null),
};

private static string MapBallWeight(BallWeightOption option) =>
Expand All @@ -117,7 +117,7 @@ private static string MapBallWeight(BallWeightOption option) =>
BallWeightOption.Curve_Ball => "MagnusBall",
BallWeightOption.Beach_Ball_Curve => "MagnusBeachBall",
BallWeightOption.Magnus_FutBall => "MagnusFutBallTest",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null),
};

private static string MapBallSize(BallSizeOption option) =>
Expand All @@ -128,7 +128,7 @@ private static string MapBallSize(BallSizeOption option) =>
BallSizeOption.Medium => "MediumBall",
BallSizeOption.Large => "BigBall",
BallSizeOption.Gigantic => "GiantBall",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null),
};

private static string MapBallBounciness(BallBouncinessOption option) =>
Expand All @@ -139,7 +139,7 @@ private static string MapBallBounciness(BallBouncinessOption option) =>
BallBouncinessOption.High => "HighBounciness",
BallBouncinessOption.Super_High => "SuperBounciness",
BallBouncinessOption.LowishBounciness => "LowishBounciness",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null),
};

private static string MapBoost(BoostOption option) =>
Expand All @@ -150,7 +150,7 @@ private static string MapBoost(BoostOption option) =>
BoostOption.Slow_Recharge => "SlowRecharge",
BoostOption.Rapid_Recharge => "RapidRecharge",
BoostOption.No_Boost => "NoBooster",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null),
};

private static string MapRumble(RumbleOption option) =>
Expand All @@ -167,7 +167,7 @@ private static string MapRumble(RumbleOption option) =>
RumbleOption.Haunted_Ball_Beam => "ItemsModeHauntedBallBeam",
RumbleOption.Tactical => "ItemsModeSelection",
RumbleOption.BatmanRumble => "ItemsMode_BM",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null),
};

private static string MapBoostStrength(BoostStrengthOption option) =>
Expand All @@ -178,7 +178,7 @@ private static string MapBoostStrength(BoostStrengthOption option) =>
BoostStrengthOption.Two => "BoostMultiplier2x",
BoostStrengthOption.Five => "BoostMultiplier5x",
BoostStrengthOption.Ten => "BoostMultiplier10x",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null),
};

private static string MapGravity(GravityOption option) =>
Expand All @@ -189,7 +189,7 @@ private static string MapGravity(GravityOption option) =>
GravityOption.High => "HighGravity",
GravityOption.Super_High => "SuperGravity",
GravityOption.Reverse => "ReverseGravity",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null),
};

private static string MapDemolish(DemolishOption option) =>
Expand All @@ -200,7 +200,7 @@ private static string MapDemolish(DemolishOption option) =>
DemolishOption.Friendly_Fire => "DemolishAll",
DemolishOption.On_Contact => "AlwaysDemolishOpposing",
DemolishOption.On_Contact_FF => "AlwaysDemolish",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null),
};

private static string MapRespawnTime(RespawnTimeOption option) =>
Expand All @@ -210,15 +210,15 @@ private static string MapRespawnTime(RespawnTimeOption option) =>
RespawnTimeOption.Two_Seconds => "TwoSecondsRespawn",
RespawnTimeOption.One_Second => "OneSecondsRespawn",
RespawnTimeOption.Disable_Goal_Reset => "DisableGoalDelay",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null),
};

private static string MapMaxTime(MaxTimeOption option) =>
option switch
{
MaxTimeOption.Default => "",
MaxTimeOption.Eleven_Minutes => "MaxTime11Minutes",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null),
};

private static string MapGameEvent(GameEventOption option) =>
Expand All @@ -227,15 +227,15 @@ private static string MapGameEvent(GameEventOption option) =>
GameEventOption.Default => "",
GameEventOption.Rugby => "RugbyGameEventRules",
GameEventOption.Haunted => "HauntedGameEventRules",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null),
};

private static string MapAudio(AudioOption option) =>
option switch
{
AudioOption.Default => "",
AudioOption.Haunted => "HauntedAudio",
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null)
_ => throw new ArgumentOutOfRangeException(nameof(option), option, null),
};

private static string GetOption(string option)
Expand Down
21 changes: 6 additions & 15 deletions RLBotCS/Conversion/FlatToModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,8 @@ internal static Rotator ToRotator(rlbot.flat.Rotator r) =>

internal static Loadout ToLoadout(rlbot.flat.PlayerLoadoutT l, uint team)
{
Color primaryColor = l.PrimaryColorLookup switch
{
{ } p => Color.FromArgb(p.A, p.R, p.G, p.B),
_ => ColorSwatches.GetPrimary(l.TeamColorId, team)
};

Color secondaryColor = l.SecondaryColorLookup switch
{
{ } s => Color.FromArgb(s.A, s.R, s.G, s.B),
_ => ColorSwatches.GetSecondary(l.CustomColorId)
};
Color primaryColor = ColorSwatches.GetPrimary(l.TeamColorId, team);
Color secondaryColor = ColorSwatches.GetSecondary(l.CustomColorId);

var lp = l.LoadoutPaint;

Expand All @@ -95,7 +86,7 @@ internal static Loadout ToLoadout(rlbot.flat.PlayerLoadoutT l, uint team)
AntennaPaintId = (byte)lp.AntennaPaintId,
HatPaintId = (byte)lp.HatPaintId,
TrailsPaintId = (byte)lp.TrailsPaintId,
GoalExplosionPaintId = (byte)lp.GoalExplosionPaintId
GoalExplosionPaintId = (byte)lp.GoalExplosionPaintId,
};

return new Loadout
Expand All @@ -113,7 +104,7 @@ internal static Loadout ToLoadout(rlbot.flat.PlayerLoadoutT l, uint team)
WheelsId = (ushort)l.WheelsId,
LoadoutPaint = loadoutPaint,
PrimaryColorLookup = primaryColor,
SecondaryColorLookup = secondaryColor
SecondaryColorLookup = secondaryColor,
};
}

Expand All @@ -129,7 +120,7 @@ not null
partVec.Y?.Val ?? defaultVec.Y,
partVec.Z?.Val ?? defaultVec.Z
),
_ => defaultVec
_ => defaultVec,
};

internal static Rotator DesiredToRotator(
Expand All @@ -144,7 +135,7 @@ not null
partRot.Yaw?.Val ?? defaultRot.Yaw,
partRot.Roll?.Val ?? defaultRot.Roll
),
_ => defaultRot
_ => defaultRot,
};

internal static Physics DesiredToPhysics(rlbot.flat.DesiredPhysicsT p, Physics defaultP) =>
Expand Down
Loading