mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Initial nou menu commit.
This commit is contained in:
parent
67fcb0c7b6
commit
6a04408a74
1
addons/interact_menu/$PBOPREFIX$
Normal file
1
addons/interact_menu/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
|||||||
|
z\ace\addons\interact_menu
|
19
addons/interact_menu/CfgEventHandlers.hpp
Normal file
19
addons/interact_menu/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
class Extended_PreInit_EventHandlers {
|
||||||
|
class ADDON {
|
||||||
|
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class Extended_PostInit_EventHandlers {
|
||||||
|
class ADDON {
|
||||||
|
clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) );
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class Extended_InitPost_EventHandlers {
|
||||||
|
class All {
|
||||||
|
class GVAR(compileMenu) {
|
||||||
|
init = QUOTE(_this call FUNC(compileMenu));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
26
addons/interact_menu/XEH_clientInit.sqf
Normal file
26
addons/interact_menu/XEH_clientInit.sqf
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
//XEH_clientInit.sqf
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
_fnc = {
|
||||||
|
_this call FUNC(render);
|
||||||
|
};
|
||||||
|
[_fnc, 0, []] call cba_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
|
_fnc = {
|
||||||
|
_this call FUNC(probe);
|
||||||
|
};
|
||||||
|
[_fnc, 0.5, []] call cba_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
|
["ACE3",
|
||||||
|
"Interact Key",
|
||||||
|
{_this call FUNC(keyDown)},
|
||||||
|
[15, [false, false, false]],
|
||||||
|
false,
|
||||||
|
"keydown"] call cba_fnc_registerKeybind;
|
||||||
|
|
||||||
|
["ACE3",
|
||||||
|
"Interact Key",
|
||||||
|
{_this call FUNC(keyUp)},
|
||||||
|
[15, [false, false, false]],
|
||||||
|
false,
|
||||||
|
"keyUp"] call cba_fnc_registerKeybind;
|
49
addons/interact_menu/XEH_preInit.sqf
Normal file
49
addons/interact_menu/XEH_preInit.sqf
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
ADDON = false;
|
||||||
|
|
||||||
|
PREP(setToRender);
|
||||||
|
PREP(render);
|
||||||
|
PREP(renderIcon);
|
||||||
|
PREP(renderMenu);
|
||||||
|
PREP(probe);
|
||||||
|
PREP(rotateVectLineGetMap);
|
||||||
|
PREP(rotateVectLine);
|
||||||
|
PREP(keyDown);
|
||||||
|
PREP(keyUp);
|
||||||
|
PREP(compileMenu);
|
||||||
|
|
||||||
|
GVAR(toRender) = [];
|
||||||
|
|
||||||
|
GVAR(keyDown) = false;
|
||||||
|
GVAR(keyDownTime) = 0;
|
||||||
|
|
||||||
|
GVAR(lastTime) = diag_tickTime;
|
||||||
|
GVAR(rotationAngle) = 0;
|
||||||
|
|
||||||
|
GVAR(selectedAction) = {};
|
||||||
|
GVAR(actionSelected) = false;
|
||||||
|
GVAR(selectedTarget) = objNull;
|
||||||
|
|
||||||
|
GVAR(filter) = [];
|
||||||
|
|
||||||
|
GVAR(menuDepthPath) = [];
|
||||||
|
GVAR(renderDepth) = 0;
|
||||||
|
GVAR(lastRenderDepth) = 0;
|
||||||
|
GVAR(vecLineMap) = [];
|
||||||
|
GVAR(lastPos) = [0,0,0];
|
||||||
|
|
||||||
|
GVAR(currentOptions) = [];
|
||||||
|
|
||||||
|
GVAR(lastPath) = [];
|
||||||
|
|
||||||
|
GVAR(expanded) = false;
|
||||||
|
|
||||||
|
GVAR(maxRenderDepth) = 0;
|
||||||
|
GVAR(startHoverTime) = diag_tickTime;
|
||||||
|
GVAR(iconCtrls) = [];
|
||||||
|
GVAR(iconCount) = 0;
|
||||||
|
|
||||||
|
GVAR(objectActionsHash) = HASH_CREATE;
|
||||||
|
|
||||||
|
ADDON = true;
|
15
addons/interact_menu/config.cpp
Normal file
15
addons/interact_menu/config.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
class CfgPatches {
|
||||||
|
class ADDON {
|
||||||
|
units[] = {};
|
||||||
|
weapons[] = {};
|
||||||
|
requiredVersion = REQUIRED_VERSION;
|
||||||
|
requiredAddons[] = {"ace_common"};
|
||||||
|
author[] = {""};
|
||||||
|
authorUrl = "";
|
||||||
|
VERSION_CONFIG;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "CfgEventHandlers.hpp"
|
95
addons/interact_menu/functions/fnc_compileMenu.sqf
Normal file
95
addons/interact_menu/functions/fnc_compileMenu.sqf
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
//fnc_compileMenu.sqf
|
||||||
|
#include "script_component.hpp";
|
||||||
|
diag_log text format["COMPILE ACTIONS: %1", _this];
|
||||||
|
|
||||||
|
_object = _this select 0;
|
||||||
|
_objectType = typeOf _object;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
displayName = "$STR_ACE_Interaction_TeamManagement";
|
||||||
|
distance = 4;
|
||||||
|
condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player} && {GVAR(EnableTeamManagement)});
|
||||||
|
statement = "";
|
||||||
|
showDisabled = 0;
|
||||||
|
priority = 3.2;
|
||||||
|
icon = PATHTOF(UI\team\team_management_ca.paa);
|
||||||
|
subMenu[] = {"ACE_TeamManagement", 0};
|
||||||
|
hotkey = "M";
|
||||||
|
enableInside = 1;
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
[
|
||||||
|
[
|
||||||
|
"Launch",
|
||||||
|
"\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa",
|
||||||
|
[0,0,0],
|
||||||
|
{ (_this select 0) setVelocity [0,0,10]; },
|
||||||
|
{ true },
|
||||||
|
1,
|
||||||
|
[]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
*/
|
||||||
|
|
||||||
|
_actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_Actions";
|
||||||
|
|
||||||
|
|
||||||
|
_recurseFnc = {
|
||||||
|
private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_condition", "_showDisabled",
|
||||||
|
"_enableInside", "_children", "_entry", "_actionsCfg"];
|
||||||
|
_actions = [];
|
||||||
|
_actionsCfg = _this select 0;
|
||||||
|
for "_i" from 0 to (count _actionsCfg)-1 do {
|
||||||
|
_entryCfg = _actionsCfg select _i;
|
||||||
|
if(isClass _entryCfg) then {
|
||||||
|
_displayName = getText (_entryCfg >> "displayName");
|
||||||
|
_distance = getNumber (_entryCfg >> "distance");
|
||||||
|
_icon = getText (_entryCfg >> "icon");
|
||||||
|
_statement = compile (getText (_entryCfg >> "statement"));
|
||||||
|
|
||||||
|
_condition = getText (_entryCfg >> "condition");
|
||||||
|
|
||||||
|
_showDisabled = getNumber (_entryCfg >> "showDisabled");
|
||||||
|
_enableInside = getNumber (_entryCfg >> "enableInside");
|
||||||
|
|
||||||
|
_condition = compile _condition;
|
||||||
|
diag_log text format["_condition: %1", _condition];
|
||||||
|
_children = [];
|
||||||
|
if(isArray (_entryCfg >> "subMenu")) then {
|
||||||
|
_subMenuDef = getArray (_entryCfg >> "subMenu");
|
||||||
|
_childMenuName = _subMenuDef select 0;
|
||||||
|
_childMenuCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_Actions" >> _childMenuName;
|
||||||
|
_children = [_childMenuCfg] call _recurseFnc;
|
||||||
|
};
|
||||||
|
_entry = [
|
||||||
|
_displayName,
|
||||||
|
_icon,
|
||||||
|
[0,0,0],
|
||||||
|
_statement,
|
||||||
|
_condition,
|
||||||
|
_distance,
|
||||||
|
_children
|
||||||
|
];
|
||||||
|
|
||||||
|
_actions pushBack _entry;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
_actions
|
||||||
|
};
|
||||||
|
|
||||||
|
_actions = [_actionsCfg] call _recurseFnc;
|
||||||
|
|
||||||
|
_actions = [[
|
||||||
|
"TEST!",
|
||||||
|
"\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa",
|
||||||
|
"Spine3",
|
||||||
|
{ true },
|
||||||
|
{ true },
|
||||||
|
5,
|
||||||
|
_actions
|
||||||
|
]];
|
||||||
|
|
||||||
|
|
||||||
|
_object setVariable [QUOTE(GVAR(actionData)), _actions];
|
8
addons/interact_menu/functions/fnc_keyDown.sqf
Normal file
8
addons/interact_menu/functions/fnc_keyDown.sqf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
//fnc_keyDown.sqf
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
if(!GVAR(keyDown)) then {
|
||||||
|
GVAR(keyDown) = true;
|
||||||
|
GVAR(keyDownTime) = diag_tickTime;
|
||||||
|
};
|
||||||
|
true
|
15
addons/interact_menu/functions/fnc_keyUp.sqf
Normal file
15
addons/interact_menu/functions/fnc_keyUp.sqf
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
//fnc_keyUp.sqf
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
GVAR(keyDown) = false;
|
||||||
|
if(GVAR(actionSelected)) then {
|
||||||
|
this = GVAR(selectedTarget);
|
||||||
|
_player = ACE_Player;
|
||||||
|
_target = GVAR(selectedTarget);
|
||||||
|
[GVAR(selectedTarget), player] call GVAR(selectedAction);
|
||||||
|
};
|
||||||
|
GVAR(expanded) = false;
|
||||||
|
GVAR(lastPath) = [];
|
||||||
|
GVAR(menuDepthPath) = [];
|
||||||
|
GVAR(vecLineMap) = [];
|
||||||
|
true
|
42
addons/interact_menu/functions/fnc_probe.sqf
Normal file
42
addons/interact_menu/functions/fnc_probe.sqf
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
//fnc_probe.sqf
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_nearestObjects", "_actionObject", "_x", "_actionData", "_renderData", "_actionItem", "_active", "_renderItem", "_object", "_forEachIndex"];
|
||||||
|
if(!GVAR(keyDown)) then {
|
||||||
|
_nearestObjects = nearestObjects [(getPos player), ["All"], 100];
|
||||||
|
|
||||||
|
GVAR(toRender) = [];
|
||||||
|
{
|
||||||
|
_actionObject = _x;
|
||||||
|
_actionData = _actionObject getVariable [QUOTE(GVAR(actionData)), []];
|
||||||
|
|
||||||
|
if((count _actionData) > 0) then {
|
||||||
|
_renderData = [];
|
||||||
|
{
|
||||||
|
_actionItem = _x;
|
||||||
|
this = _actionObject;
|
||||||
|
_target = _actionObject;
|
||||||
|
_player = ACE_player;
|
||||||
|
_active = [_target, ACE_player] call (_actionItem select 4);
|
||||||
|
player sideChat format["_active: %1 %2", _actionItem select 0, _active];
|
||||||
|
if(_active) then {
|
||||||
|
_renderItem = +_actionItem;
|
||||||
|
_renderItem set[4, true];
|
||||||
|
_renderData set[(count _renderData), _renderItem];
|
||||||
|
};
|
||||||
|
} forEach _actionData;
|
||||||
|
if((count _renderData) > 0) then {
|
||||||
|
GVAR(toRender) set[(count GVAR(toRender)), [_actionObject, _renderData]];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _nearestObjects;
|
||||||
|
// player sideChat format["p: %1", count GVAR(toRender)];
|
||||||
|
} else {
|
||||||
|
GVAR(filter) = [];
|
||||||
|
{
|
||||||
|
_object = _x select 0;
|
||||||
|
if(_object distance player > 100) then {
|
||||||
|
GVAR(filter) set[(count GVAR(filter)), _forEachIndex];
|
||||||
|
};
|
||||||
|
} forEach GVAR(toRender);
|
||||||
|
};
|
104
addons/interact_menu/functions/fnc_render.sqf
Normal file
104
addons/interact_menu/functions/fnc_render.sqf
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
//fnc_render.sqf
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_cursorPos1", "_cursorPos2", "_cursorVec", "_p1", "_p2", "_p", "_v", "_cp", "_forEachIndex", "_renderTargets", "_x", "_cursorScreenPos", "_closestDistance", "_closestSelection", "_pos", "_sPos", "_disSq", "_closest", "_cTime", "_delta", "_foundTarget", "_misMatch", "_hoverPath", "_i"];
|
||||||
|
_foundTarget = false;
|
||||||
|
_cursorPos1 = positionCameraToWorld [0, 0, 0];
|
||||||
|
_cursorPos2 = positionCameraToWorld [0, 0, 2];
|
||||||
|
GVAR(currentOptions) = [];
|
||||||
|
if((count GVAR(toRender)) > 0 && GVAR(keyDown)) then {
|
||||||
|
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);
|
||||||
|
};
|
||||||
|
{
|
||||||
|
if(!(_forEachIndex in GVAR(filter))) then {
|
||||||
|
GVAR(renderDepth) = 0;
|
||||||
|
_renderTargets = _x;
|
||||||
|
{
|
||||||
|
[_renderTargets select 0, _x, 0] call FUNC(renderMenu);
|
||||||
|
} forEach (_renderTargets select 1);
|
||||||
|
};
|
||||||
|
} forEach GVAR(toRender);
|
||||||
|
// player sideChat format["c: %1", count GVAR(toRender)];
|
||||||
|
};
|
||||||
|
|
||||||
|
if(GVAR(keyDown)) then {
|
||||||
|
|
||||||
|
_cursorScreenPos = worldToScreen _cursorPos2;
|
||||||
|
_closestDistance = 1000000;
|
||||||
|
_closestSelection = -1;
|
||||||
|
{
|
||||||
|
_pos = _x select 1;
|
||||||
|
_sPos = worldToScreen _pos;
|
||||||
|
if(count _sPos > 0) then {
|
||||||
|
_disSq = (((_cursorScreenPos select 0) - (_sPos select 0))^2 + ((_cursorScreenPos select 1) - (_sPos select 1))^2);
|
||||||
|
if(_disSq < 0.0125 && _disSq < _closestDistance) then {
|
||||||
|
_closestDistance = _disSq;
|
||||||
|
_closestSelection = _forEachIndex;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach GVAR(currentOptions);
|
||||||
|
|
||||||
|
if(_closestSelection != -1) then {
|
||||||
|
|
||||||
|
_closest = GVAR(currentOptions) select _closestSelection;
|
||||||
|
|
||||||
|
_pos = _closest select 1;
|
||||||
|
_cTime = diag_tickTime;
|
||||||
|
_delta = _cTime - GVAR(lastTime);
|
||||||
|
GVAR(lastTime) = _cTime;
|
||||||
|
GVAR(rotationAngle) = GVAR(rotationAngle) + (180*_delta);
|
||||||
|
if(GVAR(rotationAngle) > 360) then {
|
||||||
|
GVAR(rotationAngle) = GVAR(rotationAngle) - 360;
|
||||||
|
};
|
||||||
|
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,.75], _pos, 0.6*SafeZoneW, 0.6*SafeZoneW, GVAR(rotationAngle), "", 0.5, 0.025, "TahomaB"];
|
||||||
|
_foundTarget = true;
|
||||||
|
GVAR(actionSelected) = true;
|
||||||
|
GVAR(selectedTarget) = (_closest select 0) select 0;
|
||||||
|
GVAR(selectedAction) = ((_closest select 0) select 1) select 3;
|
||||||
|
_misMatch = false;
|
||||||
|
_hoverPath = (_closest select 2);
|
||||||
|
if((count GVAR(lastPath)) != (count _hoverPath)) then {
|
||||||
|
_misMatch = true;
|
||||||
|
} else {
|
||||||
|
{
|
||||||
|
if(_x != (_hoverPath select _forEachIndex)) exitWith {
|
||||||
|
_misMatch = true;
|
||||||
|
};
|
||||||
|
} forEach GVAR(lastPath);
|
||||||
|
};
|
||||||
|
|
||||||
|
if(_misMatch) then {
|
||||||
|
GVAR(lastPath) = _hoverPath;
|
||||||
|
GVAR(startHoverTime) = diag_tickTime;
|
||||||
|
GVAR(expanded) = false;
|
||||||
|
} else {
|
||||||
|
if(!GVAR(expanded) && diag_tickTime-GVAR(startHoverTime) > 0.5) then {
|
||||||
|
GVAR(expanded) = true;
|
||||||
|
GVAR(menuDepthPath) = +GVAR(lastPath);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selected_ca.paa", [1,0,0,1], _cursorPos2, 1, 1, 0, "", 0.5, 0.025, "TahomaB"];
|
||||||
|
};
|
||||||
|
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);
|
||||||
|
};
|
||||||
|
GVAR(iconCtrls) resize GVAR(iconCount);
|
||||||
|
GVAR(iconCount) = 0;
|
28
addons/interact_menu/functions/fnc_renderIcon.sqf
Normal file
28
addons/interact_menu/functions/fnc_renderIcon.sqf
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
//fnc_renderIcon.sqf
|
||||||
|
#include "script_component.hpp"
|
||||||
|
#define DEFAULT_ICON QUOTE(\z\ace\addons\interaction\ui\dot_ca.paa)
|
||||||
|
private ["_color", "_pos", "_sPos", "_ctrl", "_icon"];
|
||||||
|
_text = _this select 0;
|
||||||
|
_color = _this select 1;
|
||||||
|
_pos = _this select 2;
|
||||||
|
_icon = _this select 6;
|
||||||
|
_sPos = worldToScreen _pos;
|
||||||
|
if(count _sPos > 0) then {
|
||||||
|
// player sideChat format["render!"];
|
||||||
|
if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then {
|
||||||
|
GVAR(iconCtrls) pushBack ((findDisplay 46) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]);
|
||||||
|
};
|
||||||
|
_ctrl = GVAR(iconCtrls) select GVAR(iconCount);
|
||||||
|
GVAR(iconCount) = GVAR(iconCount) + 1;
|
||||||
|
if(_icon == "") then {
|
||||||
|
_icon = DEFAULT_ICON;
|
||||||
|
};
|
||||||
|
_text = "<img image='" + _icon + "' />" + _text;
|
||||||
|
_ctrl ctrlSetStructuredText (parseText _text);
|
||||||
|
_ctrl ctrlSetPosition [(_sPos select 0)-(0.011*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.4*SafeZoneW, 0.025*SafeZoneW];
|
||||||
|
_ctrl ctrlSetForegroundColor _color;
|
||||||
|
_opacity = _color select 3;
|
||||||
|
_control ctrlSetTextColor _color;
|
||||||
|
// _ctrl ctrlSetBackgroundColor [1,0,0,1];
|
||||||
|
_ctrl ctrlCommit 0;
|
||||||
|
};
|
63
addons/interact_menu/functions/fnc_renderMenu.sqf
Normal file
63
addons/interact_menu/functions/fnc_renderMenu.sqf
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
//fnc_renderMenu.sqf
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_object", "_actionData", "_distance", "_index", "_pos", "_cursorScreenPos", "_path", "_menuDepth", "_opacity", "_currentRenderDepth", "_radialOffset", "_active", "_x", "_offset", "_newPos", "_forEachIndex"];
|
||||||
|
|
||||||
|
_object = _this select 0;
|
||||||
|
_actionData = _this select 1;
|
||||||
|
_distance = _actionData select 5;
|
||||||
|
_index = _this select 2;
|
||||||
|
|
||||||
|
if((count _this) > 3) then {
|
||||||
|
_pos = _this select 3;
|
||||||
|
} else {
|
||||||
|
if(typeName (_actionData select 2) == "ARRAY") then {
|
||||||
|
_pos = _object modelToWorld (_actionData select 2);
|
||||||
|
} else {
|
||||||
|
_pos = _object modelToWorld (_object selectionPosition (_actionData select 2));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
_cursorScreenPos = (positionCameraToWorld [0, 0, 0]);
|
||||||
|
if(_cursorScreenPos distance _pos <= _distance) then {
|
||||||
|
_path = [];
|
||||||
|
if((count _this) > 4) then {
|
||||||
|
_path = +(_this select 4);
|
||||||
|
};
|
||||||
|
_menuDepth = (count GVAR(menuDepthPath));
|
||||||
|
|
||||||
|
_opacity = 1;
|
||||||
|
if(_menuDepth > 0 && _index != (GVAR(menuDepthPath) select (GVAR(renderDepth)))) then {
|
||||||
|
_opacity = ((GVAR(renderDepth)/_menuDepth)) max 0.25;
|
||||||
|
};
|
||||||
|
_path set[(count _path), _index];
|
||||||
|
// player sideChat format["r: %1", _actionData select 2];
|
||||||
|
[_actionData select 0, [1,1,1,_opacity], _pos, 1, 1, 0, _actionData select 1, 0.5, 0.025, "TahomaB"] call FUNC(renderIcon);
|
||||||
|
GVAR(currentOptions) set[(count GVAR(currentOptions)), [_this, _pos, _path]];
|
||||||
|
_currentRenderDepth = -1;
|
||||||
|
_currentRenderDepth = GVAR(renderDepth);
|
||||||
|
GVAR(renderDepth) = GVAR(renderDepth) + 1;
|
||||||
|
if(_index == (GVAR(menuDepthPath) select (GVAR(renderDepth)-1))) then {
|
||||||
|
_radialOffset = 0;
|
||||||
|
{
|
||||||
|
// if(_index != (GVAR(menuDepthPath) select (GVAR(renderDepth)))) then {
|
||||||
|
this = _object;
|
||||||
|
_target = _object;
|
||||||
|
_player = ACE_player;
|
||||||
|
_active = [_object, ACE_player] call (_x select 4);
|
||||||
|
diag_log text format["_active: %1: %2", (_x select 0), _active];
|
||||||
|
if(_active) then {
|
||||||
|
_offset = [GVAR(vecLineMap), (270*(GVAR(renderDepth)%2))-(_radialOffset*45)] call FUNC(rotateVectLine);
|
||||||
|
_newPos = [
|
||||||
|
(_pos select 0) + ((_offset select 0)*0.08*_distance),
|
||||||
|
(_pos select 1) + ((_offset select 1)*0.08*_distance),
|
||||||
|
(_pos select 2) + ((_offset select 2)*0.08*_distance)
|
||||||
|
];
|
||||||
|
// drawLine3D [_pos, _newPos, [1,0,0,1]];
|
||||||
|
[_object, _x, _forEachIndex, _newPos, _path] call FUNC(renderMenu);
|
||||||
|
_radialOffset = _radialOffset + 1;
|
||||||
|
};
|
||||||
|
// };
|
||||||
|
} forEach (_actionData select 6);
|
||||||
|
};
|
||||||
|
GVAR(renderDepth) = GVAR(renderDepth) - 1;
|
||||||
|
};
|
40
addons/interact_menu/functions/fnc_rotateVectLine.sqf
Normal file
40
addons/interact_menu/functions/fnc_rotateVectLine.sqf
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
//fnc_rotateVectLine.sqf
|
||||||
|
#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;
|
39
addons/interact_menu/functions/fnc_rotateVectLineGetMap.sqf
Normal file
39
addons/interact_menu/functions/fnc_rotateVectLineGetMap.sqf
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
//fnc_rotateVectLineGetMap.sqf
|
||||||
|
#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]
|
6
addons/interact_menu/functions/fnc_setToRender.sqf
Normal file
6
addons/interact_menu/functions/fnc_setToRender.sqf
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
//fnc_setToRender.sqf
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_options"];
|
||||||
|
_object = _this select 0;
|
||||||
|
_options = _this select 1;
|
1
addons/interact_menu/functions/script_component.hpp
Normal file
1
addons/interact_menu/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "\z\ace\addons\interact_menu\script_component.hpp"
|
12
addons/interact_menu/script_component.hpp
Normal file
12
addons/interact_menu/script_component.hpp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#define COMPONENT interact_menu
|
||||||
|
#include "\z\ace\addons\main\script_mod.hpp"
|
||||||
|
|
||||||
|
#ifdef DEBUG_ENABLED_INTERACT_MENU
|
||||||
|
#define DEBUG_MODE_FULL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG_SETTINGS_INTERACT_MENU
|
||||||
|
#define DEBUG_SETTINGS DEBUG_SETTINGS_INTERACT_MENU
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "\z\ace\addons\main\script_macros.hpp"
|
@ -44,3 +44,7 @@ PREP(showMouseHint);
|
|||||||
PREP(sortOptionsByPriority);
|
PREP(sortOptionsByPriority);
|
||||||
PREP(tapShoulder);
|
PREP(tapShoulder);
|
||||||
PREP(updateTooltipPosition);
|
PREP(updateTooltipPosition);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user