Pass function by reference to Draw3D EH (#7333)

This commit is contained in:
mharis001 2019-12-26 20:42:48 -05:00 committed by PabstMirror
parent 53c53bbdbc
commit 085ebd89db
4 changed files with 62 additions and 41 deletions

View File

@ -19,6 +19,6 @@ class Extended_PostInit_EventHandlers {
class Extended_DisplayLoad_EventHandlers {
class RscDisplayCurator {
ADDON = QUOTE(call FUNC(drawCuratorGarrisonPathing));
ADDON = QUOTE(call FUNC(initDisplayCurator));
};
};

View File

@ -1,4 +1,5 @@
PREP(drawCuratorGarrisonPathing);
PREP(garrison);
PREP(unGarrison);
PREP(garrisonMove);
PREP(initDisplayCurator);
PREP(unGarrison);

View File

@ -1,54 +1,56 @@
#include "script_component.hpp"
/*
* Author: alganthe
* Add draw3D eh to the curator interface.
* Draws AI garrison pathing while the Zeus display is open.
*
* Arguments:
* None
*
* Return value:
* Return Value:
* None
*
* Example:
* [] call ace_ai_fnc_drawCuratorGarrisonPathing
*
* Public: No
*/
*/
addMissionEventHandler ["Draw3D", {
if (findDisplay 312 isEqualTo displayNull) exitWith {
removeMissionEventHandler ["Draw3D", _thisEventHandler];
};
if (isNull findDisplay 312) exitWith {
removeMissionEventHandler ["Draw3D", _thisEventHandler];
};
private _unitMoveList = missionNameSpace getVariable [QGVAR(garrison_unitMoveList), []];
{
_x params ["_unit", "_pos"];
private _unitMoveList = missionNameSpace getVariable [QGVAR(garrison_unitMoveList), []];
switch (true) do {
case (surfaceIsWater (getPos _unit) && {surfaceIsWater _pos}) : {
for "_i" from 0 to 3 do {
drawLine3D [_unit modelToWorldVisualWorld [0,0,1], (AGLtoASL _pos), [1,0,0,1]];
};
drawIcon3D ["\a3\ui_f\data\map\groupicons\waypoint.paa", [1,0,0,1], (AGLtoASL _pos), 0.75, 0.75, 0.75];
};
case (!surfaceIsWater (getPos _unit) && {!surfaceIsWater _pos}) : {
for "_i" from 0 to 3 do {
drawLine3D [_unit modelToWorldVisual [0,0,1], _pos, [1,0,0,1]];
};
drawIcon3D ["\a3\ui_f\data\map\groupicons\waypoint.paa", [1,0,0,1], _pos, 0.75, 0.75, 0.75];
};
case (!surfaceIsWater (getPos _unit) && {surfaceIsWater _pos}) : {
for "_i" from 0 to 3 do {
drawLine3D [_unit modelToWorldVisual [0,0,1], (AGLToASL _pos), [1,0,0,1]];
};
drawIcon3D ["\a3\ui_f\data\map\groupicons\waypoint.paa", [1,0,0,1], (AGLtoASL _pos), 0.75, 0.75, 0.75];
};
case (surfaceIsWater (getPos _unit) && {!surfaceIsWater _pos}) : {
for "_i" from 0 to 3 do {
drawLine3D [_unit modelToWorldVisualWorld [0,0,1], _pos, [1,0,0,1]];
};
drawIcon3D ["\a3\ui_f\data\map\groupicons\waypoint.paa", [1,0,0,1], _pos, 0.75, 0.75, 0.75];
{
_x params ["_unit", "_pos"];
switch (true) do {
case (surfaceIsWater (getPos _unit) && {surfaceIsWater _pos}) : {
for "_i" from 0 to 3 do {
drawLine3D [_unit modelToWorldVisualWorld [0,0,1], (AGLtoASL _pos), [1,0,0,1]];
};
drawIcon3D ["\a3\ui_f\data\map\groupicons\waypoint.paa", [1,0,0,1], (AGLtoASL _pos), 0.75, 0.75, 0.75];
};
} forEach _unitMoveList;
}];
case (!surfaceIsWater (getPos _unit) && {!surfaceIsWater _pos}) : {
for "_i" from 0 to 3 do {
drawLine3D [_unit modelToWorldVisual [0,0,1], _pos, [1,0,0,1]];
};
drawIcon3D ["\a3\ui_f\data\map\groupicons\waypoint.paa", [1,0,0,1], _pos, 0.75, 0.75, 0.75];
};
case (!surfaceIsWater (getPos _unit) && {surfaceIsWater _pos}) : {
for "_i" from 0 to 3 do {
drawLine3D [_unit modelToWorldVisual [0,0,1], (AGLToASL _pos), [1,0,0,1]];
};
drawIcon3D ["\a3\ui_f\data\map\groupicons\waypoint.paa", [1,0,0,1], (AGLtoASL _pos), 0.75, 0.75, 0.75];
};
case (surfaceIsWater (getPos _unit) && {!surfaceIsWater _pos}) : {
for "_i" from 0 to 3 do {
drawLine3D [_unit modelToWorldVisualWorld [0,0,1], _pos, [1,0,0,1]];
};
drawIcon3D ["\a3\ui_f\data\map\groupicons\waypoint.paa", [1,0,0,1], _pos, 0.75, 0.75, 0.75];
};
};
} forEach _unitMoveList;

View File

@ -0,0 +1,18 @@
#include "script_component.hpp"
/*
* Author: mharis001
* Initializes the Zeus display.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ace_ai_fnc_initDisplayCurator
*
* Public: No
*/
addMissionEventHandler ["Draw3D", {call FUNC(drawCuratorGarrisonPathing)}];