2
0
Эх сурвалжийг харах

- Added ability to explicitly execute a guiControl's console and altConsole command
- Fixed formatting of resolution strings for the internal values, allowing them to be properly parsed and applied by the options menu/canvas
- Fixed display of Display Device on option's menu
- Fixed Issue of it not displaying any keybinds in keyboard/gamepad options if there's only a single actionmap
- Added 'hold to scroll' action to optionsMenu
- Added apply button to options menu
- Added remap button to options menu when on keyboard/gamepad keybinds categories
- Fixed up the remap logic so remapping a key only unbinds the matched device being bound, so binds for different devices are untouched
- Made keybinds options properly refresh when keybinds are changed
- Shifted keyboard "go" keybind for menu nav from Enter to Space for easier use
- Removed stick keybinds from gamepad

Areloch 1 жил өмнө
parent
commit
67ac556ecd

+ 16 - 0
Engine/source/gui/core/guiControl.cpp

@@ -2947,3 +2947,19 @@ DefineEngineMethod( GuiControl, getAspect, F32, (),,
    const Point2I &ext = object->getExtent();
    return (F32)ext.x / (F32)ext.y;
 }
+
+//-----------------------------------------------------------------------------
+
+DefineEngineMethod(GuiControl, execCommand, const char*, (), ,
+   "Forcefully executes the command field value(if any) on this guiControl.\n"
+   "@return The results of the evaluation of the command.")
+{
+   return object->execConsoleCallback();
+}
+
+DefineEngineMethod(GuiControl, execAltCommand, const char*, (), ,
+   "Forcefully executes the altCommand field value(if any) on this guiControl.\n"
+   "@return The results of the evaluation of the altCommand.")
+{
+   return object->execAltConsoleCallback();
+}

+ 1 - 1
Templates/BaseGame/game/core/gui/scripts/canvas.tscript

@@ -94,7 +94,7 @@ function configureCanvas()
    if ($pref::Video::deviceMode != $Video::ModeFullscreen)
       $pref::Video::FullScreen = false;
    %modeStr = Canvas.prefsToModeStr();
-
+   
    echo("--------------");
    echo("Attempting to set resolution to \"" @ %modeStr @ "\"");
 

+ 33 - 5
Templates/BaseGame/game/core/rendering/scripts/graphicsOptions.tscript

@@ -9,9 +9,10 @@ function OptionsQualityLevel::isCurrent( %this )
       %value = %this.getValue( %i );
       
       if ( getVariable( %pref ) !$= %value )
+      {
          return false;
+      }
    }
-   
    return true;
 }
 
@@ -971,7 +972,7 @@ function VideoSettingsGroup::populateDisplaySettings(%this)
       {
          class = "OptionsQualityLevel";
          displayName = %device;
-         key["$pref::Video::displayDeviceId"] = %device;
+         key["$pref::Video::deviceId"] = %i;
       };
       
       DisplayDevicesGroup.add(%entry);
@@ -985,8 +986,9 @@ function VideoSettingsGroup::populateDisplaySettings(%this)
       for(%i=0; %i < getFieldCount(%resolutionList); %i++)
       {
          %rawResolution = getField(%resolutionList, %i);
-         %prettyResolution = _makePrettyResString(%rawResolution);
          
+         %prettyResolution = _makePrettyResString(%rawResolution);
+
          %entry = new ArrayObject()
          {
             class = "OptionsQualityLevel";
@@ -997,6 +999,26 @@ function VideoSettingsGroup::populateDisplaySettings(%this)
          DisplayResSettingsGroup.add(%entry);
       }
    }
+   else
+   {
+      if($platform !$= "windows")
+         %monitorRect = Canvas.getMonitorUsableRect($pref::Video::deviceId);
+      else
+         %monitorRect = Canvas.getMonitorRect($pref::Video::deviceId);
+         
+      %rawResolution = getWords(%monitorRect, 2);
+      
+      %prettyResolution = _makePrettyResString(%rawResolution);
+         
+      %entry = new ArrayObject()
+      {
+         class = "OptionsQualityLevel";
+         displayName = %prettyResolution;
+         key["$pref::Video::Resolution"] = %rawResolution;
+      };
+      
+      DisplayResSettingsGroup.add(%entry);
+   }
 
    %refreshList = getScreenRefreshList($pref::Video::mode);
    for(%i=0; %i < getFieldCount(%refreshList); %i++)
