From 1019198113c5dcb4ef7c7b704268d990fd88b31c Mon Sep 17 00:00:00 2001 From: Brad Harding Date: Wed, 28 Aug 2024 18:03:48 +1000 Subject: [PATCH] Further work on weapon silhouettes --- src/d_items.h | 1 + src/hu_stuff.c | 52 ++++++++++++++++++++++++++------------------------ src/hu_stuff.h | 3 +-- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/d_items.h b/src/d_items.h index ea3bc9f2b..4a8b1090b 100644 --- a/src/d_items.h +++ b/src/d_items.h @@ -83,6 +83,7 @@ typedef struct char key; bool altered; patch_t *weaponpatch; + int weapony; patch_t *ammopatch; } weaponinfo_t; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index f97b3c045..8a221c5dc 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -738,30 +738,28 @@ static altkeypic_t altkeypics[NUMCARDS] = { RED2, NULL, NULL } }; -static patch_t *altnumpatch[10]; -static patch_t *altnumpatch2[10]; -static patch_t *altminuspatch; -static patch_t *altendpatch; -static patch_t *altleftpatch1; -static patch_t *altleftpatch2; -static patch_t *altrightpatch; -static patch_t *altmarkpatch; -static patch_t *altmark2patch; - -static short altminuspatchwidth; - -static int gray; -static int darkgray; -static int green1; -static int green2; -static int green3; -static int blue2; -static int blue3; -static int red2; -static int yellow1; -static int yellow2; - -static bool weaponschanged; +static patch_t *altnumpatch[10]; +static patch_t *altnumpatch2[10]; +static patch_t *altminuspatch; +static patch_t *altendpatch; +static patch_t *altleftpatch1; +static patch_t *altleftpatch2; +static patch_t *altrightpatch; +static patch_t *altmarkpatch; +static patch_t *altmark2patch; + +static short altminuspatchwidth; + +static int gray; +static int darkgray; +static int green1; +static int green2; +static int green3; +static int blue2; +static int blue3; +static int red2; +static int yellow1; +static int yellow2; static void HU_AltInit(void) { @@ -825,11 +823,15 @@ static void HU_AltInit(void) weaponinfo[i].weaponpatch = W_CacheLumpNum(firstspritelump + sprites[state->sprite].spriteframes[state->frame].lump[0]); + weaponinfo[i].weapony = ALTHUD_Y + 10 - SHORT(weaponinfo[i].weaponpatch->height) / 2; } } if (!weaponinfo[wp_pistol].weaponpatch) + { weaponinfo[wp_pistol].weaponpatch = W_CacheLumpName("DRHUDWP1"); + weaponinfo[wp_pistol].weapony = ALTHUD_Y + 10 - SHORT(weaponinfo[wp_pistol].weaponpatch->height) / 2; + } gray = nearestcolors[GRAY1]; darkgray = nearestcolors[DARKGRAY1]; @@ -1265,7 +1267,7 @@ static void HU_DrawAltHUD(void) althudfunc(ALTHUD_RIGHT_X, ALTHUD_Y + 13, altrightpatch, WHITE, color, tinttab60); if ((patch = weaponinfo[weapon].weaponpatch)) - hudweaponfunc(ALTHUD_RIGHT_X + 108, ALTHUD_Y + 10 - SHORT(patch->height) / 2, patch, tinttab60); + hudweaponfunc(ALTHUD_RIGHT_X + 108, weaponinfo[weapon].weapony, patch, tinttab60); for (int i = 1; i <= NUMCARDS; i++) for (int j = 0; j < NUMCARDS; j++) diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 2acfb0d85..53b0e3658 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -77,8 +77,7 @@ #define HUD_KEY_WAIT 250 #define ALTHUD_LEFT_X (MAXWIDESCREENDELTA + 9) -#define ALTHUD_RIGHT_X (SCREENWIDTH - MAXWIDESCREENDELTA \ - - (weaponschanged && !fixspriteoffsets ? 76 : 128)) +#define ALTHUD_RIGHT_X (SCREENWIDTH - MAXWIDESCREENDELTA - 128) #define ALTHUD_Y (SCREENHEIGHT - 41) #define DRAWDISKTICS (12 * TICRATE)