Add more sane default controls for controller 0.9.24
authorWuzzy <Wuzzy2@mail.ru>
Tue, 24 Jul 2018 18:37:52 +0200
branch0.9.24
changeset 13551 46ee00a7526a
parent 13550 8b89bdb3c3dd
child 13552 214dde864805
Add more sane default controls for controller
ChangeLog.txt
README.md
hedgewars/uInputHandler.pas
--- a/ChangeLog.txt	Tue Jul 24 18:37:52 2018 +0200
+++ b/ChangeLog.txt	Tue Jul 24 18:37:52 2018 +0200
@@ -2,7 +2,8 @@
 * bugfixes
 ====================== 0.9.24.2 ====================
  * Restore joystick/controller functionality
- * Fix crash when starting Hedgewars with 2 controllers connected
+ * Fix crash when starting game with 2 controllers or mor connected
+ + Add default controls for controllers (see README)
 
 ====================== 0.9.24.1 ====================
  * Fix crash when portable portal device is fired at reduced graphics quality
--- a/README.md	Tue Jul 24 18:37:52 2018 +0200
+++ b/README.md	Tue Jul 24 18:37:52 2018 +0200
@@ -68,6 +68,24 @@
 * T: Chat
 * U: Team chat
 
+### Default controller controls
+Hedgewars also supports controllers. By default, Hedgewars sets up a few
+controls for your first (!) connected controller.
+This default might not be ideal, we recommend you set manual controls
+in the settings menu.
+
+* 1st D-pad: Walk and aim
+* 2nd D-pad / 1st thumbstick: Move camera/cursor
+* Button 1: Long jump
+* Button 2: High jump
+* Button 3: Attack
+* Button 4: Ammo menu
+* Button 5: Precise
+* Button 6: Select target, or pick weapon (in ammo menu)
+* Button 7: Switch hedgehog
+* Button 8: Find hedgehog / toggle auto camera
+* Button 9: Mission panel
+
 For the full list, go to the Hedgewars settings. Also read the weapon tooltips
 for weapon-specific controls.
 
--- a/hedgewars/uInputHandler.pas	Tue Jul 24 18:37:52 2018 +0200
+++ b/hedgewars/uInputHandler.pas	Tue Jul 24 18:37:52 2018 +0200
@@ -392,11 +392,40 @@
     RegisterBind(DefaultBinds, 'right', '+right');
     RegisterBind(DefaultBinds, 'left_shift', '+precise');
 
+    // Default controls for first connected controller
+    { NOTE: This is provided for convenience so players
+    don't have to set-up the controller entirely in a new install.
+    It's not ideal, so players are still encourages to
+    set up things manually. }
+    // Essential controls
+    RegisterBind(DefaultBinds, 'j0h0r', '+right');
+    RegisterBind(DefaultBinds, 'j0h0l', '+left');
+    RegisterBind(DefaultBinds, 'j0h0u', '+up');
+    RegisterBind(DefaultBinds, 'j0h0d', '+down');
+    RegisterBind(DefaultBinds, 'j0b0', 'ljump');
+    RegisterBind(DefaultBinds, 'j0b1', 'hjump');
+    RegisterBind(DefaultBinds, 'j0b2', '+attack');
+    RegisterBind(DefaultBinds, 'j0b3', 'ammomenu');
+    RegisterBind(DefaultBinds, 'j0b4', '+precise');
+    RegisterBind(DefaultBinds, 'j0b5', 'put');
+    RegisterBind(DefaultBinds, 'j0b6', 'switch');
+    // TODO: Add controller-friendly way to change timer
 
-    RegisterBind(DefaultBinds, 'j0a0u', '+left');
-    RegisterBind(DefaultBinds, 'j0a0d', '+right');
-    RegisterBind(DefaultBinds, 'j0a1u', '+up');
-    RegisterBind(DefaultBinds, 'j0a1d', '+down');
+    // Cursor movement (also essential)
+    RegisterBind(DefaultBinds, 'j0h1r', '+cur_r');
+    RegisterBind(DefaultBinds, 'j0h1l', '+cur_l');
+    RegisterBind(DefaultBinds, 'j0h1d', '+cur_d');
+    RegisterBind(DefaultBinds, 'j0h1u', '+cur_u');
+
+    RegisterBind(DefaultBinds, 'j0a0u', '+cur_r');
+    RegisterBind(DefaultBinds, 'j0a0d', '+cur_l');
+    RegisterBind(DefaultBinds, 'j0a1u', '+cur_d');
+    RegisterBind(DefaultBinds, 'j0a1d', '+cur_u');
+
+    // Additional controls
+    RegisterBind(DefaultBinds, 'j0b7', 'findhh');
+    RegisterBind(DefaultBinds, 'j0b8', '+mission');
+
     for i:= 1 to 10 do RegisterBind(DefaultBinds, 'f'+IntToStr(i), 'slot '+char(48+i));
     for i:= 1 to 5  do RegisterBind(DefaultBinds, IntToStr(i), 'timer '+IntToStr(i));