diff options
-rw-r--r-- | src/cgame/cg_servercmds.c | 7 | ||||
-rw-r--r-- | src/game/g_combat.c | 3 | ||||
-rw-r--r-- | src/game/g_local.h | 1 | ||||
-rw-r--r-- | src/game/g_utils.c | 18 | ||||
-rw-r--r-- | src/ui/ui_atoms.c | 16 |
5 files changed, 43 insertions, 2 deletions
diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index e3fee20c..f6cef10f 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -809,6 +809,13 @@ static void CG_ServerCommand( void ) } } + //the server thinks this client should close all menus + if( !strcmp( cmd, "serverclosemenus" ) ) + { + trap_SendConsoleCommand( "closemenus\n" ); + return; + } + CG_Printf( "Unknown client game command: %s\n", cmd ); } diff --git a/src/game/g_combat.c b/src/game/g_combat.c index e7024bfb..46a579d1 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -209,6 +209,9 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int killer, self->s.number, meansOfDeath, killerName, self->client->pers.netname, obit ); + //TA: close any menus the client has open + G_CloseMenus( self->client->ps.clientNum ); + // broadcast the death event to everyone ent = G_TempEntity( self->r.currentOrigin, EV_OBITUARY ); ent->s.eventParm = meansOfDeath; diff --git a/src/game/g_local.h b/src/game/g_local.h index 7020b8ec..7075ea16 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -605,6 +605,7 @@ void AddRemap(const char *oldShader, const char *newShader, float timeOff const char *BuildShaderStateConfig(); void G_TriggerMenu( int clientNum, dynMenu_t menu ); +void G_CloseMenus( int clientNum ); // // g_combat.c diff --git a/src/game/g_utils.c b/src/game/g_utils.c index 7d9b362e..50812aac 100644 --- a/src/game/g_utils.c +++ b/src/game/g_utils.c @@ -743,6 +743,7 @@ qboolean G_Visible( gentity_t *ent1, gentity_t *ent2 ) return qtrue; } + /* =============== G_TriggerMenu @@ -758,6 +759,23 @@ void G_TriggerMenu( int clientNum, dynMenu_t menu ) trap_SendServerCommand( clientNum, buffer ); } + +/* +=============== +G_CloseMenus + +Close all open menus on some client +=============== +*/ +void G_CloseMenus( int clientNum ) +{ + char buffer[ 32 ]; + + Com_sprintf( buffer, 32, "serverclosemenus" ); + trap_SendServerCommand( clientNum, buffer ); +} + + /* ================ DebugLine diff --git a/src/ui/ui_atoms.c b/src/ui/ui_atoms.c index 41f538ff..b8adacdd 100644 --- a/src/ui/ui_atoms.c +++ b/src/ui/ui_atoms.c @@ -368,11 +368,11 @@ qboolean UI_ConsoleCommand( int realTime ) return qtrue; } - if ( Q_stricmp (cmd, "menu") == 0 ) + if( Q_stricmp ( cmd, "menu" ) == 0 ) { arg1 = UI_Argv( 1 ); - if( Menu_Count() > 0 ) + if( Menu_Count( ) > 0 ) { trap_Key_SetCatcher( KEYCATCH_UI ); Menus_ActivateByName( arg1 ); @@ -380,6 +380,18 @@ qboolean UI_ConsoleCommand( int realTime ) } } + if( Q_stricmp ( cmd, "closemenus" ) == 0 ) + { + 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; + } + } + if ( Q_stricmp (cmd, "ui_cdkey") == 0 ) { //UI_CDKeyMenu_f(); return qtrue; |