diff --git a/addons/medical/config.cpp b/addons/medical/config.cpp
index 0ba99d21f1..e3557fab40 100644
--- a/addons/medical/config.cpp
+++ b/addons/medical/config.cpp
@@ -6,7 +6,7 @@ class CfgPatches {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
- requiredAddons[] = {"ace_common"};
+ requiredAddons[] = {"ace_medical_engine"};
author = ECSTRING(common,ACETeam);
authors[] = {"Glowbal", "KoffeinFlummi","Arcanum417"};
url = ECSTRING(main,URL);
diff --git a/addons/medical/dev/watchVariable.sqf b/addons/medical/dev/watchVariable.sqf
index 1c2e5eba71..0e39cae4cd 100644
--- a/addons/medical/dev/watchVariable.sqf
+++ b/addons/medical/dev/watchVariable.sqf
@@ -27,10 +27,13 @@
// Blood:
private _bloodVolume = GET_BLOOD_VOLUME(_unit);
+ private _woundBleeding = GET_WOUND_BLEEDING(_unit);
private _bloodLoss = GET_BLOOD_LOSS(_unit);
- private _secondsToHeartstop = if (_bloodLoss != 0) then {format ["[Time Left: %1 sec]", (((_bloodVolume - BLOOD_VOLUME_CLASS_4_HEMORRHAGE) max 0) / _bloodLoss) toFixed 1]} else {""};
- _return pushBack format ["Blood: %1", _bloodVolume toFixed 3];
- _return pushBack format [" - [Loss: %1] %2", _bloodLoss toFixed 5, _secondsToHeartstop];
+ private _hemorrhage = GET_HEMORRHAGE(_unit);
+ private _isBleeding = if (IS_BLEEDING(_unit)) then {"Bleeding"} else {""};
+ private _secondsToHeartstop = if (_bloodLoss != 0) then {format ["[Time Left: %1 sec]", (((_bloodVolume - BLOOD_VOLUME_CLASS_4_HEMORRHAGE) max 0) / _bloodLoss) toFixed 0]} else {""};
+ _return pushBack format ["Blood: %1 [Hemorrhage: %2] %3", _bloodVolume toFixed 3, _hemorrhage, _isBleeding];
+ _return pushBack format [" - [W: %1 T: %2] %3", _woundBleeding toFixed 4, _bloodLoss toFixed 4, _secondsToHeartstop];
// Heart:
private _cardiacOutput = [_unit] call EFUNC(medical_status,getCardiacOutput);
@@ -43,15 +46,19 @@
private _pain = GET_PAIN(_unit);
private _painSuppress = GET_PAIN_SUPPRESS(_unit);
private _painLevel = GET_PAIN_PERCEIVED(_unit);
- _return pushBack format ["Effective Pain: %1", _painLevel toFixed 3];
+ private _isInPain = IS_IN_PAIN(_unit);
+ _return pushBack format ["Effective Pain: %1 [%2]", _painLevel toFixed 3, _isInPain];
_return pushBack format [" - [Pain: %1] [Suppress: %2]", _pain toFixed 3, _painSuppress toFixed 3];
// Damage:
private _damage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
private _limping = if (_unit getVariable [QEGVAR(medical,isLimping), false]) then {"[ Limping ]"} else {""};
- _return pushBack format ["Damage: [H: %1] [B: %2] %3", (_damage select 0) toFixed 2, (_damage select 1) toFixed 2, _limping];
+ _return pushBack format ["Damage: [H: %1] [B: %2] %3", (_damage select 0) toFixed 2, (_damage select 1) toFixed 2];
_return pushBack format ["[LA:%1] [RA: %2] [LL:%3] [RL: %4]", (_damage select 2) toFixed 2, (_damage select 3) toFixed 2, (_damage select 4) toFixed 2, (_damage select 5) toFixed 2];
+ _return pushBack format ["Hitpoints: [HHed:%1] [HBod: %2]", (_unit getHitPointDamage "HitHead") toFixed 2, (_unit getHitPointDamage "HitBody") toFixed 2];
+ _return pushBack format ["[HHnd:%1] [HLeg: %2] %3", (_unit getHitPointDamage "HitHands") toFixed 2, (_unit getHitPointDamage "HitLegs") toFixed 2, _limping];
+
// Tourniquets:
_return pushBack "------- Tourniquets: -------";
@@ -79,6 +86,21 @@
_return pushBack format ["%1: [%2-%3] [x%4] [Bld: %5] [Dmg: %6]", ALL_SELECTIONS select _xBodyPartN, _xClassID, _xCategory, _xAmountOf toFixed 1, _xBleeding toFixed 4, _xDamage toFixed 2];
} forEach _wounds;
+ // Bandaged Wounds:
+ _return pushBack "------- Bandaged Wounds: -------";
+ private _wounds = _unit getVariable [QEGVAR(medical,bandagedWounds), []];
+ {
+ _x params ["", "_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage", "_xCategory"];
+ _return pushBack format ["%1: [%2-%3] [x%4] [Bld: %5] [Dmg: %6]", ALL_SELECTIONS select _xBodyPartN, _xClassID, _xCategory, _xAmountOf toFixed 1, _xBleeding toFixed 4, _xDamage toFixed 2];
+ } forEach _wounds;
+
+ // Stitched Wounds:
+ _return pushBack "------- Stitched Wounds: -------";
+ private _wounds = _unit getVariable [QEGVAR(medical,stitchedWounds), []];
+ {
+ _x params ["", "_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage", "_xCategory"];
+ _return pushBack format ["%1: [%2-%3] [x%4] [Bld: %5] [Dmg: %6]", ALL_SELECTIONS select _xBodyPartN, _xClassID, _xCategory, _xAmountOf toFixed 1, _xBleeding toFixed 4, _xDamage toFixed 2];
+ } forEach _wounds;
// IVs:
_return pushBack "------- IVs: -------";
@@ -88,10 +110,39 @@
_return pushBack format ["%1: %2 [%3 ml]", ALL_SELECTIONS select _xBodyPartN, _xType, _xVolumeAdded];
} forEach _ivBags;
+ // Medications:
+ _return pushBack "------- Medications: -------";
+ private _hrTargetAdjustment = 0;
+ private _painSupressAdjustment = 0;
+ private _peripheralResistanceAdjustment = 0;
+ private _medicationCounts = [];
+ private _rawMedications = (_unit getVariable [VAR_MEDICATIONS, []]) apply {
+ _x params ["_medication", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust"];
+ private _timeInSystem = CBA_missionTime - _timeAdded;
+ private _index = _medicationCounts find _medication;
+ if (_index < 0) then {
+ _index = _medicationCounts pushBack _medication;
+ _medicationCounts pushBack 0
+ };
+ _medicationCounts set [(_index + 1), (_medicationCounts select (_index + 1)) + linearConversion [_timeTillMaxEffect, _maxTimeInSystem, _timeInSystem, 1, 0, true]];
+
+ private _effectRatio = (((_timeInSystem / _timeTillMaxEffect) ^ 2) min 1) * (_maxTimeInSystem - _timeInSystem) / _maxTimeInSystem;
+ _hrTargetAdjustment = _hrTargetAdjustment + _hrAdjust * _effectRatio;
+ _painSupressAdjustment = _painSupressAdjustment + _painAdjust * _effectRatio;
+ _peripheralResistanceAdjustment = _peripheralResistanceAdjustment + _flowAdjust * _effectRatio;
+ format ["%1 [%2 / %3][%4][%5,%6,%7]",_medication,_timeInSystem toFixed 0,_maxTimeInSystem toFixed 0, _effectRatio toFixed 2, _hrAdjust toFixed 1, _painAdjust toFixed 2, _flowAdjust toFixed 1];
+ };
+ _return pushBack format ["Adjusts: [HR %1][PS %2][PR %3]", _hrTargetAdjustment toFixed 2, _painSupressAdjustment toFixed 2, _peripheralResistanceAdjustment toFixed 2];
+ for "_i" from 0 to (count _medicationCounts) - 1 step 2 do {
+ _return pushBack format ["-%1: %2", _medicationCounts select _i, _medicationCounts select _i + 1];
+ };
+ _return pushBack "------- Medications Raw: -------";
+ _return append _rawMedications;
+
// Footer:
_return pushBack "";
// Return:
_return joinString "
"
-}, [30]] call EFUNC(common,watchVariable);
+}, [40]] call EFUNC(common,watchVariable);
diff --git a/addons/medical/functions/fnc_addDamageToUnit.sqf b/addons/medical/functions/fnc_addDamageToUnit.sqf
index e78326a1f4..cde34b31d6 100644
--- a/addons/medical/functions/fnc_addDamageToUnit.sqf
+++ b/addons/medical/functions/fnc_addDamageToUnit.sqf
@@ -23,7 +23,7 @@
// #define DEBUG_TESTRESULTS
params [["_unit", objNull, [objNull]], ["_damageToAdd", -1, [0]], ["_bodyPart", "", [""]], ["_typeOfDamage", "", [""]], ["_instigator", objNull, [objNull]]];
-TRACE_5("params",_unit,_damageToAdd,_bodyPart,_typeOfDamage,_instigator);
+TRACE_5("addDamageToUnit",_unit,_damageToAdd,_bodyPart,_typeOfDamage,_instigator);
private _bodyPartIndex = ALL_BODY_PARTS find (toLower _bodyPart);
if (isNull _unit || {!local _unit} || {!alive _unit}) exitWith {ERROR_1("addDamageToUnit - badUnit %1", _this); false};
diff --git a/addons/medical/script_component.hpp b/addons/medical/script_component.hpp
index d29a19b332..1abe143393 100644
--- a/addons/medical/script_component.hpp
+++ b/addons/medical/script_component.hpp
@@ -14,5 +14,5 @@
#define DEBUG_SETTINGS DEBUG_SETTINGS_MEDICAL
#endif
-#include "\z\ace\addons\main\script_macros.hpp"
#include "\z\ace\addons\medical_engine\script_macros_medical.hpp"
+#include "\z\ace\addons\main\script_macros.hpp"
diff --git a/addons/medical_ai/script_component.hpp b/addons/medical_ai/script_component.hpp
index 53ffcf20ba..006c21ac2a 100644
--- a/addons/medical_ai/script_component.hpp
+++ b/addons/medical_ai/script_component.hpp
@@ -14,5 +14,5 @@
#define DEBUG_SETTINGS DEBUG_SETTINGS_MEDICAL_AI
#endif
-#include "\z\ace\addons\main\script_macros.hpp"
#include "\z\ace\addons\medical_engine\script_macros_medical.hpp"
+#include "\z\ace\addons\main\script_macros.hpp"
diff --git a/addons/medical_blood/script_component.hpp b/addons/medical_blood/script_component.hpp
index c7bf8fb91e..ef72e2fdd5 100644
--- a/addons/medical_blood/script_component.hpp
+++ b/addons/medical_blood/script_component.hpp
@@ -14,8 +14,8 @@
#define DEBUG_SETTINGS DEBUG_SETTINGS_MEDICAL_BLOOD
#endif
-#include "\z\ace\addons\main\script_macros.hpp"
#include "\z\ace\addons\medical_engine\script_macros_medical.hpp"
+#include "\z\ace\addons\main\script_macros.hpp"
#define MAX_BLOOD_OBJECTS 500
#define BLOOD_OBJECT_LIFETIME 900
diff --git a/addons/medical_damage/functions/fnc_woundsHandler.sqf b/addons/medical_damage/functions/fnc_woundsHandler.sqf
index 262715a59b..68e43f2c36 100644
--- a/addons/medical_damage/functions/fnc_woundsHandler.sqf
+++ b/addons/medical_damage/functions/fnc_woundsHandler.sqf
@@ -129,6 +129,8 @@ private _bodyPartVisParams = [_unit, false, false, false, false]; // params arra
_unit setVariable [QEGVAR(medical,openWounds), _openWounds, true];
_unit setVariable [QEGVAR(medical,bodyPartDamage), _bodyPartDamage, true];
+[_unit] call EFUNC(medical_status,updateWoundBloodLoss);
+
_bodyPartVisParams call EFUNC(medical_engine,updateBodyPartVisuals);
[QEGVAR(medical,injured), [_unit, _painLevel]] call CBA_fnc_localEvent;
diff --git a/addons/medical_damage/functions/fnc_woundsHandlerSQF.sqf b/addons/medical_damage/functions/fnc_woundsHandlerSQF.sqf
index 6071f64a2f..88c70538a8 100644
--- a/addons/medical_damage/functions/fnc_woundsHandlerSQF.sqf
+++ b/addons/medical_damage/functions/fnc_woundsHandlerSQF.sqf
@@ -180,6 +180,8 @@ private _woundsCreated = [];
_unit setVariable [QEGVAR(medical,openWounds), _openWounds, true];
_unit setVariable [QEGVAR(medical,bodyPartDamage), _bodyPartDamage, true];
+[_unit] call EFUNC(medical_status,updateWoundBloodLoss);
+
_bodyPartVisParams call EFUNC(medical_engine,updateBodyPartVisuals);
[QEGVAR(medical,injured), [_unit, _painLevel]] call CBA_fnc_localEvent;
diff --git a/addons/medical_damage/script_component.hpp b/addons/medical_damage/script_component.hpp
index f96a81d378..c567aeeae7 100644
--- a/addons/medical_damage/script_component.hpp
+++ b/addons/medical_damage/script_component.hpp
@@ -14,5 +14,5 @@
#define DEBUG_SETTINGS DEBUG_SETTINGS_MEDICAL_DAMAGE
#endif
-#include "\z\ace\addons\main\script_macros.hpp"
#include "\z\ace\addons\medical_engine\script_macros_medical.hpp"
+#include "\z\ace\addons\main\script_macros.hpp"
diff --git a/addons/medical_engine/script_component.hpp b/addons/medical_engine/script_component.hpp
index d45c30a024..dbe6e2a2cb 100644
--- a/addons/medical_engine/script_component.hpp
+++ b/addons/medical_engine/script_component.hpp
@@ -14,8 +14,8 @@
#define DEBUG_SETTINGS DEBUG_SETTINGS_MEDICAL_ENGINE
#endif
-#include "\z\ace\addons\main\script_macros.hpp"
#include "\z\ace\addons\medical_engine\script_macros_medical.hpp"
+#include "\z\ace\addons\main\script_macros.hpp"
#include "\z\ace\addons\medical_engine\script_macros_config.hpp"
#define PRELOAD_CLASS(class) \
diff --git a/addons/medical_engine/script_macros_medical.hpp b/addons/medical_engine/script_macros_medical.hpp
index e1687126ac..8e38faa455 100644
--- a/addons/medical_engine/script_macros_medical.hpp
+++ b/addons/medical_engine/script_macros_medical.hpp
@@ -1,3 +1,7 @@
+// #define DEBUG_MODE_FULL
+// #define DISABLE_COMPILE_CACHE
+// #define ENABLE_PERFORMANCE_COUNTERS
+
#define ALL_BODY_PARTS ["head", "body", "leftarm", "rightarm", "leftleg", "rightleg"]
#define ALL_SELECTIONS ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]
@@ -108,6 +112,7 @@
// Defined here for easy consistency with GETVAR/SETVAR (also a list for reference)
#define VAR_BLOOD_PRESS QEGVAR(medical,bloodPressure)
#define VAR_BLOOD_VOL QEGVAR(medical,bloodVolume)
+#define VAR_WOUND_BLEEDING QEGVAR(medical,woundBleeding)
#define VAR_CRDC_ARRST QEGVAR(medical,inCardiacArrest)
#define VAR_HEART_RATE QEGVAR(medical,heartRate)
#define VAR_PAIN QEGVAR(medical,pain)
@@ -115,13 +120,10 @@
#define VAR_PERIPH_RES QEGVAR(medical,peripheralResistance)
#define VAR_UNCON "ACE_isUnconscious"
// These variables track gradual adjustments (from medication, etc.)
-#define VAR_HEART_RATE_ADJ QEGVAR(medical,heartRateAdjustments)
-#define VAR_PAIN_SUPP_ADJ QEGVAR(medical,painSuppressAdjustments)
-#define VAR_PERIPH_RES_ADJ QEGVAR(medical,peripheralResistanceAdjustments)
+#define VAR_MEDICATIONS QEGVAR(medical,medications)
// These variables track the current state of status values above
#define VAR_HEMORRHAGE QEGVAR(medical,hemorrhage)
#define VAR_IN_PAIN QEGVAR(medical,inPain)
-#define VAR_IS_BLEEDING QEGVAR(medical,isBleeding)
#define VAR_TOURNIQUET QEGVAR(medical,tourniquets)
@@ -129,13 +131,14 @@
// Retrieval macros for common unit values
// Defined for easy consistency and speed
#define GET_BLOOD_VOLUME(unit) (unit getVariable [VAR_BLOOD_VOL,DEFAULT_BLOOD_VOLUME])
+#define GET_WOUND_BLEEDING(unit) (unit getVariable [VAR_WOUND_BLEEDING,0])
#define GET_HEART_RATE(unit) (unit getVariable [VAR_HEART_RATE,DEFAULT_HEART_RATE])
#define GET_HEMORRHAGE(unit) (unit getVariable [VAR_HEMORRHAGE,0])
#define GET_PAIN(unit) (unit getVariable [VAR_PAIN,0])
#define GET_PAIN_SUPPRESS(unit) (unit getVariable [VAR_PAIN_SUPP,0])
#define GET_TOURNIQUETS(unit) (unit getVariable [VAR_TOURNIQUET, DEFAULT_TOURNIQUET_VALUES])
#define IN_CRDC_ARRST(unit) (unit getVariable [VAR_CRDC_ARRST,false])
-#define IS_BLEEDING(unit) (unit getVariable [VAR_IS_BLEEDING,false])
+#define IS_BLEEDING(unit) (GET_WOUND_BLEEDING(unit) > 0)
#define IS_IN_PAIN(unit) (unit getVariable [VAR_IN_PAIN,false])
#define IS_UNCONSCIOUS(unit) (unit getVariable [VAR_UNCON,false])
diff --git a/addons/medical_feedback/script_component.hpp b/addons/medical_feedback/script_component.hpp
index a082cd3d50..e39fa42c8b 100644
--- a/addons/medical_feedback/script_component.hpp
+++ b/addons/medical_feedback/script_component.hpp
@@ -14,8 +14,8 @@
#define DEBUG_SETTINGS DEBUG_SETTINGS_MEDICAL_FEEDBACK
#endif
-#include "\z\ace\addons\main\script_macros.hpp"
#include "\z\ace\addons\medical_engine\script_macros_medical.hpp"
+#include "\z\ace\addons\main\script_macros.hpp"
#define EMPTY_SOUND {"A3\Sounds_F\dummysound.wss",1,1}
#define NAMESPACE_NULL locationNull
diff --git a/addons/medical_gui/script_component.hpp b/addons/medical_gui/script_component.hpp
index f87ebc8bc9..a1c8fb6a8d 100644
--- a/addons/medical_gui/script_component.hpp
+++ b/addons/medical_gui/script_component.hpp
@@ -14,8 +14,8 @@
#define DEBUG_SETTINGS DEBUG_SETTINGS_MEDICAL_GUI
#endif
-#include "\z\ace\addons\main\script_macros.hpp"
#include "\z\ace\addons\medical_engine\script_macros_medical.hpp"
+#include "\z\ace\addons\main\script_macros.hpp"
#include "\a3\ui_f\hpp\defineResincl.inc"
#include "\a3\ui_f\hpp\defineDIKCodes.inc"
diff --git a/addons/medical_statemachine/script_component.hpp b/addons/medical_statemachine/script_component.hpp
index 1553911601..fbde60be72 100644
--- a/addons/medical_statemachine/script_component.hpp
+++ b/addons/medical_statemachine/script_component.hpp
@@ -14,5 +14,5 @@
#define DEBUG_SETTINGS DEBUG_SETTINGS_MEDICAL_STATEMACHINE
#endif
-#include "\z\ace\addons\main\script_macros.hpp"
#include "\z\ace\addons\medical_engine\script_macros_medical.hpp"
+#include "\z\ace\addons\main\script_macros.hpp"
diff --git a/addons/medical_status/XEH_PREP.hpp b/addons/medical_status/XEH_PREP.hpp
index 3b74368c2a..32e02d18c8 100644
--- a/addons/medical_status/XEH_PREP.hpp
+++ b/addons/medical_status/XEH_PREP.hpp
@@ -1,4 +1,4 @@
-PREP(addHeartRateAdjustment);
+PREP(addMedicationAdjustment);
PREP(adjustPainLevel);
PREP(getBloodLoss);
PREP(getBloodPressure);
@@ -12,3 +12,4 @@ PREP(isInStableCondition);
PREP(setCardiacArrest);
PREP(setDead);
PREP(setUnconscious);
+PREP(updateWoundBloodLoss);
diff --git a/addons/medical_status/functions/fnc_addHeartRateAdjustment.sqf b/addons/medical_status/functions/fnc_addHeartRateAdjustment.sqf
deleted file mode 100644
index 39b65a4ead..0000000000
--- a/addons/medical_status/functions/fnc_addHeartRateAdjustment.sqf
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "script_component.hpp"
-/*
- * Author: BaerMitUmlaut
- * Adds a heart rate adjustment that will take effect over time.
- *
- * Arguments:
- * 0: The Unit