Also apply gl_hudscale cvar to the inventory.

This commit is contained in:
svdijk 2014-05-04 21:05:56 +02:00
parent ba16e501d2
commit d823940370
2 changed files with 19 additions and 15 deletions

View file

@ -38,12 +38,12 @@ CL_ParseInventory(void)
} }
static void static void
Inv_DrawString(int x, int y, char *string) Inv_DrawStringScaled(int x, int y, char *string, float factor)
{ {
while (*string) while (*string)
{ {
Draw_Char(x, y, *string); Draw_CharScaled(x, y, *string, factor);
x += 8; x += factor*8;
string++; string++;
} }
} }
@ -59,6 +59,9 @@ SetStringHighBit(char *s)
#define DISPLAY_ITEMS 17 #define DISPLAY_ITEMS 17
// from r_main.c
extern cvar_t *gl_hudscale;
void void
CL_DrawInventory(void) CL_DrawInventory(void)
{ {
@ -77,6 +80,8 @@ CL_DrawInventory(void)
num = 0; num = 0;
selected_num = 0; selected_num = 0;
float scale = gl_hudscale->value;
for (i = 0; i < MAX_ITEMS; i++) for (i = 0; i < MAX_ITEMS; i++)
{ {
if (i == selected) if (i == selected)
@ -104,21 +109,21 @@ CL_DrawInventory(void)
top = 0; top = 0;
} }
x = (viddef.width - 256) / 2; x = (viddef.width - scale*256) / 2;
y = (viddef.height - 240) / 2; y = (viddef.height - scale*240) / 2;
/* repaint everything next frame */ /* repaint everything next frame */
SCR_DirtyScreen(); SCR_DirtyScreen();
Draw_Pic(x, y + 8, "inventory"); Draw_PicScaled(x, y + scale*8, "inventory", scale);
y += 24; y += scale*24;
x += 24; x += scale*24;
Inv_DrawString(x, y, "hotkey ### item"); Inv_DrawStringScaled(x, y, "hotkey ### item", scale);
Inv_DrawString(x, y + 8, "------ --- ----"); Inv_DrawStringScaled(x, y + scale*8, "------ --- ----", scale);
y += 16; y += scale*16;
for (i = top; i < num && i < top + DISPLAY_ITEMS; i++) for (i = top; i < num && i < top + DISPLAY_ITEMS; i++)
{ {
@ -149,13 +154,13 @@ CL_DrawInventory(void)
/* draw a blinky cursor by the selected item */ /* draw a blinky cursor by the selected item */
if ((int)(cls.realtime * 10) & 1) if ((int)(cls.realtime * 10) & 1)
{ {
Draw_Char(x - 8, y, 15); Draw_CharScaled(x - scale*8, y, 15, scale);
} }
} }
Inv_DrawString(x, y, string); Inv_DrawStringScaled(x, y, string, scale);
y += 8; y += scale*8;
} }
} }

View file

@ -1145,7 +1145,6 @@ SCR_ExecuteLayoutString(char *s)
token = COM_Parse(&s); token = COM_Parse(&s);
time = (int)strtol(token, (char **)NULL, 10); time = (int)strtol(token, (char **)NULL, 10);
// TODO: scale*
DrawAltStringScaled(x + scale*32, y, ci->name, scale); DrawAltStringScaled(x + scale*32, y, ci->name, scale);
DrawAltStringScaled(x + scale*32, y + scale*8, "Score: ", scale); DrawAltStringScaled(x + scale*32, y + scale*8, "Score: ", scale);
DrawAltStringScaled(x + scale*(32 + 7 * 8), y + scale*8, va("%i", score), scale); DrawAltStringScaled(x + scale*(32 + 7 * 8), y + scale*8, va("%i", score), scale);