mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
get kestrl to work
This commit is contained in:
parent
8c8e14b0ca
commit
70b642afc0
@ -34,7 +34,7 @@ class RscTitles {
|
||||
idc = 12;
|
||||
type = 0;
|
||||
style = 1;
|
||||
text = " 0000";
|
||||
text = "";
|
||||
x = "safeZoneX + 0.08";
|
||||
y = "safeZoneY + safeZoneH - 0.51";
|
||||
h = "0.09";
|
||||
@ -77,7 +77,7 @@ class RscTitles {
|
||||
idc = 1;
|
||||
type = 0;
|
||||
style = "48 + 0x800";
|
||||
text = PATHTOF(data\kestrel_0.paa);
|
||||
text = "";
|
||||
x = "safeZoneX + 0.07";
|
||||
y = "safeZoneY + safeZoneH - 0.76";
|
||||
h = "0.15";
|
||||
|
@ -1,94 +0,0 @@
|
||||
|
||||
/*
|
||||
WHILE {AGM_isKestrel} DO {
|
||||
_dSpotter = direction _player;
|
||||
_windrarray = WIND;
|
||||
_windrA= _windrarray select 0;
|
||||
_windrB= _windrarray select 1;
|
||||
_windrC= sqrt ((_windrA * _windrA) + (_windrB * _windrB));
|
||||
_windrD= _windrA atan2 _windrB;
|
||||
_windrR = _dSpotter - _windrD;
|
||||
IF (_windrR < 0) THEN {_windrR = 360+_windrR;};
|
||||
_windrBB = _windrC * sin (_windrR);
|
||||
_windrAA = sqrt ((_windrC * _windrC) - (_windrBB * _windrBB));
|
||||
IF (_windrR < 90) THEN {_windrAA= _windrAA - (_windrAA*2);};
|
||||
IF (_windrR > 270) THEN {_windrAA= _windrAA - (_windrAA*2);};
|
||||
|
||||
_OrtPlayer = eyePos _player;
|
||||
_Pos0 = _OrtPlayer select 0;
|
||||
_Pos1 = _OrtPlayer select 1;
|
||||
_Pos2 = _OrtPlayer select 2;
|
||||
|
||||
// im Gebaude
|
||||
_Ort=0;
|
||||
IF (lineIntersects [_OrtPlayer, [_Pos0,_Pos1,_Pos2 + 15]]) THEN {_Ort=_Ort+1};
|
||||
/*
|
||||
if (lineIntersects [_OrtPlayer, [_Pos0,_Pos1 + 15,_Pos2]]) then {_Ort=_Ort+1};
|
||||
if (lineIntersects [_OrtPlayer, [_Pos0,_Pos1 - 15,_Pos2]]) then {_Ort=_Ort+1};
|
||||
if (lineIntersects [_OrtPlayer, [_Pos0 + 15,_Pos1,_Pos2]]) then {_Ort=_Ort+1};
|
||||
if (lineIntersects [_OrtPlayer, [_Pos0 - 15,_Pos1,_Pos2]]) then {_Ort=_Ort+1};
|
||||
*/
|
||||
IF (lineIntersects [[(_Pos0) , (_Pos1), (_Pos2)], [(_Pos0) - (sin windDir) * 15, (_Pos1) - (cos windDir) * 15, (_Pos2)]]) THEN {_Ort=_Ort+1};
|
||||
IF (lineIntersects [[(_Pos0) , (_Pos1), (_Pos2)], [(_Pos0) - (sin (windDir-90)) * 15, (_Pos1) - (cos (windDir-90)) * 15, (_Pos2)]]) THEN {_Ort=_Ort+1};
|
||||
IF (lineIntersects [[(_Pos0) , (_Pos1), (_Pos2)], [(_Pos0) - (sin (windDir+90)) * 15, (_Pos1) - (cos (windDir+90)) * 15, (_Pos2)]]) THEN {_Ort=_Ort+1};
|
||||
IF (lineIntersects [[(_Pos0) , (_Pos1), (_Pos2)], [(_Pos0) - (sin (windDir+180)) * 15, (_Pos1) - (cos (windDir+180)) * 15, (_Pos2)]]) THEN {_Ort=_Ort+1};
|
||||
if (_Ort>3) then {_windrAA=99.99;_windrBB=99.99};
|
||||
|
||||
// in Windrichtung
|
||||
_Ort=0;
|
||||
IF (lineIntersects [[(_Pos0) , (_Pos1), (_Pos2)], [(_Pos0) - (sin windDir) * 5, (_Pos1) - (cos windDir) * 5, (_Pos2)]]) THEN {_Ort=_Ort+1};
|
||||
IF (lineIntersects [[(_Pos0) , (_Pos1), (_Pos2)], [(_Pos0) - (sin (windDir-15)) * 5, (_Pos1) - (cos (windDir-15)) * 5, (_Pos2)]]) THEN {_Ort=_Ort+1};
|
||||
IF (lineIntersects [[(_Pos0) , (_Pos1), (_Pos2)], [(_Pos0) - (sin (windDir+15)) * 5, (_Pos1) - (cos (windDir+15)) * 5, (_Pos2)]]) THEN {_Ort=_Ort+1};
|
||||
//IF (lineIntersects [_OrtPLAYER, [_Pos0,_Pos1,_Pos2 + 10]]) THEN {_Ort=_Ort+1};
|
||||
IF (_Ort>2) THEN {_windrAA=99.99;_windrBB=99.99};
|
||||
|
||||
|
||||
|
||||
|
||||
//IF (vehicle _player != _player) THEN {_windrAA=0;_windrBB=0};
|
||||
IF (_player != vehicle _player) THEN {_windrAA=0;_windrBB=0};
|
||||
|
||||
IF (_windrAA == 99.99) then {
|
||||
AGM_Kestrel_wind_Head = 0;
|
||||
_windrAA= "0.00";
|
||||
_windrBB= "0.00";
|
||||
}ELSE{
|
||||
AGM_Kestrel_wind_Head=_windrAA;
|
||||
IF (_windrAA < 0) THEN {
|
||||
_windrAA= FORMAT["-%1",[_windrAA*-1, 1, 2] call CBA_fnc_FORMATNumber];
|
||||
}ELSE{
|
||||
_windrAA= FORMAT["%1",[_windrAA, 1, 2] call CBA_fnc_FORMATNumber];
|
||||
};
|
||||
IF (_windrBB < 0) THEN {
|
||||
_windrBB= FORMAT["-%1",[_windrBB*-1, 1, 2] call CBA_fnc_FORMATNumber];
|
||||
}ELSE{
|
||||
_windrBB= FORMAT["%1",[_windrBB, 1, 2] call CBA_fnc_FORMATNumber];
|
||||
};
|
||||
};
|
||||
|
||||
_ctrl2 ctrlSetText _windrAA;
|
||||
_ctrl3 ctrlSetText _windrBB;
|
||||
_ctrl4 ctrlSetText FORMAT["%1",round (direction _player)];
|
||||
_ctrl5 ctrlSetText FORMAT["%1", (round (AGM_Wind_currentTemperature * 10)) / 10];
|
||||
_ctrl6 ctrlsettextcolor [0,0,0,1-(sunOrMoon*sunOrMoon+(moonIntensity/5))];
|
||||
|
||||
IF (!("AGM_ItemKestrel" in items _player)) THEN {AGM_isKestrel = FALSE;};
|
||||
IF (
|
||||
underwater _player ||
|
||||
//{_player != vehicle _player} ||
|
||||
{cameraView == "GUNNER"} ||
|
||||
{!alive _player}
|
||||
) THEN {AGM_isKestrel = FALSE;};
|
||||
IF (!AGM_isKestrel) THEN {_sleep1 = 0.01;};
|
||||
|
||||
SLEEP _sleep1;
|
||||
};
|
||||
AGM_isKestrelWheel=False;
|
||||
_ctrl1 ctrlShow false;
|
||||
_ctrl2 ctrlShow false;
|
||||
_ctrl3 ctrlShow false;
|
||||
_ctrl4 ctrlShow false;
|
||||
_ctrl5 ctrlShow false;
|
||||
_ctrl6 ctrlShow false;
|
||||
*/
|
||||
|
@ -4,6 +4,13 @@
|
||||
GVAR(windHead) = 0;
|
||||
|
||||
[{
|
||||
|
||||
if (!GVAR(isKestrel) || {!("ACE_Kestrel" in items ACE_player)}) exitWith {
|
||||
call FUNC(closeKestrel);
|
||||
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
private ["_dlgKestrel", "_ctrlKestrel1", "_ctrlKestrel2", "_ctrlHUD1", "_ctrlHUD2", "_ctrlHUD3", "_ctrlHUD4"];
|
||||
|
||||
disableSerialization;
|
||||
@ -15,16 +22,106 @@ GVAR(windHead) = 0;
|
||||
_ctrlHUD3 = _dlgKestrel displayCtrl 14;
|
||||
_ctrlHUD4 = _dlgKestrel displayCtrl 15;
|
||||
|
||||
private ["_wheelState", "_wheelStateAdd"];
|
||||
private "_show";
|
||||
_show = cameraView != "GUNNER";
|
||||
|
||||
systemChat str diag_frameno;
|
||||
_ctrlKestrel1 ctrlShow _show;
|
||||
_ctrlKestrel2 ctrlShow _show;
|
||||
_ctrlHUD1 ctrlShow _show;
|
||||
_ctrlHUD2 ctrlShow _show;
|
||||
_ctrlHUD3 ctrlShow _show;
|
||||
_ctrlHUD4 ctrlShow _show;
|
||||
|
||||
if !(_show) exitWith {};
|
||||
|
||||
private ["_position", "_directon", "_windC", "_windD", "_windR", "_windB", "_windA"];
|
||||
|
||||
if (!GVAR(isKestrel) || {!("ACE_Kestrel" in items ACE_player)}) exitWith {
|
||||
call FUNC(closeKestrel);
|
||||
_position = eyePos ACE_player;
|
||||
_directon = direction ACE_player;
|
||||
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
_windC = sqrt ((wind select 0) ^ 2 + (wind select 1) ^ 2);
|
||||
_windD = (wind select 0) atan2 (wind select 1);
|
||||
|
||||
_windR = _directon - _windD;
|
||||
|
||||
if (_windR < 0) then {
|
||||
_windR = _windR + 360;
|
||||
};
|
||||
|
||||
_windB = _windC * sin _windR;
|
||||
_windA = sqrt (_windC ^ 2 - _windB ^ 2);
|
||||
|
||||
if (_windR < 90) then {
|
||||
_windA = _windA - 2 * _windA;
|
||||
};
|
||||
|
||||
if (_windR > 270) then {
|
||||
_windA = _windA - 2 * _windA;
|
||||
};
|
||||
|
||||
// in building
|
||||
_intersects = 0;
|
||||
if (lineIntersects [_position, _position vectorAdd [0, 0, 15]]) then {_intersects = _intersects + 1};
|
||||
|
||||
if (lineIntersects [_position, _position vectorAdd [- 15 * sin windDir, - 15 * cos windDir, 0]]) then {_intersects = _intersects + 1};
|
||||
if (lineIntersects [_position, _position vectorAdd [- 15 * sin (windDir - 90), - 15 * cos (windDir - 90), 0]]) then {_intersects = _intersects + 1};
|
||||
if (lineIntersects [_position, _position vectorAdd [- 15 * sin (windDir + 90), - 15 * cos (windDir + 90), 0]]) then {_intersects = _intersects + 1};
|
||||
if (lineIntersects [_position, _position vectorAdd [- 15 * sin (windDir + 180), - 15 * cos (windDir + 180), 0]]) then {_intersects = _intersects + 1};
|
||||
|
||||
if (_intersects > 3) then {
|
||||
_windA = 99.99;
|
||||
_windB = 99.99;
|
||||
};
|
||||
|
||||
// in wind direction
|
||||
_intersects = 0;
|
||||
if (lineIntersects [_position, _position vectorAdd [- 5 * sin windDir, - 5 * cos windDir, 0]]) then {_intersects = _intersects + 1};
|
||||
if (lineIntersects [_position, _position vectorAdd [- 5 * sin (windDir - 15), - 5 * cos (windDir - 15), 0]]) then {_intersects = _intersects + 1};
|
||||
if (lineIntersects [_position, _position vectorAdd [- 5 * sin (windDir + 15), - 5 * cos (windDir + 15), 0]]) then {_intersects = _intersects + 1};
|
||||
|
||||
if (_intersects > 2) then {
|
||||
_windA = 99.99;
|
||||
_windB = 99.99;
|
||||
};
|
||||
|
||||
if (ACE_player != vehicle ACE_player) then {
|
||||
_windA = 99.99;
|
||||
_windB = 99.99;
|
||||
};
|
||||
|
||||
if (_windA == 99.99) then {
|
||||
|
||||
GVAR(windHead) = 0;
|
||||
|
||||
_windA = "0.00";
|
||||
_windB = "0.00";
|
||||
|
||||
} else {
|
||||
|
||||
GVAR(windHead) = _windA;
|
||||
|
||||
if (_windA < 0) then {
|
||||
_windA = format ["-%1", [-1 * _windA, 1, 2] call CBA_fnc_formatNumber];
|
||||
} else {
|
||||
_windA = format [ "%1", [ _windA, 1, 2] call CBA_fnc_formatNumber];
|
||||
};
|
||||
|
||||
if (_windB < 0) then {
|
||||
_windB = format ["-%1", [-1 * _windB, 1, 2] call CBA_fnc_formatNumber];
|
||||
} else {
|
||||
_windB = format [ "%1", [ _windB, 1, 2] call CBA_fnc_formatNumber];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
_ctrlHUD1 ctrlSetText _windA;
|
||||
_ctrlHUD2 ctrlSetText _windB;
|
||||
_ctrlHUD3 ctrlSetText str round _directon;
|
||||
_ctrlHUD4 ctrlSetText str ((round (0 * 10)) / 10);
|
||||
|
||||
private "_brightness";
|
||||
_brightness = call EFUNC(common,ambientBrightness);
|
||||
|
||||
_ctrlKestrel2 ctrlsettextcolor [0, 0, 0, 1 - _brightness];
|
||||
|
||||
}, 0.01, _this select 0] call CBA_fnc_addPerFrameHandler;
|
||||
|
@ -5,11 +5,18 @@ GVAR(windHead) = 0;
|
||||
GVAR(wheelState) = 1;
|
||||
|
||||
[{
|
||||
private ["_display", "_control"];
|
||||
|
||||
if (!GVAR(isKestrelWheel)) exitWith {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
private ["_dlgKestrelWheel", "_ctrlKestrelWheel"];
|
||||
|
||||
disableSerialization;
|
||||
_display = _this select 0;
|
||||
_control = _display displayCtrl 1;
|
||||
_dlgKestrelWheel = _this select 0;
|
||||
_ctrlKestrelWheel = _dlgKestrelWheel displayCtrl 1;
|
||||
|
||||
_ctrlKestrelWheel ctrlShow (cameraView != "GUNNER");
|
||||
|
||||
private ["_wheelState", "_wheelStateAdd"];
|
||||
|
||||
@ -28,13 +35,9 @@ GVAR(wheelState) = 1;
|
||||
private "_brightness";
|
||||
_brightness = call EFUNC(common,ambientBrightness);
|
||||
|
||||
_control ctrlSetText format [QUOTE(PATHTOF(data\kestrel_%1.paa)), _rad1];
|
||||
_control ctrlSetTextColor [_brightness, _brightness, _brightness, 1];
|
||||
_ctrlKestrelWheel ctrlSetText format [QUOTE(PATHTOF(data\kestrel_%1.paa)), _wheelState];
|
||||
_ctrlKestrelWheel ctrlSetTextColor [_brightness, _brightness, _brightness, 1];
|
||||
|
||||
};
|
||||
|
||||
if (!GVAR(isKestrelWheel)) exitWith {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
}, 0.01, _this select 0] call CBA_fnc_addPerFrameHandler;
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user