Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //------------------------------------------------------------------------------
- function createCanvas(%windowTitle)
- {
- if ($isDedicated)
- {
- GFXInit::createNullDevice();
- return true;
- }
- // Create the Canvas
- %foo = new GuiCanvas(Canvas);
- return true;
- }
- //------------------------------------------------------------------------------
- // Check if a script file exists, compiled or not.
- function isScriptFile(%path)
- {
- if( isFile(%path @ ".dso") || isFile(%path) )
- return true;
- return false;
- }
- //-----------------------------------------------------------------------------
- // The displayHelp, onStart, onExit and parseArgs function are overriden
- // by mod packages to get hooked into initialization and cleanup.
- function onStart()
- {
- // Default startup function
- }
- function onExit()
- {
- // OnExit is called directly from C++ code, whereas onStart is
- // invoked at the end of this file.
- }
- function compileFiles(%pattern)
- {
- echo("\n--------- Compiling Files ---------");
- %path = filePath(%pattern);
- %saveDSO = $Scripts::OverrideDSOPath;
- %saveIgnore = $Scripts::ignoreDSOs;
- $Scripts::OverrideDSOPath = %path;
- $Scripts::ignoreDSOs = false;
- %mainCsFile = makeFullPath("main.cs");
- for (%file = findFirstFileMultiExpr(%pattern); %file !$= ""; %file = findNextFileMultiExpr(%pattern))
- {
- // we don't want to try and compile the primary main.cs
- if(%mainCsFile !$= %file)
- compile(%file, true);
- }
- $Scripts::OverrideDSOPath = %saveDSO;
- $Scripts::ignoreDSOs = %saveIgnore;
- }
- package Help {
- function onExit() {
- // Override onExit when displaying help
- }
- };
- function displayHelp() {
- activatePackage(Help);
- // Notes on logmode: console logging is written to console.log.
- // -log 0 disables console logging.
- // -log 1 appends to existing logfile; it also closes the file
- // (flushing the write buffer) after every write.
- // -log 2 overwrites any existing logfile; it also only closes
- // the logfile when the application shuts down. (default)
- error(
- "Torque Demo command line options:\n"@
- " -log <logmode> Logging behavior; see main.cs comments for details\n"@
- " -game <game_name> Reset list of mods to only contain <game_name>\n"@
- " <game_name> Works like the -game argument\n"@
- " -dir <dir_name> Add <dir_name> to list of directories\n"@
- " -console Open a separate console\n"@
- " -show <shape> Deprecated\n"@
- " -jSave <file_name> Record a journal\n"@
- " -jPlay <file_name> Play back a journal\n"@
- " -jDebug <file_name> Play back a journal and issue an int3 at the end\n"@
- " -help Display this help message\n"
- );
- }
- //------------------------------------------------------------------------------
- // Execute startup scripts for each mod, starting at base and working up
- function loadDir(%dir)
- {
- pushback($userDirs, %dir, ";");
- if (isScriptFile(%dir @ "/main.cs"))
- exec(%dir @ "/main.cs");
- }
- function loadDirs(%dirPath)
- {
- %dirPath = nextToken(%dirPath, token, ";");
- if (%dirPath !$= "")
- loadDirs(%dirPath);
- if(exec(%token @ "/main.cs") != true)
- {
- error("Error: Unable to find specified directory: " @ %token );
- $dirCount--;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement