diff --git a/addons/common/Cfg3DEN.hpp b/addons/common/Cfg3DEN.hpp new file mode 100644 index 000000000..01721e2bc --- /dev/null +++ b/addons/common/Cfg3DEN.hpp @@ -0,0 +1,14 @@ + +class Cfg3DEN { + class Group { + class AttributeCategories { + class Init { + class Attributes { + class Callsign { + expression = "[_this, _value] call CBA_fnc_setCallsign"; + }; + }; + }; + }; + }; +}; diff --git a/addons/common/CfgEventHandlers.hpp b/addons/common/CfgEventHandlers.hpp index e53a38deb..aab746c5e 100644 --- a/addons/common/CfgEventHandlers.hpp +++ b/addons/common/CfgEventHandlers.hpp @@ -1,10 +1,4 @@ -class Extended_PreStart_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); - }; -}; - class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/common/CfgFunctions.hpp b/addons/common/CfgFunctions.hpp index 62d3c2cc5..954b51908 100644 --- a/addons/common/CfgFunctions.hpp +++ b/addons/common/CfgFunctions.hpp @@ -25,6 +25,7 @@ class CfgFunctions { PATHTO_FNC(getGroupIndex); PATHTO_FNC(getMagazineIndex); PATHTO_FNC(currentMagazineIndex); + PATHTO_FNC(setCallsign); }; class Soldiers { diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index e1975a131..2a2a3be60 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -35,28 +35,11 @@ for "_i" from 0 to ((count (CFG)) - 1) do { }; }; -// system to synch team colors -// Note: 1.62 added Multiplayer synchronization for assigned team -// Run the PFEH only if on previous versions, keep the event for backwards compatability - -PREP(onTeamColorChanged); -PREP(synchTeamColors); - -["CBA_teamColorChanged", FUNC(onTeamColorChanged)] call CBA_fnc_addEventHandler; - -if (hasInterface && {(productVersion select 2) < 162}) then { - [FUNC(synchTeamColors), 1, []] call CBA_fnc_addPerFrameHandler; - - if (didJIP) then { - { - private _team = _x getVariable [QGVAR(synchedTeam), ""]; - if (_team != "") then { - _x assignTeam _team; - }; - true - } count allUnits; - }; -}; +// event for switching team colors, DEPRECATED +["CBA_teamColorChanged", { + params ["_unit", "_team"]; + _unit assignTeam _team; +}] call CBA_fnc_addEventHandler; //Event for switching vehicle var names from CBA_fnc_switchPlayer ["CBA_setVehicleVarName", { diff --git a/addons/common/XEH_preStart.sqf b/addons/common/XEH_preStart.sqf deleted file mode 100644 index 87c0b5c2d..000000000 --- a/addons/common/XEH_preStart.sqf +++ /dev/null @@ -1,4 +0,0 @@ -#include "script_component.hpp" - -PREP(onTeamColorChanged); -PREP(synchTeamColors); diff --git a/addons/common/config.cpp b/addons/common/config.cpp index c930164c1..ad1c320b3 100644 --- a/addons/common/config.cpp +++ b/addons/common/config.cpp @@ -8,12 +8,13 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"A3_BaseConfig_F"}; + requiredAddons[] = {"A3_BaseConfig_F","A3_3DEN"}; version = VERSION; authors[] = {"Spooner","Sickboy","Rocko"}; }; }; +#include "Cfg3DEN.hpp" #include "CfgEventHandlers.hpp" #include "CfgFunctions.hpp" diff --git a/addons/common/fnc_onTeamColorChanged.sqf b/addons/common/fnc_onTeamColorChanged.sqf deleted file mode 100644 index 2a13d0782..000000000 --- a/addons/common/fnc_onTeamColorChanged.sqf +++ /dev/null @@ -1,27 +0,0 @@ -/* ---------------------------------------------------------------------------- -Internal Function: CBA_common_fnc_onTeamColorChanged - -Description: - Assigns the units team color if it changed on the squad leaders machine. - -Parameters: - _unit - unit [OBJECT] - _team - team the unit got assigned to [STRING] - -Returns: - Nothing - -Author: - BaerMitUmlaut ----------------------------------------------------------------------------- */ -#include "script_component.hpp" - -params ["_unit", "_team"]; - -_unit assignTeam _team; - -if ((productVersion select 2) >= 162) exitWith {}; - -if (local (leader _unit)) then { - _unit setVariable [QGVAR(synchedTeam), _team, true]; -}; diff --git a/addons/common/fnc_setCallsign.sqf b/addons/common/fnc_setCallsign.sqf new file mode 100644 index 000000000..75a23f50d --- /dev/null +++ b/addons/common/fnc_setCallsign.sqf @@ -0,0 +1,39 @@ +/* ---------------------------------------------------------------------------- +Function: CBA_fnc_setCallsign + +Description: + Set call sign of a group. + + Works in SP, MP and Eden-Editor and at any point. + +Parameters: + _group - A group + _callsign - The call sign the group should receive + +Returns: + Nothing + +Example: + (begin example) + [group player, "Banana Squad"] call CBA_fnc_setCallsign + (end) + +Author: + snippers, commy2 +---------------------------------------------------------------------------- */ +#include "script_component.hpp" +SCRIPT(setCallsign); + +params [["_group", grpNull, [grpNull, objNull]], ["_callsign", "", [""]]]; + +private _group = _group call CBA_fnc_getGroup; + +if (is3DEN) then { + _group setGroupId [_callsign]; +}; + +[{ + params ["_group", "_callsign"]; + + _group setGroupIdGlobal [_callsign]; +}, [_group, _callsign]] call CBA_fnc_execNextFrame; diff --git a/addons/common/fnc_synchTeamColors.sqf b/addons/common/fnc_synchTeamColors.sqf deleted file mode 100644 index dc51271fb..000000000 --- a/addons/common/fnc_synchTeamColors.sqf +++ /dev/null @@ -1,26 +0,0 @@ -/* ---------------------------------------------------------------------------- -Internal Function: CBA_common_fnc_synchTeamColors - -Description: - Synchs the team colors. Does not need to be called manually. - -Parameters: - None - -Returns: - Nothing - -Author: - BaerMitUmlaut ----------------------------------------------------------------------------- */ -#include "script_component.hpp" - -if (leader player == player) then { - { - if ((assignedTeam _x) != (_x getVariable [QGVAR(synchedTeam), "MAIN"])) then { - //Local team != currently synched team, so we need to synchronize them again - ["CBA_teamColorChanged", [_x, assignedTeam _x]] call CBA_fnc_globalEvent; - }; - true - } count units player; -}; diff --git a/addons/diagnostic/CfgEventHandlers.hpp b/addons/diagnostic/CfgEventHandlers.hpp index 63b96e1ed..ea49e36f3 100644 --- a/addons/diagnostic/CfgEventHandlers.hpp +++ b/addons/diagnostic/CfgEventHandlers.hpp @@ -1,10 +1,4 @@ -class Extended_PreStart_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); - }; -}; - class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/diagnostic/XEH_preInit.sqf b/addons/diagnostic/XEH_preInit.sqf index 2b2e99f0f..28356dbbc 100644 --- a/addons/diagnostic/XEH_preInit.sqf +++ b/addons/diagnostic/XEH_preInit.sqf @@ -1,9 +1,10 @@ -// Any registered functions used in the PreINIT phase must use the uiNamespace copies of the variable. -// So uiNamespace getVariable "CBA_fnc_hashCreate" instead of just CBA_fnc_hashCreate -VM #include "script_component.hpp" +SCRIPT(XEH_preInit); LOG(MSG_INIT); -[QUOTE(GVAR(debug)), { _this call (uiNamespace getVariable "CBA_fnc_debug") }] call (uiNamespace getVariable "CBA_fnc_addEventHandler"); +ADDON = false; -PREP(perf_loop); +[QGVAR(debug), {_this call CBA_fnc_debug}] call CBA_fnc_addEventHandler; + +ADDON = true; diff --git a/addons/diagnostic/XEH_preStart.sqf b/addons/diagnostic/XEH_preStart.sqf deleted file mode 100644 index eb6d8c1b0..000000000 --- a/addons/diagnostic/XEH_preStart.sqf +++ /dev/null @@ -1,3 +0,0 @@ -#include "script_component.hpp" - -PREP(perf_loop); diff --git a/addons/diagnostic/fnc_debug.sqf b/addons/diagnostic/fnc_debug.sqf index eb35d4941..7b8705285 100644 --- a/addons/diagnostic/fnc_debug.sqf +++ b/addons/diagnostic/fnc_debug.sqf @@ -4,129 +4,103 @@ Function: CBA_fnc_debug Description: General Purpose Debug Message Writer - Handles very long messages without losing text or crashing the game. + Handles very long messages without losing text. Parameters: - _message - Message to write or data structure to dump [String or Array]. - _component - component [String, defaults to "CBA_DIAGNOSTIC"] - _typeOfDebug - Type of message [3-element Array, as described below...] - ... _useGlobalChat - Write to global chat [Boolean, defaults to true]. - ... _local - Log to local arma.rpt [Boolean, defaults to true] - ... _global - Log to local and remote arma.rpt [Boolean, defaults to false] + _message - Message to write + _title - Message title (optional, default: "cba_diagnostic") + _type - Type of message + 0: _useChat - Write to chat (optional, default: true) + 1: _useLog - Log to arma.rpt (optional, default: true) + 2: _global - true: execute global (optional, default: false) Returns: nil Examples: (begin example) - // Write the debug message in chat-log of local computer, and in - // local and remote arma.rpt. - [ "New Player Joined the Server!", "cba_network", [true, false, true] ] call CBA_fnc_debug; + // Write the debug message in chat-log of every client + ["New Player Joined the Server!", "cba_network", [true, false, true]] call CBA_fnc_debug; (end) Author: - Sickboy + Sickboy, commy2 ---------------------------------------------------------------------------- */ - #include "script_component.hpp" -if (isNil QUOTE(ADDON)) then -{ - CREATELOGICLOCAL; - // GVAR(debug) = []; // TODO: Evaluate if this is useful... Logging to rpt and using a tail reader seems okay too! -}; +// function to split lines into multiple lines with a maxium length +#define MAX_LINE_LENGTH 120 -_ar2msg = { - private ["_ar", "_str", "_msg", "_orig", "_total", "_i"]; - _ar = []; - if (typeName (_this select 0) == "ARRAY") then - { - _orig = _this select 0; - _str = format["%1 [", _this select 1]; - } else { - _orig = _this; - _str = "["; - }; - { _ar pushBack (toArray _x) } forEach _orig; - _msg = []; - _total = 0; _i = 0; - { - _c = count _x; - if (_total + _c < 178) then - { - _total = _total + _c; - if (_i > 0) then { _str = _str + ", " }; - _str = _str + toString(_x); - } else { - _msg pushBack _str; - _total = _c; - _str = toString(_x); - }; - _i = _i + 1; - } forEach _ar; - _str = _str + "]"; - _msg pushBack _str; - _msg -}; +private _fnc_splitLines = { + private _return = []; -_str2msg = { - private ["_ar", "_i", "_nar", "_msg"]; - _ar = toArray _this; - if (count _ar < 180) exitWith { [_this] }; - _i = 0; _nar = []; _msg = []; { - if (_i < 180) then - { - _nar pushBack _x; - _i = _i + 1; - } else { - _msg pushBack (toString(_nar)); - _nar = [_x]; - _i = 1; + private _string = _x; + + while {count _string > 0} do { + _return pushBack (_string select [0, MAX_LINE_LENGTH]); + _string = _string select [MAX_LINE_LENGTH]; }; - } forEach _ar; - if (count _nar > 0) then { _msg pushBack (toString(_nar)) }; - _msg + } forEach _this; + + _return }; -_format = { - private ["_msg"]; - _msg = []; - switch (typeName _this) do - { - case "ARRAY": { { { _msg pushBack _x } forEach (_x call _str2msg) } forEach _this }; - case "STRING": { _msg = _this call _str2msg }; - default { _msg = format["%1", _this] call _str2msg }; - }; - _msg +// create a logic than can use the chat +if (isNil QGVAR(logic)) then { + GVAR(logic) = "Logic" createVehicleLocal [0,0,0]; }; -private ["_c", "_type", "_component", "_message", "_msg", "_ar2", "_i", "_msgAr"]; -_c = count _this; -_type = [true, true, false]; -_component = QUOTE(ADDON); -_message = _this select 0; -if (_c > 1) then -{ - _component = _this select 1; - if (_c > 2) then - { - _type = _this select 2; - }; +// input +params [["_message", "", ["", []]], ["_title", 'ADDON', [""]], ["_type", [], [[]]]]; + +_type params [ + ["_useChat", true, [false]], + ["_useLog", true, [false]], + ["_global", false, [false]] +]; + +// forward to remote machines +if (_global) then { + [QGVAR(debug), [_message, _title, [_useChat, _useLog, false]]] call CBA_fnc_remoteEvent; }; -if (_type select 2) exitWith -{ - [QGVAR(debug), [_message, _component, [_type select 0,_type select 1,false]]] call CBA_fnc_globalEvent; +// if string, split into seperate lines marked by "\n" +if (_message isEqualType "") then { + _message = [_message, "\n"] call CBA_fnc_split; }; -_msgAr = []; -switch (typeName _message) do -{ - case "ARRAY": { _msgAr = [format["%3 (%2) %1 -", _component, [time, "H:MM:SS.mmm"] call CBA_fnc_formatElapsedTime, [diag_tickTime, "H:MM:SS.mmm"] call CBA_fnc_formatElapsedTime]]; { _msgAr pushBack _x } forEach (_message call _ar2msg) }; - default { _msgAr = (format["%4 (%3) %1 - %2", _component, _message, [time, "H:MM:SS.mmm"] call CBA_fnc_formatElapsedTime, [diag_tickTime, "H:MM:SS.mmm"] call CBA_fnc_formatElapsedTime] call _format) }; +// format the first line to include title and time stamp +_message set [0, format [ + "(%3) %1 - %2", + _title, + _message select 0, + [CBA_missionTime, "H:MM:SS"] call CBA_fnc_formatElapsedTime +]]; + +_message = _message call _fnc_splitLines; + +// print in chat +if (_useChat) then { + // fix for chat-log being reset after the loading screen + if (time < 1) then { + _message spawn { + uiSleep 1; + + { + GVAR(logic) globalChat _x; + } forEach _this; + }; + } else { + { + GVAR(logic) globalChat _x; + } forEach _message; + }; }; -if (_type select 0) then { if (SLX_XEH_MACHINE select 0) then { { ADDON globalChat _x } forEach _msgAr } }; -if (_type select 1) then { { if (_x != "") then { diag_log text _x } } forEach _msgAr }; -//GVAR(debug) pushBack _msgAr; // TODO: Evaluate cleanup system? +// print in rpt-log +if (_useLog) then { + { + diag_log text _x; + } forEach _message; +}; diff --git a/addons/diagnostic/fnc_perf_loop.sqf b/addons/diagnostic/fnc_perf_loop.sqf deleted file mode 100644 index 95bd67619..000000000 --- a/addons/diagnostic/fnc_perf_loop.sqf +++ /dev/null @@ -1,161 +0,0 @@ -/* - Script performance measurements, by Sickboy. Originally by Rommel -*/ -// #define DEBUG_MODE_FULL -#include "script_component.hpp" -#define DELAY 1 -#define DIFF 1.1 -#define HIGH_DIFF 2 -#define INTERVAL 10 -#define LAG_INTERVAL 2 // INTERVAL -#define DEFAULT_VALUES diag_tickTime, time, diag_fps, diag_fpsMin - -/* - // For usage outside CBA - #define QUOTE(A) #A - #define GVAR(A) my_##A -*/ - -// temp -//GVAR(lag) = true; - -private ["_entry", "_create", "_dump", "_f"]; - -if (isNil QGVAR(running)) then { GVAR(running) = false }; -if (GVAR(running)) exitWith {}; // Already running -GVAR(running) = true; - -FUNC(lag) = { - //_unit = if (isNull player) then { allUnits select 0 } else { player }; - for "_i" from 0 to 100 do { - { _unit = _x; call compile format["nearestObjects [call compile ""_unit"", [""All""], 5000]"] } forEach allUnits; - }; -}; - -FUNC(lag3) = { - // Piece of ace_sys_maptools that caused lags for sys_missileguidance - DOUBLES(ADDON,compassRuler) = ""; - DOUBLES(ADDON,compassRose) = ""; - while { true } do { - if("ace_sys_maptools_tools_tools_tools" in ["A", "B", "C"]) then { - } else { - _actionId = -1; - deleteMarkerLocal QUOTE(DOUBLES(ADDON,compassRuler)); - deleteMarkerLocal QUOTE(DOUBLES(ADDON,compassRose)); - GVAR(MouseDown) = false; - GVAR(DragOK) = false; - GVAR(OffDrag) = false; - GVAR(LastDragPosition) = []; - GVAR(RulerStartPos) = []; - GVAR(MouseShift) = false; - GVAR(LastDragAzimuth) = -1000; - GVAR(MapLineSegmentStart) = [0, 0, 0]; - GVAR(MapLineColor) = 0; - GVAR(MapPreviousDir) = 0; - GVAR(RulerKeyDown) = -1000; - }; - }; - -}; - -FUNC(lag2) = { - { deleteVehicle _x } forEach _objects; // _x setDamage 1 - _objects = []; - for "_i" from 0 to 100 do { - _logic = "LOGIC" createVehicleLocal [0, 0, 0]; - _objects pushBack _logic; - }; -}; - - -GVAR(logs) = []; GVAR(ar) = []; -if (isNil QGVAR(log)) then { GVAR(log) = true }; -if (isNil QGVAR(lag)) then { GVAR(lag) = false }; -if (isNil QGVAR(interactive)) then { GVAR(interactive) = true }; - -_dump = { - //diag_log format ["%1 %2 %3 %4 %5",count allunits,time,diag_ticktime,diag_fpsmin,diag_fps]; -}; - -_create = { - private "_pid"; - _pid = SLX_XEH_STR spawn _dump; - waituntil {scriptDone _pid}; -}; - -waitUntil {SLX_XEH_MACHINE select 5}; // waitUntil player ready etc -TRACE_1("Started",GVAR(running)); - -if (time == 0) then { sleep 0.001 }; // Sleep until after the briefing - -// Induce lag by executing commands -if (GVAR(lag)) then { - SLX_XEH_STR spawn { - // By HojO - for "_i" from 0 to 100 do { - _null = SLX_XEH_STR spawn { while{true} do {_LagMyGame = sin(cos(tan(sin(cos(tan(sin(cos(tan(0.12345678)))))))));} }; - }; - /* - private ["_nextTime", "_objects", "_logic"]; - _nextTime = time + LAG_INTERVAL; - _objects = []; - while {GVAR(lag)} do { - waitUntil {time > _nextTime}; - TRACE_1("Lag Started",""); - // SLX_XEH_STR spawn FUNC(lag3); - call FUNC(lag); - _nextTime = time + LAG_INTERVAL; - TRACE_1("Lag Ended",""); - }; - */ - }; -}; - -// Output logged information and add warnings when appropriate -SLX_XEH_STR spawn { - private ["_nextTime", "_limit", "_high", "_a", "_b", "_deltaTick", "_deltaTime", "_log", "_do", "_ar"]; - _nextTime = time + INTERVAL; - _limit = DELAY * DIFF; - _high = DELAY * HIGH_DIFF; - while {GVAR(log)} do { - waitUntil {time > _nextTime}; - _ar = GVAR(ar); GVAR(ar) = []; - _log = ["Current", DEFAULT_VALUES]; - GVAR(logs) pushBack _log; - { - // TODO: Also compare the delta between the previous few entries? - _a = _x select 0; _b = _x select 1; - _deltaTick = (_b select 0) - (_a select 0); - _deltaTime = (_b select 1) - (_a select 1); - _log = ["Delta", _a, _b, _deltaTick, _deltaTime]; - _do = false; - if (_deltaTime > _limit) then { _do = true; if (_deltaTime > _high) then { _log pushBack "WARNING: Large deltaTime"; _log pushBack _deltaTime } }; - if (_deltaTick > _limit) then { _do = true; if (_deltaTick > _high) then { _log pushBack "WARNING: Large deltaTick"; _log pushBack _deltaTick } }; - if (_do) then { GVAR(logs) pushBack _log }; - } forEach _ar; - if (GVAR(interactive)) then { - // Output at each iteration - { diag_log _x } forEach GVAR(logs); - GVAR(logs) = []; - }; - _nextTime = time + INTERVAL; - }; - if !(GVAR(interactive)) then { - // Output at exit - { diag_log _x } forEach GVAR(log); - }; - GVAR(log) = []; -}; - -// Sleep for DELAY seconds, then execute a simple command, and log the delta between the logged times and ticktimes -while {GVAR(log)} do { - _entry = [[DEFAULT_VALUES]]; - sleep DELAY; - [] call _create; - _entry pushBack [DEFAULT_VALUES]; - GVAR(ar) pushBack _entry; -}; - -GVAR(ar) = []; -GVAR(running) = false; -TRACE_1("Exit",GVAR(running)); diff --git a/addons/events/CfgFunctions.hpp b/addons/events/CfgFunctions.hpp index 3ba9eec4f..c750c20c1 100644 --- a/addons/events/CfgFunctions.hpp +++ b/addons/events/CfgFunctions.hpp @@ -82,6 +82,8 @@ class CfgFunctions { description = "Raises a CBA event on the target client ID's machine."; file = "\x\cba\addons\events\fnc_ownerEvent.sqf"; }; + PATHTO_FNC(addMarkerEventHandler); + PATHTO_FNC(removeMarkerEventHandler); }; }; }; diff --git a/addons/events/fnc_addMarkerEventHandler.sqf b/addons/events/fnc_addMarkerEventHandler.sqf new file mode 100644 index 000000000..419a7987b --- /dev/null +++ b/addons/events/fnc_addMarkerEventHandler.sqf @@ -0,0 +1,58 @@ +/* ---------------------------------------------------------------------------- +Function: CBA_fnc_addMarkerEventHandler + +Description: + Adds an event handler that executes code when a marker is created or deleted. + +Parameters: + _eventType - Type of event to add. Can be "created" or "deleted". + _function - Function to call when marker is created or deleted. + +Returns: + _eventId - Unique ID. Used with 'CBA_fnc_removeMarkerEventHandler'. + +Examples: + (begin example) + _id = ["created", {systemChat str _this}] call CBA_fnc_addMarkerEventHandler; + (end) + +Author: + commy2 +---------------------------------------------------------------------------- */ +#include "script_component.hpp" +SCRIPT(addMarkerEventHandler); + +params [["_eventType", "", [""]], ["_function", {}, [{}]]]; + +if (isNil QGVAR(oldMarkers)) then { + GVAR(oldMarkers) = allMapMarkers; + + [{ + private _newAllMapMarkers = allMapMarkers; + if !(_newAllMapMarkers isEqualTo GVAR(oldMarkers)) then { + params ["_events"]; + + { + [QGVAR(markerDeleted), [_x]] call CBA_fnc_localEvent; + } forEach (GVAR(oldMarkers) - _newAllMapMarkers); + + { + [QGVAR(markerCreated), [_x]] call CBA_fnc_localEvent; + } forEach (_newAllMapMarkers - GVAR(oldMarkers)); + + GVAR(oldMarkers) = _newAllMapMarkers; + }; + }, 0] call CBA_fnc_addPerFrameHandler; +}; + +if (_function isEqualTo {}) exitWith {-1}; + +switch (toLower _eventType) do { + case "created": { + [QGVAR(markerCreated), _function] call CBA_fnc_addEventHandler // return + }; + case "deleted": { + [QGVAR(markerDeleted), _function] call CBA_fnc_addEventHandler // return + }; + default {-1}; +}; diff --git a/addons/events/fnc_removeMarkerEventHandler.sqf b/addons/events/fnc_removeMarkerEventHandler.sqf new file mode 100644 index 000000000..12f604acc --- /dev/null +++ b/addons/events/fnc_removeMarkerEventHandler.sqf @@ -0,0 +1,36 @@ +/* ---------------------------------------------------------------------------- +Function: CBA_fnc_removeMarkerEventHandler + +Description: + Removes an event handler previously registered with 'CBA_fnc_addMarkerEventHandler'. + +Parameters: + _eventName - Type of event to remove. Can be "created" or "deleted". + _eventId - Unique ID of the event handler to remove. + +Returns: + None + +Examples: + (begin example) + ["created", _id] call CBA_fnc_removeMarkerEventHandler; + (end) + +Author: + commy2 +---------------------------------------------------------------------------- */ +#include "script_component.hpp" +SCRIPT(removeMarkerEventHandler); + +params [["_eventType", "", [""]], ["_eventId", -1, [0]]]; + +switch (toLower _eventType) do { + case "created": { + [QGVAR(markerCreated), _eventId] call CBA_fnc_removeEventHandler; + }; + case "deleted": { + [QGVAR(markerDeleted), _eventId] call CBA_fnc_removeEventHandler; + }; +}; + +nil diff --git a/addons/hashes/fnc_hashHasKey.sqf b/addons/hashes/fnc_hashHasKey.sqf index bf47da059..c05f54a05 100644 --- a/addons/hashes/fnc_hashHasKey.sqf +++ b/addons/hashes/fnc_hashHasKey.sqf @@ -23,6 +23,6 @@ Author: SCRIPT(hashHasKey); // ----------------------------------------------------------------------------- -params [["_hash", [], [[]]], "_key"]; +params [["_hash", [[], []], [[]]], "_key"]; _key in (_hash select HASH_KEYS); // Return. diff --git a/addons/jr/cfgweapons.hpp b/addons/jr/cfgweapons.hpp index 7b7e4b5e0..49aa78a0b 100644 --- a/addons/jr/cfgweapons.hpp +++ b/addons/jr/cfgweapons.hpp @@ -5,7 +5,11 @@ class CfgWeapons { class Rifle_Base_F : Rifle { class WeaponSlotsInfo; }; - + + class Rifle_Short_Base_F : Rifle_Base_F { + class WeaponSlotsInfo; + }; + class Rifle_Long_Base_F : Rifle_Base_F { class WeaponSlotsInfo; }; @@ -204,6 +208,11 @@ class CfgWeapons { class MuzzleSlot : asdg_MuzzleSlot_762MG { iconPosition[] = {0.1, 0.5}; iconScale = 0.2; + class compatibleItems: compatibleItems { + muzzle_snds_h = 1; + muzzle_snds_h_khk_F = 1; + muzzle_snds_h_snd_F = 1; + }; }; class CowsSlot: asdg_OpticRail1913_short_MG { iconPosition[] = {0.6, 0.45}; @@ -294,17 +303,9 @@ class CfgWeapons { class arifle_Katiba_F : arifle_Katiba_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { - class MuzzleSlot : asdg_MuzzleSlot_762 { + class MuzzleSlot : asdg_MuzzleSlot_65 { iconPosition[] = {0, 0.45}; iconScale = 0.2; - class compatibleItems: compatibleItems { - muzzle_snds_h = 1; - muzzle_snds_h_khk_F = 1; - muzzle_snds_h_snd_F = 1; - muzzle_snds_65_TI_blk_F = 1; - muzzle_snds_65_TI_hex_F = 1; - muzzle_snds_65_TI_ghex_F = 1; - }; }; class CowsSlot: asdg_OpticRail1913 { iconPosition[] = {0.45, 0.28}; @@ -319,17 +320,9 @@ class CfgWeapons { class arifle_Katiba_C_F : arifle_Katiba_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { - class MuzzleSlot : asdg_MuzzleSlot_762 { + class MuzzleSlot : asdg_MuzzleSlot_65 { iconPosition[] = {0.1, 0.45}; iconScale = 0.2; - class compatibleItems: compatibleItems { - muzzle_snds_h = 1; - muzzle_snds_h_khk_F = 1; - muzzle_snds_h_snd_F = 1; - muzzle_snds_65_TI_blk_F = 1; - muzzle_snds_65_TI_hex_F = 1; - muzzle_snds_65_TI_ghex_F = 1; - }; }; class CowsSlot: asdg_OpticRail1913 { iconPosition[] = {0.45, 0.28}; @@ -344,17 +337,9 @@ class CfgWeapons { class arifle_Katiba_GL_F : arifle_Katiba_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { - class MuzzleSlot : asdg_MuzzleSlot_762 { + class MuzzleSlot : asdg_MuzzleSlot_65 { iconPosition[] = {0, 0.45}; iconScale = 0.2; - class compatibleItems: compatibleItems { - muzzle_snds_h = 1; - muzzle_snds_h_khk_F = 1; - muzzle_snds_h_snd_F = 1; - muzzle_snds_65_TI_blk_F = 1; - muzzle_snds_65_TI_hex_F = 1; - muzzle_snds_65_TI_ghex_F = 1; - }; }; class CowsSlot: asdg_OpticRail1913 { iconPosition[] = {0.45, 0.28}; @@ -428,17 +413,9 @@ class CfgWeapons { class arifle_MXC_F : arifle_MX_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { - class MuzzleSlot : asdg_MuzzleSlot_762 { + class MuzzleSlot : asdg_MuzzleSlot_65 { iconPosition[] = {0, 0.4}; iconScale = 0.2; - class compatibleItems: compatibleItems { - muzzle_snds_h = 1; - muzzle_snds_h_khk_F = 1; - muzzle_snds_h_snd_F = 1; - muzzle_snds_65_TI_blk_F = 1; - muzzle_snds_65_TI_hex_F = 1; - muzzle_snds_65_TI_ghex_F = 1; - }; }; class CowsSlot: asdg_OpticRail1913 { iconPosition[] = {0.5, 0.3}; @@ -453,17 +430,9 @@ class CfgWeapons { class arifle_MX_F : arifle_MX_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { - class MuzzleSlot : asdg_MuzzleSlot_762 { + class MuzzleSlot : asdg_MuzzleSlot_65 { iconPosition[] = {0, 0.45}; iconScale = 0.2; - class compatibleItems: compatibleItems { - muzzle_snds_h = 1; - muzzle_snds_h_khk_F = 1; - muzzle_snds_h_snd_F = 1; - muzzle_snds_65_TI_blk_F = 1; - muzzle_snds_65_TI_hex_F = 1; - muzzle_snds_65_TI_ghex_F = 1; - }; }; class CowsSlot: asdg_OpticRail1913 { iconPosition[] = {0.5, 0.35}; @@ -482,17 +451,9 @@ class CfgWeapons { class arifle_MX_GL_F : arifle_MX_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { - class MuzzleSlot : asdg_MuzzleSlot_762 { + class MuzzleSlot : asdg_MuzzleSlot_65 { iconPosition[] = {0, 0.45}; iconScale = 0.2; - class compatibleItems: compatibleItems { - muzzle_snds_h = 1; - muzzle_snds_h_khk_F = 1; - muzzle_snds_h_snd_F = 1; - muzzle_snds_65_TI_blk_F = 1; - muzzle_snds_65_TI_hex_F = 1; - muzzle_snds_65_TI_ghex_F = 1; - }; }; class CowsSlot: asdg_OpticRail1913 { iconPosition[] = {0.5, 0.35}; @@ -507,17 +468,9 @@ class CfgWeapons { class arifle_MX_SW_F : arifle_MX_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { - class MuzzleSlot : asdg_MuzzleSlot_762MG { + class MuzzleSlot : asdg_MuzzleSlot_65 { iconPosition[] = {0, 0.45}; iconScale = 0.2; - class compatibleItems: compatibleItems { - muzzle_snds_h = 1; - muzzle_snds_h_khk_F = 1; - muzzle_snds_h_snd_F = 1; - muzzle_snds_65_TI_blk_F = 1; - muzzle_snds_65_TI_hex_F = 1; - muzzle_snds_65_TI_ghex_F = 1; - }; }; class CowsSlot: asdg_OpticRail1913 { iconPosition[] = {0.5, 0.35}; @@ -536,17 +489,9 @@ class CfgWeapons { class arifle_MXM_F : arifle_MX_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { - class MuzzleSlot : asdg_MuzzleSlot_762 { + class MuzzleSlot : asdg_MuzzleSlot_65 { iconPosition[] = {0, 0.4}; iconScale = 0.2; - class compatibleItems: compatibleItems { - muzzle_snds_h = 1; - muzzle_snds_h_khk_F = 1; - muzzle_snds_h_snd_F = 1; - muzzle_snds_65_TI_blk_F = 1; - muzzle_snds_65_TI_hex_F = 1; - muzzle_snds_65_TI_ghex_F = 1; - }; }; class CowsSlot: asdg_OpticRail1913 { iconPosition[] = {0.5, 0.35}; @@ -601,7 +546,7 @@ class CfgWeapons { }; }; - class SMG_01_Base: Rifle_Base_F { + class SMG_01_Base: Rifle_Short_Base_F { class WeaponSlotsInfo; }; @@ -639,7 +584,7 @@ class CfgWeapons { }; }; - class pdw2000_base_F: Rifle_Base_F { + class pdw2000_base_F: Rifle_Short_Base_F { class WeaponSlotsInfo; }; @@ -658,12 +603,15 @@ class CfgWeapons { class LMG_03_base_F : Rifle_Long_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { -/* - class MuzzleSlot : asdg_MuzzleSlot_762MG { //unfortunately there's no muzzle proxy so these attachments won't show up (2016-06-20) - iconPosition[] = {0.1, 0.5}; + class MuzzleSlot : asdg_MuzzleSlot_762MG { + class compatibleItems: compatibleItems { + muzzle_snds_M = 1; + muzzle_snds_m_khk_F = 1; + muzzle_snds_m_snd_F = 1; + }; + iconPosition[] = {0, 0.4}; iconScale = 0.2; }; -*/ class CowsSlot: asdg_OpticRail1913_short_MG { iconPosition[] = {0.57, 0.28}; iconScale = 0.15; @@ -677,17 +625,9 @@ class CfgWeapons { class DMR_07_base_F : Rifle_Long_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { - class MuzzleSlot : asdg_MuzzleSlot_762 { + class MuzzleSlot : asdg_MuzzleSlot_65 { iconPosition[] = {0, 0.45}; iconScale = 0.2; - class compatibleItems: compatibleItems { - muzzle_snds_h = 1; - muzzle_snds_h_khk_F = 1; - muzzle_snds_h_snd_F = 1; - muzzle_snds_65_TI_blk_F = 1; - muzzle_snds_65_TI_hex_F = 1; - muzzle_snds_65_TI_ghex_F = 1; - }; }; class CowsSlot : asdg_OpticRail1913_short { iconPosition[] = {0.45, 0.28}; @@ -696,10 +636,10 @@ class CfgWeapons { }; }; - class SMG_05_base_F : Rifle_Base_F { + class SMG_05_base_F : Rifle_Short_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { class MuzzleSlot : asdg_MuzzleSlot_9MM_SMG { - iconPosition[] = {0, 0.45}; + iconPosition[] = {0.05, 0.35}; iconScale = 0.2; }; class CowsSlot : asdg_OpticRail1913_short { @@ -719,7 +659,7 @@ class CfgWeapons { class arifle_AK12_base_F : Rifle_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { class MuzzleSlot : asdg_MuzzleSlot_762R { - iconPosition[] = {0, 0.45}; + iconPosition[] = {0, 0.35}; iconScale = 0.2; class compatibleItems: compatibleItems { muzzle_snds_B = 1; @@ -728,11 +668,11 @@ class CfgWeapons { }; }; class CowsSlot: asdg_OpticRail1913 { - iconPosition[] = {0.45, 0.28}; + iconPosition[] = {0.5, 0.25}; iconScale = 0.2; }; class PointerSlot: asdg_FrontSideRail { - iconPosition[] = {0.35, 0.45}; + iconPosition[] = {0.3, 0.35}; iconScale = 0.2; }; }; @@ -741,7 +681,7 @@ class CfgWeapons { class arifle_AK12_F : arifle_AK12_base_F { class WeaponSlotsInfo : WeaponSlotsInfo { class UnderBarrelSlot : asdg_UnderSlot { - iconPosition[] = {0.2, 0.8}; + iconPosition[] = {0.35, 0.7}; iconScale = 0.3; }; }; @@ -750,7 +690,7 @@ class CfgWeapons { class arifle_SPAR_01_base_F : Rifle_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { class MuzzleSlot : asdg_MuzzleSlot_556 { - iconPosition[] = {0, 0.45}; + iconPosition[] = {0, 0.4}; iconScale = 0.2; }; class CowsSlot: asdg_OpticRail1913 { @@ -792,7 +732,7 @@ class CfgWeapons { class arifle_SPAR_02_base_F : Rifle_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { class MuzzleSlot : asdg_MuzzleSlot_556 { - iconPosition[] = {0, 0.45}; + iconPosition[] = {0, 0.4}; iconScale = 0.2; }; class CowsSlot: asdg_OpticRail1913 { @@ -813,7 +753,7 @@ class CfgWeapons { class arifle_SPAR_03_base_F : Rifle_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { class MuzzleSlot : asdg_MuzzleSlot_762 { - iconPosition[] = {0, 0.45}; + iconPosition[] = {0, 0.4}; iconScale = 0.2; }; class CowsSlot: asdg_OpticRail1913_long { @@ -834,7 +774,7 @@ class CfgWeapons { class arifle_CTAR_base_F : Rifle_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { class MuzzleSlot : asdg_MuzzleSlot_58 { - iconPosition[] = {0, 0.45}; + iconPosition[] = {0, 0.4}; iconScale = 0.2; }; class CowsSlot: asdg_OpticRail1913 { @@ -851,7 +791,7 @@ class CfgWeapons { class arifle_CTARS_base_F : Rifle_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { class MuzzleSlot : asdg_MuzzleSlot_58 { - iconPosition[] = {0, 0.45}; + iconPosition[] = {0, 0.4}; iconScale = 0.2; }; class CowsSlot: asdg_OpticRail1913 { @@ -867,17 +807,9 @@ class CfgWeapons { class arifle_ARX_base_F : Rifle_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { - class MuzzleSlot : asdg_MuzzleSlot_762 { - iconPosition[] = {0, 0.45}; + class MuzzleSlot : asdg_MuzzleSlot_65 { + iconPosition[] = {0, 0.4}; iconScale = 0.2; - class compatibleItems: compatibleItems { - muzzle_snds_h = 1; - muzzle_snds_h_khk_F = 1; - muzzle_snds_h_snd_F = 1; - muzzle_snds_65_TI_blk_F = 1; - muzzle_snds_65_TI_hex_F = 1; - muzzle_snds_65_TI_ghex_F = 1; - }; }; class CowsSlot: asdg_OpticRail1913 { iconPosition[] = {0.45, 0.28}; @@ -935,4 +867,23 @@ class CfgWeapons { }; }; }; + + class muzzle_snds_H; + class muzzle_snds_H_MG : muzzle_snds_H { // we were seriously lacking a MG suppressor since BI hid these (1.64) + scope = 2; + displayName = "$STR_CBA_JR_cfgweapons_muzzle_snds_h_mg"; // 7.62 MG, can also be used on 6.5 and 5.56 MGs + picture = "\A3\Weapons_F_Mark\Data\UI\gear_acca_snds_338_tan_CA.paa"; + model = "\A3\Weapons_F\Acc\acca_snds_338_tan_F"; + }; + class muzzle_snds_H_MG_blk_F : muzzle_snds_H_MG { + displayName = "$STR_CBA_JR_cfgweapons_muzzle_snds_h_mg"; // 7.62 MG, can also be used on 6.5 and 5.56 MGs + picture = "\A3\Weapons_F_Mark\Data\UI\gear_acca_snds_338_black_CA.paa"; + model = "\A3\Weapons_F\Acc\acca_snds_338_black_F"; + }; + class muzzle_snds_H_MG_khk_F : muzzle_snds_H_MG { + displayName = "$STR_CBA_JR_cfgweapons_muzzle_snds_h_mg"; // 7.62 MG, can also be used on 6.5 and 5.56 MGs + picture = "\A3\Weapons_F_Mark\Data\UI\gear_acca_snds_338_green_CA.paa"; + model = "\A3\Weapons_F\Acc\acca_snds_338_green_F"; + }; + }; diff --git a/addons/jr/jr_classes.hpp b/addons/jr/jr_classes.hpp index 56593bb92..8bb030683 100644 --- a/addons/jr/jr_classes.hpp +++ b/addons/jr/jr_classes.hpp @@ -141,6 +141,17 @@ class asdg_MuzzleSlot_762: asdg_MuzzleSlot { // for 7.62x51 universal mount supp }; }; +class asdg_MuzzleSlot_65: asdg_MuzzleSlot_762 { // for 6.5 weapons, mostly to deal with BIS vanilla compatibility + class compatibleItems: compatibleItems { + muzzle_snds_h = 1; + muzzle_snds_h_khk_F = 1; + muzzle_snds_h_snd_F = 1; + muzzle_snds_65_TI_blk_F = 1; + muzzle_snds_65_TI_hex_F = 1; + muzzle_snds_65_TI_ghex_F = 1; + }; +}; + class asdg_MuzzleSlot_556: asdg_MuzzleSlot { // for 5.56x45 universal mount suppressors class compatibleItems { muzzle_snds_M = 1; @@ -207,5 +218,7 @@ class asdg_MuzzleSlot_58: asdg_MuzzleSlot { // for 5.8x42 suppressors class compatibleItems { muzzle_snds_58_blk_F = 1; muzzle_snds_58_wdm_F = 1; + muzzle_snds_58_ghex_F = 1; + muzzle_snds_58_hex_F = 1; }; }; diff --git a/addons/jr/stringtable.xml b/addons/jr/stringtable.xml index 3d23d6014..ba01d039d 100644 --- a/addons/jr/stringtable.xml +++ b/addons/jr/stringtable.xml @@ -4,5 +4,17 @@ Community Base Addons - Joint Rails + + Sound Suppressor MG + Sound Suppressor MG + Tlumič hluku MG + Silencieux pour MG + Schalldämpfer MG + Silenziatore MG + Tłumik KM + Metralhadora silenciador + Глушитель для пулемета + Silenciador MG + diff --git a/addons/jr_prep/config.cpp b/addons/jr_prep/config.cpp index 44e2d9684..4420dbd24 100644 --- a/addons/jr_prep/config.cpp +++ b/addons/jr_prep/config.cpp @@ -18,6 +18,9 @@ class CfgWeapons { class Rifle_Base_F : Rifle { class WeaponSlotsInfo; }; + class Rifle_Short_Base_F : Rifle_Base_F { + class WeaponSlotsInfo; + }; class Rifle_Long_Base_F : Rifle_Base_F { class WeaponSlotsInfo; }; @@ -136,7 +139,7 @@ class CfgWeapons { }; }; - class SMG_05_base_F : Rifle_Base_F { + class SMG_05_base_F : Rifle_Short_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { delete MuzzleSlot; delete CowsSlot; diff --git a/addons/main/test.sqf b/addons/main/test.sqf index 6d6c659f1..750621db7 100644 --- a/addons/main/test.sqf +++ b/addons/main/test.sqf @@ -5,7 +5,7 @@ #include "script_component.hpp" -#define CATEGORIES ["arrays", "common", "diagnostic", "hashes", "strings", "vectors", "jr"] +#define CATEGORIES ["arrays", "common", "diagnostic", "hashes", "network", "strings", "vectors", "jr"] SCRIPT(test); diff --git a/addons/network/test.sqf b/addons/network/test.sqf new file mode 100644 index 000000000..bb8a45168 --- /dev/null +++ b/addons/network/test.sqf @@ -0,0 +1,20 @@ +// ----------------------------------------------------------------------------- +// Automatically generated by 'functions_config.rb' +// DO NOT MANUALLY EDIT THIS FILE! +// ----------------------------------------------------------------------------- +#define DEBUG_MODE_FULL +#include "script_component.hpp" + +#define TESTS ["network"] + +SCRIPT(test-network); + +// ---------------------------------------------------------------------------- + +LOG("=== Testing Network ==="); + +{ + call compile preprocessFileLineNumbers format ["\x\cba\addons\network\test_%1.sqf", _x]; +} forEach TESTS; + +nil;