diff --git a/addons/events/config.cpp b/addons/events/config.cpp index 7b3ea0226..8ed11c1ac 100644 --- a/addons/events/config.cpp +++ b/addons/events/config.cpp @@ -46,3 +46,32 @@ class CfgWeapons { }; }; #endif + +//["testcomponent1", "test1", {systemChat str 11}] call CBA_fnc_addKeyHandlerFromConfig; +//["testcomponent1", "test2", {systemChat str 12}] call CBA_fnc_addKeyHandlerFromConfig; +//["testcomponent2", "test1", {systemChat str 21}] call CBA_fnc_addKeyHandlerFromConfig; +//["testcomponent2", "test2", {systemChat str 22}] call CBA_fnc_addKeyHandlerFromConfig; + +/*class CfgSettings { + class CBA { + class events { + class testcomponent1 { + test1 = 15; + + class test2 { + key = 15; + shift = 1; + }; + }; + + class testcomponent2 { + test1 = 19; + + class test2 { + key = 19; + ctrl = 1; + }; + }; + }; + }; +};*/ diff --git a/addons/help/CfgEventhandlers.hpp b/addons/help/CfgEventhandlers.hpp index 29fcde5e3..0d3301d6e 100644 --- a/addons/help/CfgEventhandlers.hpp +++ b/addons/help/CfgEventhandlers.hpp @@ -6,12 +6,12 @@ class Extended_PreStart_EventHandlers { class Extended_PreInit_EventHandlers { class ADDON { - clientInit = QUOTE(call COMPILE_FILE(XEH_preClientInit)); + init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; class Extended_PostInit_EventHandlers { class ADDON { - clientInit = QUOTE(call COMPILE_FILE(XEH_postClientInit)); + init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; diff --git a/addons/help/XEH_postClientInit.sqf b/addons/help/XEH_postClientInit.sqf deleted file mode 100644 index 8e53273cb..000000000 --- a/addons/help/XEH_postClientInit.sqf +++ /dev/null @@ -1,56 +0,0 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" - -if (!hasInterface) exitWith {}; - -// create diary -player createDiarySubject ["CBA_docs", "CBA"]; - -//player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_WEBSITE_WIKI", "http://dev-heaven.net/projects/cca"]]; - -private _creditsInfo = GVAR(credits) getVariable "CfgPatches"; -private _credits_CfgPatches = _creditsInfo call FUNC(process); - -if (!isNil "_credits_CfgPatches") then { - player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_CREDITS_ADDONS", _credits_CfgPatches]]; -}; - -if (!isNil QGVAR(docs)) then { - player createDiaryRecord ["CBA_docs", ["Docs", GVAR(docs)]]; -}; - -if (!isNil QGVAR(keys)) then { - player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_HELP_KEYS", GVAR(keys)]]; -}; - -//player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_CREDITS", GVAR(credits_cba)]]; -//player createDiaryRecord ["CBA_docs", ["Credits - Vehicles", (_creditsInfo getVariable "CfgVehicles") call FUNC(process)]]; -//player createDiaryRecord ["CBA_docs", ["Credits - Weapons", (_creditsInfo getVariable "CfgWeapons") call FUNC(process)]]; -//player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_WEBSITE", "http://dev-heaven.net/projects/cca"]]; - -// add diary for scripted keybinds -0 spawn { - private _text = GVAR(keys); - - private _activeMods = allVariables EGVAR(keybinding,addons); - _activeMods sort true; - - { - (EGVAR(keybinding,addons) getVariable _x) params ["_addonName", "_addonActions"]; - - _text = _text + format ["%1:
", _addonName]; - - { - (EGVAR(keybinding,actions) getVariable (_addonName + "$" + _x)) params ["_displayName", "", "_registryKeybinds"]; - if (isLocalized _displayName) then { _displayName = localize _displayName; }; - - private _keyName = (_registryKeybinds select {_x select 0 > DIK_ESCAPE} apply {_x call CBA_fnc_localizeKey}) joinString " "; - - _text = _text + format [" %1: %2
", _displayName, _keyName]; - } forEach _addonActions; - - _text = _text + "
"; - } forEach _activeMods; - - player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_HELP_KEYS", _text]]; -}; diff --git a/addons/help/XEH_postInit.sqf b/addons/help/XEH_postInit.sqf new file mode 100644 index 000000000..a2854aaf1 --- /dev/null +++ b/addons/help/XEH_postInit.sqf @@ -0,0 +1,43 @@ +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +if (!hasInterface) exitWith {}; + +{ + // create diary, entries added in reverse order + private _unit = player; + _unit createDiarySubject [QGVAR(docs), "CBA"]; + + // add diary for scripted keybinds + private _keys = GVAR(keys); + + private _addons = allVariables EGVAR(keybinding,addons); + _addons sort true; + + { + (EGVAR(keybinding,addons) getVariable _x) params ["_addon", "_addonActions"]; + + _keys = _keys + format ["%1:
", _addon]; + + { + (EGVAR(keybinding,actions) getVariable (_addon + "$" + _x)) params ["_displayName", "", "_keybinds"]; + + if (isLocalized _displayName) then { + _displayName = localize _displayName; + }; + + private _keyName = (_keybinds select {_x select 0 > DIK_ESCAPE} apply {_x call CBA_fnc_localizeKey}) joinString " "; + + _keys = _keys + format [" %1: %2
", _displayName, _keyName]; + } forEach _addonActions; + + _keys = _keys + "
"; + } forEach _addons; + + // delete last line breaks + _keys = _keys select [0, count _keys - 10]; + + _unit createDiaryRecord [QGVAR(docs), [localize "STR_CBA_Help_Keys", _keys]]; + _unit createDiaryRecord [QGVAR(docs), [localize "STR_CBA_Credits", call (uiNamespace getVariable QGVAR(credits))]]; + _unit createDiaryRecord [QGVAR(docs), [localize "STR_CBA_Addons", call (uiNamespace getVariable QGVAR(mods))]]; +} call CBA_fnc_execNextFrame; diff --git a/addons/help/XEH_preClientInit.sqf b/addons/help/XEH_preClientInit.sqf deleted file mode 100644 index d6396050f..000000000 --- a/addons/help/XEH_preClientInit.sqf +++ /dev/null @@ -1,147 +0,0 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" - -LOG(MSG_INIT); - -ADDON = false; - -[QFUNC(help), {call BIS_fnc_help}] call CBA_fnc_compileFinal; - -[QFUNC(process), { - params ["_hash1", "_hash2", "_hash3"]; - - private _result = []; - - { - private _entry = format [ - "%1, v%2, (%3)
Author: %4", - _x, - _hash3 getVariable _x, - _hash2 getVariable _x, - (_hash1 getVariable _x) joinString ", " - ]; - - _result pushBack _entry; - } forEach allVariables _hash1; - - _result joinString "

"; -}] call CBA_fnc_compileFinal; - -// keys -private _fnc_getKeyName = { - private _shift = [0, DIK_LSHIFT] select (_shift > 0); - private _ctrl = [0, DIK_LCONTROL] select (_ctrl > 0); - private _alt = [0, DIK_LMENU] select (_alt > 0); - - private _keys = [_shift, _ctrl, _alt, _key]; - - private _result = "^"; - - { - private _keyName = call compile format ["format ['%1', %2]", "%1", keyName _x]; - _keyName = [_keyName, " "] call CBA_fnc_split; - - private _keyText = "^"; - - { - _keyText = _keyText + " " + _x; - } forEach _keyName; - - _keyText = [_keyText, "^ ", ""] call CBA_fnc_replace; - _result = _result + "-" + _keyText; - } forEach _keys; - - _result = [_result, "^ ", ""] call CBA_fnc_replace; - _result = [_result, "^-", ""] call CBA_fnc_replace; - _result = [_result, "^", "None"] call CBA_fnc_replace; - _result -}; - -private _text = ""; - -private _config = configFile >> "CfgSettings" >> "CBA" >> "events"; - -{ - private _addonConfig = _x; - private _addonName = configName _addonConfig; - - private _addonNameArr = [_addonName, "_"] call CBA_fnc_split; - private _addonText = "^"; - - { - if (_x != "sys") then { - _addonText = format ["%1 %2", _addonText, _x]; - }; - } forEach _addonNameArr; - - _addonText = [_addonText, "^ ", ""] call CBA_fnc_replace; - _addonText = format ["%1:", _addonText]; - - { - private _entry = _x; - private _actionName = configName _entry; - - _actionName = [_actionName, "_", " "] call CBA_fnc_replace; - - private _keyState = if (isNumber _entry) then { - [getNumber _entry, 0, 0, 0 ] - } else { - [ - getNumber (_entry >> "key"), - getNumber (_entry >> "shift"), - getNumber (_entry >> "ctrl"), - getNumber (_entry >> "alt") - ] - }; - - private _keyName = _keyState call _fnc_getKeyName; - - _actionName = format [" %1: %2", _actionName, _keyName]; - - _text = _text + _actionName + "
"; - } forEach configProperties [_addonConfig, "isNumber _x || isClass _x", true]; - - _text = _text + "
"; -} forEach ("true" configClasses _config); - -GVAR(keys) = _text; - -// credits -GVAR(credits) = call CBA_fnc_createNamespace; - -private _fnc_readCreditsFromConfig = { - params ["_type"]; - - private _config = configFile >> _type; - - private _hash1 = call CBA_fnc_createNamespace; - private _hash2 = call CBA_fnc_createNamespace; - private _hash3 = call CBA_fnc_createNamespace; - - { - private _entry = _x; - - _hash1 setVariable [configName _entry, getArray (_entry >> "author")]; - _hash2 setVariable [configName _entry, getText (_entry >> "authorUrl")]; - _hash3 setVariable [configName _entry, getText (_entry >> "version")]; - } forEach ("isArray (_x >> 'author')" configClasses _config); - - [_hash1, _hash2, _hash3] -}; - -{ - GVAR(credits) setVariable [_x, _x call _fnc_readCreditsFromConfig]; -} forEach ["CfgPatches"]; //, "CfgVehicles", "CfgWeapons"]; - -// docs -GVAR(docs) = ""; - -private _config = configFile >> "CfgMods"; - -{ - private _entry = format ["* %1 - %2
%3

", configName _x, getText (_x >> "name"), getText (_x >> "description")]; - - GVAR(docs) + _entry; -} forEach ("isText (_x >> 'description')" configClasses _config); - -ADDON = true; diff --git a/addons/help/XEH_preInit.sqf b/addons/help/XEH_preInit.sqf new file mode 100644 index 000000000..7130d8ddb --- /dev/null +++ b/addons/help/XEH_preInit.sqf @@ -0,0 +1,45 @@ +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +if (!hasInterface) exitWith {}; + +ADDON = false; + +// bwc +FUNC(help) = BIS_fnc_help; + +// keys +private _keys = ""; + +private _config = configFile >> "CfgSettings" >> "CBA" >> "events"; + +{ + private _addon = configName _x; + + _keys = _keys + format ["%1:
", _addon]; + + { + private _action = configName _x; + + private _keybind = if (isNumber _x) then { + [getNumber _x, false, false, false] + } else { + [ + getNumber (_x >> "key"), + getNumber (_x >> "shift") > 0, + getNumber (_x >> "ctrl") > 0, + getNumber (_x >> "alt") > 0 + ] + }; + + private _keyName = _keybind call CBA_fnc_localizeKey; + + _keys = _keys + format [" %1: %2
", _action, _keyName]; + } forEach configProperties [_x, "isNumber _x || isClass _x"]; + + _keys = _keys + "
"; +} forEach ("true" configClasses _config); + +GVAR(keys) = _keys; + +ADDON = true; diff --git a/addons/help/XEH_preStart.sqf b/addons/help/XEH_preStart.sqf index e307f1748..1148c245c 100644 --- a/addons/help/XEH_preStart.sqf +++ b/addons/help/XEH_preStart.sqf @@ -1,14 +1,61 @@ +//#define DEBUG_MODE_FULL #include "script_component.hpp" -PREP(setVersionLine); -PREP(setCreditsLine); - -//Cache for CBA_help_fnc_setCreditsLine -if (!isClass (configFile >> "CfgPatches" >> "CBA_DisableCredits")) then { - uiNamespace setVariable [QGVAR(creditsCache), - "isText (_x >> 'author') && - {getText (_x >> 'author') != localize 'STR_A3_Bohemia_Interactive'} && - {getText (_x >> 'author') != ''} - " configClasses (configFile >> "CfgPatches") - ]; +if (!hasInterface) exitWith {}; + +// credits +private _addons = "true" configClasses (configFile >> "CfgPatches") select { + isText (_x >> "author") && {!(getText (_x >> "author") in [localize "STR_A3_Bohemia_Interactive", "CFGPATCHES_AUTHOR", ""])} }; + +private _credits = []; + +{ + private _name = configName _x; + + if (isText (_x >> "name")) then { + _name = getText (_x >> "name") call CBA_fnc_sanitizeHTML; + }; + + _name = format ["%1", _name]; + + private _version = ""; + + if (isText (_x >> "version")) then { + _version = format [" v%1", getText (_x >> "version")]; + }; + + private _author = getText (_x >> "author") call CBA_fnc_sanitizeHTML; + + _credits pushBack format ["%1%2 by %3", _name, _version, _author]; +} forEach _addons; + +_credits = (_credits arrayIntersect _credits) joinString "
"; + +uiNamespace setVariable [QGVAR(credits), compileFinal str _credits]; + +// mods +private _mods = "true" configClasses (configFile >> "CfgPatches") apply {configSourceMod _x}; +_mods = (_mods arrayIntersect _mods select {!isNumber (configfile >> "CfgMods" >> _x >> "appId")}) - [""]; + +_mods = _mods apply { + private _entry = configfile >> "CfgMods" >> _x; + + private _name = getText (_entry >> "name") call CBA_fnc_sanitizeHTML; + + if (isClass _entry) then { + _x = format [" %1 - %2", configName _entry, _name]; + + if (isText (_entry >> "description")) then { + private _description = getText (_entry >> "description") call CBA_fnc_sanitizeHTML; + + _x = _x + format ["
%1", _description]; + }; + }; + + _x +}; + +_mods = _mods joinString "

"; + +uiNamespace setVariable [QGVAR(mods), compileFinal str _mods]; diff --git a/addons/help/config.cpp b/addons/help/config.cpp index f044a5f06..a5d3b2e30 100644 --- a/addons/help/config.cpp +++ b/addons/help/config.cpp @@ -8,11 +8,10 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"cba_common", "cba_hashes", "cba_keybinding"}; + requiredAddons[] = {"cba_common","cba_keybinding"}; version = VERSION; - authors[] = {"alef", "Rocko", "Sickboy"}; + authors[] = {"alef","Rocko","Sickboy"}; }; }; #include "CfgEventhandlers.hpp" -#include "gui.hpp" diff --git a/addons/help/fnc_setCreditsLine.sqf b/addons/help/fnc_setCreditsLine.sqf deleted file mode 100644 index f89340f09..000000000 --- a/addons/help/fnc_setCreditsLine.sqf +++ /dev/null @@ -1,59 +0,0 @@ -#include "script_component.hpp" -/* ---------------------------------------------------------------------------- -Function: CBA_help_fnc_setCreditsLine - -Description: - Picks a random CfgPatches entry with an "author" entry and displays author, - version and URL in the main menu and ingame in the pause menu. - -Parameters: - 0: _control - Credits line control - -Returns: - None ----------------------------------------------------------------------------- */ - -params ["_control"]; - -if !(ctrlText _control isEqualTo "") exitWith {}; - -// get settings -{ - if (isNil _x) then { - missionNamespace setVariable [_x, isClass (configFile >> "CfgPatches" >> _x)]; - }; -} forEach ["CBA_DisableCredits", "CBA_MonochromeCredits"]; - -if (CBA_DisableCredits) exitWith {}; - -// find random addon with author -private _entry = selectRandom (uiNamespace getVariable [QGVAR(creditsCache), []]); - -if (isNil "_entry") exitWith {}; - -// addon name -private _name = configName _entry; - -if (isText (_entry >> "name")) then { - _name = getText (_entry >> "name"); -}; - -if (!CBA_MonochromeCredits) then { - _name = format ["%1", _name]; -}; - -// author name -private _author = getText (_entry >> "author"); - -// version if any -private _version = ""; - -if (isText (_entry >> "version")) then { - _version = format [" v%1", getText (_entry >> "version")]; -}; - -// add single line -_control ctrlSetStructuredText parseText format ["%1%2 by %3", _name, _version, _author]; - -// make credits line not obstruct other controls -_control ctrlEnable false; diff --git a/addons/help/fnc_setVersionLine.sqf b/addons/help/fnc_setVersionLine.sqf deleted file mode 100644 index 42ae24f25..000000000 --- a/addons/help/fnc_setVersionLine.sqf +++ /dev/null @@ -1,100 +0,0 @@ -#include "script_component.hpp" -/* ---------------------------------------------------------------------------- -Function: CBA_help_fnc_setVersionLine - -Description: - Displays all CfgPatches with a "versionDesc" entry in the main menu. - - Mods are cycled automatically every 4 seconds or can be browsed using LMB and RMB. - Double clicking executes the script in "versionAct". - -Parameters: - 0: _control - Either version line or button control - 1: _key - 0: LMB - next mod, 1: RMB - previous mod (optional, default: 0) - -Returns: - None ----------------------------------------------------------------------------- */ - -params ["_control", ["_key", 0]]; - -private _display = ctrlParent _control; - -private _ctrlText = _display displayCtrl IDC_VERSION_TEXT; -private _ctrlButton = _display displayCtrl IDC_VERSION_BUTTON; - -// create addon list -if (isNil {uiNamespace getVariable QGVAR(VerList)}) then { - private _verList = []; - uiNamespace setVariable [QGVAR(VerList), _verList]; - - // gather version info - { - private _entry = _x; - - private _verLine = format ["%1 v%2", getText (_entry >> "versionDesc"), getText (_entry >> "version")]; - private _verAct = getText (_entry >> "versionAct"); - - _verList pushBack [_verLine, _verAct]; - } forEach ("isText (_x >> 'versionDesc')" configClasses (configFile >> "CfgPatches")); -}; - -// start loop that cycles through all addons -terminate (uiNamespace getVariable [QGVAR(VerScript), scriptNull]); - -private _verScript = [_control] spawn { // will terminate when main menu mission exits - uiSleep 4; - isNil (uiNamespace getVariable QFUNC(setVersionLine)); // execute unscheduled -}; - -uiNamespace setVariable [QGVAR(VerScript), _verScript]; - -// start loop with mouse moving event on main menu. this is used, because loops can't be used at that point -if (isNull (uiNamespace getVariable [QGVAR(VerScriptFlag), displayNull])) then { - uiNamespace setVariable [QGVAR(VerScriptFlag), _display]; - - _display displayAddEventHandler ["MouseMoving", { - params ["_display"]; - - if (!scriptDone (uiNamespace getVariable [QGVAR(VerScript), scriptNull])) exitWith {}; - - private _verScript = [allControls _display select 0] spawn { // will terminate when main menu mission exits - uiSleep 4; - isNil (uiNamespace getVariable QFUNC(setVersionLine)); // execute unscheduled - }; - - uiNamespace setVariable [QGVAR(VerScript), _verScript]; - }]; -}; - -// left click forward, other click back -if (isNil {uiNamespace getVariable QGVAR(VerNext)}) then { - uiNamespace setVariable [QGVAR(VerNext), -1]; -}; - -private _next = uiNamespace getVariable QGVAR(VerNext); - -if (_key isEqualTo 0) then { - _next = _next + 1; -} else { - _next = _next - 1; -}; - -// stay in bounds -_verList = uiNamespace getVariable QGVAR(VerList); - -if (_next >= count _verList) then { - _next = 0; -} else { - if (_next < 0) then { - _next = count _verList - 1; - }; -}; - -uiNamespace setVariable [QGVAR(VerNext), _next]; - -// add single line -(_verList select _next) params ["_verLine", "_verAct"]; - -_ctrlText ctrlSetText _verLine; // print version line -_ctrlButton ctrlSetEventHandler ["MouseButtonDblClick", _verAct]; // set double-click action if any diff --git a/addons/help/gui.hpp b/addons/help/gui.hpp deleted file mode 100644 index e024c0ea6..000000000 --- a/addons/help/gui.hpp +++ /dev/null @@ -1,78 +0,0 @@ -class RscText; -class RscButton; - -class RscStructuredText { - class Attributes; -}; - -class GVAR(credits_base): RscStructuredText { - onLoad = QUOTE(_this call (uiNamespace getVariable 'FUNC(setCreditsLine)')); - size = POS_H(0.8); - x = POS_X_CENTERED(7); - y = POS_Y(23.1); - w = POS_W(26); - h = POS_H(0.8); - shadow = 0; - - class Attributes: Attributes { - font = "RobotoCondensedLight"; - align = "center"; - valign = "middle"; - color = "#bdcc9c"; - }; -}; - -class RscStandardDisplay; -class RscDisplayMain: RscStandardDisplay { - class controls { - class GVAR(CreditsVersion): RscText { - onLoad = QUOTE(_this call (uiNamespace getVariable 'FUNC(setVersionLine)')); - idc = IDC_VERSION_TEXT; - font = "RobotoCondensedLight"; - shadow = 0; - style = ST_RIGHT; - sizeEx = POS_H(0.8); - x = POS_X_RIGHT(12); - y = POS_Y(24.1); - w = POS_W(10); - h = POS_H(0.8); - }; - - class GVAR(CreditsVersionButton): RscButton { - onMouseButtonClick = QUOTE(_this call (uiNamespace getVariable 'FUNC(setVersionLine)')); - idc = IDC_VERSION_BUTTON; - colorText[] = {1,1,1,0}; - colorDisabled[] = {1,1,1,0}; - colorBackground[] = {0,0,0,0}; - colorBackgroundDisabled[] = {0,0,0,0}; - colorBackgroundActive[] = {0,0,0,0}; - colorFocused[] = {0,0,0,0}; - soundClick[] = {"",1,1}; - - x = POS_X_RIGHT(12); - y = POS_Y(24.1); - w = POS_W(10); - h = POS_H(0.8); - }; - - class GVAR(credits): GVAR(credits_base) { - size = POS_H_MAIN_MENU(1); - x = POS_X_MAIN_MENU(0); - y = POS_Y_MAIN_MENU(2); - w = POS_W_MAIN_MENU(0); - h = POS_H_MAIN_MENU(1); - }; - }; -}; - -class RscDisplayInterrupt: RscStandardDisplay { - class controls { - class GVAR(credits): GVAR(credits_base) {}; - }; -}; - -class RscDisplayMPInterrupt: RscStandardDisplay { - class controls { - class GVAR(credits): GVAR(credits_base) {}; - }; -}; diff --git a/addons/help/script_component.hpp b/addons/help/script_component.hpp index e490c5e01..964446e78 100644 --- a/addons/help/script_component.hpp +++ b/addons/help/script_component.hpp @@ -11,22 +11,4 @@ #include "\x\cba\addons\main\script_macros.hpp" -#include "\a3\ui_f\hpp\defineCommonGrids.inc" #include "\a3\ui_f\hpp\defineDIKCodes.inc" -#include "\a3\ui_f\hpp\defineResincl.inc" - -#define POS_X(N) ((N) * GUI_GRID_W + GUI_GRID_X) -#define POS_Y(N) ((N) * GUI_GRID_H + GUI_GRID_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_X_RIGHT(N) (safezoneW - 1 * (N) * GUI_GRID_W + GUI_GRID_X) - -#define POS_X_MAIN_MENU(N) safezoneX -#define POS_Y_MAIN_MENU(N) (safezoneY + safezoneH - 1 * (N) * (pixelH * pixelGrid * 2)) -#define POS_W_MAIN_MENU(N) safezoneW -#define POS_H_MAIN_MENU(N) ((N) * (pixelH * pixelGrid * 2)) - -#define IDC_VERSION_TEXT 222712 -#define IDC_VERSION_BUTTON 222713 diff --git a/addons/help/stringtable.xml b/addons/help/stringtable.xml index 7bc7e8e73..8268d475a 100644 --- a/addons/help/stringtable.xml +++ b/addons/help/stringtable.xml @@ -13,7 +13,7 @@ Community Base Addons - Aide Community Base Addons - Yardım - + Keybindings Tastendruckzuweisung Keybindings @@ -28,37 +28,7 @@ 按键绑定 Klavye Tuşları - - Bugtracker - Bugtracker - Bugtracker - Bugtracker - Баг трэкер - Bugtracker - Zgłaszanie błędów - traqueur de bugs - Bugtracker - バグトラッカー - 臭蟲追蹤器 - 臭虫追踪器 - Sorun Takibi - - - Wiki (Documentation) - Wiki (Documentation) - Wiki (Documentation) - Wiki (Documentation) - Wiki (Документация) - Wiki (Documentation) - Wiki (dokumentacja) - Wiki (Documentation) - Wiki (Documentation) - ウィキ (ドキュメント) - 維基 (文件) - 维基 (文件) - Wiki (Dökümantasyon) - - + Credits Credits Credits @@ -73,20 +43,20 @@ 制作组 Yapımcılar - - Credits - Addons - Credits - Addons - Credits - Addons - Credits - Addons - Кредиты - Дополнения - Credits - Addons - Twórcy - Addons - Credits - Addons - Credits - Addons - クレジット - アドオン - 製作組 - 模組 - 制作组 - 模组 - Yapımcılar - Modüller + + Addons + Addons + Addons + Addons + Дополнения + Addons + Addons + Addons + Addons + アドオン + 模組 + 模组 + Modüller diff --git a/addons/main_a3/CfgMods.hpp b/addons/main_a3/CfgMods.hpp new file mode 100644 index 000000000..ce808b1e5 --- /dev/null +++ b/addons/main_a3/CfgMods.hpp @@ -0,0 +1,18 @@ +class CfgMods { + class PREFIX { + author = "$STR_CBA_Author"; + dir = "@CBA_A3"; + name = "Community Base Addons v3.9.1"; + picture = "x\cba\addons\main\logo_cba_ca.paa"; + hidePicture = 1; + hideName = 1; + actionName = "Website"; + action = "$STR_CBA_URL"; + description = "Bugtracker: https://github.com/CBATeam/CBA_A3/issues
Documentation: https://github.com/CBATeam/CBA_A3/wiki"; + logo = "logo_cba_ca.paa"; + logoOver = "logo_cba_ca.paa"; + tooltip = "Community Base Addons"; + tooltipOwned = "Community Base Addons Owned"; + overview = "What does the name Community Base Addons mean? It is a system that offers a range of features for addon-makers and mission designers. This includes a collection of community-built functions, an integrated keybinding system, and extend event-handler support for compatibility with other 3rd-party addons; and much much more."; + }; +}; diff --git a/addons/main_a3/CfgSettings.hpp b/addons/main_a3/CfgSettings.hpp new file mode 100644 index 000000000..1dde5bb30 --- /dev/null +++ b/addons/main_a3/CfgSettings.hpp @@ -0,0 +1,11 @@ +class CfgSettings { + class CBA { + class Versioning { + class PREFIX { + class Dependencies { + CBA[] = {"cba_main", {1,0,0}, "(true)"}; + }; + }; + }; + }; +}; diff --git a/addons/main_a3/config.cpp b/addons/main_a3/config.cpp index 261bbf347..84fea97ca 100644 --- a/addons/main_a3/config.cpp +++ b/addons/main_a3/config.cpp @@ -14,26 +14,5 @@ class CfgPatches { }; }; -class CfgSettings { - class CBA { - class Versioning { - class PREFIX { - class Dependencies { - CBA[] = {"cba_main", {1, 0, 0}, "(true)"}; - }; - }; - }; - }; -}; - -class CfgMods { - class PREFIX { - dir = "@CBA_A3"; - name = "Community Base Addons (Arma III)"; - picture = "x\cba\addons\main\logo_cba_ca.paa"; - hidePicture = "true"; - hideName = "true"; - actionName = "Website"; - action = "$STR_CBA_URL"; - }; -}; +#include "CfgMods.hpp" +#include "CfgSettings.hpp" diff --git a/addons/strings/CfgFunctions.hpp b/addons/strings/CfgFunctions.hpp index 2e4dfae66..b48fac451 100644 --- a/addons/strings/CfgFunctions.hpp +++ b/addons/strings/CfgFunctions.hpp @@ -15,6 +15,7 @@ class CfgFunctions { PATHTO_FNC(split); PATHTO_FNC(strLen); PATHTO_FNC(trim); + PATHTO_FNC(sanitizeHTML); }; }; }; diff --git a/addons/strings/fnc_sanitizeHTML.sqf b/addons/strings/fnc_sanitizeHTML.sqf new file mode 100644 index 000000000..8aa90d89c --- /dev/null +++ b/addons/strings/fnc_sanitizeHTML.sqf @@ -0,0 +1,29 @@ +#include "script_component.hpp" +/* ---------------------------------------------------------------------------- +Function: CBA_fnc_sanitizeHTML + +Description: + Replaces all < > and & with HTML character codes. + +Parameters: + _string - String to sanitize + +Returns: + Sanitized string + +Example: + (begin example) + "&
abc" call CBA_fnc_sanitizeHTML; // "<&>
abc" + (end) + +Author: + commy2 +--------------------------------------------------------------------------- */ + +params ["_string"]; + +_string = [_string, "&", "&"] call CBA_fnc_replace; +_string = [_string, "<", "<"] call CBA_fnc_replace; +_string = [_string, ">", ">"] call CBA_fnc_replace; + +[_string, "<br/>", "
"] call CBA_fnc_replace // return