/* ================= UI_UpdateMenu ================= */ void UI_UpdateMenu( float flTime ) { if( !uiStatic.initialized ) return; UI_DrawFinalCredits (); if( !uiStatic.visible ) return; if( !uiStatic.menuActive ) return; uiStatic.realTime = flTime * 1000; uiStatic.framecount++; if( CVAR_GET_FLOAT( "sv_background" ) && !g_engfuncs.pfnClientInGame()) return; // don't draw menu while level is loading if( uiStatic.firstDraw ) { // we loading background so skip SCR_Update if( UI_StartBackGroundMap( )) return; if( uiStatic.menuActive->activateFunc ) uiStatic.menuActive->activateFunc(); } // draw menu if( uiStatic.menuActive->drawFunc ) uiStatic.menuActive->drawFunc(); else UI_DrawMenu( uiStatic.menuActive ); if( uiStatic.firstDraw ) { uiStatic.firstDraw = false; static int first = TRUE; if( first ) { BACKGROUND_TRACK( "gamestartup.mp3", "gamestartup.mp3" ); first = FALSE; } } //CR UI_DrawTitleAnim(); // // draw cursor UI_DrawMouseCursor(); // delay playing the enter sound until after the menu has been // drawn, to avoid delay while caching images if( uiStatic.enterSound > 0.0f && uiStatic.enterSound <= gpGlobals->time ) { UI_StartSound( uiSoundIn ); uiStatic.enterSound = -1; } }
/* ================= UI_LoadGame_Callback ================= */ static void UI_LoadGame_Callback( void *self, int event ) { menuCommon_s *item = (menuCommon_s *)self; if( event == QM_CHANGED ) { if( uiLoadGame.saveName[uiLoadGame.savesList.curItem][0] == '\0' ) uiLoadGame.load.generic.flags |= QMF_GRAYED; else uiLoadGame.load.generic.flags &= ~QMF_GRAYED; if( uiLoadGame.delName[uiLoadGame.savesList.curItem][0] == '\0' ) uiLoadGame.remove.generic.flags |= QMF_GRAYED; else uiLoadGame.remove.generic.flags &= ~QMF_GRAYED; return; } if( event != QM_ACTIVATED ) return; switch( item->id ) { case ID_CANCEL: UI_PopMenu(); break; case ID_LOAD: if( uiLoadGame.saveName[uiLoadGame.savesList.curItem][0] ) { char cmd[128]; sprintf( cmd, "load \"%s\"\n", uiLoadGame.saveName[uiLoadGame.savesList.curItem] ); BACKGROUND_TRACK( NULL, NULL ); CLIENT_COMMAND( FALSE, cmd ); } break; case ID_NO: case ID_DELETE: UI_DeleteDialog(); break; case ID_YES: if( uiLoadGame.delName[uiLoadGame.savesList.curItem][0] ) { char cmd[128]; sprintf( cmd, "killsave \"%s\"\n", uiLoadGame.delName[uiLoadGame.savesList.curItem] ); CLIENT_COMMAND( TRUE, cmd ); sprintf( cmd, "save/%s.bmp", uiLoadGame.delName[uiLoadGame.savesList.curItem] ); PIC_Free( cmd ); // restarts the menu UI_PopMenu(); UI_LoadGame_Menu(); return; } UI_DeleteDialog(); break; } }
/* ================= UI_Main_NewGame ================= */ static void UI_Main_NewGame( void ) { if( CVAR_GET_FLOAT( "host_serverstate" ) && CVAR_GET_FLOAT( "maxplayers" ) > 1 ) HOST_ENDGAME( "end of the game" ); CVAR_SET_FLOAT( "skill", 1.0f ); CVAR_SET_FLOAT( "deathmatch", 0.0f ); CVAR_SET_FLOAT( "teamplay", 0.0f ); CVAR_SET_FLOAT( "pausable", 1.0f ); // singleplayer is always allowing pause CVAR_SET_FLOAT( "coop", 0.0f ); BACKGROUND_TRACK( NULL, NULL ); CLIENT_COMMAND( FALSE, "newgame\n" ); }