Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split interaction menu settings between interaction and self interaction #6609

Merged
merged 13 commits into from
Dec 8, 2019
30 changes: 0 additions & 30 deletions addons/interact_menu/ACE_Settings.hpp
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
class ACE_Settings {
class GVAR(alwaysUseCursorSelfInteraction) {
PabstMirror marked this conversation as resolved.
Show resolved Hide resolved
value = 0;
typeName = "BOOL";
isClientSettable = 1;
category = CSTRING(Category_InteractionMenu);
displayName = CSTRING(AlwaysUseCursorSelfInteraction);
};
class GVAR(cursorKeepCentered) {
value = 0;
typeName = "BOOL";
isClientSettable = 1;
category = CSTRING(Category_InteractionMenu);
displayName = CSTRING(cursorKeepCentered);
description = CSTRING(cursorKeepCenteredDescription);
};
class GVAR(alwaysUseCursorInteraction) {
value = 0;
typeName = "BOOL";
isClientSettable = 1;
category = CSTRING(Category_InteractionMenu);
displayName = CSTRING(AlwaysUseCursorInteraction);
};
class GVAR(useListMenu) {
BrettMayson marked this conversation as resolved.
Show resolved Hide resolved
value = 0;
typeName = "BOOL";
Expand Down Expand Up @@ -80,14 +58,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";
Expand Down
22 changes: 18 additions & 4 deletions addons/interact_menu/XEH_clientInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,24 @@ 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"];
if (_menuType == 0) exitWith {
BrettMayson marked this conversation as resolved.
Show resolved Hide resolved
if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), true] call EFUNC(common,blurScreen);};
if (GVAR(menuBackground)==2) then {0 cutRsc[QGVAR(menuBackground), "PLAIN", 1, false];};
};
if (_menuType == 1) exitWith {
if (GVAR(menuBackgroundSelf)==1) then {[QGVAR(menuBackgroundSelf), true] call EFUNC(common,blurScreen);};
if (GVAR(menuBackgroundSelf)==2) then {0 cutRsc[QGVAR(menuBackgroundSelf), "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"];
if (_menuType == 0) exitWith {
if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), false] call EFUNC(common,blurScreen);};
if (GVAR(menuBackground)==2) then {(uiNamespace getVariable [QGVAR(menuBackground), displayNull]) closeDisplay 0;};
};
if (_menuType == 1) exitWith {
if (GVAR(menuBackgroundSelf)==1) then {[QGVAR(menuBackgroundSelf), false] call EFUNC(common,blurScreen);};
if (GVAR(menuBackgroundSelf)==2) then {(uiNamespace getVariable [QGVAR(menuBackgroundSelf), displayNull]) closeDisplay 0;};
};
}] call CBA_fnc_addEventHandler;
5 changes: 4 additions & 1 deletion addons/interact_menu/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ GVAR(ActSelfNamespace) = [] call CBA_fnc_createNamespace;

// Event handlers for all interact menu controls
DFUNC(handleMouseMovement) = {
if (GVAR(cursorKeepCentered)) then {
if (
(GVAR(keyDownSelfAction) && {GVAR(cursorKeepCenteredSelfInteraction)}) ||
{!(GVAR(keyDownSelfAction)) && {GVAR(cursorKeepCentered)}}
) 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 {
Expand Down
4 changes: 2 additions & 2 deletions addons/interact_menu/functions/fnc_keyDown.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 6 additions & 1 deletion addons/interact_menu/functions/fnc_renderIcon.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ private _pos = if (GVAR(UseListMenu)) then {
[(_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(keyDownSelfAction) && {GVAR(cursorKeepCenteredSelfInteraction)}) ||
BrettMayson marked this conversation as resolved.
Show resolved Hide resolved
{!(GVAR(keyDownSelfAction)) && {GVAR(cursorKeepCentered)}}) &&
{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)];
};
Expand Down
6 changes: 5 additions & 1 deletion addons/interact_menu/functions/fnc_renderSelector.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ private _pos = if (GVAR(UseListMenu)) then {

GVAR(iconCount) = GVAR(iconCount) + 1;

if (GVAR(cursorKeepCentered) && {uiNamespace getVariable [QGVAR(cursorMenuOpened),false]}) then {
if (
BrettMayson marked this conversation as resolved.
Show resolved Hide resolved
((GVAR(keyDownSelfAction) && {GVAR(cursorKeepCenteredSelfInteraction)}) ||
{!(GVAR(keyDownSelfAction)) && {GVAR(cursorKeepCentered)}}) &&
{uiNamespace getVariable [QGVAR(cursorMenuOpened),false]}
BrettMayson marked this conversation as resolved.
Show resolved Hide resolved
) 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)];
};
Expand Down
60 changes: 60 additions & 0 deletions addons/interact_menu/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,63 @@
false,
{GVAR(selectorColorHex) = _this call BIS_fnc_colorRGBtoHTML} // Stored in Hex to avoid constant conversion
] call CBA_settings_fnc_init;

