/* ============================ CL_StartHunkUsers After the server has cleared the hunk, these will need to be restarted This is the only place that any of these functions are called from ============================ */ void CL_StartHunkUsers( void ) { if ( !com_cl_running->integer ) { return; } if ( !cls.rendererStarted ) { cls.rendererStarted = qtrue; CL_InitRenderer(); } if ( !cls.soundStarted ) { cls.soundStarted = qtrue; S_Init(); } if ( !cls.soundRegistered ) { cls.soundRegistered = qtrue; S_BeginRegistration(); } //we require the ui to be loaded here or else it crashes trying to access the ui on command line map loads if ( !cls.uiStarted ) { cls.uiStarted = qtrue; CL_InitUI(); } // if ( !cls.cgameStarted && cls.state > CA_CONNECTED && cls.state != CA_CINEMATIC ) { if ( !cls.cgameStarted && cls.state > CA_CONNECTED && (cls.state != CA_CINEMATIC && !CL_IsRunningInGameCinematic()) ) { cls.cgameStarted = qtrue; CL_InitCGame(); } }
void SV_DedicatedSpawn(char* map) { //turn off dedicated flag so textures will load Cvar_Set("dedicated", "0"); //clear and restart the render system extern void CL_InitRenderer( void ); CL_InitRenderer(); // Register sounds, so that muting is turned off and UI sounds work cls.soundRegistered = qtrue; S_BeginRegistration(ClientManager::NumClients()); //clear out & init ghoul2 system // G2API_CleanG2(G2_CLEAN_ALL); // com_serverGhoulInit = true; // com_serverGhoulShutdown = false; //reload menu stuff VM_Call( uivm, UI_INIT, 0 ); VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_DEDICATED ); //jsw//clear out the socket buffers for voice in case they got filled while loading // g_Voice.EmptyVoiceBuffer(); // g_Voice.StartVoice(); // g_Voice.VerifyPlayerList(); //reset dedicated flag so no other textures will load Cvar_Set( "dedicated", "1"); }
// Specifies the model that will be used as the world static void R_BeginRegistrationAndLoadWorld( const char* model ) { char fullname[ MAX_QPATH ]; String::Sprintf( fullname, sizeof ( fullname ), "maps/%s.bsp", model ); R_Shutdown( false ); CL_InitRenderer(); R_LoadWorld( fullname ); }
// This function gets called once just before drawing each frame, and it's sole purpose in life // is to check to see if any of the video mode parameters have changed, and if they have to // update the rendering DLL and/or video mode to match. void CLQ2_CheckVidChanges() { if ( vid_restart_requested ) { S_StopAllSounds(); /* ** refresh has changed */ vid_restart_requested = false; cl.q2_refresh_prepped = false; cls.disable_screen = true; R_Shutdown( true ); CL_InitRenderer(); cls.disable_screen = false; } }
static void CLQW_ParseServerData( QMsg& message ) { common->DPrintf( "Serverdata packet received.\n" ); Cbuf_Execute(); // make sure any stuffed commands are done R_Shutdown( false ); CL_InitRenderer(); // // wipe the clientActive_t struct // CL_ClearState(); // parse protocol version number // allow 2.2 and 2.29 demos to play int protover = message.ReadLong(); if ( protover != QWPROTOCOL_VERSION && !( clc.demoplaying && ( protover == 26 || protover == 27 || protover == 28 ) ) ) { common->Error( "Server returned version %i, not %i\nYou probably need to upgrade.\nCheck http://www.quakeworld.net/", protover, QWPROTOCOL_VERSION ); } cl.servercount = message.ReadLong(); // game directory const char* str = message.ReadString2(); bool cflag = false; if ( String::ICmp( fsqhw_gamedirfile, str ) ) { // save current config Com_WriteConfiguration(); cflag = true; } FS_SetGamedirQHW( str ); //ZOID--run the autoexec.cfg in the gamedir //if it exists if ( cflag ) { if ( FS_FileExists( "config.cfg" ) ) { Cbuf_AddText( "cl_warncmd 0\n" ); Cbuf_AddText( "exec config.cfg\n" ); Cbuf_AddText( "exec frontend.cfg\n" ); Cbuf_AddText( "cl_warncmd 1\n" ); } } // parse player slot, high bit means spectator cl.playernum = message.ReadByte(); if ( cl.playernum & 128 ) { cl.qh_spectator = true; cl.playernum &= ~128; } cl.viewentity = cl.playernum + 1; // get the full level name str = const_cast<char*>( message.ReadString2() ); String::NCpy( cl.qh_levelname, str, sizeof ( cl.qh_levelname ) - 1 ); // get the movevars movevars.gravity = message.ReadFloat(); movevars.stopspeed = message.ReadFloat(); movevars.maxspeed = message.ReadFloat(); movevars.spectatormaxspeed = message.ReadFloat(); movevars.accelerate = message.ReadFloat(); movevars.airaccelerate = message.ReadFloat(); movevars.wateraccelerate = message.ReadFloat(); movevars.friction = message.ReadFloat(); movevars.waterfriction = message.ReadFloat(); movevars.entgravity = message.ReadFloat(); // seperate the printfs so the server message can have a color common->Printf( "\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n" ); common->Printf( S_COLOR_ORANGE "%s" S_COLOR_WHITE "\n", str ); // ask for the sound list next Com_Memset( cl.qh_sound_name, 0, sizeof ( cl.qh_sound_name ) ); CL_AddReliableCommand( va( "soundlist %i %i", cl.servercount, 0 ) ); // now waiting for downloads, etc cls.state = CA_LOADING; }
static void CLQ1_ParseServerInfo( QMsg& message ) { common->DPrintf( "Serverinfo packet received.\n" ); R_Shutdown( false ); CL_InitRenderer(); clc.qh_signon = 0; // // wipe the clientActive_t struct // CL_ClearState(); SCR_ClearCenterString(); // parse protocol version number int i = message.ReadLong(); if ( i != Q1PROTOCOL_VERSION ) { common->Printf( "Server returned version %i, not %i", i, Q1PROTOCOL_VERSION ); return; } // parse maxclients cl.qh_maxclients = message.ReadByte(); if ( cl.qh_maxclients < 1 || cl.qh_maxclients > MAX_CLIENTS_QH ) { common->Printf( "Bad maxclients (%u) from server\n", cl.qh_maxclients ); return; } // parse gametype cl.qh_gametype = message.ReadByte(); // parse signon message const char* str = message.ReadString2(); String::NCpy( cl.qh_levelname, str, sizeof ( cl.qh_levelname ) - 1 ); // seperate the printfs so the server message can have a color common->Printf( "\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n" ); common->Printf( S_COLOR_ORANGE "%s" S_COLOR_WHITE "\n", str ); // precache models Com_Memset( cl.model_draw, 0, sizeof ( cl.model_draw ) ); char model_precache[ MAX_MODELS_Q1 ][ MAX_QPATH ]; int nummodels; for ( nummodels = 1;; nummodels++ ) { str = message.ReadString2(); if ( !str[ 0 ] ) { break; } if ( nummodels == MAX_MODELS_Q1 ) { common->Printf( "Server sent too many model precaches\n" ); return; } String::Cpy( model_precache[ nummodels ], str ); } // precache sounds Com_Memset( cl.sound_precache, 0, sizeof ( cl.sound_precache ) ); char sound_precache[ MAX_SOUNDS_Q1 ][ MAX_QPATH ]; int numsounds; for ( numsounds = 1;; numsounds++ ) { str = message.ReadString2(); if ( !str[ 0 ] ) { break; } if ( numsounds == MAX_SOUNDS_Q1 ) { common->Printf( "Server sent too many sound precaches\n" ); return; } String::Cpy( sound_precache[ numsounds ], str ); } // // now we try to load everything else until a cache allocation fails // CM_LoadMap( model_precache[ 1 ], true, NULL ); R_LoadWorld( model_precache[ 1 ] ); CLQH_KeepaliveMessage(); for ( i = 2; i < nummodels; i++ ) { cl.model_draw[ i ] = CLQ1_RegisterModel( model_precache[ i ] ); if ( cl.model_draw[ i ] == 0 ) { common->Printf( "Model %s not found\n", model_precache[ i ] ); return; } CLQH_KeepaliveMessage(); } S_BeginRegistration(); CLQ1_InitTEnts(); for ( i = 1; i < numsounds; i++ ) { cl.sound_precache[ i ] = S_RegisterSound( sound_precache[ i ] ); CLQH_KeepaliveMessage(); } S_EndRegistration(); // local state R_EndRegistration(); }