//========= Copyright Valve Corporation, All rights reserved. ============// // // Purpose: // // $NoKeywords: $ //===========================================================================// #include "tier0/platform.h" #include "sys.h" #include "testscriptmgr.h" #include "tier0/dbg.h" #include "filesystem_engine.h" #include "tier1/strtools.h" #include "cmd.h" #include "convar.h" #include "vstdlib/random.h" #include #if defined( _X360 ) #include "xbox/xbox_win32stubs.h" #endif // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" CTestScriptMgr g_TestScriptMgr; ConVar testscript_debug( "testscript_debug", "0", 0, "Debug test scripts." ); #ifdef _DEBUG // --------------------------------------------------------------------------------------------------- // // Global console commands the test script manager implements. // --------------------------------------------------------------------------------------------------- // CON_COMMAND_EXTERN( Test_Wait, Test_Wait, "" ) { if ( args.ArgC() < 2 ) { Error( "Test_Wait: requires seconds parameter." ); return; } float flSeconds = atof( args[ 1 ] ); GetTestScriptMgr()->SetWaitTime( flSeconds ); } CON_COMMAND_EXTERN( Test_RunFrame, Test_RunFrame, "" ) { GetTestScriptMgr()->SetWaitCheckPoint( "frame_end" ); } CON_COMMAND_EXTERN( Test_WaitForCheckPoint, Test_WaitForCheckPoint, "" ) { if ( args.ArgC() < 2 ) { Error( "Test_WaitForCheckPoint [once]: requires checkpoint name." ); return; } bool bOnce = ( args.ArgC() >= 3 && Q_stricmp( args[2], "once" ) == 0 ); GetTestScriptMgr()->SetWaitCheckPoint( args[ 1 ], bOnce ); } CON_COMMAND_EXTERN( Test_StartLoop, Test_StartLoop, "Test_StartLoop - Denote the start of a loop. Really just defines a named point you can jump to." ) { if ( args.ArgC() < 2 ) { Error( "Test_StartLoop: requires a loop name." ); return; } GetTestScriptMgr()->StartLoop( args[ 1 ] ); } CON_COMMAND_EXTERN( Test_LoopCount, Test_LoopCount, "Test_LoopCount - loop back to the specified loop start point the specified # of times." ) { if ( args.ArgC() < 3 ) { Error( "Test_LoopCount: requires a loop name and number of times to loop." ); return; } GetTestScriptMgr()->LoopCount( args[ 1 ], atoi( args[ 2 ] ) ); } CON_COMMAND_EXTERN( Test_Loop, Test_Loop, "Test_Loop - loop back to the specified loop start point unconditionally." ) { if ( args.ArgC() < 2 ) { Error( "Test_Loop: requires a loop name." ); return; } GetTestScriptMgr()->LoopCount( args[ 1 ], -1 ); } CON_COMMAND_EXTERN( Test_LoopForNumSeconds, Test_LoopForNumSeconds, "Test_LoopForNumSeconds