interact_menu: add headers

This commit is contained in:
Nicolás Badano 2015-02-21 17:11:03 -03:00
parent 908f23a78f
commit 6b7f649244
14 changed files with 190 additions and 84 deletions

View File

@ -1,9 +1,9 @@
/*
* Author: commy2
* Add an ACE action to an object. Note: This function is NOT global.
* Author: commy2 and NouberNou
* Add an ACE action to an object or inside a parent action. Note: This function is NOT global.
*
* Argument:
* 0: Object the action should be assigned to <OBJECT>
* 0: Object the action should be assigned to or parent action <OBJECT> or <ARRAY>
* 1: Name of the action shown in the menu <STRING>
* 2: Icon <STRING>
* 3: Position (Position or Selection Name) <POSITION> or <STRING>
@ -18,15 +18,10 @@
*/
#include "script_component.hpp"
private ["_object", "_displayName", "_icon", "_position", "_statement", "_condition", "_distance", "_actions", "_entry"];
_object = _this select 0;
_displayName = _this select 1;
_icon = _this select 2;
_position = _this select 3;
_statement = _this select 4;
_condition = _this select 5;
_distance = _this select 6;
EXPLODE_7_PVT(_this,_object,_displayName,_icon,_position,_statement,_condition,_distance);
private ["_actions","_entry"];
_actions = [];
if(IS_OBJECT(_object)) then {
_actions = _object getVariable [QUOTE(GVAR(actionData)), []];
@ -51,4 +46,4 @@ _entry = [
];
GVAR(uidCounter) = GVAR(uidCounter) + 1;
_actions pushBack _entry;
_entry;
_entry;

View File

@ -1,23 +1,18 @@
//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;
*/
* Author: NouberNou
* Compile the action menu from config for a given object.
*
* Argument:
* 0: Object <OBJECT>
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp";
EXPLODE_1_PVT(_this,_object);
/*
[
@ -33,6 +28,8 @@ enableInside = 1;
]
*/
private ["_objectType","_recurseFnc","_actions"];
_objectType = typeOf _object;
_actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_Actions";
@ -73,7 +70,6 @@ _recurseFnc = {
_children,
GVAR(uidCounter)
];
diag_log _entry;
GVAR(uidCounter) = GVAR(uidCounter) + 1;
_actions pushBack _entry;
};

View File

