more common code cleanup

This commit is contained in:
commy2
2015-09-20 22:16:51 +02:00
parent 5907bccc77
commit 493ce1b092
7 changed files with 123 additions and 109 deletions

View File

@ -5,23 +5,20 @@
* Arguments:
* 0: True to disable key inputs, false to re-enable them <BOOL>
*
* Return value:
* Nothing
* Return Value:
* None
*
* Public: Yes
* Public: No
*/
#include "script_component.hpp"
private ["_dlg"];
PARAMS_1(_state);
params ["_state"];
if (_state) then {
disableSerialization;
if (!isNull (uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull])) exitWith {};
if ("ACE_DisableUserInput" in ([BIS_stackedEventHandlers_onEachFrame, {_this select 0}] call FUNC(map))) exitWith {};
if (!isNil QGVAR(disableInputPFH)) exitWith {};
// end TFAR and ACRE2 radio transmissions
call FUNC(endRadioTransmission);
@ -34,19 +31,22 @@ if (_state) then {
closeDialog 0;
createDialog QGVAR(DisableMouse_Dialog);
private "_dlg";
_dlg = uiNamespace getVariable QGVAR(dlgDisableMouse);
_dlg displayAddEventHandler ["KeyDown", {
private ["_key", "_dlg", "_ctrl", "_config", "_acc", "_index"];
_key = _this select 1;
params ["", "_key"];
if (_key == 1 && {alive player}) then {
createDialog (["RscDisplayInterrupt", "RscDisplayMPInterrupt"] select isMultiplayer);
disableSerialization;
private ["_dlg", "_ctrl"];
_dlg = finddisplay 49;
_dlg displayAddEventHandler ["KeyDown", {
_key = _this select 1;
params ["", "_key"];
!(_key == 1)
}];
@ -62,19 +62,21 @@ if (_state) then {
_ctrl = _dlg displayctrl ([104, 1010] select isMultiplayer);
_ctrl ctrlSetEventHandler ["buttonClick", QUOTE(closeDialog 0; player setDamage 1; [false] call DFUNC(disableUserInput);)];
_ctrl ctrlEnable (call {_config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}});
_ctrl ctrlEnable (call {private "_config"; _config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}});
_ctrl ctrlSetText "RESPAWN";
_ctrl ctrlSetTooltip "Respawn.";
};
if (_key in actionKeys "TeamSwitch" && {teamSwitchEnabled}) then {
(uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0;
private "_acc";
_acc = accTime;
teamSwitch;
setAccTime _acc;
};
if (_key in actionKeys "CuratorInterface" && {getAssignedCuratorLogic player in allCurators}) then {
if (_key in actionKeys "CuratorInterface" && {getAssignedCuratorLogic player in allCurators}) then {
(uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0;
openCuratorInterface;
};