From af3fde8e0348b96e0230842fe0ab22fe90754e9e Mon Sep 17 00:00:00 2001 From: blackhc Date: Sun, 5 Jun 2005 11:07:31 +0000 Subject: [PATCH] -If developer == 0 and you arent connected to a server, the menu is automatically displaying itself. -Fixed the demo playback problem (mouse is still no reacting though). git-svn-id: svn://svn.icculus.org/nexuiz/trunk@435 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- scmenu/source/menu.qc | 35 +++++++++++++++++++++++---------- scmenu/source/system/events.qc | 6 +++--- scmenu/source/system/events_.qc | 6 +++--- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/scmenu/source/menu.qc b/scmenu/source/menu.qc index 9dbc6b262..6bf2aff07 100644 --- a/scmenu/source/menu.qc +++ b/scmenu/source/menu.qc @@ -5,6 +5,18 @@ // AK contains all menu functions (especially the required ones) /////////////////////////////////////////////// +void() m_updategamestate = +{ + // update isserver and clientstate + gamestatus = 0; + if( isserver() ) + gamestatus = gamestatus | GAME_ISSERVER; + if( clientstate() == CS_CONNECTED ) + gamestatus = gamestatus | GAME_CONNECTED; + if( cvar("developer") ) + gamestatus = gamestatus | GAME_DEVELOPER; +}; + void() m_init = { // init graphic @@ -49,8 +61,18 @@ void() m_frame = void() m_draw = { - if( !Menu_Active ) - return; + m_updategamestate(); + + + if( !Menu_Active ) { + // test whether we want to force it to be displayed + if( !(gamestatus & GAME_CONNECTED) && !(gamestatus & GAME_DEVELOPER) ) { + m_display(); + } + else { + return; + } + } // call m_frame cause draw is the only menu function called once per frame m_frame(); @@ -69,14 +91,7 @@ void() m_display = { Menu_Active = true; - // update isserver and clientstate - gamestatus = 0; - if( isserver() ) - gamestatus = gamestatus | GAME_ISSERVER; - if( clientstate() == CS_CONNECTED ) - gamestatus = gamestatus | GAME_CONNECTED; - if( cvar("developer") ) - gamestatus = gamestatus | GAME_DEVELOPER; + m_updategamestate(); // let also the snd and gfx know (perhaps for sfx) Gfx_Display(); diff --git a/scmenu/source/system/events.qc b/scmenu/source/system/events.qc index f79a90294..f555d3768 100644 --- a/scmenu/source/system/events.qc +++ b/scmenu/source/system/events.qc @@ -423,13 +423,13 @@ void( float pKey, float pAscii) Menu_Key = Menu_ProcessKey( Menu_ActiveWindow, pKey, pAscii ) != MENU_EVENT_PROCESSED ) // If it goes really wrong: if( pKey == K_ESCAPE ) - if( cvar( "developer" ) ) + if( gamestatus & GAME_DEVELOPER ) error( " K_ESCAPE wasnt processed!\n" ); else { Menu_Toggle(); cmd( "menu_restart\n" ); } - else if( cvar( "developer" ) ) { + else if( gamestatus & GAME_DEVELOPER ) { print( " Key ", ftos( pKey ), " ('" ); print( chr( pAscii ), "') wasn't processed!\n" ); } @@ -438,7 +438,7 @@ void( float pKey, float pAscii) Menu_Key = bool() Menu_Toggle = { // only let the qc toggle the menu if we are ingame or a developer - if( gamestatus & GAME_CONNECTED || cvar( "developer" ) ) { + if( gamestatus & GAME_CONNECTED || gamestatus & GAME_DEVELOPER ) { // then allow toggling m_hide(); return true; diff --git a/scmenu/source/system/events_.qc b/scmenu/source/system/events_.qc index 82f01dc0d..749002c2e 100644 --- a/scmenu/source/system/events_.qc +++ b/scmenu/source/system/events_.qc @@ -395,13 +395,13 @@ void( float pKey, float pAscii) Menu_Key = Menu_ProcessKey( Menu_ActiveWindow, pKey, pAscii ) != MENU_EVENT_PROCESSED ) // If it goes really wrong: if( pKey == K_ESCAPE ) - if( cvar( "developer" ) ) + if( gamestatus & GAME_DEVELOPER ) error( " K_ESCAPE wasnt processed!\n" ); else { Menu_Toggle(); cmd( "menu_restart\n" ); } - else if( cvar( "developer" ) ) { + else if( gamestatus & GAME_DEVELOPER ) { print( " Key ", ftos( pKey ), " ('" ); print( chr( pAscii ), "') wasn't processed!\n" ); } @@ -410,7 +410,7 @@ void( float pKey, float pAscii) Menu_Key = bool() Menu_Toggle = { // only let the qc toggle the menu if we are ingame or a developer - if( gamestatus & GAME_CONNECTED || cvar( "developer" ) ) { + if( gamestatus & GAME_CONNECTED || gamestatus & GAME_DEVELOPER ) { // then allow toggling m_hide(); return true; -- 2.39.2