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
This commit is contained in:
hendricks266 2013-04-14 06:42:58 +00:00
parent eb4031fe8f
commit 3cd85edac0

View file

@ -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) 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; n = (p->inv_amount[GET_JETPACK] > 0)<<3;
if (n&8) j++; if (n&8) j++;
@ -1103,11 +1108,27 @@ static void G_DrawInventory(const DukePlayer_t *p)
n |= (p->inv_amount[GET_BOOTS] > 0)<<6; n |= (p->inv_amount[GET_BOOTS] > 0)<<6;
if (n&64) j++; if (n&64) j++;
xoff = 160-(j*11); x = (160-(j*11))<<16; // nearly center
j = 0; 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) while (j <= 9)
{ {
@ -1116,32 +1137,32 @@ static void G_DrawInventory(const DukePlayer_t *p)
switch (n&(1<<j)) switch (n&(1<<j))
{ {
case 1: case 1:
rotatesprite_win(xoff<<16,y<<16,65536L,0,FIRSTAID_ICON,0,0,2+16); rotatesprite_win(x,y,65536L,0,FIRSTAID_ICON,0,0,2+16);
break; break;
case 2: case 2:
rotatesprite_win((xoff+1)<<16,y<<16,65536L,0,STEROIDS_ICON,0,0,2+16); rotatesprite_win(x+(1<<16),y,65536L,0,STEROIDS_ICON,0,0,2+16);
break; break;
case 4: case 4:
rotatesprite_win((xoff+2)<<16,y<<16,65536L,0,HOLODUKE_ICON,0,0,2+16); rotatesprite_win(x+(2<<16),y,65536L,0,HOLODUKE_ICON,0,0,2+16);
break; break;
case 8: case 8:
rotatesprite_win(xoff<<16,y<<16,65536L,0,JETPACK_ICON,0,0,2+16); rotatesprite_win(x,y,65536L,0,JETPACK_ICON,0,0,2+16);
break; break;
case 16: case 16:
rotatesprite_win(xoff<<16,y<<16,65536L,0,HEAT_ICON,0,0,2+16); rotatesprite_win(x,y,65536L,0,HEAT_ICON,0,0,2+16);
break; break;
case 32: case 32:
rotatesprite_win(xoff<<16,y<<16,65536L,0,AIRTANK_ICON,0,0,2+16); rotatesprite_win(x,y,65536L,0,AIRTANK_ICON,0,0,2+16);
break; break;
case 64: case 64:
rotatesprite_win(xoff<<16,(y-1)<<16,65536L,0,BOOT_ICON,0,0,2+16); rotatesprite_win(x,y-(1<<16),65536L,0,BOOT_ICON,0,0,2+16);
break; break;
} }
xoff += 22; x += 22<<16;
if (p->inven_icon == j+1) if (p->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++; j++;