[Change] Gave afterburn it's own keybind (for joysticks).

This commit is contained in:
Allanis 2013-12-17 20:12:28 +00:00
parent 37b1d50654
commit fe6f5b27ef

View File

@ -31,7 +31,7 @@ static Keybind** input_keybinds; /**< Contains the players keybindings. */
/* Name of each keybinding. */
const char* keybindNames[] = {
/* Movement. */
"accel", "left", "right", "reverse",
"accel", "left", "right", "reverse", "afterburn",
/* Targetting. */
"target", "target_nearest", "target_hostile",
/* Fighting. */
@ -52,8 +52,6 @@ unsigned int input_afterburnSensibility = 200; /**< ms between taps to afterbur
/* From player.c */
extern double player_turn;
extern unsigned int player_target;
/* Grabbed from main.c */
extern int show_fps;
/**
@ -64,6 +62,7 @@ extern int show_fps;
void input_setDefault(void) {
/* Movement. */
input_setKeybind("accel", KEYBIND_KEYBOARD, SDLK_w, 0);
input_setKeybind("afterburn", KEYBIND_KEYBOARD, SDLK_UNKNOWN, 0); /* Not set. */
input_setKeybind("left", KEYBIND_KEYBOARD, SDLK_a, 0);
input_setKeybind("right", KEYBIND_KEYBOARD, SDLK_d, 0);
input_setKeybind("reverse", KEYBIND_KEYBOARD, SDLK_s, 0);
@ -203,6 +202,10 @@ static void input_key(int keynum, double value, int kabs) {
if(value == KEY_PRESS) input_accelLast = t;
}
else if(KEY("afterburn") && INGAME() && NOHYP()) {
if(value == KEY_PRESS) player_afterburn();
else if(value == KEY_RELEASE) player_afterburnOver();
}
/* Turning left. */
else if(KEY("left")) {
player_abortAutonav();
@ -212,7 +215,7 @@ static void input_key(int keynum, double value, int kabs) {
if(kabs) { player_turn = -value; }
else { player_turn -= value; }
if(player_turn < -1.) { player_turn = -1.; }/* Make sure value is sane. */
if(player_turn < -1.) player_turn = -1.; /* Make sure value is sane. */
}
/* Turning right. */
else if(KEY("right")) {