mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
ambientBrightness effects tag distance
This commit is contained in:
parent
942066b04a
commit
6dc81796b5
@ -1,10 +1,13 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_onKeyPressAlphaMax", "_defaultIcon", "_distance", "_alpha", "_icon", "_targets", "_pos2", "_vecy", "_relPos", "_projDist", "_pos", "_target", "_targetEyePosASL"];
|
||||
private ["_onKeyPressAlphaMax", "_defaultIcon", "_distance", "_alpha", "_icon", "_targets", "_pos2", "_vecy", "_relPos", "_projDist", "_pos", "_target", "_targetEyePosASL", "_ambientBrightness", "_maxDistance"];
|
||||
|
||||
//don't show nametags in spectator
|
||||
if ((isNull ACE_player) || {!alive ACE_player}) exitWith {};
|
||||
|
||||
_ambientBrightness = ((([] call EFUNC(common,ambientBrightness)) + ([0, 0.4] select ((currentVisionMode ace_player) != 0))) min 1) max 0;
|
||||
_maxDistance = _ambientBrightness * GVAR(PlayerNamesViewDistance);
|
||||
|
||||
_onKeyPressAlphaMax = if ((GVAR(showPlayerNames) in [3,4])) then {
|
||||
2 + (GVAR(ShowNamesTime) - time); //after release 1 second of full opacity, 1 second of fading to 0
|
||||
} else {
|
||||
@ -29,8 +32,7 @@ if (GVAR(showCursorTagForVehicles) && {_onKeyPressAlphaMax > 0}) then {
|
||||
{GVAR(ShowNamesForAI) || {[_target] call EFUNC(common,isPlayer)}} &&
|
||||
{!(_target getVariable ["ACE_hideName", false])}) then {
|
||||
_distance = ACE_player distance _target;
|
||||
_alpha = ((1 - 0.2 * (_distance - GVAR(PlayerNamesViewDistance))) min 1) * GVAR(PlayerNamesMaxAlpha);
|
||||
_alpha = _alpha min _onKeyPressAlphaMax;
|
||||
_alpha = (((1 - 0.2 * (_distance - _maxDistance)) min 1) * GVAR(PlayerNamesMaxAlpha)) min _onKeyPressAlphaMax;
|
||||
[ACE_player, _target, _alpha, _distance * 0.026, _defaultIcon] call FUNC(drawNameTagIcon);
|
||||
};
|
||||
};
|
||||
@ -46,8 +48,7 @@ if ((GVAR(showPlayerNames) in [2,4]) && {_onKeyPressAlphaMax > 0}) then {
|
||||
{GVAR(ShowNamesForAI) || {[_target] call EFUNC(common,isPlayer)}} &&
|
||||
{!(_target getVariable ["ACE_hideName", false])}) then {
|
||||
_distance = ACE_player distance _target;
|
||||
_alpha = ((1 - 0.2 * (_distance - GVAR(PlayerNamesViewDistance))) min 1) * GVAR(PlayerNamesMaxAlpha);
|
||||
_alpha = _alpha min _onKeyPressAlphaMax;
|
||||
_alpha = (((1 - 0.2 * (_distance - _maxDistance)) min 1) * GVAR(PlayerNamesMaxAlpha)) min _onKeyPressAlphaMax;
|
||||
_icon = ICON_NONE;
|
||||
if (GVAR(showSoundWaves) == 2) then { //icon will be drawn below, so only show name here
|
||||
_icon = if (([_target] call FUNC(isSpeaking)) && {(vehicle _target) == _target}) then {ICON_NAME} else {_defaultIcon};
|
||||
@ -61,7 +62,7 @@ if ((GVAR(showPlayerNames) in [2,4]) && {_onKeyPressAlphaMax > 0}) then {
|
||||
|
||||
if (((GVAR(showPlayerNames) in [1,3]) && {_onKeyPressAlphaMax > 0}) || {GVAR(showSoundWaves) == 2}) then {
|
||||
_pos = positionCameraToWorld [0, 0, 0];
|
||||
_targets = _pos nearObjects ["CAManBase", GVAR(PlayerNamesViewDistance) + 5];
|
||||
_targets = _pos nearObjects ["CAManBase", _maxDistance + 5];
|
||||
|
||||
if (!surfaceIsWater _pos) then {
|
||||
_pos = ATLtoASL _pos;
|
||||
@ -96,12 +97,12 @@ if (((GVAR(showPlayerNames) in [1,3]) && {_onKeyPressAlphaMax > 0}) || {GVAR(sho
|
||||
_distance = vectorMagnitude _relPos;
|
||||
_projDist = _relPos vectorDistance (_vecy vectorMultiply (_relPos vectorDotProduct _vecy));
|
||||
|
||||
_alpha = ((1 - 0.2 * (_distance - GVAR(PlayerNamesViewDistance))) min (1 - 0.15 * (_projDist * 5 - _distance - 3)) min 1) * GVAR(PlayerNamesMaxAlpha);
|
||||
_alpha = ((1 - 0.2 * (_distance - _maxDistance)) min (1 - 0.15 * (_projDist * 5 - _distance - 3)) min 1) * GVAR(PlayerNamesMaxAlpha);
|
||||
|
||||
if ((GVAR(showSoundWaves) == 2) && {([_target] call FUNC(isSpeaking)) && {(vehicle _target) == _target}}) then {
|
||||
_alpha = 1;
|
||||
} else {
|
||||
_alpha = _alpha min _onKeyPressAlphaMax;
|
||||
_alpha = (_alpha min _onKeyPressAlphaMax);
|
||||
};
|
||||
|
||||
[ACE_player, _target, _alpha, _distance * 0.026, _icon] call FUNC(drawNameTagIcon);
|
||||
|
Loading…
Reference in New Issue
Block a user