Several Visual Mode enhancements and fixes:

- Support copy flag for line slopes
- Allow resetting actions/tags
- Properly check for existing slopes when toggling backside slopes
- Properly remove specific elements from selection
This commit is contained in:
sphere 2021-08-26 15:16:51 +02:00
parent 4833ba765e
commit ae9ac0b08f

View file

@ -917,22 +917,36 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Find interesting linedefs (such as line slopes)
foreach (Linedef l in General.Map.Map.Linedefs)
{
// MascaraSnake: Slope handling
// ========== Plane Align (see http://zdoom.org/wiki/Plane_Align) ==========
if (l.IsRegularSlope)
{
if (!General.Map.FormatInterface.HasLinedefParameters) l.SetSlopeArgs();
if (((l.Args[0] == 1) || (l.Args[1] == 1)) && (l.Front != null))
{
SectorData sd = GetSectorData(l.Front.Sector);
sd.AddEffectLineSlope(l);
}
if (((l.Args[0] == 2) || (l.Args[1] == 2)) && (l.Back != null))
{
SectorData sd = GetSectorData(l.Back.Sector);
sd.AddEffectLineSlope(l);
}
}
// MascaraSnake: Slope handling
// ========== Plane Align (see http://zdoom.org/wiki/Plane_Align) ==========
if (l.IsRegularSlope)
{
if (!General.Map.FormatInterface.HasLinedefParameters) l.SetSlopeArgs();
if (((l.Args[0] == 1) || (l.Args[1] == 1)) && (l.Front != null))
{
SectorData sd = GetSectorData(l.Front.Sector);
sd.AddEffectLineSlope(l);
if (l.IsFlagSet("32768") && General.Map.SRB2)
{
l.SetSlopeCopyArgs();
sd = GetSectorData(l.Back.Sector);
sd.AddEffectPlaneClopySlope(l, false);
l.SetSlopeArgs();
}
}
if (((l.Args[0] == 2) || (l.Args[1] == 2)) && (l.Back != null))
{
SectorData sd = GetSectorData(l.Back.Sector);
sd.AddEffectLineSlope(l);
if (l.IsFlagSet("32768") && General.Map.SRB2)
{
l.SetSlopeCopyArgs();
sd = GetSectorData(l.Front.Sector);
sd.AddEffectPlaneClopySlope(l, true);
l.SetSlopeArgs();
}
}
}
// MascaraSnake: Slope handling
// ========== Plane Copy (mxd) (see http://zdoom.org/wiki/Plane_Copy) ==========
@ -1031,8 +1045,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
// MascaraSnake: Vertex slopes, SRB2-style
if (l.IsVertexSlope)
// MascaraSnake: Vertex slopes, SRB2-style
if (l.IsVertexSlope)
{
l.SetVertexSlopeArgs();
if (l.Args[0] >= 0 && l.Args[0] <= 3)
@ -3780,6 +3794,41 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
//sphere
[BeginAction("resetactionsandtags")]
public void ResetActionsAndTags()
{
List<VisualGeometry> selection = GetSelectedSurfaces();
if (selection.Count == 0)
{
General.Interface.DisplayStatus(StatusType.Warning, "Reset actions and tags action requires selected surfaces!");
return;
}
General.Map.UndoRedo.CreateUndo("Reset actions and tags");
//check selection
foreach (VisualGeometry vg in selection)
{
if (vg.GeometryType == VisualGeometryType.WALL_LOWER ||
vg.GeometryType == VisualGeometryType.WALL_MIDDLE ||
vg.GeometryType == VisualGeometryType.WALL_UPPER)
vg.Sidedef.Line.Action = vg.Sidedef.Line.Tag = 0;
if (vg.GeometryType == VisualGeometryType.FLOOR ||
vg.GeometryType == VisualGeometryType.CEILING)
vg.Sector.Sector.Effect = vg.Sector.Sector.Tag = 0;
vg.Sector.UpdateSectorGeometry(true);
}
//update changed geometry
RebuildElementData();
UpdateChangedObjects();
General.Interface.DisplayStatus(StatusType.Action, "Reset actions and tags for " + selection.Count + (selection.Count == 1 ? " surface." : " surfaces."));
ClearSelection();
ShowTargetInfo();
}
//mxd
[BeginAction("toggleslope")]
public void ToggleSlope()
@ -3880,7 +3929,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
side.Line.Args[1] = 0;
side.Line.SetSlopeTypeFromArgs(); //MascaraSnake: Arguments changed, so update slope type
}
update = true;
}
}
@ -3959,7 +4007,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
if (side == vg.Sidedef || !side.Line.IsRegularSlope) continue;
int arg = (side == side.Line.Front ? 2 : 1);
int arg = (side == side.Line.Front ? 1 : 2);
if (side.Line.Args[0] == arg)
{
@ -3990,7 +4038,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
if (side == vg.Sidedef || !side.Line.IsRegularSlope) continue;
int arg = (side == side.Line.Front ? 2 : 1);
int arg = (side == side.Line.Front ? 1 : 2);
if (side.Line.Args[1] == arg)
{
@ -4103,12 +4151,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void SelectSingleSided()
{
int counter = 0;
List<VisualGeometry> selected = GetSelectedSurfaces();
foreach (VisualGeometry vg in selected)
if (vg is BaseVisualGeometrySidedef && vg.Sidedef.Other == null)
counter++;
else
vg.Selected = false;
List<IVisualEventReceiver> selected = GetSelectedObjects(true, true, true, true);
foreach (IVisualEventReceiver i in selected)
if (i is BaseVisualGeometrySidedef)
{
if ((i as BaseVisualGeometrySidedef).Sidedef.Other == null)
counter++;
else
{
RemoveSelectedObject(i);
(i as VisualGeometry).Selected = false;
}
}
General.Interface.DisplayStatus(StatusType.Action, "Selected only single-sided linedefs (" + counter + ")");
General.Interface.RedrawDisplay();
@ -4121,12 +4175,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void SelectDoubleSided()
{
int counter = 0;
List<VisualGeometry> selected = GetSelectedSurfaces();
foreach (VisualGeometry vg in selected)
if (vg is BaseVisualGeometrySidedef && vg.Sidedef.Other != null)
counter++;
else
vg.Selected = false;
List<IVisualEventReceiver> selected = GetSelectedObjects(true, true, true, true);
foreach (IVisualEventReceiver i in selected)
if (i is BaseVisualGeometrySidedef)
{
if ((i as BaseVisualGeometrySidedef).Sidedef.Other != null)
counter++;
else
{
RemoveSelectedObject(i);
(i as VisualGeometry).Selected = false;
}
}
General.Interface.DisplayStatus(StatusType.Action, "Selected only double-sided linedefs (" + counter + ")");
General.Interface.RedrawDisplay();
@ -4138,12 +4198,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void SelectFloors()
{
int counter = 0;
List<VisualGeometry> selected = GetSelectedSurfaces();
foreach (VisualGeometry vg in selected)
if (vg is VisualFloor)
List<IVisualEventReceiver> selected = GetSelectedObjects(true, true, true, true);
foreach (IVisualEventReceiver i in selected)
if (i is VisualFloor)
counter++;
else
vg.Selected = false;
{
RemoveSelectedObject(i);
(i as VisualGeometry).Selected = false;
}
General.Interface.DisplayStatus(StatusType.Action, "Selected only floors (" + counter + ")");
General.Interface.RedrawDisplay();
@ -4155,12 +4218,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void SelectCeilings()
{
int counter = 0;
List<VisualGeometry> selected = GetSelectedSurfaces();
foreach (VisualGeometry vg in selected)
if (vg is VisualCeiling)
List<IVisualEventReceiver> selected = GetSelectedObjects(true, true, true, true);
foreach (IVisualEventReceiver i in selected)
if (i is VisualCeiling)
counter++;
else
vg.Selected = false;
{
RemoveSelectedObject(i);
(i as VisualGeometry).Selected = false;
}
General.Interface.DisplayStatus(StatusType.Action, "Selected only ceilings (" + counter + ")");
General.Interface.RedrawDisplay();