mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Cache drawIcon3D parameters
This commit is contained in:
@ -20,22 +20,23 @@
|
|||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["", "_target", "", "_heightOffset", ""];
|
||||||
|
|
||||||
|
_fnc_parameters = {
|
||||||
params ["_player", "_target", "_alpha", "_heightOffset", "_iconType"];
|
params ["_player", "_target", "_alpha", "_heightOffset", "_iconType"];
|
||||||
|
|
||||||
if ((_iconType == ICON_NONE) || {isObjectHidden _target}) exitWith {}; //Don't waste time if not visable
|
if ((_iconType == ICON_NONE) || {isObjectHidden _target}) exitWith {}; //Don't waste time if not visable
|
||||||
|
|
||||||
private ["_position", "_color", "_name", "_size", "_icon", "_scale"];
|
|
||||||
|
|
||||||
//Set Icon:
|
//Set Icon:
|
||||||
_icon = "";
|
private _icon = "";
|
||||||
_size = 0;
|
private _size = 0;
|
||||||
if (_iconType in [ICON_NAME_SPEAK, ICON_SPEAK]) then {
|
if (_iconType == ICON_NAME_SPEAK || _iconType == ICON_SPEAK) then {
|
||||||
_icon = format ["%1%2%3",QUOTE(PATHTOF(UI\soundwave)), floor (random 10), ".paa"];
|
_icon = format [QUOTE(PATHTOF(UI\soundwave%1.paa)), floor (random 10)];
|
||||||
_size = 1;
|
_size = 1;
|
||||||
_alpha = (_alpha max 0.2) + 0.2;//Boost alpha when speaking
|
_alpha = (_alpha max 0.2) + 0.2;//Boost alpha when speaking
|
||||||
} else {
|
} else {
|
||||||
if (_iconType == ICON_NAME_RANK) then {
|
if (_iconType == ICON_NAME_RANK) then {
|
||||||
_icon = format["\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa",(toLower(rank _target))];
|
_icon = format["\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa", toLower(rank _target)];
|
||||||
_size = 1;
|
_size = 1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -43,13 +44,14 @@ if (_iconType in [ICON_NAME_SPEAK, ICON_SPEAK]) then {
|
|||||||
if (_alpha < 0) exitWith {}; //Don't waste time if not visable
|
if (_alpha < 0) exitWith {}; //Don't waste time if not visable
|
||||||
|
|
||||||
//Set Text:
|
//Set Text:
|
||||||
_name = if (_iconType in [ICON_NAME, ICON_NAME_RANK, ICON_NAME_SPEAK]) then {
|
private _name = if (_iconType in [ICON_NAME, ICON_NAME_RANK, ICON_NAME_SPEAK]) then {
|
||||||
[_target, true, true] call EFUNC(common,getName)
|
[_target, true, true] call EFUNC(common,getName)
|
||||||
} else {
|
} else {
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
|
|
||||||
//Set Color:
|
//Set Color:
|
||||||
|
private _color = [1, 1, 1, _alpha];
|
||||||
if ((group _target) != (group _player)) then {
|
if ((group _target) != (group _player)) then {
|
||||||
_color = +GVAR(defaultNametagColor); //Make a copy, then multiply both alpha values (allows client to decrease alpha in settings)
|
_color = +GVAR(defaultNametagColor); //Make a copy, then multiply both alpha values (allows client to decrease alpha in settings)
|
||||||
_color set [3, (_color select 3) * _alpha];
|
_color set [3, (_color select 3) * _alpha];
|
||||||
@ -57,19 +59,12 @@ if ((group _target) != (group _player)) then {
|
|||||||
_color = [[1, 1, 1, _alpha], [1, 0, 0, _alpha], [0, 1, 0, _alpha], [0, 0, 1, _alpha], [1, 1, 0, _alpha]] select ((["MAIN", "RED", "GREEN", "BLUE", "YELLOW"] find (assignedTeam _target)) max 0);
|
_color = [[1, 1, 1, _alpha], [1, 0, 0, _alpha], [0, 1, 0, _alpha], [0, 0, 1, _alpha], [1, 1, 0, _alpha]] select ((["MAIN", "RED", "GREEN", "BLUE", "YELLOW"] find (assignedTeam _target)) max 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isNil "_color") then {
|
private _scale = [0.333, 0.5, 0.666, 0.83333, 1] select GVAR(tagSize);
|
||||||
_color = [1, 1, 1, _alpha];
|
|
||||||
};
|
|
||||||
|
|
||||||
// Convert position to ASLW (expected by drawIcon3D) and add height offsets
|
[
|
||||||
_position = _target modelToWorldVisual ((_target selectionPosition "pilot") vectorAdd [0,0,(_heightOffset + .3)]);
|
|
||||||
|
|
||||||
_scale = [0.333, 0.5, 0.666, 0.83333, 1] select GVAR(tagSize);
|
|
||||||
|
|
||||||
drawIcon3D [
|
|
||||||
_icon,
|
_icon,
|
||||||
_color,
|
_color,
|
||||||
_position,
|
[],
|
||||||
(_size * _scale),
|
(_size * _scale),
|
||||||
(_size * _scale),
|
(_size * _scale),
|
||||||
0,
|
0,
|
||||||
@ -77,4 +72,13 @@ drawIcon3D [
|
|||||||
2,
|
2,
|
||||||
(0.05 * _scale),
|
(0.05 * _scale),
|
||||||
"PuristaMedium"
|
"PuristaMedium"
|
||||||
];
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
private _parameters = [_this, _fnc_parameters, _target, QGVAR(drawParameters), 0.3] call EFUNC(common,cachedCall);
|
||||||
|
|
||||||
|
// Convert position to ASLW (expected by drawIcon3D) and add height offsets
|
||||||
|
_parameters set [2, _target modelToWorldVisual ((_target selectionPosition "pilot") vectorAdd [0,0,_heightOffset + .3])];
|
||||||
|
|
||||||
|
TRACE_1("Params:",_parameters);
|
||||||
|
drawIcon3D _parameters;
|
||||||
|
Reference in New Issue
Block a user