@@ -1100,6 +1122,7 @@ function updateDisplayOptionsSettings()
       $pref::Video::FullScreen = %newFullScreen;
       $pref::Video::RefreshRate = %newRefresh;
       $pref::Video::AA = %newAA;
+      
       configureCanvas();
    }
 }
@@ -1135,6 +1158,11 @@ function PostFXLightRayOptionsGroup::onApply(%this)
 
 function getCurrentQualityLevel(%qualityGroup)
 {
+   /*if(%qualityGroup.getId() == DisplayResSettingsGroup.getId())
+   {
+      echo("Checking current quality level of Display Resolution");    
+   }*/
+   
    for ( %i=0; %i < %qualityGroup.getCount(); %i++ )
    {
       %level = %qualityGroup.getObject( %i );
@@ -1349,7 +1377,7 @@ function getScreenResolutionList(%deviceID, %deviceMode)
    if ((%deviceMode == $Video::ModeBorderless) && ($platform !$= "windows"))
    {
       %borderlessRes = getWords(Canvas.getMonitorUsableRect(%deviceID), 2);
-      return _makePrettyResString(%borderlessRes);
+      return %borderlessRes;
    }
 
    %resCount = Canvas.getModeCount();
@@ -1361,7 +1389,7 @@ function getScreenResolutionList(%deviceID, %deviceMode)
       if (!Canvas.checkCanvasRes(%testResString, %deviceID, %deviceMode, false))
          continue;
 
-      %testRes = _makePrettyResString( %testResString );
+      %testRes = getWords(%testResString, 0, 1);
       
       //sanitize
       %found = false;

+ 4 - 4
Templates/BaseGame/game/data/ExampleModule/scripts/client/defaultKeybinds.tscript

@@ -17,10 +17,10 @@ addKeyRemap("Ascend", "ExampleMoveMap", "keyboard", "moveup", "Makes the camera
 addKeyRemap("Descend", "ExampleMoveMap", "keyboard", "movedown", "Makes the camera descend");
 addKeyRemap("Jump", "ExampleMoveMap", "keyboard", "jump", "Jump");
 
-addKeyRemap("Forward", "ExampleMoveMap", "gamepad", "gamePadMoveY", "Forward Movement");
-addKeyRemap("Backward", "ExampleMoveMap", "gamepad", "gamePadMoveY", "Backward Movement");
-addKeyRemap("Strafe Left", "ExampleMoveMap", "gamepad", "gamePadMoveX", "Left Strafing Movement");
-addKeyRemap("Strafe Right", "ExampleMoveMap", "gamepad", "gamePadMoveX", "Right Strafing Movement");
+//addKeyRemap("Forward", "ExampleMoveMap", "gamepad", "gamePadMoveY", "Forward Movement");
+//addKeyRemap("Backward", "ExampleMoveMap", "gamepad", "gamePadMoveY", "Backward Movement");
+//addKeyRemap("Strafe Left", "ExampleMoveMap", "gamepad", "gamePadMoveX", "Left Strafing Movement");
+//addKeyRemap("Strafe Right", "ExampleMoveMap", "gamepad", "gamePadMoveX", "Right Strafing Movement");
 addKeyRemap("Jump", "ExampleMoveMap", "gamepad", "jump", "Jump");
 
 //------------------------------------------------------------------------------

+ 1 - 1
Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.tscript

@@ -147,7 +147,7 @@ if(!isObject( ChooseLevelActionMap ) )
    ChooseLevelActionMap.bind( gamepad, lpov, BaseUINavigatePrev );
    ChooseLevelActionMap.bind( gamepad, rpov, BaseUINavigateNext );
    
-   ChooseLevelActionMap.bind( keyboard, Enter, ChooseLevelBegin );
+   ChooseLevelActionMap.bind( keyboard, Space, ChooseLevelBegin );
    ChooseLevelActionMap.bind( gamepad, btn_a, ChooseLevelBegin );
 }
 

+ 1 - 1
Templates/BaseGame/game/data/UI/guis/GameMenu.tscript

@@ -73,7 +73,7 @@ if(!isObject( GameMenuActionMap ) )
    GameMenuActionMap.bind( gamepad, upov, BaseUINavigatePrev );
    GameMenuActionMap.bind( gamepad, dpov, BaseUINavigateNext );
    
-   GameMenuActionMap.bind( keyboard, Enter, BaseUIActivateSelected );
+   GameMenuActionMap.bind( keyboard, Space, BaseUIActivateSelected );
    GameMenuActionMap.bind( gamepad, btn_a, BaseUIActivateSelected );
    
    GameMenuActionMap.bindCmd( keyboard, Escape, "Canvas.popDialog(GameMenu);", "" );

+ 1 - 1
Templates/BaseGame/game/data/UI/guis/joinServerMenu.tscript

@@ -17,7 +17,7 @@ if(!isObject( JoinServerActionMap ) )
    JoinServerActionMap.bindCmd( keyboard, e, "JoinServerMenu.queryLan();" );
    JoinServerActionMap.bindCmd( gamepad, btn_y, "JoinServerMenu.queryLan();" );
    
-   JoinServerActionMap.bindCmd( keyboard, Enter, "JoinServerMenu::join();" );
+   JoinServerActionMap.bindCmd( keyboard, Space, "JoinServerMenu::join();" );
    JoinServerActionMap.bindCmd( gamepad, btn_a, "JoinServerMenu::join();" );
 }
 

+ 3 - 3
Templates/BaseGame/game/data/UI/guis/mainMenu.tscript

@@ -9,6 +9,8 @@ function MainMenuGui::onWake(%this)
 {
    $MenuList = MainMenuButtonList;
    $MenuList.listPosition = 0;
+   
+   $MenuList.syncGui();
 }
 
 function MainMenuGui::onSleep(%this)
@@ -25,7 +27,7 @@ if(!isObject( BaseUIActionMap ) )
    BaseUIActionMap.bind( gamepad, upov, BaseUINavigatePrev );
    BaseUIActionMap.bind( gamepad, dpov, BaseUINavigateNext );
    
-   BaseUIActionMap.bind( keyboard, Enter, BaseUIActivateSelected );
+   BaseUIActionMap.bind( keyboard, Space, BaseUIActivateSelected );
    BaseUIActionMap.bind( gamepad, btn_a, BaseUIActivateSelected );
    
    BaseUIActionMap.bind( keyboard, Escape, BaseUIBackOut );
@@ -75,9 +77,7 @@ function BaseUIStickNavigate(%val)
    else if(%val == -1)
       BaseUINavigatePrev(1);
    else 
-   {
       cancel($BaseUI::scrollSchedule);
-   }
 }
 
 function BaseUIBackOut(%val)

