ACE3/addons/spectator/functions/fnc_setCameraAttributes.sqf

67 lines
1.8 KiB
Plaintext
Raw Normal View History

2015-07-20 21:45:28 +00:00
/*
* Author: SilentSpike
* Sets the spectator camera attributes as desired
*
* Arguments:
* 0: Camera mode <NUMBER> <OPTIONAL>
* - 0: Free
* - 1: Internal
* - 2: External
* 1: Camera unit (objNull for random) <OBJECT> <OPTIONAL>
2015-07-21 14:44:11 +00:00
* 2: Camera vision <NUMBER> <OPTIONAL>
* - -2: Normal
* - -1: Night vision
* - 0: Thermal white hot
* - 1: Thermal black hot
2015-07-21 17:07:55 +00:00
* 3: Camera position (ATL) <ARRAY> <OPTIONAL>
2015-07-21 14:44:11 +00:00
* 4: Camera pan (0 - 360) <NUMBER> <OPTIONAL>
* 5: Camera tilt (-90 - 90) <NUMBER> <OPTIONAL>
* 6: Camera zoom (0.1 - 2) <NUMBER> <OPTIONAL>
* 7: Camera speed (m/s) <NUMBER> <OPTIONAL>
2015-07-20 21:45:28 +00:00
*
* Return Value:
* None <NIL>
*
* Example:
* [1, objNull] call ace_spectator_fnc_setCameraAttributes
*
* Public: Yes
*/
#include "script_component.hpp"
2015-07-21 14:44:11 +00:00
params [
["_mode",GVAR(camMode),[0]],
["_unit",GVAR(camUnit),[objNull]],
["_vision",GVAR(camVision),[0]],
["_position",GVAR(camPos),[[]],3],
["_heading",GVAR(camPan),[0]],
["_tilt",GVAR(camTilt),[0]],
["_zoom",GVAR(camZoom),[0]],
["_speed",GVAR(camSpeed),[0]]
];
2015-07-20 21:45:28 +00:00
// Normalize input
2015-07-21 14:44:11 +00:00
if !(_mode in GVAR(availableModes)) then {
_mode = GVAR(availableModes) select ((GVAR(availableModes) find GVAR(camMode)) max 0);
2015-07-21 14:44:11 +00:00
};
if !(_vision in GVAR(availableVisions)) then {
_vision = GVAR(availableVisions) select ((GVAR(availableVisions) find GVAR(camVision)) max 0);
2015-07-21 14:44:11 +00:00
};
2015-07-20 21:45:28 +00:00
GVAR(camPan) = ((_heading % 360) max 0);
2015-07-21 17:07:55 +00:00
GVAR(camPosition) = (ATLtoASL _position);
2015-07-21 18:36:20 +00:00
GVAR(camSpeed) = (_speed min 0.05) max 10;
GVAR(camTilt) = (_heading min -89) max 89;
2015-07-20 21:45:28 +00:00
GVAR(camUnit) = _unit;
2015-07-21 14:44:11 +00:00
GVAR(camVision) = _vision;
2015-07-20 21:45:28 +00:00
GVAR(camZoom) = (_zoom min 2) max 0;
// Apply if camera exists
if !(isNil QGVAR(camera)) then {
2015-07-21 14:44:11 +00:00
[_mode,_unit,_vision] call FUNC(transitionCamera);
} else {
GVAR(camMode) = _mode;
2015-07-20 21:45:28 +00:00
};