Visual Mode: added actions to lower and raise map elements by the current grid size (no defaults bound). Resolves #699

This commit is contained in:
biwa 2022-02-05 18:40:08 +01:00
parent 6259b6d99f
commit c425b2bdc9
2 changed files with 47 additions and 2 deletions

View file

@ -654,6 +654,27 @@ raisesector128
repeat = true;
}
lowermapelementbygridsize
{
title = "Lower Floor/Ceiling/Thing by grid size";
category = "visual";
description = "Lowers the targeted or selected floors/ceilings by the current grid size. This also lowers selected or targeted things.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
repeat = true;
}
raisemapelementbygridsize
{
title = "Raise Floor/Ceiling/Thing by grid size";
category = "visual";
description = "Raises the targeted or selected floors/ceilings by the current grid size. This also raises selected or targeted things.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
repeat = true;
}
//mxd
lowersectortonearest

View file

@ -2720,9 +2720,33 @@ namespace CodeImp.DoomBuilder.BuilderModes
PostAction();
}
[BeginAction("raisemapelementbygridsize")]
public void RaiseMapElementByGridSize()
{
PreAction(UndoGroup.SectorHeightChange);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, true, true);
bool hasvisualslopehandles = objs.Any(o => o is VisualSlope);
foreach (IVisualEventReceiver i in objs) // If slope handles are selected only apply the action to them
if (!hasvisualslopehandles || (hasvisualslopehandles && i is VisualSlope))
i.OnChangeTargetHeight(General.Map.Grid.GridSize);
PostAction();
}
//mxd
[BeginAction("raisesectortonearest")]
[BeginAction("lowermapelementbygridsize")]
public void LowerMapElementByGridSize()
{
PreAction(UndoGroup.SectorHeightChange);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, true, true);
bool hasvisualslopehandles = objs.Any(o => o is VisualSlope);
foreach (IVisualEventReceiver i in objs) // If slope handles are selected only apply the action to them
if (!hasvisualslopehandles || (hasvisualslopehandles && i is VisualSlope))
i.OnChangeTargetHeight(-General.Map.Grid.GridSize);
PostAction();
}
//mxd
[BeginAction("raisesectortonearest")]
public void RaiseSectorToNearest()
{
List<VisualSidedefSlope> selectedhandles = GetSelectedSlopeHandles();