+ 1 - 1
Templates/BaseGame/game/data/UI/guis/messageBoxDlg.tscript

@@ -125,7 +125,7 @@ if(!isObject( MessageBoxActionMap ) )
 {
    new ActionMap(MessageBoxActionMap){};
    
-   MessageBoxActionMap.bind( keyboard, Enter, messageBoxYesClicked );
+   MessageBoxActionMap.bind( keyboard, Space, messageBoxYesClicked );
    MessageBoxActionMap.bind( gamepad, btn_a, messageBoxYesClicked );
    
    MessageBoxActionMap.bind( keyboard, Escape, messageBoxNoClicked );

+ 31 - 1
Templates/BaseGame/game/data/UI/guis/optionsMenu.gui

@@ -192,11 +192,41 @@ $guiContent = new GuiControl(OptionsMenu) {
          tooltipProfile = "GuiToolTipProfile";
          class = "MenuInputButton";
       };
-      new GuiIconButtonCtrl(OptionsMenuResetBtn) {
+      new GuiIconButtonCtrl(OptionsMenuRemapBtn) {
+         BitmapAsset = "UI:Keyboard_Black_Space_image";
+         sizeIconToButton = "1";
+         makeIconSquare = "1";
+         textLocation = "Center";
+         text = "Remap";
+         position = "850 0";
+         extent = "140 40";
+         horizSizing = "left";
+         vertSizing = "center";
+         profile = "GuiMenuButtonProfile";
+         command = "OptionsMenuActivateOption(1)";
+         tooltipProfile = "GuiToolTipProfile";
+         class = "MenuInputButton";
+      };
+      new GuiIconButtonCtrl(OptionsMenuApplyBtn) {
          BitmapAsset = "UI:Keyboard_Black_Return_image";
          sizeIconToButton = "1";
          makeIconSquare = "1";
          textLocation = "Center";
+         text = "Apply";
+         position = "990 0";
+         extent = "140 40";
+         horizSizing = "left";
+         vertSizing = "center";
+         profile = "GuiMenuButtonProfile";
+         command = "OptionsMenu.applyChangedOptions();";
+         tooltipProfile = "GuiToolTipProfile";
+         class = "MenuInputButton";
+      };
+      new GuiIconButtonCtrl(OptionsMenuResetBtn) {
+         BitmapAsset = "UI:Keyboard_Black_R_image";
+         sizeIconToButton = "1";
+         makeIconSquare = "1";
+         textLocation = "Center";
          text = "Reset";
          position = "1135 0";
          extent = "140 40";

+ 72 - 37
Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript

@@ -59,8 +59,11 @@ if(!isObject( OptionsMenuActionMap ) )
    OptionsMenuActionMap.bind( keyboard, R, OptionsMenuReset );
    OptionsMenuActionMap.bind( gamepad, btn_x, OptionsMenuReset );
    
-   OptionsMenuActionMap.bind( keyboard, Enter, OptionsMenuActivateOption );
+   OptionsMenuActionMap.bind( keyboard, Space, OptionsMenuActivateOption );
    OptionsMenuActionMap.bind( gamepad, btn_a, OptionsMenuActivateOption );
+   
+   OptionsMenuActionMap.bind( keyboard, Enter, tryApplyOptions);
+   OptionsMenuActionMap.bind( gamepad, btn_start, tryApplyOptions);
 }
 
 //==============================================================================
@@ -237,6 +240,11 @@ function OptionsMenu::syncGui(%this)
    
    OptionsMenuPrevNavIcon.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuPrevCategory"));
    OptionsMenuNextNavIcon.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuNextCategory"));
+   
+   OptionsMenuApplyBtn.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "tryApplyOptions"));
+   
+   OptionsMenuRemapBtn.visible = KBMControlsList.visible || GamepadControlsList.visible;
+   OptionsMenuRemapBtn.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuActivateOption"));
 }
 
 //==============================================================================
