| 1 |
/* |
| 2 |
=========================================================================== |
| 3 |
Copyright (C) 1999-2005 Id Software, Inc. |
| 4 |
|
| 5 |
This file is part of Quake III Arena source code. |
| 6 |
|
| 7 |
Quake III Arena source code is free software; you can redistribute it |
| 8 |
and/or modify it under the terms of the GNU General Public License as |
| 9 |
published by the Free Software Foundation; either version 2 of the License, |
| 10 |
or (at your option) any later version. |
| 11 |
|
| 12 |
Quake III Arena source code is distributed in the hope that it will be |
| 13 |
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
GNU General Public License for more details. |
| 16 |
|
| 17 |
You should have received a copy of the GNU General Public License |
| 18 |
along with Quake III Arena source code; if not, write to the Free Software |
| 19 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 |
=========================================================================== |
| 21 |
*/ |
| 22 |
// |
| 23 |
// cg_consolecmds.c -- text commands typed in at the local console, or |
| 24 |
// executed by a key binding |
| 25 |
|
| 26 |
#include "cg_local.h" |
| 27 |
#include "../ui/ui_shared.h" |
| 28 |
#ifdef MISSIONPACK |
| 29 |
extern menuDef_t *menuScoreboard; |
| 30 |
#endif |
| 31 |
|
| 32 |
void CG_PrintClientNumbers( void ) { |
| 33 |
int i; |
| 34 |
|
| 35 |
CG_Printf( "slot score ping name\n" ); |
| 36 |
CG_Printf( "---- ----- ---- ----\n" ); |
| 37 |
|
| 38 |
for(i=0;i<cg.numScores;i++) { |
| 39 |
CG_Printf("%-4d",cg.scores[i].client); |
| 40 |
|
| 41 |
CG_Printf(" %-5d",cg.scores[i].score); |
| 42 |
|
| 43 |
CG_Printf(" %-4d",cg.scores[i].ping); |
| 44 |
|
| 45 |
CG_Printf(" %s\n",cgs.clientinfo[cg.scores[i].client].name); |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
void CG_TargetCommand_f( void ) { |
| 50 |
int targetNum; |
| 51 |
char test[4]; |
| 52 |
|
| 53 |
targetNum = CG_CrosshairPlayer(); |
| 54 |
if (!targetNum ) { |
| 55 |
return; |
| 56 |
} |
| 57 |
|
| 58 |
trap_Argv( 1, test, 4 ); |
| 59 |
trap_SendConsoleCommand( va( "gc %i %i", targetNum, atoi( test ) ) ); |
| 60 |
} |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
/* |
| 65 |
================= |
| 66 |
CG_SizeUp_f |
| 67 |
|
| 68 |
Keybinding command |
| 69 |
================= |
| 70 |
*/ |
| 71 |
static void CG_SizeUp_f (void) { |
| 72 |
trap_Cvar_Set("cg_viewsize", va("%i",(int)(cg_viewsize.integer+10))); |
| 73 |
} |
| 74 |
|
| 75 |
|
| 76 |
/* |
| 77 |
================= |
| 78 |
CG_SizeDown_f |
| 79 |
|
| 80 |
Keybinding command |
| 81 |
================= |
| 82 |
*/ |
| 83 |
static void CG_SizeDown_f (void) { |
| 84 |
trap_Cvar_Set("cg_viewsize", va("%i",(int)(cg_viewsize.integer-10))); |
| 85 |
} |
| 86 |
|
| 87 |
|
| 88 |
/* |
| 89 |
============= |
| 90 |
CG_Viewpos_f |
| 91 |
|
| 92 |
Debugging command to print the current position |
| 93 |
============= |
| 94 |
*/ |
| 95 |
static void CG_Viewpos_f (void) { |
| 96 |
CG_Printf ("(%i %i %i) : %i\n", (int)cg.refdef.vieworg[0], |
| 97 |
(int)cg.refdef.vieworg[1], (int)cg.refdef.vieworg[2], |
| 98 |
(int)cg.refdefViewAngles[YAW]); |
| 99 |
} |
| 100 |
|
| 101 |
|
| 102 |
static void CG_ScoresDown_f( void ) { |
| 103 |
|
| 104 |
#ifdef MISSIONPACK |
| 105 |
CG_BuildSpectatorString(); |
| 106 |
#endif |
| 107 |
if ( cg.scoresRequestTime + 2000 < cg.time ) { |
| 108 |
// the scores are more than two seconds out of data, |
| 109 |
// so request new ones |
| 110 |
cg.scoresRequestTime = cg.time; |
| 111 |
trap_SendClientCommand( "score" ); |
| 112 |
|
| 113 |
// leave the current scores up if they were already |
| 114 |
// displayed, but if this is the first hit, clear them out |
| 115 |
if ( !cg.showScores ) { |
| 116 |
cg.showScores = qtrue; |
| 117 |
cg.numScores = 0; |
| 118 |
} |
| 119 |
} else { |
| 120 |
// show the cached contents even if they just pressed if it |
| 121 |
// is within two seconds |
| 122 |
cg.showScores = qtrue; |
| 123 |
} |
| 124 |
} |
| 125 |
|
| 126 |
static void CG_ScoresUp_f( void ) { |
| 127 |
if ( cg.showScores ) { |
| 128 |
cg.showScores = qfalse; |
| 129 |
cg.scoreFadeTime = cg.time; |
| 130 |
} |
| 131 |
} |
| 132 |
|
| 133 |
static void CG_AccDown_f( void ) { |
| 134 |
|
| 135 |
if ( cg.accRequestTime + 2000 < cg.time ) { |
| 136 |
|
| 137 |
cg.accRequestTime = cg.time; |
| 138 |
trap_SendClientCommand( "acc" ); |
| 139 |
|
| 140 |
if ( !cg.showAcc ) { |
| 141 |
cg.showAcc = qtrue; |
| 142 |
} |
| 143 |
|
| 144 |
} else { |
| 145 |
cg.showAcc = qtrue; |
| 146 |
} |
| 147 |
} |
| 148 |
|
| 149 |
|
| 150 |
static void CG_AccUp_f( void ) { |
| 151 |
if ( cg.showAcc ) { |
| 152 |
cg.showAcc = qfalse; |
| 153 |
cg.accFadeTime = cg.time; |
| 154 |
} |
| 155 |
} |
| 156 |
|
| 157 |
|
| 158 |
#ifdef MISSIONPACK |
| 159 |
extern menuDef_t *menuScoreboard; |
| 160 |
void Menu_Reset( void ); // FIXME: add to right include file |
| 161 |
|
| 162 |
static void CG_LoadHud_f( void) { |
| 163 |
char buff[1024]; |
| 164 |
const char *hudSet; |
| 165 |
memset(buff, 0, sizeof(buff)); |
| 166 |
|
| 167 |
String_Init(); |
| 168 |
Menu_Reset(); |
| 169 |
|
| 170 |
trap_Cvar_VariableStringBuffer("cg_hudFiles", buff, sizeof(buff)); |
| 171 |
hudSet = buff; |
| 172 |
if (hudSet[0] == '\0') { |
| 173 |
hudSet = "ui/hud.txt"; |
| 174 |
} |
| 175 |
|
| 176 |
CG_LoadMenus(hudSet); |
| 177 |
menuScoreboard = NULL; |
| 178 |
} |
| 179 |
|
| 180 |
|
| 181 |
static void CG_scrollScoresDown_f( void) { |
| 182 |
if (menuScoreboard && cg.scoreBoardShowing) { |
| 183 |
Menu_ScrollFeeder(menuScoreboard, FEEDER_SCOREBOARD, qtrue); |
| 184 |
Menu_ScrollFeeder(menuScoreboard, FEEDER_REDTEAM_LIST, qtrue); |
| 185 |
Menu_ScrollFeeder(menuScoreboard, FEEDER_BLUETEAM_LIST, qtrue); |
| 186 |
} |
| 187 |
} |
| 188 |
|
| 189 |
|
| 190 |
static void CG_scrollScoresUp_f( void) { |
| 191 |
if (menuScoreboard && cg.scoreBoardShowing) { |
| 192 |
Menu_ScrollFeeder(menuScoreboard, FEEDER_SCOREBOARD, qfalse); |
| 193 |
Menu_ScrollFeeder(menuScoreboard, FEEDER_REDTEAM_LIST, qfalse); |
| 194 |
Menu_ScrollFeeder(menuScoreboard, FEEDER_BLUETEAM_LIST, qfalse); |
| 195 |
} |
| 196 |
} |
| 197 |
|
| 198 |
|
| 199 |
static void CG_spWin_f( void) { |
| 200 |
trap_Cvar_Set("cg_cameraOrbit", "2"); |
| 201 |
trap_Cvar_Set("cg_cameraOrbitDelay", "35"); |
| 202 |
trap_Cvar_Set("cg_thirdPerson", "1"); |
| 203 |
trap_Cvar_Set("cg_thirdPersonAngle", "0"); |
| 204 |
trap_Cvar_Set("cg_thirdPersonRange", "100"); |
| 205 |
CG_AddBufferedSound(cgs.media.winnerSound); |
| 206 |
//trap_S_StartLocalSound(cgs.media.winnerSound, CHAN_ANNOUNCER); |
| 207 |
CG_CenterPrint("YOU WIN!", SCREEN_HEIGHT * .30, 0); |
| 208 |
} |
| 209 |
|
| 210 |
static void CG_spLose_f( void) { |
| 211 |
trap_Cvar_Set("cg_cameraOrbit", "2"); |
| 212 |
trap_Cvar_Set("cg_cameraOrbitDelay", "35"); |
| 213 |
trap_Cvar_Set("cg_thirdPerson", "1"); |
| 214 |
trap_Cvar_Set("cg_thirdPersonAngle", "0"); |
| 215 |
trap_Cvar_Set("cg_thirdPersonRange", "100"); |
| 216 |
CG_AddBufferedSound(cgs.media.loserSound); |
| 217 |
//trap_S_StartLocalSound(cgs.media.loserSound, CHAN_ANNOUNCER); |
| 218 |
CG_CenterPrint("YOU LOSE...", SCREEN_HEIGHT * .30, 0); |
| 219 |
} |
| 220 |
|
| 221 |
#endif |
| 222 |
|
| 223 |
static void CG_TellTarget_f( void ) { |
| 224 |
int clientNum; |
| 225 |
char command[128]; |
| 226 |
char message[128]; |
| 227 |
|
| 228 |
clientNum = CG_CrosshairPlayer(); |
| 229 |
if ( clientNum == -1 ) { |
| 230 |
return; |
| 231 |
} |
| 232 |
|
| 233 |
trap_Args( message, 128 ); |
| 234 |
Com_sprintf( command, 128, "tell %i %s", clientNum, message ); |
| 235 |
trap_SendClientCommand( command ); |
| 236 |
} |
| 237 |
|
| 238 |
static void CG_TellAttacker_f( void ) { |
| 239 |
int clientNum; |
| 240 |
char command[128]; |
| 241 |
char message[128]; |
| 242 |
|
| 243 |
clientNum = CG_LastAttacker(); |
| 244 |
if ( clientNum == -1 ) { |
| 245 |
return; |
| 246 |
} |
| 247 |
|
| 248 |
trap_Args( message, 128 ); |
| 249 |
Com_sprintf( command, 128, "tell %i %s", clientNum, message ); |
| 250 |
trap_SendClientCommand( command ); |
| 251 |
} |
| 252 |
|
| 253 |
static void CG_VoiceTellTarget_f( void ) { |
| 254 |
int clientNum; |
| 255 |
char command[128]; |
| 256 |
char message[128]; |
| 257 |
|
| 258 |
clientNum = CG_CrosshairPlayer(); |
| 259 |
if ( clientNum == -1 ) { |
| 260 |
return; |
| 261 |
} |
| 262 |
|
| 263 |
trap_Args( message, 128 ); |
| 264 |
Com_sprintf( command, 128, "vtell %i %s", clientNum, message ); |
| 265 |
trap_SendClientCommand( command ); |
| 266 |
} |
| 267 |
|
| 268 |
static void CG_VoiceTellAttacker_f( void ) { |
| 269 |
int clientNum; |
| 270 |
char command[128]; |
| 271 |
char message[128]; |
| 272 |
|
| 273 |
clientNum = CG_LastAttacker(); |
| 274 |
if ( clientNum == -1 ) { |
| 275 |
return; |
| 276 |
} |
| 277 |
|
| 278 |
trap_Args( message, 128 ); |
| 279 |
Com_sprintf( command, 128, "vtell %i %s", clientNum, message ); |
| 280 |
trap_SendClientCommand( command ); |
| 281 |
} |
| 282 |
|
| 283 |
#ifdef MISSIONPACK |
| 284 |
static void CG_NextTeamMember_f( void ) { |
| 285 |
CG_SelectNextPlayer(); |
| 286 |
} |
| 287 |
|
| 288 |
static void CG_PrevTeamMember_f( void ) { |
| 289 |
CG_SelectPrevPlayer(); |
| 290 |
} |
| 291 |
|
| 292 |
// ASS U ME's enumeration order as far as task specific orders, OFFENSE is zero, CAMP is last |
| 293 |
// |
| 294 |
static void CG_NextOrder_f( void ) { |
| 295 |
clientInfo_t *ci = cgs.clientinfo + cg.snap->ps.clientNum; |
| 296 |
if (ci) { |
| 297 |
if (!ci->teamLeader && sortedTeamPlayers[cg_currentSelectedPlayer.integer] != cg.snap->ps.clientNum) { |
| 298 |
return; |
| 299 |
} |
| 300 |
} |
| 301 |
if (cgs.currentOrder < TEAMTASK_CAMP) { |
| 302 |
cgs.currentOrder++; |
| 303 |
|
| 304 |
if (cgs.currentOrder == TEAMTASK_RETRIEVE) { |
| 305 |
if (!CG_OtherTeamHasFlag()) { |
| 306 |
cgs.currentOrder++; |
| 307 |
} |
| 308 |
} |
| 309 |
|
| 310 |
if (cgs.currentOrder == TEAMTASK_ESCORT) { |
| 311 |
if (!CG_YourTeamHasFlag()) { |
| 312 |
cgs.currentOrder++; |
| 313 |
} |
| 314 |
} |
| 315 |
|
| 316 |
} else { |
| 317 |
cgs.currentOrder = TEAMTASK_OFFENSE; |
| 318 |
} |
| 319 |
cgs.orderPending = qtrue; |
| 320 |
cgs.orderTime = cg.time + 3000; |
| 321 |
} |
| 322 |
|
| 323 |
|
| 324 |
static void CG_ConfirmOrder_f (void ) { |
| 325 |
trap_SendConsoleCommand(va("cmd vtell %d %s\n", cgs.acceptLeader, VOICECHAT_YES)); |
| 326 |
trap_SendConsoleCommand("+button5; wait; -button5"); |
| 327 |
if (cg.time < cgs.acceptOrderTime) { |
| 328 |
trap_SendClientCommand(va("teamtask %d\n", cgs.acceptTask)); |
| 329 |
cgs.acceptOrderTime = 0; |
| 330 |
} |
| 331 |
} |
| 332 |
|
| 333 |
static void CG_DenyOrder_f (void ) { |
| 334 |
trap_SendConsoleCommand(va("cmd vtell %d %s\n", cgs.acceptLeader, VOICECHAT_NO)); |
| 335 |
trap_SendConsoleCommand("+button6; wait; -button6"); |
| 336 |
if (cg.time < cgs.acceptOrderTime) { |
| 337 |
cgs.acceptOrderTime = 0; |
| 338 |
} |
| 339 |
} |
| 340 |
|
| 341 |
static void CG_TaskOffense_f (void ) { |
| 342 |
if (cgs.gametype == GT_CTF || cgs.gametype == GT_CTF_ELIMINATION || cgs.gametype == GT_1FCTF) { |
| 343 |
trap_SendConsoleCommand(va("cmd vsay_team %s\n", VOICECHAT_ONGETFLAG)); |
| 344 |
} else { |
| 345 |
trap_SendConsoleCommand(va("cmd vsay_team %s\n", VOICECHAT_ONOFFENSE)); |
| 346 |
} |
| 347 |
trap_SendClientCommand(va("teamtask %d\n", TEAMTASK_OFFENSE)); |
| 348 |
} |
| 349 |
|
| 350 |
static void CG_TaskDefense_f (void ) { |
| 351 |
trap_SendConsoleCommand(va("cmd vsay_team %s\n", VOICECHAT_ONDEFENSE)); |
| 352 |
trap_SendClientCommand(va("teamtask %d\n", TEAMTASK_DEFENSE)); |
| 353 |
} |
| 354 |
|
| 355 |
static void CG_TaskPatrol_f (void ) { |
| 356 |
trap_SendConsoleCommand(va("cmd vsay_team %s\n", VOICECHAT_ONPATROL)); |
| 357 |
trap_SendClientCommand(va("teamtask %d\n", TEAMTASK_PATROL)); |
| 358 |
} |
| 359 |
|
| 360 |
static void CG_TaskCamp_f (void ) { |
| 361 |
trap_SendConsoleCommand(va("cmd vsay_team %s\n", VOICECHAT_ONCAMPING)); |
| 362 |
trap_SendClientCommand(va("teamtask %d\n", TEAMTASK_CAMP)); |
| 363 |
} |
| 364 |
|
| 365 |
static void CG_TaskFollow_f (void ) { |
| 366 |
trap_SendConsoleCommand(va("cmd vsay_team %s\n", VOICECHAT_ONFOLLOW)); |
| 367 |
trap_SendClientCommand(va("teamtask %d\n", TEAMTASK_FOLLOW)); |
| 368 |
} |
| 369 |
|
| 370 |
static void CG_TaskRetrieve_f (void ) { |
| 371 |
trap_SendConsoleCommand(va("cmd vsay_team %s\n", VOICECHAT_ONRETURNFLAG)); |
| 372 |
trap_SendClientCommand(va("teamtask %d\n", TEAMTASK_RETRIEVE)); |
| 373 |
} |
| 374 |
|
| 375 |
static void CG_TaskEscort_f (void ) { |
| 376 |
trap_SendConsoleCommand(va("cmd vsay_team %s\n", VOICECHAT_ONFOLLOWCARRIER)); |
| 377 |
trap_SendClientCommand(va("teamtask %d\n", TEAMTASK_ESCORT)); |
| 378 |
} |
| 379 |
|
| 380 |
static void CG_TaskOwnFlag_f (void ) { |
| 381 |
trap_SendConsoleCommand(va("cmd vsay_team %s\n", VOICECHAT_IHAVEFLAG)); |
| 382 |
} |
| 383 |
|
| 384 |
static void CG_TauntKillInsult_f (void ) { |
| 385 |
trap_SendConsoleCommand("cmd vsay kill_insult\n"); |
| 386 |
} |
| 387 |
|
| 388 |
static void CG_TauntPraise_f (void ) { |
| 389 |
trap_SendConsoleCommand("cmd vsay praise\n"); |
| 390 |
} |
| 391 |
|
| 392 |
static void CG_TauntTaunt_f (void ) { |
| 393 |
trap_SendConsoleCommand("cmd vtaunt\n"); |
| 394 |
} |
| 395 |
|
| 396 |
static void CG_TauntDeathInsult_f (void ) { |
| 397 |
trap_SendConsoleCommand("cmd vsay death_insult\n"); |
| 398 |
} |
| 399 |
|
| 400 |
static void CG_TauntGauntlet_f (void ) { |
| 401 |
trap_SendConsoleCommand("cmd vsay kill_guantlet\n"); |
| 402 |
} |
| 403 |
|
| 404 |
static void CG_TaskSuicide_f (void ) { |
| 405 |
int clientNum; |
| 406 |
char command[128]; |
| 407 |
|
| 408 |
clientNum = CG_CrosshairPlayer(); |
| 409 |
if ( clientNum == -1 ) { |
| 410 |
return; |
| 411 |
} |
| 412 |
|
| 413 |
Com_sprintf( command, 128, "tell %i suicide", clientNum ); |
| 414 |
trap_SendClientCommand( command ); |
| 415 |
} |
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
/* |
| 420 |
================== |
| 421 |
CG_TeamMenu_f |
| 422 |
================== |
| 423 |
*/ |
| 424 |
/* |
| 425 |
static void CG_TeamMenu_f( void ) { |
| 426 |
if (trap_Key_GetCatcher() & KEYCATCH_CGAME) { |
| 427 |
CG_EventHandling(CGAME_EVENT_NONE); |
| 428 |
trap_Key_SetCatcher(0); |
| 429 |
} else { |
| 430 |
CG_EventHandling(CGAME_EVENT_TEAMMENU); |
| 431 |
//trap_Key_SetCatcher(KEYCATCH_CGAME); |
| 432 |
} |
| 433 |
} |
| 434 |
*/ |
| 435 |
|
| 436 |
/* |
| 437 |
================== |
| 438 |
CG_EditHud_f |
| 439 |
================== |
| 440 |
*/ |
| 441 |
/* |
| 442 |
static void CG_EditHud_f( void ) { |
| 443 |
//cls.keyCatchers ^= KEYCATCH_CGAME; |
| 444 |
//VM_Call (cgvm, CG_EVENT_HANDLING, (cls.keyCatchers & KEYCATCH_CGAME) ? CGAME_EVENT_EDITHUD : CGAME_EVENT_NONE); |
| 445 |
} |
| 446 |
*/ |
| 447 |
|
| 448 |
#endif |
| 449 |
|
| 450 |
/* |
| 451 |
================== |
| 452 |
CG_StartOrbit_f |
| 453 |
================== |
| 454 |
*/ |
| 455 |
|
| 456 |
static void CG_StartOrbit_f( void ) { |
| 457 |
char var[MAX_TOKEN_CHARS]; |
| 458 |
|
| 459 |
trap_Cvar_VariableStringBuffer( "developer", var, sizeof( var ) ); |
| 460 |
if ( !atoi(var) ) { |
| 461 |
return; |
| 462 |
} |
| 463 |
if (cg_cameraOrbit.value != 0) { |
| 464 |
trap_Cvar_Set ("cg_cameraOrbit", "0"); |
| 465 |
trap_Cvar_Set("cg_thirdPerson", "0"); |
| 466 |
} else { |
| 467 |
trap_Cvar_Set("cg_cameraOrbit", "5"); |
| 468 |
trap_Cvar_Set("cg_thirdPerson", "1"); |
| 469 |
trap_Cvar_Set("cg_thirdPersonAngle", "0"); |
| 470 |
trap_Cvar_Set("cg_thirdPersonRange", "100"); |
| 471 |
} |
| 472 |
} |
| 473 |
|
| 474 |
/* |
| 475 |
static void CG_Camera_f( void ) { |
| 476 |
char name[1024]; |
| 477 |
trap_Argv( 1, name, sizeof(name)); |
| 478 |
if (trap_loadCamera(name)) { |
| 479 |
cg.cameraMode = qtrue; |
| 480 |
trap_startCamera(cg.time); |
| 481 |
} else { |
| 482 |
CG_Printf ("Unable to load camera %s\n",name); |
| 483 |
} |
| 484 |
} |
| 485 |
*/ |
| 486 |
|
| 487 |
|
| 488 |
typedef struct { |
| 489 |
char *cmd; |
| 490 |
void (*function)(void); |
| 491 |
} consoleCommand_t; |
| 492 |
|
| 493 |
static consoleCommand_t commands[] = { |
| 494 |
{ "testgun", CG_TestGun_f }, |
| 495 |
{ "testmodel", CG_TestModel_f }, |
| 496 |
{ "nextframe", CG_TestModelNextFrame_f }, |
| 497 |
{ "prevframe", CG_TestModelPrevFrame_f }, |
| 498 |
{ "nextskin", CG_TestModelNextSkin_f }, |
| 499 |
{ "prevskin", CG_TestModelPrevSkin_f }, |
| 500 |
{ "viewpos", CG_Viewpos_f }, |
| 501 |
{ "+scores", CG_ScoresDown_f }, |
| 502 |
{ "-scores", CG_ScoresUp_f }, |
| 503 |
{ "+zoom", CG_ZoomDown_f }, |
| 504 |
{ "-zoom", CG_ZoomUp_f }, |
| 505 |
{ "sizeup", CG_SizeUp_f }, |
| 506 |
{ "sizedown", CG_SizeDown_f }, |
| 507 |
{ "weapnext", CG_NextWeapon_f }, |
| 508 |
{ "weapprev", CG_PrevWeapon_f }, |
| 509 |
{ "weapon", CG_Weapon_f }, |
| 510 |
{ "tell_target", CG_TellTarget_f }, |
| 511 |
{ "tell_attacker", CG_TellAttacker_f }, |
| 512 |
{ "vtell_target", CG_VoiceTellTarget_f }, |
| 513 |
{ "vtell_attacker", CG_VoiceTellAttacker_f }, |
| 514 |
{ "tcmd", CG_TargetCommand_f }, |
| 515 |
#ifdef MISSIONPACK |
| 516 |
{ "loadhud", CG_LoadHud_f }, |
| 517 |
{ "nextTeamMember", CG_NextTeamMember_f }, |
| 518 |
{ "prevTeamMember", CG_PrevTeamMember_f }, |
| 519 |
{ "nextOrder", CG_NextOrder_f }, |
| 520 |
{ "confirmOrder", CG_ConfirmOrder_f }, |
| 521 |
{ "denyOrder", CG_DenyOrder_f }, |
| 522 |
{ "taskOffense", CG_TaskOffense_f }, |
| 523 |
{ "taskDefense", CG_TaskDefense_f }, |
| 524 |
{ "taskPatrol", CG_TaskPatrol_f }, |
| 525 |
{ "taskCamp", CG_TaskCamp_f }, |
| 526 |
{ "taskFollow", CG_TaskFollow_f }, |
| 527 |
{ "taskRetrieve", CG_TaskRetrieve_f }, |
| 528 |
{ "taskEscort", CG_TaskEscort_f }, |
| 529 |
{ "taskSuicide", CG_TaskSuicide_f }, |
| 530 |
{ "taskOwnFlag", CG_TaskOwnFlag_f }, |
| 531 |
{ "tauntKillInsult", CG_TauntKillInsult_f }, |
| 532 |
{ "tauntPraise", CG_TauntPraise_f }, |
| 533 |
{ "tauntTaunt", CG_TauntTaunt_f }, |
| 534 |
{ "tauntDeathInsult", CG_TauntDeathInsult_f }, |
| 535 |
{ "tauntGauntlet", CG_TauntGauntlet_f }, |
| 536 |
{ "spWin", CG_spWin_f }, |
| 537 |
{ "spLose", CG_spLose_f }, |
| 538 |
{ "scoresDown", CG_scrollScoresDown_f }, |
| 539 |
{ "scoresUp", CG_scrollScoresUp_f }, |
| 540 |
#endif |
| 541 |
{ "startOrbit", CG_StartOrbit_f }, |
| 542 |
// { "camera", CG_Camera_f }, |
| 543 |
{ "loaddeferred", CG_LoadDeferredPlayers }, |
| 544 |
{ "+acc", CG_AccDown_f }, |
| 545 |
{ "-acc", CG_AccUp_f }, |
| 546 |
{ "clients", CG_PrintClientNumbers } |
| 547 |
}; |
| 548 |
|
| 549 |
|
| 550 |
/* |
| 551 |
================= |
| 552 |
CG_ConsoleCommand |
| 553 |
|
| 554 |
The string has been tokenized and can be retrieved with |
| 555 |
Cmd_Argc() / Cmd_Argv() |
| 556 |
================= |
| 557 |
*/ |
| 558 |
qboolean CG_ConsoleCommand( void ) { |
| 559 |
const char *cmd; |
| 560 |
int i; |
| 561 |
|
| 562 |
cmd = CG_Argv(0); |
| 563 |
|
| 564 |
for ( i = 0 ; i < sizeof( commands ) / sizeof( commands[0] ) ; i++ ) { |
| 565 |
if ( !Q_stricmp( cmd, commands[i].cmd ) ) { |
| 566 |
commands[i].function(); |
| 567 |
return qtrue; |
| 568 |
} |
| 569 |
} |
| 570 |
|
| 571 |
return qfalse; |
| 572 |
} |
| 573 |
|
| 574 |
|
| 575 |
/* |
| 576 |
================= |
| 577 |
CG_InitConsoleCommands |
| 578 |
|
| 579 |
Let the client system know about all of our commands |
| 580 |
so it can perform tab completion |
| 581 |
================= |
| 582 |
*/ |
| 583 |
void CG_InitConsoleCommands( void ) { |
| 584 |
int i; |
| 585 |
|
| 586 |
for ( i = 0 ; i < sizeof( commands ) / sizeof( commands[0] ) ; i++ ) { |
| 587 |
trap_AddCommand( commands[i].cmd ); |
| 588 |
} |
| 589 |
|
| 590 |
// |
| 591 |
// the game server will interpret these commands, which will be automatically |
| 592 |
// forwarded to the server after they are not recognized locally |
| 593 |
// |
| 594 |
trap_AddCommand ("kill"); |
| 595 |
trap_AddCommand ("say"); |
| 596 |
trap_AddCommand ("say_team"); |
| 597 |
trap_AddCommand ("tell"); |
| 598 |
trap_AddCommand ("vsay"); |
| 599 |
trap_AddCommand ("vsay_team"); |
| 600 |
trap_AddCommand ("vtell"); |
| 601 |
trap_AddCommand ("vtaunt"); |
| 602 |
trap_AddCommand ("vosay"); |
| 603 |
trap_AddCommand ("vosay_team"); |
| 604 |
trap_AddCommand ("votell"); |
| 605 |
trap_AddCommand ("give"); |
| 606 |
trap_AddCommand ("god"); |
| 607 |
trap_AddCommand ("notarget"); |
| 608 |
trap_AddCommand ("noclip"); |
| 609 |
trap_AddCommand ("team"); |
| 610 |
trap_AddCommand ("follow"); |
| 611 |
trap_AddCommand ("levelshot"); |
| 612 |
trap_AddCommand ("addbot"); |
| 613 |
trap_AddCommand ("setviewpos"); |
| 614 |
trap_AddCommand ("callvote"); |
| 615 |
trap_AddCommand ("getmappage"); |
| 616 |
trap_AddCommand ("vote"); |
| 617 |
trap_AddCommand ("callteamvote"); |
| 618 |
trap_AddCommand ("teamvote"); |
| 619 |
trap_AddCommand ("stats"); |
| 620 |
trap_AddCommand ("teamtask"); |
| 621 |
trap_AddCommand ("loaddefered"); // spelled wrong, but not changing for demo |
| 622 |
} |