Camera vision modes

This commit is contained in:
SilentSpike 2015-07-21 11:59:20 +01:00
parent 21942eb5a1
commit 40f32b604a
3 changed files with 24 additions and 6 deletions

View File

@ -24,6 +24,7 @@ GVAR(camPos) = [worldSize * 0.5,worldSize * 0.5,20];
GVAR(camSpeed) = 1; GVAR(camSpeed) = 1;
GVAR(camTilt) = -10; GVAR(camTilt) = -10;
GVAR(camUnit) = objNull; GVAR(camUnit) = objNull;
GVAR(camVision) = -2;
GVAR(camZoom) = 1.3; GVAR(camZoom) = 1.3;
GVAR(showComp) = true; GVAR(showComp) = true;

View File

@ -28,7 +28,7 @@ switch (toLower _mode) do {
// Initalize camera variables // Initalize camera variables
GVAR(camBoom) = [false,false]; GVAR(camBoom) = [false,false];
GVAR(camDolly) = [false,false,false,false]; GVAR(camDolly) = [false,false,false,false];
GVAR(gunCam) = false; GVAR(camGun) = false;
// Initalize display variables // Initalize display variables
GVAR(ctrlKey) = false; GVAR(ctrlKey) = false;
@ -67,7 +67,7 @@ switch (toLower _mode) do {
GVAR(camera) = nil; GVAR(camera) = nil;
GVAR(camBoom) = nil; GVAR(camBoom) = nil;
GVAR(camDolly) = nil; GVAR(camDolly) = nil;
GVAR(gunCam) = nil; GVAR(camGun) = nil;
// Cleanup display variables // Cleanup display variables
GVAR(ctrlKey) = nil; GVAR(ctrlKey) = nil;
@ -187,6 +187,9 @@ switch (toLower _mode) do {
}; };
case 44: { // Z case 44: { // Z
GVAR(camBoom) set [1,true]; GVAR(camBoom) set [1,true];
};
case 49: { // N
}; };
case 50: { // M case 50: { // M
[_display,nil,nil,nil,true] call FUNC(toggleInterface); [_display,nil,nil,nil,true] call FUNC(toggleInterface);

View File

@ -1,6 +1,6 @@
/* /*
* Author: SilentSpike * Author: SilentSpike
* Transitions the spectator camera view mode/unit * Transitions the spectator camera vision/view mode/unit
* *
* Arguments: * Arguments:
* 0: Camera mode <NUMBER> * 0: Camera mode <NUMBER>
@ -8,6 +8,11 @@
* - 1: Internal * - 1: Internal
* - 2: External * - 2: External
* 1: Camera unit <OBJECT> * 1: Camera unit <OBJECT>
* 2: Vision mode <NUMBER>
* - -2: Normal
* - -1: NV
* - 0: White hot
* - 1: Black hot
* *
* Return Value: * Return Value:
* None <NIL> * None <NIL>
@ -20,7 +25,7 @@
#include "script_component.hpp" #include "script_component.hpp"
params [["_newMode",GVAR(camMode)],["_newUnit",GVAR(camUnit)]]; params [["_newMode",GVAR(camMode)], ["_newUnit",GVAR(camUnit)], ["_newVision",GVAR(camVision)]];
// When no units available to spectate, exit to freecam // When no units available to spectate, exit to freecam
if (GVAR(unitList) isEqualTo []) then { if (GVAR(unitList) isEqualTo []) then {
@ -30,7 +35,7 @@ if (GVAR(unitList) isEqualTo []) then {
// Reset gun cam if not internal // Reset gun cam if not internal
if (_newMode != 1) then { if (_newMode != 1) then {
GVAR(gunCam) = false; GVAR(camGun) = false;
}; };
if (_newMode == 0) then { // Free if (_newMode == 0) then { // Free
@ -45,6 +50,15 @@ if (_newMode == 0) then { // Free
showCinemaBorder false; showCinemaBorder false;
cameraEffectEnableHUD false; cameraEffectEnableHUD false;
// 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 // Handle camera movement
if (isNil QGVAR(camHandler)) then { GVAR(camHandler) = [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; }; if (isNil QGVAR(camHandler)) then { GVAR(camHandler) = [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; };
} else { } else {
@ -55,7 +69,7 @@ if (_newMode == 0) then { // Free
if (_newMode == 1) then { // Internal if (_newMode == 1) then { // Internal
// Handle gun cam // Handle gun cam
if (GVAR(gunCam)) then { if (GVAR(camGun)) then {
_newUnit switchCamera "gunner"; _newUnit switchCamera "gunner";
} else { } else {
_newUnit switchCamera "internal"; _newUnit switchCamera "internal";