Changed ESCAPE key handling a bit

This commit is contained in:
Andrei Drexler 2011-03-10 08:55:21 +00:00
parent d2ad17af41
commit f8847e0f37
2 changed files with 9 additions and 9 deletions

View file

@ -8777,11 +8777,7 @@ void _UI_KeyEvent(int key, qboolean down)
menuDef_t *menu = Menu_GetFocused();
if (menu) {
if (key == K_ESCAPE && down && !Menus_AnyFullScreenVisible()) {
Menus_CloseAll();
} else {
Menu_HandleKey(menu, key, down);
}
Menu_HandleKey(menu, key, down);
} else {
trap_Key_SetCatcher(trap_Key_GetCatcher() & ~KEYCATCH_UI);
trap_Key_ClearStates();

View file

@ -4230,11 +4230,15 @@ void Menu_HandleKey(menuDef_t * menu, int key, qboolean down)
break;
case K_ESCAPE:
if (!g_waitingForKey && menu->onESC) {
itemDef_t it;
if (!g_waitingForKey) {
if (menu->onESC) {
itemDef_t it;
it.parent = menu;
Item_RunScript(&it, menu->onESC);
it.parent = menu;
Item_RunScript(&it, menu->onESC);
} else if (openMenuCount > 0) {
Menus_Close(menuStack[openMenuCount]);
}
}
break;
case K_TAB: