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

Arsenal - add custom right panel misc items buttons #7596

Merged
merged 27 commits into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
08fa70d
added medical, food and roleplay categories to arsenal
Schwaggot Feb 20, 2020
fa1a025
decreased wound stitch time
Schwaggot Feb 22, 2020
ce79862
Merge remote-tracking branch 'upstream/master'
Schwaggot Mar 10, 2020
d05191d
Merge pull request #3 from kellerkompanie/master
shukari Mar 11, 2020
d7466d3
Merge branch 'master' of github.com:shukari/ACE3
shukari Mar 11, 2020
f7af7f0
added custom rightPanelButtons
shukari Mar 12, 2020
4c9112a
stuff that doesnt belong here
shukari Mar 12, 2020
febefe6
fix
shukari Mar 12, 2020
603e6b3
commys wishes
shukari Mar 12, 2020
5483256
commys wishes part2
shukari Mar 12, 2020
525702a
Update addons/arsenal/defines.hpp
shukari Mar 12, 2020
c77737d
Update addons/arsenal/functions/fnc_fillRightPanel.sqf
shukari Mar 12, 2020
ba1e453
Update addons/arsenal/functions/fnc_fillRightPanel.sqf
shukari Mar 12, 2020
50eae9a
infinitely better SPEED
shukari Mar 12, 2020
d062de3
Merge branch 'master' of github.com:shukari/ACE3
shukari Mar 12, 2020
6656ab7
Merge branch 'master' of github.com:acemod/ACE3
shukari Apr 13, 2020
7d4b291
changes
shukari Apr 30, 2020
f5514de
Merge branch 'master' of github.com:acemod/ACE3
shukari Apr 30, 2020
2a541f2
Merge branch 'master' of github.com:acemod/ACE3
shukari May 1, 2020
3ef2718
delete unused stuff
shukari May 4, 2020
7183623
my own 3 white dots
shukari May 6, 2020
f270241
Merge branch 'master' of github.com:acemod/ACE3
shukari May 21, 2020
da081af
Merge branch 'master' of github.com:acemod/ACE3
shukari Jun 12, 2020
6a7e90f
fixed fillRightPanel IDC_MISC
shukari Jun 23, 2020
acfd44f
Merge remote-tracking branch 'remotes/origin/master'
shukari Jun 23, 2020
d781bd7
commy fixes
shukari Jun 26, 2020
a20915b
background first
shukari Jun 28, 2020
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
2 changes: 1 addition & 1 deletion AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ Andrea "AtixNeon" Verano <veranoandrea88@gmail.com>
Anthariel <Contact@storm-simulation.com>
Arcanum417 <lubos.len@gmail.com>
Anton
Arcanum417 <lubos.len@gmail.com>
Arkhir <wonsz666@gmail.com >
Asgar Serran <piechottaf@web.de>
BaerMitUmlaut
Expand Down Expand Up @@ -139,6 +138,7 @@ Robert Boklahánics <bokirobi@gmail.com>
ruPaladin <happyworm24@rambler.ru>
Rutger "RedBery" Meijering <c.redbery@gmail.com>
Schwaggot <tom.ryan@posteo.de>
shukari
simon84 <badguy360th@gmail.com>
Skengman2
Smith <smitt14ua@gmail.com>
Expand Down
1 change: 1 addition & 0 deletions addons/arsenal/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PREP(addDefaultLoadout);
PREP(addListBoxItem);
PREP(addRightPanelButton);
PREP(addStat);
PREP(addVirtualItems);
PREP(attributeAddCompatible);
Expand Down
1 change: 1 addition & 0 deletions addons/arsenal/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class CfgPatches {
};

#include "ui\RscAttributes.hpp"
#include "ui\RscCustomArsenalButton.hpp"
#include "Display3DEN.hpp"
#include "Cfg3DEN.hpp"
#include "CfgEventHandlers.hpp"
Expand Down
Binary file added addons/arsenal/data/iconCustom.paa
Binary file not shown.
39 changes: 36 additions & 3 deletions addons/arsenal/defines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,12 @@
#define FADE_DELAY 0.15
#define CAM_DIS_MAX 5

