From 3cd85edac03b0c923266769c009682fea92626fa Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sun, 14 Apr 2013 06:42:58 +0000 Subject: [PATCH] Fix the inventory icon selector's positioning to match v1.5 (reported by Fox [1]). While we're at it, move it according to ud.statusbarscale for aesthetic purposes. [1] http://forums.duke4.net/topic/2961-paper-cuts-minor-bugs-and-annoyances/page__view__findpost__p__153060 git-svn-id: https://svn.eduke32.com/eduke32@3676 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 45 +++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 924381f6d..ec8326216 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -1084,9 +1084,14 @@ static void G_DrawAltDigiNum(int32_t x, int32_t y, int32_t n, char s, int32_t cs } } +static int32_t invensc(int32_t maximum) // used to reposition the inventory icon selector as the HUD scales +{ + return scale(maximum << 16, ud.statusbarscale - 36, 100 - 36); +} + static void G_DrawInventory(const DukePlayer_t *p) { - int32_t n, j = 0, xoff = 0, y; + int32_t n, j = 0, x = 0, y; n = (p->inv_amount[GET_JETPACK] > 0)<<3; if (n&8) j++; @@ -1103,11 +1108,27 @@ static void G_DrawInventory(const DukePlayer_t *p) n |= (p->inv_amount[GET_BOOTS] > 0)<<6; if (n&64) j++; - xoff = 160-(j*11); + x = (160-(j*11))<<16; // nearly center j = 0; - y = 154; + if (ud.screen_size < 8) // mini-HUDs or no HUD + { + y = 172<<16; + + if (ud.screen_size == 4 && ud.althud) // modern mini-HUD + y -= invensc(tilesizy[BIGALPHANUM]+10); // slide on the y-axis + } + else // full HUD + { + y = (200<<16) - (sbarsc(tilesizy[BOTTOMSTATUSBAR]<<16) + (12<<16) + (tilesizy[BOTTOMSTATUSBAR]<<(16-1))); + + if (!ud.statusbarmode) // original non-overlay mode + y += sbarsc(tilesizy[BOTTOMSTATUSBAR]<<16)>>1; // account for the viewport y-size as the HUD scales + } + + if (ud.screen_size == 4 && !ud.althud) // classic mini-HUD + x += invensc(ud.multimode > 1 ? 56 : 65); // slide on the x-axis while (j <= 9) { @@ -1116,32 +1137,32 @@ static void G_DrawInventory(const DukePlayer_t *p) switch (n&(1<inven_icon == j+1) - rotatesprite_win((xoff-2)<<16,(y+19)<<16,65536L,1024,ARROW,-32,0,2+16); + rotatesprite_win(x-(2<<16),y+(19<<16),65536L,1024,ARROW,-32,0,2+16); } j++;