ACE3/addons/medical_gui/functions/fnc_displayPatientInformation.sqf
mharis001 8d2bba4b35
Rewrite Medical GUI (#6831)
* Add a macro for the bloodloss scaling factor

* Adjust bloodloss threshold for red icon

* Remove bloodloss color scaling factor

The issue is actually the other way round, the factor of 20 would
instantly make bodyparts red on taking a wound.

* Implemet 10 color steps provided by ShackTac

This replaces the old method of colouring the interaction menu icons
and body image selections with a new method that has 10 distinct color
steps (matching across the icons and the body image).

* Use macros for constants

* Implement blue damage colouring

This re-adds visualisation for colouring based on damage. The case where
a limb has a tourniquet will hopefully be handled by an overlayed icon.

* Tidy up file structure

* Move patient information display to medical_ui

* Make common colour conversion code into functions

* Add tourniquet icon overlay to body image

* Fix mispelling I forgot to commit

* Update icon paths to new white cross icon

* Clean mess after rebase

* Add new medical menu gui

* Add updating injury list and body image

* Add updating treatment category buttons

* Update onMenuClose function

* Delete unused functions

* Add action buttons and triage card to menu

* Move medical menu PFH to separate function

* Move setTriageStatus to treatment

* Add triage select dropdown

* Add toggle button action

* Fix mouse moving randomly when opening

* Add logs list update and remove unused functions

* Hide tourniquet icons by default

* Remove CfgInGameUI (already in feedback)

* Update patient info display

* Update triage card display

* Add settings to control interact menu actions

* Cleanup files/paths

* Move triage status update to common function

* Add icons for interact menu actions

* Modify icon color for interact menu actions

* Update canOpenMenu for new setting

* Hide pain information for unconscious

* Stringtable cleanup

* Use switch for pain text

* Change minor triage status to minimal

* Fix injury list to use new stringtable entry names

* Fix medical actions check when disabled

* Skip distance check in same vehicle

* More cleanup

* Fix CI error

* Requested changes

* Fix INJURIES string

* Fix include after comment block

* Fix missing ;

Co-Authored-By: mharis001 <34453221+mharis001@users.noreply.github.com>
2019-03-24 18:17:48 -04:00

66 lines
2.2 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Glowbal, mharis001
* Opens the patient information display for given target.
*
* Arguments:
* 0: Target <OBJECT>
* 1: Body part <NUMBER>
*
* Return Value:
* None
*
* Example:
* [_target, 0] call ace_medical_gui_fnc_displayPatientInformation
*
* Public: No
*/
#define MAX_DISTANCE 4
params ["_target", "_selectionN"];
private _display = uiNamespace getVariable [QGVAR(RscPatientInfo), displayNull];
if (isNull _display) then {
QGVAR(RscPatientInfo) cutRsc [QGVAR(RscPatientInfo), "PLAIN", -1, false];
_display = uiNamespace getVariable [QGVAR(RscPatientInfo), displayNull];
[{
params ["_display", "_pfhID"];
if (isNull _display) exitWith {
[_pfhID] call CBA_fnc_removePerFrameHandler;
};
private _target = _display getVariable [QGVAR(target), objNull];
private _selectionN = _display getVariable [QGVAR(selectionN), 0];
// Close display if target moved too far away (ignore if in same vehicle)
if (ACE_player distance _target > MAX_DISTANCE && {vehicle _target != vehicle ACE_player}) exitWith {
[_pfhID] call CBA_fnc_removePerFrameHandler;
QGVAR(RscPatientInfo) cutFadeOut 0.3;
[[ELSTRING(medical,DistanceToFar), _target call EFUNC(common,getName)], 2] call EFUNC(common,displayTextStructured);
};
// Update body image
private _ctrlBodyImage = _display displayCtrl IDC_BODY_GROUP;
[_ctrlBodyImage, _target] call FUNC(updateBodyImage);
// Update injury list
private _ctrlInjuries = _display displayCtrl IDC_INJURIES;
[_ctrlInjuries, _target, _selectionN] call FUNC(updateInjuryList);
// Update activity log
private _ctrlActivityLog = _display displayCtrl IDC_ACTIVITY;
private _activityLog = _target getVariable [QEGVAR(medical,logFile_activity_view), []];
[_ctrlActivityLog, _activityLog] call FUNC(updateLogList);
// Update triage status
[_display, _target] call FUNC(updateTriageStatus);
}, 0, _display] call CBA_fnc_addPerFrameHandler;
};
_display setVariable [QGVAR(target), _target];
_display setVariable [QGVAR(selectionN), _selectionN];