2015-01-18 18:38:27 +00:00
|
|
|
//XEH_clientInit.sqf
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-04-03 05:42:25 +00:00
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
|
2015-05-04 19:06:33 +00:00
|
|
|
GVAR(cachedBuildingTypes) = [];
|
|
|
|
GVAR(cachedBuildingActionPairs) = [];
|
|
|
|
|
2015-04-25 11:28:21 +00:00
|
|
|
GVAR(ParsedTextCached) = [];
|
|
|
|
|
2015-04-30 04:53:00 +00:00
|
|
|
//Setup text/shadow/size/color settings matrix
|
2015-04-20 23:28:01 +00:00
|
|
|
[] call FUNC(setupTextColors);
|
|
|
|
["SettingChanged", {
|
2015-04-29 06:26:13 +00:00
|
|
|
PARAMS_1(_name);
|
2015-04-30 04:53:00 +00:00
|
|
|
if (_name in [QGVAR(colorTextMax), QGVAR(colorTextMin), QGVAR(colorShadowMax), QGVAR(colorShadowMin), QGVAR(textSize), QGVAR(shadowSetting)]) then {
|
2015-04-20 23:28:01 +00:00
|
|
|
[] call FUNC(setupTextColors);
|
|
|
|
};
|
|
|
|
}] call EFUNC(common,addEventhandler);
|
|
|
|
|
2015-03-23 21:26:20 +00:00
|
|
|
// Install the render EH on the main display
|
|
|
|
addMissionEventHandler ["Draw3D", DFUNC(render)];
|
|
|
|
|
2015-04-14 03:19:38 +00:00
|
|
|
//Add Actions to Houses:
|
2015-05-03 04:13:35 +00:00
|
|
|
["interactMenuOpened", {_this call FUNC(userActions_addHouseActions)}] call EFUNC(common,addEventHandler);
|
2015-04-14 03:19:38 +00:00
|
|
|
|
2015-03-23 21:26:20 +00:00
|
|
|
// This spawn is probably worth keeping, as pfh don't work natively on the briefing screen and IDK how reliable the hack we implemented for them is.
|
|
|
|
// The thread dies as soon as the mission start, so it's not really compiting for scheduler space.
|
|
|
|
[] spawn {
|
|
|
|
// Wait until the map display is detected
|
|
|
|
waitUntil {(!isNull findDisplay 12)};
|
|
|
|
|
2015-04-03 05:42:25 +00:00
|
|
|
// Install the render EH on the map screen
|
2015-03-23 21:26:20 +00:00
|
|
|
((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["Draw", DFUNC(render)];
|
2015-01-18 18:38:27 +00:00
|
|
|
};
|
2015-03-23 21:26:20 +00:00
|
|
|
|
2015-01-18 18:38:27 +00:00
|
|
|
|
2015-05-28 19:59:04 +00:00
|
|
|
["ACE3 Common", QGVAR(InteractKey), (localize LSTRING(InteractKey)),
|
2015-04-04 15:20:14 +00:00
|
|
|
{
|
|
|
|
// Statement
|
|
|
|
[0] call FUNC(keyDown)
|
2015-04-25 06:23:54 +00:00
|
|
|
},{[0,false] call FUNC(keyUp)},
|
2015-03-05 07:32:26 +00:00
|
|
|
[219, [false, false, false]], false] call cba_fnc_addKeybind; //Left Windows Key
|
2015-02-18 21:58:06 +00:00
|
|
|
|
2015-05-28 19:59:04 +00:00
|
|
|
["ACE3 Common", QGVAR(SelfInteractKey), (localize LSTRING(SelfInteractKey)),
|
2015-04-04 15:20:14 +00:00
|
|
|
{
|
|
|
|
// Statement
|
|
|
|
[1] call FUNC(keyDown)
|
2015-04-25 06:23:54 +00:00
|
|
|
},{[1,false] call FUNC(keyUp)},
|
2015-03-05 07:32:26 +00:00
|
|
|
[219, [false, true, false]], false] call cba_fnc_addKeybind; //Left Windows Key + Ctrl/Strg
|
2015-04-04 15:20:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Listens for the falling unconscious event, just in case the menu needs to be closed
|
|
|
|
["medical_onUnconscious", {
|
|
|
|
// If no menu is open just quit
|
|
|
|
if (GVAR(openedMenuType) < 0) exitWith {};
|
|
|
|
|
|
|
|
EXPLODE_2_PVT(_this,_unit,_isUnconscious);
|
|
|
|
|
|
|
|
if (_unit != ACE_player || !_isUnconscious) exitWith {};
|
|
|
|
|
|
|
|
GVAR(actionSelected) = false;
|
2015-05-05 18:05:31 +00:00
|
|
|
[GVAR(openedMenuType), false] call FUNC(keyUp);
|
2015-04-04 15:20:14 +00:00
|
|
|
}] call EFUNC(common,addEventhandler);
|
2015-04-15 04:20:20 +00:00
|
|
|
|
|
|
|
// disable firing while the interact menu is is is opened
|
|
|
|
["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventHandler);
|
2015-05-29 19:56:07 +00:00
|
|
|
|
2015-06-03 04:04:47 +00:00
|
|
|
// background options
|
|
|
|
["interactMenuOpened", {
|
|
|
|
if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), true] call EFUNC(common,blurScreen);};
|
|
|
|
if (GVAR(menuBackground)==2) then {0 cutRsc[QGVAR(menuBackground), "PLAIN", 1, false];};
|
|
|
|
}] call EFUNC(common,addEventHandler);
|
|
|
|
["interactMenuClosed", {
|
|
|
|
if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), false] call EFUNC(common,blurScreen);};
|
|
|
|
if (GVAR(menuBackground)==2) then {(uiNamespace getVariable [QGVAR(menuBackground), displayNull]) closeDisplay 0;};
|
|
|
|
}] call EFUNC(common,addEventHandler);
|
2015-06-04 22:11:35 +00:00
|
|
|
|
2015-08-20 17:17:37 +00:00
|
|
|
// Let key work with zeus open (not perfect, contains workaround to prevent other CBA keybindings)
|
2015-06-04 22:11:35 +00:00
|
|
|
["zeusDisplayChanged",{
|
|
|
|
if (_this select 1) then {
|
2015-08-20 17:17:37 +00:00
|
|
|
(finddisplay 312) displayAddEventHandler ["KeyUp", {
|
|
|
|
_key = ["ACE3 Common","ace_interact_menu_InteractKey"] call CBA_fnc_getKeybind;
|
2015-08-31 13:40:31 +00:00
|
|
|
_key = _key select 5;
|
|
|
|
_dik = _key select 0;
|
|
|
|
_mods = _key select 1;
|
|
|
|
|
|
|
|
if ((_this select 1) == _dik) then {
|
|
|
|
if ((_this select [2,3]) isEqualTo _mods) then {
|
|
|
|
[_this,'keyup'] call CBA_events_fnc_keyHandler
|
|
|
|
};
|
2015-08-20 17:17:37 +00:00
|
|
|
};
|
|
|
|
}];
|
|
|
|
(finddisplay 312) displayAddEventHandler ["KeyDown", {
|
|
|
|
_key = ["ACE3 Common","ace_interact_menu_InteractKey"] call CBA_fnc_getKeybind;
|
2015-08-31 13:40:31 +00:00
|
|
|
_key = _key select 5;
|
|
|
|
_dik = _key select 0;
|
|
|
|
_mods = _key select 1;
|
|
|
|
|
|
|
|
if ((_this select 1) == _dik) then {
|
|
|
|
if ((_this select [2,3]) isEqualTo _mods) then {
|
|
|
|
[_this,'keydown'] call CBA_events_fnc_keyHandler
|
|
|
|
};
|
2015-08-20 17:17:37 +00:00
|
|
|
};
|
|
|
|
}];
|
2015-06-04 22:11:35 +00:00
|
|
|
};
|
|
|
|
}] call EFUNC(common,addEventHandler);
|
2015-09-15 17:55:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
//Debug to help end users identify mods that break CBA's XEH
|
2015-09-19 15:43:29 +00:00
|
|
|
[{
|
2015-09-15 17:55:08 +00:00
|
|
|
private ["_badClassnames"];
|
|
|
|
_badClassnames = [];
|
|
|
|
{
|
|
|
|
if ((isNil (format [QGVAR(Act_%1), typeOf _x])) || {isNil (format [QGVAR(SelfAct_%1), typeOf _x])}) then {
|
|
|
|
if (!((typeOf _x) in _badClassnames)) then {
|
|
|
|
_badClassnames pushBack (typeOf _x);
|
2015-09-15 18:10:06 +00:00
|
|
|
ACE_LOGERROR_3("Compile checks bad for (classname: %1)(addon: %2) %3", (typeOf _x), (unitAddons (typeOf _x)), _x);
|
2015-09-15 17:55:08 +00:00
|
|
|
};
|
|
|
|
};
|
2015-09-15 18:30:04 +00:00
|
|
|
} forEach (allUnits + allDeadMen + vehicles);
|
2015-09-15 17:55:08 +00:00
|
|
|
if ((count _badClassnames) == 0) then {
|
|
|
|
ACE_LOGINFO("All compile checks passed");
|
|
|
|
} else {
|
|
|
|
ACE_LOGERROR_1("%1 Classnames failed compile check!!! (bad XEH / missing cba_enable_auto_xeh.pbo)", (count _badClassnames));
|
|
|
|
|
2015-09-19 15:43:29 +00:00
|
|
|
//Only show visual error if they are actually missing the pbo:
|
|
|
|
#define SUPMON configFile>>"CfgSettings">>"CBA">>"XEH">>"supportMonitor"
|
|
|
|
if ((!isNumber(SUPMON)) || {getNumber(SUPMON) != 1}) then {
|
|
|
|
["ACE Interaction failed to compile for some units (try adding cba_enable_auto_xeh.pbo)"] call BIS_fnc_error;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}, [], 5] call EFUNC(common,waitAndExecute); //ensure CBASupMon has time to run first
|