From ccfb7ddfad607bd85c95d385ac519622ddbec647 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 18 Feb 2022 00:24:52 -0500 Subject: [PATCH] v1.2.0: reworked default keybinds again --- .../messages/windows/windows.properties | 2 +- .../shatteredpixeldungeon/SPDAction.java | 97 +++++++++---------- .../scenes/WelcomeScene.java | 21 ++-- .../shatteredpixeldungeon/ui/Toolbar.java | 4 +- .../shatteredpixeldungeon/ui/Window.java | 3 +- .../windows/WndHardNotification.java | 10 +- 6 files changed, 69 insertions(+), 68 deletions(-) diff --git a/core/src/main/assets/messages/windows/windows.properties b/core/src/main/assets/messages/windows/windows.properties index bfa21d212..a7bf656ae 100644 --- a/core/src/main/assets/messages/windows/windows.properties +++ b/core/src/main/assets/messages/windows/windows.properties @@ -100,7 +100,7 @@ windows.wndkeybindings.menu=Menu windows.wndkeybindings.hero_info=Hero Info windows.wndkeybindings.journal=Journal windows.wndkeybindings.wait=Wait -windows.wndkeybindings.search=Search +windows.wndkeybindings.examine=Examine windows.wndkeybindings.rest=Rest windows.wndkeybindings.inventory=Inventory windows.wndkeybindings.quickslot_1=Quickslot 1 diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDAction.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDAction.java index 03bfdb171..6f7b96e16 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDAction.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDAction.java @@ -41,44 +41,44 @@ public class SPDAction extends GameAction { public static final GameAction BACK = GameAction.BACK; //-- - public static final GameAction N = new SPDAction("n"); - public static final GameAction W = new SPDAction("w"); - public static final GameAction S = new SPDAction("s"); - public static final GameAction E = new SPDAction("e"); - public static final GameAction NW = new SPDAction("nw"); - public static final GameAction NE = new SPDAction("ne"); - public static final GameAction SW = new SPDAction("sw"); - public static final GameAction SE = new SPDAction("se"); - public static final GameAction WAIT = new SPDAction("wait"); + public static final GameAction N = new SPDAction("n"); + public static final GameAction W = new SPDAction("w"); + public static final GameAction S = new SPDAction("s"); + public static final GameAction E = new SPDAction("e"); + public static final GameAction NW = new SPDAction("nw"); + public static final GameAction NE = new SPDAction("ne"); + public static final GameAction SW = new SPDAction("sw"); + public static final GameAction SE = new SPDAction("se"); + public static final GameAction WAIT = new SPDAction("wait"); - public static final GameAction INVENTORY = new SPDAction("inventory"); - public static final GameAction QUICKSLOT_1 = new SPDAction("quickslot_1"); - public static final GameAction QUICKSLOT_2 = new SPDAction("quickslot_2"); - public static final GameAction QUICKSLOT_3 = new SPDAction("quickslot_3"); - public static final GameAction QUICKSLOT_4 = new SPDAction("quickslot_4"); - public static final GameAction QUICKSLOT_5 = new SPDAction("quickslot_5"); - public static final GameAction QUICKSLOT_6 = new SPDAction("quickslot_6"); + public static final GameAction INVENTORY = new SPDAction("inventory"); + public static final GameAction QUICKSLOT_1 = new SPDAction("quickslot_1"); + public static final GameAction QUICKSLOT_2 = new SPDAction("quickslot_2"); + public static final GameAction QUICKSLOT_3 = new SPDAction("quickslot_3"); + public static final GameAction QUICKSLOT_4 = new SPDAction("quickslot_4"); + public static final GameAction QUICKSLOT_5 = new SPDAction("quickslot_5"); + public static final GameAction QUICKSLOT_6 = new SPDAction("quickslot_6"); - public static final GameAction BAG_1 = new SPDAction("bag_1"); - public static final GameAction BAG_2 = new SPDAction("bag_2"); - public static final GameAction BAG_3 = new SPDAction("bag_3"); - public static final GameAction BAG_4 = new SPDAction("bag_4"); - public static final GameAction BAG_5 = new SPDAction("bag_5"); + public static final GameAction BAG_1 = new SPDAction("bag_1"); + public static final GameAction BAG_2 = new SPDAction("bag_2"); + public static final GameAction BAG_3 = new SPDAction("bag_3"); + public static final GameAction BAG_4 = new SPDAction("bag_4"); + public static final GameAction BAG_5 = new SPDAction("bag_5"); - public static final GameAction SEARCH = new SPDAction("search"); - public static final GameAction REST = new SPDAction("rest"); + public static final GameAction EXAMINE = new SPDAction("examine"); + public static final GameAction REST = new SPDAction("rest"); - public static final GameAction TAG_ATTACK = new SPDAction("tag_attack"); - public static final GameAction TAG_DANGER = new SPDAction("tag_danger"); - public static final GameAction TAG_ACTION = new SPDAction("tag_action"); - public static final GameAction TAG_LOOT = new SPDAction("tag_loot"); - public static final GameAction TAG_RESUME = new SPDAction("tag_resume"); + public static final GameAction TAG_ATTACK = new SPDAction("tag_attack"); + public static final GameAction TAG_DANGER = new SPDAction("tag_danger"); + public static final GameAction TAG_ACTION = new SPDAction("tag_action"); + public static final GameAction TAG_LOOT = new SPDAction("tag_loot"); + public static final GameAction TAG_RESUME = new SPDAction("tag_resume"); - public static final GameAction HERO_INFO = new SPDAction("hero_info"); - public static final GameAction JOURNAL = new SPDAction("journal"); + public static final GameAction HERO_INFO = new SPDAction("hero_info"); + public static final GameAction JOURNAL = new SPDAction("journal"); - public static final GameAction ZOOM_IN = new SPDAction("zoom_in"); - public static final GameAction ZOOM_OUT = new SPDAction("zoom_out"); + public static final GameAction ZOOM_IN = new SPDAction("zoom_in"); + public static final GameAction ZOOM_OUT = new SPDAction("zoom_out"); private static final LinkedHashMap defaultBindings = new LinkedHashMap<>(); static { @@ -87,13 +87,14 @@ public class SPDAction extends GameAction { defaultBindings.put( Input.Keys.W, SPDAction.N ); defaultBindings.put( Input.Keys.A, SPDAction.W ); - defaultBindings.put( Input.Keys.X, SPDAction.S ); + defaultBindings.put( Input.Keys.S, SPDAction.S ); defaultBindings.put( Input.Keys.D, SPDAction.E ); - defaultBindings.put( Input.Keys.Q, SPDAction.NW ); - defaultBindings.put( Input.Keys.E, SPDAction.NE ); - defaultBindings.put( Input.Keys.Z, SPDAction.SW ); - defaultBindings.put( Input.Keys.C, SPDAction.SE ); - defaultBindings.put( Input.Keys.S, SPDAction.WAIT ); + defaultBindings.put( Input.Keys.SPACE, SPDAction.WAIT ); + + defaultBindings.put( Input.Keys.UP, SPDAction.N ); + defaultBindings.put( Input.Keys.LEFT, SPDAction.W ); + defaultBindings.put( Input.Keys.DOWN, SPDAction.S ); + defaultBindings.put( Input.Keys.RIGHT, SPDAction.E ); defaultBindings.put( Input.Keys.NUMPAD_8, SPDAction.N ); defaultBindings.put( Input.Keys.NUMPAD_4, SPDAction.W ); @@ -105,12 +106,7 @@ public class SPDAction extends GameAction { defaultBindings.put( Input.Keys.NUMPAD_3, SPDAction.SE ); defaultBindings.put( Input.Keys.NUMPAD_5, SPDAction.WAIT ); - defaultBindings.put( Input.Keys.UP, SPDAction.N ); - defaultBindings.put( Input.Keys.LEFT, SPDAction.W ); - defaultBindings.put( Input.Keys.DOWN, SPDAction.S ); - defaultBindings.put( Input.Keys.RIGHT, SPDAction.E ); - - defaultBindings.put( Input.Keys.T, SPDAction.INVENTORY ); + defaultBindings.put( Input.Keys.F, SPDAction.INVENTORY ); defaultBindings.put( Input.Keys.I, SPDAction.INVENTORY ); defaultBindings.put( Input.Keys.NUM_1, SPDAction.QUICKSLOT_1 ); defaultBindings.put( Input.Keys.NUM_2, SPDAction.QUICKSLOT_2 ); @@ -125,16 +121,15 @@ public class SPDAction extends GameAction { defaultBindings.put( Input.Keys.F4, SPDAction.BAG_4 ); defaultBindings.put( Input.Keys.F5, SPDAction.BAG_5 ); - defaultBindings.put( Input.Keys.G, SPDAction.SEARCH ); - defaultBindings.put( Input.Keys.B, SPDAction.REST ); + defaultBindings.put( Input.Keys.E, SPDAction.EXAMINE ); + defaultBindings.put( Input.Keys.Z, SPDAction.REST ); - defaultBindings.put( Input.Keys.R, SPDAction.TAG_ATTACK ); - defaultBindings.put( Input.Keys.CONTROL_LEFT, SPDAction.TAG_ATTACK ); + defaultBindings.put( Input.Keys.Q, SPDAction.TAG_ATTACK ); defaultBindings.put( Input.Keys.TAB, SPDAction.TAG_DANGER ); - defaultBindings.put( Input.Keys.F, SPDAction.TAG_ACTION ); - defaultBindings.put( Input.Keys.V, SPDAction.TAG_LOOT ); + defaultBindings.put( Input.Keys.X, SPDAction.TAG_ACTION ); + defaultBindings.put( Input.Keys.C, SPDAction.TAG_LOOT ); defaultBindings.put( Input.Keys.ENTER, SPDAction.TAG_LOOT ); - defaultBindings.put( Input.Keys.SPACE, SPDAction.TAG_RESUME ); + defaultBindings.put( Input.Keys.R, SPDAction.TAG_RESUME ); defaultBindings.put( Input.Keys.H, SPDAction.HERO_INFO ); defaultBindings.put( Input.Keys.J, SPDAction.JOURNAL ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java index a035cc604..6198fec61 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java @@ -195,20 +195,21 @@ public class WelcomeScene extends PixelScene { text.setPos((w - text.width()) / 2f, (topRegion + 2) + (textSpace - text.height())/2); add(text); - if (previousVersion <= 593){ + if (previousVersion <= 594){ //TODO translate! add(new WndHardNotification(Icons.get(Icons.INFO), "Key Bindings", - "Shattered Pixel Dungeon's default keybindings have changed based on early demo feedback!\n\n" + - "Here's a quick summary of what's been adjusted:\n" + - "_-_ The WAXD and QEZC keys are now used for movement, S is used for waiting\n" + - "_-_ Quickslots now use the number keys\n" + - "_-_ Several game action bindings have been moved to the right of WASD\n" + - "_-_ Inventory bags can now be tabbed through with F1-F5\n" + - "_-_ Other bindings (including numpad and arrow keys to move) are unchanged.\n\n" + - "Please let me know if these new bindings work well for you, I am open to further adjustments. All keybinds can still be customized via the settings menu.", + "Once again, Shattered Pixel Dungeon's default keybindings have changed based on early demo feedback!\n\n" + + "Here's a quick summary of what's been adjusted:\n" + + "_-_ Two movement keys can be pressed at once to move diagonally\n" + + "_-_ The WASD keys are now used for movement\n" + + "_-_ Several game action bindings have been moved around WASD\n" + + "_-_ Quickslots now use the number keys\n" + + "_-_ Inventory bags can now be tabbed through with F1-F5\n" + + "_-_ Other bindings (including numpad and arrow keys to move) are unchanged.\n\n" + + "Thanks for your continued feedback, I think these bindings and the new diagonal movement functionality should work very well. All keybinds can still be customized via the settings menu.", Messages.get(this, "continue"), - 2){ + 4){ @Override public void hide() { super.hide(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java index 1f424e1b5..ad6fa9c51 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java @@ -144,12 +144,12 @@ public class Toolbar extends Component { @Override public GameAction keyAction() { - return SPDAction.SEARCH; + return SPDAction.EXAMINE; } @Override protected String hoverText() { - return Messages.titleCase(Messages.get(WndKeyBindings.class, "search")); + return Messages.titleCase(Messages.get(WndKeyBindings.class, "examine")); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Window.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Window.java index fb9277b8d..111592c2e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Window.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Window.java @@ -195,7 +195,8 @@ public class Window extends Group implements Signal.Listener { @Override public boolean onSignal( KeyEvent event ) { if (event.pressed) { - if (KeyBindings.getActionForKey( event ) == SPDAction.BACK){ + if (KeyBindings.getActionForKey( event ) == SPDAction.BACK + || KeyBindings.getActionForKey( event ) == SPDAction.WAIT){ onBackPressed(); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndHardNotification.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndHardNotification.java index 03af4ffb8..7770bc1ec 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndHardNotification.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndHardNotification.java @@ -58,15 +58,19 @@ public class WndHardNotification extends WndTitledMessage{ resize(width, (int) btnOkay.bottom()); } + float incTime = 0; + @Override public void update() { super.update(); - timeLeft -= Game.elapsed; - if (timeLeft <= 0 ){ + incTime += Game.elapsed; + if (timeLeft <= 0 && !btnOkay.active){ btnOkay.enable(true); btnOkay.text(btnMessage); - } else { + } else if (timeLeft > 0 && incTime >= 1) { + timeLeft -= incTime; + incTime = 0; btnOkay.text(btnMessage + " (" + (int)Math.ceil(timeLeft) + ")"); }