Merge branch 'master' into keep-import-path

This commit is contained in:
GriffinR 2022-12-14 16:10:23 -05:00 committed by GitHub
commit 5ca3906f55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 1 deletions

View file

@ -11,6 +11,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
- Add `setScale` to the scripting API.
### Changed
- Hovering on border metatiles with the mouse will now display their information in the bottom bar.
- The last-used directory is now preserved in import/export file dialogs.
### Fixed
@ -20,6 +21,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
### Breaking Changes
- Proper support for pokefirered's clone objects was added, which requires the changes made in [pokefirered/#484](https://github.com/pret/pokefirered/pull/484).
- Warp IDs are now treated as strings, which requires the change to `mapjson` made in [pokeemerald/#1755](https://github.com/pret/pokeemerald/pull/1755). Additionally `MAP_NONE` was renamed to `MAP_DYNAMIC`. Both changes also apply to pokefirered and pokeruby.
- Overhauled the region map editor, adding support for tilemaps, and significant customization. Also now supports pokefirered. Requires the changes made in [pokeemerald/#1651](https://github.com/pret/pokeemerald/pull/1651), [pokefirered/#500](https://github.com/pret/pokefirered/pull/500), or [pokeruby/#842](https://github.com/pret/pokeruby/pull/842).
- Many API functions which were previously accessible via the `map` object are now accessible via one of the new objects `overlay`, `utility`, or `constants`. Some functions were renamed accordingly. See [porymap/#460](https://github.com/huderlem/porymap/pull/460) for a full list of API function name changes.
- Arguments for the API function `createImage` have changed: `xflip` and `yflip` have been replaced with `hScale` and `vScale`, and `offset` has been replaced with `xOffset` and `yOffset`.
- The API function `addFilledRect` has been removed; it's been replaced by new arguments in `addRect`: `color` has been replaced with `borderColor` and `fillColor`, and a new `rounding` argument allows ellipses to be drawn.
@ -34,7 +36,6 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
- Add new features to the scripting API, including the ability to display messages and user input windows, set the overlay's opacity, rotation, scale, and clipping, interact with map header properties and the map border, read tile pixel data, and more.
### Changed
- Overhauled the region map editor, adding support for tilemaps, and significant customization. Also now supports pokefirered.
- Previous settings will be remembered in the New Map Options window.
- The Custom Attributes table for map headers and events now supports types other than strings.
- If an object event is inanimate, it will always render using its first frame.

View file

@ -18,9 +18,18 @@ public:
Map *map;
void draw();
signals:
void hoveredBorderMetatileSelectionChanged(uint16_t);
void hoveredBorderMetatileSelectionCleared();
void borderMetatilesChanged();
private:
void hoverUpdate(const QPointF &);
protected:
void mousePressEvent(QGraphicsSceneMouseEvent*);
void mouseMoveEvent(QGraphicsSceneMouseEvent*);
void hoverMoveEvent(QGraphicsSceneHoverEvent*);
void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
};
#endif // BORDERMETATILESPIXMAPITEM_H

View file

@ -1443,6 +1443,10 @@ void Editor::displayBorderMetatiles() {
selected_border_metatiles_item->draw();
scene_selected_border_metatiles->addItem(selected_border_metatiles_item);
connect(selected_border_metatiles_item, &BorderMetatilesPixmapItem::hoveredBorderMetatileSelectionChanged,
this, &Editor::onHoveredMetatileSelectionChanged);
connect(selected_border_metatiles_item, &BorderMetatilesPixmapItem::hoveredBorderMetatileSelectionCleared,
this, &Editor::onHoveredMetatileSelectionCleared);
connect(selected_border_metatiles_item, &BorderMetatilesPixmapItem::borderMetatilesChanged,
this, &Editor::onBorderMetatilesChanged);
}

View file

@ -54,3 +54,21 @@ void BorderMetatilesPixmapItem::draw() {
emit borderMetatilesChanged();
}
void BorderMetatilesPixmapItem::hoverUpdate(const QPointF &pixmapPos) {
QPoint pos = Metatile::coordFromPixmapCoord(pixmapPos);
uint16_t metatileId = this->map->getBorderMetatileId(pos.x(), pos.y());
emit this->hoveredBorderMetatileSelectionChanged(metatileId);
}
void BorderMetatilesPixmapItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
this->hoverUpdate(event->pos());
}
void BorderMetatilesPixmapItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) {
this->hoverUpdate(event->pos());
}
void BorderMetatilesPixmapItem::hoverLeaveEvent(QGraphicsSceneHoverEvent*) {
emit this->hoveredBorderMetatileSelectionCleared();
}