diff --git a/src/battle/hud.c b/src/battle/hud.c index 48cb399..6761286 100644 --- a/src/battle/hud.c +++ b/src/battle/hud.c @@ -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 { diff --git a/src/battle/player.c b/src/battle/player.c index e142a8a..0535b53 100644 --- a/src/battle/player.c +++ b/src/battle/player.c @@ -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) diff --git a/src/structs.h b/src/structs.h index 1fa3ed6..c6c9bf0 100644 --- a/src/structs.h +++ b/src/structs.h @@ -110,7 +110,9 @@ struct Entity { int maxShield; int reload; int reloadTime; + int selectedGun; int selectedGunType; + int numGuns; int combinedGuns; int shieldRecharge; int shieldRechargeRate;