#define RIGHT_PANEL_CUSTOM_BUTTONS 61, 63, 65, 67, 69, 71, 73, 75, 77, 79
#define RIGHT_PANEL_CUSTOM_BACKGROUND 60, 62, 64, 66, 68, 70, 72, 74, 76, 78
#define RIGHT_PANEL_ACC_IDCS IDC_buttonOptic, IDC_buttonItemAcc, IDC_buttonMuzzle, IDC_buttonBipod
#define RIGHT_PANEL_ACC_BACKGROUND_IDCS IDC_iconBackgroundOptic, IDC_iconBackgroundItemAcc, IDC_iconBackgroundMuzzle, IDC_iconBackgroundBipod
#define RIGHT_PANEL_ITEMS_IDCS IDC_buttonMag, IDC_buttonMagALL, IDC_buttonThrow, IDC_buttonPut, IDC_buttonMisc
#define RIGHT_PANEL_ITEMS_BACKGROUND_IDCS IDC_iconBackgroundMag, IDC_iconBackgroundMagALL, IDC_iconBackgroundThrow, IDC_iconBackgroundPut, IDC_iconBackgroundMisc
#define RIGHT_PANEL_ITEMS_IDCS IDC_buttonMag, IDC_buttonMagALL, IDC_buttonThrow, IDC_buttonPut, IDC_buttonMisc, RIGHT_PANEL_CUSTOM_BUTTONS
#define RIGHT_PANEL_ITEMS_BACKGROUND_IDCS IDC_iconBackgroundMag, IDC_iconBackgroundMagALL, IDC_iconBackgroundThrow, IDC_iconBackgroundPut, IDC_iconBackgroundMisc, RIGHT_PANEL_CUSTOM_BACKGROUND
#define ARROWS_IDCS IDC_arrowMinus, IDC_arrowPlus

#define GETDLC\
Expand Down Expand Up @@ -304,7 +306,38 @@ _buttonCurrentMag2Ctrl ctrlCommit FADE_DELAY;\
} foreach [\
IDC_blockRightFrame,\
IDC_blockRighttBackground\
];
];\
if (!isNil QGVAR(customRightPanelButtons)) then {\
private _miscOffset = 0;\
{\
if (!isNil "_x") then {\
_x params ["", "_picture", "_tooltip"];\
_miscOffset = _forEachIndex + 1;\
private _ctrl = _display ctrlCreate [QGVAR(customArsenalButton_Button), 61 + (_forEachIndex * 2)];\
_ctrl ctrlSetPosition [\
safezoneW + safezoneX - 10 * GRID_W,\
safezoneY + (88 + (10 * _forEachIndex)) * GRID_H\
];\
_ctrl ctrlSetText _picture;\
_ctrl ctrlSetTooltip _tooltip;\
_ctrl ctrlCommit 0;\
_ctrl = _display ctrlCreate [QGVAR(customArsenalButton_Background), 60 + (_forEachIndex * 2)];\
_ctrl ctrlSetPosition [\
safezoneW + safezoneX - 13 * GRID_W,\
safezoneY + (88 + (10 * _forEachIndex)) * GRID_H\
];\
_ctrl ctrlCommit 0;\
};\
} forEach GVAR(customRightPanelButtons);\
{\
_x = _display displayCtrl _x;\
_x ctrlSetPosition [\
safezoneW + safezoneX - (10 + (3 * _forEachIndex)) * GRID_W,\
safezoneY + (88 + (10 * _miscOffset)) * GRID_H\
];\
_x ctrlCommit 0;\
} forEach [IDC_buttonMisc, IDC_iconBackgroundMisc];\
};

