/* ================= CG_ServerCommand The string has been tokenized and can be retrieved with Cmd_Argc() / Cmd_Argv() ================= */ static void CG_ServerCommand( void ) { const char *cmd; consoleCommand_t *command; cmd = CG_Argv( 0 ); command = bsearch( cmd, svcommands, sizeof( svcommands ) / sizeof( svcommands[ 0 ]), sizeof( svcommands[ 0 ] ), cmdcmp ); if( command ) { command->function( ); return; } CG_Printf( "Unknown client game command: %s\n", cmd ); }
/* ================= CG_ConsoleCommand The string has been tokenized and can be retrieved with Cmd_Argc() / Cmd_Argv() ================= */ qboolean CG_ConsoleCommand( void ) { const char *cmd; int i; cmd = CG_Argv(0); for ( i = 0 ; i < ARRAY_LEN( commands ) ; i++ ) { if ( !Q_stricmp( cmd, commands[i].cmd ) ) { commands[i].function(); return qtrue; } } if(CG_Cutscene2d_CheckCmd(cmd)) return qtrue; return qfalse; }
/* ================= CG_ServerCommand The string has been tokenized and can be retrieved with Cmd_Argc() / Cmd_Argv() ================= */ static void CG_ServerCommand( void ) { const char *cmd = CG_Argv( 0 ); serverCommand_t *command = NULL; if ( !cmd[0] ) { // server claimed the command return; } command = (serverCommand_t *)Q_LinearSearch( cmd, commands, numCommands, sizeof( commands[0] ), svcmdcmp ); if ( command ) { command->func(); return; } trap->Print( "Unknown client game command: %s\n", cmd ); }
static void CG_Rocket_InitServers() { const char *src = CG_Argv( 1 ); trap_LAN_ResetPings( CG_StringToNetSource( src ) ); trap_LAN_ResetServerStatus(); if ( !Q_stricmp( src, "internet" ) ) { trap_SendConsoleCommand( "globalservers 0 86 full empty\n" ); } else if ( !Q_stricmp( src, "local" ) ) { trap_SendConsoleCommand( "localservers\n" ); } trap_LAN_UpdateVisiblePings( CG_StringToNetSource( src ) ); }
/* ================= CG_ParseScores ================= */ static void CG_ParseScores( void ) { int i; cg.numScores = ( trap_Argc() - 3 ) / 6; if ( cg.numScores > MAX_CLIENTS ) { cg.numScores = MAX_CLIENTS; } cg.teamScores[ 0 ] = atoi( CG_Argv( 1 ) ); cg.teamScores[ 1 ] = atoi( CG_Argv( 2 ) ); memset( cg.scores, 0, sizeof( cg.scores ) ); if ( cg_debugRandom.integer ) { CG_Printf( "cg.numScores: %d\n", cg.numScores ); } for ( i = 0; i < cg.numScores; i++ ) { // cg.scores[ i ].client = atoi( CG_Argv( i * 6 + 3 ) ); cg.scores[ i ].score = atoi( CG_Argv( i * 6 + 4 ) ); cg.scores[ i ].ping = atoi( CG_Argv( i * 6 + 5 ) ); cg.scores[ i ].time = atoi( CG_Argv( i * 6 + 6 ) ); cg.scores[ i ].weapon = atoi( CG_Argv( i * 6 + 7 ) ); cg.scores[ i ].upgrade = atoi( CG_Argv( i * 6 + 8 ) ); if ( cg.scores[ i ].client < 0 || cg.scores[ i ].client >= MAX_CLIENTS ) { cg.scores[ i ].client = 0; } cgs.clientinfo[ cg.scores[ i ].client ].score = cg.scores[ i ].score; cg.scores[ i ].team = cgs.clientinfo[ cg.scores[ i ].client ].team; } }
void CG_WriteCam_f (void) { char text[1024]; char *targetname; static int numCams; numCams++; targetname = (char *)CG_Argv(1); if( !targetname || !targetname[0] ) { targetname = "nameme!"; } CG_Printf( "Camera #%d ('%s') written to: ", numCams, targetname ); sprintf( text, "//entity %d\n{\n\"classname\" \"ref_tag\"\n\"targetname\" \"%s\"\n\"origin\" \"%i %i %i\"\n\"angles\" \"%i %i %i\"\n\"fov\" \"%i\"\n}\n", numCams, targetname, (int)cg.refdef.vieworg[0], (int)cg.refdef.vieworg[1], (int)cg.refdef.vieworg[2], (int)cg.refdefViewAngles[0], (int)cg.refdefViewAngles[1], (int)cg.refdefViewAngles[2], cg_fov.integer ); gi.WriteCam( text ); }
// The string has been tokenized and can be retrieved with Cmd_Argc() / Cmd_Argv() qboolean CG_ConsoleCommand( void ) { const char *cmd = NULL; const command_t *command = NULL; if ( JPLua_Event_ConsoleCommand() ) return qtrue; cmd = CG_Argv( 0 ); command = (command_t *)bsearch( cmd, commands, numCommands, sizeof(commands[0]), cmdcmp ); if ( !command ) return qfalse; if ( !command->func ) return qfalse; command->func(); return qtrue; }
static void demoSeekTwoCommand_f(void) { const char *cmd = CG_Argv(1); if (isdigit( cmd[0] )) { //teh's parser for time MM:SS.MSEC, thanks *bow* int i; char *sec, *min;; min = (char *)cmd; for( i=0; min[i]!=':'&& min[i]!=0; i++ ); if(cmd[i]==0) sec = 0; else { min[i] = 0; sec = min+i+1; } demo.play.time = ( atoi( min ) * 60000 + ( sec ? atof( sec ) : 0 ) * 1000 ); demo.play.fraction = 0; } }
void CG_TestVehicle (long cat) { vec3_t angles; int i; if( cat != CAT_PLANE && cat != CAT_GROUND ) { return; } cg.testVehicleCat = cat; for( i = 0; i < BP_MAX_PARTS; ++i ) { memset( &cg.testVehicleParts[i], 0, sizeof(cg.testVehicleParts[i]) ); } if ( Cmd_Argc() < 2 ) { return; } Q_strncpyz (cg.testVehicleName, CG_Argv( 1 ), MAX_QPATH ); registerTestVehicle(); /* if ( Cmd_Argc() == 3 ) { cg.testModelEntity.backlerp = atof( CG_Argv( 2 ) ); cg.testModelEntity.frame = 1; cg.testModelEntity.oldframe = 0; }*/ if (! cg.testVehicleParts[0].hModel ) { CG_Printf( "Can't register model\n" ); return; } angles[PITCH] = 0; angles[YAW] = 180 + cg.refdefViewAngles[1]; angles[ROLL] = 0; for( i = 0; i < BP_MAX_PARTS; ++i ) { VectorMA( cg.refdef.vieworg, 100, cg.refdef.viewaxis[0], cg.testVehicleParts[i].origin ); AnglesToAxis( angles, cg.testVehicleParts[i].axis ); } // cg.testGun = false; }
/* ================= CG_ParseTeamInfo ================= */ static void CG_ParseTeamInfo( void ) { int i=0, client=0; //Raz: avoid crash if server sends invalid range numSortedTeamPlayers = Com_Clampi( 0, TEAM_MAXOVERLAY, atoi( CG_Argv( 1 ) ) ); for ( i=0; i<numSortedTeamPlayers; i++ ) { client = Com_Clampi( 0, MAX_CLIENTS, atoi( CG_Argv( i * 6 + 2 ) ) ); sortedTeamPlayers[i] = client; cgs.clientinfo[ client ].location = atoi( CG_Argv( i * 6 + 3 ) ); cgs.clientinfo[ client ].health = atoi( CG_Argv( i * 6 + 4 ) ); cgs.clientinfo[ client ].armor = atoi( CG_Argv( i * 6 + 5 ) ); cgs.clientinfo[ client ].curWeapon = atoi( CG_Argv( i * 6 + 6 ) ); cgs.clientinfo[ client ].powerups = atoi( CG_Argv( i * 6 + 7 ) ); } }
/* ================= CG_ParseTeamInfo ================= */ static void CG_ParseTeamInfo( void ) { int i; int client; numSortedTeamPlayers = atoi( CG_Argv( 1 ) ); for ( i = 0 ; i < numSortedTeamPlayers ; i++ ) { client = atoi( CG_Argv( i * 6 + 2 ) ); sortedTeamPlayers[i] = client; cgs.clientinfo[ client ].location = atoi( CG_Argv( i * 6 + 3 ) ); cgs.clientinfo[ client ].health = atoi( CG_Argv( i * 6 + 4 ) ); cgs.clientinfo[ client ].armor = atoi( CG_Argv( i * 6 + 5 ) ); cgs.clientinfo[ client ].curWeapon = atoi( CG_Argv( i * 6 + 6 ) ); cgs.clientinfo[ client ].powerups = atoi( CG_Argv( i * 6 + 7 ) ); } }
/* ================= CG_ConsoleCommand The string has been tokenized and can be retrieved with Cmd_Argc() / Cmd_Argv() ================= */ qboolean CG_ConsoleCommand( void ) { consoleCommand_t *cmd; //ZT hook if (ZT_Command( ) == qtrue) { return qtrue; } cmd = bsearch( CG_Argv( 0 ), commands, sizeof( commands ) / sizeof( commands[ 0 ]), sizeof( commands[ 0 ] ), cmdcmp ); if( !cmd ) return qfalse; cmd->function( ); return qtrue; }
/* ================= CG_ConsoleCommand The string has been tokenized and can be retrieved with Cmd_Argc() / Cmd_Argv() ================= */ qboolean CG_ConsoleCommand( void ) { const char *cmd; int i; // Arnout - don't allow console commands until a snapshot is present if ( !cg.snap ) { return qfalse; } cmd = CG_Argv( 0 ); for ( i = 0 ; i < sizeof( commands ) / sizeof( commands[0] ) ; i++ ) { if ( !Q_stricmp( cmd, commands[i].cmd ) ) { commands[i].function(); return qtrue; } } return qfalse; }
void CG_Rocket_ProcessEvents() { eventCmd_t *cmd; std::string cmdText; // Get the even command while ( Rocket_GetEvent(cmdText) ) { Cmd::PushArgs(cmdText); cmd = (eventCmd_t*) bsearch( CG_Argv( 0 ), eventCmdList, eventCmdListCount, sizeof( eventCmd_t ), eventCmdCmp ); if ( cmd ) { cmd->exec(); } Cmd::PopArgs(); Rocket_DeleteEvent(); } }
static void CG_Set_MFD_Page( int num ) { int page; if( Cmd_Argc() < 2 ) { return; } page = atoi( CG_Argv(1) ); if( page < 0 ) page = 0; else if( page >= MFD_MAX ) page = MFD_MAX - 1; cg.Mode_MFD[num] = page; if( num == MFD_1 ) Cvar_Set( "mfd1_defaultpage", va("%d", page) ); else if( num == MFD_2 ) Cvar_Set( "mfd2_defaultpage", va("%d", page) ); }
/* ================= CG_Play_f ================= */ void CG_Play_f( void ) { int i; int c; sfxHandle_t h; c = trap_Argc(); if( c < 2 ) { Com_Printf ("Usage: play <sound filename> [sound filename] [sound filename] ...\n"); return; } for( i = 1; i < c; i++ ) { h = trap_S_RegisterSound( CG_Argv( i ), qfalse ); if( h ) { trap_S_StartLocalSound( h, CHAN_LOCAL_SOUND ); } } }
/* ================= CG_Announce_f Play an announcer sound ================= */ static void CG_Announce( void ) { const char *event, *soundName; if( !cg_announcer.integer ) return; if( trap_Argc( ) != 2 ) return; event = CG_Argv( 1 ); if( !Q_stricmp( event, "votenow" ) || !Q_stricmp( event, "votecancelled" ) || !Q_stricmp( event, "votefailed" ) || !Q_stricmp( event, "votepassed" ) || !Q_stricmp( event, "timelimit_hit" ) || !Q_stricmp( event, "timelimit_1min" ) || !Q_stricmp( event, "timelimit_5min" ) || !Q_stricmp( event, "suddendeath" ) || !Q_stricmp( event, "sdimminent" ) || !Q_stricmp( event, "alienswin" ) || !Q_stricmp( event, "aliensadmit" ) || !Q_stricmp( event, "alienslocked" ) || !Q_stricmp( event, "aliensunlocked" ) || !Q_stricmp( event, "humanswin" ) || !Q_stricmp( event, "humansadmit" ) || !Q_stricmp( event, "humanslocked" ) || !Q_stricmp( event, "humansunlocked" ) || !Q_stricmp( event, "stalemate" ) || !Q_stricmp( event, "1minremains" ) || !Q_stricmp( event, "5minremains" ) ) soundName = va( "sound/feedback/%s.wav", event ); else return; cg.announcerStackLatest++; cg.announcerStackLatest %= MAX_ANNOUNCER_STACK; cg.announcerStack[ cg.announcerStackLatest ] = trap_S_RegisterSound( soundName, qfalse ); }
static void JKG_AddToACI( void ) { int itemID = atoi(CG_Argv(1)); cg.playerInventory[cg.numItemsInInventory-1].id = &CGitemLookupTable[itemID]; // MEGA UNSTABLE HACK HERE USE EXTREME CAUTION if(CGitemLookupTable[itemID].itemType == ITEM_WEAPON) { // hm, go for ACI now int i = 0; for(; i < MAX_ACI_SLOTS; i++) { if(cg.playerACI[i] == -1) { cg.playerACI[i] = cg.numItemsInInventory-1; break; } } } }
void CG_CompleteCommand( int argNum ) { const char *cmd; int i; cmd = CG_Argv( 0 ); while ( *cmd == '\\' || *cmd == '/' ) { cmd++; } for ( i = 0; i < ARRAY_LEN( commands ); i++ ) { if ( !Q_stricmp( cmd, commands[ i ].cmd ) && commands[ i ].completer ) { commands[ i ].completer(); return; } } }
static void CG_Rocket_EventExecForm() { static char params[ BIG_INFO_STRING ]; char cmd[ MAX_STRING_CHARS ] = { 0 }; char Template[ MAX_STRING_CHARS ]; char *k = Template; char *s = Template; Q_strncpyz( Template, CG_Argv( 1 ), sizeof( Template ) ); Rocket_GetEventParameters( params, sizeof( params ) ); if ( !*params ) { Log::Warn( "Invalid form submit. No named values exist.\n" ); return; } while ( k && *k ) { s = strchr( k, '$' ); if ( s ) { char *ss = strchr( s + 1, '$' ); if ( ss ) { *s = 0; *ss = 0; Q_strcat( cmd, sizeof( cmd ), k ); Q_strcat( cmd, sizeof( cmd ), Info_ValueForKey( params, s + 1 ) ); } k = ss + 1; } } if ( *cmd ) { trap_SendConsoleCommand( cmd ); } }
/* =============== CG_Weapon_f =============== */ void CG_Weapon_f( void ) { int num; if( !cg.snap ) return; if( cg.snap->ps.pm_flags & PMF_FOLLOW ) return; num = atoi( CG_Argv( 1 ) ); if( num < 1 || num > 31 ) return; cg.weaponSelectTime = cg.time; if( !BG_InventoryContainsWeapon( num, cg.snap->ps.stats ) ) return; // don't have the weapon cg.weaponSelect = num; }
void CG_TestGVCmd_f (void) { char cmd[128]; return; // if there is anything to do finish this func if( cg.testVehicleCat != CAT_GROUND ) { return; } if ( Cmd_Argc() < 2 ) { return; } Q_strncpyz (cmd, CG_Argv( 1 ), MAX_QPATH ); if (Q_stricmp (cmd, "blah") == 0) { } else if (Q_stricmp (cmd, "blahblah") == 0) { } }
static void demoViewCommand_f(void) { const char *cmd = CG_Argv(1); if (!Q_stricmp(cmd, "chase")) { demo.viewType = viewChase; } else if (!Q_stricmp(cmd, "camera")) { demo.viewType = viewCamera; } else if (!Q_stricmp(cmd, "effect")) { demo.viewType = viewEffect; } else if (!Q_stricmp(cmd, "prev")) { if (demo.viewType == 0) demo.viewType = viewLast - 1; else demo.viewType--; } else if (!Q_stricmp(cmd, "next")) { demo.viewType++; if (demo.viewType >= viewLast) demo.viewType = 0; } else { Com_Printf("view usage:\n" ); Com_Printf("view camera, Change to camera view.\n" ); Com_Printf("view chase, Change to chase view.\n" ); Com_Printf("view effect, Change to effect view.\n" ); Com_Printf("view follow, Change to follow view.\n" ); Com_Printf("view next/prev, Change to next or previous view.\n" ); return; } switch (demo.viewType) { case viewCamera: CG_DemosAddLog("View set to camera" ); break; case viewChase: CG_DemosAddLog("View set to chase" ); break; case viewEffect: CG_DemosAddLog("View set to effect" ); break; } }
/* ================= CG_ServerCommand The string has been tokenized and can be retrieved with CG_Argc() / CG_Argv() ================= */ static void CG_ServerCommand() { const char *cmd; consoleCommand_t *command; cmd = CG_Argv( 0 ); if ( !cmd[ 0 ] ) { return; } command = (consoleCommand_t*) bsearch( cmd, svcommands, ARRAY_LEN( svcommands ), sizeof( svcommands[ 0 ] ), cmdcmp ); if ( command ) { command->function(); return; } CG_Printf(_( "Unknown client game command: %s\n"), cmd ); }
/* ================= ConsoleCommand The string has been tokenized and can be retrieved with Cmd_Argc() / Cmd_Argv() ================= */ bool ConsoleCommand() { char buffer[BIG_INFO_STRING]; consoleCommand_t *cmd; cmd = (consoleCommand_t*) bsearch( CG_Argv( 0 ), commands, ARRAY_LEN( commands ), sizeof( commands[ 0 ] ), cmdcmp ); if ( !cmd || !cmd->function ) { //This command was added to provide completion of server-side commands //forward it to the server // (see also CG_ServerCommands) trap_EscapedArgs( buffer, sizeof ( buffer ) ); trap_SendClientCommand( buffer ); } else { cmd->function(); } return true; }
/* =============== CG_TestTS_f Test a trail system =============== */ void CG_TestTS_f( void ) { char tsName[ MAX_QPATH ]; if( trap_Argc( ) < 2 ) return; Q_strncpyz( tsName, CG_Argv( 1 ), MAX_QPATH ); testTSHandle = CG_RegisterTrailSystem( tsName ); if( testTSHandle ) { CG_DestroyTestTS_f( ); testTS = CG_SpawnNewTrailSystem( testTSHandle ); if( CG_IsTrailSystemValid( &testTS ) ) { CG_SetAttachmentCent( &testTS->frontAttachment, &cg_entities[ 0 ] ); CG_AttachToCent( &testTS->frontAttachment ); } } }
/* ================= CG_ParseTeamInfo ================= */ static void CG_ParseTeamInfo() { int i; int count; int client; count = trap_Argc(); for ( i = 1; i < count; ++i ) // i is also incremented when writing into cgs.clientinfo { client = atoi( CG_Argv( i ) ); if ( client < 0 || client >= MAX_CLIENTS ) { CG_Printf( "[skipnotify]CG_ParseTeamInfo: bad client number: %d\n", client ); return; } // wrong team? skip to the next one if ( cgs.clientinfo[ client ].team != cg.snap->ps.persistant[ PERS_TEAM ] ) { return; } cgs.clientinfo[ client ].location = atoi( CG_Argv( ++i ) ); cgs.clientinfo[ client ].health = atoi( CG_Argv( ++i ) ); cgs.clientinfo[ client ].curWeaponClass = atoi( CG_Argv( ++i ) ); cgs.clientinfo[ client ].credit = atoi( CG_Argv( ++i ) ); if( cg.snap->ps.persistant[ PERS_TEAM ] != TEAM_ALIENS ) { cgs.clientinfo[ client ].upgrade = atoi( CG_Argv( ++i ) ); } } cgs.teamInfoReceived = true; }
void Wolfcam_Follow_f (void) { int clientNum; char name[MAX_QPATH]; if (trap_Argc() < 2) { Com_Printf ("currently following [%d] ", wcg.selectedClientNum); if (wcg.followMode == WOLFCAM_FOLLOW_DEMO_TAKER) { Com_Printf ("^3<demo pov>\n"); } else { BG_cleanName (cgs.clientinfo[wcg.selectedClientNum].name, name, sizeof(name), qfalse); Com_Printf ("%s\n", name); if (wcg.followMode == WOLFCAM_FOLLOW_KILLER) { Com_Printf("mode: follow killer\n"); } else if (wcg.followMode == WOLFCAM_FOLLOW_VICTIM) { Com_Printf("mode: follow victim\n"); } //Com_Printf("\n"); } Com_Printf ("^7use 'follow -1' to return to demo taker's pov\n"); return; } if (!strcmp("victim", CG_Argv(1))) { wcg.followMode = WOLFCAM_FOLLOW_VICTIM; goto done; } if (!strcmp("killer", CG_Argv(1))) { wcg.followMode = WOLFCAM_FOLLOW_KILLER; goto done; } clientNum = atoi(CG_Argv(1)); if (clientNum > MAX_CLIENTS || clientNum < -1) { Com_Printf ("bad client number\n"); return; } if (clientNum == -1) { wcg.selectedClientNum = -1; wcg.clientNum = -1; //cg.renderingThirdPerson = 0; wolfcam_following = qfalse; wcg.followMode = WOLFCAM_FOLLOW_DEMO_TAKER; //trap_Cvar_Set ("cg_thirdPerson", "0"); //FIXME wolfcam cg.freecam = qfalse; if (cgs.clientinfo[cg.clientNum].team == TEAM_SPECTATOR) { trap_SendConsoleCommand("exec spectator.cfg\n"); } else if (cg.snap && cg.snap->ps.pm_type == PM_SPECTATOR) { trap_SendConsoleCommand("exec spectator.cfg\n"); } else { trap_SendConsoleCommand("exec ingame.cfg\n"); } trap_SendConsoleCommand("exec wolfcamfirstpersonviewdemotaker.cfg\n"); return; } if (!cgs.clientinfo[clientNum].infoValid) { Com_Printf ("invalid client\n"); return; } wcg.selectedClientNum = clientNum; wcg.clientNum = clientNum; wcg.followMode = WOLFCAM_FOLLOW_SELECTED_PLAYER; done: wolfcam_following = qtrue; cg.freecam = qfalse; trap_SendConsoleCommand("exec follow.cfg\n"); if (wcg.clientNum == cg.snap->ps.clientNum) { trap_SendConsoleCommand("exec wolfcamfirstpersonviewdemotaker.cfg\n"); } else { trap_SendConsoleCommand("exec wolfcamfirstpersonviewother.cfg\n"); } }
/* ================= CG_ParseScores ================= */ static void CG_ParseScores(void) { int i, powerups; cg.numScores = atoi(CG_Argv(1)); if(cg.numScores > MAX_CLIENTS) { cg.numScores = MAX_CLIENTS; } cg.teamScores[0] = atoi(CG_Argv(2)); cg.teamScores[1] = atoi(CG_Argv(3)); memset(cg.scores, 0, sizeof(cg.scores)); for(i = 0; i < cg.numScores; i++) { // cg.scores[i].client = atoi(CG_Argv(i * 14 + 4)); cg.scores[i].score = atoi(CG_Argv(i * 14 + 5)); cg.scores[i].ping = atoi(CG_Argv(i * 14 + 6)); cg.scores[i].time = atoi(CG_Argv(i * 14 + 7)); cg.scores[i].scoreFlags = atoi(CG_Argv(i * 14 + 8)); powerups = atoi(CG_Argv(i * 14 + 9)); cg.scores[i].accuracy = atoi(CG_Argv(i * 14 + 10)); cg.scores[i].impressiveCount = atoi(CG_Argv(i * 14 + 11)); cg.scores[i].excellentCount = atoi(CG_Argv(i * 14 + 12)); cg.scores[i].guantletCount = atoi(CG_Argv(i * 14 + 13)); cg.scores[i].defendCount = atoi(CG_Argv(i * 14 + 14)); cg.scores[i].assistCount = atoi(CG_Argv(i * 14 + 15)); cg.scores[i].perfect = atoi(CG_Argv(i * 14 + 16)); cg.scores[i].captures = atoi(CG_Argv(i * 14 + 17)); if(cg.scores[i].client < 0 || cg.scores[i].client >= MAX_CLIENTS) { cg.scores[i].client = 0; } cgs.clientinfo[cg.scores[i].client].score = cg.scores[i].score; cgs.clientinfo[cg.scores[i].client].powerups = powerups; cg.scores[i].team = cgs.clientinfo[cg.scores[i].client].team; } #ifdef MISSIONPACK CG_SetScoreSelection(NULL); #endif }
/* ================ 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(); } }