Merge pull request #2042 from MikeMatrix/cleanupMedicalMenu

Cleanup for medical_menu PR #2039
This commit is contained in:
Glowbal 2015-08-07 08:29:58 +02:00
commit 40e260b36e
12 changed files with 217 additions and 188 deletions

View File

@ -3,38 +3,40 @@
* Collect treatment actions from medical config * Collect treatment actions from medical config
* *
* Arguments: * Arguments:
* None
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [] call ace_medical_menu_fnc_collectActions
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_configBasic", "_configAdvanced", "_compileActionsLevel"]; private ["_configBasic", "_configAdvanced", "_fnc_compileActionsLevel"];
_configBasic = (configFile >> "ACE_Medical_Actions" >> "Basic"); _configBasic = (configFile >> "ACE_Medical_Actions" >> "Basic");
_configAdvanced = (configFile >> "ACE_Medical_Actions" >> "Advanced"); _configAdvanced = (configFile >> "ACE_Medical_Actions" >> "Advanced");
_fnc_compileActionsLevel = {
_compileActionsLevel = { private ["_entryCount", "_actions", "_displayName", "_condition", "_category", "_statement"];
private [ "_config", "_entryCount", "_actions", "_action", "_displayName","_condition", "_category", "_statement"]; params ["_config"];
_config = _this select 0;
_entryCount = (count _config) - 1;
_actions = []; _actions = [];
for "_i" from 0 to _entryCount /* step +1 */ do { {
_action = _config select _i; if (isClass _x) then {
if (isClass _action) then { _displayName = getText (_x >> "displayName");
_displayName = getText (_action >> "displayName"); _category = getText (_x >> "category");
_category = getText (_action >> "category"); _condition = format[QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical,canTreatCached)), configName _x];
_condition = format[QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical,canTreatCached)), configName _action]; _statement = format[QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical,treatment)), configName _x];
_statement = format[QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical,treatment)), configName _action]; _actions pushBack [_displayName, _category, compile _condition, compile _statement];
_actions pushback [_displayName, _category, compile _condition, compile _statement];
}; };
}; nil
_actions; } count _config;
_actions // return
}; };
GVAR(actionsBasic) = [_configBasic] call _compileActionsLevel; GVAR(actionsBasic) = [_configBasic] call _fnc_compileActionsLevel;
GVAR(actionsAdvanced) = [_configAdvanced] call _compileActionsLevel; GVAR(actionsAdvanced) = [_configAdvanced] call _fnc_compileActionsLevel;

View File

