2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-07-20 21:45:28 +00:00
|
|
|
/*
|
|
|
|
* Author: SilentSpike
|
2017-08-12 13:25:48 +00:00
|
|
|
* 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
|
2017-08-12 13:25:48 +00:00
|
|
|
* - 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
|
2017-08-12 13:25:48 +00:00
|
|
|
* - ...
|
2015-10-04 17:30:07 +00:00
|
|
|
* 3: Camera position (ATL) <ARRAY>
|
2017-08-12 13:25:48 +00:00
|
|
|
* 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:
|
2017-08-12 13:25:48 +00:00
|
|
|
* None
|
2015-07-20 21:45:28 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [1, objNull] call ace_spectator_fnc_setCameraAttributes
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
2015-07-21 14:44:11 +00:00
|
|
|
params [
|
2017-08-12 13:25:48 +00:00
|
|
|
["_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
|
|
|
|
2017-08-12 13:25:48 +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
|
|
|
|
2017-08-12 13:25:48 +00:00
|
|
|
if !(isNil "_mode") then {
|
|
|
|
// If mode not free and no focus, find focus
|
2017-08-30 15:36:53 +00:00
|
|
|
if ((_mode != MODE_FREE) && {isNull GVAR(camFocus)}) then {
|
2017-08-12 13:25:48 +00:00
|
|
|
[true] call FUNC(setFocus);
|
|
|
|
};
|
2015-07-20 21:45:28 +00:00
|
|
|
|
2017-08-12 13:25:48 +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;
|
|
|
|
};
|
2015-09-09 22:21:49 +00:00
|
|
|
} else {
|
2017-08-12 13:25:48 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2017-08-30 15:36:53 +00:00
|
|
|
GVAR(camFocus) = _focus;
|
2017-08-12 13:25:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
};
|