- 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
This commit is contained in:
Nicolás Badano
2015-03-02 23:29:57 -03:00
parent 094be22a19
commit 83572921ae
12 changed files with 230 additions and 195 deletions

View File

@ -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 {