#define TOGGLE_RIGHT_PANEL_HIDE\
{\
Expand Down
55 changes: 55 additions & 0 deletions addons/arsenal/functions/fnc_addRightPanelButton.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include "script_component.hpp"
#include "..\defines.hpp"
/*
* Author: shukari, Schwaggot
* Adds a right panel button for uniforms, vests and backpacks with
* defined misc items.
*
* Arguments:
* 0: items only misc items <ARRAY of STRING>
* 1: tooltip <STRING> (Optional)
* 2: picture path <STRING> (Optional)
* 3: override a spezific button (0-9) <NUMBER> (Optional)
*
* Return Value:
* successful: number of the slot; error: -1 <NUMBER>
*
* Example:
* [["ACE_bloodIV_500", "ACE_Banana"], "MedicalStuff", "\z\ace\addons\arsenal\data\iconCustom.paa", 5] call ace_arsenal_fnc_addRightPanelButton
*
* Public: Yes
*/

params [["_items", [], [[]]], ["_tooltip", "", [""]], ["_picture", QPATHTOF(data\iconCustom.paa), [""]], ["_override", -1, [0]]];

if (isNil QGVAR(customRightPanelButtons)) then {
GVAR(customRightPanelButtons) = [];
};

private _position = count GVAR(customRightPanelButtons);

if (_override != -1 && {_override >= 0} && {_override <= 9}) then {
_position = _override;
} else {
private _emptyPos = GVAR(customRightPanelButtons) findIf {isNil "_x"};
if (_emptyPos != -1) then {
_position = _emptyPos;
};
};

private _return = -1;
if (_position >= 0 && _position <= 9) then {
private _cfgWeapons = configFile >> "CfgWeapons";
_items = _items select {
private _configItemInfo = _cfgWeapons >> _x >> "ItemInfo";

_x isKindOf ["CBA_MiscItem", _cfgWeapons] && {getNumber (_configItemInfo >> "type") in [TYPE_MUZZLE, TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_BIPOD]} ||
{getNumber (_configItemInfo >> "type") in [TYPE_FIRST_AID_KIT, TYPE_MEDIKIT, TYPE_TOOLKIT]} ||
{getText (_cfgWeapons >> _x >> "simulation") == "ItemMineDetector"}
};

_return = _position;
GVAR(customRightPanelButtons) set [_position, [_items apply {toLower _x}, _picture, _tooltip]];
};

_return
27 changes: 26 additions & 1 deletion addons/arsenal/functions/fnc_fillRightPanel.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,20 @@ switch (_ctrlIDC) do {
};

case IDC_buttonMisc : {
// hide custom button items
private _blockItems = [];
if (!isNil QGVAR(customRightPanelButtons)) then {
{
if (!isNil "_x") then {
_blockItems append (_x select 0);
};
} forEach GVAR(customRightPanelButtons);
};

{
["CfgWeapons", _x, false] call _fnc_fill_right_Container;
} foreach (GVAR(virtualItems) select 17);
} forEach ((GVAR(virtualItems) select 17) select {!((toLower _x) in _blockItems)});

{
["CfgWeapons", _x, false, true] call _fnc_fill_right_Container;
} foreach (GVAR(virtualItems) select 18);
Expand All @@ -286,6 +297,20 @@ switch (_ctrlIDC) do {
["CfgGlasses", _x, false, true] call _fnc_fill_right_Container;
} foreach (GVAR(virtualItems) select 24);
};

default {
private _index = [RIGHT_PANEL_CUSTOM_BUTTONS] find _ctrlIDC;
if (_index != -1) then {
private _data = GVAR(customRightPanelButtons) param [_index];

if (!isNil "_data") then {
private _items = _data select 0;
{
["CfgWeapons", _x, true] call _fnc_fill_right_Container;
} foreach ((GVAR(virtualItems) select 17) select {(toLower _x) in _items});
};
};
};
};

