2012-11-26 18:58:24 +00:00
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Doom 3 BFG Edition GPL Source Code
2012-11-28 15:47:07 +00:00
Copyright ( C ) 1993 - 2012 id Software LLC , a ZeniMax Media company .
2012-11-26 18:58:24 +00:00
2012-11-28 15:47:07 +00:00
This file is part of the Doom 3 BFG Edition GPL Source Code ( " Doom 3 BFG Edition Source Code " ) .
2012-11-26 18:58:24 +00:00
Doom 3 BFG Edition Source Code is free software : you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation , either version 3 of the License , or
( at your option ) any later version .
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code . If not , see < http : //www.gnu.org/licenses/>.
In addition , the Doom 3 BFG Edition 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 BFG Edition Source Code . If not , please request a copy in writing from id Software at the address below .
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 .
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
# pragma hdrstop
2012-12-22 15:18:19 +00:00
# include "precompiled.h"
2012-11-26 18:58:24 +00:00
# include "../Game_local.h"
/*
= = = = = = = = = = = = = = = = = =
Cmd_GetFloatArg
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
float Cmd_GetFloatArg ( const idCmdArgs & args , int & argNum )
{
const char * value ;
2012-11-26 18:58:24 +00:00
value = args . Argv ( argNum + + ) ;
return atof ( value ) ;
}
/*
= = = = = = = = = = = = = = = = = = =
Cmd_EntityList_f
= = = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_EntityList_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
int e ;
2012-11-28 15:47:07 +00:00
idEntity * check ;
2012-11-26 18:58:24 +00:00
int count ;
size_t size ;
idStr match ;
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) > 1 )
{
2012-11-26 18:58:24 +00:00
match = args . Args ( ) ;
match . Replace ( " " , " " ) ;
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
match = " " ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
count = 0 ;
size = 0 ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " %-4s %-20s %-20s %s \n " , " Num " , " EntityDef " , " Class " , " Name " ) ;
gameLocal . Printf ( " -------------------------------------------------------------------- \n " ) ;
2012-11-28 15:47:07 +00:00
for ( e = 0 ; e < MAX_GENTITIES ; e + + )
{
2012-11-26 18:58:24 +00:00
check = gameLocal . entities [ e ] ;
2012-11-28 15:47:07 +00:00
if ( ! check )
{
2012-11-26 18:58:24 +00:00
continue ;
}
2012-11-28 15:47:07 +00:00
if ( ! check - > name . Filter ( match , true ) )
{
2012-11-26 18:58:24 +00:00
continue ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " %4i: %-20s %-20s %s \n " , e ,
2012-11-28 15:47:07 +00:00
check - > GetEntityDefName ( ) , check - > GetClassname ( ) , check - > name . c_str ( ) ) ;
2012-11-26 18:58:24 +00:00
count + + ;
size + = check - > spawnArgs . Allocated ( ) ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " ...%d entities \n ...%d bytes of spawnargs \n " , count , size ) ;
}
/*
= = = = = = = = = = = = = = = = = = =
Cmd_ActiveEntityList_f
= = = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_ActiveEntityList_f ( const idCmdArgs & args )
{
idEntity * check ;
2012-11-26 18:58:24 +00:00
int count ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
count = 0 ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " %-4s %-20s %-20s %s \n " , " Num " , " EntityDef " , " Class " , " Name " ) ;
gameLocal . Printf ( " -------------------------------------------------------------------- \n " ) ;
2012-11-28 15:47:07 +00:00
for ( check = gameLocal . activeEntities . Next ( ) ; check ! = NULL ; check = check - > activeNode . Next ( ) )
{
2012-11-26 18:58:24 +00:00
char dormant = check - > fl . isDormant ? ' - ' : ' ' ;
gameLocal . Printf ( " %4i:%c%-20s %-20s %s \n " , check - > entityNumber , dormant , check - > GetEntityDefName ( ) , check - > GetClassname ( ) , check - > name . c_str ( ) ) ;
count + + ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " ...%d active entities \n " , count ) ;
}
/*
= = = = = = = = = = = = = = = = = = =
Cmd_ListSpawnArgs_f
= = = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_ListSpawnArgs_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
int i ;
2012-11-28 15:47:07 +00:00
idEntity * ent ;
2012-11-26 18:58:24 +00:00
ent = gameLocal . FindEntity ( args . Argv ( 1 ) ) ;
2012-11-28 15:47:07 +00:00
if ( ! ent )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " entity not found \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
for ( i = 0 ; i < ent - > spawnArgs . GetNumKeyVals ( ) ; i + + )
{
const idKeyValue * kv = ent - > spawnArgs . GetKeyVal ( i ) ;
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " \" %s \" " S_COLOR_WHITE " \" %s \" \n " , kv - > GetKey ( ) . c_str ( ) , kv - > GetValue ( ) . c_str ( ) ) ;
}
}
/*
= = = = = = = = = = = = = = = = = = =
Cmd_ReloadScript_f
= = = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_ReloadScript_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
// shutdown the map because entities may point to script objects
gameLocal . MapShutdown ( ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// recompile the scripts
gameLocal . program . Startup ( SCRIPT_DEFAULT ) ;
2012-11-28 15:47:07 +00:00
if ( fileSystem - > ReadFile ( " doom_main.script " , NULL ) > 0 )
{
2012-11-26 18:58:24 +00:00
gameLocal . program . CompileFile ( " doom_main.script " ) ;
gameLocal . program . FinishCompilation ( ) ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// error out so that the user can rerun the scripts
gameLocal . Error ( " Exiting map to reload scripts " ) ;
}
2012-11-28 15:47:07 +00:00
CONSOLE_COMMAND ( reloadScript2 , " Doesn't thow an error... Use this when switching game modes " , 0 )
{
2012-11-26 18:58:24 +00:00
// shutdown the map because entities may point to script objects
gameLocal . MapShutdown ( ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// recompile the scripts
gameLocal . program . Startup ( SCRIPT_DEFAULT ) ;
2012-11-28 15:47:07 +00:00
if ( fileSystem - > ReadFile ( " doom_main.script " , NULL ) > 0 )
{
2012-11-26 18:58:24 +00:00
gameLocal . program . CompileFile ( " doom_main.script " ) ;
gameLocal . program . FinishCompilation ( ) ;
}
}
/*
= = = = = = = = = = = = = = = = = = =
Cmd_Script_f
= = = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_Script_f ( const idCmdArgs & args )
{
const char * script ;
2012-11-26 18:58:24 +00:00
idStr text ;
idStr funcname ;
static int funccount = 0 ;
2012-11-28 15:47:07 +00:00
idThread * thread ;
const function_t * func ;
idEntity * ent ;
if ( ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
sprintf ( funcname , " ConsoleFunction_%d " , funccount + + ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
script = args . Args ( ) ;
sprintf ( text , " void %s() {%s;} \n " , funcname . c_str ( ) , script ) ;
2012-11-28 15:47:07 +00:00
if ( gameLocal . program . CompileText ( " console " , text , true ) )
{
2012-11-26 18:58:24 +00:00
func = gameLocal . program . FindFunction ( funcname ) ;
2012-11-28 15:47:07 +00:00
if ( func )
{
2012-11-26 18:58:24 +00:00
// set all the entity names in case the user named one in the script that wasn't referenced in the default script
2012-11-28 15:47:07 +00:00
for ( ent = gameLocal . spawnedEntities . Next ( ) ; ent ! = NULL ; ent = ent - > spawnNode . Next ( ) )
{
2012-11-26 18:58:24 +00:00
gameLocal . program . SetEntity ( ent - > name , ent ) ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
thread = new idThread ( func ) ;
thread - > Start ( ) ;
}
}
}
/*
= = = = = = = = = = = = = = = = = =
KillEntities
Kills all the entities of the given class in a level .
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void KillEntities ( const idCmdArgs & args , const idTypeInfo & superClass )
{
idEntity * ent ;
2012-11-26 18:58:24 +00:00
idStrList ignore ;
2012-11-28 15:47:07 +00:00
const char * name ;
2012-11-26 18:58:24 +00:00
int i ;
2012-11-28 15:47:07 +00:00
if ( ! gameLocal . GetLocalPlayer ( ) | | ! gameLocal . CheatsOk ( false ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
for ( i = 1 ; i < args . Argc ( ) ; i + + )
{
2012-11-26 18:58:24 +00:00
name = args . Argv ( i ) ;
ignore . Append ( name ) ;
}
2012-11-28 15:47:07 +00:00
for ( ent = gameLocal . spawnedEntities . Next ( ) ; ent ! = NULL ; ent = ent - > spawnNode . Next ( ) )
{
if ( ent - > IsType ( superClass ) )
{
for ( i = 0 ; i < ignore . Num ( ) ; i + + )
{
if ( ignore [ i ] = = ent - > name )
{
2012-11-26 18:58:24 +00:00
break ;
}
}
2012-11-28 15:47:07 +00:00
if ( i > = ignore . Num ( ) )
{
2012-11-26 18:58:24 +00:00
ent - > PostEventMS ( & EV_Remove , 0 ) ;
}
}
}
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_KillMonsters_f
Kills all the monsters in a level .
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_KillMonsters_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
KillEntities ( args , idAI : : Type ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// kill any projectiles as well since they have pointers to the monster that created them
KillEntities ( args , idProjectile : : Type ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_KillMovables_f
Kills all the moveables in a level .
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_KillMovables_f ( const idCmdArgs & args )
{
if ( ! gameLocal . GetLocalPlayer ( ) | | ! gameLocal . CheatsOk ( false ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
KillEntities ( args , idMoveable : : Type ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_KillRagdolls_f
Kills all the ragdolls in a level .
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_KillRagdolls_f ( const idCmdArgs & args )
{
if ( ! gameLocal . GetLocalPlayer ( ) | | ! gameLocal . CheatsOk ( false ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
KillEntities ( args , idAFEntity_Generic : : Type ) ;
KillEntities ( args , idAFEntity_WithAttachedHead : : Type ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_Give_f
Give items to a client
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_Give_f ( const idCmdArgs & args )
{
const char * name ;
2012-11-26 18:58:24 +00:00
int i ;
bool give_all ;
2012-11-28 15:47:07 +00:00
idPlayer * player ;
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
name = args . Argv ( 1 ) ;
2012-11-28 15:47:07 +00:00
if ( idStr : : Icmp ( name , " all " ) = = 0 )
{
2012-11-26 18:58:24 +00:00
give_all = true ;
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
give_all = false ;
}
2012-11-28 15:47:07 +00:00
if ( give_all | | ( idStr : : Cmpn ( name , " weapon " , 6 ) = = 0 ) )
{
if ( gameLocal . world - > spawnArgs . GetBool ( " no_Weapons " ) )
{
2012-11-26 18:58:24 +00:00
gameLocal . world - > spawnArgs . SetBool ( " no_Weapons " , false ) ;
2012-11-28 15:47:07 +00:00
for ( i = 0 ; i < gameLocal . numClients ; i + + )
{
if ( gameLocal . entities [ i ] )
{
2012-11-26 18:58:24 +00:00
gameLocal . entities [ i ] - > PostEventSec ( & EV_Player_SelectWeapon , 0.5f , gameLocal . entities [ i ] - > spawnArgs . GetString ( " def_weapon1 " ) ) ;
}
}
}
}
2012-11-28 15:47:07 +00:00
if ( ( idStr : : Cmpn ( name , " weapon_ " , 7 ) = = 0 ) | | ( idStr : : Cmpn ( name , " item_ " , 5 ) = = 0 ) | | ( idStr : : Cmpn ( name , " ammo_ " , 5 ) = = 0 ) )
{
2012-11-26 18:58:24 +00:00
player - > GiveItem ( name ) ;
return ;
}
2012-11-28 15:47:07 +00:00
if ( give_all | | idStr : : Icmp ( name , " health " ) = = 0 )
{
2012-11-26 18:58:24 +00:00
player - > health = player - > inventory . maxHealth ;
2012-11-28 15:47:07 +00:00
if ( ! give_all )
{
2012-11-26 18:58:24 +00:00
return ;
}
}
2012-11-28 15:47:07 +00:00
if ( give_all | | idStr : : Icmp ( name , " weapons " ) = = 0 )
{
player - > inventory . weapons = ( int ) ( BIT ( MAX_WEAPONS ) - 1 ) ;
2012-11-26 18:58:24 +00:00
player - > CacheWeapons ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! give_all )
{
2012-11-26 18:58:24 +00:00
return ;
}
}
2012-11-28 15:47:07 +00:00
if ( give_all | | idStr : : Icmp ( name , " ammo " ) = = 0 )
{
for ( i = 0 ; i < AMMO_NUMTYPES ; i + + )
{
2012-11-26 18:58:24 +00:00
player - > inventory . SetInventoryAmmoForType ( i , player - > inventory . MaxAmmoForAmmoClass ( player , idWeapon : : GetAmmoNameForNum ( ( ammo_t ) i ) ) ) ;
}
2012-11-28 15:47:07 +00:00
if ( ! give_all )
{
2012-11-26 18:58:24 +00:00
return ;
}
}
2012-11-28 15:47:07 +00:00
if ( give_all | | idStr : : Icmp ( name , " armor " ) = = 0 )
{
2012-11-26 18:58:24 +00:00
player - > inventory . armor = player - > inventory . maxarmor ;
2012-11-28 15:47:07 +00:00
if ( ! give_all )
{
2012-11-26 18:58:24 +00:00
return ;
}
}
2012-11-28 15:47:07 +00:00
if ( idStr : : Icmp ( name , " berserk " ) = = 0 )
{
2012-11-26 18:58:24 +00:00
player - > GivePowerUp ( BERSERK , SEC2MS ( 30.0f ) , ITEM_GIVE_FEEDBACK | ITEM_GIVE_UPDATE_STATE ) ;
return ;
}
2012-11-28 15:47:07 +00:00
if ( idStr : : Icmp ( name , " invis " ) = = 0 )
{
2012-11-26 18:58:24 +00:00
player - > GivePowerUp ( INVISIBILITY , SEC2MS ( 30.0f ) , ITEM_GIVE_FEEDBACK | ITEM_GIVE_UPDATE_STATE ) ;
return ;
}
2012-11-28 15:47:07 +00:00
if ( idStr : : Icmp ( name , " invulnerability " ) = = 0 )
{
if ( args . Argc ( ) > 2 )
{
2012-11-26 18:58:24 +00:00
player - > GivePowerUp ( INVULNERABILITY , atoi ( args . Argv ( 2 ) ) , ITEM_GIVE_FEEDBACK | ITEM_GIVE_UPDATE_STATE ) ;
}
2012-11-28 15:47:07 +00:00
else
{
2012-11-26 18:58:24 +00:00
player - > GivePowerUp ( INVULNERABILITY , 30000 , ITEM_GIVE_FEEDBACK | ITEM_GIVE_UPDATE_STATE ) ;
}
return ;
}
2012-11-28 15:47:07 +00:00
if ( idStr : : Icmp ( name , " helltime " ) = = 0 )
{
if ( args . Argc ( ) > 2 )
{
2012-11-26 18:58:24 +00:00
player - > GivePowerUp ( HELLTIME , atoi ( args . Argv ( 2 ) ) , ITEM_GIVE_FEEDBACK | ITEM_GIVE_UPDATE_STATE ) ;
}
2012-11-28 15:47:07 +00:00
else
{
2012-11-26 18:58:24 +00:00
player - > GivePowerUp ( HELLTIME , 30000 , ITEM_GIVE_FEEDBACK | ITEM_GIVE_UPDATE_STATE ) ;
}
return ;
}
2012-11-28 15:47:07 +00:00
if ( idStr : : Icmp ( name , " envirosuit " ) = = 0 )
{
if ( args . Argc ( ) > 2 )
{
2012-11-26 18:58:24 +00:00
player - > GivePowerUp ( ENVIROSUIT , atoi ( args . Argv ( 2 ) ) , ITEM_GIVE_FEEDBACK | ITEM_GIVE_UPDATE_STATE ) ;
}
2012-11-28 15:47:07 +00:00
else
{
2012-11-26 18:58:24 +00:00
player - > GivePowerUp ( ENVIROSUIT , 30000 , ITEM_GIVE_FEEDBACK | ITEM_GIVE_UPDATE_STATE ) ;
}
return ;
}
2012-11-28 15:47:07 +00:00
if ( idStr : : Icmp ( name , " pda " ) = = 0 )
{
if ( args . Argc ( ) = = 2 )
{
2012-11-26 18:58:24 +00:00
player - > GivePDA ( NULL , NULL ) ;
2012-11-28 15:47:07 +00:00
}
else if ( idStr : : Icmp ( args . Argv ( 2 ) , " all " ) = = 0 )
{
2012-11-26 18:58:24 +00:00
// Give the personal PDA first
player - > GivePDA ( NULL , NULL ) ;
2012-11-28 15:47:07 +00:00
for ( int i = 0 ; i < declManager - > GetNumDecls ( DECL_PDA ) ; i + + )
{
player - > GivePDA ( static_cast < const idDeclPDA * > ( declManager - > DeclByIndex ( DECL_PDA , i ) ) , NULL ) ;
}
}
else
{
const idDeclPDA * pda = static_cast < const idDeclPDA * > ( declManager - > FindType ( DECL_PDA , args . Argv ( 2 ) , false ) ) ;
if ( pda = = NULL )
{
gameLocal . Printf ( " Unknown PDA %s \n " , args . Argv ( 2 ) ) ;
2012-11-26 18:58:24 +00:00
}
2012-11-28 15:47:07 +00:00
else
{
2012-11-26 18:58:24 +00:00
player - > GivePDA ( pda , NULL ) ;
}
}
return ;
}
2012-11-28 15:47:07 +00:00
if ( idStr : : Icmp ( name , " video " ) = = 0 )
{
const idDeclVideo * video = static_cast < const idDeclVideo * > ( declManager - > FindType ( DECL_VIDEO , args . Argv ( 2 ) , false ) ) ;
if ( video = = NULL )
{
gameLocal . Printf ( " Unknown video %s \n " , args . Argv ( 2 ) ) ;
}
else
{
2012-11-26 18:58:24 +00:00
player - > GiveVideo ( video , NULL ) ;
}
return ;
}
2012-11-28 15:47:07 +00:00
if ( ! give_all & & ! player - > Give ( args . Argv ( 1 ) , args . Argv ( 2 ) , ITEM_GIVE_FEEDBACK | ITEM_GIVE_UPDATE_STATE ) )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " unknown item \n " ) ;
}
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_CenterView_f
Centers the players pitch
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_CenterView_f ( const idCmdArgs & args )
{
idPlayer * player ;
2012-11-26 18:58:24 +00:00
idAngles ang ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
ang = player - > viewAngles ;
ang . pitch = 0.0f ;
player - > SetViewAngles ( ang ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_God_f
Sets client to godmode
argv ( 0 ) god
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_God_f ( const idCmdArgs & args )
{
2012-12-11 22:48:55 +00:00
const char * msg ;
2012-11-28 15:47:07 +00:00
idPlayer * player ;
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( player - > godmode )
{
2012-11-26 18:58:24 +00:00
player - > godmode = false ;
msg = " godmode OFF \n " ;
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
player - > godmode = true ;
msg = " godmode ON \n " ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " %s " , msg ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_Notarget_f
Sets client to notarget
argv ( 0 ) notarget
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_Notarget_f ( const idCmdArgs & args )
{
2012-12-11 22:48:55 +00:00
const char * msg ;
2012-11-28 15:47:07 +00:00
idPlayer * player ;
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( player - > fl . notarget )
{
2012-11-26 18:58:24 +00:00
player - > fl . notarget = false ;
msg = " notarget OFF \n " ;
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
player - > fl . notarget = true ;
msg = " notarget ON \n " ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " %s " , msg ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_Noclip_f
argv ( 0 ) noclip
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_Noclip_f ( const idCmdArgs & args )
{
2012-12-11 22:48:55 +00:00
const char * msg ;
2012-11-28 15:47:07 +00:00
idPlayer * player ;
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( player - > noclip )
{
2012-11-26 18:58:24 +00:00
msg = " noclip OFF \n " ;
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
msg = " noclip ON \n " ;
}
player - > noclip = ! player - > noclip ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " %s " , msg ) ;
}
/*
= = = = = = = = = = = = = = = = =
Cmd_PlayerModel_f
= = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_PlayerModel_f ( const idCmdArgs & args )
{
idPlayer * player ;
const char * name ;
2012-11-26 18:58:24 +00:00
idVec3 pos ;
idAngles ang ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) < 2 )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " usage: playerModel <modelname> \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
name = args . Argv ( 1 ) ;
player - > spawnArgs . Set ( " model " , name ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
pos = player - > GetPhysics ( ) - > GetOrigin ( ) ;
ang = player - > viewAngles ;
player - > SpawnToPoint ( pos , ang ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_Say
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_Say ( bool team , const idCmdArgs & args )
{
const char * cmd = team ? " sayTeam " : " say " ;
if ( ! common - > IsMultiplayer ( ) )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " %s can only be used in a multiplayer game \n " , cmd ) ;
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) < 2 )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " usage: %s <text> \n " , cmd ) ;
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
idStr text = args . Args ( ) ;
2012-11-28 15:47:07 +00:00
if ( text . Length ( ) = = 0 )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( text [ text . Length ( ) - 1 ] = = ' \n ' )
{
2012-11-26 18:58:24 +00:00
text [ text . Length ( ) - 1 ] = ' \0 ' ;
}
2012-11-28 15:47:07 +00:00
const char * name = " player " ;
2012-11-26 18:58:24 +00:00
// "server" will only appear on a dedicated server
2012-11-28 15:47:07 +00:00
if ( common - > IsServer ( ) & & gameLocal . GetLocalClientNum ( ) = = - 1 )
{
2012-11-26 18:58:24 +00:00
name = " server " ;
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
name = session - > GetActingGameStateLobbyBase ( ) . GetLobbyUserName ( gameLocal . lobbyUserIDs [ gameLocal . GetLocalClientNum ( ) ] ) ;
2012-11-28 15:47:07 +00:00
// Append the player's location to team chat messages in CTF
idPlayer * player = static_cast < idPlayer * > ( gameLocal . entities [ gameLocal . GetLocalClientNum ( ) ] ) ;
if ( gameLocal . mpGame . IsGametypeFlagBased ( ) & & team & & player )
{
idLocationEntity * locationEntity = gameLocal . LocationForPoint ( player - > GetEyePosition ( ) ) ;
if ( locationEntity )
{
idStr temp = " [ " ;
temp + = locationEntity - > GetLocation ( ) ;
temp + = " ] " ;
temp + = text ;
text = temp ;
}
}
}
if ( common - > IsClient ( ) )
{
2012-11-26 18:58:24 +00:00
idBitMsg outMsg ;
byte msgBuf [ 256 ] ;
outMsg . InitWrite ( msgBuf , sizeof ( msgBuf ) ) ;
outMsg . WriteString ( name ) ;
outMsg . WriteString ( text , - 1 , false ) ;
session - > GetActingGameStateLobbyBase ( ) . SendReliableToHost ( team ? GAME_RELIABLE_MESSAGE_TCHAT : GAME_RELIABLE_MESSAGE_CHAT , outMsg ) ;
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
gameLocal . mpGame . ProcessChatMessage ( gameLocal . GetLocalClientNum ( ) , team , name , text , NULL ) ;
}
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_Say_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_Say_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
Cmd_Say ( false , args ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_SayTeam_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_SayTeam_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
Cmd_Say ( true , args ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_AddChatLine_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_AddChatLine_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
gameLocal . mpGame . AddChatLine ( args . Argv ( 1 ) ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_GetViewpos_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_GetViewpos_f ( const idCmdArgs & args )
{
idPlayer * player ;
2012-11-26 18:58:24 +00:00
idVec3 origin ;
idMat3 axis ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
const renderView_t * view = player - > GetRenderView ( ) ;
if ( view )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " (%s) %.1f \n " , view - > vieworg . ToString ( ) , view - > viewaxis [ 0 ] . ToYaw ( ) ) ;
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
player - > GetViewPos ( origin , axis ) ;
gameLocal . Printf ( " (%s) %.1f \n " , origin . ToString ( ) , axis [ 0 ] . ToYaw ( ) ) ;
}
}
/*
= = = = = = = = = = = = = = = = =
Cmd_SetViewpos_f
= = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_SetViewpos_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
idVec3 origin ;
idAngles angles ;
int i ;
2012-11-28 15:47:07 +00:00
idPlayer * player ;
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( ( args . Argc ( ) ! = 4 ) & & ( args . Argc ( ) ! = 5 ) )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " usage: setviewpos <x> <y> <z> <yaw> \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
angles . Zero ( ) ;
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) = = 5 )
{
2012-11-26 18:58:24 +00:00
angles . yaw = atof ( args . Argv ( 4 ) ) ;
}
2012-11-28 15:47:07 +00:00
for ( i = 0 ; i < 3 ; i + + )
{
2012-11-26 18:58:24 +00:00
origin [ i ] = atof ( args . Argv ( i + 1 ) ) ;
}
origin . z - = pm_normalviewheight . GetFloat ( ) - 0.25f ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
player - > Teleport ( origin , angles , NULL ) ;
}
/*
= = = = = = = = = = = = = = = = =
Cmd_Teleport_f
= = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_Teleport_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
idVec3 origin ;
idAngles angles ;
2012-11-28 15:47:07 +00:00
idPlayer * player ;
idEntity * ent ;
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) ! = 2 )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " usage: teleport <name of entity to teleport to> \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
ent = gameLocal . FindEntity ( args . Argv ( 1 ) ) ;
2012-11-28 15:47:07 +00:00
if ( ! ent )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " entity not found \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
angles . Zero ( ) ;
angles . yaw = ent - > GetPhysics ( ) - > GetAxis ( ) [ 0 ] . ToYaw ( ) ;
origin = ent - > GetPhysics ( ) - > GetOrigin ( ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
player - > Teleport ( origin , angles , ent ) ;
}
/*
= = = = = = = = = = = = = = = = =
Cmd_Trigger_f
= = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_Trigger_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
idVec3 origin ;
idAngles angles ;
2012-11-28 15:47:07 +00:00
idPlayer * player ;
idEntity * ent ;
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) ! = 2 )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " usage: trigger <name of entity to trigger> \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
ent = gameLocal . FindEntity ( args . Argv ( 1 ) ) ;
2012-11-28 15:47:07 +00:00
if ( ! ent )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " entity not found \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
ent - > Signal ( SIG_TRIGGER ) ;
ent - > ProcessEvent ( & EV_Activate , player ) ;
ent - > TriggerGuis ( ) ;
}
/*
= = = = = = = = = = = = = = = = = = =
Cmd_Spawn_f
= = = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_Spawn_f ( const idCmdArgs & args )
{
const char * key , * value ;
2012-11-26 18:58:24 +00:00
int i ;
float yaw ;
idVec3 org ;
2012-11-28 15:47:07 +00:00
idPlayer * player ;
2012-11-26 18:58:24 +00:00
idDict dict ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( false ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) & 1 ) // must always have an even number of arguments
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " usage: spawn classname [key/value pairs] \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
yaw = player - > viewAngles . yaw ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
value = args . Argv ( 1 ) ;
dict . Set ( " classname " , value ) ;
dict . Set ( " angle " , va ( " %f " , yaw + 180 ) ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
org = player - > GetPhysics ( ) - > GetOrigin ( ) + idAngles ( 0 , yaw , 0 ) . ToForward ( ) * 80 + idVec3 ( 0 , 0 , 1 ) ;
dict . Set ( " origin " , org . ToString ( ) ) ;
2012-11-28 15:47:07 +00:00
for ( i = 2 ; i < args . Argc ( ) - 1 ; i + = 2 )
{
2012-11-26 18:58:24 +00:00
key = args . Argv ( i ) ;
value = args . Argv ( i + 1 ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
dict . Set ( key , value ) ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
gameLocal . SpawnEntityDef ( dict ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_Damage_f
Damages the specified entity
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_Damage_f ( const idCmdArgs & args )
{
if ( ! gameLocal . GetLocalPlayer ( ) | | ! gameLocal . CheatsOk ( false ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) ! = 3 )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " usage: damage <name of entity to damage> <damage> \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
idEntity * ent = gameLocal . FindEntity ( args . Argv ( 1 ) ) ;
if ( ! ent )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " entity not found \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
ent - > Damage ( gameLocal . world , gameLocal . world , idVec3 ( 0 , 0 , 1 ) , " damage_moverCrush " , atoi ( args . Argv ( 2 ) ) , INVALID_JOINT ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_Remove_f
Removes the specified entity
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_Remove_f ( const idCmdArgs & args )
{
if ( ! gameLocal . GetLocalPlayer ( ) | | ! gameLocal . CheatsOk ( false ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) ! = 2 )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " usage: remove <name of entity to remove> \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
idEntity * ent = gameLocal . FindEntity ( args . Argv ( 1 ) ) ;
if ( ! ent )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " entity not found \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
delete ent ;
}
/*
= = = = = = = = = = = = = = = = = = =
Cmd_TestLight_f
= = = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_TestLight_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
int i ;
idStr filename ;
2012-11-28 15:47:07 +00:00
const char * key = NULL , * value = NULL , * name = NULL ;
idPlayer * player = NULL ;
2012-11-26 18:58:24 +00:00
idDict dict ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( false ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
renderView_t * rv = player - > GetRenderView ( ) ;
2012-11-26 18:58:24 +00:00
float fov = tan ( idMath : : M_DEG2RAD * rv - > fov_x / 2 ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
dict . SetMatrix ( " rotation " , mat3_default ) ;
dict . SetVector ( " origin " , rv - > vieworg ) ;
dict . SetVector ( " light_target " , rv - > viewaxis [ 0 ] ) ;
dict . SetVector ( " light_right " , rv - > viewaxis [ 1 ] * - fov ) ;
dict . SetVector ( " light_up " , rv - > viewaxis [ 2 ] * fov ) ;
dict . SetVector ( " light_start " , rv - > viewaxis [ 0 ] * 16 ) ;
dict . SetVector ( " light_end " , rv - > viewaxis [ 0 ] * 1000 ) ;
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) > = 2 )
{
2012-11-26 18:58:24 +00:00
value = args . Argv ( 1 ) ;
2012-11-28 15:47:07 +00:00
filename = args . Argv ( 1 ) ;
2012-11-26 18:58:24 +00:00
filename . DefaultFileExtension ( " .tga " ) ;
dict . Set ( " texture " , filename ) ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
dict . Set ( " classname " , " light " ) ;
2012-11-28 15:47:07 +00:00
for ( i = 2 ; i < args . Argc ( ) - 1 ; i + = 2 )
{
2012-11-26 18:58:24 +00:00
key = args . Argv ( i ) ;
value = args . Argv ( i + 1 ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
dict . Set ( key , value ) ;
}
2012-11-28 15:47:07 +00:00
for ( i = 0 ; i < MAX_GENTITIES ; i + + )
{
2012-11-26 18:58:24 +00:00
name = va ( " spawned_light_%d " , i ) ; // not just light_, or it might pick up a prelight shadow
2012-11-28 15:47:07 +00:00
if ( ! gameLocal . FindEntity ( name ) )
{
2012-11-26 18:58:24 +00:00
break ;
}
}
dict . Set ( " name " , name ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
gameLocal . SpawnEntityDef ( dict ) ;
2012-11-28 15:47:07 +00:00
gameLocal . Printf ( " Created new light \n " ) ;
2012-11-26 18:58:24 +00:00
}
/*
= = = = = = = = = = = = = = = = = = =
Cmd_TestPointLight_f
= = = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_TestPointLight_f ( const idCmdArgs & args )
{
const char * key = NULL , * value = NULL , * name = NULL ;
2012-11-26 18:58:24 +00:00
int i ;
2012-11-28 15:47:07 +00:00
idPlayer * player = NULL ;
2012-11-26 18:58:24 +00:00
idDict dict ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( false ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
dict . SetVector ( " origin " , player - > GetRenderView ( ) - > vieworg ) ;
if ( args . Argc ( ) > = 2 )
{
2012-11-26 18:58:24 +00:00
value = args . Argv ( 1 ) ;
2012-11-28 15:47:07 +00:00
dict . Set ( " light " , value ) ;
2012-11-26 18:58:24 +00:00
}
2012-11-28 15:47:07 +00:00
else
{
dict . Set ( " light " , " 300 " ) ;
}
2012-11-26 18:58:24 +00:00
dict . Set ( " classname " , " light " ) ;
2012-11-28 15:47:07 +00:00
for ( i = 2 ; i < args . Argc ( ) - 1 ; i + = 2 )
{
2012-11-26 18:58:24 +00:00
key = args . Argv ( i ) ;
value = args . Argv ( i + 1 ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
dict . Set ( key , value ) ;
}
2012-11-28 15:47:07 +00:00
for ( i = 0 ; i < MAX_GENTITIES ; i + + )
{
2012-11-26 18:58:24 +00:00
name = va ( " light_%d " , i ) ;
2012-11-28 15:47:07 +00:00
if ( ! gameLocal . FindEntity ( name ) )
{
2012-11-26 18:58:24 +00:00
break ;
}
}
dict . Set ( " name " , name ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
gameLocal . SpawnEntityDef ( dict ) ;
2012-11-28 15:47:07 +00:00
gameLocal . Printf ( " Created new point light \n " ) ;
2012-11-26 18:58:24 +00:00
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_PopLight_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_PopLight_f ( const idCmdArgs & args )
{
idEntity * ent ;
idMapEntity * mapEnt ;
idMapFile * mapFile = gameLocal . GetLevelMap ( ) ;
idLight * lastLight ;
2012-11-26 18:58:24 +00:00
int last ;
2012-11-28 15:47:07 +00:00
if ( ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
bool removeFromMap = ( args . Argc ( ) > 1 ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
lastLight = NULL ;
last = - 1 ;
2012-11-28 15:47:07 +00:00
for ( ent = gameLocal . spawnedEntities . Next ( ) ; ent ! = NULL ; ent = ent - > spawnNode . Next ( ) )
{
if ( ! ent - > IsType ( idLight : : Type ) )
{
2012-11-26 18:58:24 +00:00
continue ;
}
2012-11-28 15:47:07 +00:00
if ( gameLocal . spawnIds [ ent - > entityNumber ] > last )
{
2012-11-26 18:58:24 +00:00
last = gameLocal . spawnIds [ ent - > entityNumber ] ;
lastLight = static_cast < idLight * > ( ent ) ;
}
}
2012-11-28 15:47:07 +00:00
if ( lastLight )
{
2012-11-26 18:58:24 +00:00
// find map file entity
mapEnt = mapFile - > FindEntity ( lastLight - > name ) ;
2012-11-28 15:47:07 +00:00
if ( removeFromMap & & mapEnt )
{
2012-11-26 18:58:24 +00:00
mapFile - > RemoveEntity ( mapEnt ) ;
}
gameLocal . Printf ( " Removing light %i \n " , lastLight - > GetLightDefHandle ( ) ) ;
delete lastLight ;
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " No lights to clear. \n " ) ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
}
/*
= = = = = = = = = = = = = = = = = = = =
Cmd_ClearLights_f
= = = = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_ClearLights_f ( const idCmdArgs & args )
{
idEntity * ent ;
idEntity * next ;
idLight * light ;
idMapEntity * mapEnt ;
idMapFile * mapFile = gameLocal . GetLevelMap ( ) ;
2012-11-26 18:58:24 +00:00
bool removeFromMap = ( args . Argc ( ) > 1 ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " Clearing all lights. \n " ) ;
2012-11-28 15:47:07 +00:00
for ( ent = gameLocal . spawnedEntities . Next ( ) ; ent ! = NULL ; ent = next )
{
2012-11-26 18:58:24 +00:00
next = ent - > spawnNode . Next ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! ent - > IsType ( idLight : : Type ) )
{
2012-11-26 18:58:24 +00:00
continue ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
light = static_cast < idLight * > ( ent ) ;
mapEnt = mapFile - > FindEntity ( light - > name ) ;
2012-11-28 15:47:07 +00:00
if ( removeFromMap & & mapEnt )
{
2012-11-26 18:58:24 +00:00
mapFile - > RemoveEntity ( mapEnt ) ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
delete light ;
}
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_TestFx_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_TestFx_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
idVec3 offset ;
2012-11-28 15:47:07 +00:00
const char * name ;
idPlayer * player ;
2012-11-26 18:58:24 +00:00
idDict dict ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// delete the testModel if active
2012-11-28 15:47:07 +00:00
if ( gameLocal . testFx )
{
2012-11-26 18:58:24 +00:00
delete gameLocal . testFx ;
gameLocal . testFx = NULL ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) < 2 )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
name = args . Argv ( 1 ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
offset = player - > GetPhysics ( ) - > GetOrigin ( ) + player - > viewAngles . ToForward ( ) * 100.0f ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
dict . Set ( " origin " , offset . ToString ( ) ) ;
2012-11-28 15:47:07 +00:00
dict . Set ( " test " , " 1 " ) ;
2012-11-26 18:58:24 +00:00
dict . Set ( " fx " , name ) ;
2012-11-28 15:47:07 +00:00
gameLocal . testFx = ( idEntityFx * ) gameLocal . SpawnEntityType ( idEntityFx : : Type , & dict ) ;
2012-11-26 18:58:24 +00:00
}
# define MAX_DEBUGLINES 128
2012-11-28 15:47:07 +00:00
typedef struct
{
2012-11-26 18:58:24 +00:00
bool used ;
idVec3 start , end ;
int color ;
bool blink ;
bool arrow ;
} gameDebugLine_t ;
gameDebugLine_t debugLines [ MAX_DEBUGLINES ] ;
/*
= = = = = = = = = = = = = = = = = =
Cmd_AddDebugLine_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_AddDebugLine_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
int i , argNum ;
2012-11-28 15:47:07 +00:00
const char * value ;
if ( ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) < 7 )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " usage: addline <x y z> <x y z> <color> \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
for ( i = 0 ; i < MAX_DEBUGLINES ; i + + )
{
if ( ! debugLines [ i ] . used )
{
2012-11-26 18:58:24 +00:00
break ;
}
}
2012-11-28 15:47:07 +00:00
if ( i > = MAX_DEBUGLINES )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " no free debug lines \n " ) ;
return ;
}
value = args . Argv ( 0 ) ;
2012-11-28 15:47:07 +00:00
if ( ! idStr : : Icmp ( value , " addarrow " ) )
{
2012-11-26 18:58:24 +00:00
debugLines [ i ] . arrow = true ;
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
debugLines [ i ] . arrow = false ;
}
debugLines [ i ] . used = true ;
debugLines [ i ] . blink = false ;
argNum = 1 ;
debugLines [ i ] . start . x = Cmd_GetFloatArg ( args , argNum ) ;
debugLines [ i ] . start . y = Cmd_GetFloatArg ( args , argNum ) ;
debugLines [ i ] . start . z = Cmd_GetFloatArg ( args , argNum ) ;
debugLines [ i ] . end . x = Cmd_GetFloatArg ( args , argNum ) ;
debugLines [ i ] . end . y = Cmd_GetFloatArg ( args , argNum ) ;
debugLines [ i ] . end . z = Cmd_GetFloatArg ( args , argNum ) ;
debugLines [ i ] . color = Cmd_GetFloatArg ( args , argNum ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_RemoveDebugLine_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_RemoveDebugLine_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
int i , num ;
2012-11-28 15:47:07 +00:00
const char * value ;
if ( ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) < 2 )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " usage: removeline <num> \n " ) ;
return ;
}
value = args . Argv ( 1 ) ;
2012-11-28 15:47:07 +00:00
num = atoi ( value ) ;
for ( i = 0 ; i < MAX_DEBUGLINES ; i + + )
{
if ( debugLines [ i ] . used )
{
if ( - - num < 0 )
{
2012-11-26 18:58:24 +00:00
break ;
}
}
}
2012-11-28 15:47:07 +00:00
if ( i > = MAX_DEBUGLINES )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " line not found \n " ) ;
return ;
}
debugLines [ i ] . used = false ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_BlinkDebugLine_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_BlinkDebugLine_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
int i , num ;
2012-11-28 15:47:07 +00:00
const char * value ;
if ( ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) < 2 )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " usage: blinkline <num> \n " ) ;
return ;
}
value = args . Argv ( 1 ) ;
num = atoi ( value ) ;
2012-11-28 15:47:07 +00:00
for ( i = 0 ; i < MAX_DEBUGLINES ; i + + )
{
if ( debugLines [ i ] . used )
{
if ( - - num < 0 )
{
2012-11-26 18:58:24 +00:00
break ;
}
}
}
2012-11-28 15:47:07 +00:00
if ( i > = MAX_DEBUGLINES )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " line not found \n " ) ;
return ;
}
debugLines [ i ] . blink = ! debugLines [ i ] . blink ;
}
/*
= = = = = = = = = = = = = = = = = =
PrintFloat
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void PrintFloat ( float f )
{
2014-02-17 14:40:43 +00:00
char buf [ 128 ] ;
int i ;
2012-11-28 15:47:07 +00:00
for ( i = sprintf ( buf , " %3.2f " , f ) ; i < 7 ; i + + )
{
2012-11-26 18:58:24 +00:00
buf [ i ] = ' ' ;
}
buf [ i ] = ' \0 ' ;
gameLocal . Printf ( buf ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_ListDebugLines_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_ListDebugLines_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
int i , num ;
2012-11-28 15:47:07 +00:00
if ( ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
num = 0 ;
gameLocal . Printf ( " line num: x1 y1 z1 x2 y2 z2 c b a \n " ) ;
2012-11-28 15:47:07 +00:00
for ( i = 0 ; i < MAX_DEBUGLINES ; i + + )
{
if ( debugLines [ i ] . used )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " line %3d: " , num ) ;
PrintFloat ( debugLines [ i ] . start . x ) ;
PrintFloat ( debugLines [ i ] . start . y ) ;
PrintFloat ( debugLines [ i ] . start . z ) ;
PrintFloat ( debugLines [ i ] . end . x ) ;
PrintFloat ( debugLines [ i ] . end . y ) ;
PrintFloat ( debugLines [ i ] . end . z ) ;
gameLocal . Printf ( " %d %d %d \n " , debugLines [ i ] . color , debugLines [ i ] . blink , debugLines [ i ] . arrow ) ;
num + + ;
}
}
2012-11-28 15:47:07 +00:00
if ( ! num )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " no debug lines \n " ) ;
}
}
/*
= = = = = = = = = = = = = = = = = =
D_DrawDebugLines
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void D_DrawDebugLines ( )
{
2012-11-26 18:58:24 +00:00
int i ;
idVec3 forward , right , up , p1 , p2 ;
idVec4 color ;
float l ;
2012-11-28 15:47:07 +00:00
for ( i = 0 ; i < MAX_DEBUGLINES ; i + + )
{
if ( debugLines [ i ] . used )
{
if ( ! debugLines [ i ] . blink | | ( gameLocal . time & ( 1 < < 9 ) ) )
{
color = idVec4 ( debugLines [ i ] . color & 1 , ( debugLines [ i ] . color > > 1 ) & 1 , ( debugLines [ i ] . color > > 2 ) & 1 , 1 ) ;
2012-11-26 18:58:24 +00:00
gameRenderWorld - > DebugLine ( color , debugLines [ i ] . start , debugLines [ i ] . end ) ;
//
2012-11-28 15:47:07 +00:00
if ( debugLines [ i ] . arrow )
{
2012-11-26 18:58:24 +00:00
// draw a nice arrow
forward = debugLines [ i ] . end - debugLines [ i ] . start ;
l = forward . Normalize ( ) * 0.2f ;
2012-11-28 15:47:07 +00:00
forward . NormalVectors ( right , up ) ;
if ( l > 3.0f )
{
2012-11-26 18:58:24 +00:00
l = 3.0f ;
}
2012-11-28 15:47:07 +00:00
p1 = debugLines [ i ] . end - l * forward + ( l * 0.4f ) * right ;
p2 = debugLines [ i ] . end - l * forward - ( l * 0.4f ) * right ;
2012-11-26 18:58:24 +00:00
gameRenderWorld - > DebugLine ( color , debugLines [ i ] . end , p1 ) ;
gameRenderWorld - > DebugLine ( color , debugLines [ i ] . end , p2 ) ;
gameRenderWorld - > DebugLine ( color , p1 , p2 ) ;
}
}
}
}
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_ListCollisionModels_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_ListCollisionModels_f ( const idCmdArgs & args )
{
if ( ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
collisionModelManager - > ListModels ( ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_CollisionModelInfo_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_CollisionModelInfo_f ( const idCmdArgs & args )
{
const char * value ;
if ( ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) < 2 )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " usage: collisionModelInfo <modelNum> \n "
2012-11-28 15:47:07 +00:00
" use 'all' instead of the model number for accumulated info \n " ) ;
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
value = args . Argv ( 1 ) ;
2012-11-28 15:47:07 +00:00
if ( ! idStr : : Icmp ( value , " all " ) )
{
2012-11-26 18:58:24 +00:00
collisionModelManager - > ModelInfo ( - 1 ) ;
2012-11-28 15:47:07 +00:00
}
else
{
collisionModelManager - > ModelInfo ( atoi ( value ) ) ;
2012-11-26 18:58:24 +00:00
}
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_ReloadAnims_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_ReloadAnims_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
// don't allow reloading anims when cheats are disabled,
// but if we're not in the game, it's ok
2012-11-28 15:47:07 +00:00
if ( gameLocal . GetLocalPlayer ( ) & & ! gameLocal . CheatsOk ( false ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
animationLib . ReloadAnims ( ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_ListAnims_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_ListAnims_f ( const idCmdArgs & args )
{
idEntity * ent ;
2012-11-26 18:58:24 +00:00
int num ;
size_t size ;
size_t alloced ;
2012-11-28 15:47:07 +00:00
idAnimator * animator ;
const char * classname ;
const idDict * dict ;
2012-11-26 18:58:24 +00:00
int i ;
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) > 1 )
{
2012-11-26 18:58:24 +00:00
idAnimator animator ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
classname = args . Argv ( 1 ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
dict = gameLocal . FindEntityDefDict ( classname , false ) ;
2012-11-28 15:47:07 +00:00
if ( ! dict )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " Entitydef '%s' not found \n " , classname ) ;
return ;
}
animator . SetModel ( dict - > GetString ( " model " ) ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " ---------------- \n " ) ;
num = animator . NumAnims ( ) ;
2012-11-28 15:47:07 +00:00
for ( i = 0 ; i < num ; i + + )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " %s \n " , animator . AnimFullName ( i ) ) ;
}
gameLocal . Printf ( " %d anims \n " , num ) ;
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
animationLib . ListAnims ( ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
size = 0 ;
num = 0 ;
2012-11-28 15:47:07 +00:00
for ( ent = gameLocal . spawnedEntities . Next ( ) ; ent ! = NULL ; ent = ent - > spawnNode . Next ( ) )
{
2012-11-26 18:58:24 +00:00
animator = ent - > GetAnimator ( ) ;
2012-11-28 15:47:07 +00:00
if ( animator )
{
2012-11-26 18:58:24 +00:00
alloced = animator - > Allocated ( ) ;
size + = alloced ;
num + + ;
}
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " %d memory used in %d entity animators \n " , size , num ) ;
}
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_AASStats_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_AASStats_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
int aasNum ;
2012-11-28 15:47:07 +00:00
if ( ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
aasNum = aas_test . GetInteger ( ) ;
2012-11-28 15:47:07 +00:00
idAAS * aas = gameLocal . GetAAS ( aasNum ) ;
if ( ! aas )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " No aas #%d loaded \n " , aasNum ) ;
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
aas - > Stats ( ) ;
}
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_TestDamage_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_TestDamage_f ( const idCmdArgs & args )
{
idPlayer * player ;
const char * damageDefName ;
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) < 2 | | args . Argc ( ) > 3 )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " usage: testDamage <damageDefName> [angle] \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
damageDefName = args . Argv ( 1 ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
idVec3 dir ;
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) = = 3 )
{
2012-11-26 18:58:24 +00:00
float angle = atof ( args . Argv ( 2 ) ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
idMath : : SinCos ( DEG2RAD ( angle ) , dir [ 1 ] , dir [ 0 ] ) ;
dir [ 2 ] = 0 ;
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
dir . Zero ( ) ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// give the player full health before and after
// running the damage
player - > health = player - > inventory . maxHealth ;
player - > Damage ( NULL , NULL , dir , damageDefName , 1.0f , INVALID_JOINT ) ;
player - > health = player - > inventory . maxHealth ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_TestBoneFx_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_TestBoneFx_f ( const idCmdArgs & args )
{
idPlayer * player ;
const char * bone , * fx ;
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) < 3 | | args . Argc ( ) > 4 )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " usage: testBoneFx <fxName> <boneName> \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
fx = args . Argv ( 1 ) ;
bone = args . Argv ( 2 ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
player - > StartFxOnBone ( fx , bone ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_TestDamage_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_TestDeath_f ( const idCmdArgs & args )
{
idPlayer * player ;
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
idVec3 dir ;
idMath : : SinCos ( DEG2RAD ( 45.0f ) , dir [ 1 ] , dir [ 0 ] ) ;
dir [ 2 ] = 0 ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
g_testDeath . SetBool ( 1 ) ;
player - > Damage ( NULL , NULL , dir , " damage_triggerhurt_1000 " , 1.0f , INVALID_JOINT ) ;
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) > = 2 )
{
2012-11-26 18:58:24 +00:00
player - > SpawnGibs ( dir , " damage_triggerhurt_1000 " ) ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_WeaponSplat_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_WeaponSplat_f ( const idCmdArgs & args )
{
idPlayer * player ;
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
player - > weapon . GetEntity ( ) - > BloodSplat ( 2.0f ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_SaveSelected_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_SaveSelected_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
int i ;
2012-11-28 15:47:07 +00:00
idPlayer * player = NULL ;
idEntity * s = NULL ;
idMapEntity * mapEnt ;
idMapFile * mapFile = gameLocal . GetLevelMap ( ) ;
2012-11-26 18:58:24 +00:00
idDict dict ;
idStr mapName ;
2012-11-28 15:47:07 +00:00
const char * name = NULL ;
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
s = player - > dragEntity . GetSelected ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! s )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " no entity selected, set g_dragShowSelection 1 to show the current selection \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) > 1 )
{
2012-11-26 18:58:24 +00:00
mapName = args . Argv ( 1 ) ;
mapName = " maps/ " + mapName ;
}
2012-11-28 15:47:07 +00:00
else
{
2012-11-26 18:58:24 +00:00
mapName = mapFile - > GetName ( ) ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// find map file entity
mapEnt = mapFile - > FindEntity ( s - > name ) ;
// create new map file entity if there isn't one for this articulated figure
2012-11-28 15:47:07 +00:00
if ( ! mapEnt )
{
mapEnt = new ( TAG_SYSTEM ) idMapEntity ( ) ;
2012-11-26 18:58:24 +00:00
mapFile - > AddEntity ( mapEnt ) ;
2012-11-28 15:47:07 +00:00
for ( i = 0 ; i < 9999 ; i + + )
{
2012-11-26 18:58:24 +00:00
name = va ( " %s_%d " , s - > GetEntityDefName ( ) , i ) ;
2012-11-28 15:47:07 +00:00
if ( ! gameLocal . FindEntity ( name ) )
{
2012-11-26 18:58:24 +00:00
break ;
}
}
s - > name = name ;
mapEnt - > epairs . Set ( " classname " , s - > GetEntityDefName ( ) ) ;
mapEnt - > epairs . Set ( " name " , s - > name ) ;
}
2012-11-28 15:47:07 +00:00
if ( s - > IsType ( idMoveable : : Type ) )
{
2012-11-26 18:58:24 +00:00
// save the moveable state
mapEnt - > epairs . Set ( " origin " , s - > GetPhysics ( ) - > GetOrigin ( ) . ToString ( 8 ) ) ;
mapEnt - > epairs . Set ( " rotation " , s - > GetPhysics ( ) - > GetAxis ( ) . ToString ( 8 ) ) ;
}
2012-11-28 15:47:07 +00:00
else if ( s - > IsType ( idAFEntity_Generic : : Type ) | | s - > IsType ( idAFEntity_WithAttachedHead : : Type ) )
{
2012-11-26 18:58:24 +00:00
// save the articulated figure state
dict . Clear ( ) ;
2012-11-28 15:47:07 +00:00
static_cast < idAFEntity_Base * > ( s ) - > SaveState ( dict ) ;
2012-11-26 18:58:24 +00:00
mapEnt - > epairs . Copy ( dict ) ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// write out the map file
mapFile - > Write ( mapName , " .map " ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_DeleteSelected_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_DeleteSelected_f ( const idCmdArgs & args )
{
idPlayer * player ;
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( player )
{
2012-11-26 18:58:24 +00:00
player - > dragEntity . DeleteSelected ( ) ;
}
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_SaveMoveables_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_SaveMoveables_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
int e , i ;
2012-11-28 15:47:07 +00:00
idMoveable * m = NULL ;
idMapEntity * mapEnt = NULL ;
idMapFile * mapFile = gameLocal . GetLevelMap ( ) ;
2012-11-26 18:58:24 +00:00
idStr mapName ;
2012-11-28 15:47:07 +00:00
const char * name = NULL ;
if ( ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
for ( e = 0 ; e < MAX_GENTITIES ; e + + )
{
m = static_cast < idMoveable * > ( gameLocal . entities [ e ] ) ;
if ( ! m | | ! m - > IsType ( idMoveable : : Type ) )
{
2012-11-26 18:58:24 +00:00
continue ;
}
2012-11-28 15:47:07 +00:00
if ( m - > IsBound ( ) )
{
2012-11-26 18:58:24 +00:00
continue ;
}
2012-11-28 15:47:07 +00:00
if ( ! m - > IsAtRest ( ) )
{
2012-11-26 18:58:24 +00:00
break ;
}
}
2012-11-28 15:47:07 +00:00
if ( e < MAX_GENTITIES )
{
2012-11-26 18:58:24 +00:00
gameLocal . Warning ( " map not saved because the moveable entity %s is not at rest " , gameLocal . entities [ e ] - > name . c_str ( ) ) ;
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) > 1 )
{
2012-11-26 18:58:24 +00:00
mapName = args . Argv ( 1 ) ;
mapName = " maps/ " + mapName ;
}
2012-11-28 15:47:07 +00:00
else
{
2012-11-26 18:58:24 +00:00
mapName = mapFile - > GetName ( ) ;
}
2012-11-28 15:47:07 +00:00
for ( e = 0 ; e < MAX_GENTITIES ; e + + )
{
m = static_cast < idMoveable * > ( gameLocal . entities [ e ] ) ;
if ( ! m | | ! m - > IsType ( idMoveable : : Type ) )
{
2012-11-26 18:58:24 +00:00
continue ;
}
2012-11-28 15:47:07 +00:00
if ( m - > IsBound ( ) )
{
2012-11-26 18:58:24 +00:00
continue ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// find map file entity
mapEnt = mapFile - > FindEntity ( m - > name ) ;
// create new map file entity if there isn't one for this articulated figure
2012-11-28 15:47:07 +00:00
if ( ! mapEnt )
{
mapEnt = new ( TAG_SYSTEM ) idMapEntity ( ) ;
2012-11-26 18:58:24 +00:00
mapFile - > AddEntity ( mapEnt ) ;
2012-11-28 15:47:07 +00:00
for ( i = 0 ; i < 9999 ; i + + )
{
2012-11-26 18:58:24 +00:00
name = va ( " %s_%d " , m - > GetEntityDefName ( ) , i ) ;
2012-11-28 15:47:07 +00:00
if ( ! gameLocal . FindEntity ( name ) )
{
2012-11-26 18:58:24 +00:00
break ;
}
}
m - > name = name ;
mapEnt - > epairs . Set ( " classname " , m - > GetEntityDefName ( ) ) ;
mapEnt - > epairs . Set ( " name " , m - > name ) ;
}
// save the moveable state
mapEnt - > epairs . Set ( " origin " , m - > GetPhysics ( ) - > GetOrigin ( ) . ToString ( 8 ) ) ;
mapEnt - > epairs . Set ( " rotation " , m - > GetPhysics ( ) - > GetAxis ( ) . ToString ( 8 ) ) ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// write out the map file
mapFile - > Write ( mapName , " .map " ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_SaveRagdolls_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_SaveRagdolls_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
int e , i ;
2012-11-28 15:47:07 +00:00
idAFEntity_Base * af = NULL ;
idMapEntity * mapEnt = NULL ;
idMapFile * mapFile = gameLocal . GetLevelMap ( ) ;
2012-11-26 18:58:24 +00:00
idDict dict ;
idStr mapName ;
2012-11-28 15:47:07 +00:00
const char * name = NULL ;
if ( ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) > 1 )
{
2012-11-26 18:58:24 +00:00
mapName = args . Argv ( 1 ) ;
mapName = " maps/ " + mapName ;
}
2012-11-28 15:47:07 +00:00
else
{
2012-11-26 18:58:24 +00:00
mapName = mapFile - > GetName ( ) ;
}
2012-11-28 15:47:07 +00:00
for ( e = 0 ; e < MAX_GENTITIES ; e + + )
{
af = static_cast < idAFEntity_Base * > ( gameLocal . entities [ e ] ) ;
if ( ! af )
{
2012-11-26 18:58:24 +00:00
continue ;
}
2012-11-28 15:47:07 +00:00
if ( ! af - > IsType ( idAFEntity_WithAttachedHead : : Type ) & & ! af - > IsType ( idAFEntity_Generic : : Type ) )
{
2012-11-26 18:58:24 +00:00
continue ;
}
2012-11-28 15:47:07 +00:00
if ( af - > IsBound ( ) )
{
2012-11-26 18:58:24 +00:00
continue ;
}
2012-11-28 15:47:07 +00:00
if ( ! af - > IsAtRest ( ) )
{
2012-11-26 18:58:24 +00:00
gameLocal . Warning ( " the articulated figure for entity %s is not at rest " , gameLocal . entities [ e ] - > name . c_str ( ) ) ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
dict . Clear ( ) ;
af - > SaveState ( dict ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// find map file entity
mapEnt = mapFile - > FindEntity ( af - > name ) ;
// create new map file entity if there isn't one for this articulated figure
2012-11-28 15:47:07 +00:00
if ( ! mapEnt )
{
mapEnt = new ( TAG_SYSTEM ) idMapEntity ( ) ;
2012-11-26 18:58:24 +00:00
mapFile - > AddEntity ( mapEnt ) ;
2012-11-28 15:47:07 +00:00
for ( i = 0 ; i < 9999 ; i + + )
{
2012-11-26 18:58:24 +00:00
name = va ( " %s_%d " , af - > GetEntityDefName ( ) , i ) ;
2012-11-28 15:47:07 +00:00
if ( ! gameLocal . FindEntity ( name ) )
{
2012-11-26 18:58:24 +00:00
break ;
}
}
af - > name = name ;
mapEnt - > epairs . Set ( " classname " , af - > GetEntityDefName ( ) ) ;
mapEnt - > epairs . Set ( " name " , af - > name ) ;
}
// save the articulated figure state
mapEnt - > epairs . Copy ( dict ) ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// write out the map file
mapFile - > Write ( mapName , " .map " ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_BindRagdoll_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_BindRagdoll_f ( const idCmdArgs & args )
{
idPlayer * player ;
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( player )
{
2012-11-26 18:58:24 +00:00
player - > dragEntity . BindSelected ( ) ;
}
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_UnbindRagdoll_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_UnbindRagdoll_f ( const idCmdArgs & args )
{
idPlayer * player ;
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( player )
{
2012-11-26 18:58:24 +00:00
player - > dragEntity . UnbindSelected ( ) ;
}
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_GameError_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_GameError_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
gameLocal . Error ( " game error " ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_SaveLights_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_SaveLights_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
int e , i ;
2012-11-28 15:47:07 +00:00
idLight * light = NULL ;
idMapEntity * mapEnt = NULL ;
idMapFile * mapFile = gameLocal . GetLevelMap ( ) ;
2012-11-26 18:58:24 +00:00
idDict dict ;
idStr mapName ;
2012-11-28 15:47:07 +00:00
const char * name = NULL ;
if ( ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) > 1 )
{
2012-11-26 18:58:24 +00:00
mapName = args . Argv ( 1 ) ;
mapName = " maps/ " + mapName ;
}
2012-11-28 15:47:07 +00:00
else
{
2012-11-26 18:58:24 +00:00
mapName = mapFile - > GetName ( ) ;
}
2012-11-28 15:47:07 +00:00
for ( e = 0 ; e < MAX_GENTITIES ; e + + )
{
light = static_cast < idLight * > ( gameLocal . entities [ e ] ) ;
if ( ! light | | ! light - > IsType ( idLight : : Type ) )
{
2012-11-26 18:58:24 +00:00
continue ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
dict . Clear ( ) ;
light - > SaveState ( & dict ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// find map file entity
mapEnt = mapFile - > FindEntity ( light - > name ) ;
// create new map file entity if there isn't one for this light
2012-11-28 15:47:07 +00:00
if ( ! mapEnt )
{
mapEnt = new ( TAG_SYSTEM ) idMapEntity ( ) ;
2012-11-26 18:58:24 +00:00
mapFile - > AddEntity ( mapEnt ) ;
2012-11-28 15:47:07 +00:00
for ( i = 0 ; i < 9999 ; i + + )
{
2012-11-26 18:58:24 +00:00
name = va ( " %s_%d " , light - > GetEntityDefName ( ) , i ) ;
2012-11-28 15:47:07 +00:00
if ( ! gameLocal . FindEntity ( name ) )
{
2012-11-26 18:58:24 +00:00
break ;
}
}
light - > name = name ;
mapEnt - > epairs . Set ( " classname " , light - > GetEntityDefName ( ) ) ;
mapEnt - > epairs . Set ( " name " , light - > name ) ;
}
// save the light state
mapEnt - > epairs . Copy ( dict ) ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// write out the map file
mapFile - > Write ( mapName , " .map " ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_SaveParticles_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_SaveParticles_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
int e ;
2012-11-28 15:47:07 +00:00
idEntity * ent ;
idMapEntity * mapEnt ;
idMapFile * mapFile = gameLocal . GetLevelMap ( ) ;
2012-11-26 18:58:24 +00:00
idDict dict ;
idStr mapName , strModel ;
2012-11-28 15:47:07 +00:00
if ( ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) > 1 )
{
2012-11-26 18:58:24 +00:00
mapName = args . Argv ( 1 ) ;
mapName = " maps/ " + mapName ;
}
2012-11-28 15:47:07 +00:00
else
{
2012-11-26 18:58:24 +00:00
mapName = mapFile - > GetName ( ) ;
}
2012-11-28 15:47:07 +00:00
for ( e = 0 ; e < MAX_GENTITIES ; e + + )
{
ent = static_cast < idStaticEntity * > ( gameLocal . entities [ e ] ) ;
if ( ! ent )
{
2012-11-26 18:58:24 +00:00
continue ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
strModel = ent - > spawnArgs . GetString ( " model " ) ;
2012-11-28 15:47:07 +00:00
if ( strModel . Length ( ) & & strModel . Find ( " .prt " ) > 0 )
{
2012-11-26 18:58:24 +00:00
dict . Clear ( ) ;
dict . Set ( " model " , ent - > spawnArgs . GetString ( " model " ) ) ;
dict . SetVector ( " origin " , ent - > GetPhysics ( ) - > GetOrigin ( ) ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// find map file entity
mapEnt = mapFile - > FindEntity ( ent - > name ) ;
// create new map file entity if there isn't one for this entity
2012-11-28 15:47:07 +00:00
if ( ! mapEnt )
{
2012-11-26 18:58:24 +00:00
continue ;
}
// save the particle state
mapEnt - > epairs . Copy ( dict ) ;
}
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// write out the map file
mapFile - > Write ( mapName , " .map " ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_DisasmScript_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_DisasmScript_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
gameLocal . program . Disassemble ( ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_TestSave_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_TestSave_f ( const idCmdArgs & args )
{
idFile * f , * strings ;
2012-11-26 18:58:24 +00:00
f = fileSystem - > OpenFileWrite ( " test.sav " ) ;
strings = NULL ;
gameLocal . SaveGame ( f , strings ) ;
fileSystem - > CloseFile ( f ) ;
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_RecordViewNotes_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_RecordViewNotes_f ( const idCmdArgs & args )
{
idPlayer * player ;
2012-11-26 18:58:24 +00:00
idVec3 origin ;
idMat3 axis ;
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) < = 3 )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
player - > GetViewPos ( origin , axis ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// Argv(1) = filename for map (viewnotes/mapname/person)
// Argv(2) = note number (person0001)
// Argv(3) = comments
2012-11-28 15:47:07 +00:00
idStr str = args . Argv ( 1 ) ;
2012-11-26 18:58:24 +00:00
str . SetFileExtension ( " .txt " ) ;
2012-11-28 15:47:07 +00:00
idFile * file = fileSystem - > OpenFileAppend ( str ) ;
if ( file )
{
2012-11-26 18:58:24 +00:00
file - > WriteFloatString ( " \" view \" \t ( %s ) \t ( %s ) \r \n " , origin . ToString ( ) , axis . ToString ( ) ) ;
2012-11-28 15:47:07 +00:00
file - > WriteFloatString ( " \" comments \" \t \" %s: %s \" \r \n \r \n " , args . Argv ( 2 ) , args . Argv ( 3 ) ) ;
2012-11-26 18:58:24 +00:00
fileSystem - > CloseFile ( file ) ;
}
2012-11-28 15:47:07 +00:00
idStr viewComments = args . Argv ( 1 ) ;
viewComments . StripLeading ( " viewnotes/ " ) ;
2012-11-26 18:58:24 +00:00
viewComments + = " -- Loc: " ;
viewComments + = origin . ToString ( ) ;
viewComments + = " \n " ;
2012-11-28 15:47:07 +00:00
viewComments + = args . Argv ( 3 ) ;
2012-11-26 18:58:24 +00:00
// TODO_SPARTY: removed old hud need to find a way of doing this with the new hud
//player->hud->SetStateString( "viewcomments", viewComments );
//player->hud->HandleNamedEvent( "showViewComments" );
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_CloseViewNotes_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_CloseViewNotes_f ( const idCmdArgs & args )
{
idPlayer * player = gameLocal . GetLocalPlayer ( ) ;
if ( ! player )
{
2012-11-26 18:58:24 +00:00
return ;
}
// TODO_SPARTY: removed old hud need to find a way of doing this with the new hud
//player->hud->SetStateString( "viewcomments", "" );
//player->hud->HandleNamedEvent( "hideViewComments" );
}
/*
= = = = = = = = = = = = = = = = = =
Cmd_ShowViewNotes_f
= = = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
static void Cmd_ShowViewNotes_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
static idLexer parser ( LEXFL_ALLOWPATHNAMES | LEXFL_NOSTRINGESCAPECHARS | LEXFL_NOSTRINGCONCAT | LEXFL_NOFATALERRORS ) ;
idToken token ;
2012-11-28 15:47:07 +00:00
idPlayer * player ;
2012-11-26 18:58:24 +00:00
idVec3 origin ;
idMat3 axis ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( ! parser . IsLoaded ( ) )
{
2012-11-26 18:58:24 +00:00
idStr str = " viewnotes/ " ;
str + = gameLocal . GetMapName ( ) ;
str . StripFileExtension ( ) ;
str + = " / " ;
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) > 1 )
{
2012-11-26 18:58:24 +00:00
str + = args . Argv ( 1 ) ;
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
str + = " comments " ;
}
str . SetFileExtension ( " .txt " ) ;
2012-11-28 15:47:07 +00:00
if ( ! parser . LoadFile ( str ) )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " No view notes for %s \n " , gameLocal . GetMapName ( ) ) ;
return ;
}
}
2012-11-28 15:47:07 +00:00
if ( parser . ExpectTokenString ( " view " ) & & parser . Parse1DMatrix ( 3 , origin . ToFloatPtr ( ) ) & &
parser . Parse1DMatrix ( 9 , axis . ToFloatPtr ( ) ) & & parser . ExpectTokenString ( " comments " ) & & parser . ReadToken ( & token ) )
{
2012-11-26 18:58:24 +00:00
// TODO_SPARTY: removed old hud need to find a way of doing this with the new hud
//player->hud->SetStateString( "viewcomments", token );
//player->hud->HandleNamedEvent( "showViewComments" );
player - > Teleport ( origin , axis . ToAngles ( ) , NULL ) ;
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
parser . FreeSource ( ) ;
// TODO_SPARTY: removed old hud need to find a way of doing this with the new hud
//player->hud->HandleNamedEvent( "hideViewComments" );
return ;
}
}
/*
= = = = = = = = = = = = = = = = =
FindEntityGUIs
helper function for Cmd_NextGUI_f . Checks the passed entity to determine if it
has any valid gui surfaces .
= = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
bool FindEntityGUIs ( idEntity * ent , const modelSurface_t * * surfaces , int maxSurfs , int & guiSurfaces )
{
renderEntity_t * renderEnt ;
idRenderModel * renderModel ;
const modelSurface_t * surf ;
const idMaterial * shader ;
2012-11-26 18:58:24 +00:00
int i ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
assert ( surfaces ! = NULL ) ;
assert ( ent ! = NULL ) ;
2012-11-28 15:47:07 +00:00
memset ( surfaces , 0x00 , sizeof ( modelSurface_t * ) * maxSurfs ) ;
2012-11-26 18:58:24 +00:00
guiSurfaces = 0 ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
renderEnt = ent - > GetRenderEntity ( ) ;
renderModel = renderEnt - > hModel ;
2012-11-28 15:47:07 +00:00
if ( renderModel = = NULL )
{
2012-11-26 18:58:24 +00:00
return false ;
}
2012-11-28 15:47:07 +00:00
for ( i = 0 ; i < renderModel - > NumSurfaces ( ) ; i + + )
{
2012-11-26 18:58:24 +00:00
surf = renderModel - > Surface ( i ) ;
2012-11-28 15:47:07 +00:00
if ( surf = = NULL )
{
2012-11-26 18:58:24 +00:00
continue ;
}
shader = surf - > shader ;
2012-11-28 15:47:07 +00:00
if ( shader = = NULL )
{
2012-11-26 18:58:24 +00:00
continue ;
}
2012-11-28 15:47:07 +00:00
if ( shader - > GetEntityGui ( ) > 0 )
{
2012-11-26 18:58:24 +00:00
surfaces [ guiSurfaces + + ] = surf ;
}
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
return ( guiSurfaces ! = 0 ) ;
}
/*
= = = = = = = = = = = = = = = = =
Cmd_NextGUI_f
= = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_NextGUI_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
idVec3 origin ;
idAngles angles ;
2012-11-28 15:47:07 +00:00
idPlayer * player ;
idEntity * ent ;
2012-11-26 18:58:24 +00:00
int guiSurfaces ;
bool newEnt ;
2012-11-28 15:47:07 +00:00
renderEntity_t * renderEnt ;
2012-11-26 18:58:24 +00:00
int surfIndex ;
2012-11-28 15:47:07 +00:00
srfTriangles_t * geom ;
2012-11-26 18:58:24 +00:00
idVec3 normal ;
idVec3 center ;
2012-11-28 15:47:07 +00:00
const modelSurface_t * surfaces [ MAX_RENDERENTITY_GUI ] ;
2012-11-26 18:58:24 +00:00
player = gameLocal . GetLocalPlayer ( ) ;
2012-11-28 15:47:07 +00:00
if ( ! player | | ! gameLocal . CheatsOk ( ) )
{
2012-11-26 18:58:24 +00:00
return ;
}
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) ! = 1 )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " usage: nextgui \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// start at the last entity
ent = gameLocal . lastGUIEnt . GetEntity ( ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// see if we have any gui surfaces left to go to on the current entity.
guiSurfaces = 0 ;
newEnt = false ;
2012-11-28 15:47:07 +00:00
if ( ent = = NULL )
{
2012-11-26 18:58:24 +00:00
newEnt = true ;
2012-11-28 15:47:07 +00:00
}
else if ( FindEntityGUIs ( ent , surfaces , MAX_RENDERENTITY_GUI , guiSurfaces ) = = true )
{
if ( gameLocal . lastGUI > = guiSurfaces )
{
2012-11-26 18:58:24 +00:00
newEnt = true ;
}
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
// no actual gui surfaces on this ent, so skip it
newEnt = true ;
}
2012-11-28 15:47:07 +00:00
if ( newEnt = = true )
{
2012-11-26 18:58:24 +00:00
// go ahead and skip to the next entity with a gui...
2012-11-28 15:47:07 +00:00
if ( ent = = NULL )
{
2012-11-26 18:58:24 +00:00
ent = gameLocal . spawnedEntities . Next ( ) ;
2012-11-28 15:47:07 +00:00
}
else
{
2012-11-26 18:58:24 +00:00
ent = ent - > spawnNode . Next ( ) ;
}
2012-11-28 15:47:07 +00:00
for ( ; ent ! = NULL ; ent = ent - > spawnNode . Next ( ) )
{
if ( ent - > spawnArgs . GetString ( " gui " , NULL ) ! = NULL )
{
2012-11-26 18:58:24 +00:00
break ;
}
2012-11-28 15:47:07 +00:00
if ( ent - > spawnArgs . GetString ( " gui2 " , NULL ) ! = NULL )
{
2012-11-26 18:58:24 +00:00
break ;
}
2012-11-28 15:47:07 +00:00
if ( ent - > spawnArgs . GetString ( " gui3 " , NULL ) ! = NULL )
{
2012-11-26 18:58:24 +00:00
break ;
}
// try the next entity
gameLocal . lastGUIEnt = ent ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
gameLocal . lastGUIEnt = ent ;
gameLocal . lastGUI = 0 ;
2012-11-28 15:47:07 +00:00
if ( ! ent )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " No more gui entities. Starting over... \n " ) ;
return ;
}
}
2012-11-28 15:47:07 +00:00
if ( FindEntityGUIs ( ent , surfaces , MAX_RENDERENTITY_GUI , guiSurfaces ) = = false )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " Entity \" %s \" has gui properties but no gui surfaces. \n " , ent - > name . c_str ( ) ) ;
}
2012-11-28 15:47:07 +00:00
if ( guiSurfaces = = 0 )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " Entity \" %s \" has gui properties but no gui surfaces! \n " , ent - > name . c_str ( ) ) ;
return ;
}
2012-11-28 15:47:07 +00:00
gameLocal . Printf ( " Teleporting to gui entity \" %s \" , gui #%d. \n " , ent - > name . c_str ( ) , gameLocal . lastGUI ) ;
2012-11-26 18:58:24 +00:00
renderEnt = ent - > GetRenderEntity ( ) ;
surfIndex = gameLocal . lastGUI + + ;
geom = surfaces [ surfIndex ] - > geometry ;
2012-11-28 15:47:07 +00:00
if ( geom = = NULL )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " Entity \" %s \" has gui surface %d without geometry! \n " , ent - > name . c_str ( ) , surfIndex ) ;
return ;
}
2012-11-28 15:47:07 +00:00
const idVec3 & v0 = geom - > verts [ geom - > indexes [ 0 ] ] . xyz ;
const idVec3 & v1 = geom - > verts [ geom - > indexes [ 1 ] ] . xyz ;
const idVec3 & v2 = geom - > verts [ geom - > indexes [ 2 ] ] . xyz ;
2012-11-26 18:58:24 +00:00
const idPlane plane ( v0 , v1 , v2 ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
normal = plane . Normal ( ) * renderEnt - > axis ;
center = geom - > bounds . GetCenter ( ) * renderEnt - > axis + renderEnt - > origin ;
2012-11-28 15:47:07 +00:00
origin = center + ( normal * 32.0f ) ;
2012-11-26 18:58:24 +00:00
origin . z - = player - > EyeHeight ( ) ;
normal * = - 1.0f ;
2012-11-28 15:47:07 +00:00
angles = normal . ToAngles ( ) ;
2012-11-26 18:58:24 +00:00
// make sure the player is in noclip
player - > noclip = true ;
player - > Teleport ( origin , angles , NULL ) ;
}
2012-11-28 15:47:07 +00:00
void Cmd_SetActorState_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) ! = 3 )
{
2012-11-26 18:58:24 +00:00
common - > Printf ( " usage: setActorState <entity name> <state> \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
idEntity * ent ;
ent = gameLocal . FindEntity ( args . Argv ( 1 ) ) ;
2012-11-28 15:47:07 +00:00
if ( ! ent )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " entity not found \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
if ( ! ent - > IsType ( idActor : : Type ) )
{
2012-11-26 18:58:24 +00:00
gameLocal . Printf ( " entity not an actor \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
idActor * actor = ( idActor * ) ent ;
actor - > PostEventMS ( & AI_SetState , 0 , args . Argv ( 2 ) ) ;
2012-11-26 18:58:24 +00:00
}
#if 0
// not used
2012-11-28 15:47:07 +00:00
static void ArgCompletion_DefFile ( const idCmdArgs & args , void ( * callback ) ( const char * s ) )
{
2012-11-26 18:58:24 +00:00
cmdSystem - > ArgCompletion_FolderExtension ( args , callback , " def/ " , true , " .def " , NULL ) ;
}
# endif
/*
= = = = = = = = = = = = = = =
Cmd_TestId_f
outputs a string from the string table for the specified id
= = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void Cmd_TestId_f ( const idCmdArgs & args )
{
2012-11-26 18:58:24 +00:00
idStr id ;
int i ;
2012-11-28 15:47:07 +00:00
if ( args . Argc ( ) = = 1 )
{
2012-11-26 18:58:24 +00:00
common - > Printf ( " usage: testid <string id> \n " ) ;
return ;
}
2012-11-28 15:47:07 +00:00
for ( i = 1 ; i < args . Argc ( ) ; i + + )
{
2012-11-26 18:58:24 +00:00
id + = args . Argv ( i ) ;
}
2012-11-28 15:47:07 +00:00
if ( idStr : : Cmpn ( id , STRTABLE_ID , STRTABLE_ID_LENGTH ) ! = 0 )
{
2012-11-26 18:58:24 +00:00
id = STRTABLE_ID + id ;
}
2012-11-28 15:47:07 +00:00
gameLocal . mpGame . AddChatLine ( idLocalization : : GetString ( id ) , " <nothing> " , " <nothing> " , " <nothing> " ) ;
2012-11-26 18:58:24 +00:00
}
/*
= = = = = = = = = = = = = = = = =
idGameLocal : : InitConsoleCommands
Let the system know about all of our commands
so it can perform tab completion
= = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void idGameLocal : : InitConsoleCommands ( )
{
2012-11-26 18:58:24 +00:00
cmdSystem - > AddCommand ( " game_memory " , idClass : : DisplayInfo_f , CMD_FL_GAME , " displays game class info " ) ;
cmdSystem - > AddCommand ( " listClasses " , idClass : : ListClasses_f , CMD_FL_GAME , " lists game classes " ) ;
2012-11-28 15:47:07 +00:00
cmdSystem - > AddCommand ( " listThreads " , idThread : : ListThreads_f , CMD_FL_GAME | CMD_FL_CHEAT , " lists script threads " ) ;
cmdSystem - > AddCommand ( " listEntities " , Cmd_EntityList_f , CMD_FL_GAME | CMD_FL_CHEAT , " lists game entities " ) ;
cmdSystem - > AddCommand ( " listActiveEntities " , Cmd_ActiveEntityList_f , CMD_FL_GAME | CMD_FL_CHEAT , " lists active game entities " ) ;
cmdSystem - > AddCommand ( " listMonsters " , idAI : : List_f , CMD_FL_GAME | CMD_FL_CHEAT , " lists monsters " ) ;
cmdSystem - > AddCommand ( " listSpawnArgs " , Cmd_ListSpawnArgs_f , CMD_FL_GAME | CMD_FL_CHEAT , " list the spawn args of an entity " , idGameLocal : : ArgCompletion_EntityName ) ;
2012-11-26 18:58:24 +00:00
cmdSystem - > AddCommand ( " say " , Cmd_Say_f , CMD_FL_GAME , " text chat " ) ;
cmdSystem - > AddCommand ( " sayTeam " , Cmd_SayTeam_f , CMD_FL_GAME , " team text chat " ) ;
cmdSystem - > AddCommand ( " addChatLine " , Cmd_AddChatLine_f , CMD_FL_GAME , " internal use - core to game chat lines " ) ;
2012-11-28 15:47:07 +00:00
cmdSystem - > AddCommand ( " give " , Cmd_Give_f , CMD_FL_GAME | CMD_FL_CHEAT , " gives one or more items " ) ;
2012-11-26 18:58:24 +00:00
cmdSystem - > AddCommand ( " centerview " , Cmd_CenterView_f , CMD_FL_GAME , " centers the view " ) ;
2012-11-28 15:47:07 +00:00
cmdSystem - > AddCommand ( " god " , Cmd_God_f , CMD_FL_GAME | CMD_FL_CHEAT , " enables god mode " ) ;
cmdSystem - > AddCommand ( " notarget " , Cmd_Notarget_f , CMD_FL_GAME | CMD_FL_CHEAT , " disables the player as a target " ) ;
cmdSystem - > AddCommand ( " noclip " , Cmd_Noclip_f , CMD_FL_GAME | CMD_FL_CHEAT , " disables collision detection for the player " ) ;
cmdSystem - > AddCommand ( " where " , Cmd_GetViewpos_f , CMD_FL_GAME | CMD_FL_CHEAT , " prints the current view position " ) ;
cmdSystem - > AddCommand ( " getviewpos " , Cmd_GetViewpos_f , CMD_FL_GAME | CMD_FL_CHEAT , " prints the current view position " ) ;
cmdSystem - > AddCommand ( " setviewpos " , Cmd_SetViewpos_f , CMD_FL_GAME | CMD_FL_CHEAT , " sets the current view position " ) ;
cmdSystem - > AddCommand ( " teleport " , Cmd_Teleport_f , CMD_FL_GAME | CMD_FL_CHEAT , " teleports the player to an entity location " , idGameLocal : : ArgCompletion_EntityName ) ;
cmdSystem - > AddCommand ( " trigger " , Cmd_Trigger_f , CMD_FL_GAME | CMD_FL_CHEAT , " triggers an entity " , idGameLocal : : ArgCompletion_EntityName ) ;
cmdSystem - > AddCommand ( " spawn " , Cmd_Spawn_f , CMD_FL_GAME | CMD_FL_CHEAT , " spawns a game entity " , idCmdSystem : : ArgCompletion_Decl < DECL_ENTITYDEF > ) ;
cmdSystem - > AddCommand ( " damage " , Cmd_Damage_f , CMD_FL_GAME | CMD_FL_CHEAT , " apply damage to an entity " , idGameLocal : : ArgCompletion_EntityName ) ;
cmdSystem - > AddCommand ( " remove " , Cmd_Remove_f , CMD_FL_GAME | CMD_FL_CHEAT , " removes an entity " , idGameLocal : : ArgCompletion_EntityName ) ;
cmdSystem - > AddCommand ( " killMonsters " , Cmd_KillMonsters_f , CMD_FL_GAME | CMD_FL_CHEAT , " removes all monsters " ) ;
cmdSystem - > AddCommand ( " killMoveables " , Cmd_KillMovables_f , CMD_FL_GAME | CMD_FL_CHEAT , " removes all moveables " ) ;
cmdSystem - > AddCommand ( " killRagdolls " , Cmd_KillRagdolls_f , CMD_FL_GAME | CMD_FL_CHEAT , " removes all ragdolls " ) ;
cmdSystem - > AddCommand ( " addline " , Cmd_AddDebugLine_f , CMD_FL_GAME | CMD_FL_CHEAT , " adds a debug line " ) ;
cmdSystem - > AddCommand ( " addarrow " , Cmd_AddDebugLine_f , CMD_FL_GAME | CMD_FL_CHEAT , " adds a debug arrow " ) ;
cmdSystem - > AddCommand ( " removeline " , Cmd_RemoveDebugLine_f , CMD_FL_GAME | CMD_FL_CHEAT , " removes a debug line " ) ;
cmdSystem - > AddCommand ( " blinkline " , Cmd_BlinkDebugLine_f , CMD_FL_GAME | CMD_FL_CHEAT , " blinks a debug line " ) ;
cmdSystem - > AddCommand ( " listLines " , Cmd_ListDebugLines_f , CMD_FL_GAME | CMD_FL_CHEAT , " lists all debug lines " ) ;
cmdSystem - > AddCommand ( " playerModel " , Cmd_PlayerModel_f , CMD_FL_GAME | CMD_FL_CHEAT , " sets the given model on the player " , idCmdSystem : : ArgCompletion_Decl < DECL_MODELDEF > ) ;
cmdSystem - > AddCommand ( " testFx " , Cmd_TestFx_f , CMD_FL_GAME | CMD_FL_CHEAT , " tests an FX system " , idCmdSystem : : ArgCompletion_Decl < DECL_FX > ) ;
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 > ) ;
cmdSystem - > AddCommand ( " testLight " , Cmd_TestLight_f , CMD_FL_GAME | CMD_FL_CHEAT , " tests a light " ) ;
cmdSystem - > AddCommand ( " testPointLight " , Cmd_TestPointLight_f , CMD_FL_GAME | CMD_FL_CHEAT , " tests a point light " ) ;
cmdSystem - > AddCommand ( " popLight " , Cmd_PopLight_f , CMD_FL_GAME | CMD_FL_CHEAT , " removes the last created light " ) ;
cmdSystem - > AddCommand ( " testDeath " , Cmd_TestDeath_f , CMD_FL_GAME | CMD_FL_CHEAT , " tests death " ) ;
cmdSystem - > AddCommand ( " testSave " , Cmd_TestSave_f , CMD_FL_GAME | CMD_FL_CHEAT , " writes out a test savegame " ) ;
cmdSystem - > AddCommand ( " testModel " , idTestModel : : TestModel_f , CMD_FL_GAME | CMD_FL_CHEAT , " tests a model " , idTestModel : : ArgCompletion_TestModel ) ;
cmdSystem - > AddCommand ( " testSkin " , idTestModel : : TestSkin_f , CMD_FL_GAME | CMD_FL_CHEAT , " tests a skin on an existing testModel " , idCmdSystem : : ArgCompletion_Decl < DECL_SKIN > ) ;
cmdSystem - > AddCommand ( " testShaderParm " , idTestModel : : TestShaderParm_f , CMD_FL_GAME | CMD_FL_CHEAT , " sets a shaderParm on an existing testModel " ) ;
cmdSystem - > AddCommand ( " keepTestModel " , idTestModel : : KeepTestModel_f , CMD_FL_GAME | CMD_FL_CHEAT , " keeps the last test model in the game " ) ;
cmdSystem - > AddCommand ( " testAnim " , idTestModel : : TestAnim_f , CMD_FL_GAME | CMD_FL_CHEAT , " tests an animation " , idTestModel : : ArgCompletion_TestAnim ) ;
cmdSystem - > AddCommand ( " testParticleStopTime " , idTestModel : : TestParticleStopTime_f , CMD_FL_GAME | CMD_FL_CHEAT , " tests particle stop time on a test model " ) ;
cmdSystem - > AddCommand ( " nextAnim " , idTestModel : : TestModelNextAnim_f , CMD_FL_GAME | CMD_FL_CHEAT , " shows next animation on test model " ) ;
cmdSystem - > AddCommand ( " prevAnim " , idTestModel : : TestModelPrevAnim_f , CMD_FL_GAME | CMD_FL_CHEAT , " shows previous animation on test model " ) ;
cmdSystem - > AddCommand ( " nextFrame " , idTestModel : : TestModelNextFrame_f , CMD_FL_GAME | CMD_FL_CHEAT , " shows next animation frame on test model " ) ;
cmdSystem - > AddCommand ( " prevFrame " , idTestModel : : TestModelPrevFrame_f , CMD_FL_GAME | CMD_FL_CHEAT , " shows previous animation frame on test model " ) ;
cmdSystem - > AddCommand ( " testBlend " , idTestModel : : TestBlend_f , CMD_FL_GAME | CMD_FL_CHEAT , " tests animation blending " ) ;
cmdSystem - > AddCommand ( " reloadScript " , Cmd_ReloadScript_f , CMD_FL_GAME | CMD_FL_CHEAT , " reloads scripts " ) ;
cmdSystem - > AddCommand ( " script " , Cmd_Script_f , CMD_FL_GAME | CMD_FL_CHEAT , " executes a line of script " ) ;
2012-11-26 18:58:24 +00:00
cmdSystem - > AddCommand ( " listCollisionModels " , Cmd_ListCollisionModels_f , CMD_FL_GAME , " lists collision models " ) ;
cmdSystem - > AddCommand ( " collisionModelInfo " , Cmd_CollisionModelInfo_f , CMD_FL_GAME , " shows collision model info " ) ;
2012-11-28 15:47:07 +00:00
cmdSystem - > AddCommand ( " reloadanims " , Cmd_ReloadAnims_f , CMD_FL_GAME | CMD_FL_CHEAT , " reloads animations " ) ;
2012-11-26 18:58:24 +00:00
cmdSystem - > AddCommand ( " listAnims " , Cmd_ListAnims_f , CMD_FL_GAME , " lists all animations " ) ;
cmdSystem - > AddCommand ( " aasStats " , Cmd_AASStats_f , CMD_FL_GAME , " shows AAS stats " ) ;
2012-11-28 15:47:07 +00:00
cmdSystem - > AddCommand ( " testDamage " , Cmd_TestDamage_f , CMD_FL_GAME | CMD_FL_CHEAT , " tests a damage def " , idCmdSystem : : ArgCompletion_Decl < DECL_ENTITYDEF > ) ;
cmdSystem - > AddCommand ( " weaponSplat " , Cmd_WeaponSplat_f , CMD_FL_GAME | CMD_FL_CHEAT , " projects a blood splat on the player weapon " ) ;
cmdSystem - > AddCommand ( " saveSelected " , Cmd_SaveSelected_f , CMD_FL_GAME | CMD_FL_CHEAT , " saves the selected entity to the .map file " ) ;
cmdSystem - > AddCommand ( " deleteSelected " , Cmd_DeleteSelected_f , CMD_FL_GAME | CMD_FL_CHEAT , " deletes selected entity " ) ;
cmdSystem - > AddCommand ( " saveMoveables " , Cmd_SaveMoveables_f , CMD_FL_GAME | CMD_FL_CHEAT , " save all moveables to the .map file " ) ;
cmdSystem - > AddCommand ( " saveRagdolls " , Cmd_SaveRagdolls_f , CMD_FL_GAME | CMD_FL_CHEAT , " save all ragdoll poses to the .map file " ) ;
cmdSystem - > AddCommand ( " bindRagdoll " , Cmd_BindRagdoll_f , CMD_FL_GAME | CMD_FL_CHEAT , " binds ragdoll at the current drag position " ) ;
cmdSystem - > AddCommand ( " unbindRagdoll " , Cmd_UnbindRagdoll_f , CMD_FL_GAME | CMD_FL_CHEAT , " unbinds the selected ragdoll " ) ;
cmdSystem - > AddCommand ( " saveLights " , Cmd_SaveLights_f , CMD_FL_GAME | CMD_FL_CHEAT , " saves all lights to the .map file " ) ;
cmdSystem - > AddCommand ( " saveParticles " , Cmd_SaveParticles_f , CMD_FL_GAME | CMD_FL_CHEAT , " saves all lights to the .map file " ) ;
cmdSystem - > AddCommand ( " clearLights " , Cmd_ClearLights_f , CMD_FL_GAME | CMD_FL_CHEAT , " clears all lights " ) ;
cmdSystem - > AddCommand ( " gameError " , Cmd_GameError_f , CMD_FL_GAME | CMD_FL_CHEAT , " causes a game error " ) ;
cmdSystem - > AddCommand ( " disasmScript " , Cmd_DisasmScript_f , CMD_FL_GAME | CMD_FL_CHEAT , " disassembles script " ) ;
cmdSystem - > AddCommand ( " recordViewNotes " , Cmd_RecordViewNotes_f , CMD_FL_GAME | CMD_FL_CHEAT , " record the current view position with notes " ) ;
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 " ) ;
cmdSystem - > AddCommand ( " closeViewNotes " , Cmd_CloseViewNotes_f , CMD_FL_GAME | CMD_FL_CHEAT , " close the view showing any notes for this map " ) ;
2012-11-26 18:58:24 +00:00
// multiplayer client commands ( replaces old impulses stuff )
//cmdSystem->AddCommand( "clientDropWeapon", idMultiplayerGame::DropWeapon_f, CMD_FL_GAME, "drop current weapon" );
cmdSystem - > AddCommand ( " clientMessageMode " , idMultiplayerGame : : MessageMode_f , CMD_FL_GAME , " ingame gui message mode " ) ;
// FIXME: implement
// cmdSystem->AddCommand( "clientVote", idMultiplayerGame::Vote_f, CMD_FL_GAME, "cast your vote: clientVote yes | no" );
// cmdSystem->AddCommand( "clientCallVote", idMultiplayerGame::CallVote_f, CMD_FL_GAME, "call a vote: clientCallVote si_.. proposed_value" );
cmdSystem - > AddCommand ( " clientVoiceChat " , idMultiplayerGame : : VoiceChat_f , CMD_FL_GAME , " voice chats: clientVoiceChat <sound shader> " ) ;
cmdSystem - > AddCommand ( " clientVoiceChatTeam " , idMultiplayerGame : : VoiceChatTeam_f , CMD_FL_GAME , " team voice chats: clientVoiceChat <sound shader> " ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// multiplayer server commands
cmdSystem - > AddCommand ( " serverMapRestart " , idGameLocal : : MapRestart_f , CMD_FL_GAME , " restart the current game " ) ;
2012-11-28 15:47:07 +00:00
2012-11-26 18:58:24 +00:00
// localization help commands
2012-11-28 15:47:07 +00:00
cmdSystem - > AddCommand ( " nextGUI " , Cmd_NextGUI_f , CMD_FL_GAME | CMD_FL_CHEAT , " teleport the player to the next func_static with a gui " ) ;
cmdSystem - > AddCommand ( " testid " , Cmd_TestId_f , CMD_FL_GAME | CMD_FL_CHEAT , " output the string for the specified id. " ) ;
cmdSystem - > AddCommand ( " setActorState " , Cmd_SetActorState_f , CMD_FL_GAME | CMD_FL_CHEAT , " Manually sets an actors script state " , idGameLocal : : ArgCompletion_EntityName ) ;
2012-11-26 18:58:24 +00:00
}
/*
= = = = = = = = = = = = = = = = =
idGameLocal : : ShutdownConsoleCommands
= = = = = = = = = = = = = = = = =
*/
2012-11-28 15:47:07 +00:00
void idGameLocal : : ShutdownConsoleCommands ( )
{
2012-11-26 18:58:24 +00:00
cmdSystem - > RemoveFlaggedCommands ( CMD_FL_GAME ) ;
}