// draw items
row = column = 0;
vector label_size = '1 1 0' * min(weapon_size.x, weapon_size.y) * bound(0, autocvar_hud_panel_weapons_label_scale, 1);
+ vector noncurrent_pos = '0 0 0';
+ vector noncurrent_size = weapon_size * bound(0, autocvar_hud_panel_weapons_noncurrent_scale, 1);
+ float noncurrent_alpha = panel_fg_alpha * bound(0, autocvar_hud_panel_weapons_noncurrent_alpha, 1);
+ bool isCurrent;
+
for(i = 0; i <= WEP_LAST-WEP_FIRST; ++i)
{
// retrieve information about the current weapon to be drawn
self = weaponorder[i];
weapon_id = self.impulse;
+ isCurrent = (self.weapon == switchweapon);
// skip if this weapon doesn't exist
if(!self || weapon_id < 0) { continue; }
continue;
// figure out the drawing position of weapon
- weapon_pos = (panel_pos
- + eX * column * weapon_size.x
- + eY * row * weapon_size.y);
+ weapon_pos = (panel_pos + eX * column * weapon_size.x + eY * row * weapon_size.y);
+ noncurrent_pos.x = weapon_pos.x + (weapon_size.x - noncurrent_size.x) / 2;
+ noncurrent_pos.y = weapon_pos.y + (weapon_size.y - noncurrent_size.y) / 2;
// draw background behind currently selected weapon
- if(self.weapon == switchweapon)
+ if(isCurrent)
drawpic_aspect_skin(weapon_pos, "weapon_current_bg", weapon_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
// draw the weapon accuracy
if(weapons_stat & WepSet_FromWeapon(self.weapon))
{
// draw the weapon image
- drawpic_aspect_skin(weapon_pos, self.model2, weapon_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ if(isCurrent)
+ drawpic_aspect_skin(weapon_pos, self.model2, weapon_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ else
+ drawpic_aspect_skin(noncurrent_pos, self.model2, noncurrent_size, '1 1 1', noncurrent_alpha, DRAWFLAG_NORMAL);
// draw weapon label string
switch(autocvar_hud_panel_weapons_label)
}
else // draw a "ghost weapon icon" if you don't have the weapon
{
- drawpic_aspect_skin(weapon_pos, self.model2, weapon_size, '0 0 0', panel_fg_alpha * 0.5, DRAWFLAG_NORMAL);
+ drawpic_aspect_skin(noncurrent_pos, self.model2, noncurrent_size, '0.2 0.2 0.2', panel_fg_alpha * 0.5, DRAWFLAG_NORMAL);
}
// draw the complain message
}
// Ammo (#1)
-void DrawNadeScoreBar(vector myPos, vector mySize, vector color)
+void DrawNadeProgressBar(vector myPos, vector mySize, float progress, vector color)
{
-
HUD_Panel_DrawProgressBar(
myPos + eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize.x,
mySize - eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize.x,
autocvar_hud_panel_ammo_progressbar_name,
- getstatf(STAT_NADE_BONUS_SCORE), 0, 0, color,
+ progress, 0, 0, color,
autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
-
}
void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expand_time)
{
- float theAlpha = 1, a, b;
- vector nade_color, picpos, numpos;
+ float bonusNades = getstatf(STAT_NADE_BONUS);
+ float bonusProgress = getstatf(STAT_NADE_BONUS_SCORE);
+ float bonusType = getstati(STAT_NADE_BONUS_TYPE);
+ vector nadeColor = Nade_Color(bonusType);
+ string nadeIcon = Nade_Icon(bonusType);
- nade_color = Nade_Color(getstati(STAT_NADE_BONUS_TYPE));
-
- a = getstatf(STAT_NADE_BONUS);
- b = getstatf(STAT_NADE_BONUS_SCORE);
+ vector iconPos, textPos;
if(autocvar_hud_panel_ammo_iconalign)
{
- numpos = myPos;
- picpos = myPos + eX * 2 * mySize.y;
+ iconPos = myPos + eX * 2 * mySize.y;
+ textPos = myPos;
}
else
{
- numpos = myPos + eX * mySize.y;
- picpos = myPos;
+ iconPos = myPos;
+ textPos = myPos + eX * mySize.y;
}
- DrawNadeScoreBar(myPos, mySize, nade_color);
-
- if(b > 0 || a > 0)
+ if(bonusNades > 0 || bonusProgress > 0)
{
+ DrawNadeProgressBar(myPos, mySize, bonusProgress, nadeColor);
+
if(autocvar_hud_panel_ammo_text)
- drawstring_aspect(numpos, ftos(a), eX * (2/3) * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(textPos, ftos(bonusNades), eX * (2/3) * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
if(draw_expanding)
- drawpic_aspect_skin_expanding(picpos, "nade_nbg", '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, expand_time);
+ drawpic_aspect_skin_expanding(iconPos, nadeIcon, '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, expand_time);
- drawpic_aspect_skin(picpos, "nade_bg" , '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
- drawpic_aspect_skin(picpos, "nade_nbg" , '1 1 0' * mySize.y, nade_color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
+ drawpic_aspect_skin(iconPos, nadeIcon, '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
}
}
vector distribution_color;
entity tm, pl, me;
- me = playerslots[player_localentnum - 1];
+ me = playerslots[current_player];
if((scores_flags[ps_primary] & SFL_TIME) && !teamplay) { // race/cts record display on HUD
string timer, distrtimer;
if(spectatee_status == -1)
s = _("^1Observing");
else
- s = sprintf(_("^1Spectating: ^7%s"), GetPlayerName(player_localentnum - 1));
+ s = sprintf(_("^1Spectating: ^7%s"), GetPlayerName(current_player));
drawInfoMessage(s);
if(spectatee_status == -1)
hud_skin_prev = strzone(autocvar_hud_skin);
}
- current_player = player_localentnum;
-
// draw the dock
if(autocvar_hud_dock != "" && autocvar_hud_dock != "0")
{
{
string hud_dock_color = autocvar_hud_dock_color;
if(hud_dock_color == "shirt") {
- f = stof(getplayerkeyvalue(current_player - 1, "colors"));
+ f = stof(getplayerkeyvalue(current_player, "colors"));
color = colormapPaletteColor(floor(f / 16), 0);
}
else if(hud_dock_color == "pants") {
- f = stof(getplayerkeyvalue(current_player - 1, "colors"));
+ f = stof(getplayerkeyvalue(current_player, "colors"));
color = colormapPaletteColor(f % 16, 1);
}
else