From 70da38cec5f8e2574ecdffaf3833a981ad4f739d Mon Sep 17 00:00:00 2001 From: Drofseh Date: Mon, 7 Mar 2022 10:35:49 -0800 Subject: [PATCH] Finger - Add scaling settings (#8676) * Add scaling settings - sizeCoef will scale the size directly from the setting value, default 1x is the same as the current size. - proximityScaling will scale the size based on the distance between the observer and the pointer, 2x as large at maxRange, 0.25x at 0m distance. * fix slider decimal value * bug fix --- addons/finger/functions/fnc_incomingFinger.sqf | 2 +- addons/finger/functions/fnc_perFrameEH.sqf | 9 +++++++-- addons/finger/initSettings.sqf | 16 ++++++++++++++++ addons/finger/stringtable.xml | 12 ++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/addons/finger/functions/fnc_incomingFinger.sqf b/addons/finger/functions/fnc_incomingFinger.sqf index 24afac3c34..3980e1715d 100644 --- a/addons/finger/functions/fnc_incomingFinger.sqf +++ b/addons/finger/functions/fnc_incomingFinger.sqf @@ -27,7 +27,7 @@ private _fingerPos = if (_sourceUnit == ACE_player) then { TRACE_3("incoming finger:", _sourceUnit, _fingerPosPrecise, _fingerPos); -private _data = [diag_tickTime, _fingerPos, ([_sourceUnit, false, true] call EFUNC(common,getName))]; +private _data = [diag_tickTime, _fingerPos, ([_sourceUnit, false, true] call EFUNC(common,getName)), _sourceUnit]; GVAR(fingersHash) set [hashValue _sourceUnit, _data]; if (GVAR(pfeh_id) == -1) then { diff --git a/addons/finger/functions/fnc_perFrameEH.sqf b/addons/finger/functions/fnc_perFrameEH.sqf index e6056393b0..ece6d441d2 100644 --- a/addons/finger/functions/fnc_perFrameEH.sqf +++ b/addons/finger/functions/fnc_perFrameEH.sqf @@ -21,11 +21,11 @@ if !([ACE_player, ACE_player, ["isNotInside", "isNotSwimming"]] call EFUNC(commo // Make sure player is dismounted or in a static weapon: if ((ACE_player != vehicle ACE_player) && {!((vehicle ACE_player) isKindOf "StaticWeapon")}) then {GVAR(fingersHash) = createHashMap}; -private _iconSize = BASE_SIZE * 0.10713 * (call EFUNC(common,getZoom)); +private _iconBaseSize = GVAR(sizeCoef) * BASE_SIZE * 0.10713 * (call EFUNC(common,getZoom)); { //IGNORE_PRIVATE_WARNING ["_x", "_y"]; - _y params ["_lastTime", "_pos", "_name"]; + _y params ["_lastTime", "_pos", "_name", "_sourceUnit"]; private _timeLeftToShow = _lastTime + FP_TIMEOUT - diag_tickTime; if (_timeLeftToShow <= 0) then { GVAR(fingersHash) deleteAt _x; @@ -34,6 +34,11 @@ private _iconSize = BASE_SIZE * 0.10713 * (call EFUNC(common,getZoom)); // Fade out: _drawColor set [3, ((_drawColor select 3) * ((_timeLeftToShow min 0.5) / 0.5))]; + private _iconSize = _iconBaseSize; + if (GVAR(proximityScaling)) then { + _iconSize = _iconSize * linearConversion [0, GVAR(maxRange), (getPosASL ACE_player) vectorDistance (getPosASL _sourceUnit), 0.25, 2, true]; + }; + drawIcon3D [QPATHTOF(UI\fp_icon2.paa), _drawColor, ASLtoAGL _pos, _iconSize, _iconSize, 0, _name, 1, 0.03, "RobotoCondensed"]; }; } forEach GVAR(fingersHash); diff --git a/addons/finger/initSettings.sqf b/addons/finger/initSettings.sqf index 592b045629..79c129bc46 100644 --- a/addons/finger/initSettings.sqf +++ b/addons/finger/initSettings.sqf @@ -16,6 +16,22 @@ private _category = format ["ACE %1", localize LSTRING(DisplayName)]; 1 ] call CBA_fnc_addSetting; +[ + QGVAR(sizeCoef), "SLIDER", + [LSTRING(sizeCoef_displayName), LSTRING(sizeCoef_description)], + _category, + [0.1, 5, 1, 2], + 1 +] call CBA_fnc_addSetting; + +[ + QGVAR(proximityScaling), "CHECKBOX", + [LSTRING(proximityScaling_displayName), LSTRING(proximityScaling_description)], + _category, + false, + 1 +] call CBA_fnc_addSetting; + [ QGVAR(indicatorForSelf), "CHECKBOX", [LSTRING(indicatorForSelf_name), LSTRING(indicatorForSelf_description)], diff --git a/addons/finger/stringtable.xml b/addons/finger/stringtable.xml index 2d993f8d5d..7c0343ba60 100644 --- a/addons/finger/stringtable.xml +++ b/addons/finger/stringtable.xml @@ -85,6 +85,18 @@ 設定指向指示器最大顯示距離。[預設: 4公尺] Hangi uzaklıktakilerin sanal daireyi görmesini seçin. [Varsayılan : 4 metre] + + Visual Marker Size Coefficient + + + Adjusts the size of the visual marker. + + + Proximity Scaling + + + Scales the size of the visual marker based on the distance between the player observing and the player pointing. + Show pointing indicator to self Zeigersymbol einem selbst anzeigen