Use macros for hemorrhage class tracking

This commit is contained in:
SilentSpike 2018-05-22 18:25:07 +01:00
parent c9e11e62a1
commit de2d7f2fb8
7 changed files with 19 additions and 23 deletions

View File

@ -72,9 +72,10 @@
// These variables track gradual adjustments (from medication, etc.)
#define VAR_HEART_RATE_ADJ QEGVAR(medical,heartRateAdjustments)
#define VAR_PAIN_SUPP_ADJ QEGVAR(medical,painSuppressAdjustments)
// These variables track the current state of status values
#define VAR_IN_PAIN QEGVAR(medical,inPain)
#define VAR_IS_BLEEDING QEGVAR(medical,isBleeding)
// 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)
// - Unit Functions ---------------------------------------------------
@ -82,6 +83,7 @@
// Defined for easy consistency and speed
#define GET_BLOOD_VOLUME(unit) (GETVAR(unit,VAR_BLOOD_VOL,DEFAULT_BLOOD_VOLUME))
#define GET_HEART_RATE(unit) (GETVAR(unit,VAR_HEART_RATE,DEFAULT_HEART_RATE))
#define GET_HEMORRHAGE(unit) (GETVAR(unit,VAR_HEMORRHAGE,0))
#define GET_PAIN(unit) (GETVAR(unit,VAR_PAIN,0))
#define GET_PAIN_SUPPRESS(unit) (GETVAR(unit,VAR_PAIN_SUPP,0))
#define IN_CRDC_ARRST(unit) (GETVAR(unit,VAR_CRDC_ARRST,false))

View File

@ -55,7 +55,7 @@ if (_show == 1) then {
if IS_BLEEDING(_target) then {
_genericMessages pushback [localize ELSTRING(medical,Status_Bleeding), [1, 0.1, 0.1, 1]];
};
if (_target getVariable[QEGVAR(medical,hasLostBlood), 0] > 1) then {
if (GET_HEMORRHAGE(_target) > 1) then {
_genericMessages pushback [localize ELSTRING(medical,Status_Lost_Blood), [1, 0.1, 0.1, 1]];
};

View File

@ -31,7 +31,7 @@ if IS_BLEEDING(_target) then {
_genericMessages pushBack [localize ELSTRING(medical,Status_Bleeding), [1, 0.1, 0.1, 1]];
};
if (_target getVariable [QEGVAR(medical,hasLostBlood), 0] > 1) then {
if (GET_HEMORRHAGE(_target) > 1) then {
_genericMessages pushBack [localize ELSTRING(medical,Status_Lost_Blood), [1, 0.1, 0.1, 1]];
};

View File

@ -29,7 +29,7 @@ _unit setVariable [VAR_BLOOD_PRESS, [80, 120], true];
_unit setVariable [QGVAR(peripheralResistance), 100, true];
_unit setVariable [QGVAR(peripheralResistanceAdjustments), [], true];
_unit setVariable [VAR_CRDC_ARRST, false, true];
_unit setVariable [QGVAR(hasLostBlood), 0, true];
_unit setVariable [VAR_HEMORRHAGE, 0, true];
_unit setVariable [VAR_IS_BLEEDING, false, true];
// - Pain ---------------------------------------------------------------------

View File

@ -23,8 +23,9 @@ if (alive _target) then {
_genericMessages pushBack ELSTRING(medical,diagnoseDead);
};
if (_target getVariable [QEGVAR(medical,hasLostBlood), 0] > 0) then {
if (_target getVariable [QEGVAR(medical,hasLostBlood), 0] > 1) then {
private _hemorrhage = GET_HEMORRHAGE(_target);
if (_hemorrhage > 0) then {
if (_hemorrhage > 1) then {
_genericMessages pushBack ELSTRING(medical,lostBloodALot);
} else {
_genericMessages pushBack ELSTRING(medical,lostBlood);

View File

@ -49,7 +49,7 @@ _target setVariable [QEGVAR(medical,bodyPartStatus), [0,0,0,0,0,0], true];
// generic medical admin
_target setVariable [VAR_CRDC_ARRST, false, true];
_target setVariable [VAR_UNCON, false, true];
_target setVariable [QEGVAR(medical,hasLostBlood), 0, true];
_target setVariable [VAR_HEMORRHAGE, 0, true];
_target setVariable [VAR_IS_BLEEDING, false, true];
_target setVariable [VAR_IN_PAIN, false, true];
_target setVariable [VAR_PAIN_SUPP, 0, true];

View File

@ -39,20 +39,13 @@ _bloodVolume = 0 max _bloodVolume min DEFAULT_BLOOD_VOLUME;
_unit setVariable [VAR_BLOOD_VOL, _bloodVolume, _syncValues];
// Set variables for synchronizing information across the net
if (_bloodVolume < BLOOD_VOLUME_CLASS_1_HEMORRHAGE) then {
if (_bloodVolume < BLOOD_VOLUME_CLASS_3_HEMORRHAGE) then {
if (_unit getVariable [QGVAR(hasLostBlood), 0] != 2) then {
_unit setVariable [QGVAR(hasLostBlood), 2, true];
};
} else {
if (_unit getVariable [QGVAR(hasLostBlood), 0] != 1) then {
_unit setVariable [QGVAR(hasLostBlood), 1, true];
};
};
} else {
if (_unit getVariable [QGVAR(hasLostBlood), 0] != 0) then {
_unit setVariable [QGVAR(hasLostBlood), 0, true];
};
private _hemorrhage = [
0,
[1, 3] select (_bloodVolume < BLOOD_VOLUME_CLASS_3_HEMORRHAGE)
] select (_bloodVolume < BLOOD_VOLUME_CLASS_1_HEMORRHAGE);
if (_hemorrhage != GET_HEMORRHAGE(_unit)) then {
_unit setVariable [VAR_HEMORRHAGE, _hemorrhageClass, true];
};
private _bloodLoss = GET_BLOOD_LOSS(_unit);