From 005b2ad40677600d882c6754cdcb45fd084025a7 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Mon, 20 Jul 2015 23:20:05 +0100 Subject: [PATCH] camTilt should persist --- addons/spectator/XEH_preInit.sqf | 1 + addons/spectator/functions/fnc_handleCamera.sqf | 2 +- addons/spectator/functions/fnc_handleInterface.sqf | 5 ----- .../spectator/functions/fnc_setCameraAttributes.sqf | 12 ++++++------ 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf index 5d9fc20ac1..291e1a2a09 100644 --- a/addons/spectator/XEH_preInit.sqf +++ b/addons/spectator/XEH_preInit.sqf @@ -22,6 +22,7 @@ GVAR(camMode) = 0; GVAR(camPan) = 0; GVAR(camPos) = [worldSize * 0.5,worldSize * 0.5,20]; GVAR(camSpeed) = 1; +GVAR(camTilt) = -10; GVAR(camUnit) = objNull; GVAR(camZoom) = 1.3; diff --git a/addons/spectator/functions/fnc_handleCamera.sqf b/addons/spectator/functions/fnc_handleCamera.sqf index cbedd66a86..8513bb8f8a 100644 --- a/addons/spectator/functions/fnc_handleCamera.sqf +++ b/addons/spectator/functions/fnc_handleCamera.sqf @@ -56,4 +56,4 @@ GVAR(camPos) = [_x,_y,_z max (getTerrainHeightASL [_x,_y])]; // Update camera position and rotation GVAR(camera) setPosASL GVAR(camPos); GVAR(camera) setDir GVAR(camPan); -[GVAR(camera), GVAR(camTilt), GVAR(camBank)] call BIS_fnc_setPitchBank; +[GVAR(camera), GVAR(camTilt), 0] call BIS_fnc_setPitchBank; diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index c9cdfa0fb4..9f6b74f800 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -26,10 +26,8 @@ switch (toLower _mode) do { if !(isNull (GETUVAR(GVAR(display),displayNull))) exitWith {}; // Initalize camera variables - GVAR(camBank) = 0; GVAR(camBoom) = [false,false]; GVAR(camDolly) = [false,false,false,false]; - GVAR(camTilt) = -10; GVAR(gunCam) = false; // Initalize display variables @@ -39,7 +37,6 @@ switch (toLower _mode) do { // Initalize the camera view GVAR(camera) = "Camera" camCreate GVAR(camPos); - GVAR(camera) setDir GVAR(camPan); [] call FUNC(transitionCamera); // Create the dialog @@ -68,10 +65,8 @@ switch (toLower _mode) do { // Cleanup camera variables GVAR(camera) = nil; - GVAR(camBank) = nil; GVAR(camBoom) = nil; GVAR(camDolly) = nil; - GVAR(camTilt) = nil; GVAR(gunCam) = nil; // Cleanup display variables diff --git a/addons/spectator/functions/fnc_setCameraAttributes.sqf b/addons/spectator/functions/fnc_setCameraAttributes.sqf index d56259666a..41eb38e2d9 100644 --- a/addons/spectator/functions/fnc_setCameraAttributes.sqf +++ b/addons/spectator/functions/fnc_setCameraAttributes.sqf @@ -9,9 +9,10 @@ * - 2: External * 1: Camera unit (objNull for random) * 2: Camera position (ASL) - * 3: Camera heading (0 - 360) - * 4: Camera zoom (0.1 - 2) - * 5: Camera speed (m/s) + * 3: Camera pan (0 - 360) + * 4: Camera tilt (-90 - 90) + * 5: Camera zoom (0.1 - 2) + * 6: Camera speed (m/s) * * Return Value: * None @@ -24,19 +25,18 @@ #include "script_component.hpp" -params [["_mode",GVAR(camMode),[0]], ["_unit",GVAR(camUnit),[objNull]], ["_position",GVAR(camPos),[[]],3], ["_heading",GVAR(camPan),[0]], ["_zoom",GVAR(camZoom),[0]], ["_speed",GVAR(camSpeed),[0]]]; +params [["_mode",GVAR(camMode),[0]], ["_unit",GVAR(camUnit),[objNull]], ["_position",GVAR(camPos),[[]],3], ["_heading",GVAR(camPan),[0]], ["_tilt",GVAR(camTilt),[0]], ["_zoom",GVAR(camZoom),[0]], ["_speed",GVAR(camSpeed),[0]]]; // Normalize input GVAR(camMode) = floor((_mode min 3) max 0); GVAR(camPan) = ((_heading % 360) max 0); GVAR(camPosition) = _position; GVAR(camSpeed) = _speed; +GVAR(camTilt) = ((_heading min -90) max 90); GVAR(camUnit) = _unit; GVAR(camZoom) = (_zoom min 2) max 0; // Apply if camera exists if !(isNil QGVAR(camera)) then { - GVAR(camera) setDir GVAR(camPan); - GVAR(camera) setPosASL GVAR(camPos); [] call FUNC(transitionCamera); };