mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Mk 1 eyeballs integration
This commit is contained in:
parent
47fbe9bca5
commit
b1408af43a
@ -39,7 +39,7 @@ class ACE_Settings {
|
||||
typeName = "SCALAR";
|
||||
isClientSettable = 1;
|
||||
value = 0; // index. Actual coefficient is given by functions/fnc_returnObjectCoeff.sqf
|
||||
values[] = {CSTRING(object_off),CSTRING(object_verylow),CSTRING(object_low),CSTRING(object_medium),CSTRING(object_high),CSTRING(object_veryhigh)};
|
||||
values[] = {CSTRING(object_off),CSTRING(object_verylow),CSTRING(object_low),CSTRING(object_medium),CSTRING(object_high),CSTRING(object_veryhigh),CSTRING(object_fovBased)};
|
||||
displayName = CSTRING(object_DisplayName);
|
||||
description = CSTRING(object_Description);
|
||||
};
|
||||
|
@ -2,10 +2,11 @@
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(initModule);
|
||||
PREP(returnValue);
|
||||
PREP(returnObjectCoeff);
|
||||
PREP(changeViewDistance);
|
||||
PREP(adaptViewDistance);
|
||||
PREP(changeViewDistance);
|
||||
PREP(initModule);
|
||||
PREP(returnObjectCoeff);
|
||||
PREP(returnValue);
|
||||
PREP(setFovBasedOvdPFH);
|
||||
|
||||
ADDON = true;
|
||||
|
@ -6,7 +6,7 @@ class CfgPatches {
|
||||
weapons[] = {};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_common"};
|
||||
author[] = {"Winter"};
|
||||
author[] = {"Winter", "Jonpas", "Arkhir"};
|
||||
authorUrl = "https://github.com/Winter259";
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
@ -14,4 +14,4 @@ class CfgPatches {
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "ACE_Settings.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
|
@ -14,10 +14,9 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_text","_new_view_distance","_view_distance_limit","_object_view_distance_coeff"];
|
||||
private ["_text", "_new_view_distance", "_view_distance_limit", "_object_view_distance_coeff"];
|
||||
|
||||
params ["_index_requested", "_show_prompt"];
|
||||
|
||||
@ -27,19 +26,34 @@ _view_distance_limit = GVAR(limitViewDistance); // Grab the limit
|
||||
|
||||
setViewDistance (_new_view_distance min _view_distance_limit);
|
||||
|
||||
if (_object_view_distance_coeff > 0) then {
|
||||
setObjectViewDistance (_object_view_distance_coeff * viewDistance);
|
||||
if (typeName _object_view_distance_coeff == "SCALAR") then {
|
||||
if (_object_view_distance_coeff > 0) then {
|
||||
setObjectViewDistance (_object_view_distance_coeff * viewDistance);
|
||||
} else {
|
||||
// Restore correct view distance when changing from FoV Based to Off
|
||||
// Restoring directly inside PFH's self-exit resulted in the need of selecting another option to take effect
|
||||
setObjectViewDistance GVAR(fovBasedPFHminimalViewDistance);
|
||||
};
|
||||
} else {
|
||||
if (isNil QGVAR(fovBasedPFHminimalViewDistance)) then {
|
||||
GVAR(fovBasedPFHminimalViewDistance) = getObjectViewDistance select 0; // Minimal view distance holder and PFH isRunning variable
|
||||
[FUNC(setFovBasedOvdPFH), 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
};
|
||||
|
||||
if (_show_prompt) then {
|
||||
_text = if (_new_view_distance <= _view_distance_limit) then {
|
||||
format ["<t align='center'>%1 %2m", (localize "STR_ACE_ViewDistance_infotext"), str(viewDistance)];
|
||||
} else {
|
||||
format ["<t align='center'>%1 %2m", (localize "STR_ACE_ViewDistance_invalid"), str(viewDistance)];
|
||||
};
|
||||
|
||||
if (GVAR(objectViewDistanceCoeff) > 0) then {
|
||||
_text = _text + format ["<br/><t align='center'>%1 %2%3</t>", (localize "STR_ACE_ViewDistance_objectinfotext"), str(_object_view_distance_coeff * 100),"%"];
|
||||
// FoV Based or %
|
||||
if (GVAR(objectViewDistanceCoeff) == 6) then {
|
||||
_text = format ["<t align='center'>%1 %2<br/>Min. %3<br/>Max. %4</t>", localize LSTRING(objectinfotext), localize LSTRING(object_fovBased), GVAR(fovBasedPFHminimalViewDistance), viewDistance];
|
||||
} else {
|
||||
_text = if (_new_view_distance <= _view_distance_limit) then {
|
||||
format ["<t align='center'>%1 %2m", localize LSTRING(infotext), viewDistance];
|
||||
} else {
|
||||
format ["<t align='center'>%1 %2m", localize LSTRING(invalid), viewDistance];
|
||||
};
|
||||
_text = _text + format ["<br/><t align='center'>%1 %2%3</t>", localize LSTRING(objectinfotext), _object_view_distance_coeff * 100, "%"];
|
||||
};
|
||||
[parseText _text, 2] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
[parseText _text,2] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
|
@ -27,6 +27,7 @@ _return = switch (_index) do {
|
||||
case 3: {0.60}; // Medium
|
||||
case 4: {0.80}; // High
|
||||
case 5: {1.00}; // Very High
|
||||
case 6: {"fov"}; // FoV Based
|
||||
default {0.50}; // something broke if this returns
|
||||
};
|
||||
|
||||
|
36
addons/viewdistance/functions/fnc_setFovBasedOvdPFH.sqf
Normal file
36
addons/viewdistance/functions/fnc_setFovBasedOvdPFH.sqf
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Author: Jonpas
|
||||
* Sets Object View Distance dynamically based on current Field of View, between Object View Distance (minimal value) and View Distance (maximum value) set before this PFH starts.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_viewdistance_fnc_setFovBasedObjectViewDistance
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_args", "_idPFH"];
|
||||
|
||||
// Remove PFH and set Object View Distance back to what it was before
|
||||
if (GVAR(objectViewDistanceCoeff) < 6) exitWith {
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
GVAR(fovBasedPFHminimalViewDistance) = nil;
|
||||
};
|
||||
|
||||
private ["_zoom"];
|
||||
_zoom = (call CBA_fnc_getFov) select 1;
|
||||
|
||||
if (_zoom > 0.94) then {
|
||||
// Dynamically set Object View Distance based on player's Zoom Level and View Distance
|
||||
setObjectViewDistance ((_zoom/34.98 * (viewDistance - GVAR(fovBasedPFHminimalViewDistance))) + GVAR(fovBasedPFHminimalViewDistance));
|
||||
} else {
|
||||
setObjectViewDistance GVAR(fovBasedPFHminimalViewDistance);
|
||||
};
|
||||
|
||||
TRACE_2("FoV Based",getObjectViewDistance select 0,_zoom);
|
@ -114,7 +114,7 @@
|
||||
<Portuguese>Distância de visão dinâmica dos objetos</Portuguese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_ViewDistance_object_Description">
|
||||
<English>Sets the object view distance as a coefficient of the view distance.</English>
|
||||
<English>Sets the object view distance as a coefficient of the view distance or based on field of view. FoV Based's lowest and highest value is the value which is set when enabling the option.</English>
|
||||
<Polish>Zmienia zasięg rysowania obiektów jako mnożnik zasięgu widzenia.</Polish>
|
||||
<Spanish>Establece la distancia de visión de objetos como un coeficiente de la distancia de visión.</Spanish>
|
||||
<Czech>Nastaví objekt dohlednosti jako koeficient dohlednosti.</Czech>
|
||||
@ -169,6 +169,9 @@
|
||||
<German>Sehr hoch</German>
|
||||
<Portuguese>Muito alto</Portuguese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_ViewDistance_object_fovBased">
|
||||
<English>FoV Based</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_ViewDistance_infotext">
|
||||
<English>View Distance:</English>
|
||||
<Polish>Zasięg widzenia:</Polish>
|
||||
|
Loading…
Reference in New Issue
Block a user