#include "../dpdefs/keycodes.qh"
-#include "../common/buffs.qh"
+#include "../common/buffs/all.qh"
#include "../common/constants.qh"
#include "../common/deathtypes.qh"
#include "../common/items/all.qc"
// Weapon icons (#0)
//
-entity weaponorder[WEP_MAXCOUNT];
+entity weaponorder[Weapons_MAX];
void weaponorder_swap(int i, int j, entity pass)
{
entity h = weaponorder[i];
}
void HUD_Weapons(void)
-{
+{SELFPARAM();
// declarations
WepSet weapons_stat = WepSet_GetFromStat();
int i;
weapon_cnt = 0;
for(i = WEP_FIRST; i <= WEP_LAST; ++i)
{
- self = get_weaponinfo(i);
+ setself(get_weaponinfo(i));
if(self.impulse >= 0)
{
weaponorder[weapon_cnt] = self;
++weapon_cnt;
}
}
- for(i = weapon_cnt; i < WEP_MAXCOUNT; ++i)
+ for(i = weapon_cnt; i < Weapons_MAX; ++i)
weaponorder[i] = world;
heapsort(weapon_cnt, weaponorder_swap, weaponorder_cmp, world);
if(cvar("wep_add"))
{
weapons_stat = '0 0 0';
- float countw = 1 + floor((floor(time * cvar("wep_add"))) % WEP_COUNT);
+ float countw = 1 + floor((floor(time * cvar("wep_add"))) % (Weapons_COUNT - 1));
for(i = WEP_FIRST; i <= countw; ++i)
weapons_stat |= WepSet_FromWeapon(i);
}
vector padded_panel_size = panel_size - '2 2 0' * panel_bg_padding;
// get the all-weapons layout
- vector table_size = HUD_GetTableSize_BestItemAR(WEP_COUNT, padded_panel_size, aspect);
+ int nHidden = 0;
+ WepSet weapons_stat = WepSet_GetFromStat();
+ for (int i = WEP_FIRST; i <= WEP_LAST; ++i) {
+ WepSet weapons_wep = WepSet_FromWeapon(i);
+ if (weapons_stat & weapons_wep) continue;
+ Weapon w = get_weaponinfo(i);
+ if (w.spawnflags & WEP_FLAG_MUTATORBLOCKED) nHidden += 1;
+ }
+ vector table_size = HUD_GetTableSize_BestItemAR((Weapons_COUNT - 1) - nHidden, padded_panel_size, aspect);
columns = table_size.x;
rows = table_size.y;
weapon_size.x = padded_panel_size.x / columns;
panel_pos.y += (old_panel_size.y - panel_size.y) / 2;
}
else
- weapon_count = WEP_COUNT;
+ weapon_count = (Weapons_COUNT - 1);
// animation for fading in/out the panel respectively when not in use
if(!autocvar__hud_configure)
if(!rows) // if rows is > 0 onlyowned code has already updated these vars
{
- vector table_size = HUD_GetTableSize_BestItemAR(WEP_COUNT, panel_size, aspect);
+ vector table_size = HUD_GetTableSize_BestItemAR((Weapons_COUNT - 1), panel_size, aspect);
columns = table_size.x;
rows = table_size.y;
weapon_size.x = panel_size.x / columns;
for(i = 0; i <= WEP_LAST-WEP_FIRST; ++i)
{
// retrieve information about the current weapon to be drawn
- self = weaponorder[i];
+ setself(weaponorder[i]);
weapon_id = self.impulse;
isCurrent = (self.weapon == switchweapon);
if(superTime)
addPowerupItem("Superweapons", "superweapons", autocvar_hud_progressbar_superweapons_color, superTime, 30);
- FOREACH(BUFFS, it.m_itemid & allBuffs, LAMBDA(
+ FOREACH(Buffs, it.m_itemid & allBuffs, LAMBDA(
addPowerupItem(it.m_prettyName, strcat("buff_", it.m_name), it.m_color, bound(0, getstatf(STAT_BUFF_TIME) - time, 99), 60);
));
{
vote_yescount = 0;
vote_nocount = 0;
- print(_("^1You must answer before entering hud configure mode\n"));
+ LOG_INFO(_("^1You must answer before entering hud configure mode\n"));
cvar_set("_hud_configure", "0");
}
if(vote_called_vote)
}
}
if (warning)
- dprint("Automatically fixed wrong/missing panel numbers in _hud_panelorder\n");
+ LOG_TRACE("Automatically fixed wrong/missing panel numbers in _hud_panelorder\n");
cvar_set("_hud_panelorder", s);
if(hud_panelorder_prev)