Display total available guns on HUD.

This commit is contained in:
Steve 2015-12-27 21:16:57 +00:00
parent 568abb25f4
commit 38e4564aae
3 changed files with 32 additions and 1 deletions

View File

@ -260,7 +260,14 @@ static void drawWeaponInfo(void)
{
if (!player->combinedGuns)
{
drawText(10, 70, 14, TA_LEFT, colors.white, (player->selectedGunType != -1) ? gunName[player->selectedGunType] : "(None)");
if (player->numGuns)
{
drawText(10, 70, 14, TA_LEFT, colors.white, "%s (%d / %d)", gunName[player->selectedGunType], player->selectedGun + 1, player->numGuns);
}
else
{
drawText(10, 70, 14, TA_LEFT, colors.white, "(None)");
}
}
else
{

View File

@ -68,6 +68,18 @@ void initPlayer(void)
player->selectedGunType = 0;
}
player->numGuns = 0;
for (i = 0 ; i < BT_MAX ; i++)
{
if (availableGuns[i])
{
player->numGuns++;
}
}
player->selectedGun = 0;
STRNCPY(player->name, "Player", MAX_NAME_LENGTH);
player->action = NULL;
@ -399,6 +411,16 @@ static void switchGuns(void)
}
player->selectedGunType = i;
player->selectedGun = 0;
for (i = 0 ; i < player->selectedGunType ; i++)
{
if (availableGuns[i])
{
player->selectedGun++;
}
}
}
static void selectTarget(void)

View File

@ -110,7 +110,9 @@ struct Entity {
int maxShield;
int reload;
int reloadTime;
int selectedGun;
int selectedGunType;
int numGuns;
int combinedGuns;
int shieldRecharge;
int shieldRechargeRate;