mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2025-04-22 17:44:06 +00:00
Add actions to Visual Mode: for raising and lowering sectors/things by grid size, and for toggling Peg and Repeat Midtexture flags.
This commit is contained in:
parent
2a258faa0b
commit
148f3d69ba
9 changed files with 156 additions and 75 deletions
|
@ -109,6 +109,8 @@ shortcuts
|
|||
buildermodes_lowersector8 = 65531;
|
||||
buildermodes_raisesector1 = 131066;
|
||||
buildermodes_lowersector1 = 131067;
|
||||
buildermodes_raisesectorgridsize = 393210;
|
||||
buildermodes_lowersectorgridsize = 393211;
|
||||
buildermodes_showvisualthings = 84;
|
||||
buildermodes_movetextureright = 39;
|
||||
buildermodes_movetextureleft = 37;
|
||||
|
@ -124,6 +126,8 @@ shortcuts
|
|||
buildermodes_togglemiddletexture = 77;
|
||||
buildermodes_togglelowerunpegged = 76;
|
||||
buildermodes_toggleupperunpegged = 85;
|
||||
buildermodes_togglepegmidtexture = 80;
|
||||
buildermodes_togglerepeatmidtexture = 82;
|
||||
buildermodes_togglegravity = 71;
|
||||
builder_insertpreviousprefab = 80;
|
||||
builder_createprefab = 0;
|
||||
|
|
|
@ -665,6 +665,28 @@ raisesector1
|
|||
repeat = true;
|
||||
}
|
||||
|
||||
lowersectorgridsize
|
||||
{
|
||||
title = "Lower Floor/Ceiling/Thing by grid size";
|
||||
category = "visual";
|
||||
description = "Lowers the targeted or selected floors/ceilings by current grid size. This also lowers selected or targeted things.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
repeat = true;
|
||||
}
|
||||
|
||||
raisesectorgridsize
|
||||
{
|
||||
title = "Raise Floor/Ceiling/Thing by grid size";
|
||||
category = "visual";
|
||||
description = "Raises the targeted or selected floors/ceilings by current grid size. This also raises selected or targeted things.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
repeat = true;
|
||||
}
|
||||
|
||||
//mxd
|
||||
lowersectortonearest
|
||||
{
|
||||
|
@ -1002,9 +1024,9 @@ visualfittextures
|
|||
|
||||
toggleupperunpegged
|
||||
{
|
||||
title = "Toggle Upper Unpegged";
|
||||
title = "Toggle Upper Unpegged Flag";
|
||||
category = "visual";
|
||||
description = "Toggles the Upper Unpegged setting on the selected or targeted linedef.";
|
||||
description = "Toggles the Upper Unpegged flag on the selected or targeted linedef.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
|
@ -1012,9 +1034,29 @@ toggleupperunpegged
|
|||
|
||||
togglelowerunpegged
|
||||
{
|
||||
title = "Toggle Lower Unpegged";
|
||||
title = "Toggle Lower Unpegged Flag";
|
||||
category = "visual";
|
||||
description = "Toggles the Lower Unpegged setting on the selected or targeted linedef.";
|
||||
description = "Toggles the Lower Unpegged flag on the selected or targeted linedef.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
togglepegmidtexture
|
||||
{
|
||||
title = "Toggle Peg Midtexture Flag";
|
||||
category = "visual";
|
||||
description = "Toggles the Peg Midtexture flag on the selected or targeted linedef.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
togglerepeatmidtexture
|
||||
{
|
||||
title = "Toggle Repeat Midtexture Flag";
|
||||
category = "visual";
|
||||
description = "Toggles the Repeat Midtexture flag on the selected or targeted linedef.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
|
|
|
@ -473,14 +473,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public virtual void OnTextureFit(FitTextureOptions options) { } //mxd
|
||||
public virtual void OnToggleUpperUnpegged() { }
|
||||
public virtual void OnToggleLowerUnpegged() { }
|
||||
public virtual void OnTogglePegMidtexture() { }
|
||||
public virtual void OnToggleRepeatMidtexture() { }
|
||||
public virtual void OnResetTextureOffset() { }
|
||||
public virtual void OnResetLocalTextureOffset() { } //mxd
|
||||
public virtual void OnCopyTextureOffsets() { }
|
||||
public virtual void OnPasteTextureOffsets() { }
|
||||
public virtual void OnInsert() { }
|
||||
protected virtual void SetTexture(string texturename) { }
|
||||
public virtual void ApplyUpperUnpegged(bool set) { }
|
||||
public virtual void ApplyLowerUnpegged(bool set) { }
|
||||
public virtual void ApplyLinedefFlag(string flag, bool set) { }
|
||||
protected abstract void MoveTextureOffset(Point xy);
|
||||
protected abstract Point GetTextureOffset();
|
||||
|
||||
|
|
|
@ -892,12 +892,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(this.Sidedef.Line.IsFlagSet(General.Map.Config.UpperUnpeggedFlag))
|
||||
{
|
||||
// Remove flag
|
||||
mode.ApplyUpperUnpegged(false);
|
||||
mode.CreateUndo("Remove Upper Unpegged flag");
|
||||
mode.SetActionResult("Removed Upper Unpegged flag.");
|
||||
mode.ApplyLinedefFlag(General.Map.Config.UpperUnpeggedFlag, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add flag
|
||||
mode.ApplyUpperUnpegged(true);
|
||||
mode.CreateUndo("Set Upper Unpegged flag");
|
||||
mode.SetActionResult("Set Upper Unpegged flag.");
|
||||
mode.ApplyLinedefFlag(General.Map.Config.UpperUnpeggedFlag, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -907,64 +911,66 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(this.Sidedef.Line.IsFlagSet(General.Map.Config.LowerUnpeggedFlag))
|
||||
{
|
||||
// Remove flag
|
||||
mode.ApplyLowerUnpegged(false);
|
||||
mode.CreateUndo("Remove Lower Unpegged flag");
|
||||
mode.SetActionResult("Removed Lower Unpegged flag.");
|
||||
mode.ApplyLinedefFlag(General.Map.Config.LowerUnpeggedFlag, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add flag
|
||||
mode.ApplyLowerUnpegged(true);
|
||||
mode.CreateUndo("Set Lower Unpegged flag");
|
||||
mode.SetActionResult("Set Lower Unpegged flag.");
|
||||
mode.ApplyLinedefFlag(General.Map.Config.LowerUnpeggedFlag, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This sets the Upper Unpegged flag
|
||||
public virtual void ApplyUpperUnpegged(bool set)
|
||||
public virtual void OnTogglePegMidtexture()
|
||||
{
|
||||
if(this.Sidedef.Line.IsFlagSet(General.Map.Config.PegMidtextureFlag))
|
||||
{
|
||||
// Remove flag
|
||||
mode.CreateUndo("Remove Peg Midtexture flag");
|
||||
mode.SetActionResult("Removed Peg Midtexture flag.");
|
||||
mode.ApplyLinedefFlag(General.Map.Config.PegMidtextureFlag, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add flag
|
||||
mode.CreateUndo("Set Peg Midtexture flag");
|
||||
mode.SetActionResult("Set Peg Midtexture flag.");
|
||||
mode.ApplyLinedefFlag(General.Map.Config.PegMidtextureFlag, true);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnToggleRepeatMidtexture()
|
||||
{
|
||||
if (this.Sidedef.Line.IsFlagSet(General.Map.Config.RepeatMidtextureFlag))
|
||||
{
|
||||
// Remove flag
|
||||
mode.CreateUndo("Remove Repeat Midtexture flag");
|
||||
mode.SetActionResult("Removed Repeat Midtexture flag.");
|
||||
mode.ApplyLinedefFlag(General.Map.Config.RepeatMidtextureFlag, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add flag
|
||||
mode.CreateUndo("Set Repeat Midtexture flag");
|
||||
mode.SetActionResult("Set Repeat Midtexture flag.");
|
||||
mode.ApplyLinedefFlag(General.Map.Config.RepeatMidtextureFlag, true);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ApplyLinedefFlag(string flag, bool set)
|
||||
{
|
||||
if(!set)
|
||||
{
|
||||
// Remove flag
|
||||
mode.CreateUndo("Remove upper-unpegged setting");
|
||||
mode.SetActionResult("Removed upper-unpegged setting.");
|
||||
this.Sidedef.Line.SetFlag(General.Map.Config.UpperUnpeggedFlag, false);
|
||||
this.Sidedef.Line.SetFlag(flag, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add flag
|
||||
mode.CreateUndo("Set upper-unpegged setting");
|
||||
mode.SetActionResult("Set upper-unpegged setting.");
|
||||
this.Sidedef.Line.SetFlag(General.Map.Config.UpperUnpeggedFlag, true);
|
||||
}
|
||||
|
||||
// Update sidedef geometry
|
||||
VisualSidedefParts parts = Sector.GetSidedefParts(Sidedef);
|
||||
parts.SetupAllParts();
|
||||
|
||||
// Update other sidedef geometry
|
||||
if(Sidedef.Other != null)
|
||||
{
|
||||
BaseVisualSector othersector = (BaseVisualSector)mode.GetVisualSector(Sidedef.Other.Sector);
|
||||
parts = othersector.GetSidedefParts(Sidedef.Other);
|
||||
parts.SetupAllParts();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This sets the Lower Unpegged flag
|
||||
public virtual void ApplyLowerUnpegged(bool set)
|
||||
{
|
||||
if(!set)
|
||||
{
|
||||
// Remove flag
|
||||
mode.CreateUndo("Remove lower-unpegged setting");
|
||||
mode.SetActionResult("Removed lower-unpegged setting.");
|
||||
this.Sidedef.Line.SetFlag(General.Map.Config.LowerUnpeggedFlag, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add flag
|
||||
mode.CreateUndo("Set lower-unpegged setting");
|
||||
mode.SetActionResult("Set lower-unpegged setting.");
|
||||
this.Sidedef.Line.SetFlag(General.Map.Config.LowerUnpeggedFlag, true);
|
||||
this.Sidedef.Line.SetFlag(flag, true);
|
||||
}
|
||||
|
||||
// Update sidedef geometry
|
||||
|
@ -972,7 +978,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
parts.SetupAllParts();
|
||||
|
||||
// Update other sidedef geometry
|
||||
if(Sidedef.Other != null)
|
||||
if (Sidedef.Other != null)
|
||||
{
|
||||
BaseVisualSector othersector = (BaseVisualSector)mode.GetVisualSector(Sidedef.Other.Sector);
|
||||
parts = othersector.GetSidedefParts(Sidedef.Other);
|
||||
|
|
|
@ -1741,23 +1741,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
}
|
||||
|
||||
// Apply upper unpegged flag
|
||||
public void ApplyUpperUnpegged(bool set)
|
||||
// Apply linedef flag
|
||||
public void ApplyLinedefFlag(string flag, bool set)
|
||||
{
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(false, true, false, false);
|
||||
foreach(IVisualEventReceiver i in objs)
|
||||
foreach (IVisualEventReceiver i in objs)
|
||||
{
|
||||
i.ApplyUpperUnpegged(set);
|
||||
}
|
||||
}
|
||||
|
||||
// Apply lower unpegged flag
|
||||
public void ApplyLowerUnpegged(bool set)
|
||||
{
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(false, true, false, false);
|
||||
foreach(IVisualEventReceiver i in objs)
|
||||
{
|
||||
i.ApplyLowerUnpegged(set);
|
||||
i.ApplyLinedefFlag(flag, set);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2175,6 +2165,24 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
PostAction();
|
||||
}
|
||||
|
||||
[BeginAction("raisesectorgridsize")]
|
||||
public void RaiseSectorGridSize()
|
||||
{
|
||||
PreAction(UndoGroup.SectorHeightChange);
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, true);
|
||||
foreach (IVisualEventReceiver i in objs) i.OnChangeTargetHeight(General.Map.Grid.GridSize);
|
||||
PostAction();
|
||||
}
|
||||
|
||||
[BeginAction("lowersectorgridsize")]
|
||||
public void LowerSectorGridSize()
|
||||
{
|
||||
PreAction(UndoGroup.SectorHeightChange);
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, true);
|
||||
foreach (IVisualEventReceiver i in objs) i.OnChangeTargetHeight(-General.Map.Grid.GridSize);
|
||||
PostAction();
|
||||
}
|
||||
|
||||
//mxd
|
||||
[BeginAction("raisesectortonearest")]
|
||||
public void RaiseSectorToNearest()
|
||||
|
@ -3086,6 +3094,22 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
PostAction();
|
||||
}
|
||||
|
||||
[BeginAction("togglepegmidtexture")]
|
||||
public void TogglePegMidtexture()
|
||||
{
|
||||
PreAction(UndoGroup.None);
|
||||
GetTargetEventReceiver(false).OnTogglePegMidtexture();
|
||||
PostAction();
|
||||
}
|
||||
|
||||
[BeginAction("togglerepeatmidtexture")]
|
||||
public void ToggleRepeatMidtexture()
|
||||
{
|
||||
PreAction(UndoGroup.None);
|
||||
GetTargetEventReceiver(false).OnToggleRepeatMidtexture();
|
||||
PostAction();
|
||||
}
|
||||
|
||||
[BeginAction("togglegravity")]
|
||||
public void ToggleGravity()
|
||||
{
|
||||
|
|
|
@ -669,13 +669,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public void OnTextureAlign(bool alignx, bool aligny) { }
|
||||
public void OnToggleUpperUnpegged() { }
|
||||
public void OnToggleLowerUnpegged() { }
|
||||
public void OnTogglePegMidtexture() { }
|
||||
public void OnToggleRepeatMidtexture() { }
|
||||
public void OnProcess(float deltatime) { }
|
||||
public void OnTextureFloodfill() { }
|
||||
public void OnInsert() { }
|
||||
public void OnTextureFit(FitTextureOptions options) { } //mxd
|
||||
public void ApplyTexture(string texture) { }
|
||||
public void ApplyUpperUnpegged(bool set) { }
|
||||
public void ApplyLowerUnpegged(bool set) { }
|
||||
public void ApplyLinedefFlag(string flag, bool set) { }
|
||||
public void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight) { } //mxd
|
||||
|
||||
// Return texture name
|
||||
|
|
|
@ -252,14 +252,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public void OnTextureFit(FitTextureOptions options) { } //mxd
|
||||
public void OnToggleUpperUnpegged() { }
|
||||
public void OnToggleLowerUnpegged() { }
|
||||
public void OnTogglePegMidtexture() { }
|
||||
public void OnToggleRepeatMidtexture() { }
|
||||
public void OnResetTextureOffset() { }
|
||||
public void OnResetLocalTextureOffset() { } //mxd
|
||||
public void OnProcess(float deltatime) { }
|
||||
public void OnTextureFloodfill() { }
|
||||
public void OnInsert() { }
|
||||
public void ApplyTexture(string texture) { }
|
||||
public void ApplyUpperUnpegged(bool set) { }
|
||||
public void ApplyLowerUnpegged(bool set) { }
|
||||
public void ApplyLinedefFlag(string flag, bool set) { }
|
||||
public string GetTextureName() { return ""; }
|
||||
public void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight) { } //mxd
|
||||
|
||||
|
|
|
@ -48,15 +48,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
void OnTextureFloodfill();
|
||||
void OnToggleUpperUnpegged();
|
||||
void OnToggleLowerUnpegged();
|
||||
void OnTogglePegMidtexture();
|
||||
void OnToggleRepeatMidtexture();
|
||||
void OnProcess(float deltatime);
|
||||
void OnInsert();
|
||||
void OnDelete();
|
||||
|
||||
// Assist functions
|
||||
void ApplyTexture(string texture);
|
||||
void ApplyUpperUnpegged(bool set);
|
||||
void ApplyLowerUnpegged(bool set);
|
||||
|
||||
void ApplyLinedefFlag(string flag, bool set);
|
||||
|
||||
// Other methods
|
||||
string GetTextureName();
|
||||
void SelectNeighbours(bool select, bool matchtexture, bool matchheight); //mxd
|
||||
|
|
|
@ -48,12 +48,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public void OnTextureFloodfill() { }
|
||||
public void OnToggleUpperUnpegged() { }
|
||||
public void OnToggleLowerUnpegged() { }
|
||||
public void OnTogglePegMidtexture() { }
|
||||
public void OnToggleRepeatMidtexture() { }
|
||||
public void OnProcess(float deltatime) { }
|
||||
public void OnInsert() { }
|
||||
public void OnDelete() { }
|
||||
public void ApplyTexture(string texture) { }
|
||||
public void ApplyUpperUnpegged(bool set) { }
|
||||
public void ApplyLowerUnpegged(bool set) { }
|
||||
public void ApplyLinedefFlag(string flag, bool set) { }
|
||||
public string GetTextureName() { return ""; }
|
||||
public void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight) { } //mxd
|
||||
public bool IsSelected() { return false; } //mxd
|
||||
|
|
Loading…
Reference in a new issue