[
QGVAR(alwaysUseCursorInteraction),
"CHECKBOX",
localize LSTRING(AlwaysUseCursorInteraction),
BrettMayson marked this conversation as resolved.
Show resolved Hide resolved
[format ["ACE %1", localize LSTRING(Category_InteractionMenu)], localize LSTRING(Category_InteractionMenu)],
BrettMayson marked this conversation as resolved.
Show resolved Hide resolved
false,
false,
{GVAR(alwaysUseCursorInteraction) = _this}
BrettMayson marked this conversation as resolved.
Show resolved Hide resolved
] call CBA_settings_fnc_init;

[
QGVAR(cursorKeepCentered),
"CHECKBOX",
[LSTRING(cursorKeepCentered), LSTRING(cursorKeepCenteredDescription)],
[format ["ACE %1", localize LSTRING(Category_InteractionMenu)], localize LSTRING(Category_InteractionMenu)],
false,
false,
{GVAR(cursorKeepCentered) = _this}
] call CBA_settings_fnc_init;

[
QGVAR(menuBackground),
"LIST",
localize LSTRING(background),
[format ["ACE %1", localize LSTRING(Category_InteractionMenu)], localize LSTRING(Category_InteractionMenu)],
[[0, 1, 2], ["STR_A3_OPTIONS_DISABLED", localize LSTRING(backgroundBlur), localize LSTRING(backgroundBlack)], 0],
false,
{GVAR(menuBackground) = _this}
] call CBA_settings_fnc_init;

[
QGVAR(alwaysUseCursorSelfInteraction),
"CHECKBOX",
localize LSTRING(AlwaysUseCursorInteraction),
[format ["ACE %1", localize LSTRING(Category_InteractionMenu)], localize LSTRING(Category_SelfInteractionMenu)],
true,
false,
{GVAR(alwaysUseCursorInteractionSelfInteraction) = _this}
] call CBA_settings_fnc_init;

[
QGVAR(cursorKeepCenteredSelfInteraction),
"CHECKBOX",
[LSTRING(cursorKeepCentered), LSTRING(cursorKeepCenteredDescription)],
[format ["ACE %1", localize LSTRING(Category_InteractionMenu)], localize LSTRING(Category_SelfInteractionMenu)],
true,
false,
{GVAR(cursorKeepCenteredSelfInteraction) = _this}
] call CBA_settings_fnc_init;

[
QGVAR(menuBackgroundSelf),
"LIST",
localize LSTRING(background),
BrettMayson marked this conversation as resolved.
Show resolved Hide resolved
[format ["ACE %1", localize LSTRING(Category_InteractionMenu)], localize LSTRING(Category_SelfInteractionMenu)],
[[0, 1, 2], ["STR_A3_OPTIONS_DISABLED", localize LSTRING(backgroundBlur), localize LSTRING(backgroundBlack)], 0],
false,
{GVAR(menuBackgroundSelf) = _this}
] call CBA_settings_fnc_init;
3 changes: 3 additions & 0 deletions addons/interact_menu/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@
<Chinesesimp>互动选单</Chinesesimp>
<Chinese>互動選單</Chinese>
</Key>
<Key ID="STR_ACE_Interact_Menu_Category_SelfInteractionMenu">
BrettMayson marked this conversation as resolved.
Show resolved Hide resolved
<English>Self Interaction Menu</English>
</Key>
<Key ID="STR_ACE_Interact_Menu_menuAnimationSpeed">
<English>Interaction Animation Speed</English>
<German>Interaktionsmenü Animationsgeschwindigkeit</German>
Expand Down