mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Arsenal - add custom right panel misc items buttons (#7596)
* added medical, food and roleplay categories to arsenal * decreased wound stitch time * added custom rightPanelButtons * stuff that doesnt belong here * fix * commys wishes * commys wishes part2 * Update addons/arsenal/defines.hpp Co-Authored-By: Dedmen Miller <dedmen@users.noreply.github.com> * Update addons/arsenal/functions/fnc_fillRightPanel.sqf Co-Authored-By: Dedmen Miller <dedmen@users.noreply.github.com> * Update addons/arsenal/functions/fnc_fillRightPanel.sqf Co-Authored-By: Dedmen Miller <dedmen@users.noreply.github.com> * infinitely better SPEED * changes * delete unused stuff * my own 3 white dots * fixed fillRightPanel IDC_MISC * commy fixes * background first Co-authored-by: Schwaggot <tom.ryan@posteo.de> Co-authored-by: Dedmen Miller <dedmen@users.noreply.github.com>
This commit is contained in:
parent
d38dd1d67f
commit
b77324ec58
@ -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
|
||||
@ -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>
|
||||
|
@ -1,5 +1,6 @@
|
||||
PREP(addDefaultLoadout);
|
||||
PREP(addListBoxItem);
|
||||
PREP(addRightPanelButton);
|
||||
PREP(addStat);
|
||||
PREP(addVirtualItems);
|
||||
PREP(attributeAddCompatible);
|
||||
|
@ -15,6 +15,7 @@ class CfgPatches {
|
||||
};
|
||||
|
||||
#include "ui\RscAttributes.hpp"
|
||||
#include "ui\RscCustomArsenalButton.hpp"
|
||||
#include "Display3DEN.hpp"
|
||||
#include "Cfg3DEN.hpp"
|
||||
#include "CfgEventHandlers.hpp"
|
||||
|
BIN
addons/arsenal/data/iconCustom.paa
Normal file
BIN
addons/arsenal/data/iconCustom.paa
Normal file
Binary file not shown.
@ -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\
|
||||
@ -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_Background), 60 + (_forEachIndex * 2)];\
|
||||
_ctrl ctrlSetPosition [\
|
||||
safezoneW + safezoneX - 13 * GRID_W,\
|
||||
safezoneY + (88 + (10 * _forEachIndex)) * GRID_H\
|
||||
];\
|
||||
_ctrl ctrlCommit 0;\
|
||||
_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;\
|
||||
};\
|
||||
} 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\
|
||||
{\
|
||||
|
55
addons/arsenal/functions/fnc_addRightPanelButton.sqf
Normal file
55
addons/arsenal/functions/fnc_addRightPanelButton.sqf
Normal file
@ -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
|
@ -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);
|
||||
@ -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 "";
|
||||
|
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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));
|
||||
@ -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);
|
||||
|
22
addons/arsenal/ui/RscCustomArsenalButton.hpp
Normal file
22
addons/arsenal/ui/RscCustomArsenalButton.hpp
Normal file
@ -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;
|
||||
};
|
Loading…
Reference in New Issue
Block a user