Add vision mode support to spectator external cam

Since external view is actually another camera, vision modes should also apply to it too.
This commit is contained in:
SilentSpike 2015-10-04 19:26:53 +01:00
parent 4079ca354e
commit 780e0aa270
3 changed files with 30 additions and 26 deletions

View File

@ -238,7 +238,7 @@ switch (toLower _mode) do {
GVAR(camBoom) = -0.5 * GVAR(camSpeed) * ([1, 2] select _shift);
};
case 49: { // N
if (GVAR(camMode) == 0) then {
if (GVAR(camMode) != 1) then {
if (_ctrl) then {
[nil,nil,-1] call FUNC(cycleCamera);
} else {

View File

@ -26,8 +26,13 @@ private ["_name","_vision","_fov","_speed","_mode","_time","_toolbar"];
_toolbar = _display displayCtrl IDC_TOOL;
// Find all tool values
if (GVAR(camVision) >= 0) then {
_vision = localize LSTRING(VisionThermal);
} else {
_vision = [localize LSTRING(VisionNight), localize LSTRING(VisionNormal)] select (GVAR(camVision) < -1);
};
if (GVAR(camMode) == 0) then {
_vision = if (GVAR(camVision) >= 0) then {localize LSTRING(VisionThermal)} else { [localize LSTRING(VisionNight), localize LSTRING(VisionNormal)] select (GVAR(camVision) < -1) };
_fov = format ["%1x", floor(GVAR(camZoom) * 100) * 0.01];
_speed = format ["%1 m/s", floor(GVAR(camSpeed) * 100) * 0.01];
} else {

View File

@ -49,8 +49,6 @@ if (_newMode == 0) then { // Free
// Preserve camUnit value for consistency when manually changing view
_camera cameraEffect ["internal", "back"];
showCinemaBorder false;
cameraEffectEnableHUD true;
// Apply the camera zoom
_camera camSetFov -(linearConversion [0.01,2,GVAR(camZoom),-2,-0.01,true]);
@ -64,23 +62,6 @@ if (_newMode == 0) then { // Free
GVAR(camAgent) switchCamera "internal";
clearRadio;
// 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);
};
// Vision mode only applies to free cam
if (_newVision < 0) then {
false setCamUseTi 0;
camUseNVG (_newVision >= -1);
} else {
true setCamUseTi _newVision;
};
GVAR(camVision) = _newVision;
// Handle camera movement
if (isNil QGVAR(camHandler)) then { GVAR(camHandler) = [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; };
} else {
_camera = GVAR(unitCamera);
@ -104,11 +85,6 @@ if (_newMode == 0) then { // Free
} else {
// Switch to the camera
_camera cameraEffect ["internal", "back"];
showCinemaBorder false;
cameraEffectEnableHUD true;
// Handle camera orbit movement
if (isNil QGVAR(camHandler)) then { GVAR(camHandler) = [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; };
};
// Clear radio if group changed
@ -119,4 +95,27 @@ if (_newMode == 0) then { // Free
GVAR(camUnit) = _newUnit;
};
if (_newMode in [0,2]) then {
// Set up camera UI
showCinemaBorder false;
cameraEffectEnableHUD true;
// Handle camera movement
if (isNil QGVAR(camHandler)) then { GVAR(camHandler) = [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; };
// 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);
};
// Vision mode applies to free and external cam
if (_newVision < 0) then {
false setCamUseTi 0;
camUseNVG (_newVision >= -1);
} else {
true setCamUseTi _newVision;
};
GVAR(camVision) = _newVision;
};
GVAR(camMode) = _newMode;