/* ============= CG_ScoresDown ============= */ static void CG_ScoresDown_f(int localPlayerNum) { localPlayer_t *player = &cg.localPlayers[localPlayerNum]; #ifdef TEAMARENA_HUD CG_BuildSpectatorString(); #endif if ( cg.scoresRequestTime + 2000 < cg.time ) { // the scores are more than two seconds out of data, // so request new ones cg.scoresRequestTime = cg.time; trap_SendClientCommand( "score" ); // leave the current scores up if they were already // displayed, but if this is the first hit, clear them out if ( !CG_AnyScoreboardShowing() ) { cg.numScores = 0; } player->showScores = qtrue; } else { // show the cached contents even if they just pressed if it // is within two seconds player->showScores = qtrue; } }
static void CG_ScoresDown_f(void) { #ifdef MISSIONPACK CG_BuildSpectatorString(); #endif if(cg.scoresRequestTime + 2000 < cg.time) { // the scores are more than two seconds out of data, // so request new ones cg.scoresRequestTime = cg.time; trap_SendClientCommand("score"); // leave the current scores up if they were already // displayed, but if this is the first hit, clear them out if(!cg.showScores) { cg.showScores = qtrue; cg.numScores = 0; } } else { // show the cached contents even if they just pressed if it // is within two seconds cg.showScores = qtrue; } }
/* =================== CG_RegisterClients =================== */ static void CG_RegisterClients( void ) { int i; CG_LoadingClient(cg.clientNum); CG_NewClientInfo(cg.clientNum); for (i=0 ; i<MAX_CLIENTS ; i++) { const char *clientInfo; if (cg.clientNum == i) { continue; } clientInfo = CG_ConfigString( CS_PLAYERS+i ); if ( !clientInfo[0]) { continue; } CG_LoadingClient( i ); CG_NewClientInfo( i ); } CG_BuildSpectatorString(); }
static void DrawSpectators( float fade ) { const qhandle_t fontHandle = MenuFontToHandle( JP_GetScoreboardFont() ); const float fontScale = 0.5f, lineHeight = 14.0f; float y = 128.0f; vector4 white = { 1.0f, 1.0f, 1.0f, 1.0f }; white.a = fade; CG_BuildSpectatorString(); cg.scoreboard.spectatorWidth = CG_Text_Width( cg.scoreboard.spectatorList, fontScale, fontHandle ); if ( cg.scoreboard.spectatorLen ) { const float dt = (cg.time - cg.scoreboard.spectatorResetTime)*0.0625f; cg.scoreboard.spectatorX = SCREEN_WIDTH - (1.0f)*dt; if ( cg.scoreboard.spectatorX < 0 - cg.scoreboard.spectatorWidth ) { cg.scoreboard.spectatorX = SCREEN_WIDTH; cg.scoreboard.spectatorResetTime = cg.time; } CG_Text_Paint( cg.scoreboard.spectatorX, (y + lineHeight * 20) - 3, fontScale, &white, cg.scoreboard.spectatorList, 0, 0, ITEM_TEXTSTYLE_SHADOWED, fontHandle ); } }
/* ================ 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)); trap_S_StartLocalSound(cgs.media.voteNow, CHAN_ANNOUNCER); } 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)); trap_S_StartLocalSound(cgs.media.voteNow, CHAN_ANNOUNCER); } 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, qtrue); } 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); } } else if(num >= CS_PLAYERS && num < CS_PLAYERS + MAX_CLIENTS) { CG_NewClientInfo(num - CS_PLAYERS); CG_BuildSpectatorString(); } else if(num == CS_FLAGSTATUS) { if(cgs.gametype == GT_CTF) { // format is rb where its red/blue, 0 is at base, 1 is taken, 2 is dropped cgs.redflag = str[0] - '0'; cgs.blueflag = str[1] - '0'; } else if(cgs.gametype == GT_1FCTF) { cgs.flagStatus = str[0] - '0'; } } else if(num == CS_SHADERSTATE) { CG_ShaderStateChanged(); } }
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( qtrue ); } 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_CLIENT_JEDIMASTER ) { cgs.jediMaster = atoi ( str ); } else if ( num == CS_CLIENT_DUELWINNER ) { cgs.duelWinner = atoi ( str ); } else if ( num == CS_CLIENT_DUELISTS ) { char buf[64]; int c = 0; int i = 0; while (str[i] && str[i] != '|') { buf[c] = str[i]; c++; i++; } buf[c] = 0; cgs.duelist1 = atoi ( buf ); c = 0; i++; while (str[i] && str[i] != '|') { buf[c] = str[i]; c++; i++; } buf[c] = 0; cgs.duelist2 = atoi ( buf ); if (str[i]) { c = 0; i++; while (str[i]) { buf[c] = str[i]; c++; i++; } buf[c] = 0; cgs.duelist3 = atoi(buf); } } else if ( num == CS_CLIENT_DUELHEALTHS ) { // nmckenzie: DUEL_HEALTH SetDuelistHealthsFromConfigString(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 ) ); } 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 ) ); } else if ( num == CS_INTERMISSION ) { cg.intermissionStarted = atoi( str ); } else if ( num >= CS_MODELS && num < CS_MODELS+MAX_MODELS ) { char modelName[MAX_QPATH]; strcpy(modelName, str); if (strstr(modelName, ".glm") || modelName[0] == '$') { //Check to see if it has a custom skin attached. CG_HandleAppendedSkin(modelName); CG_CacheG2AnimInfo(modelName); } if (modelName[0] != '$' && modelName[0] != '@') { //don't register vehicle names and saber names as models. cgs.gameModels[ num-CS_MODELS ] = trap->R_RegisterModel( modelName ); } else { cgs.gameModels[ num-CS_MODELS ] = 0; } // GHOUL2 Insert start /* } else if ( num >= CS_CHARSKINS && num < CS_CHARSKINS+MAX_CHARSKINS ) { cgs.skins[ num-CS_CHARSKINS ] = trap->R_RegisterSkin( str ); */ //rww - removed and replaced with CS_G2BONES // Ghoul2 Insert end } 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 ); } else if (str[1] == '$') { //an NPC soundset CG_PrecacheNPCSounds(str); } } else if ( num >= CS_EFFECTS && num < CS_EFFECTS+MAX_FX ) { if (str[0] == '*') { //it's a special global weather effect CG_ParseWeatherEffect(str); cgs.gameEffects[ num-CS_EFFECTS] = 0; } else { cgs.gameEffects[ num-CS_EFFECTS] = trap->FX_RegisterEffect( str ); } } else if ( num >= CS_SIEGE_STATE && num < CS_SIEGE_STATE+1 ) { if (str[0]) { CG_ParseSiegeState(str); } } else if ( num >= CS_SIEGE_WINTEAM && num < CS_SIEGE_WINTEAM+1 ) { if (str[0]) { cg_siegeWinTeam = atoi(str); } } else if ( num >= CS_SIEGE_OBJECTIVES && num < CS_SIEGE_OBJECTIVES+1 ) { CG_ParseSiegeObjectiveStatus(str); } else if (num >= CS_SIEGE_TIMEOVERRIDE && num < CS_SIEGE_TIMEOVERRIDE+1) { cg_beatingSiegeTime = atoi(str); CG_SetSiegeTimerCvar ( cg_beatingSiegeTime ); } else if ( num >= CS_PLAYERS && num < CS_PLAYERS+MAX_CLIENTS ) { CG_NewClientInfo( num - CS_PLAYERS, qtrue); CG_BuildSpectatorString(); } else if ( num == CS_FLAGSTATUS ) { if( cgs.gametype == GT_CTF || cgs.gametype == GT_CTY ) { // format is rb where its red/blue, 0 is at base, 1 is taken, 2 is dropped int redflagId = str[0] - '0', blueflagId = str[1] - '0'; if ( redflagId >= 0 && redflagId < ARRAY_LEN( ctfFlagStatusRemap ) ) cgs.redflag = ctfFlagStatusRemap[redflagId]; if ( blueflagId >= 0 && blueflagId < ARRAY_LEN( ctfFlagStatusRemap ) ) cgs.blueflag = ctfFlagStatusRemap[blueflagId]; } } else if ( num == CS_SHADERSTATE ) { CG_ShaderStateChanged(); } else if ( num >= CS_LIGHT_STYLES && num < CS_LIGHT_STYLES + (MAX_LIGHT_STYLES * 3)) { CG_SetLightstyle(num - CS_LIGHT_STYLES); } }
/* ================ 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_AnnounceAlienStageTransition( 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_AnnounceHumanStageTransition( 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( qtrue ); } 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_CLIENT_JEDIMASTER ) { cgs.jediMaster = atoi ( str ); } else if ( num == CS_CLIENT_DUELWINNER ) { cgs.duelWinner = atoi ( str ); } else if ( num == CS_CLIENT_DUELISTS ) { char buf[64]; int c = 0; int i = 0; while (str[i] && str[i] != '|') { buf[c] = str[i]; c++; i++; } buf[c] = 0; cgs.duelist1 = atoi ( buf ); c = 0; i++; while (str[i]) { buf[c] = str[i]; c++; i++; } buf[c] = 0; cgs.duelist2 = atoi ( buf ); } 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 ) ); } 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 ) ); } 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 ); // GHOUL2 Insert start } else if ( num >= CS_CHARSKINS && num < CS_CHARSKINS+MAX_CHARSKINS ) { cgs.skins[ num-CS_CHARSKINS ] = trap_R_RegisterSkin( str ); // Ghoul2 Insert end } 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 ); } } else if ( num >= CS_EFFECTS && num < CS_SOUNDS+MAX_SOUNDS ) { if ( str[0] != '*' ) { // player specific sounds don't register here cgs.gameEffects[ num-CS_EFFECTS] = trap_FX_RegisterEffect( str ); } } else if ( num >= CS_PLAYERS && num < CS_PLAYERS+MAX_CLIENTS ) { CG_NewClientInfo( num - CS_PLAYERS, qtrue); CG_BuildSpectatorString(); } else if ( num == CS_FLAGSTATUS ) { if( cgs.gametype == GT_CTF || cgs.gametype == GT_CTY ) { // format is rb where its red/blue, 0 is at base, 1 is taken, 2 is dropped cgs.redflag = str[0] - '0'; cgs.blueflag = str[1] - '0'; } } else if ( num == CS_SHADERSTATE ) { CG_ShaderStateChanged(); } else if ( num >= CS_LIGHT_STYLES && num < CS_LIGHT_STYLES + (MAX_LIGHT_STYLES * 3)) { CG_SetLightstyle(num - CS_LIGHT_STYLES); } }
/* ================ CG_ConfigStringModified ================ */ static void CG_ConfigStringModified() { const char *str; int num; // update the config string state with the new data, keeping in sync // with the config strings in the engine. // The engine already checked the inputs num = atoi( CG_Argv( 1 ) ); cgs.gameState[num] = CG_Argv(2); // look up the individual string that was modified str = CG_ConfigString( num ); //CG_Printf("configstring modification %i: %s\n", num, str); // 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_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 ] = true; 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 ] = true; } 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 ] = true; } 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 ); if ( cg.intermissionStarted ) { Rocket_ShowScoreboard( "scoreboard", true ); } } 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, RSF_DEFAULT); } else if ( num >= CS_GRADING_TEXTURES && num < CS_GRADING_TEXTURES + MAX_GRADING_TEXTURES ) { CG_RegisterGrading( num - CS_GRADING_TEXTURES, 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, false ); } } 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(); } }