/* ================ CG_SetConfigValues Called on load to set the initial values from configure strings ================ */ void CG_SetConfigValues( void ) { cgs.scores1 = atoi( CG_ConfigString( CS_SCORES1 ) ); cgs.scores2 = atoi( CG_ConfigString( CS_SCORES2 ) ); cgs.levelStartTime = atoi( CG_ConfigString( CS_LEVEL_START_TIME ) ); cg.warmup = atoi( CG_ConfigString( CS_WARMUP ) ); CG_EffectParse( CG_ConfigString( CS_ATMOSEFFECT ) ); }
void SP_worldspawn( void ) { char *s; CG_SpawnString( "classname", "", &s ); if ( Q_stricmp( s, "worldspawn" ) ) { CG_Error( "SP_worldspawn: The first entity isn't 'worldspawn'" ); } CG_SpawnString( "enableDust", "0", &s ); trap_Cvar_Set( "cg_enableDust", s ); CG_SpawnString( "enableBreath", "0", &s ); trap_Cvar_Set( "cg_enableBreath", s ); if ( CG_SpawnVector2D( "mapcoordsmins", "-128 128", cg.mapcoordsMins ) && // top left CG_SpawnVector2D( "mapcoordsmaxs", "128 -128", cg.mapcoordsMaxs ) ) { // bottom right cg.mapcoordsValid = qtrue; } else { cg.mapcoordsValid = qfalse; } #if 0 cg.mapcoordsScale[0] = 1 / ( cg.mapcoordsMaxs[0] - cg.mapcoordsMins[0] ); cg.mapcoordsScale[1] = 1 / ( cg.mapcoordsMaxs[1] - cg.mapcoordsMins[1] ); BG_InitLocations( cg.mapcoordsMins, cg.mapcoordsMaxs ); #endif CG_SpawnString( "atmosphere", "", &s ); CG_EffectParse( s ); CG_SpawnFloat( "skyalpha", "1", &cg.skyAlpha ); }
void SP_worldspawn(void) { char *s; CG_SpawnString("classname", "", &s); if (Q_stricmp(s, "worldspawn")) { CG_Error("SP_worldspawn: The first entity isn't 'worldspawn'"); } if (CG_SpawnVector2D("mapcoordsmins", "-128 128", cg.mapcoordsMins) && // top left CG_SpawnVector2D("mapcoordsmaxs", "128 -128", cg.mapcoordsMaxs)) { // bottom right cg.mapcoordsValid = qtrue; } else { cg.mapcoordsValid = qfalse; } CG_ParseSpawns(); BG_InitLocations(cg.mapcoordsMins, cg.mapcoordsMaxs); CG_SpawnString("atmosphere", "", &s); CG_EffectParse(s); }
void SP_worldspawn( void ) { char *s; int i; CG_SpawnString( "classname", "", &s ); if ( Q_stricmp( s, "worldspawn" ) ) { CG_Error( "SP_worldspawn: The first entity isn't 'worldspawn'" ); } cgs.ccLayers = 0; if ( CG_SpawnVector2D( "mapcoordsmins", "-128 128", cg.mapcoordsMins ) && // top left CG_SpawnVector2D( "mapcoordsmaxs", "128 -128", cg.mapcoordsMaxs ) ) { // bottom right cg.mapcoordsValid = true; } else { cg.mapcoordsValid = false; } CG_ParseSpawns(); CG_SpawnString( "cclayers", "0", &s ); cgs.ccLayers = atoi( s ); for ( i = 0; i < cgs.ccLayers; i++ ) { CG_SpawnString( va( "cclayerceil%i",i ), "0", &s ); cgs.ccLayerCeils[i] = atoi( s ); } cg.mapcoordsScale[0] = 1 / ( cg.mapcoordsMaxs[0] - cg.mapcoordsMins[0] ); cg.mapcoordsScale[1] = 1 / ( cg.mapcoordsMaxs[1] - cg.mapcoordsMins[1] ); BG_InitLocations( cg.mapcoordsMins, cg.mapcoordsMaxs ); CG_SpawnString( "atmosphere", "", &s ); CG_EffectParse( s ); cg.fiveMinuteSound_g[0] = \ cg.fiveMinuteSound_a[0] = \ cg.twoMinuteSound_g[0] = \ cg.twoMinuteSound_a[0] = \ cg.thirtySecondSound_g[0] = \ cg.thirtySecondSound_a[0] = '\0'; CG_SpawnString( "twoMinuteSound_axis", "axis_hq_5minutes", &s ); Q_strncpyz( cg.fiveMinuteSound_g, s, sizeof( cg.fiveMinuteSound_g ) ); CG_SpawnString( "twoMinuteSound_allied", "allies_hq_5minutes", &s ); Q_strncpyz( cg.fiveMinuteSound_a, s, sizeof( cg.fiveMinuteSound_a ) ); CG_SpawnString( "twoMinuteSound_axis", "axis_hq_2minutes", &s ); Q_strncpyz( cg.twoMinuteSound_g, s, sizeof( cg.twoMinuteSound_g ) ); CG_SpawnString( "twoMinuteSound_allied", "allies_hq_2minutes", &s ); Q_strncpyz( cg.twoMinuteSound_a, s, sizeof( cg.twoMinuteSound_a ) ); CG_SpawnString( "thirtySecondSound_axis", "axis_hq_30seconds", &s ); Q_strncpyz( cg.thirtySecondSound_g, s, sizeof( cg.thirtySecondSound_g ) ); CG_SpawnString( "thirtySecondSound_allied", "allies_hq_30seconds", &s ); Q_strncpyz( cg.thirtySecondSound_a, s, sizeof( cg.thirtySecondSound_a ) ); // 5 minute axis if ( !*cg.fiveMinuteSound_g ) { cgs.media.fiveMinuteSound_g = 0; } else if ( strstr( cg.fiveMinuteSound_g, ".wav" ) ) { cgs.media.fiveMinuteSound_g = trap_S_RegisterSound( cg.fiveMinuteSound_g, true ); } else { cgs.media.fiveMinuteSound_g = -1; } // 5 minute allied if ( !*cg.fiveMinuteSound_a ) { cgs.media.fiveMinuteSound_a = 0; } else if ( strstr( cg.fiveMinuteSound_a, ".wav" ) ) { cgs.media.fiveMinuteSound_a = trap_S_RegisterSound( cg.fiveMinuteSound_a, true ); } else { cgs.media.fiveMinuteSound_a = -1; } // 2 minute axis if ( !*cg.twoMinuteSound_g ) { cgs.media.twoMinuteSound_g = 0; } else if ( strstr( cg.twoMinuteSound_g, ".wav" ) ) { cgs.media.twoMinuteSound_g = trap_S_RegisterSound( cg.twoMinuteSound_g, true ); } else { cgs.media.twoMinuteSound_g = -1; } // 2 minute allied if ( !*cg.twoMinuteSound_a ) { cgs.media.twoMinuteSound_a = 0; } else if ( strstr( cg.twoMinuteSound_a, ".wav" ) ) { cgs.media.twoMinuteSound_a = trap_S_RegisterSound( cg.twoMinuteSound_a, true ); } else { cgs.media.twoMinuteSound_a = -1; } // 30 seconds axis if ( !*cg.thirtySecondSound_g ) { cgs.media.thirtySecondSound_g = 0; } else if ( strstr( cg.thirtySecondSound_g, ".wav" ) ) { cgs.media.thirtySecondSound_g = trap_S_RegisterSound( cg.thirtySecondSound_g, true ); } else { cgs.media.thirtySecondSound_g = -1; } // 30 seconds allied if ( !*cg.thirtySecondSound_a ) { cgs.media.thirtySecondSound_a = 0; } else if ( strstr( cg.thirtySecondSound_a, ".wav" ) ) { cgs.media.thirtySecondSound_a = trap_S_RegisterSound( cg.thirtySecondSound_a, true ); } else { cgs.media.thirtySecondSound_a = -1; } }
/* ================ CG_ConfigStringModified ================ */ static void CG_ConfigStringModified( void ) { const char *str; int num; num = atoi( CG_Argv( 1 ) ); // get the gamestate from the client system, which will have the // new configstring already integrated trap_GetGameState( &cgs.gameState ); // look up the individual string that was modified str = CG_ConfigString( num ); // do something with it if necessary if ( num == CS_MUSIC ) { CG_StartMusic(); } else if ( num == CS_SERVERINFO ) { CG_ParseServerinfo(); } else if ( num == CS_WARMUP ) { CG_ParseWarmup(); } else if ( num == CS_SCORES1 ) { cgs.scores1 = atoi( str ); } else if ( num == CS_SCORES2 ) { cgs.scores2 = atoi( str ); } else if ( num == CS_LEVEL_START_TIME ) { cgs.levelStartTime = atoi( str ); } else if ( num == CS_VOTE_TIME ) { cgs.voteTime = atoi( str ); cgs.voteModified = qtrue; } else if ( num == CS_VOTE_YES ) { cgs.voteYes = atoi( str ); cgs.voteModified = qtrue; } else if ( num == CS_VOTE_NO ) { cgs.voteNo = atoi( str ); cgs.voteModified = qtrue; } else if ( num == CS_VOTE_STRING ) { Q_strncpyz( cgs.voteString, str, sizeof( cgs.voteString ) ); #ifdef MISSIONPACK trap_S_StartLocalSound( cgs.media.voteNow, CHAN_ANNOUNCER ); #endif //MISSIONPACK } else if ( num >= CS_TEAMVOTE_TIME && num <= CS_TEAMVOTE_TIME + 1) { cgs.teamVoteTime[num-CS_TEAMVOTE_TIME] = atoi( str ); cgs.teamVoteModified[num-CS_TEAMVOTE_TIME] = qtrue; } else if ( num >= CS_TEAMVOTE_YES && num <= CS_TEAMVOTE_YES + 1) { cgs.teamVoteYes[num-CS_TEAMVOTE_YES] = atoi( str ); cgs.teamVoteModified[num-CS_TEAMVOTE_YES] = qtrue; } else if ( num >= CS_TEAMVOTE_NO && num <= CS_TEAMVOTE_NO + 1) { cgs.teamVoteNo[num-CS_TEAMVOTE_NO] = atoi( str ); cgs.teamVoteModified[num-CS_TEAMVOTE_NO] = qtrue; } else if ( num >= CS_TEAMVOTE_STRING && num <= CS_TEAMVOTE_STRING + 1) { Q_strncpyz( cgs.teamVoteString[num-CS_TEAMVOTE_STRING], str, sizeof( cgs.teamVoteString ) ); #ifdef MISSIONPACK trap_S_StartLocalSound( cgs.media.voteNow, CHAN_ANNOUNCER ); #endif } else if ( num == CS_INTERMISSION ) { cg.intermissionStarted = atoi( str ); } else if ( num >= CS_MODELS && num < CS_MODELS+MAX_MODELS ) { cgs.gameModels[ num-CS_MODELS ] = trap_R_RegisterModel( str ); } else if ( num >= CS_SOUNDS && num < CS_SOUNDS+MAX_MODELS ) { if ( str[0] != '*' ) { // player specific sounds don't register here cgs.gameSounds[ num-CS_SOUNDS] = trap_S_RegisterSound( str, qfalse ); } } else if ( num >= CS_PLAYERS && num < CS_PLAYERS+MAX_CLIENTS ) { CG_NewClientInfo( num - CS_PLAYERS ); CG_BuildSpectatorString(); } else if ( num == CS_SHADERSTATE ) { CG_ShaderStateChanged(); } else if( num == CS_ATMOSEFFECT ) { CG_EffectParse( str ); } }