mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
the menu cursor can now be moved up and down using the mouse wheel
This commit is contained in:
parent
29c19ca243
commit
b73851d5aa
2 changed files with 49 additions and 6 deletions
|
@ -31,6 +31,26 @@ void (string text, integer key) quit =
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void () single_player_menu =
|
||||||
|
{
|
||||||
|
Menu_Item (54, 32, "", NIL);
|
||||||
|
};
|
||||||
|
|
||||||
|
void () multi_player_menu =
|
||||||
|
{
|
||||||
|
Menu_Item (54, 52, "", NIL);
|
||||||
|
};
|
||||||
|
|
||||||
|
void () options_menu =
|
||||||
|
{
|
||||||
|
Menu_Item (54, 72, "", NIL);
|
||||||
|
};
|
||||||
|
|
||||||
|
void () help_menu =
|
||||||
|
{
|
||||||
|
Menu_Item (54, 92, "", NIL);
|
||||||
|
};
|
||||||
|
|
||||||
void () main_menu =
|
void () main_menu =
|
||||||
{
|
{
|
||||||
Menu_Begin (0, 0, "main");
|
Menu_Begin (0, 0, "main");
|
||||||
|
@ -40,10 +60,10 @@ void () main_menu =
|
||||||
Menu_Cursor (spinner);
|
Menu_Cursor (spinner);
|
||||||
//if (do_single_player)
|
//if (do_single_player)
|
||||||
// single_player_menu ();
|
// single_player_menu ();
|
||||||
//multi_player_menu ();
|
multi_player_menu ();
|
||||||
//options_menu ();
|
options_menu ();
|
||||||
//help_menu ();
|
help_menu ();
|
||||||
Menu_Item (54, 132, "", quit);
|
Menu_Item (54, 112, "", quit);
|
||||||
Menu_End ();
|
Menu_End ();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ typedef struct menu_item_s {
|
||||||
struct menu_item_s **items;
|
struct menu_item_s **items;
|
||||||
int num_items;
|
int num_items;
|
||||||
int max_items;
|
int max_items;
|
||||||
|
int cur_item;
|
||||||
int x, y;
|
int x, y;
|
||||||
func_t func;
|
func_t func;
|
||||||
func_t cursor;
|
func_t cursor;
|
||||||
|
@ -293,10 +294,15 @@ Menu_Draw (void)
|
||||||
{
|
{
|
||||||
menu_pic_t *m_pic;
|
menu_pic_t *m_pic;
|
||||||
int i;
|
int i;
|
||||||
|
menu_item_t *item;
|
||||||
|
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
*menu_pr_state.globals.time = *menu_pr_state.time;
|
*menu_pr_state.globals.time = *menu_pr_state.time;
|
||||||
|
|
||||||
|
item = menu->items[menu->cur_item];
|
||||||
|
|
||||||
for (m_pic = menu->pics; m_pic; m_pic = m_pic->next) {
|
for (m_pic = menu->pics; m_pic; m_pic = m_pic->next) {
|
||||||
qpic_t *pic = Draw_CachePic (m_pic->name, 1);
|
qpic_t *pic = Draw_CachePic (m_pic->name, 1);
|
||||||
if (!pic)
|
if (!pic)
|
||||||
|
@ -310,9 +316,12 @@ Menu_Draw (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (menu->cursor) {
|
if (menu->cursor) {
|
||||||
G_INT (&menu_pr_state, OFS_PARM0) = 0;
|
G_INT (&menu_pr_state, OFS_PARM0) = item->x;
|
||||||
G_INT (&menu_pr_state, OFS_PARM1) = 0;
|
G_INT (&menu_pr_state, OFS_PARM1) = item->y;
|
||||||
PR_ExecuteProgram (&menu_pr_state, menu->cursor);
|
PR_ExecuteProgram (&menu_pr_state, menu->cursor);
|
||||||
|
} else {
|
||||||
|
Draw_Character (item->x, item->y,
|
||||||
|
12 + ((int) (*con_data.realtime * 4) & 1));
|
||||||
}
|
}
|
||||||
if (menu_draw) {
|
if (menu_draw) {
|
||||||
PR_ExecuteProgram (&menu_pr_state, menu_draw);
|
PR_ExecuteProgram (&menu_pr_state, menu_draw);
|
||||||
|
@ -324,6 +333,20 @@ Menu_KeyEvent (knum_t key, short unicode, qboolean down)
|
||||||
{
|
{
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return;
|
return;
|
||||||
|
switch (key) {
|
||||||
|
case QFK_DOWN:
|
||||||
|
case QFM_WHEEL_DOWN:
|
||||||
|
menu->cur_item++;
|
||||||
|
menu->cur_item %= menu->num_items;
|
||||||
|
break;
|
||||||
|
case QFK_UP:
|
||||||
|
case QFM_WHEEL_UP:
|
||||||
|
menu->cur_item += menu->num_items - 1;
|
||||||
|
menu->cur_item %= menu->num_items;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue