From 0de56740c01cdc8ed4c7d3bfe339f45965565960 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sun, 19 Jul 2015 16:35:30 +0100 Subject: [PATCH] Improved camera mode transition --- .../spectator/functions/fnc_updateCamera.sqf | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/addons/spectator/functions/fnc_updateCamera.sqf b/addons/spectator/functions/fnc_updateCamera.sqf index a377bb50f2..2e3e540938 100644 --- a/addons/spectator/functions/fnc_updateCamera.sqf +++ b/addons/spectator/functions/fnc_updateCamera.sqf @@ -22,19 +22,18 @@ params [["_newMode",GVAR(camMode)],["_newUnit",GVAR(camUnit)]]; -// Reset gun cam if mode is changing -if (_newMode != GVAR(camMode)) then { - GVAR(gunCam) = false; - GVAR(camMode) = _newMode; -}; - // When no units available to spectate, exit to freecam if (GVAR(unitList) isEqualTo []) then { - GVAR(camMode) = 0; - GVAR(camUnit) = objNull; + _newMode = 0; + _newUnit = objNull; }; -if (GVAR(camMode) == 0) then { // Free +// Reset gun cam if not internal +if (_newMode != 1) then { + GVAR(gunCam) = false; +}; + +if (_newMode == 0) then { // Free // Preserve camUnit value for consistency when manually changing view GVAR(camera) cameraEffect ["internal", "back"]; @@ -50,7 +49,7 @@ if (GVAR(camMode) == 0) then { // Free _newUnit = GVAR(unitList) select floor(random(count GVAR(unitList))); }; - if (GVAR(camMode) == 1) then { // Internal + if (_newMode == 1) then { // Internal // Handle gun cam if (GVAR(gunCam)) then { _newUnit switchCamera "gunner"; @@ -68,3 +67,5 @@ if (GVAR(camMode) == 0) then { // Free GVAR(camHandler) = nil; cameraEffectEnableHUD true; }; + +GVAR(camMode) = _newMode;