2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2017-08-12 13:25:48 +00:00
|
|
|
/*
|
2023-08-17 10:02:17 +00:00
|
|
|
* Author: Nelson Duarte, AACO, kymckay
|
2017-08-12 13:25:48 +00:00
|
|
|
* Function used to select the camera mode
|
|
|
|
*
|
|
|
|
* Intended to run even if new mode == old mode, as it handles focus
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: New camera mode <NUMBER>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [1] call ace_spectator_fnc_cam_setCameraMode
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_newMode"];
|
|
|
|
|
|
|
|
private _oldMode = GVAR(camMode);
|
|
|
|
private _modes = GVAR(availableModes);
|
2017-08-30 15:36:53 +00:00
|
|
|
private _focus = GVAR(camFocus);
|
2017-08-12 13:25:48 +00:00
|
|
|
|
|
|
|
// If new mode isn't available then keep current (unless current also isn't)
|
|
|
|
if !(_newMode in _modes) then {
|
|
|
|
_newMode = _modes select ((_modes find _oldMode) max 0);
|
|
|
|
};
|
|
|
|
|
2017-08-17 11:50:43 +00:00
|
|
|
// Can't switch camera from free mode with no focus selected
|
|
|
|
if (!isNull _focus || _newMode == MODE_FREE) then {
|
2017-08-12 13:25:48 +00:00
|
|
|
private _camera = GVAR(camera);
|
|
|
|
private _showHUD = [true,true,true,true,true,true,true,true];
|
|
|
|
|
|
|
|
if (_newMode == MODE_FPS) then {
|
|
|
|
_camera cameraEffect ["Terminate", "BACK"];
|
|
|
|
_focus switchCamera "INTERNAL";
|
|
|
|
|
|
|
|
// Reset vision mode
|
|
|
|
[VISION_NORM] call FUNC(cam_setVisionMode);
|
|
|
|
|
|
|
|
[] call FUNC(cam_resetTarget);
|
|
|
|
|
|
|
|
// Disable camera input
|
|
|
|
_camera camCommand "manual off";
|
|
|
|
|
|
|
|
// Hide all unit/group information in first person view
|
|
|
|
_showHUD = [true,false,false,false,false,false,false,true];
|
|
|
|
};
|
|
|
|
|
|
|
|
if (_newMode == MODE_FOLLOW) then {
|
|
|
|
_camera cameraEffect ["Internal", "BACK"];
|
|
|
|
_focus switchCamera "EXTERNAL";
|
|
|
|
|
|
|
|
[] call FUNC(cam_resetTarget);
|
|
|
|
|
|
|
|
// Disable camera input
|
|
|
|
_camera camCommand "manual off";
|
|
|
|
};
|
|
|
|
|
|
|
|
if (_newMode == MODE_FREE) then {
|
|
|
|
_camera cameraEffect ["Internal", "BACK"];
|
2017-12-07 21:45:30 +00:00
|
|
|
switchCamera GVAR(camAgentFree); // Fix draw3D while in free camera for case where player is perma-dead
|
2017-08-12 13:25:48 +00:00
|
|
|
_camera setDir getDirVisual _camera;
|
|
|
|
|
|
|
|
if (!isNull _focus) then {
|
|
|
|
if (_oldMode == MODE_FPS) then {
|
|
|
|
[_focus] call FUNC(cam_prepareTarget);
|
|
|
|
};
|
|
|
|
[_focus] call FUNC(cam_setTarget);
|
|
|
|
};
|
|
|
|
|
|
|
|
// Enable camera input
|
|
|
|
_camera camCommand "manual on";
|
|
|
|
};
|
|
|
|
|
|
|
|
// Update the HUD
|
|
|
|
cameraEffectEnableHUD true;
|
|
|
|
showHUD _showHUD;
|
|
|
|
GVAR(camMode) = _newMode;
|
|
|
|
|
|
|
|
// Only update display if it exists, this function is independent of it
|
|
|
|
if !(isNull SPEC_DISPLAY) then {
|
|
|
|
[] call FUNC(ui_updateCamButtons);
|
|
|
|
[] call FUNC(ui_updateHelp);
|
|
|
|
};
|
|
|
|
};
|