-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix map icons not showing after closing display (#81)
- Loading branch information
Showing
8 changed files
with
214 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#include "script_component.hpp" | ||
/** | ||
* Author: Timi007 | ||
* | ||
* Description: | ||
* Draws 3DEN comments in zeus. | ||
* | ||
* Parameter(s): | ||
* None. | ||
* | ||
* Returns: | ||
* Nothing. | ||
* | ||
* Example: | ||
* [_display] call mts_enhanced_fnc_add3DENCommentsDrawEH | ||
* | ||
*/ | ||
|
||
params ["_display"]; | ||
|
||
CHECK(!GVAR(enable3DENComments)); | ||
|
||
if (!GVAR(3DENComments_drawEHAdded)) then { | ||
LOG("Adding 3DENComments draw3D"); | ||
[missionNamespace, "draw3D", { | ||
_thisArgs params ["_3denComments"]; | ||
|
||
CHECK(isNull (findDisplay ZEUS_DISPLAY)); | ||
|
||
if (!GVAR(enable3DENComments)) exitWith { | ||
removeMissionEventHandler [_thisType, _thisId]; | ||
GVAR(3DENComments_drawEHAdded) = false; | ||
}; | ||
|
||
{ | ||
_x params ["_id", "_name", "_description", "_posASL"]; | ||
|
||
private _camPosASL = getPosASLVisual curatorCamera; | ||
private _d = _posASL distance _camPosASL; | ||
private _scale = linearConversion [300, 750, _d, 0.8, 0, true]; // 300m => 1.5, 730m => 0 | ||
|
||
if (_scale < 0.01) then { | ||
continue; | ||
}; | ||
|
||
private _color = [0.2,0.8,0.6,1]; | ||
|
||
drawIcon3D [ | ||
"a3\3den\Data\Cfg3DEN\Comment\texture_ca.paa", | ||
_color, | ||
ASLToAGL _posASL, | ||
_scale, // Width | ||
_scale, // Height | ||
0, // Angle | ||
_name, // Text | ||
1 // Shadow | ||
]; | ||
|
||
drawLine3D [ | ||
ASLToAGL _posASL, | ||
[_posASL select 0, _posASL select 1, 0], | ||
_color | ||
]; | ||
} count _3denComments; | ||
}, [GVAR(3DENComments_data)]] call CBA_fnc_addBISEventHandler; | ||
}; | ||
|
||
// MapDraw EH needs to be readded every time the zeus display is opened. | ||
LOG("Adding 3DENComments map draw"); | ||
[_display displayCtrl ZEUS_MAP_CTRL, "draw", { | ||
params ["_mapCtrl"]; | ||
_thisArgs params ["_3denComments"]; | ||
|
||
if (!GVAR(enable3DENComments)) exitWith { | ||
_mapCtrl ctrlRemoveEventHandler [_thisType, _thisId]; | ||
}; | ||
|
||
{ | ||
_x params ["_id", "_name", "_description", "_posASL"]; | ||
|
||
private _color = [0.2,0.8,0.6,1]; | ||
|
||
_mapCtrl drawIcon [ | ||
"a3\3den\Data\Cfg3DEN\Comment\texture_ca.paa", | ||
_color, | ||
_posASL, | ||
24, | ||
24, | ||
0, | ||
_name, | ||
1 | ||
]; | ||
} count _3denComments; | ||
}, [GVAR(3DENComments_data)]] call CBA_fnc_addBISEventHandler; | ||
|
||
GVAR(3DENComments_drawEHAdded) = true; |
107 changes: 107 additions & 0 deletions
107
addons/zeus/functions/fnc_addACEUnconsciousIconDrawEH.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
#include "script_component.hpp" | ||
/** | ||
* Author: PhILoX, Timi007 | ||
* | ||
* Description: | ||
* Adds an eventhandler on initialization of the zeus interface. | ||
* The eventhandler adds an icon on unconscious players. | ||
* | ||
* Parameter(s): | ||
* None. | ||
* | ||
* Returns: | ||
* Nothing. | ||
* | ||
* Example: | ||
* [_display] call mts_zeus_fnc_addACEUnconsciousIconDrawEH | ||
* | ||
*/ | ||
|
||
params ["_display"]; | ||
|
||
CHECK(!GVAR(enableACEUnconsciousIcon)); | ||
|
||
private _curatorModule = getAssignedCuratorLogic player; | ||
|
||
// Only do this if zeus display is opened for the first time | ||
if (isNil {(_curatorModule getVariable QGVAR(unconsciousPlayers))}) then { | ||
LOG("Init ACEUnconsciousIcon killed EH"); | ||
_curatorModule setVariable [QGVAR(unconsciousPlayers), []]; | ||
|
||
{ | ||
if (_x getVariable ["ACE_isUnconscious", false]) then { | ||
[_x, true] call FUNC(drawACEUnconsciousIcon); | ||
}; | ||
} count (call CBA_fnc_players); | ||
|
||
["ace_unconscious", LINKFUNC(drawACEUnconsciousIcon)] call CBA_fnc_addEventHandler; | ||
[QGVAR(killed), LINKFUNC(drawACEUnconsciousIcon)] call CBA_fnc_addEventHandler; | ||
}; | ||
|
||
if (!GVAR(ACEIcon_drawEHAdded)) then { | ||
LOG("Adding ACEUnconsciousIcon draw3D"); | ||
[missionNamespace, "draw3D", { | ||
_thisArgs params ["_curatorModule"]; | ||
|
||
CHECK(isNull (findDisplay ZEUS_DISPLAY)); | ||
|
||
if (!GVAR(enableACEUnconsciousIcon)) exitWith { | ||
removeMissionEventHandler [_thisType, _thisId]; | ||
GVAR(ACEIcon_drawEHAdded) = false; | ||
}; | ||
|
||
private _unconsciousPlayers = _curatorModule getVariable [QGVAR(unconsciousPlayers), []]; | ||
|
||
{ | ||
private _pos = ASLToAGL (getPosASLVisual _x); | ||
private _camPos = ASLToAGL (getPosASLVisual curatorCamera); | ||
private _d = _pos distance _camPos; | ||
private _scale = linearConversion [300, 730, _d, 1.5, 0, true]; // 300m => 1.5, 730m => 0 | ||
|
||
if (_scale < 0.01) then { | ||
continue; | ||
}; | ||
|
||
drawIcon3D [ | ||
"z\ace\addons\zeus\ui\Icon_Module_Zeus_Unconscious_ca.paa", | ||
[0.9, 0, 0, 1], | ||
[_pos select 0, _pos select 1, (_pos select 2) + 2], | ||
_scale, // Width | ||
_scale, // Height | ||
0, // Angle | ||
"", // Text | ||
1 // Shadow | ||
]; | ||
} count _unconsciousPlayers; | ||
}, [_curatorModule]] call CBA_fnc_addBISEventHandler; | ||
}; | ||
|
||
// MapDraw EH needs to be readded every time the zeus display is opened. | ||
LOG("Adding ACEUnconsciousIcon map draw"); | ||
[_display displayCtrl ZEUS_MAP_CTRL, "draw", { | ||
params ["_mapCtrl"]; | ||
_thisArgs params ["_curatorModule"]; | ||
|
||
if (!GVAR(enableACEUnconsciousIcon)) exitWith { | ||
_mapCtrl ctrlRemoveEventHandler [_thisType, _thisId]; | ||
}; | ||
|
||
private _unconsciousPlayers = _curatorModule getVariable [QGVAR(unconsciousPlayers), []]; | ||
|
||
{ | ||
private _pos = getPosASLVisual _x; | ||
|
||
_mapCtrl drawIcon [ | ||
"z\ace\addons\zeus\ui\Icon_Module_Zeus_Unconscious_ca.paa", | ||
[0.9, 0, 0, 1], | ||
_pos, | ||
30, | ||
30, | ||
0, | ||
"", | ||
1 | ||
]; | ||
} count _unconsciousPlayers; | ||
}, [_curatorModule]] call CBA_fnc_addBISEventHandler; | ||
|
||
GVAR(ACEIcon_drawEHAdded) = true; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.