Skip to content

Commit 27b3139

Browse files
committed
Merge branch 'master' into release-3.18.2
2 parents 7863712 + 68e4ac0 commit 27b3139

6 files changed

+62
-43
lines changed

addons/quicktime/XEH_preInit.sqf

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ ADDON = false;
88
#include "initSettings.inc.sqf"
99

1010
[LSTRING(QTEKeybindGroup), QGVAR(qteUpKey), ["", LSTRING(QTEKeybindUpTooltip)], {
11-
[""] call CBA_fnc_keyPressedQTE // return
11+
["^"] call CBA_fnc_keyPressedQTE // return
1212
}, {}, [DIK_UP, [false, true, false]]] call CBA_fnc_addKeybind;
1313

1414
[LSTRING(QTEKeybindGroup), QGVAR(qteDownKey), ["", LSTRING(QTEKeybindDownTooltip)], {
15-
[""] call CBA_fnc_keyPressedQTE // return
15+
["v"] call CBA_fnc_keyPressedQTE // return
1616
}, {}, [DIK_DOWN, [false, true, false]]] call CBA_fnc_addKeybind;
1717

1818
[LSTRING(QTEKeybindGroup), QGVAR(qteLeftKey), ["", LSTRING(QTEKeybindLeftTooltip)], {
19-
[""] call CBA_fnc_keyPressedQTE // return
19+
["<"] call CBA_fnc_keyPressedQTE // return
2020
}, {}, [DIK_LEFT, [false, true, false]]] call CBA_fnc_addKeybind;
2121

2222
[LSTRING(QTEKeybindGroup), QGVAR(qteRightKey), ["", LSTRING(QTEKeybindRightTooltip)], {
23-
[""] call CBA_fnc_keyPressedQTE // return
23+
[">"] call CBA_fnc_keyPressedQTE // return
2424
}, {}, [DIK_RIGHT, [false, true, false]]] call CBA_fnc_addKeybind;
2525

2626
ADDON = true;

addons/quicktime/fnc_generateQTESequence.sqf

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Example:
1212
[5] call CBA_fnc_generateQTESequence;
1313
1414
Returns:
15-
Quick-Time sequence of requested length made up of ["", "", "", ""] <ARRAY>
15+
Quick-Time sequence of requested length made up of ["^", "v", ">", "<"] <ARRAY>
1616
1717
Author:
1818
john681611
@@ -25,7 +25,7 @@ if (_length <= 0) exitWith {[]};
2525
private _code = [];
2626

2727
for "_i" from 1 to _length do {
28-
_code pushBack (selectRandom ["", "", "", ""]);
28+
_code pushBack (selectRandom ["^", "v", ">", "<"]);
2929
};
3030

3131
_code

addons/quicktime/fnc_getFormattedQTESequence.sqf

+8-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ Author:
1919
john681611
2020
---------------------------------------------------------------------------- */
2121

22-
params ["_code"];
22+
params [["_code", [], [[]]]];
2323

24-
_code joinString " " // Arma doesn't know how to space ↑ so we need loads of spaces between
24+
_code = _code joinString " "; // Arma doesn't know how to space ↑ so we need loads of spaces between
25+
26+
{
27+
_code = _code regexReplace [_x select 0, _x select 1];
28+
} forEach [["\^", ""], ["v", ""], [">", ""], ["<", ""]];
29+
30+
_code

addons/quicktime/fnc_keyPressedQTE.sqf

+13-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Parameters:
99
_eventQTE - Character to test against Quick-Time Event <STRING>
1010
1111
Example:
12-
[""] call CBA_fnc_keyPressedQTE;
12+
["^"] call CBA_fnc_keyPressedQTE;
1313
1414
Returns:
1515
True if QTE is running <BOOLEAN>
@@ -25,7 +25,6 @@ if !(missionNamespace getVariable [QGVAR(QTERunning), false]) exitWith {
2525
false
2626
};
2727

28-
2928
private _args = GVAR(QTEArgs) get "args";
3029
private _qteSequence = GVAR(QTEArgs) get "qteSequence";
3130
private _elapsedTime = CBA_missionTime - (GVAR(QTEArgs) get "startTime");
@@ -46,17 +45,25 @@ if (GVAR(QTEHistory) isEqualTo _qteSequence) exitWith {
4645
true
4746
};
4847

48+
private _incorrectInput = false;
49+
4950
// If the user failed an input, wipe the previous input from memory
5051
if (GVAR(QTEHistory) isNotEqualTo (_qteSequence select [0, count GVAR(QTEHistory)])) then {
51-
GVAR(QTEHistory) = [];
52-
GVAR(QTEResetCount) = GVAR(QTEResetCount) + 1;
52+
if (GVAR(QTEArgs) get "resetUponIncorrectInput") then {
53+
GVAR(QTEHistory) = [];
54+
GVAR(QTEResetCount) = GVAR(QTEResetCount) + 1;
55+
} else {
56+
GVAR(QTEHistory) deleteAt [-1];
57+
};
58+
59+
_incorrectInput = true;
5360
};
5461

