Make rotation key a client setting

Improve compatibility with other addons
This commit is contained in:
PabstMirror 2016-06-07 11:52:28 -05:00
parent aea086b75e
commit 1be926f3db
4 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,10 @@
class ACE_Settings {
class GVAR(rotateModifierKey) {
value = 1;
typeName = "SCALAR";
isClientSettable = 1;
displayName = CSTRING(rotateModifierKey_displayName);
description = CSTRING(rotateModifierKey_description);
values[] = {"$STR_A3_OPTIONS_DISABLED", "ALT", "CTRL", "SHIFT"};
};
};

View File

@ -24,6 +24,7 @@ class RscButtonMenuCancel;
class RscButtonMenu;
class RscEdit;
#include "ACE_Settings.hpp"
#include "MapGpsUI.hpp"
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"

View File

@ -46,7 +46,15 @@ if (_dir != 1) then {
// Store data for dragging
GVAR(mapTool_startPos) = + GVAR(mapTool_pos);
GVAR(mapTool_startDragPos) = + _pos;
if (_altKey) then {
private _rotateKeyPressed = switch (GVAR(rotateModifierKey)) do {
case (1): {_altKey};
case (2): {_ctrlKey};
case (3): {_shiftKey};
default {false};
};
if (_rotateKeyPressed) then {
// Store data for rotating
GVAR(mapTool_startAngle) = + GVAR(mapTool_angle);
GVAR(mapTool_startDragAngle) = (180 + ((GVAR(mapTool_startDragPos) select 0) - (GVAR(mapTool_startPos) select 0)) atan2 ((GVAR(mapTool_startDragPos) select 1) - (GVAR(mapTool_startPos) select 1)) mod 360);

View File

@ -133,5 +133,11 @@
<Italian>Direzione: %1°</Italian>
<Portuguese>Direção: %1</Portuguese>
</Key>
<Key ID="STR_ACE_MapTools_rotateModifierKey_displayName">
<English>Rotate Map Tools Key</English>
</Key>
<Key ID="STR_ACE_MapTools_rotateModifierKey_description">
<English>Modifier key to allow rotating map tools</English>
</Key>
</Package>
</Project>