From d3cc2dd95ea702425415c619d0515d488683a0d7 Mon Sep 17 00:00:00 2001 From: Brad Harding Date: Tue, 27 Aug 2024 16:05:12 +1000 Subject: [PATCH] Minor tweaks --- src/hu_stuff.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index c156820f4..a799f4745 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -204,13 +204,17 @@ void HU_Init(void) for (int i = 0; i < NUMWEAPONS; i++) { - int ammothing = weaponinfo[i].ammothing; - int spawnstate = mobjinfo[ammothing].spawnstate; - int sprite = states[spawnstate].sprite; - int frame = states[spawnstate].frame; - int lumpnum = firstspritelump + sprites[sprite].spriteframes[frame].lump[0]; + const int ammothing = weaponinfo[i].ammothing; - weaponinfo[i].ammopatch = W_CacheLumpNum(lumpnum); + if (ammothing == MT_NULL || !(mobjinfo[ammothing].flags & MF_SPECIAL)) + weaponinfo[i].ammopatch = NULL; + else + { + state_t *state = &states[mobjinfo[ammothing].spawnstate]; + + weaponinfo[i].ammopatch = W_CacheLumpNum(firstspritelump + + sprites[state->sprite].spriteframes[state->frame].lump[0]); + } } keypics[it_bluecard].patch = HU_LoadHUDKeyPatch(it_bluecard);