5562
private _onDisplay = GVAR(QTEArgs) get "onDisplay";
5663
if (_onDisplay isEqualType "") then {
57-
[_onDisplay, [_args, _qteSequence, GVAR(QTEHistory), GVAR(QTEResetCount)]] call CBA_fnc_localEvent;
64+
[_onDisplay, [_args, _qteSequence, GVAR(QTEHistory), GVAR(QTEResetCount), _incorrectInput]] call CBA_fnc_localEvent;
5865
} else {
59-
[_args, _qteSequence, GVAR(QTEHistory), GVAR(QTEResetCount)] call _onDisplay;
66+
[_args, _qteSequence, GVAR(QTEHistory), GVAR(QTEResetCount), _incorrectInput] call _onDisplay;
6067
};
6168

6269
true

addons/quicktime/fnc_runQTE.sqf

+32-26
Original file line numberDiff line numberDiff line change
@@ -6,81 +6,87 @@ Description:
66
Runs a Quick-Time Event.
77
88
Parameters:
9-
_args - Extra arguments passed to the _on... functions<ARRAY>
10-
_failCondition - Code condition to fail the Quick-Time Event passed [_args, _elapsedTime, _resetCount]. <CODE, STRING> (default: {false})
11-
_onDisplay - Code callback on displayable event passed [_args, _qteSequence, _qteHistory, _resetCount]. <CODE, STRING>
12-
_onFinish - Code callback on Quick-Time Event completed passed [_args, _elapsedTime, _resetCount]. <CODE, STRING>
13-
_onFail - Code callback on Quick-Time Event timeout/outranged passed [_args, _elapsedTime, _resetCount]. <CODE, STRING>
14-
_qteSequence - Quick-Time sequence made up of ["↑", "↓", "→", "←"] <ARRAY>
9+
_args - Extra arguments passed to the _on... callbacks <ARRAY>
10+
_failCondition - Code condition to fail the Quick-Time Event; arguments passed: [_args, _elapsedTime, _resetCount] <CODE, STRING> (default: {false})
11+
_onDisplay - Code or event callback on keypress; arguments passed: [_args, _qteSequence, _qteHistory, _resetCount, _incorrectInput] <CODE, STRING>
12+
_onFinish - Code or event callback on Quick-Time Event completed; arguments passed: [_args, _elapsedTime, _resetCount] <CODE, STRING>
13+
_onFail - Code or event callback on Quick-Time Event timeout/outranged; arguments passed: [_args, _elapsedTime, _resetCount] <CODE, STRING>
14+
_qteSequence - Quick-Time sequence made up of ["^", "v", ">", "<"] <ARRAY>
15+
_resetUponIncorrectInput - Reset Quick-Time keystroke history if input is incorrect <BOOLEAN>
1516
1617
Example:
1718
[car,
1819
{
1920
params ["_args", "_elapsedTime", "_resetCount"];
2021
player distance _args > 10 || _elapsedTime > 10 || _resetCount >= 3;
21-
},
22-
{
22+
},
23+
{
2324
params ["_args", "_qteSequence", "_qteHistory", "_resetCount"];
2425
hint format [
2526
"%3/3 \n %1 \n %2",
2627
[_qteSequence] call CBA_fnc_getFormattedQTESequence,
2728
[_qteHistory] call CBA_fnc_getFormattedQTESequence,
2829
_resetCount
2930
]
30-
},
31-
{
31+
},
32+
{
3233
params ["_args", "_elapsedTime", "_resetCount"];
33-
hint format ["Finished! %1s %2", _elapsedTime, _resetCount];
34+
hint format ["Finished! %1s %2", _elapsedTime, _resetCount];
3435
},
35-
{
36+
{
3637
params ["_args", "_elapsedTime", "_resetCount"];
37-
hint format ["Failure! %1s %2", _elapsedTime, _resetCount];
38+
hint format ["Failure! %1s %2", _elapsedTime, _resetCount];
3839
},
39-
["", "", "", ""]] call CBA_fnc_runQTE
40+
["^", "v", ">", "<"]] call CBA_fnc_runQTE
4041
4142
Returns:
42-
True if the QTE was started, false if it was already running <BOOLEAN>
43+
true if the QTE was started, false if it was already running <BOOLEAN>
4344
4445
Author:
4546
john681611
4647
---------------------------------------------------------------------------- */
48+
4749
if (missionNamespace getVariable [QGVAR(QTERunning), false]) exitWith {
4850
false
4951
};
5052

