Skip to content

Commit ef294ba

Browse files
committed
Item editor pickup tab revamp
1 parent 54bcde0 commit ef294ba

File tree

2 files changed

+140
-131
lines changed

2 files changed

+140
-131
lines changed

src/dialog/itemeditor.cpp

Lines changed: 138 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,7 @@ ItemEditorDialog::ItemEditorDialog(itemdata const& ref, char const* str, int32_t
954954
list_weaptype(GUI::ZCListData::lweaptypes()),
955955
list_deftypes(GUI::ZCListData::deftypes()),
956956
list_bottletypes(GUI::ZCListData::bottletype()),
957+
list_strings(GUI::ZCListData::strings()),
957958
list_sfx(GUI::ZCListData::sfxnames(true))
958959
{}
959960

@@ -1453,140 +1454,147 @@ std::shared_ptr<GUI::Widget> ItemEditorDialog::view()
14531454
)
14541455
)),
14551456
TabRef(name = "Pickup", Column(
1456-
Rows<4>(
1457-
//
1458-
Label(text = "Counter:", hAlign = 1.0),
1459-
DropDownList(
1460-
fitParent = true,
1461-
data = list_counters,
1462-
selectedValue = local_itemref.count,
1463-
onSelectFunc = [&](int32_t val)
1464-
{
1465-
local_itemref.count = val;
1466-
}
1467-
),_d,_d,
1468-
//
1469-
Label(text = "Increase By:", hAlign = 1.0),
1470-
TextField(
1471-
val = ((local_itemref.amount & 0x4000) ? -1 : 1)*signed(local_itemref.amount & 0x3FFF),
1472-
type = GUI::TextField::type::INT_DECIMAL,
1473-
fitParent = true, low = -9999, high = 16383,
1474-
onValChangedFunc = [&](GUI::TextField::type,std::string_view,int32_t val)
1475-
{
1476-
local_itemref.amount &= 0x8000;
1477-
local_itemref.amount |= (abs(val)&0x3FFF)|(val<0?0x4000:0);
1478-
}
1479-
),
1480-
Checkbox(
1481-
hAlign = 0.0,
1482-
checked = (local_itemref.amount & 0x8000),
1483-
text = "Gradual",
1484-
onToggleFunc = [&](bool state)
1485-
{
1486-
SETFLAG(local_itemref.amount,0x8000,state);
1487-
}
1488-
),_d,
1489-
//
1490-
Label(text = "Increase Max:", hAlign = 1.0),
1491-
TextField(
1492-
val = local_itemref.setmax,
1493-
type = GUI::TextField::type::INT_DECIMAL,
1494-
fitParent = true, low = -32768, high = 32767,
1495-
onValChangedFunc = [&](GUI::TextField::type,std::string_view,int32_t val)
1496-
{
1497-
local_itemref.setmax = val;
1498-
}
1499-
),
1500-
Label(text = "But Not Above:", hAlign = 1.0),
1501-
TextField(
1502-
val = local_itemref.max,
1503-
type = GUI::TextField::type::INT_DECIMAL,
1504-
fitParent = true, high = 65535,
1505-
onValChangedFunc = [&](GUI::TextField::type,std::string_view,int32_t val)
1506-
{
1507-
local_itemref.max = val;
1508-
}
1509-
),
1510-
//
1511-
Label(text = "Sound:", hAlign = 1.0),
1512-
TextField(
1513-
val = local_itemref.playsound,
1514-
type = GUI::TextField::type::INT_DECIMAL,
1515-
fitParent = true, high = 255,
1516-
onValChangedFunc = [&](GUI::TextField::type,std::string_view,int32_t val)
1517-
{
1518-
local_itemref.playsound = val;
1519-
}
1520-
),_d,_d,
1521-
//
1522-
Label(text = "Hearts Required:", hAlign = 1.0),
1523-
TextField(
1524-
val = local_itemref.pickup_hearts,
1525-
type = GUI::TextField::type::INT_DECIMAL,
1526-
fitParent = true, high = 255,
1527-
onValChangedFunc = [&](GUI::TextField::type,std::string_view,int32_t val)
1528-
{
1529-
local_itemref.pickup_hearts = val;
1530-
}
1531-
),_d,_d
1532-
),
1533-
Column(
1534-
Checkbox(
1535-
hAlign = 0.0,
1536-
checked = (local_itemref.flags & ITEM_KEEPOLD),
1537-
text = "Keep Lower Level Items",
1538-
onToggleFunc = [&](bool state)
1539-
{
1540-
SETFLAG(local_itemref.flags,ITEM_KEEPOLD,state);
1541-
}
1542-
),
1543-
Checkbox(
1544-
hAlign = 0.0,
1545-
checked = (local_itemref.flags & ITEM_GAINOLD),
1546-
text = "Gain All Lower Level Items",
1547-
onToggleFunc = [&](bool state)
1548-
{
1549-
SETFLAG(local_itemref.flags,ITEM_GAINOLD,state);
1550-
}
1457+
Row(
1458+
Rows<4>(framed = true,
1459+
//
1460+
Label(text = "Counter:", hAlign = 1.0),
1461+
DropDownList(
1462+
fitParent = true,
1463+
data = list_counters,
1464+
selectedValue = local_itemref.count,
1465+
onSelectFunc = [&](int32_t val)
1466+
{
1467+
local_itemref.count = val;
1468+
}
1469+
),_d,_d,
1470+
//
1471+
Label(text = "Increase By:", hAlign = 1.0),
1472+
TextField(
1473+
val = ((local_itemref.amount & 0x4000) ? -1 : 1)*signed(local_itemref.amount & 0x3FFF),
1474+
type = GUI::TextField::type::INT_DECIMAL,
1475+
fitParent = true, low = -9999, high = 16383,
1476+
onValChangedFunc = [&](GUI::TextField::type,std::string_view,int32_t val)
1477+
{
1478+
local_itemref.amount &= 0x8000;
1479+
local_itemref.amount |= (abs(val)&0x3FFF)|(val<0?0x4000:0);
1480+
}
1481+
),
1482+
Checkbox(
1483+
hAlign = 0.0,
1484+
checked = (local_itemref.amount & 0x8000),
1485+
text = "Gradual",
1486+
onToggleFunc = [&](bool state)
1487+
{
1488+
SETFLAG(local_itemref.amount,0x8000,state);
1489+
}
1490+
),_d,
1491+
//
1492+
Label(text = "Increase Max:", hAlign = 1.0),
1493+
TextField(
1494+
val = local_itemref.setmax,
1495+
type = GUI::TextField::type::INT_DECIMAL,
1496+
fitParent = true, low = -32768, high = 32767,
1497+
onValChangedFunc = [&](GUI::TextField::type,std::string_view,int32_t val)
1498+
{
1499+
local_itemref.setmax = val;
1500+
}
1501+
),
1502+
Label(text = "But Not Above:", hAlign = 1.0),
1503+
TextField(
1504+
val = local_itemref.max,
1505+
type = GUI::TextField::type::INT_DECIMAL,
1506+
fitParent = true, high = 65535,
1507+
onValChangedFunc = [&](GUI::TextField::type,std::string_view,int32_t val)
1508+
{
1509+
local_itemref.max = val;
1510+
}
1511+
),
1512+
//
1513+
Label(text = "Sound:", hAlign = 1.0),
1514+
TextField(
1515+
val = local_itemref.playsound,
1516+
type = GUI::TextField::type::INT_DECIMAL,
1517+
fitParent = true, high = 255,
1518+
onValChangedFunc = [&](GUI::TextField::type,std::string_view,int32_t val)
1519+
{
1520+
local_itemref.playsound = val;
1521+
}
1522+
),_d,_d,
1523+
//
1524+
Label(text = "Hearts Required:", hAlign = 1.0),
1525+
TextField(
1526+
val = local_itemref.pickup_hearts,
1527+
type = GUI::TextField::type::INT_DECIMAL,
1528+
fitParent = true, high = 255,
1529+
onValChangedFunc = [&](GUI::TextField::type,std::string_view,int32_t val)
1530+
{
1531+
local_itemref.pickup_hearts = val;
1532+
}
1533+
),_d,_d
15511534
),
1552-
Checkbox(
1553-
hAlign = 0.0,
1554-
checked = (local_itemref.flags & ITEM_COMBINE),
1555-
text = "Upgrade When Collected Twice",
1556-
onToggleFunc = [&](bool state)
1557-
{
1558-
SETFLAG(local_itemref.flags,ITEM_COMBINE,state);
1559-
}
1535+
Column(framed = true, fitParent = true,
1536+
Checkbox(
1537+
hAlign = 0.0,
1538+
checked = (local_itemref.flags & ITEM_KEEPOLD),
1539+
text = "Keep Lower Level Items",
1540+
onToggleFunc = [&](bool state)
1541+
{
1542+
SETFLAG(local_itemref.flags,ITEM_KEEPOLD,state);
1543+
}
1544+
),
1545+
Checkbox(
1546+
hAlign = 0.0,
1547+
checked = (local_itemref.flags & ITEM_GAINOLD),
1548+
text = "Gain All Lower Level Items",
1549+
onToggleFunc = [&](bool state)
1550+
{
1551+
SETFLAG(local_itemref.flags,ITEM_GAINOLD,state);
1552+
}
1553+
),
1554+
Checkbox(
1555+
hAlign = 0.0,
1556+
checked = (local_itemref.flags & ITEM_COMBINE),
1557+
text = "Upgrade When Collected Twice",
1558+
onToggleFunc = [&](bool state)
1559+
{
1560+
SETFLAG(local_itemref.flags,ITEM_COMBINE,state);
1561+
}
1562+
)
15601563
)
15611564
),
1562-
Row(
1563-
Label(text = "String:"),
1564-
TextField(
1565-
val = local_itemref.pstring,
1566-
type = GUI::TextField::type::INT_DECIMAL,
1567-
fitParent = true, high = 65535,
1568-
onValChangedFunc = [&](GUI::TextField::type,std::string_view,int32_t val)
1569-
{
1570-
local_itemref.pstring = val;
1571-
}
1572-
),
1573-
Checkbox(
1574-
hAlign = 0.0,
1575-
checked = (local_itemref.pickup_string_flags & itemdataPSTRING_ALWAYS),
1576-
text = "Always",
1577-
onToggleFunc = [&](bool state)
1578-
{
1579-
SETFLAG(local_itemref.pickup_string_flags,itemdataPSTRING_ALWAYS,state);
1580-
}
1565+
Column(framed = true,
1566+
Row(
1567+
Label(text = "String:"),
1568+
DropDownList(data = list_strings,
1569+
selectedValue = local_itemref.pstring,
1570+
fitParent = true,
1571+
onSelectFunc = [&](int32_t val)
1572+
{
1573+
local_itemref.pstring = val;
1574+
}
1575+
)
15811576
),
1582-
Checkbox(
1583-
hAlign = 0.0,
1584-
checked = (local_itemref.pickup_string_flags & itemdataPSTRING_IP_HOLDUP),
1585-
text = "Only Held",
1586-
onToggleFunc = [&](bool state)
1587-
{
1588-
SETFLAG(local_itemref.pickup_string_flags,itemdataPSTRING_IP_HOLDUP,state);
1589-
}
1577+
Rows<2>(
1578+
INFOBTN("The pickup string shows every time the item is collected, instead of just once."),
1579+
Checkbox(
1580+
hAlign = 0.0,
1581+
checked = (local_itemref.pickup_string_flags & itemdataPSTRING_ALWAYS),
1582+
text = "Always",
1583+
onToggleFunc = [&](bool state)
1584+
{
1585+
SETFLAG(local_itemref.pickup_string_flags,itemdataPSTRING_ALWAYS,state);
1586+
}
1587+
),
1588+
INFOBTN("The pickup string shows only if the item is held up, such as when received from a chest."),
1589+
Checkbox(
1590+
hAlign = 0.0,
1591+
checked = (local_itemref.pickup_string_flags & itemdataPSTRING_IP_HOLDUP),
1592+
text = "Only Held",
1593+
onToggleFunc = [&](bool state)
1594+
{
1595+
SETFLAG(local_itemref.pickup_string_flags,itemdataPSTRING_IP_HOLDUP,state);
1596+
}
1597+
)
15901598
)
15911599
)
15921600
)),

src/dialog/itemeditor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ class ItemEditorDialog: public GUI::Dialog<ItemEditorDialog>
101101
itemdata local_itemref;
102102
GUI::ListData list_items, list_counters, list_sprites,
103103
list_itemdatscript, list_itemsprscript, list_weaponscript,
104-
list_weaptype, list_deftypes, list_bottletypes, list_sfx;
104+
list_weaptype, list_deftypes, list_bottletypes, list_sfx,
105+
list_strings;
105106
std::shared_ptr<GUI::Widget> ATTRIB_FIELD_IMPL(int32_t* mem, int index);
106107
std::shared_ptr<GUI::Widget> FLAG_CHECK(int index, int bit);
107108
template <typename T>

0 commit comments

Comments
 (0)