2015-04-07 15:58:54 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
|
|
|
* Handles the Kestrel 4500 dialog button actions
|
|
|
|
*
|
|
|
|
* Arguments:
|
2015-08-13 23:55:54 +00:00
|
|
|
* button ID <NUMBER>
|
2015-04-07 15:58:54 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-13 23:55:54 +00:00
|
|
|
* None
|
2015-04-07 15:58:54 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* 2 call ace_kestrel4500_fnc_buttonPressed
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-04-07 15:43:54 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
switch (_this) do {
|
2015-04-07 18:19:35 +00:00
|
|
|
case 0: { // Enter
|
2015-05-16 21:30:16 +00:00
|
|
|
if (!GVAR(MinAvgMax) && (GVAR(Menu) == 3 || GVAR(Menu) == 4)) then {
|
2015-05-16 18:26:52 +00:00
|
|
|
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
|
2015-05-16 21:34:50 +00:00
|
|
|
GVAR(RefHeading) = (getDir ACE_player) % 360;
|
2015-05-16 18:26:52 +00:00
|
|
|
GVAR(referenceHeadingMenu) = 0;
|
2015-05-21 16:42:44 +00:00
|
|
|
GVAR(headingSetDisplayTimer) = ACE_diagTime;
|
2015-05-16 18:26:52 +00:00
|
|
|
};
|
|
|
|
case 3: { // Manual set
|
|
|
|
GVAR(RefHeading) = GVAR(TmpHeading);
|
|
|
|
GVAR(referenceHeadingMenu) = 0;
|
2015-05-21 16:42:44 +00:00
|
|
|
GVAR(headingSetDisplayTimer) = ACE_diagTime;
|
2015-05-16 18:26:52 +00:00
|
|
|
};
|
|
|
|
};
|
2015-04-07 18:19:35 +00:00
|
|
|
};
|
2015-05-16 21:30:16 +00:00
|
|
|
if (GVAR(MinAvgMax) && GVAR(Menu) > 1 && GVAR(Menu) < 5) then {
|
2015-04-11 17:44:38 +00:00
|
|
|
if (GVAR(MinAvgMaxMode) != 1) then {
|
2015-04-07 18:19:35 +00:00
|
|
|
{
|
2015-04-08 09:25:15 +00:00
|
|
|
GVAR(MIN) set [_x, 0];
|
|
|
|
GVAR(MAX) set [_x, 0];
|
|
|
|
GVAR(TOTAL) set [_x, 0];
|
|
|
|
GVAR(ENTRIES) set [_x, 0];
|
2015-05-16 21:30:16 +00:00
|
|
|
} forEach [2, 3, 4];
|
2015-04-07 18:19:35 +00:00
|
|
|
};
|
2015-04-11 17:44:38 +00:00
|
|
|
GVAR(MinAvgMaxMode) = (GVAR(MinAvgMaxMode) + 1) % 3;
|
2015-04-07 18:19:35 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
case 1: { // Top
|
2015-05-16 18:26:52 +00:00
|
|
|
if (GVAR(referenceHeadingMenu) == 1) then {
|
|
|
|
GVAR(referenceHeadingAutoSet) = !GVAR(referenceHeadingAutoSet);
|
|
|
|
} else {
|
|
|
|
GVAR(Menu) = (GVAR(Menu) - 1 + (count GVAR(Menus))) % (count GVAR(Menus));
|
|
|
|
};
|
2015-04-07 18:19:35 +00:00
|
|
|
};
|
|
|
|
case 2: { // Bottom
|
2015-05-16 18:26:52 +00:00
|
|
|
if (GVAR(referenceHeadingMenu) == 1) then {
|
|
|
|
GVAR(referenceHeadingAutoSet) = !GVAR(referenceHeadingAutoSet);
|
|
|
|
} else {
|
|
|
|
GVAR(Menu) = (GVAR(Menu) + 1 + (count GVAR(Menus))) % (count GVAR(Menus));
|
|
|
|
};
|
2015-04-07 18:19:35 +00:00
|
|
|
};
|
|
|
|
case 3: { // Left
|
2015-05-16 18:26:52 +00:00
|
|
|
if (GVAR(referenceHeadingMenu) == 0) then {
|
|
|
|
GVAR(MinAvgMax) = !GVAR(MinAvgMax);
|
|
|
|
} else {
|
|
|
|
if (GVAR(referenceHeadingMenu) == 3) then {
|
2015-05-21 16:42:44 +00:00
|
|
|
if (ACE_diagTime - GVAR(manualSetCooldown) < 0.2) then {
|
2015-05-16 18:26:52 +00:00
|
|
|
GVAR(TmpHeading) = GVAR(TmpHeading) - 10;
|
|
|
|
} else {
|
|
|
|
GVAR(TmpHeading) = GVAR(TmpHeading) - 1;
|
|
|
|
};
|
2015-05-16 21:34:50 +00:00
|
|
|
GVAR(TmpHeading) = (GVAR(TmpHeading) + 360) % 360;
|
2015-05-21 16:42:44 +00:00
|
|
|
GVAR(manualSetCooldown) = ACE_diagTime;
|
2015-05-16 18:26:52 +00:00
|
|
|
};
|
|
|
|
};
|
2015-04-07 18:19:35 +00:00
|
|
|
};
|
|
|
|
case 4: { // Right
|
2015-05-16 18:26:52 +00:00
|
|
|
if (GVAR(referenceHeadingMenu) == 0) then {
|
|
|
|
GVAR(MinAvgMax) = !GVAR(MinAvgMax);
|
|
|
|
} else {
|
|
|
|
if (GVAR(referenceHeadingMenu) == 3) then {
|
2015-05-21 16:42:44 +00:00
|
|
|
if (ACE_diagTime - GVAR(manualSetCooldown) < 0.2) then {
|
2015-05-16 18:26:52 +00:00
|
|
|
GVAR(TmpHeading) = GVAR(TmpHeading) + 10;
|
|
|
|
} else {
|
|
|
|
GVAR(TmpHeading) = GVAR(TmpHeading) + 1;
|
|
|
|
};
|
2015-05-16 21:34:50 +00:00
|
|
|
GVAR(TmpHeading) = (GVAR(TmpHeading) + 360) % 360;
|
2015-05-21 16:42:44 +00:00
|
|
|
GVAR(manualSetCooldown) = ACE_diagTime;
|
2015-05-16 18:26:52 +00:00
|
|
|
};
|
|
|
|
};
|
2015-04-07 18:19:35 +00:00
|
|
|
};
|
|
|
|
case 5: { // Memory
|
|
|
|
};
|
|
|
|
case 6: { // Backlight
|
|
|
|
};
|
2015-05-16 18:26:52 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
};
|
2015-04-07 15:43:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
[] call FUNC(updateDisplay);
|
2015-05-14 13:39:29 +00:00
|
|
|
[] call FUNC(storeUserData);
|