Skip to content

Commit

Permalink
Circulation/Feedback/GUI/Hypothermia/Pharma - 3.0 Hotfix (#611)
Browse files Browse the repository at this point in the history
**When merged this pull request will:**
- _Describe what this pull request will do_
- _Each change in a separate line_

### IMPORTANT

- [Development Guidelines](https://ace3.acemod.org/wiki/development/)
are read, understood and applied.
- Title of this PR uses our standard template `Component -
Add|Fix|Improve|Change|Make|Remove {changes}`.
  • Loading branch information
mazinskihenry authored Oct 9, 2024
1 parent 3c0fc8a commit 6b4bd72
Show file tree
Hide file tree
Showing 19 changed files with 653 additions and 461 deletions.
12 changes: 7 additions & 5 deletions addons/circulation/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ PREP_RECOMPILE_START;
PREP_RECOMPILE_END;

if (isServer) then {
GVAR(bloodSampleMap) = createHashMap;
GVAR(sampleCounter) = 0;

GVAR(resultSampleMap) = createHashMap;
GVAR(resultCounter) = 0;
private _sampleMap = createHashMap;
missionNamespace setVariable [QGVAR(bloodSampleMap), _sampleMap];
missionNamespace setVariable [QGVAR(sampleCounter), 0];

private _resultSampleMap = createHashMap;
missionNamespace setVariable [QGVAR(resultSampleMap), _resultSampleMap];
missionNamespace setVariable [QGVAR(resultCounter), 0];
};

#define CBA_SETTINGS_CAT "KAT - ADV Medical: Circulation"
Expand Down
8 changes: 5 additions & 3 deletions addons/circulation/functions/fnc_addArterialApplyActions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ private _fnc_getActions = {
_idNumber = getNumber (_config >> "testID");

if (_idNumber > 0) then {
private _bloodTestArray = GVAR(resultSampleMap) get _idNumber;
private _patient = _bloodTestArray select 0;
private _resultSampleMap = missionNamespace getVariable [QEGVAR(circulation,resultSampleMap), []];
_resultSampleMap = _resultSampleMap get _idNumber;
_resultSampleMap = _resultSampleMap select 1;
private _patient = _resultSampleMap select 0;

_actions pushBack [
[
Expand All @@ -43,7 +45,7 @@ private _fnc_getActions = {
[]
] call ACEFUNC(interact_menu,createAction),
[],
[_bloodTestArray, _target, _idNumber, _player]
[_resultSampleMap, _target, _idNumber, _player]
];
};
} forEach ([_player, 0] call ACEFUNC(common,uniqueItems));
Expand Down
3 changes: 2 additions & 1 deletion addons/circulation/functions/fnc_addArterialTestActions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ private _fnc_getActions = {
_idNumber = getNumber (_config >> "nameID");

if (_idNumber > 0) then {
private _bloodSampleArray = GVAR(bloodSampleMap) get _idNumber;
private _bloodSampleArray = missionNamespace getVariable [QEGVAR(circulation,bloodSampleMap), []];
_bloodSampleArray = _bloodSampleArray get _idNumber;
private _patient = _bloodSampleArray select 0;

_actions pushBack [
Expand Down
12 changes: 9 additions & 3 deletions addons/circulation/functions/fnc_drawArterial.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ params ["_medic", "_patient"];

private _bloodGas = GET_BLOOD_GAS(_patient);

GVAR(sampleCounter) = [GVAR(sampleCounter) +1, 1] select (GVAR(sampleCounter) == 20);
GVAR(bloodSampleMap) set [GVAR(sampleCounter), [name(_patient), _bloodGas]];
private _sampleCounter = missionNamespace getVariable [QEGVAR(circulation,sampleCounter), 0];
private _bloodSampleMap = missionNamespace getVariable [QEGVAR(circulation,bloodSampleMap), []];

private _itemStr = format ["KAT_bloodSample_%1", GVAR(sampleCounter)];
_sampleCounter = [_sampleCounter +1, 1] select (_sampleCounter == 20);
missionNamespace setVariable [QEGVAR(circulation,sampleCounter), _sampleCounter, true];

_bloodSampleMap set [_sampleCounter, [name(_patient), _bloodGas]];
missionNamespace setVariable [QEGVAR(circulation,bloodSampleMap), _bloodSampleMap, true];

private _itemStr = format ["KAT_bloodSample_%1", _sampleCounter];

[_medic, _itemStr, true] call CBA_fnc_addItem;
2 changes: 2 additions & 0 deletions addons/circulation/functions/fnc_fullHealLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ _patient setVariable [QGVAR(tourniquetTime), [0,0,0,0,0,0]];
_patient setVariable [QGVAR(bloodGas), DEFAULT_BLOOD_GAS, true];
_patient setVariable [QGVAR(testedBloodGas), [0,0,0,0,0,0], true];

_patient setVariable [QGVAR(ABGmenuShow), false];

_patient setVariable [QGVAR(ht), [], true];
_patient setVariable [QGVAR(effusion), 0, true];

Expand Down
16 changes: 11 additions & 5 deletions addons/circulation/functions/fnc_showBloodGas.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,21 @@
params ["_entries"];
_entries params ["_bloodGas", "_player", "_idNumber", "_vehicle"];
_bloodGas params ["_patientName", "_bloodGasArray"];
_bloodGasArray params ["_paCO2", "_paO2", "_spO2", "_hCO2", "_pH", "_etCO2"];
_bloodGasArray params ["_paCO2", "_paO2", "_spO2", "_hCO3", "_pH", "_etCO2"];

private _output = format ["Patient: %1, PaCO2: %2, PaO2: %3, SpO2: %4, HCO2: %5, pH: %6", _patientName, _paCO2 toFixed 2, _paO2 toFixed 2, _spO2 toFixed 2, _hCO2 toFixed 2, _pH toFixed 2];
private _output = format ["Patient: %1, PaCO2: %2, PaO2: %3, SpO2: %4, HCO3: %5, pH: %6", _patientName, _paCO2 toFixed 2, _paO2 toFixed 2, _spO2 toFixed 2, _hCO3 toFixed 2, _pH toFixed 2];
[_output, 3, _player] call ACEFUNC(common,displayTextStructured);

GVAR(resultCounter) = if (GVAR(resultCounter) == 20) then { 1 } else { GVAR(resultCounter) + 1 };
GVAR(resultSampleMap) set [GVAR(resultCounter), [_patientName, _bloodGasArray]];
private _resultCounter = missionNamespace getVariable [QEGVAR(circulation,resultCounter), 0];
private _resultSampleMap = missionNamespace getVariable [QEGVAR(circulation,resultSampleMap), []];

private _itemStr = format ["KAT_bloodResult_%1",GVAR(resultCounter)];
_resultCounter = [_resultCounter +1, 1] select (_resultCounter == 20);
missionNamespace setVariable [QEGVAR(circulation,resultCounter), _resultCounter, true];

_resultSampleMap set [_resultCounter, [name(_patient), _bloodGas]];
missionNamespace setVariable [QEGVAR(circulation,resultSampleMap), _resultSampleMap, true];

private _itemStr = format ["KAT_bloodResult_%1", _resultCounter];

[_vehicle, (format ["KAT_bloodSample_%1",_idNumber])] call CBA_fnc_removeItemCargo;
[_player, _itemStr, true] call CBA_fnc_addItem;
2 changes: 1 addition & 1 deletion addons/feedback/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PREP_RECOMPILE_END;
"SLIDER",
[LLSTRING(SETTING_lowSpO2_display), LLSTRING(SETTING_lowSpO2_DESC)],
CBA_SETTINGS_CAT,
[0, 100, 90, 1],
[5, 100, 90, 1],
true
] call CBA_Settings_fnc_init;

Expand Down
2 changes: 2 additions & 0 deletions addons/gui/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
PREP(dumpBloodGas);
PREP(handleIVAdjust);
PREP(handleIVShow);
PREP(handleABGShow);
PREP(logListAppended);
PREP(menuPFH);
PREP(onMenuClose);
Expand Down
21 changes: 21 additions & 0 deletions addons/gui/functions/fnc_handleABGShow.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "..\script_component.hpp"
/*
* Author: Mazinksi
* Changes the visibility of the ABG Menu
*
* Arguments:
* 0: Target <OBJECT>
*
* Return Value:
* None
*
* Example:
* [_target] call kat_medical_gui_fnc_handleABGShow;
*
* Public: No
*/

params ["_target"];

private _ABGMenu = [true, false] select (_target getVariable [QEGVAR(pharma,ABGmenuShow), false]);
_target setVariable [QEGVAR(pharma,ABGmenuShow), _ABGMenu, true];
21 changes: 21 additions & 0 deletions addons/gui/functions/fnc_handleIVShow.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "..\script_component.hpp"
/*
* Author: Mazinksi
* Changes the visibility of the IV Menu
*
* Arguments:
* 0: Target <OBJECT>
*
* Return Value:
* None
*
* Example:
* [_target] call kat_medical_gui_fnc_handleIVShow;
*
* Public: No
*/

params ["_target"];

private _IVMenu = [true, false] select (_target getVariable [QEGVAR(pharma,IVmenuActive), false]);
_target setVariable [QEGVAR(pharma,IVmenuActive), _IVMenu, true];
4 changes: 4 additions & 0 deletions addons/gui/functions/fnc_onMenuOpen.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ if (GVAR(showPatientSideLabels)) then {
(_display displayCtrl IDC_SIDE_LABEL_RIGHT) ctrlShow true;
};

if ((missionNamespace getVariable [QEGVAR(pharma,RequireInsIV), false]) && (missionNamespace getVariable [QEGVAR(pharma,IVflowControl), false])) then {
ctrlShow [IDC_IV_FLOW_SHOWBUTTON, true];
};

// Set toggle button icon and tooltip
private _ctrl = _display displayCtrl IDC_TOGGLE;
if (ACEGVAR(medical_gui,target) == ACE_player) then {
Expand Down
29 changes: 24 additions & 5 deletions addons/gui/functions/fnc_updateABGStatus.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,34 @@ params ["_target"];
// Get tourniquets, damage, and blood loss for target
private _bloodGasTest = _target getVariable [QEGVAR(circulation,testedBloodGas), [0,0,0,0,0,0]];
private _activeBlood = 0;
private _ABGmenuShow = _target getVariable [QEGVAR(pharma,ABGmenuShow), false];

diag_log _ABGmenuShow;

if (_ABGmenuShow) then {
ctrlShow [IDC_ABG_TITLE, true];
ctrlShow [IDC_ABG_BACKGROUND, true];
ctrlShow [IDC_TEST_RESET, true];
} else {
ctrlShow [IDC_ABG_TITLE, false];
ctrlShow [IDC_ABG_BACKGROUND, false];
ctrlShow [IDC_TEST_RESET, false];
};

{
_x params ["_watchIDC"];

_activeBlood = _bloodGasTest select _forEachIndex;

if (_activeBlood != 0) then {
ctrlSetText [_watchIDC, (_activeBlood toFixed 2)];
if !(_ABGmenuShow) then {
ctrlShow [_x, false];
} else {
ctrlSetText [_watchIDC, "--.-"];
ctrlShow [_x, true];
_activeBlood = _bloodGasTest select _forEachIndex;

if (_activeBlood != 0) then {
ctrlSetText [_watchIDC, (_activeBlood toFixed 2)];
} else {
ctrlSetText [_watchIDC, "--.-"];
};
};

} forEach [IDC_TEST_PACO2, IDC_TEST_PAO2, IDC_TEST_SPO2, IDC_TEST_HCO3, IDC_TEST_PH];
21 changes: 21 additions & 0 deletions addons/gui/functions/fnc_updateIVStatus.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,26 @@ params ["_target"];
// Get tourniquets, damage, and blood loss for target
private _IV = _target getVariable [QEGVAR(pharma,IV), [0,0,0,0,0,0]];
private _ivFlow = _target getVariable [QEGVAR(pharma,IVflow), [0,0,0,0,0,0]];
private _ivMenuShow = _target getVariable [QEGVAR(pharma,IVmenuActive), false];

if (_ivMenuShow) then {
ctrlShow [IDC_IV_FLOW_BACKGROUND, true];
ctrlShow [IDC_IV_FLOW_TITLE, true];
} else {
ctrlShow [IDC_IV_FLOW_BACKGROUND, false];
ctrlShow [IDC_IV_FLOW_TITLE, false];
};

{
_x params ["_coverIDC", "_titleIDC", "_typeIDC", "_valueIDC", "_buttonIDCArray", "_bodyPartN"];

private _activeIV = _IV select _bodyPartN;
private _activeFlow = _ivFlow select _bodyPartN;

if !(_ivMenuShow) then {
_activeIV = -1;
};

switch (true) do {
case (_activeIV == 0): {
ctrlShow [_coverIDC, true];
Expand Down Expand Up @@ -58,6 +71,14 @@ private _ivFlow = _target getVariable [QEGVAR(pharma,IVflow), [0,0,0,0,0,0]];
ctrlSetText [_typeIDC, "IV"];
ctrlSetText [_valueIDC, (_activeFlow toFixed 1)];
};
case (_activeIV == -1): {
ctrlShow [_coverIDC, false];
ctrlShow [_titleIDC, false];
ctrlShow [_typeIDC, false];
ctrlShow [_valueIDC, false];
_buttonIDCArray apply {ctrlShow [_x, false]};
_buttonIDCArray apply {ctrlEnable [_x, false]};
};
};
} forEach [
[IDC_IV_FLOW_HEADCOVER, IDC_IV_FLOW_HEADTITLE, IDC_IV_FLOW_HEADTYPE, IDC_IV_FLOW_HEADIV_VALUE, [IDC_IV_FLOW_HEADSUBTRACTFULL, IDC_IV_FLOW_HEADSUBTRACT, IDC_IV_FLOW_HEADADD, IDC_IV_FLOW_HEADADDFULL], 0],
Expand Down
Loading

0 comments on commit 6b4bd72

Please sign in to comment.