From 27fb05d88ce13080a6bde8da26465a8ae44fe042 Mon Sep 17 00:00:00 2001 From: lizzieshinkicker Date: Wed, 22 Apr 2026 15:16:17 -0700 Subject: [PATCH] Allow for custom, non-vanilla white/inverse Invulernability overlay. --- Core/Layer/Options/Sections/ListedConfigSection.cs | 2 ++ Core/Layer/Worlds/WorldLayer.Render.Hud.cs | 7 +++++++ Core/Util/Configs/Components/ConfigRender.cs | 9 +++++++++ Core/World/Entities/Players/Player.cs | 7 ++++++- 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Core/Layer/Options/Sections/ListedConfigSection.cs b/Core/Layer/Options/Sections/ListedConfigSection.cs index 879e15069..f3666d85e 100644 --- a/Core/Layer/Options/Sections/ListedConfigSection.cs +++ b/Core/Layer/Options/Sections/ListedConfigSection.cs @@ -93,6 +93,8 @@ private void SetDisableStates() m_config.Render.LightMode.OptionDisabled = paletteMode; m_config.Render.EmulateInvulnerabilityColorMap.OptionDisabled = paletteMode; m_config.Render.DownScaleVanillaRenderSampleBuffer.OptionDisabled = m_config.Render.VanillaRender.Value == false; + + m_config.Render.AlternativeInvulnerabilityColor.OptionDisabled = m_config.Render.AlternativeInvulnerabilityOverlay.Value == false; m_config.Mouse.ForwardBackwardSpeed.OptionDisabled = m_config.Mouse.Look.Value == true; diff --git a/Core/Layer/Worlds/WorldLayer.Render.Hud.cs b/Core/Layer/Worlds/WorldLayer.Render.Hud.cs index a825120df..7e49beebb 100644 --- a/Core/Layer/Worlds/WorldLayer.Render.Hud.cs +++ b/Core/Layer/Worlds/WorldLayer.Render.Hud.cs @@ -366,6 +366,13 @@ private void DrawHudEffects(IHudRenderContext hud) hud.Clear(box, powerup.DrawColor.Value, alpha); } + var invuln = Player.Inventory.PowerupEffectColorMap; + if (m_config.Render.AlternativeInvulnerabilityOverlay && invuln is { PowerupType: PowerupType.Invulnerable, DrawPowerupEffect: true }) + { + var customColor = m_config.Render.AlternativeInvulnerabilityColor.Value; + hud.Clear(box, new Color((byte)customColor.X, (byte)customColor.Y, (byte)customColor.Z), 0.15f); + } + if (Player.BonusCount > 0) { const float PickupScaleAmount = 3f; diff --git a/Core/Util/Configs/Components/ConfigRender.cs b/Core/Util/Configs/Components/ConfigRender.cs index c1d3465d2..a5d3efa24 100644 --- a/Core/Util/Configs/Components/ConfigRender.cs +++ b/Core/Util/Configs/Components/ConfigRender.cs @@ -3,6 +3,7 @@ using Helion.Util.Configs.Options; using Helion.Util.Configs.Values; using System.ComponentModel; +using Helion.Geometry.Vectors; using static Helion.Util.Configs.Values.ConfigFilters; namespace Helion.Util.Configs.Components; @@ -166,6 +167,14 @@ public class ConfigRender: ConfigElement [ConfigInfo("Emulates custom invulnerability palettes in true color mode. May not work well with all WADs. Application restart required.", restartRequired: true)] [OptionMenu(OptionSectionType.Render, "Emulate Invulnerability Colormap")] public readonly ConfigValue EmulateInvulnerabilityColorMap = new(false); + + [ConfigInfo("Uses a custom color overlay for Invulnerability instead of the vanilla inverse/white strobe.")] + [OptionMenu(OptionSectionType.Render, "Alternative Invulnerability Overlay")] + public readonly ConfigValue AlternativeInvulnerabilityOverlay = new(false); + + [ConfigInfo("The color used for the alternative invulnerability overlay.")] + [OptionMenu(OptionSectionType.Render, "Alternative Invulnerability Color")] + public readonly ConfigValue AlternativeInvulnerabilityColor = new((0, 255, 0), ClampColor); [ConfigInfo("Line contrast mode.", mapRestartRequired: true)] [OptionMenu(OptionSectionType.Render, "Line contrast mode")] diff --git a/Core/World/Entities/Players/Player.cs b/Core/World/Entities/Players/Player.cs index 727d36a45..d2729939f 100644 --- a/Core/World/Entities/Players/Player.cs +++ b/Core/World/Entities/Players/Player.cs @@ -134,6 +134,9 @@ public virtual bool DrawFullBright() foreach (PowerupType powerupType in PowerupsWithBrightness) { + if (powerupType == PowerupType.Invulnerable && WorldStatic.World.Config.Render.AlternativeInvulnerabilityOverlay) + continue; + IPowerup? powerup = Inventory.GetPowerup(powerupType); if (powerup != null) return powerup.DrawPowerupEffect; @@ -144,7 +147,9 @@ public virtual bool DrawFullBright() public bool HasLightAmp() => Inventory.GetPowerup(PowerupType.LightAmp) != null; - public bool DrawInvulnerableColorMap() => Inventory.PowerupEffectColorMap != null && Inventory.PowerupEffectColorMap.DrawPowerupEffect; + public bool DrawInvulnerableColorMap() => + !WorldStatic.World.Config.Render.AlternativeInvulnerabilityOverlay && + Inventory.PowerupEffectColorMap is { DrawPowerupEffect: true }; public int GetExtraLightRender() => WorldStatic.World.Config.Render.ExtraLight + (ExtraLight * Constants.ExtraLightFactor); public override double ViewZ => m_viewZ;