Merge pull request #2316 from acemod/322customcamera

fix custom cameras (for intros) being broken with ACE, fix #2248
This commit is contained in:
commy2 2015-08-31 21:32:02 +02:00
commit 80a0c93bdc
3 changed files with 16 additions and 18 deletions

View File

@ -289,22 +289,13 @@ GVAR(OldVisibleMap) = false;
}, 0, []] call CBA_fnc_addPerFrameHandler;
// PFH to raise camera created event. Only works on these cams by BI.
#define ALL_CAMERAS [ \
missionNamespace getVariable ["BIS_DEBUG_CAM", objNull], \
missionNamespace getVariable ["BIS_fnc_camera_cam", objNull], \
uiNamespace getVariable ["BIS_fnc_arsenal_cam", objNull], \
uiNamespace getVariable ["BIS_fnc_animViewer_cam", objNull], \
missionNamespace getVariable ["BIS_fnc_establishingShot_fakeUAV", objNull] \
]
GVAR(OldIsCamera) = false;
[{
// "activeCameraChanged" event
private ["_isCamera"];
_isCamera = {!isNull _x} count ALL_CAMERAS > 0;
_isCamera = call FUNC(isfeatureCameraActive);
if !(_isCamera isEqualTo GVAR(OldIsCamera)) then {
// Raise ACE event locally
GVAR(OldIsCamera) = _isCamera;

View File

@ -3,16 +3,22 @@
if (!hasInterface) exitWith {};
GVAR(camera) = objNull;
0 = 0 spawn {
waituntil {!isNull ACE_player};
waituntil {sleep 1; {_x != GVAR(camera)} count allMissionObjects "camera" == 0};
GVAR(camera) cameraEffect ["TERMINATE", "BACK"];
camDestroy GVAR(camera);
// PiP technique by BadBenson
GVAR(camera) = "camera" camCreate positioncameratoworld [0,0,0];
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 [2, 1.0, 1.0, 1.0, 0.0, [0.0, 1.0, 0.0, 0.25], [1.0, 0.0, 1.0, 1.0], [0.199, 0.587, 0.114, 0.0]];
"ace_optics_rendertarget0" setPiPEffect [0];
GVAR(camera) cameraEffect ["INTERNAL", "BACK", "ace_optics_rendertarget0"];
};
@ -23,18 +29,19 @@ if (!hasInterface) exitWith {};
};
}] call EFUNC(common,addEventHandler);
// camera has to be re-created every ACE_time another camera is created. Otherwise r2t is either black or transparent. @todo Add popular custom cameras to the event in ACE_common.
// 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 {
deleteVehicle GVAR(camera);
GVAR(camera) cameraEffect ["TERMINATE", "BACK"];
camDestroy GVAR(camera);
// PiP technique by BadBenson
GVAR(camera) = "camera" camCreate positioncameratoworld [0,0,0];
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 [2, 1.0, 1.0, 1.0, 0.0, [0.0, 1.0, 0.0, 0.25], [1.0, 0.0, 1.0, 1.0], [0.199, 0.587, 0.114, 0.0]];
"ace_optics_rendertarget0" setPiPEffect [0];
GVAR(camera) cameraEffect ["INTERNAL", "BACK", "ace_optics_rendertarget0"];
};
}] call EFUNC(common,addEventHandler);

View File

@ -22,8 +22,8 @@ _optic = (primaryWeaponItems ACE_player) select 2;
_isPIP = (getText (configFile >> "CfgWeapons" >> _optic >> "ItemInfo" >> "modelOptics")) == QUOTE(PATHTOF(models\ace_optics_pip.p3d));
if (_isPIP) then {
GVAR(camera) setposATL positioncameratoworld [0,0,0.4];
GVAR(camera) camPrepareTarget positioncameratoworld [0,0,50];
GVAR(camera) setPosATL positionCameraToWorld [0,0,0.4];
GVAR(camera) camPrepareTarget positionCameraToWorld [0,0,50];
GVAR(camera) camCommitPrepared 0;
// @todo, check if that needs to be done at all