Combined guns bug fix.

This commit is contained in:
Steve 2015-12-14 14:05:02 +00:00
parent 691068a634
commit 7701fc0336
2 changed files with 30 additions and 12 deletions

View File

@ -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);
}

View File

@ -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;
}