|
@@ -1,53 +1,9 @@
|
|
|
-//options settings
|
|
|
+$optionsEntryPad = 10;
|
|
|
|
|
|
-//Screen and Display menu
|
|
|
-//Renderer Mode
|
|
|
-//Screen resolution
|
|
|
-//Windowed/fullscreen(borderless?)
|
|
|
-//VSync
|
|
|
-
|
|
|
-//Screen brightness
|
|
|
-//screen brightness
|
|
|
-//screen gamma
|
|
|
-
|
|
|
-//Lighting Menu
|
|
|
-//Shadow Distance(Distance shadows are drawn to. Also affects shadowmap slices)
|
|
|
-//Shadow Quality(Resolution of shadows rendered, setting to none disables dynamic shadows)
|
|
|
-//Soft Shadows(Whether shadow softening is used)
|
|
|
-//Shadow caching(If the lights enable it, shadow caching is activated)
|
|
|
-//Light Draw Distance(How far away lights are still drawn. Doesn't impact vector lights like the sun)
|
|
|
-
|
|
|
-//Mesh and Textures Menu
|
|
|
-//Draw distance(Overall draw distance) -slider
|
|
|
-//Object draw distance(Draw distance from small/unimportant objects) -slider
|
|
|
-//Mesh quality
|
|
|
-//Texture quality
|
|
|
-//Foliage draw distance
|
|
|
-//Terrain Quality
|
|
|
-//Decal Quality
|
|
|
-
|
|
|
-//Effects Menu
|
|
|
-//Parallax
|
|
|
-//HDR
|
|
|
-//Light shafts
|
|
|
-//Motion Blur
|
|
|
-//Depth of Field
|
|
|
-//SSAO
|
|
|
-//AA(ModelXAmount)[defualt is FXAA]
|
|
|
-//Anisotropic filtering
|
|
|
-
|
|
|
-//Keybinds
|
|
|
-
|
|
|
-//Camera
|
|
|
-//horizontal mouse sensitivity
|
|
|
-//vert mouse sensitivity
|
|
|
-//invert vertical
|
|
|
-//zoom mouse sensitivities(both horz/vert)
|
|
|
-//headbob
|
|
|
-//FOV
|
|
|
-
|
|
|
-$yesNoList = "No\tYes";
|
|
|
-$onOffList = "Off\tOn";
|
|
|
+$OptionsMenuCategories[0] = "Video";
|
|
|
+$OptionsMenuCategories[1] = "Audio";
|
|
|
+$OptionsMenuCategories[2] = "KBM";
|
|
|
+$OptionsMenuCategories[3] = "Controller";
|
|
|
|
|
|
function OptionsMenu::onAdd(%this)
|
|
|
{
|
|
@@ -56,1126 +12,1053 @@ function OptionsMenu::onAdd(%this)
|
|
|
%this.optionsCategories = new ArrayObject();
|
|
|
}
|
|
|
|
|
|
- if(!isObject(%this.unappliedChanges))
|
|
|
- {
|
|
|
- %this.unappliedChanges = new ArrayObject(OptionsMenuUnappliedChanges);
|
|
|
- }
|
|
|
-
|
|
|
%this.currentCategory = "";
|
|
|
|
|
|
- addOptionsMenuCategory("Display", "populateDisplaySettingsList();");
|
|
|
- addOptionsMenuCategory("Graphics", "populateGraphicsSettingsList();");
|
|
|
- addOptionsMenuCategory("Audio", "populateAudioSettingsList();");
|
|
|
- addOptionsMenuCategory("Keyboard & Mouse", "populateKeyboardMouseSettingsList();");
|
|
|
- addOptionsMenuCategory("Gamepad", "populateGamepadSettingsList();");
|
|
|
-
|
|
|
callOnModules("populateOptionsMenuCategories", "Game");
|
|
|
}
|
|
|
|
|
|
-function OptionsMenu::onOpen(%this)
|
|
|
+function OptionsMenu::onWake(%this)
|
|
|
{
|
|
|
- OptionsMenuCategoryList.clear();
|
|
|
-
|
|
|
- for(%i=0; %i < %this.optionsCategories.count(); %i++)
|
|
|
- {
|
|
|
- %catName = %this.optionsCategories.getKey(%i);
|
|
|
- %callback = %this.optionsCategories.getValue(%i);
|
|
|
-
|
|
|
- %newCatButton = new GuiButtonCtrl() {
|
|
|
- text = %catName;
|
|
|
- groupNum = "-1";
|
|
|
- buttonType = "PushButton";
|
|
|
- useMouseEvents = "0";
|
|
|
- position = "0 180";
|
|
|
- extent = "248 35";
|
|
|
- minExtent = "8 2";
|
|
|
- horizSizing = "right";
|
|
|
- vertSizing = "bottom";
|
|
|
- profile = "GuiMenuButtonProfile";
|
|
|
- visible = "1";
|
|
|
- active = "1";
|
|
|
- command = %callback;
|
|
|
- tooltipProfile = "GuiToolTipProfile";
|
|
|
- hovertime = "1000";
|
|
|
- isContainer = "0";
|
|
|
- canSave = "1";
|
|
|
- canSaveDynamicFields = "0";
|
|
|
- };
|
|
|
-
|
|
|
- OptionsMenuCategoryList.add(%newCatButton);
|
|
|
- }
|
|
|
+ %this.optsListCount = -1;
|
|
|
+ $optionsChangeRequiresRestart = false;
|
|
|
|
|
|
- %this.unappliedChanges.empty();
|
|
|
- $pref::Video::displayDeviceId = "";
|
|
|
+ %this.populateVideoSettings();
|
|
|
|
|
|
- OptionsMenuCategoryList.setAsActiveMenuList();
|
|
|
+ %this.populateAudioSettings();
|
|
|
|
|
|
- $activeMenuButtonContainer-->button1.set("btn_back", "R", "Reset", "OptionsMenu.resetToDefaults();");
|
|
|
- $activeMenuButtonContainer-->button2.disable();
|
|
|
- $activeMenuButtonContainer-->button3.set("", "Space", "Apply", "OptionsMenu.apply();");
|
|
|
- $activeMenuButtonContainer-->button4.set("btn_a", "", "Select", "OptionsMenu.select();");
|
|
|
- $activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", %this @ ".navigation.popPage();");
|
|
|
-}
|
|
|
+ %this.populateKBMControls();
|
|
|
|
|
|
-//We capitalize on the canClose test here, because we want to prompt for unapplied options changes before
|
|
|
-//backing out. So when the UINavigation test canClose, we can see if we have unapplied settings and prompt
|
|
|
-//that via the message box and return false.
|
|
|
-//This gives the user a chance to choose how they wish to proceed before we allow the
|
|
|
-//UINavigation to move away from the options menu
|
|
|
-function OptionsMenu::canClose(%this)
|
|
|
-{
|
|
|
- //Another special case is us catching the 'back/pop' action by just shifting from one
|
|
|
- //menu list to another. In this case, we check if we were on the settings list as our active MenuList
|
|
|
- //if so, then the back/pop just moves us to the Category list as our active and we inform the
|
|
|
- //UINavigation to not close the page
|
|
|
- if(OptionsMenuSettingsList.isActiveMenuList())
|
|
|
- {
|
|
|
- OptionsMenuCategoryList.setAsActiveMenuList();
|
|
|
- return false;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //Here, we're on the category list as our active, so we're actually trying to leae the page
|
|
|
- //If we have unapplied changes, we want to prompt about them before closing the page and navigating away
|
|
|
- //If we don't, then we can process the popPage as normal and let the OptionsMenu close
|
|
|
- if(%this.unappliedChanges.count() != 0)
|
|
|
- {
|
|
|
- MessageBoxOKCancel("Discard Changes?", "You have unapplied changes to your settings, do you wish to apply or discard them?",
|
|
|
- "OptionsMenu.apply(); MainMenuGUI.popPage();", "" @ %this @ ".unappliedChanges.empty(); " @ %this @ ".navigation.popPage();",
|
|
|
- "Apply", "Discard");
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
+ %this.populateGamepadControls();
|
|
|
+ //establish the cached prefs values here
|
|
|
|
|
|
- return true;
|
|
|
+ %this.openOptionsCategory("Video");
|
|
|
}
|
|
|
|
|
|
-function OptionsMenu::onClose(%this)
|
|
|
+if(!isObject( OptionsMenuActionMap ) )
|
|
|
{
|
|
|
+ new ActionMap(OptionsMenuActionMap){};
|
|
|
|
|
|
-}
|
|
|
-
|
|
|
-function OptionsMenuSettingsList::onAdd(%this)
|
|
|
-{
|
|
|
-}
|
|
|
+ OptionsMenuActionMap.bind( keyboard, Escape, tryCloseOptionsMenu);
|
|
|
+ OptionsMenuActionMap.bind( gamepad, btn_b, tryCloseOptionsMenu);
|
|
|
|
|
|
-function OptionsMenuSettingsList::getOptionsList(%this, %index)
|
|
|
-{
|
|
|
-}
|
|
|
-
|
|
|
-function OptionsMenu::select(%this)
|
|
|
-{
|
|
|
- if(OptionsMenuCategoryList.isActiveMenuList())
|
|
|
- {
|
|
|
- OptionsMenuSettingsList.setAsActiveMenuList();
|
|
|
- }
|
|
|
+ OptionsMenuActionMap.bind( keyboard, w, OptionMenuNavigatePrev );
|
|
|
+ OptionsMenuActionMap.bind( keyboard, s, OptionMenuNavigateNext );
|
|
|
+ OptionsMenuActionMap.bind( gamepad, yaxis, "D", "-0.23 0.23", OptionMenuStickNavigate );
|
|
|
+ OptionsMenuActionMap.bind( gamepad, upov, OptionMenuNavigatePrev );
|
|
|
+ OptionsMenuActionMap.bind( gamepad, dpov, OptionMenuNavigateNext );
|
|
|
+
|
|
|
+ OptionsMenuActionMap.bind( keyboard, a, OptionMenuPrevSetting );
|
|
|
+ OptionsMenuActionMap.bind( keyboard, d, OptionMenuNextSetting );
|
|
|
+ OptionsMenuActionMap.bind( gamepad, xaxis, "D", "-0.23 0.23", OptionMenuStickChangeSetting );
|
|
|
+ OptionsMenuActionMap.bind( gamepad, lpov, OptionMenuPrevSetting );
|
|
|
+ OptionsMenuActionMap.bind( gamepad, rpov, OptionMenuNextSetting );
|
|
|
+
|
|
|
+ OptionsMenuActionMap.bind( keyboard, q, OptionsMenuPrevCategory );
|
|
|
+ OptionsMenuActionMap.bind( gamepad, btn_l, OptionsMenuPrevCategory );
|
|
|
+
|
|
|
+ OptionsMenuActionMap.bind( keyboard, e, OptionsMenuNextCategory );
|
|
|
+ OptionsMenuActionMap.bind( gamepad, btn_r, OptionsMenuNextCategory );
|
|
|
+
|
|
|
+ OptionsMenuActionMap.bind( keyboard, R, OptionsMenuReset );
|
|
|
+ OptionsMenuActionMap.bind( gamepad, btn_x, OptionsMenuReset );
|
|
|
+
|
|
|
+ OptionsMenuActionMap.bind( keyboard, Space, OptionsMenuActivateOption );
|
|
|
+ OptionsMenuActionMap.bind( gamepad, btn_a, OptionsMenuActivateOption );
|
|
|
+
|
|
|
+ OptionsMenuActionMap.bind( keyboard, Enter, tryApplyOptions);
|
|
|
+ OptionsMenuActionMap.bind( gamepad, btn_start, tryApplyOptions);
|
|
|
}
|
|
|
|
|
|
-function OptionsMenu::apply(%this)
|
|
|
+//==============================================================================
|
|
|
+// This function updates all the elements in the actual lists to ensure they're
|
|
|
+// sized, stylized and formatted correctly, as well as up to date values
|
|
|
+function OptionsMenuList::syncGui(%this)
|
|
|
{
|
|
|
- //Now we run through our list of unapplied changes and... apply them.
|
|
|
- %hasKeybindChanges = false;
|
|
|
- %hasVideoChanges = false;
|
|
|
- %hasPostFXChanges = false;
|
|
|
- %hasAudioChanges = false;
|
|
|
- %hasGraphicsChanges = false;
|
|
|
- for(%i=0; %i < %this.unappliedChanges.count(); %i++)
|
|
|
+ %this.callOnChildren("setHighlighted", false);
|
|
|
+
|
|
|
+ %btn = %this.getObject(%this.listPosition);
|
|
|
+ if(%btn.class $= "OptionsListEntry" ||
|
|
|
+ %btn.class $= "OptionsListSliderEntry" ||
|
|
|
+ %btn.class $= "OptionsKeybindEntry")
|
|
|
+ %btn-->button.setHighlighted(true);
|
|
|
+
|
|
|
+ //iterate over the items and ensure that they are formatted well based on the settings selected
|
|
|
+ foreach(%option in %this)
|
|
|
{
|
|
|
- %targetVar = %this.unappliedChanges.getKey(%i);
|
|
|
- %newValue = strReplace(%this.unappliedChanges.getValue(%i), "\"", "");
|
|
|
+ %container = %option-->valuesContainer;
|
|
|
|
|
|
- //First, lets just check through our action map names, see if any match
|
|
|
- %wasKeybind = false;
|
|
|
- for(%am=0; %am < ActionMapGroup.getCount(); %am++)
|
|
|
+ if(%option.class $= "OptionsListEntry")
|
|
|
{
|
|
|
- %actionMap = ActionMapGroup.getObject(%am);
|
|
|
-
|
|
|
- if(%actionMap == GlobalActionMap.getId())
|
|
|
- continue;
|
|
|
+ %hasLevels = %option.optionsObject.getCount() <= 1;
|
|
|
+
|
|
|
+ %optionObject = %option.optionsObject;
|
|
|
|
|
|
- %actionMapName = %actionMap.getName();
|
|
|
- if(%actionMapName $= %targetVar)
|
|
|
+ //If it's out of range of the options, it's probably a custom value
|
|
|
+ if(%option.currentOptionIndex < %optionObject.getCount() && %option.currentOptionIndex >= 0)
|
|
|
{
|
|
|
- %hasKeybindChanges = true;
|
|
|
- %wasKeybind = true;
|
|
|
- break;
|
|
|
+ %currentOptionLevel = %optionObject.getObject(%option.currentOptionIndex);
|
|
|
+ %currentOptionLevelTxt = %currentOptionLevel.displayName;
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- if(!%wasKeybind)
|
|
|
- {
|
|
|
- %sanitizedVar = strReplace(%targetVar, "[", "");
|
|
|
- %sanitizedVar = strReplace(%sanitizedVar, "]", "");
|
|
|
- %sanitizedVar = strReplace(%sanitizedVar, ",", "_");
|
|
|
- %currentValue = getVariable(%sanitizedVar);
|
|
|
- if(%currentValue !$= %newValue)
|
|
|
+ else
|
|
|
{
|
|
|
- setVariable(%targetVar, %newValue);
|
|
|
-
|
|
|
- //now, lets check for special cases that need additional handling
|
|
|
- //for updates
|
|
|
- if ( %targetVar $= "$pref::Video::displayDevice" )
|
|
|
- {
|
|
|
- schedule(32, 0, "MessageBoxOK", "Change requires restart", "Please restart the game for a display device change to take effect.");
|
|
|
- }
|
|
|
- else if(startsWith(%targetVar, "$pref::PostFX::"))
|
|
|
- {
|
|
|
- %hasPostFXChanges = true;
|
|
|
- }
|
|
|
- else if(startsWith(%targetVar, "$pref::Video::"))
|
|
|
- {
|
|
|
- %hasVideoChanges = true;
|
|
|
-
|
|
|
- //if it's the resolution, it's possible we got the human-friendly
|
|
|
- //version stored off. if so, reprocess into the usable state
|
|
|
- if(%targetVar $= "$pref::Video::Resolution")
|
|
|
- {
|
|
|
- if(strpos(%newValue, " x ") != -1)
|
|
|
- {
|
|
|
- %newValue = strreplace(%newValue, " x ", " ");
|
|
|
- setVariable(%targetVar, %newValue);
|
|
|
- }
|
|
|
- }
|
|
|
- //This is a bit of hackery to have an intermediate variable because we display in text
|
|
|
- //but save by index, so we take the applied name and get the index of the deviceId
|
|
|
- else if(%targetVar $= "$pref::Video::displayDeviceId")
|
|
|
- {
|
|
|
- %deviceId = getDisplayDeviceId($pref::Video::displayDeviceId);
|
|
|
- if(%deviceId == -1)
|
|
|
- %deviceId = 0;
|
|
|
-
|
|
|
- $pref::Video::deviceId = %deviceId;
|
|
|
- $pref::Video::displayDeviceId = "";
|
|
|
- }
|
|
|
- }
|
|
|
- else if(startsWith(%targetVar, "$pref::SFX::"))
|
|
|
- {
|
|
|
- %hasAudioChanges = true;
|
|
|
- }
|
|
|
- else if(startsWith(%targetVar, "$pref::Graphics::"))
|
|
|
- {
|
|
|
- %hasGraphicsChanges = true;
|
|
|
- }
|
|
|
+ %currentOptionLevelTxt = "Custom";
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //If we had keybind changes, go ahead and save those out
|
|
|
- if(%hasKeybindChanges)
|
|
|
- {
|
|
|
- %prefPath = getPrefpath();
|
|
|
-
|
|
|
- %actionMapCount = ActionMapGroup.getCount();
|
|
|
-
|
|
|
- %actionMapList = "";
|
|
|
- %append = false;
|
|
|
- for(%i=0; %i < %actionMapCount; %i++)
|
|
|
- {
|
|
|
- %actionMap = ActionMapGroup.getObject(%i);
|
|
|
|
|
|
- if(%actionMap == GlobalActionMap.getId())
|
|
|
- continue;
|
|
|
+ %optionValTextWidth = %option-->optionValue.profile.getStringWidth(%currentOptionLevelTxt);
|
|
|
|
|
|
- %actionMap.save( %prefPath @ "/keybinds." @ $TorqueScriptFileExtension, %append );
|
|
|
+ %option-->optionValue.resize(%container.extent.x - %container-->prevValButton.extent.x - %optionValTextWidth - 20, 0,
|
|
|
+ %optionValTextWidth + 20, %container.extent.y);
|
|
|
+
|
|
|
+ %option-->optionValue.text = %currentOptionLevelTxt;
|
|
|
+
|
|
|
+ %container-->prevValButton.position.x = %option-->optionValue.position.x - 20;
|
|
|
+ %container-->nextValButton.position.x = %container.extent.x - %container-->prevValButton.extent.x;
|
|
|
+
|
|
|
+ //if there's no alternatives, disable the left/right buttons
|
|
|
+ %container-->prevValButton.setHidden(%hasLevels);
|
|
|
+ %container-->nextValButton.setHidden(%hasLevels);
|
|
|
+ }
|
|
|
+ else if(%option.class $= "OptionsListSliderEntry")
|
|
|
+ {
|
|
|
+ }
|
|
|
+ else if(%option.class $= "OptionsKeybindEntry")
|
|
|
+ {
|
|
|
+ %bindImgAsset = getButtonBitmap(%option.device, getField(%option.keymap, 1));
|
|
|
|
|
|
- if(%append != true)
|
|
|
- %append = true;
|
|
|
+ if(%bindImgAsset $= "UI:Keyboard_Black_Blank_image")
|
|
|
+ %bindImgAsset = "";
|
|
|
+
|
|
|
+ %container-->bindButton.setBitmap(%bindImgAsset);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if(%hasPostFXChanges)
|
|
|
- {
|
|
|
- updatePostFXSettings();
|
|
|
- }
|
|
|
-
|
|
|
- if(%hasVideoChanges)
|
|
|
- {
|
|
|
- updateDisplaySettings();
|
|
|
- }
|
|
|
-
|
|
|
- if(%hasAudioChanges)
|
|
|
- {
|
|
|
- updateAudioSettings();
|
|
|
- }
|
|
|
-
|
|
|
- if(%hasGraphicsChanges)
|
|
|
- {
|
|
|
- updateGraphicsSettings();
|
|
|
- }
|
|
|
-
|
|
|
- //Finally, write our prefs to file
|
|
|
- %prefPath = getPrefpath();
|
|
|
- export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false);
|
|
|
-
|
|
|
- OptionsMenu.unappliedChanges.empty();
|
|
|
}
|
|
|
|
|
|
-function OptionsMenu::resetToDefaults(%this)
|
|
|
+function OptionsMenuList::checkForUnappliedChanges(%this)
|
|
|
{
|
|
|
- MessageBoxOKCancel("", "This will set the graphical settings back to the auto-detected defaults. Do you wish to continue?", "AutodetectGraphics();", "");
|
|
|
-}
|
|
|
-
|
|
|
-function OptionsMenu::refresh(%this)
|
|
|
-{
|
|
|
- //cache our scroll position so we can ensure we end up back at it after the refresh
|
|
|
- %lastScrollPos = OptionsMenuSettingsScroll.getScrollPosition();
|
|
|
+ %unappliedChanges = false;
|
|
|
|
|
|
- %cat = %this.currentCategory;
|
|
|
- if(%this.currentCategory !$= "")
|
|
|
+ foreach(%option in %this)
|
|
|
{
|
|
|
- if(!isInt(%this.currentCategory))
|
|
|
+ if(%option.class $= "OptionsListEntry")
|
|
|
{
|
|
|
- %this.currentCategory = getOptionsCategoryIndexByName(%this.currentCategory);
|
|
|
+ if(%option.currentOptionIndex >= 0 && %option.currentOptionIndex < %option.optionsObject.getCount())
|
|
|
+ {
|
|
|
+ %targetOptionLevel = %option.optionsObject.getObject(%option.currentOptionIndex);
|
|
|
+
|
|
|
+ if(!%targetOptionLevel.isCurrent())
|
|
|
+ %unappliedChanges = true;
|
|
|
+
|
|
|
+ if(%unappliedChanges && %option.optionsObject.requiresRestart)
|
|
|
+ $optionsChangeRequiresRestart = true;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- if(%this.currentCategory == -1)
|
|
|
- return;
|
|
|
-
|
|
|
- %category = %this.optionsCategories.getKey(%this.currentCategory);
|
|
|
- %command = %this.optionsCategories.getValue(%this.currentCategory);
|
|
|
- eval(%command);
|
|
|
}
|
|
|
|
|
|
- //now, because we reconstruct the displayed set, we'll force the mouse(if we're using it as our input)
|
|
|
- //to be poked so we can re-track to whatever control, if any, we're over
|
|
|
- if($activeControllerType !$= "gamepad")
|
|
|
- {
|
|
|
- Canvas.setCursorPos(Canvas.getCursorPos());
|
|
|
- }
|
|
|
-
|
|
|
- //restore scroll position
|
|
|
- OptionsMenuSettingsScroll.setScrollPosition(%lastScrollPos.x, %lastScrollPos.y);
|
|
|
+ return %unappliedChanges;
|
|
|
}
|
|
|
|
|
|
-function OptionsMenu::getOptionVariableValue(%this, %variableName)
|
|
|
+function OptionsMenuList::applyChanges(%this)
|
|
|
{
|
|
|
- %unappliedPrefIndex = %this.unappliedChanges.getIndexFromKey(%variableName);
|
|
|
- if(%unappliedPrefIndex != -1)
|
|
|
+ foreach(%option in %this)
|
|
|
{
|
|
|
- %value = %this.unappliedChanges.getValue(%unappliedPrefIndex);
|
|
|
- return strreplace(%value, "\"", "");
|
|
|
- }
|
|
|
-
|
|
|
- %sanitizedVar = strReplace(%variableName, "[", "");
|
|
|
- %sanitizedVar = strReplace(%sanitizedVar, "]", "");
|
|
|
- %sanitizedVar = strReplace(%sanitizedVar, ",", "_");
|
|
|
- return getVariable(%sanitizedVar);
|
|
|
-}
|
|
|
+ if(%option.class $= "OptionsListEntry")
|
|
|
+ {
|
|
|
+ //If it's custom or nonsensical index, there's some kind of external factor going on, so we're
|
|
|
+ //just going to skip applying it because we don't know what we'd be applying
|
|
|
+ if(%option.currentOptionIndex >= 0 && %option.currentOptionIndex < %option.optionsObject.getCount())
|
|
|
+ {
|
|
|
+ %targetOptionLevel = %option.optionsObject.getObject(%option.currentOptionIndex);
|
|
|
|
|
|
-function OptionsMenuSelectButton::onVisible(%this, %state)
|
|
|
-{
|
|
|
- //We're sorta cheating here.
|
|
|
- //This button should only be displayed when we're in the categories list
|
|
|
- //so whenever the status changes, such as automatically refreshing due to
|
|
|
- //navigation events, we'll just do a quick check to ensure we're
|
|
|
- //in the right visibility mode
|
|
|
- if(%state && OptionsMenuSettingsList.isActiveMenuList())
|
|
|
- {
|
|
|
- %this.setHidden(true);
|
|
|
+ if(!%targetOptionLevel.isCurrent())
|
|
|
+ %targetOptionLevel.apply();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-function populateDisplaySettingsList()
|
|
|
+
|
|
|
+function OptionsMenu::openOptionsCategory(%this, %categoryName)
|
|
|
{
|
|
|
- OptionsMenuSettingsList.clear();
|
|
|
-
|
|
|
- OptionsMenu.currentCategory = "Display";
|
|
|
-
|
|
|
- if(isObject(OptionName))
|
|
|
- OptionName.setText("");
|
|
|
- if(isObject(OptionDescription))
|
|
|
- OptionDescription.setText("");
|
|
|
+ VideoSettingsList.setVisible(%categoryName $= "Video");
|
|
|
+ AudioSettingsList.setVisible(%categoryName $= "Audio");
|
|
|
+ KBMControlsList.setVisible(%categoryName $= "KBM");
|
|
|
+ GamepadControlsList.setVisible(%categoryName $= "Controller");
|
|
|
|
|
|
- %apiList = "";
|
|
|
- %apiCount = GFXInit::getAdapterCount();
|
|
|
- %apiIdx = 0;
|
|
|
- for(%i=0; %i < %apiCount; %i++)
|
|
|
+ if(%categoryName $= "Video")
|
|
|
{
|
|
|
- %api = GFXInit::getAdapterType(%i);
|
|
|
-
|
|
|
- if(%api !$= "NullDevice")
|
|
|
+ $MenuList = VideoSettingsList;
|
|
|
+ //Find our first non-group entry
|
|
|
+ while($MenuList.getObject($MenuList.listPosition).class !$= OptionsListEntry && $MenuList.listPosition < $MenuList.getCount())
|
|
|
{
|
|
|
- if(%apiIdx==0)
|
|
|
- %apiList = %api;
|
|
|
- else
|
|
|
- %apiList = %apiList TAB %api;
|
|
|
-
|
|
|
- %apiIdx++;
|
|
|
+ $MenuList.listPosition += 1;
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- trim(%apiList);
|
|
|
-
|
|
|
- %displayDevice = OptionsMenu.getOptionVariableValue("$pref::Video::displayDevice");
|
|
|
- if(%displayDevice $= "")
|
|
|
- %displayDevice = getDisplayDeviceType();
|
|
|
-
|
|
|
- OptionsMenuSettingsList.addOptionRow("Display API", "$pref::Video::displayDevice", %apiList, false, "", true, "The display API used for rendering.", %displayDevice);
|
|
|
-
|
|
|
- %numDevices = Canvas.getMonitorCount();
|
|
|
-
|
|
|
- %devicesList = getDisplayDeviceList();
|
|
|
-
|
|
|
- if($pref::Video::displayDeviceId $= "")
|
|
|
- $pref::Video::displayDeviceId = getField(%devicesList, $pref::Video::deviceId);
|
|
|
|
|
|
- OptionsMenuSettingsList.addOptionRow("Display Device", "$pref::Video::displayDeviceId", %devicesList, false, "", true, "The display devices the window should be on.");
|
|
|
+ %this.currentCatgeoryIdx = 0;
|
|
|
+ }
|
|
|
+ else if(%categoryName $= "Audio")
|
|
|
+ {
|
|
|
+ $MenuList = AudioSettingsList;
|
|
|
|
|
|
- if (%numDevices > 1)
|
|
|
- OptionsMenuSettingsList.setRowEnabled(1, true);
|
|
|
- else
|
|
|
- OptionsMenuSettingsList.setRowEnabled(1, false);
|
|
|
-
|
|
|
- %mode = OptionsMenu.getOptionVariableValue("$pref::Video::deviceMode");
|
|
|
- if(isInt(%mode))
|
|
|
- %mode = getField($Video::ModeTags, $pref::Video::deviceMode);
|
|
|
- OptionsMenuSettingsList.addOptionRow("Window Mode", "$pref::Video::deviceMode", $Video::ModeTags, false, "", true, "", %mode);
|
|
|
-
|
|
|
- if(%mode !$= "Borderless")
|
|
|
+ %this.currentCatgeoryIdx = 1;
|
|
|
+ }
|
|
|
+ else if(%categoryName $= "KBM")
|
|
|
{
|
|
|
- %resolutionList = getScreenResolutionList($pref::Video::deviceId, $Video::Mode[%mode]);
|
|
|
- %resolution = OptionsMenu.getOptionVariableValue("$pref::Video::Resolution");
|
|
|
- if(%resolution $= "")
|
|
|
- %resolution = $pref::Video::mode;
|
|
|
-
|
|
|
- %resolution = _makePrettyResString(%resolution);
|
|
|
-
|
|
|
- OptionsMenuSettingsList.addOptionRow("Resolution", "$pref::Video::Resolution", %resolutionList, false, "", true, "Resolution of the game window", %resolution);
|
|
|
-
|
|
|
- // If the requested resolution could not be set, mark the control and pref as changed.
|
|
|
- %resControl = OptionsMenuSettingsList.getObject(OptionsMenuSettingsList.getCount()-1);
|
|
|
- if (%resControl.getCurrentOption() !$= %resolution)
|
|
|
- %resControl.onChange();
|
|
|
+ $MenuList = KBMControlsList;
|
|
|
+
|
|
|
+ %this.currentCatgeoryIdx = 2;
|
|
|
+ }
|
|
|
+ else if(%categoryName $= "Controller")
|
|
|
+ {
|
|
|
+ $MenuList = GamepadControlsList;
|
|
|
+
|
|
|
+ %this.currentCatgeoryIdx = 3;
|
|
|
}
|
|
|
-
|
|
|
- OptionsMenuSettingsList.addOptionBoolRow("VSync", "$pref::Video::enableVerticalSync", $YesNoList, false, "", true, "", "");
|
|
|
-
|
|
|
|
|
|
- %refreshList = getScreenRefreshList($pref::Video::mode);
|
|
|
- OptionsMenuSettingsList.addOptionRow("Refresh Rate", "$pref::Video::RefreshRate", %refreshList, false, "", true, "", OptionsMenu.getOptionVariableValue("$pref::Video::RefreshRate"));
|
|
|
-
|
|
|
- //move to gameplay tab
|
|
|
- //OptionsMenuSettingsList.addSliderRow("Field of View", "", 75, 5, "65 100", "");
|
|
|
-
|
|
|
- //OptionsMenuSettingsList.addSliderRow("Brightness", "", 0.5, 0.1, "0 1", "");
|
|
|
- //OptionsMenuSettingsList.addSliderRow("Contrast", "", 0.5, 0.1, "0 1", "");
|
|
|
+ $MenuList.syncGui();
|
|
|
+ %this.syncGui();
|
|
|
}
|
|
|
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-function populateGraphicsSettingsList()
|
|
|
+//==============================================================================
|
|
|
+// This function updates the non-list items of the menu to be up to date and stylistically
|
|
|
+// complaint. This ensures keybind hint buttons are presented correctly based on the current input
|
|
|
+// device
|
|
|
+function OptionsMenu::syncGui(%this)
|
|
|
{
|
|
|
- OptionsMenuSettingsList.clear();
|
|
|
-
|
|
|
- OptionsMenu.currentCategory = "Graphics";
|
|
|
+ OptionsMenuCategoryList.callOnChildren("setHighlighted", false);
|
|
|
|
|
|
- if(isObject(OptionName))
|
|
|
- OptionName.setText("");
|
|
|
- if(isObject(OptionDescription))
|
|
|
- OptionDescription.setText("");
|
|
|
+ %btn = OptionsMenuCategoryList.getObject(%this.currentCatgeoryIdx);
|
|
|
+ %btn.setHighlighted(true);
|
|
|
|
|
|
- %yesNoList = "No\tYes";
|
|
|
- %onOffList = "Off\tOn";
|
|
|
- %anisoFilter = "Off\t4\t8\t16";
|
|
|
- %aaTypeFilter = "None\tFXAA\tSMAA\tSMAA High";
|
|
|
- OptionsMenuSettingsList.addOptionQualityLevelRow("Lighting Quality", "$pref::Graphics::LightingQuality",
|
|
|
- LightingQualityList, false, "", true, "Amount and drawdistance of local lights");
|
|
|
- OptionsMenuSettingsList.addOptionQualityLevelRow("Shadow Quality", "$pref::Graphics::ShadowQuality",
|
|
|
- ShadowQualityList, false, "", true, "Shadow revolution quality");
|
|
|
+ %buttonPosX = %btn.position.x + OptionsMenuCategoryList.position.x;
|
|
|
+
|
|
|
+ OptionsMenuPrevNavIcon.position.x = %buttonPosX - 5;
|
|
|
+ OptionsMenuNextNavIcon.position.x = %buttonPosX + %btn.extent.x - 35;
|
|
|
|
|
|
- %shadowQuality = OptionsMenu.getOptionVariableValue("$pref::Graphics::ShadowQuality");
|
|
|
- if(%shadowQuality !$= "None")
|
|
|
- {
|
|
|
- OptionsMenuSettingsList.addOptionQualityLevelRow("Soft Shadow Quality", "$pref::Graphics::SoftShadowQuality",
|
|
|
- SoftShadowList, false, "", true, "Amount of softening applied to shadowmaps");
|
|
|
- }
|
|
|
+ //Update the button imagery to comply to the last input device we'd used
|
|
|
+ %device = Canvas.getLastInputDevice();
|
|
|
+ if(%device $= "mouse")
|
|
|
+ %device = "keyboard";
|
|
|
+
|
|
|
+ OptionsMenuBackBtn.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIBackOut"));
|
|
|
+ OptionsMenuResetBtn.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuReset"));
|
|
|
|
|
|
- OptionsMenuSettingsList.addOptionQualityLevelRow("Mesh Quality", "$pref::Graphics::MeshQuality",
|
|
|
- MeshQualityGroup, false, "", true, "Fidelity of rendering of mesh objects");
|
|
|
- OptionsMenuSettingsList.addOptionQualityLevelRow("Object Draw Distance", "$pref::Graphics::ObjectDrawDistance",
|
|
|
- MeshDrawDistQualityGroup, false, "", true, "Dictates if and when static objects fade out in the distance");
|
|
|
- OptionsMenuSettingsList.addOptionQualityLevelRow("Texture Quality", "$pref::Graphics::TextureQuality",
|
|
|
- TextureQualityGroup, false, "", true, "Fidelity of textures");
|
|
|
- OptionsMenuSettingsList.addOptionQualityLevelRow("Terrain Quality", "$pref::Graphics::TerrainQuality",
|
|
|
- TerrainQualityGroup, false, "", true, "Quality level of terrain objects");
|
|
|
- OptionsMenuSettingsList.addOptionQualityLevelRow("Decal Lifetime", "$pref::Graphics::DecalLifetime",
|
|
|
- DecalLifetimeGroup, false, "", true, "How long decals are rendered");
|
|
|
- OptionsMenuSettingsList.addOptionQualityLevelRow("Ground Cover Density", "$pref::Graphics::GroundCoverDensity",
|
|
|
- GroundCoverDensityGroup, false, "", true, "Density of ground cover items, such as grass");
|
|
|
- OptionsMenuSettingsList.addOptionQualityLevelRow("Shader Quality", "$pref::Graphics::ShaderQuality",
|
|
|
- ShaderQualityGroup, false, "", true, "Dictates the overall shader quality level, adjusting what features are enabled.");
|
|
|
- OptionsMenuSettingsList.addOptionRow("Anisotropic Filtering", "$pref::Video::defaultAnisotropy", %anisoFilter, false, "", true, "Amount of Anisotropic Filtering on textures, which dictates their sharpness at a distance");
|
|
|
+ OptionsMenuPrevNavIcon.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuPrevCategory"));
|
|
|
+ OptionsMenuNextNavIcon.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuNextCategory"));
|
|
|
|
|
|
- OptionsMenuSettingsList.addOptionRow("Anti-Aliasing Type", "$pref::Video::AAMode", %aaTypeFilter, false, "", true, "The Anti-Aliasing Method applied to rendering");
|
|
|
-
|
|
|
- OptionsMenuSettingsList.addOptionBoolRow("Parallax", "$pref::Video::enableParallaxMapping", %onOffList, false, "", true, "Whether the surface parallax shader effect is enabled", "");
|
|
|
- OptionsMenuSettingsList.addOptionBoolRow("Water Reflections", "$pref::Water::enableTrueReflections", %onOffList, false, "", true, "Whether water reflections are enabled", "");
|
|
|
+ OptionsMenuApplyBtn.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "tryApplyOptions"));
|
|
|
|
|
|
- OptionsMenuSettingsList.addOptionBoolRow("SSAO", "$pref::PostFX::EnableSSAO", %onOffList, false, "", true, "Whether Screen-Space Ambient Occlusion is enabled");
|
|
|
- OptionsMenuSettingsList.addOptionBoolRow("Depth of Field", "$pref::PostFX::EnableDOF", %onOffList, false, "", true, "Whether the Depth of Field effect is enabled");
|
|
|
- OptionsMenuSettingsList.addOptionBoolRow("Vignette", "$pref::PostFX::EnableVignette", %onOffList, false, "", true, "Whether the vignette effect is enabled");
|
|
|
- OptionsMenuSettingsList.addOptionBoolRow("Light Rays", "$pref::PostFX::EnableLightRays", %onOffList, false, "", true, "Whether the light rays effect is enabled");
|
|
|
+ OptionsMenuRemapBtn.visible = KBMControlsList.visible || GamepadControlsList.visible;
|
|
|
+ OptionsMenuRemapBtn.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuActivateOption"));
|
|
|
}
|
|
|
|
|
|
-function updateGraphicsSettings()
|
|
|
+//==============================================================================
|
|
|
+// Menu navigation functions
|
|
|
+// Primarily used by keybinds
|
|
|
+function OptionsMenuPrevCategory(%val)
|
|
|
{
|
|
|
- if($pref::Graphics::LightingQuality !$= getCurrentQualityLevel(LightingQualityList))
|
|
|
- LightingQualityList.applySetting($pref::Graphics::LightingQuality);
|
|
|
- if($pref::Graphics::ShadowQuality !$= getCurrentQualityLevel(ShadowQualityList))
|
|
|
- ShadowQualityList.applySetting($pref::Graphics::ShadowQuality);
|
|
|
- if($pref::Graphics::SoftShadowQuality !$= getCurrentQualityLevel(SoftShadowList))
|
|
|
- SoftShadowList.applySetting($pref::Graphics::SoftShadowQuality);
|
|
|
-
|
|
|
- if($pref::Graphics::MeshQuality !$= getCurrentQualityLevel(MeshQualityGroup))
|
|
|
- MeshQualityGroup.applySetting($pref::Graphics::MeshQuality);
|
|
|
- if($pref::Graphics::ObjectDrawDistance !$= getCurrentQualityLevel(MeshDrawDistQualityGroup))
|
|
|
- MeshDrawDistQualityGroup.applySetting($pref::Graphics::ObjectDrawDistance);
|
|
|
- if($pref::Graphics::TextureQuality !$= getCurrentQualityLevel(TextureQualityGroup))
|
|
|
+ if(%val)
|
|
|
{
|
|
|
- TextureQualityGroup.applySetting($pref::Graphics::TextureQuality);
|
|
|
+ %currentIdx = OptionsMenu.currentMenuIdx;
|
|
|
+ OptionsMenu.currentMenuIdx -= 1;
|
|
|
|
|
|
- reloadTextures();
|
|
|
+ OptionsMenu.currentMenuIdx = mClamp(OptionsMenu.currentMenuIdx, 0, 3);
|
|
|
+
|
|
|
+ if(%currentIdx == OptionsMenu.currentMenuIdx)
|
|
|
+ return;
|
|
|
+
|
|
|
+ %newCategory = $OptionsMenuCategories[OptionsMenu.currentMenuIdx];
|
|
|
+ OptionsMenu.openOptionsCategory(%newCategory);
|
|
|
}
|
|
|
- if($pref::Graphics::TerrainQuality !$= getCurrentQualityLevel(TerrainQualityGroup))
|
|
|
- TerrainQualityGroup.applySetting($pref::Graphics::TerrainQuality);
|
|
|
- if($pref::Graphics::DecalLifetime !$= getCurrentQualityLevel(DecalLifetimeGroup))
|
|
|
- DecalLifetimeGroup.applySetting($pref::Graphics::DecalLifetime);
|
|
|
- if($pref::Graphics::GroundCoverDensity !$= getCurrentQualityLevel(GroundCoverDensityGroup))
|
|
|
- GroundCoverDensityGroup.applySetting($pref::Graphics::GroundCoverDensity);
|
|
|
- if($pref::Graphics::ShaderQuality !$= getCurrentQualityLevel(ShaderQualityGroup))
|
|
|
+}
|
|
|
+
|
|
|
+function OptionsMenuNextCategory(%val)
|
|
|
+{
|
|
|
+ if(%val)
|
|
|
{
|
|
|
- ShaderQualityGroup.applySetting($pref::Graphics::ShaderQuality);
|
|
|
- //this has ties into postFX behaviors, so we'll force an update to it here
|
|
|
- updatePostFXSettings();
|
|
|
+ %currentIdx = OptionsMenu.currentMenuIdx;
|
|
|
+ OptionsMenu.currentMenuIdx += 1;
|
|
|
+
|
|
|
+ OptionsMenu.currentMenuIdx = mClamp(OptionsMenu.currentMenuIdx, 0, 3);
|
|
|
+
|
|
|
+ if(%currentIdx == OptionsMenu.currentMenuIdx)
|
|
|
+ return;
|
|
|
+
|
|
|
+ %newCategory = $OptionsMenuCategories[OptionsMenu.currentMenuIdx];
|
|
|
+ OptionsMenu.openOptionsCategory(%newCategory);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function updateDisplaySettings()
|
|
|
+function OptionMenuNavigatePrev(%val)
|
|
|
{
|
|
|
- //Update the display settings now
|
|
|
- %deviceName = getDisplayDeviceName();
|
|
|
- %newDeviceID = getWord(%deviceName, 0) - 1;
|
|
|
-
|
|
|
- if(!isInt($pref::Video::deviceMode))
|
|
|
+ if(%val)
|
|
|
{
|
|
|
- //probably saved out as the mode name, so just translate it back
|
|
|
- for(%i=0; %i < getFieldCount($Video::ModeTags); %i++)
|
|
|
+ $MenuList.listPosition -= 1;
|
|
|
+ while( $MenuList.listPosition >= 0 && ($MenuList.getObject($MenuList.listPosition).class !$= "OptionsListEntry" &&
|
|
|
+ $MenuList.getObject($MenuList.listPosition).class !$= "OptionsListSliderEntry" &&
|
|
|
+ $MenuList.getObject($MenuList.listPosition).class !$= "OptionsKeybindEntry"))
|
|
|
{
|
|
|
- if(getField($Video::ModeTags, %i) $= $pref::Video::deviceMode)
|
|
|
- {
|
|
|
- $pref::Video::deviceMode = %i;
|
|
|
- break;
|
|
|
- }
|
|
|
+ $MenuList.listPosition -= 1;
|
|
|
}
|
|
|
+
|
|
|
+ if($MenuList.listPosition < 0)
|
|
|
+ $MenuList.listPosition = 0;
|
|
|
+
|
|
|
+ $MenuList.syncGUI();
|
|
|
+
|
|
|
+ $BaseUI::scrollSchedule = schedule($BaseUI::scrollSpeedTimeMs, 0, "OptionMenuNavigatePrev", 1);
|
|
|
}
|
|
|
-
|
|
|
- %deviceModeName = getField($Video::ModeTags, $pref::Video::deviceMode);
|
|
|
- %newDeviceMode = 0;
|
|
|
- foreach$(%modeName in $Video::ModeTags)
|
|
|
+ else
|
|
|
{
|
|
|
- if (%deviceModeName $= %modeName)
|
|
|
- break;
|
|
|
- else
|
|
|
- %newDeviceMode++;
|
|
|
- }
|
|
|
-
|
|
|
- if($pref::Video::deviceMode == $Video::ModeBorderless)
|
|
|
- {
|
|
|
- //if we're changing to borderless, we swap to the full resolution of the desktop
|
|
|
- $pref::Video::mode = Canvas.getBestCanvasRes($pref::Video::deviceId, $pref::Video::deviceMode);
|
|
|
-
|
|
|
- $pref::Video::Resolution = $pref::Video::mode.x SPC $pref::Video::mode.y;
|
|
|
+ cancel($BaseUI::scrollSchedule);
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- %newRes = $pref::Video::Resolution;
|
|
|
- %newBpp = 32; // ... its not 1997 anymore.
|
|
|
- %newFullScreen = %deviceModeName $= "Fullscreen" ? true : false;
|
|
|
- %newRefresh = $pref::Video::RefreshRate;
|
|
|
- %newVsync = $pref::Video::enableVerticalSync;
|
|
|
- %newAA = $pref::Video::AA;
|
|
|
-
|
|
|
- // Build the final mode string.
|
|
|
- %newMode = $pref::Video::Resolution SPC %newFullScreen SPC %newBpp SPC %newRefresh SPC %newAA;
|
|
|
-
|
|
|
- // Change the video mode.
|
|
|
- if ( %newMode !$= $pref::Video::mode || %newDeviceID != $pref::Video::deviceId ||
|
|
|
- %newVsync != $pref::Video::enableVerticalSync || %newDeviceMode != $pref::Video::deviceMode)
|
|
|
+function OptionMenuNavigateNext(%val)
|
|
|
+{
|
|
|
+ if(%val)
|
|
|
{
|
|
|
- //****Edge Case Hack
|
|
|
- // If we're in fullscreen mode and switching to a different monitor at the
|
|
|
- // same resolution and maintaining fullscreen, GFX...WindowTarget::resetMode()
|
|
|
- // will early-out because there is no "mode change" and the monitor change
|
|
|
- // will not get applied. Instead of modifying platform code, we're going to
|
|
|
- // move onto the new monitor in borderless and immediately switch to FS.
|
|
|
- if (%newFullScreen && $pref::Video::FullScreen &&
|
|
|
- ($pref::Video::Resolution $= %newRes) && ($pref::Video::deviceId != %newDeviceID))
|
|
|
+ $MenuList.listPosition += 1;
|
|
|
+ while($MenuList.listPosition < $MenuList.getCount() && ($MenuList.getObject($MenuList.listPosition).class !$= "OptionsListEntry" &&
|
|
|
+ $MenuList.getObject($MenuList.listPosition).class !$= "OptionsListSliderEntry" &&
|
|
|
+ $MenuList.getObject($MenuList.listPosition).class !$= "OptionsKeybindEntry"))
|
|
|
{
|
|
|
- $pref::Video::deviceId = %newDeviceID;
|
|
|
- $pref::Video::deviceMode = $Video::ModeBorderless;
|
|
|
- %tmpModeStr = Canvas.getMonitorMode(%newDeviceID, 0);
|
|
|
- Canvas.setVideoMode(%tmpModeStr.x, %tmpModeStr.y, false, 32, getWord(%tmpModeStr, $WORD::REFRESH), %newAA);
|
|
|
+ $MenuList.listPosition += 1;
|
|
|
}
|
|
|
-
|
|
|
- $pref::Video::mode = %newMode;
|
|
|
- $pref::Video::enableVerticalSync = %newVsync;
|
|
|
- $pref::Video::deviceId = %newDeviceID;
|
|
|
- $pref::Video::deviceMode = %newDeviceMode;
|
|
|
- $pref::Video::Resolution = %newRes;
|
|
|
- $pref::Video::FullScreen = %newFullScreen;
|
|
|
- $pref::Video::RefreshRate = %newRefresh;
|
|
|
- $pref::Video::AA = %newAA;
|
|
|
- configureCanvas();
|
|
|
+
|
|
|
+ if($MenuList.listPosition >= $MenuList.getCount())
|
|
|
+ $MenuList.listPosition = $MenuList.getCount()-1;
|
|
|
+
|
|
|
+ $MenuList.syncGUI();
|
|
|
+
|
|
|
+ $BaseUI::scrollSchedule = schedule($BaseUI::scrollSpeedTimeMs, 0, "OptionMenuNavigateNext", 1);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ cancel($BaseUI::scrollSchedule);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function updatePostFXSettings()
|
|
|
+function OptionMenuStickNavigate(%val)
|
|
|
{
|
|
|
- PostFXManager.settingsEffectSetEnabled(SSAOPostFx, $pref::PostFX::EnableSSAO);
|
|
|
- PostFXManager.settingsEffectSetEnabled(DepthOfFieldPostFX, $pref::PostFX::EnableDOF);
|
|
|
- PostFXManager.settingsEffectSetEnabled(LightRayPostFX, $pref::PostFX::EnableLightRays);
|
|
|
- PostFXManager.settingsEffectSetEnabled(vignettePostFX, $pref::PostFX::EnableVignette);
|
|
|
+ if(%val == 1)
|
|
|
+ OptionMenuNavigateNext(1);
|
|
|
+ else if(%val == -1)
|
|
|
+ OptionMenuNavigatePrev(1);
|
|
|
+ else
|
|
|
+ cancel($BaseUI::scrollSchedule);
|
|
|
}
|
|
|
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-function populateAudioSettingsList()
|
|
|
+function OptionMenuPrevSetting(%val)
|
|
|
{
|
|
|
- OptionsMenuSettingsList.clear();
|
|
|
-
|
|
|
- OptionsMenu.currentCategory = "Audio";
|
|
|
-
|
|
|
- if(isObject(OptionName))
|
|
|
- OptionName.setText("");
|
|
|
- if(isObject(OptionDescription))
|
|
|
- OptionDescription.setText("");
|
|
|
-
|
|
|
- %buffer = sfxGetAvailableDevices();
|
|
|
- %count = getRecordCount( %buffer );
|
|
|
- %audioDriverList = "";
|
|
|
- %audioProviderList = "";
|
|
|
- %audioDeviceList = "";
|
|
|
-
|
|
|
- $currentAudioProvider = $currentAudioProvider $= "" ? $pref::SFX::provider : $currentAudioProvider;
|
|
|
+ if(!%val)
|
|
|
+ return;
|
|
|
+
|
|
|
+ %option = $MenuList.getObject($MenuList.listPosition);
|
|
|
|
|
|
- for(%i = 0; %i < %count; %i++)
|
|
|
+ if(!isObject(%option))
|
|
|
+ return;
|
|
|
+
|
|
|
+ if(%option.class $= "OptionsListEntry")
|
|
|
{
|
|
|
- %record = getRecord(%buffer, %i);
|
|
|
- %provider = getField(%record, 0);
|
|
|
- %device = getField(%record, 1);
|
|
|
+ %optionObject = %option.optionsObject;
|
|
|
+ %currentOptionLevel = %optionObject.getObject(%option.currentOptionIndex);
|
|
|
|
|
|
- //When the client is actually running, we don't care about null audo devices
|
|
|
- if(%provider $= "null")
|
|
|
- continue;
|
|
|
+ %option.currentOptionIndex = mClamp(%option.currentOptionIndex-1, 0, %optionObject.getCount()-1);
|
|
|
|
|
|
- if(%audioProviderList $= "")
|
|
|
- %audioProviderList = %provider;
|
|
|
- else
|
|
|
- %audioProviderList = %audioProviderList @ "\t" @ %provider;
|
|
|
-
|
|
|
- if(%provider $= $currentAudioProvider)
|
|
|
- {
|
|
|
- if(%audioDeviceList $= "")
|
|
|
- %audioDeviceList = %device;
|
|
|
- else
|
|
|
- %audioDeviceList = %audioDeviceList @ "\t" @ %device;
|
|
|
- }
|
|
|
+ %newOptionLevel = %optionObject.getObject(%option.currentOptionIndex);
|
|
|
+
|
|
|
+ //echo("Changed option: " @ %optionObject.optionName @ " from level: " @ %currentOptionLevel.displayName @ " to level: " @ %newOptionLevel.displayName);
|
|
|
}
|
|
|
-
|
|
|
- OptionsMenuSettingsList.addOptionRow("Audio Provider", "$pref::SFX::provider", %audioProviderList, false, "audioProviderChanged", true, "");
|
|
|
- OptionsMenuSettingsList.addOptionRow("Audio Device", "$pref::SFX::device", %audioDeviceList, false, "", true);
|
|
|
-
|
|
|
- OptionsMenuSettingsList.addSliderRow("Master Volume", "$pref::SFX::masterVolume", 0.1, "0 1", "");
|
|
|
- OptionsMenuSettingsList.addSliderRow("GUI Volume", "$pref::SFX::channelVolume[" @ $GuiAudioType @ "]", 0.1, "0 1", "");
|
|
|
- OptionsMenuSettingsList.addSliderRow("Effects Volume", "$pref::SFX::channelVolume[" @ $SimAudioType @ "]", 0.1, "0 1", "");
|
|
|
- OptionsMenuSettingsList.addSliderRow("Music Volume", "$pref::SFX::channelVolume[" @ $MusicAudioType @ "]", 0.1, "0 1", "");
|
|
|
+ else if(%option.class $= "OptionsListSliderEntry")
|
|
|
+ {
|
|
|
+ %sliderCtrl = %option-->valuesContainer-->slider;
|
|
|
+ %minValue = %sliderCtrl.range.x;
|
|
|
+ %maxValue = %sliderCtrl.range.y;
|
|
|
+ %ticks = %sliderCtrl.ticks;
|
|
|
+
|
|
|
+ %tickIncrementVal = (%maxValue - %minValue) / %ticks;
|
|
|
+
|
|
|
+ %sliderCtrl.value -= %tickIncrementVal;
|
|
|
+ }
|
|
|
+
|
|
|
+ $MenuList.syncGUI();
|
|
|
}
|
|
|
|
|
|
-function audioProviderChanged()
|
|
|
+function OptionMenuNextSetting(%val)
|
|
|
{
|
|
|
- //Get the option we have set for the provider
|
|
|
- %provider = OptionsMenuSettingsList.getCurrentOption(0);
|
|
|
- $currentAudioProvider = %provider;
|
|
|
+ if(!%val)
|
|
|
+ return;
|
|
|
+
|
|
|
+ %option = $MenuList.getObject($MenuList.listPosition);
|
|
|
|
|
|
- //And now refresh the list to get the correct devices
|
|
|
- populateAudioSettingsList();
|
|
|
+ if(!isObject(%option) )
|
|
|
+ return;
|
|
|
+
|
|
|
+ if(%option.class $= "OptionsListEntry")
|
|
|
+ {
|
|
|
+ %optionObject = %option.optionsObject;
|
|
|
+ %currentOptionLevel = %optionObject.getObject(%option.currentOptionIndex);
|
|
|
+
|
|
|
+ %option.currentOptionIndex = mClamp(%option.currentOptionIndex+1, 0, %optionObject.getCount()-1);
|
|
|
+
|
|
|
+ %newOptionLevel = %optionObject.getObject(%option.currentOptionIndex);
|
|
|
+
|
|
|
+ //echo("Changed option: " @ %optionObject.optionName @ " from level: " @ %currentOptionLevel.displayName @ " to level: " @ %newOptionLevel.displayName);
|
|
|
+ }
|
|
|
+ else if(%option.class $= "OptionsListSliderEntry")
|
|
|
+ {
|
|
|
+ %sliderCtrl = %option-->valuesContainer-->slider;
|
|
|
+ %minValue = %sliderCtrl.range.x;
|
|
|
+ %maxValue = %sliderCtrl.range.y;
|
|
|
+ %ticks = %sliderCtrl.ticks;
|
|
|
+
|
|
|
+ %tickIncrementVal = (%maxValue - %minValue) / %ticks;
|
|
|
+
|
|
|
+ %sliderCtrl.value += %tickIncrementVal;
|
|
|
+ }
|
|
|
+
|
|
|
+ $MenuList.syncGUI();
|
|
|
}
|
|
|
|
|
|
-function updateAudioSettings()
|
|
|
+function OptionMenuStickChangeSetting(%val)
|
|
|
{
|
|
|
- //$pref::SFX::masterVolume = OptionsMenuSettingsList.getValue(2);
|
|
|
- sfxSetMasterVolume( $pref::SFX::masterVolume );
|
|
|
-
|
|
|
- //$pref::SFX::channelVolume[ $GuiAudioType ] = OptionsMenuSettingsList.getValue(3);
|
|
|
- //$pref::SFX::channelVolume[ $SimAudioType ] = OptionsMenuSettingsList.getValue(4);
|
|
|
- //$pref::SFX::channelVolume[ $MusicAudioType ] = OptionsMenuSettingsList.getValue(5);
|
|
|
-
|
|
|
- sfxSetChannelVolume( $GuiAudioType, $pref::SFX::channelVolume[ $GuiAudioType ] );
|
|
|
- sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ $SimAudioType ] );
|
|
|
- sfxSetChannelVolume( $MusicAudioType, $pref::SFX::channelVolume[ $MusicAudioType ] );
|
|
|
-
|
|
|
- //$pref::SFX::provider = OptionsMenuSettingsList.getCurrentOption(0);
|
|
|
- //$pref::SFX::device = OptionsMenuSettingsList.getCurrentOption(1);
|
|
|
+ if(%val == 1)
|
|
|
+ OptionMenuNextSetting(1);
|
|
|
+ else if(%val == -1)
|
|
|
+ OptionMenuPrevSetting(1);
|
|
|
+}
|
|
|
+
|
|
|
+function OptionsMenuActivateOption(%val)
|
|
|
+{
|
|
|
+ if(!%val)
|
|
|
+ return;
|
|
|
+
|
|
|
+ %option = $MenuList.getObject($MenuList.listPosition);
|
|
|
|
|
|
- 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 ) )
|
|
|
+ if(!isObject(%option))
|
|
|
+ return;
|
|
|
+
|
|
|
+ if(%option.class $= "OptionsKeybindEntry")
|
|
|
{
|
|
|
- sfxPlay(menuButtonPressed);
|
|
|
+ %option-->button.execAltCommand();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-function populateKeyboardMouseSettingsList()
|
|
|
+//==============================================================================
|
|
|
+// This function utilizes the VideoSettingsGroup SimGroup to populate options.
|
|
|
+// The object is defined in core/rendering/scripts/graphicsOptions.tscript
|
|
|
+// A majority of the options are statically defined, but some are dynamically populated
|
|
|
+// on refresh, like the display device or available resolution options.
|
|
|
+// Once populated, we loop over the simgroup structure to populate our option entry
|
|
|
+// rows in the options menu itself.
|
|
|
+function OptionsMenu::populateVideoSettings(%this)
|
|
|
{
|
|
|
- OptionsMenuSettingsList.clear();
|
|
|
+ VideoSettingsList.clear();
|
|
|
|
|
|
- OptionsMenu.currentCategory = "Keyboard & Mouse";
|
|
|
+ VideoSettingsGroup::populateDisplaySettings();
|
|
|
|
|
|
- if(isObject(OptionName))
|
|
|
- OptionName.setText("");
|
|
|
- if(isObject(OptionDescription))
|
|
|
- OptionDescription.setText("");
|
|
|
-
|
|
|
- $remapListDevice = "keyboard";
|
|
|
- fillRemapList();
|
|
|
+ for(%i=0; %i < VideoSettingsGroup.getCount(); %i++)
|
|
|
+ {
|
|
|
+ %setting = VideoSettingsGroup.getObject(%i);
|
|
|
+
|
|
|
+ if(%setting.class $= "SubOptionsGroup")
|
|
|
+ {
|
|
|
+ %entry = addOptionGroup(%setting.displayName);
|
|
|
+
|
|
|
+ if(isObject(%entry))
|
|
|
+ VideoSettingsList.add(%entry);
|
|
|
+
|
|
|
+ for(%s=0; %s < %setting.getCount(); %s++)
|
|
|
+ {
|
|
|
+ %option = %setting.getObject(%s);
|
|
|
+
|
|
|
+ %optionsEntry = addOptionEntry(%option);
|
|
|
+
|
|
|
+ if(isObject(%optionsEntry))
|
|
|
+ VideoSettingsList.add(%optionsEntry);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(%setting.class $= "OptionsSettings")
|
|
|
+ {
|
|
|
+ %optionsEntry = addOptionEntry(%setting);
|
|
|
+
|
|
|
+ if(isObject(%optionsEntry))
|
|
|
+ VideoSettingsList.add(%optionsEntry);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- //OptionsMenuSettingsList.refresh();
|
|
|
+ //Ensure our newly templated options listings are sized right
|
|
|
+ for(%i=0; %i < VideoSettingsList.getCount(); %i++)
|
|
|
+ {
|
|
|
+ %entry = VideoSettingsList.getObject(%i);
|
|
|
+ %entry.resize(0, 0, VideoSettingsList.extent.x - 15, %entry.extent.y); //-10 for the scroll wheel pad
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-function populateGamepadSettingsList()
|
|
|
+//==============================================================================
|
|
|
+// This function utilizes the AudioSettingsGroup SimGroup to populate options.
|
|
|
+// The object is defined in core/sfx/scripts/audioOptions.tscript
|
|
|
+// Similar to the video options, it can be a mix of static and dynamically populated
|
|
|
+// option entries, which we then iterate over and populate the entry rows for the menu
|
|
|
+function OptionsMenu::populateAudioSettings(%this)
|
|
|
{
|
|
|
- OptionsMenuSettingsList.clear();
|
|
|
+ AudioSettingsList.clear();
|
|
|
+ AudioSettingsGroup.populateSettings();
|
|
|
|
|
|
- OptionsMenu.currentCategory = "Gamepad";
|
|
|
+ //Process the lists
|
|
|
+ for(%i=0; %i < AudioSettingsGroup.getCount(); %i++)
|
|
|
+ {
|
|
|
+ %setting = AudioSettingsGroup.getObject(%i);
|
|
|
+
|
|
|
+ if(%setting.class $= "SubOptionsGroup")
|
|
|
+ {
|
|
|
+ %entry = addOptionGroup(%setting.displayName);
|
|
|
+
|
|
|
+ if(isObject(%entry))
|
|
|
+ AudioSettingsList.add(%entry);
|
|
|
+
|
|
|
+ for(%s=0; %s < %setting.getCount(); %s++)
|
|
|
+ {
|
|
|
+ %option = %setting.getObject(%s);
|
|
|
+
|
|
|
+ %optionsEntry = addOptionEntry(%option);
|
|
|
+
|
|
|
+ if(isObject(%optionsEntry))
|
|
|
+ AudioSettingsList.add(%optionsEntry);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(%setting.class $= "AudioOptionsSettings")
|
|
|
+ {
|
|
|
+ %optionsEntry = addOptionEntry(%setting);
|
|
|
+
|
|
|
+ if(isObject(%optionsEntry))
|
|
|
+ AudioSettingsList.add(%optionsEntry);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if(isObject(OptionName))
|
|
|
- OptionName.setText("");
|
|
|
- if(isObject(OptionDescription))
|
|
|
- OptionDescription.setText("");
|
|
|
+ AudioSettingsList.add(addOptionGroup("Channel Volume"));
|
|
|
|
|
|
- $remapListDevice = "gamepad";
|
|
|
- fillRemapList();
|
|
|
+ //Now we'll populate the sliders for the audio channels.
|
|
|
+ //The defaults of these are defined in core/sfx/scripts/audio.tscript
|
|
|
+ //These define the MasterVolume channel, as well as several other common defualt ones
|
|
|
+ //Because it's a variable list, this can be expanded by modules by just upping $AudioChannelCount
|
|
|
+ //and then defining the $AudioChannelName[x] with the displayed name and
|
|
|
+ //and the $AudioChannels[x] variable with the SFXSource object defined to it for the given channel
|
|
|
+ AudioSettingsList.add(addOptionSlider("Master Volume", "", "$pref::SFX::masterVolume", 0, 1, 10));
|
|
|
|
|
|
- OptionsMenuSettingsList.updateStack();
|
|
|
-}
|
|
|
-
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-function getDisplayDeviceList()
|
|
|
-{
|
|
|
- %numDevices = Canvas.getMonitorCount();
|
|
|
- %devicesList = "";
|
|
|
- for(%i = 0; %i < %numDevices; %i++)
|
|
|
+ //We init to 1, because 0 is the reserved for the masterVolume in practice
|
|
|
+ for(%i=1; %i < $AudioChannelCount; %i++)
|
|
|
{
|
|
|
- %device = (%i+1) @ " - " @ Canvas.getMonitorName(%i);
|
|
|
- if(%i==0)
|
|
|
- %devicesList = %device;
|
|
|
- else
|
|
|
- %devicesList = %devicesList @ "\t" @ %device;
|
|
|
+ AudioSettingsList.add(addOptionSlider($AudioChannelsName[%i] @ " Volume", "", "$pref::SFX::channelVolume" @ %i, 0, 1, 10));
|
|
|
+ }
|
|
|
+
|
|
|
+ //Ensure our newly templated options listings are sized right
|
|
|
+ for(%i=0; %i < AudioSettingsList.getCount(); %i++)
|
|
|
+ {
|
|
|
+ %entry = AudioSettingsList.getObject(%i);
|
|
|
+ %entry.resize(0, 0, AudioSettingsList.extent.x - 15, %entry.extent.y); //-10 for the scroll wheel pad
|
|
|
}
|
|
|
-
|
|
|
- return %devicesList;
|
|
|
}
|
|
|
|
|
|
-function getDisplayDeviceId(%displayDeviceName)
|
|
|
+function OptionsMenu::populateKBMControls(%this)
|
|
|
{
|
|
|
- %deviceList = getDisplayDeviceList();
|
|
|
+ %this.populateKeybinds("keyboard", KBMControlsList);
|
|
|
|
|
|
- %deviceCount = getFieldCount(%deviceList);
|
|
|
- for(%d = 0; %d < %deviceCount; %d++)
|
|
|
- {
|
|
|
- %deviceName = getField(%deviceList, %d);
|
|
|
- if(%deviceName $= %displayDeviceName)
|
|
|
- return %d;
|
|
|
- }
|
|
|
+ %this.syncGui();
|
|
|
|
|
|
- return -1;
|
|
|
-}
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-function OptionsMenuList::activateRow(%this)
|
|
|
-{
|
|
|
- //OptionsMenuSettingsList.setFirstResponder();
|
|
|
- OptionsMenuSettingsList.setAsActiveMenuList();
|
|
|
+ KBMControlsList.syncGui();
|
|
|
}
|
|
|
|
|
|
-function OptionsMenuSettingsList::setRowEnabled(%this, %row, %status)
|
|
|
+function OptionsMenu::populateGamepadControls(%this)
|
|
|
{
|
|
|
- %option = %this.getObject(%row);
|
|
|
- if(isObject(%option))
|
|
|
- {
|
|
|
- %option.setEnabled(%status);
|
|
|
- }
|
|
|
+ %this.populateKeybinds("gamepad", GamepadControlsList);
|
|
|
+
|
|
|
+ %this.syncGui();
|
|
|
+
|
|
|
+ GamepadControlsList.syncGui();
|
|
|
}
|
|
|
|
|
|
-function OptionsMenuSettingsList::addOptionRow(%this, %label, %targetPrefVar, %optionsList, %wrapOptions, %callback, %enabled, %description, %defaultValue)
|
|
|
+function OptionsMenu::populateKeybinds(%this, %device, %controlsList)
|
|
|
{
|
|
|
- if(%enabled $= "")
|
|
|
- %enabled = true;
|
|
|
+ %controlsList.clear();
|
|
|
+
|
|
|
+ //build out our list of action maps
|
|
|
+ %actionMapCount = ActionMapGroup.getCount();
|
|
|
+
|
|
|
+ %actionMapList = "";
|
|
|
+ for(%i=0; %i < %actionMapCount; %i++)
|
|
|
+ {
|
|
|
+ %actionMap = ActionMapGroup.getObject(%i);
|
|
|
|
|
|
- %optionsRowSize = 30;
|
|
|
- %optionColumnWidth = %this.extent.x * 0.5;//todo, calculate off longest option text?
|
|
|
+ if(%actionMap == GlobalActionMap.getId())
|
|
|
+ continue;
|
|
|
|
|
|
- %option = new GuiGameSettingsCtrl() {
|
|
|
- class = "MenuOptionsButton";
|
|
|
- profile = "GuiMenuButtonProfile";
|
|
|
- horizSizing = "width";
|
|
|
- vertSizing = "bottom";
|
|
|
- position = "0 0";
|
|
|
- extent = %this.extent.x SPC %optionsRowSize;
|
|
|
- columnSplit = %optionColumnWidth;
|
|
|
- useMouseEvents = true;
|
|
|
- previousBitmapAsset = "UI:previousOption_n_image";
|
|
|
- nextBitmapAsset = "UI:nextOption_n_image";
|
|
|
- };
|
|
|
-
|
|
|
- %option.targetPrefVar = %targetPrefVar; //create a var-option association
|
|
|
-
|
|
|
- if(%defaultValue $= "")
|
|
|
- {
|
|
|
- %unappliedPrefIndex = OptionsMenu.unappliedChanges.getIndexFromKey(%targetPrefVar);
|
|
|
- if(%unappliedPrefIndex != -1)
|
|
|
- {
|
|
|
- %value = OptionsMenu.unappliedChanges.getValue(%unappliedPrefIndex);
|
|
|
- %defaultValue = strreplace(%value, "\"", "");
|
|
|
- }
|
|
|
-
|
|
|
- if(%defaultValue $= "")
|
|
|
+ %actionMapName = %actionMap.humanReadableName $= "" ? %actionMap.getName() : %actionMap.humanReadableName;
|
|
|
+
|
|
|
+ //see if we have any actual listed remappable keys for this movemap. if so, drop it from the listing
|
|
|
+ %hasRemaps = false;
|
|
|
+ for ( %r = 0; %r < $RemapCount; %r++ )
|
|
|
{
|
|
|
- %sanitizedVar = strReplace(%targetPrefVar, "[", "");
|
|
|
- %sanitizedVar = strReplace(%sanitizedVar, "]", "");
|
|
|
- %sanitizedVar = strReplace(%sanitizedVar, ",", "_");
|
|
|
- %defaultValue = getVariable(%sanitizedVar);
|
|
|
+ %testMapName = $RemapActionMap[%r].humanReadableName $= "" ? $RemapActionMap[%r].getName() : $RemapActionMap[%r].humanReadableName;
|
|
|
+
|
|
|
+ if(%actionMapName $= %testMapName)
|
|
|
+ {
|
|
|
+ //got a match to at least one, so we're ok to continue
|
|
|
+ %hasRemaps = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ if(!%hasRemaps)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ if(%actionMapList $= "")
|
|
|
+ %actionMapList = %actionMapName;
|
|
|
+ else
|
|
|
+ %actionMapList = %actionMapList TAB %actionMapName;
|
|
|
}
|
|
|
|
|
|
- /*if(%defaultValue $= "Off" || %defaultValue $= "No")
|
|
|
- %defaultValue = "0";
|
|
|
- if(%defaultValue $= "On" || %defaultValue $= "Yes")
|
|
|
- %defaultValue = "1";*/
|
|
|
-
|
|
|
- %option.setListSetting(%label, %optionsList, %wrapOptions, %callback, %enabled, %description, %defaultValue);
|
|
|
-
|
|
|
- %this.add(%option);
|
|
|
-}
|
|
|
-
|
|
|
-function OptionsMenuSettingsList::addOptionQualityLevelRow(%this, %label, %targetPrefVar, %qualityLevelList, %wrapOptions, %callback, %enabled, %description, %defaultValue)
|
|
|
-{
|
|
|
- if(%defaultValue $= "")
|
|
|
- {
|
|
|
- %unappliedPrefIndex = OptionsMenu.unappliedChanges.getIndexFromKey(%targetPrefVar);
|
|
|
- if(%unappliedPrefIndex != -1)
|
|
|
+ //If we didn't find any valid actionMaps, then just exit out
|
|
|
+ if(%actionMapList $= "")
|
|
|
+ return;
|
|
|
+
|
|
|
+ if($activeRemapControlSet $= "")
|
|
|
+ $activeRemapControlSet = getField(%actionMapList, 0);
|
|
|
+
|
|
|
+ for(%am = 0; %am < getFieldCount(%actionMapList); %am++)
|
|
|
{
|
|
|
- %value = OptionsMenu.unappliedChanges.getValue(%unappliedPrefIndex);
|
|
|
- %defaultValue = strreplace(%value, "\"", "");
|
|
|
- }
|
|
|
-
|
|
|
- if(%defaultValue $= "")
|
|
|
+ %currentActionMap = getField(%actionMapList, %am);
|
|
|
+
|
|
|
+ //only add the group if we've got more than one group, otherwise it's obviously
|
|
|
+ //part of the single grouping
|
|
|
+ if(getFieldCount(%actionMapList) > 1)
|
|
|
{
|
|
|
- %sanitizedVar = strReplace(%targetPrefVar, "[", "");
|
|
|
- %sanitizedVar = strReplace(%sanitizedVar, "]", "");
|
|
|
- %sanitizedVar = strReplace(%sanitizedVar, ",", "_");
|
|
|
- %defaultValue = getVariable(%sanitizedVar);
|
|
|
+ %actionMapGroupEntry = addOptionGroup(%currentActionMap);
|
|
|
+ %controlsList.add(%actionMapGroupEntry);
|
|
|
}
|
|
|
+
|
|
|
+ for ( %i = 0; %i < $RemapCount; %i++ )
|
|
|
+ {
|
|
|
+ if(%device !$= "" && %device !$= $RemapDevice[%i])
|
|
|
+ continue;
|
|
|
+
|
|
|
+ %actionMapName = $RemapActionMap[%i].humanReadableName $= "" ? $RemapActionMap[%i].getName() : $RemapActionMap[%i].humanReadableName;
|
|
|
+
|
|
|
+ if(%currentActionMap !$= %actionMapName)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ %keyMap = buildFullMapString( %i, $RemapActionMap[%i], %device );
|
|
|
+
|
|
|
+ %description = $RemapDescription[%i];
|
|
|
|
|
|
- if(%defaultValue $= "")
|
|
|
- %defaultValue = getCurrentQualityLevel(%qualityLevelList);
|
|
|
+ %remapEntry = addActionMapEntry(%actionMapName, %device, %keyMap, %i, %description);
|
|
|
+ %controlsList.add(%remapEntry);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- return %this.addOptionRow(%label, %targetPrefVar, getQualityLevels(%qualityLevelList),
|
|
|
- %wrapOptions, %callback, %enabled, %description, %defaultValue);
|
|
|
+ //Ensure our newly templated options listings are sized right
|
|
|
+ for(%i=0; %i < %controlsList.getCount(); %i++)
|
|
|
+ {
|
|
|
+ %entry = %controlsList.getObject(%i);
|
|
|
+ %entry.resize(0, 0, %controlsList.extent.x - 15, %entry.extent.y); //-10 for the scroll wheel pad
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-function OptionsMenuSettingsList::addOptionBoolRow(%this, %label, %targetPrefVar, %qualityLevelList, %wrapOptions, %callback, %enabled, %description, %defaultValue, %inverted)
|
|
|
+//==============================================================================
|
|
|
+function tryCloseOptionsMenu(%val)
|
|
|
{
|
|
|
- if(%defaultValue $= "")
|
|
|
- %defaultValue = OptionsMenu.getOptionVariableValue(%targetPrefVar);
|
|
|
+ if(!%val)
|
|
|
+ return;
|
|
|
|
|
|
- if(%inverted $= "")
|
|
|
- %inverted = false;
|
|
|
-
|
|
|
- //Lame and hacky, but some variables are 'disabled' and some are 'enabled'
|
|
|
- if(isInt(%defaultValue) && %inverted)
|
|
|
+ $optionsChangeRequiresRestart = false;
|
|
|
+
|
|
|
+ %unappliedVideoChanges = VideoSettingsList.checkForUnappliedChanges();
|
|
|
+ %unappliedAudioChanges = AudioSettingsList.checkForUnappliedChanges();
|
|
|
+
|
|
|
+ //validate audio prefs
|
|
|
+ if($pref::SFX::masterVolume_tempVar !$= "" && $pref::SFX::masterVolume_tempVar != $pref::SFX::masterVolume)
|
|
|
+ %unappliedAudioChanges = true;
|
|
|
+
|
|
|
+ for(%i=1; %i < $AudioChannelCount; %i++)
|
|
|
{
|
|
|
- if(%defaultValue == 0)
|
|
|
- %defaultValue = 1;
|
|
|
- else
|
|
|
- %defaultValue = 0;
|
|
|
+ %tempVolume = getVariable("$pref::SFX::channelVolume" @ %i @ "_tempVar");
|
|
|
+ if(%tempVolume !$= "" && $pref::SFX::channelVolume[ %i ] != %tempVolume)
|
|
|
+ %unappliedAudioChanges = true;
|
|
|
}
|
|
|
|
|
|
- if(%qualityLevelList $= $yesNoList && isInt(%defaultValue))
|
|
|
+ if(%unappliedVideoChanges || %unappliedAudioChanges)
|
|
|
{
|
|
|
- %defaultValue = convertBoolToYesNo(%defaultValue);
|
|
|
+ MessageBoxOKCancel("Discard Changes?", "You have unapplied changes to your settings, do you wish to apply or discard them?",
|
|
|
+ "OptionsMenu.applyChangedOptions(); BaseUIBackOut(1);", "BaseUIBackOut(1);",
|
|
|
+ "Apply", "Discard");
|
|
|
}
|
|
|
- else if(%qualityLevelList $= $onOffList && isInt(%defaultValue))
|
|
|
+ else
|
|
|
{
|
|
|
- %defaultValue = convertBoolToOnOff(%defaultValue);
|
|
|
+ BaseUIBackOut(1);
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- return %this.addOptionRow(%label, %targetPrefVar, %qualityLevelList,
|
|
|
- %wrapOptions, %callback, %enabled, %description, %defaultValue);
|
|
|
-}
|
|
|
-
|
|
|
-function OptionsMenuSettingsList::addSliderRow(%this, %label, %targetPrefVar, %increment, %range, %callback, %enabled, %description, %defaultValue)
|
|
|
+function tryApplyOptions(%val)
|
|
|
{
|
|
|
- if(%enabled $= "")
|
|
|
- %enabled = true;
|
|
|
+ if(!%val)
|
|
|
+ return;
|
|
|
|
|
|
- %optionsRowSize = 30;
|
|
|
- %optionColumnWidth = %this.extent.x * 0.5;//todo, calculate off longest option text?
|
|
|
-
|
|
|
- %option = new GuiGameSettingsCtrl() {
|
|
|
- class = "MenuOptionsButton";
|
|
|
- profile = "GuiMenuButtonProfile";
|
|
|
- horizSizing = "width";
|
|
|
- vertSizing = "bottom";
|
|
|
- position = "0 0";
|
|
|
- extent = %this.extent.x SPC %optionsRowSize;
|
|
|
- columnSplit = %optionColumnWidth;
|
|
|
- useMouseEvents = true;
|
|
|
- };
|
|
|
-
|
|
|
- %option.targetPrefVar = %targetPrefVar; //create a var-option association
|
|
|
+ $optionsChangeRequiresRestart = false;
|
|
|
|
|
|
- if(%defaultValue $= "")
|
|
|
- %defaultValue = OptionsMenu.getOptionVariableValue(%targetPrefVar);
|
|
|
+ %unappliedVideoChanges = VideoSettingsList.checkForUnappliedChanges();
|
|
|
+ %unappliedAudioChanges = AudioSettingsList.checkForUnappliedChanges();
|
|
|
|
|
|
- %option.setSliderSetting(%label, %defaultValue, %increment, %range, %callback, %enabled, %description);
|
|
|
-
|
|
|
- %this.add(%option);
|
|
|
+ if(%unappliedVideoChanges || %unappliedAudioChanges)
|
|
|
+ OptionsMenu.applyChangedOptions();
|
|
|
}
|
|
|
|
|
|
-function OptionsMenuSettingsList::addKeybindRow(%this, %label, %bitmapName, %callback, %enabled, %description, %remapIndex)
|
|
|
+function OptionsMenu::applyChangedOptions(%this)
|
|
|
{
|
|
|
- if(%enabled $= "")
|
|
|
- %enabled = true;
|
|
|
-
|
|
|
- %optionsRowSize = 40;
|
|
|
- %optionColumnWidth = %this.extent.x * 0.5;//todo, calculate off longest option text?
|
|
|
-
|
|
|
- %option = new GuiGameSettingsCtrl() {
|
|
|
- class = "MenuOptionsButton";
|
|
|
- profile = "GuiMenuButtonProfile";
|
|
|
- horizSizing = "width";
|
|
|
- vertSizing = "bottom";
|
|
|
- position = "0 0";
|
|
|
- extent = %this.extent.x SPC %optionsRowSize;
|
|
|
- columnSplit = %optionColumnWidth;
|
|
|
- useMouseEvents = true;
|
|
|
- };
|
|
|
+ VideoSettingsList.applyChanges();
|
|
|
+ AudioSettingsList.applyChanges();
|
|
|
|
|
|
- %option.remapIndex = %remapIndex;
|
|
|
+ //Process the audio channel tempvars to get their values
|
|
|
+ //and then apply them to the actual pref variable, as well as the SFXChannelVolume
|
|
|
+ $pref::SFX::masterVolume = $pref::SFX::masterVolume_tempVar;
|
|
|
+ sfxSetMasterVolume( $pref::SFX::masterVolume );
|
|
|
|
|
|
- %option.setKeybindSetting(%label, %bitmapName, %callback, %enabled, %description);
|
|
|
+ //0 is always master anyways
|
|
|
+ for(%i=1; %i < $AudioChannelCount; %i++)
|
|
|
+ {
|
|
|
+ %volume = getVariable("$pref::SFX::channelVolume" @ %i @ "_tempVar");
|
|
|
+ sfxSetChannelVolume( %i, %volume );
|
|
|
+ $pref::SFX::channelVolume[ %i ] = %volume;
|
|
|
+ }
|
|
|
|
|
|
- %this.add(%option);
|
|
|
-}
|
|
|
+ //Finally, write our prefs to file
|
|
|
+ %prefPath = getPrefpath();
|
|
|
+ export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false);
|
|
|
|
|
|
-//
|
|
|
-function OptionsMenuCategoryList::onNavigate(%this, %index)
|
|
|
-{
|
|
|
- OptionsMenu.currentCategory = %index;
|
|
|
- %this.getObject(%index).performClick();
|
|
|
+ if($optionsChangeRequiresRestart)
|
|
|
+ MessageBoxOK("Restart Required", "Some of your changes require the game to be restarted.");
|
|
|
}
|
|
|
|
|
|
-function convertOptionToBool(%val)
|
|
|
+function doKeyRemap( %optionEntry )
|
|
|
{
|
|
|
- if(%val $= "yes" || %val $= "on")
|
|
|
- return 1;
|
|
|
- else
|
|
|
- return 0;
|
|
|
-}
|
|
|
+ %name = getField(%optionEntry.keymap,0);
|
|
|
|
|
|
-function convertBoolToYesNo(%val)
|
|
|
-{
|
|
|
- if(%val == 1)
|
|
|
- return "Yes";
|
|
|
- else if(%val == 0)
|
|
|
- return "No";
|
|
|
-
|
|
|
- return %val;
|
|
|
+ RemapDlg-->OptRemapText.text = "Re-bind \"" @ %name @ "\" to..." ;
|
|
|
+ OptRemapInputCtrl.index = %optionEntry.remapIndex;
|
|
|
+
|
|
|
+ $remapListDevice = %optionEntry.device;
|
|
|
+
|
|
|
+ Canvas.pushDialog( RemapDlg );
|
|
|
}
|
|
|
|
|
|
-function convertBoolToOnOff(%val)
|
|
|
+function OptionsMenu::resetSettings(%this)
|
|
|
{
|
|
|
- if(%val == 1)
|
|
|
- return "On";
|
|
|
- else if(%val == 0)
|
|
|
- return "Off";
|
|
|
-
|
|
|
- return %val;
|
|
|
+ MessageBoxOKCancel("", "This will set the graphical settings back to the auto-detected defaults. Do you wish to continue?", "AutodetectGraphics();", "");
|
|
|
}
|
|
|
|
|
|
-function getDisplayDeviceName()
|
|
|
+//==============================================================================
|
|
|
+// Option types
|
|
|
+function addOptionGroup(%displayName)
|
|
|
{
|
|
|
- %numDevices = Canvas.getMonitorCount();
|
|
|
- %devicesList = "";
|
|
|
- for(%i = 0; %i < %numDevices; %i++)
|
|
|
- {
|
|
|
- %device = (%i+1) @ " - " @ Canvas.getMonitorName(%i);
|
|
|
- if(%i==0)
|
|
|
- %devicesList = %device;
|
|
|
- else
|
|
|
- %devicesList = %devicesList @ "\t" @ %device;
|
|
|
- }
|
|
|
+ OptionsMenu.optsListCount++;
|
|
|
+ %group = new GuiTextCtrl() {
|
|
|
+ text = %displayName;
|
|
|
+ position = "0 0";
|
|
|
+ extent = "500 45";
|
|
|
+ profile = "MenuHeaderText";
|
|
|
+ tooltipProfile = "GuiToolTipProfile";
|
|
|
+ canSave = false;
|
|
|
+ };
|
|
|
|
|
|
- return getField(%devicesList, $pref::Video::deviceId);
|
|
|
-}
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-function MenuOptionsButton::onMouseEnter(%this)
|
|
|
-{
|
|
|
- if(isObject(OptionName))
|
|
|
- OptionName.setText(%this.getLabel());
|
|
|
- if(isObject(OptionDescription))
|
|
|
- OptionDescription.setText(%this.getToolTip());
|
|
|
+ return %group;
|
|
|
}
|
|
|
|
|
|
-function MenuOptionsButton::onMouseLeave(%this)
|
|
|
+function optionsMenuButton::onHighlighted(%this, %highlighted)
|
|
|
{
|
|
|
- if(isObject(OptionName))
|
|
|
- OptionName.setText("");
|
|
|
- if(isObject(OptionDescription))
|
|
|
- OptionDescription.setText("");
|
|
|
-}
|
|
|
-
|
|
|
-function MenuOptionsButton::onHighlighted(%this, %state)
|
|
|
-{
|
|
|
- MenuListButton::onHighlighted(%this, %state);
|
|
|
+ %container = %this.getParent();
|
|
|
+
|
|
|
+ %container-->optionName.profile = %highlighted ? MenuSubHeaderTextHighlighted : MenuSubHeaderText;
|
|
|
+ %container-->optionDescription.profile = %highlighted ? GuiMLTextProfileHighlighted : GuiMLTextProfile;
|
|
|
+
|
|
|
+ %valuesContainer = %container-->valuesContainer;
|
|
|
+ %valuesContainer-->optionValue.profile = %highlighted ? GuiMenuTextProfileHL : GuiMenuTextProfile;
|
|
|
+
|
|
|
+ OptionsMenuSettingsScroll.scrollToObject(%container);
|
|
|
}
|
|
|
|
|
|
-function MenuOptionsButton::onChange(%this)
|
|
|
+function addOptionEntry(%optionObj)
|
|
|
{
|
|
|
- %optionMode = %this.getMode();
|
|
|
- %optionName = %this.getLabel();
|
|
|
- %tooltipText = %this.getTooltip();
|
|
|
-
|
|
|
- %targetVar = %this.targetPrefVar;
|
|
|
+ OptionsMenu.optsListCount++;
|
|
|
+ if(!isObject(%optionObj) || (%optionObj.class !$= "OptionsSettings" && %optionObj.class !$= "AudioOptionsSettings"))
|
|
|
+ {
|
|
|
+ error("addOptionsEntry() - attempting to create a new options entry, but was provided an invalid options object");
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
|
|
|
- OptionName.setText(%optionName);
|
|
|
- OptionDescription.setText(%tooltipText);
|
|
|
+ %qualityLevel = getCurrentQualityLevel(%optionObj);
|
|
|
|
|
|
- if(%optionMode == 0)
|
|
|
+ if(isObject(%qualityLevel))
|
|
|
{
|
|
|
- %currentValue = %this.getCurrentOption();
|
|
|
- if(%currentValue !$= "")
|
|
|
- {
|
|
|
- if(%currentValue $= "yes" || %currentValue $= "on")
|
|
|
- %saveReadyValue = 1;
|
|
|
- else if(%currentValue $= "no" || %currentValue $= "off")
|
|
|
- %saveReadyValue = 0;
|
|
|
- else
|
|
|
- %saveReadyValue = %currentValue;
|
|
|
-
|
|
|
- %prefIndex = OptionsMenu.unappliedChanges.getIndexFromKey(%targetVar);
|
|
|
- if(%prefIndex == -1)
|
|
|
- {
|
|
|
- echo("Setting UnappliedChanges via add: key:" @ %targetVar @", value: " @ %saveReadyValue);
|
|
|
- OptionsMenu.unappliedChanges.add(%targetVar, "\"" @ %saveReadyValue @ "\"" );
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- echo("Setting UnappliedChanges via modify: key:" @ %targetVar @", value: " @ %saveReadyValue);
|
|
|
- OptionsMenu.unappliedChanges.setValue("\"" @ %saveReadyValue @ "\"", %prefIndex);
|
|
|
- }
|
|
|
- }
|
|
|
+ %qualityLevelText = %qualityLevel.displayName;
|
|
|
+ %qualityLevelIndex = %optionObj.getObjectIndex(%qualityLevel);
|
|
|
}
|
|
|
- else if(%optionMode == 1)
|
|
|
+ else
|
|
|
{
|
|
|
- %currentValue = %this.getValue();
|
|
|
-
|
|
|
- %prefIndex = OptionsMenu.unappliedChanges.getIndexFromKey(%targetVar);
|
|
|
- if(%prefIndex == -1)
|
|
|
- {
|
|
|
- echo("Setting UnappliedChanges via add: key:" @ %targetVar @", value: " @ %currentValue);
|
|
|
- OptionsMenu.unappliedChanges.add(%targetVar, "\"" @ %currentValue @ "\"" );
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- OptionsMenu.unappliedChanges.setValue("\"" @ %currentValue @ "\"", %prefIndex);
|
|
|
- }
|
|
|
+ %qualityLevelText = %qualityLevel;
|
|
|
+ %qualityLevelIndex = %optionObj.getCount();
|
|
|
}
|
|
|
|
|
|
- //Update the UI in case there's responsive logic
|
|
|
- OptionsMenu.schedule(32, "refresh");
|
|
|
-}
|
|
|
-
|
|
|
-function OptionsMenu::onKeybindChanged(%this, %actionMap, %keybind)
|
|
|
-{
|
|
|
- %prefIndex = OptionsMenu.unappliedChanges.getIndexFromKey(%actionMap);
|
|
|
- if(%prefIndex == -1)
|
|
|
- OptionsMenu.unappliedChanges.add(%actionMap, %keybind);
|
|
|
- else
|
|
|
- OptionsMenu.unappliedChanges.setValue(%keybind, %prefIndex);
|
|
|
-}
|
|
|
+ %optionNameHeight = 20;
|
|
|
+ if(%optionObj.Description $= "")
|
|
|
+ %optionNameHeight = 40;
|
|
|
+
|
|
|
+ %entry = new GuiContainer() {
|
|
|
+ position = "0 0";
|
|
|
+ extent = "800 40";
|
|
|
+ profile = GuiMenuDefaultProfile;
|
|
|
+ tooltipProfile = "GuiToolTipProfile";
|
|
|
+ horizSizing = "width";
|
|
|
+ vertSizing = "bottom";
|
|
|
+ class = "OptionsListEntry";
|
|
|
+ optionsObject = %optionObj;
|
|
|
+ currentOptionIndex = %qualityLevelIndex;
|
|
|
+ selectionID = OptionsMenu.optsListCount;
|
|
|
+ canSave = false;
|
|
|
+
|
|
|
+ new GuiButtonCtrl() {
|
|
|
+ profile = GuiMenuButtonProfile;
|
|
|
+ position = "0 0";
|
|
|
+ extent = "800 40";
|
|
|
+ horizSizing = "width";
|
|
|
+ vertSizing = "height";
|
|
|
+ internalName = "button";
|
|
|
+ class = "optionsMenuButton";
|
|
|
+ };
|
|
|
|
|
|
-//
|
|
|
-// Indicates what category the options item should be added into
|
|
|
-//
|
|
|
-function addOptionsMenuCategory(%categoryName, %selectCallback)
|
|
|
-{
|
|
|
- //Don't add duplicates!
|
|
|
- %index = OptionsMenu.optionsCategories.getIndexFromKey(%categoryName);
|
|
|
- if(%index == -1)
|
|
|
- OptionsMenu.optionsCategories.add(%categoryName, %selectCallback);
|
|
|
+ new GuiTextCtrl() {
|
|
|
+ text = %optionObj.OptionName;
|
|
|
+ position = $optionsEntryPad SPC -1;
|
|
|
+ extent = 400 SPC %optionNameHeight;
|
|
|
+ profile = "MenuSubHeaderText";
|
|
|
+ tooltipProfile = "GuiToolTipProfile";
|
|
|
+ internalName = "optionName";
|
|
|
+ };
|
|
|
+ new GuiTextCtrl() {
|
|
|
+ text = %optionObj.Description;
|
|
|
+ position = $optionsEntryPad SPC 17;
|
|
|
+ extent = "400 18";
|
|
|
+ profile = "GuiMLTextProfile";
|
|
|
+ tooltipProfile = "GuiToolTipProfile";
|
|
|
+ internalName = "optionDescription";
|
|
|
+ };
|
|
|
+
|
|
|
+ new GuiContainer() {
|
|
|
+ position = "400 0";
|
|
|
+ extent = "400 40";
|
|
|
+ profile = GuiModelessDialogProfile;
|
|
|
+ tooltipProfile = "GuiToolTipProfile";
|
|
|
+ horizSizing = "left";
|
|
|
+ vertSizing = "height";
|
|
|
+ internalName = "valuesContainer";
|
|
|
+
|
|
|
+ new GuiButtonCtrl() {
|
|
|
+ position = "310 0";
|
|
|
+ extent = "20 40";
|
|
|
+ text = "<";
|
|
|
+ profile = GuiMenuButtonProfile;
|
|
|
+ internalName = "prevValButton";
|
|
|
+ command = "$MenuList.listPosition = $thisControl.getParent().getParent().selectionID; OptionMenuPrevSetting(1);";
|
|
|
+ };
|
|
|
+
|
|
|
+ new GuiTextCtrl() {
|
|
|
+ text = %qualityLevelText;
|
|
|
+ position = "330 0";
|
|
|
+ extent = "50 40";
|
|
|
+ profile = "GuiMenuTextProfile";
|
|
|
+ tooltipProfile = "GuiToolTipProfile";
|
|
|
+ horizSizing = "right";
|
|
|
+ vertSizing = "center";
|
|
|
+ internalName = "optionValue";
|
|
|
+ };
|
|
|
+
|
|
|
+ new GuiButtonCtrl() {
|
|
|
+ position = "380 0";
|
|
|
+ extent = "20 40";
|
|
|
+ text = ">";
|
|
|
+ profile = GuiMenuButtonProfile;
|
|
|
+ internalName = "nextValButton";
|
|
|
+ command = "$MenuList.listPosition = $thisControl.getParent().getParent().selectionID; OptionMenuNextSetting(1);";
|
|
|
+ };
|
|
|
+ };
|
|
|
+ };
|
|
|
+
|
|
|
+ return %entry;
|
|
|
}
|
|
|
|
|
|
-function removeOptionsMenuCategory(%categoryName)
|
|
|
+function addOptionSlider(%optionName, %optionDesc, %prefName, %sliderMin, %sliderMax, %sliderTicks)
|
|
|
{
|
|
|
- %index = OptionsMenu.optionsCategories.getIndexFromKey(%categoryName);
|
|
|
- if(%index != -1)
|
|
|
- OptionsMenu.optionsCategories.erase(%index);
|
|
|
-}
|
|
|
+ OptionsMenu.optsListCount++;
|
|
|
+ %currentVal = getVariable(%prefName);
|
|
|
+
|
|
|
+ %tempVarName = %prefName @ "_tempVar";
|
|
|
+
|
|
|
+ if(%currentVal $= "")
|
|
|
+ %currentVal = %sliderMin;
|
|
|
+
|
|
|
+ setVariable(%tempVarName, %currentVal);
|
|
|
+
|
|
|
+ %optionNameHeight = 20;
|
|
|
+ if(%optionDesc $= "")
|
|
|
+ %optionNameHeight = 40;
|
|
|
+
|
|
|
+ %entry = new GuiContainer() {
|
|
|
+ position = "0 0";
|
|
|
+ extent = "800 40";
|
|
|
+ profile = GuiMenuDefaultProfile;
|
|
|
+ tooltipProfile = "GuiToolTipProfile";
|
|
|
+ horizSizing = "width";
|
|
|
+ vertSizing = "bottom";
|
|
|
+ class = "OptionsListSliderEntry";
|
|
|
+ canSave = false;
|
|
|
+
|
|
|
+ new GuiButtonCtrl() {
|
|
|
+ profile = GuiMenuButtonProfile;
|
|
|
+ position = "0 0";
|
|
|
+ extent = "800 40";
|
|
|
+ horizSizing = "width";
|
|
|
+ vertSizing = "height";
|
|
|
+ internalName = "button";
|
|
|
+ class = "optionsMenuButton";
|
|
|
+ };
|
|
|
|
|
|
-function getOptionsCategoryIndexByName(%categoryName)
|
|
|
-{
|
|
|
- for(%i=0; %i < OptionsMenu.optionsCategories.count(); %i++)
|
|
|
- {
|
|
|
- if(OptionsMenu.optionsCategories.getKey(%i) $= %categoryName)
|
|
|
- return %i;
|
|
|
- }
|
|
|
+ new GuiTextCtrl() {
|
|
|
+ text = %optionName;
|
|
|
+ position = $optionsEntryPad SPC -1;
|
|
|
+ extent = 400 SPC %optionNameHeight;
|
|
|
+ profile = "MenuSubHeaderText";
|
|
|
+ tooltipProfile = "GuiToolTipProfile";
|
|
|
+ internalName = "optionName";
|
|
|
+ };
|
|
|
+
|
|
|
+ new GuiTextCtrl() {
|
|
|
+ text = %optionDesc;
|
|
|
+ position = $optionsEntryPad SPC 17;
|
|
|
+ extent = "400 18";
|
|
|
+ profile = "GuiMLTextProfile";
|
|
|
+ tooltipProfile = "GuiToolTipProfile";
|
|
|
+ internalName = "optionDescription";
|
|
|
+ };
|
|
|
+
|
|
|
+ new GuiContainer() {
|
|
|
+ position = "400 0";
|
|
|
+ extent = "400 40";
|
|
|
+ profile = GuiModelessDialogProfile;
|
|
|
+ tooltipProfile = "GuiToolTipProfile";
|
|
|
+ horizSizing = "left";
|
|
|
+ vertSizing = "height";
|
|
|
+ internalName = "valuesContainer";
|
|
|
+
|
|
|
+ new GuiSliderCtrl() {
|
|
|
+ range = %sliderMin SPC %sliderMax;
|
|
|
+ ticks = %sliderTicks;
|
|
|
+ snap = "1";
|
|
|
+ value = %currentVal;
|
|
|
+ variable = %tempVarName;
|
|
|
+ useFillBar = "1";
|
|
|
+ fillBarColor = $TextMediumEmphasisColor;
|
|
|
+ renderTicks = "0";
|
|
|
+ position = "0 10";
|
|
|
+ extent = "400 20";
|
|
|
+ minExtent = "8 2";
|
|
|
+ horizSizing = "right";
|
|
|
+ vertSizing = "center";
|
|
|
+ profile = GuiMenuButtonProfile;
|
|
|
+ visible = "1";
|
|
|
+ active = "1";
|
|
|
+ command = "$thisControl.updateSliderValue();";
|
|
|
+ tooltipProfile = "GuiToolTipProfile";
|
|
|
+ hovertime = "1000";
|
|
|
+ isContainer = "0";
|
|
|
+ canSave = "1";
|
|
|
+ canSaveDynamicFields = "0";
|
|
|
+ class = "OptionsSliderEntrySlider";
|
|
|
+ internalName = "slider";
|
|
|
+ };
|
|
|
+ };
|
|
|
+ };
|
|
|
|
|
|
- return -1;
|
|
|
+ return %entry;
|
|
|
}
|
|
|
|
|
|
-function addListOption(%label, %description, %targetPrefVar, %optionsList, %wrapOptions, %callback, %enabled)
|
|
|
+function OptionsSliderEntrySlider::updateSliderValue(%this)
|
|
|
{
|
|
|
- if(%wrapOptions $= "")
|
|
|
- %wrapOptions = false;
|
|
|
-
|
|
|
- if(%enabled $= "")
|
|
|
- %enabled = true;
|
|
|
-
|
|
|
- OptionsMenuSettingsList.addOptionRow(%label, %targetPrefVar, %optionsList, %wrapOptions, %callback, %enabled, %description, %targetPrefVar);
|
|
|
+ //update settings value here
|
|
|
}
|
|
|
|
|
|
-function addSliderOption(%label, %description, %targetPrefVar, %defaultValue, %increment, %range, %callback, %enabled)
|
|
|
+function OptionsMenuActionMapButton::onHighlighted(%this, %highlighted)
|
|
|
{
|
|
|
- if(%enabled $= "")
|
|
|
- %enabled = true;
|
|
|
+ %container = %this.getParent();
|
|
|
+ %container-->actionName.profile = %highlighted ? MenuSubHeaderTextHighlighted : MenuSubHeaderText;
|
|
|
|
|
|
- OptionsMenuSettingsList.addSliderRow(%label, %targetPrefVar, %defaultValue, %increment, %range, %callback, %enabled, %description);
|
|
|
+ OptionsMenuSettingsScroll.scrollToObject(%container);
|
|
|
}
|
|
|
|
|
|
-function addKeybindOption(%label, %description, %bitmapName, %callback, %enabled)
|
|
|
+function addActionMapEntry(%actionMap, %device, %keyMap, %index, %description)
|
|
|
{
|
|
|
- if(%enabled $= "")
|
|
|
- %enabled = true;
|
|
|
+ %entry = new GuiContainer() {
|
|
|
+ position = "0 0";
|
|
|
+ extent = "800 40";
|
|
|
+ profile = GuiMenuDefaultProfile;
|
|
|
+ tooltipProfile = "GuiToolTipProfile";
|
|
|
+ horizSizing = "width";
|
|
|
+ vertSizing = "bottom";
|
|
|
+ class = "OptionsKeybindEntry";
|
|
|
+ actionMap = %actionMap;
|
|
|
+ device = %device;
|
|
|
+ keymap = %keyMap;
|
|
|
+ remapIndex = %index;
|
|
|
+ canSave = false;
|
|
|
+
|
|
|
+ new GuiButtonCtrl() {
|
|
|
+ profile = GuiMenuButtonProfile;
|
|
|
+ position = "0 0";
|
|
|
+ extent = "800 40";
|
|
|
+ horizSizing = "width";
|
|
|
+ vertSizing = "height";
|
|
|
+ internalName = "button";
|
|
|
+ class = "OptionsMenuActionMapButton";
|
|
|
+ altCommand = "doKeyRemap($thisControl.getParent());";
|
|
|
+ };
|
|
|
|
|
|
- OptionsMenuSettingsList.addSliderRow(%label, %bitmapName, %callback, %enabled, %description);
|
|
|
-}
|
|
|
+ new GuiTextCtrl() {
|
|
|
+ text = getField(%keyMap, 0);
|
|
|
+ position = $optionsEntryPad SPC -1;
|
|
|
+ extent = "400 40";
|
|
|
+ profile = "MenuSubHeaderText";
|
|
|
+ tooltipProfile = "GuiToolTipProfile";
|
|
|
+ internalName = "actionName";
|
|
|
+ };
|
|
|
+
|
|
|
+ new GuiContainer() {
|
|
|
+ position = "400 3";
|
|
|
+ extent = "400 34";
|
|
|
+ profile = GuiModelessDialogProfile;
|
|
|
+ tooltipProfile = "GuiToolTipProfile";
|
|
|
+ horizSizing = "left";
|
|
|
+ vertSizing = "height";
|
|
|
+ internalName = "valuesContainer";
|
|
|
+
|
|
|
+ new GuiIconButtonCtrl() {
|
|
|
+ position = "300 -10";
|
|
|
+ extent = "98 45";
|
|
|
+ BitmapAsset = "";
|
|
|
+ profile = GuiRemapActionMapButtonProfile;
|
|
|
+ sizeIconToButton = true;
|
|
|
+ makeIconSquare = true;
|
|
|
+ iconLocation = "center";
|
|
|
+ internalName = "bindButton";
|
|
|
+ active = false;
|
|
|
+ };
|
|
|
+ };
|
|
|
+ };
|
|
|
+
|
|
|
+ return %entry;
|
|
|
+}
|