|
1 | 1 | //#define DEBUG_MODE_FULL |
2 | 2 | #include "script_component.hpp" |
3 | 3 |
|
4 | | -GVAR(CREDITS_Info) = [GVAR(credits), "CfgPatches"] call (uiNamespace getVariable "CBA_fnc_hashGet"); |
5 | | -GVAR(CREDITS_CfgPatches) = (GVAR(CREDITS_Info)) call FUNC(process); |
6 | | -TRACE_2("",GVAR(CREDITS_Info), GVAR(CREDITS_CfgPatches)); |
7 | | - |
8 | | -#ifdef DEBUG_MODE_FULL |
9 | | - // Troubleshooting an A3 Funcitons Compliation for missionNamespace. |
10 | | - if (isNil "CBA_fnc_hashGet") then { diag_log "CBA_fnc_hashGet is nil!!";}; |
11 | | - if (isNil QGVAR(CREDITS_CfgPatches)) then { diag_log "CREDITS_CfgPatches is nil! CBA_fnc_hashGet must have failed"; TRACE_1("",CBA_fnc_hashGet)}; |
12 | | -#endif |
13 | | - |
14 | | -private ["_pkeynam", "_shift", "_ctrl", "_alt", "_keys", "_key", "_keystrg", |
15 | | - "_mod", "_knaml", "_knam", "_i", "_j", "_k", "_text", "_names", "_handlers", |
16 | | - "_name", "_handler", "_actionNames", "_actionEntries", "_actionName", |
17 | | - "_displayName", "_keyn"]; |
18 | | - |
19 | | -_pkeynam = { |
20 | | - _shift = if(_shift) then {42} else {0}; |
21 | | - _ctrl = if(_ctrl) then {56} else {0}; |
22 | | - _alt = if(_alt) then {29} else {0}; |
23 | | - _keys = [_shift,_ctrl,_alt,_dikKey]; |
24 | | - _keystrg = "^"; |
| 4 | +// create diary |
| 5 | +player createDiarySubject ["CBA_docs", "CBA"]; |
| 6 | + |
| 7 | +//player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_WEBSITE_WIKI", "http://dev-heaven.net/projects/cca"]]; |
| 8 | + |
| 9 | +private _creditsInfo = GVAR(credits) getVariable "CfgPatches"; |
| 10 | +private _credits_CfgPatches = _creditsInfo call FUNC(process); |
| 11 | + |
| 12 | +if (!isNil "_credits_CfgPatches") then { |
| 13 | + player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_CREDITS_ADDONS", _credits_CfgPatches]]; |
| 14 | +}; |
| 15 | + |
| 16 | +if (!isNil QGVAR(docs)) then { |
| 17 | + player createDiaryRecord ["CBA_docs", ["Docs", GVAR(docs)]]; |
| 18 | +}; |
| 19 | + |
| 20 | +if (!isNil QGVAR(keys)) then { |
| 21 | + player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_HELP_KEYS", GVAR(keys)]]; |
| 22 | +}; |
| 23 | + |
| 24 | +//player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_CREDITS", GVAR(credits_cba)]]; |
| 25 | +//player createDiaryRecord ["CBA_docs", ["Credits - Vehicles", (_creditsInfo getVariable "CfgVehicles") call FUNC(process)]]; |
| 26 | +//player createDiaryRecord ["CBA_docs", ["Credits - Weapons", (_creditsInfo getVariable "CfgWeapons") call FUNC(process)]]; |
| 27 | +//player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_WEBSITE", "http://dev-heaven.net/projects/cca"]]; |
| 28 | + |
| 29 | +// add diary for scripted keybinds |
| 30 | +private _fnc_getKeyName = { |
| 31 | + private _shift = [0, DIK_LSHIFT] select _shift; |
| 32 | + private _ctrl = [0, DIK_LCONTROL] select _ctrl; |
| 33 | + private _alt = [0, DIK_LMENU] select _alt; |
| 34 | + |
| 35 | + private _keys = [_shift, _ctrl, _alt, _key]; |
| 36 | + |
| 37 | + _result = "^"; |
| 38 | + |
25 | 39 | { |
26 | | - _knaml = [cba_keybinding_dikDecToStringTable, format ["%1", _x], format ["Unknown key (%1)",_x]] call BIS_fnc_getFromPairs; |
27 | | - _knaml = [_knaml, " "] call (uiNamespace getVariable "CBA_fnc_split"); |
28 | | - _knam = "^"; |
29 | | - {_k = _x; _knam = _knam + " " + _k} forEach _knaml; |
30 | | - _knam = [_knam, "^ ", ""] call (uiNamespace getVariable "CBA_fnc_replace"); |
31 | | - _keystrg = _keystrg + "+" + _knam; |
| 40 | + private _keyname1 = [cba_keybinding_dikDecToStringTable, format ["%1", _x], format ["Unknown key (%1)",_x]] call BIS_fnc_getFromPairs; |
| 41 | + _keyname1 = [_keyname1, " "] call CBA_fnc_split; |
| 42 | + |
| 43 | + private _keyname2 = "^"; |
| 44 | + |
| 45 | + { |
| 46 | + _keyname2 = _keyname2 + " " + _x; |
| 47 | + } forEach _keyname1; |
| 48 | + |
| 49 | + _keyname2 = [_keyname2, "^ ", ""] call CBA_fnc_replace; |
| 50 | + _result = _result + "+" + _keyname2; |
32 | 51 | } forEach _keys; |
33 | | - _keystrg = [_keystrg, "^ ", ""] call (uiNamespace getVariable "CBA_fnc_replace"); |
34 | | - _keystrg = [_keystrg, "^+", ""] call (uiNamespace getVariable "CBA_fnc_replace"); |
35 | | - _keystrg = [_keystrg, "^", "None"] call (uiNamespace getVariable "CBA_fnc_replace"); |
36 | | - _keystrg = [_keystrg, "LAlt", "Alt"] call (uiNamespace getVariable "CBA_fnc_replace"); |
37 | | - _keystrg = [_keystrg, "LCtrl", "Ctrl"] call (uiNamespace getVariable "CBA_fnc_replace"); |
38 | | - _keystrg = [_keystrg, "LShift", "Shift"] call (uiNamespace getVariable "CBA_fnc_replace"); |
39 | | - _keystrg |
| 52 | + |
| 53 | + _result = [_result, "^ ", ""] call CBA_fnc_replace; |
| 54 | + _result = [_result, "^+", ""] call CBA_fnc_replace; |
| 55 | + _result = [_result, "^", "None"] call CBA_fnc_replace; |
| 56 | + _result = [_result, "LAlt", "Alt"] call CBA_fnc_replace; |
| 57 | + _result = [_result, "LCtrl", "Ctrl"] call CBA_fnc_replace; |
| 58 | + _result = [_result, "LShift", "Shift"] call CBA_fnc_replace; |
| 59 | + _result |
40 | 60 | }; |
41 | 61 |
|
42 | | -_h = _pkeynam spawn { |
43 | | - _text = ""; |
44 | | - _names = cba_keybinding_handlers select 0; |
45 | | - _handlers = cba_keybinding_handlers select 1; |
46 | | - for "_i" from 0 to (count _names) do { |
47 | | - _name = _names select _i; |
48 | | - _handler = _handlers select _i; |
49 | | - if (!isNil "_name") then { |
50 | | - _text = _text + format ["%1:<br/>", _name]; |
51 | | - _actionNames = _handler select 0; |
52 | | - _actionEntries = _handler select 1; |
53 | | - |
54 | | - for "_j" from 0 to (count _actionNames - 1) do { |
55 | | - _actionName = _actionNames select _j; |
56 | | - _actionEntry = _actionEntries select _j; |
57 | | - |
58 | | - _displayName = _actionEntry select 0; |
59 | | - if (typeName _displayName == typeName []) then { |
60 | | - _displayName = (_actionEntry select 0) select 0; |
| 62 | +_fnc_getKeyName spawn { |
| 63 | + private _text = GVAR(keys); |
| 64 | + |
| 65 | + cba_keybinding_handlers params [["_keyNames", [], [[]]], ["_keyHandlers", [], [[]]]]; |
| 66 | + |
| 67 | + { |
| 68 | + private _keyName = _x; |
| 69 | + private _keyHandler = _keyHandlers param [_forEachIndex, []]; |
| 70 | + |
| 71 | + if (!isNil "_keyName") then { |
| 72 | + _text = _text + format ["%1:<br/>", _keyName]; |
| 73 | + |
| 74 | + _keyHandler params [["_actionNames", [], [[]]], ["_actionEntries", [], [[]]]]; |
| 75 | + |
| 76 | + { |
| 77 | + private _actionName = _x; |
| 78 | + private _actionEntry = _actionEntries param [_forEachIndex, []]; |
| 79 | + |
| 80 | + _actionEntry params [["_displayName", "", ["", []]], ["_keyBind", [], [[]]]]; |
| 81 | + |
| 82 | + if (_displayName isEqualType []) then { |
| 83 | + _displayName = _displayName param [0, ""]; |
61 | 84 | }; |
| 85 | + |
62 | 86 | // Escape < and > |
63 | | - _displayName = [_displayName, "<", "<"] call (uiNamespace getVariable "CBA_fnc_replace"); |
64 | | - _displayName = [_displayName, ">", ">"] call (uiNamespace getVariable "CBA_fnc_replace"); |
65 | | - _keyBind = _actionEntry select 1; |
66 | | - _dikKey = _keyBind select 0; |
67 | | - _mod = _keyBind select 1; |
68 | | - _shift = _mod select 0; |
69 | | - _ctrl = _mod select 1; |
70 | | - _alt = _mod select 2; |
71 | | - _keyn = call _this; |
72 | | - |
73 | | - _text = _text + format [" %1: <font color='#c48214'>%2</font><br/>", _displayName, _keyn]; |
74 | | - }; |
75 | | - _text = _text + "<br/>"; |
76 | | - }; |
77 | | - }; |
78 | | - player createDiaryRecord ["CBA_docs", [(localize "STR_DN_CBA_HELP_KEYS"), _text]]; |
79 | | -}; |
| 87 | + _displayName = [_displayName, "<", "<"] call CBA_fnc_replace; |
| 88 | + _displayName = [_displayName, ">", ">"] call CBA_fnc_replace; |
80 | 89 |
|
81 | | -player createDiarySubject ["CBA_docs", "CBA"]; |
82 | | -//player createDiaryRecord ["CBA_docs", [(localize "STR_DN_CBA_WEBSITE_WIKI"), "http://dev-heaven.net/projects/cca"]]; |
83 | | -if (!isNil QGVAR(CREDITS_CfgPatches)) then { player createDiaryRecord ["CBA_docs", [(localize "STR_DN_CBA_CREDITS_ADDONS"), GVAR(CREDITS_CfgPatches)]];}; |
84 | | -if (!isNil QGVAR(docs)) then { player createDiaryRecord ["CBA_docs", ["Docs", GVAR(docs)]];}; |
85 | | -if (!isNil QGVAR(keys)) then { player createDiaryRecord ["CBA_docs", [(localize "STR_DN_CBA_HELP_KEYS"), GVAR(keys)]];}; |
86 | | -//player createDiaryRecord ["CBA_docs", [(localize "STR_DN_CBA_CREDITS"), GVAR(credits_cba)]]; |
87 | | -//player createDiaryRecord ["CBA_docs", ["Credits - Vehicles", ([GVAR(credits), "CfgVehicles"] call (uiNamespace getVariable "CBA_fnc_hashGet")) call FUNC(process)]]; |
88 | | -//player createDiaryRecord ["CBA_docs", ["Credits - Weapons", ([GVAR(credits), "CfgWeapons"] call (uiNamespace getVariable "CBA_fnc_hashGet")) call FUNC(process)]]; |
| 90 | + _keyBind params [["_key", 0, [0]], ["_mod", [], [[]]]]; |
| 91 | + _mod params [["_shift", false, [false]], ["_ctrl", false, [false]], ["_alt", false, [false]]]; |
89 | 92 |
|
90 | | -//player createDiaryRecord ["CBA_docs", [(localize "STR_DN_CBA_WEBSITE"), "http://dev-heaven.net/projects/cca"]]; |
| 93 | + _text = _text + format [" %1: <font color='#c48214'>%2</font><br/>", _displayName, call _this]; |
| 94 | + } forEach _actionNames; |
91 | 95 |
|
| 96 | + _text = _text + "<br/>"; |
| 97 | + }; |
| 98 | + } forEach _keyNames; |
92 | 99 |
|
93 | | -// [cba_help_credits, "CfgPatches"] call (uiNamespace getVariable "CBA_fnc_hashGet") |
| 100 | + player createDiaryRecord ["CBA_docs", [localize "STR_DN_CBA_HELP_KEYS", _text]]; |
| 101 | +}; |
0 commit comments