/* =============== CG_MapRestart The server has issued a map_restart, so the next snapshot is completely new and should not be interpolated to. A tournement restart will clear everything, but doesn't require a reload of all the media =============== */ static void CG_MapRestart( void ) { if ( cg_showmiss.integer ) { CG_Printf( "CG_MapRestart\n" ); } CG_InitLocalEntities(); CG_InitMarkPolys(); // make sure the "3 frags left" warnings play again cg.fraglimitWarnings = 0; cg.timelimitWarnings = 0; cg.intermissionStarted = qfalse; cgs.voteTime = 0; cg.mapRestart = qtrue; CG_StartMusic(); trap_S_ClearLoopingSounds(qtrue); // we really should clear more parts of cg here and stop sounds #ifdef MISSIONPACK if (cg_singlePlayerActive.integer) { trap_Cvar_Set("ui_matchStartTime", va("%i", cg.time)); if (cg_recordSPDemo.integer && cg_recordSPDemoName.string && *cg_recordSPDemoName.string) { trap_SendConsoleCommand(va("set g_synchronousclients 1 ; record %s \n", cg_recordSPDemoName.string)); } } #endif }
/* =============== CG_MapRestart The server has issued a map_restart, so the next snapshot is completely new and should not be interpolated to. A tournement restart will clear everything, but doesn't require a reload of all the media =============== */ static void CG_MapRestart( void ) { if ( cg_showmiss.integer ) { CG_Printf( "CG_MapRestart\n" ); } CG_InitMarkPolys(); // make sure the "3 frags left" warnings play again cg.fraglimitWarnings = 0; cg.timelimitWarnings = 0; cg.intermissionStarted = qfalse; cgs.voteTime = 0; cg.mapRestart = qtrue; CG_StartMusic(); trap_S_ClearLoopingSounds( qtrue ); // we really should clear more parts of cg here and stop sounds // play the "fight" sound if this is a restart without warmup if ( cg.warmup == 0 ) { CG_CenterPrint( "FIGHT!", 120, GIANTCHAR_WIDTH * 2 ); } trap_Cvar_Set( "cg_thirdPerson", "0" ); }
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 cgi_GetGameState( &cgs.gameState ); // look up the individual string that was modified str = CG_ConfigString( num ); // do something with it if necessary if ( num == CS_ITEMS ) { int i; for ( i = 1 ; i < bg_numItems ; i++ ) { if ( str[ i ] == '1' ) { if (bg_itemlist[i].classname) { CG_RegisterItemSounds( i ); CG_RegisterItemVisuals( i ); } } } } else if ( num == CS_MUSIC ) { CG_StartMusic( qtrue ); } else if ( num == CS_SERVERINFO ) { CG_ParseServerinfo(); } else if ( num >= CS_MODELS && num < CS_MODELS+MAX_MODELS ) { cgs.model_draw[ num-CS_MODELS ] = cgi_R_RegisterModel( str ); // OutputDebugString(va("### CG_ConfigStringModified(): cgs.model_draw[%d] = \"%s\"\n",num-CS_MODELS,str)); // GHOUL2 Insert start } else if ( num >= CS_CHARSKINS && num < CS_CHARSKINS+MAX_CHARSKINS ) { cgs.skins[ num-CS_CHARSKINS ] = cgi_R_RegisterSkin( str ); // Ghoul2 Insert end } else if ( num >= CS_SOUNDS && num < CS_SOUNDS+MAX_SOUNDS ) { if ( str[0] != '*' ) { cgs.sound_precache[ num-CS_SOUNDS] = cgi_S_RegisterSound( str ); } } else if ( num >= CS_EFFECTS && num < CS_EFFECTS + MAX_FX ) { theFxScheduler.RegisterEffect( str ); } else if ( num >= CS_PLAYERS && num < CS_PLAYERS+MAX_CLIENTS ) { CG_NewClientinfo( num - CS_PLAYERS ); CG_RegisterClientModels( num - CS_PLAYERS ); } else if ( num >= CS_LIGHT_STYLES && num < CS_LIGHT_STYLES + (MAX_LIGHT_STYLES*3)) { CG_SetLightstyle(num - CS_LIGHT_STYLES); } else if ( num >= CS_WORLD_FX && num < CS_WORLD_FX + MAX_WORLD_FX ) { cgi_R_WorldEffectCommand( str ); } }
// The server has issued a map_restart, so the next snapshot is completely new and should not be interpolated to. // A tournament restart will clear everything, but doesn't require a reload of all the media static void CG_MapRestart( void ) { if ( cg_showMiss.integer ) trap->Print( "CG_MapRestart\n" ); trap->R_ClearDecals(); //FIXME: trap->FX_Reset? CG_InitLocalEntities(); CG_InitMarkPolys(); CG_KillCEntityInstances(); cg.fraglimitWarnings = 0; cg.timelimitWarnings = 0; cg.intermissionStarted = qfalse; cgs.voteTime = 0; cg.mapRestart = qtrue; CG_StartMusic( qtrue ); trap->S_ClearLoopingSounds(); // we really should clear more parts of cg here and stop sounds // play the "fight" sound if this is a restart without warmup if ( cg.warmup == 0 && cgs.gametype != GT_SIEGE && cgs.gametype != GT_POWERDUEL ) { trap->S_StartLocalSound( media.sounds.warning.countFight, CHAN_ANNOUNCER ); CG_CenterPrint( CG_GetStringEdString( "MP_SVGAME", "BEGIN_DUEL" ), 120, GIANTCHAR_WIDTH * 2 ); } }
/* =============== CG_MapRestart The server has issued a map_restart, so the next snapshot is completely new and should not be interpolated to. A tournement restart will clear everything, but doesn't require a reload of all the media =============== */ static void CG_MapRestart( void ) { if( cg_showmiss.integer ) CG_Printf( "CG_MapRestart\n" ); CG_InitMarkPolys( ); // make sure the "3 frags left" warnings play again cg.fraglimitWarnings = 0; cg.timelimitWarnings = 0; cg.intermissionStarted = qfalse; cgs.voteTime[ TEAM_NONE ] = 0; cg.mapRestart = qtrue; CG_StartMusic( ); trap_S_ClearLoopingSounds( qtrue ); // we really should clear more parts of cg here and stop sounds trap_Cvar_Set( "cg_thirdPerson", "0" ); cg.splashTime = cg.time; }
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 cgi_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_MODELS && num < CS_MODELS+MAX_MODELS ) { cgs.model_draw[ num-CS_MODELS ] = cgi_R_RegisterModel( str ); } else if ( num >= CS_SOUNDS && num < CS_SOUNDS+MAX_MODELS ) { if ( str[0] != '*' ) { cgs.sound_precache[ num-CS_SOUNDS] = cgi_S_RegisterSound( str ); } } else if ( num >= CS_PLAYERS && num < CS_PLAYERS+MAX_CLIENTS ) { CG_NewClientinfo( num - CS_PLAYERS ); CG_RegisterClientModels( num - CS_PLAYERS ); } }
/* =============== CG_MapRestart The server has issued a map_restart, so the next snapshot is completely new and should not be interpolated to. A tournement restart will clear everything, but doesn't require a reload of all the media =============== */ static void CG_MapRestart(void) { if(cg_showmiss.integer) { CG_Printf("CG_MapRestart\n"); } CG_InitLocalEntities(); CG_InitMarkPolys(); CG_InitParticles(); // make sure the "3 frags left" warnings play again cg.fraglimitWarnings = 0; cg.timelimitWarnings = 0; cg.intermissionStarted = qfalse; cgs.voteTime = 0; cg.mapRestart = qtrue; CG_StartMusic(); trap_S_ClearLoopingSounds(qtrue); // we really should clear more parts of cg here and stop sounds // play the "fight" sound if this is a restart without warmup if(cg.warmup == 0 /* && cgs.gametype == GT_TOURNAMENT */ ) { trap_S_StartLocalSound(cgs.media.countFightSound, CHAN_ANNOUNCER); CG_CenterPrint("FIGHT!", 120, GIANTCHAR_WIDTH * 2); } #ifdef MISSIONPACK if(cg_singlePlayerActive.integer) { trap_Cvar_Set("ui_matchStartTime", va("%i", cg.time)); if(cg_recordSPDemo.integer && cg_recordSPDemoName.string && *cg_recordSPDemoName.string) { trap_SendConsoleCommand(va("set g_synchronousclients 1 ; record %s \n", cg_recordSPDemoName.string)); } } #endif trap_Cvar_Set("cg_cameraOrbit", "0"); trap_Cvar_Set("cg_thirdPerson", "0"); }
/* =============== CG_MapRestart The server has issued a map_restart, so the next snapshot is completely new and should not be interpolated to. A tournement restart will clear everything, but doesn't require a reload of all the media =============== */ static void CG_MapRestart( void ) { if ( cg_showMiss.integer ) { trap->Print( "CG_MapRestart\n" ); } trap->R_ClearDecals ( ); //FIXME: trap->FX_Reset? CG_InitLocalEntities(); CG_InitMarkPolys(); CG_KillCEntityInstances(); // make sure the "3 frags left" warnings play again cg.fraglimitWarnings = 0; cg.timelimitWarnings = 0; cg.intermissionStarted = qfalse; cgs.voteTime = 0; cg.mapRestart = qtrue; CG_StartMusic(qtrue); trap->S_ClearLoopingSounds(); // we really should clear more parts of cg here and stop sounds // play the "fight" sound if this is a restart without warmup if ( cg.warmup == 0 && cgs.gametype != GT_POWERDUEL/* && cgs.gametype == GT_DUEL */) { trap->S_StartLocalSound( cgs.media.countFightSound, CHAN_ANNOUNCER ); CG_CenterPrint( CG_GetStringEdString("MP_SVGAME", "BEGIN_DUEL"), 120, GIANTCHAR_WIDTH*2 ); } /* if (cg_singlePlayerActive.integer) { trap->Cvar_Set("ui_matchStartTime", va("%i", cg.time)); if (cg_recordSPDemo.integer && cg_recordSPDemoName.string && *cg_recordSPDemoName.string) { trap->SendConsoleCommand(va("set g_synchronousclients 1 ; record %s \n", cg_recordSPDemoName.string)); } } */ trap->Cvar_Set("cg_thirdPerson", "0"); cg.numItemsInInventory = 0; memset(cg.playerInventory, 0, sizeof(cg.playerInventory)); memset(cg.playerACI, -1, sizeof(cg.playerACI)); }
/* =============== CG_MapRestart The server has issued a map_restart, so the next snapshot is completely new and should not be interpolated to. A tournement restart will clear everything, but doesn't require a reload of all the media =============== */ static void CG_MapRestart( void ) { if ( cg_showmiss.integer ) { CG_Printf( "CG_MapRestart\n" ); } CG_InitMarkPolys(); cg.intermissionStarted = qfalse; cgs.voteTime[ TEAM_NONE ] = 0; cg.mapRestart = qtrue; CG_StartMusic(); trap_S_ClearLoopingSounds( qtrue ); // we really should clear more parts of cg here and stop sounds trap_Cvar_Set( "cg_thirdPerson", "0" ); }
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_Init Called after every level change or subsystem restart Will perform callbacks to make the loading info screen update. ================= */ void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum, int randomSeed ) { const char *s; // clear everything memset( &cgs, 0, sizeof( cgs ) ); memset( &cg, 0, sizeof( cg ) ); memset( cg_entities, 0, sizeof(cg_entities) ); srand( randomSeed ); cg.clientNum = clientNum; cgs.processedSnapshotNum = serverMessageNum; cgs.serverCommandSequence = serverCommandSequence; trap_R_RegisterFont( "facfont-20", 0, &cgs.media.facfont ); trap_R_RegisterFont( "verdana-14", 0, &cgs.media.verdana ); // load a few needed things before we do any screen updates // cgs.media.charsetShader = trap_R_RegisterShader( "gfx/2d/bigchars" ); cgs.media.whiteShader = trap_R_RegisterShader( "*white" ); // cgs.media.charsetProp = trap_R_RegisterShaderNoMip( "menu/art/font1_prop.tga" ); // cgs.media.charsetPropGlow = trap_R_RegisterShaderNoMip( "menu/art/font1_prop_glo.tga" ); // cgs.media.charsetPropB = trap_R_RegisterShaderNoMip( "menu/art/font2_prop.tga" ); cgs.media.blackShader = trap_R_RegisterShaderNoMip( "textures/mohmenu/black.tga" ); CG_RegisterCvars(); CG_InitConsoleCommands(); // get the rendering configuration from the client system trap_GetGlconfig( &cgs.glconfig ); cgs.screenXScale = cgs.glconfig.vidWidth / 640.0; cgs.screenYScale = cgs.glconfig.vidHeight / 480.0; // get the gamestate from the client system trap_GetGameState( &cgs.gameState ); // check version s = CG_ConfigString( CS_GAME_VERSION ); if ( strcmp( s, GAME_VERSION ) ) { CG_Error( "Client/Server game mismatch: %s/%s", GAME_VERSION, s ); } s = CG_ConfigString( CS_LEVEL_START_TIME ); cgs.levelStartTime = atoi( s ); CG_ParseServerinfo(); // load the new map CG_LoadingString( "collision map" ); trap_CM_LoadMap( cgs.mapname ); CG_LoadingString( "sounds" ); CG_RegisterSounds(); CG_LoadUbersound(); CG_LoadingString( "graphics" ); CG_RegisterGraphics(); CG_LoadingString( "clients" ); CG_RegisterClients(); // if low on memory, some clients will be deferred CG_InitLocalEntities(); CG_InitMarkPolys(); CG_InitEventSystem(); CG_InitBeams(); CG_InitRainEffect(); // remove the last loading update cg.infoScreenText[0] = 0; // Make sure we have update values (scores) CG_SetConfigValues(); CG_StartMusic(); CG_LoadingString( "" ); trap_S_ClearLoopingSounds( qtrue ); }
/* ================ 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_MUSIC_QUEUE ) { //----(SA) added CG_QueueMusic(); } else if ( num == CS_MISSIONSTATS ) { //----(SA) added CG_ParseMissionStats(); } 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 ) ); #if 0 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 ); #endif } else if ( num == CS_INTERMISSION ) { cg.intermissionStarted = atoi( str ); } else if ( num == CS_SCREENFADE ) { CG_ParseScreenFade(); } else if ( num == CS_FOGVARS ) { CG_ParseFog(); } 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 // Ridah, register sound scripts seperately if ( !strstr( str, ".wav" ) ) { CG_SoundScriptPrecache( str ); } else { cgs.gameSounds[ num - CS_SOUNDS] = trap_S_RegisterSound( str ); } } } else if ( num >= CS_PLAYERS && num < CS_PLAYERS + MAX_CLIENTS ) { CG_NewClientInfo( num - CS_PLAYERS ); } // Rafael particle configstring else if ( num >= CS_PARTICLES && num < CS_PARTICLES + MAX_PARTICLES_AREAS ) { CG_NewParticleArea( num ); } //----(SA) have not reached this code yet so I don't know if I really need this here else if ( num >= CS_DLIGHTS && num < CS_DLIGHTS + MAX_DLIGHTS ) { CG_Printf( ">>>>>>>>>>>got configstring for dlight: %d\ntell Sherman!!!!!!!!!!", num - CS_DLIGHTS ); //----(SA) } else if ( num == CS_SHADERSTATE ) { CG_ShaderStateChanged(); } }
/* ================= CG_Init Called after every level change or subsystem restart Will perform callbacks to make the loading info screen update. ================= */ void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum ) { const char *s; // clear everything memset( &cgs, 0, sizeof( cgs ) ); memset( &cg, 0, sizeof( cg ) ); memset( cg_entities, 0, sizeof(cg_entities) ); memset( cg_weapons, 0, sizeof(cg_weapons) ); memset( cg_items, 0, sizeof(cg_items) ); cg.clientNum = clientNum; cgs.processedSnapshotNum = serverMessageNum; cgs.serverCommandSequence = serverCommandSequence; // load a few needed things before we do any screen updates cgs.media.charsetShader = trap_R_RegisterShader( "gfx/2d/bigchars" ); cgs.media.whiteShader = trap_R_RegisterShader( "white" ); cgs.media.charsetProp = trap_R_RegisterShaderNoMip( "menu/art/font1_prop.tga" ); cgs.media.charsetPropGlow = trap_R_RegisterShaderNoMip( "menu/art/font1_prop_glo.tga" ); cgs.media.charsetPropB = trap_R_RegisterShaderNoMip( "menu/art/font2_prop.tga" ); CG_RegisterCvars(); CG_InitConsoleCommands(); cg.weaponSelect = WP_MACHINEGUN; cgs.redflag = cgs.blueflag = -1; // For compatibily, default to unset for cgs.flagStatus = -1; // old servers // get the rendering configuration from the client system trap_GetGlconfig( &cgs.glconfig ); cgs.screenXScale = cgs.glconfig.vidWidth / 640.0; cgs.screenYScale = cgs.glconfig.vidHeight / 480.0; // get the gamestate from the client system trap_GetGameState( &cgs.gameState ); // check version s = CG_ConfigString( CS_GAME_VERSION ); if ( strcmp( s, GAME_VERSION ) ) { CG_Error( "Client/Server game mismatch: %s/%s", GAME_VERSION, s ); } s = CG_ConfigString( CS_LEVEL_START_TIME ); cgs.levelStartTime = atoi( s ); CG_ParseServerinfo(); // load the new map CG_LoadingString( "collision map" ); trap_CM_LoadMap( cgs.mapname ); cg.loading = qtrue; // force players to load instead of defer CG_LoadingString( "sounds" ); CG_RegisterSounds(); CG_LoadingString( "graphics" ); CG_RegisterGraphics(); CG_LoadingString( "clients" ); CG_RegisterClients(); // if low on memory, some clients will be deferred cg.loading = qfalse; // future players will be deferred CG_InitLocalEntities(); CG_InitMarkPolys(); // remove the last loading update cg.infoScreenText[0] = 0; // Make sure we have update values (scores) CG_SetConfigValues(); CG_StartMusic(); CG_LoadingString( "" ); CG_ShaderStateChanged(); trap_S_ClearLoopingSounds( qtrue ); }
void CG_StopDeathMusic( void ) { trap_S_StopBackgroundTrack(); cg.deathmusicStarted = qfalse; CG_StartMusic(); }
/* =============== CG_MapRestart The server has issued a map_restart, so the next snapshot is completely new and should not be interpolated to. A tournement restart will clear everything, but doesn't require a reload of all the media =============== */ static void CG_MapRestart( void ) { // char buff[64]; int i; if ( cg_showmiss.integer ) { CG_Printf( "CG_MapRestart\n" ); } memset( &cg.lastWeapSelInBank[0], 0, MAX_WEAP_BANKS * sizeof( int ) ); // clear weapon bank selections cg.centerPrintTime = 0; // reset centerprint counter so previous messages don't re-appear cg.itemPickupTime = 0; // reset item pickup counter so previous messages don't re-appear cg.cursorHintFade = 0; // reset cursor hint timer cg.yougotmailTime = 0; // reset // (SA) clear zoom (so no warpies) cg.zoomedBinoc = qfalse; cg.zoomedBinoc = cg.zoomedScope = qfalse; cg.zoomTime = 0; cg.zoomval = 0; // reset fog to world fog (if present) // trap_R_SetFog(FOG_CMD_SWITCHFOG, FOG_MAP,20,0,0,0,0); // trap_Cvar_VariableStringBuffer("r_mapFogColor", buff, sizeof(buff)); // trap_SendClientCommand(va("fogswitch %s", buff) ); CG_InitLocalEntities(); CG_InitMarkPolys(); //Rafael particles CG_ClearParticles(); // done. for ( i = 1; i < MAX_PARTICLES_AREAS; i++ ) { { int rval; rval = CG_NewParticleArea( CS_PARTICLES + i ); if ( !rval ) { break; } } } // Ridah, trails CG_ClearTrails(); // done. // Ridah CG_ClearFlameChunks(); CG_SoundInit(); // done. // RF, init ZombieFX trap_RB_ZombieFXAddNewHit( -1, NULL, NULL ); // make sure the "3 frags left" warnings play again cg.fraglimitWarnings = 0; cg.timelimitWarnings = 0; cg.intermissionStarted = qfalse; cgs.voteTime = 0; cg.lightstylesInited = qfalse; cg.mapRestart = qtrue; CG_StartMusic(); trap_S_ClearLoopingSounds( qtrue ); // we really should clear more parts of cg here and stop sounds cg.v_dmg_time = 0; cg.v_noFireTime = 0; cg.v_fireTime = 0; // RF, clear out animScriptData so we recalc everything and get new pointers from server memset( cgs.animScriptData.modelInfo, 0, sizeof( cgs.animScriptData.modelInfo ) ); for ( i = 0; i < MAX_CLIENTS; i++ ) { if ( cgs.clientinfo[i].infoValid ) { CG_LoadClientInfo( &cgs.clientinfo[i] ); // re-register the valid clients } } // always clear the weapon selection cg.weaponSelect = WP_NONE; // clear out the player weapon info memset( &cg_entities[0].pe.weap, 0, sizeof( cg_entities[0].pe.weap ) ); // check for server set weapons we might not know about // (FIXME: this is a hack for the time being since a scripted "selectweapon" does // not hit the first snap, the server weapon set in cg_playerstate.c line 219 doesn't // do the trick) if ( !cg.weaponSelect ) { if ( cg_loadWeaponSelect.integer > 0 ) { cg.weaponSelect = cg_loadWeaponSelect.integer; cg.weaponSelectTime = cg.time; trap_Cvar_Set( "cg_loadWeaponSelect", "0" ); // turn it off } } // clear out rumble effects memset( cg.cameraShake, 0, sizeof( cg.cameraShake ) ); memset( cg.cameraShakeAngles, 0, sizeof( cg.cameraShakeAngles ) ); cg.rumbleScale = 0; // play the "fight" sound if this is a restart without warmup // if ( cg.warmup == 0 /* && cgs.gametype == GT_TOURNAMENT */) { // trap_S_StartLocalSound( cgs.media.countFightSound, CHAN_ANNOUNCER ); // CG_CenterPrint( "FIGHT!", 120, GIANTCHAR_WIDTH*2 ); // } #ifdef MISSIONPACK if ( cg_singlePlayerActive.integer ) { trap_Cvar_Set( "ui_matchStartTime", va( "%i", cg.time ) ); if ( cg_recordSPDemo.integer && cg_recordSPDemoName.string && *cg_recordSPDemoName.string ) { trap_SendConsoleCommand( va( "set g_synchronousclients 1 ; record %s \n", cg_recordSPDemoName.string ) ); } } #endif trap_Cvar_Set( "cg_thirdPerson", "0" ); }
/* ================ 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(); } }
/* ================ 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_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(); } 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(); } }