ACE3/addons/optics/XEH_postInit.sqf

56 lines
1.9 KiB
Plaintext
Raw Normal View History

2015-04-03 10:33:12 +00:00
// by commy2
#include "script_component.hpp"
2015-04-03 20:30:29 +00:00
2015-04-04 10:06:20 +00:00
if (!hasInterface) exitWith {};
2015-04-03 20:30:29 +00:00
GVAR(camera) = objNull;
2015-04-04 10:06:20 +00:00
0 = 0 spawn {
// Workarround for the ThreeDen Editor Camera
if ((!isNil {is3DEN}) && {is3DEN}) exitWith {
ACE_LOGINFO("Eden detected: disabling Optics PIP Camera");
};
2016-02-06 20:50:35 +00:00
2015-11-30 16:28:01 +00:00
waitUntil {!isNull ACE_player};
waitUntil {sleep 1; {_x != GVAR(camera)} count allMissionObjects "camera" == 0 && {isNull curatorCamera}};
GVAR(camera) cameraEffect ["TERMINATE", "BACK"];
camDestroy GVAR(camera);
2015-04-04 10:06:20 +00:00
// PiP technique by BadBenson
GVAR(camera) = "camera" camCreate positionCameraToWorld [0,0,0];
2015-04-04 10:06:20 +00:00
GVAR(camera) camSetFov 0.7;
GVAR(camera) camSetTarget ACE_player;
GVAR(camera) camCommit 1;
"ace_optics_rendertarget0" setPiPEffect [0];
2015-04-04 10:06:20 +00:00
GVAR(camera) cameraEffect ["INTERNAL", "BACK", "ace_optics_rendertarget0"];
};
2015-04-04 04:19:19 +00:00
// save control for fired EH
2016-05-24 13:13:11 +00:00
["ace_infoDisplayChanged", {
2015-04-04 04:19:19 +00:00
if (!isNull ((_this select 0) displayCtrl 1713001)) then {
2015-04-04 10:06:20 +00:00
uiNamespace setVariable [QGVAR(RscWeaponInfo2D), _this select 0];
2015-04-04 04:19:19 +00:00
};
}] call CBA_fnc_addEventHandler;
// camera has to be re-created every time another camera is created. Otherwise r2t is either black or transparent. @todo Add popular custom cameras to the event in ACE_common.
["activeCameraChanged", {
if !(_this select 1) then {
GVAR(camera) cameraEffect ["TERMINATE", "BACK"];
camDestroy GVAR(camera);
// PiP technique by BadBenson
GVAR(camera) = "camera" camCreate positionCameraToWorld [0,0,0];
GVAR(camera) camSetFov 0.7;
GVAR(camera) camSetTarget ACE_player;
GVAR(camera) camCommit 1;
"ace_optics_rendertarget0" setPiPEffect [0];
GVAR(camera) cameraEffect ["INTERNAL", "BACK", "ace_optics_rendertarget0"];
};
}] call CBA_fnc_addEventHandler;
2016-02-06 20:50:35 +00:00
// Register fire event handler
2016-05-24 13:13:11 +00:00
["ace_firedPlayer", DFUNC(handleFired)] call CBA_fnc_addEventHandler;