diff --git a/addons/arrays/fnc_sortNestedArray.sqf b/addons/arrays/fnc_sortNestedArray.sqf index fa798a846..db784f1ea 100644 --- a/addons/arrays/fnc_sortNestedArray.sqf +++ b/addons/arrays/fnc_sortNestedArray.sqf @@ -28,15 +28,9 @@ SCRIPT(sortNestedArray); params [["_array", [], [[]]], ["_index", 0, [0]], ["_order", true, [false]]]; -#ifndef LINUX_BUILD private _helperArray = _array apply { [_x select _index, _x] }; -#else -private _helperArray = [_array, { - [_x select _index, _x] -}] call CBA_fnc_filter; -#endif _helperArray sort _order; diff --git a/addons/arrays/fnc_sortNestedArray_Linux.sqf b/addons/arrays/fnc_sortNestedArray_Linux.sqf deleted file mode 100644 index f74d08e5e..000000000 --- a/addons/arrays/fnc_sortNestedArray_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "fnc_sortNestedArray.sqf" diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 393c285cb..ed51d8d98 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -29,11 +29,7 @@ call COMPILE_FILE(init_perFrameHandler); call COMPILE_FILE(init_delayLess); // Due to activateAddons being overwritten by eachother (only the last executed command will be active), we apply this bandaid -#ifndef LINUX_BUILD - private _addons = ("true" configClasses (configFile >> "CfgPatches")) apply {configName _x}; -#else - private _addons = ["true" configClasses (configFile >> "CfgPatches"), {configName _x}] call CBA_fnc_filter; -#endif +private _addons = ("true" configClasses (configFile >> "CfgPatches")) apply {configName _x}; activateAddons _addons; GVAR(addons) = _addons; diff --git a/addons/common/XEH_preInit_Linux.sqf b/addons/common/XEH_preInit_Linux.sqf deleted file mode 100644 index 2a0f6bc06..000000000 --- a/addons/common/XEH_preInit_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "XEH_preInit.sqf" diff --git a/addons/common/fnc_dropMagazine.sqf b/addons/common/fnc_dropMagazine.sqf index 73adbb2eb..49b7d9d2b 100644 --- a/addons/common/fnc_dropMagazine.sqf +++ b/addons/common/fnc_dropMagazine.sqf @@ -30,11 +30,7 @@ params [["_unit", objNull, [objNull]], ["_item", "", [""]], ["_ammo", -1, [0]]]; // random mag mode if (_ammo < 0) then { - #ifndef LINUX_BUILD - _ammo = ((magazinesAmmoFull _unit select {_x select 0 == _item && {toLower (_x select 4) in ["uniform","vest","backpack"]}}) call BIS_fnc_selectRandom) param [1, "null"]; - #else - _ammo = (([magazinesAmmoFull _unit, {_x select 0 == _item && {toLower (_x select 4) in ["uniform","vest","backpack"]}}] call BIS_fnc_conditionalSelect) call BIS_fnc_selectRandom) param [1, "null"]; - #endif + _ammo = (selectRandom (magazinesAmmoFull _unit select {_x select 0 == _item && {toLower (_x select 4) in ["uniform","vest","backpack"]}})) param [1, "null"]; }; // no mag of this type in units inventory diff --git a/addons/common/fnc_dropMagazine_Linux.sqf b/addons/common/fnc_dropMagazine_Linux.sqf deleted file mode 100644 index 13fd26a05..000000000 --- a/addons/common/fnc_dropMagazine_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "fnc_dropMagazine.sqf" diff --git a/addons/common/fnc_dropWeapon.sqf b/addons/common/fnc_dropWeapon.sqf index 4e2b4df07..99e55d5ce 100644 --- a/addons/common/fnc_dropWeapon.sqf +++ b/addons/common/fnc_dropWeapon.sqf @@ -27,11 +27,7 @@ SCRIPT(dropWeapon); params [["_unit", objNull, [objNull]], ["_item", "", [""]]]; -#ifndef LINUX_BUILD - private _weaponInfo = (weaponsItems _unit select {_x select 0 == _item}) param [0, []]; -#else - private _weaponInfo = ([weaponsItems _unit, {_x select 0 == _item}] call BIS_fnc_conditionalSelect) param [0, []]; -#endif +private _weaponInfo = (weaponsItems _unit select {_x select 0 == _item}) param [0, []]; private _return = [_unit, _item] call CBA_fnc_removeWeapon; if (_return) then { diff --git a/addons/common/fnc_dropWeapon_Linux.sqf b/addons/common/fnc_dropWeapon_Linux.sqf deleted file mode 100644 index e2c4f38dd..000000000 --- a/addons/common/fnc_dropWeapon_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "fnc_dropWeapon.sqf" diff --git a/addons/common/fnc_getAlive.sqf b/addons/common/fnc_getAlive.sqf index 10ca18bd5..53adbc9eb 100644 --- a/addons/common/fnc_getAlive.sqf +++ b/addons/common/fnc_getAlive.sqf @@ -31,8 +31,4 @@ if (_entities isEqualType grpNull) then { _entities = units _entities; }; -#ifndef LINUX_BUILD - _entities select {alive _x} // return -#else - [_entities, {alive _x}] call BIS_fnc_conditionalSelect // return -#endif +_entities select {alive _x} // return diff --git a/addons/common/fnc_getAlive_Linux.sqf b/addons/common/fnc_getAlive_Linux.sqf deleted file mode 100644 index 4b1826ff4..000000000 --- a/addons/common/fnc_getAlive_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "fnc_getAlive.sqf" diff --git a/addons/common/fnc_getMagazineIndex.sqf b/addons/common/fnc_getMagazineIndex.sqf index f9f1871a0..4ab75d374 100644 --- a/addons/common/fnc_getMagazineIndex.sqf +++ b/addons/common/fnc_getMagazineIndex.sqf @@ -1,36 +1,26 @@ -/* ---------------------------------------------------------------------------- -Function: CBA_fnc_getMagazineIndex - -Description: - Finds out the magazine ID of all magazines of given type in the inventory of given unit. - -Parameters: - _unit - Unit to check - _magazine - Magazines to check - -Returns: - Magazine IDs - -Author: - commy2 ----------------------------------------------------------------------------- */ -#include "script_component.hpp" -SCRIPT(getMagazineIndex); - -params [["_unit", objNull, [objNull]], ["_magazine", "", [""]]]; - -private _displayName = getText (configFile >> "CfgMagazines" >> _magazine >> "displayName"); - -if (_displayName isEqualTo "") exitWith {[]}; - -#ifndef LINUX_BUILD - magazinesDetail _unit select {_x find _displayName == 0} apply {_x = _x splitString "[:]"; _x select (count _x - 1)}; -#else - [magazinesDetail _unit, { - if (_x find _displayName == 0) then { - _x = _x splitString "[:]"; - _x = _x select (count _x - 1); - true - } else {false}; - }] call BIS_fnc_conditionalSelect; -#endif +/* ---------------------------------------------------------------------------- +Function: CBA_fnc_getMagazineIndex + +Description: + Finds out the magazine ID of all magazines of given type in the inventory of given unit. + +Parameters: + _unit - Unit to check + _magazine - Magazines to check + +Returns: + Magazine IDs + +Author: + commy2 +---------------------------------------------------------------------------- */ +#include "script_component.hpp" +SCRIPT(getMagazineIndex); + +params [["_unit", objNull, [objNull]], ["_magazine", "", [""]]]; + +private _displayName = getText (configFile >> "CfgMagazines" >> _magazine >> "displayName"); + +if (_displayName isEqualTo "") exitWith {[]}; + +magazinesDetail _unit select {_x find _displayName == 0} apply {_x = _x splitString "[:]"; _x select (count _x - 1)}; diff --git a/addons/common/fnc_getMagazineIndex_Linux.sqf b/addons/common/fnc_getMagazineIndex_Linux.sqf deleted file mode 100644 index c9b541aad..000000000 --- a/addons/common/fnc_getMagazineIndex_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "fnc_getMagazineIndex.sqf" diff --git a/addons/common/fnc_headDir.sqf b/addons/common/fnc_headDir.sqf index 5408be650..f98c494af 100644 --- a/addons/common/fnc_headDir.sqf +++ b/addons/common/fnc_headDir.sqf @@ -76,15 +76,13 @@ if (_unit != call CBA_fnc_currentUnit) then { private _diff = -_azimuth; if !(_offset isEqualTo "") then { -#ifndef LINUX_BUILD ADD(_diff,_unit getDir ([_offset] call CBA_fnc_getPos)); -#else - ADD(_diff,[ARR_2(_unit,[_offset] call CBA_fnc_getPos)] call BIS_fnc_dirTo); -#endif }; + if (_diff < 0) then { ADD(_diff,360); }; + if (_diff > 180) then { SUB(_diff,360); }; diff --git a/addons/common/fnc_headDir_Linux.sqf b/addons/common/fnc_headDir_Linux.sqf deleted file mode 100644 index fbb80205a..000000000 --- a/addons/common/fnc_headDir_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "fnc_headDir.sqf" diff --git a/addons/common/fnc_players.sqf b/addons/common/fnc_players.sqf index a00b2d9d1..63def5d2c 100644 --- a/addons/common/fnc_players.sqf +++ b/addons/common/fnc_players.sqf @@ -1,26 +1,26 @@ -/* ---------------------------------------------------------------------------- -Function: CBA_fnc_players - -Description: - Reports all (human) player objects. Does not include headless client entities. - - Unlike "BIS_fnc_listPlayers", this function will not report the game logics of headless clients. - -Parameters: - None - -Returns: - List of all player objects - -Examples: - (begin example) - [] call CBA_fnc_players - (end) - -Author: - commy2 ----------------------------------------------------------------------------- */ -#include "script_component.hpp" -SCRIPT(players); - -[allUnits + allDead, {isPlayer _x && {!(_x isKindOf "HeadlessClient_F")}}] call BIS_fnc_conditionalSelect +/* ---------------------------------------------------------------------------- +Function: CBA_fnc_players + +Description: + Reports all (human) player objects. Does not include headless client entities. + + Unlike "BIS_fnc_listPlayers", this function will not report the game logics of headless clients. + +Parameters: + None + +Returns: + List of all player objects + +Examples: + (begin example) + [] call CBA_fnc_players + (end) + +Author: + commy2 +---------------------------------------------------------------------------- */ +#include "script_component.hpp" +SCRIPT(players); + +(allUnits + allDead) select {isPlayer _x && {!(_x isKindOf "HeadlessClient_F")}} diff --git a/addons/common/fnc_removeMagazine.sqf b/addons/common/fnc_removeMagazine.sqf index 6385b0522..0609234a5 100644 --- a/addons/common/fnc_removeMagazine.sqf +++ b/addons/common/fnc_removeMagazine.sqf @@ -65,31 +65,17 @@ if (_ammo < 0) then { private _backpack = backpackContainer _unit; // magazinesAmmoCargo bugged. returns nil for objNull. - #ifndef LINUX_BUILD - if (!isNull _uniform) then { - _uniformMagazines = magazinesAmmoCargo _uniform select {_x select 0 == _item}; - }; - - if (!isNull _vest) then { - _vestMagazines = magazinesAmmoCargo _vest select {_x select 0 == _item}; - }; - - if (!isNull _backpack) then { - _backpackMagazines = magazinesAmmoCargo _backpack select {_x select 0 == _item}; - }; - #else - if (!isNull _uniform) then { - _uniformMagazines = [magazinesAmmoCargo _uniform, {_x select 0 == _item}] call BIS_fnc_conditionalSelect; - }; + if (!isNull _uniform) then { + _uniformMagazines = magazinesAmmoCargo _uniform select {_x select 0 == _item}; + }; - if (!isNull _vest) then { - _vestMagazines = [magazinesAmmoCargo _vest, {_x select 0 == _item}] call BIS_fnc_conditionalSelect; - }; + if (!isNull _vest) then { + _vestMagazines = magazinesAmmoCargo _vest select {_x select 0 == _item}; + }; - if (!isNull _backpack) then { - _backpackMagazines = [magazinesAmmoCargo _backpack, {_x select 0 == _item}] call BIS_fnc_conditionalSelect; - }; - #endif + if (!isNull _backpack) then { + _backpackMagazines = magazinesAmmoCargo _backpack select {_x select 0 == _item}; + }; { if (_x select 1 == _ammo) exitWith { diff --git a/addons/common/fnc_removeMagazine_Linux.sqf b/addons/common/fnc_removeMagazine_Linux.sqf deleted file mode 100644 index f5fc2bbdb..000000000 --- a/addons/common/fnc_removeMagazine_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "fnc_removeMagazine.sqf" diff --git a/addons/common/fnc_turretPath.sqf b/addons/common/fnc_turretPath.sqf index 914b1601f..b96f0a163 100644 --- a/addons/common/fnc_turretPath.sqf +++ b/addons/common/fnc_turretPath.sqf @@ -1,34 +1,30 @@ -/* ---------------------------------------------------------------------------- -Function: CBA_fnc_turretPath - -Description: - Get a unit's turret path in the current vehicle. - - Reverse version of the turretUnit scripting command. - -Parameters: - _unit - a soldier in a vehicle - -Example: - (begin example) - _turretPath = player call CBA_fnc_turretPath - (end) - -Returns: - Soldiers turret path. [] when on foot, driver or in cargo - -Author: - commy2 ----------------------------------------------------------------------------- */ -#include "script_component.hpp" -SCRIPT(turretPath); - -params [["_unit", objNull, [objNull]]]; - -private _vehicle = vehicle _unit; - -#ifndef LINUX_BUILD - (allTurrets [_vehicle, true] select {(_vehicle turretUnit _x) isEqualTo _unit}) param [0, []] -#else - ([allTurrets [_vehicle, true], {(_vehicle turretUnit _x) isEqualTo _unit}] call BIS_fnc_conditionalSelect) param [0, []] -#endif +/* ---------------------------------------------------------------------------- +Function: CBA_fnc_turretPath + +Description: + Get a unit's turret path in the current vehicle. + + Reverse version of the turretUnit scripting command. + +Parameters: + _unit - a soldier in a vehicle + +Example: + (begin example) + _turretPath = player call CBA_fnc_turretPath + (end) + +Returns: + Soldiers turret path. [] when on foot, driver or in cargo + +Author: + commy2 +---------------------------------------------------------------------------- */ +#include "script_component.hpp" +SCRIPT(turretPath); + +params [["_unit", objNull, [objNull]]]; + +private _vehicle = vehicle _unit; + +(allTurrets [_vehicle, true] select {(_vehicle turretUnit _x) isEqualTo _unit}) param [0, []] diff --git a/addons/common/fnc_turretPathWeapon.sqf b/addons/common/fnc_turretPathWeapon.sqf index e13870576..bec3aaf26 100644 --- a/addons/common/fnc_turretPathWeapon.sqf +++ b/addons/common/fnc_turretPathWeapon.sqf @@ -1,36 +1,32 @@ -/* ---------------------------------------------------------------------------- -Function: CBA_fnc_turretPathWeapon - -Description: - Get the turret path belonging to a weapon of given vehicle. - - Reverse version of the weaponsTurret scripting command. - -Parameters: - _vehicle - a vehicle with turrets - _weapon - a weapon in the vehicles turret - -Example: - (begin example) - _turretPath = [cameraOn, "HMG_127_mbt"] call CBA_fnc_turretPathWeapon - (end) - -Returns: - Weapons turret path. [-1] for driver weapon. [] when weapon not found. - -Author: - commy2 ----------------------------------------------------------------------------- */ -#include "script_component.hpp" -SCRIPT(turretPathWeapon); - -params [["_vehicle", objNull, [objNull]], ["_weapon", "", [""]]]; - -private _turrets = allTurrets _vehicle; -_turrets pushBack [-1]; - -#ifndef LINUX_BUILD - (_turrets select {{_x == _weapon} count (_vehicle weaponsTurret _x) > 0}) param [0, []] -#else - ([_turrets, {{_x == _weapon} count (_vehicle weaponsTurret _x) > 0}] call BIS_fnc_conditionalSelect) param [0, []] -#endif +/* ---------------------------------------------------------------------------- +Function: CBA_fnc_turretPathWeapon + +Description: + Get the turret path belonging to a weapon of given vehicle. + + Reverse version of the weaponsTurret scripting command. + +Parameters: + _vehicle - a vehicle with turrets + _weapon - a weapon in the vehicles turret + +Example: + (begin example) + _turretPath = [cameraOn, "HMG_127_mbt"] call CBA_fnc_turretPathWeapon + (end) + +Returns: + Weapons turret path. [-1] for driver weapon. [] when weapon not found. + +Author: + commy2 +---------------------------------------------------------------------------- */ +#include "script_component.hpp" +SCRIPT(turretPathWeapon); + +params [["_vehicle", objNull, [objNull]], ["_weapon", "", [""]]]; + +private _turrets = allTurrets _vehicle; +_turrets pushBack [-1]; + +(_turrets select {{_x == _weapon} count (_vehicle weaponsTurret _x) > 0}) param [0, []] diff --git a/addons/common/fnc_turretPathWeapon_Linux.sqf b/addons/common/fnc_turretPathWeapon_Linux.sqf deleted file mode 100644 index 6bce09bb6..000000000 --- a/addons/common/fnc_turretPathWeapon_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "fnc_turretPathWeapon.sqf" diff --git a/addons/common/fnc_turretPath_Linux.sqf b/addons/common/fnc_turretPath_Linux.sqf deleted file mode 100644 index 7e42e9bfe..000000000 --- a/addons/common/fnc_turretPath_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "fnc_turretPath.sqf" diff --git a/addons/common/fnc_vehicleRole.sqf b/addons/common/fnc_vehicleRole.sqf index 898d500d4..3e6653bfc 100644 --- a/addons/common/fnc_vehicleRole.sqf +++ b/addons/common/fnc_vehicleRole.sqf @@ -1,32 +1,28 @@ -/* ---------------------------------------------------------------------------- -Function: CBA_fnc_vehicleRole - -Description: - Get a unit's role in its current vehicle. - - Used because assignedVehicleRole reports the role assigned by the group leader instead of the current position. - -Parameters: - _unit - a soldier in a vehicle - -Example: - (begin example) - _role = player call CBA_fnc_vehicleRole - (end) - -Returns: - Soldiers role in the current vehicle. Can be "driver", "gunner", "commander", "Turret", or "cargo". Empty string if not in vehicle - -Author: - commy2 ----------------------------------------------------------------------------- */ -#include "script_component.hpp" -SCRIPT(vehicleRole); - -params [["_unit", objNull, [objNull]]]; - -#ifndef LINUX_BUILD - fullCrew vehicle _unit select {(_x select 0) isEqualTo _unit} param [0, [nil, ""]] select 1 -#else - ([fullCrew vehicle _unit, {(_x select 0) isEqualTo _unit}] call BIS_fnc_conditionalSelect) param [0, [nil, ""]] select 1 -#endif +/* ---------------------------------------------------------------------------- +Function: CBA_fnc_vehicleRole + +Description: + Get a unit's role in its current vehicle. + + Used because assignedVehicleRole reports the role assigned by the group leader instead of the current position. + +Parameters: + _unit - a soldier in a vehicle + +Example: + (begin example) + _role = player call CBA_fnc_vehicleRole + (end) + +Returns: + Soldiers role in the current vehicle. Can be "driver", "gunner", "commander", "Turret", or "cargo". Empty string if not in vehicle + +Author: + commy2 +---------------------------------------------------------------------------- */ +#include "script_component.hpp" +SCRIPT(vehicleRole); + +params [["_unit", objNull, [objNull]]]; + +fullCrew vehicle _unit select {(_x select 0) isEqualTo _unit} param [0, [nil, ""]] select 1 diff --git a/addons/common/fnc_vehicleRole_Linux.sqf b/addons/common/fnc_vehicleRole_Linux.sqf deleted file mode 100644 index f84bc30fd..000000000 --- a/addons/common/fnc_vehicleRole_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "fnc_vehicleRole.sqf" diff --git a/addons/events/XEH_preInit.sqf b/addons/events/XEH_preInit.sqf index 0500a7843..1a1818e06 100644 --- a/addons/events/XEH_preInit.sqf +++ b/addons/events/XEH_preInit.sqf @@ -50,12 +50,7 @@ if (!isNull (uiNamespace getVariable ["CBA_missionDisplay", displayNull])) then }; PREP(keyHandler); -#ifndef LINUX_BUILD - PREP(keyHandlerDown); -#else - PREP(keyHandlerDown_Linux); - FUNC(keyHandlerDown) = FUNC(keyHandlerDown_Linux); -#endif +PREP(keyHandlerDown); PREP(keyHandlerUp); ["keyDown", FUNC(keyHandlerDown)] call CBA_fnc_addDisplayHandler; @@ -64,11 +59,7 @@ PREP(keyHandlerUp); private _keyHandlers = []; _keyHandlers resize 250; -#ifndef LINUX_BUILD - GVAR(keyDownStates) = _keyHandlers apply {[]}; -#else - GVAR(keyDownStates) = [_keyHandlers, {[]}] call CBA_fnc_filter; -#endif +GVAR(keyDownStates) = _keyHandlers apply {[]}; GVAR(keyUpStates) = + GVAR(keyDownStates); GVAR(keyHandlersDown) = call CBA_fnc_createNamespace; diff --git a/addons/events/XEH_preInit_Linux.sqf b/addons/events/XEH_preInit_Linux.sqf deleted file mode 100644 index 2a0f6bc06..000000000 --- a/addons/events/XEH_preInit_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "XEH_preInit.sqf" diff --git a/addons/events/XEH_preStart.sqf b/addons/events/XEH_preStart.sqf index 9ead70670..2dc664426 100644 --- a/addons/events/XEH_preStart.sqf +++ b/addons/events/XEH_preStart.sqf @@ -1,10 +1,5 @@ -#include "script_component.hpp" - -PREP(keyHandler); -#ifndef LINUX_BUILD - PREP(keyHandlerDown); -#else - PREP(keyHandlerDown_Linux); - FUNC(keyHandlerDown) = FUNC(keyHandlerDown_Linux); -#endif -PREP(keyHandlerUp); +#include "script_component.hpp" + +PREP(keyHandler); +PREP(keyHandlerDown); +PREP(keyHandlerUp); diff --git a/addons/events/XEH_preStart_Linux.sqf b/addons/events/XEH_preStart_Linux.sqf deleted file mode 100644 index 77560cafc..000000000 --- a/addons/events/XEH_preStart_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "XEH_preStart.sqf" diff --git a/addons/events/fnc_addKeyHandler.sqf b/addons/events/fnc_addKeyHandler.sqf index eeb3f5d6a..98d71a9c7 100644 --- a/addons/events/fnc_addKeyHandler.sqf +++ b/addons/events/fnc_addKeyHandler.sqf @@ -74,11 +74,8 @@ _hash setVariable [_hashKey, [_key, _settings, _code, _allowHold, _holdDelay]]; private _keyHandlers = [GVAR(keyDownStates), GVAR(keyUpStates)] select (_type == "keyup"); private _hashKeys = _keyHandlers param [_key, []]; -#ifndef LINUX_BUILD - _hashKeys pushBackUnique _hashKey; // pushBackUnique. Fixes using addKeyHander twice with the same keyHash/id executing the newly added action twice. -#else - _hashKeys pushBack _hashKey; -#endif +_hashKeys pushBackUnique _hashKey; // pushBackUnique. Fixes using addKeyHander twice with the same keyHash/id executing the newly added action twice. + _keyHandlers set [_key, _hashKeys]; _hashKey diff --git a/addons/events/fnc_addKeyHandler_Linux.sqf b/addons/events/fnc_addKeyHandler_Linux.sqf deleted file mode 100644 index ff277d0e7..000000000 --- a/addons/events/fnc_addKeyHandler_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "fnc_addKeyHandler.sqf" diff --git a/addons/events/fnc_addPlayerEventHandler_Linux.sqf b/addons/events/fnc_addPlayerEventHandler_Linux.sqf deleted file mode 100644 index 459fbe39a..000000000 --- a/addons/events/fnc_addPlayerEventHandler_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -// not implemented for 1.54 --1 diff --git a/addons/events/fnc_keyHandlerDown.sqf b/addons/events/fnc_keyHandlerDown.sqf index f9995773e..9ce667cb9 100644 --- a/addons/events/fnc_keyHandlerDown.sqf +++ b/addons/events/fnc_keyHandlerDown.sqf @@ -1,88 +1,77 @@ -/* ---------------------------------------------------------------------------- -Internal Function: CBA_events_fnc_keyHandlerDown -Description: - Executes the key's handler -Author: - Sickboy, commy2 ----------------------------------------------------------------------------- */ -// #define DEBUG_MODE_FULL -#include "script_component.hpp" -SCRIPT(keyHandlerDown); - -params ["", "_inputKey"]; - -if (_inputKey == 0) exitWith {}; - -private _inputSettings = _this select [2,3]; - -private _blockInput = false; - -{ - private _keybindParams = GVAR(keyHandlersDown) getVariable _x; - - _keybindParams params ["", "_keybindSettings", "_code", "_allowHold", "_holdDelay"]; - - // Verify if the required modifier keys are present - if (_keybindSettings isEqualTo _inputSettings) then { - private _xUp = _x + "_cbadefaultuphandler"; - private _execute = true; - private _holdTime = 0; - - if (_holdDelay > 0) then { - _holdTime = GVAR(keyHoldTimers) getVariable _xUp; - - if (isNil "_holdTime") then { - _holdTime = diag_tickTime + _holdDelay; - GVAR(keyHoldTimers) setVariable [_xUp, _holdTime]; - }; - - if (diag_tickTime < _holdTime) then { - _execute = false; - }; - }; - - // check if either holding down a key is enabled or if the key wasn't already held down - #ifndef LINUX_BUILD - if (_execute && {_allowHold || {GVAR(keyUpActiveList) pushBackUnique _xUp != -1}}) then { - #else - if (_execute && {_allowHold || {!(_xUp in GVAR(keyUpActiveList))}}) then { - GVAR(keyUpActiveList) pushBack _xUp; - #endif - private _params = + _this; - _params pushBack + _keybindParams; - _params pushBack _x; - - _blockInput = _params call _code; - - #ifdef DEBUG_MODE_FULL - if ((isNil "_blockInput") || {!(_blockInput isEqualType false)}) then { - LOG(PFORMAT_2("Keybind Handler returned nil or non-bool", _x, _blockInput)); - }; - #endif - }; - - if (_blockInput isEqualTo true) exitWith {}; - }; -} forEach (GVAR(keyDownStates) param [_inputKey, []]); - -// To have a valid key up we first need to have a valid key down of the same combo! -// If we do, we add it to a list of pressed key up combos, then on key up we check that list to see if we have a valid key up. -{ - private _keybindParams = GVAR(keyHandlersUp) getVariable _x; - - _keybindParams params ["", "_keybindSettings"]; - - // Verify if the required modifier keys are present - if (_keybindSettings isEqualTo _inputSettings) then { - #ifndef LINUX_BUILD - GVAR(keyDownActiveList) pushBackUnique _x; - #else - if !(_x in GVAR(keyDownActiveList)) then { - GVAR(keyDownActiveList) pushBack _x; - }; - #endif - }; -} forEach (GVAR(keyUpStates) param [_inputKey, []]); - -//Only return true if _blockInput is defined and is type bool (handlers could return anything): -(!isNil "_blockInput") && {_blockInput isEqualTo true} +/* ---------------------------------------------------------------------------- +Internal Function: CBA_events_fnc_keyHandlerDown +Description: + Executes the key's handler +Author: + Sickboy, commy2 +---------------------------------------------------------------------------- */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" +SCRIPT(keyHandlerDown); + +params ["", "_inputKey"]; + +if (_inputKey == 0) exitWith {}; + +private _inputSettings = _this select [2,3]; + +private _blockInput = false; + +{ + private _keybindParams = GVAR(keyHandlersDown) getVariable _x; + + _keybindParams params ["", "_keybindSettings", "_code", "_allowHold", "_holdDelay"]; + + // Verify if the required modifier keys are present + if (_keybindSettings isEqualTo _inputSettings) then { + private _xUp = _x + "_cbadefaultuphandler"; + private _execute = true; + private _holdTime = 0; + + if (_holdDelay > 0) then { + _holdTime = GVAR(keyHoldTimers) getVariable _xUp; + + if (isNil "_holdTime") then { + _holdTime = diag_tickTime + _holdDelay; + GVAR(keyHoldTimers) setVariable [_xUp, _holdTime]; + }; + + if (diag_tickTime < _holdTime) then { + _execute = false; + }; + }; + + // check if either holding down a key is enabled or if the key wasn't already held down + if (_execute && {_allowHold || {GVAR(keyUpActiveList) pushBackUnique _xUp != -1}}) then { + private _params = + _this; + _params pushBack + _keybindParams; + _params pushBack _x; + + _blockInput = _params call _code; + + #ifdef DEBUG_MODE_FULL + if ((isNil "_blockInput") || {!(_blockInput isEqualType false)}) then { + LOG(PFORMAT_2("Keybind Handler returned nil or non-bool", _x, _blockInput)); + }; + #endif + }; + + if (_blockInput isEqualTo true) exitWith {}; + }; +} forEach (GVAR(keyDownStates) param [_inputKey, []]); + +// To have a valid key up we first need to have a valid key down of the same combo! +// If we do, we add it to a list of pressed key up combos, then on key up we check that list to see if we have a valid key up. +{ + private _keybindParams = GVAR(keyHandlersUp) getVariable _x; + + _keybindParams params ["", "_keybindSettings"]; + + // Verify if the required modifier keys are present + if (_keybindSettings isEqualTo _inputSettings) then { + GVAR(keyDownActiveList) pushBackUnique _x; + }; +} forEach (GVAR(keyUpStates) param [_inputKey, []]); + +//Only return true if _blockInput is defined and is type bool (handlers could return anything): +(!isNil "_blockInput") && {_blockInput isEqualTo true} diff --git a/addons/events/fnc_keyHandlerDown_Linux.sqf b/addons/events/fnc_keyHandlerDown_Linux.sqf deleted file mode 100644 index 0065b7c4c..000000000 --- a/addons/events/fnc_keyHandlerDown_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "fnc_keyHandlerDown.sqf" diff --git a/addons/events/fnc_targetEvent.sqf b/addons/events/fnc_targetEvent.sqf index ece5e96f0..c43c4b5cc 100644 --- a/addons/events/fnc_targetEvent.sqf +++ b/addons/events/fnc_targetEvent.sqf @@ -1,63 +1,59 @@ -/* ---------------------------------------------------------------------------- -Function: CBA_fnc_targetEvent - -Description: - Raises a CBA event on all machines where this object or at least one of these objects are local. - -Parameters: - _eventName - Type of event to publish. - _params - Parameters to pass to the event handlers. - _targets - Where to execute events. - -Returns: - None - -Examples: - (begin example) - ["test", ["target"], cursorTarget] call CBA_fnc_targetEvent; - (end) - -Author: - commy2 ----------------------------------------------------------------------------- */ -#include "script_component.hpp" -SCRIPT(targetEvent); - -params [["_eventName", "", [""]], ["_params", []], ["_targets", objNull, [objNull, grpNull, []]]]; - -if !(_targets isEqualType []) then { - _targets = [_targets]; -}; - -#ifndef LINUX_BUILD - private _remoteTargets = _targets select {!local GETOBJ(_x)}; -#else - private _remoteTargets = [_targets, {!local GETOBJ(_x)}] call BIS_fnc_conditionalSelect; -#endif - -// do local events if there is a local target -if (count _targets > count _remoteTargets) then { - CALL_EVENT(_params,_eventName); -}; - -// no networking when no targets are remote -if (_remoteTargets isEqualTo []) exitWith {}; - -if (isServer) then { - private _sentOwners = []; - - { - private _owner = owner GETOBJ(_x); - - // only send event once each time this function is called, even if multipe targets are local to the same machine - if !(_owner in _sentOwners) then { - _sentOwners pushBack _owner; - SEND_EVENT_TO_CLIENT(_params,_eventName,_owner); - }; - } forEach _remoteTargets; -} else { - // only server knows object owners. let server handle the event. - SEND_TEVENT_TO_SERVER(_params,_eventName,_remoteTargets); -}; - -nil +/* ---------------------------------------------------------------------------- +Function: CBA_fnc_targetEvent + +Description: + Raises a CBA event on all machines where this object or at least one of these objects are local. + +Parameters: + _eventName - Type of event to publish. + _params - Parameters to pass to the event handlers. + _targets - Where to execute events. + +Returns: + None + +Examples: + (begin example) + ["test", ["target"], cursorTarget] call CBA_fnc_targetEvent; + (end) + +Author: + commy2 +---------------------------------------------------------------------------- */ +#include "script_component.hpp" +SCRIPT(targetEvent); + +params [["_eventName", "", [""]], ["_params", []], ["_targets", objNull, [objNull, grpNull, []]]]; + +if !(_targets isEqualType []) then { + _targets = [_targets]; +}; + +private _remoteTargets = _targets select {!local GETOBJ(_x)}; + +// do local events if there is a local target +if (count _targets > count _remoteTargets) then { + CALL_EVENT(_params,_eventName); +}; + +// no networking when no targets are remote +if (_remoteTargets isEqualTo []) exitWith {}; + +if (isServer) then { + private _sentOwners = []; + + { + private _owner = owner GETOBJ(_x); + + // only send event once each time this function is called, even if multipe targets are local to the same machine + if !(_owner in _sentOwners) then { + _sentOwners pushBack _owner; + SEND_EVENT_TO_CLIENT(_params,_eventName,_owner); + }; + } forEach _remoteTargets; +} else { + // only server knows object owners. let server handle the event. + SEND_TEVENT_TO_SERVER(_params,_eventName,_remoteTargets); +}; + +nil diff --git a/addons/events/fnc_targetEvent_Linux.sqf b/addons/events/fnc_targetEvent_Linux.sqf deleted file mode 100644 index 87f4bc2bf..000000000 --- a/addons/events/fnc_targetEvent_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "fnc_targetEvent.sqf" diff --git a/addons/hashes/fnc_hashCreate.sqf b/addons/hashes/fnc_hashCreate.sqf index e776f4aea..135eb3372 100644 --- a/addons/hashes/fnc_hashCreate.sqf +++ b/addons/hashes/fnc_hashCreate.sqf @@ -34,13 +34,8 @@ SCRIPT(hashCreate); // ----------------------------------------------------------------------------- params [["_array", [], [[]]], "_defaultValue"]; -#ifndef LINUX_BUILD - private _keys = _array apply {_x select 0}; - private _values = _array apply {_x select 1}; -#else - private _keys = [_array, {_x select 0}] call CBA_fnc_filter; - private _values = [_array, {_x select 1}] call CBA_fnc_filter; -#endif +private _keys = _array apply {_x select 0}; +private _values = _array apply {_x select 1}; // Return. [TYPE_HASH, _keys, _values, if (isNil "_defaultValue") then {nil} else {_defaultValue}]; diff --git a/addons/hashes/fnc_hashCreate_Linux.sqf b/addons/hashes/fnc_hashCreate_Linux.sqf deleted file mode 100644 index 8fe7eb7fe..000000000 --- a/addons/hashes/fnc_hashCreate_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "fnc_hashCreate.sqf" diff --git a/addons/help/fnc_setCreditsLine.sqf b/addons/help/fnc_setCreditsLine.sqf index 5f73c98f2..a1136c176 100644 --- a/addons/help/fnc_setCreditsLine.sqf +++ b/addons/help/fnc_setCreditsLine.sqf @@ -38,11 +38,11 @@ if (CBA_DisableCredits) exitWith {}; // find addon with author private _config = configFile >> "CfgPatches"; -private _entry = (" +private _entry = selectRandom (" isText (_x >> 'author') && {getText (_x >> 'author') != localize 'STR_A3_Bohemia_Interactive'} && {getText (_x >> 'author') != ''} -" configClasses _config) call (uiNamespace getVariable "BIS_fnc_selectRandom"); //bwc for 1.54 (Linux build) +" configClasses _config); if (isNil "_entry") exitWith {}; diff --git a/addons/jr/fnc_compatibleItems.sqf b/addons/jr/fnc_compatibleItems.sqf index 0431b7547..4a75c56db 100644 --- a/addons/jr/fnc_compatibleItems.sqf +++ b/addons/jr/fnc_compatibleItems.sqf @@ -43,22 +43,14 @@ if (isNil "_compatibleItems") then { if (isArray _cfgCompatibleItems) then { { - #ifndef LINUX_BUILD - _compatibleItems pushBackUnique _x; - #else - if !(_x in _compatibleItems) then {_compatibleItems pushBack _x}; - #endif + _compatibleItems pushBackUnique _x; nil } count getArray _cfgCompatibleItems; } else { if (isClass _cfgCompatibleItems) then { { if (getNumber _x > 0) then { - #ifndef LINUX_BUILD - _compatibleItems pushBackUnique configName _x; - #else - if !(configName _x in _compatibleItems) then {_compatibleItems pushBack configName _x}; - #endif + _compatibleItems pushBackUnique configName _x; }; nil } count configProperties [_cfgCompatibleItems, "isNumber _x"]; @@ -80,9 +72,5 @@ if (isNil "_typefilter") then { //return _typefilter = [-1, 101, 201, 301, 302] param [["", "muzzle", "optic", "pointer", "bipod"] find _typefilter, -1]; }; - #ifndef LINUX_BUILD - _compatibleItems select {_typefilter == getNumber (configFile >> "CfgWeapons" >> _x >> "itemInfo" >> "type")} - #else - [_compatibleItems, {_typefilter == getNumber (configFile >> "CfgWeapons" >> _x >> "itemInfo" >> "type")}] call BIS_fnc_conditionalSelect - #endif + _compatibleItems select {_typefilter == getNumber (configFile >> "CfgWeapons" >> _x >> "itemInfo" >> "type")} }; diff --git a/addons/jr/fnc_compatibleItems_Linux.sqf b/addons/jr/fnc_compatibleItems_Linux.sqf deleted file mode 100644 index eb7852a1c..000000000 --- a/addons/jr/fnc_compatibleItems_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "fnc_compatibleItems.sqf" diff --git a/addons/keybinding/gui/gui.hpp b/addons/keybinding/gui/gui.hpp index 3642030b6..e69ac530c 100644 --- a/addons/keybinding/gui/gui.hpp +++ b/addons/keybinding/gui/gui.hpp @@ -34,8 +34,8 @@ class RscDisplayConfigure { idc = 4302; text = CSTRING(configureAddons); onButtonClick = "_this call cba_keybinding_fnc_onButtonClick_configure"; - x = "20.15 * (((safezoneW / safezoneH) min 1.2) / 40) + ([safezoneX, safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2] select ((productVersion select 2) >= 162))"; - y = "23 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/([1,2] select ((productVersion select 2) >= 162)))"; + x = "20.15 * (((safezoneW / safezoneH) min 1.2) / 40) + safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2"; + y = "23 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; w = "12.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; }; @@ -44,8 +44,8 @@ class RscDisplayConfigure { { idc = 4303; text = "$STR_A3_RscDisplayConfigure_ButtonKeyboard"; - x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + ([safezoneX, safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2] select ((productVersion select 2) >= 162))"; - y = "2.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/([1,2] select ((productVersion select 2) >= 162)))"; + x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2"; + y = "2.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; w = "8 * (((safezoneW / safezoneH) min 1.2) / 40)"; h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; }; @@ -59,8 +59,8 @@ class RscDisplayConfigure { }; idc = 4301; enableDisplay = 0; - x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + ([safezoneX, safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2] select ((productVersion select 2) >= 162))"; - y = "3.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/([1,2] select ((productVersion select 2) >= 162)))"; + x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2"; + y = "3.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; h = "19.6 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; diff --git a/addons/linux/$NOBIN-NOTEST$ b/addons/linux/$NOBIN-NOTEST$ deleted file mode 100644 index e69de29bb..000000000 diff --git a/addons/linux/$PBOPREFIX$ b/addons/linux/$PBOPREFIX$ deleted file mode 100644 index 731616ad0..000000000 --- a/addons/linux/$PBOPREFIX$ +++ /dev/null @@ -1 +0,0 @@ -x\cba\addons\linux diff --git a/addons/linux/CfgEventHandlers.hpp b/addons/linux/CfgEventHandlers.hpp deleted file mode 100644 index d5132924a..000000000 --- a/addons/linux/CfgEventHandlers.hpp +++ /dev/null @@ -1,13 +0,0 @@ - -#define F_FILEPATH_XEH(comp,func) class DOUBLES(PREFIX,comp) {\ - init = __EVAL([QUOTE(call COMPILE_FILE_SYS(PREFIX,comp,func)), QUOTE(call COMPILE_FILE_SYS(PREFIX,comp,DOUBLES(func,Linux)))] select IS_LINUX);\ -} - -class Extended_PreStart_EventHandlers { - F_FILEPATH_XEH(events,XEH_preStart); -}; - -class Extended_PreInit_EventHandlers { - F_FILEPATH_XEH(common,XEH_preInit); - F_FILEPATH_XEH(events,XEH_preInit); -}; diff --git a/addons/linux/CfgFunctions.hpp b/addons/linux/CfgFunctions.hpp deleted file mode 100644 index 9b9270aef..000000000 --- a/addons/linux/CfgFunctions.hpp +++ /dev/null @@ -1,56 +0,0 @@ - -#define F_FILEPATH(comp,func) class func {\ - file = __EVAL([QUOTE(PATHTOEF(comp,DOUBLES(fnc,func).sqf)), QUOTE(PATHTOEF(comp,TRIPLES(fnc,func,Linux).sqf))] select IS_LINUX);\ -} - -class CfgFunctions { - class A3_Bootcamp { - class Inventory { - F_FILEPATH(jr,compatibleItems); - }; - }; - class CBA { - - class Anims { - F_FILEPATH(common,headDir); - }; - - class Entities { - F_FILEPATH(common,getAlive); - F_FILEPATH(common,getMagazineIndex); - }; - - class Vehicles { - F_FILEPATH(common,vehicleRole); - F_FILEPATH(common,turretPath); - F_FILEPATH(common,turretPathWeapon); - F_FILEPATH(common,viewDir); - }; - - class Inventory { - F_FILEPATH(common,removeMagazine); - F_FILEPATH(common,dropWeapon); - F_FILEPATH(common,dropMagazine); - F_FILEPATH(common,addBinocularMagazine); - F_FILEPATH(jr,compatibleItems); - }; - - class Arrays { - F_FILEPATH(arrays,sortNestedArray); - }; - - class Events { - F_FILEPATH(events,addPlayerEventHandler); - F_FILEPATH(events,addKeyHandler); - F_FILEPATH(events,targetEvent); - }; - - class Hashes { - F_FILEPATH(hashes,hashCreate); - }; - - class XEH { - F_FILEPATH(xeh,compileEventHandlers); - }; - }; -}; diff --git a/addons/linux/config.cpp b/addons/linux/config.cpp deleted file mode 100644 index 22e2a935b..000000000 --- a/addons/linux/config.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "script_component.hpp" - -class CfgPatches { - class ADDON { - author = "$STR_CBA_Author"; - name = ECSTRING(Optional,Component); - url = "$STR_CBA_URL"; - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"cba_common","cba_events","cba_hashes","cba_jr","cba_xeh"}; - version = VERSION; - authors[] = {"commy2"}; - }; -}; - -#include "CfgEventHandlers.hpp" -#include "CfgFunctions.hpp" diff --git a/addons/linux/script_component.hpp b/addons/linux/script_component.hpp deleted file mode 100644 index 467aa2e36..000000000 --- a/addons/linux/script_component.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#define COMPONENT linux -#include "\x\cba\addons\main\script_mod.hpp" - -#ifdef DEBUG_ENABLED_LINUX - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_LINUX - #define DEBUG_SETTINGS DEBUG_SETTINGS_LINUX -#endif - -#include "\x\cba\addons\main\script_macros.hpp" diff --git a/addons/main/script_macros_common.hpp b/addons/main/script_macros_common.hpp index a5cad5307..4edd86001 100644 --- a/addons/main/script_macros_common.hpp +++ b/addons/main/script_macros_common.hpp @@ -1539,5 +1539,3 @@ Macro: OBSOLETE() #define XEH_POST_INIT QUOTE(call COMPILE_FILE(XEH_PostInit_Once)) #define XEH_POST_CINIT QUOTE(call COMPILE_FILE(XEH_PostClientInit_Once)) #define XEH_POST_SINIT QUOTE(call COMPILE_FILE(XEH_PostServerInit_Once)) - -#define IS_LINUX (productVersion select 2 <= 154) diff --git a/addons/settings/CfgEventHandlers.hpp b/addons/settings/CfgEventHandlers.hpp index b19cf6343..4da075d49 100644 --- a/addons/settings/CfgEventHandlers.hpp +++ b/addons/settings/CfgEventHandlers.hpp @@ -1,27 +1,27 @@ class Extended_PreStart_EventHandlers { class ADDON { - init = QUOTE(if (!IS_LINUX) then {call COMPILE_FILE(XEH_preStart)};); + init = QUOTE(call COMPILE_FILE(XEH_preStart)); }; }; class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(if (!IS_LINUX) then {call COMPILE_FILE(XEH_preInit)};); + init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; class Extended_PostInit_EventHandlers { class ADDON { - init = QUOTE(if (!IS_LINUX) then {call COMPILE_FILE(XEH_postInit)};); + init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; class Extended_DisplayLoad_EventHandlers { class RscDisplayGameOptions { - ADDON = QUOTE(if (IS_LINUX || {isNil 'ADDON'}) then {_this call COMPILE_FILE(gui_initDisplay_disabled)} else {_this call COMPILE_FILE(gui_initDisplay)};); + ADDON = QUOTE(if (isNil 'ADDON') then {_this call COMPILE_FILE(gui_initDisplay_disabled)} else {_this call COMPILE_FILE(gui_initDisplay)};); }; class Display3DEN { - ADDON = QUOTE(if (!IS_LINUX) then {_this call COMPILE_FILE(init3DEN)};); + ADDON = QUOTE(_this call COMPILE_FILE(init3DEN)); }; }; diff --git a/addons/settings/gui.hpp b/addons/settings/gui.hpp index 4ac6b70e2..c7a241f77 100644 --- a/addons/settings/gui.hpp +++ b/addons/settings/gui.hpp @@ -180,8 +180,8 @@ class GVAR(presets) { class controls { class CBA_Presets: RscControlsGroup { idc = IDC_PRESETS_GROUP; - x = POS_X_CENTERED(10); - y = POS_Y_CENTERED(0.9); + x = POS_X(10); + y = POS_Y(0.9); w = POS_W(20); h = POS_H(22.2); diff --git a/addons/settings/script_component.hpp b/addons/settings/script_component.hpp index d8e29d4ab..e362e4376 100644 --- a/addons/settings/script_component.hpp +++ b/addons/settings/script_component.hpp @@ -37,17 +37,13 @@ #define IDC_PRESETS_CANCEL 8006 #define IDC_PRESETS_DELETE 8007 -#define IS_APEX (productVersion select 2 >= 162) - -#define POS_X(N) ((N) * GUI_GRID_W + ([GUI_GRID_X, GUI_GRID_CENTER_X] select IS_APEX)) -#define POS_X_LOW(N) ((N) * GUI_GRID_W + GUI_GRID_X) -#define POS_Y(N) ((N) * GUI_GRID_H + ([GUI_GRID_Y, GUI_GRID_CENTER_Y] select IS_APEX)) -#define POS_Y_LOW(N) ((N) * GUI_GRID_H + GUI_GRID_Y) +#define POS_X(N) ((N) * GUI_GRID_W + GUI_GRID_CENTER_X) +#define POS_Y(N) ((N) * GUI_GRID_H + GUI_GRID_CENTER_Y) #define POS_W(N) ((N) * GUI_GRID_W) #define POS_H(N) ((N) * GUI_GRID_H) -#define POS_X_CENTERED(N) ((N) * GUI_GRID_W + GUI_GRID_CENTER_X) -#define POS_Y_CENTERED(N) ((N) * GUI_GRID_H + GUI_GRID_CENTER_Y) +#define POS_X_LOW(N) ((N) * GUI_GRID_W + GUI_GRID_X) +#define POS_Y_LOW(N) ((N) * GUI_GRID_H + GUI_GRID_Y) #define COLOR_TEXT_DISABLED [1,1,1,0.3] #define COLOR_BUTTON_ENABLED [1,1,1,1] diff --git a/addons/statemachine/CfgEventHandlers.hpp b/addons/statemachine/CfgEventHandlers.hpp index e8171fca9..93e3311cf 100644 --- a/addons/statemachine/CfgEventHandlers.hpp +++ b/addons/statemachine/CfgEventHandlers.hpp @@ -1,11 +1,11 @@ class Extended_PreStart_EventHandlers { class ADDON { - init = QUOTE(if (!IS_LINUX) then {call COMPILE_FILE(XEH_preStart)}); + init = QUOTE(call COMPILE_FILE(XEH_preStart)); }; }; class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(if (!IS_LINUX) then {call COMPILE_FILE(XEH_preInit)}); + init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; diff --git a/addons/xeh/fnc_compileEventHandlers.sqf b/addons/xeh/fnc_compileEventHandlers.sqf index 628b37617..7b91ba7d8 100644 --- a/addons/xeh/fnc_compileEventHandlers.sqf +++ b/addons/xeh/fnc_compileEventHandlers.sqf @@ -1,203 +1,199 @@ -/* ---------------------------------------------------------------------------- -Function: CBA_fnc_compileEventHandlers - -Description: - Compiles all Extended EventHandlers in given config. - -Parameters: - 0: _baseConfig - What config file should be used. - -Returns: - Compiled code of all Extended EventHandlers - format: [event1, event2, ..., eventN] - eventX format: [_className , _eventName , _eventFunc , _allowInheritance , _excludedClasses ] - -Examples: - (begin example) - configFile call CBA_fnc_compileEventHandlers; - (end) - -Author: - commy2 ----------------------------------------------------------------------------- */ -#include "script_component.hpp" - -params [["_baseConfig", configNull, [configNull]]]; - -private _result = []; -private _resultNames = []; - -// note: format is never used for config parsing here, because of it's 8192 character limitation. - -{ - private _eventName = _x; - - { - private _eventFunc = ""; - private _customName = configName _x; - - if (isClass _x) then { - // events on clients and server - private _entry = _x >> "init"; - - if (isText _entry) then { - _eventFunc = _eventFunc + getText _entry + ";"; - }; - - // client only events - if (!isDedicated) then { - _entry = _x >> "clientInit"; - - if (isText _entry) then { - _eventFunc = _eventFunc + getText _entry + ";"; - }; - }; - - // server only events - if (isServer) then { - _entry = _x >> "serverInit"; - - if (isText _entry) then { - _eventFunc = _eventFunc + getText _entry + ";"; - }; - }; - } else { - // global events - if (isText _x) then { - _eventFunc = getText _x + ";"; - }; - }; - - if !(_eventFunc isEqualTo "") then { - _eventFunc = compile _eventFunc; - TRACE_2("does something",_customName,_eventName); - } else { - _eventFunc = {}; - TRACE_2("does NOT do something",_customName,_eventName); - }; - - _result pushBack ["", _eventName, _eventFunc]; - _resultNames pushBack _customName; - } forEach configProperties [_baseConfig >> XEH_FORMAT_CONFIG_NAME(_eventName)]; -} forEach ["preInit", "postInit"]; - -// object events -{ - private _eventName = _x; - - { - private _entryName = _eventName; // how the entries are labeled, e.g. init, serverInit - - private _className = configName _x; - private _eventFuncBase = ""; - - if (_eventName == "initPost") then { - _entryName = "init"; - }; - - // backwards compatibility - if (_eventName == "fired") then { - // generate backwards compatible format of _this - _eventFuncBase = "private _this = [_this select 0, _this select 1, _this select 2, _this select 3, _this select 4, _this select 6, _this select 5];"; - diag_log text format ["[XEH]: Usage of deprecated Extended Event Handler ""fired"". Use ""firedBIS"" instead. Path: %1\%2\%3\%4.", configSourceMod _x, _baseConfig, XEH_FORMAT_CONFIG_NAME(_eventName), _className]; - }; - - { - private _eventFunc = _eventFuncBase; - private _customName = configName _x; - private _allowInheritance = true; - private _excludedClasses = []; - - if (isClass _x) then { - // allow inheritance of this event? - private _scope = _x >> "scope"; - - if (isNumber _scope) then { - _allowInheritance = getNumber _scope != 0; - }; - - // classes excluded from this event - private _exclude = _x >> "exclude"; - - if (isArray _exclude) then { - _excludedClasses append getArray _exclude; - }; - - if (isText _exclude) then { - _excludedClasses pushBack getText _exclude; - }; - - // events on clients and server - private _entry = _x >> _entryName; - - if (isText _entry) then { - _eventFunc = _eventFunc + getText _entry + ";"; - }; - - // client only events - if (!isDedicated) then { - _entry = _x >> format ["client%1", _entryName]; - - if (isText _entry) then { - _eventFunc = _eventFunc + getText _entry + ";"; - }; - }; - - // server only events - if (isServer) then { - _entry = _x >> format ["server%1", _entryName]; - - if (isText _entry) then { - _eventFunc = _eventFunc + getText _entry + ";"; - }; - }; - - // init event handlers that should run on respawn again, onRespawn = 1 - if (toLower _eventName in ["init", "initpost"] && {getNumber (_x >> "onRespawn") == 1}) then { - _eventFunc = _eventFunc + "(_this select 0) addEventHandler ['Respawn', " + str _eventFunc + "];"; - }; - } else { - // global events - if (isText _x) then { - _eventFunc = _eventFunc + getText _x + ";"; - }; - }; - - // emulate oo-like inheritance by adding classnames that would redefine an event by using the same custom event name to the excluded classes - { - (_result select _forEachIndex) params ["_classNameX", "_eventNameX"]; - - // same custom name and same event type - if (_customName == _x && {_eventName == _eventNameX}) then { - // has parent already set, update parent to exclude this class - if (_className isKindOf _classNameX) then { - (_result select _forEachIndex select 4) pushBack _className; - }; - - // has child already set, add child to excluded classes - if (_classNameX isKindOf _className) then { - _excludedClasses pushBack _classNameX; - }; - }; - } forEach _resultNames; - - // only add event on machines where it exists - if !(_eventFunc isEqualTo _eventFuncBase) then { - _eventFunc = compile _eventFunc; - TRACE_3("does something",_customName,_className,_eventName); - } else { - _eventFunc = {}; - TRACE_3("does NOT do something",_customName,_className,_eventName); - }; - - _result pushBack [_className, _eventName, _eventFunc, _allowInheritance, _excludedClasses]; - _resultNames pushBack _customName; - } forEach configProperties [_x]; - } forEach configProperties [_baseConfig >> XEH_FORMAT_CONFIG_NAME(_eventName), "isClass _x"]; -} forEach [XEH_EVENTS]; - -#ifndef LINUX_BUILD - _result select {!((_x select 2) isEqualTo {})} -#else - [_result, {!((_x select 2) isEqualTo {})}] call BIS_fnc_conditionalSelect -#endif +/* ---------------------------------------------------------------------------- +Function: CBA_fnc_compileEventHandlers + +Description: + Compiles all Extended EventHandlers in given config. + +Parameters: + 0: _baseConfig - What config file should be used. + +Returns: + Compiled code of all Extended EventHandlers + format: [event1, event2, ..., eventN] + eventX format: [_className , _eventName , _eventFunc , _allowInheritance , _excludedClasses ] + +Examples: + (begin example) + configFile call CBA_fnc_compileEventHandlers; + (end) + +Author: + commy2 +---------------------------------------------------------------------------- */ +#include "script_component.hpp" + +params [["_baseConfig", configNull, [configNull]]]; + +private _result = []; +private _resultNames = []; + +// note: format is never used for config parsing here, because of it's 8192 character limitation. + +{ + private _eventName = _x; + + { + private _eventFunc = ""; + private _customName = configName _x; + + if (isClass _x) then { + // events on clients and server + private _entry = _x >> "init"; + + if (isText _entry) then { + _eventFunc = _eventFunc + getText _entry + ";"; + }; + + // client only events + if (!isDedicated) then { + _entry = _x >> "clientInit"; + + if (isText _entry) then { + _eventFunc = _eventFunc + getText _entry + ";"; + }; + }; + + // server only events + if (isServer) then { + _entry = _x >> "serverInit"; + + if (isText _entry) then { + _eventFunc = _eventFunc + getText _entry + ";"; + }; + }; + } else { + // global events + if (isText _x) then { + _eventFunc = getText _x + ";"; + }; + }; + + if !(_eventFunc isEqualTo "") then { + _eventFunc = compile _eventFunc; + TRACE_2("does something",_customName,_eventName); + } else { + _eventFunc = {}; + TRACE_2("does NOT do something",_customName,_eventName); + }; + + _result pushBack ["", _eventName, _eventFunc]; + _resultNames pushBack _customName; + } forEach configProperties [_baseConfig >> XEH_FORMAT_CONFIG_NAME(_eventName)]; +} forEach ["preInit", "postInit"]; + +// object events +{ + private _eventName = _x; + + { + private _entryName = _eventName; // how the entries are labeled, e.g. init, serverInit + + private _className = configName _x; + private _eventFuncBase = ""; + + if (_eventName == "initPost") then { + _entryName = "init"; + }; + + // backwards compatibility + if (_eventName == "fired") then { + // generate backwards compatible format of _this + _eventFuncBase = "private _this = [_this select 0, _this select 1, _this select 2, _this select 3, _this select 4, _this select 6, _this select 5];"; + diag_log text format ["[XEH]: Usage of deprecated Extended Event Handler ""fired"". Use ""firedBIS"" instead. Path: %1\%2\%3\%4.", configSourceMod _x, _baseConfig, XEH_FORMAT_CONFIG_NAME(_eventName), _className]; + }; + + { + private _eventFunc = _eventFuncBase; + private _customName = configName _x; + private _allowInheritance = true; + private _excludedClasses = []; + + if (isClass _x) then { + // allow inheritance of this event? + private _scope = _x >> "scope"; + + if (isNumber _scope) then { + _allowInheritance = getNumber _scope != 0; + }; + + // classes excluded from this event + private _exclude = _x >> "exclude"; + + if (isArray _exclude) then { + _excludedClasses append getArray _exclude; + }; + + if (isText _exclude) then { + _excludedClasses pushBack getText _exclude; + }; + + // events on clients and server + private _entry = _x >> _entryName; + + if (isText _entry) then { + _eventFunc = _eventFunc + getText _entry + ";"; + }; + + // client only events + if (!isDedicated) then { + _entry = _x >> format ["client%1", _entryName]; + + if (isText _entry) then { + _eventFunc = _eventFunc + getText _entry + ";"; + }; + }; + + // server only events + if (isServer) then { + _entry = _x >> format ["server%1", _entryName]; + + if (isText _entry) then { + _eventFunc = _eventFunc + getText _entry + ";"; + }; + }; + + // init event handlers that should run on respawn again, onRespawn = 1 + if (toLower _eventName in ["init", "initpost"] && {getNumber (_x >> "onRespawn") == 1}) then { + _eventFunc = _eventFunc + "(_this select 0) addEventHandler ['Respawn', " + str _eventFunc + "];"; + }; + } else { + // global events + if (isText _x) then { + _eventFunc = _eventFunc + getText _x + ";"; + }; + }; + + // emulate oo-like inheritance by adding classnames that would redefine an event by using the same custom event name to the excluded classes + { + (_result select _forEachIndex) params ["_classNameX", "_eventNameX"]; + + // same custom name and same event type + if (_customName == _x && {_eventName == _eventNameX}) then { + // has parent already set, update parent to exclude this class + if (_className isKindOf _classNameX) then { + (_result select _forEachIndex select 4) pushBack _className; + }; + + // has child already set, add child to excluded classes + if (_classNameX isKindOf _className) then { + _excludedClasses pushBack _classNameX; + }; + }; + } forEach _resultNames; + + // only add event on machines where it exists + if !(_eventFunc isEqualTo _eventFuncBase) then { + _eventFunc = compile _eventFunc; + TRACE_3("does something",_customName,_className,_eventName); + } else { + _eventFunc = {}; + TRACE_3("does NOT do something",_customName,_className,_eventName); + }; + + _result pushBack [_className, _eventName, _eventFunc, _allowInheritance, _excludedClasses]; + _resultNames pushBack _customName; + } forEach configProperties [_x]; + } forEach configProperties [_baseConfig >> XEH_FORMAT_CONFIG_NAME(_eventName), "isClass _x"]; +} forEach [XEH_EVENTS]; + +_result select {!((_x select 2) isEqualTo {})} diff --git a/addons/xeh/fnc_compileEventHandlers_Linux.sqf b/addons/xeh/fnc_compileEventHandlers_Linux.sqf deleted file mode 100644 index e96cf6f60..000000000 --- a/addons/xeh/fnc_compileEventHandlers_Linux.sqf +++ /dev/null @@ -1,2 +0,0 @@ -#define LINUX_BUILD -#include "fnc_compileEventHandlers.sqf" diff --git a/addons/xeh/fnc_postInit_unscheduled.sqf b/addons/xeh/fnc_postInit_unscheduled.sqf index 1c0d96a5b..acb3517be 100644 --- a/addons/xeh/fnc_postInit_unscheduled.sqf +++ b/addons/xeh/fnc_postInit_unscheduled.sqf @@ -1,50 +1,50 @@ -/* ---------------------------------------------------------------------------- -Function: CBA_fnc_postInit_unscheduled - -Description: - Occurs once per mission after objects and functions are initialized. - Internal use only. - -Parameters: - None - -Returns: - None - -Author: - commy2 ----------------------------------------------------------------------------- */ -#include "script_component.hpp" - -XEH_LOG("XEH: PostInit started. " + PFORMAT_9("MISSIONINIT",missionName,missionVersion,worldName,isMultiplayer,isServer,isDedicated,CBA_isHeadlessClient,hasInterface,didJIP) + format [ARR_2(", isLinux=%1",IS_LINUX)]); - -// fix CBA_missionTime being -1 on (non-JIP) clients at mission start. -if (CBA_missionTime == -1) then { - CBA_missionTime = 0; -}; - -// call PostInit events -{ - if (_x select 1 == "postInit") then { - [] call (_x select 2); - }; -} forEach GVAR(allEventHandlers); - -// do InitPost -{ - _x params ["_this"]; - - { - [_this] call _x; - } forEach (_this getVariable QGVAR(initPost)); -} forEach GVAR(initPostStack); - -GVAR(initPostStack) = nil; - -#ifdef DEBUG_MODE_FULL - diag_log text format ["isScheduled = %1", call CBA_fnc_isScheduled]; -#endif - -SLX_XEH_MACHINE set [8, true]; // PostInit passed - -XEH_LOG("XEH: PostInit finished."); +/* ---------------------------------------------------------------------------- +Function: CBA_fnc_postInit_unscheduled + +Description: + Occurs once per mission after objects and functions are initialized. + Internal use only. + +Parameters: + None + +Returns: + None + +Author: + commy2 +---------------------------------------------------------------------------- */ +#include "script_component.hpp" + +XEH_LOG("XEH: PostInit started. " + PFORMAT_9("MISSIONINIT",missionName,missionVersion,worldName,isMultiplayer,isServer,isDedicated,CBA_isHeadlessClient,hasInterface,didJIP)); + +// fix CBA_missionTime being -1 on (non-JIP) clients at mission start. +if (CBA_missionTime == -1) then { + CBA_missionTime = 0; +}; + +// call PostInit events +{ + if (_x select 1 == "postInit") then { + [] call (_x select 2); + }; +} forEach GVAR(allEventHandlers); + +// do InitPost +{ + _x params ["_this"]; + + { + [_this] call _x; + } forEach (_this getVariable QGVAR(initPost)); +} forEach GVAR(initPostStack); + +GVAR(initPostStack) = nil; + +#ifdef DEBUG_MODE_FULL + diag_log text format ["isScheduled = %1", call CBA_fnc_isScheduled]; +#endif + +SLX_XEH_MACHINE set [8, true]; // PostInit passed + +XEH_LOG("XEH: PostInit finished.");