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)
This commit is contained in:
MaxED 2012-11-26 14:23:48 +00:00
parent 323c098b17
commit c018e05805
3 changed files with 35 additions and 5 deletions

View file

@ -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
}

View file

@ -91,6 +91,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
private List<IVisualEventReceiver> selectedobjects;
//mxd. Used in Cut/PasteSelection actions
private List<ThingCopyData> 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<int, List<Sector>> sectortags = new Dictionary<int, List<Sector>>();
sectordata = new Dictionary<Sector, SectorData>(General.Map.Map.Sectors.Count);
thingdata = new Dictionary<Thing,ThingData>(General.Map.Map.Things.Count);
//mxd
if (!gzdoomRenderingEffects && sectordata != null && sectordata.Count > 0) {
//rebuild sectors with effects
foreach (KeyValuePair<Sector, SectorData> group in sectordata)
group.Value.Reset();
}
Dictionary<int, List<Sector>> sectortags = new Dictionary<int, List<Sector>>();
sectordata = new Dictionary<Sector, SectorData>(General.Map.Map.Sectors.Count);
thingdata = new Dictionary<Thing, ThingData>(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)
@ -1833,6 +1843,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
}
}

View file

@ -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;
}