More reliable freecam PFH termination

This commit is contained in:
SilentSpike 2015-07-18 17:06:13 +01:00
parent fb2b2bc9e5
commit 7b28214c80
3 changed files with 5 additions and 2 deletions

View File

@ -17,7 +17,7 @@
#include "script_component.hpp"
// Kill PFH when not in free cam (or display is closed)
if ((GVAR(camMode) != 0) || isNull (GETUVAR(GVAR(display),displayNull))) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; };
if (isNil QGVAR(camHandler)) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; };
_oldPos = getPosASL GVAR(camera);
_mX = 0;

View File

@ -135,6 +135,8 @@ switch (toLower _mode) do {
with uiNamespace do {
GVAR(display) = nil;
};
GVAR(camHandler) = nil;
};
// Mouse events
case "onmousebuttondown": {

View File

@ -23,7 +23,7 @@ if (GVAR(camMode) == 0) then { // Free
cameraEffectEnableHUD false;
// Handle camera movement
[FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler;
if (isNil QGVAR(camHandler)) then { GVAR(camHandler) = [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; };
} else {
// When null unit is given choose random
if (isNull _newUnit) then {
@ -45,5 +45,6 @@ if (GVAR(camMode) == 0) then { // Free
// Terminate camera view
GVAR(camera) cameraEffect ["terminate", "back"];
GVAR(camHandler) = nil;
cameraEffectEnableHUD true;
};