Skip to content

Commit

Permalink
Occlusion Fade Time Setting
Browse files Browse the repository at this point in the history
  • Loading branch information
diwako committed Feb 14, 2019
1 parent 2ae52d6 commit 9d864aa
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 8 deletions.
20 changes: 20 additions & 0 deletions addons/main/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -756,5 +756,25 @@
<Japanese>レイアウト エディタを使用して位置を変更します。</Japanese>
<Portuguese>Usa a posição definida no editor de layout do jogo ao invés da posição padrão</Portuguese>
</Key>
<Key ID="STR_dui_occlusion_fade_time">
<English>Occlusion Fade Time</English>
<!-- <Czech></Czech> -->
<!-- <French></French> -->
<German>Okklusionsüberblendzeit</German>
<!-- <Korean></Korean> -->
<!-- <Japanese></Japanese> -->
<!-- <Polish></Polish> -->
<!-- <Portuguese></Portuguese> -->
</Key>
<Key ID="STR_dui_occlusion_fade_time_desc">
<English>Sets the time it takes for icons to fade away on the radar</English>
<!-- <Czech></Czech> -->
<!-- <French></French> -->
<German>Stellt die Zeit ein wie lange es dauert, bis ein Icon vom Radar verschwindet</German>
<!-- <Korean></Korean> -->
<!-- <Japanese></Japanese> -->
<!-- <Polish></Polish> -->
<!-- <Portuguese></Portuguese> -->
</Key>
</Package>
</Project>
2 changes: 1 addition & 1 deletion addons/radar/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ GVAR(uiPixels) = DUI_128PX;

GVAR(a3UiScale) = linearConversion [0.55,0.7,getResolution # 5,1,0.85,false];
GVAR(windowHeightMod) = linearConversion [1080,1440,getResolution # 1,1,0.75,false];
diwako_dui_bearing_size_calc = diwako_dui_dir_size * GVAR(a3UiScale) * diwako_dui_hudScaling * GVAR(windowHeightMod);
GVAR(bearing_size_calc) = diwako_dui_dir_size * GVAR(a3UiScale) * diwako_dui_hudScaling * GVAR(windowHeightMod);
GVAR(vehicleNamespace) = [] call CBA_fnc_createNamespace;

if !(isNil "ace_nightvision") then {
Expand Down
9 changes: 9 additions & 0 deletions addons/radar/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@ private _curCat = localize "STR_dui_cat_compass";
}
] call CBA_Settings_fnc_init;

[
QGVAR(occlusion_fade_time)
,"SLIDER"
,[localize "STR_dui_occlusion_fade_time", localize "STR_dui_occlusion_fade_time_desc"]
,[CBA_SETTINGS_CAT, _curCat]
,[2, 60, 10, 1]
,false
] call CBA_Settings_fnc_init;

[
"diwako_dui_compass_icon_scale"
,"SLIDER"
Expand Down
2 changes: 1 addition & 1 deletion addons/radar/functions/fnc_cacheLoop.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ if (diwako_dui_enable_compass) then {
_compassY = profileNamespace getVariable ["igui_diwako_dui_compass_y", _compassY];
};

diwako_dui_bearing_size_calc = diwako_dui_dir_size * GVAR(a3UiScale) * diwako_dui_hudScaling * GVAR(windowHeightMod);
GVAR(bearing_size_calc) = diwako_dui_dir_size * GVAR(a3UiScale) * diwako_dui_hudScaling * GVAR(windowHeightMod);

_compassCtrl ctrlSetPosition [
_ctrlMiddleX,
Expand Down
4 changes: 2 additions & 2 deletions addons/radar/functions/fnc_compass.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ GVAR(compass_pfHandle) = [{

if (_hasCompass && {diwako_dui_enable_compass_dir == 2 || {diwako_dui_enable_compass_dir == 1 && {!(isNull objectParent _player)}}}) then {
if (diwako_dui_dir_showMildot) then {
_dirCtrl ctrlSetStructuredText parseText format ["<t align='center' size='%3' shadow='2' shadowColor='#000000'>%1 | %2</t>", (round _dir) mod 360, round (_dir / 0.056250), diwako_dui_bearing_size_calc];
_dirCtrl ctrlSetStructuredText parseText format ["<t align='center' size='%3' shadow='2' shadowColor='#000000'>%1 | %2</t>", (round _dir) mod 360, round (_dir / 0.056250), GVAR(bearing_size_calc)];
} else {
_dirCtrl ctrlSetStructuredText parseText format ["<t align='center' size='%2' shadow='2' shadowColor='#000000'>%1</t>", (round _dir) mod 360, diwako_dui_bearing_size_calc];
_dirCtrl ctrlSetStructuredText parseText format ["<t align='center' size='%2' shadow='2' shadowColor='#000000'>%1</t>", (round _dir) mod 360, GVAR(bearing_size_calc)];
};
} else {
_dirCtrl ctrlSetText "";
Expand Down
9 changes: 5 additions & 4 deletions addons/radar/functions/fnc_displayUnitOnCompass.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if (_distance <= _circleRange) then {
};

if (diwako_dui_enable_occlusion && {_fade > 0}) then {
private _lastSeen = _unit getVariable "diwako_dui_lastSeen";
private _lastSeen = _unit getVariable QGVAR(lastSeen);
private _occlude = !isNil "_lastSeen";
if (_unit getVariable ["diwako_dui_lastChecked", -1] < time) then {
_unit setVariable ["diwako_dui_lastChecked", time + 1];
Expand All @@ -41,7 +41,7 @@ if (diwako_dui_enable_occlusion && {_fade > 0}) then {
} else {
// unit visible
if !(isNil "_lastSeen") then {
_unit setVariable ["diwako_dui_lastSeen", nil];
_unit setVariable [QGVAR(lastSeen), nil];
};
_occlude = false;
};
Expand All @@ -50,10 +50,11 @@ if (diwako_dui_enable_occlusion && {_fade > 0}) then {
// unit not visible anymore
if (isNil "_lastSeen") then {
_lastSeen = time;
_unit setVariable ["diwako_dui_lastSeen", _lastSeen];
_unit setVariable [QGVAR(lastSeen), _lastSeen];
};
_fade = linearConversion [0, 10, time - _lastSeen, 1, 0, true] min _fade;
_fade = linearConversion [0, GVAR(occlusion_fade_time), time - _lastSeen, 1, 0, true] min _fade;
};
_unit setVariable [QGVAR(occlusion_fade), _fade];
};

private _ctrl = _ctrlGrp getVariable [format ["diwako_dui_ctrl_unit_%1", _unitID], controlNull];
Expand Down

0 comments on commit 9d864aa

Please sign in to comment.