More various ace arsenal fixes (#6192)

* Compile stats on preInit

* Remove uneeded check in add/removeStat

* Remove perf profiler vars

They aren't required anymore

* Fix case issue in verifyLoadout, remove uneeded line

* Fix ace arsenal cam not working porperly underwater

By removing those checks the cam is allowed to clip through objects and work properly underwater, sounds like features to me :D

* Fix gunbag behavior in ace arsenal

Switching between gunbags will keep the weapon, switching to another backpack then back to a gunbag will also keep the weapon.

* Fix text scaling in the searchbars and loadout name edit boxes

Also made the text bigger by default
This commit is contained in:
Josuan Albin 2018-04-12 17:44:23 +02:00 committed by PabstMirror
parent 468da8b79b
commit 1994e301fd
19 changed files with 59 additions and 93 deletions

View File

@ -58,4 +58,6 @@ GVAR(modList) = ["","curator","kart","heli","mark","expansion","expansionpremium
_this call FUNC(handleStats); _this call FUNC(handleStats);
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;
call FUNC(compileStats);
ADDON = true; ADDON = true;

View File

@ -339,27 +339,27 @@ _buttonCurrentMag2Ctrl ctrlCommit FADE_DELAY;\
] ]
#define CHECK_WEAPON_OR_ACC\ #define CHECK_WEAPON_OR_ACC\
_item in (_weaponsArray select 0) ||\ (_weaponsArray select 0) findIf {_x == _item} > -1 ||\
{_item in (_weaponsArray select 1)} ||\ {(_weaponsArray select 1) findIf {_x == _item} > -1} ||\
{_item in (_weaponsArray select 2)} ||\ {(_weaponsArray select 2) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 9)} ||\ {(GVAR(virtualItems) select 9) findIf {_x == _item} > -1} ||\
{_item in (_accsArray select 0)} ||\ {(_accsArray select 0) findIf {_x == _item} > -1} ||\
{_item in (_accsArray select 1)} ||\ {(_accsArray select 1 findIf {_x == _item} > -1)} ||\
{_item in (_accsArray select 2)} ||\ {(_accsArray select 2) findIf {_x == _item} > -1} ||\
{_item in (_accsArray select 3)} {(_accsArray select 3) findIf {_x == _item} > -1}
#define CHECK_ASSIGNED_ITEMS\ #define CHECK_ASSIGNED_ITEMS\
_item in (GVAR(virtualItems) select 10) ||\ (GVAR(virtualItems) select 10) findIf {_x == _item} > -1 ||\
{_item in (GVAR(virtualItems) select 11)} ||\ {(GVAR(virtualItems) select 11) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 12)} ||\ {(GVAR(virtualItems) select 12) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 13)} ||\ {(GVAR(virtualItems) select 13) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 14)} ||\ {(GVAR(virtualItems) select 14) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 8)} {(GVAR(virtualItems) select 8) findIf {_x == _item} > -1}
#define CHECK_CONTAINER\ #define CHECK_CONTAINER\
_item in (GVAR(virtualItems) select 4) ||\ (GVAR(virtualItems) select 4) findIf {_x == _item} > -1 ||\
{_item in (GVAR(virtualItems) select 5)} ||\ {(GVAR(virtualItems) select 5) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 6)} {(GVAR(virtualItems) select 6) findIf {_x == _item} > -1}
#define CLASS_CHECK_ITEM\ #define CLASS_CHECK_ITEM\
isClass (_weaponCfg >> _item) ||\ isClass (_weaponCfg >> _item) ||\
@ -368,24 +368,24 @@ _buttonCurrentMag2Ctrl ctrlCommit FADE_DELAY;\
{isClass (_magCfg >> _item)} {isClass (_magCfg >> _item)}
#define CHECK_CONTAINER_ITEMS\ #define CHECK_CONTAINER_ITEMS\
_item in (GVAR(virtualItems) select 3) ||\ (GVAR(virtualItems) select 3) findIf {_x == _item} > -1 ||\
{_item in (_accsArray select 0)} ||\ {(_accsArray select 0) findIf {_x == _item} > -1} ||\
{_item in (_accsArray select 1)} ||\ {(_accsArray select 1) findIf {_x == _item} > -1} ||\
{_item in (_accsArray select 2)} ||\ {(_accsArray select 2) findIf {_x == _item} > -1} ||\
{_item in (_accsArray select 3)} ||\ {(_accsArray select 3) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 4)} ||\ {(GVAR(virtualItems) select 4) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 5)} ||\ {(GVAR(virtualItems) select 5) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 6)} ||\ {(GVAR(virtualItems) select 6) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 7)} ||\ {(GVAR(virtualItems) select 7) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 8)} ||\ {(GVAR(virtualItems) select 8) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 10)} ||\ {(GVAR(virtualItems) select 10) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 11)} ||\ {(GVAR(virtualItems) select 11) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 12)} ||\ {(GVAR(virtualItems) select 12) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 13)} ||\ {(GVAR(virtualItems) select 13) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 14)} ||\ {(GVAR(virtualItems) select 14) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 15)} ||\ {(GVAR(virtualItems) select 15) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 16)} ||\ {(GVAR(virtualItems) select 16) findIf {_x == _item} > -1} ||\
{_item in (GVAR(virtualItems) select 17)} {(GVAR(virtualItems) select 17) findIf {_x == _item} > -1}
#define ADD_LOADOUTS_LIST_PICTURES\ #define ADD_LOADOUTS_LIST_PICTURES\
_contentPanelCtrl lnbSetPicture [[_newRow, 2], getText (configFile >> "cfgWeapons" >> ((_loadout select 0) select 0) >> "picture")];\ _contentPanelCtrl lnbSetPicture [[_newRow, 2], getText (configFile >> "cfgWeapons" >> ((_loadout select 0) select 0) >> "picture")];\

