Prepare camera when optic equipped

This commit is contained in:
PabstMirror 2016-06-12 01:53:03 -05:00
parent d14392c35c
commit 5e3d4866a6

View File

@ -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;