static void CG_TaskEscort_f(void) { trap_SendConsoleCommand(va("cmd vsay_team %s\n", VOICECHAT_ONFOLLOWCARRIER)); trap_SendClientCommand(va("teamtask %d\n", TEAMTASK_ESCORT)); }
/* ================= CG_DrawTourneyScoreboard Draw the oversize scoreboard for tournements ================= */ void CG_DrawOldTourneyScoreboard( void ) { const char *s; vec4_t color; int min, tens, ones; clientInfo_t *ci; int y; int i; // request more scores regularly if ( cg.scoresRequestTime + 2000 < cg.time ) { cg.scoresRequestTime = cg.time; trap_SendClientCommand( "score" ); } // draw the dialog background color[0] = color[1] = color[2] = 0; color[3] = 1; CG_FillRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, color ); color[0] = 1; color[1] = 1; color[2] = 1; color[3] = 1; // print the mesage of the day s = CG_ConfigString( CS_MOTD ); if ( !s[0] ) { s = "Scoreboard"; } // print optional title CG_CenterGiantLine( 8, s ); // print server time ones = cg.time / 1000; min = ones / 60; ones %= 60; tens = ones / 10; ones %= 10; s = va("%i:%i%i", min, tens, ones ); CG_CenterGiantLine( 64, s ); // print the two scores y = 160; if ( cgs.gametype >= GT_TEAM && cgs.ffa_gt!=1) { // // teamplay scoreboard // CG_DrawStringExt( 8, y, "Red Team", color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); s = va("%i", cg.teamScores[0] ); CG_DrawStringExt( 632 - GIANT_WIDTH * strlen(s), y, s, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); y += 64; CG_DrawStringExt( 8, y, "Blue Team", color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); s = va("%i", cg.teamScores[1] ); CG_DrawStringExt( 632 - GIANT_WIDTH * strlen(s), y, s, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); } else { // // free for all scoreboard // for ( i = 0 ; i < MAX_CLIENTS ; i++ ) { ci = &cgs.clientinfo[i]; if ( !ci->infoValid ) { continue; } if ( ci->team != TEAM_FREE ) { continue; } CG_DrawStringExt( 8, y, ci->name, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); s = va("%i", ci->score ); CG_DrawStringExt( 632 - GIANT_WIDTH * strlen(s), y, s, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); y += 64; } } }
static void CG_TaskPatrol_f (void ) { trap_SendConsoleCommand(va("cmd vsay_team %s\n", VOICECHAT_ONPATROL)); trap_SendClientCommand(va("teamtask %d\n", TEAMTASK_PATROL)); }
/* ================= CG_DrawQ3Scoreboard Draw the normal in-game scoreboard ================= */ qboolean CG_DrawQ3Scoreboard( void ) { int x, y, w, i, n1, n2; float *fadeColor, fade; char *s; int maxClients; int lineHeight; int topBorderSize, bottomBorderSize; // don't draw anything if the menu or console is up if ( cg_paused.integer ) { cg.deferredPlayerLoading = 0; return qfalse; } if ( cgs.gametype == GT_SINGLE_PLAYER && cg.predictedPlayerState.pm_type == PM_INTERMISSION ) { cg.deferredPlayerLoading = 0; return qfalse; } // don't draw scoreboard during death while warmup up if ( cg.warmup && !cg.showScores && cg.time > cg.scoreFadeTime + FADE_TIME ) { return qfalse; } //#if 0 if ( cg.showScores || cg.predictedPlayerState.pm_type == PM_DEAD || cg.predictedPlayerState.pm_type == PM_INTERMISSION ) { fadeColor = colorWhite; } else { fadeColor = CG_FadeColor( cg.scoreFadeTime, FADE_TIME ); if ( !fadeColor ) { // next time scoreboard comes up, don't print killer cg.deferredPlayerLoading = 0; cg.killerName[0] = 0; return qfalse; } } //#endif //fadeColor = colorWhite; fade = fadeColor[3]; //#if 0 // request more scores regularly if ( cg.scoresRequestTime + 2000 < cg.time ) { cg.scoresRequestTime = cg.time; trap_SendClientCommand( "score" ); } //CG_Printf( "scoresRequestTime = %i\n", cg.scoresRequestTime ); //CG_Printf( "scoreFadeTime = %i, fade = %f\n", cg.scoreFadeTime, fade ); //#endif // fragged by ... line if ( !cg.warmup ) { if ( cg.killerName[0] ) { s = va( "Fragged by %s", cg.killerName ); y = 40; if ( cg_highResFonts.integer ) { float scale = 0.35; int h; w = CG_Text_Width(s, scale, 0); h = CG_Text_Height(s, scale, 0); x = (SCREEN_WIDTH - w) / 2; CG_Text_Paint( x, y + h, scale, fadeColor, s, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER ); } else { w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH; x = ( SCREEN_WIDTH - w ) / 2; CG_DrawBigString( x, y, s, fade, SCR_CENTER ); } } // current rank { s = CG_GetGameStatusText(); if ( s[0] ) { y = 60; if ( cg_highResFonts.integer ) { float scale = 0.35f; int h; w = CG_Text_Width(s, scale, 0); h = CG_Text_Height(s, scale, 0); x = (SCREEN_WIDTH - w) / 2; CG_Text_Paint( x, y + h, scale, fadeColor, s, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER ); } else { w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH; x = ( SCREEN_WIDTH - w ) / 2; CG_DrawBigString( x, y, s, fade, SCR_CENTER ); } } } } // scoreboard y = SB_HEADER; CG_DrawColorPic( SB_SCORE_X + (SB_RATING_WIDTH / 2), y, 64, 32, cgs.media.scoreboardScore, SCR_CENTER, fadeColor ); CG_DrawColorPic( SB_PING_X - (SB_RATING_WIDTH / 2), y, 64, 32, cgs.media.scoreboardPing, SCR_CENTER, fadeColor ); CG_DrawColorPic( SB_TIME_X - (SB_RATING_WIDTH / 2), y, 64, 32, cgs.media.scoreboardTime, SCR_CENTER, fadeColor ); CG_DrawColorPic( SB_NAME_X - (SB_RATING_WIDTH / 2), y, 64, 32, cgs.media.scoreboardName, SCR_CENTER, fadeColor ); y = SB_TOP; // If there are more than SB_MAXCLIENTS_NORMAL, use the interleaved scores if ( cg.numScores > SB_MAXCLIENTS_NORMAL ) { maxClients = SB_MAXCLIENTS_INTER; lineHeight = SB_INTER_HEIGHT; topBorderSize = 8; bottomBorderSize = 16; } else { maxClients = SB_MAXCLIENTS_NORMAL; lineHeight = SB_NORMAL_HEIGHT; topBorderSize = 16; bottomBorderSize = 16; } localClient = qfalse; if ( gt[cgs.gametype].teams ) { float team_opacity = 0.33f; // // teamplay scoreboard // y += lineHeight/2; if ( cg.teamScores[0] >= cg.teamScores[1] ) { n1 = CG_TeamScoreCount( TEAM_RED, maxClients ); CG_DrawTeamBackground( 0, y - topBorderSize, SCREEN_WIDTH, n1 * lineHeight + bottomBorderSize, team_opacity, TEAM_RED, SCR_NONE ); CG_TeamScoreboard( y, TEAM_RED, fade, maxClients, lineHeight ); y += (n1 * lineHeight) + BIGCHAR_HEIGHT; maxClients -= n1; n2 = CG_TeamScoreCount( TEAM_BLUE, maxClients ); CG_DrawTeamBackground( 0, y - topBorderSize, SCREEN_WIDTH, n2 * lineHeight + bottomBorderSize, team_opacity, TEAM_BLUE, SCR_NONE ); CG_TeamScoreboard( y, TEAM_BLUE, fade, maxClients, lineHeight ); y += (n2 * lineHeight) + BIGCHAR_HEIGHT; maxClients -= n2; } else { n1 = CG_TeamScoreCount( TEAM_BLUE, maxClients ); CG_DrawTeamBackground( 0, y - topBorderSize, SCREEN_WIDTH, n1 * lineHeight + bottomBorderSize, team_opacity, TEAM_BLUE, SCR_NONE ); CG_TeamScoreboard( y, TEAM_BLUE, fade, maxClients, lineHeight ); y += (n1 * lineHeight) + BIGCHAR_HEIGHT; maxClients -= n1; n2 = CG_TeamScoreCount( TEAM_RED, maxClients ); CG_DrawTeamBackground( 0, y - topBorderSize, SCREEN_WIDTH, n2 * lineHeight + bottomBorderSize, team_opacity, TEAM_RED, SCR_NONE ); CG_TeamScoreboard( y, TEAM_RED, fade, maxClients, lineHeight ); y += (n2 * lineHeight) + BIGCHAR_HEIGHT; maxClients -= n2; } /* n1 = CG_TeamScoreCount( TEAM_SPECTATOR, maxClients ); CG_TeamScoreboard( y, TEAM_SPECTATOR, fade, maxClients, lineHeight ); */ n1 = CG_TeamScoreboard( y, TEAM_SPECTATOR, fade, maxClients, lineHeight ); y += (n1 * lineHeight) + BIGCHAR_HEIGHT; } else { // // free for all scoreboard // /* n1 = CG_TeamScoreCount( TEAM_SPECTATOR, maxClients ); CG_TeamScoreboard( y, TEAM_FREE, fade, maxClients, lineHeight ); y += (n1 * lineHeight) + BIGCHAR_HEIGHT; n2 = CG_TeamScoreCount( TEAM_SPECTATOR, maxClients ); CG_TeamScoreboard( y, TEAM_SPECTATOR, fade, maxClients - n1, lineHeight ); y += (n2 * lineHeight) + BIGCHAR_HEIGHT; */ n1 = CG_TeamScoreboard( y, TEAM_FREE, fade, maxClients, lineHeight ); y += (n1 * lineHeight) + BIGCHAR_HEIGHT; n2 = CG_TeamScoreboard( y, TEAM_SPECTATOR, fade, maxClients - n1, lineHeight ); y += (n2 * lineHeight) + BIGCHAR_HEIGHT; } if (!localClient) { // draw local client at the bottom for ( i = 0 ; i < cg.numScores ; i++ ) { if ( cg.scores[i].client == cg.snap->ps.clientNum ) { CG_DrawClientScore( y, &cg.scores[i], fadeColor, fade, lineHeight == SB_NORMAL_HEIGHT ); break; } } } // load any models that have been deferred if ( ++cg.deferredPlayerLoading > 10 ) { CG_LoadDeferredPlayers(); } return qtrue; }
qboolean CG_FireteamCheckExecKey(int key, qboolean doaction) { if (key == K_ESCAPE) { return qtrue; } if ((key & K_CHAR_FLAG)) { return qfalse; } key &= ~K_CHAR_FLAG; switch (cgs.ftMenuMode) { case 0: if (cgs.ftMenuPos == -1) { if (cg_quickMessageAlt.integer) { if (key >= '0' && key <= '9') { int i = ((key - '0') + 9) % 10; if (i < 5) { if (!CG_FireteamHasClass(i, qtrue)) { return qfalse; } } if (i > 7) { return qfalse; } if (doaction) { if (i < 5) { cgs.ftMenuPos = i; } else if (i == 5) { CG_QuickFireteamMessage_f(); } else { trap_SendClientCommand(va("vsay_buddy -1 %s %s", CG_BuildSelectedFirteamString(), ftMenuRootStringsMsg[i])); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } } return qtrue; } } else { if (key >= 'a' && key <= 'z') { int i; for (i = 0; ftMenuRootStrings[i]; i++) { if (key == tolower(*ftMenuRootStringsAlphachars[i])) { if (i < 5) { if (!CG_FireteamHasClass(i, qtrue)) { return qfalse; } } if (doaction) { if (i < 5) { cgs.ftMenuPos = i; } else if (i == 5) { CG_QuickFireteamMessage_f(); } else { trap_SendClientCommand(va("vsay_buddy -1 %s %s", CG_BuildSelectedFirteamString(), ftMenuRootStringsMsg[i])); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } } return qtrue; } } } } } else { if (cgs.ftMenuPos < 0 || cgs.ftMenuPos > 4) { return qfalse; } if (cg_quickMessageAlt.integer) { if (key >= '0' && key <= '9') { int i = ((key - '0') + 9) % 10; int x; const char **strings = ftMenuStrings[cgs.ftMenuPos]; for (x = 0; strings[x]; x++) { if (x == i) { if (doaction) { trap_SendClientCommand(va("vsay_buddy %i %s %s", cgs.ftMenuPos, CG_BuildSelectedFirteamString(), (ftMenuStringsMsg[cgs.ftMenuPos])[i])); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } return qtrue; } } } } else { const char **strings = ftMenuStrings[cgs.ftMenuPos]; if (key >= 'a' && key <= 'z') { int i; for (i = 0; strings[i]; i++) { if (key == tolower(*ftMenuStringsAlphachars[cgs.ftMenuPos][i])) { if (doaction) { trap_SendClientCommand(va("vsay_buddy %i %s %s", cgs.ftMenuPos, CG_BuildSelectedFirteamString(), (ftMenuStringsMsg[cgs.ftMenuPos])[i])); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } return qtrue; } } } } } break; case 1: { int i = -1; if (cg_quickMessageAlt.integer) { if (key >= '0' && key <= '9') { i = ((key - '0') + 9) % 10; } } else { const char **strings; if (!CG_IsOnFireteam(cg.clientNum)) { strings = ftOffMenuListAlphachars; } else { if (!CG_IsFireTeamLeader(cg.clientNum)) { strings = ftOnMenuListAlphachars; } else { strings = ftLeaderMenuListAlphachars; } } if (key >= 'a' && key <= 'z') { int x; for (x = 0; strings[x]; x++) { if (key == tolower(*strings[x])) { i = x; break; } } } } if (i == -1) { break; } if (!CG_IsOnFireteam(cg.clientNum)) { if (i >= 2) { break; } if (i == 0 && !CG_CountFireteamsByTeam(cgs.clientinfo[cg.clientNum].team)) { return qfalse; } if (doaction) { if (i == 1) { trap_SendConsoleCommand("fireteam create\n"); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } else { cgs.ftMenuMode = 2; cgs.ftMenuModeEx = 0; cgs.ftMenuPos = i; } } return qtrue; } else { if (!CG_IsFireTeamLeader(cg.clientNum)) { if (i >= 2) { break; } if (i == 0 && !CG_CountPlayersNF()) { break; } if (doaction) { if (i == 1) { trap_SendConsoleCommand("fireteam leave\n"); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } else { cgs.ftMenuMode = 3; cgs.ftMenuModeEx = 0; cgs.ftMenuPos = i; } } return qtrue; } else { if (i >= 7) { break; } if (i == 2 && !CG_CountPlayersNF()) { break; } if ((i == 3 || i == 4) && !CG_CountPlayersSF()) { break; } if (doaction) { if (i == 0) { trap_SendConsoleCommand("fireteam disband\n"); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } else if (i == 1) { trap_SendConsoleCommand("fireteam leave\n"); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } else if (i == 5) { trap_SendConsoleCommand("fireteam privacy\n"); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } else { cgs.ftMenuMode = 4; cgs.ftMenuModeEx = 0; cgs.ftMenuPos = i; } } return qtrue; } } } break; case 2: { int i; for (i = 0; i < MAX_FIRETEAMS; i++) { if (!cg.fireTeams[i].inuse) { continue; } if (cgs.clientinfo[cg.fireTeams[i].leader].team != cgs.clientinfo[cg.clientNum].team) { continue; } if (cg_quickMessageAlt.integer) { if (key >= '0' && key <= '9') { if (((key - '0') + 9) % 10 == cg.fireTeams[i].ident) { if (doaction) { trap_SendConsoleCommand(va("fireteam apply %i", i + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } return qtrue; } } } else { if (key >= 'a' && key <= 'z') { if (key - 'a' == cg.fireTeams[i].ident) { if (doaction) { trap_SendConsoleCommand(va("fireteam apply %i", i + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } return qtrue; } } } } } break; case 3: { int i = -1, x; if (cg_quickMessageAlt.integer) { if (key >= '0' && key <= '9') { i = ((key - '0') + 9) % 10; } } else { if (key >= 'a' && key <= 'g') { i = key - 'a'; } if (key == 'n') { i = 9; } if (key == 'p') { i = 0; } } if (i == -1) { break; } if (CG_CountPlayersNF() > (cgs.ftMenuModeEx + 1) * 8) { if (i == 0) { cgs.ftMenuModeEx++; } } if (cgs.ftMenuModeEx) { if (i == 9) { cgs.ftMenuModeEx--; } } x = CG_PlayerNFFromPos(i, &cgs.ftMenuModeEx); if (x != -1) { if (doaction) { trap_SendConsoleCommand(va("fireteam propose %i", x + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } return qtrue; } break; } break; case 4: { int i = -1, x; if (cg_quickMessageAlt.integer) { if (key >= '0' && key <= '9') { i = ((key - '0') + 9) % 10; } } else { if (key >= 'a' && key <= 'g') { i = key - 'a'; } if (key == 'n') { i = 9; } if (key == 'p') { i = 8; } } if (i == -1) { break; } switch (cgs.ftMenuPos) { case 2: if (CG_CountPlayersNF() > (cgs.ftMenuModeEx + 1) * 8) { if (i == 9) { if (doaction) { cgs.ftMenuModeEx++; } return qtrue; } } if (cgs.ftMenuModeEx) { if (i == 8) { if (doaction) { cgs.ftMenuModeEx--; } return qtrue; } } x = CG_PlayerNFFromPos(i, &cgs.ftMenuModeEx); if (x != -1) { if (doaction) { trap_SendConsoleCommand(va("fireteam invite %i", x + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } return qtrue; } break; case 3: case 4: case 6: if (CG_CountPlayersSF() > (cgs.ftMenuModeEx + 1) * 8) { if (i == 0) { cgs.ftMenuModeEx++; } } if (cgs.ftMenuModeEx) { if (i == 9) { cgs.ftMenuModeEx--; } } x = CG_PlayerSFFromPos(i, &cgs.ftMenuModeEx); if (x != -1) { if (doaction) { switch (cgs.ftMenuPos) { case 6: trap_SendConsoleCommand(va("fireteam admin %i", x + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); break; case 4: trap_SendConsoleCommand(va("fireteam warn %i", x + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); break; case 3: trap_SendConsoleCommand(va("fireteam kick %i", x + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); break; } } return qtrue; } break; } } break; } return qfalse; }
void CG_ForceTapOut_f(void) { trap_SendClientCommand("forcetapout"); }
static void CG_TaskDefense_f( int localPlayerNum ) { trap_Cmd_ExecuteText(EXEC_NOW, va("cmd %s %s\n", Com_LocalPlayerCvarName(localPlayerNum, "vsay_team"), VOICECHAT_ONDEFENSE)); trap_SendClientCommand(va("teamtask %d\n", TEAMTASK_DEFENSE)); }
/** * @brief Sends an class setup message. Enables etpro like classscripts */ void CG_Class_f(void) { char cls[64]; const char *classtype, *teamstring; int weapon1, weapon2, playerclass; bg_playerclass_t *classinfo; team_t team; weaponType_t *wt; if (cg.demoPlayback) { return; } team = cgs.clientinfo[cg.clientNum].team; if (team == TEAM_SPECTATOR) { return; } if (trap_Argc() < 2) { CG_Printf("Invalid command format.\n"); return; } switch (team) { case TEAM_AXIS: classtype = "r"; teamstring = "Axis"; break; case TEAM_ALLIES: classtype = "b"; teamstring = "Allies"; break; default: CG_Printf("Invalid team.\n"); return; } trap_Argv(1, cls, 64); if (!Q_stricmp(cls, "s")) { playerclass = PC_SOLDIER; } else if (!Q_stricmp(cls, "m")) { playerclass = PC_MEDIC; } else if (!Q_stricmp(cls, "e")) { playerclass = PC_ENGINEER; } else if (!Q_stricmp(cls, "f")) { playerclass = PC_FIELDOPS; } else if (!Q_stricmp(cls, "c")) { playerclass = PC_COVERTOPS; } else { CG_Printf("Invalid class format.\n"); return; } classinfo = BG_GetPlayerClassInfo(team, playerclass); if (trap_Argc() > 2) { trap_Argv(2, cls, 64); weapon1 = atoi(cls); if (!classinfo->classWeapons[weapon1 - 1]) { CG_Printf("Invalid command format for weapon.\n"); return; } } else { weapon1 = 1; } if (cgs.clientinfo[cg.clientNum].skill[SK_HEAVY_WEAPONS] >= 4 && playerclass == PC_SOLDIER) { weapon2 = (team == TEAM_AXIS) ? WP_MP40 : WP_THOMPSON; } else if (cgs.clientinfo[cg.clientNum].skill[SK_LIGHT_WEAPONS] >= 4) { if (playerclass == PC_COVERTOPS) { weapon2 = (team == TEAM_AXIS) ? WP_AKIMBO_SILENCEDLUGER : WP_AKIMBO_SILENCEDCOLT; } else { weapon2 = (team == TEAM_AXIS) ? WP_AKIMBO_LUGER : WP_AKIMBO_COLT; } } else { if (playerclass == PC_COVERTOPS) { weapon2 = (team == TEAM_AXIS) ? WP_SILENCER : WP_SILENCED_COLT; } else { weapon2 = (team == TEAM_AXIS) ? WP_LUGER : WP_COLT; } } // Print out the selected class and weapon info wt = WM_FindWeaponTypeForWeapon(classinfo->classWeapons[weapon1 - 1]); CG_PriorityCenterPrint(va(CG_TranslateString("You will spawn as a %s %s with a %s."), teamstring, BG_ClassnameForNumber(playerclass), wt ? wt->desc : "^1UNKNOWN WEAPON"), SCREEN_HEIGHT - 88, SMALLCHAR_WIDTH, -1); // Send the switch command to the server trap_SendClientCommand(va("team %s %i %i %i\n", classtype, playerclass, classinfo->classWeapons[weapon1 - 1], weapon2)); }
/* =============== CG_CalcViewValues Sets cg.refdef view values =============== */ static int CG_CalcViewValues( void ) { playerState_t *ps; memset( &cg.refdef, 0, sizeof( cg.refdef ) ); // calculate size of 3D view CG_CalcVrect(); ps = &cg.predictedPlayerState; if ( cg.cameraMode ) { vec3_t origin, angles; float fov = 90; float x; if ( trap_getCameraInfo( CAM_PRIMARY, cg.time, &origin, &angles, &fov ) ) { VectorCopy( origin, cg.refdef.vieworg ); angles[ROLL] = 0; angles[PITCH] = -angles[PITCH]; // (SA) compensate for reversed pitch (this makes the game match the editor, however I'm guessing the real fix is to be done there) VectorCopy( angles, cg.refdefViewAngles ); AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis ); x = cg.refdef.width / tan( fov / 360 * M_PI ); cg.refdef.fov_y = atan2( cg.refdef.height, x ); cg.refdef.fov_y = cg.refdef.fov_y * 360 / M_PI; cg.refdef.fov_x = fov; trap_SendClientCommand( va( "setCameraOrigin %f %f %f", origin[0], origin[1], origin[2] ) ); return 0; } else { cg.cameraMode = qfalse; // camera off in cgame trap_Cvar_Set( "cg_letterbox", "0" ); trap_SendClientCommand( "stopCamera" ); // camera off in game trap_stopCamera( CAM_PRIMARY ); // camera off in client CG_Fade( 0, 0, 0, 255, 0, 0 ); // go black CG_Fade( 0, 0, 0, 0, cg.time + 200, 1500 ); // then fadeup } } // intermission view if ( ps->pm_type == PM_INTERMISSION ) { VectorCopy( ps->origin, cg.refdef.vieworg ); VectorCopy( ps->viewangles, cg.refdefViewAngles ); AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis ); return CG_CalcFov(); } cg.bobcycle = ( ps->bobCycle & 128 ) >> 7; cg.bobfracsin = fabs( sin( ( ps->bobCycle & 127 ) / 127.0 * M_PI ) ); cg.xyspeed = sqrt( ps->velocity[0] * ps->velocity[0] + ps->velocity[1] * ps->velocity[1] ); VectorCopy( ps->origin, cg.refdef.vieworg ); VectorCopy( ps->viewangles, cg.refdefViewAngles ); // add error decay if ( cg_errorDecay.value > 0 ) { int t; float f; t = cg.time - cg.predictedErrorTime; f = ( cg_errorDecay.value - t ) / cg_errorDecay.value; if ( f > 0 && f < 1 ) { VectorMA( cg.refdef.vieworg, f, cg.predictedError, cg.refdef.vieworg ); } else { cg.predictedErrorTime = 0; } } // Ridah, lock the viewangles if the game has told us to if ( ps->viewlocked ) { /* if (ps->viewlocked == 4) { centity_t *tent; tent = &cg_entities[ps->viewlocked_entNum]; VectorCopy (tent->currentState.apos.trBase, cg.refdefViewAngles); } else */ BG_EvaluateTrajectory( &cg_entities[ps->viewlocked_entNum].currentState.apos, cg.time, cg.refdefViewAngles ); if ( ps->viewlocked == 2 ) { cg.refdefViewAngles[0] += crandom(); cg.refdefViewAngles[1] += crandom(); } } // done. if ( cg.renderingThirdPerson ) { // back away from character CG_OffsetThirdPersonView(); } else { // offset for local bobbing and kicks CG_OffsetFirstPersonView(); // Ridah, lock the viewangles if the game has told us to if ( ps->viewlocked == 4 ) { vec3_t fwd; AngleVectors( cg.refdefViewAngles, fwd, NULL, NULL ); VectorMA( cg_entities[ps->viewlocked_entNum].currentState.pos.trBase, 16, fwd, cg.refdef.vieworg ); } else if ( ps->viewlocked ) { vec3_t fwd; float oldZ; // set our position to be behind it oldZ = cg.refdef.vieworg[2]; AngleVectors( cg.refdefViewAngles, fwd, NULL, NULL ); VectorMA( cg_entities[ps->viewlocked_entNum].currentState.pos.trBase, -34, fwd, cg.refdef.vieworg ); cg.refdef.vieworg[2] = oldZ; } // done. } // position eye relative to origin AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis ); if ( cg.hyperspace ) { cg.refdef.rdflags |= RDF_NOWORLDMODEL | RDF_HYPERSPACE; } // field of view return CG_CalcFov(); }
void CG_Drop_f( void ) { char command[ 128 ]; char message[ 128 ]; gitem_t *item; int j; if ( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_SPECTATOR ) { return; } if ( cg.predictedPlayerState.stats[ STAT_HEALTH ] <= 0 ) { CG_Printf( "You must be alive to use this command.\n" ); return; } trap_Args( message, 128 ); item = BG_FindItem( message ); if ( !item ) { CG_Printf( "unknown item: %s\n", message ); return; } if ( !cg_items[ item->giTag ].registered ) { return; } j = item->giTag; switch ( item->giType ) { case IT_WEAPON: if ( cgs.dmflags & 256 ) { return; } if ( !( cg.snap->ps.stats[ STAT_WEAPONS ] & ( 1 << j ) ) ) { CG_Printf( "Out of item: %s\n", message ); return; } if ( cg.snap->ps.weaponstate != WEAPON_READY ) { return; } if ( j == cg.snap->ps.weapon ) { return; } if ( j <= WP_MACHINEGUN || j == WP_GRAPPLING_HOOK ) { CG_Printf( "Item is not dropable.\n" ); return; } case IT_AMMO: if ( cg.snap->ps.ammo[ j ] < 1 ) { CG_Printf( "Out of item: %s\n", message ); return; } break; case IT_POWERUP: if ( cg.snap->ps.powerups[ j ] <= cg.time ) { CG_Printf( "Out of item: %s\n", message ); return; } break; case IT_HOLDABLE: if ( j == HI_KAMIKAZE ) { CG_Printf( "Item is not dropable.\n" ); return; } if ( bg_itemlist[ cg.snap->ps.stats[ STAT_HOLDABLE_ITEM ] ].giTag != j ) { CG_Printf( "Out of item: %s\n", message ); return; } break; default: CG_Printf( "Item is not dropable.\n" ); return; } Com_sprintf( command, 128, "drop %s", message ); trap_SendClientCommand( command ); }
static int CG_CalcFov( void ) { float y; float phase; float v; int contents; float fov_x, fov_y; float zoomFov; float f; int inwater; int attribFov; usercmd_t cmd; usercmd_t oldcmd; int cmdNum; cmdNum = trap_GetCurrentCmdNumber(); trap_GetUserCmd( cmdNum, &cmd ); trap_GetUserCmd( cmdNum - 1, &oldcmd ); // switch follow modes if necessary: cycle between free -> follow -> third-person follow if ( usercmdButtonPressed( cmd.buttons, BUTTON_USE_HOLDABLE ) && !usercmdButtonPressed( oldcmd.buttons, BUTTON_USE_HOLDABLE ) ) { if ( cg.snap->ps.pm_flags & PMF_FOLLOW ) { if ( !cg.chaseFollow ) { cg.chaseFollow = qtrue; } else { cg.chaseFollow = qfalse; trap_SendClientCommand( "follow\n" ); } } else if ( cg.snap->ps.persistant[ PERS_SPECSTATE ] != SPECTATOR_NOT ) { trap_SendClientCommand( "follow\n" ); } } if ( cg.predictedPlayerState.pm_type == PM_INTERMISSION || ( cg.snap->ps.persistant[ PERS_SPECSTATE ] != SPECTATOR_NOT ) || ( cg.renderingThirdPerson ) ) { // if in intermission or third person, use a fixed value fov_y = BASE_FOV_Y; } else { // don't lock the fov globally - we need to be able to change it if ( ( attribFov = trap_Cvar_VariableIntegerValue( BG_Class( cg.predictedPlayerState.stats[ STAT_CLASS ] )->fovCvar ) ) ) { if ( attribFov < 80 ) { attribFov = 80; } else if ( attribFov >= 140 ) { attribFov = 140; } } else { attribFov = BG_Class( cg.predictedPlayerState.stats[ STAT_CLASS ] )->fov; } attribFov *= 0.75; fov_y = attribFov; if ( fov_y < 1.0f ) { fov_y = 1.0f; } else if ( fov_y > MAX_FOV_Y ) { fov_y = MAX_FOV_Y; } if ( cg.spawnTime > ( cg.time - FOVWARPTIME ) && BG_ClassHasAbility( cg.predictedPlayerState.stats[ STAT_CLASS ], SCA_FOVWARPS ) ) { float fraction = ( float )( cg.time - cg.spawnTime ) / FOVWARPTIME; fov_y = MAX_FOV_WARP_Y - ( ( MAX_FOV_WARP_Y - fov_y ) * fraction ); } // account for zooms zoomFov = BG_Weapon( cg.predictedPlayerState.weapon )->zoomFov * 0.75f; if ( zoomFov < 1.0f ) { zoomFov = 1.0f; } else if ( zoomFov > attribFov ) { zoomFov = attribFov; } // only do all the zoom stuff if the client CAN zoom // FIXME: zoom control is currently hard coded to WBUTTON_ATTACK2 if ( BG_Weapon( cg.predictedPlayerState.weapon )->canZoom ) { if ( cg.zoomed ) { f = ( cg.time - cg.zoomTime ) / ( float ) ZOOM_TIME; if ( f > 1.0f ) { fov_y = zoomFov; } else { fov_y = fov_y + f * ( zoomFov - fov_y ); } // WBUTTON_ATTACK2 isn't held so unzoom next time if ( !usercmdButtonPressed( cmd.buttons, BUTTON_ATTACK2 ) || cg.snap->ps.weaponstate == WEAPON_RELOADING ) { cg.zoomed = qfalse; cg.zoomTime = MIN( cg.time, cg.time + cg.time - cg.zoomTime - ZOOM_TIME ); } } else { f = ( cg.time - cg.zoomTime ) / ( float ) ZOOM_TIME; if ( f < 1.0f ) { fov_y = zoomFov + f * ( fov_y - zoomFov ); } // WBUTTON_ATTACK2 is held so zoom next time if ( usercmdButtonPressed( cmd.buttons, BUTTON_ATTACK2 ) && cg.snap->ps.weaponstate != WEAPON_RELOADING ) { cg.zoomed = qtrue; cg.zoomTime = MIN( cg.time, cg.time + cg.time - cg.zoomTime - ZOOM_TIME ); } } } else if ( cg.zoomed ) { cg.zoomed = qfalse; } } y = cg.refdef.height / tan( 0.5f * DEG2RAD( fov_y ) ); fov_x = atan2( cg.refdef.width, y ); fov_x = 2.0f * RAD2DEG( fov_x ); // warp if underwater contents = CG_PointContents( cg.refdef.vieworg, -1 ); if ( contents & ( CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA ) ) { phase = cg.time / 1000.0f * WAVE_FREQUENCY * M_PI * 2.0f; v = WAVE_AMPLITUDE * sin( phase ); fov_x += v; fov_y -= v; inwater = qtrue; } else { inwater = qfalse; } // set it cg.refdef.fov_x = fov_x; cg.refdef.fov_y = fov_y; if ( !cg.zoomed ) { cg.zoomSensitivity = 1.0f; } else { cg.zoomSensitivity = cg.refdef.fov_y / 75.0f; } return inwater; }
/* ================= CG_ServerCommand The string has been tokenized and can be retrieved with Cmd_Argc() / Cmd_Argv() ================= */ static void CG_ServerCommand( void ) { const char *cmd; char text[ MAX_SAY_TEXT ]; cmd = CG_Argv( 0 ); if ( !cmd[ 0 ] ) { // server claimed the command return; } if ( !strcmp( cmd, "cp" ) ) { CG_CenterPrint( CG_Argv( 1 ), SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH ); return; } if ( !strcmp( cmd, "cs" ) ) { CG_ConfigStringModified(); return; } if ( !strcmp( cmd, "print" ) ) { CG_Printf( "%s", CG_Argv( 1 ) ); return; } if ( !strcmp( cmd, "chat" ) ) { if ( !cg_teamChatsOnly.integer ) { trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND ); Q_strncpyz( text, CG_Argv( 1 ), MAX_SAY_TEXT ); CG_RemoveChatEscapeChar( text ); CG_Printf( "%s\n", text ); } return; } if ( !strcmp( cmd, "tchat" ) ) { if ( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) { trap_S_StartLocalSound( cgs.media.alienTalkSound, CHAN_LOCAL_SOUND ); } else if ( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) { trap_S_StartLocalSound( cgs.media.humanTalkSound, CHAN_LOCAL_SOUND ); } else { trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND ); } Q_strncpyz( text, CG_Argv( 1 ), MAX_SAY_TEXT ); CG_RemoveChatEscapeChar( text ); CG_AddToTeamChat( text ); CG_Printf( "%s\n", text ); return; } if ( !strcmp( cmd, "scores" ) ) { CG_ParseScores(); return; } if ( !strcmp( cmd, "tinfo" ) ) { CG_ParseTeamInfo(); return; } if ( !strcmp( cmd, "map_restart" ) ) { CG_MapRestart(); return; } if ( Q_stricmp( cmd, "remapShader" ) == 0 ) { if ( trap_Argc() == 4 ) { trap_R_RemapShader( CG_Argv( 1 ), CG_Argv( 2 ), CG_Argv( 3 ) ); } } //the server has triggered a menu if ( !strcmp( cmd, "servermenu" ) ) { if ( trap_Argc() == 2 && !cg.demoPlayback ) { CG_Menu( atoi( CG_Argv( 1 ) ) ); } return; } //the server thinks this client should close all menus if ( !strcmp( cmd, "serverclosemenus" ) ) { trap_SendConsoleCommand( "closemenus\n" ); return; } //poison cloud effect needs to be reliable if ( !strcmp( cmd, "poisoncloud" ) ) { cg.poisonedTime = cg.time; if ( CG_IsParticleSystemValid( &cg.poisonCloudPS ) ) { cg.poisonCloudPS = CG_SpawnNewParticleSystem( cgs.media.poisonCloudPS ); CG_SetAttachmentCent( &cg.poisonCloudPS->attachment, &cg.predictedPlayerEntity ); CG_AttachToCent( &cg.poisonCloudPS->attachment ); } return; } if ( !strcmp( cmd, "weaponswitch" ) ) { CG_Printf( "client weaponswitch\n" ); if ( trap_Argc() == 2 ) { cg.weaponSelect = atoi( CG_Argv( 1 ) ); cg.weaponSelectTime = cg.time; } return; } // server requests a ptrc if ( !strcmp( cmd, "ptrcrequest" ) ) { int code = CG_ReadPTRCode(); trap_SendClientCommand( va( "ptrcverify %d", code ) ); return; } // server issues a ptrc if ( !strcmp( cmd, "ptrcissue" ) ) { if ( trap_Argc() == 2 ) { int code = atoi( CG_Argv( 1 ) ); CG_WritePTRCode( code ); } return; } // reply to ptrcverify if ( !strcmp( cmd, "ptrcconfirm" ) ) { trap_SendConsoleCommand( "menu ptrc_popmenu\n" ); return; } CG_Printf( "Unknown client game command: %s\n", cmd ); }
void CO_SendClientCommand( const char *command ) { trap_Syscall_CG(); trap_SendClientCommand( command ); trap_Syscall_UI(); }
// Toggle all views void CG_mvToggleAll_f(void) { if(!cg.demoPlayback) { trap_SendClientCommand((cg.mvTotalClients > 0) ? "mvnone\n" : "mvall\n"); } }
static void CG_TaskCamp_f( int localPlayerNum ) { trap_Cmd_ExecuteText(EXEC_NOW, va("cmd %s %s\n", Com_LocalPlayerCvarName(localPlayerNum, "vsay_team"), VOICECHAT_ONCAMPING)); trap_SendClientCommand(va("%s %d\n", Com_LocalPlayerCvarName(localPlayerNum, "teamtask"), TEAMTASK_CAMP)); }
/* ================== CG_EventHandling ================== */ void CG_EventHandling( int type, qboolean fForced ) { if( cg.demoPlayback && type == CGAME_EVENT_NONE && !fForced ) { type = CGAME_EVENT_DEMO; } if( type != CGAME_EVENT_NONE ) { trap_Cvar_Set( "cl_bypassMouseInput", 0 ); } switch( type ) { // OSP - Demo support case CGAME_EVENT_DEMO: cgs.fResize = qfalse; cgs.fSelect = qfalse; cgs.cursorUpdate = cg.time + 10000; cgs.timescaleUpdate = cg.time + 4000; CG_ScoresUp_f(); break; case CGAME_EVENT_SPEAKEREDITOR: case CGAME_EVENT_GAMEVIEW: case CGAME_EVENT_NONE: case CGAME_EVENT_CAMPAIGNBREIFING: case CGAME_EVENT_FIRETEAMMSG: default: // default handling (cleanup mostly) if( cgs.eventHandling == CGAME_EVENT_GAMEVIEW ) { cg.showGameView = qfalse; trap_S_FadeBackgroundTrack( 0.0f, 500, 0 ); trap_S_StopStreamingSound( -1 ); cg.limboEndCinematicTime = 0; if( fForced ) { if( cgs.limboLoadoutModified ) { trap_SendClientCommand( "rs" ); cgs.limboLoadoutSelected = qfalse; } } } else if( cgs.eventHandling == CGAME_EVENT_SPEAKEREDITOR ) { if( type == -CGAME_EVENT_SPEAKEREDITOR ) { type = CGAME_EVENT_NONE; } else { trap_Key_SetCatcher( KEYCATCH_CGAME ); return; } } else if( cgs.eventHandling == CGAME_EVENT_CAMPAIGNBREIFING ) { type = CGAME_EVENT_GAMEVIEW; } else if( cgs.eventHandling == CGAME_EVENT_FIRETEAMMSG ) { cg.showFireteamMenu = qfalse; trap_Cvar_Set( "cl_bypassmouseinput", "0" ); } else if( cg.snap && cg.snap->ps.pm_type == PM_INTERMISSION && fForced ) { trap_UI_Popup( UIMENU_INGAME ); } break; } cgs.eventHandling = type; if(type == CGAME_EVENT_NONE) { trap_Key_SetCatcher(trap_Key_GetCatcher() & ~KEYCATCH_CGAME); ccInitial = qfalse; if(cg.demoPlayback && cg.demohelpWindow != SHOW_OFF) { CG_ShowHelp_Off(&cg.demohelpWindow); } } else if( type == CGAME_EVENT_GAMEVIEW ) { cg.showGameView = qtrue; CG_LimboPanel_Setup(); trap_Key_SetCatcher(KEYCATCH_CGAME); } else if( type == CGAME_EVENT_FIRETEAMMSG ) { cgs.ftMenuPos = -1; cgs.ftMenuMode = 0; cg.showFireteamMenu = qtrue; trap_Cvar_Set( "cl_bypassmouseinput", "1" ); trap_Key_SetCatcher(KEYCATCH_CGAME); } else { trap_Key_SetCatcher(KEYCATCH_CGAME); } }
static void CG_TaskRetrieve_f( int localPlayerNum ) { trap_Cmd_ExecuteText(EXEC_NOW, va("cmd %s %s\n", Com_LocalPlayerCvarName(localPlayerNum, "vsay_team"), VOICECHAT_ONRETURNFLAG)); trap_SendClientCommand(va("%s %d\n", Com_LocalPlayerCvarName(localPlayerNum, "teamtask"), TEAMTASK_RETRIEVE)); }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot( snapshot_t *snap ) { char buf[64]; int i; centity_t *cent; entityState_t *state; cg.snap = snap; BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse ); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); trap_SendClientCommand( "fogswitch 0" ); // clear it out so the set below will take trap_Cvar_VariableStringBuffer( "r_savegameFogColor", buf, sizeof( buf ) ); trap_Cvar_Set( "r_savegameFogColor", "0" ); if ( strlen( buf ) > 1 ) { if ( !Q_stricmp( buf, "none" ) ) { trap_SendClientCommand( "fogswitch 0" ); // 'off' } else { trap_SendClientCommand( va( "fogswitch %s", buf ) ); } } else { trap_Cvar_VariableStringBuffer( "r_mapFogColor", buf, sizeof( buf ) ); trap_SendClientCommand( va( "fogswitch %s", buf ) ); } // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(); for ( i = 0 ; i < cg.snap->numEntities ; i++ ) { state = &cg.snap->entities[ i ]; cent = &cg_entities[ state->number ]; memcpy( ¢->currentState, state, sizeof( entityState_t ) ); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity( cent ); // check for events CG_CheckEvents( cent ); } // DHM - Nerve :: Set cg.clientNum so that it may be used elsewhere cg.clientNum = snap->ps.clientNum; // NERVE - SMF { static char prevmap[64] = { 0 }; char curmap[64]; trap_Cvar_VariableStringBuffer( "mapname", curmap, 64 ); if ( cgs.gametype == GT_WOLF && Q_stricmp( curmap, prevmap ) ) { strcpy( prevmap, curmap ); trap_SendConsoleCommand( "openLimboMenu\n" ); } } // -NERVE - SMF }
static void CG_TaskEscort_f( int localPlayerNum ) { trap_Cmd_ExecuteText(EXEC_NOW, va("cmd %s %s\n", Com_LocalPlayerCvarName(localPlayerNum, "vsay_team"), VOICECHAT_ONFOLLOWCARRIER)); trap_SendClientCommand(va("%s %d\n", Com_LocalPlayerCvarName(localPlayerNum, "teamtask"), TEAMTASK_ESCORT)); }
/** * @brief Sends an class setup message. Enables etpro like classscripts */ void CG_Class_f(void) { char cls[64]; const char *classtype, *teamstring; int weapon1, weapon2, playerclass; bg_playerclass_t *classinfo; team_t team; if (cg.demoPlayback) { return; } team = cgs.clientinfo[cg.clientNum].team; if (team == TEAM_SPECTATOR) { return; } if (trap_Argc() < 2) { CG_Printf("Invalid command format.\n"); return; } switch (team) { case TEAM_AXIS: classtype = "r"; teamstring = CG_TranslateString("Axis"); break; case TEAM_ALLIES: classtype = "b"; teamstring = CG_TranslateString("Allies"); break; default: CG_Printf("Invalid team.\n"); return; } trap_Argv(1, cls, 64); if (!Q_stricmp(cls, "s") || !Q_stricmp(cls, "0")) { playerclass = PC_SOLDIER; } else if (!Q_stricmp(cls, "m") || !Q_stricmp(cls, "1")) { playerclass = PC_MEDIC; } else if (!Q_stricmp(cls, "e") || !Q_stricmp(cls, "2")) { playerclass = PC_ENGINEER; } else if (!Q_stricmp(cls, "f") || !Q_stricmp(cls, "3")) { playerclass = PC_FIELDOPS; } else if (!Q_stricmp(cls, "c") || !Q_stricmp(cls, "4")) { playerclass = PC_COVERTOPS; } else { CG_Printf("Invalid class format.\n"); return; } classinfo = BG_GetPlayerClassInfo(team, playerclass); if (trap_Argc() > 2) { trap_Argv(2, cls, 64); weapon1 = atoi(cls); if (weapon1 <= 0 || weapon1 > MAX_WEAPS_PER_CLASS) { weapon1 = classinfo->classWeapons[0]; } else if (!classinfo->classWeapons[weapon1 - 1]) { CG_Printf("Invalid command format for weapon.\n"); return; } else { weapon1 = classinfo->classWeapons[weapon1 - 1]; } } else { weapon1 = classinfo->classWeapons[0]; } if (trap_Argc() > 3) { trap_Argv(3, cls, 64); weapon2 = atoi(cls); weapon2 = CG_GetSecondaryWeapon(weapon2, team, playerclass); } else { weapon2 = CG_GetSecondaryWeapon(-1, team, playerclass); } // Print out the selected class and weapon info if (cgs.clientinfo[cg.clientNum].skill[SK_HEAVY_WEAPONS] >= 4 && playerclass == PC_SOLDIER && !Q_stricmp(weaponTable[weapon1].desc, weaponTable[weapon2].desc)) { CG_PriorityCenterPrint(va(CG_TranslateString("You will spawn as a %s %s with a %s."), teamstring, BG_ClassnameForNumber(playerclass), weaponTable[weapon1].desc), 400, cg_fontScaleCP.value, -1); } else { CG_PriorityCenterPrint(va(CG_TranslateString("You will spawn as a %s %s with a %s and a %s."), teamstring, BG_ClassnameForNumber(playerclass), weaponTable[weapon1].desc, weaponTable[weapon2].desc), 400, cg_fontScaleCP.value, -1); } // Send the switch command to the server trap_SendClientCommand(va("team %s %i %i %i\n", classtype, playerclass, weapon1, weapon2)); }
static void CG_TaskFollow_f(void) { trap_SendConsoleCommand(va("cmd vsay_team %s\n", VOICECHAT_ONFOLLOW)); trap_SendClientCommand(va("teamtask %d\n", TEAMTASK_FOLLOW)); }
static void CG_TaskDefense_f (void ) { trap_SendConsoleCommand(va("cmd vsay_team %s\n", VOICECHAT_ONDEFENSE)); trap_SendClientCommand(va("teamtask %d\n", TEAMTASK_DEFENSE)); }
static void CG_TaskRetrieve_f(void) { trap_SendConsoleCommand(va("cmd vsay_team %s\n", VOICECHAT_ONRETURNFLAG)); trap_SendClientCommand(va("teamtask %d\n", TEAMTASK_RETRIEVE)); }
static void CG_TaskCamp_f (void ) { trap_SendConsoleCommand(va("cmd vsay_team %s\n", VOICECHAT_ONCAMPING)); trap_SendClientCommand(va("teamtask %d\n", TEAMTASK_CAMP)); }
/* ================= 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); //mcwf if (!Q_stricmp(cmd,"m")) { if (need_escape(ConcatArgs(1))) { trap_SendClientCommand(va("m \"%s\"\n",escape_string(ConcatArgs(1)))); // say private return -1; } } if (!Q_stricmp(cmd,"priv")) { if (need_escape(ConcatArgs(1))) { trap_SendClientCommand(va("priv \"%s\"\n",escape_string(ConcatArgs(1)))); // say private clone return -1; } } if (!Q_stricmp(cmd,"mt")) { if (need_escape(ConcatArgs(1))) { trap_SendClientCommand(va("mt \"%s\"\n",escape_string(ConcatArgs(1)))); // say private team return -1; } } if (!Q_stricmp(cmd,"ma")) { if (need_escape(ConcatArgs(1))) { trap_SendClientCommand(va("ma \"%s\"\n",escape_string(ConcatArgs(1)))); // admin chat return -1; } } if (!Q_stricmp(cmd,"say")) { if (need_escape(ConcatArgs(1))) { trap_SendClientCommand(va("say \"%s\"\n",escape_string(ConcatArgs(1)))); // say normal return -1; } } if (!Q_stricmp(cmd,"say_team")) { if (need_escape(ConcatArgs(1))) { trap_SendClientCommand(va("say_team \"%s\"\n",escape_string(ConcatArgs(1)))); // say team return -1; } } if (!Q_stricmp(cmd,"say_teamnl")) { if (need_escape(ConcatArgs(1))) { trap_SendClientCommand(va("say_teamnl \"%s\"\n",escape_string(ConcatArgs(1)))); // say team no pos return -1; } } if (!Q_stricmp(cmd,"say_buddy")) { if (need_escape(ConcatArgs(1))) { trap_SendClientCommand(va("say_buddy \"%s\"\n",escape_string(ConcatArgs(1)))); // say fireteam return -1; } } //mcwf // TODO just for testing, remove me later if (!Q_stricmp(cmd,"cyclechar")) { trap_SendClientCommand( "cyclechar" ); return -1; } // TODO just for testing, remove me later if (!Q_stricmp(cmd,"setchar")) { trap_SendClientCommand( "setchar" ); return -1; } for ( i = 0 ; i < sizeof( commands ) / sizeof( commands[0] ) ; i++ ) { if ( !Q_stricmp( cmd, commands[i].cmd ) ) { commands[i].function(); return qtrue; } } return qfalse; }