mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 08:04:40 +00:00
Merge pull request #495 from JeffProgrammer/tsneo
TorqueScript Interpreter 2.0
This commit is contained in:
commit
6487e2eede
309 changed files with 9842 additions and 10062 deletions
|
|
@ -143,6 +143,7 @@ function parseMissionGroupForIds( %className, %childGroup )
|
|||
if(!isObject(%currentGroup))
|
||||
return "";
|
||||
|
||||
%classIds = "";
|
||||
for(%i = 0; %i < (%currentGroup).getCount(); %i++)
|
||||
{
|
||||
if( (%currentGroup).getObject(%i).getClassName() $= %className )
|
||||
|
|
|
|||
|
|
@ -193,6 +193,9 @@ function resetMission()
|
|||
|
||||
clearServerPaths();
|
||||
|
||||
// TODO: Is this right?
|
||||
%client = ClientGroup.getObject(0);
|
||||
|
||||
// Inform the game code we're resetting.
|
||||
%hasGameMode = callGamemodeFunction("onMissionReset", %client);
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
%guiContent = new GuiControl(ConsoleDlg) {
|
||||
$guiContent = new GuiControl(ConsoleDlg) {
|
||||
position = "0 0";
|
||||
extent = "1024 768";
|
||||
minExtent = "8 8";
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ function ConsoleEntry::eval()
|
|||
&& !startsWith(%text, "for(")
|
||||
&& !startsWith(%text, "switch(")
|
||||
&& !startsWith(%text, "switch$("))
|
||||
eval("%result = " @ %text);
|
||||
%result = eval("return" SPC %text);
|
||||
else
|
||||
eval(%text);
|
||||
$Con::warnVoidAssignment = %oldWarnVoidAssignment;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ function PostFXManager::loadPresetFile()
|
|||
{
|
||||
//Show the dialog and set the flag
|
||||
getLoadFilename($PostFXManager::fileFilter, "PostFXManager::loadPresetHandler");
|
||||
$PostFXManager::currentPreset = $Tools::FileDialogs::LastFilePath();
|
||||
$PostFXManager::currentPreset = $Tools::FileDialogs::LastFilePath;
|
||||
}
|
||||
|
||||
function PostFXManager::loadPresetHandler( %filename )
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ function findGameObject(%name)
|
|||
|
||||
//%assetName = AssetDatabase.getAssetName(%assetId);
|
||||
|
||||
if(%assetId $= %name)
|
||||
if(%assetId $= %name)
|
||||
{
|
||||
%gameObjectAsset = AssetDatabase.acquireAsset(%assetId);
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ function spawnGameObject(%name, %addToScene)
|
|||
%go.setHidden(false);
|
||||
%go.setScopeAlways();
|
||||
|
||||
if(%addToMissionGroup == true) //save instance when saving level
|
||||
if(%addToScene == true) //save instance when saving level
|
||||
getScene(0).add(%go);
|
||||
else // clear instance on level exit
|
||||
MissionCleanup.add(%go);
|
||||
|
|
|
|||
|
|
@ -524,7 +524,9 @@ function loadDir(%dir)
|
|||
|
||||
function loadDirs(%dirPath)
|
||||
{
|
||||
%dirPath = nextToken(%dirPath, token, ";");
|
||||
%dirPath = nextToken(%dirPath, "$token", ";");
|
||||
%token = $token;
|
||||
|
||||
if (%dirPath !$= "")
|
||||
loadDirs(%dirPath);
|
||||
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@ function popFront(%list, %delim)
|
|||
|
||||
function parseArgs()
|
||||
{
|
||||
for ($i = 1; $i < $Game::argc ; $i++)
|
||||
for (%i = 1; %i < $Game::argc ; %i++)
|
||||
{
|
||||
$arg = $Game::argv[$i];
|
||||
$nextArg = $Game::argv[$i+1];
|
||||
$hasNextArg = $Game::argc - $i > 1;
|
||||
$arg = $Game::argv[%i];
|
||||
$nextArg = $Game::argv[%i+1];
|
||||
$hasNextArg = $Game::argc - %i > 1;
|
||||
$logModeSpecified = false;
|
||||
|
||||
// Check for dedicated run
|
||||
|
|
@ -55,7 +55,7 @@ function parseArgs()
|
|||
{
|
||||
$userDirs = $defaultGame;
|
||||
$dirCount = 1;
|
||||
$isDedicated = true;
|
||||
%isDedicated = true;
|
||||
}*/
|
||||
|
||||
switch$ ($arg)
|
||||
|
|
@ -64,15 +64,15 @@ function parseArgs()
|
|||
case "-dedicated":
|
||||
$userDirs = $defaultGame;
|
||||
$dirCount = 1;
|
||||
$isDedicated = true;
|
||||
%isDedicated = true;
|
||||
$Server::Dedicated = true;
|
||||
enableWinConsole(true);
|
||||
$argUsed[%i]++;
|
||||
|
||||
|
||||
//--------------------
|
||||
case "-mission":
|
||||
$argUsed[%i]++;
|
||||
if ($hasNextArg)
|
||||
if ($hasNextArg)
|
||||
{
|
||||
$missionArg = $nextArg;
|
||||
$argUsed[%i+1]++;
|
||||
|
|
@ -84,7 +84,7 @@ function parseArgs()
|
|||
//--------------------
|
||||
case "-connect":
|
||||
$argUsed[%i]++;
|
||||
if ($hasNextArg)
|
||||
if ($hasNextArg)
|
||||
{
|
||||
$JoinGameAddress = $nextArg;
|
||||
$argUsed[%i+1]++;
|
||||
|
|
@ -93,10 +93,10 @@ function parseArgs()
|
|||
else
|
||||
error("Error: Missing Command Line argument. Usage: -connect <ip_address>");
|
||||
|
||||
|
||||
|
||||
//--------------------
|
||||
case "-log":
|
||||
$argUsed[$i]++;
|
||||
$argUsed[%i]++;
|
||||
if ($hasNextArg)
|
||||
{
|
||||
// Turn on console logging
|
||||
|
|
@ -107,22 +107,22 @@ function parseArgs()
|
|||
}
|
||||
setLogMode($nextArg);
|
||||
$logModeSpecified = true;
|
||||
$argUsed[$i+1]++;
|
||||
$i++;
|
||||
$argUsed[%i+1]++;
|
||||
%i++;
|
||||
}
|
||||
else
|
||||
error("Error: Missing Command Line argument. Usage: -log <Mode: 0,1,2>");
|
||||
|
||||
//--------------------
|
||||
case "-dir":
|
||||
$argUsed[$i]++;
|
||||
$argUsed[%i]++;
|
||||
if ($hasNextArg)
|
||||
{
|
||||
// Append the mod to the end of the current list
|
||||
$userDirs = strreplace($userDirs, $nextArg, "");
|
||||
$userDirs = pushFront($userDirs, $nextArg, ";");
|
||||
$argUsed[$i+1]++;
|
||||
$i++;
|
||||
$argUsed[%i+1]++;
|
||||
%i++;
|
||||
$dirCount++;
|
||||
}
|
||||
else
|
||||
|
|
@ -130,15 +130,15 @@ function parseArgs()
|
|||
|
||||
//--------------------
|
||||
// changed the default behavior of this command line arg. It now
|
||||
// defaults to ONLY loading the game, not tools
|
||||
// defaults to ONLY loading the game, not tools
|
||||
// default auto-run already loads in tools --SRZ 11/29/07
|
||||
case "-game":
|
||||
$argUsed[$i]++;
|
||||
$argUsed[%i]++;
|
||||
if ($hasNextArg)
|
||||
{
|
||||
// Set the selected dir --NOTE: we no longer allow tools with this argument
|
||||
/*
|
||||
if( $isDedicated )
|
||||
/*
|
||||
if( %isDedicated )
|
||||
{
|
||||
$userDirs = $nextArg;
|
||||
$dirCount = 1;
|
||||
|
|
@ -151,8 +151,8 @@ function parseArgs()
|
|||
*/
|
||||
$userDirs = $nextArg;
|
||||
$dirCount = 1;
|
||||
$argUsed[$i+1]++;
|
||||
$i++;
|
||||
$argUsed[%i+1]++;
|
||||
%i++;
|
||||
error($userDirs);
|
||||
}
|
||||
else
|
||||
|
|
@ -161,121 +161,121 @@ function parseArgs()
|
|||
//--------------------
|
||||
case "-console":
|
||||
enableWinConsole(true);
|
||||
$argUsed[$i]++;
|
||||
$argUsed[%i]++;
|
||||
|
||||
//--------------------
|
||||
case "-jSave":
|
||||
$argUsed[$i]++;
|
||||
$argUsed[%i]++;
|
||||
if ($hasNextArg)
|
||||
{
|
||||
echo("Saving event log to journal: " @ $nextArg);
|
||||
saveJournal($nextArg);
|
||||
$argUsed[$i+1]++;
|
||||
$i++;
|
||||
$argUsed[%i+1]++;
|
||||
%i++;
|
||||
}
|
||||
else
|
||||
error("Error: Missing Command Line argument. Usage: -jSave <journal_name>");
|
||||
|
||||
//--------------------
|
||||
case "-jPlay":
|
||||
$argUsed[$i]++;
|
||||
$argUsed[%i]++;
|
||||
if ($hasNextArg)
|
||||
{
|
||||
playJournal($nextArg);
|
||||
$argUsed[$i+1]++;
|
||||
$i++;
|
||||
$argUsed[%i+1]++;
|
||||
%i++;
|
||||
}
|
||||
else
|
||||
error("Error: Missing Command Line argument. Usage: -jPlay <journal_name>");
|
||||
|
||||
|
||||
//--------------------
|
||||
case "-jPlayToVideo":
|
||||
$argUsed[$i]++;
|
||||
$argUsed[%i]++;
|
||||
if ($hasNextArg)
|
||||
{
|
||||
$VideoCapture::journalName = $nextArg;
|
||||
$VideoCapture::captureFromJournal = true;
|
||||
$argUsed[$i+1]++;
|
||||
$i++;
|
||||
$argUsed[%i+1]++;
|
||||
%i++;
|
||||
}
|
||||
else
|
||||
error("Error: Missing Command Line argument. Usage: -jPlayToVideo <journal_name>");
|
||||
|
||||
|
||||
//--------------------
|
||||
case "-vidCapFile":
|
||||
$argUsed[$i]++;
|
||||
$argUsed[%i]++;
|
||||
if ($hasNextArg)
|
||||
{
|
||||
$VideoCapture::fileName = $nextArg;
|
||||
$argUsed[$i+1]++;
|
||||
$i++;
|
||||
$argUsed[%i+1]++;
|
||||
%i++;
|
||||
}
|
||||
else
|
||||
error("Error: Missing Command Line argument. Usage: -vidCapFile <ouput_video_name>");
|
||||
|
||||
|
||||
//--------------------
|
||||
case "-vidCapFPS":
|
||||
$argUsed[$i]++;
|
||||
$argUsed[%i]++;
|
||||
if ($hasNextArg)
|
||||
{
|
||||
$VideoCapture::fps = $nextArg;
|
||||
$argUsed[$i+1]++;
|
||||
$i++;
|
||||
$argUsed[%i+1]++;
|
||||
%i++;
|
||||
}
|
||||
else
|
||||
error("Error: Missing Command Line argument. Usage: -vidCapFPS <ouput_video_framerate>");
|
||||
|
||||
|
||||
//--------------------
|
||||
case "-vidCapEncoder":
|
||||
$argUsed[$i]++;
|
||||
$argUsed[%i]++;
|
||||
if ($hasNextArg)
|
||||
{
|
||||
$VideoCapture::encoder = $nextArg;
|
||||
$argUsed[$i+1]++;
|
||||
$i++;
|
||||
$argUsed[%i+1]++;
|
||||
%i++;
|
||||
}
|
||||
else
|
||||
error("Error: Missing Command Line argument. Usage: -vidCapEncoder <ouput_video_encoder>");
|
||||
|
||||
|
||||
//--------------------
|
||||
case "-vidCapWidth":
|
||||
$argUsed[$i]++;
|
||||
$argUsed[%i]++;
|
||||
if ($hasNextArg)
|
||||
{
|
||||
$videoCapture::width = $nextArg;
|
||||
$argUsed[$i+1]++;
|
||||
$i++;
|
||||
$argUsed[%i+1]++;
|
||||
%i++;
|
||||
}
|
||||
else
|
||||
error("Error: Missing Command Line argument. Usage: -vidCapWidth <ouput_video_width>");
|
||||
|
||||
|
||||
//--------------------
|
||||
case "-vidCapHeight":
|
||||
$argUsed[$i]++;
|
||||
$argUsed[%i]++;
|
||||
if ($hasNextArg)
|
||||
{
|
||||
$videoCapture::height = $nextArg;
|
||||
$argUsed[$i+1]++;
|
||||
$i++;
|
||||
$argUsed[%i+1]++;
|
||||
%i++;
|
||||
}
|
||||
else
|
||||
error("Error: Missing Command Line argument. Usage: -vidCapHeight <ouput_video_height>");
|
||||
|
||||
//--------------------
|
||||
case "-level":
|
||||
$argUsed[$i]++;
|
||||
$argUsed[%i]++;
|
||||
if ($hasNextArg)
|
||||
{
|
||||
%hasExt = strpos($nextArg, ".mis");
|
||||
if(%hasExt == -1)
|
||||
{
|
||||
$levelToLoad = $nextArg @ " ";
|
||||
|
||||
for(%i = $i + 2; %i < $Game::argc; %i++)
|
||||
|
||||
for(%j = %i + 2; %j < $Game::argc; %j++)
|
||||
{
|
||||
$arg = $Game::argv[%i];
|
||||
$arg = $Game::argv[%j];
|
||||
%hasExt = strpos($arg, ".mis");
|
||||
|
||||
|
||||
if(%hasExt == -1)
|
||||
{
|
||||
$levelToLoad = $levelToLoad @ $arg @ " ";
|
||||
|
|
@ -285,14 +285,14 @@ function parseArgs()
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$levelToLoad = $nextArg;
|
||||
}
|
||||
|
||||
$argUsed[$i+1]++;
|
||||
$i++;
|
||||
|
||||
$argUsed[%i+1]++;
|
||||
%i++;
|
||||
}
|
||||
else
|
||||
error("Error: Missing Command Line argument. Usage: -level <level file name (no path), with or without extension>");
|
||||
|
|
@ -300,33 +300,33 @@ function parseArgs()
|
|||
//-------------------
|
||||
case "-worldeditor":
|
||||
$startWorldEditor = true;
|
||||
$argUsed[$i]++;
|
||||
$argUsed[%i]++;
|
||||
|
||||
//-------------------
|
||||
case "-guieditor":
|
||||
$startGUIEditor = true;
|
||||
$argUsed[$i]++;
|
||||
$argUsed[%i]++;
|
||||
|
||||
//-------------------
|
||||
case "-help":
|
||||
$displayHelp = true;
|
||||
$argUsed[$i]++;
|
||||
$argUsed[%i]++;
|
||||
|
||||
//-------------------
|
||||
case "-compileAll":
|
||||
$compileAll = true;
|
||||
$argUsed[$i]++;
|
||||
|
||||
$argUsed[%i]++;
|
||||
|
||||
//-------------------
|
||||
case "-compileTools":
|
||||
$compileTools = true;
|
||||
$argUsed[$i]++;
|
||||
$argUsed[%i]++;
|
||||
|
||||
//-------------------
|
||||
case "-genScript":
|
||||
$genScript = true;
|
||||
$argUsed[$i]++;
|
||||
|
||||
$argUsed[%i]++;
|
||||
|
||||
case "-fullscreen":
|
||||
$cliFullscreen = true;
|
||||
$argUsed[%i]++;
|
||||
|
|
@ -357,36 +357,36 @@ function parseArgs()
|
|||
else
|
||||
error("Error: Missing Command Line argument. Usage: -prefs <path/script." @ $TorqueScriptFileExtension @ ">");
|
||||
|
||||
|
||||
|
||||
//-------------------
|
||||
default:
|
||||
$argUsed[$i]++;
|
||||
$argUsed[%i]++;
|
||||
if($userDirs $= "")
|
||||
$userDirs = $arg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------
|
||||
// Play journal to video file?
|
||||
if ($VideoCapture::captureFromJournal && $VideoCapture::journalName !$= "")
|
||||
{
|
||||
{
|
||||
if ($VideoCapture::fileName $= "")
|
||||
$VideoCapture::fileName = $VideoCapture::journalName;
|
||||
|
||||
$VideoCapture::fileName = $VideoCapture::journalName;
|
||||
|
||||
if ($VideoCapture::encoder $= "")
|
||||
$VideoCapture::encoder = "THEORA";
|
||||
|
||||
|
||||
if ($VideoCapture::fps $= "")
|
||||
$VideoCapture::fps = 30;
|
||||
|
||||
|
||||
if ($videoCapture::width $= "")
|
||||
$videoCapture::width = 0;
|
||||
|
||||
|
||||
if ($videoCapture::height $= "")
|
||||
$videoCapture::height = 0;
|
||||
|
||||
playJournalToVideo( $VideoCapture::journalName, $VideoCapture::fileName,
|
||||
$VideoCapture::encoder, $VideoCapture::fps,
|
||||
|
||||
playJournalToVideo( $VideoCapture::journalName, $VideoCapture::fileName,
|
||||
$VideoCapture::encoder, $VideoCapture::fps,
|
||||
$videoCapture::width SPC $videoCapture::height );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
function callGamemodeFunction(%gameModeFuncName, %arg0, %arg1, %arg2, %arg3, %arg4, %arg5, %arg6)
|
||||
{
|
||||
if(%data !$= "")
|
||||
%data = "\""@%data@"\"";
|
||||
|
||||
%activeSceneCount = getSceneCount();
|
||||
|
||||
%hasGameMode = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue