Fix flag setting actions when multiple sides are selected

This commit is contained in:
spherallic 2024-07-12 15:04:44 +02:00
parent 0140ac59f8
commit d654fc2d79
8 changed files with 17 additions and 15 deletions

View file

@ -400,7 +400,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected virtual void SetTexture(string texturename) { } protected virtual void SetTexture(string texturename) { }
public virtual void ApplyUpperUnpegged(bool set) { } public virtual void ApplyUpperUnpegged(bool set) { }
public virtual void ApplyLowerUnpegged(bool set) { } public virtual void ApplyLowerUnpegged(bool set) { }
public virtual void ApplyLineFlag(Linedef line, string flag, string name) { } public virtual void ApplyLineFlag(string flag, string name) { }
protected abstract void MoveTextureOffset(int offsetx, int offsety); protected abstract void MoveTextureOffset(int offsetx, int offsety);
protected abstract Point GetTextureOffset(); protected abstract Point GetTextureOffset();
public virtual void OnPaintSelectEnd() { } // biwa public virtual void OnPaintSelectEnd() { } // biwa

View file

@ -1063,7 +1063,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Toggle midtexture pegging // Toggle midtexture pegging
public virtual void OnTogglePegMidtexture() public virtual void OnTogglePegMidtexture()
{ {
mode.ApplyLineFlag(this.Sidedef.Line, "midpeg", "Peg Midtexture"); mode.ApplyLineFlag("midpeg", "Peg Midtexture");
} }
// Toggle slope skew // Toggle slope skew
@ -1073,15 +1073,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
case VisualGeometryType.WALL_LOWER: case VisualGeometryType.WALL_LOWER:
case VisualGeometryType.WALL_UPPER: case VisualGeometryType.WALL_UPPER:
mode.ApplyLineFlag(this.Sidedef.Line, "skewtd", "Slope Skew");
break;
case VisualGeometryType.WALL_MIDDLE_3D: case VisualGeometryType.WALL_MIDDLE_3D:
mode.ApplyLineFlag(this.GetControlLinedef(), "skewtd", "Slope Skew"); mode.ApplyLineFlag("skewtd", "Slope Skew");
break; break;
case VisualGeometryType.WALL_MIDDLE: case VisualGeometryType.WALL_MIDDLE:
mode.ApplyLineFlag(this.Sidedef.Line, "noskew", "No Midtexture Skew"); mode.ApplyLineFlag("noskew", "No Midtexture Skew");
break; break;
} }
} }
@ -1149,8 +1146,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
// This sets a specified flag // This sets a specified flag
public virtual void ApplyLineFlag(Linedef line, string flag, string name) public virtual void ApplyLineFlag(string flag, string name)
{ {
Linedef line = this.Sidedef.Line;
if (this.GeometryType == VisualGeometryType.WALL_MIDDLE_3D)
line = this.GetControlLinedef();
if (line.IsFlagSet(flag)) if (line.IsFlagSet(flag))
{ {
// Remove flag // Remove flag

View file

@ -2249,12 +2249,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
// Apply specified flag // Apply specified flag
public void ApplyLineFlag(Linedef line, string flag, string name) public void ApplyLineFlag(string flag, string name)
{ {
List<IVisualEventReceiver> objs = GetSelectedObjects(false, true, false, false, false); List<IVisualEventReceiver> objs = GetSelectedObjects(false, true, false, false, false);
foreach (IVisualEventReceiver i in objs) foreach (IVisualEventReceiver i in objs)
{ {
i.ApplyLineFlag(line, flag, name); i.ApplyLineFlag(flag, name);
} }
} }

View file

@ -129,7 +129,7 @@ namespace CodeImp.DoomBuilder.VisualModes
public void ApplyTexture(string texture) { } public void ApplyTexture(string texture) { }
public void ApplyUpperUnpegged(bool set) { } public void ApplyUpperUnpegged(bool set) { }
public void ApplyLowerUnpegged(bool set) { } public void ApplyLowerUnpegged(bool set) { }
public void ApplyLineFlag(Linedef line, string flag, string name) { } public void ApplyLineFlag(string flag, string name) { }
public void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight, bool stopatselected) { } //mxd public void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight, bool stopatselected) { } //mxd
public virtual void OnPaintSelectEnd() { } // biwa public virtual void OnPaintSelectEnd() { } // biwa
public void OnChangeScale(int x, int y) { } public void OnChangeScale(int x, int y) { }

View file

@ -723,7 +723,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void ApplyTexture(string texture) { } public void ApplyTexture(string texture) { }
public void ApplyUpperUnpegged(bool set) { } public void ApplyUpperUnpegged(bool set) { }
public void ApplyLowerUnpegged(bool set) { } public void ApplyLowerUnpegged(bool set) { }
public void ApplyLineFlag(Linedef line, string flag, string name) { } public void ApplyLineFlag(string flag, string name) { }
public void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight, bool stopatselected) { } //mxd public void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight, bool stopatselected) { } //mxd
public virtual void OnPaintSelectEnd() { } // biwa public virtual void OnPaintSelectEnd() { } // biwa

View file

@ -262,7 +262,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void ApplyTexture(string texture) { } public void ApplyTexture(string texture) { }
public void ApplyUpperUnpegged(bool set) { } public void ApplyUpperUnpegged(bool set) { }
public void ApplyLowerUnpegged(bool set) { } public void ApplyLowerUnpegged(bool set) { }
public void ApplyLineFlag(Linedef line, string flag, string name) { } public void ApplyLineFlag(string flag, string name) { }
public string GetTextureName() { return ""; } public string GetTextureName() { return ""; }
public void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight, bool stopatselected) { } //mxd public void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight, bool stopatselected) { } //mxd
public virtual void OnPaintSelectBegin() { } // biwa public virtual void OnPaintSelectBegin() { } // biwa

View file

@ -64,7 +64,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
void ApplyTexture(string texture); void ApplyTexture(string texture);
void ApplyUpperUnpegged(bool set); void ApplyUpperUnpegged(bool set);
void ApplyLowerUnpegged(bool set); void ApplyLowerUnpegged(bool set);
void ApplyLineFlag(Linedef line, string flag, string name); void ApplyLineFlag(string flag, string name);
// Other methods // Other methods
string GetTextureName(); string GetTextureName();

View file

@ -61,7 +61,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void ApplyTexture(string texture) { } public void ApplyTexture(string texture) { }
public void ApplyUpperUnpegged(bool set) { } public void ApplyUpperUnpegged(bool set) { }
public void ApplyLowerUnpegged(bool set) { } public void ApplyLowerUnpegged(bool set) { }
public void ApplyLineFlag(Linedef line, string flag, string name) { } public void ApplyLineFlag(string flag, string name) { }
public string GetTextureName() { return ""; } public string GetTextureName() { return ""; }
public void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight, bool stopatselected) { } //mxd public void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight, bool stopatselected) { } //mxd
} }