Skip to content

Commit

Permalink
Client: HUD: Ammo: Draw pink boxes for missing sprites
Browse files Browse the repository at this point in the history
  • Loading branch information
tmp64 committed Nov 25, 2023
1 parent 6f5de39 commit f758899
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions src/game/client/hud/ammo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,9 @@ int CHudAmmo::DrawWList(float flTime)
if (p)
iWidth = p->rcActive.right - p->rcActive.left;

HSPRITE hSprSelection = gHUD.GetSprite(m_HUD_selection);
const wrect_t &rcSprSelection = gHUD.GetSpriteRect(m_HUD_selection);

for (int iPos = 0; iPos < MAX_WEAPON_POSITIONS; iPos++)
{
p = gWR.GetWeaponSlot(i, iPos);
Expand All @@ -1138,11 +1141,19 @@ int CHudAmmo::DrawWList(float flTime)
a = 255 * gHUD.GetHudTransparency();
ScaleColors(r, g, b, a);

SPR_Set(p->hActive, r, g, b);
SPR_DrawAdditive(0, x, y, &p->rcActive);
if (p->hActive)
{
SPR_Set(p->hActive, r, g, b);
SPR_DrawAdditive(0, x, y, &p->rcActive);
}
else
{
// Pink rect
gEngfuncs.pfnFillRGBA(x, y, rcSprSelection.right - rcSprSelection.left, rcSprSelection.bottom - rcSprSelection.top, 64, 0, 64, a);
}

SPR_Set(gHUD.GetSprite(m_HUD_selection), r, g, b);
SPR_DrawAdditive(0, x, y, &gHUD.GetSpriteRect(m_HUD_selection));
SPR_Set(hSprSelection, r, g, b);
SPR_DrawAdditive(0, x, y, &rcSprSelection);
}
else
{
Expand All @@ -1160,15 +1171,23 @@ int CHudAmmo::DrawWList(float flTime)
ScaleColors(r, g, b, a);
}

SPR_Set(p->hInactive, r, g, b);
SPR_DrawAdditive(0, x, y, &p->rcInactive);
if (p->hInactive)
{
SPR_Set(p->hInactive, r, g, b);
SPR_DrawAdditive(0, x, y, &p->rcInactive);
}
else
{
// Pink rect
gEngfuncs.pfnFillRGBA(x, y, rcSprSelection.right - rcSprSelection.left, rcSprSelection.bottom - rcSprSelection.top, 48, 0, 48, a);
}
}

// Draw Ammo Bar

DrawAmmoBar(p, x + giABWidth / 2, y, giABWidth, giABHeight);

y += p->rcActive.bottom - p->rcActive.top + 5;
y += rcSprSelection.bottom - rcSprSelection.top + 5;
}

x += iWidth + 5;
Expand Down

0 comments on commit f758899

Please sign in to comment.