From e2abbe35d9d6ec4f1a5ad67f77169366ab131b71 Mon Sep 17 00:00:00 2001 From: spherallic Date: Fri, 12 Jul 2024 17:29:52 +0200 Subject: [PATCH] Update all FOF sides when modifying offsets/skew, always reset local texture offsets with reset actions --- .../VisualModes/BaseVisualGeometrySidedef.cs | 24 ++++++++++++------- .../VisualModes/VisualMiddle3D.cs | 18 ++++++++++++++ 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs index bd115438..451685e2 100755 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs @@ -979,7 +979,11 @@ namespace CodeImp.DoomBuilder.BuilderModes // Apply offsets Sidedef.OffsetX = 0; Sidedef.OffsetY = 0; - + + // Reset texture offsets too + SetTextureOffsetX(0); + SetTextureOffsetY(0); + // Update sidedef geometry VisualSidedefParts parts = Sector.GetSidedefParts(Sidedef); parts.SetupAllParts(); @@ -1148,10 +1152,8 @@ namespace CodeImp.DoomBuilder.BuilderModes // This sets a specified flag public virtual void ApplyLineFlag(string flag, string name) { - Linedef line = this.Sidedef.Line; - - if (this.GeometryType == VisualGeometryType.WALL_MIDDLE_3D) - line = this.GetControlLinedef(); + bool middle3d = this.GeometryType == VisualGeometryType.WALL_MIDDLE_3D; + Linedef line = middle3d ? this.GetControlLinedef() : this.Sidedef.Line; if (line.IsFlagSet(flag)) { @@ -1179,6 +1181,10 @@ namespace CodeImp.DoomBuilder.BuilderModes parts = othersector.GetSidedefParts(Sidedef.Other); parts.SetupAllParts(); } + + //mxd. Update linked effects + SectorData sd = mode.GetSectorDataEx(Sector.Sector); + if (sd != null) sd.Reset(true); } @@ -1720,13 +1726,13 @@ namespace CodeImp.DoomBuilder.BuilderModes } } } - + // Texture offset change public virtual bool OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { if((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket)) undoticket = mode.CreateUndo("Change texture offsets"); - + //mxd if(General.Map.UDMF && General.Map.Config.UseLocalSidedefTextureOffsets) { @@ -1737,8 +1743,8 @@ namespace CodeImp.DoomBuilder.BuilderModes // Update this part only this.Setup(); - } - else + } + else { //mxd. Apply classic offsets bool textureloaded = (Texture != null && Texture.IsImageLoaded); diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs b/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs index de12bff7..96451ddb 100755 --- a/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs @@ -576,6 +576,24 @@ namespace CodeImp.DoomBuilder.BuilderModes mode.GetVisualSector(extrafloor.Linedef.Front.Sector).UpdateSectorGeometry(false); } + //sphere: update FOF texture offsets and skewing properly + public override bool OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) + { + base.OnChangeTextureOffset(horizontal, vertical, doSurfaceAngleCorrection); + + // Update the model sector to update all 3d floors + mode.GetVisualSector(extrafloor.Linedef.Front.Sector).UpdateSectorGeometry(false); + + return true; + } + public override void OnToggleSlopeSkew() + { + base.OnToggleSlopeSkew(); + + // Update the model sector to update all 3d floors + mode.GetVisualSector(extrafloor.Linedef.Front.Sector).UpdateSectorGeometry(false); + } + #endregion } }