Change the Kestrel 4500 behavior 'back to normal' when AB is disabled

This commit is contained in:
ulteq 2015-04-11 19:44:38 +02:00
parent 6d40859ec2
commit 1ff7218903
3 changed files with 65 additions and 47 deletions

View File

@ -17,11 +17,11 @@
switch (_this) do {
case 0: { // Enter
if (!GVAR(MinAvgMAx) && (GVAR(Menu) == 2 || GVAR(Menu) == 3)) then {
if (!GVAR(MinAvgMax) && (GVAR(Menu) == 2 || GVAR(Menu) == 3)) then {
GVAR(RefHeading) = getDir ACE_player;
};
if (GVAR(MinAvgMAx) && GVAR(Menu) > 0 && GVAR(Menu) < 4) then {
if (GVAR(MinAvgMAxMode) != 1) then {
if (GVAR(MinAvgMax) && GVAR(Menu) > 0 && GVAR(Menu) < 4) then {
if (GVAR(MinAvgMaxMode) != 1) then {
{
GVAR(MIN) set [_x, 0];
GVAR(MAX) set [_x, 0];
@ -29,7 +29,7 @@ switch (_this) do {
GVAR(ENTRIES) set [_x, 0];
} forEach [1, 2, 3];
};
GVAR(MinAvgMaxMode) = GVAR(MinAvgMaxMode + 1) % 3;
GVAR(MinAvgMaxMode) = (GVAR(MinAvgMaxMode) + 1) % 3;
};
};
case 1: { // Top
@ -39,10 +39,10 @@ switch (_this) do {
GVAR(Menu) = (GVAR(Menu) + 1 + (count GVAR(Menus))) % (count GVAR(Menus));
};
case 3: { // Left
GVAR(MinAvgMaxMode) = !GVAR(MinAvgMaxMode);
GVAR(MinAvgMax) = !GVAR(MinAvgMax);
};
case 4: { // Right
GVAR(MinAvgMaxMode) = !GVAR(MinAvgMaxMode);
GVAR(MinAvgMax) = !GVAR(MinAvgMax);
};
case 5: { // Memory
};

View File

@ -17,7 +17,7 @@
private ["_playerDir", "_windSpeed", "_windDir", "_crosswind", "_headwind", "_humidity", "_temperature", "_humidity", "_barometricPressure", "_altitude"];
if (isNil QUOTE(GVAR(MIN)) || isNil QUOTE(GVAR(MAX))) then {
if (isNil QGVAR(MIN) || isNil QGVAR(MAX)) then {
_temperature = GET_TEMPERATURE_AT_HEIGHT((getPosASL ACE_player) select 2);
_humidity = EGVAR(weather,currentHumidity);
_barometricPressure = 1013.25 * exp(-(EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2)) / 7990) - 10 * overcast;
@ -45,23 +45,31 @@ if (GVAR(MinAvgMaxMode) == 1) then {
_windSpeed = vectorMagnitude ACE_wind;
_windDir = (ACE_wind select 0) atan2 (ACE_wind select 1);
if (isClass (configFile >> "CfgPatches" >> "ACE_Advanced_Ballistics")) then {
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
_windSpeed = (eyePos ACE_player) call EFUNC(advanced_ballistics,calculateWindSpeed);
_windSpeed = cos(_playerDir - _windDir) * _windSpeed;
};
_windSpeed = cos(_playerDir - _windDir) * _windSpeed;
GVAR(MIN) set [1, (GVAR(MIN) select 1) min abs(_windSpeed)];
GVAR(MAX) set [1, abs(_windSpeed) max (GVAR(MAX) select 1)];
GVAR(TOTAL) set [1, (GVAR(TOTAL) select 1) + abs(_windSpeed)];
// CROSSWIND
_crosswind = abs(sin(GVAR(RefHeading) - _playerDir) * _windSpeed);
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
_crosswind = abs(sin(GVAR(RefHeading) - _playerDir) * _windSpeed);
} else {
_crosswind = abs(sin(GVAR(RefHeading)) * _windSpeed);
};
GVAR(MIN) set [2, (GVAR(MIN) select 2) min _crosswind];
GVAR(MAX) set [2, _crosswind max (GVAR(MAX) select 2)];
GVAR(TOTAL) set [2, (GVAR(TOTAL) select 2) + _crosswind];
// HEADWIND
_headwind = abs(cos(GVAR(RefHeading) - _playerDir) * _windSpeed);
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
_headwind = abs(cos(GVAR(RefHeading) - _playerDir) * _windSpeed);
} else {
_headwind = abs(cos(GVAR(RefHeading)) * _windSpeed);
};
GVAR(MIN) set [3, (GVAR(MIN) select 3) min _headwind];
GVAR(MAX) set [3, _headwind max (GVAR(MAX) select 3)];
GVAR(TOTAL) set [3, (GVAR(TOTAL) select 3) + _headwind];

View File

@ -40,12 +40,12 @@ _windDir = (ACE_wind select 0) atan2 (ACE_wind select 1);
_temperature = GET_TEMPERATURE_AT_HEIGHT((getPosASL ACE_player) select 2);
_humidity = EGVAR(weather,currentHumidity);
if (isClass (configFile >> "CfgPatches" >> "ACE_Advanced_Ballistics")) then {
_windSpeed = (eyePos ACE_player) call EFUNC(advanced_ballistics,calculateWindSpeed);
};
_playerDir = getDir ACE_player;
_windSpeed = cos(_playerDir - _windDir) * _windSpeed;
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
_windSpeed = (eyePos ACE_player) call EFUNC(advanced_ballistics,calculateWindSpeed);
_windSpeed = cos(_playerDir - _windDir) * _windSpeed;
};
GVAR(Direction) = 4 * floor(_playerDir / 90);
if (_playerDir % 90 > 10) then { GVAR(Direction) = GVAR(Direction) + 1};
@ -57,7 +57,7 @@ GVAR(Direction) = GVAR(Direction) % 16;
switch (GVAR(Menu)) do {
case 0: { // Direction
if (!GVAR(MinAvgMax)) then {
_textCenterBig = format["%1", format["%1 %2", GVAR(Direction)s select GVAR(Direction), round(_playerDir)]];
_textCenterBig = format["%1", format["%1 %2", GVAR(Directions) select GVAR(Direction), round(_playerDir)]];
} else {
_textCenterLine1Left = "Min";
_textCenterLine2Left = "Avg";
@ -80,13 +80,13 @@ switch (GVAR(Menu)) do {
_textInfoLine2 = "- average";
};
case 1: {
_textCenterLine1Right = Str(round((Kestrel4500_MAX select 1) * 10) / 10);
_textCenterLine2Right = Str(round((Kestrel4500_TOTAL select 1) / (Kestrel4500_ENTRIES select 1) * 10) / 10);
_textCenterLine1Right = Str(round((GVAR(Max) select 1) * 10) / 10);
_textCenterLine2Right = Str(round((GVAR(Total) select 1) / (GVAR(Entries) select 1) * 10) / 10);
_textInfoLine2 = "- stop";
};
case 2: {
_textCenterLine1Right = Str(round((Kestrel4500_MAX select 1) * 10) / 10);
_textCenterLine2Right = Str(round((Kestrel4500_TOTAL select 1) / (Kestrel4500_ENTRIES select 1) * 10) / 10);
_textCenterLine1Right = Str(round((GVAR(Max) select 1) * 10) / 10);
_textCenterLine2Right = Str(round((GVAR(Total) select 1) / (GVAR(Entries) select 1) * 10) / 10);
_textInfoLine2 = "- clear";
};
};
@ -94,8 +94,13 @@ switch (GVAR(Menu)) do {
};
case 2: { // CROSSWIND
if (!GVAR(MinAvgMax)) then {
_textCenterBig = Str(round(abs(sin(GVAR(RefHeading) - _playerDir) * _windSpeed) * 10) / 10);
_textInfoLine1 = format["%1 m/s @ %2", round((cos(_playerDir - _windDir) * _windSpeed) * 10) / 10, round(_playerDir)];
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
_textCenterBig = Str(round(abs(sin(GVAR(RefHeading) - _playerDir) * _windSpeed) * 10) / 10);
_textInfoLine1 = format["%1 m/s @ %2", round((cos(_playerDir - _windDir) * _windSpeed) * 10) / 10, round(_playerDir)];
} else {
_textCenterBig = Str(round(abs(sin(GVAR(RefHeading)) * _windSpeed) * 10) / 10);
_textInfoLine1 = format["%1 m/s @ %2", round(_windSpeed * 10) / 10, round(_windDir)];
};
_textInfoLine2 = "- set heading";
} else {
_textCenterLine1Left = "Max";
@ -107,13 +112,13 @@ switch (GVAR(Menu)) do {
_textInfoLine2 = "- average";
};
case 1: {
_textCenterLine1Right = Str(round((Kestrel4500_MAX select 2) * 10) / 10);
_textCenterLine2Right = Str(round((Kestrel4500_TOTAL select 2) / (Kestrel4500_ENTRIES select 2) * 10) / 10);
_textCenterLine1Right = Str(round((GVAR(Max) select 2) * 10) / 10);
_textCenterLine2Right = Str(round((GVAR(Total) select 2) / (GVAR(Entries) select 2) * 10) / 10);
_textInfoLine2 = "- stop";
};
case 2: {
_textCenterLine1Right = Str(round((Kestrel4500_MAX select 2) * 10) / 10);
_textCenterLine2Right = Str(round((Kestrel4500_TOTAL select 2) / (Kestrel4500_ENTRIES select 2) * 10) / 10);
_textCenterLine1Right = Str(round((GVAR(Max) select 2) * 10) / 10);
_textCenterLine2Right = Str(round((GVAR(Total) select 2) / (GVAR(Entries) select 2) * 10) / 10);
_textInfoLine2 = "- clear";
};
};
@ -121,8 +126,13 @@ switch (GVAR(Menu)) do {
};
case 3: { // HEADWIND
if (!GVAR(MinAvgMax)) then {
_textCenterBig = Str(round(abs(cos(GVAR(RefHeading) - _playerDir) * _windSpeed) * 10) / 10);
_textInfoLine1 = format["%1 m/s @ %2", round((cos(_playerDir - _windDir) * _windSpeed) * 10) / 10, round(_playerDir)];
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
_textCenterBig = Str(round(abs(cos(GVAR(RefHeading) - _playerDir) * _windSpeed) * 10) / 10);
_textInfoLine1 = format["%1 m/s @ %2", round((cos(_playerDir - _windDir) * _windSpeed) * 10) / 10, round(_playerDir)];
} else {
_textCenterBig = Str(round(abs(cos(GVAR(RefHeading)) * _windSpeed) * 10) / 10);
_textInfoLine1 = format["%1 m/s @ %2", round(_windSpeed * 10) / 10, round(_windDir)];
};
_textInfoLine2 = "- set heading";
} else {
_textCenterLine1Left = "Max";
@ -134,13 +144,13 @@ switch (GVAR(Menu)) do {
_textInfoLine2 = "- average";
};
case 1: {
_textCenterLine1Right = Str(round((Kestrel4500_MAX select 3) * 10) / 10);
_textCenterLine2Right = Str(round((Kestrel4500_TOTAL select 3) / (Kestrel4500_ENTRIES select 3) * 10) / 10);
_textCenterLine1Right = Str(round((GVAR(Max) select 3) * 10) / 10);
_textCenterLine2Right = Str(round((GVAR(Total) select 3) / (GVAR(Entries) select 3) * 10) / 10);
_textInfoLine2 = "- stop";
};
case 2: {
_textCenterLine1Right = Str(round((Kestrel4500_MAX select 3) * 10) / 10);
_textCenterLine2Right = Str(round((Kestrel4500_TOTAL select 3) / (Kestrel4500_ENTRIES select 3) * 10) / 10);
_textCenterLine1Right = Str(round((GVAR(Max) select 3) * 10) / 10);
_textCenterLine2Right = Str(round((GVAR(Total) select 3) / (GVAR(Entries) select 3) * 10) / 10);
_textInfoLine2 = "- clear";
};
};
@ -153,9 +163,9 @@ switch (GVAR(Menu)) do {
_textCenterLine1Left = "Min";
_textCenterLine2Left = "Avg";
_textCenterLine3Left = "Max";
_textCenterLine1Right = Str(round((Kestrel4500_MIN select 4) * 10) / 10);
_textCenterLine2Right = Str(round((Kestrel4500_TOTAL select 4) / (Kestrel4500_ENTRIES select 4) * 10) / 10);
_textCenterLine3Right = Str(round((Kestrel4500_MAX select 4) * 10) / 10);
_textCenterLine1Right = Str(round((GVAR(Min) select 4) * 10) / 10);
_textCenterLine2Right = Str(round((GVAR(Total) select 4) / (GVAR(Entries) select 4) * 10) / 10);
_textCenterLine3Right = Str(round((GVAR(Max) select 4) * 10) / 10);
};
};
case 5: { // HUMIDITY
@ -165,9 +175,9 @@ switch (GVAR(Menu)) do {
_textCenterLine1Left = "Min";
_textCenterLine2Left = "Avg";
_textCenterLine3Left = "Max";
_textCenterLine1Right = Str(round((Kestrel4500_MIN select 5) * 10) / 10);
_textCenterLine2Right = Str(round((Kestrel4500_TOTAL select 5) / (Kestrel4500_ENTRIES select 5) * 10) / 10);
_textCenterLine3Right = Str(round((Kestrel4500_MAX select 5) * 10) / 10);
_textCenterLine1Right = Str(round((GVAR(Min) select 5) * 10) / 10);
_textCenterLine2Right = Str(round((GVAR(Total) select 5) / (GVAR(Entries) select 5) * 10) / 10);
_textCenterLine3Right = Str(round((GVAR(Max) select 5) * 10) / 10);
};
};
case 6: { // BARO
@ -177,9 +187,9 @@ switch (GVAR(Menu)) do {
_textCenterLine1Left = "Min";
_textCenterLine2Left = "Avg";
_textCenterLine3Left = "Max";
_textCenterLine1Right = Str(round((Kestrel4500_MIN select 6) * 10) / 10);
_textCenterLine2Right = Str(round((Kestrel4500_TOTAL select 6) / (Kestrel4500_ENTRIES select 6) * 10) / 10);
_textCenterLine3Right = Str(round((Kestrel4500_MAX select 6) * 10) / 10);
_textCenterLine1Right = Str(round((GVAR(Min) select 6) * 10) / 10);
_textCenterLine2Right = Str(round((GVAR(Total) select 6) / (GVAR(Entries) select 6) * 10) / 10);
_textCenterLine3Right = Str(round((GVAR(Max) select 6) * 10) / 10);
};
};
case 7: { // ALTITUDE
@ -189,16 +199,16 @@ switch (GVAR(Menu)) do {
_textCenterLine1Left = "Min";
_textCenterLine2Left = "Avg";
_textCenterLine3Left = "Max";
_textCenterLine1Right = Str(round(Kestrel4500_MIN select 7));
_textCenterLine2Right = Str(round((Kestrel4500_TOTAL select 7) / (Kestrel4500_ENTRIES select 7)));
_textCenterLine3Right = Str(round(Kestrel4500_MAX select 7));
_textCenterLine1Right = Str(round(GVAR(Min) select 7));
_textCenterLine2Right = Str(round((GVAR(Total) select 7) / (GVAR(Entries) select 7)));
_textCenterLine3Right = Str(round(GVAR(Max) select 7));
};
};
case 8: { // User Screen 1
_textCenterLine1Left = Str(round(_playerDir));
_textCenterLine2Left = Str(round(EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2)));
_textCenterLine3Left = Str(round(abs(_windSpeed) * 10) / 10);
_textCenterLine1Right = GVAR(Direction)s select GVAR(Direction);
_textCenterLine1Right = GVAR(Directions) select GVAR(Direction);
_textCenterLine2Right = "m";
_textCenterLine3Right = "m/s";
};