From 2e47e7d823cd69dfbd7b869605e28222ac36dd2c Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Thu, 8 Dec 2022 14:34:50 -0600 Subject: [PATCH 1/9] adds a mechanism to inject additional steps into mission loading leverages the EventManager and ScriptMsgListener() classes to set up a third mission load stage triggered by the following flow: function ::onLoadMap(%this) starts an execution chain that leads to ::finishMapLoad() each ::finishMapLoad() MUST contain the line Core_ClientServer.GetEventManager().postEvent( "mapLoadComplete" ); once all have called back that they have finished thier tasks, players finish loading into a hosted mission --- .../clientServer/Core_ClientServer.tscript | 30 +++++++++++++++++++ .../scripts/server/levelLoad.tscript | 9 +++++- .../game/core/utility/scripts/module.tscript | 7 +++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/Templates/BaseGame/game/core/clientServer/Core_ClientServer.tscript b/Templates/BaseGame/game/core/clientServer/Core_ClientServer.tscript index 60a3705de..494c5014a 100644 --- a/Templates/BaseGame/game/core/clientServer/Core_ClientServer.tscript +++ b/Templates/BaseGame/game/core/clientServer/Core_ClientServer.tscript @@ -12,6 +12,33 @@ // When a local game is started - a listen server - via calling StartGame() a server is created and then the client is // connected to it via createAndConnectToLocalServer(). +function Core_ClientServer::onLoadMap(%this) +{ + %this.finishMapLoad(); +} + +function Core_ClientServer::finishMapLoad() +{ + Core_ClientServer.GetEventManager().postEvent( "mapLoadComplete" ); +} + +function Core_ClientServerListener::onMapLoadComplete(%this) +{ + $moduleLoadedDone++; + %numModsNeedingLoaded = 0; + %modulesList = ModuleDatabase.findModules(); + for(%i=0; %i < getWordCount(%modulesList); %i++) + { + %module = getWord(%modulesList, %i); + if (%module.ModuleId.isMethod("finishMapLoad")) + %numModsNeedingLoaded++; + } + if ($moduleLoadedDone == %numModsNeedingLoaded) + { + loadMissionStage3(); + } +} + function Core_ClientServer::onCreate( %this ) { echo("\n--------- Initializing Directory: scripts ---------"); @@ -33,6 +60,9 @@ function Core_ClientServer::onCreate( %this ) { initClient(); } + %this.GetEventManager().registerEvent("mapLoadComplete"); + %this.listener = new ScriptMsgListener() {class = Core_ClientServerListener;}; + %this.GetEventManager().subscribe( %this.listener, "mapLoadComplete" ); } function Core_ClientServer::onDestroy( %this ) diff --git a/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.tscript b/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.tscript index 86e0d8b5f..b1c6d1262 100644 --- a/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.tscript +++ b/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.tscript @@ -126,7 +126,14 @@ function loadMissionStage2() // Set mission name. if( isObject( theLevelInfo ) ) $Server::MissionName = theLevelInfo.levelName; + $moduleLoadedDone = 0; + callOnModules("onLoadMap"); +} + +function loadMissionStage3() +{ + echo("*** Stage 3 load"); %hasGameMode = callGamemodeFunction("onCreateGame"); @@ -143,8 +150,8 @@ function loadMissionStage2() // Go ahead and launch the game %hasGameMode = callGamemodeFunction("onMissionStart"); + } - function endMission() { if (!isObject( getScene(0) )) diff --git a/Templates/BaseGame/game/core/utility/scripts/module.tscript b/Templates/BaseGame/game/core/utility/scripts/module.tscript index 7cdc57423..eceaaea1b 100644 --- a/Templates/BaseGame/game/core/utility/scripts/module.tscript +++ b/Templates/BaseGame/game/core/utility/scripts/module.tscript @@ -317,3 +317,10 @@ function SimSet::unQueueExec(%scopeSet, %execFilePath) %execFileList.echo(); } +function SimSet::GetEventManager(%this) +{ + if( !isObject( %this.eventManager ) ) + %this.eventManager = new EventManager() { queue = "ModuleEventManager"; }; + + return %this.eventManager; +} \ No newline at end of file From 1eb59e77e89cb1cd7db0fcb65dce2229404232fa Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Thu, 8 Dec 2022 18:36:58 -0600 Subject: [PATCH 2/9] bloom operates off of color>1.0. adjust defaults to suit --- .../core/postFX/scripts/HDR/HDRPostFX.tscript | 8 ++-- .../scripts/default.postfxpreset.tscript | 40 +++++++++---------- .../levels/ExampleLevel.postfxpreset.tscript | 8 ++-- 3 files changed, 26 insertions(+), 30 deletions(-) diff --git a/Templates/BaseGame/game/core/postFX/scripts/HDR/HDRPostFX.tscript b/Templates/BaseGame/game/core/postFX/scripts/HDR/HDRPostFX.tscript index 954cfaec9..69f49db0b 100644 --- a/Templates/BaseGame/game/core/postFX/scripts/HDR/HDRPostFX.tscript +++ b/Templates/BaseGame/game/core/postFX/scripts/HDR/HDRPostFX.tscript @@ -34,9 +34,9 @@ $PostFX::HDRPostFX::keyValue = 0.115; //Explicit HDR Params -$PostFX::HDRPostFX::exposureValue = 1.5; +$PostFX::HDRPostFX::exposureValue = 1.0; -$PostFX::HDRPostFX::whitePoint = 2.5; +$PostFX::HDRPostFX::whitePoint = 1.0; //HDR Color Corrections Vars @@ -60,8 +60,8 @@ $PostFX::HDRPostFX::adaptRate = 0.85; // http://www.iryoku.com/next-generation-post-processing-in-call-of-duty-advanced-warfare $PostFX::HDRPostFX::enableBloom = true; -$PostFX::HDRPostFX::threshold = 1.25; -$PostFX::HDRPostFX::intensity = 0.25; +$PostFX::HDRPostFX::threshold = 1.0; +$PostFX::HDRPostFX::intensity = 1.0; $PostFX::HDRPostFX::radius = 4.0; $PostFX::HDRPostFX::enableDirt = true; diff --git a/Templates/BaseGame/game/core/postFX/scripts/default.postfxpreset.tscript b/Templates/BaseGame/game/core/postFX/scripts/default.postfxpreset.tscript index 9fa4e5282..3e18231aa 100644 --- a/Templates/BaseGame/game/core/postFX/scripts/default.postfxpreset.tscript +++ b/Templates/BaseGame/game/core/postFX/scripts/default.postfxpreset.tscript @@ -1,27 +1,23 @@ $PostFX::HDRPostFX::Enabled = 1; -$PostFX::HDRPostFX::exposureValue = "1.5"; -$PostFX::HDRPostFX::whitePoint = "2"; +$PostFX::HDRPostFX::exposureValue = 1; +$PostFX::HDRPostFX::whitePoint = 1; $PostFX::HDRPostFX::logContrast = 1; -$PostFX::HDRPostFX::saturationValue = "1"; -$PostFX::HDRPostFX::colorFilter = "1 1 1 1"; -$PostFX::HDRPostFX::minLuminace = "0"; +$PostFX::HDRPostFX::saturationValue = 1; +$PostFX::HDRPostFX::colorFilter = "1.0 1.0 1.0"; +$PostFX::HDRPostFX::minLuminace = "0.5"; $PostFX::HDRPostFX::whiteCutoff = 1; -$PostFX::HDRPostFX::adaptRate = "0.8"; +$PostFX::HDRPostFX::adaptRate = "0.134615391"; $PostFX::HDRPostFX::tonemapMode = "ACES"; -$PostFX::HDRPostFX::enableAutoExposure = "0"; -$PostFX::HDRPostFX::keyValue = "0.200000003"; -$PostFX::HDRPostFX::enableBloom = "1"; -$PostFX::HDRPostFX::threshold = "1"; -$PostFX::HDRPostFX::intensity = "1"; -$PostFX::HDRPostFX::radius = "5"; -$PostFX::HDRPostFX::enableDirt = "1"; +$PostFX::HDRPostFX::enableAutoExposure = "1"; +$PostFX::HDRPostFX::keyValue = 0.18; +$PostFX::HDRPostFX::enableBloom = 1; +$PostFX::HDRPostFX::threshold = 1; +$PostFX::HDRPostFX::intensity = 1; +$PostFX::HDRPostFX::radius = "4"; +$PostFX::HDRPostFX::enableDirt = 1; $PostFX::HDRPostFX::dirtScale = 2048; -$PostFX::HDRPostFX::dirtIntensity = "1"; -$PostFX::HDRPostFX::dirtImage = "Core_PostFX:lensDirt_image"; -$PostFX::HDRPostFX::dirtEdgeMinDist = "0.0218579229"; -$PostFX::HDRPostFX::dirtEdgeMaxDist = "0.0546448082"; -$PostFX::HDRPostFX::dirtEdgeMinVal = "0.0437158458"; -$PostFX::VignettePostFX::Enabled = "1"; -$PostFX::VignettePostFX::VMin = 0.2; -$PostFX::VignettePostFX::VMax = "0.9"; -$PostFX::VignettePostFX::Color = "0 0 0 1"; +$PostFX::HDRPostFX::dirtIntensity = 2; +$PostFX::HDRPostFX::dirtImage = "core/postFX/images/lensDirt.png"; +$PostFX::HDRPostFX::dirtEdgeMinDist = 0.125; +$PostFX::HDRPostFX::dirtEdgeMaxDist = 0.75; +$PostFX::HDRPostFX::dirtEdgeMinVal = 0.05; diff --git a/Templates/BaseGame/game/data/ExampleModule/levels/ExampleLevel.postfxpreset.tscript b/Templates/BaseGame/game/data/ExampleModule/levels/ExampleLevel.postfxpreset.tscript index db82dfa22..3e1da612f 100644 --- a/Templates/BaseGame/game/data/ExampleModule/levels/ExampleLevel.postfxpreset.tscript +++ b/Templates/BaseGame/game/data/ExampleModule/levels/ExampleLevel.postfxpreset.tscript @@ -1,6 +1,6 @@ $PostFX::HDRPostFX::Enabled = 1; -$PostFX::HDRPostFX::exposureValue = 1.5; -$PostFX::HDRPostFX::whitePoint = 2.5; +$PostFX::HDRPostFX::exposureValue = 1; +$PostFX::HDRPostFX::whitePoint = 1; $PostFX::HDRPostFX::logContrast = 1; $PostFX::HDRPostFX::saturationValue = 1; $PostFX::HDRPostFX::colorFilter = "1.0 1.0 1.0"; @@ -11,8 +11,8 @@ $PostFX::HDRPostFX::tonemapMode = "ACES"; $PostFX::HDRPostFX::enableAutoExposure = "0"; $PostFX::HDRPostFX::keyValue = 0.18; $PostFX::HDRPostFX::enableBloom = 1; -$PostFX::HDRPostFX::threshold = 1.25; -$PostFX::HDRPostFX::intensity = 0.25; +$PostFX::HDRPostFX::threshold = 1; +$PostFX::HDRPostFX::intensity = 1; $PostFX::HDRPostFX::radius = 4; $PostFX::HDRPostFX::enableDirt = 1; $PostFX::HDRPostFX::dirtScale = 2048; From 1f346ccb22ddbc7f3577618b0c2b3fe427406d9a Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Fri, 9 Dec 2022 14:51:07 -0600 Subject: [PATCH 3/9] lock 4.0.2 version in --- Engine/source/app/version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/app/version.h b/Engine/source/app/version.h index c6e044e6c..f72b36f6d 100644 --- a/Engine/source/app/version.h +++ b/Engine/source/app/version.h @@ -41,10 +41,10 @@ /// code version, the game name, and which type of game it is (TGB, TGE, TGEA, etc.). /// /// Version number is major * 1000 + minor * 100 + revision * 10. -#define TORQUE_GAME_ENGINE 4001 +#define TORQUE_GAME_ENGINE 4002 /// Human readable engine version string. -#define TORQUE_GAME_ENGINE_VERSION_STRING "4.0.1" +#define TORQUE_GAME_ENGINE_VERSION_STRING "4.0.2" /// Gets the engine version number. The version number is specified as a global in version.cc U32 getVersionNumber(); From 78cb2e1d80990791e32cc0d8cbfd2fabde793ab0 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Mon, 12 Dec 2022 13:02:11 -0600 Subject: [PATCH 4/9] adds a fail state method+event to the load chain at time of writing: Core_ClientServer.GetEventManager().postEvent( "mapLoadFail", false ); kicks players and closes the server Core_ClientServer.GetEventManager().postEvent( "mapLoadFail", false ); proceeds to continue loading reguardless --- .../clientServer/Core_ClientServer.tscript | 28 +++++++++++++++++++ .../scripts/server/levelLoad.tscript | 1 + 2 files changed, 29 insertions(+) diff --git a/Templates/BaseGame/game/core/clientServer/Core_ClientServer.tscript b/Templates/BaseGame/game/core/clientServer/Core_ClientServer.tscript index 494c5014a..8df5cc8eb 100644 --- a/Templates/BaseGame/game/core/clientServer/Core_ClientServer.tscript +++ b/Templates/BaseGame/game/core/clientServer/Core_ClientServer.tscript @@ -39,6 +39,32 @@ function Core_ClientServerListener::onMapLoadComplete(%this) } } +function Core_ClientServerListener::onmapLoadFail(%this, %isFine) +{ + if (%isFine) + { + %this.onMapLoadComplete(); + return; + } + + $moduleLoadedFailed++; + echo("onmapLoadFail!"); + if ($moduleLoadedFailed>1) return; // yeah, we know + + $Server::LoadFailMsg = "Failed to load map!"; + // Inform clients that are already connected + + for (%clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++) + { + %cl = ClientGroup.getObject( %clientIndex ); + %cl.onConnectionDropped($Server::LoadFailMsg); + %cl.endMission(); + %cl.resetGhosting(); + %cl.clearPaths(); + } + destroyServer(); +} + function Core_ClientServer::onCreate( %this ) { echo("\n--------- Initializing Directory: scripts ---------"); @@ -61,8 +87,10 @@ function Core_ClientServer::onCreate( %this ) initClient(); } %this.GetEventManager().registerEvent("mapLoadComplete"); + %this.GetEventManager().registerEvent("mapLoadFail"); %this.listener = new ScriptMsgListener() {class = Core_ClientServerListener;}; %this.GetEventManager().subscribe( %this.listener, "mapLoadComplete" ); + %this.GetEventManager().subscribe( %this.listener, "mapLoadFail" ); } function Core_ClientServer::onDestroy( %this ) diff --git a/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.tscript b/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.tscript index b1c6d1262..ee8e43dba 100644 --- a/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.tscript +++ b/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.tscript @@ -127,6 +127,7 @@ function loadMissionStage2() if( isObject( theLevelInfo ) ) $Server::MissionName = theLevelInfo.levelName; $moduleLoadedDone = 0; + $moduleLoadedFailed = 0; callOnModules("onLoadMap"); } From 29e06fc327da71c5defddefb69da4f98274fc975 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Mon, 12 Dec 2022 14:07:52 -0600 Subject: [PATCH 5/9] refactor, with the following wrappers to keep in mind: Core_ClientServer.clearLoadStatus(); Core_ClientServer.inishMapLoad(); Core_ClientServer.FailMapLoad( %moduleName, %isFine); Of special note: the postevent method must only take one entry, so we store off Core_ClientServer.failedModuleName = %moduleName; priorto triggering the event so that the failing module can be reported. --- .../clientServer/Core_ClientServer.tscript | 25 +++++++++++++------ .../scripts/server/levelLoad.tscript | 3 +-- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Templates/BaseGame/game/core/clientServer/Core_ClientServer.tscript b/Templates/BaseGame/game/core/clientServer/Core_ClientServer.tscript index 8df5cc8eb..1bc3b9d6f 100644 --- a/Templates/BaseGame/game/core/clientServer/Core_ClientServer.tscript +++ b/Templates/BaseGame/game/core/clientServer/Core_ClientServer.tscript @@ -12,19 +12,30 @@ // When a local game is started - a listen server - via calling StartGame() a server is created and then the client is // connected to it via createAndConnectToLocalServer(). +function Core_ClientServer::clearLoadStatus() +{ + Core_ClientServer.moduleLoadedDone = 0; + Core_ClientServer.moduleLoadedFailed = 0; +} function Core_ClientServer::onLoadMap(%this) { %this.finishMapLoad(); } -function Core_ClientServer::finishMapLoad() +function Core_ClientServer::finishMapLoad(%this) { Core_ClientServer.GetEventManager().postEvent( "mapLoadComplete" ); } +function Core_ClientServer::FailMapLoad(%this, %moduleName, %isFine) +{ + Core_ClientServer.failedModuleName = %moduleName; + Core_ClientServer.GetEventManager().postEvent( "mapLoadFail", %isFine ); +} + function Core_ClientServerListener::onMapLoadComplete(%this) { - $moduleLoadedDone++; + Core_ClientServer.moduleLoadedDone++; %numModsNeedingLoaded = 0; %modulesList = ModuleDatabase.findModules(); for(%i=0; %i < getWordCount(%modulesList); %i++) @@ -33,7 +44,7 @@ function Core_ClientServerListener::onMapLoadComplete(%this) if (%module.ModuleId.isMethod("finishMapLoad")) %numModsNeedingLoaded++; } - if ($moduleLoadedDone == %numModsNeedingLoaded) + if (Core_ClientServer.moduleLoadedDone == %numModsNeedingLoaded) { loadMissionStage3(); } @@ -47,11 +58,11 @@ function Core_ClientServerListener::onmapLoadFail(%this, %isFine) return; } - $moduleLoadedFailed++; - echo("onmapLoadFail!"); - if ($moduleLoadedFailed>1) return; // yeah, we know + Core_ClientServer.moduleLoadedFailed++; + if (Core_ClientServer.moduleLoadedFailed>1) return; // yeah, we know - $Server::LoadFailMsg = "Failed to load map!"; + $Server::LoadFailMsg = Core_ClientServer.failedModuleName @" failed to load mission specific data!"; + error($Server::LoadFailMsg); // Inform clients that are already connected for (%clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++) diff --git a/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.tscript b/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.tscript index ee8e43dba..140135b01 100644 --- a/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.tscript +++ b/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.tscript @@ -126,8 +126,7 @@ function loadMissionStage2() // Set mission name. if( isObject( theLevelInfo ) ) $Server::MissionName = theLevelInfo.levelName; - $moduleLoadedDone = 0; - $moduleLoadedFailed = 0; + Core_ClientServer.clearLoadStatus(); callOnModules("onLoadMap"); } From 4deae92c486d0300a8d212f1610aec163850d646 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Wed, 14 Dec 2022 23:07:35 -0600 Subject: [PATCH 6/9] fix bad rtParams refrence --- .../shaders/lighting/advanced/gl/reflectionProbeArrayP.glsl | 2 +- .../shaders/lighting/advanced/reflectionProbeArrayP.hlsl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/reflectionProbeArrayP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/reflectionProbeArrayP.glsl index fcd3d46df..50d7a0295 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/reflectionProbeArrayP.glsl +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/reflectionProbeArrayP.glsl @@ -64,7 +64,7 @@ void main() } #ifdef USE_SSAO_MASK - float ssao = 1.0 - texture( ssaoMask, viewportCoordToRenderTarget( IN_uv0.xy, rtParams6 ) ).r; + float ssao = 1.0 - texture( ssaoMask, viewportCoordToRenderTarget( IN_uv0.xy, rtParams7 ) ).r; surface.ao = min(surface.ao, ssao); #endif diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/reflectionProbeArrayP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/reflectionProbeArrayP.hlsl index e397a2410..c6efd8126 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/reflectionProbeArrayP.hlsl +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/reflectionProbeArrayP.hlsl @@ -58,7 +58,7 @@ float4 main(PFXVertToPix IN) : SV_TARGET } #ifdef USE_SSAO_MASK - float ssao = 1.0 - TORQUE_TEX2D( ssaoMask, viewportCoordToRenderTarget( IN.uv0.xy, rtParams6 ) ).r; + float ssao = 1.0 - TORQUE_TEX2D( ssaoMask, viewportCoordToRenderTarget( IN.uv0.xy, rtParams7 ) ).r; surface.ao = min(surface.ao, ssao); #endif From f2585fea4d30e8d31f2bcffb78a13b0da8fdeab7 Mon Sep 17 00:00:00 2001 From: Areloch Date: Fri, 16 Dec 2022 00:35:16 -0600 Subject: [PATCH 7/9] Fixes handling of click/activation events on keybind options ctrls so clicking on it at all activates it, instead of needing to click on the button image specifically Adjust the scaling of the options rows to be a consistent 50/50 divide between the options name and the actual options values to make the layout and scaling consistent Fixes key remapping behavior to work properly Added SubHeader text gui profile that is centered Made the remapping gui control be stylistically consistent to messageboxes --- .../gui/controls/guiGameSettingsCtrl.cpp | 11 +- .../game/data/UI/guis/optionsMenu.tscript | 6 +- .../BaseGame/game/data/UI/guis/remapDlg.gui | 138 ++++++------------ .../game/data/UI/scripts/controlsMenu.tscript | 19 +-- .../game/data/UI/scripts/profiles.tscript | 5 + 5 files changed, 65 insertions(+), 114 deletions(-) diff --git a/Engine/source/gui/controls/guiGameSettingsCtrl.cpp b/Engine/source/gui/controls/guiGameSettingsCtrl.cpp index 618b3acb8..254d63634 100644 --- a/Engine/source/gui/controls/guiGameSettingsCtrl.cpp +++ b/Engine/source/gui/controls/guiGameSettingsCtrl.cpp @@ -817,16 +817,9 @@ void GuiGameSettingsCtrl::clickKeybind(S32 xPos) S32 columnSplit = mColumnSplit; S32 height = getHeight(); + S32 width = getWidth(); - Point2I button; - button.x = columnSplit + (columnSplit / 2.5)/* + (optionWidth / 2)*/; - button.y = 0; - - Point2I buttonSize; - buttonSize.x = height; - buttonSize.y = height; - - RectI rect(button, buttonSize); + RectI rect(Point2I::Zero, Point2I(width, height)); onChange_callback(); diff --git a/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript b/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript index 8722f9902..f7f5593b9 100644 --- a/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript +++ b/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript @@ -828,7 +828,7 @@ function OptionsMenuSettingsList::addOptionRow(%this, %label, %targetPrefVar, %o %enabled = true; %optionsRowSize = 30; - %optionColumnWidth = %this.extent.x * 0.3;//todo, calculate off longest option text? + %optionColumnWidth = %this.extent.x * 0.5;//todo, calculate off longest option text? %option = new GuiGameSettingsCtrl() { class = "MenuOptionsButton"; @@ -936,7 +936,7 @@ function OptionsMenuSettingsList::addSliderRow(%this, %label, %targetPrefVar, %i %enabled = true; %optionsRowSize = 30; - %optionColumnWidth = %this.extent.x - 450;//todo, calculate off longest option text? + %optionColumnWidth = %this.extent.x * 0.5;//todo, calculate off longest option text? %option = new GuiGameSettingsCtrl() { class = "MenuOptionsButton"; @@ -965,7 +965,7 @@ function OptionsMenuSettingsList::addKeybindRow(%this, %label, %bitmapName, %cal %enabled = true; %optionsRowSize = 40; - %optionColumnWidth = %this.extent.x - 450; + %optionColumnWidth = %this.extent.x * 0.5;//todo, calculate off longest option text? %option = new GuiGameSettingsCtrl() { class = "MenuOptionsButton"; diff --git a/Templates/BaseGame/game/data/UI/guis/remapDlg.gui b/Templates/BaseGame/game/data/UI/guis/remapDlg.gui index 82f4c0130..feef7d938 100644 --- a/Templates/BaseGame/game/data/UI/guis/remapDlg.gui +++ b/Templates/BaseGame/game/data/UI/guis/remapDlg.gui @@ -1,121 +1,77 @@ //--- OBJECT WRITE BEGIN --- $guiContent = new GuiControl(RemapDlg) { - position = "0 0"; extent = "1024 768"; minExtent = "8 8"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; isContainer = "1"; - canSave = "1"; canSaveDynamicFields = "1"; helpTag = "0"; new GuiContainer(RemapPanel) { - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "162 352"; - extent = "700 64"; - minExtent = "8 2"; + position = "162 332"; + extent = "700 104"; horizSizing = "center"; vertSizing = "center"; profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; new GuiInputCtrl(OptRemapInputCtrl) { - lockMouse = "0"; position = "480 0"; - extent = "64 64"; + extent = "64 104"; minExtent = "8 8"; horizSizing = "width"; vertSizing = "height"; profile = "GuiInputCtrlProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; - new GuiChunkedBitmapCtrl() { - bitmapAsset = "UI:hudfill_image"; - useVariable = "0"; - tile = "0"; - position = "0 0"; - extent = "700 64"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; + new GuiControl(RemapBoxCtrl) { + position = "-1 1"; + extent = "701 102"; + horizSizing = "center"; + vertSizing = "center"; profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiTextCtrl() { - text = "Press escape to cancel"; - maxLength = "255"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "247 34"; - extent = "242 20"; - minExtent = "8 8"; - horizSizing = "width"; - vertSizing = "height"; - profile = "GuiMenuButtonProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiTextCtrl() { - text = "Re-bind \"\" to..."; - maxLength = "255"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "177 8"; - extent = "384 20"; - minExtent = "8 8"; - horizSizing = "width"; - vertSizing = "height"; - profile = "GuiMenuButtonProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - internalName = "OptRemapText"; - canSave = "1"; - canSaveDynamicFields = "0"; + + new GuiBitmapBarCtrl() { + BitmapAsset = "UI:panel_image"; + extent = "701 40"; + horizSizing = "width"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiBitmapBarCtrl() { + BitmapAsset = "UI:panel_low_image"; + position = "0 40"; + extent = "701 341"; + horizSizing = "width"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiTextCtrl() { + text = "Press escape to cancel"; + maxLength = "255"; + position = "260 67"; + extent = "181 23"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "height"; + profile = "MenuMLSubHeaderTextCenter"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiTextCtrl() { + text = "Re-bind \"Forward\" to..."; + maxLength = "255"; + position = "259 40"; + extent = "184 23"; + minExtent = "8 8"; + horizSizing = "center"; + vertSizing = "height"; + profile = "MenuMLSubHeaderTextCenter"; + tooltipProfile = "GuiToolTipProfile"; + internalName = "OptRemapText"; + }; }; }; }; diff --git a/Templates/BaseGame/game/data/UI/scripts/controlsMenu.tscript b/Templates/BaseGame/game/data/UI/scripts/controlsMenu.tscript index 88a8d6cf5..6f51988d3 100644 --- a/Templates/BaseGame/game/data/UI/scripts/controlsMenu.tscript +++ b/Templates/BaseGame/game/data/UI/scripts/controlsMenu.tscript @@ -205,12 +205,13 @@ function controlSetChanged() fillRemapList(); } -function doKeyRemap( %rowIndex ) +function doKeyRemap( %row ) { + %rowIndex = %row.getParent().getObjectIndex(%row); %rowIndex--; //Offset the rowIndex to account for controlset option %name = $RemapName[%rowIndex]; - RemapDlg-->OptRemapText.setValue( "Re-bind \"" @ %name @ "\" to..." ); + RemapDlg-->OptRemapText.text = "Re-bind \"" @ %name @ "\" to..." ; OptRemapInputCtrl.index = %rowIndex; Canvas.pushDialog( RemapDlg ); @@ -223,7 +224,7 @@ function doKeyRemap( %rowIndex ) function ControlsMenuRebindButton::onClick(%this) { %name = $RemapName[%this.keybindIndex]; - RemapDlg-->OptRemapText.setValue( "Re-bind \"" @ %name @ "\" to..." ); + RemapDlg-->OptRemapText.text = "Re-bind \"" @ %name @ "\" to..." ; OptRemapInputCtrl.index = %this.keybindIndex; OptRemapInputCtrl.optionIndex = %this.optionIndex; @@ -305,16 +306,12 @@ function OptRemapInputCtrl::onInputEvent( %this, %device, %action ) %prevCmdName = $RemapName[%prevMapIndex]; Canvas.pushDialog( RemapConfirmDlg ); - RemapConfirmationText.setText("\"" @ %mapName @ "\" is already bound to \"" - @ %prevCmdName @ "\"! Do you wish to replace this mapping?"); - RemapConfirmationYesButton.command = "redoMapping(" @ %device @ ", " @ %actionMap @ ", \"" @ %action @ "\", \"" @ + %remapWarnText = "\"" @ %mapName @ "\" is already bound to \"" @ %prevCmdName @ "\"! Do you wish to replace this mapping?"; + %doRemapCommand = "redoMapping(" @ %device @ ", " @ %actionMap @ ", \"" @ %action @ "\", \"" @ %cmd @ "\", " @ %prevMapIndex @ ", " @ %this.index @ "); Canvas.popDialog();"; - RemapConfirmationNoButton.command = "Canvas.popDialog();"; + %cancelCommand = "Canvas.popDialog();"; - /*MessageBoxYesNo( "Warning", - "\"" @ %mapName @ "\" is already bound to \"" - @ %prevCmdName @ "\"!\nDo you wish to replace this mapping?", - %callback, "" );*/ + MessageBoxYesNo( "Key already in use", %remapWarnText, %doRemapCommand, %cancelCommand ); } function findRemapCmdIndex( %command ) diff --git a/Templates/BaseGame/game/data/UI/scripts/profiles.tscript b/Templates/BaseGame/game/data/UI/scripts/profiles.tscript index 64019e345..b79b81a59 100644 --- a/Templates/BaseGame/game/data/UI/scripts/profiles.tscript +++ b/Templates/BaseGame/game/data/UI/scripts/profiles.tscript @@ -78,6 +78,11 @@ new GuiControlProfile(MenuMLSubHeaderText) autoSizeHeight = true; }; +new GuiControlProfile(MenuMLSubHeaderTextCenter : MenuMLSubHeaderText) +{ + justify = "center"; +}; + if( !isObject( GuiMenuButtonProfile ) ) new GuiControlProfile( GuiMenuButtonProfile ) { From d4a6ea46280727c74f86248c7219f7a1d42fb780 Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Sat, 17 Dec 2022 22:45:09 -0500 Subject: [PATCH 8/9] Fix LibPNG on Universal MacOS + Bump minimum MacOS version to 10.14 --- Tools/CMake/libraries/lpng.cmake | 40 ++++++++++++++++++-------------- Tools/CMake/torque3d.cmake | 4 ++-- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/Tools/CMake/libraries/lpng.cmake b/Tools/CMake/libraries/lpng.cmake index e14f6a36b..788065c52 100644 --- a/Tools/CMake/libraries/lpng.cmake +++ b/Tools/CMake/libraries/lpng.cmake @@ -22,26 +22,31 @@ project(lpng) -# addDef(PNG_NO_ASSEMBLER_CODE) - -# Enables NEON for libpng -if ( TORQUE_CPU_ARM32 OR TORQUE_CPU_ARM64 ) - set(PNG_ARM_NEON on CACHE STRING "") - add_definitions(-DPNG_ARM_NEON_OPT=1) +if (APPLE AND TORQUE_MACOS_UNIVERSAL_BINARY) addPath("${libDir}/lpng/arm") -else() - set(PNG_ARM_NEON off CACHE STRING "") - add_definitions(-DPNG_ARM_NEON_OPT=0) -endif() -# Enables SSE for libpng - also takes care of compiler warnings. -if ( TORQUE_CPU_X32 OR TORQUE_CPU_X64 ) - set(PNG_INTEL_SSE on CACHE STRING "") - add_definitions(-DPNG_INTEL_SSE_OPT=1) - addPath("${libDir}/lpng/intel") + set(CMAKE_XCODE_ATTRIBUTE_PER_ARCH_CFLAGS_x86_64 "-DPNG_INTEL_SSE_OPT=1 -DPNG_ARM_NEON_OPT=0") + set(CMAKE_XCODE_ATTRIBUTE_PER_ARCH_CFLAGS_arm64 "-DPNG_ARM_NEON_OPT=1 -DPNG_INTEL_SSE_OPT=0") else() - set(PNG_INTEL_SSE off CACHE STRING "") - add_definitions(-DPNG_INTEL_SSE_OPT=0) + # Enables NEON for libpng + if ( TORQUE_CPU_ARM32 OR TORQUE_CPU_ARM64 ) + set(PNG_ARM_NEON on CACHE STRING "" FORCE) + add_definitions(-DPNG_ARM_NEON_OPT=1) + addPath("${libDir}/lpng/arm") + else() + set(PNG_ARM_NEON off CACHE STRING "" FORCE) + add_definitions(-DPNG_ARM_NEON_OPT=0) + endif() + + # Enables SSE for libpng - also takes care of compiler warnings. + if ( TORQUE_CPU_X32 OR TORQUE_CPU_X64 ) + set(PNG_INTEL_SSE on CACHE STRING "" FORCE) + add_definitions(-DPNG_INTEL_SSE_OPT=1) + addPath("${libDir}/lpng/intel") + else() + set(PNG_INTEL_SSE off CACHE STRING "" FORCE) + add_definitions(-DPNG_INTEL_SSE_OPT=0) + endif() endif() mark_as_advanced(PNG_INTEL_SSE) @@ -50,3 +55,4 @@ mark_as_advanced(PNG_ARM_NEON) addInclude(${libDir}/zlib) finishLibrary("${libDir}/${PROJECT_NAME}") + diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index 2a315235d..94eeafc86 100644 --- a/Tools/CMake/torque3d.cmake +++ b/Tools/CMake/torque3d.cmake @@ -742,14 +742,14 @@ if (APPLE AND NOT IOS) # Detect architecture if not using universal if (TORQUE_MACOS_UNIVERSAL_BINARY) set(ARCHITECTURE_STRING_APPLE "x86_64;arm64") - set(DEPLOYMENT_TARGET_APPLE "10.13") + set(DEPLOYMENT_TARGET_APPLE "10.14") else() if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm64") set(ARCHITECTURE_STRING_APPLE "arm64") set(DEPLOYMENT_TARGET_APPLE "11.0") else() set(ARCHITECTURE_STRING_APPLE "x86_64") - set(DEPLOYMENT_TARGET_APPLE "10.9") + set(DEPLOYMENT_TARGET_APPLE "10.14") endif() endif() From 00c27095f71e72a480e7c574abf97bd96ab72118 Mon Sep 17 00:00:00 2001 From: Areloch Date: Thu, 22 Dec 2022 00:02:34 -0600 Subject: [PATCH 9/9] Establishes a common namespace for Module ScopeSet objects to make it easier to work with function calls out of module namespaces --- Engine/source/module/moduleManager.cpp | 4 ++++ .../game/core/utility/scripts/module.tscript | 18 +++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Engine/source/module/moduleManager.cpp b/Engine/source/module/moduleManager.cpp index cdfd90f94..515c4ba58 100644 --- a/Engine/source/module/moduleManager.cpp +++ b/Engine/source/module/moduleManager.cpp @@ -385,6 +385,8 @@ bool ModuleManager::loadModuleGroup( const char* pModuleGroup ) // Create a scope set. SimSet* pScopeSet = new SimSet; pScopeSet->registerObject( pLoadReadyModuleDefinition->getModuleId() ); + pScopeSet->setClassNamespace("ModuleRoot"); + pReadyEntry->mpModuleDefinition->mScopeSet = pScopeSet->getId(); // Increase load count. @@ -773,6 +775,8 @@ bool ModuleManager::loadModuleExplicit( const char* pModuleId, const U32 version // Create a scope set. SimSet* pScopeSet = new SimSet; pScopeSet->registerObject( pLoadReadyModuleDefinition->getModuleId() ); + pScopeSet->setClassNamespace("ModuleRoot"); + pReadyEntry->mpModuleDefinition->mScopeSet = pScopeSet->getId(); // Increase load count. diff --git a/Templates/BaseGame/game/core/utility/scripts/module.tscript b/Templates/BaseGame/game/core/utility/scripts/module.tscript index eceaaea1b..5c52c3ea7 100644 --- a/Templates/BaseGame/game/core/utility/scripts/module.tscript +++ b/Templates/BaseGame/game/core/utility/scripts/module.tscript @@ -104,7 +104,7 @@ function loadAssetsByType(%assetType) } } -function SimSet::getModulePath(%scopeSet) +function ModuleRoot::getModulePath(%scopeSet) { %name = %scopeSet.getName(); %moduleDef = ModuleDatabase.findModule(%name); @@ -115,7 +115,7 @@ function SimSet::getModulePath(%scopeSet) return ""; } -function SimSet::registerDatablock(%scopeSet, %datablockFilePath, %isExclusive) +function ModuleRoot::registerDatablock(%scopeSet, %datablockFilePath, %isExclusive) { if ($traceModuleCalls) warn("SimSet::registerDatablock"); @@ -171,7 +171,7 @@ function SimSet::registerDatablock(%scopeSet, %datablockFilePath, %isExclusive) DatablockFilesList.echo(); } -function SimSet::unRegisterDatablock(%scopeSet, %datablockFilePath) +function ModuleRoot::unRegisterDatablock(%scopeSet, %datablockFilePath) { if ($traceModuleCalls) warn("SimSet::unRegisterDatablock"); @@ -215,7 +215,7 @@ function SimSet::unRegisterDatablock(%scopeSet, %datablockFilePath) DatablockFilesList.echo(); } -function SimSet::queueExec(%scopeSet, %execFilePath, %isExclusive) +function ModuleRoot::queueExec(%scopeSet, %execFilePath, %isExclusive) { if ($traceModuleCalls) warn("SimSet::queueExec"); @@ -272,7 +272,7 @@ function SimSet::queueExec(%scopeSet, %execFilePath, %isExclusive) %execFileList.echo(); } -function SimSet::unQueueExec(%scopeSet, %execFilePath) +function ModuleRoot::unQueueExec(%scopeSet, %execFilePath) { if ($traceModuleCalls) warn("SimSet::unRegisterDatablock"); @@ -317,10 +317,10 @@ function SimSet::unQueueExec(%scopeSet, %execFilePath) %execFileList.echo(); } -function SimSet::GetEventManager(%this) +function ModuleRoot::GetEventManager(%scopeSet) { - if( !isObject( %this.eventManager ) ) - %this.eventManager = new EventManager() { queue = "ModuleEventManager"; }; + if( !isObject( %scopeSet.eventManager ) ) + %scopeSet.eventManager = new EventManager() { queue = "ModuleEventManager"; }; - return %this.eventManager; + return %scopeSet.eventManager; } \ No newline at end of file