From d2341d3bbcccecab981a2b6c497824154da713cb Mon Sep 17 00:00:00 2001 From: svdijk Date: Sat, 20 Sep 2014 15:57:33 +0000 Subject: [PATCH] Revert r731 ("Make the key menu scrollable"). In hindsight this really was "shooting a cannon at a mosquito". Even at a resolution of 320x200 we don't actually draw any keybindings off-screen, we just draw the last one very close to the edge (similar to the version string in the bottom right of the console). Although that is not visually pleasing, it is not that likely to actually occur (not many people will use a resolution of 320x200 or set the 2D scaling to the maximum value), and is not worth always having one keybinding "missing" at any scale setting. (If we even want/need to readd this, it should work dynamically, e.g. calculate a "virtual resolution" from the actual window resolution and the actual 2D scaling value.) git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1039 af15c1b1-3010-417e-b628-4374ebc0bcbd --- quakespasm/Quake/gl_draw.c | 35 +++-------------------------------- quakespasm/Quake/menu.c | 26 +++++--------------------- 2 files changed, 8 insertions(+), 53 deletions(-) diff --git a/quakespasm/Quake/gl_draw.c b/quakespasm/Quake/gl_draw.c index 41dffc62..fbc632b1 100644 --- a/quakespasm/Quake/gl_draw.c +++ b/quakespasm/Quake/gl_draw.c @@ -34,7 +34,6 @@ qpic_t *draw_backtile; gltexture_t *char_texture; //johnfitz qpic_t *pic_ovr, *pic_ins; //johnfitz -- new cursor handling qpic_t *pic_nul; //johnfitz -- for missing gfx, don't crash -qpic_t *pic_up, *pic_down; //QuakeSpasm -- menu scrolling //johnfitz -- new pics byte pic_ovr_data[8][8] = @@ -99,32 +98,6 @@ byte pic_crosshair_data[8][8] = }; //johnfitz -//QuakeSpasm -- new pics -byte pic_up_data[8][8] = -{ - {255,255,255,255,255,255,255,255}, - {255,255,255,255,255,255,255,255}, - {255,255,255, 7,255,255,255,255}, - {255,255, 8, 8, 7,255,255,255}, - {255, 8, 4, 8, 4, 7,255,255}, - {255,255, 2, 8, 2, 2, 2,255}, - {255,255,255, 8, 2,255,255,255}, - {255,255,255,255, 2,255,255,255}, -}; - -byte pic_down_data[8][8] = -{ - {255,255,255,255,255,255,255,255}, - {255,255,255,255,255,255,255,255}, - {255,255,255, 8,255,255,255,255}, - {255,255,255, 8, 2,255,255,255}, - {255, 8, 4, 8, 4, 7,255,255}, - {255,255, 8, 8, 7, 2, 2,255}, - {255,255,255, 7, 2, 2,255,255}, - {255,255,255,255, 2,255,255,255}, -}; -//QuakeSpasm - typedef struct { gltexture_t *gltexture; @@ -433,11 +406,9 @@ void Draw_Init (void) Scrap_Upload (); //creates 2 empty textures // create internal pics - pic_ins = Draw_MakePic ("ins", 8, 9, &pic_ins_data[0][0]); - pic_ovr = Draw_MakePic ("ovr", 8, 8, &pic_ovr_data[0][0]); - pic_nul = Draw_MakePic ("nul", 8, 8, &pic_nul_data[0][0]); - pic_up = Draw_MakePic ("up", 8, 8, &pic_up_data[0][0]); - pic_down = Draw_MakePic ("down", 8, 8, &pic_down_data[0][0]); + pic_ins = Draw_MakePic ("ins", 8, 9, &pic_ins_data[0][0]); + pic_ovr = Draw_MakePic ("ovr", 8, 8, &pic_ovr_data[0][0]); + pic_nul = Draw_MakePic ("nul", 8, 8, &pic_nul_data[0][0]); // load game pics Draw_LoadPics (); diff --git a/quakespasm/Quake/menu.c b/quakespasm/Quake/menu.c index 8dad77c8..33fdf1c7 100644 --- a/quakespasm/Quake/menu.c +++ b/quakespasm/Quake/menu.c @@ -1289,11 +1289,8 @@ const char *bindnames[][2] = #define NUMCOMMANDS (sizeof(bindnames)/sizeof(bindnames[0])) -#define KEYS_SIZE 18 - static int keys_cursor; qboolean m_keys_bind_grab; -static int keys_top; void M_Menu_Keys_f (void) { @@ -1365,22 +1362,14 @@ void M_Keys_Draw (void) else M_Print (18, 32, "Enter to change, backspace to clear"); - if (keys_top) - M_DrawTransPic (6, 48, pic_up); - if (keys_top + KEYS_SIZE < (int)NUMCOMMANDS) - M_DrawTransPic (6, 48 + ((KEYS_SIZE-1)*8), pic_down); - // search for known bindings - for (i = 0; i < KEYS_SIZE; i++) + for (i = 0; i < (int)NUMCOMMANDS; i++) { - if (i+keys_top >= (int)NUMCOMMANDS) - break; - y = 48 + 8*i; - M_Print (16, y, bindnames[i+keys_top][1]); + M_Print (16, y, bindnames[i][1]); - M_FindKeysForCommand (bindnames[i+keys_top][0], keys); + M_FindKeysForCommand (bindnames[i][0], keys); if (keys[0] == -1) { @@ -1400,9 +1389,9 @@ void M_Keys_Draw (void) } if (m_keys_bind_grab) - M_DrawCharacter (130, 48 + (keys_cursor-keys_top)*8, '='); + M_DrawCharacter (130, 48 + keys_cursor*8, '='); else - M_DrawCharacter (130, 48 + (keys_cursor-keys_top)*8, 12+((int)(realtime*4)&1)); + M_DrawCharacter (130, 48 + keys_cursor*8, 12+((int)(realtime*4)&1)); } @@ -1462,11 +1451,6 @@ void M_Keys_Key (int k) M_UnbindCommand (bindnames[keys_cursor][0]); break; } - - if (keys_cursor < keys_top) - keys_top = keys_cursor; - else if (keys_cursor >= keys_top+KEYS_SIZE) - keys_top = keys_cursor - KEYS_SIZE + 1; } //=============================================================================