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
This commit is contained in:
Drofseh 2022-03-07 10:35:49 -08:00 committed by GitHub
parent 8b60fae23a
commit 70da38cec5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 3 deletions

View File

@ -27,7 +27,7 @@ private _fingerPos = if (_sourceUnit == ACE_player) then {
TRACE_3("incoming finger:", _sourceUnit, _fingerPosPrecise, _fingerPos); 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]; GVAR(fingersHash) set [hashValue _sourceUnit, _data];
if (GVAR(pfeh_id) == -1) then { if (GVAR(pfeh_id) == -1) then {

View File

@ -21,11 +21,11 @@ if !([ACE_player, ACE_player, ["isNotInside", "isNotSwimming"]] call EFUNC(commo
// Make sure player is dismounted or in a static weapon: // 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}; 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"]; //IGNORE_PRIVATE_WARNING ["_x", "_y"];
_y params ["_lastTime", "_pos", "_name"]; _y params ["_lastTime", "_pos", "_name", "_sourceUnit"];
private _timeLeftToShow = _lastTime + FP_TIMEOUT - diag_tickTime; private _timeLeftToShow = _lastTime + FP_TIMEOUT - diag_tickTime;
if (_timeLeftToShow <= 0) then { if (_timeLeftToShow <= 0) then {
GVAR(fingersHash) deleteAt _x; GVAR(fingersHash) deleteAt _x;
@ -34,6 +34,11 @@ private _iconSize = BASE_SIZE * 0.10713 * (call EFUNC(common,getZoom));
// Fade out: // Fade out:
_drawColor set [3, ((_drawColor select 3) * ((_timeLeftToShow min 0.5) / 0.5))]; _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"]; drawIcon3D [QPATHTOF(UI\fp_icon2.paa), _drawColor, ASLtoAGL _pos, _iconSize, _iconSize, 0, _name, 1, 0.03, "RobotoCondensed"];
}; };
} forEach GVAR(fingersHash); } forEach GVAR(fingersHash);

View File

@ -16,6 +16,22 @@ private _category = format ["ACE %1", localize LSTRING(DisplayName)];
1 1
] call CBA_fnc_addSetting; ] 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", QGVAR(indicatorForSelf), "CHECKBOX",
[LSTRING(indicatorForSelf_name), LSTRING(indicatorForSelf_description)], [LSTRING(indicatorForSelf_name), LSTRING(indicatorForSelf_description)],

View File

@ -85,6 +85,18 @@
<Chinese>設定指向指示器最大顯示距離。[預設: 4公尺]</Chinese> <Chinese>設定指向指示器最大顯示距離。[預設: 4公尺]</Chinese>
<Turkish>Hangi uzaklıktakilerin sanal daireyi görmesini seçin. [Varsayılan : 4 metre] </Turkish> <Turkish>Hangi uzaklıktakilerin sanal daireyi görmesini seçin. [Varsayılan : 4 metre] </Turkish>
</Key> </Key>
<Key ID="STR_ACE_Finger_sizeCoef_displayName">
<English>Visual Marker Size Coefficient</English>
</Key>
<Key ID="STR_ACE_Finger_sizeCoef_description">
<English>Adjusts the size of the visual marker.</English>
</Key>
<Key ID="STR_ACE_Finger_proximityScaling_displayName">
<English>Proximity Scaling</English>
</Key>
<Key ID="STR_ACE_Finger_proximityScaling_description">
<English>Scales the size of the visual marker based on the distance between the player observing and the player pointing.</English>
</Key>
<Key ID="STR_ACE_Finger_indicatorForSelf_name"> <Key ID="STR_ACE_Finger_indicatorForSelf_name">
<English>Show pointing indicator to self</English> <English>Show pointing indicator to self</English>
<German>Zeigersymbol einem selbst anzeigen</German> <German>Zeigersymbol einem selbst anzeigen</German>