From 42b5abae116c27cad907aee5cc5dd85ad978c59c Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Wed, 5 Aug 2015 19:25:38 +0100 Subject: [PATCH] Add support for respawn counter to spectator UI Rather than hiding the BI respawn counter, it should be "integrated" into the UI via code if present. --- addons/spectator/UI/interface.hpp | 11 +++++- .../functions/fnc_handleInterface.sqf | 35 +++++++++++++++---- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/addons/spectator/UI/interface.hpp b/addons/spectator/UI/interface.hpp index e8df31c280..bd6d34339f 100644 --- a/addons/spectator/UI/interface.hpp +++ b/addons/spectator/UI/interface.hpp @@ -1,6 +1,15 @@ +// Temporary fix until BI take care of it +class RscFrame { + x = 0; + y = 0; + w = 0; + h = 0; +}; + + class RscButtonMenu; class RscControlsGroupNoScrollbars; -class RscFrame; +//class RscFrame; class RscListNBox; class RscMapControl; class RscPicture; diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index b85e73dabb..b6608959b7 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -43,9 +43,8 @@ switch (toLower _mode) do { // Close map openMap [false,false]; - // Disable BI damage effects and remove counter layer + // Disable BI damage effects BIS_fnc_feedback_allowPP = false; - ("BIS_fnc_respawnCounter" call BIS_fnc_rscLayer) cutText ["","plain"]; // Close all existing dialogs while {dialog} do { @@ -81,7 +80,7 @@ switch (toLower _mode) do { clearRadio; _unit switchCamera "internal"; - // Re-enable BI damage effects + // Enable BI damage effects BIS_fnc_feedback_allowPP = true; // Cleanup camera variables @@ -154,9 +153,33 @@ switch (toLower _mode) do { [localize LSTRING(prevUnit),"Left Arrow"] ]; - // Hacky way to enable keybindings - //_display displayAddEventHandler ["KeyUp", {[_this,'keyup'] call CBA_events_fnc_keyHandler}]; - //_display displayAddEventHandler ["KeyDown", {[_this,'keydown'] call CBA_events_fnc_keyHandler}]; + // Handle support for BI's respawn counter + [{ + if !(isNull (GETUVAR(RscRespawnCounter,displayNull))) then { + disableSerialization; + private ["_counter","_title","_back","_timer","_frame","_x","_y"]; + _counter = GETUVAR(RscRespawnCounter,displayNull); + _title = _counter displayCtrl 1001; + _back = _counter displayCtrl 1002; + _timer = _counter displayCtrl 1003; + _frame = _counter ctrlCreate ["RscFrame",1008]; + + _x = safeZoneX + safeZoneW - TOOL_W * 4 - MARGIN * 3; + _y = safeZoneY + safeZoneH - TOOL_H; + + // Timer + _title ctrlSetPosition [_x,_y,TOOL_W,TOOL_H]; + _back ctrlSetPosition [_x,_y,TOOL_W,TOOL_H]; + _timer ctrlSetPosition [_x,_y,TOOL_W,TOOL_H]; + _frame ctrlSetPosition [_x,_y,TOOL_W,TOOL_H]; + _timer ctrlSetFontHeight TOOL_H; + + _title ctrlCommit 0; + _back ctrlCommit 0; + _timer ctrlCommit 0; + _frame ctrlCommit 0; + }; + },[],0.5] call EFUNC(common,waitAndExecute); }; case "onunload": { // Kill GUI PFHs