From 1406c11f8e8770b509bdc44c98a814d98731aba2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 2 Dec 2018 09:42:45 +0100 Subject: [PATCH] - 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. --- src/g_shared/shared_hud.cpp | 1 + wadsrc/static/zscript/statusbar/alt_hud.txt | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/g_shared/shared_hud.cpp b/src/g_shared/shared_hud.cpp index 3fe49f72a..bd4410fcb 100644 --- a/src/g_shared/shared_hud.cpp +++ b/src/g_shared/shared_hud.cpp @@ -701,6 +701,7 @@ void DrawHUD() althud->IntVar("statspace") = statspace; althud->IntVar("healthpic") = healthpic? healthpic->id.GetIndex() : -1; althud->IntVar("berserkpic") = berserkpic? berserkpic->id.GetIndex() : -1; + althud->IntVar("tnt1a0") = tnt1a0.GetIndex(); althud->PointerVar("HUDFont") = HudFont; if (!automapactive) diff --git a/wadsrc/static/zscript/statusbar/alt_hud.txt b/wadsrc/static/zscript/statusbar/alt_hud.txt index e4691a655..b016677a2 100644 --- a/wadsrc/static/zscript/statusbar/alt_hud.txt +++ b/wadsrc/static/zscript/statusbar/alt_hud.txt @@ -43,6 +43,7 @@ DVector2 AM_GetPosition(); class AltHud { TextureID healthPic, berserkPic; + TextureID tnt1a0; int hudwidth, hudheight; int statspace; Font HudFont; // The font for the health and armor display @@ -297,9 +298,10 @@ class AltHud if (state != null) icon = state.GetSpriteTexture(0); 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); return true;