diff --git a/Data/RenderConfig.cs b/Data/RenderConfig.cs index b6629d8..11d7596 100644 --- a/Data/RenderConfig.cs +++ b/Data/RenderConfig.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using ADOFAIRenderer.Util.FFmpeg; +using UnityEngine; namespace ADOFAIRenderer.Data; @@ -27,6 +28,10 @@ public class AdvancedConfig public bool ProcessAudio { get; set; } = true; public bool NonTile { get; set; } = false; public string FileExtension { get; set; } = "mkv"; + + public Color? firePlanetColor = null; + public Color? icePlanetColor = null; + public Color? windPlanetColor = null; } public class VideoEncodingConfig diff --git a/Patch/Game/PlanetRendererPatch.cs b/Patch/Game/PlanetRendererPatch.cs new file mode 100644 index 0000000..bba0c31 --- /dev/null +++ b/Patch/Game/PlanetRendererPatch.cs @@ -0,0 +1,30 @@ +using ADOFAIRenderer.Core; +using HarmonyLib; +using UnityEngine; + +namespace ADOFAIRenderer.Patch.Game; + +[HarmonyPatch(typeof(PlanetRenderer))] +public static class PlanetRendererPatch +{ + [HarmonyPrefix] + [HarmonyPatch("SetColor")] + // ReSharper disable once InconsistentNaming + private static void OverrideColor(PlanetRenderer __instance, ref PlanetColor planetColor) + { + if (RenderManager.Instance.stage == RenderStage.None) return; + + var advConf = RenderManager.Instance.Configuration.AdvancedConfig; + ApplyColor(ref planetColor, scrController.instance.planetRed, advConf.firePlanetColor); + ApplyColor(ref planetColor, scrController.instance.planetBlue, advConf.icePlanetColor); + ApplyColor(ref planetColor, scrController.instance.planetGreen, advConf.windPlanetColor); + + return; + + void ApplyColor(ref PlanetColor planetColor, scrPlanet targetPlanet, Color? customColor) + { + if (__instance == targetPlanet.planetRenderer && customColor != null) + planetColor = new PlanetColor(customColor.Value); + } + } +} \ No newline at end of file