SysCmds.cpp 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406
  1. /*
  2. ===========================================================================
  3. Doom 3 GPL Source Code
  4. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
  6. Doom 3 Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #include "../../idlib/precompiled.h"
  21. #pragma hdrstop
  22. #include "../Game_local.h"
  23. #include "TypeInfo.h"
  24. /*
  25. ==================
  26. Cmd_GetFloatArg
  27. ==================
  28. */
  29. float Cmd_GetFloatArg( const idCmdArgs &args, int &argNum ) {
  30. const char *value;
  31. value = args.Argv( argNum++ );
  32. return atof( value );
  33. }
  34. /*
  35. ===================
  36. Cmd_EntityList_f
  37. ===================
  38. */
  39. void Cmd_EntityList_f( const idCmdArgs &args ) {
  40. int e;
  41. idEntity *check;
  42. int count;
  43. size_t size;
  44. idStr match;
  45. if ( args.Argc() > 1 ) {
  46. match = args.Args();
  47. match.Replace( " ", "" );
  48. } else {
  49. match = "";
  50. }
  51. count = 0;
  52. size = 0;
  53. gameLocal.Printf( "%-4s %-20s %-20s %s\n", " Num", "EntityDef", "Class", "Name" );
  54. gameLocal.Printf( "--------------------------------------------------------------------\n" );
  55. for( e = 0; e < MAX_GENTITIES; e++ ) {
  56. check = gameLocal.entities[ e ];
  57. if ( !check ) {
  58. continue;
  59. }
  60. if ( !check->name.Filter( match, true ) ) {
  61. continue;
  62. }
  63. gameLocal.Printf( "%4i: %-20s %-20s %s\n", e,
  64. check->GetEntityDefName(), check->GetClassname(), check->name.c_str() );
  65. count++;
  66. size += check->spawnArgs.Allocated();
  67. }
  68. gameLocal.Printf( "...%d entities\n...%d bytes of spawnargs\n", count, size );
  69. }
  70. /*
  71. ===================
  72. Cmd_ActiveEntityList_f
  73. ===================
  74. */
  75. void Cmd_ActiveEntityList_f( const idCmdArgs &args ) {
  76. idEntity *check;
  77. int count;
  78. count = 0;
  79. gameLocal.Printf( "%-4s %-20s %-20s %s\n", " Num", "EntityDef", "Class", "Name" );
  80. gameLocal.Printf( "--------------------------------------------------------------------\n" );
  81. for( check = gameLocal.activeEntities.Next(); check != NULL; check = check->activeNode.Next() ) {
  82. char dormant = check->fl.isDormant ? '-' : ' ';
  83. gameLocal.Printf( "%4i:%c%-20s %-20s %s\n", check->entityNumber, dormant, check->GetEntityDefName(), check->GetClassname(), check->name.c_str() );
  84. count++;
  85. }
  86. gameLocal.Printf( "...%d active entities\n", count );
  87. }
  88. /*
  89. ===================
  90. Cmd_ListSpawnArgs_f
  91. ===================
  92. */
  93. void Cmd_ListSpawnArgs_f( const idCmdArgs &args ) {
  94. int i;
  95. idEntity *ent;
  96. ent = gameLocal.FindEntity( args.Argv( 1 ) );
  97. if ( !ent ) {
  98. gameLocal.Printf( "entity not found\n" );
  99. return;
  100. }
  101. for ( i = 0; i < ent->spawnArgs.GetNumKeyVals(); i++ ) {
  102. const idKeyValue *kv = ent->spawnArgs.GetKeyVal( i );
  103. gameLocal.Printf( "\"%s\" "S_COLOR_WHITE"\"%s\"\n", kv->GetKey().c_str(), kv->GetValue().c_str() );
  104. }
  105. }
  106. /*
  107. ===================
  108. Cmd_ReloadScript_f
  109. ===================
  110. */
  111. void Cmd_ReloadScript_f( const idCmdArgs &args ) {
  112. // shutdown the map because entities may point to script objects
  113. gameLocal.MapShutdown();
  114. // recompile the scripts
  115. gameLocal.program.Startup( SCRIPT_DEFAULT );
  116. // error out so that the user can rerun the scripts
  117. gameLocal.Error( "Exiting map to reload scripts" );
  118. }
  119. /*
  120. ===================
  121. Cmd_Script_f
  122. ===================
  123. */
  124. void Cmd_Script_f( const idCmdArgs &args ) {
  125. const char * script;
  126. idStr text;
  127. idStr funcname;
  128. static int funccount = 0;
  129. idThread * thread;
  130. const function_t *func;
  131. idEntity *ent;
  132. if ( !gameLocal.CheatsOk() ) {
  133. return;
  134. }
  135. sprintf( funcname, "ConsoleFunction_%d", funccount++ );
  136. script = args.Args();
  137. sprintf( text, "void %s() {%s;}\n", funcname.c_str(), script );
  138. if ( gameLocal.program.CompileText( "console", text, true ) ) {
  139. func = gameLocal.program.FindFunction( funcname );
  140. if ( func ) {
  141. // set all the entity names in case the user named one in the script that wasn't referenced in the default script
  142. for( ent = gameLocal.spawnedEntities.Next(); ent != NULL; ent = ent->spawnNode.Next() ) {
  143. gameLocal.program.SetEntity( ent->name, ent );
  144. }
  145. thread = new idThread( func );
  146. thread->Start();
  147. }
  148. }
  149. }
  150. /*
  151. ==================
  152. KillEntities
  153. Kills all the entities of the given class in a level.
  154. ==================
  155. */
  156. void KillEntities( const idCmdArgs &args, const idTypeInfo &superClass ) {
  157. idEntity *ent;
  158. idStrList ignore;
  159. const char *name;
  160. int i;
  161. if ( !gameLocal.GetLocalPlayer() || !gameLocal.CheatsOk( false ) ) {
  162. return;
  163. }
  164. for( i = 1; i < args.Argc(); i++ ) {
  165. name = args.Argv( i );
  166. ignore.Append( name );
  167. }
  168. for( ent = gameLocal.spawnedEntities.Next(); ent != NULL; ent = ent->spawnNode.Next() ) {
  169. if ( ent->IsType( superClass ) ) {
  170. for( i = 0; i < ignore.Num(); i++ ) {
  171. if ( ignore[ i ] == ent->name ) {
  172. break;
  173. }
  174. }
  175. if ( i >= ignore.Num() ) {
  176. ent->PostEventMS( &EV_Remove, 0 );
  177. }
  178. }
  179. }
  180. }
  181. /*
  182. ==================
  183. Cmd_KillMonsters_f
  184. Kills all the monsters in a level.
  185. ==================
  186. */
  187. void Cmd_KillMonsters_f( const idCmdArgs &args ) {
  188. KillEntities( args, idAI::Type );
  189. // kill any projectiles as well since they have pointers to the monster that created them
  190. KillEntities( args, idProjectile::Type );
  191. }
  192. /*
  193. ==================
  194. Cmd_KillMovables_f
  195. Kills all the moveables in a level.
  196. ==================
  197. */
  198. void Cmd_KillMovables_f( const idCmdArgs &args ) {
  199. if ( !gameLocal.GetLocalPlayer() || !gameLocal.CheatsOk( false ) ) {
  200. return;
  201. }
  202. KillEntities( args, idMoveable::Type );
  203. }
  204. /*
  205. ==================
  206. Cmd_KillRagdolls_f
  207. Kills all the ragdolls in a level.
  208. ==================
  209. */
  210. void Cmd_KillRagdolls_f( const idCmdArgs &args ) {
  211. if ( !gameLocal.GetLocalPlayer() || !gameLocal.CheatsOk( false ) ) {
  212. return;
  213. }
  214. KillEntities( args, idAFEntity_Generic::Type );
  215. KillEntities( args, idAFEntity_WithAttachedHead::Type );
  216. }
  217. /*
  218. ==================
  219. Cmd_Give_f
  220. Give items to a client
  221. ==================
  222. */
  223. void Cmd_Give_f( const idCmdArgs &args ) {
  224. const char *name;
  225. int i;
  226. bool give_all;
  227. idPlayer *player;
  228. player = gameLocal.GetLocalPlayer();
  229. if ( !player || !gameLocal.CheatsOk() ) {
  230. return;
  231. }
  232. name = args.Argv( 1 );
  233. if ( idStr::Icmp( name, "all" ) == 0 ) {
  234. give_all = true;
  235. } else {
  236. give_all = false;
  237. }
  238. if ( give_all || ( idStr::Cmpn( name, "weapon", 6 ) == 0 ) ) {
  239. if ( gameLocal.world->spawnArgs.GetBool( "no_Weapons" ) ) {
  240. gameLocal.world->spawnArgs.SetBool( "no_Weapons", false );
  241. for( i = 0; i < gameLocal.numClients; i++ ) {
  242. if ( gameLocal.entities[ i ] ) {
  243. gameLocal.entities[ i ]->PostEventSec( &EV_Player_SelectWeapon, 0.5f, gameLocal.entities[ i ]->spawnArgs.GetString( "def_weapon1" ) );
  244. }
  245. }
  246. }
  247. }
  248. if ( ( idStr::Cmpn( name, "weapon_", 7 ) == 0 ) || ( idStr::Cmpn( name, "item_", 5 ) == 0 ) || ( idStr::Cmpn( name, "ammo_", 5 ) == 0 ) ) {
  249. player->GiveItem( name );
  250. return;
  251. }
  252. if ( give_all || idStr::Icmp( name, "health" ) == 0 ) {
  253. player->health = player->inventory.maxHealth;
  254. if ( !give_all ) {
  255. return;
  256. }
  257. }
  258. if ( give_all || idStr::Icmp( name, "weapons" ) == 0 ) {
  259. player->inventory.weapons = BIT( MAX_WEAPONS ) - 1;
  260. player->CacheWeapons();
  261. if ( !give_all ) {
  262. return;
  263. }
  264. }
  265. if ( give_all || idStr::Icmp( name, "ammo" ) == 0 ) {
  266. for ( i = 0 ; i < AMMO_NUMTYPES; i++ ) {
  267. player->inventory.ammo[ i ] = player->inventory.MaxAmmoForAmmoClass( player, idWeapon::GetAmmoNameForNum( ( ammo_t )i ) );
  268. }
  269. if ( !give_all ) {
  270. return;
  271. }
  272. }
  273. if ( give_all || idStr::Icmp( name, "armor" ) == 0 ) {
  274. player->inventory.armor = player->inventory.maxarmor;
  275. if ( !give_all ) {
  276. return;
  277. }
  278. }
  279. if ( idStr::Icmp( name, "berserk" ) == 0 ) {
  280. player->GivePowerUp( BERSERK, SEC2MS( 30.0f ) );
  281. return;
  282. }
  283. if ( idStr::Icmp( name, "invis" ) == 0 ) {
  284. player->GivePowerUp( INVISIBILITY, SEC2MS( 30.0f ) );
  285. return;
  286. }
  287. if ( idStr::Icmp( name, "pda" ) == 0 ) {
  288. player->GivePDA( args.Argv(2), NULL );
  289. return;
  290. }
  291. if ( idStr::Icmp( name, "video" ) == 0 ) {
  292. player->GiveVideo( args.Argv(2), NULL );
  293. return;
  294. }
  295. if ( !give_all && !player->Give( args.Argv(1), args.Argv(2) ) ) {
  296. gameLocal.Printf( "unknown item\n" );
  297. }
  298. }
  299. /*
  300. ==================
  301. Cmd_CenterView_f
  302. Centers the players pitch
  303. ==================
  304. */
  305. void Cmd_CenterView_f( const idCmdArgs &args ) {
  306. idPlayer *player;
  307. idAngles ang;
  308. player = gameLocal.GetLocalPlayer();
  309. if ( !player ) {
  310. return;
  311. }
  312. ang = player->viewAngles;
  313. ang.pitch = 0.0f;
  314. player->SetViewAngles( ang );
  315. }
  316. /*
  317. ==================
  318. Cmd_God_f
  319. Sets client to godmode
  320. argv(0) god
  321. ==================
  322. */
  323. void Cmd_God_f( const idCmdArgs &args ) {
  324. char *msg;
  325. idPlayer *player;
  326. player = gameLocal.GetLocalPlayer();
  327. if ( !player || !gameLocal.CheatsOk() ) {
  328. return;
  329. }
  330. if ( player->godmode ) {
  331. player->godmode = false;
  332. msg = "godmode OFF\n";
  333. } else {
  334. player->godmode = true;
  335. msg = "godmode ON\n";
  336. }
  337. gameLocal.Printf( "%s", msg );
  338. }
  339. /*
  340. ==================
  341. Cmd_Notarget_f
  342. Sets client to notarget
  343. argv(0) notarget
  344. ==================
  345. */
  346. void Cmd_Notarget_f( const idCmdArgs &args ) {
  347. char *msg;
  348. idPlayer *player;
  349. player = gameLocal.GetLocalPlayer();
  350. if ( !player || !gameLocal.CheatsOk() ) {
  351. return;
  352. }
  353. if ( player->fl.notarget ) {
  354. player->fl.notarget = false;
  355. msg = "notarget OFF\n";
  356. } else {
  357. player->fl.notarget = true;
  358. msg = "notarget ON\n";
  359. }
  360. gameLocal.Printf( "%s", msg );
  361. }
  362. /*
  363. ==================
  364. Cmd_Noclip_f
  365. argv(0) noclip
  366. ==================
  367. */
  368. void Cmd_Noclip_f( const idCmdArgs &args ) {
  369. char *msg;
  370. idPlayer *player;
  371. player = gameLocal.GetLocalPlayer();
  372. if ( !player || !gameLocal.CheatsOk() ) {
  373. return;
  374. }
  375. if ( player->noclip ) {
  376. msg = "noclip OFF\n";
  377. } else {
  378. msg = "noclip ON\n";
  379. }
  380. player->noclip = !player->noclip;
  381. gameLocal.Printf( "%s", msg );
  382. }
  383. /*
  384. =================
  385. Cmd_Kill_f
  386. =================
  387. */
  388. void Cmd_Kill_f( const idCmdArgs &args ) {
  389. idPlayer *player;
  390. if ( gameLocal.isMultiplayer ) {
  391. if ( gameLocal.isClient ) {
  392. idBitMsg outMsg;
  393. byte msgBuf[ MAX_GAME_MESSAGE_SIZE ];
  394. outMsg.Init( msgBuf, sizeof( msgBuf ) );
  395. outMsg.WriteByte( GAME_RELIABLE_MESSAGE_KILL );
  396. networkSystem->ClientSendReliableMessage( outMsg );
  397. } else {
  398. player = gameLocal.GetClientByCmdArgs( args );
  399. if ( !player ) {
  400. common->Printf( "kill <client nickname> or kill <client index>\n" );
  401. return;
  402. }
  403. player->Kill( false, false );
  404. cmdSystem->BufferCommandText( CMD_EXEC_NOW, va( "say killed client %d '%s^0'\n", player->entityNumber, gameLocal.userInfo[ player->entityNumber ].GetString( "ui_name" ) ) );
  405. }
  406. } else {
  407. player = gameLocal.GetLocalPlayer();
  408. if ( !player ) {
  409. return;
  410. }
  411. player->Kill( false, false );
  412. }
  413. }
  414. /*
  415. =================
  416. Cmd_PlayerModel_f
  417. =================
  418. */
  419. void Cmd_PlayerModel_f( const idCmdArgs &args ) {
  420. idPlayer *player;
  421. const char *name;
  422. idVec3 pos;
  423. idAngles ang;
  424. player = gameLocal.GetLocalPlayer();
  425. if ( !player || !gameLocal.CheatsOk() ) {
  426. return;
  427. }
  428. if ( args.Argc() < 2 ) {
  429. gameLocal.Printf( "usage: playerModel <modelname>\n" );
  430. return;
  431. }
  432. name = args.Argv( 1 );
  433. player->spawnArgs.Set( "model", name );
  434. pos = player->GetPhysics()->GetOrigin();
  435. ang = player->viewAngles;
  436. player->SpawnToPoint( pos, ang );
  437. }
  438. /*
  439. ==================
  440. Cmd_Say
  441. ==================
  442. */
  443. static void Cmd_Say( bool team, const idCmdArgs &args ) {
  444. const char *name;
  445. idStr text;
  446. const char *cmd = team ? "sayTeam" : "say" ;
  447. if ( !gameLocal.isMultiplayer ) {
  448. gameLocal.Printf( "%s can only be used in a multiplayer game\n", cmd );
  449. return;
  450. }
  451. if ( args.Argc() < 2 ) {
  452. gameLocal.Printf( "usage: %s <text>\n", cmd );
  453. return;
  454. }
  455. text = args.Args();
  456. if ( text.Length() == 0 ) {
  457. return;
  458. }
  459. if ( text[ text.Length() - 1 ] == '\n' ) {
  460. text[ text.Length() - 1 ] = '\0';
  461. }
  462. name = "player";
  463. idPlayer * player;
  464. // here we need to special case a listen server to use the real client name instead of "server"
  465. // "server" will only appear on a dedicated server
  466. if ( gameLocal.isClient || cvarSystem->GetCVarInteger( "net_serverDedicated" ) == 0 ) {
  467. player = gameLocal.localClientNum >= 0 ? static_cast<idPlayer *>( gameLocal.entities[ gameLocal.localClientNum ] ) : NULL;
  468. if ( player ) {
  469. name = player->GetUserInfo()->GetString( "ui_name", "player" );
  470. }
  471. } else {
  472. name = "server";
  473. }
  474. if ( gameLocal.isClient ) {
  475. idBitMsg outMsg;
  476. byte msgBuf[ 256 ];
  477. outMsg.Init( msgBuf, sizeof( msgBuf ) );
  478. outMsg.WriteByte( team ? GAME_RELIABLE_MESSAGE_TCHAT : GAME_RELIABLE_MESSAGE_CHAT );
  479. outMsg.WriteString( name );
  480. outMsg.WriteString( text, -1, false );
  481. networkSystem->ClientSendReliableMessage( outMsg );
  482. } else {
  483. gameLocal.mpGame.ProcessChatMessage( gameLocal.localClientNum, team, name, text, NULL );
  484. }
  485. }
  486. /*
  487. ==================
  488. Cmd_Say_f
  489. ==================
  490. */
  491. static void Cmd_Say_f( const idCmdArgs &args ) {
  492. Cmd_Say( false, args );
  493. }
  494. /*
  495. ==================
  496. Cmd_SayTeam_f
  497. ==================
  498. */
  499. static void Cmd_SayTeam_f( const idCmdArgs &args ) {
  500. Cmd_Say( true, args );
  501. }
  502. /*
  503. ==================
  504. Cmd_AddChatLine_f
  505. ==================
  506. */
  507. static void Cmd_AddChatLine_f( const idCmdArgs &args ) {
  508. gameLocal.mpGame.AddChatLine( args.Argv( 1 ) );
  509. }
  510. /*
  511. ==================
  512. Cmd_Kick_f
  513. ==================
  514. */
  515. static void Cmd_Kick_f( const idCmdArgs &args ) {
  516. idPlayer *player;
  517. if ( !gameLocal.isMultiplayer ) {
  518. gameLocal.Printf( "kick can only be used in a multiplayer game\n" );
  519. return;
  520. }
  521. if ( gameLocal.isClient ) {
  522. gameLocal.Printf( "You have no such power. This is a server command\n" );
  523. return;
  524. }
  525. player = gameLocal.GetClientByCmdArgs( args );
  526. if ( !player ) {
  527. gameLocal.Printf( "usage: kick <client nickname> or kick <client index>\n" );
  528. return;
  529. }
  530. cmdSystem->BufferCommandText( CMD_EXEC_NOW, va( "say kicking out client %d '%s^0'\n", player->entityNumber, gameLocal.userInfo[ player->entityNumber ].GetString( "ui_name" ) ) );
  531. cmdSystem->BufferCommandText( CMD_EXEC_NOW, va( "kick %d\n", player->entityNumber ) );
  532. }
  533. /*
  534. ==================
  535. Cmd_GetViewpos_f
  536. ==================
  537. */
  538. void Cmd_GetViewpos_f( const idCmdArgs &args ) {
  539. idPlayer *player;
  540. idVec3 origin;
  541. idMat3 axis;
  542. player = gameLocal.GetLocalPlayer();
  543. if ( !player ) {
  544. return;
  545. }
  546. const renderView_t *view = player->GetRenderView();
  547. if ( view ) {
  548. gameLocal.Printf( "(%s) %.1f\n", view->vieworg.ToString(), view->viewaxis[0].ToYaw() );
  549. } else {
  550. player->GetViewPos( origin, axis );
  551. gameLocal.Printf( "(%s) %.1f\n", origin.ToString(), axis[0].ToYaw() );
  552. }
  553. }
  554. /*
  555. =================
  556. Cmd_SetViewpos_f
  557. =================
  558. */
  559. void Cmd_SetViewpos_f( const idCmdArgs &args ) {
  560. idVec3 origin;
  561. idAngles angles;
  562. int i;
  563. idPlayer *player;
  564. player = gameLocal.GetLocalPlayer();
  565. if ( !player || !gameLocal.CheatsOk() ) {
  566. return;
  567. }
  568. if ( ( args.Argc() != 4 ) && ( args.Argc() != 5 ) ) {
  569. gameLocal.Printf( "usage: setviewpos <x> <y> <z> <yaw>\n" );
  570. return;
  571. }
  572. angles.Zero();
  573. if ( args.Argc() == 5 ) {
  574. angles.yaw = atof( args.Argv( 4 ) );
  575. }
  576. for ( i = 0 ; i < 3 ; i++ ) {
  577. origin[i] = atof( args.Argv( i + 1 ) );
  578. }
  579. origin.z -= pm_normalviewheight.GetFloat() - 0.25f;
  580. player->Teleport( origin, angles, NULL );
  581. }
  582. /*
  583. =================
  584. Cmd_Teleport_f
  585. =================
  586. */
  587. void Cmd_Teleport_f( const idCmdArgs &args ) {
  588. idVec3 origin;
  589. idAngles angles;
  590. idPlayer *player;
  591. idEntity *ent;
  592. player = gameLocal.GetLocalPlayer();
  593. if ( !player || !gameLocal.CheatsOk() ) {
  594. return;
  595. }
  596. if ( args.Argc() != 2 ) {
  597. gameLocal.Printf( "usage: teleport <name of entity to teleport to>\n" );
  598. return;
  599. }
  600. ent = gameLocal.FindEntity( args.Argv( 1 ) );
  601. if ( !ent ) {
  602. gameLocal.Printf( "entity not found\n" );
  603. return;
  604. }
  605. angles.Zero();
  606. angles.yaw = ent->GetPhysics()->GetAxis()[ 0 ].ToYaw();
  607. origin = ent->GetPhysics()->GetOrigin();
  608. player->Teleport( origin, angles, ent );
  609. }
  610. /*
  611. =================
  612. Cmd_Trigger_f
  613. =================
  614. */
  615. void Cmd_Trigger_f( const idCmdArgs &args ) {
  616. idVec3 origin;
  617. idAngles angles;
  618. idPlayer *player;
  619. idEntity *ent;
  620. player = gameLocal.GetLocalPlayer();
  621. if ( !player || !gameLocal.CheatsOk() ) {
  622. return;
  623. }
  624. if ( args.Argc() != 2 ) {
  625. gameLocal.Printf( "usage: trigger <name of entity to trigger>\n" );
  626. return;
  627. }
  628. ent = gameLocal.FindEntity( args.Argv( 1 ) );
  629. if ( !ent ) {
  630. gameLocal.Printf( "entity not found\n" );
  631. return;
  632. }
  633. ent->Signal( SIG_TRIGGER );
  634. ent->ProcessEvent( &EV_Activate, player );
  635. ent->TriggerGuis();
  636. }
  637. /*
  638. ===================
  639. Cmd_Spawn_f
  640. ===================
  641. */
  642. void Cmd_Spawn_f( const idCmdArgs &args ) {
  643. const char *key, *value;
  644. int i;
  645. float yaw;
  646. idVec3 org;
  647. idPlayer *player;
  648. idDict dict;
  649. player = gameLocal.GetLocalPlayer();
  650. if ( !player || !gameLocal.CheatsOk( false ) ) {
  651. return;
  652. }
  653. if ( args.Argc() & 1 ) { // must always have an even number of arguments
  654. gameLocal.Printf( "usage: spawn classname [key/value pairs]\n" );
  655. return;
  656. }
  657. yaw = player->viewAngles.yaw;
  658. value = args.Argv( 1 );
  659. dict.Set( "classname", value );
  660. dict.Set( "angle", va( "%f", yaw + 180 ) );
  661. org = player->GetPhysics()->GetOrigin() + idAngles( 0, yaw, 0 ).ToForward() * 80 + idVec3( 0, 0, 1 );
  662. dict.Set( "origin", org.ToString() );
  663. for( i = 2; i < args.Argc() - 1; i += 2 ) {
  664. key = args.Argv( i );
  665. value = args.Argv( i + 1 );
  666. dict.Set( key, value );
  667. }
  668. gameLocal.SpawnEntityDef( dict );
  669. }
  670. /*
  671. ==================
  672. Cmd_Damage_f
  673. Damages the specified entity
  674. ==================
  675. */
  676. void Cmd_Damage_f( const idCmdArgs &args ) {
  677. if ( !gameLocal.GetLocalPlayer() || !gameLocal.CheatsOk( false ) ) {
  678. return;
  679. }
  680. if ( args.Argc() != 3 ) {
  681. gameLocal.Printf( "usage: damage <name of entity to damage> <damage>\n" );
  682. return;
  683. }
  684. idEntity *ent = gameLocal.FindEntity( args.Argv( 1 ) );
  685. if ( !ent ) {
  686. gameLocal.Printf( "entity not found\n" );
  687. return;
  688. }
  689. ent->Damage( gameLocal.world, gameLocal.world, idVec3( 0, 0, 1 ), "damage_moverCrush", atoi( args.Argv( 2 ) ), INVALID_JOINT );
  690. }
  691. /*
  692. ==================
  693. Cmd_Remove_f
  694. Removes the specified entity
  695. ==================
  696. */
  697. void Cmd_Remove_f( const idCmdArgs &args ) {
  698. if ( !gameLocal.GetLocalPlayer() || !gameLocal.CheatsOk( false ) ) {
  699. return;
  700. }
  701. if ( args.Argc() != 2 ) {
  702. gameLocal.Printf( "usage: remove <name of entity to remove>\n" );
  703. return;
  704. }
  705. idEntity *ent = gameLocal.FindEntity( args.Argv( 1 ) );
  706. if ( !ent ) {
  707. gameLocal.Printf( "entity not found\n" );
  708. return;
  709. }
  710. delete ent;
  711. }
  712. /*
  713. ===================
  714. Cmd_TestLight_f
  715. ===================
  716. */
  717. void Cmd_TestLight_f( const idCmdArgs &args ) {
  718. int i;
  719. idStr filename;
  720. const char *key, *value, *name;
  721. idPlayer * player;
  722. idDict dict;
  723. player = gameLocal.GetLocalPlayer();
  724. if ( !player || !gameLocal.CheatsOk( false ) ) {
  725. return;
  726. }
  727. renderView_t *rv = player->GetRenderView();
  728. float fov = tan( idMath::M_DEG2RAD * rv->fov_x / 2 );
  729. dict.SetMatrix( "rotation", mat3_default );
  730. dict.SetVector( "origin", rv->vieworg );
  731. dict.SetVector( "light_target", rv->viewaxis[0] );
  732. dict.SetVector( "light_right", rv->viewaxis[1] * -fov );
  733. dict.SetVector( "light_up", rv->viewaxis[2] * fov );
  734. dict.SetVector( "light_start", rv->viewaxis[0] * 16 );
  735. dict.SetVector( "light_end", rv->viewaxis[0] * 1000 );
  736. if ( args.Argc() >= 2 ) {
  737. value = args.Argv( 1 );
  738. filename = args.Argv(1);
  739. filename.DefaultFileExtension( ".tga" );
  740. dict.Set( "texture", filename );
  741. }
  742. dict.Set( "classname", "light" );
  743. for( i = 2; i < args.Argc() - 1; i += 2 ) {
  744. key = args.Argv( i );
  745. value = args.Argv( i + 1 );
  746. dict.Set( key, value );
  747. }
  748. for ( i = 0; i < MAX_GENTITIES; i++ ) {
  749. name = va( "spawned_light_%d", i ); // not just light_, or it might pick up a prelight shadow
  750. if ( !gameLocal.FindEntity( name ) ) {
  751. break;
  752. }
  753. }
  754. dict.Set( "name", name );
  755. gameLocal.SpawnEntityDef( dict );
  756. gameLocal.Printf( "Created new light\n");
  757. }
  758. /*
  759. ===================
  760. Cmd_TestPointLight_f
  761. ===================
  762. */
  763. void Cmd_TestPointLight_f( const idCmdArgs &args ) {
  764. const char *key, *value, *name;
  765. int i;
  766. idPlayer *player;
  767. idDict dict;
  768. player = gameLocal.GetLocalPlayer();
  769. if ( !player || !gameLocal.CheatsOk( false ) ) {
  770. return;
  771. }
  772. dict.SetVector("origin", player->GetRenderView()->vieworg);
  773. if ( args.Argc() >= 2 ) {
  774. value = args.Argv( 1 );
  775. dict.Set("light", value);
  776. } else {
  777. dict.Set("light", "300");
  778. }
  779. dict.Set( "classname", "light" );
  780. for( i = 2; i < args.Argc() - 1; i += 2 ) {
  781. key = args.Argv( i );
  782. value = args.Argv( i + 1 );
  783. dict.Set( key, value );
  784. }
  785. for ( i = 0; i < MAX_GENTITIES; i++ ) {
  786. name = va( "light_%d", i );
  787. if ( !gameLocal.FindEntity( name ) ) {
  788. break;
  789. }
  790. }
  791. dict.Set( "name", name );
  792. gameLocal.SpawnEntityDef( dict );
  793. gameLocal.Printf( "Created new point light\n");
  794. }
  795. /*
  796. ==================
  797. Cmd_PopLight_f
  798. ==================
  799. */
  800. void Cmd_PopLight_f( const idCmdArgs &args ) {
  801. idEntity *ent;
  802. idMapEntity *mapEnt;
  803. idMapFile *mapFile = gameLocal.GetLevelMap();
  804. idLight *lastLight;
  805. int last;
  806. if ( !gameLocal.CheatsOk() ) {
  807. return;
  808. }
  809. bool removeFromMap = ( args.Argc() > 1 );
  810. lastLight = NULL;
  811. last = -1;
  812. for( ent = gameLocal.spawnedEntities.Next(); ent != NULL; ent = ent->spawnNode.Next() ) {
  813. if ( !ent->IsType( idLight::Type ) ) {
  814. continue;
  815. }
  816. if ( gameLocal.spawnIds[ ent->entityNumber ] > last ) {
  817. last = gameLocal.spawnIds[ ent->entityNumber ];
  818. lastLight = static_cast<idLight*>( ent );
  819. }
  820. }
  821. if ( lastLight ) {
  822. // find map file entity
  823. mapEnt = mapFile->FindEntity( lastLight->name );
  824. if ( removeFromMap && mapEnt ) {
  825. mapFile->RemoveEntity( mapEnt );
  826. }
  827. gameLocal.Printf( "Removing light %i\n", lastLight->GetLightDefHandle() );
  828. delete lastLight;
  829. } else {
  830. gameLocal.Printf( "No lights to clear.\n" );
  831. }
  832. }
  833. /*
  834. ====================
  835. Cmd_ClearLights_f
  836. ====================
  837. */
  838. void Cmd_ClearLights_f( const idCmdArgs &args ) {
  839. idEntity *ent;
  840. idEntity *next;
  841. idLight *light;
  842. idMapEntity *mapEnt;
  843. idMapFile *mapFile = gameLocal.GetLevelMap();
  844. bool removeFromMap = ( args.Argc() > 1 );
  845. gameLocal.Printf( "Clearing all lights.\n" );
  846. for( ent = gameLocal.spawnedEntities.Next(); ent != NULL; ent = next ) {
  847. next = ent->spawnNode.Next();
  848. if ( !ent->IsType( idLight::Type ) ) {
  849. continue;
  850. }
  851. light = static_cast<idLight*>( ent );
  852. mapEnt = mapFile->FindEntity( light->name );
  853. if ( removeFromMap && mapEnt ) {
  854. mapFile->RemoveEntity( mapEnt );
  855. }
  856. delete light;
  857. }
  858. }
  859. /*
  860. ==================
  861. Cmd_TestFx_f
  862. ==================
  863. */
  864. void Cmd_TestFx_f( const idCmdArgs &args ) {
  865. idVec3 offset;
  866. const char *name;
  867. idPlayer * player;
  868. idDict dict;
  869. player = gameLocal.GetLocalPlayer();
  870. if ( !player || !gameLocal.CheatsOk() ) {
  871. return;
  872. }
  873. // delete the testModel if active
  874. if ( gameLocal.testFx ) {
  875. delete gameLocal.testFx;
  876. gameLocal.testFx = NULL;
  877. }
  878. if ( args.Argc() < 2 ) {
  879. return;
  880. }
  881. name = args.Argv( 1 );
  882. offset = player->GetPhysics()->GetOrigin() + player->viewAngles.ToForward() * 100.0f;
  883. dict.Set( "origin", offset.ToString() );
  884. dict.Set( "test", "1");
  885. dict.Set( "fx", name );
  886. gameLocal.testFx = ( idEntityFx * )gameLocal.SpawnEntityType( idEntityFx::Type, &dict );
  887. }
  888. #define MAX_DEBUGLINES 128
  889. typedef struct {
  890. bool used;
  891. idVec3 start, end;
  892. int color;
  893. bool blink;
  894. bool arrow;
  895. } gameDebugLine_t;
  896. gameDebugLine_t debugLines[MAX_DEBUGLINES];
  897. /*
  898. ==================
  899. Cmd_AddDebugLine_f
  900. ==================
  901. */
  902. static void Cmd_AddDebugLine_f( const idCmdArgs &args ) {
  903. int i, argNum;
  904. const char *value;
  905. if ( !gameLocal.CheatsOk() ) {
  906. return;
  907. }
  908. if ( args.Argc () < 7 ) {
  909. gameLocal.Printf( "usage: addline <x y z> <x y z> <color>\n" );
  910. return;
  911. }
  912. for ( i = 0; i < MAX_DEBUGLINES; i++ ) {
  913. if ( !debugLines[i].used ) {
  914. break;
  915. }
  916. }
  917. if ( i >= MAX_DEBUGLINES ) {
  918. gameLocal.Printf( "no free debug lines\n" );
  919. return;
  920. }
  921. value = args.Argv( 0 );
  922. if ( !idStr::Icmp( value, "addarrow" ) ) {
  923. debugLines[i].arrow = true;
  924. } else {
  925. debugLines[i].arrow = false;
  926. }
  927. debugLines[i].used = true;
  928. debugLines[i].blink = false;
  929. argNum = 1;
  930. debugLines[i].start.x = Cmd_GetFloatArg( args, argNum );
  931. debugLines[i].start.y = Cmd_GetFloatArg( args, argNum );
  932. debugLines[i].start.z = Cmd_GetFloatArg( args, argNum );
  933. debugLines[i].end.x = Cmd_GetFloatArg( args, argNum );
  934. debugLines[i].end.y = Cmd_GetFloatArg( args, argNum );
  935. debugLines[i].end.z = Cmd_GetFloatArg( args, argNum );
  936. debugLines[i].color = Cmd_GetFloatArg( args, argNum );
  937. }
  938. /*
  939. ==================
  940. Cmd_RemoveDebugLine_f
  941. ==================
  942. */
  943. static void Cmd_RemoveDebugLine_f( const idCmdArgs &args ) {
  944. int i, num;
  945. const char *value;
  946. if ( !gameLocal.CheatsOk() ) {
  947. return;
  948. }
  949. if ( args.Argc () < 2 ) {
  950. gameLocal.Printf( "usage: removeline <num>\n" );
  951. return;
  952. }
  953. value = args.Argv( 1 );
  954. num = atoi(value);
  955. for ( i = 0; i < MAX_DEBUGLINES; i++ ) {
  956. if ( debugLines[i].used ) {
  957. if ( --num < 0 ) {
  958. break;
  959. }
  960. }
  961. }
  962. if ( i >= MAX_DEBUGLINES ) {
  963. gameLocal.Printf( "line not found\n" );
  964. return;
  965. }
  966. debugLines[i].used = false;
  967. }
  968. /*
  969. ==================
  970. Cmd_BlinkDebugLine_f
  971. ==================
  972. */
  973. static void Cmd_BlinkDebugLine_f( const idCmdArgs &args ) {
  974. int i, num;
  975. const char *value;
  976. if ( !gameLocal.CheatsOk() ) {
  977. return;
  978. }
  979. if ( args.Argc () < 2 ) {
  980. gameLocal.Printf( "usage: blinkline <num>\n" );
  981. return;
  982. }
  983. value = args.Argv( 1 );
  984. num = atoi( value );
  985. for ( i = 0; i < MAX_DEBUGLINES; i++ ) {
  986. if ( debugLines[i].used ) {
  987. if ( --num < 0 ) {
  988. break;
  989. }
  990. }
  991. }
  992. if ( i >= MAX_DEBUGLINES ) {
  993. gameLocal.Printf( "line not found\n" );
  994. return;
  995. }
  996. debugLines[i].blink = !debugLines[i].blink;
  997. }
  998. /*
  999. ==================
  1000. PrintFloat
  1001. ==================
  1002. */
  1003. static void PrintFloat( float f ) {
  1004. char buf[128], i;
  1005. for ( i = sprintf( buf, "%3.2f", f ); i < 7; i++ ) {
  1006. buf[i] = ' ';
  1007. }
  1008. buf[i] = '\0';
  1009. gameLocal.Printf( buf );
  1010. }
  1011. /*
  1012. ==================
  1013. Cmd_ListDebugLines_f
  1014. ==================
  1015. */
  1016. static void Cmd_ListDebugLines_f( const idCmdArgs &args ) {
  1017. int i, num;
  1018. if ( !gameLocal.CheatsOk() ) {
  1019. return;
  1020. }
  1021. num = 0;
  1022. gameLocal.Printf( "line num: x1 y1 z1 x2 y2 z2 c b a\n" );
  1023. for ( i = 0; i < MAX_DEBUGLINES; i++ ) {
  1024. if ( debugLines[i].used ) {
  1025. gameLocal.Printf( "line %3d: ", num );
  1026. PrintFloat( debugLines[i].start.x );
  1027. PrintFloat( debugLines[i].start.y );
  1028. PrintFloat( debugLines[i].start.z );
  1029. PrintFloat( debugLines[i].end.x );
  1030. PrintFloat( debugLines[i].end.y );
  1031. PrintFloat( debugLines[i].end.z );
  1032. gameLocal.Printf( "%d %d %d\n", debugLines[i].color, debugLines[i].blink, debugLines[i].arrow );
  1033. num++;
  1034. }
  1035. }
  1036. if ( !num ) {
  1037. gameLocal.Printf( "no debug lines\n" );
  1038. }
  1039. }
  1040. /*
  1041. ==================
  1042. D_DrawDebugLines
  1043. ==================
  1044. */
  1045. void D_DrawDebugLines( void ) {
  1046. int i;
  1047. idVec3 forward, right, up, p1, p2;
  1048. idVec4 color;
  1049. float l;
  1050. for ( i = 0; i < MAX_DEBUGLINES; i++ ) {
  1051. if ( debugLines[i].used ) {
  1052. if ( !debugLines[i].blink || (gameLocal.time & (1<<9)) ) {
  1053. color = idVec4( debugLines[i].color&1, (debugLines[i].color>>1)&1, (debugLines[i].color>>2)&1, 1 );
  1054. gameRenderWorld->DebugLine( color, debugLines[i].start, debugLines[i].end );
  1055. //
  1056. if ( debugLines[i].arrow ) {
  1057. // draw a nice arrow
  1058. forward = debugLines[i].end - debugLines[i].start;
  1059. l = forward.Normalize() * 0.2f;
  1060. forward.NormalVectors( right, up);
  1061. if ( l > 3.0f ) {
  1062. l = 3.0f;
  1063. }
  1064. p1 = debugLines[i].end - l * forward + (l * 0.4f) * right;
  1065. p2 = debugLines[i].end - l * forward - (l * 0.4f) * right;
  1066. gameRenderWorld->DebugLine( color, debugLines[i].end, p1 );
  1067. gameRenderWorld->DebugLine( color, debugLines[i].end, p2 );
  1068. gameRenderWorld->DebugLine( color, p1, p2 );
  1069. }
  1070. }
  1071. }
  1072. }
  1073. }
  1074. /*
  1075. ==================
  1076. Cmd_ListCollisionModels_f
  1077. ==================
  1078. */
  1079. static void Cmd_ListCollisionModels_f( const idCmdArgs &args ) {
  1080. if ( !gameLocal.CheatsOk() ) {
  1081. return;
  1082. }
  1083. collisionModelManager->ListModels();
  1084. }
  1085. /*
  1086. ==================
  1087. Cmd_CollisionModelInfo_f
  1088. ==================
  1089. */
  1090. static void Cmd_CollisionModelInfo_f( const idCmdArgs &args ) {
  1091. const char *value;
  1092. if ( !gameLocal.CheatsOk() ) {
  1093. return;
  1094. }
  1095. if ( args.Argc () < 2 ) {
  1096. gameLocal.Printf( "usage: collisionModelInfo <modelNum>\n"
  1097. "use 'all' instead of the model number for accumulated info\n" );
  1098. return;
  1099. }
  1100. value = args.Argv( 1 );
  1101. if ( !idStr::Icmp( value, "all" ) ) {
  1102. collisionModelManager->ModelInfo( -1 );
  1103. } else {
  1104. collisionModelManager->ModelInfo( atoi(value) );
  1105. }
  1106. }
  1107. /*
  1108. ==================
  1109. Cmd_ExportModels_f
  1110. ==================
  1111. */
  1112. static void Cmd_ExportModels_f( const idCmdArgs &args ) {
  1113. idModelExport exporter;
  1114. idStr name;
  1115. // don't allow exporting models when cheats are disabled,
  1116. // but if we're not in the game, it's ok
  1117. if ( gameLocal.GetLocalPlayer() && !gameLocal.CheatsOk( false ) ) {
  1118. return;
  1119. }
  1120. if ( args.Argc() < 2 ) {
  1121. exporter.ExportModels( "def", ".def" );
  1122. } else {
  1123. name = args.Argv( 1 );
  1124. name = "def/" + name;
  1125. name.DefaultFileExtension( ".def" );
  1126. exporter.ExportDefFile( name );
  1127. }
  1128. }
  1129. /*
  1130. ==================
  1131. Cmd_ReexportModels_f
  1132. ==================
  1133. */
  1134. static void Cmd_ReexportModels_f( const idCmdArgs &args ) {
  1135. idModelExport exporter;
  1136. idStr name;
  1137. // don't allow exporting models when cheats are disabled,
  1138. // but if we're not in the game, it's ok
  1139. if ( gameLocal.GetLocalPlayer() && !gameLocal.CheatsOk( false ) ) {
  1140. return;
  1141. }
  1142. idAnimManager::forceExport = true;
  1143. if ( args.Argc() < 2 ) {
  1144. exporter.ExportModels( "def", ".def" );
  1145. } else {
  1146. name = args.Argv( 1 );
  1147. name = "def/" + name;
  1148. name.DefaultFileExtension( ".def" );
  1149. exporter.ExportDefFile( name );
  1150. }
  1151. idAnimManager::forceExport = false;
  1152. }
  1153. /*
  1154. ==================
  1155. Cmd_ReloadAnims_f
  1156. ==================
  1157. */
  1158. static void Cmd_ReloadAnims_f( const idCmdArgs &args ) {
  1159. // don't allow reloading anims when cheats are disabled,
  1160. // but if we're not in the game, it's ok
  1161. if ( gameLocal.GetLocalPlayer() && !gameLocal.CheatsOk( false ) ) {
  1162. return;
  1163. }
  1164. animationLib.ReloadAnims();
  1165. }
  1166. /*
  1167. ==================
  1168. Cmd_ListAnims_f
  1169. ==================
  1170. */
  1171. static void Cmd_ListAnims_f( const idCmdArgs &args ) {
  1172. idEntity * ent;
  1173. int num;
  1174. size_t size;
  1175. size_t alloced;
  1176. idAnimator * animator;
  1177. const char * classname;
  1178. const idDict * dict;
  1179. int i;
  1180. if ( args.Argc() > 1 ) {
  1181. idAnimator animator;
  1182. classname = args.Argv( 1 );
  1183. dict = gameLocal.FindEntityDefDict( classname, false );
  1184. if ( !dict ) {
  1185. gameLocal.Printf( "Entitydef '%s' not found\n", classname );
  1186. return;
  1187. }
  1188. animator.SetModel( dict->GetString( "model" ) );
  1189. gameLocal.Printf( "----------------\n" );
  1190. num = animator.NumAnims();
  1191. for( i = 0; i < num; i++ ) {
  1192. gameLocal.Printf( "%s\n", animator.AnimFullName( i ) );
  1193. }
  1194. gameLocal.Printf( "%d anims\n", num );
  1195. } else {
  1196. animationLib.ListAnims();
  1197. size = 0;
  1198. num = 0;
  1199. for( ent = gameLocal.spawnedEntities.Next(); ent != NULL; ent = ent->spawnNode.Next() ) {
  1200. animator = ent->GetAnimator();
  1201. if ( animator ) {
  1202. alloced = animator->Allocated();
  1203. size += alloced;
  1204. num++;
  1205. }
  1206. }
  1207. gameLocal.Printf( "%d memory used in %d entity animators\n", size, num );
  1208. }
  1209. }
  1210. /*
  1211. ==================
  1212. Cmd_AASStats_f
  1213. ==================
  1214. */
  1215. static void Cmd_AASStats_f( const idCmdArgs &args ) {
  1216. int aasNum;
  1217. if ( !gameLocal.CheatsOk() ) {
  1218. return;
  1219. }
  1220. aasNum = aas_test.GetInteger();
  1221. idAAS *aas = gameLocal.GetAAS( aasNum );
  1222. if ( !aas ) {
  1223. gameLocal.Printf( "No aas #%d loaded\n", aasNum );
  1224. } else {
  1225. aas->Stats();
  1226. }
  1227. }
  1228. /*
  1229. ==================
  1230. Cmd_TestDamage_f
  1231. ==================
  1232. */
  1233. static void Cmd_TestDamage_f( const idCmdArgs &args ) {
  1234. idPlayer *player;
  1235. const char *damageDefName;
  1236. player = gameLocal.GetLocalPlayer();
  1237. if ( !player || !gameLocal.CheatsOk() ) {
  1238. return;
  1239. }
  1240. if ( args.Argc() < 2 || args.Argc() > 3 ) {
  1241. gameLocal.Printf( "usage: testDamage <damageDefName> [angle]\n" );
  1242. return;
  1243. }
  1244. damageDefName = args.Argv( 1 );
  1245. idVec3 dir;
  1246. if ( args.Argc() == 3 ) {
  1247. float angle = atof( args.Argv( 2 ) );
  1248. idMath::SinCos( DEG2RAD( angle ), dir[1], dir[0] );
  1249. dir[2] = 0;
  1250. } else {
  1251. dir.Zero();
  1252. }
  1253. // give the player full health before and after
  1254. // running the damage
  1255. player->health = player->inventory.maxHealth;
  1256. player->Damage( NULL, NULL, dir, damageDefName, 1.0f, INVALID_JOINT );
  1257. player->health = player->inventory.maxHealth;
  1258. }
  1259. /*
  1260. ==================
  1261. Cmd_TestBoneFx_f
  1262. ==================
  1263. */
  1264. static void Cmd_TestBoneFx_f( const idCmdArgs &args ) {
  1265. idPlayer *player;
  1266. const char *bone, *fx;
  1267. player = gameLocal.GetLocalPlayer();
  1268. if ( !player || !gameLocal.CheatsOk() ) {
  1269. return;
  1270. }
  1271. if ( args.Argc() < 3 || args.Argc() > 4 ) {
  1272. gameLocal.Printf( "usage: testBoneFx <fxName> <boneName>\n" );
  1273. return;
  1274. }
  1275. fx = args.Argv( 1 );
  1276. bone = args.Argv( 2 );
  1277. player->StartFxOnBone( fx, bone );
  1278. }
  1279. /*
  1280. ==================
  1281. Cmd_TestDamage_f
  1282. ==================
  1283. */
  1284. static void Cmd_TestDeath_f( const idCmdArgs &args ) {
  1285. idPlayer *player;
  1286. player = gameLocal.GetLocalPlayer();
  1287. if ( !player || !gameLocal.CheatsOk() ) {
  1288. return;
  1289. }
  1290. idVec3 dir;
  1291. idMath::SinCos( DEG2RAD( 45.0f ), dir[1], dir[0] );
  1292. dir[2] = 0;
  1293. g_testDeath.SetBool( 1 );
  1294. player->Damage( NULL, NULL, dir, "damage_triggerhurt_1000", 1.0f, INVALID_JOINT );
  1295. if ( args.Argc() >= 2) {
  1296. player->SpawnGibs( dir, "damage_triggerhurt_1000" );
  1297. }
  1298. }
  1299. /*
  1300. ==================
  1301. Cmd_WeaponSplat_f
  1302. ==================
  1303. */
  1304. static void Cmd_WeaponSplat_f( const idCmdArgs &args ) {
  1305. idPlayer *player;
  1306. player = gameLocal.GetLocalPlayer();
  1307. if ( !player || !gameLocal.CheatsOk() ) {
  1308. return;
  1309. }
  1310. player->weapon.GetEntity()->BloodSplat( 2.0f );
  1311. }
  1312. /*
  1313. ==================
  1314. Cmd_SaveSelected_f
  1315. ==================
  1316. */
  1317. static void Cmd_SaveSelected_f( const idCmdArgs &args ) {
  1318. int i;
  1319. idPlayer *player;
  1320. idEntity *s;
  1321. idMapEntity *mapEnt;
  1322. idMapFile *mapFile = gameLocal.GetLevelMap();
  1323. idDict dict;
  1324. idStr mapName;
  1325. const char *name;
  1326. player = gameLocal.GetLocalPlayer();
  1327. if ( !player || !gameLocal.CheatsOk() ) {
  1328. return;
  1329. }
  1330. s = player->dragEntity.GetSelected();
  1331. if ( !s ) {
  1332. gameLocal.Printf( "no entity selected, set g_dragShowSelection 1 to show the current selection\n" );
  1333. return;
  1334. }
  1335. if ( args.Argc() > 1 ) {
  1336. mapName = args.Argv( 1 );
  1337. mapName = "maps/" + mapName;
  1338. }
  1339. else {
  1340. mapName = mapFile->GetName();
  1341. }
  1342. // find map file entity
  1343. mapEnt = mapFile->FindEntity( s->name );
  1344. // create new map file entity if there isn't one for this articulated figure
  1345. if ( !mapEnt ) {
  1346. mapEnt = new idMapEntity();
  1347. mapFile->AddEntity( mapEnt );
  1348. for ( i = 0; i < 9999; i++ ) {
  1349. name = va( "%s_%d", s->GetEntityDefName(), i );
  1350. if ( !gameLocal.FindEntity( name ) ) {
  1351. break;
  1352. }
  1353. }
  1354. s->name = name;
  1355. mapEnt->epairs.Set( "classname", s->GetEntityDefName() );
  1356. mapEnt->epairs.Set( "name", s->name );
  1357. }
  1358. if ( s->IsType( idMoveable::Type ) ) {
  1359. // save the moveable state
  1360. mapEnt->epairs.Set( "origin", s->GetPhysics()->GetOrigin().ToString( 8 ) );
  1361. mapEnt->epairs.Set( "rotation", s->GetPhysics()->GetAxis().ToString( 8 ) );
  1362. }
  1363. else if ( s->IsType( idAFEntity_Generic::Type ) || s->IsType( idAFEntity_WithAttachedHead::Type ) ) {
  1364. // save the articulated figure state
  1365. dict.Clear();
  1366. static_cast<idAFEntity_Base *>(s)->SaveState( dict );
  1367. mapEnt->epairs.Copy( dict );
  1368. }
  1369. // write out the map file
  1370. mapFile->Write( mapName, ".map" );
  1371. }
  1372. /*
  1373. ==================
  1374. Cmd_DeleteSelected_f
  1375. ==================
  1376. */
  1377. static void Cmd_DeleteSelected_f( const idCmdArgs &args ) {
  1378. idPlayer *player;
  1379. player = gameLocal.GetLocalPlayer();
  1380. if ( !player || !gameLocal.CheatsOk() ) {
  1381. return;
  1382. }
  1383. if ( player ) {
  1384. player->dragEntity.DeleteSelected();
  1385. }
  1386. }
  1387. /*
  1388. ==================
  1389. Cmd_SaveMoveables_f
  1390. ==================
  1391. */
  1392. static void Cmd_SaveMoveables_f( const idCmdArgs &args ) {
  1393. int e, i;
  1394. idMoveable *m;
  1395. idMapEntity *mapEnt;
  1396. idMapFile *mapFile = gameLocal.GetLevelMap();
  1397. idStr mapName;
  1398. const char *name;
  1399. if ( !gameLocal.CheatsOk() ) {
  1400. return;
  1401. }
  1402. for( e = 0; e < MAX_GENTITIES; e++ ) {
  1403. m = static_cast<idMoveable *>(gameLocal.entities[ e ]);
  1404. if ( !m || !m->IsType( idMoveable::Type ) ) {
  1405. continue;
  1406. }
  1407. if ( m->IsBound() ) {
  1408. continue;
  1409. }
  1410. if ( !m->IsAtRest() ) {
  1411. break;
  1412. }
  1413. }
  1414. if ( e < MAX_GENTITIES ) {
  1415. gameLocal.Warning( "map not saved because the moveable entity %s is not at rest", gameLocal.entities[ e ]->name.c_str() );
  1416. return;
  1417. }
  1418. if ( args.Argc() > 1 ) {
  1419. mapName = args.Argv( 1 );
  1420. mapName = "maps/" + mapName;
  1421. }
  1422. else {
  1423. mapName = mapFile->GetName();
  1424. }
  1425. for( e = 0; e < MAX_GENTITIES; e++ ) {
  1426. m = static_cast<idMoveable *>(gameLocal.entities[ e ]);
  1427. if ( !m || !m->IsType( idMoveable::Type ) ) {
  1428. continue;
  1429. }
  1430. if ( m->IsBound() ) {
  1431. continue;
  1432. }
  1433. // find map file entity
  1434. mapEnt = mapFile->FindEntity( m->name );
  1435. // create new map file entity if there isn't one for this articulated figure
  1436. if ( !mapEnt ) {
  1437. mapEnt = new idMapEntity();
  1438. mapFile->AddEntity( mapEnt );
  1439. for ( i = 0; i < 9999; i++ ) {
  1440. name = va( "%s_%d", m->GetEntityDefName(), i );
  1441. if ( !gameLocal.FindEntity( name ) ) {
  1442. break;
  1443. }
  1444. }
  1445. m->name = name;
  1446. mapEnt->epairs.Set( "classname", m->GetEntityDefName() );
  1447. mapEnt->epairs.Set( "name", m->name );
  1448. }
  1449. // save the moveable state
  1450. mapEnt->epairs.Set( "origin", m->GetPhysics()->GetOrigin().ToString( 8 ) );
  1451. mapEnt->epairs.Set( "rotation", m->GetPhysics()->GetAxis().ToString( 8 ) );
  1452. }
  1453. // write out the map file
  1454. mapFile->Write( mapName, ".map" );
  1455. }
  1456. /*
  1457. ==================
  1458. Cmd_SaveRagdolls_f
  1459. ==================
  1460. */
  1461. static void Cmd_SaveRagdolls_f( const idCmdArgs &args ) {
  1462. int e, i;
  1463. idAFEntity_Base *af;
  1464. idMapEntity *mapEnt;
  1465. idMapFile *mapFile = gameLocal.GetLevelMap();
  1466. idDict dict;
  1467. idStr mapName;
  1468. const char *name;
  1469. if ( !gameLocal.CheatsOk() ) {
  1470. return;
  1471. }
  1472. if ( args.Argc() > 1 ) {
  1473. mapName = args.Argv( 1 );
  1474. mapName = "maps/" + mapName;
  1475. }
  1476. else {
  1477. mapName = mapFile->GetName();
  1478. }
  1479. for( e = 0; e < MAX_GENTITIES; e++ ) {
  1480. af = static_cast<idAFEntity_Base *>(gameLocal.entities[ e ]);
  1481. if ( !af ) {
  1482. continue;
  1483. }
  1484. if ( !af->IsType( idAFEntity_WithAttachedHead::Type ) && !af->IsType( idAFEntity_Generic::Type ) ) {
  1485. continue;
  1486. }
  1487. if ( af->IsBound() ) {
  1488. continue;
  1489. }
  1490. if ( !af->IsAtRest() ) {
  1491. gameLocal.Warning( "the articulated figure for entity %s is not at rest", gameLocal.entities[ e ]->name.c_str() );
  1492. }
  1493. dict.Clear();
  1494. af->SaveState( dict );
  1495. // find map file entity
  1496. mapEnt = mapFile->FindEntity( af->name );
  1497. // create new map file entity if there isn't one for this articulated figure
  1498. if ( !mapEnt ) {
  1499. mapEnt = new idMapEntity();
  1500. mapFile->AddEntity( mapEnt );
  1501. for ( i = 0; i < 9999; i++ ) {
  1502. name = va( "%s_%d", af->GetEntityDefName(), i );
  1503. if ( !gameLocal.FindEntity( name ) ) {
  1504. break;
  1505. }
  1506. }
  1507. af->name = name;
  1508. mapEnt->epairs.Set( "classname", af->GetEntityDefName() );
  1509. mapEnt->epairs.Set( "name", af->name );
  1510. }
  1511. // save the articulated figure state
  1512. mapEnt->epairs.Copy( dict );
  1513. }
  1514. // write out the map file
  1515. mapFile->Write( mapName, ".map" );
  1516. }
  1517. /*
  1518. ==================
  1519. Cmd_BindRagdoll_f
  1520. ==================
  1521. */
  1522. static void Cmd_BindRagdoll_f( const idCmdArgs &args ) {
  1523. idPlayer *player;
  1524. player = gameLocal.GetLocalPlayer();
  1525. if ( !player || !gameLocal.CheatsOk() ) {
  1526. return;
  1527. }
  1528. if ( player ) {
  1529. player->dragEntity.BindSelected();
  1530. }
  1531. }
  1532. /*
  1533. ==================
  1534. Cmd_UnbindRagdoll_f
  1535. ==================
  1536. */
  1537. static void Cmd_UnbindRagdoll_f( const idCmdArgs &args ) {
  1538. idPlayer *player;
  1539. player = gameLocal.GetLocalPlayer();
  1540. if ( !player || !gameLocal.CheatsOk() ) {
  1541. return;
  1542. }
  1543. if ( player ) {
  1544. player->dragEntity.UnbindSelected();
  1545. }
  1546. }
  1547. /*
  1548. ==================
  1549. Cmd_GameError_f
  1550. ==================
  1551. */
  1552. static void Cmd_GameError_f( const idCmdArgs &args ) {
  1553. gameLocal.Error( "game error" );
  1554. }
  1555. /*
  1556. ==================
  1557. Cmd_SaveLights_f
  1558. ==================
  1559. */
  1560. static void Cmd_SaveLights_f( const idCmdArgs &args ) {
  1561. int e, i;
  1562. idLight *light;
  1563. idMapEntity *mapEnt;
  1564. idMapFile *mapFile = gameLocal.GetLevelMap();
  1565. idDict dict;
  1566. idStr mapName;
  1567. const char *name;
  1568. if ( !gameLocal.CheatsOk() ) {
  1569. return;
  1570. }
  1571. if ( args.Argc() > 1 ) {
  1572. mapName = args.Argv( 1 );
  1573. mapName = "maps/" + mapName;
  1574. }
  1575. else {
  1576. mapName = mapFile->GetName();
  1577. }
  1578. for( e = 0; e < MAX_GENTITIES; e++ ) {
  1579. light = static_cast<idLight*>(gameLocal.entities[ e ]);
  1580. if ( !light || !light->IsType( idLight::Type ) ) {
  1581. continue;
  1582. }
  1583. dict.Clear();
  1584. light->SaveState( &dict );
  1585. // find map file entity
  1586. mapEnt = mapFile->FindEntity( light->name );
  1587. // create new map file entity if there isn't one for this light
  1588. if ( !mapEnt ) {
  1589. mapEnt = new idMapEntity();
  1590. mapFile->AddEntity( mapEnt );
  1591. for ( i = 0; i < 9999; i++ ) {
  1592. name = va( "%s_%d", light->GetEntityDefName(), i );
  1593. if ( !gameLocal.FindEntity( name ) ) {
  1594. break;
  1595. }
  1596. }
  1597. light->name = name;
  1598. mapEnt->epairs.Set( "classname", light->GetEntityDefName() );
  1599. mapEnt->epairs.Set( "name", light->name );
  1600. }
  1601. // save the light state
  1602. mapEnt->epairs.Copy( dict );
  1603. }
  1604. // write out the map file
  1605. mapFile->Write( mapName, ".map" );
  1606. }
  1607. /*
  1608. ==================
  1609. Cmd_SaveParticles_f
  1610. ==================
  1611. */
  1612. static void Cmd_SaveParticles_f( const idCmdArgs &args ) {
  1613. int e;
  1614. idEntity *ent;
  1615. idMapEntity *mapEnt;
  1616. idMapFile *mapFile = gameLocal.GetLevelMap();
  1617. idDict dict;
  1618. idStr mapName, strModel;
  1619. if ( !gameLocal.CheatsOk() ) {
  1620. return;
  1621. }
  1622. if ( args.Argc() > 1 ) {
  1623. mapName = args.Argv( 1 );
  1624. mapName = "maps/" + mapName;
  1625. }
  1626. else {
  1627. mapName = mapFile->GetName();
  1628. }
  1629. for( e = 0; e < MAX_GENTITIES; e++ ) {
  1630. ent = static_cast<idStaticEntity*> ( gameLocal.entities[ e ] );
  1631. if ( !ent ) {
  1632. continue;
  1633. }
  1634. strModel = ent->spawnArgs.GetString( "model" );
  1635. if ( strModel.Length() && strModel.Find( ".prt") > 0 ) {
  1636. dict.Clear();
  1637. dict.Set( "model", ent->spawnArgs.GetString( "model" ) );
  1638. dict.SetVector( "origin", ent->GetPhysics()->GetOrigin() );
  1639. // find map file entity
  1640. mapEnt = mapFile->FindEntity( ent->name );
  1641. // create new map file entity if there isn't one for this entity
  1642. if ( !mapEnt ) {
  1643. continue;
  1644. }
  1645. // save the particle state
  1646. mapEnt->epairs.Copy( dict );
  1647. }
  1648. }
  1649. // write out the map file
  1650. mapFile->Write( mapName, ".map" );
  1651. }
  1652. /*
  1653. ==================
  1654. Cmd_DisasmScript_f
  1655. ==================
  1656. */
  1657. static void Cmd_DisasmScript_f( const idCmdArgs &args ) {
  1658. gameLocal.program.Disassemble();
  1659. }
  1660. /*
  1661. ==================
  1662. Cmd_TestSave_f
  1663. ==================
  1664. */
  1665. static void Cmd_TestSave_f( const idCmdArgs &args ) {
  1666. idFile *f;
  1667. f = fileSystem->OpenFileWrite( "test.sav" );
  1668. gameLocal.SaveGame( f );
  1669. fileSystem->CloseFile( f );
  1670. }
  1671. /*
  1672. ==================
  1673. Cmd_RecordViewNotes_f
  1674. ==================
  1675. */
  1676. static void Cmd_RecordViewNotes_f( const idCmdArgs &args ) {
  1677. idPlayer *player;
  1678. idVec3 origin;
  1679. idMat3 axis;
  1680. if ( args.Argc() <= 3 ) {
  1681. return;
  1682. }
  1683. player = gameLocal.GetLocalPlayer();
  1684. if ( !player ) {
  1685. return;
  1686. }
  1687. player->GetViewPos( origin, axis );
  1688. // Argv(1) = filename for map (viewnotes/mapname/person)
  1689. // Argv(2) = note number (person0001)
  1690. // Argv(3) = comments
  1691. idStr str = args.Argv(1);
  1692. str.SetFileExtension( ".txt" );
  1693. idFile *file = fileSystem->OpenFileAppend( str );
  1694. if ( file ) {
  1695. file->WriteFloatString( "\"view\"\t( %s )\t( %s )\r\n", origin.ToString(), axis.ToString() );
  1696. file->WriteFloatString( "\"comments\"\t\"%s: %s\"\r\n\r\n", args.Argv(2), args.Argv(3) );
  1697. fileSystem->CloseFile( file );
  1698. }
  1699. idStr viewComments = args.Argv(1);
  1700. viewComments.StripLeading("viewnotes/");
  1701. viewComments += " -- Loc: ";
  1702. viewComments += origin.ToString();
  1703. viewComments += "\n";
  1704. viewComments += args.Argv(3);
  1705. player->hud->SetStateString( "viewcomments", viewComments );
  1706. player->hud->HandleNamedEvent( "showViewComments" );
  1707. }
  1708. /*
  1709. ==================
  1710. Cmd_CloseViewNotes_f
  1711. ==================
  1712. */
  1713. static void Cmd_CloseViewNotes_f( const idCmdArgs &args ) {
  1714. idPlayer *player = gameLocal.GetLocalPlayer();
  1715. if ( !player ) {
  1716. return;
  1717. }
  1718. player->hud->SetStateString( "viewcomments", "" );
  1719. player->hud->HandleNamedEvent( "hideViewComments" );
  1720. }
  1721. /*
  1722. ==================
  1723. Cmd_ShowViewNotes_f
  1724. ==================
  1725. */
  1726. static void Cmd_ShowViewNotes_f( const idCmdArgs &args ) {
  1727. static idLexer parser( LEXFL_ALLOWPATHNAMES | LEXFL_NOSTRINGESCAPECHARS | LEXFL_NOSTRINGCONCAT | LEXFL_NOFATALERRORS );
  1728. idToken token;
  1729. idPlayer *player;
  1730. idVec3 origin;
  1731. idMat3 axis;
  1732. player = gameLocal.GetLocalPlayer();
  1733. if ( !player ) {
  1734. return;
  1735. }
  1736. if ( !parser.IsLoaded() ) {
  1737. idStr str = "viewnotes/";
  1738. str += gameLocal.GetMapName();
  1739. str.StripFileExtension();
  1740. str += "/";
  1741. if ( args.Argc() > 1 ) {
  1742. str += args.Argv( 1 );
  1743. } else {
  1744. str += "comments";
  1745. }
  1746. str.SetFileExtension( ".txt" );
  1747. if ( !parser.LoadFile( str ) ) {
  1748. gameLocal.Printf( "No view notes for %s\n", gameLocal.GetMapName() );
  1749. return;
  1750. }
  1751. }
  1752. if ( parser.ExpectTokenString( "view" ) && parser.Parse1DMatrix( 3, origin.ToFloatPtr() ) &&
  1753. parser.Parse1DMatrix( 9, axis.ToFloatPtr() ) && parser.ExpectTokenString( "comments" ) && parser.ReadToken( &token ) ) {
  1754. player->hud->SetStateString( "viewcomments", token );
  1755. player->hud->HandleNamedEvent( "showViewComments" );
  1756. player->Teleport( origin, axis.ToAngles(), NULL );
  1757. } else {
  1758. parser.FreeSource();
  1759. player->hud->HandleNamedEvent( "hideViewComments" );
  1760. return;
  1761. }
  1762. }
  1763. /*
  1764. =================
  1765. FindEntityGUIs
  1766. helper function for Cmd_NextGUI_f. Checks the passed entity to determine if it
  1767. has any valid gui surfaces.
  1768. =================
  1769. */
  1770. bool FindEntityGUIs( idEntity *ent, const modelSurface_t ** surfaces, int maxSurfs, int &guiSurfaces ) {
  1771. renderEntity_t *renderEnt;
  1772. idRenderModel *renderModel;
  1773. const modelSurface_t *surf;
  1774. const idMaterial *shader;
  1775. int i;
  1776. assert( surfaces != NULL );
  1777. assert( ent != NULL );
  1778. memset( surfaces, 0x00, sizeof( modelSurface_t *) * maxSurfs );
  1779. guiSurfaces = 0;
  1780. renderEnt = ent->GetRenderEntity();
  1781. renderModel = renderEnt->hModel;
  1782. if ( renderModel == NULL ) {
  1783. return false;
  1784. }
  1785. for( i = 0; i < renderModel->NumSurfaces(); i++ ) {
  1786. surf = renderModel->Surface( i );
  1787. if ( surf == NULL ) {
  1788. continue;
  1789. }
  1790. shader = surf->shader;
  1791. if ( shader == NULL ) {
  1792. continue;
  1793. }
  1794. if ( shader->GetEntityGui() > 0 ) {
  1795. surfaces[ guiSurfaces++ ] = surf;
  1796. }
  1797. }
  1798. return ( guiSurfaces != 0 );
  1799. }
  1800. /*
  1801. =================
  1802. Cmd_NextGUI_f
  1803. =================
  1804. */
  1805. void Cmd_NextGUI_f( const idCmdArgs &args ) {
  1806. idVec3 origin;
  1807. idAngles angles;
  1808. idPlayer *player;
  1809. idEntity *ent;
  1810. int guiSurfaces;
  1811. bool newEnt;
  1812. renderEntity_t *renderEnt;
  1813. int surfIndex;
  1814. srfTriangles_t *geom;
  1815. idMat4 modelMatrix;
  1816. idVec3 normal;
  1817. idVec3 center;
  1818. const modelSurface_t *surfaces[ MAX_RENDERENTITY_GUI ];
  1819. player = gameLocal.GetLocalPlayer();
  1820. if ( !player || !gameLocal.CheatsOk() ) {
  1821. return;
  1822. }
  1823. if ( args.Argc() != 1 ) {
  1824. gameLocal.Printf( "usage: nextgui\n" );
  1825. return;
  1826. }
  1827. // start at the last entity
  1828. ent = gameLocal.lastGUIEnt.GetEntity();
  1829. // see if we have any gui surfaces left to go to on the current entity.
  1830. guiSurfaces = 0;
  1831. newEnt = false;
  1832. if ( ent == NULL ) {
  1833. newEnt = true;
  1834. } else if ( FindEntityGUIs( ent, surfaces, MAX_RENDERENTITY_GUI, guiSurfaces ) == true ) {
  1835. if ( gameLocal.lastGUI >= guiSurfaces ) {
  1836. newEnt = true;
  1837. }
  1838. } else {
  1839. // no actual gui surfaces on this ent, so skip it
  1840. newEnt = true;
  1841. }
  1842. if ( newEnt == true ) {
  1843. // go ahead and skip to the next entity with a gui...
  1844. if ( ent == NULL ) {
  1845. ent = gameLocal.spawnedEntities.Next();
  1846. } else {
  1847. ent = ent->spawnNode.Next();
  1848. }
  1849. for ( ; ent != NULL; ent = ent->spawnNode.Next() ) {
  1850. if ( ent->spawnArgs.GetString( "gui", NULL ) != NULL ) {
  1851. break;
  1852. }
  1853. if ( ent->spawnArgs.GetString( "gui2", NULL ) != NULL ) {
  1854. break;
  1855. }
  1856. if ( ent->spawnArgs.GetString( "gui3", NULL ) != NULL ) {
  1857. break;
  1858. }
  1859. // try the next entity
  1860. gameLocal.lastGUIEnt = ent;
  1861. }
  1862. gameLocal.lastGUIEnt = ent;
  1863. gameLocal.lastGUI = 0;
  1864. if ( !ent ) {
  1865. gameLocal.Printf( "No more gui entities. Starting over...\n" );
  1866. return;
  1867. }
  1868. }
  1869. if ( FindEntityGUIs( ent, surfaces, MAX_RENDERENTITY_GUI, guiSurfaces ) == false ) {
  1870. gameLocal.Printf( "Entity \"%s\" has gui properties but no gui surfaces.\n", ent->name.c_str() );
  1871. }
  1872. if ( guiSurfaces == 0 ) {
  1873. gameLocal.Printf( "Entity \"%s\" has gui properties but no gui surfaces!\n", ent->name.c_str() );
  1874. return;
  1875. }
  1876. gameLocal.Printf( "Teleporting to gui entity \"%s\", gui #%d.\n" , ent->name.c_str (), gameLocal.lastGUI );
  1877. renderEnt = ent->GetRenderEntity();
  1878. surfIndex = gameLocal.lastGUI++;
  1879. geom = surfaces[ surfIndex ]->geometry;
  1880. if ( geom == NULL ) {
  1881. gameLocal.Printf( "Entity \"%s\" has gui surface %d without geometry!\n", ent->name.c_str(), surfIndex );
  1882. return;
  1883. }
  1884. assert( geom->facePlanes != NULL );
  1885. modelMatrix = idMat4( renderEnt->axis, renderEnt->origin );
  1886. normal = geom->facePlanes[ 0 ].Normal() * renderEnt->axis;
  1887. center = geom->bounds.GetCenter() * modelMatrix;
  1888. origin = center + (normal * 32.0f);
  1889. origin.z -= player->EyeHeight();
  1890. normal *= -1.0f;
  1891. angles = normal.ToAngles ();
  1892. // make sure the player is in noclip
  1893. player->noclip = true;
  1894. player->Teleport( origin, angles, NULL );
  1895. }
  1896. static void ArgCompletion_DefFile( const idCmdArgs &args, void(*callback)( const char *s ) ) {
  1897. cmdSystem->ArgCompletion_FolderExtension( args, callback, "def/", true, ".def", NULL );
  1898. }
  1899. /*
  1900. ===============
  1901. Cmd_TestId_f
  1902. outputs a string from the string table for the specified id
  1903. ===============
  1904. */
  1905. void Cmd_TestId_f( const idCmdArgs &args ) {
  1906. idStr id;
  1907. int i;
  1908. if ( args.Argc() == 1 ) {
  1909. common->Printf( "usage: testid <string id>\n" );
  1910. return;
  1911. }
  1912. for ( i = 1; i < args.Argc(); i++ ) {
  1913. id += args.Argv( i );
  1914. }
  1915. if ( idStr::Cmpn( id, STRTABLE_ID, STRTABLE_ID_LENGTH ) != 0 ) {
  1916. id = STRTABLE_ID + id;
  1917. }
  1918. gameLocal.mpGame.AddChatLine( common->GetLanguageDict()->GetString( id ), "<nothing>", "<nothing>", "<nothing>" );
  1919. }
  1920. /*
  1921. =================
  1922. idGameLocal::InitConsoleCommands
  1923. Let the system know about all of our commands
  1924. so it can perform tab completion
  1925. =================
  1926. */
  1927. void idGameLocal::InitConsoleCommands( void ) {
  1928. cmdSystem->AddCommand( "listTypeInfo", ListTypeInfo_f, CMD_FL_GAME, "list type info" );
  1929. cmdSystem->AddCommand( "writeGameState", WriteGameState_f, CMD_FL_GAME, "write game state" );
  1930. cmdSystem->AddCommand( "testSaveGame", TestSaveGame_f, CMD_FL_GAME|CMD_FL_CHEAT, "test a save game for a level" );
  1931. cmdSystem->AddCommand( "game_memory", idClass::DisplayInfo_f, CMD_FL_GAME, "displays game class info" );
  1932. cmdSystem->AddCommand( "listClasses", idClass::ListClasses_f, CMD_FL_GAME, "lists game classes" );
  1933. cmdSystem->AddCommand( "listThreads", idThread::ListThreads_f, CMD_FL_GAME|CMD_FL_CHEAT, "lists script threads" );
  1934. cmdSystem->AddCommand( "listEntities", Cmd_EntityList_f, CMD_FL_GAME|CMD_FL_CHEAT, "lists game entities" );
  1935. cmdSystem->AddCommand( "listActiveEntities", Cmd_ActiveEntityList_f, CMD_FL_GAME|CMD_FL_CHEAT, "lists active game entities" );
  1936. cmdSystem->AddCommand( "listMonsters", idAI::List_f, CMD_FL_GAME|CMD_FL_CHEAT, "lists monsters" );
  1937. cmdSystem->AddCommand( "listSpawnArgs", Cmd_ListSpawnArgs_f, CMD_FL_GAME|CMD_FL_CHEAT, "list the spawn args of an entity", idGameLocal::ArgCompletion_EntityName );
  1938. cmdSystem->AddCommand( "say", Cmd_Say_f, CMD_FL_GAME, "text chat" );
  1939. cmdSystem->AddCommand( "sayTeam", Cmd_SayTeam_f, CMD_FL_GAME, "team text chat" );
  1940. cmdSystem->AddCommand( "addChatLine", Cmd_AddChatLine_f, CMD_FL_GAME, "internal use - core to game chat lines" );
  1941. cmdSystem->AddCommand( "gameKick", Cmd_Kick_f, CMD_FL_GAME, "same as kick, but recognizes player names" );
  1942. cmdSystem->AddCommand( "give", Cmd_Give_f, CMD_FL_GAME|CMD_FL_CHEAT, "gives one or more items" );
  1943. cmdSystem->AddCommand( "centerview", Cmd_CenterView_f, CMD_FL_GAME, "centers the view" );
  1944. cmdSystem->AddCommand( "god", Cmd_God_f, CMD_FL_GAME|CMD_FL_CHEAT, "enables god mode" );
  1945. cmdSystem->AddCommand( "notarget", Cmd_Notarget_f, CMD_FL_GAME|CMD_FL_CHEAT, "disables the player as a target" );
  1946. cmdSystem->AddCommand( "noclip", Cmd_Noclip_f, CMD_FL_GAME|CMD_FL_CHEAT, "disables collision detection for the player" );
  1947. cmdSystem->AddCommand( "kill", Cmd_Kill_f, CMD_FL_GAME, "kills the player" );
  1948. cmdSystem->AddCommand( "where", Cmd_GetViewpos_f, CMD_FL_GAME|CMD_FL_CHEAT, "prints the current view position" );
  1949. cmdSystem->AddCommand( "getviewpos", Cmd_GetViewpos_f, CMD_FL_GAME|CMD_FL_CHEAT, "prints the current view position" );
  1950. cmdSystem->AddCommand( "setviewpos", Cmd_SetViewpos_f, CMD_FL_GAME|CMD_FL_CHEAT, "sets the current view position" );
  1951. cmdSystem->AddCommand( "teleport", Cmd_Teleport_f, CMD_FL_GAME|CMD_FL_CHEAT, "teleports the player to an entity location", idGameLocal::ArgCompletion_EntityName );
  1952. cmdSystem->AddCommand( "trigger", Cmd_Trigger_f, CMD_FL_GAME|CMD_FL_CHEAT, "triggers an entity", idGameLocal::ArgCompletion_EntityName );
  1953. cmdSystem->AddCommand( "spawn", Cmd_Spawn_f, CMD_FL_GAME|CMD_FL_CHEAT, "spawns a game entity", idCmdSystem::ArgCompletion_Decl<DECL_ENTITYDEF> );
  1954. cmdSystem->AddCommand( "damage", Cmd_Damage_f, CMD_FL_GAME|CMD_FL_CHEAT, "apply damage to an entity", idGameLocal::ArgCompletion_EntityName );
  1955. cmdSystem->AddCommand( "remove", Cmd_Remove_f, CMD_FL_GAME|CMD_FL_CHEAT, "removes an entity", idGameLocal::ArgCompletion_EntityName );
  1956. cmdSystem->AddCommand( "killMonsters", Cmd_KillMonsters_f, CMD_FL_GAME|CMD_FL_CHEAT, "removes all monsters" );
  1957. cmdSystem->AddCommand( "killMoveables", Cmd_KillMovables_f, CMD_FL_GAME|CMD_FL_CHEAT, "removes all moveables" );
  1958. cmdSystem->AddCommand( "killRagdolls", Cmd_KillRagdolls_f, CMD_FL_GAME|CMD_FL_CHEAT, "removes all ragdolls" );
  1959. cmdSystem->AddCommand( "addline", Cmd_AddDebugLine_f, CMD_FL_GAME|CMD_FL_CHEAT, "adds a debug line" );
  1960. cmdSystem->AddCommand( "addarrow", Cmd_AddDebugLine_f, CMD_FL_GAME|CMD_FL_CHEAT, "adds a debug arrow" );
  1961. cmdSystem->AddCommand( "removeline", Cmd_RemoveDebugLine_f, CMD_FL_GAME|CMD_FL_CHEAT, "removes a debug line" );
  1962. cmdSystem->AddCommand( "blinkline", Cmd_BlinkDebugLine_f, CMD_FL_GAME|CMD_FL_CHEAT, "blinks a debug line" );
  1963. cmdSystem->AddCommand( "listLines", Cmd_ListDebugLines_f, CMD_FL_GAME|CMD_FL_CHEAT, "lists all debug lines" );
  1964. cmdSystem->AddCommand( "playerModel", Cmd_PlayerModel_f, CMD_FL_GAME|CMD_FL_CHEAT, "sets the given model on the player", idCmdSystem::ArgCompletion_Decl<DECL_MODELDEF> );
  1965. cmdSystem->AddCommand( "testFx", Cmd_TestFx_f, CMD_FL_GAME|CMD_FL_CHEAT, "tests an FX system", idCmdSystem::ArgCompletion_Decl<DECL_FX> );
  1966. cmdSystem->AddCommand( "testBoneFx", Cmd_TestBoneFx_f, CMD_FL_GAME|CMD_FL_CHEAT, "tests an FX system bound to a joint", idCmdSystem::ArgCompletion_Decl<DECL_FX> );
  1967. cmdSystem->AddCommand( "testLight", Cmd_TestLight_f, CMD_FL_GAME|CMD_FL_CHEAT, "tests a light" );
  1968. cmdSystem->AddCommand( "testPointLight", Cmd_TestPointLight_f, CMD_FL_GAME|CMD_FL_CHEAT, "tests a point light" );
  1969. cmdSystem->AddCommand( "popLight", Cmd_PopLight_f, CMD_FL_GAME|CMD_FL_CHEAT, "removes the last created light" );
  1970. cmdSystem->AddCommand( "testDeath", Cmd_TestDeath_f, CMD_FL_GAME|CMD_FL_CHEAT, "tests death" );
  1971. cmdSystem->AddCommand( "testSave", Cmd_TestSave_f, CMD_FL_GAME|CMD_FL_CHEAT, "writes out a test savegame" );
  1972. cmdSystem->AddCommand( "testModel", idTestModel::TestModel_f, CMD_FL_GAME|CMD_FL_CHEAT, "tests a model", idTestModel::ArgCompletion_TestModel );
  1973. cmdSystem->AddCommand( "testSkin", idTestModel::TestSkin_f, CMD_FL_GAME|CMD_FL_CHEAT, "tests a skin on an existing testModel", idCmdSystem::ArgCompletion_Decl<DECL_SKIN> );
  1974. cmdSystem->AddCommand( "testShaderParm", idTestModel::TestShaderParm_f, CMD_FL_GAME|CMD_FL_CHEAT, "sets a shaderParm on an existing testModel" );
  1975. cmdSystem->AddCommand( "keepTestModel", idTestModel::KeepTestModel_f, CMD_FL_GAME|CMD_FL_CHEAT, "keeps the last test model in the game" );
  1976. cmdSystem->AddCommand( "testAnim", idTestModel::TestAnim_f, CMD_FL_GAME|CMD_FL_CHEAT, "tests an animation", idTestModel::ArgCompletion_TestAnim );
  1977. cmdSystem->AddCommand( "testParticleStopTime", idTestModel::TestParticleStopTime_f,CMD_FL_GAME|CMD_FL_CHEAT, "tests particle stop time on a test model" );
  1978. cmdSystem->AddCommand( "nextAnim", idTestModel::TestModelNextAnim_f, CMD_FL_GAME|CMD_FL_CHEAT, "shows next animation on test model" );
  1979. cmdSystem->AddCommand( "prevAnim", idTestModel::TestModelPrevAnim_f, CMD_FL_GAME|CMD_FL_CHEAT, "shows previous animation on test model" );
  1980. cmdSystem->AddCommand( "nextFrame", idTestModel::TestModelNextFrame_f, CMD_FL_GAME|CMD_FL_CHEAT, "shows next animation frame on test model" );
  1981. cmdSystem->AddCommand( "prevFrame", idTestModel::TestModelPrevFrame_f, CMD_FL_GAME|CMD_FL_CHEAT, "shows previous animation frame on test model" );
  1982. cmdSystem->AddCommand( "testBlend", idTestModel::TestBlend_f, CMD_FL_GAME|CMD_FL_CHEAT, "tests animation blending" );
  1983. cmdSystem->AddCommand( "reloadScript", Cmd_ReloadScript_f, CMD_FL_GAME|CMD_FL_CHEAT, "reloads scripts" );
  1984. cmdSystem->AddCommand( "script", Cmd_Script_f, CMD_FL_GAME|CMD_FL_CHEAT, "executes a line of script" );
  1985. cmdSystem->AddCommand( "listCollisionModels", Cmd_ListCollisionModels_f, CMD_FL_GAME, "lists collision models" );
  1986. cmdSystem->AddCommand( "collisionModelInfo", Cmd_CollisionModelInfo_f, CMD_FL_GAME, "shows collision model info" );
  1987. cmdSystem->AddCommand( "reexportmodels", Cmd_ReexportModels_f, CMD_FL_GAME|CMD_FL_CHEAT, "reexports models", ArgCompletion_DefFile );
  1988. cmdSystem->AddCommand( "reloadanims", Cmd_ReloadAnims_f, CMD_FL_GAME|CMD_FL_CHEAT, "reloads animations" );
  1989. cmdSystem->AddCommand( "listAnims", Cmd_ListAnims_f, CMD_FL_GAME, "lists all animations" );
  1990. cmdSystem->AddCommand( "aasStats", Cmd_AASStats_f, CMD_FL_GAME, "shows AAS stats" );
  1991. cmdSystem->AddCommand( "testDamage", Cmd_TestDamage_f, CMD_FL_GAME|CMD_FL_CHEAT, "tests a damage def", idCmdSystem::ArgCompletion_Decl<DECL_ENTITYDEF> );
  1992. cmdSystem->AddCommand( "weaponSplat", Cmd_WeaponSplat_f, CMD_FL_GAME|CMD_FL_CHEAT, "projects a blood splat on the player weapon" );
  1993. cmdSystem->AddCommand( "saveSelected", Cmd_SaveSelected_f, CMD_FL_GAME|CMD_FL_CHEAT, "saves the selected entity to the .map file" );
  1994. cmdSystem->AddCommand( "deleteSelected", Cmd_DeleteSelected_f, CMD_FL_GAME|CMD_FL_CHEAT, "deletes selected entity" );
  1995. cmdSystem->AddCommand( "saveMoveables", Cmd_SaveMoveables_f, CMD_FL_GAME|CMD_FL_CHEAT, "save all moveables to the .map file" );
  1996. cmdSystem->AddCommand( "saveRagdolls", Cmd_SaveRagdolls_f, CMD_FL_GAME|CMD_FL_CHEAT, "save all ragdoll poses to the .map file" );
  1997. cmdSystem->AddCommand( "bindRagdoll", Cmd_BindRagdoll_f, CMD_FL_GAME|CMD_FL_CHEAT, "binds ragdoll at the current drag position" );
  1998. cmdSystem->AddCommand( "unbindRagdoll", Cmd_UnbindRagdoll_f, CMD_FL_GAME|CMD_FL_CHEAT, "unbinds the selected ragdoll" );
  1999. cmdSystem->AddCommand( "saveLights", Cmd_SaveLights_f, CMD_FL_GAME|CMD_FL_CHEAT, "saves all lights to the .map file" );
  2000. cmdSystem->AddCommand( "saveParticles", Cmd_SaveParticles_f, CMD_FL_GAME|CMD_FL_CHEAT, "saves all lights to the .map file" );
  2001. cmdSystem->AddCommand( "clearLights", Cmd_ClearLights_f, CMD_FL_GAME|CMD_FL_CHEAT, "clears all lights" );
  2002. cmdSystem->AddCommand( "gameError", Cmd_GameError_f, CMD_FL_GAME|CMD_FL_CHEAT, "causes a game error" );
  2003. #ifndef ID_DEMO_BUILD
  2004. cmdSystem->AddCommand( "disasmScript", Cmd_DisasmScript_f, CMD_FL_GAME|CMD_FL_CHEAT, "disassembles script" );
  2005. cmdSystem->AddCommand( "recordViewNotes", Cmd_RecordViewNotes_f, CMD_FL_GAME|CMD_FL_CHEAT, "record the current view position with notes" );
  2006. cmdSystem->AddCommand( "showViewNotes", Cmd_ShowViewNotes_f, CMD_FL_GAME|CMD_FL_CHEAT, "show any view notes for the current map, successive calls will cycle to the next note" );
  2007. cmdSystem->AddCommand( "closeViewNotes", Cmd_CloseViewNotes_f, CMD_FL_GAME|CMD_FL_CHEAT, "close the view showing any notes for this map" );
  2008. cmdSystem->AddCommand( "exportmodels", Cmd_ExportModels_f, CMD_FL_GAME|CMD_FL_CHEAT, "exports models", ArgCompletion_DefFile );
  2009. // multiplayer client commands ( replaces old impulses stuff )
  2010. cmdSystem->AddCommand( "clientDropWeapon", idMultiplayerGame::DropWeapon_f, CMD_FL_GAME, "drop current weapon" );
  2011. cmdSystem->AddCommand( "clientMessageMode", idMultiplayerGame::MessageMode_f, CMD_FL_GAME, "ingame gui message mode" );
  2012. // FIXME: implement
  2013. // cmdSystem->AddCommand( "clientVote", idMultiplayerGame::Vote_f, CMD_FL_GAME, "cast your vote: clientVote yes | no" );
  2014. // cmdSystem->AddCommand( "clientCallVote", idMultiplayerGame::CallVote_f, CMD_FL_GAME, "call a vote: clientCallVote si_.. proposed_value" );
  2015. cmdSystem->AddCommand( "clientVoiceChat", idMultiplayerGame::VoiceChat_f, CMD_FL_GAME, "voice chats: clientVoiceChat <sound shader>" );
  2016. cmdSystem->AddCommand( "clientVoiceChatTeam", idMultiplayerGame::VoiceChatTeam_f, CMD_FL_GAME, "team voice chats: clientVoiceChat <sound shader>" );
  2017. // multiplayer server commands
  2018. cmdSystem->AddCommand( "serverMapRestart", idGameLocal::MapRestart_f, CMD_FL_GAME, "restart the current game" );
  2019. cmdSystem->AddCommand( "serverForceReady", idMultiplayerGame::ForceReady_f,CMD_FL_GAME, "force all players ready" );
  2020. cmdSystem->AddCommand( "serverNextMap", idGameLocal::NextMap_f, CMD_FL_GAME, "change to the next map" );
  2021. #endif
  2022. // localization help commands
  2023. cmdSystem->AddCommand( "nextGUI", Cmd_NextGUI_f, CMD_FL_GAME|CMD_FL_CHEAT, "teleport the player to the next func_static with a gui" );
  2024. cmdSystem->AddCommand( "testid", Cmd_TestId_f, CMD_FL_GAME|CMD_FL_CHEAT, "output the string for the specified id." );
  2025. }
  2026. /*
  2027. =================
  2028. idGameLocal::ShutdownConsoleCommands
  2029. =================
  2030. */
  2031. void idGameLocal::ShutdownConsoleCommands( void ) {
  2032. cmdSystem->RemoveFlaggedCommands( CMD_FL_GAME );
  2033. }