From 40f32b604a1d99901a1e7047afc82ec78ffd6d2f Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Tue, 21 Jul 2015 11:59:20 +0100 Subject: [PATCH] Camera vision modes --- addons/spectator/XEH_preInit.sqf | 1 + .../functions/fnc_handleInterface.sqf | 7 ++++-- .../functions/fnc_transitionCamera.sqf | 22 +++++++++++++++---- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf index 291e1a2a09..100c45dea9 100644 --- a/addons/spectator/XEH_preInit.sqf +++ b/addons/spectator/XEH_preInit.sqf @@ -24,6 +24,7 @@ GVAR(camPos) = [worldSize * 0.5,worldSize * 0.5,20]; GVAR(camSpeed) = 1; GVAR(camTilt) = -10; GVAR(camUnit) = objNull; +GVAR(camVision) = -2; GVAR(camZoom) = 1.3; GVAR(showComp) = true; diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 14d74bf81b..abe9cc8c47 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -28,7 +28,7 @@ switch (toLower _mode) do { // Initalize camera variables GVAR(camBoom) = [false,false]; GVAR(camDolly) = [false,false,false,false]; - GVAR(gunCam) = false; + GVAR(camGun) = false; // Initalize display variables GVAR(ctrlKey) = false; @@ -67,7 +67,7 @@ switch (toLower _mode) do { GVAR(camera) = nil; GVAR(camBoom) = nil; GVAR(camDolly) = nil; - GVAR(gunCam) = nil; + GVAR(camGun) = nil; // Cleanup display variables GVAR(ctrlKey) = nil; @@ -187,6 +187,9 @@ switch (toLower _mode) do { }; case 44: { // Z GVAR(camBoom) set [1,true]; + }; + case 49: { // N + }; case 50: { // M [_display,nil,nil,nil,true] call FUNC(toggleInterface); diff --git a/addons/spectator/functions/fnc_transitionCamera.sqf b/addons/spectator/functions/fnc_transitionCamera.sqf index 1ebd048e2d..a0b1bfe48a 100644 --- a/addons/spectator/functions/fnc_transitionCamera.sqf +++ b/addons/spectator/functions/fnc_transitionCamera.sqf @@ -1,6 +1,6 @@ /* * Author: SilentSpike - * Transitions the spectator camera view mode/unit + * Transitions the spectator camera vision/view mode/unit * * Arguments: * 0: Camera mode @@ -8,6 +8,11 @@ * - 1: Internal * - 2: External * 1: Camera unit + * 2: Vision mode + * - -2: Normal + * - -1: NV + * - 0: White hot + * - 1: Black hot * * Return Value: * None @@ -20,7 +25,7 @@ #include "script_component.hpp" -params [["_newMode",GVAR(camMode)],["_newUnit",GVAR(camUnit)]]; +params [["_newMode",GVAR(camMode)], ["_newUnit",GVAR(camUnit)], ["_newVision",GVAR(camVision)]]; // When no units available to spectate, exit to freecam if (GVAR(unitList) isEqualTo []) then { @@ -30,7 +35,7 @@ if (GVAR(unitList) isEqualTo []) then { // Reset gun cam if not internal if (_newMode != 1) then { - GVAR(gunCam) = false; + GVAR(camGun) = false; }; if (_newMode == 0) then { // Free @@ -45,6 +50,15 @@ if (_newMode == 0) then { // Free showCinemaBorder false; cameraEffectEnableHUD false; + // Vision mode only applies to free cam + if (_newVision < 0) then { + false setCamUseTi 0; + camUseNVG (_newVision >= -1); + } else { + true setCamUseTi _newVision; + }; + GVAR(camVision) = _newVision; + // Handle camera movement if (isNil QGVAR(camHandler)) then { GVAR(camHandler) = [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; }; } else { @@ -55,7 +69,7 @@ if (_newMode == 0) then { // Free if (_newMode == 1) then { // Internal // Handle gun cam - if (GVAR(gunCam)) then { + if (GVAR(camGun)) then { _newUnit switchCamera "gunner"; } else { _newUnit switchCamera "internal";