mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
Make the key menu scrollable (otherwise we draw allmost-offscreen at max scale)
git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@731 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
9422f993a8
commit
4b342f6dc2
2 changed files with 55 additions and 9 deletions
|
@ -34,6 +34,7 @@ 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] =
|
||||
|
@ -98,6 +99,32 @@ 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, 5, 4, 2,255,255,255},
|
||||
{255, 3, 6, 4, 2, 1,255,255},
|
||||
{255, 6, 5, 4, 3, 2,255,255},
|
||||
{ 3, 6, 4, 4, 4, 2, 1,255},
|
||||
{ 6, 5, 4, 4, 4, 3, 2,255},
|
||||
{255,255,255,255,255,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},
|
||||
{ 6, 5, 4, 4, 4, 3, 2,255},
|
||||
{ 3, 6, 4, 4, 4, 2, 1,255},
|
||||
{255, 6, 5, 4, 3, 2,255,255},
|
||||
{255, 3, 6, 4, 2, 1,255,255},
|
||||
{255,255, 5, 4, 2,255,255,255},
|
||||
{255,255,255,255,255,255,255,255},
|
||||
};
|
||||
//QuakeSpasm
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gltexture_t *gltexture;
|
||||
|
@ -466,9 +493,11 @@ 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_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]);
|
||||
|
||||
// load game pics
|
||||
Draw_LoadPics ();
|
||||
|
|
29
Quake/menu.c
29
Quake/menu.c
|
@ -1282,8 +1282,11 @@ const char *bindnames[][2] =
|
|||
|
||||
#define NUMCOMMANDS (sizeof(bindnames)/sizeof(bindnames[0]))
|
||||
|
||||
int keys_cursor;
|
||||
#define KEYS_SIZE 15
|
||||
|
||||
static int keys_cursor;
|
||||
qboolean m_keys_bind_grab;
|
||||
static int keys_top;
|
||||
|
||||
void M_Menu_Keys_f (void)
|
||||
{
|
||||
|
@ -1345,6 +1348,7 @@ void M_Keys_Draw (void)
|
|||
int keys[2];
|
||||
const char *name;
|
||||
qpic_t *p;
|
||||
extern qpic_t *pic_up, *pic_down;
|
||||
|
||||
p = Draw_CachePic ("gfx/ttl_cstm.lmp");
|
||||
M_DrawPic ( (320-p->width)/2, 4, p);
|
||||
|
@ -1354,14 +1358,22 @@ void M_Keys_Draw (void)
|
|||
else
|
||||
M_Print (18, 32, "Enter to change, backspace to clear");
|
||||
|
||||
if (keys_top)
|
||||
Draw_Pic (6, 48, pic_up);
|
||||
if (keys_top + KEYS_SIZE < (int)NUMCOMMANDS)
|
||||
Draw_Pic (6, 48 + ((KEYS_SIZE-1)*8), pic_down);
|
||||
|
||||
// search for known bindings
|
||||
for (i = 0; i < (int)NUMCOMMANDS; i++)
|
||||
for (i = 0; i < KEYS_SIZE; i++)
|
||||
{
|
||||
if (i+keys_top >= (int)NUMCOMMANDS)
|
||||
break;
|
||||
|
||||
y = 48 + 8*i;
|
||||
|
||||
M_Print (16, y, bindnames[i][1]);
|
||||
M_Print (16, y, bindnames[i+keys_top][1]);
|
||||
|
||||
M_FindKeysForCommand (bindnames[i][0], keys);
|
||||
M_FindKeysForCommand (bindnames[i+keys_top][0], keys);
|
||||
|
||||
if (keys[0] == -1)
|
||||
{
|
||||
|
@ -1381,9 +1393,9 @@ void M_Keys_Draw (void)
|
|||
}
|
||||
|
||||
if (m_keys_bind_grab)
|
||||
M_DrawCharacter (130, 48 + keys_cursor*8, '=');
|
||||
M_DrawCharacter (130, 48 + (keys_cursor-keys_top)*8, '=');
|
||||
else
|
||||
M_DrawCharacter (130, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
|
||||
M_DrawCharacter (130, 48 + (keys_cursor-keys_top)*8, 12+((int)(realtime*4)&1));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1443,6 +1455,11 @@ 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;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
|
Loading…
Reference in a new issue