2018-07-30 09:22:14 +00:00
|
|
|
#include "script_component.hpp"
|
2016-07-15 10:23:26 +00:00
|
|
|
/*
|
2019-03-24 22:17:48 +00:00
|
|
|
* Author: Glowbal, SilentSpike, mharis001
|
|
|
|
* Updates the body image for given target.
|
2016-07-15 10:23:26 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2019-03-24 22:17:48 +00:00
|
|
|
* 0: Body image controls group <CONTROL>
|
|
|
|
* 1: Target <OBJECT>
|
2016-07-15 10:23:26 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2019-03-24 22:17:48 +00:00
|
|
|
* [CONTROL, _target] call ace_medical_menu_fnc_updateBodyImage
|
2016-07-15 10:23:26 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2019-03-24 22:17:48 +00:00
|
|
|
params ["_ctrlGroup", "_target"];
|
|
|
|
|
|
|
|
// Get tourniquets, damage, and blood loss for target
|
|
|
|
private _tourniquets = GET_TOURNIQUETS(_target);
|
2019-06-03 15:31:46 +00:00
|
|
|
private _fractures = GET_FRACTURES(_target);
|
2019-03-24 22:17:48 +00:00
|
|
|
private _bodyPartDamage = _target getVariable [QEGVAR(medical,bodyPartDamage), [0, 0, 0, 0, 0, 0]];
|
|
|
|
private _bodyPartBloodLoss = [0, 0, 0, 0, 0, 0];
|
|
|
|
|
|
|
|
{
|
2019-05-12 04:13:59 +00:00
|
|
|
_x params ["", "_bodyPartN", "_amountOf", "_bleeding"];
|
2019-03-24 22:17:48 +00:00
|
|
|
_bodyPartBloodLoss set [_bodyPartN, (_bodyPartBloodLoss select _bodyPartN) + (_bleeding * _amountOf)];
|
2019-06-22 18:36:27 +00:00
|
|
|
} forEach GET_OPEN_WOUNDS(_target);
|
2016-07-15 10:23:26 +00:00
|
|
|
|
|
|
|
{
|
2019-05-12 04:13:59 +00:00
|
|
|
_x params ["_bodyPartIDC", ["_tourniquetIDC", -1], ["_fractureIDC", -1]];
|
2019-03-24 22:17:48 +00:00
|
|
|
|
|
|
|
// Show or hide the tourniquet icon
|
|
|
|
if (_tourniquetIDC != -1) then {
|
|
|
|
private _hasTourniquet = _tourniquets select _forEachIndex > 0;
|
|
|
|
private _ctrlTourniquet = _ctrlGroup controlsGroupCtrl _tourniquetIDC;
|
|
|
|
_ctrlTourniquet ctrlShow _hasTourniquet;
|
|
|
|
};
|
2019-06-03 15:31:46 +00:00
|
|
|
|
2019-05-12 04:13:59 +00:00
|
|
|
// Show or hide fractrue/bones
|
|
|
|
if (_fractureIDC != -1) then {
|
|
|
|
private _ctrlBone = _ctrlGroup controlsGroupCtrl _fractureIDC;
|
|
|
|
switch (_fractures select _forEachIndex) do {
|
2019-06-03 15:31:46 +00:00
|
|
|
case 0: {
|
2019-05-12 04:13:59 +00:00
|
|
|
_ctrlBone ctrlShow false;
|
|
|
|
};
|
2019-06-03 15:31:46 +00:00
|
|
|
case 1: {
|
2019-05-12 04:13:59 +00:00
|
|
|
_ctrlBone ctrlShow true;
|
|
|
|
_ctrlBone ctrlSetTextColor [1, 0, 0, 1];
|
|
|
|
};
|
2019-06-03 15:31:46 +00:00
|
|
|
case -1: {
|
2019-05-12 04:13:59 +00:00
|
|
|
if (EGVAR(medical,fractures) == 2) then {
|
|
|
|
_ctrlBone ctrlShow true;
|
|
|
|
_ctrlBone ctrlSetTextColor [0, 0, 1, 1];
|
|
|
|
} else {
|
|
|
|
_ctrlBone ctrlShow false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2016-07-15 10:23:26 +00:00
|
|
|
|
2019-03-24 22:17:48 +00:00
|
|
|
// Update body part color based on blood loss and damage
|
|
|
|
private _bloodLoss = _bodyPartBloodLoss select _forEachIndex;
|
|
|
|
private _bodyPartColor = if (_bloodLoss > 0) then {
|
|
|
|
[_bloodLoss] call FUNC(bloodLossToRGBA);
|
2016-12-05 20:34:20 +00:00
|
|
|
} else {
|
2019-03-24 22:17:48 +00:00
|
|
|
private _damage = _bodyPartDamage select _forEachIndex;
|
|
|
|
[_damage] call FUNC(damageToRGBA);
|
2016-07-15 10:23:26 +00:00
|
|
|
};
|
|
|
|
|
2019-03-24 22:17:48 +00:00
|
|
|
private _ctrlBodyPart = _ctrlGroup controlsGroupCtrl _bodyPartIDC;
|
|
|
|
_ctrlBodyPart ctrlSetTextColor _bodyPartColor;
|
|
|
|
} forEach [
|
|
|
|
[IDC_BODY_HEAD],
|
|
|
|
[IDC_BODY_TORSO],
|
2019-06-03 15:31:46 +00:00
|
|
|
[IDC_BODY_ARMLEFT, IDC_BODY_ARMLEFT_T, IDC_BODY_ARMLEFT_B],
|
2019-05-12 04:13:59 +00:00
|
|
|
[IDC_BODY_ARMRIGHT, IDC_BODY_ARMRIGHT_T, IDC_BODY_ARMRIGHT_B],
|
2019-06-03 15:31:46 +00:00
|
|
|
[IDC_BODY_LEGLEFT, IDC_BODY_LEGLEFT_T, IDC_BODY_LEGLEFT_B],
|
2019-05-12 04:13:59 +00:00
|
|
|
[IDC_BODY_LEGRIGHT, IDC_BODY_LEGRIGHT_T, IDC_BODY_LEGRIGHT_B]
|
2019-03-24 22:17:48 +00:00
|
|
|
];
|