Add more sane default controls for controller
authorWuzzy <Wuzzy2@mail.ru>
Fri, 20 Jul 2018 15:56:43 +0200
changeset 13519 1232ab8206d4
parent 13518 122e08d45caa
child 13531 282218ab1b28
child 13532 ee77086fc5fa
Add more sane default controls for controller
ChangeLog.txt
README.md
hedgewars/uInputHandler.pas
--- a/ChangeLog.txt	Fri Jul 20 14:33:41 2018 +0200
+++ b/ChangeLog.txt	Fri Jul 20 15:56:43 2018 +0200
@@ -5,6 +5,7 @@
  + Add new key to show mission panel (default: M)
  + Add chat command “/help”, displays help for chat commands
  + Increase hedgehog limit to 64
+ * Functionality of controllers restored
  * Fix crash when 2 or more controllers were connected
  * Fix extreme amounts of droplets when shooting with minigun into ocean world edge
  * Fix hog being unable to walk after using sniper rifle without firing both shots
--- a/README.md	Fri Jul 20 14:33:41 2018 +0200
+++ b/README.md	Fri Jul 20 15:56:43 2018 +0200
@@ -69,6 +69,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	Fri Jul 20 14:33:41 2018 +0200
+++ b/hedgewars/uInputHandler.pas	Fri Jul 20 15:56:43 2018 +0200
@@ -393,11 +393,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));