Fixed a bug with callback-calling in Menu_KeyEvent

This commit is contained in:
Robin Redeker 2002-02-01 18:50:56 +00:00
parent cf2f42ea6a
commit 60e99d724b

View file

@ -459,6 +459,8 @@ Menu_Draw (void)
void void
Menu_KeyEvent (knum_t key, short unicode, qboolean down) Menu_KeyEvent (knum_t key, short unicode, qboolean down)
{ {
menu_item_t *item;
if (!menu) if (!menu)
return; return;
if (menu->keyevent) { if (menu->keyevent) {
@ -470,10 +472,11 @@ Menu_KeyEvent (knum_t key, short unicode, qboolean down)
return; return;
} else if (menu->items && menu->items[menu->cur_item]->func } else if (menu->items && menu->items[menu->cur_item]->func
&& menu->items[menu->cur_item]->allkeys) { && menu->items[menu->cur_item]->allkeys) {
G_INT (&menu_pr_state, OFS_PARM0) = key; item = menu->items[menu->cur_item];
G_INT (&menu_pr_state, OFS_PARM1) = unicode; G_INT (&menu_pr_state, OFS_PARM0) =
G_INT (&menu_pr_state, OFS_PARM2) = down; PR_SetString (&menu_pr_state, item->text);
PR_ExecuteProgram (&menu_pr_state, menu->items[menu->cur_item]->func); G_INT (&menu_pr_state, OFS_PARM1) = key;
PR_ExecuteProgram (&menu_pr_state, item->func);
if (G_INT (&menu_pr_state, OFS_RETURN)) if (G_INT (&menu_pr_state, OFS_RETURN))
return; return;
} }
@ -493,7 +496,7 @@ Menu_KeyEvent (knum_t key, short unicode, qboolean down)
case QFK_RETURN: case QFK_RETURN:
case QFM_BUTTON1: case QFM_BUTTON1:
{ {
menu_item_t *item = menu->items[menu->cur_item]; item = menu->items[menu->cur_item];
if (item->func) { if (item->func) {
G_INT (&menu_pr_state, OFS_PARM0) = G_INT (&menu_pr_state, OFS_PARM0) =
PR_SetString (&menu_pr_state, item->text); PR_SetString (&menu_pr_state, item->text);