diff --git a/CHANGELOG.md b/CHANGELOG.md index 81997fe5..92d6a1d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d - 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. ## [5.1.0] - 2023-01-22 ### Added diff --git a/include/ui/tilemaptileselector.h b/include/ui/tilemaptileselector.h index f68a6974..9d419d63 100644 --- a/include/ui/tilemaptileselector.h +++ b/include/ui/tilemaptileselector.h @@ -126,6 +126,12 @@ public: TilemapTileSelector(QString tilesetFilepath, TilemapFormat format, QString palFilepath): SelectablePixmapItem(8, 8, 1, 1) { this->tileset = QImage(tilesetFilepath); this->format = format; + if (this->tileset.format() == QImage::Format::Format_Indexed8 && this->format == TilemapFormat::BPP_4) { + // Squash pixel data to fit 4BPP. Allows project repo to use 8BPP images for 4BPP tilemaps + uchar * pixel = this->tileset.bits(); + for (int i = 0; i < this->tileset.sizeInBytes(); i++, pixel++) + *pixel %= 16; + } bool err; if (!palFilepath.isEmpty()) { this->palette = PaletteUtil::parse(palFilepath, &err); diff --git a/src/ui/tilemaptileselector.cpp b/src/ui/tilemaptileselector.cpp index 865e14ef..a4ef5719 100644 --- a/src/ui/tilemaptileselector.cpp +++ b/src/ui/tilemaptileselector.cpp @@ -51,8 +51,7 @@ QImage TilemapTileSelector::setPalette(int paletteIndex) { { QVector newColorTable; int palMinLength = paletteIndex * 16 + 16; - if ((this->palette.count() < palMinLength) || (tilesetImage.colorTable().count() != 16)) { - // either a) the palette has less than 256 colors, or b) the image is improperly indexed + if (this->palette.count() < palMinLength) { for (QRgb color : tilesetImage.colorTable()) { int gray = qGray(color); newColorTable.append(qRgb(gray, gray, gray));