- added the missing TNT1A0 check for icon-less keys.

Since it tries to get the icon from the spawn state it also has to check if that actually has a valid sprite.
This commit is contained in:
Christoph Oelckers 2018-12-02 09:42:45 +01:00
parent fbc441673a
commit 1406c11f8e
2 changed files with 5 additions and 2 deletions

View File

@ -701,6 +701,7 @@ void DrawHUD()
althud->IntVar("statspace") = statspace; althud->IntVar("statspace") = statspace;
althud->IntVar("healthpic") = healthpic? healthpic->id.GetIndex() : -1; althud->IntVar("healthpic") = healthpic? healthpic->id.GetIndex() : -1;
althud->IntVar("berserkpic") = berserkpic? berserkpic->id.GetIndex() : -1; althud->IntVar("berserkpic") = berserkpic? berserkpic->id.GetIndex() : -1;
althud->IntVar("tnt1a0") = tnt1a0.GetIndex();
althud->PointerVar<FFont>("HUDFont") = HudFont; althud->PointerVar<FFont>("HUDFont") = HudFont;
if (!automapactive) if (!automapactive)

View File

@ -43,6 +43,7 @@ DVector2 AM_GetPosition();
class AltHud class AltHud
{ {
TextureID healthPic, berserkPic; TextureID healthPic, berserkPic;
TextureID tnt1a0;
int hudwidth, hudheight; int hudwidth, hudheight;
int statspace; int statspace;
Font HudFont; // The font for the health and armor display Font HudFont; // The font for the health and armor display
@ -297,9 +298,10 @@ class AltHud
if (state != null) icon = state.GetSpriteTexture(0); if (state != null) icon = state.GetSpriteTexture(0);
else icon.SetNull(); else icon.SetNull();
} }
if (icon.isNull()) icon = inv.Icon; // missing sprites map to TNT1A0. So if that gets encountered, use the default icon instead.
if (icon.isNull() || icon == tnt1a0) icon = inv.Icon;
if (icon.isValid()) if (icon.isValid())
{ {
DrawImageToBox(icon, x, y, 8, 10); DrawImageToBox(icon, x, y, 8, 10);
return true; return true;