2015-04-07 15:58:54 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
|
|
|
* Generates the Kestrel 4500 output text.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* Nothing
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* [top <STRING>, centerBig <STRING>, CenterLine1Left <STRING>, CenterLine2Left <STRING>, CenterLine3Left <STRING>, CenterLine1Right <STRING>, CenterLine2Right <STRING>, CenterLine3Right <STRING>, InfoLine1 <STRING>, InfoLine2 <STRING>]
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-04-07 15:43:54 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-04-24 09:53:06 +00:00
|
|
|
private ["_playerDir", "_textTop", "_textCenterBig", "_textCenterLine1Left", "_textCenterLine2Left", "_textCenterLine3Left", "_textCenterLine1Right", "_textCenterLine2Right", "_textCenterLine3Right", "_textInfoLine1", "_textInfoLine2", "_temperature", "_humidity", "_windSpeed", "_windDir"];
|
2015-04-07 15:43:54 +00:00
|
|
|
|
|
|
|
[] call FUNC(collectData);
|
|
|
|
|
2015-04-08 09:25:15 +00:00
|
|
|
_textTop = GVAR(Menus) select GVAR(Menu);
|
2015-04-07 15:43:54 +00:00
|
|
|
_textCenterBig = "";
|
|
|
|
|
|
|
|
_textCenterLine1Left = "";
|
|
|
|
_textCenterLine2Left = "";
|
|
|
|
_textCenterLine3Left = "";
|
|
|
|
_textCenterLine1Right = "";
|
|
|
|
_textCenterLine2Right = "";
|
|
|
|
_textCenterLine3Right = "";
|
|
|
|
|
|
|
|
_textInfoLine1 = "";
|
|
|
|
_textInfoLine2 = "";
|
|
|
|
|
2015-04-13 09:53:19 +00:00
|
|
|
_windSpeed = call FUNC(measureWindSpeed);
|
2015-04-07 15:43:54 +00:00
|
|
|
_windDir = (ACE_wind select 0) atan2 (ACE_wind select 1);
|
|
|
|
|
|
|
|
_temperature = GET_TEMPERATURE_AT_HEIGHT((getPosASL ACE_player) select 2);
|
|
|
|
_humidity = EGVAR(weather,currentHumidity);
|
|
|
|
|
2015-04-11 17:44:38 +00:00
|
|
|
_playerDir = getDir ACE_player;
|
|
|
|
|
2015-04-08 09:25:15 +00:00
|
|
|
GVAR(Direction) = 4 * floor(_playerDir / 90);
|
|
|
|
if (_playerDir % 90 > 10) then { GVAR(Direction) = GVAR(Direction) + 1};
|
|
|
|
if (_playerDir % 90 > 35) then { GVAR(Direction) = GVAR(Direction) + 1};
|
|
|
|
if (_playerDir % 90 > 55) then { GVAR(Direction) = GVAR(Direction) + 1};
|
|
|
|
if (_playerDir % 90 > 80) then { GVAR(Direction) = GVAR(Direction) + 1};
|
|
|
|
GVAR(Direction) = GVAR(Direction) % 16;
|
2015-04-07 15:43:54 +00:00
|
|
|
|
2015-04-08 09:25:15 +00:00
|
|
|
switch (GVAR(Menu)) do {
|
2015-04-07 18:19:35 +00:00
|
|
|
case 0: { // Direction
|
2015-04-08 09:25:15 +00:00
|
|
|
if (!GVAR(MinAvgMax)) then {
|
2015-04-11 17:44:38 +00:00
|
|
|
_textCenterBig = format["%1", format["%1 %2", GVAR(Directions) select GVAR(Direction), round(_playerDir)]];
|
2015-04-07 18:19:35 +00:00
|
|
|
} else {
|
|
|
|
_textCenterLine1Left = "Min";
|
|
|
|
_textCenterLine2Left = "Avg";
|
|
|
|
_textCenterLine3Left = "Max";
|
|
|
|
_textCenterLine1Right = "N/A";
|
|
|
|
_textCenterLine2Right = "N/A";
|
2015-04-14 13:22:26 +00:00
|
|
|
_textCenterLine3Right = "N/A";
|
2015-04-07 18:19:35 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
case 1: { // Wind SPD
|
2015-04-08 09:25:15 +00:00
|
|
|
if (!GVAR(MinAvgMax)) then {
|
2015-04-13 09:53:19 +00:00
|
|
|
_textCenterBig = Str(round(abs(_windSpeed) * 10) / 10);
|
2015-04-07 18:19:35 +00:00
|
|
|
} else {
|
|
|
|
_textCenterLine1Left = "Max";
|
|
|
|
_textCenterLine2Left = "Avg";
|
2015-04-08 09:25:15 +00:00
|
|
|
switch (GVAR(MinAvgMaxMode)) do {
|
2015-04-07 18:19:35 +00:00
|
|
|
case 0: {
|
|
|
|
_textCenterLine1Right = "--. -";
|
|
|
|
_textCenterLine2Right = "--. -";
|
|
|
|
_textInfoLine2 = "- average";
|
|
|
|
};
|
|
|
|
case 1: {
|
2015-04-11 17:44:38 +00:00
|
|
|
_textCenterLine1Right = Str(round((GVAR(Max) select 1) * 10) / 10);
|
|
|
|
_textCenterLine2Right = Str(round((GVAR(Total) select 1) / (GVAR(Entries) select 1) * 10) / 10);
|
2015-04-07 18:19:35 +00:00
|
|
|
_textInfoLine2 = "- stop";
|
|
|
|
};
|
|
|
|
case 2: {
|
2015-04-11 17:44:38 +00:00
|
|
|
_textCenterLine1Right = Str(round((GVAR(Max) select 1) * 10) / 10);
|
|
|
|
_textCenterLine2Right = Str(round((GVAR(Total) select 1) / (GVAR(Entries) select 1) * 10) / 10);
|
2015-04-07 18:19:35 +00:00
|
|
|
_textInfoLine2 = "- clear";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
case 2: { // CROSSWIND
|
2015-04-08 09:25:15 +00:00
|
|
|
if (!GVAR(MinAvgMax)) then {
|
2015-04-11 17:44:38 +00:00
|
|
|
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
|
2015-04-13 09:53:19 +00:00
|
|
|
_textCenterBig = Str(round(abs(sin(GVAR(RefHeading) - _playerDir) * _windSpeed) * 10) / 10);
|
2015-04-18 20:12:37 +00:00
|
|
|
_textInfoLine1 = format["%1 m/s @ %2", round((abs(cos(_playerDir - _windDir)) * _windSpeed) * 10) / 10, round(_playerDir)];
|
2015-04-11 17:44:38 +00:00
|
|
|
} else {
|
2015-04-13 09:53:19 +00:00
|
|
|
_textCenterBig = Str(round(abs(sin(GVAR(RefHeading)) * _windSpeed) * 10) / 10);
|
|
|
|
_textInfoLine1 = format["%1 m/s @ %2", round(_windSpeed * 10) / 10, round(_windDir)];
|
2015-04-11 17:44:38 +00:00
|
|
|
};
|
2015-04-07 18:19:35 +00:00
|
|
|
_textInfoLine2 = "- set heading";
|
|
|
|
} else {
|
|
|
|
_textCenterLine1Left = "Max";
|
|
|
|
_textCenterLine2Left = "Avg";
|
2015-04-08 09:25:15 +00:00
|
|
|
switch (GVAR(MinAvgMax)Mode) do {
|
2015-04-07 18:19:35 +00:00
|
|
|
case 0: {
|
|
|
|
_textCenterLine1Right = "--. -";
|
|
|
|
_textCenterLine2Right = "--. -";
|
|
|
|
_textInfoLine2 = "- average";
|
|
|
|
};
|
|
|
|
case 1: {
|
2015-04-11 17:44:38 +00:00
|
|
|
_textCenterLine1Right = Str(round((GVAR(Max) select 2) * 10) / 10);
|
|
|
|
_textCenterLine2Right = Str(round((GVAR(Total) select 2) / (GVAR(Entries) select 2) * 10) / 10);
|
2015-04-07 18:19:35 +00:00
|
|
|
_textInfoLine2 = "- stop";
|
|
|
|
};
|
|
|
|
case 2: {
|
2015-04-11 17:44:38 +00:00
|
|
|
_textCenterLine1Right = Str(round((GVAR(Max) select 2) * 10) / 10);
|
|
|
|
_textCenterLine2Right = Str(round((GVAR(Total) select 2) / (GVAR(Entries) select 2) * 10) / 10);
|
2015-04-07 18:19:35 +00:00
|
|
|
_textInfoLine2 = "- clear";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
case 3: { // HEADWIND
|
2015-04-08 09:25:15 +00:00
|
|
|
if (!GVAR(MinAvgMax)) then {
|
2015-04-11 17:44:38 +00:00
|
|
|
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
|
2015-04-13 09:53:19 +00:00
|
|
|
_textCenterBig = Str(round(abs(cos(GVAR(RefHeading) - _playerDir) * _windSpeed) * 10) / 10);
|
2015-04-18 20:12:37 +00:00
|
|
|
_textInfoLine1 = format["%1 m/s @ %2", round((abs(cos(_playerDir - _windDir)) * _windSpeed) * 10) / 10, round(_playerDir)];
|
2015-04-11 17:44:38 +00:00
|
|
|
} else {
|
2015-04-13 09:53:19 +00:00
|
|
|
_textCenterBig = Str(round(abs(cos(GVAR(RefHeading)) * _windSpeed) * 10) / 10);
|
|
|
|
_textInfoLine1 = format["%1 m/s @ %2", round(_windSpeed * 10) / 10, round(_windDir)];
|
2015-04-11 17:44:38 +00:00
|
|
|
};
|
2015-04-07 18:19:35 +00:00
|
|
|
_textInfoLine2 = "- set heading";
|
|
|
|
} else {
|
|
|
|
_textCenterLine1Left = "Max";
|
|
|
|
_textCenterLine2Left = "Avg";
|
2015-04-08 09:25:15 +00:00
|
|
|
switch (GVAR(MinAvgMax)Mode) do {
|
2015-04-07 18:19:35 +00:00
|
|
|
case 0: {
|
|
|
|
_textCenterLine1Right = "--. -";
|
|
|
|
_textCenterLine2Right = "--. -";
|
|
|
|
_textInfoLine2 = "- average";
|
|
|
|
};
|
|
|
|
case 1: {
|
2015-04-11 17:44:38 +00:00
|
|
|
_textCenterLine1Right = Str(round((GVAR(Max) select 3) * 10) / 10);
|
|
|
|
_textCenterLine2Right = Str(round((GVAR(Total) select 3) / (GVAR(Entries) select 3) * 10) / 10);
|
2015-04-07 18:19:35 +00:00
|
|
|
_textInfoLine2 = "- stop";
|
|
|
|
};
|
|
|
|
case 2: {
|
2015-04-11 17:44:38 +00:00
|
|
|
_textCenterLine1Right = Str(round((GVAR(Max) select 3) * 10) / 10);
|
|
|
|
_textCenterLine2Right = Str(round((GVAR(Total) select 3) / (GVAR(Entries) select 3) * 10) / 10);
|
2015-04-07 18:19:35 +00:00
|
|
|
_textInfoLine2 = "- clear";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
case 4: { // TEMP
|
2015-04-08 09:25:15 +00:00
|
|
|
if (!GVAR(MinAvgMax)) then {
|
2015-04-07 18:19:35 +00:00
|
|
|
_textCenterBig = Str(round(_temperature * 10) / 10);
|
|
|
|
} else {
|
|
|
|
_textCenterLine1Left = "Min";
|
|
|
|
_textCenterLine2Left = "Avg";
|
|
|
|
_textCenterLine3Left = "Max";
|
2015-04-11 17:44:38 +00:00
|
|
|
_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);
|
2015-04-07 18:19:35 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
case 5: { // HUMIDITY
|
2015-04-08 09:25:15 +00:00
|
|
|
if (!GVAR(MinAvgMax)) then {
|
2015-04-07 18:19:35 +00:00
|
|
|
_textCenterBig = Str(round(_humidity * 100 * 10) / 10);
|
|
|
|
} else {
|
|
|
|
_textCenterLine1Left = "Min";
|
|
|
|
_textCenterLine2Left = "Avg";
|
|
|
|
_textCenterLine3Left = "Max";
|
2015-04-11 17:44:38 +00:00
|
|
|
_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);
|
2015-04-07 18:19:35 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
case 6: { // BARO
|
2015-04-08 09:25:15 +00:00
|
|
|
if (!GVAR(MinAvgMax)) then {
|
2015-04-20 11:54:22 +00:00
|
|
|
_textCenterBig = Str(round((((getPosASL ACE_player) select 2) call EFUNC(weather,calculateBarometricPressure)) * 10) / 10);
|
2015-04-07 18:19:35 +00:00
|
|
|
} else {
|
|
|
|
_textCenterLine1Left = "Min";
|
|
|
|
_textCenterLine2Left = "Avg";
|
|
|
|
_textCenterLine3Left = "Max";
|
2015-04-11 17:44:38 +00:00
|
|
|
_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);
|
2015-04-07 18:19:35 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
case 7: { // ALTITUDE
|
2015-04-08 09:25:15 +00:00
|
|
|
if (!GVAR(MinAvgMax)) then {
|
2015-04-08 10:56:34 +00:00
|
|
|
_textCenterBig = Str(round(EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2)));
|
2015-04-07 18:19:35 +00:00
|
|
|
} else {
|
|
|
|
_textCenterLine1Left = "Min";
|
|
|
|
_textCenterLine2Left = "Avg";
|
|
|
|
_textCenterLine3Left = "Max";
|
2015-04-11 17:44:38 +00:00
|
|
|
_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));
|
2015-04-07 18:19:35 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
case 8: { // User Screen 1
|
|
|
|
_textCenterLine1Left = Str(round(_playerDir));
|
2015-04-08 10:56:34 +00:00
|
|
|
_textCenterLine2Left = Str(round(EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2)));
|
2015-04-13 09:53:19 +00:00
|
|
|
_textCenterLine3Left = Str(round(abs(_windSpeed) * 10) / 10);
|
2015-04-11 17:44:38 +00:00
|
|
|
_textCenterLine1Right = GVAR(Directions) select GVAR(Direction);
|
2015-04-07 18:19:35 +00:00
|
|
|
_textCenterLine2Right = "m";
|
|
|
|
_textCenterLine3Right = "m/s";
|
|
|
|
};
|
|
|
|
case 9: { // User Screen 2
|
|
|
|
_textCenterLine1Left = Str(round(_temperature * 10) / 10);
|
|
|
|
_textCenterLine2Left = Str(round(_humidity * 100 * 10) / 10);
|
2015-04-08 10:56:34 +00:00
|
|
|
_textCenterLine3Left = Str(round((1013.25 * exp(-(EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2)) / 7990) - 10 * overcast) * 10) / 10);
|
2015-04-07 18:19:35 +00:00
|
|
|
_textCenterLine1Right = "C";
|
|
|
|
_textCenterLine2Right = "%";
|
|
|
|
_textCenterLine3Right = "hPA";
|
|
|
|
};
|
2015-04-07 15:43:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
[_textTop, _textCenterBig, _textCenterLine1Left, _textCenterLine2Left, _textCenterLine3Left, _textCenterLine1Right, _textCenterLine2Right, _textCenterLine3Right, _textInfoLine1, _textInfoLine2]
|