@@ -292,6 +300,12 @@ function OptionMenuNavigatePrev(%val)
          $MenuList.listPosition = 0;
          
       $MenuList.syncGUI();
+      
+      $BaseUI::scrollSchedule = schedule($BaseUI::scrollSpeedTimeMs, 0, "OptionMenuNavigatePrev", 1);
+   }
+   else
+   {
+      cancel($BaseUI::scrollSchedule);
    }
 }
 
@@ -311,15 +325,23 @@ function OptionMenuNavigateNext(%val)
          $MenuList.listPosition = $MenuList.getCount()-1;
          
       $MenuList.syncGUI();
+      
+      $BaseUI::scrollSchedule = schedule($BaseUI::scrollSpeedTimeMs, 0, "OptionMenuNavigateNext", 1);
+   }
+   else
+   {
+      cancel($BaseUI::scrollSchedule);
    }
 }
 
 function OptionMenuStickNavigate(%val)
 {
-   if(%val == -1)
-      BaseUINavigateNext(1);
-   else if(%val == 1)
-      mainMenuNavigateDown(1);
+   if(%val == 1)
+      OptionMenuNavigateNext(1);
+   else if(%val == -1)
+      OptionMenuNavigatePrev(1);
+   else 
+      cancel($BaseUI::scrollSchedule);
 }
 
 function OptionMenuPrevSetting(%val)
@@ -387,11 +409,9 @@ function OptionsMenuActivateOption(%val)
    if(!isObject(%option))
       return;
       
-      echo(%option.class);
-      
    if(%option.class $= "OptionsKeybindEntry")
    {
-      eval(%option-->button.altCommand);
+      %option-->button.execAltCommand();
    }
 }
 
