From e1087cab7a96b69fb2876fcbb06d29ff172ce16d Mon Sep 17 00:00:00 2001 From: diwako Date: Sat, 2 Feb 2019 11:22:29 +0100 Subject: [PATCH] Cone based occlusion feature --- mod/functions/fn_displayUnitOnCompass.sqf | 6 +++--- mod/functions/fn_preinit.sqf | 13 +++++++++++++ mod/stringtable.xml | 16 ++++++++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/mod/functions/fn_displayUnitOnCompass.sqf b/mod/functions/fn_displayUnitOnCompass.sqf index 90df655..79ab7bf 100644 --- a/mod/functions/fn_displayUnitOnCompass.sqf +++ b/mod/functions/fn_displayUnitOnCompass.sqf @@ -23,12 +23,13 @@ if (isNil "_player") then { private _circleRange = diwako_dui_compassRange; private _distance = _player distance2d _unit; private _fade = linearConversion [_circleRange * 0.90, _circleRange, _distance, diwako_dui_compass_opacity, 0, true]; +private _relDir = ((_player getRelDir _unit) - (_viewDir - _playerDir) ) mod 360; if (diwako_dui_enable_occlusion && {_fade > 0}) then { private _vis = [vehicle _unit, "VIEW"] checkVisibility [eyePos _player, AGLToASL (_unit modelToWorld (_unit selectionPosition "Spine2"))]; private _lastSeen = _unit getVariable "diwako_dui_lastSeen"; - - if (_vis == 0) then { + private _cone = if (_relDir > 180) then { abs (_relDir - 360)} else { abs _relDir}; + if (_vis == 0 || {diwako_dui_enable_occlusion_actual_cone < _cone}) then { // unit not visible anymore if (isNil "_lastSeen") then { _lastSeen = time; @@ -68,7 +69,6 @@ if (isNull _ctrl) then { ctrlPosition _ctrlGrp params ["_left", "_top", "_width", "_height"]; private _center = [_left + _width/2, _top + _height/2]; -private _relDir = ((_player getRelDir _unit) - (_viewDir - _playerDir) ) mod 360; private _dist = _distance / linearConversion [15,50,_circleRange,40,145,false]; private _iconScale = diwako_dui_compass_icon_scale; private _newWidth = (44 * pixelW) /_divisor * _iconScale; diff --git a/mod/functions/fn_preinit.sqf b/mod/functions/fn_preinit.sqf index 22071ea..41cdc37 100644 --- a/mod/functions/fn_preinit.sqf +++ b/mod/functions/fn_preinit.sqf @@ -186,6 +186,19 @@ private _curCat = localize "STR_dui_cat_compass"; ,false ] call CBA_Settings_fnc_init; +[ + "diwako_dui_enable_occlusion_cone" + ,"SLIDER" + ,[localize "STR_dui_occlusion_cone", localize "STR_dui_occlusion_cone_desc"] + ,[CBA_SETTINGS_CAT, _curCat] + ,[0, 360, 360, 1] + ,false + ,{ + params ["_value"]; + diwako_dui_enable_occlusion_actual_cone = _value / 2; + } +] call CBA_Settings_fnc_init; + [ "diwako_dui_compass_icon_scale" ,"SLIDER" diff --git a/mod/stringtable.xml b/mod/stringtable.xml index e897361..e48a219 100644 --- a/mod/stringtable.xml +++ b/mod/stringtable.xml @@ -526,5 +526,21 @@ Gdy jesteś sam w grupie, będzie to tylko ukrywać znacznik gracza na kompasie + + Occlusion Cone + + + Okklusionskegel + + + + + Sets the cone (in degrees) in which a unit is considered seen infront of the player. E.g. 90 means you can see the unit 45 degrees to your left and right + + + Stellt den Kegel (in Grad) ein, in dem eine Einheit als vor dem Spieler gesehen gilt. Als Beispiel mit 90 grad sieht man Einheiten 45° nach links und rechts + + + \ No newline at end of file