diff options
author | Michael Levin <risujin@fastmail.fm> | 2009-10-03 11:16:05 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:14:48 +0000 |
commit | 181f6a9939ddddfc765114319fa14c74f316dd09 (patch) | |
tree | 0dd20c67eb3ec9e2d57dc9e96190cc1597a38d79 /src/ui | |
parent | 5399133ec251b57770a9adf2010af5547b9af16a (diff) |
* Menus_CloseAll() now takes one argument -- force. This argument determines whether to close all menus or ignore menus that don't respond to CloseAll (via the new dontCloseAll MENU_TRUE attribute).
* ui_messagemode2222 and the like won't activate the teamsay menu
* Say menu will no longer close when the player dies
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/ui_atoms.c | 15 | ||||
-rw-r--r-- | src/ui/ui_main.c | 18 | ||||
-rw-r--r-- | src/ui/ui_shared.c | 25 | ||||
-rw-r--r-- | src/ui/ui_shared.h | 3 |
4 files changed, 42 insertions, 19 deletions
diff --git a/src/ui/ui_atoms.c b/src/ui/ui_atoms.c index 0c48f797..ab35533c 100644 --- a/src/ui/ui_atoms.c +++ b/src/ui/ui_atoms.c @@ -170,7 +170,7 @@ qboolean UI_ConsoleCommand( int realTime ) case '\0': // Global uiInfo.chatTeam = qfalse; - uiInfo.chatTargetClientNum = -1; + uiInfo.chatTargetClientNum = -1; break; case '2': @@ -201,12 +201,15 @@ qboolean UI_ConsoleCommand( int realTime ) { if( Menu_Count( ) > 0 ) { - trap_Key_SetCatcher( trap_Key_GetCatcher( ) & ~KEYCATCH_UI ); - trap_Key_ClearStates( ); - trap_Cvar_Set( "cl_paused", "0" ); - Menus_CloseAll( ); - return qtrue; + Menus_CloseAll( qfalse ); + if( Menu_Count( ) == 0 ) + { + trap_Key_SetCatcher( trap_Key_GetCatcher( ) & ~KEYCATCH_UI ); + trap_Key_ClearStates( ); + trap_Cvar_Set( "cl_paused", "0" ); + } } + return qtrue; } return qfalse; diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index e8d6988c..05a2ae07 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -1419,7 +1419,7 @@ void UI_Load( void ) UI_LoadMenus( "ui/menus.txt", qtrue ); UI_LoadMenus( "ui/ingame.txt", qfalse ); UI_LoadMenus( "ui/tremulous.txt", qfalse ); - Menus_CloseAll(); + Menus_CloseAll( qtrue ); Menus_ActivateByName( lastName ); } @@ -2845,7 +2845,7 @@ static void UI_RunMenuScript( char **args ) //disallow the menu if it would be empty if( uiInfo.alienUpgradeCount <= 0 ) - Menus_CloseAll( ); + Menus_CloseAll( qfalse ); } else if( Q_stricmp( name, "UpgradeToNewClass" ) == 0 ) { @@ -3000,7 +3000,7 @@ static void UI_RunMenuScript( char **args ) { trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect\n" ); trap_Key_SetCatcher( KEYCATCH_UI ); - Menus_CloseAll(); + Menus_CloseAll( qtrue ); Menus_ActivateByName( "main" ); } else if( Q_stricmp( name, "ServerSort" ) == 0 ) @@ -3025,7 +3025,7 @@ static void UI_RunMenuScript( char **args ) trap_Key_SetCatcher( trap_Key_GetCatcher() & ~KEYCATCH_UI ); trap_Key_ClearStates(); trap_Cvar_Set( "cl_paused", "0" ); - Menus_CloseAll(); + Menus_CloseAll( qfalse ); } else if( Q_stricmp( name, "voteMap" ) == 0 ) { @@ -3777,7 +3777,7 @@ void UI_Init( qboolean inGameLoad ) UI_LoadMenus( "ui/ingame.txt", qfalse ); UI_LoadMenus( "ui/tremulous.txt", qfalse ); - Menus_CloseAll(); + Menus_CloseAll( qtrue ); trap_LAN_LoadCachedServers(); @@ -3805,7 +3805,7 @@ void UI_KeyEvent( int key, qboolean down ) if( menu ) { if( key == K_ESCAPE && down && !Menus_AnyFullScreenVisible() ) - Menus_CloseAll(); + Menus_CloseAll( qtrue ); else Menu_HandleKey( menu, key, down ); } @@ -3862,14 +3862,14 @@ void UI_SetActiveMenu( uiMenuCommand_t menu ) trap_Key_SetCatcher( trap_Key_GetCatcher() & ~KEYCATCH_UI ); trap_Key_ClearStates(); trap_Cvar_Set( "cl_paused", "0" ); - Menus_CloseAll(); + Menus_CloseAll( qtrue ); return; case UIMENU_MAIN: trap_Cvar_Set( "sv_killserver", "1" ); trap_Key_SetCatcher( KEYCATCH_UI ); - Menus_CloseAll(); + Menus_CloseAll( qtrue ); Menus_ActivateByName( "main" ); trap_Cvar_VariableStringBuffer( "com_errorMessage", buf, sizeof( buf ) ); @@ -3887,7 +3887,7 @@ void UI_SetActiveMenu( uiMenuCommand_t menu ) trap_Cvar_Set( "cl_paused", "1" ); trap_Key_SetCatcher( KEYCATCH_UI ); UI_BuildPlayerList(); - Menus_CloseAll(); + Menus_CloseAll( qtrue ); Menus_ActivateByName( "ingame" ); return; } diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c index f59a7349..f41b8bdc 100644 --- a/src/ui/ui_shared.c +++ b/src/ui/ui_shared.c @@ -1555,14 +1555,18 @@ void Menus_CloseByName( const char *p ) Menus_Close( Menus_FindByName( p ) ); } -void Menus_CloseAll( void ) +void Menus_CloseAll( qboolean force ) { int i; for( i = 0; i < menuCount; i++ ) - Menus_Close( &Menus[i] ); + { + if( !( Menus[i].window.flags & WINDOW_DONTCLOSEALL ) || force ) + Menus_Close( &Menus[i] ); + } - openMenuCount = 0; + if( force ) + openMenuCount = 0; } @@ -7587,6 +7591,20 @@ qboolean MenuParse_visible( itemDef_t *item, int handle ) return qtrue; } +qboolean MenuParse_dontCloseAll( itemDef_t *item, int handle ) +{ + int i; + menuDef_t *menu = ( menuDef_t* )item; + + if( !PC_Int_Parse( handle, &i ) ) + return qfalse; + + if( i ) + menu->window.flags |= WINDOW_DONTCLOSEALL; + + return qtrue; +} + qboolean MenuParse_onOpen( itemDef_t *item, int handle ) { menuDef_t * menu = ( menuDef_t* )item; @@ -7867,6 +7885,7 @@ keywordHash_t menuParseKeywords[] = { {"aspectBias", MenuParse_aspectBias, NULL}, {"style", MenuParse_style, NULL}, {"visible", MenuParse_visible, NULL}, + {"dontCloseAll", MenuParse_dontCloseAll, NULL}, {"onOpen", MenuParse_onOpen, NULL}, {"onClose", MenuParse_onClose, NULL}, {"onESC", MenuParse_onESC, NULL}, diff --git a/src/ui/ui_shared.h b/src/ui/ui_shared.h index 6c6be08c..bbf09234 100644 --- a/src/ui/ui_shared.h +++ b/src/ui/ui_shared.h @@ -64,6 +64,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define WINDOW_POPUP 0x00200000 // popup #define WINDOW_BACKCOLORSET 0x00400000 // backcolor was explicitly set #define WINDOW_TIMEDVISIBLE 0x00800000 // visibility timing ( NOT implemented ) +#define WINDOW_DONTCLOSEALL 0x01000000 // don't close during Menus_CloseAll() // CGAME cursor type bits @@ -457,7 +458,7 @@ menuDef_t *Menus_FindByName( const char *p ); void Menus_CloseByName( const char *p ); void Display_HandleKey( int key, qboolean down, int x, int y ); void LerpColor( vec4_t a, vec4_t b, vec4_t c, float t ); -void Menus_CloseAll( void ); +void Menus_CloseAll( qboolean force ); void Menu_Paint( menuDef_t *menu, qboolean forcePaint ); void Menu_SetFeederSelection( menuDef_t *menu, int feeder, int index, const char *name ); void Display_CacheAll( void ); |