(_display displayCtrl IDC_rightSearchbar) ctrlSetText "";
Expand Down
11 changes: 6 additions & 5 deletions addons/arsenal/ui/RscAttributes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ class GVAR(display) {
colorBackground[]={0,0,0,1};
fade=1;
enable=0;
x = QUOTE(safezoneW + safezoneX - 13 * GRID_W);
x = QUOTE(safezoneW + safezoneX - 13 * GRID_W);
y = QUOTE(safezoneY + 8 * GRID_H);
w = QUOTE(12 * GRID_W);
h = QUOTE(9 * GRID_H);
Expand All @@ -798,7 +798,7 @@ class GVAR(display) {
text="\A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\ItemOptic_ca.paa";
onButtonClick = QUOTE([ARR_2(ctrlParent (_this select 0), _this select 0)] call FUNC(fillRightPanel));
colorBackground[]={0,0,0,0.5};
x = QUOTE(safezoneW + safezoneX - 10 * GRID_W);
x = QUOTE(safezoneW + safezoneX - 10 * GRID_W);
y = QUOTE(safezoneY + 8 * GRID_H);
w = QUOTE(9 * GRID_W);
h = QUOTE(9 * GRID_H);
Expand Down Expand Up @@ -903,6 +903,7 @@ class GVAR(display) {
tooltip="$STR_A3_RscDisplayArsenal_tab_CargoMisc";
y = QUOTE(safezoneY + 88 * GRID_H);
};

class buttonRemoveAll: ctrlButtonPicture {
idc = IDC_buttonRemoveAll;
text = QPATHTOF(data\iconClearContainer.paa);
Expand All @@ -911,7 +912,7 @@ class GVAR(display) {
onButtonClick = QUOTE(ctrlParent (_this select 0) call FUNC(buttonClearAll));
fade=1;
enable=0;
x = QUOTE(safezoneW + safezoneX - 11 * GRID_W);
x = QUOTE(safezoneW + safezoneX - 11 * GRID_W);
y = QUOTE(safeZoneH + safezoneY - 29 * GRID_H);
w = QUOTE(9 * GRID_W);
h = QUOTE(9 * GRID_H);
Expand All @@ -926,7 +927,7 @@ class GVAR(loadoutsDisplay) {
class controls {
class centerBox: ctrlControlsGroupNoScrollbars {
idc = IDC_centerBox;
x = QUOTE(safezoneW + safezoneX - (180 * GRID_W));
x = QUOTE(safezoneW + safezoneX - (180 * GRID_W));
y = QUOTE(safezoneY + (5 * GRID_H));
w = QUOTE(160 * GRID_W);
h = QUOTE(safezoneH - (34 * GRID_H));
Expand Down Expand Up @@ -1056,7 +1057,7 @@ class GVAR(loadoutsDisplay) {
};
class buttonClose: ctrlButton {
idc = -1;
x = QUOTE(safezoneW + safezoneX - 32 * GRID_W);
x = QUOTE(safezoneW + safezoneX - 32 * GRID_W);
y = QUOTE(safezoneH + safezoneY - 9 * GRID_H);
w = QUOTE(30 * GRID_W);
h = QUOTE(7 * GRID_H);
Expand Down
22 changes: 22 additions & 0 deletions addons/arsenal/ui/RscCustomArsenalButton.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class GVAR(customArsenalButton_Button) : RscButtonArsenal {
x = QUOTE(safezoneW + safezoneX - 10 * GRID_W);
y = QUOTE(safezoneY + 88 * GRID_H);
w = QUOTE(9 * GRID_W);
h = QUOTE(9 * GRID_H);

text = QPATHTOF(data\iconCustom.paa);
tooltip = "";
onButtonClick = QUOTE([ARR_2(ctrlParent (_this select 0), _this select 0)] call FUNC(fillRightPanel));
colorBackground[] = {0,0,0,0.5};
};

class GVAR(customArsenalButton_Background) : ctrlStaticBackground {
x = QUOTE(safezoneW + safezoneX - 13 * GRID_W);
y = QUOTE(safezoneY + 88 * GRID_H);
w = QUOTE(12 * GRID_W);
h = QUOTE(9 * GRID_H);

colorBackground[] = {0,0,0,1};
fade = 1;
enable = 0;
};