2015-02-10 04:22:10 +00:00
|
|
|
/*
|
2015-08-07 14:43:06 +00:00
|
|
|
* Author: KoffeinFlummi, esteldunedain
|
2015-02-10 04:22:10 +00:00
|
|
|
* Display the adjustment knobs, update their value and fade them out later
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
2015-08-07 14:43:06 +00:00
|
|
|
* Example:
|
|
|
|
* [] call ace_scopes_fnc_showZeroing
|
|
|
|
*
|
2015-02-10 04:22:10 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
2015-02-10 02:00:40 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-07 14:43:06 +00:00
|
|
|
private ["_weaponIndex", "_adjustment", "_layer", "_display", "_zeroing", "_vertical", "_horizontal"];
|
2015-02-10 02:00:40 +00:00
|
|
|
|
2015-08-07 14:43:06 +00:00
|
|
|
disableSerialization;
|
2015-02-10 02:00:40 +00:00
|
|
|
|
2015-02-12 14:57:55 +00:00
|
|
|
_weaponIndex = [ACE_player, currentWeapon ACE_player] call EFUNC(common,getWeaponIndex);
|
2015-02-10 04:22:10 +00:00
|
|
|
if (_weaponIndex < 0) exitWith {};
|
2015-02-10 02:00:40 +00:00
|
|
|
|
|
|
|
_adjustment = ACE_player getVariable QGVAR(Adjustment);
|
|
|
|
if (isNil "_adjustment") then {
|
2015-04-11 12:02:44 +00:00
|
|
|
// [Windage, Elevation, Zero]
|
2015-08-07 14:43:06 +00:00
|
|
|
_adjustment = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];
|
2015-02-10 02:00:40 +00:00
|
|
|
};
|
|
|
|
|
2015-02-10 04:22:10 +00:00
|
|
|
// Display the adjustment knobs
|
|
|
|
_layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer;
|
|
|
|
_layer cutRsc [QGVAR(Zeroing), "PLAIN", 0, false];
|
|
|
|
|
|
|
|
// Find the display
|
|
|
|
_display = uiNamespace getVariable [QGVAR(ZeroingDisplay), displayNull];
|
|
|
|
if (isNull _display) exitWith {};
|
|
|
|
|
|
|
|
// Update values
|
|
|
|
_zeroing = _adjustment select _weaponIndex;
|
2015-08-07 14:43:06 +00:00
|
|
|
_zeroing params ["_elevation", "_windage"];
|
2015-02-12 14:51:17 +00:00
|
|
|
_vertical = _display displayCtrl 12;
|
|
|
|
_horizontal = _display displayCtrl 13;
|
2015-08-07 14:43:06 +00:00
|
|
|
_vertical ctrlSetText (str _elevation);
|
|
|
|
_horizontal ctrlSetText (str _windage);
|
2015-02-10 04:22:10 +00:00
|
|
|
|
2015-10-21 20:52:21 +00:00
|
|
|
// Set the time when to hide the knobs
|
2015-05-21 16:42:44 +00:00
|
|
|
GVAR(timeToHide) = ACE_diagTime + 3.0;
|
2015-02-10 04:22:10 +00:00
|
|
|
|
|
|
|
if !(isNil QGVAR(fadePFH)) exitWith {};
|
|
|
|
|
|
|
|
// Launch a PFH to wait and fade out the knobs
|
|
|
|
GVAR(fadePFH) = [{
|
2015-05-21 16:42:44 +00:00
|
|
|
if (ACE_diagTime >= GVAR(timeToHide)) exitWith {
|
2015-02-10 04:22:10 +00:00
|
|
|
private "_layer";
|
2015-08-07 14:43:06 +00:00
|
|
|
params ["", "_pfhId"];
|
2015-02-10 04:22:10 +00:00
|
|
|
_layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer;
|
|
|
|
_layer cutFadeOut 2;
|
|
|
|
|
|
|
|
GVAR(fadePFH) = nil;
|
2015-11-30 15:45:20 +00:00
|
|
|
[_pfhId] call CBA_fnc_removePerFrameHandler;
|
2015-02-10 04:22:10 +00:00
|
|
|
};
|
|
|
|
}, 0.1, []] call CBA_fnc_addPerFrameHandler
|