mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Merge pull request #1604 from Sir-Skurpsalot/Skurpz/controls-menu-fixes
Some checks are pending
Linux Build / ${{matrix.config.name}} (map[build_type:Release cc:gcc cxx:g++ generator:Ninja name:Ubuntu Latest GCC]) (push) Waiting to run
MacOSX Build / ${{matrix.config.name}} (map[build_type:Release cc:clang cxx:clang++ generator:Ninja name:MacOSX Latest Clang]) (push) Waiting to run
Windows Build / ${{matrix.config.name}} (map[build_type:Release cc:cl cxx:cl environment_script:C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat generator:Visual Studio 17 2022 name:Windows Latest MSVC]) (push) Waiting to run
Some checks are pending
Linux Build / ${{matrix.config.name}} (map[build_type:Release cc:gcc cxx:g++ generator:Ninja name:Ubuntu Latest GCC]) (push) Waiting to run
MacOSX Build / ${{matrix.config.name}} (map[build_type:Release cc:clang cxx:clang++ generator:Ninja name:MacOSX Latest Clang]) (push) Waiting to run
Windows Build / ${{matrix.config.name}} (map[build_type:Release cc:cl cxx:cl environment_script:C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat generator:Visual Studio 17 2022 name:Windows Latest MSVC]) (push) Waiting to run
Skurpz/controls menu fixes
This commit is contained in:
commit
b919ab50ed
|
|
@ -583,7 +583,7 @@ function OptionsMenu::populateAudioSettings(%this)
|
|||
|
||||
function OptionsMenu::populateKBMControls(%this)
|
||||
{
|
||||
%this.populateKeybinds("keyboard", KBMControlsList);
|
||||
%this.populateKeybinds("keyboard" TAB "mouse", KBMControlsList);
|
||||
|
||||
%this.syncGui();
|
||||
|
||||
|
|
@ -599,7 +599,7 @@ function OptionsMenu::populateGamepadControls(%this)
|
|||
GamepadControlsList.syncGui();
|
||||
}
|
||||
|
||||
function OptionsMenu::populateKeybinds(%this, %device, %controlsList)
|
||||
function OptionsMenu::populateKeybinds(%this, %devices, %controlsList)
|
||||
{
|
||||
%controlsList.clear();
|
||||
|
||||
|
|
@ -662,21 +662,30 @@ function OptionsMenu::populateKeybinds(%this, %device, %controlsList)
|
|||
|
||||
for ( %i = 0; %i < $RemapCount; %i++ )
|
||||
{
|
||||
if(%device !$= "" && %device !$= $RemapDevice[%i])
|
||||
%entryDevice = "";
|
||||
//Check each field of %devices for device matching the remappable action
|
||||
foreach$(%d in %devices){
|
||||
if(%d $= $RemapDevice[%i]) {
|
||||
%entryDevice = %d;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//If there was no match go to the next remappable action
|
||||
if(%entryDevice $= "")
|
||||
continue;
|
||||
|
||||
%actionMapName = $RemapActionMap[%i].humanReadableName $= "" ? $RemapActionMap[%i].getName() : $RemapActionMap[%i].humanReadableName;
|
||||
|
||||
|
||||
%actionMapName = $RemapActionMap[%i].humanReadableName $= "" ? $RemapActionMap[%i].getName() : $RemapActionMap[%i].humanReadableName;
|
||||
|
||||
if(%currentActionMap !$= %actionMapName)
|
||||
continue;
|
||||
|
||||
%keyMap = buildFullMapString( %i, $RemapActionMap[%i], %device );
|
||||
|
||||
%keyMap = buildFullMapString( %i, $RemapActionMap[%i], %entryDevice );
|
||||
|
||||
%description = $RemapDescription[%i];
|
||||
if ($reportKeymapping)
|
||||
echo("Added ActionMap Entry: " @ %actionMapName @ " | " @ %device @ " | " @ %keymap @ " | " @ %description);
|
||||
|
||||
%remapEntry = addActionMapEntry(%actionMapName, %device, %keyMap, %i, %description);
|
||||
|
||||
echo("Added ActionMap Entry: " @ %actionMapName @ " | " @ %entryDevice @ " | " @ %keymap @ " | " @ %description);
|
||||
|
||||
%remapEntry = addActionMapEntry(%actionMapName, %entryDevice, %keyMap, %i, %description);
|
||||
%controlsList.add(%remapEntry);
|
||||
}
|
||||
}
|
||||
|
|
@ -1132,4 +1141,4 @@ function addActionMapEntry(%actionMap, %device, %keyMap, %index, %description)
|
|||
}
|
||||
|
||||
return %entry;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,85 +126,6 @@ function buildFullMapString( %index, %actionMap, %deviceType )
|
|||
return %name TAB %mapString;
|
||||
}
|
||||
|
||||
function fillRemapList()
|
||||
{
|
||||
%device = $remapListDevice;
|
||||
|
||||
OptionsMenuSettingsList.clear();
|
||||
|
||||
//build out our list of action maps
|
||||
%actionMapCount = ActionMapGroup.getCount();
|
||||
|
||||
%actionMapList = "";
|
||||
for(%i=0; %i < %actionMapCount; %i++)
|
||||
{
|
||||
%actionMap = ActionMapGroup.getObject(%i);
|
||||
|
||||
if(%actionMap == GlobalActionMap.getId())
|
||||
continue;
|
||||
|
||||
%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++ )
|
||||
{
|
||||
%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 we didn't find any valid actionMaps, then just exit out
|
||||
if(%actionMapList $= "")
|
||||
return;
|
||||
|
||||
if($activeRemapControlSet $= "")
|
||||
$activeRemapControlSet = getField(%actionMapList, 0);
|
||||
|
||||
OptionsMenuSettingsList.addOptionRow("Control Set", "$activeRemapControlSet", %actionMapList, false, "controlSetChanged", true, "Which keybind control set to edit", $activeRemapControlSet);
|
||||
|
||||
for ( %i = 0; %i < $RemapCount; %i++ )
|
||||
{
|
||||
if(%device !$= "" && %device !$= $RemapDevice[%i])
|
||||
continue;
|
||||
|
||||
%actionMapName = $RemapActionMap[%i].humanReadableName $= "" ? $RemapActionMap[%i].getName() : $RemapActionMap[%i].humanReadableName;
|
||||
|
||||
if($activeRemapControlSet !$= %actionMapName)
|
||||
continue;
|
||||
|
||||
%keyMap = buildFullMapString( %i, $RemapActionMap[%i], %device );
|
||||
%description = $RemapDescription[%i];
|
||||
|
||||
%buttonImageAsset = getButtonBitmap(%device, getField(%keyMap, 1));
|
||||
|
||||
OptionsMenuSettingsList.addKeybindRow(getField(%keyMap, 0), %buttonImageAsset, "doKeyRemap", true, %description, %i);
|
||||
}
|
||||
|
||||
//OptionsMenuSettingsList.refresh();
|
||||
//OptionsMenu.addRow( %i, %this.buildFullMapString( %i ) );
|
||||
}
|
||||
|
||||
function controlSetChanged()
|
||||
{
|
||||
$activeRemapControlSet = OptionsMenuSettingsList.getObject(0).getCurrentOption();
|
||||
fillRemapList();
|
||||
}
|
||||
|
||||
function ControlsMenuRebindButton::onClick(%this)
|
||||
{
|
||||
%name = $RemapName[%this.keybindIndex];
|
||||
|
|
@ -231,5 +152,6 @@ function redoMapping( %device, %actionMap, %action, %cmd, %oldIndex, %newIndex )
|
|||
//%actionMap.bind( %device, %action, $RemapCmd[%newIndex] );
|
||||
%actionMap.bind( %device, %action, %cmd );
|
||||
|
||||
fillRemapList();
|
||||
OptionsMenu.populateKBMControls();
|
||||
OptionsMenu.populateGamepadControls();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,9 @@ function getButtonBitmap(%device, %button)
|
|||
{
|
||||
if(%button $= "lshift" || %button $= "rshift")
|
||||
%button = "shift";
|
||||
|
||||
else if(%button $= "lcontrol" || %button $= "rcontrol")
|
||||
%button = "ctrl";
|
||||
|
||||
%assetId = "UI:Keyboard_Black_" @ %button @ "_image";
|
||||
}
|
||||
else if(%device !$= "")
|
||||
|
|
@ -192,4 +194,4 @@ function switchLanguage(%language) //use here the #n as it's the order of inclus
|
|||
// swap existing language from the current core langtable and refresh the gui contents
|
||||
getCoreLangTable().setCurrentLanguage(%language);
|
||||
Canvas.setContent(Canvas.getContent());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue