ACE3/addons/spectator/functions/fnc_updateView.sqf

43 lines
1.1 KiB
Plaintext
Raw Normal View History

2015-07-15 13:33:11 +00:00
#include "script_component.hpp"
2015-07-16 18:43:16 +00:00
params [["_newMode",GVAR(camMode)]];
// Reset gun cam if mode is changing
if (_newMode != GVAR(camMode)) then {
GVAR(gunCam) = false;
GVAR(camMode) = _newMode;
};
2015-07-16 22:58:58 +00:00
// When no units available to spectate, exit to freecam
if (GVAR(unitList) isEqualTo []) then {
GVAR(camMode) = 0;
};
2015-07-15 13:33:11 +00:00
2015-07-16 22:58:58 +00:00
if (GVAR(camMode) == 0) then { // Free
2015-07-15 13:33:11 +00:00
GVAR(camera) cameraEffect ["internal", "back"];
2015-07-16 16:48:32 +00:00
// HUD stuff
showCinemaBorder false;
cameraEffectEnableHUD false;
2015-07-15 13:33:11 +00:00
} else {
// First ensure valid unit is selected
if !(GVAR(camUnit) in GVAR(unitList)) then {
GVAR(camUnit) = GVAR(unitList) select floor(random(count GVAR(unitList)));
};
2015-07-16 22:58:58 +00:00
if (GVAR(camMode) == 1) then { // Internal
2015-07-15 13:33:11 +00:00
// Handle gun cam
if (GVAR(gunCam)) then {
GVAR(camUnit) switchCamera "gunner";
} else {
GVAR(camUnit) switchCamera "internal";
};
} else { // External
GVAR(camUnit) switchCamera "external";
};
2015-07-16 16:48:32 +00:00
// Terminate camera view
GVAR(camera) cameraEffect ["terminate", "back"];
cameraEffectEnableHUD true;
2015-07-15 13:33:11 +00:00
};