[Fix] Someone has to put a stop to VLack finding my bugs.

This commit is contained in:
Allanis 2013-03-16 17:11:08 +00:00
parent fdaabd259e
commit 6f12836395

View File

@ -117,6 +117,11 @@ void input_setKeybind(char* keybind, KeybindType type, int key, int reverse) {
// ===================================================================== // =====================================================================
#define KEY(s) (strcmp(input_keybinds[keynum]->name, s)==0) #define KEY(s) (strcmp(input_keybinds[keynum]->name, s)==0)
#define INGAME() (!toolkit) #define INGAME() (!toolkit)
// We won't be having any more funny stuff from VLack..
#define NOHYP() \
(!pilot_isFlag(player, PILOT_HYP_PREP) && \
!pilot_isFlag(player, PILOT_HYP_BEGIN) && \
!pilot_isFlag(player, PILOT_HYPERSPACE))
static void input_key(int keynum, double value, int abs) { static void input_key(int keynum, double value, int abs) {
// Accelerating. // Accelerating.
if(KEY("accel")) { if(KEY("accel")) {
@ -156,15 +161,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") && !paused) { else if(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") && !paused) { else if(KEY("target") && INGAME()) {
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")) { else if(KEY("target_nearest") && INGAME()) {
if(value == KEY_PRESS) player_target = pilot_getHostile(); if(value == KEY_PRESS) player_target = pilot_getHostile();
} }
// Face the target. // Face the target.
@ -180,11 +185,11 @@ static void input_key(int keynum, double value, int abs) {
} }
} }
// Board those ships. // Board those ships.
else if(KEY("board") && INGAME()) { else if(KEY("board") && INGAME() && NOHYP()) {
if(value == KEY_PRESS) player_board(); if(value == KEY_PRESS) player_board();
} }
// Shooting secondary weapon. // Shooting secondary weapon.
else if(KEY("secondary") && INGAME()) { else if(KEY("secondary") && INGAME() && NOHYP()) {
if(value == KEY_PRESS) { player_setFlag(PLAYER_SECONDARY); } if(value == KEY_PRESS) { player_setFlag(PLAYER_SECONDARY); }
else if(value == KEY_RELEASE) { player_rmFlag(PLAYER_SECONDARY); } else if(value == KEY_RELEASE) { player_rmFlag(PLAYER_SECONDARY); }
} }
@ -194,17 +199,17 @@ static void input_key(int keynum, double value, int abs) {
} }
// Space. // Space.
// Target planet (cycles just like target). // Target planet (cycles just like target).
else if(KEY("target_planet") && INGAME()) { else if(KEY("target_planet") && INGAME() && NOHYP()) {
if(value == KEY_PRESS) player_targetPlanet(); if(value == KEY_PRESS) player_targetPlanet();
} }
// Target nearest planet or attempt to land. // Target nearest planet or attempt to land.
else if(KEY("land") && INGAME()) { else if(KEY("land") && INGAME() && NOHYP()) {
if(value == KEY_PRESS) player_land(); if(value == KEY_PRESS) player_land();
} }
else if(KEY("thyperspace") && INGAME()) { else if(KEY("thyperspace") && INGAME() && NOHYP()) {
if(value == KEY_PRESS) player_targetHyperspace(); if(value == KEY_PRESS) player_targetHyperspace();
} }
else if(KEY("starmap")) { else if(KEY("starmap") && NOHYP()) {
if(value == KEY_PRESS) map_open(); if(value == KEY_PRESS) map_open();
} }
else if(KEY("jump") && INGAME()) { else if(KEY("jump") && INGAME()) {
@ -223,7 +228,7 @@ static void input_key(int keynum, double value, int abs) {
if(value == KEY_PRESS) player_screenshot(); if(value == KEY_PRESS) player_screenshot();
} }
// Pause the game. // Pause the game.
else if(KEY("pause")) { else if(KEY("pause") && NOHYP()) {
if(value == KEY_PRESS) { if(value == KEY_PRESS) {
if(!toolkit) { if(!toolkit) {
if(paused) unpause(); if(paused) unpause();
@ -231,11 +236,11 @@ static void input_key(int keynum, double value, int abs) {
} }
} }
// Opens a menu. // Opens a menu.
else if(KEY("menu")) { else if(KEY("menu") && NOHYP()) {
if(value == KEY_PRESS) menu_small(); if(value == KEY_PRESS) menu_small();
} }
// Show pilot information. // Show pilot information.
else if(KEY("info")) { else if(KEY("info") && NOHYP()) {
if(value == KEY_PRESS) info_menu(); if(value == KEY_PRESS) info_menu();
} }
} }