diff --git a/Source/Plugins/BuilderModes/Resources/Actions.cfg b/Source/Plugins/BuilderModes/Resources/Actions.cfg index 07e8eab712670a22e8be5afddfff1e975b22e389..69996d067020365a19fdc0b7dfdcdc15d8e00e30 100755 --- a/Source/Plugins/BuilderModes/Resources/Actions.cfg +++ b/Source/Plugins/BuilderModes/Resources/Actions.cfg @@ -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 diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs index ff2fa8bb02fb6826d7f37592a2afbf0e1b70ddee..60e2c1528d1dd672c3941fa6717f402a2918e36a 100755 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs @@ -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();