From d8b96066e60b660d61fe7df3881d08dd442d6542 Mon Sep 17 00:00:00 2001 From: ruPaladin Date: Sun, 19 Apr 2015 11:01:41 +0300 Subject: [PATCH 01/20] Rus translation (nametags) --- addons/nametags/stringtable.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/nametags/stringtable.xml b/addons/nametags/stringtable.xml index 77e10b6ee9e..e224ce61e4f 100644 --- a/addons/nametags/stringtable.xml +++ b/addons/nametags/stringtable.xml @@ -22,7 +22,7 @@ Zobrazit jména hráčů Mostrar nomes de jogadores Mostra i nomi dei giocatori - Показать имена игроков + Показывать имена игроков (включить имена) Show player name only on cursor (requires player names) @@ -34,7 +34,7 @@ Mostra i nomi solo se puntati (richiede mostra nomi abilitato) Mostrar nome de jogador somente no cursor (requer nome de jogadores) Játékosok nevének mutatása csak a kurzoron (a nevek mutatása szükséges) - Показать имена игроков только под курсором (требует имен игроков) + Показать имена игроков только под курсором (при включенных именах) Show player name only on keypress (requires player names) @@ -44,7 +44,7 @@ Zobrazit jména hráčů jen na klávesu (vyžaduje jména hráčů) Pokaż imiona graczy tylko po przytrzymaniu klawisza (wymagana opcja Pokaż imiona graczy) Játékosnevek mutatása csak gombnyomásra (a nevek mutatása szükséges) - Показать имена игроков только по нажатию клавиши (требует имен игроков) + Показать имена игроков только по нажатию клавиши (при включенных именах) Mostra i nomi solo se si preme il tasto (richiede mostra nomi abilitato) @@ -57,7 +57,7 @@ Mostra i gradi (richiede mostra nomi abilitato) Mostrar patente de jogadores (requer nome de jogadores) Játékosok rendfokozatának mutatása (a nevek mutatása szükséges) - Показывать звания игроков (требует имен игроков) + Показывать звания игроков (при вкл. именах) Show vehicle crew info @@ -74,7 +74,7 @@ Show name tags for AI units Zeige Namen für KI Einheiten Mostrar etiquetas de nombre para unidades IA - Показывать именые метки ИИ + Показывать имена ботов Zobrazit jména AI Wyświetl imiona jednostek AI Afficher les noms des IA @@ -85,7 +85,7 @@ Show SoundWaves (requires player names) Zeigen Schallwellen (benötigt Spielernamen) Mostrar onda sonora (requiere Mostrar nombres de jugadores) - Показывать звуковые волны (требует имен игроков) + Индикатор разговора (при вкл. именах) Zobrazit SoundWaves (vyžaduje jména hráčů) Pokaż fale dźwiękowe (wymagana opcja Pokaż imiona graczy) Afficher "qui parle" (si noms affichés) From 20740679cca12701f22aea15cae0b5ce7ccec91f Mon Sep 17 00:00:00 2001 From: ulteq Date: Sun, 19 Apr 2015 17:40:49 +0200 Subject: [PATCH 02/20] Fixed inconsistent 'workingMemory' initialization --- addons/atragmx/functions/fnc_change_gun.sqf | 26 ++++++++++++------- .../atragmx/functions/fnc_create_dialog.sqf | 2 +- .../atragmx/functions/fnc_cycle_gun_list.sqf | 2 +- .../functions/fnc_restore_user_data.sqf | 2 +- .../atragmx/functions/fnc_toggle_gun_list.sqf | 2 +- 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/addons/atragmx/functions/fnc_change_gun.sqf b/addons/atragmx/functions/fnc_change_gun.sqf index a401a849e3f..7c5abac47e8 100644 --- a/addons/atragmx/functions/fnc_change_gun.sqf +++ b/addons/atragmx/functions/fnc_change_gun.sqf @@ -4,7 +4,8 @@ * * Arguments: * gunID - * update solution + * restore workingMemory from gunList + * update display * * Return Value: * Nothing @@ -16,23 +17,30 @@ */ #include "script_component.hpp" -private ["_gunID", "_updateSolution"]; -_gunID = _this select 0; -_updateSolution = _this select 1; +private ["_gunID", "_restoreMemory", "_updateDisplay"]; +_gunID = _this select 0; +_restoreMemory = _this select 1; +_updateDisplay = _this select 2; if (_gunID < 0 || _gunID > (count GVAR(gunList)) - 1) exitWith {}; -GVAR(workingMemory) = +(GVAR(gunList) select _gunID); +if (_restoreMemory) then { + GVAR(workingMemory) = +(GVAR(gunList) select _gunID); +}; GVAR(currentGun) = _gunID; -lbSetCurSel [6000, GVAR(currentGun)]; +if (_updateDisplay) then { + lbSetCurSel [6000, GVAR(currentGun)]; +}; GVAR(currentScopeUnit) = 0 max (GVAR(workingMemory) select 6) min 3; GVAR(currentScopeClickUnit) = 0 max (GVAR(workingMemory) select 7) min 2; GVAR(currentScopeClickNumber) = 1 max (GVAR(workingMemory) select 8) min 10; -[] call FUNC(update_gun); -[] call FUNC(update_gun_ammo_data); +if (_updateDisplay) then { + [] call FUNC(update_gun); + [] call FUNC(update_gun_ammo_data); +}; GVAR(elevationOutput) set [GVAR(currentTarget), 0]; GVAR(windage1Output) set [GVAR(currentTarget), 0]; @@ -41,6 +49,6 @@ GVAR(leadOutput) set [GVAR(currentTarget), 0]; GVAR(tofOutput) set [GVAR(currentTarget), 0]; GVAR(velocityOutput) set [GVAR(currentTarget), 0]; -if (_updateSolution) then { +if (_updateDisplay) then { [] call FUNC(calculate_target_solution); }; diff --git a/addons/atragmx/functions/fnc_create_dialog.sqf b/addons/atragmx/functions/fnc_create_dialog.sqf index 1646b0ec25a..b4d51bd8940 100644 --- a/addons/atragmx/functions/fnc_create_dialog.sqf +++ b/addons/atragmx/functions/fnc_create_dialog.sqf @@ -40,7 +40,7 @@ GVAR(showTargetRangeAssist) call FUNC(show_target_range_assist); GVAR(showTargetSpeedAssist) call FUNC(show_target_speed_assist); GVAR(showTargetSpeedAssistTimer) call FUNC(show_target_speed_assist_timer); -[GVAR(currentGun), false] call FUNC(change_gun); +[GVAR(currentGun), false, true] call FUNC(change_gun); { lbAdd [6000, _x select 0]; diff --git a/addons/atragmx/functions/fnc_cycle_gun_list.sqf b/addons/atragmx/functions/fnc_cycle_gun_list.sqf index 75f54c79fb0..3796bb78e62 100644 --- a/addons/atragmx/functions/fnc_cycle_gun_list.sqf +++ b/addons/atragmx/functions/fnc_cycle_gun_list.sqf @@ -17,4 +17,4 @@ if (!(GVAR(showMainPage) || GVAR(showGunList))) exitWith {}; -[(GVAR(currentGun) + (count GVAR(gunList)) + _this) % (count GVAR(gunList)), true] call FUNC(change_gun); +[(GVAR(currentGun) + (count GVAR(gunList)) + _this) % (count GVAR(gunList)), true, true] call FUNC(change_gun); diff --git a/addons/atragmx/functions/fnc_restore_user_data.sqf b/addons/atragmx/functions/fnc_restore_user_data.sqf index 54d1f3cd2b8..55b73cc5b50 100644 --- a/addons/atragmx/functions/fnc_restore_user_data.sqf +++ b/addons/atragmx/functions/fnc_restore_user_data.sqf @@ -16,7 +16,7 @@ #include "script_component.hpp" GVAR(currentUnit) = 0 max (profileNamespace getVariable ["ACE_ATragMX_currentUnit", 2]) min 2; -GVAR(currentGun) = 0 max (profileNamespace getVariable ["ACE_ATragMX_currentGun", 0]); +[(profileNamespace getVariable ["ACE_ATragMX_currentGun", 0]), true, false] call FUNC(change_gun); GVAR(currentTarget) = 0 max (profileNamespace getVariable ["ACE_ATragMX_currentTarget", 0]) min 3; GVAR(currentScopeUnit) = 0 max (profileNamespace getVariable ["ACE_ATragMX_currentScopeUnit", 0]) min 3; diff --git a/addons/atragmx/functions/fnc_toggle_gun_list.sqf b/addons/atragmx/functions/fnc_toggle_gun_list.sqf index 714e6e848d9..1cc1f9338bb 100644 --- a/addons/atragmx/functions/fnc_toggle_gun_list.sqf +++ b/addons/atragmx/functions/fnc_toggle_gun_list.sqf @@ -20,7 +20,7 @@ if (ctrlVisible 6000) then { true call FUNC(show_main_page); if (_this) then { - [lbCurSel 6000, true] call FUNC(change_gun); + [lbCurSel 6000, true, true] call FUNC(change_gun); }; } else { false call FUNC(show_main_page); From a83925dd2dd12215539d6e7cc7cbde0b67268aa0 Mon Sep 17 00:00:00 2001 From: Tachii Date: Sun, 19 Apr 2015 18:43:05 +0300 Subject: [PATCH 03/20] Update stringtable.xml --- addons/medical/stringtable.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index 9645aa22895..9f862b9b3b5 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -477,7 +477,7 @@ Minor Gering Menor - Легкие ранения + Несрочная помощь Normalny Léger Minimální @@ -487,7 +487,7 @@ Delayed Retrasado - Средние ранения + Срочная помощь Opóźniony Différé Verzögert @@ -498,7 +498,7 @@ Immediate Inmediato - Тяжелые ранения + Неотложная помощь Natychmiastowy Urgence Immédiate Sofort @@ -1610,7 +1610,7 @@ Pain Effect Type Schmerzeffekt-Typ Rodzaj efektu bólu - Эффект боли + Тип эффекта боли Pain Effect Type Tipo de efecto de dolor Type d'effet de douleur From 596fadcba07b41cd95df71280dcd0444e3fc625d Mon Sep 17 00:00:00 2001 From: Tachii Date: Sun, 19 Apr 2015 18:51:35 +0300 Subject: [PATCH 04/20] ru translations fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Не стоит додумывать правильные значения или то, как вы думаете это должно интерпертироваться. Нужно переводить то, что написано. Как пример Very Light Wounds - это не царапины, это очень лёгкие ранения. Царапины - это scratches --- addons/medical/stringtable.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index 9f862b9b3b5..053115f5d7e 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -1529,7 +1529,7 @@ Heavily wounded Schwer verwundet: Ciężko ranny - Сильные ранения + Сильно ранен Gravemente ferito Gravemente herido Lourdement blessé @@ -1538,7 +1538,7 @@ Lightly wounded Leicht verwundet: Lekko ranny - Легкие ранения + Легко ранен Leggermente ferito Levemente herido Légèrement blessé @@ -1547,7 +1547,7 @@ Very lightly wounded Sehr leicht verwundet: B. lekko ranny - Царапины + Очень легко ранен Ferito lievemente Muy levemente herido Très légèrement blessé From a7d913b80e1d81b9a4714d82aad283f717b8be35 Mon Sep 17 00:00:00 2001 From: Tachii Date: Sun, 19 Apr 2015 18:54:47 +0300 Subject: [PATCH 05/20] Update stringtable.xml --- addons/medical/stringtable.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index 053115f5d7e..0287478bc5c 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -1529,7 +1529,7 @@ Heavily wounded Schwer verwundet: Ciężko ranny - Сильно ранен + Тяжело ранен Gravemente ferito Gravemente herido Lourdement blessé From aad8d6b7850eab3c3f5ebe1f11e7eb19c465f40e Mon Sep 17 00:00:00 2001 From: jaynus Date: Sun, 19 Apr 2015 09:04:42 -0700 Subject: [PATCH 06/20] Fixed: max litter scalar array, have internal values. --- addons/medical/ACE_Settings.hpp | 6 +++++- addons/medical/functions/fnc_handleCreateLitter.sqf | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/addons/medical/ACE_Settings.hpp b/addons/medical/ACE_Settings.hpp index b42d5bc5a60..6ab24379c5e 100644 --- a/addons/medical/ACE_Settings.hpp +++ b/addons/medical/ACE_Settings.hpp @@ -79,7 +79,11 @@ class ACE_Settings { displayName = "$STR_ACE_Medical_litterSimulationDetail"; description = "$STR_ACE_Medical_litterSimulationDetail_Desc"; typeName = "SCALAR"; - value = 500; + + value = 3; + values[] = {"Off", "Low", "Medium", "High", "Ultra"}; + _values[] = { 0, 50, 100, 1000, 5000 }; + isClientSettable = 1; }; class GVAR(litterCleanUpDelay) { diff --git a/addons/medical/functions/fnc_handleCreateLitter.sqf b/addons/medical/functions/fnc_handleCreateLitter.sqf index aca47250cdc..ee7e591cd12 100644 --- a/addons/medical/functions/fnc_handleCreateLitter.sqf +++ b/addons/medical/functions/fnc_handleCreateLitter.sqf @@ -4,7 +4,7 @@ if(!hasInterface) exitWith { false }; PARAMS_3(_litterClass,_position,_direction); -private["_litterObject"]; +private["_litterObject", "_maxLitterCount"]; if (isNil QGVAR(allCreatedLitter)) then { GVAR(allCreatedLitter) = []; @@ -14,7 +14,8 @@ if (isNil QGVAR(allCreatedLitter)) then { _litterObject = _litterClass createVehicleLocal _position; _litterObject setDir _direction; -if((count GVAR(allCreatedLitter)) > GVAR(litterSimulationDetail) ) then { +_maxLitterCount = getArray (configFile >> "ACE_Settings" >> QGVAR(litterSimulationDetail) >> "_values") select GVAR(litterSimulationDetail); +if((count GVAR(allCreatedLitter)) > _maxLitterCount ) then { // gank the first litter object, and spawn ours. private["_oldLitter"]; _oldLitter = GVAR(allCreatedLitter) deleteAt 0; From 60cab963bfdee0e020c5c1adb3d77178aa2279b6 Mon Sep 17 00:00:00 2001 From: Tachii Date: Sun, 19 Apr 2015 23:00:51 +0300 Subject: [PATCH 07/20] Update stringtable.xml --- addons/medical/stringtable.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index 0287478bc5c..bf0bde22f62 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -1529,7 +1529,7 @@ Heavily wounded Schwer verwundet: Ciężko ranny - Тяжело ранен + Тяжелые ранения Gravemente ferito Gravemente herido Lourdement blessé @@ -1538,7 +1538,7 @@ Lightly wounded Leicht verwundet: Lekko ranny - Легко ранен + Легкие раненя Leggermente ferito Levemente herido Légèrement blessé From 5038674aefb212f72ea3d566ab9d253e31732e1a Mon Sep 17 00:00:00 2001 From: Tachii Date: Sun, 19 Apr 2015 23:01:38 +0300 Subject: [PATCH 08/20] Update stringtable.xml --- addons/medical/stringtable.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index bf0bde22f62..cf6e4515b3d 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -1538,7 +1538,7 @@ Lightly wounded Leicht verwundet: Lekko ranny - Легкие раненя + Легкие ранения Leggermente ferito Levemente herido Légèrement blessé @@ -1547,7 +1547,7 @@ Very lightly wounded Sehr leicht verwundet: B. lekko ranny - Очень легко ранен + Незначительные ранения Ferito lievemente Muy levemente herido Très légèrement blessé From f7d35d5593c1bc728c359e3e2a2c0e79ccaba815 Mon Sep 17 00:00:00 2001 From: ulteq Date: Sun, 19 Apr 2015 22:30:13 +0200 Subject: [PATCH 09/20] =?UTF-8?q?The=20ATragMX=20now=20also=20accounts=20f?= =?UTF-8?q?or=20vertical=20coriolis=20drift=20(E=C3=B6tv=C3=B6s=20effect)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../functions/fnc_calculate_range_card.sqf | 2 +- .../fnc_calculate_scope_base_angle.sqf | 2 +- .../functions/fnc_calculate_solution.sqf | 35 +++++++++++++------ .../fnc_calculate_target_solution.sqf | 2 +- .../functions/fnc_update_zero_range.sqf | 2 +- 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/addons/atragmx/functions/fnc_calculate_range_card.sqf b/addons/atragmx/functions/fnc_calculate_range_card.sqf index c11cf905505..f3f27f7d3e6 100644 --- a/addons/atragmx/functions/fnc_calculate_range_card.sqf +++ b/addons/atragmx/functions/fnc_calculate_range_card.sqf @@ -77,4 +77,4 @@ GVAR(rangeCardData) = []; private ["_result"]; _result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, - [_windSpeed1, _windSpeed2], _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, true, _stabilityFactor, _twistDirection, _latitude] call FUNC(calculate_solution); + [_windSpeed1, _windSpeed2], _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, true, _stabilityFactor, _twistDirection, _latitude, _directionOfFire] call FUNC(calculate_solution); diff --git a/addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf b/addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf index 76c54f63a98..fbd191bb79c 100644 --- a/addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf +++ b/addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf @@ -35,6 +35,6 @@ _barometricPressure = 1013.25; _relativeHumidity = 0; private ["_result"]; -_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, [0, 0], 0, 0, 0, _zeroRange, _airFriction, 1, "ICAO", false, 1.5, 0, 0] call FUNC(calculate_solution); +_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, [0, 0], 0, 0, 0, _zeroRange, _airFriction, 1, "ICAO", false, 1.5, 0, 0, 0] call FUNC(calculate_solution); _scopeBaseAngle + (_result select 0) / 60 diff --git a/addons/atragmx/functions/fnc_calculate_solution.sqf b/addons/atragmx/functions/fnc_calculate_solution.sqf index 2d70e8dca13..f90b299ce9a 100644 --- a/addons/atragmx/functions/fnc_calculate_solution.sqf +++ b/addons/atragmx/functions/fnc_calculate_solution.sqf @@ -43,7 +43,7 @@ */ #include "script_component.hpp" -private ["_scopeBaseAngle", "_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_temperature", "_barometricPressure", "_relativeHumidity", "_simSteps", "_windSpeed1", "_windSpeed2", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange", "_drag", "_bc", "_dragModel", "_atmosphereModel", "_storeRangeCardData", "_stabilityFactor", "_twistDirection", "_latitude"]; +private ["_scopeBaseAngle", "_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_temperature", "_barometricPressure", "_relativeHumidity", "_simSteps", "_windSpeed1", "_windSpeed2", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange", "_drag", "_bc", "_dragModel", "_atmosphereModel", "_storeRangeCardData", "_stabilityFactor", "_twistDirection", "_latitude", "_directionOfFire"]; _scopeBaseAngle = _this select 0; _bulletMass = _this select 1; _boreHeight = _this select 2; @@ -66,6 +66,7 @@ _storeRangeCardData = _this select 17; _stabilityFactor = _this select 18; _twistDirection = _this select 19; _latitude = _this select 20; +_directionOfFire = _this select 21; private ["_bulletPos", "_bulletVelocity", "_bulletAccel", "_bulletSpeed", "_gravity", "_deltaT"]; _bulletPos = [0, 0, 0]; @@ -114,6 +115,12 @@ _speedTotal = 0; _stepsTotal = 0; _speedAverage = 0; +private ["_eoetvoesMultiplier"]; +_eoetvoesMultiplier = 0; +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,EoetvoesEnabled), false]) then { + _eoetvoesMultiplier = 2 * (0.0000729 * _muzzleVelocity / -9.80665) * cos(_latitude) * sin(_directionOfFire); +}; + _TOF = 0; _bulletPos set [0, 0]; @@ -169,16 +176,19 @@ while {_TOF < 15 && (_bulletPos select 1) < _targetRange} do { _kineticEnergy = 0.5 * (_bulletMass / 1000 * (_bulletSpeed ^ 2)); _kineticEnergy = _kineticEnergy * 0.737562149; - if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false])) then { - if ((_bulletPos select 1) > 0) then { + if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (_bulletPos select 1) > 0) then { + if (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false]) then { _horizontalDeflection = 0.0000729 * ((_bulletPos select 1) ^ 2) * sin(_latitude) / _speedAverage; _horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1)); _windage1 = _windage1 + _horizontalCoriolis; _windage2 = _windage2 + _horizontalCoriolis; }; - }; - if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then { - if ((_bulletPos select 1) > 0) then { + if (missionNamespace getVariable [QEGVAR(advanced_ballistics,EoetvoesEnabled), false]) then { + _verticalDeflection = (_bulletPos select 2) * _eoetvoesMultiplier; + _verticalCoriolis = - atan(_verticalDeflection / (_bulletPos select 1)); + _elevation = _elevation + _verticalCoriolis; + }; + if (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false]) then { _spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83; _spinDrift = - atan(_spinDeflection / (_bulletPos select 1)); _windage1 = _windage1 + _spinDrift; @@ -206,16 +216,19 @@ if (_targetRange != 0) then { _kineticEnergy = 0.5 * (_bulletMass / 1000 * (_bulletSpeed ^ 2)); _kineticEnergy = _kineticEnergy * 0.737562149; -if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false])) then { - if ((_bulletPos select 1) > 0) then { +if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (_bulletPos select 1) > 0) then { + if (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false]) then { _horizontalDeflection = 0.0000729 * ((_bulletPos select 1) ^ 2) * sin(_latitude) / _speedAverage; _horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1)); _windage1 = _windage1 + _horizontalCoriolis; _windage2 = _windage2 + _horizontalCoriolis; }; -}; -if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then { - if ((_bulletPos select 1) > 0) then { + if (missionNamespace getVariable [QEGVAR(advanced_ballistics,EoetvoesEnabled), false]) then { + _verticalDeflection = (_bulletPos select 2) * _eoetvoesMultiplier; + _verticalCoriolis = - atan(_verticalDeflection / (_bulletPos select 1)); + _elevation = _elevation + _verticalCoriolis; + }; + if (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false]) then { _spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83; _spinDrift = - atan(_spinDeflection / (_bulletPos select 1)); _windage1 = _windage1 + _spinDrift; diff --git a/addons/atragmx/functions/fnc_calculate_target_solution.sqf b/addons/atragmx/functions/fnc_calculate_target_solution.sqf index c8a36834988..641551fca12 100644 --- a/addons/atragmx/functions/fnc_calculate_target_solution.sqf +++ b/addons/atragmx/functions/fnc_calculate_target_solution.sqf @@ -72,7 +72,7 @@ _targetRange = GVAR(targetRange) select GVAR(currentTarget); private ["_result"]; _result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, - [_windSpeed1, _windSpeed2], _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, false, _stabilityFactor, _twistDirection, _latitude] call FUNC(calculate_solution); + [_windSpeed1, _windSpeed2], _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, false, _stabilityFactor, _twistDirection, _latitude, _directionOfFire] call FUNC(calculate_solution); GVAR(elevationOutput) set [GVAR(currentTarget), _result select 0]; GVAR(windage1Output) set [GVAR(currentTarget), (_result select 1) select 0]; diff --git a/addons/atragmx/functions/fnc_update_zero_range.sqf b/addons/atragmx/functions/fnc_update_zero_range.sqf index a5cab3755ed..299c321d330 100644 --- a/addons/atragmx/functions/fnc_update_zero_range.sqf +++ b/addons/atragmx/functions/fnc_update_zero_range.sqf @@ -44,7 +44,7 @@ _barometricPressure = GVAR(barometricPressure); _relativeHumidity = GVAR(relativeHumidity); private ["_result"]; -_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, [0, 0], 0, 0, 0, _zeroRange, _bc, _dragModel, _atmosphereModel, false, 1.5, 0, 0] call FUNC(calculate_solution); +_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, [0, 0], 0, 0, 0, _zeroRange, _bc, _dragModel, _atmosphereModel, false, 1.5, 0, 0, 0] call FUNC(calculate_solution); GVAR(workingMemory) set [2, _zeroRange]; GVAR(workingMemory) set [3, _scopeBaseAngle + (_result select 0) / 60]; From 6c8b58789024df653d90e4502cb895c48114f2a0 Mon Sep 17 00:00:00 2001 From: Tachii Date: Mon, 20 Apr 2015 00:02:01 +0300 Subject: [PATCH 10/20] Update stringtable.xml --- addons/medical/stringtable.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index cf6e4515b3d..06361528e31 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -1547,7 +1547,7 @@ Very lightly wounded Sehr leicht verwundet: B. lekko ranny - Незначительные ранения + Царапины Ferito lievemente Muy levemente herido Très légèrement blessé From 20293bd11b4b36c8e6c3ebc51429935f60d1644b Mon Sep 17 00:00:00 2001 From: Tachii Date: Mon, 20 Apr 2015 00:26:20 +0300 Subject: [PATCH 11/20] Update stringtable.xml --- addons/medical/stringtable.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index 06361528e31..e85283c471d 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -1610,7 +1610,7 @@ Pain Effect Type Schmerzeffekt-Typ Rodzaj efektu bólu - Тип эффекта боли + Визуальный эффект боли Pain Effect Type Tipo de efecto de dolor Type d'effet de douleur From f928f37e264bdbb7b476e1c4a5d9f8d958a0d7b3 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Mon, 20 Apr 2015 01:16:51 -0300 Subject: [PATCH 12/20] Eliminate interact_menu fps drops due to high nearby object counts. Instead of reanalizing every frame which actions points should be rendered based on distance, that job is now done only 5 times per second. The rest of the frames the action points from the last frame are rerendered.. Close #434 --- addons/interact_menu/XEH_preInit.sqf | 3 +++ .../interact_menu/functions/fnc_keyDown.sqf | 1 + .../functions/fnc_renderActionPoints.sqf | 19 +++++++++++++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/addons/interact_menu/XEH_preInit.sqf b/addons/interact_menu/XEH_preInit.sqf index b4a3504cdd2..747da7083e1 100644 --- a/addons/interact_menu/XEH_preInit.sqf +++ b/addons/interact_menu/XEH_preInit.sqf @@ -49,4 +49,7 @@ GVAR(expandedTime) = diag_tickTime; GVAR(iconCtrls) = []; GVAR(iconCount) = 0; +GVAR(foundActions) = []; +GVAR(lastTimeSearchedActions) = -1000; + ADDON = true; diff --git a/addons/interact_menu/functions/fnc_keyDown.sqf b/addons/interact_menu/functions/fnc_keyDown.sqf index 47fdfb19518..123c1d45e2b 100644 --- a/addons/interact_menu/functions/fnc_keyDown.sqf +++ b/addons/interact_menu/functions/fnc_keyDown.sqf @@ -29,6 +29,7 @@ if (_menuType == 0) then { }; GVAR(keyDownTime) = diag_tickTime; GVAR(openedMenuType) = _menuType; +GVAR(lastTimeSearchedActions) = -1000; GVAR(useCursorMenu) = (vehicle ACE_player != ACE_player) || visibleMap || diff --git a/addons/interact_menu/functions/fnc_renderActionPoints.sqf b/addons/interact_menu/functions/fnc_renderActionPoints.sqf index 6ed4b41de44..78d5418e5a8 100644 --- a/addons/interact_menu/functions/fnc_renderActionPoints.sqf +++ b/addons/interact_menu/functions/fnc_renderActionPoints.sqf @@ -24,6 +24,9 @@ _fnc_renderNearbyActions = { _cameraPos = (positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL); _cameraDir = ((positionCameraToWorld [0, 0, 1]) call EFUNC(common,positionToASL)) vectorDiff _cameraPos; + GVAR(foundActions) = []; + GVAR(lastTimeSearchedActions) = diag_tickTime; + _numInteractObjects = 0; _nearestObjects = nearestObjects [ACE_player, ["All"], 13]; { @@ -46,6 +49,7 @@ _fnc_renderNearbyActions = { _action = _x; if ([_target, _action] call FUNC(renderBaseMenu)) then { _numInteractions = _numInteractions + 1; + GVAR(foundActions) pushBack [_target, _action]; }; }; } forEach GVAR(objectActionList); @@ -57,6 +61,7 @@ _fnc_renderNearbyActions = { // Try to render the menu if ([_target, _action] call FUNC(renderBaseMenu)) then { _numInteractions = _numInteractions + 1; + GVAR(foundActions) pushBack [_target, _action]; }; } forEach _classActions; @@ -71,7 +76,11 @@ _fnc_renderNearbyActions = { } forEach _nearestObjects; }; - +_fnc_renderLastFrameActions = { + { + _x call FUNC(renderBaseMenu); + } forEach GVAR(foundActions); +}; _fnc_renderSelfActions = { _target = _this; @@ -109,7 +118,13 @@ _fnc_renderSelfActions = { if (GVAR(openedMenuType) == 0) then { if (vehicle ACE_player == ACE_player) then { - call _fnc_renderNearbyActions; + if (diag_tickTime > GVAR(lastTimeSearchedActions) + 0.20) then { + // Once every 0.2 secs, collect nearby objects active and visible action points and render them + call _fnc_renderNearbyActions; + } else { + // The rest of the frames just draw the same action points rendered the last frame + call _fnc_renderLastFrameActions; + }; } else { (vehicle ACE_player) call _fnc_renderSelfActions; }; From 8ff72e7fc8e17ec740bc74e9341a8e4c7a1bcdc8 Mon Sep 17 00:00:00 2001 From: ulteq Date: Mon, 20 Apr 2015 10:35:29 +0200 Subject: [PATCH 13/20] Fixed another bug in the unit conversion code --- addons/atragmx/functions/fnc_update_gun_ammo_data.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf b/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf index 36271971856..94801cad398 100644 --- a/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf +++ b/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf @@ -47,10 +47,10 @@ if (GVAR(currentUnit) != 2) then { } else { ctrlSetText [120050, Str(Round(GVAR(workingMemory) select 1))]; }; -if (GVAR(currentUnit) == 2) then { - ctrlSetText [120060, Str(Round(GVAR(workingMemory) select 2))]; -} else { +if (GVAR(currentUnit) == 1) then { ctrlSetText [120060, Str(Round((GVAR(workingMemory) select 2) * 1.0936133))]; +} else { + ctrlSetText [120060, Str(Round(GVAR(workingMemory) select 2))]; }; if (GVAR(currentUnit) == 2) then { From 2bf47ca0c4777d8282be3f1b7ff4c782ca20d3f1 Mon Sep 17 00:00:00 2001 From: ulteq Date: Mon, 20 Apr 2015 10:36:20 +0200 Subject: [PATCH 14/20] Added two more asterix (*) meter indicator GUI elements --- addons/atragmx/RscTitles.hpp | 14 ++++++++++++++ .../atragmx/functions/fnc_show_gun_ammo_data.sqf | 2 +- addons/atragmx/functions/fnc_show_target_data.sqf | 2 +- .../atragmx/functions/fnc_update_gun_ammo_data.sqf | 5 +++++ .../atragmx/functions/fnc_update_target_data.sqf | 5 +++++ 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/addons/atragmx/RscTitles.hpp b/addons/atragmx/RscTitles.hpp index 905212d5c90..fe45ef67f50 100644 --- a/addons/atragmx/RscTitles.hpp +++ b/addons/atragmx/RscTitles.hpp @@ -1115,6 +1115,13 @@ class ATragMX_Display { idc=120060; y=0.265*safezoneH+safezoneY+0.520; }; + class TEXT_GUN_AMMO_DATA_ZERO_RANGE_METER_INDICATOR: TEXT_GUN_AMMO_DATA_BORE_HEIGHT { + idc=120061; + w=0.05; + x=0.550*safezoneW+safezoneX+0.315; + y=0.265*safezoneH+safezoneY+0.520; + text=""; + }; class TEXT_GUN_AMMO_DATA_DONE: TEXT_TARGET_SPEED_ASSIST_DONE { idc=12008; action=QUOTE(1 call FUNC(toggle_gun_ammo_data)); @@ -1327,6 +1334,13 @@ class ATragMX_Display { idc=140060; y=0.265*safezoneH+safezoneY+0.520; }; + class TEXT_TARGET_DATA_TARGET_RANGE_METER_INDICATOR: TEXT_TARGET_DATA_LATITUDE { + idc=140061; + w=0.05; + x=0.550*safezoneW+safezoneX+0.315; + y=0.265*safezoneH+safezoneY+0.520; + text=""; + }; class TEXT_TARGET_DATA_DONE: TEXT_TARGET_SPEED_ASSIST_DONE { idc=14008; action=QUOTE(1 call FUNC(toggle_target_data)); diff --git a/addons/atragmx/functions/fnc_show_gun_ammo_data.sqf b/addons/atragmx/functions/fnc_show_gun_ammo_data.sqf index 06ab20b3b73..dfab6da2380 100644 --- a/addons/atragmx/functions/fnc_show_gun_ammo_data.sqf +++ b/addons/atragmx/functions/fnc_show_gun_ammo_data.sqf @@ -17,7 +17,7 @@ GVAR(showGunAmmoData) = _this; -{ctrlShow [_x, _this]} forEach [12000, 120000, 12001, 120010, 12002, 120020, 12003, 120030, 12004, 120040, 12005, 120050, 12006, 120060, 12007, 12008, 12009, 12010, 12011]; +{ctrlShow [_x, _this]} forEach [12000, 120000, 12001, 120010, 12002, 120020, 12003, 120030, 12004, 120040, 12005, 120050, 12006, 120060, 120061, 12007, 12008, 12009, 12010, 12011]; if (_this) then { [] call FUNC(update_gun_ammo_data); diff --git a/addons/atragmx/functions/fnc_show_target_data.sqf b/addons/atragmx/functions/fnc_show_target_data.sqf index 4e696ae3318..48e419f65f8 100644 --- a/addons/atragmx/functions/fnc_show_target_data.sqf +++ b/addons/atragmx/functions/fnc_show_target_data.sqf @@ -17,7 +17,7 @@ GVAR(showTargetData) = _this; -{ctrlShow [_x, _this]} forEach [14000, 140000, 14001, 140010, 14002, 141020, 140020, 141021, 140021, 14003, 140030, 14004, 140040, 141040, 141041, 140041, 14005, 140050, 14006, 140060, 14007, 14008, 14009, 14010, 14011]; +{ctrlShow [_x, _this]} forEach [14000, 140000, 14001, 140010, 14002, 141020, 140020, 141021, 140021, 14003, 140030, 14004, 140040, 141040, 141041, 140041, 14005, 140050, 14006, 140060, 140061, 14007, 14008, 14009, 14010, 14011]; if (_this) then { [] call FUNC(update_target_data); diff --git a/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf b/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf index 94801cad398..4ccae287e73 100644 --- a/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf +++ b/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf @@ -52,6 +52,11 @@ if (GVAR(currentUnit) == 1) then { } else { ctrlSetText [120060, Str(Round(GVAR(workingMemory) select 2))]; }; +if (GVAR(currentUnit) == 0) then { + ctrlSetText [120061, "*"]; +} else { + ctrlSetText [120061, ""]; +}; if (GVAR(currentUnit) == 2) then { ctrlSetText [12000, "Bore (cm)"]; diff --git a/addons/atragmx/functions/fnc_update_target_data.sqf b/addons/atragmx/functions/fnc_update_target_data.sqf index 733118d5837..b5e6dcf85a2 100644 --- a/addons/atragmx/functions/fnc_update_target_data.sqf +++ b/addons/atragmx/functions/fnc_update_target_data.sqf @@ -37,6 +37,11 @@ if (GVAR(currentUnit) == 1) then { } else { ctrlSetText [140060, Str(Round((GVAR(targetRange) select GVAR(currentTarget))))]; }; +if (GVAR(currentUnit) == 0) then { + ctrlSetText [140061, "*"]; +} else { + ctrlSetText [140061, ""]; +}; if (GVAR(currentUnit) == 2) then { ctrlSetText [14002, "Wind Speed (m/s)"]; From c049ee5c08308f6355db086ab91a16619bf75487 Mon Sep 17 00:00:00 2001 From: ulteq Date: Mon, 20 Apr 2015 11:02:28 +0200 Subject: [PATCH 15/20] Fixed incorrect .408 Chey Tac airFriction value --- addons/atragmx/XEH_postInit.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/atragmx/XEH_postInit.sqf b/addons/atragmx/XEH_postInit.sqf index 574b5a89917..242b9dcbe8d 100644 --- a/addons/atragmx/XEH_postInit.sqf +++ b/addons/atragmx/XEH_postInit.sqf @@ -13,7 +13,7 @@ if ((profileNamespace getVariable ["ACE_ATragMX_profileNamespaceVersion", 0]) == ["12.7x54mm" , 300, 100, 0.3394, -0.0014000, 3.81, 0, 2, 10, 120, 0, 0, 48.60, 12.7, 24.13, 1.050, 1, "ASM" ], - [".408 Chey Tac" , 910, 100, 0.0569, -0.0004800, 3.81, 0, 2, 10, 120, 0, 0, 27.15, 10.4, 33.02, 0.970, 1, "ASM" ], + [".408 Chey Tac" , 910, 100, 0.0571, -0.0003950, 3.81, 0, 2, 10, 120, 0, 0, 27.15, 10.4, 33.02, 0.970, 1, "ASM" ], ["9.3×64mm" , 870, 100, 0.0619, -0.0007500, 3.81, 0, 2, 10, 120, 0, 0, 14.90, 9.30, 35.56, 0.368, 1, "ASM" ], From de0414803ec7649d18aed45e481c05b14f8d6d3b Mon Sep 17 00:00:00 2001 From: ulteq Date: Mon, 20 Apr 2015 11:08:28 +0200 Subject: [PATCH 16/20] Fixed some more airFriction values in the ATragMX gun list --- addons/atragmx/XEH_postInit.sqf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/atragmx/XEH_postInit.sqf b/addons/atragmx/XEH_postInit.sqf index 242b9dcbe8d..7f047834e2b 100644 --- a/addons/atragmx/XEH_postInit.sqf +++ b/addons/atragmx/XEH_postInit.sqf @@ -6,16 +6,16 @@ if ((profileNamespace getVariable ["ACE_ATragMX_profileNamespaceVersion", 0]) == GVAR(gunList) = profileNamespace getVariable "ACE_ATragMX_gunList"; } else { // Profile Name, Muzzle Velocity, Zero Range, Scope Base Angle, AirFriction, Bore Height, Scope Unit, Scope Click Unit, Scope Click Number, Maximum Elevation, Dialed Elevation, Dialed Windage, Mass, Bullet Diameter, Rifle Twist, BC, Drag Model, Atmosphere Model - GVAR(gunList) = [["12.7x108mm" , 820, 100, 0.0659, -0.0008600, 3.81, 0, 2, 10, 120, 0, 0, 48.28, 12.7, 38.10, 0.630, 1, "ASM" ], + GVAR(gunList) = [["12.7x108mm" , 820, 100, 0.0657, -0.0006400, 3.81, 0, 2, 10, 120, 0, 0, 48.28, 12.7, 38.10, 0.630, 1, "ASM" ], - ["12.7x99mm AMAX" , 860, 100, 0.0612, -0.0008600, 3.81, 0, 2, 10, 120, 0, 0, 48.60, 12.7, 38.10, 1.050, 1, "ASM" ], - ["12.7x99mm" , 853, 100, 0.0623, -0.0008600, 3.81, 0, 2, 10, 120, 0, 0, 41.92, 12.7, 38.10, 0.670, 1, "ASM" ], + ["12.7x99mm AMAX" , 860, 100, 0.0612, -0.0003740, 3.81, 0, 2, 10, 120, 0, 0, 48.60, 12.7, 38.10, 1.050, 1, "ASM" ], + ["12.7x99mm" , 853, 100, 0.0623, -0.0006000, 3.81, 0, 2, 10, 120, 0, 0, 41.92, 12.7, 38.10, 0.670, 1, "ASM" ], - ["12.7x54mm" , 300, 100, 0.3394, -0.0014000, 3.81, 0, 2, 10, 120, 0, 0, 48.60, 12.7, 24.13, 1.050, 1, "ASM" ], + ["12.7x54mm" , 300, 100, 0.3395, -0.0001400, 3.81, 0, 2, 10, 120, 0, 0, 48.60, 12.7, 24.13, 1.050, 1, "ASM" ], [".408 Chey Tac" , 910, 100, 0.0571, -0.0003950, 3.81, 0, 2, 10, 120, 0, 0, 27.15, 10.4, 33.02, 0.970, 1, "ASM" ], - ["9.3×64mm" , 870, 100, 0.0619, -0.0007500, 3.81, 0, 2, 10, 120, 0, 0, 14.90, 9.30, 35.56, 0.368, 1, "ASM" ], + ["9.3×64mm" , 870, 100, 0.0619, -0.0010600, 3.81, 0, 2, 10, 120, 0, 0, 14.90, 9.30, 35.56, 0.368, 1, "ASM" ], [".338LM 250gr" , 880, 100, 0.0598, -0.0006060, 3.81, 0, 2, 10, 120, 0, 0, 16.20, 8.58, 25.40, 0.322, 7, "ICAO"], [".338LM 300gr" , 800, 100, 0.0677, -0.0005350, 3.81, 0, 2, 10, 120, 0, 0, 19.44, 8.58, 25.40, 0.381, 7, "ICAO"], From 0e08fd4457d1cc5fb2a79235a5ff0637998e7287 Mon Sep 17 00:00:00 2001 From: ulteq Date: Mon, 20 Apr 2015 11:09:12 +0200 Subject: [PATCH 17/20] Incremented the ATragMX profile namespace version --- addons/atragmx/script_component.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/atragmx/script_component.hpp b/addons/atragmx/script_component.hpp index 7cd5b449119..6e81f794937 100644 --- a/addons/atragmx/script_component.hpp +++ b/addons/atragmx/script_component.hpp @@ -11,4 +11,4 @@ #include "\z\ace\addons\main\script_macros.hpp" -#define ATRAGMX_PROFILE_NAMESPACE_VERSION 1.1 +#define ATRAGMX_PROFILE_NAMESPACE_VERSION 1.2 From 6c2982548fe70a0dcd8b47be50fff89a0e30b8f4 Mon Sep 17 00:00:00 2001 From: ulteq Date: Mon, 20 Apr 2015 12:35:08 +0200 Subject: [PATCH 18/20] Fixed incorrect function header --- .../advanced_ballistics/functions/fnc_calculateAirDensity.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/advanced_ballistics/functions/fnc_calculateAirDensity.sqf b/addons/advanced_ballistics/functions/fnc_calculateAirDensity.sqf index ea7a77e8375..298049e51db 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateAirDensity.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateAirDensity.sqf @@ -1,7 +1,7 @@ /* * Author: Ruthberg * - * Displays a wind info (colored arrow) in the top left corner of the screen + * Calculates the air density * * Arguments: * 0: temperature - degrees celcius From 89e33dc177dd43fe2e8c66ade92aec786f39548f Mon Sep 17 00:00:00 2001 From: ulteq Date: Mon, 20 Apr 2015 13:54:22 +0200 Subject: [PATCH 19/20] Refactored the weather module: * No changes in functionality --- addons/advanced_ballistics/XEH_preInit.sqf | 1 - .../fnc_calculateAtmosphericCorrection.sqf | 2 +- .../functions/fnc_handleFired.sqf | 6 +- .../kestrel4500/functions/fnc_collectData.sqf | 4 +- .../functions/fnc_generateOutputData.sqf | 2 +- addons/weather/XEH_postInit.sqf | 99 +++++++------------ addons/weather/XEH_preInit.sqf | 40 ++------ .../functions/fnc_calculateAirDensity.sqf | 36 +++++++ .../fnc_calculateBarometricPressure.sqf | 20 ++++ .../weather/functions/fnc_displayWindInfo.sqf | 1 + addons/weather/functions/fnc_getMapData.sqf | 4 + addons/weather/functions/fnc_getWind.sqf | 1 + .../functions/fnc_serverController.sqf | 1 + .../weather/functions/fnc_updateHumidity.sqf | 28 ++++++ addons/weather/functions/fnc_updateRain.sqf | 26 +++++ .../functions/fnc_updateTemperature.sqf | 22 +++++ addons/weather/functions/fnc_updateWind.sqf | 21 ++++ addons/weather/script_component.hpp | 8 ++ 18 files changed, 217 insertions(+), 105 deletions(-) create mode 100644 addons/weather/functions/fnc_calculateAirDensity.sqf create mode 100644 addons/weather/functions/fnc_calculateBarometricPressure.sqf create mode 100644 addons/weather/functions/fnc_updateHumidity.sqf create mode 100644 addons/weather/functions/fnc_updateRain.sqf create mode 100644 addons/weather/functions/fnc_updateTemperature.sqf create mode 100644 addons/weather/functions/fnc_updateWind.sqf diff --git a/addons/advanced_ballistics/XEH_preInit.sqf b/addons/advanced_ballistics/XEH_preInit.sqf index b58a2b88e81..1d19a9c4929 100644 --- a/addons/advanced_ballistics/XEH_preInit.sqf +++ b/addons/advanced_ballistics/XEH_preInit.sqf @@ -2,7 +2,6 @@ ADDON = false; -PREP(calculateAirDensity); PREP(calculateAmmoTemperatureVelocityShift); PREP(calculateAtmosphericCorrection); PREP(calculateBarrelLengthVelocityShift); diff --git a/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf b/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf index 02e849399ee..b0166109f5f 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf @@ -24,7 +24,7 @@ _pressure = _this select 2; // in hPa _relativeHumidity = _this select 3; // as ratio 0-1 _atmosphereModel = _this select 4; // "ICAO" or "ASM" -_airDensity = [_temperature, _pressure, _relativeHumidity] call FUNC(calculateAirDensity); +_airDensity = [_temperature, _pressure, _relativeHumidity] call EFUNC(weather,calculateAirDensity); if (_atmosphereModel == "ICAO") then { (STD_AIR_DENSITY_ICAO / _airDensity) * _ballisticCoefficient diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index baa3a871fa7..54a7f2d5b0b 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -110,7 +110,7 @@ _stabilityFactor = 1.5; if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then { _temperature = GET_TEMPERATURE_AT_HEIGHT((getPosASL _unit) select 2); - _barometricPressure = 1013.25 * exp(-(EGVAR(weather,Altitude) + ((getPosASL _bullet) select 2)) / 7990) - 10 * overcast; + _barometricPressure = ((getPosASL _bullet) select 2) call EFUNC(weather,calculateBarometricPressure); _stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor); }; @@ -288,7 +288,7 @@ if (GVAR(AdvancedAirDragEnabled)) then { }; if (GVAR(AtmosphericDensitySimulationEnabled)) then { - _pressure = 1013.25 * exp(-(EGVAR(weather,Altitude) + (_bulletPosition select 2)) / 7990) - 10 * overcast; + _pressure = (_bulletPosition select 2) call EFUNC(weather,calculateBarometricPressure); _temperature = GET_TEMPERATURE_AT_HEIGHT(_bulletPosition select 2); _humidity = EGVAR(weather,currentHumidity); _airDensity = STD_AIR_DENSITY_ICAO; @@ -315,7 +315,7 @@ if (GVAR(AdvancedAirDragEnabled)) then { _bulletVelocity = _bulletVelocity vectorDiff _accel; } else { if (GVAR(AtmosphericDensitySimulationEnabled)) then { - _pressureDeviation = 1013.25 * exp(-(EGVAR(weather,Altitude) + (_bulletPosition select 2)) / 7990) - 1013.25 - 10 * overcast; + _pressureDeviation = (_bulletPosition select 2) call EFUNC(weather,calculateBarometricPressure) - 1013.25; _temperature = GET_TEMPERATURE_AT_HEIGHT(_bulletPosition select 2); _humidity = EGVAR(weather,currentHumidity); _airFriction = _airFriction + ((_temperature - 15) * 0.0000015 + _humidity * 0.0000040 + _pressureDeviation * -0.0000009); diff --git a/addons/kestrel4500/functions/fnc_collectData.sqf b/addons/kestrel4500/functions/fnc_collectData.sqf index 8ebd4e01d20..bbad8619bc2 100644 --- a/addons/kestrel4500/functions/fnc_collectData.sqf +++ b/addons/kestrel4500/functions/fnc_collectData.sqf @@ -19,7 +19,7 @@ private ["_playerDir", "_windSpeed", "_windDir", "_crosswind", "_headwind", "_hu if (isNil QGVAR(MIN) || isNil QGVAR(MAX)) then { _temperature = GET_TEMPERATURE_AT_HEIGHT((getPosASL ACE_player) select 2); _humidity = EGVAR(weather,currentHumidity); - _barometricPressure = 1013.25 * exp(-(EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2)) / 7990) - 10 * overcast; + _barometricPressure = ((getPosASL ACE_player) select 2) call EFUNC(weather,calculateBarometricPressure); _altitude = EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2); GVAR(MIN) = [0, 0, 0, 0, _temperature, _humidity, _barometricPressure, _altitude]; GVAR(MAX) = [0, 0, 0, 0, _temperature, _humidity, _barometricPressure, _altitude]; @@ -82,7 +82,7 @@ GVAR(MAX) set [5, _humidity max (GVAR(MAX) select 5)]; GVAR(TOTAL) set [5, (GVAR(TOTAL) select 5) + _humidity]; // BARO -_barometricPressure = 1013.25 * exp(-(EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2)) / 7990) - 10 * overcast; +_barometricPressure = ((getPosASL ACE_player) select 2) call EFUNC(weather,calculateBarometricPressure); GVAR(MIN) set [6, (GVAR(MIN) select 6) min _barometricPressure]; GVAR(MAX) set [6, _barometricPressure max (GVAR(MAX) select 6)]; GVAR(TOTAL) set [6, (GVAR(TOTAL) select 6) + _barometricPressure]; diff --git a/addons/kestrel4500/functions/fnc_generateOutputData.sqf b/addons/kestrel4500/functions/fnc_generateOutputData.sqf index 3e392bd55bb..3f5e77b748c 100644 --- a/addons/kestrel4500/functions/fnc_generateOutputData.sqf +++ b/addons/kestrel4500/functions/fnc_generateOutputData.sqf @@ -174,7 +174,7 @@ switch (GVAR(Menu)) do { }; case 6: { // BARO if (!GVAR(MinAvgMax)) then { - _textCenterBig = Str(round((1013.25 * exp(-(EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2)) / 7990) - 10 * overcast) * 10) / 10); + _textCenterBig = Str(round((((getPosASL ACE_player) select 2) call EFUNC(weather,calculateBarometricPressure)) * 10) / 10); } else { _textCenterLine1Left = "Min"; _textCenterLine2Left = "Avg"; diff --git a/addons/weather/XEH_postInit.sqf b/addons/weather/XEH_postInit.sqf index 9276e710da4..e40a061aafc 100644 --- a/addons/weather/XEH_postInit.sqf +++ b/addons/weather/XEH_postInit.sqf @@ -1,6 +1,36 @@ -//XEH_postInit.sqf -//#define DEBUG_MODE_FULL #include "script_component.hpp" + +// Rain variables +GVAR(enableRain) = true; +GVAR(rain_next_period) = -1; +GVAR(rain_period_count) = 0; +GVAR(rain_initial_rain) = 0; +if(overcast >= 0.7) then { + GVAR(rain_initial_rain) = (random ((overcast-0.7)/0.3)); +}; +GVAR(current_rain) = GVAR(rain_initial_rain); +GVAR(rain_current_range) = -1+(random 2); +GVAR(overcast_multiplier) = 1; + +// Wind Variables +ACE_wind = [0, 0, 0]; +GVAR(wind_initial_dir) = (random 360); +GVAR(wind_initial_speed) = (overcast*5)+(random (overcast*5)) max 1; +GVAR(wind_mean_speed) = GVAR(wind_initial_speed); +GVAR(wind_mean_dir) = GVAR(wind_initial_dir); +GVAR(wind_current_speed) = GVAR(wind_initial_speed); +GVAR(wind_current_dir) = GVAR(wind_initial_dir); +GVAR(wind_current_range_speed) = -1+(random 2); +GVAR(wind_current_range_dir) = -1+(random 2); +GVAR(wind_next_period) = -1; //ceil((2+random(5))/(GVAR(overcast_multiplier)/10)); +GVAR(wind_next_major_period) = -1; +GVAR(wind_period_count) = 0; +GVAR(wind_major_period_count) = 0; +GVAR(wind_total_time) = 0; +GVAR(wind_period_start_time) = time; + +call FUNC(getMapData); + "ACE_WIND_PARAMS" addPublicVariableEventHandler { GVAR(wind_period_start_time) = time; }; "ACE_RAIN_PARAMS" addPublicVariableEventHandler { GVAR(rain_period_start_time) = time; }; "ACE_MISC_PARAMS" addPublicVariableEventHandler { @@ -22,66 +52,9 @@ {false}, [37, [true, false, false]], false, 0] call CBA_fnc_addKeybind; // (SHIFT + K) -// Update Wind simulWeatherSync; -_fnc_updateWind = { - ACE_wind = [] call FUNC(getWind); - setWind [ACE_wind select 0, ACE_wind select 1, true]; - 2 setGusts 0; - - // Set waves: 0 when no wind, 1 when wind >= 16 m/s - 1 setWaves (((vectorMagnitude ACE_wind) / 16.0) min 1.0); - - //systemChat format ["w:%1 %2,ACE_w:%1 %2, w", [wind select 0, wind select 1, ACE_wind select 0, ACE_wind select 1]]; -}; -[_fnc_updateWind, 1, []] call CBA_fnc_addPerFrameHandler; - - -// Update Rain -_fnc_updateRain = { - private ["_oldStrength","_rainStrength","_transitionTime","_periodPosition","_periodPercent"]; - if(GVAR(enableRain)) then { - if(!isNil "ACE_RAIN_PARAMS" && {!isNil QGVAR(rain_period_start_time)}) then { - _oldStrength = ACE_RAIN_PARAMS select 0; - _rainStrength = ACE_RAIN_PARAMS select 1; - _transitionTime = ACE_RAIN_PARAMS select 2; - _periodPosition = (time - GVAR(rain_period_start_time)) min _transitionTime; - _periodPercent = (_periodPosition/_transitionTime) min 1; - 0 setRain ((_periodPercent*(_rainStrength-_oldStrength))+_oldStrength); - }; - }; -}; -[_fnc_updateRain, 2, []] call CBA_fnc_addPerFrameHandler; - - -// Update Temperature -_fnc_updateTemperature = { - private ["_time","_month","_hourlyCoef","_avgTemperature","_pS1","_pS2"]; - _time = daytime; - _month = date select 1; - - // Temperature - _hourlyCoef = -0.5 * sin(360 * ((3 + (date select 3))/24 + (date select 4)/1440)); - - GVAR(currentTemperature) = (GVAR(TempDay) select (_month - 1)) * (1 - _hourlyCoef) + (GVAR(TempNight) select (_month - 1)) * _hourlyCoef; - GVAR(currentTemperature) = GVAR(currentTemperature) - 2 * humidity - 4 * overcast; - GVAR(currentTemperature) = round(GVAR(currentTemperature) * 10) / 10; - - // Humidity - GVAR(currentHumidity) = (GVAR(Humidity) select _month) / 100; - - if (rain > 0 && overcast > 0.7) then { - GVAR(currentHumidity) = 1; - } else { - _avgTemperature = ((GVAR(TempDay) select (_month - 1)) + (GVAR(TempNight) select (_month - 1))) / 2; - _pS1 = 6.112 * exp((17.62 * _avgTemperature) / (243.12 + _avgTemperature)); - _PS2 = 6.112 * exp((17.62 * GVAR(currentTemperature)) / (243.12 + GVAR(currentTemperature))); - GVAR(currentHumidity) = GVAR(currentHumidity) * _PS1 / _PS2; - }; - GVAR(currentHumidity) = 0 max GVAR(currentHumidity) min 1; - - // @todo: take altitude and humidity into account - GVAR(currentRelativeDensity) = (273.15 + 20) / (273.15 + GVAR(currentTemperature)); -}; -[_fnc_updateTemperature, 20, []] call CBA_fnc_addPerFrameHandler; +[FUNC(updateTemperature), 20, []] call CBA_fnc_addPerFrameHandler; +[FUNC(updateHumidity), 20, []] call CBA_fnc_addPerFrameHandler; +[FUNC(updateWind), 1, []] call CBA_fnc_addPerFrameHandler; +[FUNC(updateRain), 2, []] call CBA_fnc_addPerFrameHandler; \ No newline at end of file diff --git a/addons/weather/XEH_preInit.sqf b/addons/weather/XEH_preInit.sqf index 2751e772266..ee05983a697 100644 --- a/addons/weather/XEH_preInit.sqf +++ b/addons/weather/XEH_preInit.sqf @@ -2,44 +2,16 @@ #include "script_component.hpp" ADDON = false; -LOG(MSG_INIT); +PREP(calculateAirDensity); +PREP(calculateBarometricPressure); PREP(displayWindInfo); PREP(getMapData); PREP(getWind); PREP(serverController); - - -// Rain variables -GVAR(enableRain) = true; -GVAR(rain_next_period) = -1; -GVAR(rain_period_count) = 0; -GVAR(rain_initial_rain) = 0; -if(overcast >= 0.7) then { - GVAR(rain_initial_rain) = (random ((overcast-0.7)/0.3)); -}; -GVAR(current_rain) = GVAR(rain_initial_rain); -GVAR(rain_current_range) = -1+(random 2); -GVAR(overcast_multiplier) = 1; - -// Wind Variables -ACE_wind = [0, 0, 0]; -GVAR(wind_initial_dir) = (random 360); -GVAR(wind_initial_speed) = (overcast*5)+(random (overcast*5)) max 1; -GVAR(wind_mean_speed) = GVAR(wind_initial_speed); -GVAR(wind_mean_dir) = GVAR(wind_initial_dir); -GVAR(wind_current_speed) = GVAR(wind_initial_speed); -GVAR(wind_current_dir) = GVAR(wind_initial_dir); -GVAR(wind_current_range_speed) = -1+(random 2); -GVAR(wind_current_range_dir) = -1+(random 2); -GVAR(wind_next_period) = -1; //ceil((2+random(5))/(GVAR(overcast_multiplier)/10)); -GVAR(wind_next_major_period) = -1; -GVAR(wind_period_count) = 0; -GVAR(wind_major_period_count) = 0; -GVAR(wind_total_time) = 0; -GVAR(wind_period_start_time) = time; - -// Init weather variables, in case they are needed before postInit -call FUNC(getMapData); +PREP(updateHumidity); +PREP(updateRain); +PREP(updateTemperature); +PREP(updateWind); ADDON = true; diff --git a/addons/weather/functions/fnc_calculateAirDensity.sqf b/addons/weather/functions/fnc_calculateAirDensity.sqf new file mode 100644 index 00000000000..298049e51db --- /dev/null +++ b/addons/weather/functions/fnc_calculateAirDensity.sqf @@ -0,0 +1,36 @@ +/* + * Author: Ruthberg + * + * Calculates the air density + * + * Arguments: + * 0: temperature - degrees celcius + * 1: pressure - hPa + * 2: relativeHumidity - value between 0.0 and 1.0 + * + * Return Value: + * 0: density of air - kg * m^(-3) + * + * Return value: + * None + */ +#include "script_component.hpp" + +private ["_temperature", "_pressure", "_relativeHumidity"]; +_temperature = _this select 0; // in C +_pressure = _this select 1; // in hPa +_relativeHumidity = _this select 2; // as ratio 0-1 + +_pressure = _pressure * 100; + +if (_relativeHumidity > 0) then { + private ["_pSat", "_vaporPressure", "_partialPressure"]; + // Saturation vapor pressure calculated according to: http://wahiduddin.net/calc/density_algorithms.htm + _pSat = 6.1078 * 10 ^ ((7.5 * _temperature) / (_temperature + 237.3)); + _vaporPressure = _relativeHumidity * _pSat; + _partialPressure = _pressure - _vaporPressure; + + (_partialPressure * DRY_AIR_MOLAR_MASS + _vaporPressure * WATER_VAPOR_MOLAR_MASS) / (UNIVERSAL_GAS_CONSTANT * KELVIN(_temperature)) +} else { + _pressure / (SPECIFIC_GAS_CONSTANT_DRY_AIR * KELVIN(_temperature)) +}; diff --git a/addons/weather/functions/fnc_calculateBarometricPressure.sqf b/addons/weather/functions/fnc_calculateBarometricPressure.sqf new file mode 100644 index 00000000000..c65d343c934 --- /dev/null +++ b/addons/weather/functions/fnc_calculateBarometricPressure.sqf @@ -0,0 +1,20 @@ +/* + * Author: Ruthberg + * + * Calculates the barometric pressure based on altitude and weather + * + * Arguments: + * 0: altitude - meters + * + * Return Value: + * 0: barometric pressure - hPA + * + * Return value: + * None + */ +#include "script_component.hpp" + +private ["_altitude"]; +_altitude = _this; + +(1013.25 * exp(-(GVAR(Altitude) + _altitude) / 7990) - 10 * overcast) diff --git a/addons/weather/functions/fnc_displayWindInfo.sqf b/addons/weather/functions/fnc_displayWindInfo.sqf index d84cddd1065..58d728bf67a 100644 --- a/addons/weather/functions/fnc_displayWindInfo.sqf +++ b/addons/weather/functions/fnc_displayWindInfo.sqf @@ -1,5 +1,6 @@ /* * Author: Ruthberg + * * Displays a wind info (colored arrow) in the top left corner of the screen * * Argument: diff --git a/addons/weather/functions/fnc_getMapData.sqf b/addons/weather/functions/fnc_getMapData.sqf index fecf9f34f77..cb0a961c21b 100644 --- a/addons/weather/functions/fnc_getMapData.sqf +++ b/addons/weather/functions/fnc_getMapData.sqf @@ -1,5 +1,6 @@ /* * Author: Ruthberg, esteldunedain + * * Get the weather data for the current map * * Argument: @@ -109,3 +110,6 @@ if (worldName in ["Imrali"]) exitWith { GVAR(TempDay) = [1, 3, 9, 14, 19, 23, 25, 24, 21, 13, 7, 2]; GVAR(TempNight) = [-4, -3, 0, 4, 9, 12, 14, 14, 10, 6, 2, -2]; GVAR(Humidity) = [82, 80, 78, 70, 71, 72, 70, 73, 78, 80, 83, 82]; + +GVAR(currentTemperature) = 20; +GVAR(currentHumidity) = 0.5; diff --git a/addons/weather/functions/fnc_getWind.sqf b/addons/weather/functions/fnc_getWind.sqf index b0fbf5e8fa6..54ec6efad3b 100644 --- a/addons/weather/functions/fnc_getWind.sqf +++ b/addons/weather/functions/fnc_getWind.sqf @@ -1,5 +1,6 @@ /* * Author: ACE2 Team + * * Calculate current wind locally from the data broadcasted by the server * * Argument: diff --git a/addons/weather/functions/fnc_serverController.sqf b/addons/weather/functions/fnc_serverController.sqf index e29836fc184..d7dff0eb706 100644 --- a/addons/weather/functions/fnc_serverController.sqf +++ b/addons/weather/functions/fnc_serverController.sqf @@ -1,5 +1,6 @@ /* * Author: ACE2 Team, esteldunedain + * * Calculate the wind and rain evolution on the server. Broadcast the current and next values to the clients * * Argument: diff --git a/addons/weather/functions/fnc_updateHumidity.sqf b/addons/weather/functions/fnc_updateHumidity.sqf new file mode 100644 index 00000000000..e3ba7a02248 --- /dev/null +++ b/addons/weather/functions/fnc_updateHumidity.sqf @@ -0,0 +1,28 @@ +/* + * Author: ACE2 Team + * + * Updates GVAR(currentHumidity) based on + * + * Argument: + * Nothing + * + * Return value: + * Nothing + */ +#include "script_component.hpp" + +private ["_month", "_avgTemperature", "_pS1", "_pS2"]; +_month = date select 1; + +GVAR(currentHumidity) = (GVAR(Humidity) select _month) / 100; + +if (rain > 0 && overcast > 0.7) then { + GVAR(currentHumidity) = 1; +} else { + _avgTemperature = ((GVAR(TempDay) select (_month - 1)) + (GVAR(TempNight) select (_month - 1))) / 2; + _pS1 = 6.112 * exp((17.62 * _avgTemperature) / (243.12 + _avgTemperature)); + _PS2 = 6.112 * exp((17.62 * GVAR(currentTemperature)) / (243.12 + GVAR(currentTemperature))); + GVAR(currentHumidity) = GVAR(currentHumidity) * _PS1 / _PS2; +}; + +GVAR(currentHumidity) = 0 max GVAR(currentHumidity) min 1; diff --git a/addons/weather/functions/fnc_updateRain.sqf b/addons/weather/functions/fnc_updateRain.sqf new file mode 100644 index 00000000000..01e32e17341 --- /dev/null +++ b/addons/weather/functions/fnc_updateRain.sqf @@ -0,0 +1,26 @@ +/* + * Author: ACE2 Team + * + * Updates rain based on ACE_RAIN_PARAMS + * + * Argument: + * Nothing + * + * Return value: + * Nothing + */ +#include "script_component.hpp" + +private ["_oldStrength", "_rainStrength", "_transitionTime", "_periodPosition", "_periodPercent"]; + +if (!GVAR(enableRain)) exitWith {}; + +if (!isNil "ACE_RAIN_PARAMS" && {!isNil QGVAR(rain_period_start_time)}) then { + _oldStrength = ACE_RAIN_PARAMS select 0; + _rainStrength = ACE_RAIN_PARAMS select 1; + _transitionTime = ACE_RAIN_PARAMS select 2; + _periodPosition = (time - GVAR(rain_period_start_time)) min _transitionTime; + _periodPercent = (_periodPosition/_transitionTime) min 1; + + 0 setRain ((_periodPercent*(_rainStrength-_oldStrength))+_oldStrength); +}; diff --git a/addons/weather/functions/fnc_updateTemperature.sqf b/addons/weather/functions/fnc_updateTemperature.sqf new file mode 100644 index 00000000000..5e342ad83d2 --- /dev/null +++ b/addons/weather/functions/fnc_updateTemperature.sqf @@ -0,0 +1,22 @@ +/* + * Author: ACE2 Team + * + * Updates GVAR(currentTemperature) based on the map data + * + * Argument: + * Nothing + * + * Return value: + * Nothing + */ +#include "script_component.hpp" + +private ["_time", "_month", "_hourlyCoef"]; +_time = daytime; +_month = date select 1; + +_hourlyCoef = -0.5 * sin(360 * ((3 + (date select 3))/24 + (date select 4)/1440)); + +GVAR(currentTemperature) = (GVAR(TempDay) select (_month - 1)) * (1 - _hourlyCoef) + (GVAR(TempNight) select (_month - 1)) * _hourlyCoef; +GVAR(currentTemperature) = GVAR(currentTemperature) - 2 * humidity - 4 * overcast; +GVAR(currentTemperature) = round(GVAR(currentTemperature) * 10) / 10; diff --git a/addons/weather/functions/fnc_updateWind.sqf b/addons/weather/functions/fnc_updateWind.sqf new file mode 100644 index 00000000000..e5a52348a86 --- /dev/null +++ b/addons/weather/functions/fnc_updateWind.sqf @@ -0,0 +1,21 @@ +/* + * Author: ACE2 Team + * + * Updates wind, gusts and waves based on ACE_wind + * + * Argument: + * Nothing + * + * Return value: + * Nothing + */ +#include "script_component.hpp" + +ACE_wind = [] call FUNC(getWind); +setWind [ACE_wind select 0, ACE_wind select 1, true]; +2 setGusts 0; + +// Set waves: 0 when no wind, 1 when wind >= 16 m/s +1 setWaves (((vectorMagnitude ACE_wind) / 16.0) min 1.0); + +//hintSilent format["Wind: %1\nACE_wind: %2\nDeviation: %3 (m/s)", wind, ACE_wind, Round((vectorMagnitude (ACE_wind vectorDiff wind)) * 1000) / 1000]; diff --git a/addons/weather/script_component.hpp b/addons/weather/script_component.hpp index a21d8245fd6..edc1ac64d0c 100644 --- a/addons/weather/script_component.hpp +++ b/addons/weather/script_component.hpp @@ -10,3 +10,11 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" + +#define ABSOLUTE_ZERO_IN_CELSIUS -273.15 +#define KELVIN(t) (t - ABSOLUTE_ZERO_IN_CELSIUS) +#define CELSIUS(t) (t + ABSOLUTE_ZERO_IN_CELSIUS) +#define UNIVERSAL_GAS_CONSTANT 8.314 +#define WATER_VAPOR_MOLAR_MASS 0.018016 +#define DRY_AIR_MOLAR_MASS 0.028964 +#define SPECIFIC_GAS_CONSTANT_DRY_AIR 287.058 From 06a4f3d10e216924d281d7491656128f06633be8 Mon Sep 17 00:00:00 2001 From: KoffeinFlummi Date: Mon, 20 Apr 2015 15:48:50 +0200 Subject: [PATCH 20/20] Remove tabler comments. --- addons/attach/stringtable.xml | 3 +-- addons/captives/stringtable.xml | 3 +-- addons/dragging/stringtable.xml | 3 +-- addons/explosives/stringtable.xml | 3 +-- addons/interaction/stringtable.xml | 3 +-- addons/microdagr/stringtable.xml | 3 +-- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/addons/attach/stringtable.xml b/addons/attach/stringtable.xml index df8fc26c3c4..70ed9666b4f 100644 --- a/addons/attach/stringtable.xml +++ b/addons/attach/stringtable.xml @@ -1,5 +1,4 @@  - @@ -205,4 +204,4 @@ %1<br/>отсоединен(-а) - \ No newline at end of file + diff --git a/addons/captives/stringtable.xml b/addons/captives/stringtable.xml index 6e021143513..55a9f6211a9 100644 --- a/addons/captives/stringtable.xml +++ b/addons/captives/stringtable.xml @@ -1,5 +1,4 @@  - @@ -189,4 +188,4 @@ Niente selezionato - \ No newline at end of file + diff --git a/addons/dragging/stringtable.xml b/addons/dragging/stringtable.xml index 378ce353bda..521ab870064 100644 --- a/addons/dragging/stringtable.xml +++ b/addons/dragging/stringtable.xml @@ -1,5 +1,4 @@  - @@ -51,4 +50,4 @@ Нести - \ No newline at end of file + diff --git a/addons/explosives/stringtable.xml b/addons/explosives/stringtable.xml index 3299cb980c5..8e941b1f2a0 100644 --- a/addons/explosives/stringtable.xml +++ b/addons/explosives/stringtable.xml @@ -1,5 +1,4 @@  - @@ -503,4 +502,4 @@ Raccogli - \ No newline at end of file + diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index 41068c9e2d3..38902f80cf4 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -1,5 +1,4 @@  - @@ -735,4 +734,4 @@ Passeggeri - \ No newline at end of file + diff --git a/addons/microdagr/stringtable.xml b/addons/microdagr/stringtable.xml index 017ac9f0d54..91d83646b45 100644 --- a/addons/microdagr/stringtable.xml +++ b/addons/microdagr/stringtable.xml @@ -1,5 +1,4 @@  - @@ -280,4 +279,4 @@ Chiudi MicroDAGR - \ No newline at end of file +