Updated parameterization in Interact_menu module.

This commit is contained in:
Michael Braun 2015-08-05 00:46:57 +02:00
parent 275b0c4300
commit 77e62946ae
23 changed files with 67 additions and 96 deletions

View File

@ -19,7 +19,7 @@
*/
#include "script_component.hpp"
EXPLODE_4_PVT(_this,_objectType,_typeNum,_parentPath,_action);
params ["_objectType", "_typeNum", "_parentPath", "_action"];
// Ensure the config menu was compiled first
if (_typeNum == 0) then {

View File

@ -19,7 +19,7 @@
*/
#include "script_component.hpp"
EXPLODE_4_PVT(_this,_object,_typeNum,_parentPath,_action);
params ["_object", "_typeNum", "_parentPath", "_action"];
private ["_varName","_actionList"];
_varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum;

View File

@ -14,8 +14,8 @@
*/
#include "script_component.hpp"
EXPLODE_3_PVT(_this,_object,_origAction,_parentPath);
EXPLODE_2_PVT(_origAction,_origActionData,_origActionChildren);
params ["_object", "_origAction", "_parentPath"];
_origAction params ["_origActionData", "_origActionChildren"];
private ["_target","_player","_fullPath","_activeChildren","_dynamicChildren","_action","_actionData","_x"];

View File

@ -12,7 +12,7 @@
*/
#include "script_component.hpp";
EXPLODE_1_PVT(_this,_target);
params ["_target"];
private ["_objectType","_actionsVarName","_isMan"];
_objectType = _target;
@ -29,7 +29,7 @@ if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {};
private "_recurseFnc";
_recurseFnc = {
private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_position", "_condition", "_showDisabled", "_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren", "_modifierFunction"];
EXPLODE_1_PVT(_this,_actionsCfg);
params ["_actionsCfg"];
_actions = [];
{

View File

@ -12,7 +12,7 @@
*/
#include "script_component.hpp";
EXPLODE_1_PVT(_this,_target);
params ["_target"];
private ["_objectType","_actionsVarName","_isMan"];
_objectType = _target;
@ -30,7 +30,7 @@ private "_recurseFnc";
_recurseFnc = {
private ["_actions", "_displayName", "_icon", "_statement", "_condition", "_showDisabled",
"_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren", "_modifierFunction"];
EXPLODE_1_PVT(_this,_actionsCfg);
params ["_actionsCfg"];
_actions = [];
{

View File

@ -19,7 +19,7 @@ private "_recurseFnc";
_recurseFnc = {
private ["_actions", "_displayName", "_icon", "_statement", "_condition", "_showDisabled",
"_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren", "_modifierFunction"];
EXPLODE_1_PVT(_this,_actionsCfg);
params ["_actionsCfg"];
_actions = [];
{

View File

@ -26,55 +26,30 @@
*/
#include "script_component.hpp"
EXPLODE_5_PVT(_this,_actionName,_displayName,_icon,_statement,_condition);
params [
"_actionName",
"_displayName",
"_icon",
"_statement",
"_condition",
["_insertChildren", {}],
["_customParams", []],
["_position", {[0, 0, 0]}],
["_distance", 2],
["_params", [false, false, false, false, false]],
["_modifierFunction", {}]
];
// IGNORE_PRIVATE_WARNING(_target);
private ["_insertChildren","_customParams","_position","_distance","_params", "_modifierFunction"];
_insertChildren = if (count _this > 5) then {
_this select 5
} else {
{}
};
_customParams = if (count _this > 6) then {
_this select 6
} else {
[]
};
_position = if (count _this > 7) then {
if (typeName (_this select 7) == "STRING") then {
_position = if (typeName (_position) == "STRING") then {
// If the action is set to a selection, create the suitable code
compile format ["_target selectionPosition '%1'", _this select 7];
compile format ["_target selectionPosition '%1'", _position];
} else {
if (typeName (_this select 7) == "ARRAY") then {
if (typeName (_position) == "ARRAY") then {
// If the action is set to a array position, create the suitable code
compile format ["%1", _this select 7];
compile format ["%1", _position];
} else {
_this select 7
_position;
};
}
} else {
{[0,0,0]}
};
_distance = if (count _this > 8) then {
_this select 8
} else {
2
};
_params = if (count _this > 9) then {
_this select 9
} else {
[false,false,false,false,false]
};
_modifierFunction = if (count _this > 10) then {
_this select 10
} else {
{}
};
[

View File

@ -1,11 +1,7 @@
// by commy2
#include "script_component.hpp"
private ["_ctrl", "_index", "_text"];
_ctrl = _this select 0;
_index = _this select 1;
_text = _this select 2;
params ["_ctrl", "_index", "_text"];
//systemChat str (_text != ARR_SELECT(GVAR(ParsedTextCached),_index,"-1"));

View File

@ -17,7 +17,7 @@
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_actionTreeList,_parentPath);
params ["_actionTreeList", "_parentPath"];
private ["_parentNode", "_foundParentNode", "_fnc_findFolder", "_actionTree"];
@ -31,10 +31,10 @@ _parentNode = [[],_actionTreeList];
_foundParentNode = false;
_fnc_findFolder = {
EXPLODE_3_PVT(_this,_parentPath,_level,_actionNode);
params ["_parentPath", "_level", "_actionNode"];
{
EXPLODE_2_PVT(_x,_actionData,_actionChildren);
_x params ["_actionData", "_actionChildren"];
if ((_actionData select 0) isEqualTo (_parentPath select _level)) exitWith {
if (count _parentPath == _level + 1) exitWith {

View File

@ -11,7 +11,7 @@
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_newUnit,_oldUnit);
params ["_newUnit", "_oldUnit"];
// add to new unit
private "_ehid";

View File

@ -13,7 +13,7 @@
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_longPath,_shortPath);
params ["_longPath", "_shortPath"];
private ["_isSubPath","_i"];
_isSubPath = true;

View File

@ -12,7 +12,7 @@
*/
#include "script_component.hpp"
EXPLODE_1_PVT(_this,_menuType);
params ["_menuType"];
if (GVAR(openedMenuType) == _menuType) exitWith {true};

View File

@ -12,8 +12,7 @@
*/
#include "script_component.hpp"
private "_calledByClicking";
_calledByClicking = _this select 1;
params ["_menuType", "_calledByClicking"];
// Exit if there's no menu opened
if (GVAR(openedMenuType) < 0) exitWith {true};

View File

@ -17,11 +17,11 @@
*/
#include "script_component.hpp"
EXPLODE_3_PVT(_this,_objectType,_typeNum,_fullPath);
params ["_objectType", "_typeNum", "_fullPath"];
private ["_res","_varName","_actionTrees", "_parentNode", "_found"];
_res = _fullPath call FUNC(splitPath);
EXPLODE_2_PVT(_res,_parentPath,_actionName);
_res params ["_parentPath", "_actionName"];
_varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType];
_actionTrees = missionNamespace getVariable [_varName, []];

View File

@ -17,11 +17,11 @@
*/
#include "script_component.hpp"
EXPLODE_3_PVT(_this,_object,_typeNum,_fullPath);
params ["_object", "_typeNum", "_fullPath"];
private ["_res","_varName","_actionList"];
_res = _fullPath call FUNC(splitPath);
EXPLODE_2_PVT(_res,_parentPath,_actionName);
_res params ["_parentPath", "_actionName"];
_varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum;
_actionList = _object getVariable [_varName, []];

View File

@ -78,7 +78,7 @@ _fnc_renderNearbyActions = {
_fnc_renderLastFrameActions = {
{
EXPLODE_3_PVT(_x,_target,_action,_objectActionList);
_x params ["_target", "_action", "_objectActionList"];
GVAR(objectActionList) = _objectActionList;
[_target, _action] call FUNC(renderBaseMenu);
@ -176,6 +176,6 @@ if (count GVAR(collectedActionPoints) > 1) then {
// Render the non-ocluded points
{
EXPLODE_3_PVT(_x,_z,_sPos,_activeActionTree);
_x params ["_z", "_sPos", "_activeActionTree"];
[[], _activeActionTree, _sPos, [180,360]] call FUNC(renderMenu);
} forEach GVAR(collectedActionPoints);

View File

@ -18,8 +18,8 @@ BEGIN_COUNTER(fnc_renderBaseMenu)
private ["_distance","_pos","_weaponDir","_ref","_sPos","_activeActionTree", "_line"];
EXPLODE_2_PVT(_this,_object,_baseActionNode);
EXPLODE_1_PVT(_baseActionNode,_actionData);
params ["_object", "_baseActionNode"];
_baseActionNode params ["_actionData"];
_distance = _actionData select 8;

View File

@ -16,7 +16,8 @@
#include "script_component.hpp"
#define DEFAULT_ICON QUOTE(\z\ace\addons\interaction\ui\dot_ca.paa)
private ["_ctrl", "_pos", "_displayNum"];
PARAMS_4(_text,_icon,_sPos,_textSettings);
params ["_text", "_icon", "_sPos", "_textSettings"];
//systemChat format ["Icon %1 - %2,%3", _text, _sPos select 0, _sPos select 1];

View File

@ -17,9 +17,9 @@
private ["_menuInSelectedPath", "_path", "_menuDepth", "_x", "_offset", "_newPos", "_forEachIndex", "_player", "_pos", "_target", "_textSettings"];
EXPLODE_4_PVT(_this,_parentPath,_action,_sPos,_angles);
EXPLODE_3_PVT(_action,_actionData,_activeChildren,_actionObject);
EXPLODE_2_PVT(_angles,_centerAngle,_maxAngleSpan);
params ["_parentPath", "_action", "_sPos", "_angles"];
_action params ["_actionData", "_activeChildren", "_actionObject"];
_angles params ["_centerAngle", "_maxAngleSpan"];
_menuDepth = (count GVAR(menuDepthPath));

View File

@ -13,7 +13,7 @@
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_sPos,_icon);
params ["_sPos", "_icon"];
private ["_displayNum", "_ctrl", "_pos"];

View File

@ -16,7 +16,7 @@ private ["_menuDepth", "_mixColor", "_pathCount", "_row", "_shadowColor", "_text
//Mixes 2 colors (number arrays) and makes a color string "#AARRGGBB" for structured text
_mixColor = {
PARAMS_3(_color1,_color2,_ratio);
params ["_color1", "_color2", "_ratio"];
private ["_return", "_mix", "_index"];
_return = "";
for "_index" from 0 to 3 do {

View File

@ -16,7 +16,7 @@
*/
#include "script_component.hpp"
PARAMS_1(_interactionType);
params ["_interactionType"];
//Ignore if not enabled:
if (!GVAR(addBuildingActions)) exitWith {};
@ -27,8 +27,8 @@ if ((vehicle ACE_player) != ACE_player) exitWith {};
[{
private ["_nearBuidlings", "_typeOfHouse", "_houseBeingScaned", "_actionSet", "_memPoints", "_memPointsActions", "_helperPos", "_helperObject"];
PARAMS_2(_args,_pfID);
EXPLODE_4_PVT(_args,_setPosition,_addedHelpers,_housesScaned,_housesToScanForActions);
params ["_args", "_pfID"];
_args params ["_setPosition", "_addedHelpers", "_housesScaned", "_housesToScanForActions"];
if (!EGVAR(interact_menu,keyDown)) then {
{deleteVehicle _x;} forEach _addedHelpers;
@ -75,7 +75,7 @@ if ((vehicle ACE_player) != ACE_player) exitWith {};
_housesScaned pushBack _houseBeingScaned;
_actionSet = [_typeOfHouse] call FUNC(userActions_getHouseActions);
EXPLODE_2_PVT(_actionSet,_memPoints,_memPointsActions);
_actionSet params ["_memPoints", "_memPointsActions"];
// systemChat format ["Add Actions for [%1] (count %2) @ %3", _typeOfHouse, (count _memPoints), diag_tickTime];
{

View File

@ -12,7 +12,7 @@
*/
#include "script_component.hpp"
PARAMS_1(_typeOfBuilding);
params ["_typeOfBuilding"];
private["_action", "_actionDisplayName", "_actionDisplayNameDefault", "_actionMaxDistance", "_actionOffset", "_actionPath", "_actionPosition", "_building", "_configPath", "_endIndex", "_iconImage", "_index", "_ladders", "_memPointIndex", "_memPoints", "_memPointsActions", "_startIndex"];
@ -24,7 +24,7 @@ _memPointsActions = [];
//Get the offset for a memory point:
_fnc_getMemPointOffset = {
PARAMS_1(_memoryPoint);
params ["_memoryPoint"];
_memPointIndex = _memPoints find _memoryPoint;
_actionOffset = [0,0,0];
if (_memPointIndex == -1) then {
@ -38,14 +38,14 @@ _fnc_getMemPointOffset = {
// Add UserActions for the building:
_fnc_userAction_Statement = {
PARAMS_3(_target,_player,_variable);
EXPLODE_2_PVT(_variable,_actionStatement,_actionCondition);
params ["_target", "_player", "_variable"];
_variable params ["_actionStatement", "_actionCondition"];
this = _target getVariable [QGVAR(building), objNull];
call _actionStatement;
};
_fnc_userAction_Condition = {
PARAMS_3(_target,_player,_variable);
EXPLODE_2_PVT(_variable,_actionStatement,_actionCondition);
params ["_target", "_player", "_variable"];
_variable params ["_actionStatement", "_actionCondition"];
this = _target getVariable [QGVAR(building), objNull];
if (isNull this) exitWith {false};
call _actionCondition;
@ -84,29 +84,29 @@ for "_index" from 0 to ((count _configPath) - 1) do {
// Add Ladder Actions for the building:
_fnc_ladder_ladderUp = {
PARAMS_3(_target,_player,_variable);
EXPLODE_1_PVT(_variable,_ladderIndex);
params ["_target", "_player", "_variable"];
_variable params ["_ladderIndex"];
_building = _target getVariable [QGVAR(building), objNull];
TRACE_3("Ladder Action - UP",_player,_building,_ladderIndex);
_player action ["LadderUp", _building, _ladderIndex, 0];
};
_fnc_ladder_ladderDown = {
PARAMS_3(_target,_player,_variable);
EXPLODE_1_PVT(_variable,_ladderIndex);
params ["_target", "_player", "_variable"];
_variable params ["_ladderIndex"];
_building = _target getVariable [QGVAR(building), objNull];
TRACE_3("Ladder Action - Down",_player,_building,_ladderIndex);
_player action ["LadderDown", _building, _ladderIndex, 1];
};
_fnc_ladder_conditional = {
PARAMS_2(_target,_player);
params ["_target", "_player"];
//(Check distance < 2) and (Don't show actions if on a ladder)
((_target distance _player) < 2) && {((getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState _player) >> "onLadder")) == 0)}
};
_ladders = getArray (configFile >> "CfgVehicles" >> _typeOfBuilding >> "ladders");
{
EXPLODE_2_PVT(_x,_ladderBottomMemPoint,_ladderTopMemPoint);
_x params ["_ladderBottomMemPoint", "_ladderTopMemPoint"];
_actionMaxDistance = 3; //interact_menu will check head -> target's offset; leave this high and do a precice distance check in condition