/* ================ 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_ALIEN_STAGES ) { stage_t oldAlienStage = cgs.alienStage; if( str[0] ) { sscanf( str, "%d %d %d", &cgs.alienStage, &cgs.alienCredits, &cgs.alienNextStageThreshold ); if( cgs.alienStage != oldAlienStage ) CG_AnnounceAlienStageTransistion( oldAlienStage, cgs.alienStage ); } else { cgs.alienStage = cgs.alienCredits = cgs.alienNextStageThreshold = 0; } } else if( num == CS_HUMAN_STAGES ) { stage_t oldHumanStage = cgs.humanStage; if( str[0] ) { sscanf( str, "%d %d %d", &cgs.humanStage, &cgs.humanCredits, &cgs.humanNextStageThreshold ); if( cgs.humanStage != oldHumanStage ) CG_AnnounceHumanStageTransistion( oldHumanStage, cgs.humanStage ); } else { cgs.humanStage = cgs.humanCredits = cgs.humanNextStageThreshold = 0; } } else if( num == CS_LEVEL_START_TIME ) cgs.levelStartTime = atoi( str ); else if( num >= CS_VOTE_TIME && num < CS_VOTE_TIME + NUM_TEAMS ) { cgs.voteTime[ num - CS_VOTE_TIME ] = atoi( str ); cgs.voteModified[ num - CS_VOTE_TIME ] = qtrue; if( num - CS_VOTE_TIME == TEAM_NONE ) trap_Cvar_Set( "ui_voteActive", cgs.voteTime[ TEAM_NONE ] ? "1" : "0" ); else if( num - CS_VOTE_TIME == TEAM_ALIENS ) trap_Cvar_Set( "ui_alienTeamVoteActive", cgs.voteTime[ TEAM_ALIENS ] ? "1" : "0" ); else if( num - CS_VOTE_TIME == TEAM_HUMANS ) trap_Cvar_Set( "ui_humanTeamVoteActive", cgs.voteTime[ TEAM_HUMANS ] ? "1" : "0" ); } else if( num >= CS_VOTE_YES && num < CS_VOTE_YES + NUM_TEAMS ) { cgs.voteYes[ num - CS_VOTE_YES ] = atoi( str ); cgs.voteModified[ num - CS_VOTE_YES ] = qtrue; } else if( num >= CS_VOTE_NO && num < CS_VOTE_NO + NUM_TEAMS ) { cgs.voteNo[ num - CS_VOTE_NO ] = atoi( str ); cgs.voteModified[ num - CS_VOTE_NO ] = qtrue; } else if( num >= CS_VOTE_STRING && num < CS_VOTE_STRING + NUM_TEAMS ) Q_strncpyz( cgs.voteString[ num - CS_VOTE_STRING ], str, sizeof( cgs.voteString[ num - CS_VOTE_STRING ] ) ); else if( num >= CS_VOTE_CALLER && num < CS_VOTE_CALLER + NUM_TEAMS ) Q_strncpyz( cgs.voteCaller[ num - CS_VOTE_CALLER ], str, sizeof( cgs.voteCaller[ num - CS_VOTE_CALLER ] ) ); 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_SHADERS && num < CS_SHADERS+MAX_GAME_SHADERS ) cgs.gameShaders[ num - CS_SHADERS ] = trap_R_RegisterShader( str ); else if( num >= CS_PARTICLE_SYSTEMS && num < CS_PARTICLE_SYSTEMS+MAX_GAME_PARTICLE_SYSTEMS ) cgs.gameParticleSystems[ num - CS_PARTICLE_SYSTEMS ] = CG_RegisterParticleSystem( (char *)str ); else if( num >= CS_SOUNDS && num < CS_SOUNDS+MAX_SOUNDS ) { 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_WINNER ) { trap_Cvar_Set( "ui_winner", str ); } else if( num == CS_SHADERSTATE ) { CG_ShaderStateChanged( ); } }
/* ================ 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_BUILDPOINTS ) { sscanf( str, "%d %d %d %d %d", &cgs.alienBuildPoints, &cgs.alienBuildPointsTotal, &cgs.humanBuildPoints, &cgs.humanBuildPointsTotal, &cgs.humanBuildPointsPowered ); } else if ( num == CS_STAGES ) { stage_t oldAlienStage = cgs.alienStage; stage_t oldHumanStage = cgs.humanStage; sscanf( str, "%d %d %d %d %d %d", &cgs.alienStage, &cgs.humanStage, &cgs.alienKills, &cgs.humanKills, &cgs.alienNextStageThreshold, &cgs.humanNextStageThreshold ); if ( cgs.alienStage != oldAlienStage ) { CG_AnnounceAlienStageTransistion( oldAlienStage, cgs.alienStage ); } if ( cgs.humanStage != oldHumanStage ) { CG_AnnounceHumanStageTransistion( oldHumanStage, cgs.humanStage ); } } else if ( num == CS_SPAWNS ) { sscanf( str, "%d %d", &cgs.numAlienSpawns, &cgs.numHumanSpawns ); } else if ( num == CS_LEVEL_START_TIME ) { cgs.levelStartTime = atoi( str ); } else if ( num == CS_VOTE_TIME ) { cgs.voteTime = atoi( str ); cgs.voteModified = qtrue; if ( cgs.voteTime ) { trap_Cvar_Set( "ui_voteActive", "1" ); } else { trap_Cvar_Set( "ui_voteActive", "0" ); } } 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 ) ); } else if ( num >= CS_TEAMVOTE_TIME && num <= CS_TEAMVOTE_TIME + 1 ) { int cs_offset = num - CS_TEAMVOTE_TIME; cgs.teamVoteTime[ cs_offset ] = atoi( str ); cgs.teamVoteModified[ cs_offset ] = qtrue; if ( cs_offset == 0 ) { if ( cgs.teamVoteTime[ cs_offset ] ) { trap_Cvar_Set( "ui_humanTeamVoteActive", "1" ); } else { trap_Cvar_Set( "ui_humanTeamVoteActive", "0" ); } } else if ( cs_offset == 1 ) { if ( cgs.teamVoteTime[ cs_offset ] ) { trap_Cvar_Set( "ui_alienTeamVoteActive", "1" ); } else { trap_Cvar_Set( "ui_alienTeamVoteActive", "0" ); } } } 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 ) ); } 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_SHADERS && num < CS_SHADERS + MAX_GAME_SHADERS ) { cgs.gameShaders[ num - CS_SHADERS ] = trap_R_RegisterShader( str ); } else if ( num >= CS_PARTICLE_SYSTEMS && num < CS_PARTICLE_SYSTEMS + MAX_GAME_PARTICLE_SYSTEMS ) { cgs.gameParticleSystems[ num - CS_PARTICLE_SYSTEMS ] = CG_RegisterParticleSystem( ( char * ) str ); } else if ( num >= CS_SOUNDS && num < CS_SOUNDS + MAX_SOUNDS ) { 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_FLAGSTATUS ) { } else if ( num == CS_SHADERSTATE ) { CG_ShaderStateChanged(); } }