From 2b0cfac8e4ae60f5194fea1d3bf067f672469f6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sat, 28 Feb 2015 23:00:24 -0300 Subject: [PATCH 01/20] Removed obsolote code from ace_interaction (#109) --- addons/attach/functions/fnc_openAttachUI.sqf | 1 - .../explosives/functions/fnc_openPlaceUI.sqf | 3 - .../functions/fnc_openTransmitterUI.sqf | 3 - addons/interaction/Menu_Config.hpp | 69 -------- addons/interaction/XEH_preInit.sqf | 20 --- addons/interaction/config.cpp | 18 -- .../functions/fnc_AddSelectableItem.sqf | 11 +- .../interaction/functions/fnc_GetActions.sqf | 154 ---------------- .../functions/fnc_addInteraction.sqf | 57 ------ .../functions/fnc_addInteractionSelf.sqf | 55 ------ .../functions/fnc_addToTooltip.sqf | 5 - .../functions/fnc_canInteractWith.sqf | 14 -- .../interaction/functions/fnc_getActions2.sqf | 121 ------------- .../functions/fnc_initialiseInteraction.sqf | 167 ------------------ .../functions/fnc_menuKeyInput.sqf | 17 -- .../functions/fnc_onButtonDown.sqf | 18 -- .../functions/fnc_onButtonDownSelf.sqf | 18 -- addons/interaction/functions/fnc_openMenu.sqf | 7 - .../functions/fnc_openMenuSelf.sqf | 4 - .../interaction/functions/fnc_openSubMenu.sqf | 4 - .../functions/fnc_openSubMenuSelf.sqf | 4 - .../functions/fnc_prepareSelectMenu.sqf | 25 ++- .../functions/fnc_removeInteraction.sqf | 36 ---- .../functions/fnc_removeInteractionSelf.sqf | 35 ---- addons/interaction/functions/fnc_showMenu.sqf | 118 ------------- addons/interaction/stringtable.xml | 31 ---- .../functions/fnc_openSelectMagazineUI.sqf | 1 - 27 files changed, 14 insertions(+), 1002 deletions(-) delete mode 100644 addons/interaction/functions/fnc_GetActions.sqf delete mode 100644 addons/interaction/functions/fnc_addInteraction.sqf delete mode 100644 addons/interaction/functions/fnc_addInteractionSelf.sqf delete mode 100644 addons/interaction/functions/fnc_addToTooltip.sqf delete mode 100644 addons/interaction/functions/fnc_canInteractWith.sqf delete mode 100644 addons/interaction/functions/fnc_getActions2.sqf delete mode 100644 addons/interaction/functions/fnc_initialiseInteraction.sqf delete mode 100644 addons/interaction/functions/fnc_menuKeyInput.sqf delete mode 100644 addons/interaction/functions/fnc_onButtonDown.sqf delete mode 100644 addons/interaction/functions/fnc_onButtonDownSelf.sqf delete mode 100644 addons/interaction/functions/fnc_openMenu.sqf delete mode 100644 addons/interaction/functions/fnc_openMenuSelf.sqf delete mode 100644 addons/interaction/functions/fnc_openSubMenu.sqf delete mode 100644 addons/interaction/functions/fnc_openSubMenuSelf.sqf delete mode 100644 addons/interaction/functions/fnc_removeInteraction.sqf delete mode 100644 addons/interaction/functions/fnc_removeInteractionSelf.sqf delete mode 100644 addons/interaction/functions/fnc_showMenu.sqf diff --git a/addons/attach/functions/fnc_openAttachUI.sqf b/addons/attach/functions/fnc_openAttachUI.sqf index 5533956bb6..1b95be9b84 100644 --- a/addons/attach/functions/fnc_openAttachUI.sqf +++ b/addons/attach/functions/fnc_openAttachUI.sqf @@ -62,6 +62,5 @@ _attachables = items _unit; }, { call EFUNC(interaction,hideMenu); - if !(profileNamespace getVariable [QEGVAR(interaction,AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)}; } ] call EFUNC(interaction,openSelectMenu); diff --git a/addons/explosives/functions/fnc_openPlaceUI.sqf b/addons/explosives/functions/fnc_openPlaceUI.sqf index 5ad79381b1..6eb2d478bf 100644 --- a/addons/explosives/functions/fnc_openPlaceUI.sqf +++ b/addons/explosives/functions/fnc_openPlaceUI.sqf @@ -51,8 +51,5 @@ _actions = [localize "STR_ACE_Explosives_PlaceMenu", localize "STR_ACE_Explosive }, { call EFUNC(interaction,hideMenu); - if !(profileNamespace getVariable [QUOTE(EGVAR(interaction,AutoCloseMenu)), false]) then { - "ACE_Explosives" call EFUNC(interaction,openMenuSelf); - }; } ] call EFUNC(interaction,openSelectMenu); diff --git a/addons/explosives/functions/fnc_openTransmitterUI.sqf b/addons/explosives/functions/fnc_openTransmitterUI.sqf index b87673c214..f90636474e 100644 --- a/addons/explosives/functions/fnc_openTransmitterUI.sqf +++ b/addons/explosives/functions/fnc_openTransmitterUI.sqf @@ -43,9 +43,6 @@ if (count _detonators == 0) then { }, { call EFUNC(interaction,hideMenu); - if !(profileNamespace getVariable [QUOTE(EGVAR(interaction,AutoCloseMenu)), false]) then { - "ACE_Explosives" call EFUNC(interaction,openMenuSelf); - }; } ] call EFUNC(interaction,openSelectMenu); }; diff --git a/addons/interaction/Menu_Config.hpp b/addons/interaction/Menu_Config.hpp index ccd0f7d414..3a76c4560d 100644 --- a/addons/interaction/Menu_Config.hpp +++ b/addons/interaction/Menu_Config.hpp @@ -518,75 +518,6 @@ class RscInteractionText: RscText{ h = 1.5 * GUI_GRID_H; }; class RscTitles { - class ACE_FlowMenu { - idd = 9920; - enableSimulation = 1; - movingEnable = 0; - fadeIn=0.5; - fadeOut=0.5; - duration = 10e10; - onLoad = "uiNamespace setVariable ['ACE_Flow_Display', _this select 0];"; - - class controls { - class RearIcon: RscInteractionIcon{ - idc = 999; - text = PATHTOF(UI\CenterIcon_ca.paa); - x = 17.9 * GUI_GRID_W; - y = 10 * GUI_GRID_H; - w = 3.7 * GUI_GRID_H; - h = 5.75 * GUI_GRID_H; - }; - class TopIcon: RscInteractionIcon{ - idc = 1200; - h = 1 * GUI_GRID_H; - y = 9 * GUI_GRID_H; - }; - class FirstIcon: RscInteractionIcon{ - idc = 1201; - y = 10.25 * GUI_GRID_H; - h = 1.5 * GUI_GRID_H; - }; - class SelectedItemIcon: RscInteractionIcon{ - idc = 1202; - y = 12 * GUI_GRID_H; - }; - class ThirdIcon: RscInteractionIcon{ - idc = 1203; - y = 14.25 * GUI_GRID_H; - h = 1.5 * GUI_GRID_H; - }; - class BottomIcon: TopIcon{ - idc = 1204; - y = 16 * GUI_GRID_H; - }; - class ItemName: RscText{ - idc = 1000; - style = 0x01; - x = 5.25 * GUI_GRID_W; - y = 12.15 * GUI_GRID_H; - w = 13 * GUI_GRID_W; - h = 1.5 * GUI_GRID_H; - colorBackground[] = {0.3, 0.3, 0.3, 0.8}; - }; - class BackIcon: RscInteractionIcon{ - idc = 1210; - text = PATHTOF(UI\backArrow_ca.paa); - x = 18.25 * GUI_GRID_W; - y = 12.69 * GUI_GRID_H; - w = 0.5 * GUI_GRID_W; - h = 0.5 * GUI_GRID_H; - }; - class ItemDetails: RscStructuredText{ - idc = 1100; - style = 0x0c; - x = 23.5 * GUI_GRID_W; - y = 11 * GUI_GRID_H; - w = 13 * GUI_GRID_W; - h = 3.9 * GUI_GRID_H; - colorBackground[] = {0, 0, 0, 0.4}; - }; - }; - }; class GVAR(InteractionHelper) { idd = 9930; enableSimulation = 1; diff --git a/addons/interaction/XEH_preInit.sqf b/addons/interaction/XEH_preInit.sqf index bcb8103ea2..5060138d56 100644 --- a/addons/interaction/XEH_preInit.sqf +++ b/addons/interaction/XEH_preInit.sqf @@ -2,49 +2,29 @@ ADDON = false; -PREP(addInteraction); -PREP(addInteractionSelf); PREP(addSelectableItem); -PREP(addToTooltip); PREP(applyButtons); -PREP(canInteractWith); PREP(canTapShoulder); -PREP(getActions); -PREP(getActions2); PREP(getDoor); PREP(getDoorAnimations); PREP(getDown); PREP(getSelectedButton); PREP(hideMenu); PREP(hideMouseHint); -PREP(initialiseInteraction); PREP(isInRange); PREP(joinTeam); -PREP(menuKeyInput); PREP(moduleInteraction); PREP(moveDown); -PREP(onButtonDown); -PREP(onButtonDownSelf); -PREP(onButtonUp); -PREP(onClick); PREP(onSelectMenuDblClick); PREP(openDoor); -PREP(openMenu); PREP(openMenuSelectUI); -PREP(openMenuSelf); PREP(openSelectMenu); -PREP(openSubMenu); -PREP(openSubMenuSelf); PREP(prepareSelectMenu); PREP(push); -PREP(removeInteraction); -PREP(removeInteractionSelf); PREP(removeTag); PREP(sendAway); -PREP(showMenu); PREP(showMouseHint); PREP(sortOptionsByPriority); PREP(tapShoulder); -PREP(updateTooltipPosition); ADDON = true; diff --git a/addons/interaction/config.cpp b/addons/interaction/config.cpp index 90db08e9e2..c9cfd2c0b4 100644 --- a/addons/interaction/config.cpp +++ b/addons/interaction/config.cpp @@ -19,24 +19,6 @@ class CfgPatches { #include class ACE_Settings { - class GVAR(FlowMenu) { - value = 0; - typeName = "BOOL"; - isClientSetable = 1; - displayName = "$STR_ACE_Interaction_FlowMenu"; - }; - class GVAR(AutoCloseMenu) { - value = 0; - typeName = "BOOL"; - isClientSetable = 1; - displayName = "$STR_ACE_Interaction_AutoCloseMenu"; - }; - class GVAR(AutoCenterCursor) { - value = 1; - typeName = "BOOL"; - isClientSetable = 1; - displayName = "$STR_ACE_Interaction_AutoCenterCursor"; - }; class GVAR(EnableTeamManagement) { value = 1; typeName = "BOOL"; diff --git a/addons/interaction/functions/fnc_AddSelectableItem.sqf b/addons/interaction/functions/fnc_AddSelectableItem.sqf index 1e3065d234..966c4fe043 100644 --- a/addons/interaction/functions/fnc_AddSelectableItem.sqf +++ b/addons/interaction/functions/fnc_AddSelectableItem.sqf @@ -29,13 +29,8 @@ if (_picture == "" || _picture == "PictureThing") then { _picture = QUOTE(PATHTOF(UI\dot_ca.paa)); }; -if ((profileNamespace getVariable [QGVAR(FlowMenu), false])) then { - //[_displayName, _statement, _condition, _priority, _subMenu, _icon, _tooltip, _conditionShow, _exceptions, _distance, _hotkey] - _container pushBack [_displayName, nil, {true},0,[], _picture, "", {true}, [], 4, "", _data]; -}else{ - _index = lbAdd [_container, _displayName]; - lbSetData [_container, _index, str _data]; - lbSetPicture [_container, _index, _picture]; -}; +_index = lbAdd [_container, _displayName]; +lbSetData [_container, _index, str _data]; +lbSetPicture [_container, _index, _picture]; _container diff --git a/addons/interaction/functions/fnc_GetActions.sqf b/addons/interaction/functions/fnc_GetActions.sqf deleted file mode 100644 index 67386331c1..0000000000 --- a/addons/interaction/functions/fnc_GetActions.sqf +++ /dev/null @@ -1,154 +0,0 @@ -/* - Author: - commy2 - Garth de Wet (LH) - - Description: - - Parameters: - 0: OBJECT - target - 1: ARRAY - Parents of the target object - 2: ARRAY - Actions - 3: ARRAY - Patches - 4: CONFIG - Parent config (ConfigFile >> "CfgVehicles"/MissionConfigFile >> "CfgVehicles") - 5: BOOL - Is mission config file? - 6: STRING - Classname ("ACE_Actions"/"ACE_SelfActions") - 7: STRING - Sub-class - - Returns: - Nothing - - Example: - [player, [configfile >> "CfgVehicles" >> typeOf player, true] call BIS_fnc_returnParents, [], [],configfile >> "CfgVehicles", false, "ACE_Actions"] call ACE_Interaction_fnc_GetActions; - - [player, [configfile >> "CfgVehicles" >> typeOf player, true] call BIS_fnc_returnParents, [], [],configfile >> "CfgVehicles", false, "ACE_SelfActions"] call ACE_Interaction_fnc_GetActions; -*/ -#include "script_component.hpp" - -#define DEFAULT_ICON QUOTE(PATHTOF(UI\dot_ca.paa)) -private ["_target", "_parents", "_actions", "_patches", "_baseConfig", "_actionType", "_i","_index", "_missionConfig", "_stdConfig"]; -_target = _this select 0; -_parents = _this select 1; -_actions = _this select 2; -_patches = _this select 3; -_baseConfig = _this select 4; -_missionConfig = _this select 5; -_actionType = _this select 6; -_subClass = _this select 7; - -_stdConfig = (configFile >> "CfgVehicles" >> typeOf _target >> _actionType); -if (_subClass != "") then { - _stdConfig = _stdConfig >> _subClass; -}; - -_count = count _parents; -for "_i" from 0 to (_count - 1) do { - _config = _baseConfig >> _parents select _i >> _actionType; - if (_subClass != "") then { - _config = _config >> _subClass; - }; - - _count = count _config; - if (_count > 0) then { - for "_index" from 0 to (_count - 1) do { - private ["_action", "_displayName", "_distance","_condition","_statement","_showDisabled", "_priority", "_tooltip", "_hotkey", - "_subMenu", "_conditionShow", "_exceptions", "_icon", "_actionToCache", "_cacheActions", "_cache", "_indexCache", "_configName"]; - _action = if (_missionConfig) then {_config select _index} else {_stdConfig >> configName (_config select _index)}; - _cache = missionNamespace getVariable [QGVAR(MenuCache), [[], [], []]]; - - if (count _action > 0) then { - _configName = configName _action; - - _cacheConfigs = _cache select 0; - _cacheActions = _cache select 1; - _cacheIndices = _cache select 2; - - _indexCache = _cacheConfigs find _action; - if (_indexCache == -1) then { - _displayName = getText (_action >> "displayName"); - _distance = getNumber (_action >> "distance"); - _priority = getNumber (_action >> "priority"); - _subMenu = getArray (_action >> "subMenu"); - _tooltip = getText (_action >> "tooltip"); - _hotkey = getText (_action >> "hotkey"); - _enableInside = getNumber (_action >> "enableInside"); - - // Condition - _condition = getText (_action >> "condition"); - if (_condition == "") then {_condition = "true"}; - - _condition = _condition + format [QUOTE( && {%1 call EGVAR(common,canInteract)} && {[ARR_2(ACE_player, GVAR(Target))] call EFUNC(common,canInteractWith)} ), getArray (_action >> "exceptions")]; - if (_enableInside != 1) then {_condition = _condition + " && {_player == _vehicle}"}; - - _condition = compile _condition; - - // Condition to show the action - _conditionShow = getText (_action >> "conditionShow"); - _conditionShow = if (_conditionShow == "") then {{true}} else {compile _conditionShow}; - - _showDisabled = getNumber (_action >> "showDisabled") == 1; - if (isText (_action >> "conditionShow")) then { - _showDisabled = [_object, _player] call _conditionShow; - }; - - // Exceptions to the general conditions that have to be true - _exceptions = getArray (_action >> "exceptions"); - - // statement - _statement = getText (_action >> "statement"); - _statement = compile _statement; - - if (profileNamespace getVariable [QGVAR(FlowMenu), false]) then { - _statement = if (getText (_action >> "statement") == "" && {count _subMenu > 1}) then { - compile format [QUOTE( call FUNC(hideMenu);if(%2 == 1)then{['%1'] call FUNC(openSubMenuSelf);}else{['%1'] call FUNC(openSubMenu);}; ), _subMenu select 0, _subMenu select 1]; - } else { - compile (QUOTE( call FUNC(hideMenu); ) + getText (_action >> "statement")); - }; - }; - - // icon - _icon = getText (_action >> "Icon"); - if (_icon == "") then { - _icon = DEFAULT_ICON; - }; - - _actionToCache = [_displayName, _statement, _condition, _priority, _subMenu, _icon, _tooltip, _conditionShow, _exceptions, _distance, _hotkey]; - - if (!(_configName in _patches) && {_showDisabled || {[_object, _player] call _condition}} && {_distance == 0 || {[_object, _distance] call FUNC(isInRange)}}) then { - _actions pushBack _actionToCache; - _patches pushBack _configName; - }; - - _indexCache = _cacheActions find _actionToCache; - if (_indexCache == -1) then { - _indexCache = count _cacheActions; - _cacheActions pushBack _actionToCache; - }; - - _cacheConfigs pushBack _action; - _cacheIndices pushBack _indexCache; - - _cache = [_cacheConfigs, _cacheActions, _cacheIndices]; - ["InteractionMenu", _action, {format ["%1 loaded into cache", _this]}] call EFUNC(common,log); - } else { - ["InteractionMenu", _action, {format ["%1 loaded from cache", _this]}] call EFUNC(common,log); - - _cachedAction = _cacheActions select (_cacheIndices select _indexCache); - - _showDisabled = getNumber (_action >> "showDisabled") == 1; - if (isText (_action >> "conditionShow")) then { - _showDisabled = [_object, _player] call (_cachedAction select 7); - }; - - if (!(_configName in _patches) && {_showDisabled || {[_object, _player] call (_cachedAction select 2)}} && {[_object, (_cachedAction select 9)] call FUNC(isInRange) || {(_cachedAction select 9) == 0}}) then { - _actions pushBack _cachedAction; - _patches pushBack _configName; - }; - }; - }; - - GVAR(MenuCache) = _cache; - }; - }; -}; -[_actions, _patches] diff --git a/addons/interaction/functions/fnc_addInteraction.sqf b/addons/interaction/functions/fnc_addInteraction.sqf deleted file mode 100644 index 5e8889891d..0000000000 --- a/addons/interaction/functions/fnc_addInteraction.sqf +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: commy2 - * - * Add an ACE action to an object. Note: This function is global. - * - * Argument: - * 0: Object the action should be assigned to (Object) - * 1: Name of the action shown in the menu (String) - * 2: Distance the player can be away from the object (Number) - * 3: Condition (Code or String) - * 4: Statement (Code or String) - * 5: Show the action even if the conditon is not met (Bool or Number) - * 6: Priority (Number, optional default: 0) - * - * Return value: - * ID of the action (used to remove it later). - */ - -#include "script_component.hpp" - -private ["_object", "_displayName", "_distance", "_condition", "_statement", "_showDisabled", "_priority", "_actionsVar", "_id", "_actionIDs", "_actions"]; - -_object = _this select 0; -_displayName = _this select 1; -_distance = _this select 2; -_condition = _this select 3; -_statement = _this select 4; -_showDisabled = _this select 5; -_priority = _this select 6; - -if (typeName _condition == "STRING") then { - _condition = compile _condition; -}; - -if (typeName _statement == "STRING") then { - _statement = compile _statement; -}; - -if (typeName _showDisabled == "SCALAR") then { - _showDisabled = _showDisabled > 0; -}; - -if (isNil "_priority") then { - _priority = 0; -}; - -_actionsVar = _object getVariable [QGVAR(Interactions), [-1, [], []]]; - -_id = (_actionsVar select 0) + 1; -_actionIDs = _actionsVar select 1; -_actions = _actionsVar select 2; - -_actionIDs pushBack _id; -_actions pushBack [_displayName, _distance, _condition, _statement, _showDisabled, _priority]; - -_object setVariable [QGVAR(Interactions), [_id, _actionIDs, _actions], true]; -_id diff --git a/addons/interaction/functions/fnc_addInteractionSelf.sqf b/addons/interaction/functions/fnc_addInteractionSelf.sqf deleted file mode 100644 index 48773fcb99..0000000000 --- a/addons/interaction/functions/fnc_addInteractionSelf.sqf +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: commy2 - * - * Add an ACE self action to the player. Execute this on the local machine of the player. - * - * Argument: - * 0: Name of the action shown in the menu (String) - * 1: Condition (Code or String) - * 2: Statement (Code or String) - * 3: Show the action even if the conditon is not met (Bool or Number) - * 4: Priority (Number, optional default: 0) - * - * Return value: - * ID of the action (used to remove it later). - */ - -#include "script_component.hpp" - -private ["_displayName", "_condition", "_statement", "_showDisabled", "_priority", "_actionsVar", "_id", "_actionIDs", "_actions"]; - - -_displayName = _this select 0; - -_condition = _this select 1; -_statement = _this select 2; -_showDisabled = _this select 3; -_priority = _this select 4; - -if (typeName _condition == "STRING") then { - _condition = compile _condition; -}; - -if (typeName _statement == "STRING") then { - _statement = compile _statement; -}; - -if (typeName _showDisabled == "SCALAR") then { - _showDisabled = _showDisabled > 0; -}; - -if (isNil "_priority") then { - _priority = 0; -}; - -_actionsVar = ACE_player getVariable [QGVAR(InteractionsSelf), [-1, [], []]]; - -_id = (_actionsVar select 0) + 1; -_actionIDs = _actionsVar select 1; -_actions = _actionsVar select 2; - -_actionIDs pushBack _id; -_actions pushBack [_displayName, _condition, _statement, _showDisabled, _priority]; - -ACE_player setVariable [QGVAR(InteractionsSelf), [_id, _actionIDs, _actions], false]; -_id diff --git a/addons/interaction/functions/fnc_addToTooltip.sqf b/addons/interaction/functions/fnc_addToTooltip.sqf deleted file mode 100644 index 9f5595a9bc..0000000000 --- a/addons/interaction/functions/fnc_addToTooltip.sqf +++ /dev/null @@ -1,5 +0,0 @@ -// by commy2 - -#include "script_component.hpp" - -GVAR(CurrentTooltip) pushBack (_this select 0); diff --git a/addons/interaction/functions/fnc_canInteractWith.sqf b/addons/interaction/functions/fnc_canInteractWith.sqf deleted file mode 100644 index 5a47782546..0000000000 --- a/addons/interaction/functions/fnc_canInteractWith.sqf +++ /dev/null @@ -1,14 +0,0 @@ -// by commy2 - -#include "script_component.hpp" - -private ["_unit", "_isCivilian"]; - -_unit = _this select 0; -_isCivilian = _this select 1; - -if (isNil "_isCivilian") then {_isCivilian = true}; - -alive _unit -&& [side _unit != side ACE_player, side group _unit == civilian] select _isCivilian -//&& {count (weapons _unit) == 0} diff --git a/addons/interaction/functions/fnc_getActions2.sqf b/addons/interaction/functions/fnc_getActions2.sqf deleted file mode 100644 index 0de4f7a534..0000000000 --- a/addons/interaction/functions/fnc_getActions2.sqf +++ /dev/null @@ -1,121 +0,0 @@ -// commy2 -#include "script_component.hpp" - -private ["_object", "_config", "_type", "_actions", "_configs"]; - -_object = _this select 0; -_config = _this select 1; // configFile, missionConfigFile -_type = _this select 2; // "ACE_CfgInteractions", "ACE_CfgInteractionsSelf" -_actions = _this select 3; // []; - -_configs = "_object isKindOf configName _x" configClasses (_config >> _type); - -// cache -private ["_cache", "_cacheConfigs", "_cacheActions", "_cacheIndices"]; - -_cache = uiNamespace getVariable [QGVAR(MenuCache), [[], [], []]]; -_cacheConfigs = _cache select 0; -_cacheActions = _cache select 1; -_cacheIndices = _cache select 2; - -// get interactions -{ - private "_configActions"; - - _configActions = "true" configClasses (_config >> _type >> configName _x); - { - private ["_action", "_configName", "_indexCache"]; - - _action = _x; - _configName = configName _action; - - _indexCache = _cacheConfigs find _action; - if (_indexCache == -1) then { - private ["_displayName", "_distance", "_priority", "_subMenu", "_tooltip", "_hotkey", "_enableInside", "_condition", "_conditionShow", "_showDisabled", "_exceptions", "_statement", "_icon"]; - - _displayName = getText (_action >> "displayName"); - _distance = getNumber (_action >> "distance"); - _priority = getNumber (_action >> "priority"); - _subMenu = getArray (_action >> "subMenu"); - _tooltip = getText (_action >> "tooltip"); - _hotkey = getText (_action >> "hotkey"); - _enableInside = getNumber (_action >> "enableInside"); - - // Condition - _condition = getText (_action >> "condition"); - if (_condition == "") then {_condition = "true"}; - - _condition = _condition + format [QUOTE(&& {%1 call EFUNC(common,canInteract)} && {[ARR_2(ACE_player, GVAR(Target))] call FUNC(canInteractWith)}), getArray (_action >> "exceptions")]; - if (_enableInside != 1) then {_condition = _condition + " && {_player == _vehicle}"}; - - _condition = compile _condition; - - // Condition to show the action - _conditionShow = getText (_action >> "conditionShow"); - _conditionShow = if (_conditionShow == "") then {{true}} else {compile _conditionShow}; - - _showDisabled = getNumber (_action >> "showDisabled") == 1; - if (isText (_action >> "conditionShow")) then { - _showDisabled = [_object, _player] call _conditionShow; - }; - - // Exceptions to the general conditions that have to be true - _exceptions = getArray (_action >> "exceptions"); - - // statement - _statement = getText (_action >> "statement"); - _statement = compile _statement; - - if (GVAR(FlowMenu)) then { - _statement = if (getText (_action >> "statement") == "" && {count _subMenu > 1}) then { - compile format [QUOTE( call FUNC(hideMenu);if(%2 == 1)then{['%1'] call FUNC(openSubMenuSelf);}else{['%1'] call FUNC(openSubMenu);}; ), _subMenu select 0, _subMenu select 1]; - } else { - compile (QUOTE( call FUNC(hideMenu); ) + getText (_action >> "statement")); - }; - }; - - // icon - _icon = getText (_action >> "Icon"); - if (_icon == "") then { - _icon = DEFAULT_ICON; - }; - - private "_actionToCache"; - _actionToCache = [_displayName, _statement, _condition, _priority, _subMenu, _icon, _tooltip, _conditionShow, _exceptions, _distance, _hotkey]; - - if ((_showDisabled || {[_object, _player] call _condition}) && {_distance == 0 || {[_object, _distance] call FUNC(isInRange)}}) then { - _actions pushBack _actionToCache; - }; - - _indexCache = _cacheActions find _actionToCache; - if (_indexCache == -1) then { - _indexCache = count _cacheActions; - _cacheActions pushBack _actionToCache; - }; - - _cacheConfigs pushBack _action; - _cacheIndices pushBack _indexCache; - - _cache = [_cacheConfigs, _cacheActions, _cacheIndices]; - ["InteractionMenu", _action, {format ["%1 loaded into cache", _this]}] call EFUNC(common,log); - } else { - ["InteractionMenu", _action, {format ["%1 loaded from cache", _this]}] call EFUNC(common,log); - - private ["_cachedAction", "_showDisabled"]; - _cachedAction = _cacheActions select (_cacheIndices select _indexCache); - - _showDisabled = getNumber (_action >> "showDisabled") == 1; - if (isText (_action >> "conditionShow")) then { - _showDisabled = [_object, _player] call (_cachedAction select 7); - }; - - if ((_showDisabled || {[_object, _player] call (_cachedAction select 2)}) && {[_object, (_cachedAction select 9)] call FUNC(isInRange) || {(_cachedAction select 9) == 0}}) then { - _actions pushBack _cachedAction; - }; - }; - } forEach _configActions; //Actions of this CfgVehicles class -} forEach _configs; //CfgVehicles class - -uiNamespace setVariable [QGVAR(MenuCache), _cache]; - -_actions diff --git a/addons/interaction/functions/fnc_initialiseInteraction.sqf b/addons/interaction/functions/fnc_initialiseInteraction.sqf deleted file mode 100644 index 4d88eb4ea1..0000000000 --- a/addons/interaction/functions/fnc_initialiseInteraction.sqf +++ /dev/null @@ -1,167 +0,0 @@ -/* - Author: - commy2 - Garth de Wet (LH) - - Description: - Initialises the interaction click handlers. - - Parameters: - 0 : CODE - code to call when right clicking/center button - 1 : BOOLEAN - Submenu - 2 : BOOLEAN - Flow Menu - 3 : BOOLEAN - Self interaction - 4 : OBJECT - Target - - Returns: - Nothing - - Example: - [{"Default" call FUNC(openMenu);}, true, (profileNamespace getVariable [QGVAR(FlowMenu), false]), GVAR(Target)] call FUNC(initialiseInteraction); -*/ -#include "script_component.hpp" - -private ["_subMenu", "_selfMenu", "_target"]; -GVAR(MainButton) = _this select 0; -_subMenu = _this select 1; -_selfMenu = _this select 3; -_target = _this select 4; - -_player = ACE_player; -_vehicle = vehicle _player; -//_object = [GVAR(Target), _player] select (GVAR(MenuType) % 2 == 1); - -if !([_target, 5] call FUNC(isInRange)) exitWith {}; - -GVAR(Shortcuts) = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; - -// Flow menu -if (_this select 2) then { - (QGVAR(FlowMenu) call BIS_fnc_rscLayer) cutRsc [QGVAR(FlowMenu), "PLAIN",0.5, false]; - ACE_Interaction_SelectedButton = 0; - (findDisplay 1713999) closeDisplay 1; - if (_player getVariable ["ACE_AcceptAction", -1] == -1) then { - [{if(isNil {GVAR(MainButton)} || {!(profileNamespace getVariable [QGVAR(FlowMenu), false])})exitWith{false};(-(_this select 0) / 1.2) call FUNC(MoveDown);true}] call EFUNC(common,addScrollWheelEventHandler); - - _player setVariable ["ACE_AcceptAction", [_player, "DefaultAction", {(!isNil {GVAR(MainButton)}) && {(profileNamespace getVariable [QGVAR(FlowMenu), false])}}, {_action = GVAR(Buttons) select ACE_Interaction_SelectedButton;_target = GVAR(Target);_player = ACE_player;_vehicle = vehicle _player;if ([_target, _player] call (_action select 2)) then {call FUNC(hideMenu);if(count _action == 12) then{(_action select 11) call (_action select 1);}else{[_target, _player] call (_action select 1);};};}] call EFUNC(common,addActionEventHandler)]; - _player setVariable ["ACE_AcceptAction", [_player, "menuBack", {(!isNil {GVAR(MainButton)}) && {(profileNamespace getVariable [QGVAR(FlowMenu), false])}}, {call GVAR(MainButton);}] call EFUNC(common,addActionEventHandler)]; - }; - 0 call FUNC(moveDown); - [localize "STR_ACE_Interaction_MakeSelection", if (_subMenu)then{localize "STR_ACE_Interaction_Back"}else{""}, localize "STR_ACE_Interaction_ScrollHint"] call FUNC(showMouseHint); - ((uiNamespace getVariable QGVAR(Flow_Display)) displayCtrl (1210)) ctrlShow _subMenu; -}else{ // Rose - if (!isNull(uiNamespace getVariable QGVAR(Flow_Display))) then { - (uiNameSpace getVariable QGVAR(Flow_Display)) closeDisplay 0; - call FUNC(hideMouseHint); - }; - if (!_subMenu || {isNull (findDisplay 1713999)}) then { - (findDisplay 1713999) closeDisplay 1; - - (findDisplay 46) createDisplay QGVAR(Dialog); - // Add eventhandlers - /*(findDisplay 1713999) displayAddEventHandler ["KeyDown", QUOTE(_this call EGVAR(common,onKeyDown))]; - (findDisplay 1713999) displayAddEventHandler ["KeyUp", QUOTE(_this call EGVAR(common,onKeyUp))];*/ - - (findDisplay 1713999) displayAddEventHandler ["KeyDown", QUOTE(_this call FUNC(menuKeyInput))]; - }; - disableSerialization; - _dlgInteractionDialog = uiNamespace getVariable QGVAR(Dialog); - _ctrlInteractionDialog = _dlgInteractionDialog displayCtrl 3; - if (GVAR(AutoCenterCursor)) then {setMousePosition [0.5, 0.5]}; - if !(_subMenu) then { - _ctrlInteractionDialog ctrlSetText ([_target] call EFUNC(common,getName)); - } else { - _ctrlInteractionDialog ctrlSetText localize "STR_ACE_Interaction_Back"; - }; - - _buttons = GVAR(Buttons); - _count = count _buttons; - - for "_i" from 0 to 9 do { - _ctrlInteractionDialog = _dlgInteractionDialog displayCtrl (10 + _i); - _ctrlInteractionDialog ctrlShow true; - - _ctrlInteractionDialogIcon = _dlgInteractionDialog displayCtrl (20 + _i); - _ctrlInteractionDialogShortcut = _dlgInteractionDialog displayCtrl (30 + _i); - //_ctrlInteractionDialogBackground = _dlgInteractionDialog displayCtrl (40 + _i); - if (_i < _count) then { - _action = _buttons select _i; - _ctrlInteractionDialog ctrlSetText (_action select 0); - _ctrlInteractionDialog ctrlEnable ([_target, _player] call (_action select 2)); - _ctrlInteractionDialog ctrlSetTooltip (_action select 6); - - _ctrlInteractionDialogIcon ctrlSetText (_action select 5); - _ctrlInteractionDialogShortcut ctrlSetText (_action select 10); - //_ctrlInteractionDialogBackground ctrlShow true; - - GVAR(Shortcuts) set [_i, [_action select 10] call EFUNC(common,letterToCode)]; - } else { - _ctrlInteractionDialog ctrlSetText ""; - _ctrlInteractionDialog ctrlEnable false; - _ctrlInteractionDialog ctrlSetTooltip ""; - - _ctrlInteractionDialogIcon ctrlSetText ""; - _ctrlInteractionDialogShortcut ctrlSetText ""; - //_ctrlInteractionDialogBackground ctrlShow false; - }; - }; - - // Update Buttons - terminate (missionNamespace getVariable [QGVAR(updateMenuHandle), scriptNull]); - - GVAR(updateMenuHandle) = 0 spawn { - disableSerialization; - _dlgMenu = uiNamespace getVariable [QGVAR(Dialog), displayNull]; - _ctrlTooltip = _dlgMenu displayCtrl 40; - - _player = ACE_player; - _vehicle = vehicle _player; - _target = [GVAR(Target), _player] select (GVAR(MenuType) % 2 == 1); - - waitUntil { - if !([_target, 5] call FUNC(isInRange)) exitWith { - (findDisplay 1713999) closeDisplay 1 - }; - - GVAR(Tooltips) = [[], [], [], [], [], [], [], [], [], []]; - { - _ctrlText = _dlgMenu displayCtrl (10 + _forEachIndex); - _ctrlIcon = _dlgMenu displayCtrl (20 + _forEachIndex); - - _condition = _x select 2; - _conditionShow = _x select 7; - _distance = _x select 9; - - GVAR(CurrentTooltip) = []; - - _enable = (_distance == 0 || {[_target, _distance] call FUNC(isInRange)}) && {[_target, _player] call _condition} && {[_target, _player] call _conditionShow}; - if (isNil "_enable") then {_enable = false}; - - GVAR(Tooltips) set [_forEachIndex, GVAR(CurrentTooltip)]; - - // apply conditional tooltips - /*if (_forEachIndex == call ACE_Interaction_fnc_getSelectedButton) then { - _tooltip = _x select 6; - - _showTooltip = _tooltip != ""; - - _tooltip = text _tooltip; - - { - _showTooltip = true; - _tooltip = composeText [_tooltip, lineBreak, _x]; - } forEach (GVAR(Tooltips) select _forEachIndex); - - _ctrlTooltip ctrlSetStructuredText _tooltip; - _ctrlTooltip ctrlShow _showTooltip; - };*/ - - _ctrlText ctrlEnable _enable; - _ctrlIcon ctrlEnable _enable; - } forEach GVAR(Buttons); - - sleep 0.5; - isNull (findDisplay 1713999) - }; - }; -}; diff --git a/addons/interaction/functions/fnc_menuKeyInput.sqf b/addons/interaction/functions/fnc_menuKeyInput.sqf deleted file mode 100644 index 2390d6be14..0000000000 --- a/addons/interaction/functions/fnc_menuKeyInput.sqf +++ /dev/null @@ -1,17 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -private "_key"; - -_key = _this select 1; - -if (_key in [28, 57, 156, 200, 208, 203, 205, 201, 209]) exitWith {true}; - -_index = GVAR(Shortcuts) find _key; - -if (_index != -1 && {ctrlEnabled (findDisplay 1713999 displayCtrl (_index + 10))}) exitWith { - _index call FUNC(onClick); - true -}; - -false diff --git a/addons/interaction/functions/fnc_onButtonDown.sqf b/addons/interaction/functions/fnc_onButtonDown.sqf deleted file mode 100644 index 63f62ed4a0..0000000000 --- a/addons/interaction/functions/fnc_onButtonDown.sqf +++ /dev/null @@ -1,18 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -if (dialog) exitWith { - closeDialog 0; -}; - -if (isNull (findDisplay 1713999)) then { - if (ACE_player == vehicle ACE_player) then {"" call FUNC(openMenu)} else {[ACE_player, vehicle ACE_player] call FUNC(openMenuSelectUI)}; - setMousePosition [0.5, 0.5]; -} else { - (findDisplay 1713999) closeDisplay 1; -}; - -// Raise custom event. @todo: remove -[_player, "interactionMenuOpened", [_player, GVAR(Target), 0]] call EFUNC(common,callCustomEventHandlers); -// Raise ACE localEvent -["interactionMenuOpened", [_player, GVAR(Target), 0]] call EFUNC(common,localEvent); diff --git a/addons/interaction/functions/fnc_onButtonDownSelf.sqf b/addons/interaction/functions/fnc_onButtonDownSelf.sqf deleted file mode 100644 index 7b9abb926e..0000000000 --- a/addons/interaction/functions/fnc_onButtonDownSelf.sqf +++ /dev/null @@ -1,18 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -if (dialog) exitWith { - closeDialog 0; -}; - -if (isNull (findDisplay 1713999)) then { - "" call FUNC(openMenuSelf); - setMousePosition [0.5, 0.5]; -} else { - (findDisplay 1713999) closeDisplay 1; -}; - -// Raise custom event. @todo: remove -[_player, "interactionMenuOpened", [_player, GVAR(Target), 1]] call EFUNC(common,callCustomEventHandlers); -// Raise ACE localEvent -["interactionMenuOpened", [_player, GVAR(Target), 1]] call EFUNC(common,localEvent); diff --git a/addons/interaction/functions/fnc_openMenu.sqf b/addons/interaction/functions/fnc_openMenu.sqf deleted file mode 100644 index 7785f2e4a4..0000000000 --- a/addons/interaction/functions/fnc_openMenu.sqf +++ /dev/null @@ -1,7 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -private "_target"; -_target = [cursorTarget, GVAR(Target)] select (_this == "Default"); - -[0, _target, ""] call FUNC(showMenu); diff --git a/addons/interaction/functions/fnc_openMenuSelf.sqf b/addons/interaction/functions/fnc_openMenuSelf.sqf deleted file mode 100644 index 9ce84f7287..0000000000 --- a/addons/interaction/functions/fnc_openMenuSelf.sqf +++ /dev/null @@ -1,4 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -[1, ACE_player, ""] call FUNC(showMenu); diff --git a/addons/interaction/functions/fnc_openSubMenu.sqf b/addons/interaction/functions/fnc_openSubMenu.sqf deleted file mode 100644 index cda4e76537..0000000000 --- a/addons/interaction/functions/fnc_openSubMenu.sqf +++ /dev/null @@ -1,4 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -[2, GVAR(Target), _this select 0] call FUNC(showMenu); diff --git a/addons/interaction/functions/fnc_openSubMenuSelf.sqf b/addons/interaction/functions/fnc_openSubMenuSelf.sqf deleted file mode 100644 index e207603ebb..0000000000 --- a/addons/interaction/functions/fnc_openSubMenuSelf.sqf +++ /dev/null @@ -1,4 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -[3, ACE_player, _this select 0] call FUNC(showMenu); diff --git a/addons/interaction/functions/fnc_prepareSelectMenu.sqf b/addons/interaction/functions/fnc_prepareSelectMenu.sqf index 43c9eccdf1..acff7fa5e2 100644 --- a/addons/interaction/functions/fnc_prepareSelectMenu.sqf +++ b/addons/interaction/functions/fnc_prepareSelectMenu.sqf @@ -18,18 +18,15 @@ private ["_buttonAction", "_header", "_buttonText", "_cancelButton"]; closeDialog 0; -if (!(profileNamespace getVariable [QGVAR(FlowMenu), false])) exitWith { - _header = _this select 0; - _buttonText = _this select 1; - if (isNil "_buttonText" or {_buttonText == ""}) then { - _buttonText = localize "STR_ACE_Interaction_MakeSelection"; - }; - createDialog "RscACE_SelectAnItem"; - ctrlSetText [8860, _buttonText]; - ctrlSetText [8870, _header]; - - lbClear 8866; - - 8866 +_header = _this select 0; +_buttonText = _this select 1; +if (isNil "_buttonText" or {_buttonText == ""}) then { + _buttonText = localize "STR_ACE_Interaction_MakeSelection"; }; -[] +createDialog "RscACE_SelectAnItem"; +ctrlSetText [8860, _buttonText]; +ctrlSetText [8870, _header]; + +lbClear 8866; + +8866 diff --git a/addons/interaction/functions/fnc_removeInteraction.sqf b/addons/interaction/functions/fnc_removeInteraction.sqf deleted file mode 100644 index 141773da73..0000000000 --- a/addons/interaction/functions/fnc_removeInteraction.sqf +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Author: commy2 - * - * Remove an ACE action from an object. Note: This function is global. - * - * Argument: - * 0: Object (Object) - * 1: ID of the action (Number) - * - * Return value: - * None. - */ -#include "script_component.hpp" - -private ["_object", "_id", "_actionsVar", "_currentID", "_actionIDs", "_actions"]; - -_object = _this select 0; -_id = _this select 1; - -_actionsVar = _object getVariable [QGVAR(Interactions), [-1, [], []]]; - -_currentID = _actionsVar select 0; -_actionIDs = _actionsVar select 1; -_actions = _actionsVar select 2; - -_id = _actionIDs find _id; - -if (_id == -1) exitWith {}; - -_actionIDs set [_id, -1]; -_actionIDs = _actionIDs - [-1]; - -_actions set [_id, []]; -_actions = _actions - [[]]; - -_object setVariable [QGVAR(Interactions), [_currentID, _actionIDs, _actions], true]; diff --git a/addons/interaction/functions/fnc_removeInteractionSelf.sqf b/addons/interaction/functions/fnc_removeInteractionSelf.sqf deleted file mode 100644 index fce0f6a5a0..0000000000 --- a/addons/interaction/functions/fnc_removeInteractionSelf.sqf +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Author: commy2 - * - * Remove an ACE self action from the player. - * - * Argument: - * 0: ID of the action (Number) - * - * Return value: - * None. - */ -#include "script_component.hpp" - -private ["_id", "_actionsVar", "_currentID", "_actionIDs", "_actions"]; - - -_id = _this select 0; - -_actionsVar = ACE_player getVariable [QGVAR(InteractionsSelf), [-1, [], []]]; - -_currentID = _actionsVar select 0; -_actionIDs = _actionsVar select 1; -_actions = _actionsVar select 2; - -_id = _actionIDs find _id; - -if (_id == -1) exitWith {}; - -_actionIDs set [_id, -1]; -_actionIDs = _actionIDs - [-1]; - -_actions set [_id, []]; -_actions = _actions - [[]]; - -ACE_player setVariable [QGVAR(InteractionsSelf), [_currentID, _actionIDs, _actions], false]; diff --git a/addons/interaction/functions/fnc_showMenu.sqf b/addons/interaction/functions/fnc_showMenu.sqf deleted file mode 100644 index b567a22ea4..0000000000 --- a/addons/interaction/functions/fnc_showMenu.sqf +++ /dev/null @@ -1,118 +0,0 @@ -/* - Author: - commy2 - Garth de Wet (LH) - aeroson - - Description: - - Parameters: - 0: NUMBER - Menu type (0 - interaction, 1 - self-interaction, 2 - sub-interaction, 3 - sub-self-interaction) - 1: OBJECT - Target object - 2: STRING - Sub-Menu ClassName - - Returns: - Nothing - - Example: - [0, GVAR(Target)] call FUNC(showMenu); - [1, player] call FUNC(showMenu); - [2, GVAR(Target), "ACE_Explosives"] call FUNC(showMenu); - [3, player, "ACE_Explosives"] call FUNC(showMenu); -*/ -#include "script_component.hpp" - -private ["_player", "_vehicle", "_mainButtonAction", "_object", "_index", "_actions", "_result", "_menuType"]; -#define DEFAULT_ICON QUOTE(PATHOF(UI\dot_ca.paa)) -#define DEFAULT_DISTANCE 4 // seems to be 4 -_player = ACE_player; -_vehicle = vehicle _player; - -GVAR(MenuType) = _this select 0; // 0 Interaction, 1 Self Interaction - -_mainButtonAction = [ - {call FUNC(hideMenu)}, - {call FUNC(hideMenu)}, - {"Default" call FUNC(openMenu)}, - {"Default" call FUNC(openMenuSelf)} -] select GVAR(MenuType); - -_menuType = GVAR(MenuType) % 2; -uiNamespace setVariable [QGVAR(CursorPosition), [controlNull, 0.5, 0.5, -1]]; - -GVAR(Target) = _this select 1; -_object = GVAR(Target); - -if (_menuType == 0 && {(isNull (_object) || {!([_object, 4] call FUNC(isInRange))})}) exitWith {}; -if !([_player, _object] call EFUNC(common,canInteractWith)) exitWith {}; - -// add actions or self actions of GVAR(Target) -_parents = [configFile >> "CfgVehicles" >> typeOf _object, true] call BIS_fnc_returnParents; -_result = [_object, _parents, [], [], missionConfigFile >> "CfgVehicles", true, ["ACE_Actions", "ACE_SelfActions"] select _menuType, _this select 2] call FUNC(GetActions); -_actions = ([_object, _parents, _result select 0, _result select 1,configFile >> "CfgVehicles", false, ["ACE_Actions", "ACE_SelfActions"] select _menuType, _this select 2] call FUNC(GetActions) select 0); - -// add self actions of vehicle _player -if (_menuType == 1 && {_player != _vehicle}) then { - _parents = [configFile >> "CfgVehicles" >> typeOf _vehicle, true] call BIS_fnc_returnParents; - _result = [_vehicle, _parents, [], [], missionConfigFile >> "CfgVehicles", true, ["ACE_Actions", "ACE_SelfActions"] select _menuType, _this select 2] call FUNC(GetActions); - _actions = _actions + (([_vehicle, _parents, _result select 0, _result select 1,configFile >> "CfgVehicles", false, ["ACE_Actions", "ACE_SelfActions"] select _menuType, _this select 2] call FUNC(GetActions) select 0)); -}; - -// custom defined actions, stored in variable instead of cfg like above -if (GVAR(MenuType) < 2) then { - - private ["_customActions", "_customAction", "_displayName", "_distance","_condition","_statement","_showDisabled", "_priority"]; - - // add interactions or self interactions of GVAR(Target) - _customActions = (_object getVariable [[QGVAR(Interactions), QGVAR(ACE_InteractionsSelf)] select _menuType, [-1, [], []]]) select 2; - - // add self interactions of vehicle _player - if (_menuType == 1 && {_player != _vehicle}) then { - _customActions = _customActions + ((_vehicle getVariable [[QGVAR(Interactions), QGVAR(ACE_InteractionsSelf)] select _menuType, [-1, [], []]]) select 2); - }; - - if(_menuType==0) then { - - private ["_distance"]; - - for "_index" from 0 to (count _customActions - 1) do { - - _customAction = _customActions select _index; - _displayName = _customAction select 0; - _distance = _customAction select 1; - _condition = _customAction select 2; - _statement = _customAction select 3; - _showDisabled = _customAction select 4; - _priority = _customAction select 5; - - if ((_showDisabled || {[_object, _player] call _condition}) && {[_object, _distance] call FUNC(isInRange) || {_distance == 0}}) then { - _actions pushBack [_displayName, _statement, _condition, _priority, [], DEFAULT_ICON, "", {true}, [], _distance, ""]; - }; - }; - - } else { // self interactions do not have distance - - for "_index" from 0 to (count _customActions - 1) do { - - _customAction = _customActions select _index; - _displayName = _customAction select 0; - _condition = _customAction select 1; - _statement = _customAction select 2; - _showDisabled = _customAction select 3; - _priority = _customAction select 4; - - if (_showDisabled || {[_object, _player] call _condition}) then { - _actions pushBack [_displayName, _statement, _condition, _priority, [], DEFAULT_ICON, "", {true}, [], DEFAULT_DISTANCE, ""]; - }; - }; - - }; - - -}; - -if (count _actions == 0) exitWith {}; - -_actions call FUNC(sortOptionsByPriority); -GVAR(Buttons) = _actions; -[_mainButtonAction, (_this select 2) != "", (profileNamespace getVariable [QGVAR(FlowMenu), false]), _menuType == 1, _object] call FUNC(initialiseInteraction); diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index 960d136c0f..841b0b052d 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -569,18 +569,6 @@ Perdona Megbocsátás - - Flow Menu - Mausradmenü - Flow Menu - Menú desplegable - Menu Déroulant - Flow Menu - Выпадающее меню - Flow Menu - Menù a Scorrimento - Legördülő menü - Scroll Scrollen @@ -616,25 +604,6 @@ Poza zasięgiem Mimo dosah - - Close Menu on Key Release - Menü nach Loslassen schließen - Zamknij menu automatycznie - Fermer le menu en relâchant la touche - Cerrar menú al soltar la tecla - Menü bezárása a billentyű elengedésekor - Закрывать меню при отжатии клавиши - Menu interakce (Na držení) - - - Auto Center Cursor - Mauszeiger automatisch zentrieren - Auto-centrar cursor - Automatycznie centruj kursor - Vycentrování kurzoru - Egér auto-centrírozása - Автоцентрирование курсора - Equipment >> Ausrüstung >> diff --git a/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf b/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf index e96e84e9a1..fc183faa5b 100644 --- a/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf +++ b/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf @@ -54,6 +54,5 @@ _actions, { [_this] call FUNC(startRepackingMagazine); }, { call EFUNC(interaction,hideMenu); //ToDo: Self Interaction Integration - if !(profileNamespace getVariable [QGVAR(AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)}; } ] call EFUNC(interaction,openSelectMenu); From 84a7c5de4642af5efb82721c2f392ed1bc56da8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 1 Mar 2015 00:46:59 -0300 Subject: [PATCH 02/20] Remove config entries for AGM interaction rose --- addons/interaction/Menu_Config.hpp | 364 ----------------------------- 1 file changed, 364 deletions(-) diff --git a/addons/interaction/Menu_Config.hpp b/addons/interaction/Menu_Config.hpp index 3a76c4560d..38f12066e0 100644 --- a/addons/interaction/Menu_Config.hpp +++ b/addons/interaction/Menu_Config.hpp @@ -43,370 +43,6 @@ class ACE_Interaction_Button_Base { soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape",0.09,1}; }; -#define ICON_BORDER 0.05 - -// Old command rose -class ACE_Interaction_Dialog { - idd = 1713999; - enableSimulation = 1; - movingEnable = 0; - onLoad = "_dlgInteractionDialog = _this select 0; for '_a' from 10 to 19 do {(_dlgInteractionDialog displayCtrl _a) ctrlShow false}; uiNamespace setVariable ['ACE_Interaction_Dialog', _dlgInteractionDialog];"; - objects[] = {}; - class controls { - class Interaction_BackgroundMain: ACE_Interaction_Button_Base { - type = 0; - style = 2; - idc = 2; - colorBackground[] = {0,0,0,0.5}; - colorBackgroundDisabled[] = {0,0,0,0.5}; - x = "(0.5-1.8/16/2 + 0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.55/9/2 + 0 * 0.04) * safezoneH + safezoneY"; - w = "1.8 / 16 * safezoneW"; - h = "0.55 / 9 * safezoneH"; - }; - - class Interaction_ButtonMain: ACE_Interaction_Button_Base { - action = "-1 call ACE_Interaction_fnc_onClick;"; - style = 2; - tooltip = ""; - text = "Interaction Menu"; - idc = 3; - sizeEx = "0.6 / 40 / (getResolution select 5)"; - colorBackground[] = {0,0,0,0}; - colorBackgroundDisabled[] = {0,0,0,0}; - colorBackgroundActive[] = {1,1,1,0.2}; - colorFocused[] = {0,0,0,0}; - x = "(0.5-1.8/16/2 + 0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.55/9/2 + 0 * 0.04) * safezoneH + safezoneY"; - w = "1.8 / 16 * safezoneW"; - h = "0.55 / 9 * safezoneH"; - }; - - class Interaction_Background0: ACE_Interaction_Button_Base { - type = 0; - style = 2; - idc = 40; - colorBackground[] = {0,0,0,0.5}; - colorBackgroundDisabled[] = {0,0,0,0.5}; - x = "(0.5-2.0/16/2 + 0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 2.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Background1: Interaction_Background0 { - idc = 41; - x = "(0.5-2.0/16/2 + 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 1.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Background2: Interaction_Background0 { - idc = 42; - x = "(0.5-2.0/16/2 + 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 0.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Background3: Interaction_Background0 { - idc = 43; - x = "(0.5-2.0/16/2 + 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 0.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Background4: Interaction_Background0 { - idc = 44; - x = "(0.5-2.0/16/2 + 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 1.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Background5: Interaction_Background0 { - idc = 45; - x = "(0.5-2.0/16/2 + 0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 2.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Background6: Interaction_Background0 { - idc = 46; - x = "(0.5-2.0/16/2 - 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 1.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Background7: Interaction_Background0 { - idc = 47; - x = "(0.5-2.0/16/2 - 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 0.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Background8: Interaction_Background0 { - idc = 48; - x = "(0.5-2.0/16/2 - 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 0.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Background9: Interaction_Background0 { - idc = 49; - x = "(0.5-2.0/16/2 - 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 1.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - - class Interaction_Icon0: ACE_Interaction_Button_Base { - tooltip = ""; - text = ""; - idc = 20; - type = 0; - style = 48; - colorBackground[] = {0,0,0,0}; - x = (0.5-(2.0-ICON_BORDER)/16/2 + 0 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 - 2.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - class Interaction_Icon1: Interaction_Icon0 { - idc = 21; - x = (0.5-(2.0-ICON_BORDER)/16/2 + 1.0 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 - 1.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - class Interaction_Icon2: Interaction_Icon0 { - idc = 22; - x = (0.5-(2.0-ICON_BORDER)/16/2 + 1.25 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 - 0.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - class Interaction_Icon3: Interaction_Icon0 { - idc = 23; - x = (0.5-(2.0-ICON_BORDER)/16/2 + 1.25 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 + 0.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - class Interaction_Icon4: Interaction_Icon0 { - idc = 24; - x = (0.5-(2.0-ICON_BORDER)/16/2 + 1.0 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 + 1.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - class Interaction_Icon5 : Interaction_Icon0 { - idc = 25; - x = (0.5-(2.0-ICON_BORDER)/16/2 + 0 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 + 2.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - class Interaction_Icon6: Interaction_Icon0 { - idc = 26; - x = (0.5-(2.0-ICON_BORDER)/16/2 - 1.0 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 + 1.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - class Interaction_Icon7: Interaction_Icon0 { - idc = 27; - x = (0.5-(2.0-ICON_BORDER)/16/2 - 1.25 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 + 0.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - class Interaction_Icon8: Interaction_Icon0 { - idc = 28; - x = (0.5-(2.0-ICON_BORDER)/16/2 - 1.25 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 - 0.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - class Interaction_Icon9: Interaction_Icon0 { - idc = 29; - x = (0.5-(2.0-ICON_BORDER)/16/2 - 1.0 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 - 1.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - - class Interaction_Shortcut0: ACE_Interaction_Button_Base { - tooltip = ""; - text = ""; - idc = 30; - style = 2; - colorBackground[] = {0,0,0,0}; - x = "(0.5+2.0/16/2-0.3/16 + 0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 2.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Shortcut1: Interaction_Shortcut0 { - idc = 31; - type = 0; - x = "(0.5+2.0/16/2-0.3/16 + 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 1.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Shortcut2: Interaction_Shortcut0 { - idc = 32; - type = 0; - x = "(0.5+2.0/16/2-0.3/16 + 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 0.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Shortcut3: Interaction_Shortcut0 { - idc = 33; - type = 0; - x = "(0.5+2.0/16/2-0.3/16 + 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 0.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Shortcut4: Interaction_Shortcut0 { - idc = 34; - type = 0; - x = "(0.5+2.0/16/2-0.3/16 + 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 1.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Shortcut5 : Interaction_Shortcut0 { - idc = 35; - type = 0; - x = "(0.5+2.0/16/2-0.3/16 + 0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 2.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Shortcut6: Interaction_Shortcut0 { - idc = 36; - type = 0; - x = "(0.5+2.0/16/2-0.3/16 - 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 1.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Shortcut7: Interaction_Shortcut0 { - idc = 37; - type = 0; - x = "(0.5+2.0/16/2-0.3/16 - 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 0.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Shortcut8: Interaction_Shortcut0 { - idc = 38; - type = 0; - x = "(0.5+2.0/16/2-0.3/16 - 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 0.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Shortcut9: Interaction_Shortcut0 { - idc = 39; - type = 0; - x = "(0.5+2.0/16/2-0.3/16 - 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 1.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - - class Interaction_Button0: ACE_Interaction_Button_Base { - action = "0 call ACE_Interaction_fnc_onClick;"; - style = 2; - tooltip = ""; - text = ""; - idc = 10; - colorBackground[] = {0,0,0,0}; - colorBackgroundDisabled[] = {0,0,0,0}; - colorBackgroundActive[] = {1,1,1,0.2}; - colorFocused[] = {0,0,0,0}; - x = "(0.5-2.0/16/2 + 0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 2.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Button1: Interaction_Button0 { - action = "1 call ACE_Interaction_fnc_onClick;"; - idc = 11; - x = "(0.5-2.0/16/2 + 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 1.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Button2: Interaction_Button0 { - action = "2 call ACE_Interaction_fnc_onClick;"; - idc = 12; - x = "(0.5-2.0/16/2 + 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 0.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Button3: Interaction_Button0 { - action = "3 call ACE_Interaction_fnc_onClick;"; - idc = 13; - x = "(0.5-2.0/16/2 + 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 0.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Button4: Interaction_Button0 { - action = "4 call ACE_Interaction_fnc_onClick;"; - idc = 14; - x = "(0.5-2.0/16/2 + 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 1.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Button5: Interaction_Button0 { - action = "5 call ACE_Interaction_fnc_onClick;"; - idc = 15; - x = "(0.5-2.0/16/2 + 0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 2.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Button6: Interaction_Button0 { - action = "6 call ACE_Interaction_fnc_onClick;"; - idc = 16; - x = "(0.5-2.0/16/2 - 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 1.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Button7: Interaction_Button0 { - action = "7 call ACE_Interaction_fnc_onClick;"; - idc = 17; - x = "(0.5-2.0/16/2 - 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 0.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Button8: Interaction_Button0 { - action = "8 call ACE_Interaction_fnc_onClick;"; - idc = 18; - x = "(0.5-2.0/16/2 - 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 0.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Button9: Interaction_Button0 { - action = "9 call ACE_Interaction_fnc_onClick;"; - idc = 19; - x = "(0.5-2.0/16/2 - 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 1.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - }; -}; - class RscListbox; class IGUIBack; class RscText; From 2235f844080af86b0d22e4c1d291b84f4f6b6795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 1 Mar 2015 00:48:29 -0300 Subject: [PATCH 03/20] Moved handcuffing/uncuffing to top level actions, as we apparently won't be interacting with hands for anything else for the moment --- addons/captives/CfgVehicles.hpp | 44 ++++++++++++++------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 57f9644a4a..d4ada31ee5 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -2,34 +2,26 @@ class CfgVehicles { class Man; class CAManBase: Man { class ACE_Actions { - class ACE_RightHandActions { + + class ACE_ApplyHandcuffs { + displayName = "$STR_ACE_Captives_SetCaptive"; selection = "righthand"; - displayName = "Right hand"; - distance = 5; - condition = QUOTE(([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs)) || ([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs))); - class ACE_ApplyHandcuffs { - displayName = "$STR_ACE_Captives_SetCaptive"; - distance = 4; - condition = QUOTE([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs)); - statement = QUOTE([ARR_2(_player, _target)] call FUNC(doApplyHandcuffs)); - exceptions[] = {}; - showDisabled = 0; - priority = 2.4; - icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); - hotkey = "C"; - }; - class ACE_RemoveHandcuffs { - displayName = "$STR_ACE_Captives_ReleaseCaptive"; - distance = 4; - condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs)); - statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs)); - exceptions[] = {}; - showDisabled = 0; - priority = 2.4; - icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); - hotkey = "R"; - }; + distance = 2; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doApplyHandcuffs)); + exceptions[] = {}; + icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); }; + class ACE_RemoveHandcuffs { + displayName = "$STR_ACE_Captives_ReleaseCaptive"; + selection = "righthand"; + distance = 2; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs)); + exceptions[] = {}; + icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); + }; + class ACE_MainActions { class ACE_EscortCaptive { displayName = "$STR_ACE_Captives_EscortCaptive"; From 78b1d698c1063dd108367eb50e4fa7dca761d084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 1 Mar 2015 00:52:08 -0300 Subject: [PATCH 04/20] Added base actions for limbs on CAManBase --- addons/interaction/CfgVehicles.hpp | 43 ++++++++++++++++++++++++------ addons/interaction/stringtable.xml | 15 +++++++++++ 2 files changed, 50 insertions(+), 8 deletions(-) diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index 10fde54769..c074e79609 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -145,6 +145,41 @@ class CfgVehicles { enableInside = 1; }; }; + class ACE_Head { + displayName = "$STR_ACE_Interaction_Head"; + selection = "pilot"; + distance = 2.0; + condition = ""; + statement = ""; + }; + class ACE_ArmLeft { + displayName = "$STR_ACE_Interaction_ArmLeft"; + selection = "LeftForeArm"; + distance = 2.0; + condition = ""; + statement = ""; + }; + class ACE_ArmRight { + displayName = "$STR_ACE_Interaction_ArmRight"; + selection = "RightForeArm"; + distance = 2.0; + condition = ""; + statement = ""; + }; + class ACE_LegLeft { + displayName = "$STR_ACE_Interaction_LegLeft"; + selection = "LKnee"; + distance = 2.0; + condition = ""; + statement = ""; + }; + class ACE_LegRight { + displayName = "$STR_ACE_Interaction_LegRight"; + selection = "RKnee"; + distance = 2.0; + condition = ""; + statement = ""; + }; class ACE_TapShoulderRight { displayName = "$STR_ACE_Interaction_TapShoulder"; @@ -152,10 +187,6 @@ class CfgVehicles { distance = 2.0; condition = QUOTE([ARR_2(_player, _target)] call DFUNC(canTapShoulder)); statement = QUOTE([ARR_3(_player, _target, 0)] call DFUNC(tapShoulder)); - showDisabled = 0; - priority = 2.8; - hotkey = "Q"; - enableInside = 1; }; class ACE_TapShoulderLeft { displayName = "$STR_ACE_Interaction_TapShoulder"; @@ -163,10 +194,6 @@ class CfgVehicles { distance = 2.0; condition = QUOTE([ARR_2(_player, _target)] call DFUNC(canTapShoulder)); statement = QUOTE([ARR_3(_player, _target, 1)] call DFUNC(tapShoulder)); - showDisabled = 0; - priority = 2.8; - hotkey = "Q"; - enableInside = 1; }; }; diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index 841b0b052d..fb712ffe04 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -5,6 +5,21 @@ Interactions >> + + Head >> + + + Left Arm >> + + + Right Arm >> + + + Left Leg >> + + + Right Leg >> + Interaction Menu Interaktionsmenü From 2e0b195cba9b3bc2983fe7e9763e78872e4b2087 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 1 Mar 2015 01:32:21 -0300 Subject: [PATCH 05/20] Added base action for handheld weapons --- addons/interaction/CfgVehicles.hpp | 7 +++++++ addons/interaction/stringtable.xml | 3 +++ 2 files changed, 10 insertions(+) diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index c074e79609..0400a5c025 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -180,6 +180,13 @@ class CfgVehicles { condition = ""; statement = ""; }; + class ACE_Weapon { + displayName = "$STR_ACE_Interaction_Weapon"; + selection = "weapon"; + distance = 2.0; + condition = ""; + statement = ""; + }; class ACE_TapShoulderRight { displayName = "$STR_ACE_Interaction_TapShoulder"; diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index fb712ffe04..76898cd227 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -20,6 +20,9 @@ Right Leg >> + + Weapon >> + Interaction Menu Interaktionsmenü From 47eec69ebe5a2524da00bcfa1bcf688fc458c441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 1 Mar 2015 01:33:38 -0300 Subject: [PATCH 06/20] Removed old config entries --- addons/explosives/CfgVehicles.hpp | 1 - addons/interaction/CfgVehicles.hpp | 30 ------------------------------ addons/map/CfgVehicles.hpp | 1 - 3 files changed, 32 deletions(-) diff --git a/addons/explosives/CfgVehicles.hpp b/addons/explosives/CfgVehicles.hpp index 983bc0972a..a1f0aa5944 100644 --- a/addons/explosives/CfgVehicles.hpp +++ b/addons/explosives/CfgVehicles.hpp @@ -16,7 +16,6 @@ class CfgVehicles { showDisabled = 1; priority = 4; icon = PATHTOF(UI\Explosives_Menu_ca.paa); - subMenu[] = {"ACE_Explosives", 1}; hotkey = "X"; //Sub-menu items class ACE_Detonate { diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index 0400a5c025..4c7ccb072b 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -212,7 +212,6 @@ class CfgVehicles { showDisabled = 1; priority = 3.2; icon = PATHTOF(UI\team\team_management_ca.paa); - subMenu[] = {"ACE_TeamManagement", 1}; enableInside = 1; hotkey = "M"; @@ -290,30 +289,12 @@ class CfgVehicles { }; }; - /* DANCE ANIMATION DOESN'T WORK :( - class ACE_Dance { - displayName = "$STR_ACE_Interaction_Dance"; - condition = "isClass (configFile >> 'CfgPatches' >> 'ACE_Movement') and !ACE_Dancing"; - statement = "ACE_Dancing = true; [-2, {_this switchMove 'TestDance';}, player] call CBA_fnc_globalExecute;"; - showDisabled = 0; - priority = -1.2; - }; - class ACE_StopDancing { - displayName = "$STR_ACE_Interaction_StopDancing"; - condition = "ACE_Dancing"; - statement = "ACE_Dancing = false; [-2, {_this switchMove '';}, player] call CBA_fnc_globalExecute;"; - showDisabled = 0; - priority = -1.2; - }; - */ - class ACE_Gestures { displayName = "$STR_ACE_Interaction_Gestures"; condition = "canStand _target"; statement = ""; showDisabled = 1; priority = 3.5; - subMenu[] = {"ACE_Gestures", 1}; icon = PATHTOF(UI\gestures_ca.paa); hotkey = "G"; @@ -420,19 +401,8 @@ class CfgVehicles { showDisabled = 1; priority = 4.5; icon = ""; // @todo - subMenu[] = {"ACE_Equipment", 1}; enableInside = 1; hotkey = "E"; - - class ACE_Dummy { - displayName = ""; - condition = QUOTE(false); - statement = ""; - showDisabled = 1; - priority = -99; - icon = PATHTOEF(common,UI\blank_CO.paa); - enableInside = 1; - }; }; }; }; diff --git a/addons/map/CfgVehicles.hpp b/addons/map/CfgVehicles.hpp index eafc85cdf1..4452c10b23 100644 --- a/addons/map/CfgVehicles.hpp +++ b/addons/map/CfgVehicles.hpp @@ -15,7 +15,6 @@ class CfgVehicles { exceptions[] = {"ACE_Drag_isNotDragging", QEGVAR(common,notOnMap)}; showDisabled = 0; priority = 100; - subMenu[] = {"ACE_MapTools", 1}; enableInside = 1; class ACE_MapToolsHide { From 526e765144734f14c102b25598bfd1da3fc49545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 1 Mar 2015 01:35:06 -0300 Subject: [PATCH 07/20] Added base main actions for vehicle ancestors --- addons/attach/CfgVehicles.hpp | 3 -- addons/interaction/CfgVehicles.hpp | 70 ++++++++++++++++++++++++------ addons/respawn/CfgVehicles.hpp | 3 ++ 3 files changed, 59 insertions(+), 17 deletions(-) diff --git a/addons/attach/CfgVehicles.hpp b/addons/attach/CfgVehicles.hpp index b681c0f7f7..047549dfba 100644 --- a/addons/attach/CfgVehicles.hpp +++ b/addons/attach/CfgVehicles.hpp @@ -2,9 +2,6 @@ #define MACRO_ATTACHTOVEHICLE \ class ACE_Actions { \ class ACE_MainActions { \ - selection = ""; \ - distance = 5; \ - condition = "true"; \ class GVAR(AttachVehicle) { \ displayName = "$STR_ACE_Attach_AttachDetach"; \ condition = QUOTE(([ARR_3(_player, _target, '')] call FUNC(canAttach))); \ diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index 4c7ccb072b..ee7788bc0e 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -409,48 +409,90 @@ class CfgVehicles { class LandVehicle; class Car: LandVehicle { - class ACE_Actions {}; + class ACE_Actions { + class ACE_MainActions { + selection = ""; + distance = 8; + condition = "true"; + }; + }; class ACE_SelfActions {}; }; class Tank: LandVehicle { - class ACE_Actions {}; + class ACE_Actions { + class ACE_MainActions { + selection = ""; + distance = 8; + condition = "true"; + }; + }; class ACE_SelfActions {}; }; class Air; class Helicopter: Air { - class ACE_Actions {}; + class ACE_Actions { + class ACE_MainActions { + selection = ""; + distance = 8; + condition = "true"; + }; + }; class ACE_SelfActions {}; }; class Plane: Air { - class ACE_Actions {}; + class ACE_Actions { + class ACE_MainActions { + selection = ""; + distance = 8; + condition = "true"; + }; + }; class ACE_SelfActions {}; }; class Ship; class Ship_F: Ship { class ACE_Actions { - class ACE_Push { - displayName = "$STR_ACE_Interaction_Push"; - distance = 4; - condition = QUOTE(getMass _target < 1000 && {alive _target}); - statement = QUOTE([ARR_2(_target, [ARR_3(2 * (vectorDir _player select 0), 2 * (vectorDir _player select 1), 0.5)])] call FUNC(push);); - showDisabled = 0; - priority = -1; + class ACE_MainActions { + selection = ""; + distance = 8; + condition = "true"; + + class ACE_Push { + displayName = "$STR_ACE_Interaction_Push"; + distance = 6; + condition = QUOTE(getMass _target < 1000 && {alive _target}); + statement = QUOTE([ARR_2(_target, [ARR_3(2 * (vectorDir _player select 0), 2 * (vectorDir _player select 1), 0.5)])] call FUNC(push);); + showDisabled = 0; + priority = -1; + }; }; }; class ACE_SelfActions {}; }; class StaticWeapon: LandVehicle { - class ACE_Actions {}; + class ACE_Actions { + class ACE_MainActions { + selection = ""; + distance = 8; + condition = "true"; + }; + }; class ACE_SelfActions {}; }; class StaticMortar; class Mortar_01_base_F: StaticMortar { - class ACE_Actions {}; + class ACE_Actions { + class ACE_MainActions { + selection = ""; + distance = 8; + condition = "true"; + }; + }; class ACE_SelfActions {}; }; -}; \ No newline at end of file +}; diff --git a/addons/respawn/CfgVehicles.hpp b/addons/respawn/CfgVehicles.hpp index cbf35b0baf..2a5d96ff95 100644 --- a/addons/respawn/CfgVehicles.hpp +++ b/addons/respawn/CfgVehicles.hpp @@ -157,6 +157,7 @@ class CfgVehicles { class ACE_MainActions { distance = 5; condition = "true"; + selection = ""; class ACE_Teleport { displayName = "Teleport to Base"; distance = 4; @@ -181,6 +182,7 @@ class CfgVehicles { class ACE_MainActions { distance = 5; condition = "true"; + selection = ""; class ACE_Teleport { displayName = "Teleport to Base"; distance = 4; @@ -205,6 +207,7 @@ class CfgVehicles { class ACE_MainActions { distance = 5; condition = "true"; + selection = ""; class ACE_Teleport { displayName = "Teleport to Base"; distance = 4; From 8b761e3528927448fcecf92388b27eff0d1c1bed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 1 Mar 2015 18:28:05 -0300 Subject: [PATCH 08/20] Bandage actions moved from base to second level --- addons/medical/CfgVehicles.hpp | 101 +++++++++++++++++++++------------ 1 file changed, 66 insertions(+), 35 deletions(-) diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index 190d131f07..906a8da05a 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -60,46 +60,77 @@ class CfgVehicles { }; class ACE_Actions { - class Bandage_Head { - displayName = "Bandage Head"; - selection = "pilot"; - distance = 2.0; - //condition = QUOTE([ARR_4(_player, _target, 'head', 'Bandage')] call DFUNC(canTreat)); - statement = QUOTE([ARR_4(_player, _target, 'head', 'Bandage Head')] call DFUNC(treatment)); - showDisabled = 1; - priority = 2; - hotkey = "B"; - enableInside = 1; + class ACE_Head { + class Bandage_Head { + displayName = "Bandage Head"; + distance = 2.0; + //condition = QUOTE([ARR_4(_player, _target, 'head', 'Bandage')] call DFUNC(canTreat)); + statement = QUOTE([ARR_4(_player, _target, 'head', 'Bandage Head')] call DFUNC(treatment)); + showDisabled = 1; + priority = 2; + hotkey = "B"; + enableInside = 1; + }; }; - class Bandage_Torso: Bandage_Head { - displayName = "Bandage Torso"; - selection = "Spine3"; - //condition = QUOTE([ARR_4(_player, _target, 'body', 'Bandage')] call DFUNC(canTreat)); - statement = QUOTE([ARR_4(_player, _target, 'body', 'Bandage')] call DFUNC(treatment)); + class ACE_MainActions { + class Bandage_Torso { + displayName = "Bandage Torso"; + distance = 2.0; + //condition = QUOTE([ARR_4(_player, _target, 'body', 'Bandage')] call DFUNC(canTreat)); + statement = QUOTE([ARR_4(_player, _target, 'body', 'Bandage')] call DFUNC(treatment)); + showDisabled = 1; + priority = 2; + hotkey = "B"; + enableInside = 1; + }; }; - class Bandage_LeftArm: Bandage_Head { - displayName = "Bandage Right Arm"; - selection = "LeftForeArm"; - //condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Bandage')] call DFUNC(canTreat)); - statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'Bandage')] call DFUNC(treatment)); + class ACE_ArmLeft { + class Bandage_LeftArm { + displayName = "Bandage Right Arm"; + distance = 2.0; + //condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Bandage')] call DFUNC(canTreat)); + statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'Bandage')] call DFUNC(treatment)); + showDisabled = 1; + priority = 2; + hotkey = "B"; + enableInside = 1; + }; }; - class Bandage_RightArm: Bandage_Head { - displayName = "Bandage Right Arm"; - selection = "RightForeArm"; - //condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Bandage')] call DFUNC(canTreat)); - statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'Bandage')] call DFUNC(treatment)); + class ACE_ArmRight { + class Bandage_RightArm { + displayName = "Bandage Right Arm"; + distance = 2.0; + //condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Bandage')] call DFUNC(canTreat)); + statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'Bandage')] call DFUNC(treatment)); + showDisabled = 1; + priority = 2; + hotkey = "B"; + enableInside = 1; + }; }; - class Bandage_LeftLeg: Bandage_Head { - displayName = "Bandage Left Leg"; - selection = "lknee"; - //condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'Bandage')] call DFUNC(canTreat)); - statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'Bandage')] call DFUNC(treatment)); + class ACE_LegLeft { + class Bandage_LeftLeg { + displayName = "Bandage Left Leg"; + distance = 2.0; + //condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'Bandage')] call DFUNC(canTreat)); + statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'Bandage')] call DFUNC(treatment)); + showDisabled = 1; + priority = 2; + hotkey = "B"; + enableInside = 1; + }; }; - class Bandage_RightLeg: Bandage_Head { - displayName = "Bandage Right Leg"; - selection = "rknee"; - //condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'Bandage')] call DFUNC(canTreat)); - statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'Bandage')] call DFUNC(treatment)); + class ACE_LegRight { + class Bandage_RightLeg { + displayName = "Bandage Right Leg"; + distance = 2.0; + //condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'Bandage')] call DFUNC(canTreat)); + statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'Bandage')] call DFUNC(treatment)); + showDisabled = 1; + priority = 2; + hotkey = "B"; + enableInside = 1; + }; }; }; }; From a824c1266a269ee2b7c4e422f1b973561bd54461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Fri, 20 Feb 2015 02:04:00 -0300 Subject: [PATCH 09/20] Create an interaction point for the current weapon --- addons/interact_menu/functions/fnc_renderMenu.sqf | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/interact_menu/functions/fnc_renderMenu.sqf b/addons/interact_menu/functions/fnc_renderMenu.sqf index f90b084a29..f0583abcaa 100644 --- a/addons/interact_menu/functions/fnc_renderMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderMenu.sqf @@ -31,7 +31,14 @@ if((count _this) > 4) then { if(typeName (_actionData select 2) == "ARRAY") then { _pos = _object modelToWorld (_actionData select 2); } else { - _pos = _object modelToWorld (_object selectionPosition (_actionData select 2)); + if ((_actionData select 2) == "weapon") then { + // Craft a suitable position for weapon interaction + _weaponDir = _object weaponDirection currentWeapon _object; + _ref = _weaponDir call EFUNC(common,createOrthonormalReference); + _pos = (_object modelToWorld (_object selectionPosition "righthand")) vectorAdd ((_ref select 2) vectorMultiply 0.1); + } else { + _pos = _object modelToWorld (_object selectionPosition (_actionData select 2)); + }; }; }; From 71477f820adbec06a71495af1d9283342fb17de3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 1 Mar 2015 18:47:49 -0300 Subject: [PATCH 10/20] Add displayName to vehicle main actions. Increase range to 10m --- addons/interaction/CfgVehicles.hpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index ee7788bc0e..6d845139ba 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -411,8 +411,9 @@ class CfgVehicles { class Car: LandVehicle { class ACE_Actions { class ACE_MainActions { + displayName = "$STR_ACE_Interaction_MainAction"; selection = ""; - distance = 8; + distance = 10; condition = "true"; }; }; @@ -421,8 +422,9 @@ class CfgVehicles { class Tank: LandVehicle { class ACE_Actions { class ACE_MainActions { + displayName = "$STR_ACE_Interaction_MainAction"; selection = ""; - distance = 8; + distance = 10; condition = "true"; }; }; @@ -433,8 +435,9 @@ class CfgVehicles { class Helicopter: Air { class ACE_Actions { class ACE_MainActions { + displayName = "$STR_ACE_Interaction_MainAction"; selection = ""; - distance = 8; + distance = 10; condition = "true"; }; }; @@ -443,8 +446,9 @@ class CfgVehicles { class Plane: Air { class ACE_Actions { class ACE_MainActions { + displayName = "$STR_ACE_Interaction_MainAction"; selection = ""; - distance = 8; + distance = 10; condition = "true"; }; }; @@ -455,8 +459,9 @@ class CfgVehicles { class Ship_F: Ship { class ACE_Actions { class ACE_MainActions { + displayName = "$STR_ACE_Interaction_MainAction"; selection = ""; - distance = 8; + distance = 10; condition = "true"; class ACE_Push { @@ -475,8 +480,9 @@ class CfgVehicles { class StaticWeapon: LandVehicle { class ACE_Actions { class ACE_MainActions { + displayName = "$STR_ACE_Interaction_MainAction"; selection = ""; - distance = 8; + distance = 10; condition = "true"; }; }; @@ -487,8 +493,9 @@ class CfgVehicles { class Mortar_01_base_F: StaticMortar { class ACE_Actions { class ACE_MainActions { + displayName = "$STR_ACE_Interaction_MainAction"; selection = ""; - distance = 8; + distance = 10; condition = "true"; }; }; From 716eb72d162812d3313ba85e730c875e860efd8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 1 Mar 2015 19:35:18 -0300 Subject: [PATCH 11/20] Prevent ace_vehiclelock from overwritting mainaction distance --- addons/vehiclelock/CfgVehicles.hpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/addons/vehiclelock/CfgVehicles.hpp b/addons/vehiclelock/CfgVehicles.hpp index 2ffb4eee44..5be796c126 100644 --- a/addons/vehiclelock/CfgVehicles.hpp +++ b/addons/vehiclelock/CfgVehicles.hpp @@ -1,8 +1,5 @@ #define MACRO_LOCK_ACTIONS \ class ACE_MainActions { \ - selection = ""; \ - distance = 5; \ - condition = "true"; \ class ACE_unlockVehicle { \ displayName = "$STR_ACE_Vehicle_Action_UnLock"; \ distance = 4; \ From 472e2c5bffdcd8ae030904c542f50cd70bedf5d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 1 Mar 2015 20:14:27 -0300 Subject: [PATCH 12/20] Reduce opacity of base actions --- addons/interact_menu/functions/fnc_renderMenu.sqf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/interact_menu/functions/fnc_renderMenu.sqf b/addons/interact_menu/functions/fnc_renderMenu.sqf index f0583abcaa..ec836c1be3 100644 --- a/addons/interact_menu/functions/fnc_renderMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderMenu.sqf @@ -78,8 +78,12 @@ _menuInSelectedPath = true; // Render icon // ARGB Color (First Hex Pair is transparancy) _color = "#FFFFFFFF"; -if(_menuDepth > 0 && !_menuInSelectedPath) then { - _color = format ["#%1FFFFFF", [255 * ((((count _path) - 2)/_menuDepth) max 0.25)] call EFUNC(common,toHex)]; +if(!_menuInSelectedPath) then { //_menuDepth > 0 && + if (_menuDepth > 0) then { + _color = format ["#%1FFFFFF", [255 * ((((count _path) - 2)/_menuDepth) max 0.25)] call EFUNC(common,toHex)]; + } else { + _color = format ["#%1FFFFFF", [255 * 0.75] call EFUNC(common,toHex)]; + }; }; [_actionData select 0, _color, _pos, 1, 1, 0, _actionData select 1, 0.5, 0.025, "TahomaB"] call FUNC(renderIcon); From 094be22a199756f31fd79fa2d6ea57d7c7957a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Mon, 2 Mar 2015 17:53:30 -0300 Subject: [PATCH 13/20] Move collect children on a sepparate function --- addons/interact_menu/XEH_preInit.sqf | 1 + .../functions/fnc_collectActiveChildren.sqf | 58 +++++++++++++++++++ .../functions/fnc_renderMenu.sqf | 38 +----------- 3 files changed, 60 insertions(+), 37 deletions(-) create mode 100644 addons/interact_menu/functions/fnc_collectActiveChildren.sqf diff --git a/addons/interact_menu/XEH_preInit.sqf b/addons/interact_menu/XEH_preInit.sqf index 72e8e7249e..6d13067aba 100644 --- a/addons/interact_menu/XEH_preInit.sqf +++ b/addons/interact_menu/XEH_preInit.sqf @@ -5,6 +5,7 @@ ADDON = false; PREP(addAction); PREP(compileMenu); PREP(compileMenuSelfAction); +PREP(collectActiveChildren); PREP(keyDown); PREP(keyDownSelfAction); PREP(keyUp); diff --git a/addons/interact_menu/functions/fnc_collectActiveChildren.sqf b/addons/interact_menu/functions/fnc_collectActiveChildren.sqf new file mode 100644 index 0000000000..c258516f00 --- /dev/null +++ b/addons/interact_menu/functions/fnc_collectActiveChildren.sqf @@ -0,0 +1,58 @@ +/* + * Author: CAA-Picard + * For a given action, collect all active children + * + * Argument: + * 0: Object + * 1: Action data + * + * Return value: + * Active children + * + * Public: No + */ +#include "script_component.hpp" + +EXPLODE_2_PVT(_this,_object,_parentAction); + +private ["_activeChildren","_target","_player","_action"]; + +_activeChildren = []; + +_target = _object; +_player = ACE_player; + +// Collect children class actions +{ + _action = _x; + + if([_object, ACE_player] call (_action select 4)) then { + _activeChildren pushBack _action; + }; +} forEach (_parentAction select 6); + +// Collect children object actions +{ + _action = _x; + + // Check if the action is children of the selected menu + if ((count (_action select 8)) == (count (_parentAction select 8) + 1)) then { + + // Compare parent path to see if it's a suitable child + private "_isChild"; + _isChild = true; + { + if !(_x isEqualTo ((_action select 8) select _forEachIndex)) exitWith { + _isChild = false; + }; + } forEach (_parentAction select 8); + + if (_isChild) then { + if ([_target, ACE_player] call (_action select 4)) then { + _activeChildren pushBack _action; + }; + }; + }; +} forEach GVAR(objectActions); + +_activeChildren diff --git a/addons/interact_menu/functions/fnc_renderMenu.sqf b/addons/interact_menu/functions/fnc_renderMenu.sqf index ec836c1be3..547b2a5a80 100644 --- a/addons/interact_menu/functions/fnc_renderMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderMenu.sqf @@ -95,42 +95,7 @@ if !(_menuInSelectedPath) exitWith {true}; // Collect all active children actions private "_activeChildren"; -_activeChildren = []; -// Collect children class actions -{ - _target = _object; - _player = ACE_player; - _active = [_object, ACE_player] call (_x select 4); - if(_active) then { - _activeChildren pushBack _x; - }; -} forEach (_actionData select 6); - -// Collect children object actions -{ - _actionItem = _x; - - // Check if the action is children of the selected menu - if ((count (_actionItem select 8)) == (count _path)) then { - // Compare parent path to see if it's a suitable child - private "_isChild"; - _isChild = true; - for "_i" from 0 to (count (_actionItem select 8)) - 2 do { - if !(((_actionItem select 8) select _i) isEqualTo (_path select (_i + 1))) exitWith { - _isChild = false; - }; - }; - if (_isChild) exitWith { - _target = _object; - _player = ACE_player; - _active = [_target, ACE_player] call (_actionItem select 4); - - if (_active) then { - _activeChildren pushBack _actionItem; - }; - }; - }; -} forEach GVAR(objectActions); +_activeChildren = [_object,_actionData] call FUNC(collectActiveChildren); private ["_angleSpan","_angle"]; _angleSpan = _maxAngleSpan min (55 * ((count _activeChildren) - 1)); @@ -139,7 +104,6 @@ if (_angleSpan >= 305) then { }; _angle = _centerAngle - _angleSpan / 2; - { _target = _object; _player = ACE_player; From 83572921ae0112f9c16b7277e858ad1fbdaee4db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Mon, 2 Mar 2015 23:29:57 -0300 Subject: [PATCH 14/20] - Modification of actions data structure to separate action parameters from children - The action tree of each interaction point is parsed before drawing, pruning inactive actions - Parent actions without statements or active children are not drawn, in order to reduce clutter --- addons/interact_menu/XEH_preInit.sqf | 5 +- .../interact_menu/functions/fnc_addAction.sqf | 21 +++--- .../functions/fnc_collectActiveActionTree.sqf | 72 +++++++++++++++++++ .../functions/fnc_collectActiveChildren.sqf | 58 --------------- .../functions/fnc_compileMenu.sqf | 47 ++++++------ .../functions/fnc_compileMenuSelfAction.sqf | 53 +++++++------- .../functions/fnc_keyDownSelfAction.sqf | 1 - .../functions/fnc_removeAction.sqf | 2 +- addons/interact_menu/functions/fnc_render.sqf | 35 ++++----- .../functions/fnc_renderBaseMenu.sqf | 66 +++++++++++++++++ .../functions/fnc_renderIcon.sqf | 3 +- .../functions/fnc_renderMenu.sqf | 62 +++------------- 12 files changed, 230 insertions(+), 195 deletions(-) create mode 100644 addons/interact_menu/functions/fnc_collectActiveActionTree.sqf delete mode 100644 addons/interact_menu/functions/fnc_collectActiveChildren.sqf create mode 100644 addons/interact_menu/functions/fnc_renderBaseMenu.sqf diff --git a/addons/interact_menu/XEH_preInit.sqf b/addons/interact_menu/XEH_preInit.sqf index 6d13067aba..3923ddf4b3 100644 --- a/addons/interact_menu/XEH_preInit.sqf +++ b/addons/interact_menu/XEH_preInit.sqf @@ -5,7 +5,7 @@ ADDON = false; PREP(addAction); PREP(compileMenu); PREP(compileMenuSelfAction); -PREP(collectActiveChildren); +PREP(collectActiveActionTree); PREP(keyDown); PREP(keyDownSelfAction); PREP(keyUp); @@ -13,6 +13,7 @@ PREP(keyUpSelfAction); PREP(removeAction); PREP(render); PREP(renderIcon); +PREP(renderBaseMenu); PREP(renderMenu); PREP(rotateVectLine); PREP(rotateVectLineGetMap); @@ -43,6 +44,4 @@ GVAR(startHoverTime) = diag_tickTime; GVAR(iconCtrls) = []; GVAR(iconCount) = 0; -GVAR(uidCounter) = 0; - ADDON = true; diff --git a/addons/interact_menu/functions/fnc_addAction.sqf b/addons/interact_menu/functions/fnc_addAction.sqf index 1a288bd85e..136205766e 100644 --- a/addons/interact_menu/functions/fnc_addAction.sqf +++ b/addons/interact_menu/functions/fnc_addAction.sqf @@ -36,17 +36,18 @@ if((count _actions) == 0) then { private "_entry"; _entry = [ - _displayName, - _icon, - _position, - _statement, - _condition, - _distance, - [], - GVAR(uidCounter), - + _fullPath + [ + _displayName, + _icon, + _position, + _statement, + _condition, + _distance, + [false,false,false], + + _fullPath + ], + [] ]; -GVAR(uidCounter) = GVAR(uidCounter) + 1; _actions pushBack _entry; diff --git a/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf b/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf new file mode 100644 index 0000000000..42f762de3f --- /dev/null +++ b/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf @@ -0,0 +1,72 @@ +/* + * Author: CAA-Picard + * Collect a entire tree of active actions + * + * Argument: + * 0: Object + * 1: Original action tree + * + * Return value: + * Active children + * + * Public: No + */ +#include "script_component.hpp" + +EXPLODE_2_PVT(_this,_object,_origAction); +EXPLODE_2_PVT(_origAction,_origActionData,_origActionChildren); + +private ["_resultingAction","_target","_player","_activeChildren","_action","_actionData","_x"]; + +_target = _object; +_player = ACE_player; + +// Return nothing if the action itself is not active +if !([_target, ACE_player] call (_origActionData select 4)) exitWith { + [] +}; + +_activeChildren = []; + +// Collect children class actions +{ + _action = [_object, _x] call FUNC(collectActiveActionTree); + if ((count _action) > 0) then { + _activeChildren pushBack _action; + }; +} forEach _origActionChildren; + +// Collect children object actions +{ + _action = _x; + _actionData = _action select 0; + + // Check if the action is children of the original action + if ((count (_actionData select 7)) == (count (_origActionData select 7) + 1)) then { + + // Compare parent path to see if it's a suitable child + private "_isChild"; + _isChild = true; + { + if !(_x isEqualTo ((_actionData select 7) select _forEachIndex)) exitWith { + _isChild = false; + }; + } forEach (_origActionData select 7); + + if (_isChild) then { + _action = [_object, _action] call FUNC(collectActiveActionTree); + if ((count _action) > 0) then { + _activeChildren pushBack _action; + }; + }; + }; +} forEach GVAR(objectActions); + + +// If the original action has no statement, and no children, don't display it +if ((count _activeChildren) == 0 && ((_origActionData select 3) isEqualTo {})) exitWith { + // @todo: Account for showDisabled? + [] +}; + +[_origActionData, _activeChildren] diff --git a/addons/interact_menu/functions/fnc_collectActiveChildren.sqf b/addons/interact_menu/functions/fnc_collectActiveChildren.sqf deleted file mode 100644 index c258516f00..0000000000 --- a/addons/interact_menu/functions/fnc_collectActiveChildren.sqf +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Author: CAA-Picard - * For a given action, collect all active children - * - * Argument: - * 0: Object - * 1: Action data - * - * Return value: - * Active children - * - * Public: No - */ -#include "script_component.hpp" - -EXPLODE_2_PVT(_this,_object,_parentAction); - -private ["_activeChildren","_target","_player","_action"]; - -_activeChildren = []; - -_target = _object; -_player = ACE_player; - -// Collect children class actions -{ - _action = _x; - - if([_object, ACE_player] call (_action select 4)) then { - _activeChildren pushBack _action; - }; -} forEach (_parentAction select 6); - -// Collect children object actions -{ - _action = _x; - - // Check if the action is children of the selected menu - if ((count (_action select 8)) == (count (_parentAction select 8) + 1)) then { - - // Compare parent path to see if it's a suitable child - private "_isChild"; - _isChild = true; - { - if !(_x isEqualTo ((_action select 8) select _forEachIndex)) exitWith { - _isChild = false; - }; - } forEach (_parentAction select 8); - - if (_isChild) then { - if ([_target, ACE_player] call (_action select 4)) then { - _activeChildren pushBack _action; - }; - }; - }; -} forEach GVAR(objectActions); - -_activeChildren diff --git a/addons/interact_menu/functions/fnc_compileMenu.sqf b/addons/interact_menu/functions/fnc_compileMenu.sqf index cd9f8f51c7..c2ebac5034 100644 --- a/addons/interact_menu/functions/fnc_compileMenu.sqf +++ b/addons/interact_menu/functions/fnc_compileMenu.sqf @@ -45,8 +45,9 @@ _recurseFnc = { // Add canInteract (including exceptions) and canInteractWith to condition _condition = _condition + format [QUOTE( && {%1 call EGVAR(common,canInteract)} && {[ARR_2(ACE_player, _target)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")]; - _showDisabled = getNumber (_entryCfg >> "showDisabled"); - _enableInside = getNumber (_entryCfg >> "enableInside"); + _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; + _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; + _canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0; _fullPath = (+ _parentPath); _fullPath pushBack (configName _entryCfg); @@ -55,18 +56,18 @@ _recurseFnc = { _children = [_entryCfg, _fullPath] call _recurseFnc; _entry = [ - _displayName, - _icon, - _selection, - _statement, - _condition, - _distance, - _children, - GVAR(uidCounter), - _fullPath + [ + _displayName, + _icon, + _selection, + _statement, + _condition, + _distance, + [_showDisabled,_enableInside,_canCollapse], + _fullPath + ], + _children ]; - - GVAR(uidCounter) = GVAR(uidCounter) + 1; _actions pushBack _entry; }; }; @@ -81,15 +82,17 @@ missionNamespace setVariable [_actionsVarName, [_actionsCfg, []] call _recurseFn /* [ [ - "My Action", - "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa", - [0,0,0], - { (_this select 0) setVelocity [0,0,10]; }, - { true }, - 1, - [], - uid, - ["ACE_MainActions","TeamManagement","MyAction"] + [ + "My Action", + "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa", + [0,0,0], + { (_this select 0) setVelocity [0,0,10]; }, + { true }, + 1, + [false,false,false] + ["ACE_MainActions","TeamManagement","MyAction"] + ], + [children actions] ] ] */ diff --git a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf index d4096d123f..0dd82e5178 100644 --- a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf +++ b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf @@ -42,8 +42,9 @@ _recurseFnc = { // Add canInteract (including exceptions) and canInteractWith to condition _condition = _condition + format [QUOTE( && {%1 call EGVAR(common,canInteract)} && {[ARR_2(ACE_player, _target)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")]; - _showDisabled = getNumber (_entryCfg >> "showDisabled"); - _enableInside = getNumber (_entryCfg >> "enableInside"); + _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; + _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; + _canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0; _fullPath = (+ _parentPath); _fullPath pushBack (configName _entryCfg); @@ -52,18 +53,18 @@ _recurseFnc = { _children = [_entryCfg, _fullPath] call _recurseFnc; _entry = [ - _displayName, - _icon, - [0,0,0], - _statement, - _condition, - 10, //distace - _children, - GVAR(uidCounter), - _fullPath + [ + _displayName, + _icon, + [0,0,0], + _statement, + _condition, + 10, //distace + [_showDisabled,_enableInside,_canCollapse], + _fullPath + ], + _children ]; - - GVAR(uidCounter) = GVAR(uidCounter) + 1; _actions pushBack _entry; }; }; @@ -74,18 +75,20 @@ private "_actionsCfg"; _actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_SelfActions"; // Create a master action to base on self action -_actions = [[ - "Self Actions", - "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa", - "Spine3", - { true }, - { true }, - 10, - [_actionsCfg, ["ACE_SelfActions"]] call _recurseFnc, - GVAR(uidCounter), - ["ACE_SelfActions"] -] +_actions = [ + [ + [ + "Self Actions", + "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa", + "Spine3", + { true }, + { true }, + 10, + [false,true,false], + ["ACE_SelfActions"] + ], + [_actionsCfg, ["ACE_SelfActions"]] call _recurseFnc + ] ]; -GVAR(uidCounter) = GVAR(uidCounter) + 1; missionNamespace setVariable [_actionsVarName, _actions]; diff --git a/addons/interact_menu/functions/fnc_keyDownSelfAction.sqf b/addons/interact_menu/functions/fnc_keyDownSelfAction.sqf index 151a7f3b04..1dff596665 100644 --- a/addons/interact_menu/functions/fnc_keyDownSelfAction.sqf +++ b/addons/interact_menu/functions/fnc_keyDownSelfAction.sqf @@ -33,6 +33,5 @@ if(!GVAR(keyDownSelfAction)) then { }; GVAR(selfMenuOffset) = (positionCameraToWorld [0, 0, 2]) vectorDiff (positionCameraToWorld [0, 0, 0]); - //systemChat format ["GVAR(selfMenuOffset) %1",GVAR(selfMenuOffset)]; }; true diff --git a/addons/interact_menu/functions/fnc_removeAction.sqf b/addons/interact_menu/functions/fnc_removeAction.sqf index 2d66b64627..3c6988971d 100644 --- a/addons/interact_menu/functions/fnc_removeAction.sqf +++ b/addons/interact_menu/functions/fnc_removeAction.sqf @@ -24,7 +24,7 @@ _varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum; _actions = _object getVariable [_varName, []]; { - if ((_x select 8) isEqualTo _fullPath) exitWith { + if (((_x select 0) select 7) isEqualTo _fullPath) exitWith { _actions deleteAt _forEachIndex; }; } forEach _actions; diff --git a/addons/interact_menu/functions/fnc_render.sqf b/addons/interact_menu/functions/fnc_render.sqf index c4cb9ad32f..8dce504acc 100644 --- a/addons/interact_menu/functions/fnc_render.sqf +++ b/addons/interact_menu/functions/fnc_render.sqf @@ -22,7 +22,7 @@ GVAR(selfMenuScale) = (((worldToScreen (positionCameraToWorld [1,0,2])) select 0 //systemChat format ["selfMenuScale: %1", GVAR(selfMenuScale)]; GVAR(currentOptions) = []; -private ["_actionsVarName","_classActions","_objectActions","_target","_player","_actionItem","_active"]; +private ["_actionsVarName","_classActions","_objectActions","_target","_player","_action","_actionData","_active"]; _player = ACE_player; if (GVAR(keyDown)) then { [] call FUNC(updateVecLineMap); @@ -44,11 +44,11 @@ if (GVAR(keyDown)) then { _actionsVarName = format [QGVAR(Act_%1), typeOf _target]; GVAR(objectActions) = _target getVariable [QGVAR(actions), []]; { - _actionItem = _x; + _action = _x; // Only render them directly if they are base level actions - if (count (_actionItem select 8) == 1) then { + if (count ((_action select 0) select 7) == 1) then { // Try to render the menu - if ([_target, _actionItem, false, [180, 360]] call FUNC(renderMenu)) then { + if ([_target, _action] call FUNC(renderBaseMenu)) then { _numInteractions = _numInteractions + 1; }; }; @@ -57,9 +57,9 @@ if (GVAR(keyDown)) then { // Iterate through base level class actions and render them if appropiate _classActions = missionNamespace getVariable [_actionsVarName, []]; { - _actionItem = _x; + _action = _x; // Try to render the menu - if ([_target, _actionItem, false, [180, 360]] call FUNC(renderMenu)) then { + if ([_target, _action] call FUNC(renderBaseMenu)) then { _numInteractions = _numInteractions + 1; }; } forEach _classActions; @@ -86,14 +86,10 @@ if (GVAR(keyDown)) then { GVAR(objectActions) = _target getVariable [QGVAR(selfActions), []]; /* { - _actionItem = _x; + _action = _x; // Only render them directly if they are base level actions - if (count (_actionItem select 8) == 1) then { - _active = [_target, ACE_player] call (_actionItem select 4); - - if (_active) then { - [_target, _actionItem, 0, [180, 360]] call FUNC(renderMenu); - }; + if (count (_action select 7) == 1) then { + [_target, _action, 0, [180, 360]] call FUNC(renderMenu); }; } forEach GVAR(objectActions); */ @@ -102,14 +98,10 @@ if (GVAR(keyDown)) then { _actionsVarName = format [QGVAR(SelfAct_%1), typeOf _target]; _classActions = missionNamespace getVariable [_actionsVarName, []]; { - _actionItem = _x; - _active = [_target, ACE_player] call (_actionItem select 4); + _action = _x; - if (_active) then { - //_pos = (ACE_player modelToWorld (ACE_player selectionPosition "spine3")) vectorAdd GVAR(selfMenuOffset) vectorAdd [0,0,0.25]; - _pos = _cursorPos1 vectorAdd GVAR(selfMenuOffset); - [_target, _actionItem, true, [180, 360], _pos] call FUNC(renderMenu); - }; + _pos = _cursorPos1 vectorAdd GVAR(selfMenuOffset); + [_target, _action, _pos] call FUNC(renderBaseMenu); } forEach _classActions; }; }; @@ -154,9 +146,10 @@ if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then { _foundTarget = true; GVAR(actionSelected) = true; GVAR(selectedTarget) = (_closest select 0) select 0; - GVAR(selectedAction) = ((_closest select 0) select 1) select 3; + GVAR(selectedAction) = (((_closest select 0) select 1) select 0) select 3; _misMatch = false; _hoverPath = (_closest select 2); + if((count GVAR(lastPath)) != (count _hoverPath)) then { _misMatch = true; } else { diff --git a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf new file mode 100644 index 0000000000..37f4be25eb --- /dev/null +++ b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf @@ -0,0 +1,66 @@ +/* + * Author: NouberNou and CAA-Picard + * Render the interaction menu for a base action + * + * Argument: + * 0: Object + * 1: Action data + * 2: 3D position (Optional) + * + * Return value: + * Was the menu rendered + * + * Public: No + */ +#include "script_component.hpp" + +private ["_distance","_pos","_weaponDir","_ref","_cameraPos","_sPos","_activeActionTree"]; + +EXPLODE_2_PVT(_this,_object,_baseAction); +EXPLODE_1_PVT(_baseAction,_actionData); + +_distance = _actionData select 5; + +// Obtain a 3D position for the action +if((count _this) > 2) then { + _pos = _this select 2; +} else { + if(typeName (_actionData select 2) == "ARRAY") then { + _pos = _object modelToWorld (_actionData select 2); + } else { + if ((_actionData select 2) == "weapon") then { + // Craft a suitable position for weapon interaction + _weaponDir = _object weaponDirection currentWeapon _object; + _ref = _weaponDir call EFUNC(common,createOrthonormalReference); + _pos = (_object modelToWorld (_object selectionPosition "righthand")) vectorAdd ((_ref select 2) vectorMultiply 0.1); + } else { + _pos = _object modelToWorld (_object selectionPosition (_actionData select 2)); + }; + }; +}; + +// For non-self actions, exit if the action is too far away +_cameraPos = positionCameraToWorld [0, 0, 0]; +if (GVAR(keyDown) && {_cameraPos distance _pos >= _distance}) exitWith {false}; + +// Exit if the action is behind you +_sPos = worldToScreen _pos; +if(count _sPos == 0) exitWith {false}; + +// Exit if the action is off screen +if ((_sPos select 0) < safeZoneXAbs || (_sPos select 0) > safeZoneXAbs + safeZoneWAbs) exitWith {false}; +if ((_sPos select 1) < safeZoneY || (_sPos select 1) > safeZoneY + safeZoneH) exitWith {false}; + + +// Collect active tree +// @todo: cache activeActionTree? +_activeActionTree = ([_object, _baseAction] call FUNC(collectActiveActionTree)); + +// Check if there's something left for rendering +if (count _activeActionTree == 0) exitWith {false}; + +//EXPLODE_2_PVT(_activeActionTree,_actionData,_actionChildren); + +[_object, _activeActionTree, _pos, [180,360]] call FUNC(renderMenu); + +true diff --git a/addons/interact_menu/functions/fnc_renderIcon.sqf b/addons/interact_menu/functions/fnc_renderIcon.sqf index d3f94a2d86..9d845eab3f 100644 --- a/addons/interact_menu/functions/fnc_renderIcon.sqf +++ b/addons/interact_menu/functions/fnc_renderIcon.sqf @@ -40,11 +40,10 @@ if(count _sPos > 0) then { if(_icon == "") then { _icon = DEFAULT_ICON; }; - //systemChat format ["Ctrl: %1, %2,%3", _text,_sPos select 0, _sPos select 1]; _text = format ["
%4", _icon, _color, _color, _text]; _ctrl ctrlSetStructuredText (parseText _text); _ctrl ctrlSetPosition [(_sPos select 0)-(0.2*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.4*SafeZoneW, 0.035*SafeZoneW]; //_ctrl ctrlSetBackgroundColor [1, 0, 0, 0.1]; - // _ctrl ctrlSetBackgroundColor [1,0,0,1]; + //_ctrl ctrlSetBackgroundColor [1,0,0,1]; _ctrl ctrlCommit 0; }; diff --git a/addons/interact_menu/functions/fnc_renderMenu.sqf b/addons/interact_menu/functions/fnc_renderMenu.sqf index 547b2a5a80..3ae2f98324 100644 --- a/addons/interact_menu/functions/fnc_renderMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderMenu.sqf @@ -1,70 +1,32 @@ /* * Author: NouberNou and CAA-Picard - * Render a interaction menu and it's children recursively + * Render an interaction menu and it's children recursively * * Argument: * 0: Object * 1: Action data - * 2: Was the condition already checked? + * 2: 3D position * 3: Angle range available for rendering - * 4: 3D position (Optional) * * Return value: - * Was the menu rendered + * None * * Public: No */ #include "script_component.hpp" -private ["_distance", "_uid", "_pos", "_cameraPos", "_path", "_menuDepth", "_opacity", "_currentRenderDepth", "_radialOffset", "_active", "_x", "_offset", "_newPos", "_forEachIndex"]; +private ["_menuInSelectedPath", "_path", "_menuDepth", "_currentRenderDepth", "_x", "_offset", "_newPos", "_forEachIndex"]; -EXPLODE_4_PVT(_this,_object,_actionData,_wasConditionChecked,_angles); +EXPLODE_4_PVT(_this,_object,_action,_pos,_angles); +EXPLODE_2_PVT(_action,_actionData,_activeChildren); EXPLODE_2_PVT(_angles,_centerAngle,_maxAngleSpan); -_uid = _actionData select 7; -_distance = _actionData select 5; - -// Obtain a 3D position for the action -if((count _this) > 4) then { - _pos = _this select 4; -} else { - if(typeName (_actionData select 2) == "ARRAY") then { - _pos = _object modelToWorld (_actionData select 2); - } else { - if ((_actionData select 2) == "weapon") then { - // Craft a suitable position for weapon interaction - _weaponDir = _object weaponDirection currentWeapon _object; - _ref = _weaponDir call EFUNC(common,createOrthonormalReference); - _pos = (_object modelToWorld (_object selectionPosition "righthand")) vectorAdd ((_ref select 2) vectorMultiply 0.1); - } else { - _pos = _object modelToWorld (_object selectionPosition (_actionData select 2)); - }; - }; -}; - -// For non-self actions, exit if the action is too far away -_cameraPos = positionCameraToWorld [0, 0, 0]; -if (GVAR(keyDown) && {_cameraPos distance _pos >= _distance}) exitWith {false}; - -// Exit if the action is behind you -_sPos = worldToScreen _pos; -if(count _sPos == 0) exitWith {false}; - -// Exit if the action is off screen -if ((_sPos select 0) < safeZoneXAbs || (_sPos select 0) > safeZoneXAbs + safeZoneWAbs) exitWith {false}; -if ((_sPos select 1) < safeZoneY || (_sPos select 1) > safeZoneY + safeZoneH) exitWith {false}; - -// If the condition was not checked, check it and exit if needed -if (!_wasConditionChecked && {!([_target, ACE_player] call (_actionItem select 4))}) exitWith {false}; - _menuDepth = (count GVAR(menuDepthPath)) - 1; // Store path to action -_path = [_object]; -_path = _path + (_actionData select 8); +_path = [_object] + (_actionData select 7); // Check if the menu is on the selected path -private "_menuInSelectedPath"; _menuInSelectedPath = true; { if (_forEachIndex >= (count GVAR(menuDepthPath))) exitWith { @@ -93,10 +55,6 @@ GVAR(currentOptions) pushBack [_this, _pos, _path]; // Exit without rendering children if it isn't if !(_menuInSelectedPath) exitWith {true}; -// Collect all active children actions -private "_activeChildren"; -_activeChildren = [_object,_actionData] call FUNC(collectActiveChildren); - private ["_angleSpan","_angle"]; _angleSpan = _maxAngleSpan min (55 * ((count _activeChildren) - 1)); if (_angleSpan >= 305) then { @@ -109,12 +67,12 @@ _angle = _centerAngle - _angleSpan / 2; _player = ACE_player; _offset = [GVAR(vecLineMap), _angle] call FUNC(rotateVectLine); - _mod = (0.15 max (0.15 * (_cameraPos distance _pos))) / GVAR(selfMenuScale); + _mod = (0.15 max (0.15 * ((positionCameraToWorld [0, 0, 0]) distance _pos))) / GVAR(selfMenuScale); _newPos = _pos vectorAdd (_offset vectorMultiply _mod); - // drawLine3D [_pos, _newPos, [1,0,0,0.5]]; + //drawLine3D [_pos, _newPos, [1,0,0,0.5]]; - [_object, _x, true, [_angle, 140], _newPos] call FUNC(renderMenu); + [_object, _x, _newPos, [_angle, 140]] call FUNC(renderMenu); if (_angleSpan == 360) then { _angle = _angle + _angleSpan / (count _activeChildren); From cd00eda8c07521a47e4a0654e52422934d341333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Mon, 2 Mar 2015 23:30:11 -0300 Subject: [PATCH 15/20] Fix interactions with civilians --- addons/interaction/CfgVehicles.hpp | 4 ++-- addons/interaction/XEH_preInit.sqf | 1 + .../functions/fnc_canInteractWithCivilian.sqf | 11 +++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 addons/interaction/functions/fnc_canInteractWithCivilian.sqf diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index 6d845139ba..c4f44bdcff 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -122,7 +122,7 @@ class CfgVehicles { class ACE_GetDown { displayName = "$STR_ACE_Interaction_GetDown"; distance = 5; - condition = QUOTE([_target] call DFUNC(canInteractWith)); + condition = QUOTE([_target] call DFUNC(canInteractWithCivilian)); statement = QUOTE([_target] call DFUNC(getDown)); showDisabled = 0; priority = 2.2; @@ -130,7 +130,7 @@ class CfgVehicles { class ACE_SendAway { displayName = "$STR_ACE_Interaction_SendAway"; distance = 5; - condition = QUOTE([_target] call DFUNC(canInteractWith)); + condition = QUOTE([_target] call DFUNC(canInteractWithCivilian)); statement = QUOTE([_target] call DFUNC(sendAway)); showDisabled = 0; priority = 2.0; diff --git a/addons/interaction/XEH_preInit.sqf b/addons/interaction/XEH_preInit.sqf index 5060138d56..6efa72778e 100644 --- a/addons/interaction/XEH_preInit.sqf +++ b/addons/interaction/XEH_preInit.sqf @@ -4,6 +4,7 @@ ADDON = false; PREP(addSelectableItem); PREP(applyButtons); +PREP(canInteractWithCivilian); PREP(canTapShoulder); PREP(getDoor); PREP(getDoorAnimations); diff --git a/addons/interaction/functions/fnc_canInteractWithCivilian.sqf b/addons/interaction/functions/fnc_canInteractWithCivilian.sqf new file mode 100644 index 0000000000..6408d66aa8 --- /dev/null +++ b/addons/interaction/functions/fnc_canInteractWithCivilian.sqf @@ -0,0 +1,11 @@ +// by commy2 + +#include "script_component.hpp" + +EXPLODE_2_PVT(_this,_unit,_isCivilian); + +if (isNil "_isCivilian") then {_isCivilian = true}; + +alive _unit +&& [side _unit != side ACE_player, side group _unit == civilian] select _isCivilian +//&& {count (weapons _unit) == 0} \ No newline at end of file From 8fd13f3fe5562e63ffe632d1b7a1f042073e6a1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Mar 2015 00:04:15 -0300 Subject: [PATCH 16/20] Activate bandaging conditions --- addons/medical/CfgVehicles.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index 906a8da05a..7dd4397ff1 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -64,7 +64,7 @@ class CfgVehicles { class Bandage_Head { displayName = "Bandage Head"; distance = 2.0; - //condition = QUOTE([ARR_4(_player, _target, 'head', 'Bandage')] call DFUNC(canTreat)); + condition = QUOTE([ARR_4(_player, _target, 'head', 'Bandage')] call DFUNC(canTreat)); statement = QUOTE([ARR_4(_player, _target, 'head', 'Bandage Head')] call DFUNC(treatment)); showDisabled = 1; priority = 2; @@ -76,7 +76,7 @@ class CfgVehicles { class Bandage_Torso { displayName = "Bandage Torso"; distance = 2.0; - //condition = QUOTE([ARR_4(_player, _target, 'body', 'Bandage')] call DFUNC(canTreat)); + condition = QUOTE([ARR_4(_player, _target, 'body', 'Bandage')] call DFUNC(canTreat)); statement = QUOTE([ARR_4(_player, _target, 'body', 'Bandage')] call DFUNC(treatment)); showDisabled = 1; priority = 2; @@ -88,7 +88,7 @@ class CfgVehicles { class Bandage_LeftArm { displayName = "Bandage Right Arm"; distance = 2.0; - //condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Bandage')] call DFUNC(canTreat)); + condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Bandage')] call DFUNC(canTreat)); statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'Bandage')] call DFUNC(treatment)); showDisabled = 1; priority = 2; @@ -100,7 +100,7 @@ class CfgVehicles { class Bandage_RightArm { displayName = "Bandage Right Arm"; distance = 2.0; - //condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Bandage')] call DFUNC(canTreat)); + condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Bandage')] call DFUNC(canTreat)); statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'Bandage')] call DFUNC(treatment)); showDisabled = 1; priority = 2; @@ -112,7 +112,7 @@ class CfgVehicles { class Bandage_LeftLeg { displayName = "Bandage Left Leg"; distance = 2.0; - //condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'Bandage')] call DFUNC(canTreat)); + condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'Bandage')] call DFUNC(canTreat)); statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'Bandage')] call DFUNC(treatment)); showDisabled = 1; priority = 2; @@ -124,7 +124,7 @@ class CfgVehicles { class Bandage_RightLeg { displayName = "Bandage Right Leg"; distance = 2.0; - //condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'Bandage')] call DFUNC(canTreat)); + condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'Bandage')] call DFUNC(canTreat)); statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'Bandage')] call DFUNC(treatment)); showDisabled = 1; priority = 2; From b675d9d180b3b08eadb97d0b2861402e6b041433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Mar 2015 00:16:38 -0300 Subject: [PATCH 17/20] Compensate for movement during the frame to get rid of jittering --- addons/interact_menu/functions/fnc_renderBaseMenu.sqf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf index 37f4be25eb..980b01bb4c 100644 --- a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf @@ -37,6 +37,8 @@ if((count _this) > 2) then { _pos = _object modelToWorld (_object selectionPosition (_actionData select 2)); }; }; + // Compensate for movement during the frame to get rid of jittering + _pos = _pos vectorAdd ((visiblePositionASL _object) vectorDiff (getPosASL _object)); }; // For non-self actions, exit if the action is too far away From 1c25baa404b3b6b4baca445488adf6b541ab16ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Mar 2015 00:34:34 -0300 Subject: [PATCH 18/20] Base interaction distance in distance to head instead of distance to camera. Works much better on third person view --- addons/interact_menu/functions/fnc_renderBaseMenu.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf index 980b01bb4c..d25a8ad957 100644 --- a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf @@ -42,8 +42,8 @@ if((count _this) > 2) then { }; // For non-self actions, exit if the action is too far away -_cameraPos = positionCameraToWorld [0, 0, 0]; -if (GVAR(keyDown) && {_cameraPos distance _pos >= _distance}) exitWith {false}; +if (GVAR(keyDown) && + {(ACE_player modelToWorld (ACE_player selectionPosition "pilot")) distance _pos >= _distance}) exitWith {false}; // Exit if the action is behind you _sPos = worldToScreen _pos; From 12c0a77f8654d58c1d3114fa4e02744cdf4b7457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Mar 2015 01:37:00 -0300 Subject: [PATCH 19/20] Add functions to common for converting between "position" and ASL --- addons/common/XEH_preInit.sqf | 2 ++ addons/common/functions/fnc_ASLToPosition.sqf | 21 +++++++++++++++++++ addons/common/functions/fnc_positionToASL.sqf | 21 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 addons/common/functions/fnc_ASLToPosition.sqf create mode 100644 addons/common/functions/fnc_positionToASL.sqf diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 62fbd7404f..97c9b9c906 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -15,6 +15,7 @@ PREP(addSetting); PREP(adminKick); PREP(ambientBrightness); PREP(applyForceWalkStatus); +PREP(ASLToPosition); PREP(beingCarried); PREP(binarizeNumber); PREP(blurScreen); @@ -135,6 +136,7 @@ PREP(onLoadRscDisplayChannel); PREP(owned); PREP(player); PREP(playerSide); +PREP(positionToASL); PREP(progressBar); PREP(queueAnimation); PREP(readSettingFromModule); diff --git a/addons/common/functions/fnc_ASLToPosition.sqf b/addons/common/functions/fnc_ASLToPosition.sqf new file mode 100644 index 0000000000..41e532d39b --- /dev/null +++ b/addons/common/functions/fnc_ASLToPosition.sqf @@ -0,0 +1,21 @@ +/* + * Author: CAA-Picard + * Converts ASL to Arma "Position" + * + * Arguments: + * 0: position x + * 1: position y + * 2: position z + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +if (surfaceIsWater _this) then { + _this +} else { + ASLtoATL _this +}; diff --git a/addons/common/functions/fnc_positionToASL.sqf b/addons/common/functions/fnc_positionToASL.sqf new file mode 100644 index 0000000000..916184eb33 --- /dev/null +++ b/addons/common/functions/fnc_positionToASL.sqf @@ -0,0 +1,21 @@ +/* + * Author: CAA-Picard + * Converts Arma "Position" to ASL + * + * Arguments: + * 0: position x + * 1: position y + * 2: position z + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +if (surfaceIsWater _this) then { + _this +} else { + ATLtoASL _this +}; From 27808847db0d7f1a9f71680ba431ec0589391853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Mar 2015 01:37:17 -0300 Subject: [PATCH 20/20] - Solve a number of ASL vs ATL issues - Replace the way of calculating 3D positions for subactions --- addons/interact_menu/XEH_preInit.sqf | 4 -- .../functions/fnc_keyDownSelfAction.sqf | 4 +- addons/interact_menu/functions/fnc_keyUp.sqf | 1 - .../functions/fnc_keyUpSelfAction.sqf | 1 - addons/interact_menu/functions/fnc_render.sqf | 8 +-- .../functions/fnc_renderBaseMenu.sqf | 3 ++ .../functions/fnc_renderMenu.sqf | 6 ++- .../functions/fnc_rotateVectLine.sqf | 52 ------------------- .../functions/fnc_rotateVectLineGetMap.sqf | 52 ------------------- .../functions/fnc_updateVecLineMap.sqf | 13 ----- 10 files changed, 11 insertions(+), 133 deletions(-) delete mode 100644 addons/interact_menu/functions/fnc_rotateVectLine.sqf delete mode 100644 addons/interact_menu/functions/fnc_rotateVectLineGetMap.sqf delete mode 100644 addons/interact_menu/functions/fnc_updateVecLineMap.sqf diff --git a/addons/interact_menu/XEH_preInit.sqf b/addons/interact_menu/XEH_preInit.sqf index 3923ddf4b3..d3ea2451b9 100644 --- a/addons/interact_menu/XEH_preInit.sqf +++ b/addons/interact_menu/XEH_preInit.sqf @@ -15,9 +15,6 @@ PREP(render); PREP(renderIcon); PREP(renderBaseMenu); PREP(renderMenu); -PREP(rotateVectLine); -PREP(rotateVectLineGetMap); -PREP(updateVecLineMap); GVAR(keyDown) = false; GVAR(keyDownSelfAction) = false; @@ -31,7 +28,6 @@ GVAR(actionSelected) = false; GVAR(selectedTarget) = objNull; GVAR(menuDepthPath) = []; -GVAR(vecLineMap) = []; GVAR(lastPos) = [0,0,0]; GVAR(currentOptions) = []; diff --git a/addons/interact_menu/functions/fnc_keyDownSelfAction.sqf b/addons/interact_menu/functions/fnc_keyDownSelfAction.sqf index 1dff596665..0f58a246d2 100644 --- a/addons/interact_menu/functions/fnc_keyDownSelfAction.sqf +++ b/addons/interact_menu/functions/fnc_keyDownSelfAction.sqf @@ -32,6 +32,8 @@ if(!GVAR(keyDownSelfAction)) then { setMousePosition [0.5, 0.5]; }; - GVAR(selfMenuOffset) = (positionCameraToWorld [0, 0, 2]) vectorDiff (positionCameraToWorld [0, 0, 0]); + + GVAR(selfMenuOffset) = ((positionCameraToWorld [0, 0, 2]) call EFUNC(common,positionToASL)) vectorDiff + ((positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL)); }; true diff --git a/addons/interact_menu/functions/fnc_keyUp.sqf b/addons/interact_menu/functions/fnc_keyUp.sqf index ee98a86f7a..b2b5f35547 100644 --- a/addons/interact_menu/functions/fnc_keyUp.sqf +++ b/addons/interact_menu/functions/fnc_keyUp.sqf @@ -22,5 +22,4 @@ if(GVAR(actionSelected)) then { GVAR(expanded) = false; GVAR(lastPath) = []; GVAR(menuDepthPath) = []; -GVAR(vecLineMap) = []; true diff --git a/addons/interact_menu/functions/fnc_keyUpSelfAction.sqf b/addons/interact_menu/functions/fnc_keyUpSelfAction.sqf index 1842587984..0f784e640b 100644 --- a/addons/interact_menu/functions/fnc_keyUpSelfAction.sqf +++ b/addons/interact_menu/functions/fnc_keyUpSelfAction.sqf @@ -26,5 +26,4 @@ if(GVAR(actionSelected)) then { GVAR(expanded) = false; GVAR(lastPath) = []; GVAR(menuDepthPath) = []; -GVAR(vecLineMap) = []; true diff --git a/addons/interact_menu/functions/fnc_render.sqf b/addons/interact_menu/functions/fnc_render.sqf index 8dce504acc..f5723f0c5d 100644 --- a/addons/interact_menu/functions/fnc_render.sqf +++ b/addons/interact_menu/functions/fnc_render.sqf @@ -25,7 +25,6 @@ GVAR(currentOptions) = []; private ["_actionsVarName","_classActions","_objectActions","_target","_player","_action","_actionData","_active"]; _player = ACE_player; if (GVAR(keyDown)) then { - [] call FUNC(updateVecLineMap); // Render all nearby interaction menus #define MAXINTERACTOBJECTS 3 @@ -76,8 +75,6 @@ if (GVAR(keyDown)) then { } else { if (GVAR(keyDownSelfAction)) then { - [] call FUNC(updateVecLineMap); - // Render only the self action menu _target = vehicle ACE_player; @@ -100,7 +97,7 @@ if (GVAR(keyDown)) then { { _action = _x; - _pos = _cursorPos1 vectorAdd GVAR(selfMenuOffset); + _pos = (((positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL)) vectorAdd GVAR(selfMenuOffset)) call EFUNC(common,ASLToPosition); [_target, _action, _pos] call FUNC(renderBaseMenu); } forEach _classActions; }; @@ -176,9 +173,6 @@ if(!_foundTarget && GVAR(actionSelected)) then { GVAR(actionSelected) = false; GVAR(expanded) = false; GVAR(lastPath) = []; - if(!GVAR(keyDown)) then { - GVAR(vecLineMap) = []; - }; }; for "_i" from GVAR(iconCount) to (count GVAR(iconCtrls))-1 do { ctrlDelete (GVAR(iconCtrls) select _i); diff --git a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf index d25a8ad957..7ff430fa08 100644 --- a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf @@ -41,6 +41,9 @@ if((count _this) > 2) then { _pos = _pos vectorAdd ((visiblePositionASL _object) vectorDiff (getPosASL _object)); }; +_cameraToActionVec = (_pos call EFUNC(common,positionToASL)) vectorDiff ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL)); +GVAR(refSystem) = _cameraToActionVec call EFUNC(common,createOrthonormalReference); + // For non-self actions, exit if the action is too far away if (GVAR(keyDown) && {(ACE_player modelToWorld (ACE_player selectionPosition "pilot")) distance _pos >= _distance}) exitWith {false}; diff --git a/addons/interact_menu/functions/fnc_renderMenu.sqf b/addons/interact_menu/functions/fnc_renderMenu.sqf index 3ae2f98324..ad604b9fa5 100644 --- a/addons/interact_menu/functions/fnc_renderMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderMenu.sqf @@ -66,9 +66,11 @@ _angle = _centerAngle - _angleSpan / 2; _target = _object; _player = ACE_player; - _offset = [GVAR(vecLineMap), _angle] call FUNC(rotateVectLine); _mod = (0.15 max (0.15 * ((positionCameraToWorld [0, 0, 0]) distance _pos))) / GVAR(selfMenuScale); - _newPos = _pos vectorAdd (_offset vectorMultiply _mod); + + _offset = ((GVAR(refSystem) select 1) vectorMultiply (-_mod * cos _angle)) vectorAdd + ((GVAR(refSystem) select 2) vectorMultiply (-_mod * sin _angle)); + _newPos = ((_pos call EFUNC(common,positionToASL)) vectorAdd _offset) call EFUNC(common,ASLToPosition); //drawLine3D [_pos, _newPos, [1,0,0,0.5]]; diff --git a/addons/interact_menu/functions/fnc_rotateVectLine.sqf b/addons/interact_menu/functions/fnc_rotateVectLine.sqf deleted file mode 100644 index 4639a50903..0000000000 --- a/addons/interact_menu/functions/fnc_rotateVectLine.sqf +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Author: NouberNou - * Rotate a vector line (?) - * - * Argument: - * 0: Map - * 1: Theta - * - * Return value: - * 0: ?? - * - * Public: No - */ -#include "script_component.hpp" - -private ["_theta", "_p", "_map", "_p1", "_p2", "_q1", "_q2", "_u", "_d"]; -_map = _this select 0; -_theta = _this select 1; - -_p = _map select 0; -_p1 = _map select 1; -_p2 = _map select 2; - -_q1 = +(_map select 3); -_q2 = +(_map select 4); -_u = _map select 5; -_d = _map select 6; - -/* Step 4 */ -_q2 set[0, (_q1 select 0) * cos(_theta) - (_q1 select 1) * sin(_theta)]; -_q2 set[1, (_q1 select 0) * sin(_theta) + (_q1 select 1) * cos(_theta)]; -_q2 set[2, (_q1 select 2)]; - -/* Inverse of step 3 */ -_q1 set[0, (_q2 select 0) * _d + (_q2 select 2) * (_u select 0)]; -_q1 set[1, (_q2 select 1)]; -_q1 set[2, - (_q2 select 0) * (_u select 0) + (_q2 select 2) * _d]; - -/* Inverse of step 2 */ -if (_d != 0) then { - _q2 set[0, (_q1 select 0)]; - _q2 set[1, (_q1 select 1) * (_u select 2) / _d + (_q1 select 2) * (_u select 1) / _d]; - _q2 set[2, - (_q1 select 1) * (_u select 1) / _d + (_q1 select 2) * (_u select 2) / _d]; -} else { - _q2 = _q1; -}; - -/* Inverse of step 1 */ -_q1 set[0, (_q2 select 0) + (_p1 select 0)]; -_q1 set[1, (_q2 select 1) + (_p1 select 1)]; -_q1 set[2, (_q2 select 2) + (_p1 select 2)]; -_q1; diff --git a/addons/interact_menu/functions/fnc_rotateVectLineGetMap.sqf b/addons/interact_menu/functions/fnc_rotateVectLineGetMap.sqf deleted file mode 100644 index e695f3fa8e..0000000000 --- a/addons/interact_menu/functions/fnc_rotateVectLineGetMap.sqf +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Author: NouberNou - * ? - * - * Argument: - * 0: p0 - * 1: p1 - * 2: p2 - * - * Return value: - * Map - * - * Public: No - */ -#include "script_component.hpp" - -private ["_p", "_p1", "_p2", "_q1", "_q2", "_u", "_d"]; - -_p = _this select 0; -_p1 = _this select 1; -_p2 = _this select 2; - -_q1 = []; -_q2 = []; -_u = []; - -/* Step 1 */ -_q1 set[0, (_p select 0) - (_p1 select 0)]; -_q1 set[1, (_p select 1) - (_p1 select 1)]; -_q1 set[2, (_p select 2) - (_p1 select 2)]; - -_u set[0, (_p2 select 0) - (_p1 select 0)]; -_u set[1, (_p2 select 1) - (_p1 select 1)]; -_u set[2, (_p2 select 2) - (_p1 select 2)]; -_u = _u call BIS_fnc_unitVector; -_d = sqrt((_u select 1)*(_u select 1) + (_u select 2)*(_u select 2)); - -/* Step 2 */ -if (_d != 0) then { - _q2 set[0, (_q1 select 0)]; - _q2 set[1, (_q1 select 1) * (_u select 2) / _d - (_q1 select 2) * (_u select 1) / _d]; - _q2 set[2, (_q1 select 1) * (_u select 1) / _d + (_q1 select 2) * (_u select 2) / _d]; -} else { - _q2 = _q1; -}; - -/* Step 3 */ -_q1 set[0, (_q2 select 0) * _d - (_q2 select 2) * (_u select 0)]; -_q1 set[1, (_q2 select 1)]; -_q1 set[2, (_q2 select 0) * (_u select 0) + (_q2 select 2) * _d]; - -[_p, _p1, _p2, _q1, _q2, _u, _d] diff --git a/addons/interact_menu/functions/fnc_updateVecLineMap.sqf b/addons/interact_menu/functions/fnc_updateVecLineMap.sqf deleted file mode 100644 index c5027ffc60..0000000000 --- a/addons/interact_menu/functions/fnc_updateVecLineMap.sqf +++ /dev/null @@ -1,13 +0,0 @@ -#include "script_component.hpp"; - -if((count GVAR(vecLineMap)) == 0 || ((count GVAR(menuDepthPath)) > 0 && (getPosASL player) distance GVAR(lastPos) > 0.01)) then { - GVAR(lastPos) = getPosASL player; - _cursorVec = [_cursorPos2, _cursorPos1] call BIS_fnc_vectorFromXtoY; - _p1 = [0,0,0]; - _p2 = +_cursorVec; - _p = (_cursorVec call CBA_fnc_vect2polar); - _v = [(_p select 0), (_p select 1), (_p select 2)+90] call CBA_fnc_polar2vect; - _cp = [_cursorVec, _v] call BIS_fnc_crossProduct; - - GVAR(vecLineMap) = [_cp, _p1, _p2] call FUNC(rotateVectLineGetMap); -}; \ No newline at end of file