From cfeac68b36504a66e02ffdeb2b67ed789fbd91fa Mon Sep 17 00:00:00 2001
From: onpon4
Date: Sun, 1 Mar 2015 19:59:27 -0500
Subject: [PATCH] Updated joystick controls to work well with most gamepads.
All gamepads I've come across work OK with button 2 or 3 as the primary
button, and button 1 or 4 as the secondary button. For the rest,
basically invariably, buttons 5 and 7 are the left shoulder buttons,
buttons 6 and 8 are the right shoulder buttons, button 9 is "Select"
or "Back", and button 10 is "Start". Based on this, I've changed
the gamepad controls to something that should work for most gamepads.
Also fixed some bad HTML in the documentation, and removed the
build instructions from there (they will soon be obsolete; I'm
working on replacing the hand-made Makefile with GNU Autoconf).
---
docs/index.html | 70 ++++++++++++++++++++-----------------------------
src/player.cpp | 18 ++++++++++---
2 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/docs/index.html b/docs/index.html
index a7ba45e..deeb550 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -59,57 +59,45 @@ along with this program. If not, see .
opens with Chris attempting to escape a Weapco patrol that has
intercepted him.
- Installation
-
- Installation under Linux:
-
-tar zxf starfighter-1.2.tar.gz
-cd starfighter-1.2
-make
-make install
-
-
- When the game is first run it will attempt to create ~/.parallelrealities/starfighter/
.
- Should this fail the game will not run.
-
Controls
Menus
- - Arrow Keys - Highlight option
-
- Control / Space - Select menu option
+
- Arrow Keys - Highlight option
+ - Control / Enter - Select menu option
Intermission Screen
- - Mouse or Arrow Keys - Move cursor
-
- Left Mouse Button - Selected option
-
- Right Mouse Button - Toggle planet orbit On / Off
+
- Mouse or Arrow Keys - Move cursor
+ - Left Mouse Button or Control / Enter - Selected option
+ - Right Mouse Button or Space - Toggle planet orbit On / Off
In Game
- - Arrow Keys - Control Firefly
-
- Ctrl - Fire primary weapon
-
- Space - Fire secondary weapon
-
- Shift - Toggle Primary Weapon Concentrate / Spread (see Weaponry)
-
- T - Switch Targetting Arrow mode
-
- P - Pause / Unpause
-
- Escape - Flee (not possible until all primary missions completed)
-
- Escape whilst paused - Quit to title screen
+
- Arrow Keys - Control Firefly
+ - Ctrl - Fire primary weapon
+ - Space - Fire secondary weapon
+ - Shift - Toggle Primary Weapon Concentrate / Spread (see Weaponry)
+ - P - Pause / Unpause
+ - Escape - Flee (not possible until all primary missions completed)
+ - Escape whilst paused - Quit to title screen
Joystick and Gamepad support
- - Stick or Hat - Same as Arrow Keys
-
- Button 0 - Fire primary weapon / Select menu option
-
- Button 1 - Fire secondary weapon / Select menu option
-
- Button 2 - Toggle Primary Weapon Concentrate / Spread
-
- Button 3 - Switch Targetting Arrow mode
+
- Stick or Hat - Same as Arrow Keys
+ - Button 1 / 4 - Fire primary weapon / Select menu option
+ - Button 2 / 3 - Fire secondary weapon / Select menu option
+ - Button 6 / 8 / 9 - Toggle Primary Weapon Concentrate / Spread
+ - Button 10 - Pause / Unpause
+ - Button 5 / 7 - Flee (not possible until all primary missions completed)
+ - Button 5 / 7 whilst paused - Quit to title screen
Note - Keys cannot be changed
@@ -125,11 +113,11 @@ make install
the options shown:
* Will only be shown if there are saved games
@@ -230,11 +218,11 @@ make install
you pick up, as well as mission related information.
- - White messages are standard for picking up items such as cash and power ups.
-
- Green messages signify successful completion of mission objectives.
-
- Light Blue messages give further details about Primary mission requirements.
-
- Red messages indicate mission failures, warnings and wing mate ejections.
-
- Yellow messages give further details about Secondary mission requirements.
+
- White messages are standard for picking up items such as cash and power ups.
+ - Green messages signify successful completion of mission objectives.
+ - Light Blue messages give further details about Primary mission requirements.
+ - Red messages indicate mission failures, warnings and wing mate ejections.
+ - Yellow messages give further details about Secondary mission requirements.
The Target Arrow
diff --git a/src/player.cpp b/src/player.cpp
index 5818aa3..3f02854 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -429,14 +429,26 @@ void getPlayerInput()
switch (engine.event.jbutton.button)
{
case 0:
- engine.keyState[KEY_FIRE] = engine.event.jbutton.state;
- break;
- case 1:
+ case 3:
engine.keyState[KEY_ALTFIRE] = engine.event.jbutton.state;
break;
+ case 1:
case 2:
+ engine.keyState[KEY_FIRE] = engine.event.jbutton.state;
+ break;
+ case 4:
+ case 6:
+ engine.keyState[KEY_ESCAPE] = engine.event.jbutton.state;
+ break;
+ case 5:
+ case 7:
+ case 8:
engine.keyState[KEY_SWITCH] = engine.event.jbutton.state;
break;
+ case 9:
+ if (engine.event.jbutton.state)
+ engine.keyState[KEY_PAUSE] = 1;
+ break;
}
break;