]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud.qc
bigfont for health/armor and powerups
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud.qc
index b08d89afe14abcec3f35e37c373d9a9965e0117c..4ec5852d4d008313f3601806999babd06c849ded 100644 (file)
@@ -86,48 +86,25 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the
 // TODO: make a default skin, and fallback to these!
 
 // drawpic wrapper to draw an image as large as possible with preserved aspect ratio into a box
-void drawpic_aspect_skin(vector pos, string pic, vector sz, vector color, float alpha, float drawflag) {
-       pic = strcat(hud_skin_path, "/", pic);
-
-       vector imgsize;
-       imgsize = drawgetimagesize(pic);
-       float imgaspect;
-       imgaspect = imgsize_x/imgsize_y;
-
-       vector oldsz;
-       oldsz = sz;
-       float aspect;
-       aspect = sz_x/sz_y;
-
-       if(aspect > imgaspect) {
-               sz_x = sz_y * imgaspect;
-               drawpic(pos + eX * (oldsz_x - sz_x) * 0.5, pic, sz, color, alpha, drawflag);
-       } else {
-               sz_y = sz_x / imgaspect; 
-               drawpic(pos + eY * (oldsz_y - sz_y) * 0.5, pic, sz, color, alpha, drawflag);
-       }
-}
-
-// drawpic wrapper to draw an image as large as possible with preserved aspect ratio into a box
-void drawpic_aspect(vector pos, string pic, vector sz, vector color, float alpha, float drawflag) {
-       vector imgsize;
-       imgsize = drawgetimagesize(pic);
-       float imgaspect;
-       imgaspect = imgsize_x/imgsize_y;
-
-       vector oldsz;
-       oldsz = sz;
-       float aspect;
-       aspect = sz_x/sz_y;
-
-       if(aspect > imgaspect) {
-               sz_x = sz_y * imgaspect;
-               drawpic(pos + eX * (oldsz_x - sz_x) * 0.5, pic, sz, color, alpha, drawflag);
-       } else {
-               sz_y = sz_x / imgaspect; 
-               drawpic(pos + eY * (oldsz_y - sz_y) * 0.5, pic, sz, color, alpha, drawflag);
-       }
-}
+var float imgaspect;
+var float aspect;
+#define drawpic_aspect(pos,pic,mySize,color,alpha,drawflag)\
+       vector imgsize;\
+       imgsize = drawgetimagesize(pic);\
+       imgaspect = imgsize_x/imgsize_y;\
+       vector oldsz, sz;\
+       oldsz = sz = mySize;\
+       aspect = sz_x/sz_y;\
+       if(aspect > imgaspect) {\
+               sz_x = sz_y * imgaspect;\
+               drawpic(pos + eX * (oldsz_x - sz_x) * 0.5, pic, sz, color, alpha, drawflag);\
+       } else {\
+               sz_y = sz_x / imgaspect;\
+               drawpic(pos + eY * (oldsz_y - sz_y) * 0.5, pic, sz, color, alpha, drawflag);\
+       }
+
+#define drawpic_aspect_skin(pos,pic,sz,color,alpha,drawflag)\
+       do {drawpic_aspect(pos, strcat(hud_skin_path, "/", pic), sz, color, alpha, drawflag) } while(0)
 
 // TODO: aspect!
 void drawpic_aspect_skin_expanding(vector pos, string pic, vector sz, vector rgb, float alpha, float flag, float fadelerp) {
@@ -657,22 +634,22 @@ vector HUD_Panel_CheckMove(vector myPos, vector mySize)
        targCenter = '0 0 0'; // shut up fteqcc, there IS a reference
 
        for (i = 0; i < HUD_PANEL_NUM; ++i) {
-               HUD_Panel_UpdatePosSizeForId(i)
-
                if(i == highlightedPanel || !panel_enabled)
                        continue;
 
-               targPos = panel_pos;
-               targSize = panel_size;
+               HUD_Panel_UpdatePosSizeForId(i)
+
+               panel_pos -= '1 1 0' * panel_bg_border;
+               panel_size += '2 2 0' * panel_bg_border;
 
-               if(myPos_y + mySize_y < targPos_y)
+               if(myPos_y + mySize_y < panel_pos_y)
                        continue;
-               if(myPos_y > targPos_y + targSize_y)
+               if(myPos_y > panel_pos_y + panel_size_y)
                        continue;
 
-               if(myPos_x + mySize_x < targPos_x)
+               if(myPos_x + mySize_x < panel_pos_x)
                        continue;
-               if(myPos_x > targPos_x + targSize_x)
+               if(myPos_x > panel_pos_x + panel_size_x)
                        continue;
 
                // OK, there IS a collision.
@@ -680,37 +657,39 @@ vector HUD_Panel_CheckMove(vector myPos, vector mySize)
                myCenter_x = myPos_x + 0.5 * mySize_x;
                myCenter_y = myPos_y + 0.5 * mySize_y;
 
-               targCenter_x = targPos_x + 0.5 * targSize_x;
-               targCenter_y = targPos_y + 0.5 * targSize_y;
+               targCenter_x = panel_pos_x + 0.5 * panel_size_x;
+               targCenter_y = panel_pos_y + 0.5 * panel_size_y;
 
                if(myCenter_x < targCenter_x && myCenter_y < targCenter_y) // top left (of the target panel)
                {
-                       if(myPos_x + mySize_x - targPos_x < myPos_y + mySize_y - targPos_y) // push it to the side
-                               myTarget_x = targPos_x - mySize_x;
+                       if(myPos_x + mySize_x - panel_pos_x < myPos_y + mySize_y - panel_pos_y) // push it to the side
+                               myTarget_x = panel_pos_x - mySize_x;
                        else // push it upwards
-                               myTarget_y = targPos_y - mySize_y;
+                               myTarget_y = panel_pos_y - mySize_y;
                }
                else if(myCenter_x > targCenter_x && myCenter_y < targCenter_y) // top right
                {
-                       if(targPos_x + targSize_x - myPos_x < myPos_y + mySize_y - targPos_y) // push it to the side
-                               myTarget_x = targPos_x + targSize_x;
+                       if(panel_pos_x + panel_size_x - myPos_x < myPos_y + mySize_y - panel_pos_y) // push it to the side
+                               myTarget_x = panel_pos_x + panel_size_x;
                        else // push it upwards
-                               myTarget_y = targPos_y - mySize_y;
+                               myTarget_y = panel_pos_y - mySize_y;
                }
                else if(myCenter_x < targCenter_x && myCenter_y > targCenter_y) // bottom left
                {
-                       if(myPos_x + mySize_x - targPos_x < targPos_y + targSize_y - myPos_y) // push it to the side
-                               myTarget_x = targPos_x - mySize_x;
+                       if(myPos_x + mySize_x - panel_pos_x < panel_pos_y + panel_size_y - myPos_y) // push it to the side
+                               myTarget_x = panel_pos_x - mySize_x;
                        else // push it downwards
-                               myTarget_y = targPos_y + targSize_y;
+                               myTarget_y = panel_pos_y + panel_size_y;
                }
                else if(myCenter_x > targCenter_x && myCenter_y > targCenter_y) // bottom right
                {
-                       if(targPos_x + targSize_x - myPos_x < targPos_y + targSize_y - myPos_y) // push it to the side
-                               myTarget_x = targPos_x + targSize_x;
+                       if(panel_pos_x + panel_size_x - myPos_x < panel_pos_y + panel_size_y - myPos_y) // push it to the side
+                               myTarget_x = panel_pos_x + panel_size_x;
                        else // push it downwards
-                               myTarget_y = targPos_y + targSize_y;
+                               myTarget_y = panel_pos_y + panel_size_y;
                }
+               if(cvar("hud_configure_checkcollisions_debug"))
+                       drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
        }
 
        return myTarget;
@@ -722,18 +701,21 @@ void HUD_Panel_SetPos(vector pos)
        vector mySize;
        mySize = panel_size;
 
+       if(cvar("hud_configure_checkcollisions_debug"))
+               drawfill(pos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
+
+       if(autocvar_hud_configure_grid)
+       {
+               pos_x = floor((pos_x/vid_conwidth)/bound(0.005, autocvar_hud_configure_grid_xsize, 0.2) + 0.5) * bound(0.005, autocvar_hud_configure_grid_xsize, 0.2) * vid_conwidth;
+               pos_y = floor((pos_y/vid_conheight)/bound(0.005, autocvar_hud_configure_grid_ysize, 0.2) + 0.5) * bound(0.005, autocvar_hud_configure_grid_ysize, 0.2) * vid_conheight;
+       }
+
        if(hud_configure_checkcollisions)
                pos = HUD_Panel_CheckMove(pos, mySize);
 
        pos_x = bound(0, pos_x, vid_conwidth - mySize_x);
        pos_y = bound(0, pos_y, vid_conheight - mySize_y);
 
-       if(autocvar_hud_configure_grid)
-       {
-               pos_x = floor((pos_x/vid_conwidth)/bound(0.005, autocvar_hud_configure_grid_x, 0.2) + 0.5) * bound(0.005, autocvar_hud_configure_grid_x, 0.2) * vid_conwidth;
-               pos_y = floor((pos_y/vid_conheight)/bound(0.005, autocvar_hud_configure_grid_y, 0.2) + 0.5) * bound(0.005, autocvar_hud_configure_grid_y, 0.2) * vid_conheight;
-       }
-
        string s;
        s = strcat(ftos(pos_x/vid_conwidth), " ", ftos(pos_y/vid_conheight));
 
@@ -755,25 +737,26 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
        ratio = mySize_x/mySize_y;
 
        for (i = 0; i < HUD_PANEL_NUM; ++i) {
-               HUD_Panel_UpdatePosSizeForId(i)
-
                if(i == highlightedPanel || !panel_enabled)
                        continue;
 
-               targPos = panel_pos;
-               targSize = panel_size;
-               targEndPos = targPos + targSize;
+               HUD_Panel_UpdatePosSizeForId(i)
+
+               panel_pos -= '1 1 0' * panel_bg_border;
+               panel_size += '2 2 0' * panel_bg_border;
+
+               targEndPos = panel_pos + panel_size;
 
                // resizeorigin is WITHIN target panel, just abort any collision testing against that particular panel to produce expected behaviour!
-               if(resizeorigin_x > targPos_x && resizeorigin_x < targEndPos_x && resizeorigin_y > targPos_y && resizeorigin_y < targEndPos_y)
+               if(resizeorigin_x > panel_pos_x && resizeorigin_x < targEndPos_x && resizeorigin_y > panel_pos_y && resizeorigin_y < targEndPos_y)
                        continue;
 
                if (resizeCorner == 1)
                {
                        // check if this panel is on our way
-                       if (resizeorigin_x <= targPos_x)
+                       if (resizeorigin_x <= panel_pos_x)
                                continue;
-                       if (resizeorigin_y <= targPos_y)
+                       if (resizeorigin_y <= panel_pos_y)
                                continue;
                        if (targEndPos_x <= resizeorigin_x - mySize_x)
                                continue;
@@ -788,7 +771,7 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
                        // in this case resizeorigin (bottom-right point) and the bottom-right point of the panel
                        dist_x = resizeorigin_x - targEndPos_x;
                        dist_y = resizeorigin_y - targEndPos_y;
-                       if (dist_y < 0 || dist_x / dist_y > ratio)
+                       if (dist_y <= 0 || dist_x / dist_y > ratio)
                                mySize_x = min(mySize_x, dist_x);
                        else
                                mySize_y = min(mySize_y, dist_y);
@@ -797,34 +780,34 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
                {
                        if (resizeorigin_x >= targEndPos_x)
                                continue;
-                       if (resizeorigin_y <= targPos_y)
+                       if (resizeorigin_y <= panel_pos_y)
                                continue;
-                       if (targPos_x >= resizeorigin_x + mySize_x)
+                       if (panel_pos_x >= resizeorigin_x + mySize_x)
                                continue;
                        if (targEndPos_y <= resizeorigin_y - mySize_y)
                                continue;
 
-                       dist_x = targPos_x - resizeorigin_x;
+                       dist_x = panel_pos_x - resizeorigin_x;
                        dist_y = resizeorigin_y - targEndPos_y;
-                       if (dist_y < 0 || dist_x / dist_y > ratio)
+                       if (dist_y <= 0 || dist_x / dist_y > ratio)
                                mySize_x = min(mySize_x, dist_x);
                        else
                                mySize_y = min(mySize_y, dist_y);
                }
                else if (resizeCorner == 3)
                {
-                       if (resizeorigin_x <= targPos_x)
+                       if (resizeorigin_x <= panel_pos_x)
                                continue;
                        if (resizeorigin_y >= targEndPos_y)
                                continue;
                        if (targEndPos_x <= resizeorigin_x - mySize_x)
                                continue;
-                       if (targPos_y >= resizeorigin_y + mySize_y)
+                       if (panel_pos_y >= resizeorigin_y + mySize_y)
                                continue;
 
                        dist_x = resizeorigin_x - targEndPos_x;
-                       dist_y = targPos_y - resizeorigin_y;
-                       if (dist_y < 0 || dist_x / dist_y > ratio)
+                       dist_y = panel_pos_y - resizeorigin_y;
+                       if (dist_y <= 0 || dist_x / dist_y > ratio)
                                mySize_x = min(mySize_x, dist_x);
                        else
                                mySize_y = min(mySize_y, dist_y);
@@ -835,20 +818,20 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
                                continue;
                        if (resizeorigin_y >= targEndPos_y)
                                continue;
-                       if (targPos_x >= resizeorigin_x + mySize_x)
+                       if (panel_pos_x >= resizeorigin_x + mySize_x)
                                continue;
-                       if (targPos_y >= resizeorigin_y + mySize_y)
+                       if (panel_pos_y >= resizeorigin_y + mySize_y)
                                continue;
 
-                       dist_x = targPos_x - resizeorigin_x;
-                       dist_y = targPos_y - resizeorigin_y;
-                       if (dist_y < 0 || dist_x / dist_y > ratio)
+                       dist_x = panel_pos_x - resizeorigin_x;
+                       dist_y = panel_pos_y - resizeorigin_y;
+                       if (dist_y <= 0 || dist_x / dist_y > ratio)
                                mySize_x = min(mySize_x, dist_x);
                        else
                                mySize_y = min(mySize_y, dist_y);
                }
                if(cvar("hud_configure_checkcollisions_debug"))
-                       drawfill(targPos, targSize, '1 1 0', .3, DRAWFLAG_NORMAL);
+                       drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
        }
 
        return mySize;
@@ -907,8 +890,8 @@ void HUD_Panel_SetPosSize(vector mySize)
        // before checkresize, otherwise panel can be snapped partially inside another panel or panel aspect ratio can be broken
        if(autocvar_hud_configure_grid)
        {
-               mySize_x = floor((mySize_x/vid_conwidth)/bound(0.005, autocvar_hud_configure_grid_x, 0.2) + 0.5) * bound(0.005, autocvar_hud_configure_grid_x, 0.2) * vid_conwidth;
-               mySize_y = floor((mySize_y/vid_conheight)/bound(0.005, autocvar_hud_configure_grid_y, 0.2) + 0.5) * bound(0.005, autocvar_hud_configure_grid_y, 0.2) * vid_conheight;
+               mySize_x = floor((mySize_x/vid_conwidth)/bound(0.005, autocvar_hud_configure_grid_xsize, 0.2) + 0.5) * bound(0.005, autocvar_hud_configure_grid_xsize, 0.2) * vid_conwidth;
+               mySize_y = floor((mySize_y/vid_conheight)/bound(0.005, autocvar_hud_configure_grid_ysize, 0.2) + 0.5) * bound(0.005, autocvar_hud_configure_grid_ysize, 0.2) * vid_conheight;
        }
 
        if(hud_configure_checkcollisions)
@@ -966,16 +949,16 @@ void HUD_Panel_Arrow_Action(float nPrimary)
                if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
                {
                        if (hudShiftState & S_SHIFT)
-                               step = bound(0.005, autocvar_hud_configure_grid_y, 0.2) * vid_conheight;
+                               step = bound(0.005, autocvar_hud_configure_grid_ysize, 0.2) * vid_conheight;
                        else
-                               step = 2 * bound(0.005, autocvar_hud_configure_grid_y, 0.2) * vid_conheight;
+                               step = 2 * bound(0.005, autocvar_hud_configure_grid_ysize, 0.2) * vid_conheight;
                }
                else
                {
                        if (hudShiftState & S_SHIFT)
-                               step = bound(0.005, autocvar_hud_configure_grid_x, 0.2) * vid_conwidth;
+                               step = bound(0.005, autocvar_hud_configure_grid_xsize, 0.2) * vid_conwidth;
                        else
-                               step = 2 * bound(0.005, autocvar_hud_configure_grid_x, 0.2) * vid_conwidth;
+                               step = 2 * bound(0.005, autocvar_hud_configure_grid_xsize, 0.2) * vid_conwidth;
                }
        }
        else
@@ -1386,7 +1369,7 @@ void HUD_WeaponIcons(void)
                heapsort(weapon_cnt, weaponorder_swap, weaponorder_cmp, world);
        }
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -1636,7 +1619,7 @@ void HUD_Inventory(void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -1748,7 +1731,7 @@ void HUD_Powerups(void) {
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -1794,6 +1777,7 @@ void HUD_Powerups(void) {
        leftalpha = bound(0, leftexact, 1);
        rightalpha = bound(0, rightexact, 1);
 
+       drawfont = hud_bigfont;
        if (mySize_x/mySize_y > 4)
        {
                if(leftcnt)
@@ -1919,6 +1903,7 @@ void HUD_Powerups(void) {
                        drawstring_aspect(numpos, ftos(rightcnt), eX * 0.5 * mySize_x + eY * 0.25 * mySize_x, 0.25 * mySize_x, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                }
        }
+       drawfont = hud_font;
 }
 
 // Health/armor (#3)
@@ -1931,7 +1916,7 @@ void HUD_HealthArmor(void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -1959,6 +1944,7 @@ void HUD_HealthArmor(void)
        vector picpos;
        vector numpos;
 
+       drawfont = hud_bigfont;
        if(autocvar_hud_healtharmor == 2) // combined health and armor display
        {
                vector v;
@@ -2192,6 +2178,7 @@ void HUD_HealthArmor(void)
                        }
                }
        }
+       drawfont = hud_font;
 }
 
 // ___TODO___ !!!
@@ -2662,7 +2649,7 @@ void HUD_Notify (void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -3073,7 +3060,7 @@ void HUD_Timer(void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -3125,7 +3112,7 @@ void HUD_Radar(void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -3250,7 +3237,7 @@ void HUD_Score(void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -3400,7 +3387,7 @@ void HUD_RaceTimer (void) {
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -3585,7 +3572,7 @@ void HUD_VoteWindow(void)
 
        a = vote_alpha * bound(autocvar_hud_vote_alreadyvoted_alpha, 1 - vote_highlighted, 1);
 
-       HUD_Panel_DrawBg(id, pos, mySize, a);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -4153,7 +4140,7 @@ void HUD_ModIcons(void)
                mod_alpha = bound(0, 1 - (time - mod_change) * 2, 1);
 
        if(mod_alpha)
-               HUD_Panel_DrawBg(id, pos, mySize, mod_alpha);
+               HUD_Panel_DrawBg(mod_alpha);
 
        if(panel_bg_padding)
        {
@@ -4182,7 +4169,7 @@ void HUD_DrawPressedKeys(void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -4212,7 +4199,7 @@ void HUD_Chat(void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -4261,7 +4248,7 @@ void HUD_EngineInfo(void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -4436,16 +4423,17 @@ void HUD_Main (void)
        {
                float i;
                // x-axis
-               for(i = 0; i < 1/bound(0.005, autocvar_hud_configure_grid_x, 0.2); ++i)
+               for(i = 0; i < 1/bound(0.005, autocvar_hud_configure_grid_xsize, 0.2); ++i)
                {
-                       drawfill(eX * i * vid_conwidth * bound(0.005, autocvar_hud_configure_grid_x, 0.2), eX + eY * vid_conheight, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
+                       drawfill(eX * i * vid_conwidth * bound(0.005, autocvar_hud_configure_grid_xsize, 0.2), eX + eY * vid_conheight, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
                }
                // y-axis
-               for(i = 0; i < 1/bound(0.005, autocvar_hud_configure_grid_y, 0.2); ++i)
+               for(i = 0; i < 1/bound(0.005, autocvar_hud_configure_grid_ysize, 0.2); ++i)
                {
-                       drawfill(eY * i * vid_conheight * bound(0.005, autocvar_hud_configure_grid_y, 0.2), eY + eX * vid_conwidth, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
+                       drawfill(eY * i * vid_conheight * bound(0.005, autocvar_hud_configure_grid_ysize, 0.2), eY + eX * vid_conwidth, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
                }
        }
+       print("grid_xsize: ", ftos(autocvar_hud_configure_grid_xsize), "\n");
 
        float f;
        vector color;