ACE3/addons/spectator/functions/fnc_setCameraAttributes.sqf

103 lines
2.5 KiB
Plaintext
Raw Normal View History

2015-07-20 21:45:28 +00:00
/*
* Author: SilentSpike
* Sets the spectator camera attributes as desired. Local effect.
* All values are optional and default to no change.
2015-07-20 21:45:28 +00:00
*
* Arguments:
2015-10-04 17:30:07 +00:00
* 0: Camera mode <NUMBER>
2015-07-20 21:45:28 +00:00
* - 0: Free
* - 1: First Person
* - 2: Follow
* 1: Camera focus <OBJECT or BOOL>
2015-10-04 17:30:07 +00:00
* 2: Camera vision <NUMBER>
2015-07-21 14:44:11 +00:00
* - -2: Normal
* - -1: Night vision
* - 0: Thermal white hot
* - 1: Thermal black hot
* - ...
2015-10-04 17:30:07 +00:00
* 3: Camera position (ATL) <ARRAY>
* 4: Camera direction (0 - 360) <NUMBER>
*
* Notes:
* - If camera mode is not free and camera has no focus, random will be used
* - To remove any current camera focus in free cam, use objNull
* - To select a random camera focus, use a boolean
2015-07-20 21:45:28 +00:00
*
* Return Value:
* None
2015-07-20 21:45:28 +00:00
*
* Example:
* [1, objNull] call ace_spectator_fnc_setCameraAttributes
*
* Public: Yes
*/
#include "script_component.hpp"
2015-07-21 14:44:11 +00:00
params [
["_mode",nil,[0]],
["_focus",nil,[objNull,true]],
["_vision",nil,[0]],
["_position",nil,[[]],3],
["_direction",nil,[0]]
2015-07-21 14:44:11 +00:00
];
2015-07-20 21:45:28 +00:00
if (count _this > 5) then {
ACE_DEPRECATED("Use of ""tilt"", ""zoom"" and ""speed"" camera attributes","3.12.0","N/A")
2015-07-21 14:44:11 +00:00
};
// Apply if camera exists
if !(isNil QGVAR(camera)) then {
// These functions are smart and handle unavailable inputs
if !(isNil "_focus") then {
[_focus] call FUNC(setFocus);
};
2015-07-21 14:44:11 +00:00
if !(isNil "_mode") then {
// If mode not free and no focus, find focus
if ((_mode != MODE_FREE) && {isNull GVAR(camFocus)}) then {
[true] call FUNC(setFocus);
};
2015-07-20 21:45:28 +00:00
[_mode] call FUNC(cam_setCameraMode);
};
if !(isNil "_vision") then {
[_vision] call FUNC(cam_setVisionMode);
};
if !(isNil "_position") then {
GVAR(camera) setPosATL _position;
};
if !(isNil "_direction") then {
GVAR(camera) setDir _direction;
};
} else {
if !(isNil "_focus") then {
// If there are no entities this becomes nil, handled on camera startup
if (_focus isEqualType true) then {
_focus = ([] call FUNC(getTargetEntities)) select 0;
};
GVAR(camFocus) = _focus;
};
if !(isNil "_mode") then {
GVAR(camMode) = _mode;
};
if !(isNil "_vision") then {
GVAR(camVision) = _vision;
};
// GVARs exits purely for pre-setting of these attributes
if !(isNil "_position") then {
GVAR(camPos) = ATLtoASL _position;
};
if !(isNil "_direction") then {
GVAR(camDir) = _direction;
};
2015-07-20 21:45:28 +00:00
};