Variable handling and consistency

This commit is contained in:
SilentSpike 2015-07-18 15:52:44 +01:00
parent 5d279e11ec
commit 382c9fbc35
4 changed files with 14 additions and 13 deletions

View File

@ -10,9 +10,15 @@ PREP(handleRespawn);
PREP(handleTree);
PREP(moduleSpectatorSettings);
PREP(setSpectator);
PREP(updateCamera);
PREP(updateInterface);
PREP(updateUnits);
PREP(updateView);
// Permanent variables
GVAR(camMode) = 0;
GVAR(camPan) = 0;
GVAR(camPos) = getPos cameraOn;
GVAR(camUnit) = objNull;
GVAR(showComp) = true;
GVAR(showHelp) = true;

View File

@ -65,7 +65,7 @@ switch (GVAR(camMode)) do {
{vehicle GVAR(camUnit) == GVAR(camUnit)} &&
{GVAR(camUnit) in GVAR(unitList)}
) then {
[] call FUNC(updateView);
[] call FUNC(updateCamera);
};
};
};

View File

@ -28,12 +28,6 @@ switch (toLower _mode) do {
// Prevent reopening
if !(isNull (GETUVAR(GVAR(display),displayNull))) exitWith {};
// Initalize preserved variables
if (isNil QGVAR(camMode)) then { GVAR(camMode) = 0; };
if (isNil QGVAR(camPan)) then { GVAR(camPan) = 0; };
if (isNil QGVAR(camPos)) then { GVAR(camPos) = getPos cameraOn; };
if (isNil QGVAR(camUnit)) then { GVAR(camUnit) = objNull; };
// Initalize camera variables
GVAR(camBank) = 0;
GVAR(camBoom) = [false,false];
@ -56,7 +50,7 @@ switch (toLower _mode) do {
// Initalize the camera view
GVAR(camera) = "Camera" camCreate GVAR(camPos);
GVAR(camera) setDir GVAR(camPan);
[] call FUNC(updateView);
[] call FUNC(updateCamera);
GVAR(camera) camSetFOV GVAR(camFOV);
@ -157,7 +151,7 @@ switch (toLower _mode) do {
if ((_button == 1) && (GVAR(camMode) == 1)) then {
// In first person toggle sights mode
GVAR(gunCam) = !GVAR(gunCam);
[] call FUNC(updateView);
[] call FUNC(updateCamera);
};
};
case "onmousebuttonup": {
@ -245,7 +239,7 @@ switch (toLower _mode) do {
//[_show] call FUNC(handleMap);
};
case 57: { // Spacebar
[[2,0,1] select GVAR(camMode)] call FUNC(updateView);
[[2,0,1] select GVAR(camMode)] call FUNC(updateCamera);
};
};
@ -300,7 +294,7 @@ switch (toLower _mode) do {
_newMode = [2,2,1] select GVAR(camMode);
};
[_newMode,_newUnit] call FUNC(updateView);
[_newMode,_newUnit] call FUNC(updateCamera);
};
};
};

View File

@ -11,12 +11,13 @@ if (_newMode != GVAR(camMode)) then {
// When no units available to spectate, exit to freecam
if (GVAR(unitList) isEqualTo []) then {
GVAR(camMode) = 0;
GVAR(camUnit) = objNull;
};
if (GVAR(camMode) == 0) then { // Free
GVAR(camera) cameraEffect ["internal", "back"];
GVAR(camUnit) = GVAR(camera);
// HUD stuff
showCinemaBorder false;
cameraEffectEnableHUD false;