Sfoglia il codice sorgente

followup: readd, and rename the module.ScriptFile entries to thier lower case

AzaezelX 4 anni fa
parent
commit
817f01ff92

+ 8 - 0
Templates/BaseGame/game/core/core.module

@@ -0,0 +1,8 @@
+<ModuleDefinition
+	ModuleId="CoreModule"
+	VersionId="1"
+	Description="Module that implements the core engine-level setup for the game."
+	ScriptFile="core"
+	CreateFunction="onCreate"
+	DestroyFunction="onDestroy"
+	Group="Core"/>

+ 86 - 0
Templates/BaseGame/game/core/core.tscript

@@ -0,0 +1,86 @@
+
+function CoreModule::onCreate(%this)
+{
+   // ----------------------------------------------------------------------------
+   // Initialize core sub system functionality such as audio, the Canvas, PostFX,
+   // rendermanager, light managers, etc.
+   //
+   // Note that not all of these need to be initialized before the client, although
+   // the audio should and the canvas definitely needs to be.  I've put things here
+   // to distinguish between the purpose and functionality of the various client
+   // scripts.  Game specific script isn't needed until we reach the shell menus
+   // and start a game or connect to a server. We get the various subsystems ready
+   // to go, and then use initClient() to handle the rest of the startup sequence.
+   //
+   // If this is too convoluted we can reduce this complexity after futher testing
+   // to find exactly which subsystems should be readied before kicking things off. 
+   // ----------------------------------------------------------------------------
+   
+   new Settings(ProjectSettings) { file = "core/settings.xml"; };
+   ProjectSettings.read();
+   
+   ModuleDatabase.LoadExplicit( "Core_Rendering" );
+   ModuleDatabase.LoadExplicit( "Core_Utility" );
+   ModuleDatabase.LoadExplicit( "Core_GUI" );
+   ModuleDatabase.LoadExplicit( "Core_Lighting" );
+   ModuleDatabase.LoadExplicit( "Core_SFX" );
+   ModuleDatabase.LoadExplicit( "Core_PostFX" );
+   ModuleDatabase.LoadExplicit( "Core_GameObjects" );
+   
+   exec("data/defaults." @ $TorqueScriptFileExtension);
+   %prefPath = getPrefpath();
+   if ( isFile( %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension ) )
+      exec( %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension );
+      
+   // Seed the random number generator.
+   setRandomSeed();
+   
+   // Parse the command line arguments
+   echo("\n--------- Parsing Arguments ---------");
+   parseArgs();
+   
+   // The canvas needs to be initialized before any gui scripts are run since
+   // some of the controls assume that the canvas exists at load time.
+   createCanvas($appName);
+
+   //load canvas
+   //exec("./console/main." @ $TorqueScriptFileExtension);
+
+   ModuleDatabase.LoadExplicit( "Core_Console" );
+   
+   // Init the physics plugin.
+   physicsInit();
+
+   sfxStartup();
+
+   // Set up networking.
+   setNetPort(0);
+
+   // Start processing file change events.   
+   startFileChangeNotifications();
+   
+   // If we have editors, initialize them here as well
+   if (isToolBuild())
+   {
+      if(isFile("tools/main." @ $TorqueScriptFileExtension) && !$isDedicated)
+         exec("tools/main." @ $TorqueScriptFileExtension);
+   }
+   
+   //This is used to build the remap keybind sets for the different actionMaps.
+   $RemapCount = 0;
+}
+
+function CoreModule::onDestroy(%this)
+{
+
+}
+
+//-----------------------------------------------------------------------------
+// Called when the engine is shutting down.
+function onExit() 
+{
+   // Stop file change events.
+   stopFileChangeNotifications();
+   
+   ModuleDatabase.UnloadExplicit( "Game" );
+}

+ 14 - 0
Templates/BaseGame/game/tools/tools.module

@@ -0,0 +1,14 @@
+<ModuleDefinition
+	ModuleId="ToolsModule"
+	VersionId="1"
+	Description="Module that implements the tools and editor suite."
+	ScriptFile="tools"
+	CreateFunction="onCreate"
+	DestroyFunction="onDestroy"
+	Group="Tools">
+	<DeclaredAssets
+        canSave="true"
+        canSaveDynamicFields="true"
+        Extension="asset.taml"
+        Recurse="true" />
+</ModuleDefinition>

+ 26 - 0
Templates/BaseGame/game/tools/tools.tscript

@@ -0,0 +1,26 @@
+
+function ToolsModule::onCreate(%this)
+{
+   // ----------------------------------------------------------------------------
+   // Initialize core sub system functionality such as audio, the Canvas, PostFX,
+   // rendermanager, light managers, etc.
+   //
+   // Note that not all of these need to be initialized before the client, although
+   // the audio should and the canvas definitely needs to be.  I've put things here
+   // to distinguish between the purpose and functionality of the various client
+   // scripts.  Game specific script isn't needed until we reach the shell menus
+   // and start a game or connect to a server. We get the various subsystems ready
+   // to go, and then use initClient() to handle the rest of the startup sequence.
+   //
+   // If this is too convoluted we can reduce this complexity after futher testing
+   // to find exactly which subsystems should be readied before kicking things off. 
+   // ----------------------------------------------------------------------------
+   
+   //ModuleDatabase.LoadExplicit( "MainEditor" );
+   //ModuleDatabase.LoadExplicit( "Tools_ObjectViewer" );
+}
+
+function ToolsModule::onDestroy(%this)
+{
+
+}