diff --git a/megamek/src/megamek/client/ui/swing/FiringDisplay.java b/megamek/src/megamek/client/ui/swing/FiringDisplay.java index b7df280a9f5..220de4f7b0d 100644 --- a/megamek/src/megamek/client/ui/swing/FiringDisplay.java +++ b/megamek/src/megamek/client/ui/swing/FiringDisplay.java @@ -125,8 +125,6 @@ public String toString() { // is the shift key held? protected boolean shiftheld; - protected boolean twisting; - protected Entity[] visibleTargets = null; protected int lastTargetID = -1; @@ -2047,17 +2045,9 @@ public void hexMoused(BoardViewEvent b) { shiftheld = (b.getModifiers() & InputEvent.SHIFT_DOWN_MASK) != 0; } - if (b.getType() == BoardViewEvent.BOARD_HEX_DRAGGED) { - if (shiftheld || twisting) { - updateFlipArms(false); - torsoTwist(b.getCoords()); - } - clientgui.getBoardView().cursor(b.getCoords()); - } else if (b.getType() == BoardViewEvent.BOARD_HEX_CLICKED) { - twisting = false; - if (!shiftheld) { - clientgui.getBoardView().select(b.getCoords()); - } + if ((b.getType() == BoardViewEvent.BOARD_HEX_CLICKED) || + (b.getType() == BoardViewEvent.BOARD_HEX_DRAGGED)) { + clientgui.getBoardView().select(b.getCoords()); } } @@ -2202,8 +2192,6 @@ public void actionPerformed(ActionEvent ev) { fire(); } else if (ev.getActionCommand().equals(FiringCommand.FIRE_SKIP.getCmd())) { nextWeapon(); - } else if (ev.getActionCommand().equals(FiringCommand.FIRE_TWIST.getCmd())) { - twisting = true; } else if (ev.getActionCommand().equals(FiringCommand.FIRE_NEXT.getCmd())) { selectEntity(clientgui.getClient().getNextEntityNum(cen)); } else if (ev.getActionCommand().equals(FiringCommand.FIRE_MORE.getCmd())) { @@ -2252,11 +2240,13 @@ void updateFlipArms(boolean armsFlipped) { return; } - twisting = false; - - torsoTwist(null); - + // clear attacks clears all non-firing actions, e.g. torso twists and arm flips as well, + // so we have to push/pop facing + int secondaryFacing = ce().getSecondaryFacing(); + clearAttacks(); + + ce().setSecondaryFacing(secondaryFacing); ce().setArmsFlipped(armsFlipped); attacks.addElement(new FlipArmsAction(cen, armsFlipped)); updateTarget(); diff --git a/megamek/src/megamek/client/ui/swing/PhysicalDisplay.java b/megamek/src/megamek/client/ui/swing/PhysicalDisplay.java index 4886445b289..eb4e839007d 100644 --- a/megamek/src/megamek/client/ui/swing/PhysicalDisplay.java +++ b/megamek/src/megamek/client/ui/swing/PhysicalDisplay.java @@ -1473,20 +1473,18 @@ public void hexMoused(BoardViewEvent b) { return; } + if (!clientgui.getClient().isMyTurn()) { + return; + } + // control pressed means a line of sight check. if ((b.getModifiers() & InputEvent.CTRL_DOWN_MASK) != 0) { return; } - if (clientgui.getClient().isMyTurn() - && ((b.getModifiers() & InputEvent.BUTTON1_DOWN_MASK) != 0)) { - if (b.getType() == BoardViewEvent.BOARD_HEX_DRAGGED) { - if (!b.getCoords().equals( - clientgui.getBoardView().getLastCursor())) { - clientgui.getBoardView().cursor(b.getCoords()); - } - } else if (b.getType() == BoardViewEvent.BOARD_HEX_CLICKED) { - clientgui.getBoardView().select(b.getCoords()); - } + + if ((b.getType() == BoardViewEvent.BOARD_HEX_CLICKED) || + (b.getType() == BoardViewEvent.BOARD_HEX_DRAGGED)) { + clientgui.getBoardView().select(b.getCoords()); } } diff --git a/megamek/src/megamek/client/ui/swing/PointblankShotDisplay.java b/megamek/src/megamek/client/ui/swing/PointblankShotDisplay.java index ca21fad07f7..772074059f5 100644 --- a/megamek/src/megamek/client/ui/swing/PointblankShotDisplay.java +++ b/megamek/src/megamek/client/ui/swing/PointblankShotDisplay.java @@ -935,17 +935,9 @@ public void hexMoused(BoardViewEvent b) { shiftheld = (b.getModifiers() & InputEvent.SHIFT_DOWN_MASK) != 0; } - if (b.getType() == BoardViewEvent.BOARD_HEX_DRAGGED) { - if (shiftheld || twisting) { - updateFlipArms(false); - torsoTwist(b.getCoords()); - } - clientgui.getBoardView().cursor(b.getCoords()); - } else if (b.getType() == BoardViewEvent.BOARD_HEX_CLICKED) { - twisting = false; - if (!shiftheld) { - clientgui.getBoardView().select(b.getCoords()); - } + if ((b.getType() == BoardViewEvent.BOARD_HEX_CLICKED) || + (b.getType() == BoardViewEvent.BOARD_HEX_DRAGGED)) { + clientgui.getBoardView().select(b.getCoords()); } } @@ -1001,8 +993,6 @@ public void actionPerformed(ActionEvent ev) { fire(); } else if (ev.getActionCommand().equals(FiringCommand.FIRE_SKIP.getCmd())) { nextWeapon(); - } else if (ev.getActionCommand().equals(FiringCommand.FIRE_TWIST.getCmd())) { - twisting = true; } else if (ev.getActionCommand().equals(FiringCommand.FIRE_MORE.getCmd())) { currentButtonGroup++; currentButtonGroup %= numButtonGroups; diff --git a/megamek/src/megamek/client/ui/swing/TargetingPhaseDisplay.java b/megamek/src/megamek/client/ui/swing/TargetingPhaseDisplay.java index db9b6f7ee42..8f57672a267 100644 --- a/megamek/src/megamek/client/ui/swing/TargetingPhaseDisplay.java +++ b/megamek/src/megamek/client/ui/swing/TargetingPhaseDisplay.java @@ -131,8 +131,6 @@ public String toString() { // is the shift key held? private boolean shiftheld; - private boolean twisting; - private final IGame.Phase phase; private Entity[] visibleTargets; @@ -1309,14 +1307,8 @@ public void hexMoused(BoardViewEvent b) { shiftheld = (b.getModifiers() & InputEvent.SHIFT_DOWN_MASK) != 0; } - if (b.getType() == BoardViewEvent.BOARD_HEX_DRAGGED) { - if (shiftheld || twisting) { - updateFlipArms(false); - torsoTwist(b.getCoords()); - } - clientgui.getBoardView().cursor(b.getCoords()); - } else if (b.getType() == BoardViewEvent.BOARD_HEX_CLICKED) { - twisting = false; + if ((b.getType() == BoardViewEvent.BOARD_HEX_CLICKED) || + (b.getType() == BoardViewEvent.BOARD_HEX_DRAGGED)) { clientgui.getBoardView().select(b.getCoords()); } } @@ -1500,8 +1492,6 @@ public void actionPerformed(ActionEvent ev) { fire(); } else if (ev.getActionCommand().equals(TargetingCommand.FIRE_SKIP.getCmd())) { nextWeapon(); - } else if (ev.getActionCommand().equals(TargetingCommand.FIRE_TWIST.getCmd())) { - twisting = true; } else if (ev.getActionCommand().equals(TargetingCommand.FIRE_NEXT.getCmd())) { selectEntity(clientgui.getClient().getNextEntityNum(cen)); } else if (ev.getActionCommand().equals(TargetingCommand.FIRE_NEXT_TARG.getCmd())) { @@ -1524,15 +1514,21 @@ public void actionPerformed(ActionEvent ev) { } private void updateFlipArms(boolean armsFlipped) { + if (ce() == null) { + return; + } + if (armsFlipped == ce().getArmsFlipped()) { return; } - twisting = false; - - torsoTwist(null); - + // clear attacks clears all non-firing actions, e.g. torso twists and arm flips as well, + // so we have to push/pop facing + int secondaryFacing = ce().getSecondaryFacing(); + clearAttacks(); + + ce().setSecondaryFacing(secondaryFacing); ce().setArmsFlipped(armsFlipped); attacks.addElement(new FlipArmsAction(cen, armsFlipped)); updateTarget();