From 3c176d2178dcd426e8e0a74cf6383c76d6258323 Mon Sep 17 00:00:00 2001 From: spherallic Date: Wed, 17 Jul 2024 11:14:41 +0200 Subject: [PATCH] Make flat alignment modes support Edit Selection mode actions --- .../ClassicModes/FlatAlignMode.cs | 76 +++++++++++++++++++ .../BuilderModes/Resources/Actions.cfg | 16 ++-- 2 files changed, 84 insertions(+), 8 deletions(-) diff --git a/Source/Plugins/BuilderModes/ClassicModes/FlatAlignMode.cs b/Source/Plugins/BuilderModes/ClassicModes/FlatAlignMode.cs index 00a445d3..81f0c024 100755 --- a/Source/Plugins/BuilderModes/ClassicModes/FlatAlignMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/FlatAlignMode.cs @@ -937,6 +937,82 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Interface.RedrawDisplay(); } + // Flip vertically + [BeginAction("flipselectionv")] + public void FlipVertically() + { + scale.y = -scale.y; + //offset.y -= texture.Height * scale.y; // This doesn't account for rotated textures yet + + UpdateSectors(); + General.Interface.RedrawDisplay(); + } + + // Flip horizontally + [BeginAction("flipselectionh")] + public void FlipHorizontally() + { + scale.x = -scale.x; + //offset.x += texture.Width * scale.x; // This doesn't account for rotated textures yet + + UpdateSectors(); + General.Interface.RedrawDisplay(); + } + + [BeginAction("moveselectionup")] + public void MoveSelectionUp() + { + offset.y -= General.Map.Grid.GridSize; + + UpdateSectors(); + General.Interface.RedrawDisplay(); + } + + [BeginAction("moveselectiondown")] + public void MoveSelectionDown() + { + offset.y += General.Map.Grid.GridSize; + + UpdateSectors(); + General.Interface.RedrawDisplay(); + } + + [BeginAction("moveselectionleft")] + public void MoveSelectionLeft() + { + offset.x += General.Map.Grid.GridSize; + + UpdateSectors(); + General.Interface.RedrawDisplay(); + } + + [BeginAction("moveselectionright")] + public void MoveSelectionRight() + { + offset.x -= General.Map.Grid.GridSize; + + UpdateSectors(); + General.Interface.RedrawDisplay(); + } + + [BeginAction("rotateclockwise")] + public void RotateCW() + { + rotation += Angle2D.DegToRad(5); + + UpdateSectors(); + General.Interface.RedrawDisplay(); + } + + [BeginAction("rotatecounterclockwise")] + public void RotateCCW() + { + rotation -= Angle2D.DegToRad(5); + + UpdateSectors(); + General.Interface.RedrawDisplay(); + } + #endregion } } diff --git a/Source/Plugins/BuilderModes/Resources/Actions.cfg b/Source/Plugins/BuilderModes/Resources/Actions.cfg index 1b423594..706f87b3 100755 --- a/Source/Plugins/BuilderModes/Resources/Actions.cfg +++ b/Source/Plugins/BuilderModes/Resources/Actions.cfg @@ -1323,7 +1323,7 @@ flipselectionv { title = "Flip Selection Vertically"; category = "edit"; - description = "Flips the selection in Edit Selection mode vertically."; + description = "Flips the selection in Edit Selection mode vertically. Also works in Floor/Ceiling Align Mode."; allowkeys = true; allowmouse = true; allowscroll = true; @@ -1333,7 +1333,7 @@ flipselectionh { title = "Flip Selection Horizontally"; category = "edit"; - description = "Flips the selection in Edit Selection mode horizontally."; + description = "Flips the selection in Edit Selection mode horizontally. Also works in Floor/Ceiling Align Mode."; allowkeys = true; allowmouse = true; allowscroll = true; @@ -1343,7 +1343,7 @@ moveselectionup { title = "Move Selection Up by Grid Size"; category = "edit"; - description = "Moves the selection in Edit Selection mode up by the current grid size."; + description = "Moves the selection in Edit Selection mode up by the current grid size. Also works in Floor/Ceiling Align Mode."; allowkeys = true; allowmouse = true; allowscroll = true; @@ -1354,7 +1354,7 @@ moveselectiondown { title = "Move Selection Down by Grid Size"; category = "edit"; - description = "Moves the selection in Edit Selection mode down by the current grid size."; + description = "Moves the selection in Edit Selection mode down by the current grid size. Also works in Floor/Ceiling Align Mode."; allowkeys = true; allowmouse = true; allowscroll = true; @@ -1365,7 +1365,7 @@ moveselectionleft { title = "Move Selection Left by Grid Size"; category = "edit"; - description = "Moves the selection in Edit Selection mode left by the current grid size."; + description = "Moves the selection in Edit Selection mode left by the current grid size. Also works in Floor/Ceiling Align Mode."; allowkeys = true; allowmouse = true; allowscroll = true; @@ -1376,7 +1376,7 @@ moveselectionright { title = "Move Selection Right by Grid Size"; category = "edit"; - description = "Moves the selection in Edit Selection mode right by the current grid size."; + description = "Moves the selection in Edit Selection mode right by the current grid size. Also works in Floor/Ceiling Align Mode."; allowkeys = true; allowmouse = true; allowscroll = true; @@ -1388,7 +1388,7 @@ rotateclockwise { title = "Rotate Clockwise"; category = "edit"; - description = "Rotates selected or highlighted things clockwise. Also rotates floor/ceiling textures in UDMF map format, and rotates the selection in Edit Selection mode."; + description = "Rotates selected or highlighted things clockwise. Also rotates floor/ceiling textures in UDMF map format and Floor/Ceiling Align Mode, and rotates the selection in Edit Selection mode."; allowkeys = true; allowmouse = false; allowscroll = true; @@ -1401,7 +1401,7 @@ rotatecounterclockwise { title = "Rotate Counterclockwise"; category = "edit"; - description = "Rotates selected or highlighted things counterclockwise. Also rotates floor/ceiling textures in UDMF map format, and rotates the selection in Edit Selection mode."; + description = "Rotates selected or highlighted things counterclockwise. Also rotates floor/ceiling textures in UDMF map format and Floor/Ceiling Align Mode, and rotates the selection in Edit Selection mode."; allowkeys = true; allowmouse = false; allowscroll = true;