/* ====================== CL_RegisterSounds ====================== */ void CL_RegisterSounds (void) { int32_t i; S_BeginRegistration (); CL_RegisterTEntSounds (); // Knightmare- 1/2/2002- ULTRA-CHEESY HACK for old demos or // connected to server using old protocol // Changed config strings require different offsets if ( LegacyProtocol() ) { for (i=1; i < OLD_MAX_SOUNDS; i++) { if (!cl.configstrings[OLD_CS_SOUNDS+i][0]) break; cl.sound_precache[i] = S_RegisterSound (cl.configstrings[OLD_CS_SOUNDS+i]); Sys_SendKeyEvents (); // pump message loop } } else { for (i=1; i < MAX_SOUNDS; i++) { if (!cl.configstrings[CS_SOUNDS+i][0]) break; cl.sound_precache[i] = S_RegisterSound (cl.configstrings[CS_SOUNDS+i]); Sys_SendKeyEvents (); // pump message loop } } //end Knightmare S_EndRegistration (); }
static void CLQW_Sound_NextDownload() { if ( clc.downloadNumber == 0 ) { common->Printf( "Checking sounds...\n" ); clc.downloadNumber = 1; } clc.downloadType = dl_sound; for ( ; cl.qh_sound_name[ clc.downloadNumber ][ 0 ] ; clc.downloadNumber++ ) { char* s = cl.qh_sound_name[ clc.downloadNumber ]; if ( !CL_CheckOrDownloadFile( va( "sound/%s",s ) ) ) { return; // started a download } } S_BeginRegistration(); CLQ1_InitTEnts(); for ( int i = 1; i < MAX_SOUNDS_Q1; i++ ) { if ( !cl.qh_sound_name[ i ][ 0 ] ) { break; } cl.sound_precache[ i ] = S_RegisterSound( cl.qh_sound_name[ i ] ); } S_EndRegistration(); // done with sounds, request models now Com_Memset( cl.model_draw, 0, sizeof ( cl.model_draw ) ); clq1_playerindex = -1; clq1_spikeindex = -1; clqw_flagindex = -1; CL_AddReliableCommand( va( "modellist %i %i", cl.servercount, 0 ) ); }
/* ====================== CL_RegisterSounds ====================== */ void CL_RegisterSounds (void) { int i; S_BeginRegistration (); CL_RegisterTEntSounds (); for (i=1 ; i<MAX_SOUNDS ; i++) { if (!cl.configstrings[CS_SOUNDS+i][0]) break; cl.sound_precache[i] = S_RegisterSound (cl.configstrings[CS_SOUNDS+i]); Sys_SendKeyEvents (); // pump message loop } S_EndRegistration (); }
/* ====================== CL_PrepSound Call before entering a new level, or after changing dlls ====================== */ void CL_PrepSound( void ) { int i, sndcount, step; MsgDev( D_NOTE, "CL_PrepSound: %s\n", clgame.mapname ); for( i = 0, sndcount = 0; i < MAX_SOUNDS && cl.sound_precache[i+1][0]; i++ ) sndcount++; // total num sounds step = sndcount/10; S_BeginRegistration(); for( i = 0; i < MAX_SOUNDS && cl.sound_precache[i+1][0]; i++ ) { cl.sound_index[i+1] = S_RegisterSound( cl.sound_precache[i+1] ); Cvar_SetFloat( "scr_loading", scr_loading->value + 5.0f / sndcount ); if( step && !( i % step ) && ( cl_allow_levelshots->integer || cl.background )) SCR_UpdateScreen(); } S_EndRegistration(); if( host.soundList ) { // need to reapply all ambient sounds after restarting for( i = 0; i < host.numsounds; i++) { soundlist_t *entry = &host.soundList[i]; if( entry->looping && entry->entnum != -1 ) { MsgDev( D_NOTE, "Restarting sound %s...\n", entry->name ); S_AmbientSound( entry->origin, entry->entnum, S_RegisterSound( entry->name ), entry->volume, entry->attenuation, entry->pitch, 0 ); } } } host.soundList = NULL; host.numsounds = 0; cl.audio_prepped = true; }
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(); }