From c018e0580572b61632966fa635888e890ae2be96 Mon Sep 17 00:00:00 2001 From: MaxED Date: Mon, 26 Nov 2012 14:23:48 +0000 Subject: [PATCH] UDMF vertex offsets ("zfloor" and "zceiling") were rendered incorrectly. Rendering of (G)ZDoom rendering effects (slopes, 3D-floors etc.) can now be toggled in GZDoom Visual mode (default key is "Tab", action is Visual modes -> Toggle GZDoom rendering effects) --- .../GZDoomEditing/Resources/Actions.cfg | 10 ++++++++ .../VisualModes/BaseVisualMode.cs | 25 ++++++++++++++++--- .../VisualModes/EffectUDMFVertexOffset.cs | 5 ++-- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/Source/Plugins/GZDoomEditing/Resources/Actions.cfg b/Source/Plugins/GZDoomEditing/Resources/Actions.cfg index 95693cfd..c8320a1f 100644 --- a/Source/Plugins/GZDoomEditing/Resources/Actions.cfg +++ b/Source/Plugins/GZDoomEditing/Resources/Actions.cfg @@ -33,4 +33,14 @@ ceilingalignmode allowscroll = true; } +togglegzdoomrenderingeffects +{ + title = "Toggle GZDoom rendering effects"; + category = "visual"; + description = "Toggles rendering of GZDoom rendering effects (slopes, 3D-floors etc.) in GZDoom Visual mode."; + allowkeys = true; + allowmouse = true; + allowscroll = false; + default = 9; //Tab +} diff --git a/Source/Plugins/GZDoomEditing/VisualModes/BaseVisualMode.cs b/Source/Plugins/GZDoomEditing/VisualModes/BaseVisualMode.cs index 7d3a0aed..81760bf5 100644 --- a/Source/Plugins/GZDoomEditing/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/GZDoomEditing/VisualModes/BaseVisualMode.cs @@ -91,6 +91,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing private List selectedobjects; //mxd. Used in Cut/PasteSelection actions private List copyBuffer; + private static bool gzdoomRenderingEffects = true; //mxd #endregion @@ -561,9 +562,18 @@ namespace CodeImp.DoomBuilder.GZDoomEditing // This requires that the blockmap is up-to-date! internal void RebuildElementData() { - Dictionary> sectortags = new Dictionary>(); - sectordata = new Dictionary(General.Map.Map.Sectors.Count); - thingdata = new Dictionary(General.Map.Map.Things.Count); + //mxd + if (!gzdoomRenderingEffects && sectordata != null && sectordata.Count > 0) { + //rebuild sectors with effects + foreach (KeyValuePair group in sectordata) + group.Value.Reset(); + } + + Dictionary> sectortags = new Dictionary>(); + sectordata = new Dictionary(General.Map.Map.Sectors.Count); + thingdata = new Dictionary(General.Map.Map.Things.Count); + + if (!gzdoomRenderingEffects) return; //mxd // Find all sector who's tag is not 0 and hash them so that we can find them quicly foreach(Sector s in General.Map.Map.Sectors) @@ -1832,6 +1842,15 @@ namespace CodeImp.DoomBuilder.GZDoomEditing PostAction(); } + + //mxd + [BeginAction("togglegzdoomrenderingeffects")] + public void ToggleGZDoomRenderingEffects() { + gzdoomRenderingEffects = !gzdoomRenderingEffects; + RebuildElementData(); + UpdateChangedObjects(); + General.Interface.DisplayStatus(StatusType.Info, "(G)ZDoom rendering effects are " + (gzdoomRenderingEffects ? "ENABLED" : "DISABLED")); + } #endregion } diff --git a/Source/Plugins/GZDoomEditing/VisualModes/EffectUDMFVertexOffset.cs b/Source/Plugins/GZDoomEditing/VisualModes/EffectUDMFVertexOffset.cs index ae612707..f045d87d 100644 --- a/Source/Plugins/GZDoomEditing/VisualModes/EffectUDMFVertexOffset.cs +++ b/Source/Plugins/GZDoomEditing/VisualModes/EffectUDMFVertexOffset.cs @@ -45,13 +45,14 @@ namespace CodeImp.DoomBuilder.GZDoomEditing { //check ceiling if (vertices[index].Fields.ContainsKey("zceiling")) { //yes, some things work in strange and mysterious ways in zdoom... - ceilingVerts[index].z = floorVerts[index].z + (float)vertices[index].Fields["zceiling"].Value; + ceilingVerts[index].z = (float)vertices[index].Fields["zceiling"].Value; ceilingChanged = true; } //and floor ceiling if (vertices[index].Fields.ContainsKey("zfloor")) { - floorVerts[index].z += (float)vertices[index].Fields["zfloor"].Value; + //yes, some things work in strange and mysterious ways in zdoom... + floorVerts[index].z = (float)vertices[index].Fields["zfloor"].Value; floorChanged = true; }