Merge branch 'master' into fix-tilemap

This commit is contained in:
GriffinR 2023-02-05 14:55:36 -05:00 committed by GitHub
commit b6c97e845b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View file

@ -8,8 +8,12 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
## [Unreleased] ## [Unreleased]
### Fixed ### Fixed
- Fix tilesets that share part of their name loading incorrectly.
- Fix events being hidden behind connecting maps. - Fix events being hidden behind connecting maps.
- Fix some minor visual issues on the Connections tab. - Fix some minor visual issues on the Connections tab.
- Fix bug which caused encounter configurator to crash if slots in fields containing groups were deleted.
- Fix bug which caused encounter configurator to crash if last field was deleted.
- Fix map render when collision view was active while map changed.
- Fix the updated pokefirered region map graphics appearing in grayscale. - Fix the updated pokefirered region map graphics appearing in grayscale.
## [5.1.0] - 2023-01-22 ## [5.1.0] - 2023-01-22

View file

@ -112,6 +112,8 @@ void Editor::setEditingCollision() {
} }
if (map_item) { if (map_item) {
map_item->paintingMode = MapPixmapItem::PaintMode::Metatiles; map_item->paintingMode = MapPixmapItem::PaintMode::Metatiles;
map_item->draw();
map_item->setVisible(true);
} }
if (events_group) { if (events_group) {
events_group->setVisible(false); events_group->setVisible(false);
@ -468,7 +470,7 @@ void Editor::configureEncounterJSON(QWidget *window) {
QVBoxLayout *slotChoiceLayout = new QVBoxLayout; QVBoxLayout *slotChoiceLayout = new QVBoxLayout;
if (useGroups) { if (useGroups) {
QComboBox *groupCombo = new QComboBox; QComboBox *groupCombo = new QComboBox;
connect(groupCombo, QOverload<const QString &>::of(&QComboBox::textActivated), [&tempFields, &currentField, index](QString newGroupName) { connect(groupCombo, QOverload<const QString &>::of(&QComboBox::textActivated), [&tempFields, &currentField, &updateTotal, index](QString newGroupName) {
for (EncounterField &field : tempFields) { for (EncounterField &field : tempFields) {
if (field.name == currentField.name) { if (field.name == currentField.name) {
for (auto groupNameIterator : field.groups) { for (auto groupNameIterator : field.groups) {
@ -485,6 +487,7 @@ void Editor::configureEncounterJSON(QWidget *window) {
break; break;
} }
} }
updateTotal(currentField);
}); });
for (auto groupNameIterator : currentField.groups) { for (auto groupNameIterator : currentField.groups) {
groupCombo->addItem(groupNameIterator.first); groupCombo->addItem(groupNameIterator.first);
@ -542,6 +545,12 @@ void Editor::configureEncounterJSON(QWidget *window) {
delete slot; delete slot;
} }
if (!tempFields.size()) {
return;
}
if (index >= tempFields.size()) {
index = tempFields.size() - 1;
}
EncounterField &currentField = tempFields[index]; EncounterField &currentField = tempFields[index];
for (int i = 0; i < currentField.encounterRates.size(); i++) { for (int i = 0; i < currentField.encounterRates.size(); i++) {
grid.addWidget(createNewSlot(i, currentField), i / 4 + 1, i % 4); grid.addWidget(createNewSlot(i, currentField), i / 4 + 1, i % 4);
@ -602,10 +611,15 @@ void Editor::configureEncounterJSON(QWidget *window) {
removeSlotButton->setFlat(true); removeSlotButton->setFlat(true);
connect(removeSlotButton, &QPushButton::clicked, [&fieldChoices, &drawSlotWidgets, &tempFields]() { connect(removeSlotButton, &QPushButton::clicked, [&fieldChoices, &drawSlotWidgets, &tempFields]() {
EncounterField &field = tempFields[fieldChoices->currentIndex()]; EncounterField &field = tempFields[fieldChoices->currentIndex()];
if (field.encounterRates.size() > 1) int lastIndex = field.encounterRates.size() - 1;
if (lastIndex > 0)
field.encounterRates.removeLast(); field.encounterRates.removeLast();
for (auto &g : field.groups) {
field.groups[g.first].removeAll(lastIndex);
}
drawSlotWidgets(fieldChoices->currentIndex()); drawSlotWidgets(fieldChoices->currentIndex());
}); });
// TODO: method for editing groups?
QFrame firstRow; QFrame firstRow;
QHBoxLayout firstRowLayout; QHBoxLayout firstRowLayout;