From 294e5a0d0fcd611bbb6c80071ea508d1d69f4690 Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 30 Sep 2016 16:04:05 +0200 Subject: [PATCH 1/2] add a factor to scale fatigue up and downhill --- .../functions/fnc_getMetabolicCosts.sqf | 16 ++++++++++++---- addons/advanced_fatigue/script_component.hpp | 4 ++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/addons/advanced_fatigue/functions/fnc_getMetabolicCosts.sqf b/addons/advanced_fatigue/functions/fnc_getMetabolicCosts.sqf index fd2234d1f20..cbc6acc04d9 100644 --- a/addons/advanced_fatigue/functions/fnc_getMetabolicCosts.sqf +++ b/addons/advanced_fatigue/functions/fnc_getMetabolicCosts.sqf @@ -16,7 +16,7 @@ * Public: No */ #include "script_component.hpp" -params ["_unit", "_velocity"]; +params ["_unit", "_speed"]; private _virtualLoad = 0; { @@ -32,6 +32,14 @@ private _gearMass = ((loadAbs _unit + _virtualLoad) * 0.1 / 2.2046) * GVAR(loadF private _terrainFactor = 1; private _terrainAngle = asin (1 - ((surfaceNormal getPosASL _unit) select 2)); private _terrainGradient = (_terrainAngle / 45 min 1) * 5 * GVAR(terrainGradientFactor); +private _terrainAltitude = getPosASL _unit; +private _terrainAltitudeDelta = getTerrainHeightASL _terrainAltitude - getTerrainHeightASL (_terrainAltitude vectorDiff vectorNormalized velocity _unit); +private _terrainAltitudeFactor = 2 * abs _terrainAltitudeDelta min 1; + +if (_terrainAltitudeDelta < -0.1) then { + _terrainAltitudeFactor = _terrainAltitudeFactor / 4; +}; + private _duty = GVAR(animDuty); { @@ -46,16 +54,16 @@ if (GVAR(isSwimming)) then { _terrainGradient = 0; }; -if (_velocity > 2) then { +if (_speed > 2) then { ( 2.10 * SIM_BODYMASS + 4 * (SIM_BODYMASS + _gearMass) * ((_gearMass / SIM_BODYMASS) ^ 2) - + _terrainFactor * (SIM_BODYMASS + _gearMass) * (0.90 * (_velocity ^ 2) + 0.66 * _velocity * _terrainGradient) + + _terrainFactor * (SIM_BODYMASS + _gearMass) * (0.90 * (_speed ^ 2) + 0.66 * _speed * _terrainGradient * _terrainAltitudeFactor) ) * 0.23 * _duty } else { ( 1.05 * SIM_BODYMASS + 4 * (SIM_BODYMASS + _gearMass) * ((_gearMass / SIM_BODYMASS) ^ 2) - + _terrainFactor * (SIM_BODYMASS + _gearMass) * (1.15 * (_velocity ^ 2) + 0.66 * _velocity * _terrainGradient) + + _terrainFactor * (SIM_BODYMASS + _gearMass) * (1.15 * (_speed ^ 2) + 0.66 * _speed * _terrainGradient * _terrainAltitudeFactor) ) * 0.23 * _duty }; diff --git a/addons/advanced_fatigue/script_component.hpp b/addons/advanced_fatigue/script_component.hpp index bed86c1be85..100447c66ab 100644 --- a/addons/advanced_fatigue/script_component.hpp +++ b/addons/advanced_fatigue/script_component.hpp @@ -2,8 +2,8 @@ #define COMPONENT_BEAUTIFIED Advanced Fatigue #include "\z\ace\addons\main\script_mod.hpp" -// #define DEBUG_MODE_FULL -// #define DISABLE_COMPILE_CACHE +#define DEBUG_MODE_FULL +#define DISABLE_COMPILE_CACHE // #define CBA_DEBUG_SYNCHRONOUS // #define ENABLE_PERFORMANCE_COUNTERS From ea5072600794261cea88d1549d1700895c25798b Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 30 Sep 2016 16:12:54 +0200 Subject: [PATCH 2/2] turn off debug mode --- addons/advanced_fatigue/script_component.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/advanced_fatigue/script_component.hpp b/addons/advanced_fatigue/script_component.hpp index 100447c66ab..bed86c1be85 100644 --- a/addons/advanced_fatigue/script_component.hpp +++ b/addons/advanced_fatigue/script_component.hpp @@ -2,8 +2,8 @@ #define COMPONENT_BEAUTIFIED Advanced Fatigue #include "\z\ace\addons\main\script_mod.hpp" -#define DEBUG_MODE_FULL -#define DISABLE_COMPILE_CACHE +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE // #define CBA_DEBUG_SYNCHRONOUS // #define ENABLE_PERFORMANCE_COUNTERS