2018-07-30 09:22:14 +00:00
|
|
|
#include "script_component.hpp"
|
2015-08-06 21:51:17 +00:00
|
|
|
/*
|
2019-03-24 22:17:48 +00:00
|
|
|
* Author: Glowbal, mharis001
|
|
|
|
* Handles opening the Medical Menu. Called from onLoad event.
|
2015-08-02 14:56:27 +00:00
|
|
|
*
|
2015-08-06 21:51:17 +00:00
|
|
|
* Arguments:
|
2015-08-07 03:37:41 +00:00
|
|
|
* 0: Medical Menu display <DISPLAY>
|
2015-08-06 21:51:17 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-07 03:37:41 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2019-03-24 22:17:48 +00:00
|
|
|
* [DISPLAY] call ace_medical_gui_fnc_onMenuOpen
|
2015-08-06 21:51:17 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
2015-08-02 14:56:27 +00:00
|
|
|
*/
|
|
|
|
|
2015-08-07 03:37:41 +00:00
|
|
|
params ["_display"];
|
|
|
|
|
2019-03-24 22:17:48 +00:00
|
|
|
// 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]};
|
2015-08-02 14:56:27 +00:00
|
|
|
|
2019-03-24 22:17:48 +00:00
|
|
|
// Fix mouse moving randomly
|
|
|
|
[{
|
|
|
|
[{setMousePosition _this}, _this] call CBA_fnc_execNextFrame;
|
|
|
|
}, getMousePosition] call CBA_fnc_execNextFrame;
|
2015-09-05 10:49:23 +00:00
|
|
|
|
2019-03-24 22:17:48 +00:00
|
|
|
// Set target name as title
|
|
|
|
private _ctrlTitle = _display displayCtrl IDC_TITLE;
|
|
|
|
_ctrlTitle ctrlSetText ([GVAR(target)] call EFUNC(common,getName));
|
2015-08-02 14:56:27 +00:00
|
|
|
|
2019-03-24 22:17:48 +00:00
|
|
|
// Initially hide the triage select buttons
|
|
|
|
[_display] call FUNC(toggleTriageSelect);
|
2015-08-02 14:56:27 +00:00
|
|
|
|
2019-03-24 22:17:48 +00:00
|
|
|
// Store display and add PFH to update it
|
|
|
|
uiNamespace setVariable [QGVAR(menuDisplay), _display];
|
|
|
|
["ace_medicalMenuOpened", [ACE_player, GVAR(target), _display]] call CBA_fnc_localEvent;
|
2015-08-02 14:56:27 +00:00
|
|
|
|
2019-03-24 22:17:48 +00:00
|
|
|
if (GVAR(menuPFH) != -1) exitWith {
|
|
|
|
TRACE_1("Menu PFH already running",GVAR(menuPFH));
|
|
|
|
};
|
2015-08-02 14:56:27 +00:00
|
|
|
|
2019-03-24 22:17:48 +00:00
|
|
|
GVAR(menuPFH) = [FUNC(menuPFH), 0, []] call CBA_fnc_addPerFrameHandler;
|
2019-06-08 22:23:09 +00:00
|
|
|
|
|
|
|
// 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.5) + 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;
|