From 7701fc0336ba6f9454c0d1f7632994961387857e Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 14 Dec 2015 14:05:02 +0000 Subject: [PATCH] Combined guns bug fix. --- src/battle/hud.c | 10 +++++++++- src/battle/player.c | 32 +++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/battle/hud.c b/src/battle/hud.c index 055f60d..a8b6067 100644 --- a/src/battle/hud.c +++ b/src/battle/hud.c @@ -258,7 +258,15 @@ static void drawBoostECMBar(int current, int max, int x, int y, int r, int g, in static void drawWeaponInfo(void) { - drawText(10, 70, 14, TA_LEFT, colors.white, (player->selectedGunType != -1) ? gunName[player->selectedGunType] : "(None)"); + if (!player->combinedGuns) + { + drawText(10, 70, 14, TA_LEFT, colors.white, (player->selectedGunType != -1) ? gunName[player->selectedGunType] : "(None)"); + } + else + { + drawText(10, 70, 14, TA_LEFT, colors.white, "(Combined Guns)"); + } + drawText(260, 70, 14, TA_RIGHT, colors.white, "Missiles (%d)", player->missiles); } diff --git a/src/battle/player.c b/src/battle/player.c index 8551671..c1144fe 100644 --- a/src/battle/player.c +++ b/src/battle/player.c @@ -45,21 +45,28 @@ void initPlayer(void) memset(&availableGuns, 0, sizeof(int) * BT_MAX); player->selectedGunType = -1; - - for (i = 0 ; i < MAX_FIGHTER_GUNS ; i++) + + if (!player->combinedGuns) { - n = player->guns[i].type; - - if (n) + for (i = 0 ; i < MAX_FIGHTER_GUNS ; i++) { - availableGuns[n] = 1; + n = player->guns[i].type; - if (player->selectedGunType == -1) + if (n) { - player->selectedGunType = n; + availableGuns[n] = 1; + + if (player->selectedGunType == -1) + { + player->selectedGunType = n; + } } } } + else + { + player->selectedGunType = 0; + } STRNCPY(player->name, "Player", MAX_NAME_LENGTH); @@ -370,11 +377,14 @@ static void switchGuns(void) i = player->selectedGunType; - do + if (!player->combinedGuns) { - i = (i + 1) % BT_MAX; + do + { + i = (i + 1) % BT_MAX; + } + while (!availableGuns[i]); } - while (!availableGuns[i]); player->selectedGunType = i; }