diff --git a/addons/interact_menu/ACE_Settings.hpp b/addons/interact_menu/ACE_Settings.hpp index a36d3dd98d..9f555f3ed1 100644 --- a/addons/interact_menu/ACE_Settings.hpp +++ b/addons/interact_menu/ACE_Settings.hpp @@ -1,32 +1,18 @@ class ACE_Settings { class GVAR(alwaysUseCursorSelfInteraction) { - value = 0; - typeName = "BOOL"; - isClientSettable = 1; - category = CSTRING(Category_InteractionMenu); - displayName = CSTRING(AlwaysUseCursorSelfInteraction); + movedToSQF = 1; }; class GVAR(cursorKeepCentered) { - value = 0; - typeName = "BOOL"; - isClientSettable = 1; - category = CSTRING(Category_InteractionMenu); - displayName = CSTRING(cursorKeepCentered); - description = CSTRING(cursorKeepCenteredDescription); + movedToSQF = 1; }; class GVAR(alwaysUseCursorInteraction) { - value = 0; - typeName = "BOOL"; - isClientSettable = 1; - category = CSTRING(Category_InteractionMenu); - displayName = CSTRING(AlwaysUseCursorInteraction); + movedToSQF = 1; }; class GVAR(useListMenu) { - value = 0; - typeName = "BOOL"; - isClientSettable = 1; - category = CSTRING(Category_InteractionMenu); - displayName = CSTRING(UseListMenu); + movedToSQF = 1; + }; + class GVAR(menuBackground) { + movedToSQF = 1; }; class GVAR(colorTextMax) { value[] = {1, 1, 1, 1}; @@ -80,14 +66,6 @@ class ACE_Settings { category = CSTRING(Category_InteractionMenu); 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) { value = 0; typeName = "BOOL"; diff --git a/addons/interact_menu/XEH_clientInit.sqf b/addons/interact_menu/XEH_clientInit.sqf index 9a44674e42..30b6a4469a 100644 --- a/addons/interact_menu/XEH_clientInit.sqf +++ b/addons/interact_menu/XEH_clientInit.sqf @@ -100,10 +100,14 @@ format ["%1 (%2)", (localize LSTRING(SelfInteractKey)), localize ELSTRING(common // background options ["ace_interactMenuOpened", { - if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), true] call EFUNC(common,blurScreen);}; - if (GVAR(menuBackground)==2) then {0 cutRsc[QGVAR(menuBackground), "PLAIN", 1, false];}; + params ["_menuType"]; + 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; ["ace_interactMenuClosed", { - if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), false] call EFUNC(common,blurScreen);}; - if (GVAR(menuBackground)==2) then {(uiNamespace getVariable [QGVAR(menuBackground), displayNull]) closeDisplay 0;}; + params ["_menuType"]; + 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; diff --git a/addons/interact_menu/XEH_preInit.sqf b/addons/interact_menu/XEH_preInit.sqf index 14ad65aafe..0d321112f9 100644 --- a/addons/interact_menu/XEH_preInit.sqf +++ b/addons/interact_menu/XEH_preInit.sqf @@ -21,7 +21,7 @@ GVAR(cacheManActions) = +(GVAR(ActNamespace) getVariable ["CAManBase", []]); // // Event handlers for all interact menu controls 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]; setMousePosition [0.5, 0.5]; } else { diff --git a/addons/interact_menu/functions/fnc_keyDown.sqf b/addons/interact_menu/functions/fnc_keyDown.sqf index 54a9f070ce..8460e338e8 100644 --- a/addons/interact_menu/functions/fnc_keyDown.sqf +++ b/addons/interact_menu/functions/fnc_keyDown.sqf @@ -44,8 +44,8 @@ GVAR(useCursorMenu) = (vehicle ACE_player != ACE_player) || (!(isNull (ACE_controlledUAV select 0))) || visibleMap || (!isNull curatorCamera) || - {(_menuType == 1) && {(isWeaponDeployed ACE_player) || GVAR(AlwaysUseCursorSelfInteraction) || {cameraView == "GUNNER"}}} || - {(_menuType == 0) && GVAR(AlwaysUseCursorInteraction)}; + {(_menuType == 1) && {(isWeaponDeployed ACE_player) || GVAR(alwaysUseCursorSelfInteraction) || {cameraView == "GUNNER"}}} || + {(_menuType == 0) && GVAR(alwaysUseCursorInteraction)}; // Delete existing controls in case there's any left GVAR(iconCount) = 0; diff --git a/addons/interact_menu/functions/fnc_renderIcon.sqf b/addons/interact_menu/functions/fnc_renderIcon.sqf index 21f1962180..19725fb610 100644 --- a/addons/interact_menu/functions/fnc_renderIcon.sqf +++ b/addons/interact_menu/functions/fnc_renderIcon.sqf @@ -38,7 +38,7 @@ if (_iconFile isEqualTo "") then { _iconFile = DEFAULT_ICON; }; -_text = if (GVAR(UseListMenu)) then { +_text = if ([GVAR(useListMenu), GVAR(useListMenuSelf)] select GVAR(keyDownSelfAction)) then { format ["%4", _iconFile, _iconColor, _textSettings, _text] } else { format ["
%4", _iconFile, _iconColor, _textSettings, "ace_break_line" callExtension _text]; @@ -47,13 +47,14 @@ _text = if (GVAR(UseListMenu)) then { [_ctrl, GVAR(iconCount), _text] call FUNC(ctrlSetParsedTextCached); 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] } else { [(_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 [1, ((_pos select 1) - (GVAR(cursorPos) select 1) + 0.5)]; }; diff --git a/addons/interact_menu/functions/fnc_renderMenu.sqf b/addons/interact_menu/functions/fnc_renderMenu.sqf index 5801f4602f..d51766548f 100644 --- a/addons/interact_menu/functions/fnc_renderMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderMenu.sqf @@ -89,8 +89,8 @@ if (_numChildren == 1) then { // Scale menu based on the amount of children private _scaleX = 1; private _scaleY = 1; - -if (GVAR(UseListMenu)) then { +private _useListMenu = [GVAR(useListMenu), GVAR(useListMenuSelf)] select GVAR(keyDownSelfAction); +if (_useListMenu) then { private _textSize = [0.75, 0.875, 1, 1.2, 1.4] select GVAR(textSize); _scaleX = _textSize * 0.17 * 1.1; _scaleY = 0.17 * 0.30 * 4/3; @@ -112,7 +112,7 @@ private _player = ACE_player; //END_COUNTER(children); private _angle = _centerAngle - _angleSpan / 2; { - private _newPos = if (GVAR(UseListMenu)) then { + private _newPos = if (_useListMenu) then { [(_sPos select 0) + _scaleX, (_sPos select 1) + _scaleY * (_forEachIndex - _numChildren/2 + 0.5)]; } else { diff --git a/addons/interact_menu/functions/fnc_renderSelector.sqf b/addons/interact_menu/functions/fnc_renderSelector.sqf index 0449f9c922..96f42f8a19 100644 --- a/addons/interact_menu/functions/fnc_renderSelector.sqf +++ b/addons/interact_menu/functions/fnc_renderSelector.sqf @@ -39,7 +39,7 @@ private _pos = if (GVAR(UseListMenu)) then { 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 [1, ((_pos select 1) - (GVAR(cursorPos) select 1) + 0.5)]; }; diff --git a/addons/interact_menu/initSettings.sqf b/addons/interact_menu/initSettings.sqf index 45c9fdbd3b..8d353906f6 100644 --- a/addons/interact_menu/initSettings.sqf +++ b/addons/interact_menu/initSettings.sqf @@ -1,9 +1,81 @@ [ QGVAR(selectorColor), "COLOR", - localize LSTRING(SelectorColor), - format ["ACE %1", localize LSTRING(Category_InteractionMenu)], + LSTRING(SelectorColor), + format ["ACE %1", LLSTRING(Category_InteractionMenu)], [1, 0, 0], false, {GVAR(selectorColorHex) = _this call BIS_fnc_colorRGBtoHTML} // Stored in Hex to avoid constant conversion ] 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;