Merge remote-tracking branch 'refs/remotes/origin/master' into vehicleInteractionDistance

This commit is contained in:
PabstMirror
2016-06-14 19:36:45 -05:00
2181 changed files with 103293 additions and 92389 deletions

View File

@ -30,10 +30,11 @@ if (_typeNum == 0) then {
[_objectType] call FUNC(compileMenuSelfAction);
};
private _varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType];
private _actionTrees = missionNamespace getVariable [_varName, []];
if((count _actionTrees) == 0) then {
missionNamespace setVariable [_varName, _actionTrees];
private _namespace = [GVAR(ActNamespace), GVAR(ActSelfNamespace)] select _typeNum;
private _actionTrees = _namespace getVariable _objectType;
if (isNil "_actionTrees") then {
_actionTrees = [];
_namespace setVariable [_objectType, _actionTrees];
};
if (_parentPath isEqualTo ["ACE_MainActions"]) then {

View File

@ -18,8 +18,12 @@
params ["_objectType", "_typeNum"];
private _varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType];
private _actionTrees = missionNamespace getVariable [_varName, []];
private _namespace = [GVAR(ActNamespace), GVAR(ActSelfNamespace)] select _typeNum;
private _actionTrees = _namespace getVariable _objectType;
if (isNil "_actionTrees") then {
_actionTrees = [];
};
private _parentNode = [_actionTrees, ["ACE_MainActions"]] call FUNC(findActionNode);
if (isNil {_parentNode}) then {

View File

@ -18,10 +18,10 @@ private _objectType = _target;
if (_target isEqualType objNull) then {
_objectType = typeOf _target;
};
private _actionsVarName = format [QGVAR(Act_%1), _objectType];
private _namespace = GVAR(ActNamespace);
// Exit if the action menu is already compiled for this class
if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {};
if !(isNil {_namespace getVariable _objectType}) exitWith {};
private _recurseFnc = {
params ["_actionsCfg", "_parentDistance"];
@ -104,7 +104,7 @@ private _actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_Actions
TRACE_1("Building ACE_Actions",_objectType);
private _actions = [_actionsCfg, 0] call _recurseFnc;
missionNamespace setVariable [_actionsVarName, _actions];
_namespace setVariable [_objectType, _actions];
/*
[

View File

@ -18,10 +18,10 @@ private _objectType = _target;
if (_target isEqualType objNull) then {
_objectType = typeOf _target;
};
private _actionsVarName = format [QGVAR(SelfAct_%1), _objectType];
private _namespace = GVAR(ActSelfNamespace);
// Exit if the action menu is already compiled for this class
if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {};
if !(isNil {_namespace getVariable _objectType}) exitWith {};
private _recurseFnc = {
@ -125,4 +125,4 @@ private _actions = [
]
];
missionNamespace setVariable [_actionsVarName, _actions];
_namespace setVariable [_objectType, _actions];

View File

@ -32,7 +32,7 @@ if (_menuType == 0) then {
GVAR(keyDown) = false;
GVAR(keyDownSelfAction) = true;
};
GVAR(keyDownTime) = ACE_diagTime;
GVAR(keyDownTime) = diag_tickTime;
GVAR(openedMenuType) = _menuType;
GVAR(lastTimeSearchedActions) = -1000;
GVAR(ParsedTextCached) = [];
@ -77,21 +77,31 @@ if (GVAR(useCursorMenu)) then {
GVAR(selfMenuOffset) = (AGLtoASL (positionCameraToWorld [0, 0, 2])) vectorDiff (AGLtoASL (positionCameraToWorld [0, 0, 0]));
if (GVAR(menuAnimationSpeed) > 0) then {
//Auto expand the first level when self, mounted vehicle or zeus (skips the first animation as there is only one choice)
if (GVAR(openedMenuType) == 0) then {
if (isNull curatorCamera) then {
if (vehicle ACE_player != ACE_player) then {
GVAR(menuDepthPath) = [["ACE_SelfActions", (vehicle ACE_player)]];
};
} else {
GVAR(menuDepthPath) = [["ACE_ZeusActions", (getAssignedCuratorLogic player)]];
//Auto expand the first level when self, mounted vehicle or zeus (skips the first animation as there is only one choice)
if (GVAR(openedMenuType) == 0) then {
if (isNull curatorCamera) then {
if (vehicle ACE_player != ACE_player) then {
GVAR(menuDepthPath) = [["ACE_SelfActions", (vehicle ACE_player)]];
GVAR(expanded) = true;
GVAR(expandedTime) = diag_tickTime;
GVAR(lastPath) = +GVAR(menuDepthPath);
GVAR(startHoverTime) = -1000;
};
} else {
GVAR(menuDepthPath) = [["ACE_SelfActions", ACE_player]];
GVAR(menuDepthPath) = [["ACE_ZeusActions", (getAssignedCuratorLogic player)]];
GVAR(expanded) = true;
GVAR(expandedTime) = diag_tickTime;
GVAR(lastPath) = +GVAR(menuDepthPath);
GVAR(startHoverTime) = -1000;
};
};
["interactMenuOpened", [_menuType]] call EFUNC(common,localEvent);
} else {
GVAR(menuDepthPath) = [["ACE_SelfActions", ACE_player]];
GVAR(expanded) = true;
GVAR(expandedTime) = diag_tickTime;
GVAR(lastPath) = +GVAR(menuDepthPath);
GVAR(startHoverTime) = -1000;
};
["ace_interactMenuOpened", [_menuType]] call CBA_fnc_localEvent;
true

View File

@ -28,7 +28,7 @@ if(GVAR(actionSelected)) then {
private _target = GVAR(selectedTarget);
// Clear the conditions caches
["clearConditionCaches", []] call EFUNC(common,localEvent);
[QGVAR(clearConditionCaches), []] call CBA_fnc_localEvent;
// exit scope if selecting an action on key release is disabled
if (!(GVAR(actionOnKeyRelease)) && !_calledByClicking) exitWith {};
@ -40,11 +40,11 @@ if(GVAR(actionSelected)) then {
[_target, _player, _actionData select 6] call (_actionData select 3);
// Clear the conditions caches again if the action was performed
["clearConditionCaches", []] call EFUNC(common,localEvent);
[QGVAR(clearConditionCaches), []] call CBA_fnc_localEvent;
};
};
["interactMenuClosed", [GVAR(openedMenuType)]] call EFUNC(common,localEvent);
["ace_interactMenuClosed", [GVAR(openedMenuType)]] call CBA_fnc_localEvent;
GVAR(keyDown) = false;
GVAR(keyDownSelfAction) = false;

View File

@ -19,18 +19,20 @@
params ["_objectType", "_typeNum", "_fullPath"];
private ["_res","_varName","_actionTrees", "_parentNode", "_found"];
_res = _fullPath call FUNC(splitPath);
private _res = _fullPath call FUNC(splitPath);
_res params ["_parentPath", "_actionName"];
_varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType];
_actionTrees = missionNamespace getVariable [_varName, []];
private _namespace = [GVAR(ActNamespace), GVAR(ActSelfNamespace)] select _typeNum;
private _actionTrees = _namespace getVariable _objectType;
if (isNil "_actionTrees") then {
_actionTrees = [];
};
_parentNode = [_actionTrees, _parentPath] call FUNC(findActionNode);
private _parentNode = [_actionTrees, _parentPath] call FUNC(findActionNode);
if (isNil {_parentNode}) exitWith {};
// Iterate through children of the father
_found = false;
private _found = false;
{
if (((_x select 0) select 0) == _actionName) exitWith {
TRACE_2("Deleting Action", _forEachIndex, _x);

View File

@ -51,12 +51,12 @@ if (GVAR(openedMenuType) >= 0) then {
private _closest = GVAR(currentOptions) select _closestSelection;
_closest params ["_action", "_sPos", "_hoverPath"];
private _cTime = ACE_diagTime;
private _cTime = diag_tickTime;
private _delta = _cTime - GVAR(lastTime);
GVAR(lastTime) = _cTime;
GVAR(rotationAngle) = (GVAR(rotationAngle) + (270*_delta)) mod 360;
[_sPos, format [QUOTE(PATHTOF(ui\selector%1.paa)), floor (((abs GVAR(rotationAngle)) mod 90) / 6)]] call FUNC(renderSelector);
[_sPos, format [QPATHTOF(ui\selector%1.paa), floor (((abs GVAR(rotationAngle)) mod 90) / 6)]] call FUNC(renderSelector);
_foundTarget = true;
GVAR(actionSelected) = true;
@ -65,17 +65,17 @@ if (GVAR(openedMenuType) >= 0) then {
private _misMatch = !(GVAR(lastPath) isEqualTo _hoverPath);
if(_misMatch && {ACE_diagTime-GVAR(expandedTime) > linearConversion [0, 2, GVAR(menuAnimationSpeed), 0.25, 0.08333333]}) then {
GVAR(startHoverTime) = ACE_diagTime;
if(_misMatch && {diag_tickTime-GVAR(expandedTime) > linearConversion [0, 2, GVAR(menuAnimationSpeed), 0.25, 0.08333333]}) then {
GVAR(startHoverTime) = diag_tickTime;
GVAR(lastPath) = _hoverPath;
GVAR(expanded) = false;
} else {
if(!GVAR(expanded) && {ACE_diagTime-GVAR(startHoverTime) > linearConversion [0, 2, GVAR(menuAnimationSpeed), 0.25, 0.08333333]}) then {
if(!GVAR(expanded) && {diag_tickTime-GVAR(startHoverTime) > linearConversion [0, 2, GVAR(menuAnimationSpeed), 0.25, 0.08333333]}) then {
GVAR(expanded) = true;
// Start the expanding menu animation only if the user is not going up the menu
if !([GVAR(menuDepthPath),GVAR(lastPath)] call FUNC(isSubPath)) then {
GVAR(expandedTime) = ACE_diagTime;
GVAR(expandedTime) = diag_tickTime;
};
GVAR(menuDepthPath) = +GVAR(lastPath);
@ -97,7 +97,7 @@ if (GVAR(openedMenuType) >= 0) then {
private _target = GVAR(selectedTarget);
// Clear the conditions caches
["clearConditionCaches", []] call EFUNC(common,localEvent);
[QGVAR(clearConditionCaches), []] call CBA_fnc_localEvent;
// Check the action conditions
private _actionData = GVAR(selectedAction) select 0;
@ -106,7 +106,7 @@ if (GVAR(openedMenuType) >= 0) then {
[_target, _player, _actionData select 6] call (_actionData select 3);
// Clear the conditions caches again if the action was performed
["clearConditionCaches", []] call EFUNC(common,localEvent);
[QGVAR(clearConditionCaches), []] call CBA_fnc_localEvent;
};
};
};
@ -116,8 +116,6 @@ if (GVAR(openedMenuType) >= 0) then {
if(!_foundTarget && GVAR(actionSelected)) then {
GVAR(actionSelected) = false;
GVAR(expanded) = false;
GVAR(lastPath) = [];
};
for "_i" from GVAR(iconCount) to (count GVAR(iconCtrls))-1 do {
ctrlDelete (GVAR(iconCtrls) select _i);

View File

@ -24,7 +24,7 @@ private _fnc_renderNearbyActions = {
#define MAXINTERACTOBJECTS 3
GVAR(foundActions) = [];
GVAR(lastTimeSearchedActions) = ACE_diagTime;
GVAR(lastTimeSearchedActions) = diag_tickTime;
private _numInteractObjects = 0;
private _nearestObjects = nearestObjects [ACE_player, ["All"], 13];
@ -54,8 +54,9 @@ private _fnc_renderNearbyActions = {
} count GVAR(objectActionList);
// Iterate through base level class actions and render them if appropiate
private _actionsVarName = format [QGVAR(Act_%1), typeOf _target];
private _classActions = missionNamespace getVariable [_actionsVarName, []];
private _namespace = GVAR(ActNamespace);
private _classActions = _namespace getVariable typeOf _target;
{
private _action = _x;
// Try to render the menu
@ -95,8 +96,8 @@ private _fnc_renderSelfActions = {
GVAR(objectActionList) = _target getVariable [QGVAR(selfActions), []];
// Iterate through base level class actions and render them if appropiate
private _actionsVarName = format [QGVAR(SelfAct_%1), typeOf _target];
private _classActions = missionNamespace getVariable [_actionsVarName, []];
private _namespace = GVAR(ActSelfNamespace);
private _classActions = _namespace getVariable typeOf _target;
private _pos = if !(GVAR(useCursorMenu)) then {
//Convert to ASL, add offset and then convert back to AGL (handles waves when over water)
@ -127,7 +128,7 @@ GVAR(collectedActionPoints) resize 0;
if (GVAR(openedMenuType) == 0) then {
if (isNull curatorCamera) then {
if (vehicle ACE_player == ACE_player) then {
if (ACE_diagTime > GVAR(lastTimeSearchedActions) + 0.20) then {
if (diag_tickTime > GVAR(lastTimeSearchedActions) + 0.20) then {
// Once every 0.2 secs, collect nearby objects active and visible action points and render them
call _fnc_renderNearbyActions;
} else {

View File

@ -99,8 +99,8 @@ if (GVAR(UseListMenu)) then {
// Animate menu scale
if (_menuInSelectedPath && {_menuDepth == count _path}) then {
_scaleX = _scaleX * (0.3 + 0.7 * (((ACE_diagTime - GVAR(expandedTime)) * linearConversion [0, 2, GVAR(menuAnimationSpeed), 8, 16]) min 1));
_scaleY = _scaleY * (0.3 + 0.7 * (((ACE_diagTime - GVAR(expandedTime)) * linearConversion [0, 2, GVAR(menuAnimationSpeed), 8, 16]) min 1));
_scaleX = _scaleX * (0.3 + 0.7 * (((diag_tickTime - GVAR(expandedTime)) * linearConversion [0, 2, GVAR(menuAnimationSpeed), 8, 16]) min 1));
_scaleY = _scaleY * (0.3 + 0.7 * (((diag_tickTime - GVAR(expandedTime)) * linearConversion [0, 2, GVAR(menuAnimationSpeed), 8, 16]) min 1));
};
private _target = _actionObject;