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
This commit is contained in:
svdijk 2014-09-20 15:57:33 +00:00
parent 58f607c014
commit d2341d3bbc
2 changed files with 8 additions and 53 deletions

View file

@ -34,7 +34,6 @@ qpic_t *draw_backtile;
gltexture_t *char_texture; //johnfitz gltexture_t *char_texture; //johnfitz
qpic_t *pic_ovr, *pic_ins; //johnfitz -- new cursor handling qpic_t *pic_ovr, *pic_ins; //johnfitz -- new cursor handling
qpic_t *pic_nul; //johnfitz -- for missing gfx, don't crash qpic_t *pic_nul; //johnfitz -- for missing gfx, don't crash
qpic_t *pic_up, *pic_down; //QuakeSpasm -- menu scrolling
//johnfitz -- new pics //johnfitz -- new pics
byte pic_ovr_data[8][8] = byte pic_ovr_data[8][8] =
@ -99,32 +98,6 @@ byte pic_crosshair_data[8][8] =
}; };
//johnfitz //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 typedef struct
{ {
gltexture_t *gltexture; gltexture_t *gltexture;
@ -433,11 +406,9 @@ void Draw_Init (void)
Scrap_Upload (); //creates 2 empty textures Scrap_Upload (); //creates 2 empty textures
// create internal pics // create internal pics
pic_ins = Draw_MakePic ("ins", 8, 9, &pic_ins_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_ovr = Draw_MakePic ("ovr", 8, 8, &pic_ovr_data[0][0]);
pic_nul = Draw_MakePic ("nul", 8, 8, &pic_nul_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]);
// load game pics // load game pics
Draw_LoadPics (); Draw_LoadPics ();

View file

@ -1289,11 +1289,8 @@ const char *bindnames[][2] =
#define NUMCOMMANDS (sizeof(bindnames)/sizeof(bindnames[0])) #define NUMCOMMANDS (sizeof(bindnames)/sizeof(bindnames[0]))
#define KEYS_SIZE 18
static int keys_cursor; static int keys_cursor;
qboolean m_keys_bind_grab; qboolean m_keys_bind_grab;
static int keys_top;
void M_Menu_Keys_f (void) void M_Menu_Keys_f (void)
{ {
@ -1365,22 +1362,14 @@ void M_Keys_Draw (void)
else else
M_Print (18, 32, "Enter to change, backspace to clear"); 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 // 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; 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) if (keys[0] == -1)
{ {
@ -1400,9 +1389,9 @@ void M_Keys_Draw (void)
} }
if (m_keys_bind_grab) if (m_keys_bind_grab)
M_DrawCharacter (130, 48 + (keys_cursor-keys_top)*8, '='); M_DrawCharacter (130, 48 + keys_cursor*8, '=');
else 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]); M_UnbindCommand (bindnames[keys_cursor][0]);
break; 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;
} }
//============================================================================= //=============================================================================