From c70c9cdee6b8c53c5da7fafc350e86eac8e3d8b2 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Sat, 5 Sep 2015 12:49:23 +0200 Subject: [PATCH] Add Screen Blur and Blackout for Medical Menu by Interact_menu setting --- addons/medical_menu/XEH_preInit.sqf | 1 + .../functions/fnc_onMenuClose.sqf | 21 +++++++++++++++++++ .../medical_menu/functions/fnc_onMenuOpen.sqf | 3 +++ addons/medical_menu/ui/menu.hpp | 4 ++-- 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 addons/medical_menu/functions/fnc_onMenuClose.sqf diff --git a/addons/medical_menu/XEH_preInit.sqf b/addons/medical_menu/XEH_preInit.sqf index c231c7df6e..65ac88e245 100644 --- a/addons/medical_menu/XEH_preInit.sqf +++ b/addons/medical_menu/XEH_preInit.sqf @@ -3,6 +3,7 @@ ADDON = false; PREP(onMenuOpen); +PREP(onMenuClose); PREP(openMenu); PREP(canOpenMenu); diff --git a/addons/medical_menu/functions/fnc_onMenuClose.sqf b/addons/medical_menu/functions/fnc_onMenuClose.sqf new file mode 100644 index 0000000000..4300089a4a --- /dev/null +++ b/addons/medical_menu/functions/fnc_onMenuClose.sqf @@ -0,0 +1,21 @@ +/* + * Author: joko // Jonas + * Handle medical menu closed + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_medical_menu_onMenuClosed + * + * Public: No + */ +#include "script_component.hpp" + +if (EGVAR(interact_menu,menuBackground)==1) then {[QGVAR(id), false] call EFUNC(common,blurScreen);}; +if (EGVAR(interact_menu,menuBackground)==2) then {(uiNamespace getVariable [QEGVAR(interact_menu,menuBackground), displayNull]) closeDisplay 0;}; + +[GVAR(MenuPFHID)] call CBA_fnc_removePerFrameHandler; diff --git a/addons/medical_menu/functions/fnc_onMenuOpen.sqf b/addons/medical_menu/functions/fnc_onMenuOpen.sqf index 164353fe73..9f0acfbeb6 100644 --- a/addons/medical_menu/functions/fnc_onMenuOpen.sqf +++ b/addons/medical_menu/functions/fnc_onMenuOpen.sqf @@ -22,6 +22,9 @@ params ["_display"]; if (isNil "_display") exitwith {}; +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];}; + if (isNil QGVAR(LatestDisplayOptionMenu)) then { GVAR(LatestDisplayOptionMenu) = "triage"; } else { diff --git a/addons/medical_menu/ui/menu.hpp b/addons/medical_menu/ui/menu.hpp index 4a07778bd1..342f0230a2 100644 --- a/addons/medical_menu/ui/menu.hpp +++ b/addons/medical_menu/ui/menu.hpp @@ -4,9 +4,9 @@ class GVAR(medicalMenu) { idd = 314412; movingEnable = true; onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(medicalMenu)), _this select 0)]; [_this select 0] call FUNC(onMenuOpen);); - onUnload = QUOTE([GVAR(MenuPFHID)] call CBA_fnc_removePerFrameHandler;); + onUnload = QUOTE([] call FUNC(onMenuClose)); class controlsBackground { - class HeaderBackground: ACE_gui_backgroundBase{ + class HeaderBackground: ACE_gui_backgroundBase { idc = -1; SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";