Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions addons/bitwise/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class CfgFunctions {
PATHTO_FNC(bitwiseRSHFT);
PATHTO_FNC(bitwiseXOR);
PATHTO_FNC(logBase2);
PATHTO_FNC(toBitMask);
};
};
};
30 changes: 30 additions & 0 deletions addons/bitwise/fnc_toBitMask.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "script_component.hpp"
/* ----------------------------------------------------------------------------
Function: CBA_fnc_toBitMask
Description:
Convert an array of booleans into a number.
Takes Input <ARRAY of BOOLs> (limited to float precision)

Parameters:
_input - Boolean (least significant bit) <BOOL>

Returns:
Bitmask <NUMBER>

Examples
(begin example)
[[true, false]] call CBA_fnc_toBitmask
(end)

Author:
commy2
---------------------------------------------------------------------------- */
SCRIPT(toBitMask);
params [["_input", [], [[]]]];

private _result = 0;
{
if (_x) then {_result = _result + 2 ^ _forEachIndex};
} forEach _input;

_result;
3 changes: 3 additions & 0 deletions addons/common/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class CfgFunctions {
PATHTO_FNC(inheritsFrom);
PATHTO_FNC(getTurret);
PATHTO_FNC(getNonPresetClass);
PATHTO_FNC(isModLoaded);
};

class Entities {
Expand Down Expand Up @@ -153,6 +154,8 @@ class CfgFunctions {
PATHTO_FNC(cssColorToHEX);
PATHTO_FNC(cssColorToTexture);
PATHTO_FNC(attachToBone);
PATHTO_FNC(binarizeNumber);
PATHTO_FNC(endRadioTransmission);
};

class Broken {
Expand Down
4 changes: 3 additions & 1 deletion addons/common/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ CBA_logic = objNull;
};
}] call CBA_fnc_compileFinal;

GVAR(isModLoadedCache) = createHashMap;

