ACE3/addons/medical_gui/functions/fnc_updateBodyImage.sqf

51 lines
1.3 KiB
Plaintext
Raw Normal View History

2016-07-15 10:23:26 +00:00
/*
* Author: Glowbal
* Update the body image on the menu
*
* Arguments:
* 0: selection bloodloss <ARRAY>
2016-12-05 20:34:20 +00:00
* 1: selection damage <ARRAY>
* 2: selection torniquet <ARRAY>
* 3: display <DISPLAY>
2016-07-15 10:23:26 +00:00
*
* Return Value:
* None
*
* Example:
* [0.3, some_display] call ace_medical_menu_fnc_updateBodyImage
*
* Public: No
*/
#include "script_component.hpp"
2016-12-05 20:34:20 +00:00
params ["_selectionBloodLoss", "_selectionDamage", "_selectionTourniquet", "_display"];
2016-07-15 10:23:26 +00:00
// Handle the body image coloring
private _availableSelections = [50, 51, 52, 53, 54, 55];
{
private _red = 1;
private _green = 1;
private _blue = 1;
2016-12-05 20:34:20 +00:00
private _torniquet = _selectionTourniquet select _forEachIndex;
if (_torniquet > 0) then {
_red = 0;
_green = 0;
_blue = 0.8;
2016-12-05 20:34:20 +00:00
} else {
private _bloodLoss = _selectionBloodLoss select _forEachIndex;
if (_bloodLoss > 0) then {
_green = 0 max (0.8 - _bloodLoss);
2016-07-15 10:23:26 +00:00
_blue = _green;
} else {
2016-12-05 20:34:20 +00:00
private _damage = _selectionDamage select _forEachIndex;
if (_damage > 0.1) then {
_blue = 0 max (1 - _damage);
2016-12-07 17:53:04 +00:00
_green = 0.5 max (1 - _damage / 2);
};
2016-07-15 10:23:26 +00:00
};
};
2016-12-05 20:34:20 +00:00
(_display displayCtrl _x) ctrlSetTextColor [_red, _green, _blue, 1.0];
} forEach _availableSelections;