Implemented the Kestrel4500 spinning wheel animation

This commit is contained in:
ulteq 2015-04-12 22:54:36 +02:00
parent 1ff7218903
commit 705017f222
12 changed files with 43 additions and 17 deletions

View File

@ -65,7 +65,7 @@ class Kestrel4500_Display
type=0; type=0;
font="TahomaB"; font="TahomaB";
SizeEX=0.025; SizeEX=0.025;
idc=-1; idc=74000;
style=48; style=48;
x=safezoneX; x=safezoneX;
y=safezoneY; y=safezoneY;
@ -73,7 +73,7 @@ class Kestrel4500_Display
h=1.024*4/3; h=1.024*4/3;
colorBackground[]={1,1,1,1}; colorBackground[]={1,1,1,1};
colorText[]={1,1,1,1}; colorText[]={1,1,1,1};
text=PATHTOF(UI\kestrel4500.paa); text=PATHTOF(UI\Kestrel4500.paa);
}; };
class POWER: Kestrel4500_RscButton class POWER: Kestrel4500_RscButton
{ {
@ -237,7 +237,7 @@ class RscTitles
h=1.024*4/3*0.75; h=1.024*4/3*0.75;
colorBackground[]={1,1,1,1}; colorBackground[]={1,1,1,1};
colorText[]={1,1,1,1}; colorText[]={1,1,1,1};
text=PATHTOF(UI\kestrel4500.paa); text=PATHTOF(UI\Kestrel4500.paa);
}; };
class RscTextTop: Kestrel4500_RscText class RscTextTop: Kestrel4500_RscText
{ {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -16,5 +16,10 @@ GVAR(Direction) = 0;
GVAR(RefHeading) = 0; GVAR(RefHeading) = 0;
GVAR(updateTimer) = 0;
GVAR(outputData) = ["", "", "", "", "", "", "", "", "", ""];
GVAR(MeasuredWindSpeed) = 0;
GVAR(WheelState) = 0;
GVAR(Kestrel4500) = false; GVAR(Kestrel4500) = false;
GVAR(Overlay) = false; GVAR(Overlay) = false;

View File

@ -27,8 +27,6 @@
#define __ctrlInfoLine1 (__dsp displayCtrl 75400) #define __ctrlInfoLine1 (__dsp displayCtrl 75400)
#define __ctrlInfoLine2 (__dsp displayCtrl 75401) #define __ctrlInfoLine2 (__dsp displayCtrl 75401)
private ["_outputData"];
if (GVAR(Overlay)) exitWith { if (GVAR(Overlay)) exitWith {
GVAR(Overlay) = false; GVAR(Overlay) = false;
3 cutText ["", "PLAIN"]; 3 cutText ["", "PLAIN"];
@ -45,6 +43,8 @@ if (GVAR(Kestrel4500) && dialog) then {
GVAR(Overlay) = true; GVAR(Overlay) = true;
[{ [{
private ["_outputData", "_updateTimer"];
// abort condition // abort condition
if (!GVAR(Overlay) || {!(("ACE_Kestrel4500" in (uniformItems ACE_player)) || ("ACE_Kestrel4500" in (vestItems ACE_player)))}) exitWith { if (!GVAR(Overlay) || {!(("ACE_Kestrel4500" in (uniformItems ACE_player)) || ("ACE_Kestrel4500" in (vestItems ACE_player)))}) exitWith {
GVAR(Overlay) = false; GVAR(Overlay) = false;
@ -54,8 +54,17 @@ GVAR(Overlay) = true;
_outputData = [] call FUNC(generateOutputData); _outputData = [] call FUNC(generateOutputData);
if (diag_tickTime > GVAR(updateTimer)) then {
GVAR(updateTimer) = diag_tickTime + 1;
GVAR(outputData) = _outputData;
};
_outputData = GVAR(outputData);
3 cutRsc ["RscKestrel4500", "PLAIN", 1, false]; 3 cutRsc ["RscKestrel4500", "PLAIN", 1, false];
__ctrlKestrel4500 ctrlSetText format [QUOTE(PATHTOF(UI\Kestrel4500_%1.paa)), floor(GVAR(WheelState) % 7)];
__ctrlTop ctrlSetText (_outputData select 0); __ctrlTop ctrlSetText (_outputData select 0);
__ctrlCenterBig ctrlSetText (_outputData select 1); __ctrlCenterBig ctrlSetText (_outputData select 1);
@ -72,6 +81,6 @@ GVAR(Overlay) = true;
__ctrlInfoLine1 ctrlSetText (_outputData select 8); __ctrlInfoLine1 ctrlSetText (_outputData select 8);
__ctrlInfoLine2 ctrlSetText (_outputData select 9); __ctrlInfoLine2 ctrlSetText (_outputData select 9);
}, 1, _this select 0] call CBA_fnc_addPerFrameHandler; }, 0.01, []] call CBA_fnc_addPerFrameHandler;
true true

View File

@ -47,6 +47,18 @@ if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) t
_windSpeed = cos(_playerDir - _windDir) * _windSpeed; _windSpeed = cos(_playerDir - _windDir) * _windSpeed;
}; };
if (_windSpeed > 0.3) then {
GVAR(MeasuredWindSpeed) = _windSpeed;
} else {
GVAR(MeasuredWindSpeed) = GVAR(MeasuredWindSpeed) * 0.99;
if (GVAR(MeasuredWindSpeed) < 0.05) then {
GVAR(MeasuredWindSpeed) = 0;
};
};
GVAR(WheelState) = GVAR(WheelState) + (ceil(GVAR(MeasuredWindSpeed)) min 1) max GVAR(MeasuredWindSpeed);
if (GVAR(WheelState) > 1000) then { GVAR(WheelState) = 0 };
GVAR(Direction) = 4 * floor(_playerDir / 90); GVAR(Direction) = 4 * floor(_playerDir / 90);
if (_playerDir % 90 > 10) then { GVAR(Direction) = GVAR(Direction) + 1}; if (_playerDir % 90 > 10) then { GVAR(Direction) = GVAR(Direction) + 1};
if (_playerDir % 90 > 35) then { GVAR(Direction) = GVAR(Direction) + 1}; if (_playerDir % 90 > 35) then { GVAR(Direction) = GVAR(Direction) + 1};
@ -69,7 +81,7 @@ switch (GVAR(Menu)) do {
}; };
case 1: { // Wind SPD case 1: { // Wind SPD
if (!GVAR(MinAvgMax)) then { if (!GVAR(MinAvgMax)) then {
_textCenterBig = Str(round(abs(_windSpeed) * 10) / 10); _textCenterBig = Str(round(abs(GVAR(MeasuredWindSpeed)) * 10) / 10);
} else { } else {
_textCenterLine1Left = "Max"; _textCenterLine1Left = "Max";
_textCenterLine2Left = "Avg"; _textCenterLine2Left = "Avg";
@ -95,11 +107,11 @@ switch (GVAR(Menu)) do {
case 2: { // CROSSWIND case 2: { // CROSSWIND
if (!GVAR(MinAvgMax)) then { if (!GVAR(MinAvgMax)) then {
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
_textCenterBig = Str(round(abs(sin(GVAR(RefHeading) - _playerDir) * _windSpeed) * 10) / 10); _textCenterBig = Str(round(abs(sin(GVAR(RefHeading) - _playerDir) * GVAR(MeasuredWindSpeed)) * 10) / 10);
_textInfoLine1 = format["%1 m/s @ %2", round((cos(_playerDir - _windDir) * _windSpeed) * 10) / 10, round(_playerDir)]; _textInfoLine1 = format["%1 m/s @ %2", round((cos(_playerDir - _windDir) * GVAR(MeasuredWindSpeed)) * 10) / 10, round(_playerDir)];
} else { } else {
_textCenterBig = Str(round(abs(sin(GVAR(RefHeading)) * _windSpeed) * 10) / 10); _textCenterBig = Str(round(abs(sin(GVAR(RefHeading)) * GVAR(MeasuredWindSpeed)) * 10) / 10);
_textInfoLine1 = format["%1 m/s @ %2", round(_windSpeed * 10) / 10, round(_windDir)]; _textInfoLine1 = format["%1 m/s @ %2", round(GVAR(MeasuredWindSpeed) * 10) / 10, round(_windDir)];
}; };
_textInfoLine2 = "- set heading"; _textInfoLine2 = "- set heading";
} else { } else {
@ -127,11 +139,11 @@ switch (GVAR(Menu)) do {
case 3: { // HEADWIND case 3: { // HEADWIND
if (!GVAR(MinAvgMax)) then { if (!GVAR(MinAvgMax)) then {
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
_textCenterBig = Str(round(abs(cos(GVAR(RefHeading) - _playerDir) * _windSpeed) * 10) / 10); _textCenterBig = Str(round(abs(cos(GVAR(RefHeading) - _playerDir) * GVAR(MeasuredWindSpeed)) * 10) / 10);
_textInfoLine1 = format["%1 m/s @ %2", round((cos(_playerDir - _windDir) * _windSpeed) * 10) / 10, round(_playerDir)]; _textInfoLine1 = format["%1 m/s @ %2", round((cos(_playerDir - _windDir) * GVAR(MeasuredWindSpeed)) * 10) / 10, round(_playerDir)];
} else { } else {
_textCenterBig = Str(round(abs(cos(GVAR(RefHeading)) * _windSpeed) * 10) / 10); _textCenterBig = Str(round(abs(cos(GVAR(RefHeading)) * GVAR(MeasuredWindSpeed)) * 10) / 10);
_textInfoLine1 = format["%1 m/s @ %2", round(_windSpeed * 10) / 10, round(_windDir)]; _textInfoLine1 = format["%1 m/s @ %2", round(GVAR(MeasuredWindSpeed) * 10) / 10, round(_windDir)];
}; };
_textInfoLine2 = "- set heading"; _textInfoLine2 = "- set heading";
} else { } else {
@ -207,7 +219,7 @@ switch (GVAR(Menu)) do {
case 8: { // User Screen 1 case 8: { // User Screen 1
_textCenterLine1Left = Str(round(_playerDir)); _textCenterLine1Left = Str(round(_playerDir));
_textCenterLine2Left = Str(round(EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2))); _textCenterLine2Left = Str(round(EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2)));
_textCenterLine3Left = Str(round(abs(_windSpeed) * 10) / 10); _textCenterLine3Left = Str(round(abs(GVAR(MeasuredWindSpeed)) * 10) / 10);
_textCenterLine1Right = GVAR(Directions) select GVAR(Direction); _textCenterLine1Right = GVAR(Directions) select GVAR(Direction);
_textCenterLine2Right = "m"; _textCenterLine2Right = "m";
_textCenterLine3Right = "m/s"; _textCenterLine3Right = "m/s";

View File

@ -30,4 +30,4 @@ ctrlSetText [74304, _outputData select 6];
ctrlSetText [74305, _outputData select 7]; ctrlSetText [74305, _outputData select 7];
ctrlSetText [74400, _outputData select 8]; ctrlSetText [74400, _outputData select 8];
ctrlSetText [74401, _outputData select 9]; ctrlSetText [74401, _outputData select 9];