From 5e3d4866a67e6c61ccec2a62580c851fdd9e727f Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 12 Jun 2016 01:53:03 -0500 Subject: [PATCH] Prepare camera when optic equipped --- addons/optics/functions/fnc_onDrawScope2D.sqf | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/addons/optics/functions/fnc_onDrawScope2D.sqf b/addons/optics/functions/fnc_onDrawScope2D.sqf index 703386092f..6e8ba739d8 100644 --- a/addons/optics/functions/fnc_onDrawScope2D.sqf +++ b/addons/optics/functions/fnc_onDrawScope2D.sqf @@ -20,16 +20,6 @@ disableSerialization; private _display = _this select 0; -//If we are not zoomed into the actual scope (not collimator) -if (!ctrlShown (_display displayCtrl 154)) exitWith { - (_display displayCtrl 1713001) ctrlShow false; - (_display displayCtrl 1713002) ctrlShow false; - (_display displayCtrl 1713005) ctrlShow false; - (_display displayCtrl 1713006) ctrlShow false; - (_display displayCtrl 1713010) ctrlShow false; - (_display displayCtrl 1713011) ctrlShow false; -}; - // @todo, all weapon types private _optic = (primaryWeaponItems ACE_player) select 2; private _isPIP = (getText (configFile >> "CfgWeapons" >> _optic >> "ItemInfo" >> "modelOptics")) == QPATHTOF(models\ace_optics_pip.p3d); @@ -40,7 +30,7 @@ if (_isPIP) then { if ((({_x != GVAR(camera)} count allMissionObjects "camera") > 0) || {!isNull curatorCamera}) exitWith { TRACE_1("waiting for feature camera to end",GVAR(camera)); }; - + // PiP technique by BadBenson GVAR(camera) = "camera" camCreate positionCameraToWorld [0,0,0]; GVAR(camera) camSetFov 0.7; @@ -51,7 +41,7 @@ if (_isPIP) then { GVAR(camera) cameraEffect ["INTERNAL", "BACK", "ace_optics_rendertarget0"]; TRACE_2("created new pip camera",GVAR(camera),isNull GVAR(camera)); - + //Start a waitUntil to handle destruction after GVAR(pipLastFrame) is no longer updated [{ (abs (diag_frameno - GVAR(pipLastFrame))) > 1 @@ -61,7 +51,19 @@ if (_isPIP) then { TRACE_2("destroyed pip camera",GVAR(camera),isNull GVAR(camera)); }, []] call CBA_fnc_waitUntilAndExecute; }; +}; +//If we are not zoomed into the actual scope (not collimator) +if (!ctrlShown (_display displayCtrl 154)) exitWith { + (_display displayCtrl 1713001) ctrlShow false; + (_display displayCtrl 1713002) ctrlShow false; + (_display displayCtrl 1713005) ctrlShow false; + (_display displayCtrl 1713006) ctrlShow false; + (_display displayCtrl 1713010) ctrlShow false; + (_display displayCtrl 1713011) ctrlShow false; +}; + +if (_isPIP) then { GVAR(camera) setPosATL positionCameraToWorld [0,0,0.4]; GVAR(camera) camPrepareTarget positionCameraToWorld [0,0,50]; GVAR(camera) camCommitPrepared 0;