mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
b54be029df
* Switch "status" header to player name
* Set title to "Medical Menu"
* Remove unused STATUS strings
* Switch to existing MedicalMenu string
Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
* Revert "Remove unused STATUS strings"
This reverts commit 62c1ced06a
.
---------
Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
84 lines
2.5 KiB
Plaintext
84 lines
2.5 KiB
Plaintext
#include "..\script_component.hpp"
|
|
/*
|
|
* Author: Glowbal, mharis001
|
|
* Handles opening the Medical Menu. Called from onLoad event.
|
|
*
|
|
* Arguments:
|
|
* 0: Medical Menu display <DISPLAY>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [DISPLAY] call ace_medical_gui_fnc_onMenuOpen
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_display"];
|
|
|
|
// Create background effects based on interact menu setting
|
|
if (EGVAR(interact_menu,menuBackground) == 1) then {[QGVAR(id), true] call EFUNC(common,blurScreen)};
|
|
if (EGVAR(interact_menu,menuBackground) == 2) then {0 cutRsc [QEGVAR(interact_menu,menuBackground), "PLAIN", 1, false]};
|
|
|
|
// Fix mouse moving randomly
|
|
[{
|
|
[{setMousePosition _this}, _this] call CBA_fnc_execNextFrame;
|
|
}, getMousePosition] call CBA_fnc_execNextFrame;
|
|
|
|
// Set middle header as target name
|
|
private _ctrlTitle = _display displayCtrl IDC_NAME;
|
|
_ctrlTitle ctrlSetText ([GVAR(target)] call EFUNC(common,getName));
|
|
|
|
// Initially hide the triage select buttons
|
|
[_display] call FUNC(toggleTriageSelect);
|
|
|
|
// Store display and add PFH to update it
|
|
uiNamespace setVariable [QGVAR(menuDisplay), _display];
|
|
["ace_medicalMenuOpened", [ACE_player, GVAR(target), _display]] call CBA_fnc_localEvent;
|
|
|
|
if (GVAR(menuPFH) != -1) exitWith {
|
|
TRACE_1("Menu PFH already running",GVAR(menuPFH));
|
|
};
|
|
|
|
GVAR(menuPFH) = [FUNC(menuPFH), 0, []] call CBA_fnc_addPerFrameHandler;
|
|
|
|
// Hide categories if they don't have any actions (airway)
|
|
private _list = [
|
|
[IDC_TRIAGE, true],
|
|
[IDC_EXAMINE, true],
|
|
[IDC_BANDAGE, "bandage"],
|
|
[IDC_MEDICATION, "medication"],
|
|
[IDC_AIRWAY, "airway"],
|
|
[IDC_ADVANCED, "advanced"],
|
|
[IDC_DRAG, "drag"],
|
|
[IDC_TOGGLE, true]
|
|
];
|
|
private _countEnabled = {
|
|
_x params ["", "_category"];
|
|
if (_category isEqualType "") then { _x set [1, (GVAR(actions) findIf {_category == _x select 1}) > -1]; };
|
|
_x select 1
|
|
} count _list;
|
|
private _offsetX = POS_X(1.75) + 0.5 * (POS_X(12) - POS_X(_countEnabled * 1.5));
|
|
{
|
|
_x params ["_idc", "_enabled"];
|
|
private _ctrl = _display displayCtrl _idc;
|
|
if (_enabled) then {
|
|
_ctrl ctrlSetPositionX _offsetX;
|
|
_ctrl ctrlCommit 0;
|
|
_offsetX = _offsetX + POS_W(1.5);
|
|
} else {
|
|
_ctrl ctrlShow false;
|
|
};
|
|
} forEach _list;
|
|
|
|
// Set toggle button icon and tooltip
|
|
private _ctrl = _display displayCtrl IDC_TOGGLE;
|
|
if (GVAR(target) == ACE_player) then {
|
|
_ctrl ctrlSetText QPATHTOF(data\categories\toggle_to_other.paa);
|
|
_ctrl ctrlSetTooltip LLSTRING(ToggleToOther);
|
|
} else {
|
|
_ctrl ctrlSetText QPATHTOF(data\categories\toggle_to_self.paa);
|
|
_ctrl ctrlSetTooltip LLSTRING(ToggleToSelf);
|
|
};
|