View File

@ -54,6 +54,7 @@ _statements params [
]; ];
call FUNC(compileStats); call FUNC(compileStats);
private _returnArray = []; private _returnArray = [];
private _fnc_addToTabs = { private _fnc_addToTabs = {

View File

@ -14,10 +14,6 @@
#include "script_component.hpp" #include "script_component.hpp"
#include "..\defines.hpp" #include "..\defines.hpp"
#ifdef ENABLE_PERF_PROFILING
private _scopeFillLeftPanel = createProfileScope QFUNC(fillLeftPanel);
#endif
params ["_display", "_control"]; params ["_display", "_control"];
private _ctrlIDC = ctrlIDC _control; private _ctrlIDC = ctrlIDC _control;

View File

@ -14,10 +14,6 @@
#include "script_component.hpp" #include "script_component.hpp"
#include "..\defines.hpp" #include "..\defines.hpp"
#ifdef ENABLE_PERF_PROFILING
private _scopeFillRightPanel = createProfileScope QFUNC(fillRightPanel);
#endif
params ["_display", "_control"]; params ["_display", "_control"];
private _ctrlIDC = ctrlIDC _control; private _ctrlIDC = ctrlIDC _control;

View File

@ -44,11 +44,6 @@ if (count _LMB > 0) then {
_helperPos set [2,(_helperPos select 2) max ((boundingboxreal GVAR(center) select 0 select 2) + 0.2)]; _helperPos set [2,(_helperPos select 2) max ((boundingboxreal GVAR(center) select 0 select 2) + 0.2)];
//--- Do not let target go below ground
private _posZmin = 0.1;
private _targetWorldPosZ = (GVAR(center) modeltoworldvisual _helperPos) select 2;
if (_targetWorldPosZ < _posZmin) then {_helperPos set [2,(_helperPos select 2) - _targetWorldPosZ + _posZmin];};
GVAR(cameraPosition) set [3,_helperPos]; GVAR(cameraPosition) set [3,_helperPos];
}; };

View File

@ -16,10 +16,6 @@
#include "script_component.hpp" #include "script_component.hpp"
#include "..\defines.hpp" #include "..\defines.hpp"
#ifdef ENABLE_PERF_PROFILING
private _scopeHandleStats = createProfileScope QFUNC(handleStats);
#endif
params ["_display", "_control", "_curSel", "_itemCfg"]; params ["_display", "_control", "_curSel", "_itemCfg"];
private _statsBoxCtrl = _display displayCtrl IDC_statsBox; private _statsBoxCtrl = _display displayCtrl IDC_statsBox;
@ -50,7 +46,6 @@ private _hideUnusedFnc = {
} forEach _numbers; } forEach _numbers;
}; };
call FUNC(compileStats);
if !(isNil "_itemCfg") then { if !(isNil "_itemCfg") then {
private _handleStatsFnc = { private _handleStatsFnc = {

View File

@ -16,10 +16,6 @@
#include "script_component.hpp" #include "script_component.hpp"
#include "..\defines.hpp" #include "..\defines.hpp"
#ifdef ENABLE_PERF_PROFILING
private _scopeItemInfo = createProfileScope QFUNC(itemInfo);
#endif
params ["_display", "_control", "_curSel" ,"_itemCfg"]; params ["_display", "_control", "_curSel" ,"_itemCfg"];
private _ctrlInfo = _display displayCtrl IDC_infoBox; private _ctrlInfo = _display displayCtrl IDC_infoBox;

View File

@ -15,11 +15,6 @@
#include "script_component.hpp" #include "script_component.hpp"
#include "..\defines.hpp" #include "..\defines.hpp"
#ifdef ENABLE_PERF_PROFILING
private _scopeArsenal = createProfileScope QFUNC(onArsenalOpen);
profilerTrigger;
#endif
params ["", "_args"]; params ["", "_args"];
_args params ["_display"]; _args params ["_display"];

View File

@ -14,10 +14,6 @@
#include "script_component.hpp" #include "script_component.hpp"
#include "..\defines.hpp" #include "..\defines.hpp"
#ifdef ENABLE_PERF_PROFILING
private _scopeOnSelChangedLeft = createProfileScope QFUNC(onSelChangedLeft);
#endif
params ["_control", "_curSel"]; params ["_control", "_curSel"];
if (_curSel < 0) exitwith {}; if (_curSel < 0) exitwith {};

View File

@ -14,10 +14,6 @@
#include "script_component.hpp" #include "script_component.hpp"
#include "..\defines.hpp" #include "..\defines.hpp"
#ifdef ENABLE_PERF_PROFILING
private _scopeOnSelChangedRight = createProfileScope QFUNC(onSelChangedRight);
#endif
params ["_control", "_curSel"]; params ["_control", "_curSel"];
if (_curSel < 0) exitwith {}; if (_curSel < 0) exitwith {};

View File

@ -14,10 +14,6 @@
#include "script_component.hpp" #include "script_component.hpp"
#include "..\defines.hpp" #include "..\defines.hpp"
#ifdef ENABLE_PERF_PROFILING
private _scopeOnSelChangedRightLNB = createProfileScope QFUNC(onSelChangedRightListnBox);
#endif
params ["_control", "_curSel"]; params ["_control", "_curSel"];
if (_curSel < 0) exitwith {}; if (_curSel < 0) exitwith {};

View File

@ -13,10 +13,6 @@
#include "script_component.hpp" #include "script_component.hpp"
#include "..\defines.hpp" #include "..\defines.hpp"
#ifdef ENABLE_PERF_PROFILING
private _scopeShowItem = createProfileScope QFUNC(showItem);
#endif
if (GVAR(centerNotPlayer)) exitWith {}; if (GVAR(centerNotPlayer)) exitWith {};
private _nextAction = switch (GVAR(currentLeftPanel)) do { private _nextAction = switch (GVAR(currentLeftPanel)) do {

View File

@ -14,10 +14,6 @@
#include "script_component.hpp" #include "script_component.hpp"
#include "..\defines.hpp" #include "..\defines.hpp"
#ifdef ENABLE_PERF_PROFILING
private _scopeSortPanel = createProfileScope QFUNC(sortPanel);
#endif
params ["_control", "_mode"]; params ["_control", "_mode"];
private _display = ctrlParent _control; private _display = ctrlParent _control;

View File

@ -19,9 +19,3 @@ GVAR(cameraHelper) attachTo [GVAR(center), GVAR(cameraPosition) select 3, ""]; /
GVAR(camera) setPos (GVAR(cameraHelper) modelToWorld [0, -_distance, 0]); GVAR(camera) setPos (GVAR(cameraHelper) modelToWorld [0, -_distance, 0]);
GVAR(camera) setVectorDirAndUp [vectorDir GVAR(cameraHelper), vectorUp GVAR(cameraHelper)]; GVAR(camera) setVectorDirAndUp [vectorDir GVAR(cameraHelper), vectorUp GVAR(cameraHelper)];
//--- Make sure the camera is not underground
if ((getPosAsl GVAR(camera) select 2) < (getPosAsl GVAR(center) select 2)) then {
private _disCoef = ((getPosAsl GVAR(cameraHelper) select 2) - (getPosAsl GVAR(center) select 2)) / ((getPosAsl GVAR(cameraHelper) select 2) - (getPosAsl GVAR(camera) select 2) + 0.001);
GVAR(camera) setPos (GVAR(cameraHelper) modelToWorldVisual [0, -_distance * _disCoef, 0]);
};

View File

@ -14,10 +14,6 @@
#include "script_component.hpp" #include "script_component.hpp"
#include "..\defines.hpp" #include "..\defines.hpp"
#ifdef ENABLE_PERF_PROFILING
private _scopeUpdateRightPanel = createProfileScope QFUNC(updateRightPanel);
#endif
params ["_control", "_maxLoad"]; params ["_control", "_maxLoad"];
private _loadIndicatorBarCtrl = _display displayCtrl IDC_loadIndicatorBar; private _loadIndicatorBarCtrl = _display displayCtrl IDC_loadIndicatorBar;

View File

@ -5,7 +5,6 @@
// #define DEBUG_MODE_FULL // #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE // #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS // #define ENABLE_PERFORMANCE_COUNTERS
// #define ENABLE_PERF_PROFILING // This requires https://forums.bohemia.net/forums/topic/211626-arma-script-profiler/ do not uncomment otherwise.
#ifdef DEBUG_ENABLED_ARSENAL #ifdef DEBUG_ENABLED_ARSENAL
#define DEBUG_MODE_FULL #define DEBUG_MODE_FULL

View File

@ -559,6 +559,7 @@ class GVAR(display) {
y = QUOTE(safezoneY + 1.8 * GRID_H); y = QUOTE(safezoneY + 1.8 * GRID_H);
w = QUOTE(74 * GRID_W); w = QUOTE(74 * GRID_W);
h = QUOTE(6 * GRID_H); h = QUOTE(6 * GRID_H);
sizeEx = QUOTE(6 * GRID_H);
}; };
class leftSearchbarButton: ctrlButtonPicture { class leftSearchbarButton: ctrlButtonPicture {
idc = IDC_leftSearchbarButton; idc = IDC_leftSearchbarButton;
@ -987,6 +988,7 @@ class GVAR(loadoutsDisplay) {
y = QUOTE(safezoneH - (51 * GRID_H)); y = QUOTE(safezoneH - (51 * GRID_H));
w = QUOTE(65 * GRID_W); w = QUOTE(65 * GRID_W);
h = QUOTE(5 * GRID_H); h = QUOTE(5 * GRID_H);
sizeEx = QUOTE(6 * GRID_H);
}; };
class loadoutsSearchbar: ctrlEdit { class loadoutsSearchbar: ctrlEdit {
idc = IDC_loadoutsSearchbar; idc = IDC_loadoutsSearchbar;
@ -997,6 +999,7 @@ class GVAR(loadoutsDisplay) {
y = QUOTE(safezoneH - (51 * GRID_H)); y = QUOTE(safezoneH - (51 * GRID_H));
w = QUOTE(72 * GRID_W); w = QUOTE(72 * GRID_W);
h = QUOTE(5 * GRID_H); h = QUOTE(5 * GRID_H);
sizeEx = QUOTE(6 * GRID_H);
}; };
class loadoutsSearchbarButton: ctrlButtonPicture { class loadoutsSearchbarButton: ctrlButtonPicture {
idc = -1; idc = -1;

View File

@ -24,4 +24,22 @@ PREP_RECOMPILE_END;
}, _this] call CBA_fnc_execNextFrame; }, _this] call CBA_fnc_execNextFrame;
}] call CBA_fnc_addClassEventHandler; }] call CBA_fnc_addClassEventHandler;
[QEGVAR(arsenal,displayOpened), {
private _center = EGVAR(arsenal,center);
if (_center call FUNC(hasGunBag)) then {
GVAR(arsenalCache) = (backpackContainer _center) getVariable [QGVAR(gunbagWeapon), []];
};
}] call CBA_fnc_addEventHandler;
[QEGVAR(arsenal,displayClosed), {
if !(isNil QGVAR(arsenalCache)) then {
(backpackContainer EGVAR(arsenal,center)) setVariable [QGVAR(gunbagWeapon),GVAR(arsenalCache), true];
};
GVAR(arsenalCache) = nil;
}] call CBA_fnc_addEventHandler;
ADDON = true; ADDON = true;