diff --git a/SQF/dayz_code/Configs/RscDisplay/RscPlayerUI.hpp b/SQF/dayz_code/Configs/RscDisplay/RscPlayerUI.hpp index 03841afe2..d05b19917 100644 --- a/SQF/dayz_code/Configs/RscDisplay/RscPlayerUI.hpp +++ b/SQF/dayz_code/Configs/RscDisplay/RscPlayerUI.hpp @@ -357,6 +357,40 @@ class RscTitles }; }; }; + class DZ_BlackScreen { + idd = -1; + movingEnable = 0; + enableSimulation = 1; + enableDisplay = 1; + onLoad = "uiNamespace setVariable ['DZ_BlackScreen', _this select 0];"; + duration = 99999999999999999; + fadein = 0; + fadeout = 0; + + class controls { + class Background: RscText { + idc = -1; + x = safezoneX; + y = safezoneY; + w = safezoneW; + h = safezoneH; + text = ""; + colorText[] = {0,0,0,0}; + colorBackground[] = {0,0,0,1}; + }; + class Text: RscText { + idc = 1; + x = 0.3 * safezoneW + safezoneX; + y = 0.859137 * safezoneH + safezoneY; + w = 0.400445 * safezoneW; + h = 0.139148 * safezoneH; + text = ""; + style = 0x02 + 0x10 + 0x200; + lineSpacing = 1; + sizeEx = 0.034; + }; + }; + }; class playerStatusGUI_epoch { idd = 690000; diff --git a/SQF/dayz_code/Configs/rscTitles.hpp b/SQF/dayz_code/Configs/rscTitles.hpp index c5491cfc8..a3f025910 100644 --- a/SQF/dayz_code/Configs/rscTitles.hpp +++ b/SQF/dayz_code/Configs/rscTitles.hpp @@ -41,7 +41,7 @@ class RscDisplayMission: RscDisplayEmpty onKeyDown = "if (!isNil 'DZ_KeyDown_EH') then {_this call DZ_KeyDown_EH;};"; //assigned much quicker than spawning init_keyboard }; class RscDisplayConfigure { - onUnload = "if (!isNil 'keyboard_keys') then {keyboard_keys = nil; [controlNull,1,false,false,false] call DZ_KeyDown_EH;};"; //refresh keyboard_keys after changing binds + onUnload = "if (!isNil 'updateControlsHandle') then {terminate updateControlsHandle;}; if (!isNil 'ui_updateControls') then {updateControlsHandle = true spawn ui_updateControls;};"; class controlsBackground; class controls; }; diff --git a/SQF/dayz_code/compile/keyboard.sqf b/SQF/dayz_code/compile/keyboard.sqf index ff50e21dc..0e61520c0 100644 --- a/SQF/dayz_code/compile/keyboard.sqf +++ b/SQF/dayz_code/compile/keyboard.sqf @@ -165,18 +165,6 @@ if (isNil "keyboard_keys") then { _handled = true; };}; }; - _turbo = { - if (vehicle player == player) then { - //Prevent easily outrunning zeds and bypassing Arma sprint fatigue (slow to normal running speed after a time) by holding turbo and spamming W - _handled = true; - }; - }; - _holdBreath = { - if (count (actionKeys "HoldBreath") > 1) then { - systemChat localize "STR_UI_HOLD_BREATH"; - _handled = true; - }; - }; _forcesave = { dayz_lastCheckBit = diag_ticktime; call player_forceSave; @@ -346,8 +334,6 @@ if (isNil "keyboard_keys") then { [actionKeys "User20", _journal] call _addArray; [actionKeys "Diary", _journal] call _addArray; [actionKeys "NetworkStats", _journal] call _addArray; - [actionKeys "Turbo", _turbo] call _addArray; - [actionKeys "HoldBreath", _holdBreath] call _addArray; [[DIK_F1], _muteSound] call _addArray; //[[DIK_F4, DIK_TAB, DIK_DELETE], _forcesave] call _addArray; //[[DIK_F4, DIK_RMENU, DIK_LMENU,DIK_LSHIFT,DIK_RSHIFT,DIK_ESCAPE], _forcesave2] call _addArray; diff --git a/SQF/dayz_code/compile/ui_updateControls.sqf b/SQF/dayz_code/compile/ui_updateControls.sqf new file mode 100644 index 000000000..6fab069ba --- /dev/null +++ b/SQF/dayz_code/compile/ui_updateControls.sqf @@ -0,0 +1,23 @@ +private ["_holdBreath","_turboKey"]; + +//Sleep required for actionKeys to update after controls dialog closes +uiSleep 1; + +//Refresh keyboard_keys after controls change +if (_this) then { + keyboard_keys = nil; + [controlNull,1,false,false,false] call DZ_KeyDown_EH; +}; + +//ActionKeys includes mouse button and joystick binds +_holdBreath = if (count (actionKeys "HoldBreath") > 1) then { [true,localize "STR_UI_HOLD_BREATH"] } else { [false,""] }; + +//Prevent easily outrunning zeds and bypassing Arma sprint fatigue (slow to normal running speed after a time) by holding turbo and spamming W +_turboKey = if (count (actionKeys "Turbo") > 0) then { [true,localize "STR_UI_HOLD_TURBO"] } else { [false,""] }; + +if ((_holdBreath select 0) or (_turboKey select 0)) then { + 85000 cutRsc ["DZ_BlackScreen","PLAIN"]; + (uiNamespace getVariable "DZ_BlackScreen") displayCtrl 1 ctrlSetText format ["%1\n%2", (_holdBreath select 1), (_turboKey select 1)]; +} else { + 85000 cutText ["","PLAIN"]; +}; \ No newline at end of file diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index 160a1754c..8abd23c26 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -133,6 +133,7 @@ if (!isDedicated) then { player_gearSet = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_gearSet.sqf"; ui_changeDisplay = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_changeDisplay.sqf"; ui_gear_sound = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_gear_sound.sqf"; + ui_updateControls = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_updateControls.sqf"; //playerstats horde_epeen_fnc_fill_page = compile preProcessFile "\z\addons\dayz_code\actions\playerstats\fill_page_fnc.sqf"; @@ -938,4 +939,4 @@ dayz_engineSwitch = { PVDZ_send = [_vehicle,"SetEngineState",[_vehicle,_state]]; publicVariableServer "PVDZ_send"; }; -}; +}; \ No newline at end of file diff --git a/SQF/dayz_code/stringtable.xml b/SQF/dayz_code/stringtable.xml index 428bf7a54..755bb172d 100644 --- a/SQF/dayz_code/stringtable.xml +++ b/SQF/dayz_code/stringtable.xml @@ -7784,6 +7784,9 @@ Please change your controls. HoldBreath holds too many keys and has been blocked. Bitte ändere deine Steuerung. "Luft anhalten" liegt auf mehr als einer Taste und wurde blockiert. + + Please change your controls. Turbo holds too many keys and has been blocked. + Streamer mode: Streamer Modus: diff --git a/SQF/dayz_code/system/player_monitor.fsm b/SQF/dayz_code/system/player_monitor.fsm index abc5e3c68..090cb93b1 100644 --- a/SQF/dayz_code/system/player_monitor.fsm +++ b/SQF/dayz_code/system/player_monitor.fsm @@ -1208,6 +1208,9 @@ class FSM itemno = 32; init = /*%FSM*/"diag_log 'player_forceSave called from fsm';" \n "//call player_forceSave;" \n + "" \n + "//Check for bad controls at login" \n + "false spawn ui_updateControls;" \n "" \n "publicVariableServer ""PVDZ_plr_LoginRecord"";"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/;