From a80eb538df59ab4a8d4aef46f27b06316de19156 Mon Sep 17 00:00:00 2001 From: codeimp Date: Thu, 2 Apr 2009 11:08:33 +0000 Subject: [PATCH] Added "AbsoluteZ" option to things in game configurations for things that use absolute Z height values --- Build/Configurations/Skulltag_DoomHexen.cfg | 2 ++ Build/Configurations/ZDoom_DoomHexen.cfg | 2 ++ Build/Configurations/ZDoom_DoomUDMF.cfg | 2 ++ Build/Configurations/ZDoom_HereticHexen.cfg | 2 ++ Build/Configurations/ZDoom_Hexen.cfg | 2 ++ Build/Configurations/ZDoom_StrifeHexen.cfg | 2 ++ .../VisualModes/BaseVisualThing.cs | 7 +++- Source/Config/ThingCategory.cs | 4 +++ Source/Config/ThingTypeInfo.cs | 6 ++++ Source/Controls/ThingInfoPanel.cs | 36 +++++++++++-------- 10 files changed, 50 insertions(+), 15 deletions(-) diff --git a/Build/Configurations/Skulltag_DoomHexen.cfg b/Build/Configurations/Skulltag_DoomHexen.cfg index b1cd974b..754b91fb 100644 --- a/Build/Configurations/Skulltag_DoomHexen.cfg +++ b/Build/Configurations/Skulltag_DoomHexen.cfg @@ -6773,12 +6773,14 @@ thingtypes { title = "Vertex slope floor"; height = 8; + absolutez = true; } 1505 { title = "Vertex slope ceiling"; height = 8; + absolutez = true; } } diff --git a/Build/Configurations/ZDoom_DoomHexen.cfg b/Build/Configurations/ZDoom_DoomHexen.cfg index aa8ffbc9..2df0a1d2 100644 --- a/Build/Configurations/ZDoom_DoomHexen.cfg +++ b/Build/Configurations/ZDoom_DoomHexen.cfg @@ -7039,12 +7039,14 @@ thingtypes { title = "Vertex slope floor"; height = 8; + absolutez = true; } 1505 { title = "Vertex slope ceiling"; height = 8; + absolutez = true; } } diff --git a/Build/Configurations/ZDoom_DoomUDMF.cfg b/Build/Configurations/ZDoom_DoomUDMF.cfg index 33289d0b..d892df25 100644 --- a/Build/Configurations/ZDoom_DoomUDMF.cfg +++ b/Build/Configurations/ZDoom_DoomUDMF.cfg @@ -7253,12 +7253,14 @@ thingtypes { title = "Vertex slope floor"; height = 8; + absolutez = true; } 1505 { title = "Vertex slope ceiling"; height = 8; + absolutez = true; } } diff --git a/Build/Configurations/ZDoom_HereticHexen.cfg b/Build/Configurations/ZDoom_HereticHexen.cfg index bd57093f..7084762f 100644 --- a/Build/Configurations/ZDoom_HereticHexen.cfg +++ b/Build/Configurations/ZDoom_HereticHexen.cfg @@ -6176,12 +6176,14 @@ thingtypes { title = "Vertex slope floor"; height = 8; + absolutez = true; } 1505 { title = "Vertex slope ceiling"; height = 8; + absolutez = true; } } diff --git a/Build/Configurations/ZDoom_Hexen.cfg b/Build/Configurations/ZDoom_Hexen.cfg index b012e8fc..fe7e3e06 100644 --- a/Build/Configurations/ZDoom_Hexen.cfg +++ b/Build/Configurations/ZDoom_Hexen.cfg @@ -7244,12 +7244,14 @@ thingtypes { title = "Vertex slope floor"; height = 8; + absolutez = true; } 1505 { title = "Vertex slope ceiling"; height = 8; + absolutez = true; } } diff --git a/Build/Configurations/ZDoom_StrifeHexen.cfg b/Build/Configurations/ZDoom_StrifeHexen.cfg index c5260973..60a4f960 100644 --- a/Build/Configurations/ZDoom_StrifeHexen.cfg +++ b/Build/Configurations/ZDoom_StrifeHexen.cfg @@ -6580,12 +6580,14 @@ thingtypes { title = "Vertex slope floor"; height = 8; + absolutez = true; } 1505 { title = "Vertex slope ceiling"; height = 8; + absolutez = true; } } diff --git a/Source/BuilderModes/VisualModes/BaseVisualThing.cs b/Source/BuilderModes/VisualModes/BaseVisualThing.cs index 71242bc9..264ef991 100644 --- a/Source/BuilderModes/VisualModes/BaseVisualThing.cs +++ b/Source/BuilderModes/VisualModes/BaseVisualThing.cs @@ -148,7 +148,12 @@ namespace CodeImp.DoomBuilder.BuilderModes // Determine position Vector3D pos = Thing.Position; - if(info.Hangs) + if(info.AbsoluteZ) + { + // Absolute Z position + pos.z = Thing.Position.z; + } + else if(info.Hangs) { // Hang from ceiling if(Thing.Sector != null) pos.z = Thing.Sector.CeilHeight - info.Height; diff --git a/Source/Config/ThingCategory.cs b/Source/Config/ThingCategory.cs index addc67ff..d90aef97 100644 --- a/Source/Config/ThingCategory.cs +++ b/Source/Config/ThingCategory.cs @@ -58,6 +58,7 @@ namespace CodeImp.DoomBuilder.Config private int blocking; private int errorcheck; private bool fixedsize; + private bool absolutez; // Disposing private bool isdisposed = false; @@ -79,6 +80,7 @@ namespace CodeImp.DoomBuilder.Config public int ErrorCheck { get { return errorcheck; } } public bool FixedSize { get { return fixedsize; } } public bool IsDisposed { get { return isdisposed; } } + public bool AbsoluteZ { get { return absolutez; } } public List Things { get { return things; } } #endregion @@ -104,6 +106,7 @@ namespace CodeImp.DoomBuilder.Config this.blocking = 0; this.errorcheck = 1; this.fixedsize = false; + this.absolutez = false; // We have no destructor GC.SuppressFinalize(this); @@ -131,6 +134,7 @@ namespace CodeImp.DoomBuilder.Config this.blocking = cfg.ReadSetting("thingtypes." + name + ".blocking", 0); this.errorcheck = cfg.ReadSetting("thingtypes." + name + ".error", 1); this.fixedsize = cfg.ReadSetting("thingtypes." + name + ".fixedsize", false); + this.absolutez = cfg.ReadSetting("thingtypes." + name + ".absolutez", false); // Safety if(this.radius < 4f) this.radius = 8f; diff --git a/Source/Config/ThingTypeInfo.cs b/Source/Config/ThingTypeInfo.cs index daa39ccd..84f57d7c 100644 --- a/Source/Config/ThingTypeInfo.cs +++ b/Source/Config/ThingTypeInfo.cs @@ -64,6 +64,7 @@ namespace CodeImp.DoomBuilder.Config private ThingCategory category; private ArgumentInfo[] args; private bool isknown; + private bool absolutez; #endregion @@ -85,6 +86,7 @@ namespace CodeImp.DoomBuilder.Config public ArgumentInfo[] Args { get { return args; } } public bool IsKnown { get { return isknown; } } public bool IsNull { get { return (index == 0); } } + public bool AbsoluteZ { get { return absolutez; } } #endregion @@ -109,6 +111,7 @@ namespace CodeImp.DoomBuilder.Config this.spritelongname = long.MaxValue; this.args = new ArgumentInfo[Linedef.NUM_ARGS]; this.isknown = false; + this.absolutez = false; // We have no destructor GC.SuppressFinalize(this); @@ -136,6 +139,7 @@ namespace CodeImp.DoomBuilder.Config this.blocking = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".blocking", cat.Blocking); this.errorcheck = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".error", cat.ErrorCheck); this.fixedsize = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".fixedsize", cat.FixedSize); + this.absolutez = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".absolutez", cat.AbsoluteZ); // Read the args for(int i = 0; i < Linedef.NUM_ARGS; i++) @@ -177,6 +181,7 @@ namespace CodeImp.DoomBuilder.Config this.blocking = cat.Blocking; this.errorcheck = cat.ErrorCheck; this.fixedsize = cat.FixedSize; + this.absolutez = cat.AbsoluteZ; // Safety if(this.radius < 4f) this.radius = 8f; @@ -212,6 +217,7 @@ namespace CodeImp.DoomBuilder.Config this.blocking = cat.Blocking; this.errorcheck = cat.ErrorCheck; this.fixedsize = cat.FixedSize; + this.absolutez = cat.AbsoluteZ; // Safety if(this.radius < 4f) this.radius = 8f; diff --git a/Source/Controls/ThingInfoPanel.cs b/Source/Controls/ThingInfoPanel.cs index ad4cd552..e5d415c7 100644 --- a/Source/Controls/ThingInfoPanel.cs +++ b/Source/Controls/ThingInfoPanel.cs @@ -110,24 +110,32 @@ namespace CodeImp.DoomBuilder.Controls // Determine z info to show t.DetermineSector(); - if(t.Sector != null) + if(ti.AbsoluteZ) { - // Hangs from ceiling? - if(ti.Hangs) - { - zvalue = (float)t.Sector.CeilHeight + t.Position.z; - zinfo = zvalue.ToString(); - } - else - { - zvalue = (float)t.Sector.FloorHeight + t.Position.z; - zinfo = zvalue.ToString(); - } + zvalue = t.Position.z; + zinfo = zvalue.ToString(); } else { - zvalue = t.Position.z; - if(zvalue >= 0.0f) zinfo = "+" + zvalue.ToString(); else zinfo = zvalue.ToString(); + if(t.Sector != null) + { + // Hangs from ceiling? + if(ti.Hangs) + { + zvalue = (float)t.Sector.CeilHeight + t.Position.z; + zinfo = zvalue.ToString(); + } + else + { + zvalue = (float)t.Sector.FloorHeight + t.Position.z; + zinfo = zvalue.ToString(); + } + } + else + { + zvalue = t.Position.z; + if(zvalue >= 0.0f) zinfo = "+" + zvalue.ToString(); else zinfo = zvalue.ToString(); + } } // Thing info