mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2025-02-07 16:31:24 +00:00
Duplicated the Toggle Slope option to also allow sloping the back sector.
This commit is contained in:
parent
1f3f0358c7
commit
0efc410d58
3 changed files with 168 additions and 4 deletions
|
@ -228,6 +228,7 @@ shortcuts
|
|||
buildermodes_flooralignmode = 0;
|
||||
buildermodes_scaledowny = 101;
|
||||
buildermodes_toggleslope = 262227;
|
||||
buildermodes_togglebackslope = 393299;
|
||||
buildermodes_resettextureudmf = 196690;
|
||||
buildermodes_rollcounterclockwise = 327675;
|
||||
buildermodes_visualfittextures = 393281;
|
||||
|
|
|
@ -1119,15 +1119,26 @@ pastepropertieswithoptions
|
|||
//mxd
|
||||
toggleslope
|
||||
{
|
||||
title = "Toggle Slope";
|
||||
title = "Toggle Slope (Front)";
|
||||
category = "visual";
|
||||
description = "Toggles Slope for selected surfaces. Select or highlight upper/lower walls to add a slope. Select or highlight floors or ceilings to remove slope.";
|
||||
description = "Toggles Slope for selected surfaces. Select or highlight upper/lower walls to add a slope to the front sector. Select or highlight floors or ceilings to remove slope.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
default = 262227; //Alt-S
|
||||
}
|
||||
|
||||
togglebackslope
|
||||
{
|
||||
title = "Toggle Slope (Back)";
|
||||
category = "visual";
|
||||
description = "Toggles Slope for selected surfaces. Select or highlight upper/lower walls to add a slope to the back sector. Select or highlight floors or ceilings to remove slope.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
default = 393299; //Ctrl-Alt-S
|
||||
}
|
||||
|
||||
placevisualstart
|
||||
{
|
||||
title = "Place Visual Mode Camera";
|
||||
|
|
|
@ -3746,7 +3746,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
List<BaseVisualSector> toUpdate = new List<BaseVisualSector>();
|
||||
General.Map.UndoRedo.CreateUndo("Toggle Slope");
|
||||
General.Map.UndoRedo.CreateUndo("Toggle Slope (Front)");
|
||||
|
||||
//check selection
|
||||
foreach(VisualGeometry vg in selection)
|
||||
|
@ -3882,6 +3882,158 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
General.Interface.DisplayStatus(StatusType.Action, "Toggled Slope for " + toUpdate.Count + (toUpdate.Count == 1 ? " surface." : " surfaces."));
|
||||
}
|
||||
|
||||
[BeginAction("togglebackslope")]
|
||||
public void ToggleBackSlope()
|
||||
{
|
||||
List<VisualGeometry> selection = GetSelectedSurfaces();
|
||||
|
||||
if (selection.Count == 0)
|
||||
{
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Toggle Slope action requires selected surfaces!");
|
||||
return;
|
||||
}
|
||||
|
||||
List<BaseVisualSector> toUpdate = new List<BaseVisualSector>();
|
||||
General.Map.UndoRedo.CreateUndo("Toggle Slope (Back)");
|
||||
|
||||
//check selection
|
||||
foreach (VisualGeometry vg in selection)
|
||||
{
|
||||
bool update = false;
|
||||
|
||||
//assign/remove action
|
||||
if (vg.GeometryType == VisualGeometryType.WALL_LOWER)
|
||||
{
|
||||
// MascaraSnake: Slope handling
|
||||
if (vg.Sidedef.Line.Action == 0 || (vg.Sidedef.Line.IsRegularSlope && vg.Sidedef.Line.Args[0] == 0))
|
||||
{
|
||||
//check if the sector already has floor slopes
|
||||
foreach (Sidedef side in vg.Sidedef.Other.Sector.Sidedefs)
|
||||
{
|
||||
if (side == vg.Sidedef || !side.Line.IsRegularSlope) continue;
|
||||
|
||||
int arg = (side == side.Line.Front ? 2 : 1);
|
||||
|
||||
if (side.Line.Args[0] == arg)
|
||||
{
|
||||
//if only floor is affected, remove action
|
||||
if (side.Line.Args[1] == 0)
|
||||
side.Line.Action = 0;
|
||||
else
|
||||
{ //clear floor alignment
|
||||
side.Line.Args[0] = 0;
|
||||
side.Line.SetSlopeTypeFromArgs(); //MascaraSnake: Arguments changed, so update slope type
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//set action
|
||||
vg.Sidedef.Line.Args[0] = (vg.Sidedef == vg.Sidedef.Line.Front ? 2 : 1);
|
||||
vg.Sidedef.Line.SetSlopeTypeFromArgs(); //MascaraSnake: Set slope type
|
||||
update = true;
|
||||
}
|
||||
}
|
||||
else if (vg.GeometryType == VisualGeometryType.WALL_UPPER)
|
||||
{
|
||||
// MascaraSnake: Slope handling
|
||||
if (vg.Sidedef.Line.Action == 0 || (vg.Sidedef.Line.IsRegularSlope && vg.Sidedef.Line.Args[1] == 0))
|
||||
{
|
||||
//check if the sector already has ceiling slopes
|
||||
foreach (Sidedef side in vg.Sidedef.Other.Sector.Sidedefs)
|
||||
{
|
||||
if (side == vg.Sidedef || !side.Line.IsRegularSlope) continue;
|
||||
|
||||
int arg = (side == side.Line.Front ? 2 : 1);
|
||||
|
||||
if (side.Line.Args[1] == arg)
|
||||
{
|
||||
//if only ceiling is affected, remove action
|
||||
if (side.Line.Args[0] == 0)
|
||||
side.Line.Action = 0;
|
||||
else
|
||||
{ //clear ceiling alignment
|
||||
side.Line.Args[1] = 0;
|
||||
side.Line.SetSlopeTypeFromArgs(); //MascaraSnake: Arguments changed, so update slope type
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//set action
|
||||
vg.Sidedef.Line.Args[1] = (vg.Sidedef == vg.Sidedef.Line.Front ? 2 : 1);
|
||||
vg.Sidedef.Line.SetSlopeTypeFromArgs(); //MascaraSnake: Set slope type
|
||||
update = true;
|
||||
}
|
||||
}
|
||||
else if (vg.GeometryType == VisualGeometryType.CEILING)
|
||||
{
|
||||
//check if the sector has ceiling slopes
|
||||
foreach (Sidedef side in vg.Sector.Sector.Sidedefs)
|
||||
{
|
||||
// MascaraSnake: Slope handling
|
||||
if (!side.Line.IsRegularSlope) continue;
|
||||
|
||||
int arg = (side == side.Line.Front ? 1 : 2);
|
||||
|
||||
if (side.Line.Args[1] == arg)
|
||||
{
|
||||
//if only ceiling is affected, remove action
|
||||
if (side.Line.Args[0] == 0)
|
||||
side.Line.Action = 0;
|
||||
else
|
||||
{ //clear ceiling alignment
|
||||
side.Line.Args[1] = 0;
|
||||
side.Line.SetSlopeTypeFromArgs(); //MascaraSnake: Arguments changed, so update slope type
|
||||
}
|
||||
|
||||
update = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (vg.GeometryType == VisualGeometryType.FLOOR)
|
||||
{
|
||||
//check if the sector has floor slopes
|
||||
foreach (Sidedef side in vg.Sector.Sector.Sidedefs)
|
||||
{
|
||||
// MascaraSnake: Slope handling
|
||||
if (!side.Line.IsRegularSlope) continue;
|
||||
|
||||
int arg = (side == side.Line.Front ? 1 : 2);
|
||||
|
||||
if (side.Line.Args[0] == arg)
|
||||
{
|
||||
//if only floor is affected, remove action
|
||||
if (side.Line.Args[1] == 0)
|
||||
side.Line.Action = 0;
|
||||
else
|
||||
{ //clear floor alignment
|
||||
side.Line.Args[0] = 0;
|
||||
side.Line.SetSlopeTypeFromArgs(); //MascaraSnake: Arguments changed, so update slope type
|
||||
}
|
||||
update = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//add to update list
|
||||
if (update) toUpdate.Add(vg.Sector as BaseVisualSector);
|
||||
}
|
||||
|
||||
//update changed geometry
|
||||
if (toUpdate.Count > 0)
|
||||
{
|
||||
RebuildElementData();
|
||||
|
||||
foreach (BaseVisualSector vs in toUpdate)
|
||||
vs.UpdateSectorGeometry(true);
|
||||
|
||||
UpdateChangedObjects();
|
||||
ClearSelection();
|
||||
ShowTargetInfo();
|
||||
}
|
||||
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Toggled Slope for " + toUpdate.Count + (toUpdate.Count == 1 ? " surface." : " surfaces."));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Texture Alignment
|
||||
|
|
Loading…
Reference in a new issue