Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ACE Arsenal stats #6110

Merged
merged 83 commits into from
Feb 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
b7dab73
Add test class
alganthe Dec 24, 2017
d92532e
Add stats mockup
alganthe Dec 31, 2017
77f7b33
Merge branch 'master' of https://github.com/acemod/ACE3 into arsenalS…
alganthe Jan 9, 2018
1041ffc
Finish mockup, add basic hide/show logic
alganthe Jan 14, 2018
327ec0e
Add base for stats
alganthe Jan 15, 2018
1ccad3f
Use CBA EHs for stats to allow 3rd party mods of it
alganthe Jan 16, 2018
78ac754
Add handleStats and most of the UI behaviors for stats
alganthe Jan 17, 2018
16d878e
Continue work on stats
alganthe Jan 18, 2018
28cbcd7
Add container stats
alganthe Jan 18, 2018
9a2ec02
Add page support for stats
alganthe Jan 19, 2018
75e6ccd
Add text for the ROF stat
alganthe Jan 19, 2018
d95fbee
Add accuracy in MOA for the accuracy stat
alganthe Jan 20, 2018
6be8222
Change accuracy shown number to 1 decimal instead of 2
alganthe Jan 20, 2018
65fa210
Add MIL in the dispersion stat text
alganthe Jan 24, 2018
cf8d94b
Change stats layout, remove dummy text strings
alganthe Jan 28, 2018
6aaab2f
Add some AB stats
alganthe Jan 28, 2018
6a868ca
Remove last test string
alganthe Jan 28, 2018
699d963
Replace configExtremes by normal lookup where it's relevant
alganthe Jan 28, 2018
daccf1a
Add "undefined value" string when AB stat isn't present
alganthe Jan 28, 2018
e8de8ba
Fix typo in preInit
alganthe Jan 28, 2018
2eb1302
Change drag model stat to ballistic coef
alganthe Jan 28, 2018
de1d167
Fix issue with unused stats, change text to white when bar is present
alganthe Jan 30, 2018
26d7452
Rewrite some part of handleStats
alganthe Jan 31, 2018
944c1e2
Re-add _hideUnusedFnc, handle empty stats arrays
alganthe Jan 31, 2018
6c6c5e9
Pass args to stat conditions, add test condition stat
alganthe Jan 31, 2018
6e25dd6
Add hearing related stats
alganthe Jan 31, 2018
c3a9ede
Remove the padding between stats and the stat bar / text
alganthe Jan 31, 2018
eba0a25
Add strings for stats
alganthe Jan 31, 2018
7faa636
Change stats window to fit baer's suggestion
alganthe Jan 31, 2018
ec9604c
Algin the close stats button, add missing strings
alganthe Jan 31, 2018
6202e53
Finish code review
alganthe Feb 1, 2018
07eb34b
Merge branch 'master' of https://github.com/acemod/ACE3 into arsenalS…
alganthe Feb 1, 2018
9c350a4
Add missing newline
alganthe Feb 1, 2018
89e29bd
Remove duplicate strings
alganthe Feb 1, 2018
052f191
Add explosive range stat
alganthe Feb 1, 2018
8edce71
Use proper string for the explo range stat
alganthe Feb 1, 2018
feef0be
Fix capitalization for ctrlParent
alganthe Feb 1, 2018
d637a50
Fix conditional stats blocking other stats
alganthe Feb 1, 2018
0c07ace
Add better integration for ballistics, hearing and explosive stats
alganthe Feb 1, 2018
71284a9
Replace the private array in handleStat by params
alganthe Feb 1, 2018
25079d9
Add backblast stats
alganthe Feb 1, 2018
36d14d4
Add backblast stat strings
alganthe Feb 1, 2018
2faeaad
Add flashlight map color and g-force reduction stats
alganthe Feb 1, 2018
da0fde7
Shorten preInit
alganthe Feb 1, 2018
76eb938
Change stats close button to fit arsenal design
alganthe Feb 2, 2018
0344052
Improve stats page indicator look
alganthe Feb 2, 2018
f24731b
Rework how stats are stored and retrieved
alganthe Feb 3, 2018
734fe0b
Remove args config entry, add priority entry, add vanilla weapon stats
alganthe Feb 3, 2018
2b68a43
Add vanilla container stats
alganthe Feb 3, 2018
d7900b2
Remove some lines in preInit
alganthe Feb 3, 2018
4cc256c
Add ballistics stats
alganthe Feb 3, 2018
f22e8b8
Add hearing stats
alganthe Feb 3, 2018
360b4f6
Remove uneeded config entries
alganthe Feb 3, 2018
a878cc9
Add explosive range stat
alganthe Feb 3, 2018
08ff9e0
Add backblast stats
alganthe Feb 3, 2018
407ef92
Add spaces after semicolons in statements
alganthe Feb 3, 2018
973baa3
Add flashlights map color stat
alganthe Feb 3, 2018
ba5bea3
Add gforce reduction stat
alganthe Feb 3, 2018
230e743
Fix headers for the new stats funcs
alganthe Feb 3, 2018
7e43eb3
Add add / remove stat API
alganthe Feb 3, 2018
cc4910c
Fix typo in removeStat header
alganthe Feb 3, 2018
75ea0ba
Remove uneeded inline func
alganthe Feb 3, 2018
690bcae
Clean up add / remove stat
alganthe Feb 4, 2018
da86449
Move all CfgACEArsenalStats entries to their own file
alganthe Feb 5, 2018
20b9a12
Replace STR_ACE_Ballistics_statAmmo by a BI string
alganthe Feb 5, 2018
3c0a052
Add script profiler related macro and code
alganthe Feb 8, 2018
f302726
Use the highest ballistic coef instead of first one defined
alganthe Feb 8, 2018
283ac4c
Add support for future ammo displayname
alganthe Feb 8, 2018
c986270
Add ACE_standardAtmosphere for ballistic coef
alganthe Feb 8, 2018
ec329f8
Add mag muzzle velocity stat
alganthe Feb 8, 2018
d757885
Add weapon muzzle velocity stat
alganthe Feb 8, 2018
fca65b2
Merge branch 'master' of https://github.com/acemod/ACE3 into arsenalS…
alganthe Feb 8, 2018
afaf372
Add comment explaining the ENABLE_PERF_PROFILING macro
alganthe Feb 9, 2018
9a228c9
Merge branch 'master' of https://github.com/acemod/ACE3 into arsenalS…
alganthe Feb 9, 2018
dc9facd
Change cfgACEArsenalStats to ACE_Arsenal_Stats
alganthe Feb 10, 2018
a3ddc77
Make JJ less pissy about spaces around =
alganthe Feb 10, 2018
2f67688
Fix indentation in weaponMuzzleVelocity, use param
alganthe Feb 10, 2018
0889493
Use GVAR and EGVAR when appropriate
alganthe Feb 10, 2018
d4b06f4
Prefix all stats except the base class
alganthe Feb 10, 2018
7840557
Merge branch 'master' into arsenalStats
PabstMirror Feb 13, 2018
dbd8f26
Fix Merge
PabstMirror Feb 13, 2018
88e271e
Fix aspect ratio scaling of stats panel
PabstMirror Feb 13, 2018
eb64f5d
Minor fixes
PabstMirror Feb 14, 2018
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
96 changes: 96 additions & 0 deletions addons/arsenal/ACE_Arsenal_Stats.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
class GVAR(stats) {
class statBase {
scope = 1;
priority = 0;
stats[] = {};
displayName = "";
showBar = 0;
showText = 0;
barStatement = "";
textStatement = "";
condition = "true";
tabs[] = {{}, {}};
};
class ACE_bananaPotassium: statBase {
scope = 2;
displayName= CSTRING(statPotassium);
showBar = 1;
barStatement = "1";
condition = QUOTE((configName (_this select 1)) == 'ACE_Banana');
tabs[] = {{}, {7}};
};
class ACE_mass: statBase {
scope = 2;
displayName= "$STR_a3_rscdisplayarsenal_stat_weight";
showText = 1;
textStatement = QUOTE([ARR_2(_this select 0, _this select 1)] call FUNC(statTextStatement_mass));
tabs[] = {{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}, {0,1,2,3,4,5,6,7}};
};
class ACE_rateOfFire: statBase {
scope = 2;
priority = 5;
stats[] = {"reloadTime"};
displayName= "$STR_a3_rscdisplayarsenal_stat_rof";
showBar = 1;
showText = 1;
barStatement = QUOTE([ARR_3((_this select 0) select 0, _this select 1, [ARR_3([ARR_2(-1.4, 0.31)], [ARR_2(1, 0.01)], true)])] call FUNC(statBarStatement_default));
textStatement = QUOTE([ARR_3((_this select 0) select 0, _this select 1, [ARR_2([ARR_2(-1.4, 0.31)], false)])] call FUNC(statTextStatement_rateOfFire));
tabs[] = {{0,1}, {}};
};
class ACE_accuracy: statBase {
scope = 2;
priority = 4;
stats[] = {"dispersion"};
displayName = "$STR_a3_rscdisplayarsenal_stat_dispersion";
showBar = 1;
showText = 1;
barStatement = QUOTE([ARR_3((_this select 0) select 0, _this select 1, [ARR_3([ARR_2(-4, -1.7)], [ARR_2(1, 0.01)], true)])] call FUNC(statBarStatement_default));
textStatement = QUOTE([ARR_3((_this select 0) select 0, _this select 1, [ARR_2([ARR_2(-4, -1.7)], false)])] call FUNC(statTextStatement_accuracy));
tabs[] = {{0,1}, {}};
};
class ACE_maxZeroing: statBase {
scope = 2;
priority = 3;
stats[] = {"maxZeroing"};
displayName = "$STR_a3_rscdisplayarsenal_stat_range";
showBar = 1;
barStatement = QUOTE([ARR_3((_this select 0) select 0, _this select 1, [ARR_3([ARR_2(0, 2500)], [ARR_2(0.01, 1)], false)])] call FUNC(statBarStatement_default));
tabs[] = {{0,1,2}, {}};
};
class ACE_impact: statBase {
scope = 2;
priority = 2;
stats[] = {"hit", "initSpeed"};
displayName = "$STR_a3_rscdisplayarsenal_stat_impact";
showBar = 1;
barStatement = QUOTE([ARR_3(_this select 0, _this select 1, [ARR_3([ARR_2(0, 3.2)], [ARR_2(-1, 1100)], 2006)])] call FUNC(statBarStatement_impact));
tabs[] = {{0,1,2}, {}};
};
class ACE_ballisticProtection: statBase {
scope = 2;
priority = 5;
stats[] = {"passthrough"};
displayName = "$STR_a3_rscdisplayarsenal_stat_passthrough";
showBar = 1;
barStatement = QUOTE([ARR_3((_this select 0) select 0, _this select 1, [ARR_3([ARR_2(0, 0.63)], [ARR_2(0.01, 1)], false)])] call FUNC(statBarStatement_default));
tabs[] = {{3,4,6}, {}};
};
class ACE_explosiveResistance: statBase {
scope = 2;
priority = 4;
stats[] = {"armor"};
displayName = "$STR_a3_rscdisplayarsenal_stat_armor";
showBar = 1;
barStatement = QUOTE([ARR_3((_this select 0) select 0, _this select 1, [ARR_3([ARR_2(0, 0.80)], [ARR_2(0.01, 1)], false)])] call FUNC(statBarStatement_default));
tabs[] = {{3,4,6}, {}};
};
class ACE_load: statBase {
scope = 2;
priority = 3;
stats[] = {"maximumLoad"};
displayName = "$STR_a3_rscdisplayarsenal_stat_load";
showBar = 1;
barStatement = QUOTE([ARR_3((_this select 0) select 0, _this select 1, [ARR_3([ARR_2(0, 500)], [ARR_2(0.01, 1)], false)])] call FUNC(statBarStatement_default));
tabs[] = {{3,4,5}, {}};
};
};
11 changes: 11 additions & 0 deletions addons/arsenal/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PREP(addListBoxItem);
PREP(addStat);
PREP(addVirtualItems);
PREP(buttonCargo);
PREP(buttonClearAll);
Expand All @@ -10,14 +11,18 @@ PREP(buttonLoadoutsLoad);
PREP(buttonLoadoutsRename);
PREP(buttonLoadoutsSave);
PREP(buttonLoadoutsShare);
PREP(buttonStats);
PREP(buttonStatsPage);
PREP(clearSearchbar);
PREP(compileStats);
PREP(fillLeftPanel);
PREP(fillLoadoutsList);
PREP(fillRightPanel);
PREP(handleLoadoutsSearchbar);
PREP(handleMouse);
PREP(handleScrollWheel);
PREP(handleSearchbar);
PREP(handleStats);
PREP(initBox);
PREP(itemInfo);
PREP(loadoutsChangeTab);
Expand All @@ -37,10 +42,16 @@ PREP(open3DEN);
PREP(openBox);
PREP(portVALoadouts);
PREP(removeBox);
PREP(removeStat);
PREP(removeVirtualItems);
PREP(scanConfig);
PREP(showItem);
PREP(sortPanel);
PREP(statBarStatement_default);
PREP(statBarStatement_impact);
PREP(statTextStatement_accuracy);
PREP(statTextStatement_mass);
PREP(statTextStatement_rateOfFire);
PREP(updateCamPos);
PREP(updateRightPanel);
PREP(updateUniqueItemsList);
Expand Down
38 changes: 38 additions & 0 deletions addons/arsenal/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "script_component.hpp"
#include "defines.hpp"