// FSM
GVAR(delayless) = QUOTE(PATHTOF(delayless.fsm));
GVAR(delayless_loop) = QUOTE(PATHTOF(delayless_loop.fsm));
Expand All @@ -41,7 +43,7 @@ GVAR(featureCamerasNames) = [
"animViewer", // Animation viewer camera
"classic" // Classic camera
];
if (isClass (configFile >> "CfgPatches" >> "missions_f_vietnam")) then { // Add SOG Cinematic module camera if CDLC loaded
if ("missions_f_vietnam" call CBA_fnc_isModLoaded) then { // Add SOG Cinematic module camera if CDLC loaded
["vn_cinematic", {missionNamespace getVariable ["vn_cinematic_running", false]}] call CBA_fnc_registerFeatureCamera;
};

Expand Down
49 changes: 49 additions & 0 deletions addons/common/fnc_binarizeNumber.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include "script_component.hpp"
/* ----------------------------------------------------------------------------
Function: CBA_fnc_binarizeNumber
Description:
Get a binary equivalent of a decimal number.

Parameters:
_number - Decimal Number <NUMBER>
_minLength - Minimum length of the returned Array, note: returned array can be larger (optional, default: 8)<NUMBER>

Returns:
Booleans <ARRAY>

Examples
(begin example)
[5, 5] call CBA_fnc_binarizeNumber
(end)

Author:
commy2
---------------------------------------------------------------------------- */
SCRIPT(binarizeNumber);
params [
["_number", nil, [0]],
["_minLength", 8, [0]]
];

if (isNil "_number") exitWith {};

_number = round _number;

private _array = [];
_array resize _minLength;

for "_index" from 0 to (_minLength - 1) do {
_array set [_index, false];
};

private _index = 0;

while {_number > 0} do {
private _rest = _number mod 2;
_number = floor (_number / 2);

_array set [_index, _rest == 1];
_index = _index + 1;
};

_array;
45 changes: 45 additions & 0 deletions addons/common/fnc_endRadioTransmission.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include "script_component.hpp"
/* ----------------------------------------------------------------------------
Function: CBA_fnc_endRadioTransmission

Description:
End radio transmissions of addons TFAR and ACRE2. TFAR v0.9.x, ACRE Public Beta 2.0.3.571, TFAR v1.0.-1.x

Parameters:
None

Returns:
None

Examples:
(begin example)
[] call CBA_fnc_endRadioTransmission
(end)

Author:
commy2
---------------------------------------------------------------------------- */
SCRIPT(endRadioTransmission);

["CBA_endRadioTransmissions"] call CBA_fnc_localEvent;
["ace_endRadioTransmissions"] call CBA_fnc_localEvent; // Ported from ACE

// ACRE
if ("acre_main" call CBA_fnc_isModLoaded) then {
[-1] call acre_sys_core_fnc_handleMultiPttKeyPressUp;
[0] call acre_sys_core_fnc_handleMultiPttKeyPressUp;
[1] call acre_sys_core_fnc_handleMultiPttKeyPressUp;
[2] call acre_sys_core_fnc_handleMultiPttKeyPressUp;
};

// TFAR
if ("task_force_radio" call CBA_fnc_isModLoaded) then {
if ("tfar_core" call CBA_fnc_isModLoaded) exitWith { // Beta TFAR, exit to avoid script errors from legacy functions not existing
([] call CBA_fnc_currentUnit) call TFAR_fnc_releaseAllTangents;
};
[] call TFAR_fnc_onSwTangentReleased;
[] call TFAR_fnc_onAdditionalSwTangentReleased;
[] call TFAR_fnc_onLRTangentReleased;
[] call TFAR_fnc_onAdditionalLRTangentReleased;
[] call TFAR_fnc_onDDTangentReleased;
};
24 changes: 24 additions & 0 deletions addons/common/fnc_isModLoaded.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "script_component.hpp"
/* ----------------------------------------------------------------------------
Function: CBA_fnc_isModLoaded
Description:
Check in CfgPatches if an addon is loaded

Parameters:
_modName - Classname of the mod in CfgPatches <STRING>

Returns:
True if addon is loaded, otherwise false <BOOL>

Examples
(begin example)
"class" call CBA_fnc_isModLoaded
(end)

Authors:
Glowbal, Grim
---------------------------------------------------------------------------- */
SCRIPT(isModLoaded);
params [["_modName", "", [""]]];

GVAR(isModLoadedCache) getOrDefaultCall [toLowerANSI _modName, { isClass (configFile >> "CfgPatches" >> _modName) }, true]
32 changes: 20 additions & 12 deletions addons/main/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,39 @@ class CfgPatches {
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {
"cba_accessory",
"cba_ai",
"cba_arrays",
"cba_bitwise",
"cba_characters",
"cba_common",
"cba_diagnostic",
"cba_disposable",
"cba_events",
"cba_hashes",
"cba_help",
"cba_jam",
"cba_jam_finish",
"cba_jr",
"cba_jr_prep",
"cba_keybinding",
"cba_loadout",
"cba_main",
"cba_modules",
"cba_music",
"cba_network",
"cba_optics",
"cba_pid",
"cba_pylons",
"cba_quicktime",
"cba_settings",
"cba_statemachine",
"cba_statuseffects",
"cba_strings",
"cba_vectors",
"cba_xeh",
"cba_accessory",
"cba_ai",
"cba_arrays",
"cba_diagnostic",
"cba_help",
"cba_jr",
"cba_jam",
"cba_ui",
"cba_vectors",
"cba_versioning",
"cba_optics",
"cba_disposable",
"cba_quicktime"
"cba_xeh",
};
author = "$STR_CBA_Author";
authors[] = {};
Expand Down
8 changes: 8 additions & 0 deletions addons/settings/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,12 @@ private _ctrlAddonOptions = (uiNamespace getVariable "RscDisplayMain") displayCt
_ctrlAddonOptions ctrlEnable true;
_ctrlAddonOptions ctrlSetTooltip LLSTRING(menu_button_tooltip);

GVAR(runAtSettingsInitialized) = [];
["CBA_settingsInitialized", {
{
(_this select 1) call (_this select 0);
} forEach GVAR(runAtSettingsInitialized);
GVAR(runAtSettingsInitialized) = nil;
}] call CBA_fnc_addEventHandler;

ADDON = true;
1 change: 1 addition & 0 deletions addons/statuseffects/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x\cba\addons\statuseffects
17 changes: 17 additions & 0 deletions addons/statuseffects/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_preInit));
};
};

class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_postInit));
};
};

class Extended_Engine_EventHandlers {
class All {
ADDON = QUOTE(call FUNC(handleEngine));
};
};
9 changes: 9 additions & 0 deletions addons/statuseffects/CfgFunctions.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CfgFunctions {
class CBA {
class StatusEffects {
PATHTO_FNC(addStatusEffectType);
PATHTO_FNC(getStatusEffect);
PATHTO_FNC(setStatusEffect);
};
};
};
5 changes: 5 additions & 0 deletions addons/statuseffects/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREP(handleEngine);
PREP(localEH);
PREP(resetVariables);
PREP(respawnEH);
PREP(sendEffects);
Loading
Loading