From 9116fed415a3d666a40dcdd43e3bb077e84aa356 Mon Sep 17 00:00:00 2001 From: ulteq Date: Sat, 16 May 2015 20:26:52 +0200 Subject: [PATCH] New main menu: 'date' | New sub menu: 'magnetic heading' --- addons/kestrel4500/RscTitles.hpp | 194 ++++---- addons/kestrel4500/XEH_postInit.sqf | 13 +- .../functions/fnc_buttonPressed.sqf | 77 ++- .../kestrel4500/functions/fnc_collectData.sqf | 30 +- .../functions/fnc_displayKestrel.sqf | 47 +- .../functions/fnc_generateOutputData.sqf | 467 ++++++++++-------- .../functions/fnc_updateDisplay.sqf | 43 +- 7 files changed, 546 insertions(+), 325 deletions(-) diff --git a/addons/kestrel4500/RscTitles.hpp b/addons/kestrel4500/RscTitles.hpp index b091a07561..fe0adf2c4b 100644 --- a/addons/kestrel4500/RscTitles.hpp +++ b/addons/kestrel4500/RscTitles.hpp @@ -2,8 +2,7 @@ #define ST_RIGHT 1 #define ST_CENTER 2 -class Kestrel4500_RscText -{ +class Kestrel4500_RscText { idc=-1; type=0; style=ST_CENTER; @@ -19,8 +18,7 @@ class Kestrel4500_RscText sizeEx=0.04; shadow=0; }; -class Kestrel4500_RscButton -{ +class Kestrel4500_RscButton { text=""; colorText[]={0,0,0,1}; colorDisabled[]={0,0,0,0}; @@ -49,8 +47,7 @@ class Kestrel4500_RscButton borderSize=0; shadow=0; }; -class Kestrel4500_Display -{ +class Kestrel4500_Display { name="Kestrel4500_Display"; idd=-1; onLoad="uiNamespace setVariable ['Kestrel4500_Display', (_this select 0)]"; @@ -58,10 +55,8 @@ class Kestrel4500_Display movingEnable=1; controlsBackground[]={}; objects[]={}; - class controls - { - class BACKGROUND - { + class controls { + class BACKGROUND { moving=1; type=0; font="TahomaB"; @@ -76,18 +71,16 @@ class Kestrel4500_Display colorText[]={1,1,1,1}; text=PATHTOF(UI\Kestrel4500.paa); }; - class POWER: Kestrel4500_RscButton - { + class POWER: Kestrel4500_RscButton { idc=-1; x=safezoneX+0.385; y=safezoneY+1.125; w=0.042; h=0.042*4/3; - action="closeDialog 0"; + action=QUOTE(7 call FUNC(buttonPressed)); onMouseButtonDown = "playSound 'kestrel4500_exit_button_click'"; }; - class ENTER: POWER - { + class ENTER: POWER { idc=-1; x=safezoneX+0.46; y=safezoneY+1.0; @@ -95,8 +88,7 @@ class Kestrel4500_Display action=QUOTE(0 call FUNC(buttonPressed)); onMouseButtonDown = "playSound 'kestrel4500_center_button_click'"; }; - class TOP: Kestrel4500_RscButton - { + class TOP: Kestrel4500_RscButton { idc=-1; x=safezoneX+0.46; y=safezoneY+0.93; @@ -105,15 +97,13 @@ class Kestrel4500_Display action=QUOTE(1 call FUNC(buttonPressed)); onMouseButtonDown = "playSound 'kestrel4500_top_button_click'"; }; - class BOTTOM: TOP - { + class BOTTOM: TOP { idc=-1; y=safezoneY+1.1; action=QUOTE(2 call FUNC(buttonPressed)); onMouseButtonDown = "playSound 'kestrel4500_bottom_button_click'"; }; - class LEFT: Kestrel4500_RscButton - { + class LEFT: Kestrel4500_RscButton { idc=-1; x=safezoneX+0.4; y=safezoneY+0.97; @@ -122,15 +112,13 @@ class Kestrel4500_Display action=QUOTE(3 call FUNC(buttonPressed)); onMouseButtonDown = "playSound 'kestrel4500_left_button_click'"; }; - class RIGHT: LEFT - { + class RIGHT: LEFT { idc=-1; x=safezoneX+0.58; action=QUOTE(4 call FUNC(buttonPressed)); onMouseButtonDown = "playSound 'kestrel4500_right_button_click'"; }; - class MEMORY: Kestrel4500_RscButton - { + class MEMORY: Kestrel4500_RscButton { idc=-1; x=safezoneX+0.395; y=safezoneY+0.87; @@ -138,15 +126,13 @@ class Kestrel4500_Display h=0.045*4/3; action=QUOTE(5 call FUNC(buttonPressed)); }; - class BACKLIGHT: MEMORY - { + class BACKLIGHT: MEMORY { idc=-1; x=safezoneX+0.585; action=QUOTE(6 call FUNC(buttonPressed)); }; - class TEXT_TOP: Kestrel4500_RscText - { + class TEXT_TOP: Kestrel4500_RscText { idc=74100; x=safezoneX+0.40; y=safezoneY+0.58; @@ -154,68 +140,86 @@ class Kestrel4500_Display h=0.04; text=""; }; - class TEXT_CENTER_BIG: TEXT_TOP - { + class TEXT_CENTER_BIG: TEXT_TOP { idc=74200; y=safezoneY+0.61; h=0.10; SizeEx=0.06; - text=""; }; - class TEXT_CENTER_LINE_1_LEFT: TEXT_TOP - { + class TEXT_CENTER: TEXT_TOP { + idc=74201; + y=safezoneY+0.64; + }; + class TEXT_CENTER_LINE_1_LEFT: TEXT_TOP { idc=74300; y=safezoneY+0.60; style=ST_LEFT; h=0.10; SizeEx=0.05; - text=""; }; - class TEXT_CENTER_LINE2_LEFT: TEXT_CENTER_LINE_1_LEFT - { + class TEXT_CENTER_LINE2_LEFT: TEXT_CENTER_LINE_1_LEFT { idc=74301; y=safezoneY+0.64; - text=""; }; - class TEXT_CENTER_LINE_3_LEFT: TEXT_CENTER_LINE2_LEFT - { + class TEXT_CENTER_LINE_3_LEFT: TEXT_CENTER_LINE2_LEFT { idc=74302; y=safezoneY+0.68; - text=""; }; - class TEXT_CENTER_LINE_1_RIGHT: TEXT_CENTER_LINE_1_LEFT - { + class TEXT_CENTER_LINE_1_RIGHT: TEXT_CENTER_LINE_1_LEFT { idc=74303; style=ST_RIGHT; }; - class TEXT_CENTER_LINE2_RIGHT: TEXT_CENTER_LINE2_LEFT - { + class TEXT_CENTER_LINE2_RIGHT: TEXT_CENTER_LINE2_LEFT { idc=74304; style=ST_RIGHT; }; - class TEXT_CENTER_LINE_3_RIGHT: TEXT_CENTER_LINE_3_LEFT - { + class TEXT_CENTER_LINE_3_RIGHT: TEXT_CENTER_LINE_3_LEFT { idc=74305; style=ST_RIGHT; }; - class TEXT_INFO_LINE_1: TEXT_TOP - { + class TEXT_INFO_LINE_1: TEXT_TOP { idc=74400; - y=safezoneY+0.69; - text=""; + y=safezoneY+0.68; }; - class TEXT_INFO_LINE_2: TEXT_TOP - { + class TEXT_INFO_LINE_2: TEXT_TOP { idc=74401; y=safezoneY+0.72; - text=""; + }; + class TEXT_BOTTOM_BIG: TEXT_TOP { + idc=74500; + y=safezoneY+0.67; + h=0.10; + SizeEx=0.06; + }; + class TEXT_CENTER_LINE_1: TEXT_TOP { + idc=74600; + y=safezoneY+0.58; + SizeEx=0.03; + }; + class TEXT_CENTER_LINE_2: TEXT_CENTER_LINE_1 { + idc=74601; + y=safezoneY+0.61; + }; + class TEXT_CENTER_LINE_3: TEXT_CENTER_LINE_1 { + idc=74602; + y=safezoneY+0.64; + }; + class TEXT_CENTER_LINE_4: TEXT_CENTER_LINE_1 { + idc=74603; + y=safezoneY+0.67; + }; + class TEXT_CENTER_LINE_5: TEXT_CENTER_LINE_1 { + idc=74604; + y=safezoneY+0.70; + }; + class TEXT_CENTER_LINE_6: TEXT_CENTER_LINE_1 { + idc=74605; + y=safezoneY+0.73; }; }; }; -class RscTitles -{ - class RscKestrel4500 - { +class RscTitles { + class RscKestrel4500 { idd=-1; onLoad="with uiNameSpace do { RscKestrel4500 = _this select 0 };"; onUnload=(_this call FUNC(onCloseDisplay)); @@ -223,10 +227,8 @@ class RscTitles duration=60; fadeIn="false"; fadeOut="false"; - class controls - { - class RscKestrel4500 - { + class controls { + class RscKestrel4500 { idc=75000; moving=0; type=0; @@ -241,8 +243,7 @@ class RscTitles colorText[]={1,1,1,1}; text=PATHTOF(UI\Kestrel4500_0.paa); }; - class RscTextTop: Kestrel4500_RscText - { + class RscTextTop: Kestrel4500_RscText { idc=75100; x=safezoneX-0.05+0.40*0.75; y=safezoneY+0.7+0.58*0.75; @@ -251,16 +252,18 @@ class RscTitles SizeEx=0.04*0.75; text=""; }; - class RscTextCenterBig: RscTextTop - { + class RscTextCenterBig: RscTextTop { idc=75200; y=safezoneY+0.7+0.61*0.75; h=0.10*0.75; SizeEx=0.06*0.75; text=""; }; - class RscTextCenterLine1Left: RscTextTop - { + class RscTextCenter: RscTextTop { + idc=75201; + y=safezoneY+0.7+0.64*0.75; + }; + class RscTextCenterLine1Left: RscTextTop { idc=75300; y=safezoneY+0.7+0.60*0.75; style=ST_LEFT; @@ -268,45 +271,70 @@ class RscTitles SizeEx=0.05*0.75; text=""; }; - class RscTextCenterLine2Left: RscTextCenterLine1Left - { + class RscTextCenterLine2Left: RscTextCenterLine1Left { idc=75301; y=safezoneY+0.7+0.64*0.75; text=""; }; - class RscTextCenterLine3Left: RscTextCenterLine2Left - { + class RscTextCenterLine3Left: RscTextCenterLine2Left { idc=75302; y=safezoneY+0.7+0.68*0.75; text=""; }; - class RscTextCenterLine1Right: RscTextCenterLine1Left - { + class RscTextCenterLine1Right: RscTextCenterLine1Left { idc=75303; style=ST_RIGHT; }; - class RscTextCenterLine2Right: RscTextCenterLine2Left - { + class RscTextCenterLine2Right: RscTextCenterLine2Left { idc=75304; style=ST_RIGHT; }; - class RscTextCenterLine3Right: RscTextCenterLine3Left - { + class RscTextCenterLine3Right: RscTextCenterLine3Left { idc=75305; style=ST_RIGHT; }; - class RscTextInfoLine1: RscTextTop - { + class RscTextInfoLine1: RscTextTop { idc=75400; - y=safezoneY+0.7+0.69*0.75; + y=safezoneY+0.7+0.68*0.75; text=""; }; - class RscTextInfoLine2: RscTextTop - { + class RscTextInfoLine2: RscTextTop { idc=75401; y=safezoneY+0.7+0.72*0.75; text=""; }; + class RscTextBottomBig: RscTextTop { + idc=75500; + y=safezoneY+0.7+0.67*0.75; + h=0.10*0.75; + SizeEx=0.06*0.75; + text=""; + }; + class RscTextCenterLine1: RscTextTop { + idc=75600; + y=safezoneY+0.7+0.58*0.75; + SizeEx=0.03*0.75; + }; + class RscTextCenterLine2: RscTextCenterLine1 { + idc=75601; + y=safezoneY+0.7+0.61*0.75; + }; + class RscTextCenterLine3: RscTextCenterLine1 { + idc=75602; + y=safezoneY+0.7+0.64*0.75; + }; + class RscTextCenterLine4: RscTextCenterLine1 { + idc=75603; + y=safezoneY+0.7+0.67*0.75; + }; + class RscTextCenterLine5: RscTextCenterLine1 { + idc=75604; + y=safezoneY+0.7+0.70*0.75; + }; + class RscTextCenterLine6: RscTextCenterLine1 { + idc=75605; + y=safezoneY+0.7+0.73*0.75; + }; }; }; diff --git a/addons/kestrel4500/XEH_postInit.sqf b/addons/kestrel4500/XEH_postInit.sqf index 674e8c5026..7790386cf7 100644 --- a/addons/kestrel4500/XEH_postInit.sqf +++ b/addons/kestrel4500/XEH_postInit.sqf @@ -2,22 +2,27 @@ #include "initKeybinds.sqf" -GVAR(Menus) = ["Direction", "Wind SPD m/s", "CROSSWIND m/s", "HEADWIND m/s", "TEMP °C", "CHILL °C", "HUMIDITY %", "HEAT INDEX °C", "DEW POINT °C", "WET BULB °C", "BARO hPA", "ALTITUDE m", "User Screen 1", "User Screen 2"]; +GVAR(Menus) = ["Date", "Direction", "Wind SPD m/s", "CROSSWIND m/s", "HEADWIND m/s", "TEMP °C", "CHILL °C", "HUMIDITY %", "HEAT INDEX °C", "DEW POINT °C", "WET BULB °C", "BARO hPA", "ALTITUDE m", "User Screen 1", "User Screen 2"]; -GVAR(TOTAL) = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; -GVAR(ENTRIES) = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; +GVAR(TOTAL) = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; +GVAR(ENTRIES) = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; GVAR(MinAvgMax) = false; GVAR(MinAvgMaxMode) = 0; +GVAR(referenceHeadingMenu) = 0; +GVAR(referenceHeadingAutoSet) = true; +GVAR(manualSetCooldown) = diag_tickTime; +GVAR(headingSetDisplayTimer) = 0; GVAR(Menu) = 1; GVAR(Directions) = ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"]; GVAR(Direction) = 0; GVAR(RefHeading) = 0; +GVAR(TmpHeading) = 0; GVAR(updateTimer) = 0; -GVAR(outputData) = ["", "", "", "", "", "", "", "", "", ""]; +GVAR(outputData) = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]; GVAR(MeasuredWindSpeed) = 0; GVAR(ImpellerState) = 0; diff --git a/addons/kestrel4500/functions/fnc_buttonPressed.sqf b/addons/kestrel4500/functions/fnc_buttonPressed.sqf index 1d73f9ac79..5c6553e402 100644 --- a/addons/kestrel4500/functions/fnc_buttonPressed.sqf +++ b/addons/kestrel4500/functions/fnc_buttonPressed.sqf @@ -18,7 +18,29 @@ switch (_this) do { case 0: { // Enter if (!GVAR(MinAvgMax) && (GVAR(Menu) == 2 || GVAR(Menu) == 3)) then { - GVAR(RefHeading) = getDir ACE_player; + switch (GVAR(referenceHeadingMenu)) do { + case 0: { // Head- and Crosswind main page + GVAR(TmpHeading) = GVAR(RefHeading); + GVAR(referenceHeadingMenu) = 1; + }; + case 1: { // Mode selection + if (GVAR(referenceHeadingAutoSet)) then { + GVAR(referenceHeadingMenu) = 2; + } else { + GVAR(referenceHeadingMenu) = 3; + }; + }; + case 2: { // Auto set + GVAR(RefHeading) = getDir ACE_player; + GVAR(referenceHeadingMenu) = 0; + GVAR(headingSetDisplayTimer) = diag_tickTime; + }; + case 3: { // Manual set + GVAR(RefHeading) = GVAR(TmpHeading); + GVAR(referenceHeadingMenu) = 0; + GVAR(headingSetDisplayTimer) = diag_tickTime; + }; + }; }; if (GVAR(MinAvgMax) && GVAR(Menu) > 0 && GVAR(Menu) < 4) then { if (GVAR(MinAvgMaxMode) != 1) then { @@ -33,21 +55,66 @@ switch (_this) do { }; }; case 1: { // Top - GVAR(Menu) = (GVAR(Menu) - 1 + (count GVAR(Menus))) % (count GVAR(Menus)); + if (GVAR(referenceHeadingMenu) == 1) then { + GVAR(referenceHeadingAutoSet) = !GVAR(referenceHeadingAutoSet); + } else { + GVAR(Menu) = (GVAR(Menu) - 1 + (count GVAR(Menus))) % (count GVAR(Menus)); + }; }; case 2: { // Bottom - GVAR(Menu) = (GVAR(Menu) + 1 + (count GVAR(Menus))) % (count GVAR(Menus)); + if (GVAR(referenceHeadingMenu) == 1) then { + GVAR(referenceHeadingAutoSet) = !GVAR(referenceHeadingAutoSet); + } else { + GVAR(Menu) = (GVAR(Menu) + 1 + (count GVAR(Menus))) % (count GVAR(Menus)); + }; }; case 3: { // Left - GVAR(MinAvgMax) = !GVAR(MinAvgMax); + if (GVAR(referenceHeadingMenu) == 0) then { + GVAR(MinAvgMax) = !GVAR(MinAvgMax); + } else { + if (GVAR(referenceHeadingMenu) == 3) then { + if (diag_tickTime - GVAR(manualSetCooldown) < 0.2) then { + GVAR(TmpHeading) = GVAR(TmpHeading) - 10; + } else { + GVAR(TmpHeading) = GVAR(TmpHeading) - 1; + }; + GVAR(manualSetCooldown) = diag_tickTime; + }; + }; }; case 4: { // Right - GVAR(MinAvgMax) = !GVAR(MinAvgMax); + if (GVAR(referenceHeadingMenu) == 0) then { + GVAR(MinAvgMax) = !GVAR(MinAvgMax); + } else { + if (GVAR(referenceHeadingMenu) == 3) then { + if (diag_tickTime - GVAR(manualSetCooldown) < 0.2) then { + GVAR(TmpHeading) = GVAR(TmpHeading) + 10; + } else { + GVAR(TmpHeading) = GVAR(TmpHeading) + 1; + }; + GVAR(manualSetCooldown) = diag_tickTime; + }; + }; }; case 5: { // Memory }; case 6: { // Backlight }; + case 7: { // Exit + private ["_exit"]; + _exit = true; + if (GVAR(referenceHeadingMenu) == 1) then { + GVAR(referenceHeadingMenu) = 0; + _exit = false; + }; + if (GVAR(referenceHeadingMenu) > 1) then { + GVAR(referenceHeadingMenu) = 1; + _exit = false; + }; + if (_exit) then { + closeDialog 0; + }; + }; }; [] call FUNC(updateDisplay); diff --git a/addons/kestrel4500/functions/fnc_collectData.sqf b/addons/kestrel4500/functions/fnc_collectData.sqf index 8e19b93f22..a20c944d1e 100644 --- a/addons/kestrel4500/functions/fnc_collectData.sqf +++ b/addons/kestrel4500/functions/fnc_collectData.sqf @@ -27,13 +27,13 @@ _dewPoint = [_temperature, _humidity] call EFUNC(weather,calculateDewPoint); _wetBulb = [_temperature, _barometricPressure, _humidity] call EFUNC(weather,calculateWetBulb); if (isNil QGVAR(MIN) || isNil QGVAR(MAX)) then { - GVAR(MIN) = [_playerDir, 0, 0, 0, _temperature, _chill, _humidity, _heatIndex, _dewPoint, _wetBulb, _barometricPressure, _altitude]; - GVAR(MAX) = [_playerDir, 0, 0, 0, _temperature, _chill, _humidity, _heatIndex, _dewPoint, _wetBulb, _barometricPressure, _altitude]; + GVAR(MIN) = [0, _playerDir, 0, 0, 0, _temperature, _chill, _humidity, _heatIndex, _dewPoint, _wetBulb, _barometricPressure, _altitude]; + GVAR(MAX) = [0, _playerDir, 0, 0, 0, _temperature, _chill, _humidity, _heatIndex, _dewPoint, _wetBulb, _barometricPressure, _altitude]; }; { GVAR(ENTRIES) set [_x, (GVAR(ENTRIES) select _x) + 1]; -} forEach [0, 4, 5, 6, 7, 8, 9, 10, 11]; +} forEach [1, 5, 6, 7, 8, 9, 10, 11, 12]; _fnc_updateMemory = { PARAMS_2(_slot,_value); @@ -47,11 +47,11 @@ _fnc_updateMemory = { if (GVAR(MinAvgMaxMode) == 1) then { { GVAR(ENTRIES) set [_x, (GVAR(ENTRIES) select _x) + 1]; - } forEach [1, 2, 3]; + } forEach [2, 3, 4]; // Wind SPD _windSpeed = call FUNC(measureWindSpeed); - [1, _windSpeed] call _fnc_updateMemory; + [2, _windSpeed] call _fnc_updateMemory; // CROSSWIND _crosswind = 0; @@ -60,7 +60,7 @@ if (GVAR(MinAvgMaxMode) == 1) then { } else { _crosswind = abs(sin(GVAR(RefHeading)) * _windSpeed); }; - [2, _crosswind] call _fnc_updateMemory; + [3, _crosswind] call _fnc_updateMemory; // HEADWIND _headwind = 0; @@ -69,14 +69,14 @@ if (GVAR(MinAvgMaxMode) == 1) then { } else { _headwind = abs(cos(GVAR(RefHeading)) * _windSpeed); }; - [3, _headwind] call _fnc_updateMemory; + [4, _headwind] call _fnc_updateMemory; }; -[4, _temperature] call _fnc_updateMemory; -[5, _chill] call _fnc_updateMemory; -[6, _humidity] call _fnc_updateMemory; -[7, _heatIndex] call _fnc_updateMemory; -[8, _dewPoint] call _fnc_updateMemory; -[9, _wetBulb] call _fnc_updateMemory; -[10, _barometricPressure] call _fnc_updateMemory; -[11, _altitude] call _fnc_updateMemory; +[5, _temperature] call _fnc_updateMemory; +[6, _chill] call _fnc_updateMemory; +[7, _humidity] call _fnc_updateMemory; +[8, _heatIndex] call _fnc_updateMemory; +[9, _dewPoint] call _fnc_updateMemory; +[10, _wetBulb] call _fnc_updateMemory; +[11, _barometricPressure] call _fnc_updateMemory; +[12, _altitude] call _fnc_updateMemory; diff --git a/addons/kestrel4500/functions/fnc_displayKestrel.sqf b/addons/kestrel4500/functions/fnc_displayKestrel.sqf index 8eb2cea0ad..fc0a1f278a 100644 --- a/addons/kestrel4500/functions/fnc_displayKestrel.sqf +++ b/addons/kestrel4500/functions/fnc_displayKestrel.sqf @@ -18,6 +18,7 @@ #define __ctrlKestrel4500 (__dsp displayCtrl 75000) #define __ctrlTop (__dsp displayCtrl 75100) #define __ctrlCenterBig (__dsp displayCtrl 75200) +#define __ctrlCenter (__dsp displayCtrl 75201) #define __ctrlCenterLine1Left (__dsp displayCtrl 75300) #define __ctrlCenterLine2Left (__dsp displayCtrl 75301) #define __ctrlCenterLine3Left (__dsp displayCtrl 75302) @@ -26,6 +27,13 @@ #define __ctrlCenterLine3Right (__dsp displayCtrl 75305) #define __ctrlInfoLine1 (__dsp displayCtrl 75400) #define __ctrlInfoLine2 (__dsp displayCtrl 75401) +#define __ctrlBottomBig (__dsp displayCtrl 75500) +#define __ctrlCenterLine1 (__dsp displayCtrl 75600) +#define __ctrlCenterLine2 (__dsp displayCtrl 75601) +#define __ctrlCenterLine3 (__dsp displayCtrl 75602) +#define __ctrlCenterLine4 (__dsp displayCtrl 75603) +#define __ctrlCenterLine5 (__dsp displayCtrl 75604) +#define __ctrlCenterLine6 (__dsp displayCtrl 75605) if (GVAR(Overlay)) exitWith { GVAR(Overlay) = false; @@ -63,17 +71,40 @@ GVAR(Overlay) = true; __ctrlTop ctrlSetText (_outputData select 0); __ctrlCenterBig ctrlSetText (_outputData select 1); + __ctrlCenter ctrlSetText (_outputData select 2); - __ctrlCenterLine1Left ctrlSetText (_outputData select 2); - __ctrlCenterLine2Left ctrlSetText (_outputData select 3); - __ctrlCenterLine3Left ctrlSetText (_outputData select 4); + __ctrlCenterLine1Left ctrlSetText (_outputData select 3); + __ctrlCenterLine2Left ctrlSetText (_outputData select 4); + __ctrlCenterLine3Left ctrlSetText (_outputData select 5); - __ctrlCenterLine1Right ctrlSetText (_outputData select 5); - __ctrlCenterLine2Right ctrlSetText (_outputData select 6); - __ctrlCenterLine3Right ctrlSetText (_outputData select 7); + __ctrlCenterLine1Right ctrlSetText (_outputData select 6); + __ctrlCenterLine2Right ctrlSetText (_outputData select 7); + __ctrlCenterLine3Right ctrlSetText (_outputData select 8); - __ctrlInfoLine1 ctrlSetText (_outputData select 8); - __ctrlInfoLine2 ctrlSetText (_outputData select 9); + __ctrlInfoLine1 ctrlSetText (_outputData select 9); + __ctrlInfoLine2 ctrlSetText (_outputData select 10); + + __ctrlBottomBig ctrlSetText (_outputData select 11); + + __ctrlCenterLine1 ctrlSetText (_outputData select 12); + __ctrlCenterLine2 ctrlSetText (_outputData select 13); + __ctrlCenterLine3 ctrlSetText (_outputData select 14); + __ctrlCenterLine4 ctrlSetText (_outputData select 15); + __ctrlCenterLine5 ctrlSetText (_outputData select 16); + __ctrlCenterLine6 ctrlSetText (_outputData select 17); + + if (GVAR(referenceHeadingMenu) == 1) then { + if (GVAR(referenceHeadingAutoSet)) then { + __ctrlCenterLine3 ctrlSetTextColor [0, 0, 0, 0.6]; + __ctrlCenterLine4 ctrlSetTextColor [0, 0, 0, 1.0]; + } else { + __ctrlCenterLine3 ctrlSetTextColor [0, 0, 0, 1.0]; + __ctrlCenterLine4 ctrlSetTextColor [0, 0, 0, 0.6]; + }; + } else { + __ctrlCenterLine3 ctrlSetTextColor [0, 0, 0, 1.0]; + __ctrlCenterLine4 ctrlSetTextColor [0, 0, 0, 1.0]; + }; }; call FUNC(updateImpellerState); diff --git a/addons/kestrel4500/functions/fnc_generateOutputData.sqf b/addons/kestrel4500/functions/fnc_generateOutputData.sqf index 95e9ec5712..106c1f3d32 100644 --- a/addons/kestrel4500/functions/fnc_generateOutputData.sqf +++ b/addons/kestrel4500/functions/fnc_generateOutputData.sqf @@ -14,12 +14,15 @@ */ #include "script_component.hpp" -private ["_playerDir", "_playerAltitude", "_temperature", "_humidity", "_barometricPressure", "_chill", "_heatIndex", "_dewPoint", "_wetBulb", "_windSpeed", "_windDir", "_textTop", "_textCenterBig", "_textCenterLine1Left", "_textCenterLine2Left", "_textCenterLine3Left", "_textCenterLine1Right", "_textCenterLine2Right", "_textCenterLine3Right", "_textInfoLine1", "_textInfoLine2"]; +if (diag_tickTime - GVAR(headingSetDisplayTimer) < 0.8) exitWith {["", "", " Heading Set", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]}; + +private ["_playerDir", "_playerAltitude", "_temperature", "_humidity", "_barometricPressure", "_chill", "_heatIndex", "_dewPoint", "_wetBulb", "_fnc_dayOfWeek", "_dayString", "_monthString", "_windSpeed", "_windDir", "_textTop", "_textCenterBig", "_textCenter", "_textCenterLine1Left", "_textCenterLine2Left", "_textCenterLine3Left", "_textCenterLine1Right", "_textCenterLine2Right", "_textCenterLine3Right", "_textInfoLine1", "_textInfoLine2", "_textBottomBig", "_textCenterLine1", "_textCenterLine2", "_textCenterLine3", "_textCenterLine4", "_textCenterLine5", "_textCenterLine6"]; [] call FUNC(collectData); _textTop = GVAR(Menus) select GVAR(Menu); _textCenterBig = ""; +_textCenter = ""; _textCenterLine1Left = ""; _textCenterLine2Left = ""; @@ -31,6 +34,15 @@ _textCenterLine3Right = ""; _textInfoLine1 = ""; _textInfoLine2 = ""; +_textBottomBig = ""; + +_textCenterLine1 = ""; +_textCenterLine2 = ""; +_textCenterLine3 = ""; +_textCenterLine4 = ""; +_textCenterLine5 = ""; +_textCenterLine6 = ""; + _windSpeed = call FUNC(measureWindSpeed); _windDir = (ACE_wind select 0) atan2 (ACE_wind select 1); @@ -45,6 +57,19 @@ _heatIndex = [_temperature, _humidity] call EFUNC(weather,calculateHeatIndex); _dewPoint = [_temperature, _humidity] call EFUNC(weather,calculateDewPoint); _wetBulb = [_temperature, _barometricPressure, _humidity] call EFUNC(weather,calculateWetBulb); +_fnc_dayOfWeek = { + private ["_year", "_month", "_day", "_table"]; + _year = _this select 0; + _month = _this select 1; + _day = _this select 2; + + _table = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]; + if (_month < 3) then { + _year = _year - 1; + }; + (_year + floor(_year/4) - floor(_year/100) + floor(_year/400) + (_table select (_month - 1)) + _day) % 7 +}; + 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}; @@ -52,220 +77,258 @@ 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; -switch (GVAR(Menu)) do { - case 0: { // Direction - if (!GVAR(MinAvgMax)) then { - _textCenterBig = format["%1", format["%1 %2", GVAR(Directions) select GVAR(Direction), round(_playerDir)]]; - } else { - _textCenterLine1Left = "Min"; - _textCenterLine2Left = "Avg"; - _textCenterLine3Left = "Max"; - _textCenterLine1Right = "N/A"; - _textCenterLine2Right = "N/A"; - _textCenterLine3Right = "N/A"; +if (GVAR(referenceHeadingMenu) == 0) then { + switch (GVAR(Menu)) do { + case 0: { // Date + EXPLODE_3_PVT(date,_year,_month,_day); + _dayString = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] select (date call _fnc_dayOfWeek); + _monthString = localize (["str_january","str_february","str_march","str_april","str_may","str_june","str_july","str_august","str_september","str_october","str_november","str_december"] select (_month - 1)); + _textTop = _dayString; + _textCenter = format["%1 %2 %3", _day, _monthString, _year]; + _textBottomBig = [daytime, "HH:MM:SS"] call bis_fnc_timeToString; }; - }; - case 1: { // Wind SPD - if (!GVAR(MinAvgMax)) then { - _textCenterBig = Str(round(abs(_windSpeed) * 10) / 10); - } else { - _textCenterLine1Left = "Max"; - _textCenterLine2Left = "Avg"; - switch (GVAR(MinAvgMaxMode)) do { - case 0: { - _textCenterLine1Right = "--. -"; - _textCenterLine2Right = "--. -"; - _textInfoLine2 = "- average"; - }; - case 1: { - _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((GVAR(Max) select 1) * 10) / 10); - _textCenterLine2Right = Str(round((GVAR(Total) select 1) / (GVAR(Entries) select 1) * 10) / 10); - _textInfoLine2 = "- clear"; - }; - }; - }; - }; - case 2: { // CROSSWIND - if (!GVAR(MinAvgMax)) then { - 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((abs(cos(_playerDir - _windDir)) * _windSpeed) * 10) / 10, round(_playerDir)]; + case 1: { // Direction + if (!GVAR(MinAvgMax)) then { + _textCenterBig = format["%1", format["%1 %2", GVAR(Directions) select GVAR(Direction), 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"; - _textCenterLine2Left = "Avg"; - switch (GVAR(MinAvgMax)Mode) do { - case 0: { - _textCenterLine1Right = "--. -"; - _textCenterLine2Right = "--. -"; - _textInfoLine2 = "- average"; - }; - case 1: { - _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((GVAR(Max) select 2) * 10) / 10); - _textCenterLine2Right = Str(round((GVAR(Total) select 2) / (GVAR(Entries) select 2) * 10) / 10); - _textInfoLine2 = "- clear"; - }; + _textCenterLine1Left = "Min"; + _textCenterLine2Left = "Avg"; + _textCenterLine3Left = "Max"; + _textCenterLine1Right = "N/A"; + _textCenterLine2Right = "N/A"; + _textCenterLine3Right = "N/A"; }; }; - }; - case 3: { // HEADWIND - if (!GVAR(MinAvgMax)) then { - 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((abs(cos(_playerDir - _windDir)) * _windSpeed) * 10) / 10, round(_playerDir)]; + case 2: { // Wind SPD + if (!GVAR(MinAvgMax)) then { + _textCenterBig = Str(round(abs(_windSpeed) * 10) / 10); } 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"; - _textCenterLine2Left = "Avg"; - switch (GVAR(MinAvgMax)Mode) do { - case 0: { - _textCenterLine1Right = "--. -"; - _textCenterLine2Right = "--. -"; - _textInfoLine2 = "- average"; - }; - case 1: { - _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((GVAR(Max) select 3) * 10) / 10); - _textCenterLine2Right = Str(round((GVAR(Total) select 3) / (GVAR(Entries) select 3) * 10) / 10); - _textInfoLine2 = "- clear"; + _textCenterLine1Left = "Max"; + _textCenterLine2Left = "Avg"; + switch (GVAR(MinAvgMaxMode)) do { + case 0: { + _textCenterLine1Right = "--. -"; + _textCenterLine2Right = "--. -"; + _textInfoLine2 = "- average"; + }; + case 1: { + _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((GVAR(Max) select 2) * 10) / 10); + _textCenterLine2Right = Str(round((GVAR(Total) select 2) / (GVAR(Entries) select 2) * 10) / 10); + _textInfoLine2 = "- clear"; + }; }; }; }; - }; - case 4: { // TEMP - if (!GVAR(MinAvgMax)) then { - _textCenterBig = Str(round(_temperature * 10) / 10); - } else { - _textCenterLine1Left = "Min"; - _textCenterLine2Left = "Avg"; - _textCenterLine3Left = "Max"; - _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 3: { // CROSSWIND + if (!GVAR(MinAvgMax)) then { + 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((abs(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"; + _textCenterLine2Left = "Avg"; + switch (GVAR(MinAvgMax)Mode) do { + case 0: { + _textCenterLine1Right = "--. -"; + _textCenterLine2Right = "--. -"; + _textInfoLine2 = "- average"; + }; + case 1: { + _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((GVAR(Max) select 3) * 10) / 10); + _textCenterLine2Right = Str(round((GVAR(Total) select 3) / (GVAR(Entries) select 3) * 10) / 10); + _textInfoLine2 = "- clear"; + }; + }; + }; + }; + case 4: { // HEADWIND + if (!GVAR(MinAvgMax)) then { + 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((abs(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"; + _textCenterLine2Left = "Avg"; + switch (GVAR(MinAvgMax)Mode) do { + case 0: { + _textCenterLine1Right = "--. -"; + _textCenterLine2Right = "--. -"; + _textInfoLine2 = "- average"; + }; + case 1: { + _textCenterLine1Right = Str(round((GVAR(Max) select 4) * 10) / 10); + _textCenterLine2Right = Str(round((GVAR(Total) select 4) / (GVAR(Entries) select 4) * 10) / 10); + _textInfoLine2 = "- stop"; + }; + case 2: { + _textCenterLine1Right = Str(round((GVAR(Max) select 4) * 10) / 10); + _textCenterLine2Right = Str(round((GVAR(Total) select 4) / (GVAR(Entries) select 4) * 10) / 10); + _textInfoLine2 = "- clear"; + }; + }; + }; + }; + case 5: { // TEMP + if (!GVAR(MinAvgMax)) then { + _textCenterBig = Str(round(_temperature * 10) / 10); + } else { + _textCenterLine1Left = "Min"; + _textCenterLine2Left = "Avg"; + _textCenterLine3Left = "Max"; + _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: { // CHILL + if (!GVAR(MinAvgMax)) then { + _textCenterBig = Str(round(_chill * 10) / 10); + } else { + _textCenterLine1Left = "Min"; + _textCenterLine2Left = "Avg"; + _textCenterLine3Left = "Max"; + _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: { // HUMIDITY + if (!GVAR(MinAvgMax)) then { + _textCenterBig = Str(round(_humidity * 100 * 10) / 10); + } else { + _textCenterLine1Left = "Min"; + _textCenterLine2Left = "Avg"; + _textCenterLine3Left = "Max"; + _textCenterLine1Right = Str(round((GVAR(Min) select 7) * 100 * 10) / 10); + _textCenterLine2Right = Str(round((GVAR(Total) select 7) / (GVAR(Entries) select 7) * 100 * 10) / 10); + _textCenterLine3Right = Str(round((GVAR(Max) select 7) * 100 * 10) / 10); + }; + }; + case 8: { // HEAT INDEX + if (!GVAR(MinAvgMax)) then { + _textCenterBig = Str(round(_heatIndex * 10) / 10); + } else { + _textCenterLine1Left = "Min"; + _textCenterLine2Left = "Avg"; + _textCenterLine3Left = "Max"; + _textCenterLine1Right = Str(round((GVAR(Min) select 8) * 10) / 10); + _textCenterLine2Right = Str(round((GVAR(Total) select 8) / (GVAR(Entries) select 8) * 10) / 10); + _textCenterLine3Right = Str(round((GVAR(Max) select 8) * 10) / 10); + }; + }; + case 9: { // DEW POINT + if (!GVAR(MinAvgMax)) then { + _textCenterBig = Str(round(_dewPoint * 10) / 10); + } else { + _textCenterLine1Left = "Min"; + _textCenterLine2Left = "Avg"; + _textCenterLine3Left = "Max"; + _textCenterLine1Right = Str(round((GVAR(Min) select 9) * 10) / 10); + _textCenterLine2Right = Str(round((GVAR(Total) select 9) / (GVAR(Entries) select 9) * 10) / 10); + _textCenterLine3Right = Str(round((GVAR(Max) select 9) * 10) / 10); + }; + }; + case 10: { // WET BULB + if (!GVAR(MinAvgMax)) then { + _textCenterBig = Str(round(_wetBulb * 10) / 10); + } else { + _textCenterLine1Left = "Min"; + _textCenterLine2Left = "Avg"; + _textCenterLine3Left = "Max"; + _textCenterLine1Right = Str(round((GVAR(Min) select 10) * 10) / 10); + _textCenterLine2Right = Str(round((GVAR(Total) select 10) / (GVAR(Entries) select 10) * 10) / 10); + _textCenterLine3Right = Str(round((GVAR(Max) select 10) * 10) / 10); + }; + }; + case 11: { // BARO + if (!GVAR(MinAvgMax)) then { + _textCenterBig = Str(round(_barometricPressure * 10) / 10); + } else { + _textCenterLine1Left = "Min"; + _textCenterLine2Left = "Avg"; + _textCenterLine3Left = "Max"; + _textCenterLine1Right = Str(round((GVAR(Min) select 11) * 10) / 10); + _textCenterLine2Right = Str(round((GVAR(Total) select 11) / (GVAR(Entries) select 11) * 10) / 10); + _textCenterLine3Right = Str(round((GVAR(Max) select 11) * 10) / 10); + }; + }; + case 12: { // ALTITUDE + if (!GVAR(MinAvgMax)) then { + _textCenterBig = Str(round(EGVAR(weather,Altitude) + _playerAltitude)); + } else { + _textCenterLine1Left = "Min"; + _textCenterLine2Left = "Avg"; + _textCenterLine3Left = "Max"; + _textCenterLine1Right = Str(round(GVAR(Min) select 12)); + _textCenterLine2Right = Str(round((GVAR(Total) select 12) / (GVAR(Entries) select 12))); + _textCenterLine3Right = Str(round(GVAR(Max) select 12)); + }; + }; + case 13: { // User Screen 1 + _textCenterLine1Left = Str(round(_playerDir)); + _textCenterLine2Left = Str(round(EGVAR(weather,Altitude) + _playerAltitude)); + _textCenterLine3Left = Str(round(abs(_windSpeed) * 10) / 10); + _textCenterLine1Right = GVAR(Directions) select GVAR(Direction); + _textCenterLine2Right = "m"; + _textCenterLine3Right = "m/s"; + }; + case 14: { // User Screen 2 + _textCenterLine1Left = Str(round(_temperature * 10) / 10); + _textCenterLine2Left = Str(round(_humidity * 100 * 10) / 10); + _textCenterLine3Left = Str(round((_playerAltitude call EFUNC(weather,calculateBarometricPressure)) * 10) / 10); + _textCenterLine1Right = "C"; + _textCenterLine2Right = "%"; + _textCenterLine3Right = "hPA"; }; }; - case 5: { // CHILL - if (!GVAR(MinAvgMax)) then { - _textCenterBig = Str(round(_chill * 10) / 10); - } else { - _textCenterLine1Left = "Min"; - _textCenterLine2Left = "Avg"; - _textCenterLine3Left = "Max"; - _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); +} else { + _textTop = ""; + switch (GVAR(referenceHeadingMenu)) do { + case 1: { + _textCenterLine1 = "MAGNETIC HEADING"; + _textCenterLine2 = Str(round(GVAR(RefHeading))); + _textCenterLine3 = "Auto Set "; + _textCenterLine4 = "Manual Set "; + _textCenterLine5 = "================"; + _textCenterLine6 = "- select (|) exit"; }; - }; - case 6: { // HUMIDITY - if (!GVAR(MinAvgMax)) then { - _textCenterBig = Str(round(_humidity * 100 * 10) / 10); - } else { - _textCenterLine1Left = "Min"; - _textCenterLine2Left = "Avg"; - _textCenterLine3Left = "Max"; - _textCenterLine1Right = Str(round((GVAR(Min) select 6) * 100 * 10) / 10); - _textCenterLine2Right = Str(round((GVAR(Total) select 6) / (GVAR(Entries) select 6) * 100 * 10) / 10); - _textCenterLine3Right = Str(round((GVAR(Max) select 6) * 100 * 10) / 10); + case 2: { + _textCenterLine1 = "MAGNETIC HEADING"; + _textCenterLine2 = Str(round(_playerDir)); + _textCenterLine3 = "Point Down the"; + _textCenterLine4 = "Runway or Range"; + _textCenterLine5 = "================"; + _textCenterLine6 = "- set heading"; }; - }; - case 7: { // HEAT INDEX - if (!GVAR(MinAvgMax)) then { - _textCenterBig = Str(round(_heatIndex * 10) / 10); - } else { - _textCenterLine1Left = "Min"; - _textCenterLine2Left = "Avg"; - _textCenterLine3Left = "Max"; - _textCenterLine1Right = Str(round((GVAR(Min) select 7) * 10) / 10); - _textCenterLine2Right = Str(round((GVAR(Total) select 7) / (GVAR(Entries) select 7) * 10) / 10); - _textCenterLine3Right = Str(round((GVAR(Max) select 7) * 10) / 10); + case 3: { + _textCenterLine1 = "MAGNETIC HEADING"; + _textCenterLine2 = Str(round(GVAR(TmpHeading))); + _textCenterLine3 = "Press < and >"; + _textCenterLine4 = "to Adjust"; + _textCenterLine5 = "================"; + _textCenterLine6 = "- set heading"; }; }; - case 8: { // DEW POINT - if (!GVAR(MinAvgMax)) then { - _textCenterBig = Str(round(_dewPoint * 10) / 10); - } else { - _textCenterLine1Left = "Min"; - _textCenterLine2Left = "Avg"; - _textCenterLine3Left = "Max"; - _textCenterLine1Right = Str(round((GVAR(Min) select 8) * 10) / 10); - _textCenterLine2Right = Str(round((GVAR(Total) select 8) / (GVAR(Entries) select 8) * 10) / 10); - _textCenterLine3Right = Str(round((GVAR(Max) select 8) * 10) / 10); - }; - }; - case 9: { // WET BULB - if (!GVAR(MinAvgMax)) then { - _textCenterBig = Str(round(_wetBulb * 10) / 10); - } else { - _textCenterLine1Left = "Min"; - _textCenterLine2Left = "Avg"; - _textCenterLine3Left = "Max"; - _textCenterLine1Right = Str(round((GVAR(Min) select 9) * 10) / 10); - _textCenterLine2Right = Str(round((GVAR(Total) select 9) / (GVAR(Entries) select 9) * 10) / 10); - _textCenterLine3Right = Str(round((GVAR(Max) select 9) * 10) / 10); - }; - }; - case 10: { // BARO - if (!GVAR(MinAvgMax)) then { - _textCenterBig = Str(round(_barometricPressure * 10) / 10); - } else { - _textCenterLine1Left = "Min"; - _textCenterLine2Left = "Avg"; - _textCenterLine3Left = "Max"; - _textCenterLine1Right = Str(round((GVAR(Min) select 10) * 10) / 10); - _textCenterLine2Right = Str(round((GVAR(Total) select 10) / (GVAR(Entries) select 10) * 10) / 10); - _textCenterLine3Right = Str(round((GVAR(Max) select 10) * 10) / 10); - }; - }; - case 11: { // ALTITUDE - if (!GVAR(MinAvgMax)) then { - _textCenterBig = Str(round(EGVAR(weather,Altitude) + _playerAltitude)); - } else { - _textCenterLine1Left = "Min"; - _textCenterLine2Left = "Avg"; - _textCenterLine3Left = "Max"; - _textCenterLine1Right = Str(round(GVAR(Min) select 11)); - _textCenterLine2Right = Str(round((GVAR(Total) select 11) / (GVAR(Entries) select 11))); - _textCenterLine3Right = Str(round(GVAR(Max) select 11)); - }; - }; - case 12: { // User Screen 1 - _textCenterLine1Left = Str(round(_playerDir)); - _textCenterLine2Left = Str(round(EGVAR(weather,Altitude) + _playerAltitude)); - _textCenterLine3Left = Str(round(abs(_windSpeed) * 10) / 10); - _textCenterLine1Right = GVAR(Directions) select GVAR(Direction); - _textCenterLine2Right = "m"; - _textCenterLine3Right = "m/s"; - }; - case 13: { // User Screen 2 - _textCenterLine1Left = Str(round(_temperature * 10) / 10); - _textCenterLine2Left = Str(round(_humidity * 100 * 10) / 10); - _textCenterLine3Left = Str(round((_playerAltitude call EFUNC(weather,calculateBarometricPressure)) * 10) / 10); - _textCenterLine1Right = "C"; - _textCenterLine2Right = "%"; - _textCenterLine3Right = "hPA"; - }; }; -[_textTop, _textCenterBig, _textCenterLine1Left, _textCenterLine2Left, _textCenterLine3Left, _textCenterLine1Right, _textCenterLine2Right, _textCenterLine3Right, _textInfoLine1, _textInfoLine2] +[_textTop, _textCenterBig, _textCenter, _textCenterLine1Left, _textCenterLine2Left, _textCenterLine3Left, _textCenterLine1Right, _textCenterLine2Right, _textCenterLine3Right, _textInfoLine1, _textInfoLine2, _textBottomBig, _textCenterLine1, _textCenterLine2, _textCenterLine3, _textCenterLine4, _textCenterLine5, _textCenterLine6] diff --git a/addons/kestrel4500/functions/fnc_updateDisplay.sqf b/addons/kestrel4500/functions/fnc_updateDisplay.sqf index 0f8be4f873..90f77f5f6a 100644 --- a/addons/kestrel4500/functions/fnc_updateDisplay.sqf +++ b/addons/kestrel4500/functions/fnc_updateDisplay.sqf @@ -14,20 +14,47 @@ */ #include "script_component.hpp" +#define __dsp (uiNamespace getVariable "Kestrel4500_Display") +#define __ctrlCenterLine3 (__dsp displayCtrl 74602) +#define __ctrlCenterLine4 (__dsp displayCtrl 74603) + private ["_outputData"]; _outputData = [] call FUNC(generateOutputData); ctrlSetText [74100, _outputData select 0]; ctrlSetText [74200, _outputData select 1]; +ctrlSetText [74201, _outputData select 2]; -ctrlSetText [74300, _outputData select 2]; -ctrlSetText [74301, _outputData select 3]; -ctrlSetText [74302, _outputData select 4]; +ctrlSetText [74300, _outputData select 3]; +ctrlSetText [74301, _outputData select 4]; +ctrlSetText [74302, _outputData select 5]; -ctrlSetText [74303, _outputData select 5]; -ctrlSetText [74304, _outputData select 6]; -ctrlSetText [74305, _outputData select 7]; +ctrlSetText [74303, _outputData select 6]; +ctrlSetText [74304, _outputData select 7]; +ctrlSetText [74305, _outputData select 8]; -ctrlSetText [74400, _outputData select 8]; -ctrlSetText [74401, _outputData select 9]; \ No newline at end of file +ctrlSetText [74400, _outputData select 9]; +ctrlSetText [74401, _outputData select 10]; + +ctrlSetText [74500, _outputData select 11]; + +ctrlSetText [74600, _outputData select 12]; +ctrlSetText [74601, _outputData select 13]; +ctrlSetText [74602, _outputData select 14]; +ctrlSetText [74603, _outputData select 15]; +ctrlSetText [74604, _outputData select 16]; +ctrlSetText [74605, _outputData select 17]; + +if (GVAR(referenceHeadingMenu) == 1) then { + if (GVAR(referenceHeadingAutoSet)) then { + __ctrlCenterLine3 ctrlSetTextColor [0, 0, 0, 0.6]; + __ctrlCenterLine4 ctrlSetTextColor [0, 0, 0, 1.0]; + } else { + __ctrlCenterLine3 ctrlSetTextColor [0, 0, 0, 1.0]; + __ctrlCenterLine4 ctrlSetTextColor [0, 0, 0, 0.6]; + }; +} else { + __ctrlCenterLine3 ctrlSetTextColor [0, 0, 0, 1.0]; + __ctrlCenterLine4 ctrlSetTextColor [0, 0, 0, 1.0]; +};