Display total available guns on HUD.
This commit is contained in:
parent
568abb25f4
commit
38e4564aae
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -110,7 +110,9 @@ struct Entity {
|
|||
int maxShield;
|
||||
int reload;
|
||||
int reloadTime;
|
||||
int selectedGun;
|
||||
int selectedGunType;
|
||||
int numGuns;
|
||||
int combinedGuns;
|
||||
int shieldRecharge;
|
||||
int shieldRechargeRate;
|
||||
|
|
Loading…
Reference in New Issue