@ -1,21 +1,18 @@
//fnc_compileMenuSelfAction.sqf
#include "script_component.hpp";
// diag_log text format["COMPILE ACTIONS: %1", _this];
_object = _this select 0;
_objectType = typeOf _object;
/*
displayName = "$STR_ACE_Hearing_Earbuds_On";
condition = QUOTE( !([_player] call FUNC(hasEarPlugsIn)) && {'ACE_EarBuds' in items _player} );
statement = QUOTE( [_player] call FUNC(putInEarPlugs) );
showDisabled = 0;
priority = 2.5;
icon = PATHTOF(UI\ACE_earplugs_x_ca.paa);
hotkey = "E";
enableInside = 1;
*/
* Author: NouberNou and CAA-Picard
* Compile the self action menu from config for a given object.
*
* Argument:
* 0: Object <OBJECT>
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp";
EXPLODE_1_PVT(_this,_object);
/*
[
@ -31,6 +28,8 @@ enableInside = 1;
]
*/
private ["_objectType","_recurseFnc","_actions"];
_objectType = typeOf _object;
_actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_SelfActions";
@ -56,14 +55,7 @@ _recurseFnc = {
_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_SelfActions" >> _childMenuName;
_children = [_childMenuCfg] call _recurseFnc;
};
_children = [_entryCfg] call _recurseFnc;
_entry = [
_displayName,
_icon,
@ -83,6 +75,7 @@ _recurseFnc = {
_actions = [_actionsCfg] call _recurseFnc;
// Create a master action to base on self action
_actions = [[
"Self Actions",
"\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa",

View File

@ -1,4 +1,15 @@
//fnc_keyDown.sqf
/*
* Author: NouberNou
* Handle interaction key down
*
* Argument:
* None
*
* Return value:
* true <BOOL>
*
* Public: No
*/
#include "script_component.hpp"
if(!GVAR(keyDown)) then {

View File

@ -1,4 +1,15 @@
//fnc_keyDownSelfAction.sqf
/*
* Author: NouberNou
* Handle self action key down
*
* Argument:
* None
*
* Return value:
* true <BOOL>
*
* Public: No
*/
#include "script_component.hpp"
if(!GVAR(keyDownSelfAction)) then {

View File

@ -1,4 +1,15 @@
//fnc_keyUpSelfAction.sqf
/*
* Author: NouberNou
* Handle interaction key up
*
* Argument:
* None
*
* Return value:
* true <BOOL>
*
* Public: No
*/
#include "script_component.hpp"
GVAR(keyDown) = false;

View File

@ -1,4 +1,15 @@
//fnc_keyUp.sqf
/*
* Author: NouberNou
* Handle self action key up
*
* Argument:
* None
*
* Return value:
* true <BOOL>
*
* Public: No
*/
#include "script_component.hpp"
GVAR(keyDownSelfAction) = false;

View File

@ -1,9 +1,21 @@
//fnc_probe.sqf
/*
* Author: NouberNou
* Scan de vicinity of the player and collect every interaction available around it on
* the GVAR(toRender) array.
*
* Argument:
* None
*
* Return value:
* None
*
* Public: No
*/
#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];
_nearestObjects = nearestObjects [(getPos ACE_player), ["All"], 100];
GVAR(toRender) = [];
{
@ -36,7 +48,7 @@ if(!GVAR(keyDown)) then {
GVAR(filter) = [];
{
_object = _x select 0;
if(_object distance player > 100) then {
if(_object distance ACE_player > 100) then {
GVAR(filter) set[(count GVAR(filter)), _forEachIndex];
};
} forEach GVAR(toRender);

View File

@ -1,24 +1,21 @@
/*
* Author: commy2
*
* Add an ACE action to an object. Note: This function is global.
* Author: commy2 and NouberNou
* Remove an action from an object
*
* Argument:
* 0: Object the action should be assigned to (Object)
* 1: Entry to remove (Array or Number)
* 0: Object the action should be assigned to <OBJECT>
* 1: Entry to remove <ARRAY> or <NUMBER>
*
* Return value:
* ID of the action (used to remove it later).
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_object", "_entry", "_found", "_actions", "_searchFnc"];
_object = _this select 0;
_entry = _this select 1;
EXPLODE_2_PVT(_this,_object,_entry);
private ["_found", "_actions", "_searchFnc"];
if(!IS_OBJECT(_object)) exitWith {false};
@ -50,4 +47,4 @@ _searchFnc = {
_actions = [_actions, _entry] call _searchFnc;
_object setVariable [QUOTE(GVAR(actionData)), _actions];
_found;
_found;

View File

@ -1,4 +1,15 @@
//fnc_render.sqf
/*
* Author: NouberNou and CAA-Picard
* Render all available nearby interactions
*
* Argument:
* None
*
* Return value:
* None
*
* Public: No
*/
#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"];

View File

@ -1,4 +1,21 @@
//fnc_renderIcon.sqf
/*
* Author: NouberNou and CAA-Picard
* Render a single interaction icon
*
* Argument:
* 0: Text <STRING>
* 1: Color <STRING>
* 2: 3d position ASL <ARRAY>
* 3: ?
* 4: ?
* 5: ?
* 6: Icon <STRING>
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp"
#define DEFAULT_ICON QUOTE(\z\ace\addons\interaction\ui\dot_ca.paa)
private ["_color", "_pos", "_sPos", "_ctrl", "_icon"];
@ -6,11 +23,11 @@ _text = _this select 0;
_color = _this select 1;
_pos = _this select 2;
_icon = _this select 6;
//systemChat format ["Drawing icon %1", _text];
_sPos = worldToScreen _pos;
// _sPos = _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)]);
};

View File

@ -1,4 +1,20 @@
//fnc_renderMenu.sqf
/*
* Author: NouberNou and CAA-Picard
* Render a interaction menu
*
* Argument:
* 0: Object <OBJECT>
* 1: Action data <ARRAY>
* 2: ?
* 3: Angle range available for rendering <ARRAY>
* 4: 3D position <ARRAY> (Optional)
* 5: Path of UIDs <ARRAY> (Optional)
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_object", "_actionData", "_distance", "_uid", "_pos", "_cursorScreenPos", "_path", "_menuDepth", "_opacity", "_currentRenderDepth", "_radialOffset", "_active", "_x", "_offset", "_newPos", "_forEachIndex"];

View File

@ -1,4 +1,16 @@
//fnc_rotateVectLine.sqf
/*
* Author: NouberNou
* Rotate a vector line (?)
*
* Argument:
* 0: Map <ARRAY>
* 1: Theta <ARRAY>
*
* Return value:
* 0: ?? <ARRAY>
*
* Public: No
*/
#include "script_component.hpp"
private ["_theta", "_p", "_map", "_p1", "_p2", "_q1", "_q2", "_u", "_d"];

View File

@ -1,4 +1,17 @@
//fnc_rotateVectLineGetMap.sqf
/*
* Author: NouberNou
* ?
*
* Argument:
* 0: p0 <ARRAY>
* 1: p1 <ARRAY>
* 2: p2 <ARRAY>
*
* Return value:
* Map <ARRAY>
*
* Public: No
*/
#include "script_component.hpp"
private ["_p", "_p1", "_p2", "_q1", "_q2", "_u", "_d"];