diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 841615e2..56f21b29 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -987,7 +987,8 @@ void CL_PrepSound( void ) { cl.sound_index[i+1] = S_RegisterSound( cl.sound_precache[i+1] ); Cvar_SetFloat( "scr_loading", scr_loading->value + 5.0f / sndcount ); - if( cl_allow_levelshots->integer || host.developer > 3 ) SCR_UpdateScreen(); + if( cl_allow_levelshots->integer || host.developer > 3 || cl.background ) + SCR_UpdateScreen(); } S_EndRegistration(); @@ -1054,7 +1055,7 @@ void CL_PrepVideo( void ) com.strncpy( name, cl.model_precache[i+1], MAX_STRING ); Mod_RegisterModel( name, i+1 ); Cvar_SetFloat( "scr_loading", scr_loading->value + 75.0f / mdlcount ); - if( cl_allow_levelshots->integer || host.developer > 3 ) + if( cl_allow_levelshots->integer || host.developer > 3 || cl.background ) SCR_UpdateScreen(); } diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 157e9c21..dcef3558 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -629,7 +629,7 @@ void CL_ParseServerData( sizebuf_t *msg ) Cvar_Set( "cl_levelshot_name", va( "levelshots/%s", clgame.mapname )); Cvar_SetFloat( "scr_loading", 0.0f ); // reset progress bar - if( cl_allow_levelshots->integer && !cls.changelevel ) + if(( cl_allow_levelshots->integer && !cls.changelevel ) || cl.background ) { if( !FS_FileExistsEx( va( "%s.bmp", cl_levelshot_name->string ), true )) { diff --git a/engine/client/cl_scrn.c b/engine/client/cl_scrn.c index 0ec0c742..f8ce36d5 100644 --- a/engine/client/cl_scrn.c +++ b/engine/client/cl_scrn.c @@ -38,7 +38,7 @@ void SCR_DrawFPS( void ) char fpsstring[32]; if( cls.state != ca_active ) return; - if( !cl_showfps->integer ) return; + if( !cl_showfps->integer || cl.background ) return; if( cls.scrshot_action != scrshot_inactive ) return; @@ -207,7 +207,7 @@ void SCR_DrawPlaque( void ) { int levelshot; - if( cl_allow_levelshots->integer && !cls.changelevel ) + if(( cl_allow_levelshots->integer && !cls.changelevel ) || Cvar_VariableInteger( "sv_background" )) { levelshot = GL_LoadTexture( cl_levelshot_name->string, NULL, 0, TF_IMAGE ); GL_SetRenderMode( kRenderNormal ); diff --git a/engine/server/sv_cmds.c b/engine/server/sv_cmds.c index eed80b49..23b7b7c4 100644 --- a/engine/server/sv_cmds.c +++ b/engine/server/sv_cmds.c @@ -300,6 +300,8 @@ void SV_MapBackground_f( void ) Cvar_FullSet( "deathmatch", "0", CVAR_LATCH ); Cvar_FullSet( "maxplayers", "1", CVAR_LATCH ); + SCR_BeginLoadingPlaque(); + SV_SpawnServer( mapname, NULL ); SV_LevelInit( mapname, NULL, NULL, false ); SV_ActivateServer (); diff --git a/engine/server/sv_game.c b/engine/server/sv_game.c index be0e1c63..4d020479 100644 --- a/engine/server/sv_game.c +++ b/engine/server/sv_game.c @@ -2266,6 +2266,13 @@ void pfnMessageEnd( void ) if( !svgame.msg_started ) Host_Error( "MessageEnd: called with no active message\n" ); svgame.msg_started = false; + // HACKHACK: clearing HudText in background mode + if( sv.background && svgame.msg[svgame.msg_index].number == svgame.gmsgHudText ) + { + BF_Clear( &sv.multicast ); + return; + } + // check for system message if( svgame.msg_index == -1 ) { diff --git a/mainui/basemenu.cpp b/mainui/basemenu.cpp index 06523eeb..ae13d102 100644 --- a/mainui/basemenu.cpp +++ b/mainui/basemenu.cpp @@ -719,17 +719,27 @@ void UI_RefreshServerList( void ) UI_StartBackGroundMap ================= */ -void UI_StartBackGroundMap( void ) +bool UI_StartBackGroundMap( void ) { + static bool first = TRUE; + + if( !first ) return FALSE; + + first = FALSE; + if( !uiStatic.bgmapcount || CVAR_GET_FLOAT( "sv_background" )) - return; + return FALSE; int bgmapid = RANDOM_LONG( 0, uiStatic.bgmapcount - 1 ); char cmd[128]; - sprintf( cmd, "map_background %s\n", uiStatic.bgmaps[bgmapid] ); + sprintf( cmd, "maps/%s.bsp", uiStatic.bgmaps[bgmapid] ); + if( !FILE_EXISTS( cmd )) return FALSE; + sprintf( cmd, "map_background %s\n", uiStatic.bgmaps[bgmapid] ); CLIENT_COMMAND( FALSE, cmd ); + + return TRUE; } // ===================================================================== @@ -857,8 +867,14 @@ void UI_UpdateMenu( float flTime ) 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(); } @@ -876,7 +892,6 @@ void UI_UpdateMenu( float flTime ) if( first ) { - UI_StartBackGroundMap (); BACKGROUND_TRACK( "gamestartup.mp3", NULL ); first = FALSE; } diff --git a/mainui/menu_creategame.cpp b/mainui/menu_creategame.cpp index 52290a1d..c2ad2c4f 100644 --- a/mainui/menu_creategame.cpp +++ b/mainui/menu_creategame.cpp @@ -118,7 +118,7 @@ static void UI_CreateGame_Begin( void ) static void UI_PromptDialog( void ) { - if( !CVAR_GET_FLOAT( "host_serverstate" )) + if( !CVAR_GET_FLOAT( "host_serverstate" ) || CVAR_GET_FLOAT( "sv_background" )) { UI_CreateGame_Begin(); return; diff --git a/mainui/menu_langame.cpp b/mainui/menu_langame.cpp index 8a1238da..09145a6a 100644 --- a/mainui/menu_langame.cpp +++ b/mainui/menu_langame.cpp @@ -182,7 +182,8 @@ static void UI_Background_Ownerdraw( void *self ) { menuCommon_s *item = (menuCommon_s *)self; - UI_DrawPic(item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic); + if( !CVAR_GET_FLOAT( "sv_background" )) + UI_DrawPic(item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic); if( uiStatic.realTime > uiLanGame.refreshTime ) { diff --git a/mainui/menu_main.cpp b/mainui/menu_main.cpp index 0e888c48..28e276e3 100644 --- a/mainui/menu_main.cpp +++ b/mainui/menu_main.cpp @@ -426,6 +426,7 @@ static void UI_Main_Init( void ) // server.dll needs for reading savefiles or startup newgame if( !CheckGameDll( )) { + uiMain.hazardCourse.generic.flags |= QMF_GRAYED; uiMain.saveRestore.generic.flags |= QMF_GRAYED; uiMain.newGame.generic.flags |= QMF_GRAYED; }