2015-07-18 17:46:46 +00:00
|
|
|
/*
|
|
|
|
* Author: SilentSpike
|
2015-07-21 12:31:00 +00:00
|
|
|
* Transitions the spectator camera vision/view/unit
|
2015-07-18 17:46:46 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Camera mode <NUMBER>
|
|
|
|
* - 0: Free
|
|
|
|
* - 1: Internal
|
|
|
|
* - 2: External
|
|
|
|
* 1: Camera unit <OBJECT>
|
2015-07-21 10:59:20 +00:00
|
|
|
* 2: Vision mode <NUMBER>
|
|
|
|
* - -2: Normal
|
|
|
|
* - -1: NV
|
|
|
|
* - 0: White hot
|
|
|
|
* - 1: Black hot
|
2015-07-18 17:46:46 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None <NIL>
|
|
|
|
*
|
|
|
|
* Example:
|
2015-07-20 21:45:11 +00:00
|
|
|
* [0,objNull] call ace_spectator_fnc_transitionCamera
|
2015-07-18 17:46:46 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2015-07-15 13:33:11 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-07-21 10:59:20 +00:00
|
|
|
params [["_newMode",GVAR(camMode)], ["_newUnit",GVAR(camUnit)], ["_newVision",GVAR(camVision)]];
|
2015-07-16 18:43:16 +00:00
|
|
|
|
2015-07-21 20:51:32 +00:00
|
|
|
// If new mode isn't available then keep current (unless current also isn't)
|
2015-07-21 14:53:20 +00:00
|
|
|
if !(_newMode in GVAR(availableModes)) then {
|
2015-07-21 20:51:32 +00:00
|
|
|
_newMode = GVAR(availableModes) select ((GVAR(availableModes) find GVAR(camMode)) max 0);
|
2015-07-21 14:53:20 +00:00
|
|
|
};
|
|
|
|
|
2015-07-16 22:58:58 +00:00
|
|
|
// When no units available to spectate, exit to freecam
|
|
|
|
if (GVAR(unitList) isEqualTo []) then {
|
2015-07-19 15:35:30 +00:00
|
|
|
_newMode = 0;
|
|
|
|
_newUnit = objNull;
|
2015-07-16 22:58:58 +00:00
|
|
|
};
|
2015-07-15 13:33:11 +00:00
|
|
|
|
2015-07-19 15:35:30 +00:00
|
|
|
// Reset gun cam if not internal
|
|
|
|
if (_newMode != 1) then {
|
2015-07-21 10:59:20 +00:00
|
|
|
GVAR(camGun) = false;
|
2015-07-19 15:35:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (_newMode == 0) then { // Free
|
2015-07-18 15:50:11 +00:00
|
|
|
// Preserve camUnit value for consistency when manually changing view
|
2015-07-15 13:33:11 +00:00
|
|
|
GVAR(camera) cameraEffect ["internal", "back"];
|
2015-07-16 16:48:32 +00:00
|
|
|
|
2015-07-24 14:53:08 +00:00
|
|
|
// Switch to camera to stop AI group chat
|
2015-07-24 14:36:36 +00:00
|
|
|
GVAR(camera) switchCamera "internal";
|
2015-07-19 23:02:14 +00:00
|
|
|
clearRadio;
|
|
|
|
|
2015-07-16 16:48:32 +00:00
|
|
|
// HUD stuff
|
|
|
|
showCinemaBorder false;
|
|
|
|
cameraEffectEnableHUD false;
|
2015-07-18 15:59:05 +00:00
|
|
|
|
2015-07-21 20:51:32 +00:00
|
|
|
// If new vision isn't available then keep current (unless current also isn't)
|
|
|
|
if !(_newVision in GVAR(availableVisions)) then {
|
|
|
|
_newVision = GVAR(availableVisions) select ((GVAR(availableVisions) find GVAR(camVision)) max 0);
|
|
|
|
};
|
|
|
|
|
2015-07-21 10:59:20 +00:00
|
|
|
// Vision mode only applies to free cam
|
|
|
|
if (_newVision < 0) then {
|
|
|
|
false setCamUseTi 0;
|
|
|
|
camUseNVG (_newVision >= -1);
|
|
|
|
} else {
|
|
|
|
true setCamUseTi _newVision;
|
|
|
|
};
|
|
|
|
GVAR(camVision) = _newVision;
|
|
|
|
|
2015-07-18 15:59:05 +00:00
|
|
|
// Handle camera movement
|
2015-07-18 16:06:13 +00:00
|
|
|
if (isNil QGVAR(camHandler)) then { GVAR(camHandler) = [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; };
|
2015-07-15 13:33:11 +00:00
|
|
|
} else {
|
2015-07-18 15:50:11 +00:00
|
|
|
// When null unit is given choose random
|
|
|
|
if (isNull _newUnit) then {
|
2015-07-17 17:54:19 +00:00
|
|
|
_newUnit = GVAR(unitList) select floor(random(count GVAR(unitList)));
|
2015-07-15 13:33:11 +00:00
|
|
|
};
|
|
|
|
|
2015-07-19 15:35:30 +00:00
|
|
|
if (_newMode == 1) then { // Internal
|
2015-07-15 13:33:11 +00:00
|
|
|
// Handle gun cam
|
2015-07-21 10:59:20 +00:00
|
|
|
if (GVAR(camGun)) then {
|
2015-07-17 17:54:19 +00:00
|
|
|
_newUnit switchCamera "gunner";
|
2015-07-15 13:33:11 +00:00
|
|
|
} else {
|
2015-07-17 17:54:19 +00:00
|
|
|
_newUnit switchCamera "internal";
|
2015-07-15 13:33:11 +00:00
|
|
|
};
|
|
|
|
} else { // External
|
2015-07-17 17:54:19 +00:00
|
|
|
_newUnit switchCamera "external";
|
2015-07-15 13:33:11 +00:00
|
|
|
};
|
2015-07-16 16:48:32 +00:00
|
|
|
|
2015-07-17 17:54:19 +00:00
|
|
|
GVAR(camUnit) = _newUnit;
|
|
|
|
|
2015-07-16 16:48:32 +00:00
|
|
|
// Terminate camera view
|
|
|
|
GVAR(camera) cameraEffect ["terminate", "back"];
|
2015-07-18 16:06:13 +00:00
|
|
|
GVAR(camHandler) = nil;
|
2015-07-16 16:48:32 +00:00
|
|
|
cameraEffectEnableHUD true;
|
2015-07-15 13:33:11 +00:00
|
|
|
};
|
2015-07-19 15:35:30 +00:00
|
|
|
|
|
|
|
GVAR(camMode) = _newMode;
|