mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Split interaction menu settings between interaction and self interaction (#6609)
* Split interaction menu settings between interaction and self interaction * consistent spacing not sure which way is wanted here, but I might as well be consistent in my own PR * remove useless code, fix use of backgroundMenu * clean up from Dystopian * use existing stringtable * remove redundent localize * Use LLSTRING, split UseListMenu * style fixes * style fixes * add movedToSQF to old settings * condense ifs * Don't use cursorKeepCentered as default
This commit is contained in:
parent
79e3de623f
commit
8b4e8a61ac
@ -1,32 +1,18 @@
|
|||||||
class ACE_Settings {
|
class ACE_Settings {
|
||||||
class GVAR(alwaysUseCursorSelfInteraction) {
|
class GVAR(alwaysUseCursorSelfInteraction) {
|
||||||
value = 0;
|
movedToSQF = 1;
|
||||||
typeName = "BOOL";
|
|
||||||
isClientSettable = 1;
|
|
||||||
category = CSTRING(Category_InteractionMenu);
|
|
||||||
displayName = CSTRING(AlwaysUseCursorSelfInteraction);
|
|
||||||
};
|
};
|
||||||
class GVAR(cursorKeepCentered) {
|
class GVAR(cursorKeepCentered) {
|
||||||
value = 0;
|
movedToSQF = 1;
|
||||||
typeName = "BOOL";
|
|
||||||
isClientSettable = 1;
|
|
||||||
category = CSTRING(Category_InteractionMenu);
|
|
||||||
displayName = CSTRING(cursorKeepCentered);
|
|
||||||
description = CSTRING(cursorKeepCenteredDescription);
|
|
||||||
};
|
};
|
||||||
class GVAR(alwaysUseCursorInteraction) {
|
class GVAR(alwaysUseCursorInteraction) {
|
||||||
value = 0;
|
movedToSQF = 1;
|
||||||
typeName = "BOOL";
|
|
||||||
isClientSettable = 1;
|
|
||||||
category = CSTRING(Category_InteractionMenu);
|
|
||||||
displayName = CSTRING(AlwaysUseCursorInteraction);
|
|
||||||
};
|
};
|
||||||
class GVAR(useListMenu) {
|
class GVAR(useListMenu) {
|
||||||
value = 0;
|
movedToSQF = 1;
|
||||||
typeName = "BOOL";
|
};
|
||||||
isClientSettable = 1;
|
class GVAR(menuBackground) {
|
||||||
category = CSTRING(Category_InteractionMenu);
|
movedToSQF = 1;
|
||||||
displayName = CSTRING(UseListMenu);
|
|
||||||
};
|
};
|
||||||
class GVAR(colorTextMax) {
|
class GVAR(colorTextMax) {
|
||||||
value[] = {1, 1, 1, 1};
|
value[] = {1, 1, 1, 1};
|
||||||
@ -80,14 +66,6 @@ class ACE_Settings {
|
|||||||
category = CSTRING(Category_InteractionMenu);
|
category = CSTRING(Category_InteractionMenu);
|
||||||
displayName = CSTRING(ActionOnKeyRelease);
|
displayName = CSTRING(ActionOnKeyRelease);
|
||||||
};
|
};
|
||||||
class GVAR(menuBackground) {
|
|
||||||
value = 0;
|
|
||||||
typeName = "SCALAR";
|
|
||||||
isClientSettable = 1;
|
|
||||||
category = CSTRING(Category_InteractionMenu);
|
|
||||||
displayName = CSTRING(background);
|
|
||||||
values[] = {"$STR_A3_OPTIONS_DISABLED", CSTRING(backgroundBlur), CSTRING(backgroundBlack)};
|
|
||||||
};
|
|
||||||
class GVAR(addBuildingActions) {
|
class GVAR(addBuildingActions) {
|
||||||
value = 0;
|
value = 0;
|
||||||
typeName = "BOOL";
|
typeName = "BOOL";
|
||||||
|
@ -100,10 +100,14 @@ format ["%1 (%2)", (localize LSTRING(SelfInteractKey)), localize ELSTRING(common
|
|||||||
|
|
||||||
// background options
|
// background options
|
||||||
["ace_interactMenuOpened", {
|
["ace_interactMenuOpened", {
|
||||||
if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), true] call EFUNC(common,blurScreen);};
|
params ["_menuType"];
|
||||||
if (GVAR(menuBackground)==2) then {0 cutRsc[QGVAR(menuBackground), "PLAIN", 1, false];};
|
private _menuBackgroundSetting = [GVAR(menuBackground), GVAR(menuBackgroundSelf)] select _menuType;
|
||||||
|
if (_menuBackgroundSetting == 1) exitWith {[QGVAR(menuBackground), true] call EFUNC(common,blurScreen);};
|
||||||
|
if (_menuBackgroundSetting == 2) exitWith {0 cutRsc [QGVAR(menuBackground), "PLAIN", 1, false];};
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
["ace_interactMenuClosed", {
|
["ace_interactMenuClosed", {
|
||||||
if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), false] call EFUNC(common,blurScreen);};
|
params ["_menuType"];
|
||||||
if (GVAR(menuBackground)==2) then {(uiNamespace getVariable [QGVAR(menuBackground), displayNull]) closeDisplay 0;};
|
private _menuBackgroundSetting = [GVAR(menuBackground), GVAR(menuBackgroundSelf)] select _menuType;
|
||||||
|
if (_menuBackgroundSetting == 1) exitWith {[QGVAR(menuBackground), false] call EFUNC(common,blurScreen);};
|
||||||
|
if (_menuBackgroundSetting == 2) exitWith {(uiNamespace getVariable [QGVAR(menuBackground), displayNull]) closeDisplay 0;};
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -21,7 +21,7 @@ GVAR(cacheManActions) = +(GVAR(ActNamespace) getVariable ["CAManBase", []]); //
|
|||||||
|
|
||||||
// Event handlers for all interact menu controls
|
// Event handlers for all interact menu controls
|
||||||
DFUNC(handleMouseMovement) = {
|
DFUNC(handleMouseMovement) = {
|
||||||
if (GVAR(cursorKeepCentered)) then {
|
if ([GVAR(cursorKeepCentered), GVAR(cursorKeepCenteredSelfInteraction)] select GVAR(keyDownSelfAction)) then {
|
||||||
GVAR(cursorPos) = GVAR(cursorPos) vectorAdd [_this select 1, _this select 2, 0] vectorDiff [0.5, 0.5, 0];
|
GVAR(cursorPos) = GVAR(cursorPos) vectorAdd [_this select 1, _this select 2, 0] vectorDiff [0.5, 0.5, 0];
|
||||||
setMousePosition [0.5, 0.5];
|
setMousePosition [0.5, 0.5];
|
||||||
} else {
|
} else {
|
||||||
|
@ -44,8 +44,8 @@ GVAR(useCursorMenu) = (vehicle ACE_player != ACE_player) ||
|
|||||||
(!(isNull (ACE_controlledUAV select 0))) ||
|
(!(isNull (ACE_controlledUAV select 0))) ||
|
||||||
visibleMap ||
|
visibleMap ||
|
||||||
(!isNull curatorCamera) ||
|
(!isNull curatorCamera) ||
|
||||||
{(_menuType == 1) && {(isWeaponDeployed ACE_player) || GVAR(AlwaysUseCursorSelfInteraction) || {cameraView == "GUNNER"}}} ||
|
{(_menuType == 1) && {(isWeaponDeployed ACE_player) || GVAR(alwaysUseCursorSelfInteraction) || {cameraView == "GUNNER"}}} ||
|
||||||
{(_menuType == 0) && GVAR(AlwaysUseCursorInteraction)};
|
{(_menuType == 0) && GVAR(alwaysUseCursorInteraction)};
|
||||||
|
|
||||||
// Delete existing controls in case there's any left
|
// Delete existing controls in case there's any left
|
||||||
GVAR(iconCount) = 0;
|
GVAR(iconCount) = 0;
|
||||||
|
@ -38,7 +38,7 @@ if (_iconFile isEqualTo "") then {
|
|||||||
_iconFile = DEFAULT_ICON;
|
_iconFile = DEFAULT_ICON;
|
||||||
};
|
};
|
||||||
|
|
||||||
_text = if (GVAR(UseListMenu)) then {
|
_text = if ([GVAR(useListMenu), GVAR(useListMenuSelf)] select GVAR(keyDownSelfAction)) then {
|
||||||
format ["<img image='%1' align='left' color='%2'/><t %3>%4</t>", _iconFile, _iconColor, _textSettings, _text]
|
format ["<img image='%1' align='left' color='%2'/><t %3>%4</t>", _iconFile, _iconColor, _textSettings, _text]
|
||||||
} else {
|
} else {
|
||||||
format ["<img image='%1' align='center' color='%2'/><br/><t %3 align='center'>%4</t>", _iconFile, _iconColor, _textSettings, "ace_break_line" callExtension _text];
|
format ["<img image='%1' align='center' color='%2'/><br/><t %3 align='center'>%4</t>", _iconFile, _iconColor, _textSettings, "ace_break_line" callExtension _text];
|
||||||
@ -47,13 +47,14 @@ _text = if (GVAR(UseListMenu)) then {
|
|||||||
[_ctrl, GVAR(iconCount), _text] call FUNC(ctrlSetParsedTextCached);
|
[_ctrl, GVAR(iconCount), _text] call FUNC(ctrlSetParsedTextCached);
|
||||||
GVAR(iconCount) = GVAR(iconCount) + 1;
|
GVAR(iconCount) = GVAR(iconCount) + 1;
|
||||||
|
|
||||||
private _pos = if (GVAR(UseListMenu)) then {
|
private _pos = if ([GVAR(useListMenu), GVAR(useListMenuSelf)] select GVAR(keyDownSelfAction)) then {
|
||||||
[(_sPos select 0) - (0.0095 * SafeZoneW), (_sPos select 1) - (0.0095 * SafeZoneW), 0.20 * SafeZoneW, 0.035 * SafeZoneW]
|
[(_sPos select 0) - (0.0095 * SafeZoneW), (_sPos select 1) - (0.0095 * SafeZoneW), 0.20 * SafeZoneW, 0.035 * SafeZoneW]
|
||||||
} else {
|
} else {
|
||||||
[(_sPos select 0) - (0.0750 * SafeZoneW), (_sPos select 1) - (0.0095 * SafeZoneW), 0.15 * SafeZoneW, 0.100 * SafeZoneW]
|
[(_sPos select 0) - (0.0750 * SafeZoneW), (_sPos select 1) - (0.0095 * SafeZoneW), 0.15 * SafeZoneW, 0.100 * SafeZoneW]
|
||||||
};
|
};
|
||||||
|
|
||||||
if (GVAR(cursorKeepCentered) && {uiNamespace getVariable [QGVAR(cursorMenuOpened),false]}) then {
|
|
||||||
|
if (([GVAR(cursorKeepCentered), GVAR(cursorKeepCenteredSelfInteraction)] select GVAR(keyDownSelfAction)) && {uiNamespace getVariable [QGVAR(cursorMenuOpened),false]}) then {
|
||||||
_pos set [0, ((_pos select 0) - (GVAR(cursorPos) select 0) + 0.5)];
|
_pos set [0, ((_pos select 0) - (GVAR(cursorPos) select 0) + 0.5)];
|
||||||
_pos set [1, ((_pos select 1) - (GVAR(cursorPos) select 1) + 0.5)];
|
_pos set [1, ((_pos select 1) - (GVAR(cursorPos) select 1) + 0.5)];
|
||||||
};
|
};
|
||||||
|
@ -89,8 +89,8 @@ if (_numChildren == 1) then {
|
|||||||
// Scale menu based on the amount of children
|
// Scale menu based on the amount of children
|
||||||
private _scaleX = 1;
|
private _scaleX = 1;
|
||||||
private _scaleY = 1;
|
private _scaleY = 1;
|
||||||
|
private _useListMenu = [GVAR(useListMenu), GVAR(useListMenuSelf)] select GVAR(keyDownSelfAction);
|
||||||
if (GVAR(UseListMenu)) then {
|
if (_useListMenu) then {
|
||||||
private _textSize = [0.75, 0.875, 1, 1.2, 1.4] select GVAR(textSize);
|
private _textSize = [0.75, 0.875, 1, 1.2, 1.4] select GVAR(textSize);
|
||||||
_scaleX = _textSize * 0.17 * 1.1;
|
_scaleX = _textSize * 0.17 * 1.1;
|
||||||
_scaleY = 0.17 * 0.30 * 4/3;
|
_scaleY = 0.17 * 0.30 * 4/3;
|
||||||
@ -112,7 +112,7 @@ private _player = ACE_player;
|
|||||||
//END_COUNTER(children);
|
//END_COUNTER(children);
|
||||||
private _angle = _centerAngle - _angleSpan / 2;
|
private _angle = _centerAngle - _angleSpan / 2;
|
||||||
{
|
{
|
||||||
private _newPos = if (GVAR(UseListMenu)) then {
|
private _newPos = if (_useListMenu) then {
|
||||||
[(_sPos select 0) + _scaleX,
|
[(_sPos select 0) + _scaleX,
|
||||||
(_sPos select 1) + _scaleY * (_forEachIndex - _numChildren/2 + 0.5)];
|
(_sPos select 1) + _scaleY * (_forEachIndex - _numChildren/2 + 0.5)];
|
||||||
} else {
|
} else {
|
||||||
|
@ -39,7 +39,7 @@ private _pos = if (GVAR(UseListMenu)) then {
|
|||||||
|
|
||||||
GVAR(iconCount) = GVAR(iconCount) + 1;
|
GVAR(iconCount) = GVAR(iconCount) + 1;
|
||||||
|
|
||||||
if (GVAR(cursorKeepCentered) && {uiNamespace getVariable [QGVAR(cursorMenuOpened),false]}) then {
|
if (([GVAR(cursorKeepCentered), GVAR(cursorKeepCenteredSelfInteraction)] select GVAR(keyDownSelfAction)) && {uiNamespace getVariable [QGVAR(cursorMenuOpened), false]}) then {
|
||||||
_pos set [0, ((_pos select 0) - (GVAR(cursorPos) select 0) + 0.5)];
|
_pos set [0, ((_pos select 0) - (GVAR(cursorPos) select 0) + 0.5)];
|
||||||
_pos set [1, ((_pos select 1) - (GVAR(cursorPos) select 1) + 0.5)];
|
_pos set [1, ((_pos select 1) - (GVAR(cursorPos) select 1) + 0.5)];
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,81 @@
|
|||||||
[
|
[
|
||||||
QGVAR(selectorColor),
|
QGVAR(selectorColor),
|
||||||
"COLOR",
|
"COLOR",
|
||||||
localize LSTRING(SelectorColor),
|
LSTRING(SelectorColor),
|
||||||
format ["ACE %1", localize LSTRING(Category_InteractionMenu)],
|
format ["ACE %1", LLSTRING(Category_InteractionMenu)],
|
||||||
[1, 0, 0],
|
[1, 0, 0],
|
||||||
false,
|
false,
|
||||||
{GVAR(selectorColorHex) = _this call BIS_fnc_colorRGBtoHTML} // Stored in Hex to avoid constant conversion
|
{GVAR(selectorColorHex) = _this call BIS_fnc_colorRGBtoHTML} // Stored in Hex to avoid constant conversion
|
||||||
] call CBA_settings_fnc_init;
|
] call CBA_settings_fnc_init;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(alwaysUseCursorInteraction),
|
||||||
|
"CHECKBOX",
|
||||||
|
LSTRING(AlwaysUseCursorInteraction),
|
||||||
|
[format ["ACE %1", LLSTRING(Category_InteractionMenu)], LLSTRING(Category_InteractionMenu)],
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
] call CBA_settings_fnc_init;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(cursorKeepCentered),
|
||||||
|
"CHECKBOX",
|
||||||
|
[LSTRING(cursorKeepCentered), LSTRING(cursorKeepCenteredDescription)],
|
||||||
|
[format ["ACE %1", LLSTRING(Category_InteractionMenu)], LLSTRING(Category_InteractionMenu)],
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
] call CBA_settings_fnc_init;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(useListMenu),
|
||||||
|
"CHECKBOX",
|
||||||
|
LSTRING(UseListMenu),
|
||||||
|
[format ["ACE %1", LLSTRING(Category_InteractionMenu)], LLSTRING(Category_InteractionMenu)],
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
] call CBA_settings_fnc_init;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(menuBackground),
|
||||||
|
"LIST",
|
||||||
|
LSTRING(background),
|
||||||
|
[format ["ACE %1", LLSTRING(Category_InteractionMenu)], LLSTRING(Category_InteractionMenu)],
|
||||||
|
[[0, 1, 2], ["STR_A3_OPTIONS_DISABLED", LLSTRING(backgroundBlur), LLSTRING(backgroundBlack)], 0],
|
||||||
|
false
|
||||||
|
] call CBA_settings_fnc_init;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(alwaysUseCursorSelfInteraction),
|
||||||
|
"CHECKBOX",
|
||||||
|
LSTRING(AlwaysUseCursorInteraction),
|
||||||
|
[format ["ACE %1", LLSTRING(Category_InteractionMenu)], LELSTRING(Interaction,InteractionMenuSelf)],
|
||||||
|
true,
|
||||||
|
false
|
||||||
|
] call CBA_settings_fnc_init;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(cursorKeepCenteredSelfInteraction),
|
||||||
|
"CHECKBOX",
|
||||||
|
[LSTRING(cursorKeepCentered), LSTRING(cursorKeepCenteredDescription)],
|
||||||
|
[format ["ACE %1", LLSTRING(Category_InteractionMenu)], LELSTRING(Interaction,InteractionMenuSelf)],
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
] call CBA_settings_fnc_init;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(useListMenuSelf),
|
||||||
|
"CHECKBOX",
|
||||||
|
LSTRING(UseListMenu),
|
||||||
|
[format ["ACE %1", LLSTRING(Category_InteractionMenu)], LELSTRING(Interaction,InteractionMenuSelf)],
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
] call CBA_settings_fnc_init;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(menuBackgroundSelf),
|
||||||
|
"LIST",
|
||||||
|
LSTRING(background),
|
||||||
|
[format ["ACE %1", LLSTRING(Category_InteractionMenu)], LELSTRING(Interaction,InteractionMenuSelf)],
|
||||||
|
[[0, 1, 2], ["STR_A3_OPTIONS_DISABLED", LLSTRING(backgroundBlur), LLSTRING(backgroundBlack)], 0],
|
||||||
|
false
|
||||||
|
] call CBA_settings_fnc_init;
|
||||||
|
Loading…
Reference in New Issue
Block a user