diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d692e265d..ad87c6b82 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D1X-Rebirth Changelog +20100317 +-------- +main/menu.c, main/menu.h: Add hide_menus and show_menus (for later use in the case of D1X) + 20100317 -------- arch/sdl/window.c, arch/include/window.h: Add window_exists function so event loops can be placed for specific windows diff --git a/main/menu.c b/main/menu.c index c68958260..12ac1ffdf 100644 --- a/main/menu.c +++ b/main/menu.c @@ -114,6 +114,8 @@ enum MENUS #define ADD_ITEM(t,value,key) do { m[num_options].type=NM_TYPE_MENU; m[num_options].text=t; menu_choice[num_options]=value;num_options++; } while (0) +static window *menus[16]; + // Function Prototypes added after LINTING void do_option(int select); void do_new_game_menu(void); @@ -122,6 +124,32 @@ extern void newmenu_close(); extern void ReorderPrimary(); extern void ReorderSecondary(); +// Hide all menus +void hide_menus(void) +{ + window *wind; + int i; + + for (i = 0; (i < 15) && (wind = window_get_front()); i++) + { + menus[i] = wind; + window_set_visible(wind, 0); + } + + Assert(window_get_front() == NULL); + menus[i] = NULL; +} + +// Show all menus, with the front one shown first +// This makes sure EVENT_WINDOW_ACTIVATED is only sent to that window +void show_menus(void) +{ + int i; + + for (i = 0; (i < 16) && menus[i]; i++) + window_set_visible(menus[i], 1); +} + //pairs of chars describing ranges char playername_allowed_chars[] = "azAZ09__--"; diff --git a/main/menu.h b/main/menu.h index 83f0ca76f..6574c5b53 100644 --- a/main/menu.h +++ b/main/menu.h @@ -20,6 +20,9 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #ifndef _MENU_H #define _MENU_H +extern void hide_menus(void); +extern void show_menus(void); + // called once at program startup to get the player's name extern int RegisterPlayer();