mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
56 lines
1.9 KiB
Plaintext
56 lines
1.9 KiB
Plaintext
// by commy2
|
|
#include "script_component.hpp"
|
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
GVAR(camera) = objNull;
|
|
|
|
0 = 0 spawn {
|
|
// Workarround for the ThreeDen Editor Camera
|
|
if ((!isNil {is3DEN}) && {is3DEN}) exitWith {
|
|
ACE_LOGINFO("Eden detected: disabling Optics PIP Camera");
|
|
};
|
|
|
|
waitUntil {!isNull ACE_player};
|
|
waitUntil {sleep 1; {_x != GVAR(camera)} count allMissionObjects "camera" == 0 && {isNull curatorCamera}};
|
|
|
|
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"];
|
|
};
|
|
|
|
// save control for fired EH
|
|
["ace_infoDisplayChanged", {
|
|
if (!isNull ((_this select 0) displayCtrl 1713001)) then {
|
|
uiNamespace setVariable [QGVAR(RscWeaponInfo2D), _this select 0];
|
|
};
|
|
}] 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;
|
|
|
|
// Register fire event handler
|
|
["ace_firedPlayer", DFUNC(handleFired)] call CBA_fnc_addEventHandler;
|