diff --git a/addons/spectator/functions/fnc_handleCamera.sqf b/addons/spectator/functions/fnc_handleCamera.sqf index e0dd7b8351..f605010d9b 100644 --- a/addons/spectator/functions/fnc_handleCamera.sqf +++ b/addons/spectator/functions/fnc_handleCamera.sqf @@ -1,5 +1,22 @@ #include "script_component.hpp" +// Update camera values +GVAR(camera) camSetFov GVAR(camFOV); + +// Commit changes +GVAR(camera) camCommit 0; +showCinemaBorder false; +cameraEffectEnableHUD true; + +// If valid unit then apply camera view as appropriate +if ((GVAR(camUnit) in GVAR(unitList)) && !isNull GVAR(camUnit)) then { + if (camMode == 1) then { + GVAR(camUnit) switchCamera "internal"; + } else { + GVAR(camera) camSetTarget GVAR(camUnit); + }; +}; + // Don't recreate the PFH if !(isNil QGVAR(camPFH)) exitWith {}; @@ -48,5 +65,8 @@ GVAR(camPFH) = [ GVAR(camera) setDir GVAR(camPan); [GVAR(camera), GVAR(camTilt), GVAR(camBank)] call BIS_fnc_setPitchBank; }; + case 1: { // Internal + + }; }; }, 0] call CBA_fnc_addPerFrameHandler; diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index bf3f7d0590..5c796fd7ce 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -32,6 +32,7 @@ switch (toLower _mode) do { if (isNil QGVAR(camMode)) then { GVAR(camMode) = 0; }; if (isNil QGVAR(camPan)) then { GVAR(camPan) = 0; }; if (isNil QGVAR(camPos)) then { GVAR(camPos) = getPos cameraOn; }; + if (isNil QGVAR(camUnit)) then { GVAR(camUnit) = objNull; }; if (isNil QGVAR(savedSpots)) then { GVAR(savedSpots) = []; }; if (isNil QGVAR(savedUnits)) then { GVAR(savedUnits) = []; }; @@ -41,8 +42,10 @@ switch (toLower _mode) do { GVAR(camBoom) = [false,false]; GVAR(camDolly) = [false,false,false,false]; GVAR(camFocus) = [-1,-1]; + GVAR(camFOV) = 0.7; GVAR(camSpeed) = 0.8; GVAR(camTilt) = -60; + GVAR(camZoom) = 3; // Initalize display variables GVAR(ctrlKey) = false; @@ -50,6 +53,7 @@ switch (toLower _mode) do { GVAR(mouseDelta) = [0.5,0.5]; GVAR(mousePos) = [0.5,0.5]; GVAR(mousePosOld) = [0.5,0.5]; + GVAR(unitList) = []; // Initalize the camera view GVAR(camera) = "Camera" camCreate GVAR(camPos); @@ -87,8 +91,10 @@ switch (toLower _mode) do { GVAR(camBoom) = nil; GVAR(camDolly) = nil; GVAR(camFocus) = nil; + GVAR(camFOV) = nil; GVAR(camSpeed) = nil; GVAR(camTilt) = nil; + GVAR(camZoom) = nil; // Cleanup display variables GVAR(mouse) = nil; @@ -117,6 +123,8 @@ switch (toLower _mode) do { (_display displayCtrl IDC_MAP) mapCenterOnCamera false; // Set text values + (_display displayCtrl IDC_FOCUS) ctrlSetText str(GVAR(camFocus)); + (_display displayCtrl IDC_FOV) ctrlSetText str(GVAR(camFOV)); (_display displayCtrl IDC_VIEW) ctrlSetText (["FREE","FIRST","THIRD"] select GVAR(camMode)); // Populate unit tree @@ -136,6 +144,13 @@ switch (toLower _mode) do { private ["_button"]; _button = _args select 1; GVAR(mouse) set [_button,true]; + + // Detect right click + if ((_button == 1) && (GVAR(camMode) == 1)) then { + // In first person aim down sight toggle + GVAR(ads) = false; + GVAR(camUnit) switchCamera "internal"; + }; }; case "onmousebuttonup": { private ["_button"]; @@ -145,6 +160,14 @@ switch (toLower _mode) do { case "onmousezchanged": { private ["_zChange"]; _zChange = _args select 1; + + // Scroll to zoom in 3rd person, modifier for FOV + if (GVAR(ctrlKey)) then { + GVAR(camFOV) = ((GVAR(camFOV) - (_zChange * GVAR(camFOV) * 0.2)) max 0.1) min 1; + } else { + GVAR(camZoom) = (GVAR(camZoom) - (_zChange * GVAR(camZoom) * 0.2)) max 0.1; + }; + call FUNC(handleCamera); }; case "onmousemoving": { private ["_x","_y"]; @@ -204,6 +227,23 @@ switch (toLower _mode) do { _map mapCenterOnCamera _show; //[_show] call FUNC(handleMap); }; + case 57: { // Spacebar + GVAR(camMode) = [1,2,0] select GVAR(camMode); + + switch (GVAR(camMode)) do { + case 0: { + GVAR(camera) cameraEffect ["internal", "back"]; + GVAR(camUnit) = objNull; + }; + case 1: { + GVAR(camUnit) = ; + }; + case 2: { + + }; + }; + call FUNC(handleCamera); + }; }; true diff --git a/addons/spectator/functions/fnc_handleMouse.sqf b/addons/spectator/functions/fnc_handleMouse.sqf index a44dccd737..95959002f9 100644 --- a/addons/spectator/functions/fnc_handleMouse.sqf +++ b/addons/spectator/functions/fnc_handleMouse.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" -private ["_x","_y","_leftButton","_rightButton","_oldX","_oldY","_deltaX","_deltaY","_angleY","_angleX"]; +private ["_x","_y","_leftButton","_rightButton","_oldX","_oldY","_deltaX","_deltaY"]; _x = GVAR(mousePos) select 0; _y = GVAR(mousePos) select 1;