diff --git a/Help/gzdb/faq.html b/Help/gzdb/faq.html index d8e68562..42ad2815 100644 --- a/Help/gzdb/faq.html +++ b/Help/gzdb/faq.html @@ -22,9 +22,9 @@

Q: I'm getting a ton of "Unable to find the DECORATE class '[some actor]' to inherit from, while parsing '[some other actor]:[DoomEdNum]'" warnings. What's wrong?
- A: This happens when a DECORATE actor is inherited from another actor, which is not defined in game configuration. To fix this, add "(g)zdoom.pk3" as a map resource. Don't forget to check "Exclude from testing parameters" chekbox while adding it, otherwise (G)ZDoom won't load. (g)zdoom.pk3 can be found in (G)ZDoom folder.

+ A: This happens when a DECORATE actor is inherited from another actor, which is not defined in game configuration. To fix this, add "(g)zdoom.pk3" as a map resource. Don't forget to check "Exclude from testing parameters" chekbox while adding it, otherwise (G)ZDoom won't load your map. (g)zdoom.pk3 can be found in (G)ZDoom folder.

Q: I'm getting a ton of "Error in 'GLDEFS' at line [n]: light declaration not found for light '[light name]'" warnings. What's wrong?
- A: GZDoom Builder doesn't include GLDEFS lights definitions. To get rid of these errors, add "lights.pk3" as a map resource. Don't forget to check "Exclude from testing parameters" chekbox while adding it, otherwise GZDoom won't load. lights.pk3 can be found in GZDoom folder.

+ A: GZDoom Builder doesn't include GLDEFS lights definitions. To get rid of these errors, add "lights.pk3" as a map resource. Don't forget to check "Exclude from testing parameters" chekbox while adding it, otherwise GZDoom won't load your map. lights.pk3 can be found in GZDoom folder.

Q: When I create a new map, I see only Doom-related game configurations. Where are configurations for other games?
A: Copy "[EngineName]_[Game][MapType].cfg" and "Includes" folder from "[GZDB]\Configurations\Configs for other games\[Game]" to "[GZDoom Builder]\Configurations\".
If you are using Zandronum, you'll also need to copy all files from "[GZDB]\Configurations\Configs for other games\Zandronum Includes\" to the main "Includes" folder ("[GZDB]\Configurations\Includes\") .