5153
params [
5254
"_args",
53-
["_failCondition",{false}, ["", {}]],
54-
["_onDisplay",{}, ["", {}]],
55-
["_onFinish",{}, ["", {}]],
56-
["_onFail",{}, ["", {}]],
57-
["_qteSequence", [], [[]]]
55+
["_failCondition", {false}, ["", {}]],
56+
["_onDisplay", {}, ["", {}]],
57+
["_onFinish", {}, ["", {}]],
58+
["_onFail", {}, ["", {}]],
59+
["_qteSequence", [], [[]]],
60+
["_resetUponIncorrectInput", true, [false]]
5861
];
5962

6063
GVAR(QTEHistory) = [];
6164
GVAR(QTEResetCount) = 0;
6265
GVAR(QTERunning) = true;
66+
6367
private _startTime = CBA_missionTime;
64-
if(GVAR(qteShorten)) then {
68+
if (GVAR(qteShorten)) then {
6569
_qteSequence = _qteSequence select [0, 1];
6670
};
71+
6772
private _qteArgsArray = [
6873
["args", _args],
6974
["failCondition", _failCondition],
7075
["onDisplay", _onDisplay],
7176
["onFinish", _onFinish],
7277
["onFail", _onFail],
7378
["qteSequence", _qteSequence],
74-
["startTime", _startTime]
79+
["startTime", _startTime],
80+
["resetUponIncorrectInput", _resetUponIncorrectInput]
7581
];
7682
GVAR(QTEArgs) = createHashMapFromArray _qteArgsArray;
7783

78-
// Setup
84+
// Setup
7985
[{
8086
private _args = GVAR(QTEArgs) get "args";
8187
private _failCondition = GVAR(QTEArgs) get "failCondition";
8288
private _elapsedTime = CBA_missionTime - (GVAR(QTEArgs) get "startTime");
83-
89+
8490
!GVAR(QTERunning) || [_args, _elapsedTime, GVAR(QTEResetCount)] call _failCondition;
8591
}, {
8692
TRACE_1("QTE ended",GVAR(QTERunning));
@@ -99,9 +105,9 @@ GVAR(QTEArgs) = createHashMapFromArray _qteArgsArray;
99105
}, []] call CBA_fnc_waitUntilAndExecute;
100106

101107
if (_onDisplay isEqualType "") then {
102-
[_onDisplay, [_args, _qteSequence, [], GVAR(QTEResetCount)]] call CBA_fnc_localEvent;
108+
[_onDisplay, [_args, _qteSequence, [], GVAR(QTEResetCount), false]] call CBA_fnc_localEvent;
103109
} else {
104-
[_args, _qteSequence, [], GVAR(QTEResetCount)] call _onDisplay;
110+
[_args, _qteSequence, [], GVAR(QTEResetCount), false] call _onDisplay;
105111
};
106112

107113
true

addons/quicktime/stringtable.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<French>Community Base Addons - Quick-Time-Events</French>
77
<German>Community Base Addons - Quick-Time-Events</German>
88
<Korean>커뮤니티 베이스 애드온 - 퀵 타임 이벤트 (QTE)</Korean>
9-
<Japanese>Community Base Addons - QTE(クイック タイム イベント)</Japanese>
9+
<Japanese>Community Base Addons - QTE (クイック タイム イベント)</Japanese>
1010
</Key>
1111
<Key ID="STR_cba_quicktime_QTEAccessabilitySingleKey">
1212
<English>Single Key press</English>
@@ -34,7 +34,7 @@
3434
<French>Événements CBA Quick-Time</French>
3535
<German>CBA Quick-Time-Events</German>
3636
<Korean>CBA 퀵 타임 이벤트 (QTE)</Korean>
37-
<Japanese>CBA QTE</Japanese>
37+
<Japanese>CBA QTE (クイック タイム イベント)</Japanese>
3838
</Key>
3939
<Key ID="STR_cba_quicktime_QTEKeybindLeftTooltip">
4040
<English>Left key used in Quick-Time Events.</English>
@@ -55,7 +55,7 @@
5555
<French>Touche du haut utilisée dans les événements Quick-Time.</French>
5656
<German>Taste in Quick-Time-Events für oben.</German>
5757
<Korean>QTE에 사용되는 위쪽 키입니다.</Korean>
58-
<Japanese>Qで使用される上キー。</Japanese>
58+
<Japanese>QTEで使用される上キー。</Japanese>
5959
</Key>
6060
<Key ID="STR_cba_quicktime_QTETitle">
6161
<English>Quick-Time Events</English>

0 commit comments

Comments
 (0)