From c063986e0076e168f793fc7a5f223fa0b37fd230 Mon Sep 17 00:00:00 2001 From: spherallic Date: Tue, 6 Dec 2022 00:20:42 +0100 Subject: [PATCH] Add toggle for displaying invisible SRB2 FOFs --- Build/Configurations/SRB2-22.cfg | 5 +++++ Source/Core/Config/LinedefActionInfo.cs | 4 ++++ Source/Core/Config/ProgramConfiguration.cs | 2 ++ Source/Core/Map/Linedef.cs | 1 + Source/Plugins/BuilderModes/Resources/Actions.cfg | 10 ++++++++++ .../BuilderModes/VisualModes/BaseVisualMode.cs | 12 +++++++++++- 6 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Build/Configurations/SRB2-22.cfg b/Build/Configurations/SRB2-22.cfg index 5580140..440caba 100644 --- a/Build/Configurations/SRB2-22.cfg +++ b/Build/Configurations/SRB2-22.cfg @@ -985,6 +985,7 @@ linedeftypes flags128text = "[7] Only block non-players"; 3dfloor = true; 3dfloorflags = "47"; + invisiblefof = true; } 140 @@ -1222,6 +1223,7 @@ linedeftypes prefix = "(223)"; 3dfloor = true; 3dfloorflags = "41"; + invisiblefof = true; } } @@ -1519,6 +1521,7 @@ linedeftypes prefix = "(200)"; 3dfloor = true; 3dfloorflags = "20201"; + invisiblefof = true; } 201 @@ -1527,6 +1530,7 @@ linedeftypes prefix = "(201)"; 3dfloor = true; 3dfloorflags = "201"; + invisiblefof = true; } 202 @@ -1535,6 +1539,7 @@ linedeftypes prefix = "(202)"; 3dfloor = true; 3dfloorflags = "3EF19"; + invisiblefof = true; } 250 diff --git a/Source/Core/Config/LinedefActionInfo.cs b/Source/Core/Config/LinedefActionInfo.cs index 02b28e0..f03ab53 100644 --- a/Source/Core/Config/LinedefActionInfo.cs +++ b/Source/Core/Config/LinedefActionInfo.cs @@ -50,6 +50,7 @@ namespace CodeImp.DoomBuilder.Config private readonly int slopeargs; private readonly int copyslopeargs; private readonly bool threedfloor; + private readonly bool invisiblefof; private readonly bool threedfloorcustom; private readonly int threedfloorflags; private readonly IDictionary threedfloorflagsadditions; @@ -75,6 +76,7 @@ namespace CodeImp.DoomBuilder.Config public int SlopeArgs { get { return slopeargs; } } public int CopySlopeArgs { get { return copyslopeargs; } } public bool ThreeDFloor { get { return threedfloor; } } + public bool InvisibleFOF { get { return invisiblefof; } } public bool ThreeDFloorCustom { get { return threedfloorcustom; } } public int ThreeDFloorFlags { get { return threedfloorflags; } } #endregion @@ -106,6 +108,7 @@ namespace CodeImp.DoomBuilder.Config this.slopeargs = cfg.ReadSetting(actionsetting + ".slopeargs", 0); this.copyslopeargs = cfg.ReadSetting(actionsetting + ".copyslopeargs", 0); this.threedfloor = cfg.ReadSetting(actionsetting + ".3dfloor", false); + this.invisiblefof = cfg.ReadSetting(actionsetting + ".invisiblefof", false); this.threedfloorcustom = cfg.ReadSetting(actionsetting + ".3dfloorcustom", false); try { this.threedfloorflags = Convert.ToInt32(cfg.ReadSetting(actionsetting + ".3dfloorflags", "0"), 16); } catch (FormatException) { this.threedfloorflags = 0; } @@ -142,6 +145,7 @@ namespace CodeImp.DoomBuilder.Config this.slopeargs = 0; this.copyslopeargs = 0; this.threedfloor = false; + this.invisiblefof = false; this.threedfloorcustom = false; this.threedfloorflags = 0; this.threedfloorflagsadditions = new Dictionary(); diff --git a/Source/Core/Config/ProgramConfiguration.cs b/Source/Core/Config/ProgramConfiguration.cs index 7d6947c..c85fae6 100644 --- a/Source/Core/Config/ProgramConfiguration.cs +++ b/Source/Core/Config/ProgramConfiguration.cs @@ -122,6 +122,7 @@ namespace CodeImp.DoomBuilder.Config private string lastUsedMapFolder; private bool gzMarkExtraFloors; private bool gzdoomrenderingeffects = true; //mxd + private bool srb2renderingeffects = true; //sphere private bool showcolormaps = true; private bool drawCrosshair; private bool drawFullCrosshair; @@ -233,6 +234,7 @@ namespace CodeImp.DoomBuilder.Config public string LastUsedMapFolder { get { return lastUsedMapFolder; } internal set { lastUsedMapFolder = value; } } public bool GZMarkExtraFloors { get { return gzMarkExtraFloors; } internal set { gzMarkExtraFloors = value; } } public bool GZDoomRenderingEffects { get { return gzdoomrenderingeffects; } set { gzdoomrenderingeffects = value; } } //mxd + public bool SRB2RenderingEffects { get { return srb2renderingeffects; } set { srb2renderingeffects = value; } } //sphere public bool ShowColormaps { get { return showcolormaps; } set { showcolormaps = value; } } //mxd public bool DrawCrosshair { get { return drawCrosshair; } internal set { drawCrosshair = value; } } public bool DrawFullCrosshair { get { return drawFullCrosshair; } internal set { drawFullCrosshair = value; } } diff --git a/Source/Core/Map/Linedef.cs b/Source/Core/Map/Linedef.cs index 8fdf806..2f953f7 100644 --- a/Source/Core/Map/Linedef.cs +++ b/Source/Core/Map/Linedef.cs @@ -92,6 +92,7 @@ namespace CodeImp.DoomBuilder.Map public int Action { get { return action; } set { BeforePropsChange(); action = value; UpdateColorPreset(); } } public int Activate { get { return activate; } set { BeforePropsChange(); activate = value; UpdateColorPreset(); } } public bool Is3DFloor { get { return (!General.Map.SRB2 && Action == 160) || General.Map.Config.GetLinedefActionInfo(Action).ThreeDFloor; } } + public bool IsInvisibleFOF { get { return General.Map.SRB2 && General.Map.Config.GetLinedefActionInfo(Action).InvisibleFOF; } } public bool IsCustom3DFloor { get { return General.Map.Config.GetLinedefActionInfo(Action).ThreeDFloorCustom; } } public bool IsRegularSlope { get { return (!General.Map.SRB2 && Action == 181) || General.Map.Config.GetLinedefActionInfo(Action).IsRegularSlope; } } public bool IsCopySlope { get { return (!General.Map.SRB2 && Action == 118) || General.Map.Config.GetLinedefActionInfo(Action).IsCopySlope; } } diff --git a/Source/Plugins/BuilderModes/Resources/Actions.cfg b/Source/Plugins/BuilderModes/Resources/Actions.cfg index 4489a3d..60f9190 100644 --- a/Source/Plugins/BuilderModes/Resources/Actions.cfg +++ b/Source/Plugins/BuilderModes/Resources/Actions.cfg @@ -1597,6 +1597,16 @@ togglegzdoomgeometryeffects default = 9; //Tab } +togglesrb2geometryeffects +{ + title = "Toggle SRB2 Invisible FOFs"; + category = "visual"; + description = "Toggles rendering of SRB2's invisible FOF types (light blocks, trigger zones etc.) in Visual mode."; + allowkeys = true; + allowmouse = true; + allowscroll = false; +} + togglecolormaps { title = "Toggle Colormaps"; diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs index b9db85e..877acdb 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs @@ -1184,7 +1184,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // MascaraSnake: 3D floor handling // ========== Sector 3D floor (see http://zdoom.org/wiki/Sector_Set3dFloor) ========== - if (l.Is3DFloor) + if (l.Is3DFloor && (General.Settings.SRB2RenderingEffects || !l.IsInvisibleFOF)) { if (l.Front != null) { @@ -3678,6 +3678,16 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Interface.DisplayStatus(StatusType.Info, "(G)ZDoom geometry effects are " + (General.Settings.GZDoomRenderingEffects ? "ENABLED" : "DISABLED")); } + //mxd + [BeginAction("togglesrb2geometryeffects")] + public void ToggleSRB2RenderingEffects() + { + General.Settings.SRB2RenderingEffects = !General.Settings.SRB2RenderingEffects; + RebuildElementData(); + UpdateChangedObjects(); + General.Interface.DisplayStatus(StatusType.Info, "SRB2 invisible FOFs are " + (General.Settings.SRB2RenderingEffects ? "ENABLED" : "DISABLED")); + } + //mxd [BeginAction("togglecolormaps")] public void ToggleColormaps()