Example #1
0
/*
============
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 );
}
/*
============
ParseOptions
============
*/
int ParseOptions( const idCmdArgs& args, idAASSettings& settings )
{
	int i;
	idStr str;
	
	for( i = 1; i < args.Argc(); i++ )
	{
	
		str = args.Argv( i );
		str.StripLeading( '-' );
		
		if( str.Icmp( "usePatches" ) == 0 )
		{
			settings.usePatches = true;
			common->Printf( "usePatches = true\n" );
		}
		else if( str.Icmp( "writeBrushMap" ) == 0 )
		{
			settings.writeBrushMap = true;
			common->Printf( "writeBrushMap = true\n" );
		}
		else if( str.Icmp( "playerFlood" ) == 0 )
		{
			settings.playerFlood = true;
			common->Printf( "playerFlood = true\n" );
		}
		else if( str.Icmp( "noOptimize" ) == 0 )
		{
			settings.noOptimize = true;
			common->Printf( "noOptimize = true\n" );
		}
	}
	return args.Argc() - 1;
}
Example #3
0
/*
====================
R_ModulateLights_f

Modifies the shaderParms on all the lights so the level
designers can easily test different color schemes
====================
*/
void R_ModulateLights_f( const idCmdArgs& args )
{
	if( !tr.primaryWorld )
	{
		return;
	}
	if( args.Argc() != 4 )
	{
		common->Printf( "usage: modulateLights <redFloat> <greenFloat> <blueFloat>\n" );
		return;
	}
	
	float modulate[3];
	for( int i = 0; i < 3; i++ )
	{
		modulate[i] = atof( args.Argv( i + 1 ) );
	}
	
	int count = 0;
	for( int i = 0; i < tr.primaryWorld->lightDefs.Num(); i++ )
	{
		idRenderLightLocal* light = tr.primaryWorld->lightDefs[i];
		if( light != NULL )
		{
			count++;
			for( int j = 0; j < 3; j++ )
			{
				light->parms.shaderParms[j] *= modulate[j];
			}
		}
	}
	common->Printf( "modulated %i lights\n", count );
}
Example #4
0
/*
============
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 );
	}
}
Example #5
0
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.Remove( ' ' );
	} 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() );
}
Example #6
0
/*
================
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;
}
Example #7
0
/*
============
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) );
	}
}
/*
============
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();
}
/*
=================
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 ) );
}
Example #10
0
/*
===============
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 );
}
Example #11
0
/*
============
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;
}
Example #12
0
/*
============
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();
}
Example #13
0
/*
=================
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 );
}
Example #14
0
/*
===============
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" );
}
Example #15
0
/*
============
idCmdSystemLocal::ArgCompletion_FolderExtension
============
*/
void idCmdSystemLocal::ArgCompletion_FolderExtension( const idCmdArgs &args, void(*callback)( const char *s ), const char *folder, bool stripFolder, ... ) {
    int i;
    idStr string;
    const char *extension;
    va_list argPtr;

    string = args.Argv( 0 );
    string += " ";
    string += args.Argv( 1 );
    common->FatalError("idCmdSystemLocal::ArgCompletion_FolderExtension TODO");
#ifdef TODO
    if ( string.Icmp( completionString ) != 0 ) {
        idStr parm, path;
        idFileList *names;

        completionString = string;
        completionParms.Clear();

        parm = args.Argv( 1 );
        parm.ExtractFilePath( path );
        if ( stripFolder || path.Length() == 0 ) {
            path = folder + path;
        }
        path.StripTrailing( '/' );

        // list folders
        names = fileSystem->ListFiles( path, "/", true, true );
        for ( i = 0; i < names->GetNumFiles(); i++ ) {
            idStr name = names->GetFile( i );
            if ( stripFolder ) {
                name.Strip( folder );
            } else {
                name.Strip( "/" );
            }
            name = args.Argv( 0 ) + ( " " + name ) + "/";
            completionParms.Append( name );
        }
        fileSystem->FreeFileList( names );

        // list files
        va_start( argPtr, stripFolder );
        for ( extension = va_arg( argPtr, const char * ); extension; extension = va_arg( argPtr, const char * ) ) {
            names = fileSystem->ListFiles( path, extension, true, true );
            for ( i = 0; i < names->GetNumFiles(); i++ ) {
                idStr name = names->GetFile( i );
                if ( stripFolder ) {
                    name.Strip( folder );
                } else {
                    name.Strip( "/" );
                }
                name = args.Argv( 0 ) + ( " " + name );
                completionParms.Append( name );
            }
            fileSystem->FreeFileList( names );
        }
        va_end( argPtr );
    }
Example #16
0
/*
============
idSIMD::Test_f
============
*/
void idSIMD::Test_f( const idCmdArgs &args ) {

	SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL );

	p_simd = processor;
	p_generic = generic;

	if ( idStr::Length( args.Argv( 1 ) ) != 0 ) {
		cpuid_t cpuid = idLib::sys->GetProcessorId();
		idStr argString = args.Args();

		argString.Replace( " ", "" );

		if ( idStr::Icmp( argString, "SSE" ) == 0 ) {
			if ( !( cpuid & CPUID_MMX ) || !( cpuid & CPUID_SSE ) ) {
				common->Printf( "CPU does not support MMX & SSE\n" );
				return;
			}
			p_simd = new (TAG_MATH) idSIMD_SSE;
		} else {
			common->Printf( "invalid argument, use: MMX, 3DNow, SSE, SSE2, SSE3, AltiVec\n" );
			return;
		}
	}

	idLib::common->SetRefreshOnPrint( true );

	idLib::common->Printf( "using %s for SIMD processing\n", p_simd->GetName() );

	GetBaseClocks();

	TestMath();
	TestMinMax();
	TestMemcpy();
	TestMemset();

	idLib::common->Printf("====================================\n" );

	TestBlendJoints();
	TestBlendJointsFast();
	TestConvertJointQuatsToJointMats();
	TestConvertJointMatsToJointQuats();
	TestTransformJoints();
	TestUntransformJoints();

	idLib::common->Printf("====================================\n" );

	idLib::common->SetRefreshOnPrint( false );

	if ( p_simd != processor ) {
		delete p_simd;
	}
	p_simd = NULL;
	p_generic = NULL;

	SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_NORMAL );
}
Example #17
0
/*
===================
idKeyInput::ArgCompletion_KeyName
===================
*/
void idKeyInput::ArgCompletion_KeyName( const idCmdArgs &args, void(*callback)( const char *s ) ) {
    keyname_t *kn;
    int i;

    for( i = 0; i < sizeof( unnamedkeys ) - 1; i++ ) {
        callback( va( "%s %c", args.Argv( 0 ), unnamedkeys[ i ] ) );
    }

    for ( kn = keynames; kn->name; kn++ ) {
        callback( va( "%s %s", args.Argv( 0 ), kn->name ) );
    }
}
/*
================
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 );
}
Example #19
0
/*
===============
idCmdSystemLocal::Vstr_f

Inserts the current value of a cvar as command text
===============
*/
void idCmdSystemLocal::Vstr_f( const idCmdArgs &args ) {
	const char *v;

	if ( args.Argc () != 2 ) {
		common->Printf( "vstr <variablename> : execute a variable command\n" );
		return;
	}

	v = cvarSystem->GetCVarString( args.Argv( 1 ) );

	cmdSystemLocal.BufferCommandText( CMD_EXEC_APPEND, va( "%s\n", v ) );
}
/*
================
idTestModel::TestAnim
================
*/
void idTestModel::TestAnim( const idCmdArgs& args )
{
	idStr			name;
	int				animNum;
	const idAnim*	newanim;
	
	if( args.Argc() < 2 )
	{
		gameLocal.Printf( "usage: testanim <animname>\n" );
		return;
	}
	
	newanim = NULL;
	
	name = args.Argv( 1 );
	animNum = animator.GetAnim( name );
	
	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;
}
/*
============
RunAAS_f
============
*/
void RunAAS_f( const idCmdArgs &args ) {
	int i;
	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->Warning( "Unable to find '%s' in def/aas.def", kv->GetValue().c_str() );
		} else {
			settings.FromDict( kv->GetValue(), settingsDict );
			i = ParseOptions( args, settings );
			mapName = args.Argv( i );
			mapName.BackSlashesToSlashes();
			if( mapName.Icmpn( "maps/", 4 ) != 0 ) {
				mapName = "maps/" + mapName;
			}
			// taaaki - support map files from darkmod/fms/<mission>/maps as well as darkmod/maps
			//          this is done by opening the file to get the true full path, then converting
			//          the path back to a RelativePath based off fs_devpath
			mapName.SetFileExtension( "map" );
			idFile *fp = idLib::fileSystem->OpenFileRead( mapName, "" );
			if( fp ) {
				mapName = idLib::fileSystem->OSPathToRelativePath( fp->GetFullPath() );
				idLib::fileSystem->CloseFile( fp );
			}
			aas.Build( mapName, &settings );
		}
		kv = dict->MatchPrefix( "type", kv );
		if( kv ) {
			common->Printf( "=======================================================\n" );
		}
	}
	common->SetRefreshOnPrint( false );
	common->PrintWarnings();
}
Example #22
0
/*
============
RunAASDir_f
============
*/
void RunAASDir_f( const idCmdArgs &args ) {
	int i;
	idAASBuild aas;
	idAASSettings settings;
	idFileList *mapFiles;

	if ( args.Argc() <= 1 ) {
		common->Printf( "runAASDir <folder>\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'" );
	}

	// scan for .map files
	mapFiles = fileSystem->ListFiles( idStr("maps/") + args.Argv(1), ".map" );

	// create AAS files for all the .map files
	for ( i = 0; i < mapFiles->GetNumFiles(); i++ ) {
		if ( i ) {
			common->Printf( "=======================================================\n" );
		}

		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 );
				aas.Build( idStr( "maps/" ) + args.Argv( 1 ) + "/" + mapFiles->GetFile( i ), &settings );
			}

			kv = dict->MatchPrefix( "type", kv );
			if ( kv ) {
				common->Printf( "=======================================================\n" );
			}
		}
	}

	fileSystem->FreeFileList( mapFiles );

	common->SetRefreshOnPrint( false );
	common->PrintWarnings();
}
Example #23
0
/*
============
Key_BindUnBindTwo_f

binds keynum to bindcommand and unbinds if there are already two binds on the key
============
*/
void Key_BindUnBindTwo_f( const idCmdArgs &args ) {
    int c = args.Argc();
    if ( c < 3 ) {
        common->Printf( "bindunbindtwo <keynum> [command]\n" );
        return;
    }
    int key = atoi( args.Argv( 1 ) );
    idStr bind = args.Argv( 2 );
    if ( idKeyInput::NumBinds( bind ) >= 2 && !idKeyInput::KeyIsBoundTo( key, bind ) ) {
        idKeyInput::UnbindBinding( bind );
    }
    idKeyInput::SetBinding( key, bind );
}
Example #24
0
/*
=====================
idTestModel::ArgCompletion_TestModel
=====================
*/
void idTestModel::ArgCompletion_TestModel( const idCmdArgs &args, void(*callback)( const char *s ) ) {
	int i, num;

	num = declManager->GetNumDecls( DECL_ENTITYDEF );
	for ( i = 0; i < num; i++ ) {
		callback( idStr( args.Argv( 0 ) ) + " " + declManager->DeclByIndex( DECL_ENTITYDEF, i , false )->GetName() );
	}
	num = declManager->GetNumDecls( DECL_MODELDEF );
	for ( i = 0; i < num; i++ ) {
		callback( idStr( args.Argv( 0 ) ) + " " + declManager->DeclByIndex( DECL_MODELDEF, i , false )->GetName() );
	}
	cmdSystem->ArgCompletion_FolderExtension( args, callback, "models/", false, ".lwo", ".ase", ".md5mesh", ".ma", ".mb", NULL );
}
Example #25
0
/*
==============
idRenderModelManagerLocal::PrintModel_f
==============
*/
void idRenderModelManagerLocal::PrintModel_f( const idCmdArgs &args ) {
	idRenderModel	*model;
	if( args.Argc() != 2 ) {
		common->Printf( "usage: printModel <modelName>\n" );
		return;
	}
	model = renderModelManager->CheckModel( args.Argv( 1 ) );
	if( !model ) {
		common->Printf( "model \"%s\" not found\n", args.Argv( 1 ) );
		return;
	}
	model->Print();
}
Example #26
0
/*
====================
MakeMegaTexture_f

Incrementally load a giant tga file and process into the mega texture block format
====================
*/
void idMegaTexture::MakeMegaTexture_f( const idCmdArgs &args ) {
	int			columns, rows, fileSize, numBytes;
	byte		*pixbuf;
	int			row, column;
	TargaHeader	targa_header;
	if( args.Argc() != 2 ) {
		common->Printf( "USAGE: makeMegaTexture <filebase>\n" );
		return;
	}
	idStr	name_s = "megaTextures/";
	name_s += args.Argv( 1 );
	name_s.StripFileExtension();
	name_s += ".tga";
	const char	*name = name_s.c_str();
	//
	// open the file
	//
	common->Printf( "Opening %s.\n", name );
	fileSize = fileSystem->ReadFile( name, NULL, NULL );
	idFile	*file = fileSystem->OpenFileRead( name );
	if( !file ) {
		common->Printf( "Couldn't open %s\n", name );
		return;
	}
	targa_header.id_length = ReadByte( file );
	targa_header.colormap_type = ReadByte( file );
	targa_header.image_type = ReadByte( file );
	targa_header.colormap_index = ReadShort( file );
	targa_header.colormap_length = ReadShort( file );
	targa_header.colormap_size = ReadByte( file );
	targa_header.x_origin = ReadShort( file );
	targa_header.y_origin = ReadShort( file );
	targa_header.width = ReadShort( file );
	targa_header.height = ReadShort( file );
	targa_header.pixel_size = ReadByte( file );
	targa_header.attributes = ReadByte( file );
	if( targa_header.image_type != 2 && targa_header.image_type != 10 && targa_header.image_type != 3 ) {
		common->Error( "LoadTGA( %s ): Only type 2 (RGB), 3 (gray), and 10 (RGB) TGA images supported\n", name );
	}
	if( targa_header.colormap_type != 0 ) {
		common->Error( "LoadTGA( %s ): colormaps not supported\n", name );
	}
	if( ( targa_header.pixel_size != 32 && targa_header.pixel_size != 24 ) && targa_header.image_type != 3 ) {
		common->Error( "LoadTGA( %s ): Only 32 or 24 bit images supported (no colormaps)\n", name );
	}
	if( targa_header.image_type == 2 || targa_header.image_type == 3 ) {
		numBytes = targa_header.width * targa_header.height * ( targa_header.pixel_size >> 3 );
		if( numBytes > fileSize - 18 - targa_header.id_length ) {
			common->Error( "LoadTGA( %s ): incomplete file\n", name );
		}
	}
Example #27
0
/*
===============
R_ReloadImages_f

Regenerate all images that came directly from files that have changed, so
any saved changes will show up in place.

New r_texturesize/r_texturedepth variables will take effect on reload

reloadImages <all>
===============
*/
void R_ReloadImages_f( const idCmdArgs &args ) {
	bool all = false;

	if ( args.Argc() == 2 ) {
		if ( !idStr::Icmp( args.Argv(1), "all" ) ) {
			all = true;
		} else {
			common->Printf( "USAGE: reloadImages <all>\n" );
			return;
		}
	}

	globalImages->ReloadImages( all );
}
Example #28
0
/*
============
idCVarSystemLocal::Reset_f
============
*/
void idCVarSystemLocal::Reset_f( const idCmdArgs &args ) {
	idInternalCVar *cvar;

	if ( args.Argc() != 2 ) {
		common->Printf ("usage: reset <variable>\n");
		return;
	}
	cvar = localCVarSystem.FindInternal( args.Argv( 1 ) );
	if ( !cvar ) {
		return;
	}

	cvar->Reset();
}
Example #29
0
/*
============
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 );
	}
}
Example #30
0
/*
==============
Con_Dump_f
==============
*/
static void Con_Dump_f( const idCmdArgs& args )
{
	if( args.Argc() != 2 )
	{
		common->Printf( "usage: conDump <filename>\n" );
		return;
	}
	
	idStr fileName = args.Argv( 1 );
	fileName.DefaultFileExtension( ".txt" );
	
	common->Printf( "Dumped console text to %s.\n", fileName.c_str() );
	
	localConsole.Dump( fileName.c_str() );
}