ACE3/addons/spottingscope/functions/fnc_animateReticle.sqf

48 lines
1.1 KiB
Plaintext
Raw Normal View History

#include "script_component.hpp"
2016-06-06 15:22:17 +00:00
/*
* Author: commy2
* Animate scripted reticle of spotting scope.
*
* Arguments:
* 0: Reticles RSC info display <DISPLAY>
*
2016-06-18 09:50:41 +00:00
* Return Value:
2016-06-06 15:22:17 +00:00
* None
*
* Example:
* [DISPLAY] call ace_spottingscope_fnc_animateReticle
*
2016-06-06 15:22:17 +00:00
* Public: No
*/
disableSerialization;
2016-06-06 17:22:24 +00:00
params ["_display"];
uinamespace setVariable [QGVAR(dlgSpottingScope), _display];
2016-06-06 15:22:17 +00:00
2016-06-06 21:14:19 +00:00
private _ctrlReticle = _display displayCtrl IDC_RETICLE;
private _ctrlBody = _display displayCtrl IDC_BODY;
private _ctrlBlackLeft = _display displayCtrl IDC_BLACK_LEFT;
private _ctrlBlackRight = _display displayCtrl IDC_BLACK_RIGHT;
2016-06-06 15:22:17 +00:00
// check if optics are used
// hide all controls otherwise
private _isUsingOptic = ctrlShown (_display displayCtrl 154);
_ctrlReticle ctrlShow _isUsingOptic;
_ctrlBody ctrlShow _isUsingOptic;
2016-06-06 21:14:19 +00:00
_ctrlBlackLeft ctrlShow _isUsingOptic;
_ctrlBlackRight ctrlShow _isUsingOptic;
2016-06-06 15:22:17 +00:00
2016-06-06 21:14:19 +00:00
// animate reticle
2016-06-06 17:22:24 +00:00
private _zoom = ([] call EFUNC(common,getZoom)) * MAGIC_SCOPE_NUMBER;
2016-06-06 15:22:17 +00:00
2016-06-06 17:22:24 +00:00
_ctrlReticle ctrlSetPosition [
POS_X_BASE(_zoom),
POS_Y_BASE(_zoom),
POS_W_BASE(_zoom),
POS_H_BASE(_zoom)
2016-06-06 15:22:17 +00:00
];
2016-06-06 17:22:24 +00:00
_ctrlReticle ctrlCommit 0;