From 8594c2ce36619765b9565afac8e635b1d17289f1 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 28 Nov 2022 16:01:29 -0500 Subject: [PATCH 1/2] Display message when hovering on border metatiles --- CHANGELOG.md | 3 +++ include/ui/bordermetatilespixmapitem.h | 9 +++++++++ src/editor.cpp | 4 ++++ src/ui/bordermetatilespixmapitem.cpp | 18 ++++++++++++++++++ 4 files changed, 34 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eed6c36a..75cd1932 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ The **"Breaking Changes"** listed below are changes that have been made in the d ### Added - Add `setScale` to the scripting API. +### Changed +- Hovering on border metatiles with the mouse will now display their information in the bottom bar. + ## [5.0.0] - 2022-10-30 ### 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). diff --git a/include/ui/bordermetatilespixmapitem.h b/include/ui/bordermetatilespixmapitem.h index 870c975e..f4af8bfe 100644 --- a/include/ui/bordermetatilespixmapitem.h +++ b/include/ui/bordermetatilespixmapitem.h @@ -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 diff --git a/src/editor.cpp b/src/editor.cpp index 21873fd7..7bb4b26f 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -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); } diff --git a/src/ui/bordermetatilespixmapitem.cpp b/src/ui/bordermetatilespixmapitem.cpp index 9aa6548e..8f8bc134 100644 --- a/src/ui/bordermetatilespixmapitem.cpp +++ b/src/ui/bordermetatilespixmapitem.cpp @@ -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(); +} From 471946dc60d3fa0aef73ad16c3eb247ce550c795 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sat, 3 Dec 2022 17:47:46 -0500 Subject: [PATCH 2/2] Link to Region Map Editor's breaking changes for 5.0.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50e4bb37..bd0bc527 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,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. @@ -31,7 +32,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.