From c5c490479f1173f317890ac04c3631c6361a3378 Mon Sep 17 00:00:00 2001 From: FruitieX Date: Tue, 29 Jun 2010 12:35:42 +0300 Subject: [PATCH] better handling of grid when editing with arrow keys, also hide the visible highlight when not in config mode :P --- qcsrc/client/hud.qc | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 4f8ce3572..737f67fac 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -787,7 +787,7 @@ void HUD_Panel_DrawBg(float id, vector pos, vector mySize, float alpha) draw_BorderPicture(pos - '1 1 0' * border, strcat("gfx/hud/", cvar_string("hud_skin"), "/", bg), mySize + '1 1 0' * 2 * border, color, alpha, '1 1 0' * (border/BORDER_MULTIPLIER)); } - if(highlightedPanel_prev == id) + if(highlightedPanel_prev == id && hud_configure) drawfill(pos - '1 1 0' * border, mySize + '1 1 0' * 2 * border, '1 1 1', .1 * (1 - cvar("_menu_alpha")), DRAWFLAG_ADDITIVE); } @@ -1132,14 +1132,34 @@ void HUD_Panel_Arrow_Action(float nPrimary) hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && cvar("hud_configure_checkcollisions")); float step; - if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW) - step = vid_conheight; - else - step = vid_conwidth; - if (hudShiftState & S_SHIFT) - step = (step / 256); // more precision + if(cvar("hud_configure_grid")) + { + if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW) + { + if (hudShiftState & S_SHIFT) + step = bound(0.005, cvar("hud_configure_grid_y"), 0.2) * vid_conheight; + else + step = 2 * bound(0.005, cvar("hud_configure_grid_y"), 0.2) * vid_conheight; + } + else + { + if (hudShiftState & S_SHIFT) + step = bound(0.005, cvar("hud_configure_grid_x"), 0.2) * vid_conwidth; + else + step = 2 * bound(0.005, cvar("hud_configure_grid_x"), 0.2) * vid_conwidth; + } + } else - step = (step / 64) * (1 + 2 * (time - pressed_key_time)); + { + if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW) + step = vid_conheight; + else + step = vid_conwidth; + if (hudShiftState & S_SHIFT) + step = (step / 256); // more precision + else + step = (step / 64) * (1 + 2 * (time - pressed_key_time)); + } highlightedPanel = highlightedPanel_prev; -- 2.39.2