@@ -504,29 +524,29 @@ function OptionsMenu::populateAudioSettings(%this)
 
 function OptionsMenu::populateKBMControls(%this)
 {
-   //$remapListDevice = "keyboard";
    %this.populateKeybinds("keyboard", KBMControlsList);
    
    %this.syncGui();
+   
+   KBMControlsList.syncGui();
 }
 
 function OptionsMenu::populateGamepadControls(%this)
 {
-   //$remapListDevice = ;
    %this.populateKeybinds("gamepad", GamepadControlsList);
    
    %this.syncGui();
+   
+   GamepadControlsList.syncGui();
 }
 
 function OptionsMenu::populateKeybinds(%this, %device, %controlsList)
 {
-   //%device = $remapListDevice;
-   
 	%controlsList.clear();
 
    //build out our list of action maps
    %actionMapCount = ActionMapGroup.getCount();
-   
+
    %actionMapList = "";
    for(%i=0; %i < %actionMapCount; %i++)
    {
@@ -567,32 +587,34 @@ function OptionsMenu::populateKeybinds(%this, %device, %controlsList)
    if($activeRemapControlSet $= "")
       $activeRemapControlSet = getField(%actionMapList, 0);
       
-   if(getFieldCount(%actionMapList) > 1)
+   for(%am = 0; %am < getFieldCount(%actionMapList); %am++)
    {
-      for(%am = 0; %am < getFieldCount(%actionMapList); %am++)
+      %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)
       {
-         %currentActionMap = getField(%actionMapList, %am);
-        
          %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];
          
-         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];
-
-            %remapEntry = addActionMapEntry(%actionMapName, %device, %keyMap, %i, %description);
-            %controlsList.add(%remapEntry);
-         }
+         %remapEntry = addActionMapEntry(%actionMapName, %device, %keyMap, %i, %description);
+         %controlsList.add(%remapEntry);
       }
    }
    
@@ -627,6 +649,20 @@ function tryCloseOptionsMenu(%val)
    }
 } 
 