ADDON = false;

Expand All @@ -20,4 +21,41 @@ GVAR(modList) = ["","curator","kart","heli","mark","expansion","expansionpremium
[QGVAR(allowSharedLoadouts), "CHECKBOX", localize LSTRING(allowSharingSetting), localize LSTRING(settingCategory), true, true] call CBA_Settings_fnc_init;
[QGVAR(EnableRPTLog), "CHECKBOX", [LSTRING(printToRPTSetting), LSTRING(printToRPTTooltip)], localize LSTRING(settingCategory), false, false] call CBA_Settings_fnc_init;

[QGVAR(statsToggle), {
params ["_display", "_showStats"];

private _statsCtrlGroupCtrl = _display displayCtrl IDC_statsBox;
private _statsPreviousPageCtrl = _display displayCtrl IDC_statsPreviousPage;
private _statsNextPageCtrl = _display displayCtrl IDC_statsNextPage;
private _statsCurrentPageCtrl = _display displayCtrl IDC_statsCurrentPage;

private _statsButtonCtrl = _display displayCtrl IDC_statsButton;
private _statsButtonCloseCtrl = _display displayCtrl IDC_statsButtonClose;

{
_x ctrlShow (GVAR(showStats) && {_showStats});
} forEach [
_statsCtrlGroupCtrl,
_statsPreviousPageCtrl,
_statsNextPageCtrl,
_statsCurrentPageCtrl,
_statsButtonCloseCtrl
];

_statsButtonCtrl ctrlShow (!GVAR(showStats) && {_showStats})
}] call CBA_fnc_addEventHandler;

[QGVAR(statsButton), {
_this call FUNC(buttonStats);
}] call CBA_fnc_addEventHandler;

[QGVAR(statsChangePage), {
_this call FUNC(buttonStatsPage);
}] call CBA_fnc_addEventHandler;


[QGVAR(displayStats), {
_this call FUNC(handleStats);
}] call CBA_fnc_addEventHandler;

ADDON = true;
1 change: 1 addition & 0 deletions addons/arsenal/XEH_preStart.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
#include "XEH_PREP.hpp"

call FUNC(scanConfig);
call FUNC(compileStats);
1 change: 1 addition & 0 deletions addons/arsenal/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ class Cfg3DEN {
#include "ui\RscAttributes.hpp"
#include "CfgEventHandlers.hpp"
#include "RscDisplayMain.hpp"
#include "ACE_Arsenal_Stats.hpp"
26 changes: 26 additions & 0 deletions addons/arsenal/defines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,32 @@
#define IDC_buttonMisc 38
#define IDC_buttonRemoveAllSelected 39
#define IDC_buttonRemoveAll 40
#define IDC_statsBox 51
#define IDC_statsTitle1 5101
#define IDC_statsBackground1 5102
#define IDC_statsBar1 5103
#define IDC_statsText1 5104
#define IDC_statsTitle2 5105
#define IDC_statsBackground2 5106
#define IDC_statsBar2 5107
#define IDC_statsText2 5108
#define IDC_statsTitle3 5109
#define IDC_statsBackground3 5110
#define IDC_statsBar3 5111
#define IDC_statsText3 5112
#define IDC_statsTitle4 5113
#define IDC_statsBackground4 5114
#define IDC_statsBar4 5115
#define IDC_statsText4 5116
#define IDC_statsTitle5 5117
#define IDC_statsBackground5 5118
#define IDC_statsBar5 5119
#define IDC_statsText5 5120
#define IDC_statsPreviousPage 52
#define IDC_statsNextPage 53
#define IDC_statsCurrentPage 54
#define IDC_statsButton 55
#define IDC_statsButtonClose 56

#define IDD_loadouts_display 1127002
#define IDC_centerBox 3
Expand Down
99 changes: 99 additions & 0 deletions addons/arsenal/functions/fnc_addStat.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* Author: Alganthe
* Add a stat to ACE Arsenal.
*
* Arguments:
* 0: Tabs to add the stat to (ARRAY of ARRAYS)
* 0.1: Left tab indexes (ARRAY of NUMBERS)
* 0.2 Right tab indexes (ARRAY of NUMBERS)
* 1: Stat class (STRING) (A unique string for each stat)
* 2: Config entries to pass (ARRAY of STRINGS)
* 3: Title (STRING)
* 4: Show bar / show text bools (ARRAY of BOOLS)
* 4.1 Show bar (BOOL)
* 4.2 Show text (BOOL)
* 5: Array of statements (ARRAY of ARRAYS)
* 5.1: Bar code (CODE)
* 5.2 Text code (CODE)
* 5.3 Condition code (CODE)
* 6: Priority (NUMBER) (Optional)
*
* Return Value:
* 0: Array of IDs (ARRAY of STRINGS)
*
* Example:
* [[[0,1,2], [7]], "scopeStat", ["scope"], "Scope", [false, true], [{}, {
params ["_statsArray", "_itemCfg"];
getNumber (_itemCfg >> _statsArray select 0)
}, {true}]] call ACE_arsenal_fnc_addStat
*
* Public: Yes
*/
#include "script_component.hpp"
params [
["_tabs", [[], []], [[]], 2],
["_class", "", [""]],
["_stats", [], [[]]],
["_title", "", [""]],
["_bools", [false, false], [[]], 2],
["_statements", [{}, {}, {true}], [[]], 3],
["_priority", 0, [0]]
];

_tabs params [
["_leftTabs", [], [[]]],
["_rightTabs", [], [[]]]
];

_bools params [["_showBar", false, [false]], ["_showText", false, [false]]];

_statements params [
["_barStatement", {}, [{}]],
["_textStatement", {}, [{}]],
["_condition", {true}, [{}]]
];

private _statsListLeftPanel = uiNamespace getVariable QGVAR(statsListLeftPanel);
private _statsListRightPanel = uiNamespace getVariable QGVAR(statsListRightPanel);
private _returnArray = [];

private _fnc_addToTabs = {
params ["_tabsList", "_tabsToAddTo", "_sideString", "_returnIndex"];
{
private _currentTab = _tabsList select _x;

private _finalID = [_class, _sideString, [str _x, format ["0%1", _x]] select (_x < 10)] joinString "";

if ({{_x select 0 == _finalID} count _x > 0} count _currentTab > 0) then {
TRACE_1("A stat with this ID already exists", _finalID);
} else {

private _arrayToSave = +_finalArray;
_arrayToSave set [0, _finalID];
_returnArray pushBack _finalID;

// Add to existing page if there's enough space, otherwise create a new page
if ({count _x < 5} count _currentTab > 0) then {
{
if (count _x < 5) exitWith {
(_currentTab select _forEachIndex) append [_arrayToSave];
};
} foreach _currentTab;
} else {
_currentTab pushBack [_arrayToSave];
};
};
} foreach _tabsToAddTo;
};

private _finalArray = ["", _stats, _title, [_showBar, _showText], [_barStatement, _textStatement, _condition], _priority];

if (count _leftTabs > 0) then {
[_statsListLeftPanel, _leftTabs, "L", 0] call _fnc_addToTabs;
};

if (count _rightTabs > 0) then {
[_statsListRightPanel, _rightTabs, "R", 1] call _fnc_addToTabs;
};

_returnArray
9 changes: 8 additions & 1 deletion addons/arsenal/functions/fnc_buttonHide.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,12 @@ private _showToggle = !ctrlShown (_display displayCtrl IDC_menuBar);
IDC_buttonCurrentMag,
IDC_buttonCurrentMag2,
IDC_iconBackgroundCurrentMag,
IDC_iconBackgroundCurrentMag2
IDC_iconBackgroundCurrentMag2,
IDC_statsButton,
IDC_statsPreviousPage,
IDC_statsNextPage,
IDC_statsCurrentPage,
IDC_statsButtonClose
];

[QGVAR(statsToggle), [_display, _showToggle]] call CBA_fnc_localEvent;
31 changes: 31 additions & 0 deletions addons/arsenal/functions/fnc_buttonStats.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Author: Alganthe
* Toggle the stats control group
*
* Arguments:
* 0: Arsenal display <DISPLAY>
* 1: Button control <CONTROL>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
#include "..\defines.hpp"

params ["_display"];

(_display displayCtrl IDC_statsButton) ctrlShow GVAR(showStats);
GVAR(showStats) = !GVAR(showStats);

{
(_display displayCtrl _x) ctrlShow GVAR(showStats);
} foreach [
IDC_statsBox,
IDC_statsPreviousPage,
IDC_statsNextPage,
IDC_statsCurrentPage,
IDC_statsButtonClose
];

Loading