mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-14 00:21:34 +00:00
Added customization of ammo display in alternative HUD
Added hud_showammo CVAR with three states: * If value is 0, show ammo for current weapon only * If value is 1, show ammo for available weapons * If value is greater than 1, show ammo for all weapons Default value is 2, so initial ammo display behavior isn't changed
This commit is contained in:
parent
7c567979d9
commit
003817f415
1 changed files with 28 additions and 13 deletions
|
@ -73,6 +73,7 @@ CVAR (Bool, hud_showitems, false,CVAR_ARCHIVE); // Show item stats on HUD
|
||||||
CVAR (Bool, hud_showstats, false, CVAR_ARCHIVE); // for stamina and accuracy.
|
CVAR (Bool, hud_showstats, false, CVAR_ARCHIVE); // for stamina and accuracy.
|
||||||
CVAR (Bool, hud_showscore, false, CVAR_ARCHIVE); // for user maintained score
|
CVAR (Bool, hud_showscore, false, CVAR_ARCHIVE); // for user maintained score
|
||||||
CVAR (Bool, hud_showweapons, true, CVAR_ARCHIVE); // Show weapons collected
|
CVAR (Bool, hud_showweapons, true, CVAR_ARCHIVE); // Show weapons collected
|
||||||
|
CVAR (Int , hud_showammo, 2, CVAR_ARCHIVE); // Show ammo collected
|
||||||
CVAR (Int , hud_showtime, 0, CVAR_ARCHIVE); // Show time on HUD
|
CVAR (Int , hud_showtime, 0, CVAR_ARCHIVE); // Show time on HUD
|
||||||
CVAR (Int , hud_timecolor, CR_GOLD,CVAR_ARCHIVE); // Color of in-game time on HUD
|
CVAR (Int , hud_timecolor, CR_GOLD,CVAR_ARCHIVE); // Color of in-game time on HUD
|
||||||
CVAR (Int , hud_showlag, 0, CVAR_ARCHIVE); // Show input latency (maketic - gametic difference)
|
CVAR (Int , hud_showlag, 0, CVAR_ARCHIVE); // Show input latency (maketic - gametic difference)
|
||||||
|
@ -547,15 +548,28 @@ static int DrawAmmo(player_t *CPlayer, int x, int y)
|
||||||
|
|
||||||
orderedammos.Clear();
|
orderedammos.Clear();
|
||||||
|
|
||||||
|
if (0 == hud_showammo)
|
||||||
|
{
|
||||||
|
// Show ammo for current weapon if any
|
||||||
|
if (wi) AddAmmoToList(wi);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Order ammo by use of weapons in the weapon slots
|
// Order ammo by use of weapons in the weapon slots
|
||||||
// Do not check for actual presence in the inventory!
|
|
||||||
// We want to show all ammo types that can be used by
|
|
||||||
// the weapons in the weapon slots.
|
|
||||||
for (k = 0; k < NUM_WEAPON_SLOTS; k++) for(j = 0; j < CPlayer->weapons.Slots[k].Size(); j++)
|
for (k = 0; k < NUM_WEAPON_SLOTS; k++) for(j = 0; j < CPlayer->weapons.Slots[k].Size(); j++)
|
||||||
{
|
{
|
||||||
const PClass *weap = CPlayer->weapons.Slots[k].GetWeapon(j);
|
const PClass *weap = CPlayer->weapons.Slots[k].GetWeapon(j);
|
||||||
|
|
||||||
if (weap) AddAmmoToList((AWeapon*)GetDefaultByType(weap));
|
if (weap)
|
||||||
|
{
|
||||||
|
// Show ammo for available weapons if hud_showammo CVAR is 1
|
||||||
|
// or show ammo for all weapons if hud_showammo is greater than 1
|
||||||
|
|
||||||
|
if (hud_showammo > 1 || CPlayer->mo->FindInventory(weap))
|
||||||
|
{
|
||||||
|
AddAmmoToList((AWeapon*)GetDefaultByType(weap));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now check for the remaining weapons that are in the inventory but not in the weapon slots
|
// Now check for the remaining weapons that are in the inventory but not in the weapon slots
|
||||||
|
@ -566,6 +580,7 @@ static int DrawAmmo(player_t *CPlayer, int x, int y)
|
||||||
AddAmmoToList((AWeapon*)inv);
|
AddAmmoToList((AWeapon*)inv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ok, we got all ammo types. Now draw the list back to front (bottom to top)
|
// ok, we got all ammo types. Now draw the list back to front (bottom to top)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue