本文整理汇总了C++中idCmdArgs::Argc方法的典型用法代码示例。如果您正苦于以下问题:C++ idCmdArgs::Argc方法的具体用法?C++ idCmdArgs::Argc怎么用?C++ idCmdArgs::Argc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idCmdArgs
的用法示例。
在下文中一共展示了idCmdArgs::Argc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Exec_f
/*
===============
idCmdSystemLocal::Exec_f
===============
*/
void idCmdSystemLocal::Exec_f( const idCmdArgs& args )
{
char* f;
int len;
idStr filename;
if( args.Argc() != 2 )
{
common->Printf( "exec <filename> : execute a script file\n" );
return;
}
filename = args.Argv( 1 );
filename.DefaultFileExtension( ".cfg" );
len = fileSystem->ReadFile( filename, reinterpret_cast<void**>( &f ), NULL );
if( !f )
{
common->Printf( "couldn't exec %s\n", args.Argv( 1 ) );
return;
}
common->Printf( "execing %s\n", args.Argv( 1 ) );
cmdSystemLocal.BufferCommandText( CMD_EXEC_INSERT, f );
fileSystem->FreeFile( f );
}
示例2: Command
/*
============
idCVarSystemLocal::Command
============
*/
bool idCVarSystemLocal::Command( const idCmdArgs &args )
{
idInternalCVar *internal;
internal = FindInternal( args.Argv( 0 ) );
if ( internal == NULL )
{
return false;
}
if ( args.Argc() == 1 )
{
// print the variable
common->Printf( "\"%s\" is:\"%s\"" S_COLOR_WHITE " default:\"%s\"\n",
internal->nameString.c_str(), internal->valueString.c_str(), internal->resetString.c_str() );
if ( idStr::Length( internal->GetDescription() ) > 0 )
{
common->Printf( S_COLOR_WHITE "%s\n", internal->GetDescription() );
}
}
else
{
// set the value
internal->Set( args.Args(), false, false );
}
return true;
}
示例3: TestAnim
/*
================
idTestModel::TestAnim
================
*/
void idTestModel::TestAnim( const idCmdArgs &args ) {
idStr name;
int animNum;
if ( args.Argc() < 2 ) {
gameLocal.Printf( "usage: testanim <animname>\n" );
return;
}
name = args.Argv( 1 );
#if 0
const idAnim *newanim = NULL;
if ( strstr( name, ".ma" ) || strstr( name, ".mb" ) ) {
const idMD5Anim *md5anims[ ANIM_MaxSyncedAnims ];
idModelExport exporter;
exporter.ExportAnim( name );
name.SetFileExtension( MD5_ANIM_EXT );
md5anims[ 0 ] = animationLib.GetAnim( name );
if ( md5anims[ 0 ] ) {
customAnim.SetAnim( animator.ModelDef(), name, name, 1, md5anims );
newanim = &customAnim;
}
} else {
animNum = animator.GetAnim( name );
}
#else
animNum = animator.GetAnim( name );
#endif
if ( !animNum ) {
gameLocal.Printf( "Animation '%s' not found.\n", name.c_str() );
return;
}
anim = animNum;
starttime = gameLocal.time;
animtime = animator.AnimLength( anim );
headAnim = 0;
if ( headAnimator ) {
headAnimator->ClearAllAnims( gameLocal.time, 0 );
headAnim = headAnimator->GetAnim( animname );
if ( !headAnim ) {
headAnim = headAnimator->GetAnim( "idle" );
if ( !headAnim ) {
gameLocal.Printf( "Missing 'idle' anim for head.\n" );
}
}
if ( headAnim && ( headAnimator->AnimLength( headAnim ) > animtime ) ) {
animtime = headAnimator->AnimLength( headAnim );
}
}
animname = name;
gameLocal.Printf( "anim '%s', %d.%03d seconds, %d frames\n", animname.c_str(), animator.AnimLength( anim ) / 1000, animator.AnimLength( anim ) % 1000, animator.NumFrames( anim ) );
// reset the anim
mode = -1;
}
示例4: RunAAS_f
/*
============
RunAAS_f
============
*/
void RunAAS_f( const idCmdArgs &args )
{
idAASBuild aas;
idAASSettings settings;
idStr mapName;
if( args.Argc() <= 1 )
{
common->Printf( "runAAS [options] <mapfile>\n"
"options:\n"
" -usePatches = use bezier patches for collision detection.\n"
" -writeBrushMap = write a brush map with the AAS geometry.\n"
" -playerFlood = use player spawn points as valid AAS positions.\n" );
return;
}
common->ClearWarnings( "compiling AAS" );
common->SetRefreshOnPrint( true );
// get the aas settings definitions
const idDict *dict = gameEdit->FindEntityDefDict( "aas_types", false );
if( !dict )
{
common->Error( "Unable to find entityDef for 'aas_types'" );
}
const idKeyValue *kv = dict->MatchPrefix( "type" );
while( kv != NULL )
{
const idDict *settingsDict = gameEdit->FindEntityDefDict( kv->GetValue(), false );
if( !settingsDict )
{
common->DWarning( "Unable to find '%s' in def/aas.def", kv->GetValue().c_str() );
}
else
{
settings.FromDict( kv->GetValue(), settingsDict );
int i = ParseOptions( args, settings );
mapName = args.Argv( i );
mapName.BackSlashesToSlashes();
if( mapName.Icmpn( "maps/", 4 ) != 0 )
{
mapName = "maps/" + mapName;
}
aas.Build( mapName, &settings );
}
kv = dict->MatchPrefix( "type", kv );
if( kv )
{
common->Printf( "=======================================================\n" );
}
}
common->SetRefreshOnPrint( false );
common->PrintWarnings();
}
示例5: Wait_f
/*
============
idCmdSystemLocal::Wait_f
Causes execution of the remainder of the command buffer to be delayed until next frame.
============
*/
void idCmdSystemLocal::Wait_f( const idCmdArgs &args ) {
if ( args.Argc() == 2 ) {
cmdSystemLocal.SetWait( atoi( args.Argv( 1 ) ) );
} else {
cmdSystemLocal.SetWait( 1 );
}
}
示例6: Set_f
/*
============
idCVarSystemLocal::Set_f
============
*/
void idCVarSystemLocal::Set_f( const idCmdArgs &args )
{
const char *str;
str = args.Args( 2, args.Argc() - 1 );
localCVarSystem.SetCVarString( args.Argv(1), str );
}
示例7: ListByFlags
void idCmdSystemLocal::ListByFlags( const idCmdArgs &args, cmdFlags_t flags ) {
int i;
idStr match;
const commandDef_t *cmd;
idList<const commandDef_t *> cmdList;
if ( args.Argc() > 1 ) {
match = args.Args( 1, -1 );
match.Replace( " ", "" );
} else {
match = "";
}
for ( cmd = cmdSystemLocal.GetCommands(); cmd; cmd = cmd->next ) {
if ( !( cmd->flags & flags ) ) {
continue;
}
if ( match.Length() && idStr( cmd->name ).Filter( match, false ) == 0 ) {
continue;
}
cmdList.Append( cmd );
}
cmdList.Sort();
for ( i = 0; i < cmdList.Num(); i++ ) {
cmd = cmdList[i];
common->Printf( " %-21s %s\n", cmd->name, cmd->description );
}
common->Printf( "%i commands\n", cmdList.Num() );
}
示例8: BlendAnim
/*
=====================
idTestModel::BlendAnim
=====================
*/
void idTestModel::BlendAnim( const idCmdArgs &args ) {
int anim1;
int anim2;
if ( args.Argc() < 4 ) {
gameLocal.Printf( "usage: testblend <anim1> <anim2> <frames>\n" );
return;
}
anim1 = gameLocal.testmodel->animator.GetAnim( args.Argv( 1 ) );
if ( !anim1 ) {
gameLocal.Printf( "Animation '%s' not found.\n", args.Argv( 1 ) );
return;
}
anim2 = gameLocal.testmodel->animator.GetAnim( args.Argv( 2 ) );
if ( !anim2 ) {
gameLocal.Printf( "Animation '%s' not found.\n", args.Argv( 2 ) );
return;
}
animname = args.Argv( 2 );
animator.CycleAnim( ANIMCHANNEL_ALL, anim1, gameLocal.time, 0 );
animator.CycleAnim( ANIMCHANNEL_ALL, anim2, gameLocal.time, FRAME2MS( atoi( args.Argv( 3 ) ) ) );
anim = anim2;
headAnim = 0;
}
示例9: Parse_f
/*
============
idCmdSystemLocal::Parse_f
This just prints out how the rest of the line was parsed, as a debugging tool.
============
*/
void idCmdSystemLocal::Parse_f( const idCmdArgs &args ) {
int i;
for ( i = 0; i < args.Argc(); i++ ) {
common->Printf( "%i: %s\n", i, args.Argv(i) );
}
}
示例10: RunReach_f
/*
============
RunReach_f
============
*/
void RunReach_f( const idCmdArgs &args ) {
int i;
idAASBuild aas;
idAASSettings settings;
if( args.Argc() <= 1 ) {
common->Printf( "runReach [options] <mapfile>\n" );
return;
}
common->ClearWarnings( "calculating AAS reachability" );
common->SetRefreshOnPrint( true );
// get the aas settings definitions
const idDict *dict = gameEdit->FindEntityDefDict( "aas_types", false );
if( !dict ) {
common->Error( "Unable to find entityDef for 'aas_types'" );
}
const idKeyValue *kv = dict->MatchPrefix( "type" );
while( kv != NULL ) {
const idDict *settingsDict = gameEdit->FindEntityDefDict( kv->GetValue(), false );
if( !settingsDict ) {
common->Warning( "Unable to find '%s' in def/aas.def", kv->GetValue().c_str() );
} else {
settings.FromDict( kv->GetValue(), settingsDict );
i = ParseOptions( args, settings );
aas.BuildReachability( idStr( "maps/" ) + args.Argv( i ), &settings );
}
kv = dict->MatchPrefix( "type", kv );
if( kv ) {
common->Printf( "=======================================================\n" );
}
}
common->SetRefreshOnPrint( false );
common->PrintWarnings();
}
示例11: TestSkin_f
/*
=================
idTestModel::TestSkin_f
Sets a skin on an existing testModel
=================
*/
void idTestModel::TestSkin_f( const idCmdArgs &args ) {
idVec3 offset;
idStr name;
idPlayer * player;
idDict dict;
player = gameLocal.GetLocalPlayer();
if ( !player || !gameLocal.CheatsOk() ) {
return;
}
// delete the testModel if active
if ( !gameLocal.testmodel ) {
common->Printf( "No active testModel\n" );
return;
}
if ( args.Argc() < 2 ) {
common->Printf( "removing testSkin.\n" );
gameLocal.testmodel->SetSkin( NULL );
return;
}
name = args.Argv( 1 );
gameLocal.testmodel->SetSkin( declManager->FindSkin( name ) );
}
示例12: TestModel_f
/*
=================
idTestModel::TestModel_f
Creates a static modelDef in front of the current position, which
can then be moved around
=================
*/
void idTestModel::TestModel_f( const idCmdArgs &args ) {
idVec3 offset;
idStr name;
idPlayer * player;
const idDict * entityDef;
idDict dict;
player = gameLocal.GetLocalPlayer();
if ( !player || !gameLocal.CheatsOk() ) {
return;
}
// delete the testModel if active
if ( gameLocal.testmodel ) {
delete gameLocal.testmodel;
gameLocal.testmodel = NULL;
}
if ( args.Argc() < 2 ) {
return;
}
name = args.Argv( 1 );
entityDef = gameLocal.FindEntityDefDict( name, false );
if ( entityDef ) {
dict = *entityDef;
} else {
if ( declManager->FindType( DECL_MODELDEF, name, false ) ) {
dict.Set( "model", name );
} else {
// allow map models with underscore prefixes to be tested during development
// without appending an ase
if ( name[ 0 ] != '_' ) {
name.DefaultFileExtension( ".ase" );
}
if ( strstr( name, ".ma" ) || strstr( name, ".mb" ) ) {
idModelExport exporter;
exporter.ExportModel( name );
name.SetFileExtension( MD5_MESH_EXT );
}
if ( !renderModelManager->CheckModel( name ) ) {
gameLocal.Printf( "Can't register model\n" );
return;
}
dict.Set( "model", name );
}
}
offset = player->GetPhysics()->GetOrigin() + player->viewAngles.ToForward() * 100.0f;
dict.Set( "origin", offset.ToString() );
dict.Set( "angle", va( "%f", player->viewAngles.yaw + 180.0f ) );
dict.Set( "def_head", g_testModelHead.GetString());
gameLocal.testmodel = ( idTestModel * )gameLocal.SpawnEntityType( idTestModel::Type, &dict );
gameLocal.testmodel->renderEntity.shaderParms[SHADERPARM_TIMEOFFSET] = -MS2SEC( gameLocal.time );
}
示例13: Echo_f
/*
===============
idCmdSystemLocal::Echo_f
Just prints the rest of the line to the console
===============
*/
void idCmdSystemLocal::Echo_f( const idCmdArgs &args ) {
int i;
for ( i = 1; i < args.Argc(); i++ ) {
common->Printf( "%s ", args.Argv( i ) );
}
common->Printf( "\n" );
}
示例14: Toggle_f
/*
============
idCVarSystemLocal::Toggle_f
============
*/
void idCVarSystemLocal::Toggle_f( const idCmdArgs &args ) {
int argc, i;
float current, set;
const char *text;
argc = args.Argc();
if ( argc < 2 ) {
common->Printf ("usage:\n"
" toggle <variable> - toggles between 0 and 1\n"
" toggle <variable> <value> - toggles between 0 and <value>\n"
" toggle <variable> [string 1] [string 2]...[string n] - cycles through all strings\n");
return;
}
idInternalCVar *cvar = localCVarSystem.FindInternal( args.Argv( 1 ) );
if ( cvar == NULL ) {
common->Warning( "Toggle_f: cvar \"%s\" not found", args.Argv( 1 ) );
return;
}
if ( argc > 3 ) {
// cycle through multiple values
text = cvar->GetString();
for( i = 2; i < argc; i++ ) {
if ( !idStr::Icmp( text, args.Argv( i ) ) ) {
// point to next value
i++;
break;
}
}
if ( i >= argc ) {
i = 2;
}
common->Printf( "set %s = %s\n", args.Argv(1), args.Argv( i ) );
cvar->Set( va("%s", args.Argv( i ) ), false, false );
} else {
// toggle between 0 and 1
current = cvar->GetFloat();
if ( argc == 3 ) {
set = atof( args.Argv( 2 ) );
} else {
set = 1.0f;
}
if ( current == 0.0f ) {
current = set;
} else {
current = 0.0f;
}
common->Printf( "set %s = %f\n", args.Argv(1), current );
cvar->Set( idStr( current ), false, false );
}
}
示例15: CompareGameState_f
/*
================
CompareGameState_f
================
*/
void CompareGameState_f( const idCmdArgs &args ) {
idStr fileName;
if ( args.Argc() > 1 ) {
fileName = args.Argv(1);
} else {
fileName = "GameState.txt";
}
fileName.SetFileExtension( "gameState.txt" );
idTypeInfoTools::CompareGameState( fileName );
}