mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Show beaufort dots on wind display -for color Blind
Show dots on the wind display so color blind can still determine wind level Replace PR #1308
This commit is contained in:
parent
175624620c
commit
066976766f
@ -28,7 +28,7 @@ if (currentWeapon ACE_player != primaryWeapon ACE_player) exitWith { false };
|
||||
|
||||
2 cutText ["", "PLAIN"];
|
||||
EGVAR(weather,WindInfo) = false;
|
||||
0 cutText ["", "PLAIN"];
|
||||
(["RscWindIntuitive"] call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
|
||||
GVAR(Protractor) = true;
|
||||
|
||||
[{
|
||||
|
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
addons/weather/UI/wind_arrow_ca.paa
Normal file
BIN
addons/weather/UI/wind_arrow_ca.paa
Normal file
Binary file not shown.
BIN
addons/weather/UI/wind_dot_ca.paa
Normal file
BIN
addons/weather/UI/wind_dot_ca.paa
Normal file
Binary file not shown.
@ -14,6 +14,7 @@ GVAR(ACE_rain) = rain;
|
||||
"ACE_RAIN_PARAMS" addPublicVariableEventHandler { GVAR(rain_period_start_time) = ACE_time; };
|
||||
"ACE_MISC_PARAMS" addPublicVariableEventHandler {
|
||||
if (!isServer) then {
|
||||
TRACE_1("MISC PARAMS PVEH",ACE_MISC_PARAMS);
|
||||
if (GVAR(syncMisc)) then {
|
||||
30 setLightnings (ACE_MISC_PARAMS select 0);
|
||||
30 setRainbow (ACE_MISC_PARAMS select 1);
|
||||
@ -27,10 +28,11 @@ GVAR(ACE_rain) = rain;
|
||||
};
|
||||
};
|
||||
|
||||
GVAR(WindInfo) = false;
|
||||
["ACE3 Common", QGVAR(WindInfoKey), localize LSTRING(WindInfoKey),
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
|
||||
// Statement
|
||||
[] call FUNC(displayWindInfo);
|
||||
@ -46,14 +48,14 @@ simulWeatherSync;
|
||||
["SettingsInitialized",{
|
||||
TRACE_1("SettingsInitialized",GVAR(syncRain));
|
||||
|
||||
//Create a 1 sec delay PFEH to update rain every frame:
|
||||
//Create a 0 sec delay PFEH to update rain every frame:
|
||||
if (GVAR(syncRain)) then {
|
||||
[{
|
||||
0 setRain GVAR(ACE_rain);
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
|
||||
//Create a 1 sec delay PFEH to update wind/rain/temp/humidity
|
||||
//Create a 1 sec delay PFEH to update wind/rain/temp/humidity:
|
||||
|
||||
//If we don't sync rain, set next time to infinity
|
||||
GVAR(nextUpdateRain) = if (GVAR(syncRain)) then {0} else {1e99};
|
||||
@ -63,11 +65,11 @@ simulWeatherSync;
|
||||
|
||||
[] call FUNC(updateWind); //Every 1 second
|
||||
|
||||
if (ACE_time > GVAR(nextUpdateRain)) then {
|
||||
if (ACE_time >= GVAR(nextUpdateRain)) then {
|
||||
[] call FUNC(updateRain); //Every 2 seconds
|
||||
GVAR(nextUpdateRain) = 2 + ACE_time;
|
||||
};
|
||||
if (ACE_time > GVAR(nextUpdateTempAndHumidity)) then {
|
||||
if (ACE_time >= GVAR(nextUpdateTempAndHumidity)) then {
|
||||
[] call FUNC(updateTemperature); //Every 20 seconds
|
||||
[] call FUNC(updateHumidity); //Every 20 seconds
|
||||
GVAR(nextUpdateTempAndHumidity) = 20 + ACE_time;
|
||||
|
@ -20,26 +20,31 @@
|
||||
|
||||
if (GVAR(WindInfo)) exitWith {
|
||||
GVAR(WindInfo) = false;
|
||||
0 cutText ["", "PLAIN"];
|
||||
(["RscWindIntuitive"] call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
|
||||
true
|
||||
};
|
||||
if (underwater ACE_player) exitWith { false };
|
||||
if (vehicle ACE_player != ACE_player) exitWith { false };
|
||||
|
||||
2 cutText ["", "PLAIN"];
|
||||
EGVAR(advanced_ballistics,Protractor) = false;
|
||||
1 cutText ["", "PLAIN"];
|
||||
GVAR(WindInfo) = true;
|
||||
|
||||
|
||||
TRACE_1("Starting Wind Info PFEH", GVAR(WindInfo));
|
||||
|
||||
[{
|
||||
if ((!GVAR(WindInfo)) || {underwater ACE_player} || {vehicle ACE_player != ACE_player}) exitWith {
|
||||
disableSerialization;
|
||||
params ["", "_pfID"];
|
||||
|
||||
if ((!GVAR(WindInfo)) || {!([ACE_player, ACE_player, []] call EFUNC(common,canInteractWith))}) exitWith {
|
||||
TRACE_1("Ending Wind Info PFEH", GVAR(WindInfo));
|
||||
GVAR(WindInfo) = false;
|
||||
0 cutText ["", "PLAIN"];
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
(["RscWindIntuitive"] call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
|
||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
private _windIndex = 12;
|
||||
private _windColor = [1, 1, 1, 1];
|
||||
//Keeps the display open:
|
||||
(["RscWindIntuitive"] call BIS_fnc_rscLayer) cutRsc ["RscWindIntuitive", "PLAIN", 1, false];
|
||||
|
||||
private _windSpeed = if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
|
||||
// With wind gradient
|
||||
[eyePos ACE_player, true, true, true] call FUNC(calculateWindSpeed);
|
||||
@ -48,34 +53,54 @@ GVAR(WindInfo) = true;
|
||||
[eyePos ACE_player, false, true, true] call FUNC(calculateWindSpeed);
|
||||
};
|
||||
|
||||
if (_windSpeed > 0.2) then {
|
||||
|
||||
private _playerDir = (ACE_player call CBA_fnc_headDir) select 0;
|
||||
private _windDir = (ACE_wind select 0) atan2 (ACE_wind select 1);
|
||||
_windIndex = round(((_playerDir - _windDir + 360) % 360) / 30);
|
||||
_windIndex = _windIndex % 12;
|
||||
};
|
||||
_windDir = 30 * (round(((_playerDir - _windDir + 360) % 360) / 30));
|
||||
|
||||
// Color Codes from https://en.wikipedia.org/wiki/Beaufort_scale#Modern_scale
|
||||
if (_windSpeed > 0.3) then { _windColor = [0.796, 1, 1, 1]; };
|
||||
if (_windSpeed > 1.5) then { _windColor = [0.596, 0.996, 0.796, 1]; };
|
||||
if (_windSpeed > 3.3) then { _windColor = [0.596, 0.996, 0.596, 1]; };
|
||||
if (_windSpeed > 5.4) then { _windColor = [0.6, 0.996, 0.4, 1]; };
|
||||
if (_windSpeed > 7.9) then { _windColor = [0.6, 0.996, 0.047, 1]; };
|
||||
if (_windSpeed > 10.7) then { _windColor = [0.8, 0.996, 0.059, 1]; };
|
||||
if (_windSpeed > 13.8) then { _windColor = [1, 0.996, 0.067, 1]; };
|
||||
if (_windSpeed > 17.1) then { _windColor = [1, 0.796, 0.051, 1]; };
|
||||
if (_windSpeed > 20.7) then { _windColor = [1, 0.596, 0.039, 1]; };
|
||||
if (_windSpeed > 24.4) then { _windColor = [1, 0.404, 0.031, 1]; };
|
||||
if (_windSpeed > 28.4) then { _windColor = [1, 0.22, 0.027, 1]; };
|
||||
if (_windSpeed > 32.6) then { _windColor = [1, 0.078, 0.027, 1]; };
|
||||
private _beaufortNumber = 0;
|
||||
private _windColor = [1, 1, 1, 1];
|
||||
if (_windSpeed > 0.3) then { _windColor = [0.796, 1, 1, 1]; _beaufortNumber = 1; };
|
||||
if (_windSpeed > 1.5) then { _windColor = [0.596, 0.996, 0.796, 1]; _beaufortNumber = 2; };
|
||||
if (_windSpeed > 3.3) then { _windColor = [0.596, 0.996, 0.596, 1]; _beaufortNumber = 3; };
|
||||
if (_windSpeed > 5.4) then { _windColor = [0.6, 0.996, 0.4, 1]; _beaufortNumber = 4; };
|
||||
if (_windSpeed > 7.9) then { _windColor = [0.6, 0.996, 0.047, 1]; _beaufortNumber = 5; };
|
||||
if (_windSpeed > 10.7) then { _windColor = [0.8, 0.996, 0.059, 1]; _beaufortNumber = 6; };
|
||||
if (_windSpeed > 13.8) then { _windColor = [1, 0.996, 0.067, 1]; _beaufortNumber = 7; };
|
||||
if (_windSpeed > 17.1) then { _windColor = [1, 0.796, 0.051, 1]; _beaufortNumber = 8; };
|
||||
if (_windSpeed > 20.7) then { _windColor = [1, 0.596, 0.039, 1]; _beaufortNumber = 9; };
|
||||
if (_windSpeed > 24.4) then { _windColor = [1, 0.404, 0.031, 1]; _beaufortNumber = 10; };
|
||||
if (_windSpeed > 28.4) then { _windColor = [1, 0.22, 0.027, 1]; _beaufortNumber = 11; };
|
||||
if (_windSpeed > 32.6) then { _windColor = [1, 0.078, 0.027, 1]; _beaufortNumber = 12; };
|
||||
|
||||
0 cutRsc ["RscWindIntuitive", "PLAIN", 1, false];
|
||||
|
||||
__ctrl ctrlSetScale 0.75;
|
||||
TRACE_3("update display",_beaufortNumber,_windDir,_windSpeed);
|
||||
__ctrl ctrlSetTextColor _windColor;
|
||||
if (_beaufortNumber > 0) then {
|
||||
__ctrl ctrlSetText QUOTE(PATHTOF(UI\wind_arrow_ca.paa));
|
||||
__ctrl ctrlSetAngle [_windDir, 0.5, 0.5];
|
||||
} else {
|
||||
__ctrl ctrlSetText QUOTE(PATHTOF(UI\wind_noneCircle_ca.paa));
|
||||
};
|
||||
__ctrl ctrlCommit 0;
|
||||
|
||||
__ctrl ctrlSetText format[QUOTE(PATHTOF(UI\wind%1.paa)), _windIndex];
|
||||
__ctrl ctrlSetTextColor _windColor;
|
||||
//Update the beaufort balls:
|
||||
(ctrlPosition __ctrl) params ["_ctrlX", "_ctrlY", "_ctrlWidth", "_ctrlHeight"];
|
||||
private _centerX = _ctrlX + _ctrlWidth / 2;
|
||||
private _centerY = _ctrlY + _ctrlHeight / 2;
|
||||
private _ballHeight = _ctrlHeight / 17;
|
||||
private _ballWidth = _ballHeight * 3/4;
|
||||
|
||||
for "_index" from 0 to (_beaufortNumber - 1) do {
|
||||
private _ball = __dsp ctrlCreate ["RscPicture", _index];
|
||||
_ball ctrlSetText QUOTE(PATHTOF(UI\wind_dot_ca.paa));
|
||||
_ball ctrlSetTextColor [1,1,1,1];
|
||||
private _ballCenterX = _centerX - (_ballWidth / 2) + ((sin _windDir) * 0.013333) * (_index - 4.9) + ((cos _windDir) * 0.0125);
|
||||
private _ballCenterY = _centerY - (_ballHeight / 2) - ((1 * cos _windDir) * 4/3*0.013333) * (_index - 4.9) + ((sin _windDir) * 0.0125);
|
||||
_ball ctrlSetPosition [_ballCenterX, _ballCenterY, _ballWidth, _ballHeight];
|
||||
_ball ctrlCommit 0;
|
||||
};
|
||||
|
||||
}, 0.5, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user