@ -10,16 +10,17 @@
* Return Value: * Return Value:
* Available actions <ARRAY> * Available actions <ARRAY>
* *
* Exmaple:
* [ACE_player, poor_dude, "some category"] call ace_medical_menu_fnc_getTreatmentOptions
*
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_player", "_target", "_name", "_actions"]; private "_actions";
_player = _this select 0; params ["_player", "_target", "_name"];
_target = _this select 1;
_name = _this select 2; if (!([ACE_player, _target, ["isNotInside"]] call EFUNC(common,canInteractWith))) exitwith {[]};
if !([ACE_player, _target, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitwith {[]};
_actions = if (EGVAR(medical,level) == 2) then { _actions = if (EGVAR(medical,level) == 2) then {
GVAR(actionsAdvanced); GVAR(actionsAdvanced);
@ -31,9 +32,11 @@ _collectedActions = [];
_bodyPart = EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart); _bodyPart = EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart);
{ {
if (_name == (_x select 1) && {call (_x select 2)}) then { _x params ["", "_currentCategory", "_currentCondition"];
_collectedActions pushback _x; if (_name == _currentCategory && {call _currentCondition}) then {
_collectedActions pushBack _x;
}; };
}foreach _actions; nil
} count _actions;
_collectedActions; _collectedActions // return

View File

@ -6,27 +6,31 @@
* 0: Category name <STRING> * 0: Category name <STRING>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* ["some category"] call ace_medical_menu_handleUI_DisplayOptions
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
#define START_IDC 20 #define START_IDC 20
#define END_IDC 27 #define END_IDC 27
#define AMOUNT_OF_ENTRIES (count _entries) #define AMOUNT_OF_ENTRIES (count _entries)
private ["_name","_entries","_display","_newTarget","_counter","_card","_ctrl","_code"];
_name = _this select 0;
if (!hasInterface) exitwith{}; if (!hasInterface) exitwith{};
private ["_entries", "_display", "_newTarget", "_card", "_ctrl", "_code"];
params ["_name"];
disableSerialization; disableSerialization;
_display = uiNamespace getVariable QGVAR(medicalMenu); _display = uiNamespace getVariable QGVAR(medicalMenu);
if (isNil "_display") exitwith {}; // no valid dialog present if (isNil "_display") exitwith {}; // no valid dialog present
if ((_name == "toggle")) exitwith { if (_name isEqualTo "toggle") exitwith {
if (GVAR(INTERACTION_TARGET) != ACE_player) then { if (GVAR(INTERACTION_TARGET) != ACE_player) then {
_newTarget = ACE_player; _newTarget = ACE_player;
} else { } else {
@ -42,7 +46,7 @@ if ((_name == "toggle")) exitwith {
}; };
// Clean the dropdown options list from all actions // Clean the dropdown options list from all actions
for [{_x=START_IDC},{_x <= END_IDC},{_x=_x+1}] do { for [{_x = START_IDC}, {_x <= END_IDC}, {_x = _x + 1}] do {
_ctrl = (_display displayCtrl (_x)); _ctrl = (_display displayCtrl (_x));
_ctrl ctrlSetText ""; _ctrl ctrlSetText "";
_ctrl ctrlShow false; _ctrl ctrlShow false;
@ -55,34 +59,34 @@ GVAR(LatestDisplayOptionMenu) = _name;
// The triage card has no options available // The triage card has no options available
lbClear 212; lbClear 212;
if (_name == "triage") exitwith { if (_name isEqualTo "triage") exitwith {
ctrlEnable[212,true]; ctrlEnable [212, true];
_card = ([GVAR(INTERACTION_TARGET)] call FUNC(getTriageList)); _card = [GVAR(INTERACTION_TARGET)] call FUNC(getTriageList);
{ {
lbadd[212,format["%1 x%2", getText(configFile >> "CfgWeapons" >> (_x select 0) >> "displayName"), _x select 1]]; lbAdd [212, format["%1 x%2", getText(configFile >> "CfgWeapons" >> (_x select 0) >> "displayName"), _x select 1]];
}foreach _card; } forEach _card;
if (count _card == 0) then { if (count _card == 0) then {
lbadd[212,"No Entries"]; lbAdd [212, "No Entries"];
}; };
}; };
ctrlEnable[212,false]; ctrlEnable [212, false];
_entries = [ACE_player, GVAR(INTERACTION_TARGET), _name] call FUNC(getTreatmentOptions); _entries = [ACE_player, GVAR(INTERACTION_TARGET), _name] call FUNC(getTreatmentOptions);
{ {
//player sidechat format["TRIGGERED: %1",_x]; //player sidechat format["TRIGGERED: %1",_x];
if (_foreachIndex > END_IDC) exitwith {}; if (_forEachIndex > END_IDC) exitwith {};
_ctrl = (_display displayCtrl (START_IDC + _foreachIndex)); _ctrl = (_display displayCtrl (START_IDC + _forEachIndex));
if (!(_foreachIndex > AMOUNT_OF_ENTRIES)) then { if (!(_forEachIndex > AMOUNT_OF_ENTRIES)) then {
_ctrl ctrlSetText (_x select 0); _ctrl ctrlSetText (_x select 0);
_code = format["ace_medical_menu_pendingReopen = true; call %1;",(_x select 3)]; _code = format ["ace_medical_menu_pendingReopen = true; call %1;", (_x select 3)];
_ctrl ctrlSetEventHandler ["ButtonClick", _code]; _ctrl ctrlSetEventHandler ["ButtonClick", _code];
_ctrl ctrlSetTooltip (_x select 0); // TODO implement _ctrl ctrlSetTooltip (_x select 0); // TODO implement
_ctrl ctrlShow true; _ctrl ctrlShow true;
} else { } else {
_ctrl ctrlSetText ""; _ctrl ctrlSetText "";
_ctrl ctrlSetEventHandler ["ButtonClick",""]; _ctrl ctrlSetEventHandler ["ButtonClick", ""];
}; };
_ctrl ctrlCommit 0; _ctrl ctrlCommit 0;
}foreach _entries; } forEach _entries;

View File

@ -3,28 +3,33 @@
* Handle the triage card display * Handle the triage card display
* *
* Arguments: * Arguments:
* None
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [] call ace_medical_menu_handleUI_dropDownTriageCard
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_display","_pos","_ctrl","_curPos","_idc"]; private ["_display", "_pos", "_ctrl", "_currentPos", "_idc"];
disableSerialization; disableSerialization;
_display = uiNamespace getVariable QGVAR(medicalMenu); _display = uiNamespace getVariable QGVAR(medicalMenu);
_pos = [ 0,0,0,0]; _pos = [0, 0, 0, 0];
_curPos = ctrlPosition (_display displayCtrl 2002); _currentPos = ctrlPosition (_display displayCtrl 2002);
if ((_curPos select 0) == 0 && (_curPos select 1) == 0) then { _currentPos params ["_currentPosX", "_currentPosY"];
if (_currentPosX == 0 && _currentPosY == 0) then {
_pos = ctrlPosition (_display displayCtrl 2001); _pos = ctrlPosition (_display displayCtrl 2001);
}; };
for "_idc" from 2002 to 2006 step 1 do { for "_idc" from 2002 to 2006 step 1 do {
_pos set [1, (_pos select 1) + (_pos select 3)]; _pos set [1, (_pos select 1) + (_pos select 3)];
_ctrl = (_display displayCtrl _idc); _ctrl = _display displayCtrl _idc;
_ctrl ctrlSetPosition _pos; _ctrl ctrlSetPosition _pos;
_ctrl ctrlCommit 0; _ctrl ctrlCommit 0;
}; };

View File

@ -3,17 +3,25 @@
* Handle medical menu opened * Handle medical menu opened
* *
* Arguments: * Arguments:
* 0: Medical Menu display <DISPLAY>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [medical_menu] call ace_medical_menu_onMenuOpen
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
if (isnil QGVAR(LatestDisplayOptionMenu)) then { private "_target";
params ["_display"];
if (isNil "_display") exitwith {};
if (isNil QGVAR(LatestDisplayOptionMenu)) then {
GVAR(LatestDisplayOptionMenu) = "triage"; GVAR(LatestDisplayOptionMenu) = "triage";
} else { } else {
if (GVAR(LatestDisplayOptionMenu) == "toggle") then { if (GVAR(LatestDisplayOptionMenu) == "toggle") then {
@ -22,52 +30,48 @@ if (isnil QGVAR(LatestDisplayOptionMenu)) then {
}; };
}; };
private ["_display","_target"];
_target = GVAR(INTERACTION_TARGET); _target = GVAR(INTERACTION_TARGET);
if (isnil QGVAR(INTERACTION_TARGET_PREVIOUS)) then { if (isNil QGVAR(INTERACTION_TARGET_PREVIOUS)) then {
GVAR(INTERACTION_TARGET_PREVIOUS) = _target; GVAR(INTERACTION_TARGET_PREVIOUS) = _target;
}; };
[GVAR(LatestDisplayOptionMenu)] call FUNC(handleUI_DisplayOptions); [GVAR(LatestDisplayOptionMenu)] call FUNC(handleUI_DisplayOptions);
// 11 till 18
disableSerialization; disableSerialization;
_display = _this select 0; //uiNamespace getVariable QGVAR(medicalMenu);
if (isnil "_display") exitwith {};
[_target, _display] call FUNC(updateUIInfo); [_target, _display] call FUNC(updateUIInfo);
(_display displayCtrl 11) ctrlSetTooltip localize "STR_ACE_Medical_Menu_VIEW_TRIAGE_CARD"; (_display displayCtrl 11) ctrlSetTooltip localize LSTRING(VIEW_TRIAGE_CARD);
(_display displayCtrl 12) ctrlSetTooltip localize "STR_ACE_Medical_Menu_EXAMINE_PATIENT"; (_display displayCtrl 12) ctrlSetTooltip localize LSTRING(EXAMINE_PATIENT);
(_display displayCtrl 13) ctrlSetTooltip localize "STR_ACE_Medical_Menu_BANDAGE_FRACTURES"; (_display displayCtrl 13) ctrlSetTooltip localize LSTRING(BANDAGE_FRACTURES);
(_display displayCtrl 14) ctrlSetTooltip localize "STR_ACE_Medical_Menu_MEDICATION"; (_display displayCtrl 14) ctrlSetTooltip localize LSTRING(MEDICATION);
(_display displayCtrl 15) ctrlSetTooltip localize "STR_ACE_Medical_Menu_AIRWAY_MANAGEMENT"; (_display displayCtrl 15) ctrlSetTooltip localize LSTRING(AIRWAY_MANAGEMENT);
(_display displayCtrl 16) ctrlSetTooltip localize "STR_ACE_Medical_Menu_ADVANCED_TREATMENT"; (_display displayCtrl 16) ctrlSetTooltip localize LSTRING(ADVANCED_TREATMENT);
(_display displayCtrl 17) ctrlSetTooltip localize "STR_ACE_Medical_Menu_DRAG_CARRY"; (_display displayCtrl 17) ctrlSetTooltip localize LSTRING(DRAG_CARRY);
(_display displayCtrl 18) ctrlSetTooltip localize "STR_ACE_Medical_Menu_TOGGLE_SELF"; (_display displayCtrl 18) ctrlSetTooltip localize LSTRING(TOGGLE_SELF);
(_display displayCtrl 301) ctrlSetTooltip localize "STR_ACE_Medical_Menu_SELECT_HEAD"; (_display displayCtrl 301) ctrlSetTooltip localize LSTRING(SELECT_HEAD);
(_display displayCtrl 302) ctrlSetTooltip localize "STR_ACE_Medical_Menu_SELECT_TORSO"; (_display displayCtrl 302) ctrlSetTooltip localize LSTRING(SELECT_TORSO);
(_display displayCtrl 303) ctrlSetTooltip localize "STR_ACE_Medical_Menu_SELECT_ARM_R"; (_display displayCtrl 303) ctrlSetTooltip localize LSTRING(SELECT_ARM_R);
(_display displayCtrl 304) ctrlSetTooltip localize "STR_ACE_Medical_Menu_SELECT_ARM_L"; (_display displayCtrl 304) ctrlSetTooltip localize LSTRING(SELECT_ARM_L);
(_display displayCtrl 305) ctrlSetTooltip localize "STR_ACE_Medical_Menu_SELECT_LEG_R"; (_display displayCtrl 305) ctrlSetTooltip localize LSTRING(SELECT_LEG_R);
(_display displayCtrl 306) ctrlSetTooltip localize "STR_ACE_Medical_Menu_SELECT_LEG_L"; (_display displayCtrl 306) ctrlSetTooltip localize LSTRING(SELECT_LEG_L);
(_display displayCtrl 2001) ctrlSetTooltip localize "STR_ACE_Medical_Menu_SELECT_TRIAGE_STATUS"; (_display displayCtrl 2001) ctrlSetTooltip localize LSTRING(SELECT_TRIAGE_STATUS);
(_display displayCtrl 1) ctrlSetText format["%1",[_target] call EFUNC(common,getName)]; (_display displayCtrl 1) ctrlSetText format ["%1", [_target] call EFUNC(common,getName)];
setMousePosition [ 0.4, 0.4]; setMousePosition [0.4, 0.4];
[QGVAR(onMenuOpen), "onEachFrame", { [QGVAR(onMenuOpen), "onEachFrame", {
params ["_display"];
if (isNull GVAR(INTERACTION_TARGET)) then { if (isNull GVAR(INTERACTION_TARGET)) then {
GVAR(INTERACTION_TARGET) = ACE_player; GVAR(INTERACTION_TARGET) = ACE_player;
}; };
[GVAR(INTERACTION_TARGET), _this select 0] call FUNC(updateUIInfo); [GVAR(INTERACTION_TARGET), _display] call FUNC(updateUIInfo);
[GVAR(INTERACTION_TARGET)] call FUNC(updateIcons); [GVAR(INTERACTION_TARGET)] call FUNC(updateIcons);
[GVAR(LatestDisplayOptionMenu)] call FUNC(handleUI_DisplayOptions); [GVAR(LatestDisplayOptionMenu)] call FUNC(handleUI_DisplayOptions);
_status = [GVAR(INTERACTION_TARGET)] call FUNC(getTriageStatus); _status = [GVAR(INTERACTION_TARGET)] call FUNC(getTriageStatus);
((_this select 0) displayCtrl 2000) ctrlSetText (_status select 0); (_display displayCtrl 2000) ctrlSetText (_status select 0);
((_this select 0) displayCtrl 2000) ctrlSetBackgroundColor (_status select 2); (_display displayCtrl 2000) ctrlSetBackgroundColor (_status select 2);
}, [_display]] call BIS_fnc_addStackedEventHandler; }, [_display]] call BIS_fnc_addStackedEventHandler;
["Medical_onMenuOpen", [ACE_player, _interactionTarget]] call ace_common_fnc_localEvent; ["Medical_onMenuOpen", [ACE_player, _interactionTarget]] call EFUNC(common,localEvent);

View File

@ -6,22 +6,23 @@
* 0: Target <OBJECT> * 0: Target <OBJECT>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [some_player] call ace_medical_menu_openMenu
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_interactionTarget"]; params ["_interactionTarget"];
_interactionTarget = _this select 0;
if (dialog || isNull _interactionTarget) exitwith { if (dialog || isNull _interactionTarget) exitwith {
disableSerialization; disableSerialization;
private "_display"; private "_display";
_display = uiNamespace getVariable QGVAR(medicalMenu); _display = uiNamespace getVariable QGVAR(medicalMenu);
if (!isnil "_display") then { if (!isNil "_display") then {
closeDialog 314412; closeDialog 314412;
}; };
}; };

View File

@ -7,15 +7,12 @@
* 1: Status <NUMBER> * 1: Status <NUMBER>
* *
* Return Value: * Return Value:
* NONE * None
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_target", "_status"]; params ["_target", "_status"];
_target = _this select 0;
_status = _this select 1;
_target setvariable [QEGVAR(medical,triageLevel), _status, true]; _target setvariable [QEGVAR(medical,triageLevel), _status, true];

View File

@ -7,26 +7,25 @@
* 1: log collection <ARRAY> * 1: log collection <ARRAY>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [some_display, log] call ace_medical_menu_updateActivityLog
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_display", "_logs", "_logCtrl"]; private "_logCtrl";
_display = _this select 0;
_logs = _this select 1;
_logCtrl = (_display displayCtrl 214); params ["_display", "_logs"];
_logCtrl = _display displayCtrl 214;
lbClear _logCtrl; lbClear _logCtrl;
private ["_message", "_moment", "_arguments"];
{ {
// [_message,_moment,_type, _arguments] _x params ["_message", "_moment", "_arguments"];
_message = _x select 0;
_moment = _x select 1;
_arguments = _x select 3;
if (isLocalized _message) then { if (isLocalized _message) then {
_message = localize _message; _message = localize _message;
}; };
@ -35,7 +34,9 @@ private ["_message", "_moment", "_arguments"];
if (typeName _x == "STRING" && {isLocalized _x}) then { if (typeName _x == "STRING" && {isLocalized _x}) then {
_arguments set [_foreachIndex, localize _x]; _arguments set [_foreachIndex, localize _x];
}; };
}foreach _arguments; } forEach _arguments;
_message = format([_message] + _arguments);
_logCtrl lbAdd format["%1 %2", _moment, _message]; _message = format ([_message] + _arguments);
}foreach _logs; _logCtrl lbAdd format ["%1 %2", _moment, _message];
nil
} count _logs;

View File

@ -7,35 +7,36 @@
* 1: display <DISPLAY> * 1: display <DISPLAY>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [0.3, some_display] call ace_medical_menu_updateBodyImage
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_selectionBloodLoss", "_display"]; params ["_selectionBloodLoss", "_display"];
_selectionBloodLoss = _this select 0;
_display = _this select 1;
// Handle the body image coloring // Handle the body image coloring
_availableSelections = [50,51,52,53,54,55]; _availableSelections = [50, 51, 52, 53, 54, 55];
{ {
private ["_red", "_green", "_blue"]; private ["_red", "_green", "_blue"];
_total = _x;
_red = 1; _red = 1;
_green = 1; _green = 1;
_blue = 1; _blue = 1;
if (_total > 0) then {
if (_x > 0) then {
if (_damaged select _forEachIndex) then { if (_damaged select _forEachIndex) then {
_green = (0.9 - _total) max 0; _green = (0.9 - _x) max 0;
_blue = _green; _blue = _green;
} else { } else {
_green = (0.9 - _total) max 0; _green = (0.9 - _x) max 0;
_red = _green; _red = _green;
//_blue = _green; //_blue = _green;
}; };
}; };
(_display displayCtrl (_availableSelections select _foreachIndex)) ctrlSetTextColor [_red, _green, _blue, 1.0];
}foreach _selectionBloodLoss; (_display displayCtrl (_availableSelections select _forEachIndex)) ctrlSetTextColor [_red, _green, _blue, 1.0];
} forEach _selectionBloodLoss;

View File

@ -3,27 +3,33 @@
* Update the category icons * Update the category icons
* *
* Arguments: * Arguments:
* None
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [] call ace_medical_menu_updateIcons
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_display","_startIDC","_idc","_options","_name","_amount"]; #define START_IDC 111
#define END_IDC 118
private ["_display", "_idc", "_options", "_name", "_amount"];
disableSerialization; disableSerialization;
_display = uiNamespace getVariable QGVAR(medicalMenu); _display = uiNamespace getVariable QGVAR(medicalMenu);
_startIDC = 111;
_options = ["triage" , "examine", "bandage", "medication", "airway", "advanced", "drag", "toggle"]; _options = ["triage" , "examine", "bandage", "medication", "airway", "advanced", "drag", "toggle"];
for "_idc" from _startIDC to 118 step 1 do { for "_idc" from START_IDC to END_IDC step 1 do {
_amount = [ACE_player, GVAR(INTERACTION_TARGET), _options select (_idc - 111)] call FUNC(getTreatmentOptions); _amount = [ACE_player, GVAR(INTERACTION_TARGET), _options select (_idc - START_IDC)] call FUNC(getTreatmentOptions);
if ((count _amount) > 0 || _idc == 111 || _idc == 118) then { if ((count _amount) > 0 || _idc == START_IDC || _idc == END_IDC) then {
(_display displayCtrl _idc) ctrlSettextColor [1,1,1,1]; (_display displayCtrl _idc) ctrlSettextColor [1, 1, 1, 1];
} else { } else {
(_display displayCtrl _idc) ctrlSettextColor [0.4,0.4,0.4,1]; (_display displayCtrl _idc) ctrlSettextColor [0.4, 0.4, 0.4, 1];
}; };
}; };

View File

@ -8,30 +8,31 @@
* 2: injury collection <ARRAY> * 2: injury collection <ARRAY>
* *
* Return Value: * Return Value:
* NONE * None
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_display", "_genericMessages", "_allInjuryTexts", "_lbCtrl"]; private "_lbCtrl";
_display = _this select 0;
_genericMessages = _this select 1;
_allInjuryTexts = _this select 2;
_lbCtrl = (_display displayCtrl 213); params["_display", "_genericMessages", "_allInjuryTexts"];
_lbCtrl = _display displayCtrl 213;
lbClear _lbCtrl; lbClear _lbCtrl;
{ {
_lbCtrl lbAdd (_x select 0); _lbCtrl lbAdd (_x select 0);
_lbCtrl lbSetColor [_foreachIndex, _x select 1]; _lbCtrl lbSetColor [_forEachIndex, _x select 1];
}foreach _genericMessages; nil
} count _genericMessages;
_amountOfGeneric = count _genericMessages; _amountOfGeneric = count _genericMessages;
{ {
_lbCtrl lbAdd (_x select 0); _lbCtrl lbAdd (_x select 0);
_lbCtrl lbSetColor [_foreachIndex + _amountOfGeneric, _x select 1]; _lbCtrl lbSetColor [_forEachIndex + _amountOfGeneric, _x select 1];
}foreach _allInjuryTexts; nil
} count _allInjuryTexts;
if (count _allInjuryTexts == 0) then { if (count _allInjuryTexts == 0) then {
_lbCtrl lbAdd (localize ELSTRING(medical,NoInjuriesBodypart)); _lbCtrl lbAdd localize ELSTRING(medical,NoInjuriesBodypart);
}; };

View File

@ -7,16 +7,18 @@
* 1: display <DISPLAY> * 1: display <DISPLAY>
* *
* Return Value: * Return Value:
* NONE * None
*
* Example:
* [some_player, some_display] call ace_medical_menu_updateUIInfo
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_targeT", "_display", "_genericMessages", "_totalIvVolume", "_damaged", "_selectionBloodLoss", "_allInjuryTexts"]; private ["_genericMessages", "_totalIvVolume", "_damaged", "_selectionBloodLoss", "_allInjuryTexts"];
_target = _this select 0;
_display = _this select 1; params ["_target", "_display"];
_selectionN = GVAR(selectedBodyPart); _selectionN = GVAR(selectedBodyPart);
if (_selectionN < 0 || _selectionN > 5) exitwith {}; if (_selectionN < 0 || _selectionN > 5) exitwith {};
@ -24,89 +26,91 @@ if (_selectionN < 0 || _selectionN > 5) exitwith {};
_genericMessages = []; _genericMessages = [];
if (EGVAR(medical,level) >= 2) then { if (EGVAR(medical,level) >= 2) then {
_partText = [ELSTRING(medical,Head), ELSTRING(medical,Torso), ELSTRING(medical,LeftArm) ,ELSTRING(medical,RightArm) ,ELSTRING(medical,LeftLeg), ELSTRING(medical,RightLeg)] select _selectionN; _partText = [ELSTRING(medical,Head), ELSTRING(medical,Torso), ELSTRING(medical,LeftArm) ,ELSTRING(medical,RightArm) ,ELSTRING(medical,LeftLeg), ELSTRING(medical,RightLeg)] select _selectionN;
_genericMessages pushback [localize _partText, [1, 1, 1, 1]]; _genericMessages pushBack [localize _partText, [1, 1, 1, 1]];
}; };
if (_target getvariable[QGVAR(isBleeding), false]) then { if (_target getVariable [QGVAR(isBleeding), false]) then {
_genericMessages pushback [localize ELSTRING(medical,Status_Bleeding), [1, 0.1, 0.1, 1]]; _genericMessages pushBack [localize ELSTRING(medical,Status_Bleeding), [1, 0.1, 0.1, 1]];
};
if (_target getvariable[QGVAR(hasLostBlood), 0] > 1) then {
_genericMessages pushback [localize ELSTRING(medical,Status_Lost_Blood), [1, 0.1, 0.1, 1]];
}; };
if (((_target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]) select _selectionN) > 0) then { if (_target getVariable [QGVAR(hasLostBlood), 0] > 1) then {
_genericMessages pushback [localize ELSTRING(medical,Status_Tourniquet_Applied), [0.77, 0.51, 0.08, 1]]; _genericMessages pushBack [localize ELSTRING(medical,Status_Lost_Blood), [1, 0.1, 0.1, 1]];
}; };
if (_target getvariable[QGVAR(hasPain), false]) then {
_genericMessages pushback [localize ELSTRING(medical,Status_Pain), [1, 1, 1, 1]]; if (((_target getVariable [QGVAR(tourniquets), [0, 0, 0, 0, 0, 0]]) select _selectionN) > 0) then {
_genericMessages pushBack [localize ELSTRING(medical,Status_Tourniquet_Applied), [0.77, 0.51, 0.08, 1]];
};
if (_target getVariable [QGVAR(hasPain), false]) then {
_genericMessages pushBack [localize ELSTRING(medical,Status_Pain), [1, 1, 1, 1]];
}; };
_totalIvVolume = 0; _totalIvVolume = 0;
{ {
private "_value"; private "_value";
_value = _target getvariable _x; _value = _target getVariable _x;
if !(isnil "_value") then { if (!isNil "_value") then {
_totalIvVolume = _totalIvVolume + (_target getvariable [_x, 0]); _totalIvVolume = _totalIvVolume + (_target getVariable [_x, 0]);
}; };
}foreach GVAR(IVBags); } count GVAR(IVBags);
if (_totalIvVolume >= 1) then { if (_totalIvVolume >= 1) then {
_genericMessages pushback [format[localize ELSTRING(medical,receivingIvVolume), floor _totalIvVolume], [1, 1, 1, 1]]; _genericMessages pushBack [format [localize ELSTRING(medical,receivingIvVolume), floor _totalIvVolume], [1, 1, 1, 1]];
}; };
_damaged = [false, false, false, false, false, false]; _damaged = [false, false, false, false, false, false];
_selectionBloodLoss = [0,0,0,0,0,0]; _selectionBloodLoss = [0, 0, 0, 0, 0, 0];
_allInjuryTexts = []; _allInjuryTexts = [];
if (EGVAR(medical,level) >= 2) then { if (EGVAR(medical,level) >= 2) then {
_openWounds = _target getvariable [QEGVAR(medical,openWounds), []]; _openWounds = _target getVariable [QEGVAR(medical,openWounds), []];
private "_amountOf"; private "_amountOf";
{ {
_amountOf = _x select 3; _amountOf = _x select 3;
// Find how much this bodypart is bleeding // Find how much this bodypart is bleeding
if (_amountOf > 0) then { if (_amountOf > 0) then {
_damaged set[_x select 2, true]; _damaged set [_x select 2, true];
_selectionBloodLoss set [(_x select 2), (_selectionBloodLoss select (_x select 2)) + (20 * ((_x select 4) * _amountOf))]; _selectionBloodLoss set [_x select 2, (_selectionBloodLoss select (_x select 2)) + (20 * ((_x select 4) * _amountOf))];
if (_selectionN == (_x select 2)) then { if (_selectionN == (_x select 2)) 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] // 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 >= 1) then { if (_amountOf >= 1) then {
// TODO localization // TODO localization
_allInjuryTexts pushback [format["%2x %1", (EGVAR(medical,AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [1,1,1,1]]; _allInjuryTexts pushBack [format["%2x %1", (EGVAR(medical,AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [1,1,1,1]];
} else { } else {
// TODO localization // TODO localization
_allInjuryTexts pushback [format["Partial %1", (EGVAR(medical,AllWoundInjuryTypes) select (_x select 1)) select 6], [1,1,1,1]]; _allInjuryTexts pushBack [format["Partial %1", (EGVAR(medical,AllWoundInjuryTypes) select (_x select 1)) select 6], [1,1,1,1]];
}; };
}; };
}; };
}foreach _openWounds; } forEach _openWounds;
_bandagedwounds = _target getvariable [QEGVAR(medical,bandagedWounds), []]; _bandagedwounds = _target getVariable [QEGVAR(medical,bandagedWounds), []];
{ {
_amountOf = _x select 3; _amountOf = _x select 3;
// Find how much this bodypart is bleeding // Find how much this bodypart is bleeding
if !(_damaged select (_x select 2)) then { if !(_damaged select (_x select 2)) then {
_selectionBloodLoss set [(_x select 2), (_selectionBloodLoss select (_x select 2)) + (20 * ((_x select 4) * _amountOf))]; _selectionBloodLoss set [_x select 2, (_selectionBloodLoss select (_x select 2)) + (20 * ((_x select 4) * _amountOf))];
}; };
if (_selectionN == (_x select 2)) then { if (_selectionN == (_x select 2)) 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] // 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 { if (_amountOf > 0) then {
if (_amountOf >= 1) then { if (_amountOf >= 1) then {
// TODO localization // TODO localization
_allInjuryTexts pushback [format["[B] %2x %1", (EGVAR(medical,AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [0.88,0.7,0.65,1]]; _allInjuryTexts pushBack [format ["[B] %2x %1", (EGVAR(medical,AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [0.88,0.7,0.65,1]];
} else { } else {
// TODO localization // TODO localization
_allInjuryTexts pushback [format["[B] Partial %1", (EGVAR(medical,AllWoundInjuryTypes) select (_x select 1)) select 6], [0.88,0.7,0.65,1]]; _allInjuryTexts pushBack [format ["[B] Partial %1", (EGVAR(medical,AllWoundInjuryTypes) select (_x select 1)) select 6], [0.88,0.7,0.65,1]];
}; };
}; };
}; };
}foreach _bandagedwounds; } forEach _bandagedwounds;
} else { } else {
_damaged = [true, true, true, true, true, true]; _damaged = [true, true, true, true, true, true];
{ {
_selectionBloodLoss set [_forEachIndex, _target getHitPointDamage _x]; _selectionBloodLoss set [_forEachIndex, _target getHitPointDamage _x];
if (_target getHitPointDamage _x > 0 && {_forEachIndex == _selectionN}) then { if (_target getHitPointDamage _x > 0 && _forEachIndex == _selectionN) then {
_pointDamage = _target getHitPointDamage _x; _pointDamage = _target getHitPointDamage _x;
_severity = switch (true) do { _severity = switch (true) do {
case (_pointDamage > 0.5): {localize ELSTRING(medical,HeavilyWounded)}; case (_pointDamage > 0.5): {localize ELSTRING(medical,HeavilyWounded)};
@ -129,7 +133,7 @@ if (EGVAR(medical,level) >= 2) then {
[_selectionBloodLoss, _display] call FUNC(updateBodyImage); [_selectionBloodLoss, _display] call FUNC(updateBodyImage);
[_display, _genericMessages, _allInjuryTexts] call FUNC(updateInformationLists); [_display, _genericMessages, _allInjuryTexts] call FUNC(updateInformationLists);
_logs = _target getvariable [QEGVAR(medical,logFile_Activity), []]; _logs = _target getVariable [QEGVAR(medical,logFile_Activity), []];
[_display, _logs] call FUNC(updateActivityLog); [_display, _logs] call FUNC(updateActivityLog);
_triageStatus = [_target] call EFUNC(medical,getTriageStatus); _triageStatus = [_target] call EFUNC(medical,getTriageStatus);