_prev menu fixes

This commit is contained in:
Andrei Drexler 2011-03-11 08:13:54 +00:00
parent 4125076cdf
commit a785e1e55a
2 changed files with 10 additions and 6 deletions

View file

@ -1634,10 +1634,14 @@ void Menus_Close(menuDef_t *menu)
if (!menu) if (!menu)
return; return;
prevMenu = NULL;
for (i=0; i<openMenuCount; i++) for (i=0; i<openMenuCount; i++)
{ {
if (menuStack[i] == menu) if (menuStack[i] == menu)
{ {
if (i > 0)
prevMenu = menuStack[i-1];
openMenuCount--; openMenuCount--;
while (i < openMenuCount) while (i < openMenuCount)
{ {
@ -4236,8 +4240,8 @@ void Menu_HandleKey(menuDef_t * menu, int key, qboolean down)
it.parent = menu; it.parent = menu;
Item_RunScript(&it, menu->onESC); Item_RunScript(&it, menu->onESC);
} else if (openMenuCount > 0) { } else {
Menus_Close(menuStack[openMenuCount]); Menus_Close(menu);
} }
} }
break; break;
@ -6488,10 +6492,10 @@ menuDef_t *Menus_ActivateByName(const char *p, qboolean special)
if (menuStack[j] == m) { if (menuStack[j] == m) {
alreadyActive = qtrue; alreadyActive = qtrue;
//move to the top of the stack //move to the top of the stack
if (j != openMenuCount - 1) { for (; j<openMenuCount-1; ++j) {
menuStack[j] = menuStack[openMenuCount-1]; menuStack[j] = menuStack[j+1];
menuStack[openMenuCount-1] = m;
} }
menuStack[openMenuCount-1] = m;
break; break;
} }
} }

View file

@ -89,7 +89,7 @@
//Makro - changed to 192 //Makro - changed to 192
#define MAX_MENUITEMS 192 #define MAX_MENUITEMS 192
#define MAX_COLOR_RANGES 10 #define MAX_COLOR_RANGES 10
#define MAX_OPEN_MENUS 16 #define MAX_OPEN_MENUS 32
#define WINDOW_MOUSEOVER 0x00000001 // mouse is over it, non exclusive #define WINDOW_MOUSEOVER 0x00000001 // mouse is over it, non exclusive
#define WINDOW_HASFOCUS 0x00000002 // has cursor focus, exclusive #define WINDOW_HASFOCUS 0x00000002 // has cursor focus, exclusive