[Add] More bindings ingame to avoid seg faults.

This commit is contained in:
Allanis 2013-05-15 21:19:59 +01:00
parent 4bcf431d31
commit 2e7a2b6e18

View File

@ -129,7 +129,7 @@ static void input_key(int keynum, double value, int abs) {
unsigned int t; unsigned int t;
// Accelerating. // Accelerating.
if(KEY("accel")) { if(INGAME() && KEY("accel")) {
if(abs)player_acc = value; if(abs)player_acc = value;
else player_acc += value; else player_acc += value;
// Double tap accel = afterburn! // Double tap accel = afterburn!
@ -145,7 +145,7 @@ static void input_key(int keynum, double value, int abs) {
if(value == KEY_PRESS) input_accelLast = t; if(value == KEY_PRESS) input_accelLast = t;
} }
// Turning left. // Turning left.
else if(KEY("left")) { else if(INGAME() && KEY("left")) {
// Set flags for facing correction. // Set flags for facing correction.
if(value == KEY_PRESS) { player_setFlag(PLAYER_TURN_LEFT); } if(value == KEY_PRESS) { player_setFlag(PLAYER_TURN_LEFT); }
else if(value == KEY_RELEASE) { player_rmFlag(PLAYER_TURN_LEFT); } else if(value == KEY_RELEASE) { player_rmFlag(PLAYER_TURN_LEFT); }
@ -155,7 +155,7 @@ static void input_key(int keynum, double value, int abs) {
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. // Turning right.
else if(KEY("right")) { else if(INGAME() && KEY("right")) {
// Set flags for facing correction. // Set flags for facing correction.
if(value == KEY_PRESS) { player_setFlag(PLAYER_TURN_RIGHT); } if(value == KEY_PRESS) { player_setFlag(PLAYER_TURN_RIGHT); }
else if(value == KEY_RELEASE) { player_rmFlag(PLAYER_TURN_RIGHT); } else if(value == KEY_RELEASE) { player_rmFlag(PLAYER_TURN_RIGHT); }
@ -166,7 +166,7 @@ static void input_key(int keynum, double value, int abs) {
if(player_turn < -1.) { player_turn = -1.; } // Make sure value is sane. if(player_turn < -1.) { player_turn = -1.; } // Make sure value is sane.
} }
// Turn around to face vel. // Turn around to face vel.
else if(KEY("reverse")) { else if(INGAME() && KEY("reverse")) {
if(value == KEY_PRESS) { player_setFlag(PLAYER_REVERSE); } if(value == KEY_PRESS) { player_setFlag(PLAYER_REVERSE); }
else if(value == KEY_RELEASE) { else if(value == KEY_RELEASE) {
player_rmFlag(PLAYER_REVERSE); player_rmFlag(PLAYER_REVERSE);
@ -176,15 +176,15 @@ static void input_key(int keynum, double value, int abs) {
} }
} }
// Shoot primary weapon. BOOM BOOM. // Shoot primary weapon. BOOM BOOM.
else if(KEY("primary")) { else if(INGAME() && KEY("primary")) {
if(value == KEY_PRESS) { player_setFlag(PLAYER_PRIMARY); } if(value == KEY_PRESS) { player_setFlag(PLAYER_PRIMARY); }
else if(value == KEY_RELEASE) { player_rmFlag(PLAYER_PRIMARY); } else if(value == KEY_RELEASE) { player_rmFlag(PLAYER_PRIMARY); }
} }
// Targetting. // Targetting.
else if(KEY("target") && INGAME()) { else if(INGAME() && KEY("target")) {
if(value == KEY_PRESS) player_target = pilot_getNext(player_target); if(value == KEY_PRESS) player_target = pilot_getNext(player_target);
} }
else if(KEY("target_nearest") && INGAME()) { else if(INGAME() && KEY("target_nearest")) {
if(value == KEY_PRESS) player_target = pilot_getHostile(); if(value == KEY_PRESS) player_target = pilot_getHostile();
} }
// Face the target. // Face the target.