Merge pull request #755 from acemod/fixoptics2

Fix for PIP scopes, fix #547
This commit is contained in:
commy2 2015-04-19 07:46:41 +02:00
commit c9a2505031
3 changed files with 46 additions and 5 deletions

View File

@ -196,6 +196,31 @@ GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
}, 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
_isCamera = {!isNull _x} count ALL_CAMERAS > 0;
if !(_isCamera isEqualTo GVAR(OldIsCamera)) then {
// Raise ACE event locally
GVAR(OldIsCamera) = _isCamera;
["activeCameraChanged", [ACE_player, _isCamera]] call FUNC(localEvent);
};
}, 1, []] call cba_fnc_addPerFrameHandler; // feel free to decrease the sleep time if you need it.
[QGVAR(StateArrested),false,true,QUOTE(ADDON)] call FUNC(defineVariable);
["displayTextStructured", FUNC(displayTextStructured)] call FUNC(addEventhandler);

View File

@ -98,7 +98,7 @@ class CfgWeapons {
class ACE_optic_Hamr_PIP: ACE_optic_Hamr_2D {
author = "$STR_ACE_Common_ACETeam";
_generalMacro = "ACE_optic_Hamr_PIP";
scopeArsenal = 1;
//scopeArsenal = 1;
displayName = "$STR_ACE_optic_hamr_pip";
class ItemInfo: ItemInfo {
@ -147,7 +147,7 @@ class CfgWeapons {
class ACE_optic_Arco_PIP: ACE_optic_Arco_2D {
author = "$STR_ACE_Common_ACETeam";
_generalMacro = "ACE_optic_Arco_PIP";
scopeArsenal = 1;
//scopeArsenal = 1;
displayName = "$STR_ACE_optic_arco_pip";
class ItemInfo: ItemInfo {
@ -197,7 +197,7 @@ class CfgWeapons {
author = "$STR_ACE_Common_ACETeam";
_generalMacro = "ACE_optic_MRCO_PIP";
scope = 1;
scopeArsenal = 1;
//scopeArsenal = 1;
displayName = "$STR_ACE_optic_valdada_pip";
class ItemInfo: ItemInfo {
@ -239,7 +239,7 @@ class CfgWeapons {
class ACE_optic_SOS_PIP: ACE_optic_SOS_2D {
author = "$STR_ACE_Common_ACETeam";
_generalMacro = "ACE_optic_SOS_PIP";
scopeArsenal = 1;
//scopeArsenal = 1;
displayName = "$STR_ACE_optic_sos_pip";
class ItemInfo: ItemInfo {
@ -290,7 +290,7 @@ class CfgWeapons {
class ACE_optic_LRPS_PIP: ACE_optic_LRPS_2D {
author = "$STR_ACE_Common_ACETeam";
_generalMacro = "ACE_optic_LRPS_PIP";
scopeArsenal = 1;
//scopeArsenal = 1;
displayName = "$STR_ACE_optic_lrps_pip";
class ItemInfo: ItemInfo {

View File

@ -22,3 +22,19 @@ if (!hasInterface) exitWith {};
uiNamespace setVariable [QGVAR(RscWeaponInfo2D), _this select 0];
};
}] call EFUNC(common,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 {
deleteVehicle 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 [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]];
GVAR(camera) cameraEffect ["INTERNAL", "BACK", "ace_optics_rendertarget0"];
};
}] call EFUNC(common,addEventHandler);