From 5f95f9f8c00a8e5e012767d2ba29be1a5d783635 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sat, 25 Jul 2020 01:29:25 -0500 Subject: [PATCH] Made GuiFadeinBitmapCtrl not only respond to mouse and keyboard events, but gamepad events as well, allowing gamepad inputs to skip opening splash pages Ensured that guiGameListMenuCtrl adjusts values for rows marked as sliders via the left and right gamepad actions Corrected the button maps for look and move on the gamepad for the ExampleModule's default movement binds Fixed ExampleModule's default keybinds so alt+enter correctly toggles fullscreen Fixed joinServerMenu so it has a guiInputCtrl that can catch keybind events and pass them to the menuInputButtons Removed erroneous input consumption on OptionsMenuList Removed unneeded check against Graphics API list Flipped order of Anti Aliasing option to match ordering of the others Removed old, unneeded legacy option menu script files Added logic for message boxes to automatically return active MenuInputButton control to the holder before it was pushed Added fill color for the UI list gui profile so the sliders render more legibly --- .../gui/controls/guiGameListMenuCtrl.cpp | 25 +- .../source/gui/game/guiFadeinBitmapCtrl.cpp | 6 + Engine/source/gui/game/guiFadeinBitmapCtrl.h | 1 + .../ExampleModule/scripts/default.keybinds.cs | 10 +- .../ExampleModule/scripts/inputCommands.cs | 4 + .../game/data/ui/guis/joinServerMenu.cs | 12 +- .../game/data/ui/guis/joinServerMenu.gui | 12 + .../BaseGame/game/data/ui/guis/optionsMenu.cs | 14 +- .../game/data/ui/guis/optionsMenu.gui | 2 - .../BaseGame/game/data/ui/guis/startupGui.cs | 2 + .../game/data/ui/scripts/audioMenu.cs | 200 ---- .../game/data/ui/scripts/displayMenu.cs | 245 ---- .../game/data/ui/scripts/graphicsMenu.cs | 1050 ----------------- .../game/data/ui/scripts/messageBoxes.cs | 8 + .../BaseGame/game/data/ui/scripts/profiles.cs | 5 + 15 files changed, 78 insertions(+), 1518 deletions(-) delete mode 100644 Templates/BaseGame/game/data/ui/scripts/audioMenu.cs delete mode 100644 Templates/BaseGame/game/data/ui/scripts/displayMenu.cs delete mode 100644 Templates/BaseGame/game/data/ui/scripts/graphicsMenu.cs diff --git a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp index 6d2416aae..6c93cd875 100644 --- a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp +++ b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp @@ -278,7 +278,7 @@ void GuiGameListMenuCtrl::onRenderSliderOption(Row* row, Point2I currentOffset) bool isRowSelected = (getSelected() != NO_ROW) && (row == mRows[getSelected()]); bool isRowHighlighted = (getHighlighted() != NO_ROW) ? ((row == mRows[getHighlighted()]) && (row->mEnabled)) : false; - if (profileHasArrows) + /*if (profileHasArrows) { // render the left arrow bool arrowOnL = (isRowSelected || isRowHighlighted) && (row->mValue > row->mRange.x); @@ -297,7 +297,7 @@ void GuiGameListMenuCtrl::onRenderSliderOption(Row* row, Point2I currentOffset) drawer->clearBitmapModulation(); drawer->drawBitmapStretchSR(profile->mTextureObject, RectI(arrowOffset, arrowExtent), profile->getBitmapArrayRect((U32)iconIndex)); - } + }*/ //Draw the slider bar if (row->mEnabled) @@ -324,8 +324,8 @@ void GuiGameListMenuCtrl::onRenderSliderOption(Row* row, Point2I currentOffset) ColorI barOutlineColor; if (isRowSelected) { - barColor = profile->mFillColorHL; - barOutlineColor = profile->mFillColor; + barColor = profile->mFillColor; + barOutlineColor = profile->mFillColorSEL; } else { @@ -1161,10 +1161,22 @@ void GuiGameListMenuCtrl::changeOption(Row* row, S32 delta) } row->mSelectedOption = newSelection; + if (row->mMode == GuiGameListMenuCtrl::Row::Slider) + { + row->mValue += row->mStepSize * delta; + + row->mValue = mRound(row->mValue / row->mStepSize) * row->mStepSize; + + if (row->mValue < row->mRange.x) + row->mValue = row->mRange.x; + if (row->mValue > row->mRange.y) + row->mValue = row->mRange.y; + } + static StringTableEntry LEFT = StringTable->insert("LEFT", true); static StringTableEntry RIGHT = StringTable->insert("RIGHT", true); - if (row->mScriptCallback != NULL && row->mSelectedOption != NO_OPTION) + if (row->mScriptCallback != NULL && (row->mSelectedOption != NO_OPTION && row->mMode != GuiGameListMenuCtrl::Row::Slider)) { setThisControl(); StringTableEntry direction = NULL; @@ -1714,9 +1726,6 @@ void GuiGameListMenuProfile::initPersistFields() removeField("modal"); removeField("opaque"); - removeField("fillColor"); - removeField("fillColorHL"); - removeField("fillColorNA"); removeField("border"); removeField("borderThickness"); removeField("borderColor"); diff --git a/Engine/source/gui/game/guiFadeinBitmapCtrl.cpp b/Engine/source/gui/game/guiFadeinBitmapCtrl.cpp index 3af8130ac..85ac57dd4 100644 --- a/Engine/source/gui/game/guiFadeinBitmapCtrl.cpp +++ b/Engine/source/gui/game/guiFadeinBitmapCtrl.cpp @@ -132,6 +132,12 @@ bool GuiFadeinBitmapCtrl::onKeyDown(const GuiEvent &) return true; } +bool GuiFadeinBitmapCtrl::onGamepadButtonDown(const GuiEvent& event) +{ + click_callback(); + return true; +} + //----------------------------------------------------------------------------- bool GuiFadeinBitmapCtrl::onWake() diff --git a/Engine/source/gui/game/guiFadeinBitmapCtrl.h b/Engine/source/gui/game/guiFadeinBitmapCtrl.h index c3508a3de..b6b3e0b77 100644 --- a/Engine/source/gui/game/guiFadeinBitmapCtrl.h +++ b/Engine/source/gui/game/guiFadeinBitmapCtrl.h @@ -72,6 +72,7 @@ class GuiFadeinBitmapCtrl : public GuiBitmapCtrl virtual void onPreRender(); virtual void onMouseDown(const GuiEvent &); virtual bool onKeyDown(const GuiEvent &); + virtual bool onGamepadButtonDown(const GuiEvent& event); virtual bool onWake(); virtual void onRender(Point2I offset, const RectI &updateRect); diff --git a/Templates/BaseGame/game/data/ExampleModule/scripts/default.keybinds.cs b/Templates/BaseGame/game/data/ExampleModule/scripts/default.keybinds.cs index 6870f1a89..fbf3380e2 100644 --- a/Templates/BaseGame/game/data/ExampleModule/scripts/default.keybinds.cs +++ b/Templates/BaseGame/game/data/ExampleModule/scripts/default.keybinds.cs @@ -128,10 +128,10 @@ ExampleMoveMap.bind( keyboard, space, jump ); ExampleMoveMap.bind( mouse, xaxis, yaw ); ExampleMoveMap.bind( mouse, yaxis, pitch ); -ExampleMoveMap.bind( gamepad, thumbrx, "D", "-0.23 0.23", gamepadYaw ); -ExampleMoveMap.bind( gamepad, thumbry, "D", "-0.23 0.23", gamepadPitch ); -ExampleMoveMap.bind( gamepad, thumblx, "D", "-0.23 0.23", gamePadMoveX ); -ExampleMoveMap.bind( gamepad, thumbly, "D", "-0.23 0.23", gamePadMoveY ); +ExampleMoveMap.bind( gamepad, rxaxis, "D", "-0.23 0.23", gamepadYaw ); +ExampleMoveMap.bind( gamepad, ryaxis, "D", "-0.23 0.23", gamepadPitch ); +ExampleMoveMap.bind( gamepad, xaxis, "D", "-0.23 0.23", gamePadMoveX ); +ExampleMoveMap.bind( gamepad, yaxis, "D", "-0.23 0.23", gamePadMoveY ); ExampleMoveMap.bind( gamepad, btn_a, jump ); ExampleMoveMap.bind( gamepad, btn_x, moveup ); @@ -143,6 +143,6 @@ ExampleMoveMap.bindCmd( gamepad, btn_start, "Canvas.pushDialog(PauseMenu);", "" //------------------------------------------------------------------------------ GlobalActionMap.bind(keyboard, "tilde", toggleConsole); GlobalActionMap.bindCmd(keyboard, "alt k", "cls();",""); -GlobalActionMap.bindCmd(keyboard, "alt enter", "", "Canvas.attemptFullscreenToggle();"); +GlobalActionMap.bindCmd(keyboard, "alt enter", "", "Canvas.toggleFullscreen();"); GlobalActionMap.bindCmd(keyboard, "F1", "", "contextHelp();"); ExampleMoveMap.bindCmd(keyboard, "n", "toggleNetGraph();", ""); \ No newline at end of file diff --git a/Templates/BaseGame/game/data/ExampleModule/scripts/inputCommands.cs b/Templates/BaseGame/game/data/ExampleModule/scripts/inputCommands.cs index 229e18364..55e2659d6 100644 --- a/Templates/BaseGame/game/data/ExampleModule/scripts/inputCommands.cs +++ b/Templates/BaseGame/game/data/ExampleModule/scripts/inputCommands.cs @@ -147,6 +147,8 @@ function gamePadMoveX( %val ) function gamePadMoveY( %val ) { + %val *= -1; + if(%val > 0) { $mvForwardAction = %val * $movementSpeed; @@ -183,6 +185,8 @@ function gamepadYaw(%val) function gamepadPitch(%val) { + %val *= -1; + %pitchAdj = getGamepadAdjustAmount(%val); if(ServerConnection.isControlObjectRotDampedCamera()) { diff --git a/Templates/BaseGame/game/data/ui/guis/joinServerMenu.cs b/Templates/BaseGame/game/data/ui/guis/joinServerMenu.cs index 548e077d3..e65e85e5d 100644 --- a/Templates/BaseGame/game/data/ui/guis/joinServerMenu.cs +++ b/Templates/BaseGame/game/data/ui/guis/joinServerMenu.cs @@ -6,17 +6,25 @@ function JoinServerMenu::onWake() JoinServerJoinBtn.setActive(JS_serverList.rowCount() > 0); JoinServerButtonHolder.setActive(); + + JoinServerMenuInputHandler.setFirstResponder(); } function JoinServerButtonHolder::onWake(%this) { - %this-->joinButton.set("Start", "Return", "Join", "JoinServerMenu.join();"); - %this-->backButton.set("btn_b", "escape", "Back", "JoinServerMenu.backOut();"); + %this-->joinButton.set("btn_start", "Return", "Join", "JoinServerMenu.join();"); + %this-->backButton.set("btn_b", "Escape", "Back", "JoinServerMenu.backOut();"); %this-->refreshButton.set("btn_y", "R", "Refresh", "JoinServerMenu.refresh();"); %this-->queryLANButton.set("btn_a", "Q", "Query LAN", "JoinServerMenu.queryLan();"); %this-->queryInternetButton.set("btn_x", "E", "Query Internet", "JoinServerMenu.query();"); } +function JoinServerMenuInputHandler::onInputEvent(%this, %device, %action, %state) +{ + if(%state) + $activeMenuButtonContainer.processInputs(%device, %action); +} + //---------------------------------------- function JoinServerMenu::query(%this) { diff --git a/Templates/BaseGame/game/data/ui/guis/joinServerMenu.gui b/Templates/BaseGame/game/data/ui/guis/joinServerMenu.gui index f58644b7a..a45d5d3ce 100644 --- a/Templates/BaseGame/game/data/ui/guis/joinServerMenu.gui +++ b/Templates/BaseGame/game/data/ui/guis/joinServerMenu.gui @@ -14,6 +14,18 @@ canSave = "1"; canSaveDynamicFields = "1"; returnGui = "MainMenuGui"; + + new GuiInputCtrl(JoinServerMenuInputHandler){ + profile = "GuiInputCtrlProfile"; + visible = "1"; + active = "1"; + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + sendBreakEvents="1"; + }; new GuiControl(JoinServerWindow) { position = "48 56"; diff --git a/Templates/BaseGame/game/data/ui/guis/optionsMenu.cs b/Templates/BaseGame/game/data/ui/guis/optionsMenu.cs index c0258eb3b..c7a8017eb 100644 --- a/Templates/BaseGame/game/data/ui/guis/optionsMenu.cs +++ b/Templates/BaseGame/game/data/ui/guis/optionsMenu.cs @@ -215,18 +215,19 @@ function OptionsMenu::populateDisplaySettingsList(%this) function OptionsMenu::applyDisplaySettings(%this) { - %newAdapter = GraphicsMenuDriver.getText(); - %numAdapters = GFXInit::getAdapterCount(); + //%newAdapter = GraphicsMenuDriver.getText(); + //%numAdapters = GFXInit::getAdapterCount(); %newDevice = OptionsMenuSettingsList.getCurrentOption(0); - for( %i = 0; %i < %numAdapters; %i ++ ) + /*for( %i = 0; %i < %numAdapters; %i ++ ) { - if( GFXInit::getAdapterName( %i ) $= %newAdapter ) + %targetAdapter = GFXInit::getAdapterName( %i ); + if( GFXInit::getAdapterName( %i ) $= %newDevice ) { %newDevice = GFXInit::getAdapterType( %i ); break; } - } + }*/ // Change the device. if ( %newDevice !$= $pref::Video::displayDevice ) @@ -258,6 +259,7 @@ function OptionsMenu::populateGraphicsSettingsList(%this) %onOffList = "Off\tOn"; %highMedLow = "Low\tMedium\tHigh"; %anisoFilter = "Off\t4\t8\t16"; + %aaFilter = "Off\t1\t2\t4"; OptionsMenuSettingsList.addOptionRow("Shadow Quality", getQualityLevels(ShadowQualityList), false, "", -1, -30, true, "Shadow revolution quality", getCurrentQualityLevel(ShadowQualityList)); OptionsMenuSettingsList.addOptionRow("Soft Shadow Quality", getQualityLevels(SoftShadowList), false, "", -1, -30, true, "Amount of softening applied to shadowmaps", getCurrentQualityLevel(SoftShadowList)); OptionsMenuSettingsList.addOptionRow("Mesh Quality", getQualityLevels(MeshQualityGroup), false, "", -1, -30, true, "Fidelity of rendering of mesh objects", getCurrentQualityLevel(MeshQualityGroup)); @@ -267,7 +269,7 @@ function OptionsMenu::populateGraphicsSettingsList(%this) OptionsMenuSettingsList.addOptionRow("Ground Cover Density", getQualityLevels(GroundCoverDensityGroup), false, "", -1, -30, true, "Density of ground cover items, such as grass", getCurrentQualityLevel(GroundCoverDensityGroup)); OptionsMenuSettingsList.addOptionRow("Shader Quality", getQualityLevels(ShaderQualityGroup), false, "", -1, -30, true, "Dictates the overall shader quality level, adjusting what features are enabled.", getCurrentQualityLevel(ShaderQualityGroup)); OptionsMenuSettingsList.addOptionRow("Anisotropic Filtering", %anisoFilter, false, "", -1, -30, true, "Amount of Anisotropic Filtering on textures, which dictates their sharpness at a distance", $pref::Video::defaultAnisotropy); - OptionsMenuSettingsList.addOptionRow("Anti-Aliasing", "4\t2\t1\tOff", false, "", -1, -30, true, "Amount of Post-Processing Anti-Aliasing applied to rendering", $pref::Video::AA); + OptionsMenuSettingsList.addOptionRow("Anti-Aliasing", %aaFilter, false, "", -1, -30, true, "Amount of Post-Processing Anti-Aliasing applied to rendering", $pref::Video::AA); OptionsMenuSettingsList.addOptionRow("Parallax", %onOffList, false, "", -1, -30, true, "Whether the surface parallax shader effect is enabled", convertBoolToOnOff(!$pref::Video::disableParallaxMapping)); OptionsMenuSettingsList.addOptionRow("Water Reflections", %onOffList, false, "", -1, -30, true, "Whether water reflections are enabled", convertBoolToOnOff(!$pref::Water::disableTrueReflections)); OptionsMenuSettingsList.addOptionRow("SSAO", %onOffList, false, "", -1, -30, true, "Whether Screen-Space Ambient Occlusion is enabled", convertBoolToOnOff($pref::PostFX::EnableSSAO)); diff --git a/Templates/BaseGame/game/data/ui/guis/optionsMenu.gui b/Templates/BaseGame/game/data/ui/guis/optionsMenu.gui index 54947cecd..f289ad018 100644 --- a/Templates/BaseGame/game/data/ui/guis/optionsMenu.gui +++ b/Templates/BaseGame/game/data/ui/guis/optionsMenu.gui @@ -233,8 +233,6 @@ new GuiGameListMenuCtrl(OptionsMenuSettingsList) { debugRender = "0"; - callbackOnA = "OptionsMenuSettingsList.activateRow();"; - callbackOnB = "OptionsMenuSettingsList.backOut();"; callbackOnInputs = "1"; position = "1 1"; extent = "621 510"; diff --git a/Templates/BaseGame/game/data/ui/guis/startupGui.cs b/Templates/BaseGame/game/data/ui/guis/startupGui.cs index 28c5cedce..f82a0b24c 100644 --- a/Templates/BaseGame/game/data/ui/guis/startupGui.cs +++ b/Templates/BaseGame/game/data/ui/guis/startupGui.cs @@ -40,6 +40,8 @@ function loadStartup() // Call the next() function to set our firt // splash screen StartupGui.next(); + + StartupGui.setFirstResponder(); // Play our startup sound //SFXPlayOnce(AudioGui, "data/ui/sounds/startup");//SFXPlay(startsnd); diff --git a/Templates/BaseGame/game/data/ui/scripts/audioMenu.cs b/Templates/BaseGame/game/data/ui/scripts/audioMenu.cs deleted file mode 100644 index d996745b8..000000000 --- a/Templates/BaseGame/game/data/ui/scripts/audioMenu.cs +++ /dev/null @@ -1,200 +0,0 @@ -// ============================================================================= -// AUDIO MENU -// ============================================================================= -$AudioTestHandle = 0; -// Description to use for playing the volume test sound. This isn't -// played with the description of the channel that has its volume changed -// because we know nothing about the playback state of the channel. If it -// is paused or stopped, the test sound would not play then. -$AudioTestDescription = new SFXDescription() -{ - sourceGroup = AudioChannelMaster; -}; - -function AudioMenu::loadSettings(%this) -{ - // Audio - //OptAudioHardwareToggle.setStateOn($pref::SFX::useHardware); - //OptAudioHardwareToggle.setActive( true ); - - /*%this-->OptAudioVolumeMaster.setValue( $pref::SFX::masterVolume ); - %this-->OptAudioVolumeShell.setValue( $pref::SFX::channelVolume[ $GuiAudioType] ); - %this-->OptAudioVolumeSim.setValue( $pref::SFX::channelVolume[ $SimAudioType ] ); - %this-->OptAudioVolumeMusic.setValue( $pref::SFX::channelVolume[ $MusicAudioType ] ); - - AudioMenuSoundDriver.clear(); - %buffer = sfxGetAvailableDevices(); - %count = getRecordCount( %buffer ); - for(%i = 0; %i < %count; %i++) - { - %record = getRecord(%buffer, %i); - %provider = getField(%record, 0); - - if ( AudioMenuSoundDriver.findText( %provider ) == -1 ) - AudioMenuSoundDriver.add( %provider, %i ); - } - - AudioMenuSoundDriver.sort(); - - %selId = AudioMenuSoundDriver.findText($pref::SFX::provider); - if ( %selId == -1 ) - AudioMenuSoundDriver.setFirstSelected(); - else - AudioMenuSoundDriver.setSelected( %selId );*/ - - OptionsSettingStack.clear(); - - OptionsMenu.addSliderOption(OptionsSettingStack, "Master Volume", $pref::Video::Brightness, "0 1", 10, 5); - OptionsMenu.addSliderOption(OptionsSettingStack, "Menu Volume", $pref::Video::Brightness, "0 1", 10, 5); - OptionsMenu.addSliderOption(OptionsSettingStack, "Effects Volume", $pref::Video::Brightness, "0 1", 10, 5); - OptionsMenu.addSliderOption(OptionsSettingStack, "Music Volume", $pref::Video::Brightness, "0 1", 10, 5); -} - -function AudioMenu::loadDevices(%this) -{ - if(!isObject(SoundDeviceGroup)) - { - new SimGroup( SoundDeviceGroup ); - } - else - { - SoundDeviceGroup.clear(); - } - - %buffer = sfxGetAvailableDevices(); - %count = getRecordCount( %buffer ); - for (%i = 0; %i < %count; %i++) - { - %record = getRecord(%buffer, %i); - %provider = getField(%record, 0); - %device = getField(%record, 1); - - if($pref::SFX::provider !$= %provider) - continue; - - %setting = new ArrayObject() - { - class = "OptionsMenuSettingLevel"; - caseSensitive = true; - - displayName = %device; - - key["$pref::SFX::Device"] = %device; - }; - - SoundDeviceGroup.add(%setting); - } -} - -function AudioMenu::apply(%this) -{ - sfxSetMasterVolume( $pref::SFX::masterVolume ); - - sfxSetChannelVolume( $GuiAudioType, $pref::SFX::channelVolume[ $GuiAudioType ] ); - sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ $SimAudioType ] ); - sfxSetChannelVolume( $MusicAudioType, $pref::SFX::channelVolume[ $MusicAudioType ] ); - - if ( !sfxCreateDevice( $pref::SFX::provider, - $pref::SFX::device, - $pref::SFX::useHardware, - -1 ) ) - error( "Unable to create SFX device: " @ $pref::SFX::provider - SPC $pref::SFX::device - SPC $pref::SFX::useHardware ); - - if( !isObject( $AudioTestHandle ) ) - { - sfxPlay(menuButtonPressed); - } -} - -function AudioMenuOKButton::onClick(%this) -{ - //save the settings and then back out - AudioMenu.apply(); - OptionsMenu.backOut(); -} - -function AudioMenuDefaultsButton::onClick(%this) -{ - sfxInit(); - AudioMenu.loadSettings(); -} - -function OptAudioUpdateMasterVolume( %volume ) -{ - if( %volume == $pref::SFX::masterVolume ) - return; - - sfxSetMasterVolume( %volume ); - $pref::SFX::masterVolume = %volume; - - if( !isObject( $AudioTestHandle ) ) - $AudioTestHandle = sfxPlayOnce( AudioChannel, "data/ui/sounds/volumeTest.wav" ); -} - -function OptAudioUpdateChannelVolume( %description, %volume ) -{ - %channel = sfxGroupToOldChannel( %description.sourceGroup ); - - if( %volume == $pref::SFX::channelVolume[ %channel ] ) - return; - - sfxSetChannelVolume( %channel, %volume ); - $pref::SFX::channelVolume[ %channel ] = %volume; - - if( !isObject( $AudioTestHandle ) ) - { - $AudioTestDescription.volume = %volume; - $AudioTestHandle = sfxPlayOnce( $AudioTestDescription, "data/ui/sounds/volumeTest.wav" ); - } -} - -function AudioMenuSoundDriver::onSelect( %this, %id, %text ) -{ - // Skip empty provider selections. - if ( %text $= "" ) - return; - - $pref::SFX::provider = %text; - AudioMenuSoundDevice.clear(); - - %buffer = sfxGetAvailableDevices(); - %count = getRecordCount( %buffer ); - for(%i = 0; %i < %count; %i++) - { - %record = getRecord(%buffer, %i); - %provider = getField(%record, 0); - %device = getField(%record, 1); - - if (%provider !$= %text) - continue; - - if ( AudioMenuSoundDevice.findText( %device ) == -1 ) - AudioMenuSoundDevice.add( %device, %i ); - } - - // Find the previous selected device. - %selId = AudioMenuSoundDevice.findText($pref::SFX::device); - if ( %selId == -1 ) - AudioMenuSoundDevice.setFirstSelected(); - else - AudioMenuSoundDevice.setSelected( %selId ); -} - -function AudioMenuSoundDevice::onSelect( %this, %id, %text ) -{ - // Skip empty selections. - if ( %text $= "" ) - return; - - $pref::SFX::device = %text; - - if ( !sfxCreateDevice( $pref::SFX::provider, - $pref::SFX::device, - $pref::SFX::useHardware, - -1 ) ) - error( "Unable to create SFX device: " @ $pref::SFX::provider - SPC $pref::SFX::device - SPC $pref::SFX::useHardware ); -} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/ui/scripts/displayMenu.cs b/Templates/BaseGame/game/data/ui/scripts/displayMenu.cs deleted file mode 100644 index c821eb72c..000000000 --- a/Templates/BaseGame/game/data/ui/scripts/displayMenu.cs +++ /dev/null @@ -1,245 +0,0 @@ -function DisplayMenu::loadSettings() -{ - OptionsMenu.currentMenu = "DisplayMenu"; - OptionsSettingStack.clear(); - - %APICount = getTokenCount(GraphicsDriverSetting::getList(),","); - if(%APICount > 1) - OptionsMenu.addSettingOption(OptionsSettingStack, "Diplay API", "", "GraphicsDriverSetting"); - - OptionsMenu.addSettingOption(OptionsSettingStack, "Screen Resolution", "", "ScreenResolutionSetting"); - OptionsMenu.addSettingOption(OptionsSettingStack, "Fullscreen", "", "FullscreenSetting"); - OptionsMenu.addSettingOption(OptionsSettingStack, "VSync", "", "VSyncSetting"); - - OptionsMenu.addSliderOption(OptionsSettingStack, "Field of View", $pref::Video::FOV, "65 120", 55, 75); - - OptionsMenu.addSliderOption(OptionsSettingStack, "Brightness", $pref::Video::Brightness, "0 1", 10, 5); - OptionsMenu.addSliderOption(OptionsSettingStack, "Contrast", $pref::Video::Contrast, "0 1", 10, 5); - - GraphicsSettingsCache.empty(); -} - -function DisplayMenu::apply(%this) -{ - //Loop through the settings cache and actually apply the values - %cachedSettingCount = GraphicsSettingsCache.count(); - - for(%i=0; %i < %cachedSettingCount; %i++) - { - %var = GraphicsSettingsCache.getKey(%i); - %val = GraphicsSettingsCache.getValue(%i); - - if(%var $= "$pref::Video::displayDevice") - { - MessageBoxOK( "Change requires restart", "Please restart the game for a display device change to take effect." ); - } - - setVariable(%var, %val); - } - - //Update the display settings now - if (getWord( $pref::Video::Resolution, 2) $= "") - { - $pref::Video::Resolution = getWord( $pref::Video::Resolution, 0 ) SPC getWord( $pref::Video::Resolution, 1 ); - } - else - { - $pref::Video::Resolution = getWord( $pref::Video::Resolution, 0 ) SPC getWord( $pref::Video::Resolution, 2 ); - } - - /*if ( %newFullScreen $= "false" ) - { - // If we're in windowed mode switch the fullscreen check - // if the resolution is bigger than the desktop. - %deskRes = getDesktopResolution(); - %deskResX = getWord(%deskRes, $WORD::RES_X); - %deskResY = getWord(%deskRes, $WORD::RES_Y); - if ( getWord( %newRes, $WORD::RES_X ) > %deskResX || - getWord( %newRes, $WORD::RES_Y ) > %deskResY ) - { - $pref::Video::FullScreen = "true"; - GraphicsMenuFullScreen.setStateOn( true ); - } - }*/ - - // Build the final mode string. - %newMode = $pref::Video::Resolution SPC $pref::Video::FullScreen SPC 32 SPC $pref::Video::RefreshRate SPC $pref::Video::AA; - - // Change the video mode. - /*if ( %newMode !$= $pref::Video::mode || - %newVsync != $pref::Video::disableVerticalSync ) - { - if ( %testNeedApply ) - return true;*/ - - $pref::Video::mode = %newMode; - //$pref::Video::disableVerticalSync = %newVsync; - configureCanvas(); - //} - - echo("Exporting client prefs"); - %prefPath = getPrefpath(); - export("$pref::*", %prefPath @ "/clientPrefs.cs", false); -} -// -function GraphicsDriverSetting::set(%setting) -{ - switch$(%setting) - { - case "D3D11": - GraphicsMenu::set("$pref::Video::displayDevice", "D3D11"); - case "OpenGL": - GraphicsMenu::set("$pref::Video::displayDevice", "OpenGL"); - default: - GraphicsMenu::set("$pref::Video::displayDevice", "OpenGL"); - } -} - -function GraphicsDriverSetting::get() -{ - if($pref::Video::displayDevice $= "D3D11") - return "D3D11"; - else if($pref::Video::displayDevice $= "OpenGL") - return "OpenGL"; - else - return "Unknown"; -} - -function GraphicsDriverSetting::getList() -{ - %returnsList = ""; - %buffer = getDisplayDeviceList(); - %deviceCount = getFieldCount( %buffer ); - %numAdapters = GFXInit::getAdapterCount(); - - %count = 0; - for(%i = 0; %i < %deviceCount; %i++) - { - %deviceDesc = getField(%buffer, %i); - - if(%deviceDesc $= "GFX Null Device") - continue; - - for( %i = 0; %i < %numAdapters; %i ++ ) - { - if( GFXInit::getAdapterName( %i ) $= %deviceDesc ) - { - %deviceName = GFXInit::getAdapterType( %i ); - break; - } - } - - if(%count != 0) - %returnsList = %returnsList @ "," @ %deviceName; - else - %returnsList = %deviceName; - - %count++; - } - - return %returnsList; -} - -// -function ScreenResolutionSetting::set(%setting) -{ - GraphicsMenu::set("$pref::Video::Resolution", %setting); -} - -function ScreenResolutionSetting::get() -{ - return _makePrettyResString( $pref::Video::Resolution ); -} - -function ScreenResolutionSetting::getList() -{ - %returnsList = ""; - - %resCount = Canvas.getModeCount(); - for (%i = 0; %i < %resCount; %i++) - { - %testResString = Canvas.getMode( %i ); - %testRes = _makePrettyResString( %testResString ); - - //sanitize - %found = false; - %retCount = getTokenCount(%returnsList, ","); - for (%x = 0; %x < %retCount; %x++) - { - %existingEntry = getToken(%returnsList, ",", %x); - if(%existingEntry $= %testRes) - { - %found = true; - break; - } - } - - if(%found) - continue; - - if(%i != 0) - %returnsList = %returnsList @ "," @ %testRes; - else - %returnsList = %testRes; - } - - return %returnsList; -} - -// -function FullscreenSetting::set(%setting) -{ - switch$(%setting) - { - case "On": - GraphicsMenu::set("$pref::Video::FullScreen", "1"); - case "Off": - GraphicsMenu::set("$pref::Video::FullScreen", "0"); - default: - GraphicsMenu::set("$pref::Video::FullScreen", "0"); - } -} - -function FullscreenSetting::get() -{ - if($pref::Video::FullScreen == 1) - return "On"; - else if($pref::Video::FullScreen == 0) - return "Off"; - else - return "Custom"; -} - -function FullscreenSetting::getList() -{ - return "Off,On"; -} - -// -function VSyncSetting::set(%setting) -{ - switch$(%setting) - { - case "On": - GraphicsMenu::set("$pref::Video::disableVerticalSync", "0"); - case "Off": - GraphicsMenu::set("$pref::Video::disableVerticalSync", "1"); - default: - GraphicsMenu::set("$pref::Video::disableVerticalSync", "1"); - } -} - -function VSyncSetting::get() -{ - if($pref::Video::disableVerticalSync == 0) - return "On"; - else if($pref::Video::disableVerticalSync == 1) - return "Off"; - else - return "Custom"; -} - -function VSyncSetting::getList() -{ - return "Off,On"; -} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/ui/scripts/graphicsMenu.cs b/Templates/BaseGame/game/data/ui/scripts/graphicsMenu.cs deleted file mode 100644 index 6ffa97590..000000000 --- a/Templates/BaseGame/game/data/ui/scripts/graphicsMenu.cs +++ /dev/null @@ -1,1050 +0,0 @@ -// ============================================================================= -// GRAPHICS MENU -// ============================================================================= -function GraphicsMenu::refresh(%this) -{ - // - // Display Menu - GraphicsMenuFullScreen.setStateOn( Canvas.isFullScreen() ); - GraphicsMenuVSync.setStateOn( !$pref::Video::disableVerticalSync ); - - %this.initResMenu(); - %resSelId = GraphicsMenuResolution.findText( _makePrettyResString( $pref::Video::mode ) ); - if( %resSelId != -1 ) - GraphicsMenuResolution.setSelected( %resSelId ); - - GraphicsMenuDriver.clear(); - - %buffer = getDisplayDeviceList(); - %count = getFieldCount( %buffer ); - for(%i = 0; %i < %count; %i++) - GraphicsMenuDriver.add(getField(%buffer, %i), %i); - - %selId = GraphicsMenuDriver.findText( getDisplayDeviceInformation() ); - if ( %selId == -1 ) - GraphicsMenuDriver.setFirstSelected(); - else - GraphicsMenuDriver.setSelected( %selId ); - // - - // - // General Graphics menu - GraphicsMenuShadowQlty.init(ShadowQualityList); - GraphicsMenuSoftShadow.init(SoftShadowList); - - GraphicsMenuModelDtl.init(MeshQualityGroup); - GraphicsMenuTextureDtl.init(TextureQualityGroup); - GraphicsMenuTerrainDtl.init(TerrainQualityGroup); - GraphicsMenuDecalLife.init(DecalLifetimeGroup); - GraphicsMenuGroundClutter.init(GroundCoverDensityGroup); - - GraphicsMenuMaterialQlty.init(ShaderQualityGroup); - - // Setup the anisotropic filtering menu. - %ansioCtrl = GraphicsMenuAniso; - %ansioCtrl.clear(); - %ansioCtrl.add( "16X", 16 ); - %ansioCtrl.add( "8X", 8 ); - %ansioCtrl.add( "4X", 4 ); - %ansioCtrl.add( "Off", 0 ); - %ansioCtrl.setSelected( $pref::Video::defaultAnisotropy, false ); - - // set up the Refresh Rate menu. - %refreshMenu = GraphicsMenuRefreshRate; - %refreshMenu.clear(); - // %refreshMenu.add("Auto", 60); - %refreshMenu.add("60", 60); - %refreshMenu.add("75", 75); - %refreshMenu.setSelected( $pref::Video::RefreshRate ); - - // Populate the Anti-aliasing popup. - %aaMenu = GraphicsMenuAA; - %aaMenu.clear(); - %aaMenu.Add( "4x", 4 ); - %aaMenu.Add( "2x", 2 ); - %aaMenu.Add( "1x", 1 ); - %aaMenu.Add( "Off", 0 ); - %aaMenu.setSelected( $pref::Video::AA ); - - //Parallax - GraphicsMenuParallax.setStateOn(!$pref::Video::disableParallaxMapping); - - //water reflections - GraphicsMenuWaterRefl.setStateOn(!$pref::Water::disableTrueReflections); - - GraphicsMenuParallax.setStateOn(!$pref::Video::disableParallaxMapping); - - GraphicsMenuAO.setStateOn($pref::PostFX::EnableSSAO); - GraphicsMenuHDR.setStateOn($pref::PostFX::EnableHDR); - GraphicsMenuDOF.setStateOn($pref::PostFX::EnableDOF); - GraphicsMenuVignette.setStateOn($pref::PostFX::EnableVignette); - GraphicsMenuLightRay.setStateOn($pref::PostFX::EnableLightRays); -} - -function GraphicsMenu::initResMenu( %this ) -{ - // Clear out previous values - %resMenu = GraphicsMenuResolution; - %resMenu.clear(); - - // If we are in a browser then we can't change our resolution through - // the options dialog - if (getWebDeployment()) - { - %count = 0; - %currRes = getWords(Canvas.getVideoMode(), $WORD::RES_X, $WORD::RES_Y); - %resMenu.add(%currRes, %count); - %count++; - - return; - } - - // Loop through all and add all valid resolutions - %count = 0; - %resCount = Canvas.getModeCount(); - for (%i = 0; %i < %resCount; %i++) - { - %testResString = Canvas.getMode( %i ); - %testRes = _makePrettyResString( %testResString ); - - // Only add to list if it isn't there already. - if (%resMenu.findText(%testRes) == -1) - { - %resMenu.add(%testRes, %i); - %count++; - } - } - - %resMenu.sort(); -} - -// -function GraphicsMenu::Autodetect(%this) -{ - $pref::Video::autoDetect = false; - - %shaderVer = getPixelShaderVersion(); - %intel = ( strstr( strupr( getDisplayDeviceInformation() ), "INTEL" ) != -1 ) ? true : false; - %videoMem = GFXCardProfilerAPI::getVideoMemoryMB(); - - return %this.Autodetect_Apply( %shaderVer, %intel, %videoMem ); -} - -function GraphicsMenu::Autodetect_Apply(%this, %shaderVer, %intel, %videoMem ) -{ - if ( %shaderVer < 2.0 ) - { - return "Your video card does not meet the minimum requirment of shader model 2.0."; - } - - if ( %shaderVer < 3.0 || %intel ) - { - // Allow specular and normals for 2.0a and 2.0b - if ( %shaderVer > 2.0 ) - { - MeshQualityGroup.applySetting("Lowest"); - TextureQualityGroup.applySetting("Lowest"); - GroundCoverDensityGroup.applySetting("Lowest"); - DecalLifetimeGroup.applySetting("None"); - TerrainQualityGroup.applySetting("Lowest"); - ShaderQualityGroup.applySetting("High"); - - ShadowQualityList.applySetting("None"); - - SoftShadowList.applySetting("Off"); - - $pref::Shadows::useShadowCaching = true; - - $pref::Water::disableTrueReflections = true; - $pref::Video::disableParallaxMapping = true; - $pref::PostFX::EnableSSAO = false; - $pref::PostFX::EnableHDR = false; - $pref::PostFX::EnableDOF = false; - $pref::PostFX::EnableLightRays = false; - $pref::PostFX::EnableVignette = false; - - $pref::Video::AA = 0; - $pref::Video::disableVerticalSync = 0; - } - else - { - MeshQualityGroup.applySetting("Lowest"); - TextureQualityGroup.applySetting("Lowest"); - GroundCoverDensityGroup.applySetting("Lowest"); - DecalLifetimeGroup.applySetting("None"); - TerrainQualityGroup.applySetting("Lowest"); - ShaderQualityGroup.applySetting("Low"); - - ShadowQualityList.applySetting("None"); - - SoftShadowList.applySetting("Off"); - - $pref::Shadows::useShadowCaching = true; - - $pref::Water::disableTrueReflections = true; - $pref::Video::disableParallaxMapping = true; - $pref::PostFX::EnableSSAO = false; - $pref::PostFX::EnableHDR = false; - $pref::PostFX::EnableDOF = false; - $pref::PostFX::EnableLightRays = false; - $pref::PostFX::EnableVignette = false; - - $pref::Video::AA = 0; - $pref::Video::disableVerticalSync = 0; - } - } - else - { - if ( %videoMem > 1000 ) - { - MeshQualityGroup.applySetting("High"); - TextureQualityGroup.applySetting("High"); - GroundCoverDensityGroup.applySetting("High"); - DecalLifetimeGroup.applySetting("High"); - TerrainQualityGroup.applySetting("High"); - ShaderQualityGroup.applySetting("High"); - - ShadowQualityList.applySetting("High"); - - SoftShadowList.applySetting("High"); - - //Should this default to on in ultra settings? - $pref::Shadows::useShadowCaching = true; - - $pref::Water::disableTrueReflections = false; - $pref::Video::disableParallaxMapping = false; - $pref::PostFX::EnableSSAO = true; - $pref::PostFX::EnableHDR = true; - $pref::PostFX::EnableDOF = true; - $pref::PostFX::EnableLightRays = true; - $pref::PostFX::EnableVignette = true; - - $pref::Video::AA = 4; - $pref::Video::disableVerticalSync = 16; - } - else if ( %videoMem > 400 || %videoMem == 0 ) - { - MeshQualityGroup.applySetting("Medium"); - TextureQualityGroup.applySetting("Medium"); - GroundCoverDensityGroup.applySetting("Medium"); - DecalLifetimeGroup.applySetting("Medium"); - TerrainQualityGroup.applySetting("Medium"); - ShaderQualityGroup.applySetting("High"); - - ShadowQualityList.applySetting("Medium"); - - SoftShadowList.applySetting("Low"); - - $pref::Shadows::useShadowCaching = true; - - $pref::Water::disableTrueReflections = false; - $pref::Video::disableParallaxMapping = true; - $pref::PostFX::EnableSSAO = false; - $pref::PostFX::EnableHDR = true; - $pref::PostFX::EnableDOF = true; - $pref::PostFX::EnableLightRays = true; - $pref::PostFX::EnableVignette = true; - - $pref::Video::AA = 4; - $pref::Video::disableVerticalSync = 4; - - if ( %videoMem == 0 ) - return "Torque was unable to detect available video memory. Applying 'Medium' quality."; - } - else - { - MeshQualityGroup.applySetting("Low"); - TextureQualityGroup.applySetting("Low"); - GroundCoverDensityGroup.applySetting("Low"); - DecalLifetimeGroup.applySetting("Low"); - TerrainQualityGroup.applySetting("Low"); - ShaderQualityGroup.applySetting("Low"); - - ShadowQualityList.applySetting("None"); - - SoftShadowList.applySetting("Off"); - - $pref::Shadows::useShadowCaching = true; - - $pref::Water::disableTrueReflections = false; - $pref::Video::disableParallaxMapping = true; - $pref::PostFX::EnableSSAO = false; - $pref::PostFX::EnableHDR = false; - $pref::PostFX::EnableDOF = false; - $pref::PostFX::EnableLightRays = false; - $pref::PostFX::EnableVignette = false; - - $pref::Video::AA = 0; - $pref::Video::disableVerticalSync = 0; - } - } - - %this.refresh(); - - %this.apply(); - - //force postFX updates - PostFXManager.settingsEffectSetEnabled(SSAOPostFx, $pref::PostFX::EnableSSAO); - PostFXManager.settingsEffectSetEnabled(HDRPostFX, $pref::PostFX::EnableHDR); - PostFXManager.settingsEffectSetEnabled(DOFPostEffect, $pref::PostFX::EnableDOF); - PostFXManager.settingsEffectSetEnabled(LightRayPostFX, $pref::PostFX::EnableLightRays); - PostFXManager.settingsEffectSetEnabled(VignettePostEffect, $pref::PostFX::EnableVignette); - - return "Graphics quality settings have been auto detected."; -} - -function _makePrettyResString( %resString, %giveAspectRation ) -{ - %width = getWord( %resString, $WORD::RES_X ); - %height = getWord( %resString, $WORD::RES_Y ); - - %aspect = %width / %height; - %aspect = mRound( %aspect * 100 ) * 0.01; - - switch$( %aspect ) - { - case "1.33": - %aspect = "4:3"; - case "1.78": - %aspect = "16:9"; - default: - %aspect = ""; - } - - %outRes = %width @ " x " @ %height; - if ( %giveAspectRation && %aspect !$= "" ) - %outRes = %outRes @ " (" @ %aspect @ ")"; - - return %outRes; -} - -function GraphicsMenu::apply(%this) -{ - //Loop through the settings cache and actually apply the values - %cachedSettingCount = GraphicsSettingsCache.count(); - %canvasUpdate = false; - - for(%i=0; %i < %cachedSettingCount; %i++) - { - %var = GraphicsSettingsCache.getKey(%i); - %val = GraphicsSettingsCache.getValue(%i); - - if(%var $= "$pref::Video::AA") - { - %canvasUpdate = true; - } - - setVariable(%var, %val); - } - - //Update Textures - reloadTextures(); - - //Update lighting - // Set the light manager. This should do nothing - // if its already set or if its not compatible. - //setLightManager( $pref::lightManager ); - - PostFXManager.settingsEffectSetEnabled("SSAO", $pref::PostFX::EnableSSAO); - PostFXManager.settingsEffectSetEnabled("HDR", $pref::PostFX::EnableHDR); - PostFXManager.settingsEffectSetEnabled("DOF", $pref::PostFX::EnableDOF); - PostFXManager.settingsEffectSetEnabled("LightRays", $pref::PostFX::EnableLightRays); - PostFXManager.settingsEffectSetEnabled("Vignette", $pref::PostFX::EnableVignette); - - if ( %canvasUpdate ) - { - // Change the video mode. - configureCanvas(); - } - - echo("Exporting client prefs"); - %prefPath = getPrefpath(); - export("$pref::*", %prefPath @ "/clientPrefs.cs", false); -} - -function GraphicsMenu::loadSettings() -{ - OptionsMenu.currentMenu = "GraphicsMenu"; - OptionsSettingStack.clear(); - - OptionsMenu.addSettingOption(OptionsSettingStack, "Shadow Quality", "", "ShadowQuality"); - //OptionsMenu.addSettingOption(OptionsSettingStack, "Shadow Caching", "", "ShadowCaching"); - OptionsMenu.addSettingOption(OptionsSettingStack, "Soft Shadows", "", "SoftShadow"); - - OptionsMenu.addSettingOption(OptionsSettingStack, "Model Detail", "", "MeshQuality"); - OptionsMenu.addSettingOption(OptionsSettingStack, "Texture Detail", "", "TextureQuality"); - OptionsMenu.addSettingOption(OptionsSettingStack, "Terrain Detail", "", "TerrainQuality"); - OptionsMenu.addSettingOption(OptionsSettingStack, "Decal Lifetime", "", "DecalLifetime"); - OptionsMenu.addSettingOption(OptionsSettingStack, "Ground Clutter Density", "", "GroundCoverDensity"); - - OptionsMenu.addSettingOption(OptionsSettingStack, "Material Quality", "", "ShaderQuality"); - OptionsMenu.addSettingOption(OptionsSettingStack, "Parallax", "", "ParallaxSetting"); - OptionsMenu.addSettingOption(OptionsSettingStack, "Ambient Occlusion", "", "AmbientOcclusionSetting"); - OptionsMenu.addSettingOption(OptionsSettingStack, "Light Rays", "", "LightRaysSetting"); - OptionsMenu.addSettingOption(OptionsSettingStack, "Depth of Field", "", "DOFSetting"); - OptionsMenu.addSettingOption(OptionsSettingStack, "Vignetting", "", "VignetteSetting"); - OptionsMenu.addSettingOption(OptionsSettingStack, "Water Reflections", "", "WaterReflectionSetting"); - OptionsMenu.addSettingOption(OptionsSettingStack, "Anti Aliasing", "", "AASetting"); - OptionsMenu.addSettingOption(OptionsSettingStack, "Anisotropic Filtering", "", "AnisotropicFilteringSetting"); - - GraphicsSettingsCache.empty(); -} - -function GraphicsMenu::set(%var, %val) -{ - %ex = GraphicsSettingsCache.getIndexFromKey(%var); - if(%ex != -1) - GraphicsSettingsCache.erase(%ex); - - GraphicsSettingsCache.add(%var, %val); -} - -// -// -// -function MeshQuality::set(%setting) -{ - switch$(%setting) - { - case "High": - GraphicsMenu::set("$pref::TS::detailAdjust", "1.5"); - GraphicsMenu::set("$pref::TS::skipRenderDLs", "0"); - case "Medium": - GraphicsMenu::set("$pref::TS::detailAdjust", "1.0"); - GraphicsMenu::set("$pref::TS::skipRenderDLs", "0"); - case "Low": - GraphicsMenu::set("$pref::TS::detailAdjust", "0.75"); - GraphicsMenu::set("$pref::TS::skipRenderDLs", "0"); - case "Lowest": - GraphicsMenu::set("$pref::TS::detailAdjust", "0.5"); - GraphicsMenu::set("$pref::TS::skipRenderDLs", "0"); - default: - GraphicsMenu::set("$pref::TS::detailAdjust", "1.0"); - GraphicsMenu::set("$pref::TS::skipRenderDLs", "0"); - } -} - -function MeshQuality::get() -{ - if($pref::TS::detailAdjust == 1.5) - return "High"; - else if($pref::TS::detailAdjust == 1.0) - return "Medium"; - else if($pref::TS::detailAdjust == 0.75) - return "Low"; - else if($pref::TS::detailAdjust == 0.5) - return "Lowest"; - else - return "Custom"; -} - -function MeshQuality::getList() -{ - return "Lowest,Low,Medium,High"; -} - -// -function TextureQuality::set(%setting) -{ - switch$(%setting) - { - case "High": - GraphicsMenu::set("$pref::Video::textureReductionLevel", "0"); - GraphicsMenu::set("$pref::Reflect::refractTexScale", "1.25"); - case "Medium": - GraphicsMenu::set("$pref::Video::textureReductionLevel", "0"); - GraphicsMenu::set("$pref::Reflect::refractTexScale", "1"); - case "Low": - GraphicsMenu::set("$pref::Video::textureReductionLevel", "1"); - GraphicsMenu::set("$pref::Reflect::refractTexScale", "0.75"); - case "Lowest": - GraphicsMenu::set("$pref::Video::textureReductionLevel", "2"); - GraphicsMenu::set("$pref::Reflect::refractTexScale", "0.5"); - default: - GraphicsMenu::set("$pref::Video::textureReductionLevel", "0"); - GraphicsMenu::set("$pref::Reflect::refractTexScale", "1"); - } -} - -function TextureQuality::get() -{ - if($pref::Video::textureReductionLevel == 0 && $pref::Reflect::refractTexScale == 1.25) - return "High"; - else if($pref::Video::textureReductionLevel == 0 && $pref::Reflect::refractTexScale == 1) - return "Medium"; - else if($pref::Video::textureReductionLevel == 1 && $pref::Reflect::refractTexScale == 0.75) - return "Low"; - else if($pref::Video::textureReductionLevel == 2 && $pref::Reflect::refractTexScale == 0.5) - return "Lowest"; - else - return "Custom"; -} - -function TextureQuality::getList() -{ - return "Lowest,Low,Medium,High"; -} - -// -function GroundCoverDensity::set(%setting) -{ - switch$(%setting) - { - case "High": - GraphicsMenu::set("$pref::GroundCover::densityScale", "1"); - case "Medium": - GraphicsMenu::set("$pref::GroundCover::densityScale", "0.75"); - case "Low": - GraphicsMenu::set("$pref::GroundCover::densityScale", "0.5"); - case "Lowest": - GraphicsMenu::set("$pref::GroundCover::densityScale", "0.25"); - default: - GraphicsMenu::set("$pref::GroundCover::densityScale", "0.75"); - } -} - -function GroundCoverDensity::get() -{ - if($pref::GroundCover::densityScale == 1) - return "High"; - else if($pref::GroundCover::densityScale == 0.75) - return "Medium"; - else if($pref::GroundCover::densityScale == 0.5) - return "Low"; - else if($pref::GroundCover::densityScale == 0.25) - return "Lowest"; - else - return "Custom"; -} - -function GroundCoverDensity::getList() -{ - return "Lowest,Low,Medium,High"; -} - -// -function DecalLifetime::set(%setting) -{ - switch$(%setting) - { - case "High": - GraphicsMenu::set("$pref::decalMgr::enabled", "true"); - GraphicsMenu::set("$pref::Decals::lifeTimeScale", "1"); - case "Medium": - GraphicsMenu::set("$pref::decalMgr::enabled", "true"); - GraphicsMenu::set("$pref::Decals::lifeTimeScale", "0.5"); - case "Low": - GraphicsMenu::set("$pref::decalMgr::enabled", "true"); - GraphicsMenu::set("$pref::Decals::lifeTimeScale", "0.25"); - case "None": - GraphicsMenu::set("$pref::decalMgr::enabled", "false"); - default: - GraphicsMenu::set("$pref::decalMgr::enabled", "true"); - GraphicsMenu::set("$pref::Decals::lifeTimeScale", "0.5"); - } -} - -function DecalLifetime::get() -{ - if($pref::decalMgr::enabled == true && $pref::Decals::lifeTimeScale == 1) - return "High"; - else if($pref::decalMgr::enabled == true && $pref::Decals::lifeTimeScale == 0.5) - return "Medium"; - else if($pref::decalMgr::enabled == true && $pref::Decals::lifeTimeScale == 0.25) - return "Low"; - else if($pref::decalMgr::enabled == true ) - return "None"; - else - return "Custom"; -} - -function DecalLifetime::getList() -{ - return "None,Low,Medium,High"; -} - -// -function TerrainQuality::set(%setting) -{ - switch$(%setting) - { - case "High": - GraphicsMenu::set("$pref::Terrain::lodScale", "0.75"); - GraphicsMenu::set("$pref::Terrain::detailScale", "1.5"); - case "Medium": - GraphicsMenu::set("$pref::Terrain::lodScale", "1"); - GraphicsMenu::set("$pref::Terrain::detailScale", "1"); - case "Low": - GraphicsMenu::set("$pref::Terrain::lodScale", "1.5"); - GraphicsMenu::set("$pref::Terrain::detailScale", "0.75"); - case "Lowest": - GraphicsMenu::set("$pref::Terrain::lodScale", "2"); - GraphicsMenu::set("$pref::Terrain::detailScale", "0.5"); - default: - GraphicsMenu::set("$pref::decalMgr::enabled", "1"); - GraphicsMenu::set("$pref::Decals::lifeTimeScale", "1"); - } -} - -function TerrainQuality::get() -{ - if($pref::Terrain::lodScale == 0.75 && $pref::Terrain::detailScale == 1.5) - return "High"; - else if($pref::Terrain::lodScale == 1 && $pref::Terrain::detailScale == 1) - return "Medium"; - else if($pref::Terrain::lodScale == 1.5 && $pref::Terrain::detailScale == 0.75) - return "Low"; - else if($pref::Terrain::lodScale == 2 && $pref::Terrain::detailScale == 0.5) - return "Lowest"; - else - return "Custom"; -} - -function TerrainQuality::getList() -{ - return "Lowest,Low,Medium,High"; -} - -// -function ShadowQuality::set(%setting) -{ - switch$(%setting) - { - case "High": - GraphicsMenu::set("$pref::Shadows::disable", "false"); - GraphicsMenu::set("$pref::Shadows::textureScalar", "1.0"); - case "Medium": - GraphicsMenu::set("$pref::Shadows::disable", "false"); - GraphicsMenu::set("$pref::Shadows::textureScalar", "0.5"); - case "Low": - GraphicsMenu::set("$pref::Shadows::disable", "false"); - GraphicsMenu::set("$pref::Shadows::textureScalar", "0.25"); - case "None": - GraphicsMenu::set("$pref::Shadows::disable", "true"); - GraphicsMenu::set("$pref::Shadows::textureScalar", "0.5"); - default: - GraphicsMenu::set("$pref::Shadows::disable", "false"); - GraphicsMenu::set("$pref::Shadows::textureScalar", "0.5"); - } -} - -function ShadowQuality::get() -{ - if($pref::Shadows::disable == false && $pref::Shadows::textureScalar == 1.0) - return "High"; - else if($pref::Shadows::disable == false && $pref::Shadows::textureScalar == 0.5) - return "Medium"; - else if($pref::Shadows::disable == false && $pref::Shadows::textureScalar == 0.25) - return "Low"; - else if($pref::Shadows::disable == true) - return "None"; - else - return "Custom"; -} - -function ShadowQuality::getList() -{ - return "None,Low,Medium,High"; -} - -// -function ShadowDistance::set(%setting) -{ - switch$(%setting) - { - case "Highest": - GraphicsMenu::set("$pref::Shadows::drawDistance", "1.0"); - case "High": - GraphicsMenu::set("$pref::Shadows::drawDistance", "0.75"); - case "Medium": - GraphicsMenu::set("$pref::Shadows::drawDistance", "0.5"); - case "Low": - GraphicsMenu::set("$pref::Shadows::drawDistance", "0.25"); - default: - GraphicsMenu::set("$pref::Shadows::drawDistance", "0.5"); - } -} - -function ShadowDistance::get() -{ - if($pref::Shadows::drawDistance == 1.0) - return "Highest"; - else if($pref::Shadows::drawDistance == 0.75) - return "High"; - else if($pref::Shadows::drawDistance == 0.5) - return "Medium"; - else if($pref::Shadows::drawDistance == 0.25) - return "Low"; - else - return "Custom"; -} - -function ShadowDistance::getList() -{ - return "Low,Medium,High,Highest"; -} - -// -function SoftShadow::set(%setting) -{ - switch$(%setting) - { - case "High": - GraphicsMenu::set("$pref::Shadows::filterMode", "SoftShadowHighQuality"); - case "Low": - GraphicsMenu::set("$pref::Shadows::filterMode", "SoftShadow"); - case "Off": - GraphicsMenu::set("$pref::Shadows::filterMode", "None"); - default: - GraphicsMenu::set("$pref::Shadows::filterMode", "SoftShadow"); - } -} - -function SoftShadow::get() -{ - if($pref::Shadows::filterMode $= "SoftShadowHighQuality") - return "High"; - else if($pref::Shadows::filterMode $= "SoftShadow") - return "Low"; - else if($pref::Shadows::filterMode $= "None") - return "Off"; - else - return "Custom"; -} - -function SoftShadow::getList() -{ - return "Off,Low,High"; -} - -// -function LightDistance::set(%setting) -{ - switch$(%setting) - { - case "High": - GraphicsMenu::set("$pref::Lights::drawDistance", "1"); - case "Medium": - GraphicsMenu::set("$pref::Lights::drawDistance", "0.75"); - case "Low": - GraphicsMenu::set("$pref::Lights::drawDistance", "0.5"); - case "Lowest": - GraphicsMenu::set("$pref::Lights::drawDistance", "0.25"); - default: - GraphicsMenu::set("$pref::Lights::drawDistance", "0.75"); - } -} - -function LightDistance::get() -{ - if($pref::Lights::drawDistance == 1) - return "High"; - else if($pref::Lights::drawDistance == 0.75) - return "Medium"; - else if($pref::Lights::drawDistance == 0.5) - return "Low"; - else if($pref::Lights::drawDistance == 0.25) - return "Lowest"; - else - return "Custom"; -} - -function LightDistance::getList() -{ - return "Lowest,Low,Medium,High"; -} - -// -function ShaderQuality::set(%setting) -{ - switch$(%setting) - { - case "High": - GraphicsMenu::set("$pref::Video::disablePixSpecular", "false"); - GraphicsMenu::set("$pref::Video::disableNormalmapping", "false"); - case "Low": - GraphicsMenu::set("$pref::Video::disablePixSpecular", "true"); - GraphicsMenu::set("$pref::Video::disableNormalmapping", "true"); - default: - GraphicsMenu::set("$pref::Video::disablePixSpecular", "false"); - GraphicsMenu::set("$pref::Video::disableNormalmapping", "false"); - } -} - -function ShaderQuality::get() -{ - if($pref::Video::disablePixSpecular == false || $pref::Video::disableNormalmapping == false) - return "High"; - else if($pref::Video::disablePixSpecular == true || $pref::Video::disableNormalmapping == true) - return "Low"; - else - return "Custom"; -} - -function ShaderQuality::getList() -{ - return "Low,High"; -} - -// -function ShadowCaching::set(%setting) -{ - switch$(%setting) - { - case "On": - GraphicsMenu::set("$pref::Shadows::useShadowCaching", "true"); - case "Off": - GraphicsMenu::set("$pref::Shadows::useShadowCaching", "false"); - default: - GraphicsMenu::set("$pref::Shadows::useShadowCaching", "true"); - } -} - -function ShadowCaching::get() -{ - if($pref::Shadows::useShadowCaching == true) - return "On"; - else - return "Off"; -} - -function ShadowCaching::getList() -{ - return "Off,On"; -} - -// -function ParallaxSetting::set(%setting) -{ - switch$(%setting) - { - case "On": - GraphicsMenu::set("$pref::Video::disableParallaxMapping", "false"); - case "Off": - GraphicsMenu::set("$pref::Video::disableParallaxMapping", "true"); - default: - GraphicsMenu::set("$pref::Video::disableParallaxMapping", "false"); - } -} - -function ParallaxSetting::get() -{ - if($pref::Video::disableParallaxMapping == false) - return "On"; - else - return "Off"; -} - -function ParallaxSetting::getList() -{ - return "Off,On"; -} - -// -function AmbientOcclusionSetting::set(%setting) -{ - switch$(%setting) - { - case "On": - GraphicsMenu::set("$pref::PostFX::EnableSSAO", "true"); - case "Off": - GraphicsMenu::set("$pref::PostFX::EnableSSAO", "false"); - default: - GraphicsMenu::set("$pref::PostFX::EnableSSAO", "true"); - } -} - -function AmbientOcclusionSetting::get() -{ - if($pref::PostFX::EnableSSAO == true) - return "On"; - else - return "Off"; -} - -function AmbientOcclusionSetting::getList() -{ - return "Off,On"; -} - -// -function LightRaysSetting::set(%setting) -{ - switch$(%setting) - { - case "On": - GraphicsMenu::set("$pref::PostFX::EnableLightRays", "true"); - case "Off": - GraphicsMenu::set("$pref::PostFX::EnableLightRays", "false"); - default: - GraphicsMenu::set("$pref::PostFX::EnableLightRays", "true"); - } -} - -function LightRaysSetting::get() -{ - if($pref::PostFX::EnableLightRays == true) - return "On"; - else - return "Off"; -} - -function LightRaysSetting::getList() -{ - return "Off,On"; -} - -// -function DOFSetting::set(%setting) -{ - switch$(%setting) - { - case "On": - GraphicsMenu::set("$pref::PostFX::EnableDOF", "true"); - case "Off": - GraphicsMenu::set("$pref::PostFX::EnableDOF", "false"); - default: - GraphicsMenu::set("$pref::PostFX::EnableDOF", "true"); - } -} - -function DOFSetting::get() -{ - if($pref::PostFX::EnableLightRays == true) - return "On"; - else - return "Off"; -} - -function DOFSetting::getList() -{ - return "Off,On"; -} - -// -function WaterReflectionSetting::set(%setting) -{ - switch$(%setting) - { - case "On": - GraphicsMenu::set("$pref::Water::disableTrueReflections", "false"); - case "Off": - GraphicsMenu::set("$pref::Water::disableTrueReflections", "true"); - default: - GraphicsMenu::set("$pref::Water::disableTrueReflections", "false"); - } -} - -function WaterReflectionSetting::get() -{ - if($pref::Water::disableTrueReflections == false) - return "On"; - else - return "Off"; -} - -function WaterReflectionSetting::getList() -{ - return "Off,On"; -} - -// -function VignetteSetting::set(%setting) -{ - switch$(%setting) - { - case "On": - GraphicsMenu::set("$pref::PostFX::EnableVignette", "true"); - case "Off": - GraphicsMenu::set("$pref::PostFX::EnableVignette", "false"); - default: - GraphicsMenu::set("$pref::PostFX::EnableVignette", "true"); - } -} - -function VignetteSetting::get() -{ - if($pref::PostFX::EnableVignette == true) - return "On"; - else - return "Off"; -} - -function VignetteSetting::getList() -{ - return "Off,On"; -} - -// -function AASetting::set(%setting) -{ - switch$(%setting) - { - case "4x": - GraphicsMenu::set("$pref::Video::AA", "4"); - case "2x": - GraphicsMenu::set("$pref::Video::AA", "2"); - case "1x": - GraphicsMenu::set("$pref::Video::AA", "1"); - case "Off": - GraphicsMenu::set("$pref::Video::AA", "0"); - default: - GraphicsMenu::set("$pref::Video::AA", "0"); - } -} - -function AASetting::get() -{ - if($pref::Video::AA == 4) - return "4x"; - else if($pref::Video::AA == 2) - return "2x"; - else if($pref::Video::AA == 1) - return "1x"; - else if($pref::Video::AA == 0) - return "Off"; - else - return "Custom"; -} - -function AASetting::getList() -{ - return "Off,1x,2x,4x"; -} - -// -function AnisotropicFilteringSetting::set(%setting) -{ - switch$(%setting) - { - case "16x": - GraphicsMenu::set("$pref::Video::defaultAnisotropy", "16"); - case "8x": - GraphicsMenu::set("$pref::Video::defaultAnisotropy", "8"); - case "4x": - GraphicsMenu::set("$pref::Video::defaultAnisotropy", "4"); - case "Off": - GraphicsMenu::set("$pref::Video::defaultAnisotropy", "0"); - default: - GraphicsMenu::set("$pref::Video::defaultAnisotropy", "0"); - } -} - -function AnisotropicFilteringSetting::get() -{ - if($pref::Video::defaultAnisotropy == 16) - return "16x"; - else if($pref::Video::defaultAnisotropy == 8) - return "8x"; - else if($pref::Video::defaultAnisotropy == 4) - return "4x"; - else if($pref::Video::defaultAnisotropy == 0) - return "Off"; - else - return "Custom"; -} - -function AnisotropicFilteringSetting::getList() -{ - return "Off,4x,8x,16x"; -} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/ui/scripts/messageBoxes.cs b/Templates/BaseGame/game/data/ui/scripts/messageBoxes.cs index 024dd4132..403463695 100644 --- a/Templates/BaseGame/game/data/ui/scripts/messageBoxes.cs +++ b/Templates/BaseGame/game/data/ui/scripts/messageBoxes.cs @@ -103,6 +103,7 @@ function MessageBoxOK(%title, %message, %callback) MessageBoxOKButtonHolder-->OKButton.set("btn_a", "Return", "OK", "MessageCallback(MessageBoxDlg,MessageBoxDlg.callback);"); + MessageBoxCtrl.originalMenuInputContainer = $activeMenuButtonContainer; MessageBoxOKButtonHolder.setActive(); MBSetText(MessageBoxText, MessageBoxCtrl, %message); @@ -112,6 +113,7 @@ function MessageBoxOK(%title, %message, %callback) function MessageBoxOKDlg::onSleep( %this ) { %this.callback = ""; + MessageBoxCtrl.originalMenuInputContainer.setActive(); } function MessageBoxOKCancel(%title, %message, %callback, %cancelCallback) @@ -126,6 +128,7 @@ function MessageBoxOKCancel(%title, %message, %callback, %cancelCallback) MessageBoxOCButtonHolder-->OKButton.set("btn_a", "Return", "OK", "MessageCallback(MessageBoxDlg,MessageBoxDlg.callback);"); MessageBoxOCButtonHolder-->CancelButton.set("btn_b", "Escape", "Cancel", "MessageCallback(MessageBoxDlg,MessageBoxDlg.cancelCallback);"); + MessageBoxCtrl.originalMenuInputContainer = $activeMenuButtonContainer; MessageBoxOCButtonHolder.setActive(); MBSetText(MessageBoxText, MessageBoxCtrl, %message); @@ -136,6 +139,7 @@ function MessageBoxOKCancel(%title, %message, %callback, %cancelCallback) function MessageBoxOKCancelDlg::onSleep( %this ) { %this.callback = ""; + MessageBoxCtrl.originalMenuInputContainer.setActive(); } function MessageBoxOKCancelDetails(%title, %message, %details, %callback, %cancelCallback) @@ -207,6 +211,7 @@ function MBOKCancelDetailsToggleInfoFrame() function MessageBoxOKCancelDetailsDlg::onSleep( %this ) { %this.callback = ""; + MessageBoxCtrl.originalMenuInputContainer.setActive(); } function MessageBoxYesNo(%title, %message, %yesCallback, %noCallback) @@ -221,6 +226,7 @@ function MessageBoxYesNo(%title, %message, %yesCallback, %noCallback) MessageBoxOCButtonHolder-->OKButton.set("btn_a", "Return", "Yes", "MessageCallback(MessageBoxDlg,MessageBoxDlg.yesCallBack);"); MessageBoxOCButtonHolder-->CancelButton.set("btn_b", "Escape", "No", "MessageCallback(MessageBoxDlg,MessageBoxDlg.noCallback);"); + MessageBoxCtrl.originalMenuInputContainer = $activeMenuButtonContainer; MessageBoxOCButtonHolder.setActive(); MBSetText(MessageBoxText, MessageBoxCtrl, %message); @@ -241,6 +247,7 @@ function MessageBoxYesNoCancel(%title, %message, %yesCallback, %noCallback, %can MessageBoxYNCButtonHolder-->noButton.set("btn_x", "backspace", "No", "MessageCallback(MessageBoxDlg,MessageBoxDlg.noCallback);"); MessageBoxYNCButtonHolder-->cancelButton.set("btn_b", "Escape", "No", "MessageCallback(MessageBoxDlg,MessageBoxDlg.cancelCallback);"); + MessageBoxCtrl.originalMenuInputContainer = $activeMenuButtonContainer; MessageBoxYNCButtonHolder.setActive(); MBSetText(MessageBoxText, MessageBoxCtrl, %message); @@ -256,6 +263,7 @@ function MessageBoxDlg::onSleep( %this ) %this.yesCallback = ""; %this.noCallback = ""; %this.cancelCallback = ""; + MessageBoxCtrl.originalMenuInputContainer.setActive(); } //--------------------------------------------------------------------------------------------- diff --git a/Templates/BaseGame/game/data/ui/scripts/profiles.cs b/Templates/BaseGame/game/data/ui/scripts/profiles.cs index c0ea8d442..ac4a4b66e 100644 --- a/Templates/BaseGame/game/data/ui/scripts/profiles.cs +++ b/Templates/BaseGame/game/data/ui/scripts/profiles.cs @@ -10,6 +10,11 @@ new GuiGameListMenuProfile(DefaultListMenuProfile) fontColorSEL = $TextMediumEmphasisColor; fontColorNA = $TextDisabledColor; fontColorHL = $TextMediumEmphasisColor; + + fillColor = "108 108 108"; + fillColorHL = "140 140 140"; + fillColorSEL = "180 180 180"; + HitAreaUpperLeft = "16 20"; HitAreaLowerRight = "503 74"; IconOffset = "40 0";