2018-07-30 09:22:14 +00:00
#include "script_component.hpp"
2016-07-15 10:23:26 +00:00
/*
* Author: Glowbal
* Update all UI information in the medical menu
*
* Arguments:
* 0: target <OBJECT>
* 1: display <DISPLAY>
*
* Return Value:
* None
*
* Example:
* [some_player, some_display] call ace_medical_menu_fnc_updateUIInfo
*
* Public: No
*/
params ["_target", "_display"];
if (isNil "_display" || {isNull _display}) exitWith {ERROR("No display");};
2016-12-05 20:34:20 +00:00
private _selectionN = GVAR(selectedBodyPart);
2016-07-15 10:23:26 +00:00
if (_selectionN < 0 || {_selectionN > 5}) exitWith {};
2016-12-05 20:34:20 +00:00
private _genericMessages = [];
2018-08-02 08:43:31 +00:00
private _partText = [ELSTRING(medical_gui,Head), ELSTRING(medical_gui,Torso), ELSTRING(medical_gui,Arm_L), ELSTRING(medical_gui,Arm_R), ELSTRING(medical_gui,Leg_L), ELSTRING(medical_gui,Leg_R)] select _selectionN;
2016-07-15 10:23:26 +00:00
_genericMessages pushBack [localize _partText, [1, 1, 1, 1]];
2018-05-22 17:06:28 +00:00
if IS_BLEEDING(_target) then {
2018-07-29 21:16:06 +00:00
_genericMessages pushBack [LLSTRING(Status_Bleeding), [1, 0.1, 0.1, 1]];
2016-07-15 10:23:26 +00:00
};
2018-07-25 17:42:53 +00:00
// Give a qualitative description of the blood volume lost
switch (GET_HEMORRHAGE(_target)) do {
case 1: {
2018-07-25 10:40:37 +00:00
_genericMessages pushBack [LLSTRING(Lost_Blood1), [1, 0.1, 0.1, 1]];
2018-07-18 19:38:00 +00:00
};
2018-07-25 17:42:53 +00:00
case 2: {
_genericMessages pushBack [LLSTRING(Lost_Blood2), [1, 0.1, 0.1, 1]];
};
case 3: {
_genericMessages pushBack [LLSTRING(Lost_Blood3), [1, 0.1, 0.1, 1]];
};
case 4: {
_genericMessages pushBack [LLSTRING(Lost_Blood4), [1, 0.1, 0.1, 1]];
};
2016-07-15 10:23:26 +00:00
};
2018-07-29 21:43:14 +00:00
if (HAS_TOURNIQUET_APPLIED_ON(_target,_selectionN)) then {
2018-07-29 21:16:06 +00:00
_genericMessages pushBack [localize ELSTRING(medical_treatment,Status_Tourniquet_Applied), [0.77, 0.51, 0.08, 1]];
2016-07-15 10:23:26 +00:00
};
2018-08-11 10:40:06 +00:00
if (GVAR(showPainInMenu) && {[ACE_player, GVAR(painVisualization)] call EFUNC(medical_treatment,isMedic)}) then {
2018-05-08 07:47:03 +00:00
private _painLevel = GET_PAIN_PERCEIVED(_target);
2016-12-14 20:30:28 +00:00
if (_painLevel > 0) then {
2018-07-29 21:16:06 +00:00
private _painText = localize ELSTRING(medical_treatment,Status_Pain);
2016-12-14 20:30:28 +00:00
if (_painLevel < 0.1) then {
2018-07-29 21:16:06 +00:00
_painText = localize ELSTRING(medical_treatment,Status_MildPain);
2016-12-14 20:30:28 +00:00
} else {
if (_painLevel > 0.5) then {
2018-07-29 21:16:06 +00:00
_painText = localize ELSTRING(medical_treatment,Status_SeverePain);
2016-12-14 20:30:28 +00:00
};
2016-12-10 14:24:20 +00:00
};
2016-12-14 20:30:28 +00:00
_genericMessages pushback [_painText, [1, 1, 1, 1]];
2016-12-10 14:24:20 +00:00
};
2016-07-15 10:23:26 +00:00
};
2016-12-05 20:34:20 +00:00
private _totalIvVolume = 0;
2016-09-06 19:52:22 +00:00
private _bloodBags = _target getVariable [QEGVAR(medical,ivBags), []];
2016-07-15 10:23:26 +00:00
{
2016-09-06 19:52:22 +00:00
_x params ["_bagVolumeRemaining"];
_totalIvVolume = _totalIvVolume + _bagVolumeRemaining;
} foreach _bloodBags;
2016-07-15 10:23:26 +00:00
if (_totalIvVolume >= 1) then {
2018-07-29 21:16:06 +00:00
_genericMessages pushBack [format [localize ELSTRING(medical_treatment,receivingIvVolume), floor _totalIvVolume], [1, 1, 1, 1]];
2016-07-15 10:23:26 +00:00
};
2018-07-29 21:43:14 +00:00
private _selectionTourniquet = GET_TOURNIQUETS(_target);
2016-12-05 20:34:20 +00:00
private _selectionBloodLoss = [0, 0, 0, 0, 0, 0];
2016-12-08 10:38:43 +00:00
private _selectionDamage = _target getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
2016-12-05 20:34:20 +00:00
private _allInjuryTexts = [];
2016-07-15 10:23:26 +00:00
2016-12-05 20:34:20 +00:00
{
2016-12-14 17:04:56 +00:00
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "_bleeding", "_damage", "_category"];
2018-04-20 11:28:18 +00:00
_selectionBloodLoss set [_bodyPartN, (_selectionBloodLoss select _bodyPartN) + (20 * _bleeding * _amountOf)];
2016-12-05 20:34:20 +00:00
if (_selectionN == _bodyPartN) then {
// Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this]
2016-07-15 10:23:26 +00:00
if (_amountOf > 0) then {
2016-12-07 20:56:13 +00:00
private _className = (EGVAR(medical_damage,woundsData) select _woundClassID) select 6;
2016-12-14 17:04:56 +00:00
private _postfix = ["Minor", "Medium", "Large"] select _category;
2016-12-07 20:56:13 +00:00
private _woundDescription = localize format [ELSTRING(medical_damage,%1_%2), _className, _postfix];
2016-12-05 20:34:20 +00:00
if (_amountOf >= 1) then {
2016-12-07 20:56:13 +00:00
_allInjuryTexts pushBack [format["%2x %1", _woundDescription, ceil _amountOf], [1,1,1,1]];
2016-12-05 20:34:20 +00:00
} else {
2016-12-07 20:56:13 +00:00
_allInjuryTexts pushBack [format["Partial %1", _woundDescription], [1,1,1,1]];
2016-07-15 10:23:26 +00:00
};
2016-12-15 14:01:02 +00:00
} else {
2018-08-11 10:40:06 +00:00
if (!EGVAR(medical_treatment,advancedBandages) || {!EGVAR(medical_treatment,woundReopening)}) then {
2016-12-15 14:01:02 +00:00
private _className = (EGVAR(medical_damage,woundsData) select _woundClassID) select 6;
private _postfix = ["Minor", "Medium", "Large"] select _category;
private _woundDescription = localize format [ELSTRING(medical_damage,%1_%2), _className, _postfix];
if (_amountOf >= 1) then {
_allInjuryTexts pushBack [format ["[B] %2x %1", _woundDescription, ceil _amountOf], [0.7,0.7,0.7,1]];
} else {
_allInjuryTexts pushBack [format ["[B] Partial %1", _woundDescription], [0.7,0.7,0.7,1]];
};
};
2016-07-15 10:23:26 +00:00
};
2016-12-05 20:34:20 +00:00
};
} forEach (_target getVariable [QEGVAR(medical,openWounds), []]);
{
2016-12-14 17:04:56 +00:00
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "_bleeding", "_damage", "_category"];
2016-12-05 20:34:20 +00:00
if (_selectionN == _bodyPartN) then {
// Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this]
if (_amountOf > 0) then {
2016-12-07 20:56:13 +00:00
private _className = (EGVAR(medical_damage,woundsData) select _woundClassID) select 6;
2016-12-14 17:04:56 +00:00
private _postfix = ["Minor", "Medium", "Large"] select _category;
2016-12-07 20:56:13 +00:00
private _woundDescription = localize format [ELSTRING(medical_damage,%1_%2), _className, _postfix];
2016-12-05 20:34:20 +00:00
if (_amountOf >= 1) then {
2016-12-07 20:56:13 +00:00
_allInjuryTexts pushBack [format ["[B] %2x %1", _woundDescription, ceil _amountOf], [0.88,0.7,0.65,1]];
2016-12-05 20:34:20 +00:00
} else {
2016-12-07 20:56:13 +00:00
_allInjuryTexts pushBack [format ["[B] Partial %1", _woundDescription], [0.88,0.7,0.65,1]];
2016-07-15 10:23:26 +00:00
};
};
2016-12-05 20:34:20 +00:00
};
} forEach (_target getVariable [QEGVAR(medical,bandagedWounds), []]);
{
2016-12-14 17:04:56 +00:00
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "_bleeding", "_damage", "_category"];
2016-12-05 20:34:20 +00:00
if (_selectionN == _bodyPartN) then {
// Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this]
2016-07-15 10:23:26 +00:00
if (_amountOf > 0) then {
2016-12-07 20:56:13 +00:00
private _className = (EGVAR(medical_damage,woundsData) select _woundClassID) select 6;
2016-12-14 17:04:56 +00:00
private _postfix = ["Minor", "Medium", "Large"] select _category;
2016-12-07 20:56:13 +00:00
private _woundDescription = localize format [ELSTRING(medical_damage,%1_%2), _className, _postfix];
2016-12-05 20:34:20 +00:00
if (_amountOf >= 1) then {
2016-12-07 20:56:13 +00:00
_allInjuryTexts pushBack [format ["[S] %2x %1", _woundDescription, ceil _amountOf], [0.7,0.7,0.7,1]];
2016-12-05 20:34:20 +00:00
} else {
2016-12-07 20:56:13 +00:00
_allInjuryTexts pushBack [format ["[S] Partial %1", _woundDescription], [0.7,0.7,0.7,1]];
2016-12-05 20:34:20 +00:00
};
2016-07-15 10:23:26 +00:00
};
};
2016-12-05 20:34:20 +00:00
} forEach (_target getVariable [QEGVAR(medical,stitchedWounds), []]);
2016-07-15 10:23:26 +00:00
2016-12-05 20:34:20 +00:00
[_selectionBloodLoss, _selectionDamage, _selectionTourniquet, _display] call FUNC(updateBodyImage);
2016-07-15 10:23:26 +00:00
[_display, _genericMessages, _allInjuryTexts] call FUNC(updateInformationLists);
[_display, _target getVariable [QEGVAR(medical,logFile_activity_view), []]] call FUNC(updateActivityLog);
[_display, _target getVariable [QEGVAR(medical,logFile_quick_view), []]] call FUNC(updateQuickViewLog);
2016-08-09 17:47:59 +00:00
private _triageStatus = [_target] call EFUNC(medical_treatment,getTriageStatus);
2016-07-15 10:23:26 +00:00
(_display displayCtrl 2000) ctrlSetText (_triageStatus select 0);
(_display displayCtrl 2000) ctrlSetBackgroundColor (_triageStatus select 2);