+function tryApplyOptions(%val)
+{
+   if(!%val)
+      return;
+      
+   $optionsChangeRequiresRestart = false;
+   
+   %unappliedVideoChanges = VideoSettingsList.checkForUnappliedChanges();
+   %unappliedAudioChanges = AudioSettingsList.checkForUnappliedChanges();
+   
+   if(%unappliedVideoChanges || %unappliedAudioChanges)
+      OptionsMenu.applyChangedOptions();
+}
+
 function OptionsMenu::applyChangedOptions(%this)
 {
    VideoSettingsList.applyChanges();
@@ -650,14 +686,13 @@ function OptionsMenu::applyChangedOptions(%this)
 
 function doKeyRemap( %optionEntry )
 {
-   //%rowIndex = %row.remapIndex;
-   //%name = $RemapName[%rowIndex];
-   
    %name = getField(%optionEntry.keymap,0);
 
 	RemapDlg-->OptRemapText.text = "Re-bind \"" @ %name @ "\" to..." ;
 	OptRemapInputCtrl.index = %optionEntry.remapIndex;
 	
+	$remapListDevice = %optionEntry.device;
+	
 	Canvas.pushDialog( RemapDlg );
 }
 

+ 1 - 0
Templates/BaseGame/game/data/UI/guis/remapDlg.gui

@@ -24,6 +24,7 @@ $guiContent = new GuiControl(RemapDlg) {
          vertSizing = "height";
          profile = "GuiInputCtrlProfile";
          tooltipProfile = "GuiToolTipProfile";
+         sendAxisEvents = "1";
       };
       new GuiControl(RemapBoxCtrl) {
          position = "-1 1";

+ 57 - 22
Templates/BaseGame/game/data/UI/guis/remapDlg.tscript

@@ -1,12 +1,36 @@
-function OptRemapInputCtrl::onInputEvent( %this, %device, %action )
+function OptRemapInputCtrl::onAxisEvent( %this, %device, %action, %axisVal)
 {
+   if(%device $= "mouse")
+      return;
+   if(!startsWith(%device,$remapListDevice))
+      return;
+   if(%axisVal != 1 && %axisVal != -1) //we want full presses on sticks to be sure
+      return;
+
    Canvas.popDialog( RemapDlg );
+   
+   %this.doRemap(%device, %action, %axisVal);
+}
 
-   if ( %device $= "keyboard" && %action $= "escape" )
-         return;
-   else if( %device $= "gamepad" && %action $= "btn_start" )
+function OptRemapInputCtrl::onInputEvent( %this, %device, %action )
+{
+   if(!startsWith(%device,$remapListDevice) && %action !$= "escape" && %action !$= "btn_start")
+   {
+      return;
+   }
+   else 
+   {
+      Canvas.popDialog( RemapDlg );
+   
+      if(%action $= "escape" || %action $= "btn_start")
          return;
+   
+      %this.doRemap(%device, %action, 0);
+   }
+}
 
+function OptRemapInputCtrl::doRemap(%this, %device, %action, %axisVal)
+{
    %cmd  = $RemapCmd[%this.index];
    %name = $RemapName[%this.index];
    %actionMap = $RemapActionMap[%this.index];
@@ -21,30 +45,22 @@ function OptRemapInputCtrl::onInputEvent( %this, %device, %action )
    %prevMap = %actionMap.getCommand( %device, %action );
    
    //TODO: clear all existant keybinds to a command and then bind it so we only have a single one at all times
-   unbindExtraActions( %cmd, %actionMap, 0 );
-   unbindExtraActions( %cmd, %actionMap, 1 );
+   unbindExtraActions( %cmd, %actionMap, %device, 0 );
+   unbindExtraActions( %cmd, %actionMap, %device, 1 );
 
    // If nothing was mapped to the previous command 
    // mapping then it's easy... just bind it.
-   if ( %prevMap $= "" )
-   {
-      //unbindExtraActions( %cmd, %actionMap, 1 );
-      %actionMap.bind( %device, %action, %cmd );
-      
-      OptionsMenu.syncGui();
-      return;
-   }
-
    // If the previous command is the same as the 
    // current then they hit the same input as what
    // was already assigned.
-   if ( %prevMap $= %cmd )
+   if ( %prevMap $= "" || %prevMap $= %cmd )
    {
-      //unbindExtraActions( %cmd, %actionMap, 0 );
+      //unbindExtraActions( %cmd, %actionMap, 1 );
       %actionMap.bind( %device, %action, %cmd );
-
-      OptionsMenu.syncGui();
-      return;   
+      
+      OptionsMenu.populateKBMControls();
+      OptionsMenu.populateGamepadControls();
+      return;
    }
 
    // Look for the index of the previous mapping.
@@ -73,5 +89,24 @@ function OptRemapInputCtrl::onInputEvent( %this, %device, %action )
                               %cmd @ "\", " @ %prevMapIndex @ ", " @ %this.index @ ");";
    %cancelCommand = "";
    
-   MessageBoxYesNo( "Key already in use", %remapWarnText, %doRemapCommand, %cancelCommand );
-}
+   MessageBoxYesNo( "Key already in use", %remapWarnText, %doRemapCommand, %cancelCommand );  
+}
+
+/// This unbinds actions beyond %count associated to the
+/// particular actionMap %commmand.
+function unbindExtraActions( %command, %actionMap, %device, %count )
+{
+   %temp = %actionMap.getBinding( %command );
+   if ( %temp $= "" )
+      return;
+
+   %count = getFieldCount( %temp ) - ( %count * 2 );
+   for ( %i = 0; %i < %count; %i += 2 )
+   {
+      %amDevice = getField( %temp, %i + 0 );
+      %action = getField( %temp, %i + 1 );
+      
+      if(%device !$= "" || %device $= %amDevice)
+         %actionMap.unbind( %device, %action );
+   }
+}

+ 0 - 17
Templates/BaseGame/game/data/UI/scripts/controlsMenu.tscript

@@ -225,23 +225,6 @@ function findRemapCmdIndex( %command )
 	return( -1 );	
 }
 
-/// This unbinds actions beyond %count associated to the
-/// particular actionMap %commmand.
-function unbindExtraActions( %command, %actionMap, %count )
-{
-   %temp = %actionMap.getBinding( %command );
-   if ( %temp $= "" )
-      return;
-
-   %count = getFieldCount( %temp ) - ( %count * 2 );
-   for ( %i = 0; %i < %count; %i += 2 )
-   {
-      %device = getField( %temp, %i + 0 );
-      %action = getField( %temp, %i + 1 );
-      
-      %actionMap.unbind( %device, %action );
-   }
-}
 
 function redoMapping( %device, %actionMap, %action, %cmd, %oldIndex, %newIndex )
 {