diff --git a/Source/Core/GZBuilder/Tools/UDMFTools.cs b/Source/Core/GZBuilder/Tools/UDMFTools.cs index 57c82e4d..307ac502 100644 --- a/Source/Core/GZBuilder/Tools/UDMFTools.cs +++ b/Source/Core/GZBuilder/Tools/UDMFTools.cs @@ -6,6 +6,10 @@ namespace CodeImp.DoomBuilder.GZBuilder.Tools public static class UDMFTools { //float + public static void SetFloat(UniFields fields, string key, float value) { + SetFloat(fields, key, value, 0f); + } + public static void SetFloat(UniFields fields, string key, float value, float defaultValue) { if(fields == null) return; @@ -19,12 +23,20 @@ namespace CodeImp.DoomBuilder.GZBuilder.Tools } } + public static float GetFloat(UniFields fields, string key) { + return GetFloat(fields, key, 0f); + } + public static float GetFloat(UniFields fields, string key, float defaultValue) { if(fields == null) return defaultValue; return fields.GetValue(key, defaultValue); } //int + public static void SetInteger(UniFields fields, string key, int value) { + SetInteger(fields, key, value, 0); + } + public static void SetInteger(UniFields fields, string key, int value, int defaultValue) { if(fields == null) return; @@ -38,6 +50,10 @@ namespace CodeImp.DoomBuilder.GZBuilder.Tools } } + public static int GetInteger(UniFields fields, string key) { + return GetInteger(fields, key, 0); + } + public static int GetInteger(UniFields fields, string key, int defaultValue) { if(fields == null) return defaultValue; return fields.GetValue(key, defaultValue); diff --git a/Source/Core/Geometry/Tools.cs b/Source/Core/Geometry/Tools.cs index c2a2a421..ec1891f7 100644 --- a/Source/Core/Geometry/Tools.cs +++ b/Source/Core/Geometry/Tools.cs @@ -27,6 +27,7 @@ using CodeImp.DoomBuilder.Data; using CodeImp.DoomBuilder.Config; using CodeImp.DoomBuilder.Types; using System.Windows.Forms; +using CodeImp.DoomBuilder.GZBuilder.Tools; #endregion @@ -1494,54 +1495,48 @@ namespace CodeImp.DoomBuilder.Geometry foreach(Linedef l in lines) { if(l.Front != null) { - if(!l.Front.Fields.ContainsKey("offsetx_mid") && l.Front.MiddleRequired() && l.Front.MiddleTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Front.MiddleTexture)) { + if(l.Front.MiddleRequired() && l.Front.MiddleTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Front.MiddleTexture)) { ImageData texture = General.Map.Data.GetFlatImage(l.Front.MiddleTexture); float offset = (int)Math.Round((reversed ? totalLength - curLength - l.Length : curLength)) % texture.Width; - if(offset > 0) - l.Front.Fields.Add("offsetx_mid", new UniValue(UniversalType.Float, offset)); + if(offset > 0) UDMFTools.SetFloat(l.Front.Fields, "offsetx_mid", offset); } - if(!l.Front.Fields.ContainsKey("offsetx_top") && l.Front.HighRequired() && l.Front.HighTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Front.HighTexture)) { + if(l.Front.HighRequired() && l.Front.HighTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Front.HighTexture)) { ImageData texture = General.Map.Data.GetFlatImage(l.Front.HighTexture); float offset = (int)Math.Round((reversed ? totalLength - curLength - l.Length : curLength)) % texture.Width; - if(offset > 0) - l.Front.Fields.Add("offsetx_top", new UniValue(UniversalType.Float, offset)); + if(offset > 0) UDMFTools.SetFloat(l.Front.Fields, "offsetx_top", offset); } - if(!l.Front.Fields.ContainsKey("offsetx_bottom") && l.Front.LowRequired() && l.Front.LowTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Front.LowTexture)) { + if(l.Front.LowRequired() && l.Front.LowTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Front.LowTexture)) { ImageData texture = General.Map.Data.GetFlatImage(l.Front.LowTexture); float offset = (int)Math.Round((reversed ? totalLength - curLength - l.Length : curLength)) % texture.Width; - if(offset > 0) - l.Front.Fields.Add("offsetx_bottom", new UniValue(UniversalType.Float, offset)); + if(offset > 0) UDMFTools.SetFloat(l.Front.Fields, "offsetx_bottom", offset); } } if(l.Back != null) { - if(!l.Back.Fields.ContainsKey("offsetx_mid") && l.Back.MiddleRequired() && l.Back.MiddleTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Back.MiddleTexture)) { + if(l.Back.MiddleRequired() && l.Back.MiddleTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Back.MiddleTexture)) { ImageData texture = General.Map.Data.GetFlatImage(l.Back.MiddleTexture); float offset = (int)Math.Round((reversed ? totalLength - curLength - l.Length : curLength)) % texture.Width; - if(offset > 0) - l.Back.Fields.Add("offsetx_mid", new UniValue(UniversalType.Float, offset)); + if(offset > 0) UDMFTools.SetFloat(l.Back.Fields, "offsetx_mid", offset); } - if(!l.Back.Fields.ContainsKey("offsetx_top") && l.Back.HighRequired() && l.Back.HighTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Back.HighTexture)) { + if(l.Back.HighRequired() && l.Back.HighTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Back.HighTexture)) { ImageData texture = General.Map.Data.GetFlatImage(l.Back.HighTexture); float offset = (int)Math.Round((reversed ? totalLength - curLength - l.Length : curLength)) % texture.Width; - if(offset > 0) - l.Back.Fields.Add("offsetx_top", new UniValue(UniversalType.Float, offset)); + if(offset > 0) UDMFTools.SetFloat(l.Back.Fields, "offsetx_top", offset); } - if(!l.Back.Fields.ContainsKey("offsetx_bottom") && l.Back.LowRequired() && l.Back.LowTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Back.LowTexture)) { + if(l.Back.LowRequired() && l.Back.LowTexture.Length > 1 && General.Map.Data.GetFlatExists(l.Back.LowTexture)) { ImageData texture = General.Map.Data.GetFlatImage(l.Back.LowTexture); float offset = (int)Math.Round((reversed ? totalLength - curLength - l.Length : curLength)) % texture.Width; - if(offset > 0) - l.Back.Fields.Add("offsetx_bottom", new UniValue(UniversalType.Float, offset)); + if(offset > 0) UDMFTools.SetFloat(l.Back.Fields, "offsetx_bottom", offset); } } diff --git a/Source/Core/Map/Linedef.cs b/Source/Core/Map/Linedef.cs index cd9f9b7e..597dcc9b 100644 --- a/Source/Core/Map/Linedef.cs +++ b/Source/Core/Map/Linedef.cs @@ -24,6 +24,7 @@ using System.Drawing; using CodeImp.DoomBuilder.IO; using CodeImp.DoomBuilder.Types; using CodeImp.DoomBuilder.Data; +using CodeImp.DoomBuilder.GZBuilder.Tools; #endregion @@ -835,19 +836,20 @@ namespace CodeImp.DoomBuilder.Map back.CopyPropertiesTo(nsd); nsd.Marked = back.Marked; - // Make texture offset adjustments - //mxd + //mxd. Make texture offset adjustments int distance = (int)Vector2D.Distance(nl.start.Position, nl.end.Position); - if(General.Map.UDMF) - if(distance != 0) applyTextureOffsetUDMF(back, distance); - else + if(General.Map.UDMF) { + if (distance != 0) + back.SetUdmfTextureOffsetX(distance); + } else { back.OffsetX += distance; + } } //mxd. Both sides of line are required, so we do it here... if(nl.Front != null && General.Map.UDMF) { int distance = (int)Vector2D.Distance(this.start.Position, this.end.Position); - if(distance != 0) applyTextureOffsetUDMF(nl.Front, distance); + if(distance != 0) nl.Front.SetUdmfTextureOffsetX(distance); } // Return result @@ -1074,73 +1076,6 @@ namespace CodeImp.DoomBuilder.Map colorPresetIndex = -1; } - //mxd - private void applyTextureOffsetUDMF(Sidedef side, int distance) { - float scaleTop = side.Fields.GetValue("scalex_top", 1.0f); - float scaleMid = side.Fields.GetValue("scalex_mid", 1.0f); - float scaleLow = side.Fields.GetValue("scalex_bottom", 1.0f); - - //top - if(side.HighTexture.Length > 1 && General.Map.Data.GetFlatExists(side.HighTexture)) { - ImageData texture = General.Map.Data.GetFlatImage(side.HighTexture); - - if(side.Fields.ContainsKey("offsetx_top")) { - float value = side.Fields.GetValue("offsetx_top", 0f); - float offset = (float)(Math.Round((value + distance) * scaleTop) % texture.Width); - - if(offset != 0) - side.Fields["offsetx_top"].Value = offset; - else - side.Fields.Remove("offsetx_top"); - } else if(side.HighRequired()) { - float offset = (float)(Math.Round(distance * scaleTop) % texture.Width); - - if(offset != 0) - side.Fields.Add("offsetx_top", new UniValue(UniversalType.Float, offset)); - } - } - - //middle - if(side.MiddleTexture.Length > 1 && General.Map.Data.GetFlatExists(side.MiddleTexture)){ - ImageData texture = General.Map.Data.GetFlatImage(side.MiddleTexture); - - if(side.Fields.ContainsKey("offsetx_mid")) { - float value = side.Fields.GetValue("offsetx_mid", 0f); - float offset = (float)(Math.Round((value + distance) * scaleMid) % texture.Width); - - if(offset != 0) - side.Fields["offsetx_mid"].Value = offset; - else - side.Fields.Remove("offsetx_mid"); - } else if(side.MiddleRequired()) { - float offset = (float)(Math.Round(distance * scaleMid) % texture.Width); - - if(offset != 0) - side.Fields.Add("offsetx_mid", new UniValue(UniversalType.Float, offset)); - } - } - - //bottom - if(side.LowTexture.Length > 1 && General.Map.Data.GetFlatExists(side.LowTexture)){ - ImageData texture = General.Map.Data.GetFlatImage(side.LowTexture); - - if(side.Fields.ContainsKey("offsetx_bottom")) { - float value = side.Fields.GetValue("offsetx_bottom", 0f); - float offset = (float)(Math.Round((value + distance) * scaleLow) % texture.Width); - - if(offset != 0) - side.Fields["offsetx_bottom"].Value = offset; - else - side.Fields.Remove("offsetx_bottom"); - } else if(side.LowRequired()) { - float offset = (float)(Math.Round(distance * scaleLow) % texture.Width); - - if(offset != 0) - side.Fields.Add("offsetx_bottom", new UniValue(UniversalType.Float, offset)); - } - } - } - // String representation public override string ToString() { diff --git a/Source/Core/Map/Sidedef.cs b/Source/Core/Map/Sidedef.cs index f5ceaf34..f5b187aa 100644 --- a/Source/Core/Map/Sidedef.cs +++ b/Source/Core/Map/Sidedef.cs @@ -20,6 +20,8 @@ using System; using System.Collections.Generic; using CodeImp.DoomBuilder.IO; using CodeImp.DoomBuilder.Geometry; +using CodeImp.DoomBuilder.Data; +using CodeImp.DoomBuilder.GZBuilder.Tools; #endregion @@ -560,6 +562,41 @@ namespace CodeImp.DoomBuilder.Map longtexnamelow = Lump.MakeLongName(name); General.Map.IsChanged = true; } + + // This sets udmf texture offset + public void SetUdmfTextureOffsetX(int offset) { + this.Fields.BeforeFieldsChange(); + + //top + if(HighTexture.Length > 1 && General.Map.Data.GetFlatExists(HighTexture)) { + ImageData texture = General.Map.Data.GetFlatImage(HighTexture); + float scaleTop = Fields.GetValue("scalex_top", 1.0f); + + float value = Fields.GetValue("offsetx_top", 0f); + float result = (float)(Math.Round(value + offset * scaleTop) % texture.Width); + UDMFTools.SetFloat(Fields, "offsetx_top", result); + } + + //middle + if(MiddleTexture.Length > 1 && General.Map.Data.GetFlatExists(MiddleTexture)) { + ImageData texture = General.Map.Data.GetFlatImage(MiddleTexture); + float scaleMid = Fields.GetValue("scalex_mid", 1.0f); + + float value = Fields.GetValue("offsetx_mid", 0f); + float result = (float)(Math.Round(value + offset * scaleMid) % texture.Width); + UDMFTools.SetFloat(Fields, "offsetx_mid", result); + } + + //bottom + if(LowTexture.Length > 1 && General.Map.Data.GetFlatExists(LowTexture)) { + ImageData texture = General.Map.Data.GetFlatImage(LowTexture); + float scaleLow = Fields.GetValue("scalex_bottom", 1.0f); + + float value = Fields.GetValue("offsetx_bottom", 0f); + float result = (float)(Math.Round(value + offset * scaleLow) % texture.Width); + UDMFTools.SetFloat(Fields, "offsetx_bottom", result); + } + } #endregion } diff --git a/Source/Core/Map/UniFields.cs b/Source/Core/Map/UniFields.cs index 0cf9d214..dc997690 100644 --- a/Source/Core/Map/UniFields.cs +++ b/Source/Core/Map/UniFields.cs @@ -52,9 +52,12 @@ namespace CodeImp.DoomBuilder.Map // Copy constructor /// - public UniFields(MapElement owner, UniFields copyfrom) : base(copyfrom) + public UniFields(MapElement owner, UniFields copyfrom) : base(copyfrom.Count) { this.owner = owner; + + foreach(KeyValuePair v in copyfrom) //mxd. No-no-no, David Blaine, I don't want to copy these by reference! + this.Add(v.Key, new UniValue(v.Value)); } /// Call this before making changes to the fields, or they may not be updated correctly with undo/redo! diff --git a/Source/Plugins/BuilderModes/ClassicModes/DrawGeometryMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DrawGeometryMode.cs index adbb2c2f..3052a16f 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/DrawGeometryMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DrawGeometryMode.cs @@ -109,12 +109,8 @@ namespace CodeImp.DoomBuilder.BuilderModes // This checks if the view offset/zoom changed and updates the check protected bool CheckViewChanged() { - bool viewchanged = false; - // View changed? - if(renderer.OffsetX != lastoffsetx) viewchanged = true; - if(renderer.OffsetY != lastoffsety) viewchanged = true; - if(renderer.Scale != lastscale) viewchanged = true; + bool viewchanged = (renderer.OffsetX != lastoffsetx || renderer.OffsetY != lastoffsety || renderer.Scale != lastscale); // Keep view information lastoffsetx = renderer.OffsetX; @@ -137,8 +133,7 @@ namespace CodeImp.DoomBuilder.BuilderModes DrawnVertex lastp = new DrawnVertex(); DrawnVertex curp = GetCurrentPosition(); - float vsize = ((float)renderer.VertexSize + 1.0f) / renderer.Scale; - float vsizeborder = ((float)renderer.VertexSize + 3.0f) / renderer.Scale; + float vsize = (renderer.VertexSize + 1.0f) / renderer.Scale; // The last label's end must go to the mouse cursor if(labels.Count > 0) labels[labels.Count - 1].End = curp.pos; @@ -175,8 +170,7 @@ namespace CodeImp.DoomBuilder.BuilderModes for(int i = 0; i < points.Count; i++) { // Determine vertex color - if(points[i].stitch) color = stitchcolor; - else color = losecolor; + color = points[i].stitch ? stitchcolor : losecolor; // Render vertex renderer.RenderRectangleFilled(new RectangleF(points[i].pos.x - vsize, points[i].pos.y - vsize, vsize * 2.0f, vsize * 2.0f), color, true); @@ -184,8 +178,7 @@ namespace CodeImp.DoomBuilder.BuilderModes } // Determine point color - if(snaptonearest) color = stitchcolor; - else color = losecolor; + color = snaptonearest ? stitchcolor : losecolor; // Render vertex at cursor renderer.RenderRectangleFilled(new RectangleF(curp.pos.x - vsize, curp.pos.y - vsize, vsize * 2.0f, vsize * 2.0f), color, true); diff --git a/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs index aee6426a..0580ad45 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs @@ -900,7 +900,6 @@ namespace CodeImp.DoomBuilder.BuilderModes OnMouseMove(e); // Redraw screen - //General.Map.Renderer2D.UpdateExtraFloorFlag(); //mxd General.Interface.RedrawDisplay(); } } @@ -1119,51 +1118,51 @@ namespace CodeImp.DoomBuilder.BuilderModes Linedef start = General.GetByIndex(orderedselection, 0); Linedef end = General.GetByIndex(orderedselection, orderedselection.Count - 1); - string lightKey = "light"; - string lightAbsKey = "lightabsolute"; + const string lightKey = "light"; + const string lightAbsKey = "lightabsolute"; float startbrightness = float.NaN; float endbrightness = float.NaN; //get total brightness of start sidedef(s) if(start.Front != null) { if(start.Front.Fields.GetValue(lightAbsKey, false)) { - startbrightness = (float)start.Front.Fields.GetValue(lightKey, 0); + startbrightness = start.Front.Fields.GetValue(lightKey, 0); } else { startbrightness = Math.Min(255, Math.Max(0, (float)start.Front.Sector.Brightness + start.Front.Fields.GetValue(lightKey, 0))); } } if(start.Back != null) { - float b = 0; + float b; if(start.Back.Fields.GetValue(lightAbsKey, false)) { - b = (float)start.Back.Fields.GetValue(lightKey, 0); + b = start.Back.Fields.GetValue(lightKey, 0); } else { b = Math.Min(255, Math.Max(0, (float)start.Back.Sector.Brightness + start.Back.Fields.GetValue(lightKey, 0))); } - startbrightness = (startbrightness == float.NaN ? b : (startbrightness + b) / 2); + startbrightness = (float.IsNaN(startbrightness) ? b : (startbrightness + b) / 2); } //get total brightness of end sidedef(s) if(end.Front != null) { if(end.Front.Fields.GetValue(lightAbsKey, false)) { - endbrightness = (float)end.Front.Fields.GetValue(lightKey, 0); + endbrightness = end.Front.Fields.GetValue(lightKey, 0); } else { endbrightness = Math.Min(255, Math.Max(0, (float)end.Front.Sector.Brightness + end.Front.Fields.GetValue(lightKey, 0))); } } if(end.Back != null) { - float b = 0; + float b; if(end.Back.Fields.GetValue(lightAbsKey, false)) { - b = (float)end.Back.Fields.GetValue(lightKey, 0); + b = end.Back.Fields.GetValue(lightKey, 0); } else { b = Math.Min(255, Math.Max(0, (float)end.Back.Sector.Brightness + end.Back.Fields.GetValue(lightKey, 0))); } - endbrightness = (endbrightness == float.NaN ? b : (endbrightness + b) / 2); + endbrightness = (float.IsNaN(endbrightness) ? b : (endbrightness + b) / 2); } float delta = endbrightness - startbrightness; @@ -1171,7 +1170,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // Go for all sectors in between first and last int index = 0; foreach(Linedef l in orderedselection) { - float u = (float)index / (float)(orderedselection.Count - 1); + float u = index / (float)(orderedselection.Count - 1); float b = startbrightness + delta * u; if(l.Front != null) { diff --git a/Source/Plugins/BuilderModes/General/BuilderPlug.cs b/Source/Plugins/BuilderModes/General/BuilderPlug.cs index f73dc493..e5291809 100644 --- a/Source/Plugins/BuilderModes/General/BuilderPlug.cs +++ b/Source/Plugins/BuilderModes/General/BuilderPlug.cs @@ -38,6 +38,7 @@ using CodeImp.DoomBuilder.GZBuilder.Geometry; using CodeImp.DoomBuilder.Actions; using CodeImp.DoomBuilder.BuilderModes.IO; using CodeImp.DoomBuilder.BuilderModes.Interface; +using CodeImp.DoomBuilder.GZBuilder.Tools; #endregion @@ -567,8 +568,7 @@ namespace CodeImp.DoomBuilder.BuilderModes } //clamp offsetX - if(texture != null) - newline.Front.OffsetX %= texture.Width; + if(texture != null) newline.Front.OffsetX %= texture.Width; } if((oldline.Back != null) && (newline.Back != null)) { @@ -584,8 +584,7 @@ namespace CodeImp.DoomBuilder.BuilderModes } //clamp offsetX - if(texture != null) - newline.Back.OffsetX %= texture.Width; + if(texture != null) newline.Back.OffsetX %= texture.Width; } } // Copy X and Y coordinates @@ -595,12 +594,34 @@ namespace CodeImp.DoomBuilder.BuilderModes { newline.Front.OffsetX = oldline.Front.OffsetX; newline.Front.OffsetY = oldline.Front.OffsetY; + + //mxd. Copy UDMF offsets as well + if(General.Map.UDMF) { + UDMFTools.SetFloat(newline.Front.Fields, "offsetx_top", oldline.Front.Fields.GetValue("offsetx_top", 0f)); + UDMFTools.SetFloat(newline.Front.Fields, "offsetx_mid", oldline.Front.Fields.GetValue("offsetx_mid", 0f)); + UDMFTools.SetFloat(newline.Front.Fields, "offsetx_bottom", oldline.Front.Fields.GetValue("offsetx_bottom", 0f)); + + UDMFTools.SetFloat(newline.Front.Fields, "offsety_top", oldline.Front.Fields.GetValue("offsety_top", 0f)); + UDMFTools.SetFloat(newline.Front.Fields, "offsety_mid", oldline.Front.Fields.GetValue("offsety_mid", 0f)); + UDMFTools.SetFloat(newline.Front.Fields, "offsety_bottom", oldline.Front.Fields.GetValue("offsety_bottom", 0f)); + } } if((oldline.Back != null) && (newline.Back != null)) { newline.Back.OffsetX = oldline.Back.OffsetX; newline.Back.OffsetY = oldline.Back.OffsetY; + + //mxd. Copy UDMF offsets as well + if(General.Map.UDMF) { + UDMFTools.SetFloat(newline.Back.Fields, "offsetx_top", oldline.Back.Fields.GetValue("offsetx_top", 0f)); + UDMFTools.SetFloat(newline.Back.Fields, "offsetx_mid", oldline.Back.Fields.GetValue("offsetx_mid", 0f)); + UDMFTools.SetFloat(newline.Back.Fields, "offsetx_bottom", oldline.Back.Fields.GetValue("offsetx_bottom", 0f)); + + UDMFTools.SetFloat(newline.Back.Fields, "offsety_top", oldline.Back.Fields.GetValue("offsety_top", 0f)); + UDMFTools.SetFloat(newline.Back.Fields, "offsety_mid", oldline.Back.Fields.GetValue("offsety_mid", 0f)); + UDMFTools.SetFloat(newline.Back.Fields, "offsety_bottom", oldline.Back.Fields.GetValue("offsety_bottom", 0f)); + } } } // Reset X coordinate, copy Y coordinate @@ -610,12 +631,30 @@ namespace CodeImp.DoomBuilder.BuilderModes { newline.Front.OffsetX = 0; newline.Front.OffsetY = oldline.Front.OffsetY; + + //mxd. Reset UDMF X offset as well + if(General.Map.UDMF) { + UDMFTools.SetFloat(newline.Front.Fields, "offsetx_top", 0f); + UDMFTools.SetFloat(newline.Front.Fields, "offsetx_mid", 0f); + UDMFTools.SetFloat(newline.Front.Fields, "offsetx_bottom", 0f); + } } if((oldline.Back != null) && (newline.Back != null)) { newline.Back.OffsetX = 0; newline.Back.OffsetY = oldline.Back.OffsetY; + + //mxd. Reset UDMF X offset and copy Y offset as well + if(General.Map.UDMF) { + UDMFTools.SetFloat(newline.Back.Fields, "offsetx_top", 0f); + UDMFTools.SetFloat(newline.Back.Fields, "offsetx_mid", 0f); + UDMFTools.SetFloat(newline.Back.Fields, "offsetx_bottom", 0f); + + UDMFTools.SetFloat(newline.Back.Fields, "offsety_top", oldline.Back.Fields.GetValue("offsety_top", 0f)); + UDMFTools.SetFloat(newline.Back.Fields, "offsety_mid", oldline.Back.Fields.GetValue("offsety_mid", 0f)); + UDMFTools.SetFloat(newline.Back.Fields, "offsety_bottom", oldline.Back.Fields.GetValue("offsety_bottom", 0f)); + } } } }