Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Read the level file and find the level object strings, then create the action object via eval so we
- // can extract the params from it and load them into global vars
- function Torque::getLevelInfo( %this, %missionFile )
- {
- %file = new FileObject();
- %LevelInfoObject = "";
- if ( %file.openForRead( %missionFile ) )
- {
- %inInfoBlock = false;
- while ( !%file.isEOF() )
- {
- %line = %file.readLine();
- %line = trim( %line );
- if( %line $= "new ScriptObject(LevelInfo) {" )
- %inInfoBlock = true;
- else if( %line $= "new LevelInfo(theLevelInfo) {" )
- %inInfoBlock = true;
- else if( %inInfoBlock && %line $= "};" ) {
- %inInfoBlock = false;
- %LevelInfoObject = %LevelInfoObject @ %line;
- break;
- }
- if( %inInfoBlock )
- %LevelInfoObject = %LevelInfoObject @ %line @ " ";
- }
- %file.close();
- }
- %file.delete();
- if( %LevelInfoObject !$= "" )
- {
- %LevelInfoObject = "%LevelInfoObject = " @ %LevelInfoObject;
- eval( %LevelInfoObject );
- return %LevelInfoObject;
- }
- // Didn't find our LevelInfo
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement