mirror of
https://github.com/huderlem/porymap.git
synced 2026-04-24 23:07:52 -05:00
Merge branch 'master' of https://github.com/huderlem/porymap into new-map-dialog
This commit is contained in:
commit
8bd71a3860
51
.github/workflows/main.yml
vendored
51
.github/workflows/main.yml
vendored
|
|
@ -20,21 +20,14 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Cache Qt
|
||||
id: cache-qt
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ../Qt
|
||||
key: ${{ runner.os }}-QtCache
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v2
|
||||
uses: jurplel/install-qt-action@v4
|
||||
with:
|
||||
version: '5.14.2'
|
||||
modules: 'qtwidgets qtqml qtcharts'
|
||||
cached: ${{ steps.cache-qt.outputs.cache-hit }}
|
||||
modules: 'qtcharts'
|
||||
cache: 'true'
|
||||
|
||||
- name: Configure
|
||||
run: qmake porymap.pro
|
||||
|
|
@ -43,24 +36,22 @@ jobs:
|
|||
run: make
|
||||
|
||||
build-macos:
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest, macos-13]
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
BUILD_NAME: porymap-${{ matrix.os }}-${{ github.ref_name }}
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Cache Qt
|
||||
id: cache-qt
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ../Qt
|
||||
key: ${{ runner.os }}-QtCache
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v3
|
||||
uses: jurplel/install-qt-action@v4
|
||||
with:
|
||||
version: '6.7.*'
|
||||
modules: 'qtcharts'
|
||||
cached: ${{ steps.cache-qt.outputs.cache-hit }}
|
||||
cache: 'true'
|
||||
|
||||
- name: Configure
|
||||
run: qmake -config release porymap.pro
|
||||
|
|
@ -75,19 +66,19 @@ jobs:
|
|||
- name: Prep Release Directory
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
mkdir porymap-macOS-${{ github.ref_name }}
|
||||
cp porymap.dmg porymap-macOS-${{ github.ref_name }}/porymap.dmg
|
||||
cp RELEASE-README.txt porymap-macOS-${{ github.ref_name }}/README.txt
|
||||
mkdir $BUILD_NAME
|
||||
cp porymap.dmg $BUILD_NAME/porymap.dmg
|
||||
cp RELEASE-README.txt $BUILD_NAME/README.txt
|
||||
|
||||
- name: Bundle Release Directory
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: zip -r porymap-macOS-${{ github.ref_name }}.zip porymap-macOS-${{ github.ref_name }}
|
||||
run: zip -r $BUILD_NAME.zip $BUILD_NAME
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: porymap-macOS-${{ github.ref_name }}.zip
|
||||
files: $BUILD_NAME.zip
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
|
@ -95,7 +86,7 @@ jobs:
|
|||
runs-on: windows-latest
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: dsaltares/fetch-gh-release-asset@master
|
||||
if: steps.cache-static-qt.outputs.cache-hit != 'true'
|
||||
|
|
@ -153,7 +144,7 @@ jobs:
|
|||
run: powershell.exe -Command "Compress-Archive -Path porymap-windows-${{ github.ref_name }} -DestinationPath porymap-windows-${{ github.ref_name }}.zip"
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: porymap-windows-${{ github.ref_name }}.zip
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
|
|||
- Add a `Close Project` option
|
||||
- Add charts to the `Wild Pokémon` tab that show species and level distributions.
|
||||
- Add options for customizing the map grid under `View -> Grid Settings`.
|
||||
- Add an option to display a dividing line between tilesets in the Tileset Editor.
|
||||
- An alert will be displayed when attempting to open a seemingly invalid project.
|
||||
- Add support for defining project values with `enum` where `#define` was expected.
|
||||
- Add button to enable editing map groups including renaming groups and rearranging the maps within them.
|
||||
|
|
@ -48,6 +49,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
|
|||
- Fix a visual issue when quickly dragging map connections around.
|
||||
- Fix map connections rendering incorrectly if their direction name was unknown.
|
||||
- Fix map connections rendering incorrectly if their dimensions were smaller than the border draw distance.
|
||||
- Fix metatile/collision selection images skewing off-center after opening a map from the Connections tab.
|
||||
- Fix the map list filter retaining text between project open/close.
|
||||
- Fix the map list mishandling value gaps when sorting by Area.
|
||||
- Fix a freeze on startup if project values are defined with mismatched parentheses.
|
||||
|
|
@ -60,6 +62,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
|
|||
- Fix bug where layout json and blockdata could be saved separately leading to inconsistent data.
|
||||
- Fix crash when saving tilesets with fewer palettes than the maximum.
|
||||
- Fix projects not opening on Windows if the project filepath contains certain characters.
|
||||
- Fix exported tile images containing garbage pixels after the end of the tiles.
|
||||
|
||||
## [5.4.1] - 2024-03-21
|
||||
### Fixed
|
||||
|
|
|
|||
|
|
@ -1,117 +1,89 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AboutPorymap</class>
|
||||
<widget class="QMainWindow" name="AboutPorymap">
|
||||
<widget class="QDialog" name="AboutPorymap">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>582</width>
|
||||
<height>438</height>
|
||||
<width>383</width>
|
||||
<height>121</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>About Porymap</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Title">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>22</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<underline>false</underline>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Porymap</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Version">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Description">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Map editor for pokeemerald, pokefirered and pokeruby.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Manual">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Official Documentation: <a href="https://huderlem.github.io/porymap/"><span style=" text-decoration: underline; color:#0069d9;">https://huderlem.github.io/porymap/</span></a></p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="textBrowser">
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>582</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Title">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>22</pointsize>
|
||||
<bold>true</bold>
|
||||
<underline>false</underline>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Porymap</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::TextFormat::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Version">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Description">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Map editor for pokeemerald, pokefirered and pokeruby.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Manual">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Official Documentation: <a href="https://huderlem.github.io/porymap/"><span style=" text-decoration: underline; color:#0069d9;">https://huderlem.github.io/porymap/</span></a></p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
|
|||
|
|
@ -647,6 +647,7 @@
|
|||
</property>
|
||||
<addaction name="actionLayer_Grid"/>
|
||||
<addaction name="actionMetatile_Grid"/>
|
||||
<addaction name="actionShow_Tileset_Divider"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionShow_Counts"/>
|
||||
<addaction name="actionShow_Unused"/>
|
||||
|
|
@ -799,6 +800,14 @@
|
|||
<string>Ctrl+G</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionShow_Tileset_Divider">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show Tileset Divider</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ public:
|
|||
this->showGrid = false;
|
||||
this->showTilesetEditorMetatileGrid = false;
|
||||
this->showTilesetEditorLayerGrid = true;
|
||||
this->showTilesetEditorDivider = false;
|
||||
this->monitorFiles = true;
|
||||
this->tilesetCheckerboardFill = true;
|
||||
this->newMapHeaderSectionExpanded = false;
|
||||
|
|
@ -120,6 +121,7 @@ public:
|
|||
bool showGrid;
|
||||
bool showTilesetEditorMetatileGrid;
|
||||
bool showTilesetEditorLayerGrid;
|
||||
bool showTilesetEditorDivider;
|
||||
bool monitorFiles;
|
||||
bool tilesetCheckerboardFill;
|
||||
bool newMapHeaderSectionExpanded;
|
||||
|
|
|
|||
|
|
@ -342,6 +342,8 @@ private:
|
|||
bool userSetMap(QString);
|
||||
void redrawMapScene();
|
||||
void refreshMapScene();
|
||||
void refreshMetatileViews();
|
||||
void refreshCollisionSelector();
|
||||
void setLayoutOnlyMode(bool layoutOnly);
|
||||
|
||||
bool checkProjectSanity();
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
#define ABOUTPORYMAP_H
|
||||
|
||||
#include <QString>
|
||||
#include <QMainWindow>
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class AboutPorymap;
|
||||
}
|
||||
|
||||
class AboutPorymap : public QMainWindow
|
||||
class AboutPorymap : public QDialog
|
||||
{
|
||||
public:
|
||||
explicit AboutPorymap(QWidget *parent = nullptr);
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ private slots:
|
|||
void on_actionShow_UnusedTiles_toggled(bool checked);
|
||||
void on_actionMetatile_Grid_triggered(bool checked);
|
||||
void on_actionLayer_Grid_triggered(bool checked);
|
||||
void on_actionShow_Tileset_Divider_triggered(bool checked);
|
||||
|
||||
void on_actionUndo_triggered();
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ public:
|
|||
QVector<uint16_t> usedMetatiles;
|
||||
bool selectorShowUnused = false;
|
||||
bool selectorShowCounts = false;
|
||||
bool showGrid;
|
||||
bool showGrid = false;
|
||||
bool showDivider = false;
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
||||
|
|
@ -44,6 +45,7 @@ private:
|
|||
int numRows(int numMetatiles);
|
||||
int numRows();
|
||||
void drawGrid();
|
||||
void drawDivider();
|
||||
void drawFilters();
|
||||
void drawUnused();
|
||||
void drawCounts();
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ public:
|
|||
|
||||
QVector<uint16_t> usedTiles;
|
||||
bool showUnused = false;
|
||||
bool showDivider = false;
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
||||
|
|
@ -61,6 +62,7 @@ private:
|
|||
QPoint getTileCoords(uint16_t);
|
||||
QList<QRgb> getCurPaletteTable();
|
||||
QList<Tile> buildSelectedTiles(int, int, QList<Tile>);
|
||||
QImage buildImage(int tileIdStart, int numTiles);
|
||||
|
||||
void drawUnused();
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ private:
|
|||
|
||||
// As of writing our static Qt build for Windows doesn't include the QtCharts module, so we dummy the class out here.
|
||||
// The charts module is additionally excluded from Windows in porymap.pro
|
||||
#define DISABLE_CHARTS_MODULE
|
||||
|
||||
class WildMonChart : public QWidget
|
||||
{
|
||||
|
|
|
|||
14
porymap.pro
14
porymap.pro
|
|
@ -6,8 +6,10 @@
|
|||
|
||||
QT += core gui qml network
|
||||
|
||||
!win32 {
|
||||
qtHaveModule(charts) {
|
||||
QT += charts
|
||||
} else {
|
||||
warning("Qt module 'charts' not found, disabling chart features.")
|
||||
}
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
|
@ -18,6 +20,16 @@ RC_ICONS = resources/icons/porymap-icon-2.ico
|
|||
ICON = resources/icons/porymap.icns
|
||||
QMAKE_CXXFLAGS += -std=c++17 -Wall
|
||||
QMAKE_TARGET_BUNDLE_PREFIX = com.pret
|
||||
|
||||
# Get latest commit hash if we can (to display alongside version information).
|
||||
win32 {
|
||||
LATEST_COMMIT = $$system(git rev-parse --short HEAD 2> nul)
|
||||
} else {
|
||||
LATEST_COMMIT = $$system(git rev-parse --short HEAD 2>/dev/null)
|
||||
}
|
||||
|
||||
DEFINES += PORYMAP_LATEST_COMMIT=\\\"$$LATEST_COMMIT\\\"
|
||||
|
||||
VERSION = 5.4.1
|
||||
DEFINES += PORYMAP_VERSION=\\\"$$VERSION\\\"
|
||||
|
||||
|
|
|
|||
|
|
@ -369,6 +369,8 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) {
|
|||
this->showTilesetEditorMetatileGrid = getConfigBool(key, value);
|
||||
} else if (key == "show_tileset_editor_layer_grid") {
|
||||
this->showTilesetEditorLayerGrid = getConfigBool(key, value);
|
||||
} else if (key == "show_tileset_editor_divider") {
|
||||
this->showTilesetEditorDivider = getConfigBool(key, value);
|
||||
} else if (key == "monitor_files") {
|
||||
this->monitorFiles = getConfigBool(key, value);
|
||||
} else if (key == "tileset_checkerboard_fill") {
|
||||
|
|
@ -455,6 +457,7 @@ QMap<QString, QString> PorymapConfig::getKeyValueMap() {
|
|||
map.insert("show_grid", this->showGrid ? "1" : "0");
|
||||
map.insert("show_tileset_editor_metatile_grid", this->showTilesetEditorMetatileGrid ? "1" : "0");
|
||||
map.insert("show_tileset_editor_layer_grid", this->showTilesetEditorLayerGrid ? "1" : "0");
|
||||
map.insert("show_tileset_editor_divider", this->showTilesetEditorDivider ? "1" : "0");
|
||||
map.insert("monitor_files", this->monitorFiles ? "1" : "0");
|
||||
map.insert("tileset_checkerboard_fill", this->tilesetCheckerboardFill ? "1" : "0");
|
||||
map.insert("new_map_header_section_expanded", this->newMapHeaderSectionExpanded ? "1" : "0");
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ void MainWindow::initWindow() {
|
|||
ui->actionCheck_for_Updates->setVisible(false);
|
||||
#endif
|
||||
|
||||
#ifdef DISABLE_CHARTS_MODULE
|
||||
#ifndef QT_CHARTS_LIB
|
||||
ui->pushButton_SummaryChart->setVisible(false);
|
||||
#endif
|
||||
|
||||
|
|
@ -964,8 +964,6 @@ void MainWindow::redrawMapScene() {
|
|||
}
|
||||
|
||||
void MainWindow::refreshMapScene() {
|
||||
on_mainTabBar_tabBarClicked(ui->mainTabBar->currentIndex());
|
||||
|
||||
ui->graphicsView_Map->setScene(editor->scene);
|
||||
ui->graphicsView_Map->setSceneRect(editor->scene->sceneRect());
|
||||
ui->graphicsView_Map->editor = editor;
|
||||
|
|
@ -987,7 +985,14 @@ void MainWindow::refreshMapScene() {
|
|||
//ui->graphicsView_Collision->setSceneRect(editor->scene_collision_metatiles->sceneRect());
|
||||
ui->graphicsView_Collision->setFixedSize(editor->movement_permissions_selector_item->pixmap().width() + 2, editor->movement_permissions_selector_item->pixmap().height() + 2);
|
||||
|
||||
on_mainTabBar_tabBarClicked(ui->mainTabBar->currentIndex());
|
||||
}
|
||||
|
||||
void MainWindow::refreshMetatileViews() {
|
||||
on_horizontalSlider_MetatileZoom_valueChanged(ui->horizontalSlider_MetatileZoom->value());
|
||||
}
|
||||
|
||||
void MainWindow::refreshCollisionSelector() {
|
||||
on_horizontalSlider_CollisionZoom_valueChanged(ui->horizontalSlider_CollisionZoom->value());
|
||||
}
|
||||
|
||||
|
|
@ -1766,8 +1771,10 @@ void MainWindow::on_mapViewTab_tabBarClicked(int index)
|
|||
|
||||
if (index == MapViewTab::Metatiles) {
|
||||
editor->setEditingMetatiles();
|
||||
refreshMetatileViews();
|
||||
} else if (index == MapViewTab::Collision) {
|
||||
editor->setEditingCollision();
|
||||
refreshCollisionSelector();
|
||||
} else if (index == MapViewTab::Prefabs) {
|
||||
editor->setEditingMetatiles();
|
||||
if (projectConfig.prefabFilepath.isEmpty() && !projectConfig.prefabImportPrompted) {
|
||||
|
|
@ -2555,7 +2562,6 @@ void MainWindow::on_comboBox_PrimaryTileset_currentTextChanged(const QString &ti
|
|||
if (editor->project->primaryTilesetLabels.contains(tilesetLabel) && editor->layout) {
|
||||
editor->updatePrimaryTileset(tilesetLabel);
|
||||
redrawMapScene();
|
||||
on_horizontalSlider_MetatileZoom_valueChanged(ui->horizontalSlider_MetatileZoom->value());
|
||||
updateTilesetEditor();
|
||||
prefab.updatePrefabUi(editor->layout);
|
||||
markMapEdited();
|
||||
|
|
@ -2567,7 +2573,6 @@ void MainWindow::on_comboBox_SecondaryTileset_currentTextChanged(const QString &
|
|||
if (editor->project->secondaryTilesetLabels.contains(tilesetLabel) && editor->layout) {
|
||||
editor->updateSecondaryTileset(tilesetLabel);
|
||||
redrawMapScene();
|
||||
on_horizontalSlider_MetatileZoom_valueChanged(ui->horizontalSlider_MetatileZoom->value());
|
||||
updateTilesetEditor();
|
||||
prefab.updatePrefabUi(editor->layout);
|
||||
markMapEdited();
|
||||
|
|
|
|||
|
|
@ -1,16 +1,23 @@
|
|||
#include "aboutporymap.h"
|
||||
#include "ui_aboutporymap.h"
|
||||
#include "log.h"
|
||||
|
||||
AboutPorymap::AboutPorymap(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
QDialog(parent),
|
||||
ui(new Ui::AboutPorymap)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
this->ui->label_Version->setText(QString("Version %1 - %2").arg(QCoreApplication::applicationVersion()).arg(QStringLiteral(__DATE__)));
|
||||
this->ui->textBrowser->setSource(QUrl("qrc:/CHANGELOG.md"));
|
||||
static const QString commitHash = PORYMAP_LATEST_COMMIT;
|
||||
this->ui->label_Version->setText(QString("Version %1%2\nQt %3 (%4)\n%5")
|
||||
.arg(QCoreApplication::applicationVersion())
|
||||
.arg(commitHash.isEmpty() ? "" : QString(" (%1)").arg(commitHash))
|
||||
.arg(QStringLiteral(QT_VERSION_STR))
|
||||
.arg(QSysInfo::buildCpuArchitecture())
|
||||
.arg(QStringLiteral(__DATE__))
|
||||
);
|
||||
|
||||
layout()->setSizeConstraint(QLayout::SetFixedSize);
|
||||
}
|
||||
|
||||
AboutPorymap::~AboutPorymap()
|
||||
|
|
|
|||
|
|
@ -28,6 +28,14 @@ TilesetEditor::TilesetEditor(Project *project, Layout *layout, QWidget *parent)
|
|||
this->tileXFlip = ui->checkBox_xFlip->isChecked();
|
||||
this->tileYFlip = ui->checkBox_yFlip->isChecked();
|
||||
this->paletteId = ui->spinBox_paletteSelector->value();
|
||||
|
||||
// TODO: The dividing line at the moment is only accurate if the number of primary metatiles is divisible by 8.
|
||||
// If it's not, the secondary metatiles will wrap above the line. This has other problems (like skewing
|
||||
// metatile groups the user may have designed) so this should be fixed by filling the primary metatiles
|
||||
// image with invalid magenta metatiles until it's divisible by 8. Then the line can be re-enabled as-is.
|
||||
ui->actionShow_Tileset_Divider->setChecked(/*porymapConfig.showTilesetEditorDivider*/false);
|
||||
ui->actionShow_Tileset_Divider->setVisible(false);
|
||||
|
||||
ui->spinBox_paletteSelector->setMinimum(0);
|
||||
ui->spinBox_paletteSelector->setMaximum(Project::getNumPalettesTotal() - 1);
|
||||
ui->lineEdit_metatileLabel->setValidator(new IdentifierValidator(this));
|
||||
|
|
@ -181,6 +189,7 @@ void TilesetEditor::initMetatileSelector()
|
|||
bool showGrid = porymapConfig.showTilesetEditorMetatileGrid;
|
||||
this->ui->actionMetatile_Grid->setChecked(showGrid);
|
||||
this->metatileSelector->showGrid = showGrid;
|
||||
this->metatileSelector->showDivider = this->ui->actionShow_Tileset_Divider->isChecked();
|
||||
|
||||
this->metatilesScene = new QGraphicsScene;
|
||||
this->metatilesScene->addItem(this->metatileSelector);
|
||||
|
|
@ -222,6 +231,8 @@ void TilesetEditor::initTileSelector()
|
|||
connect(this->tileSelector, &TilesetEditorTileSelector::selectedTilesChanged,
|
||||
this, &TilesetEditor::onSelectedTilesChanged);
|
||||
|
||||
this->tileSelector->showDivider = this->ui->actionShow_Tileset_Divider->isChecked();
|
||||
|
||||
this->tilesScene = new QGraphicsScene;
|
||||
this->tilesScene->addItem(this->tileSelector);
|
||||
this->tileSelector->select(0);
|
||||
|
|
@ -1026,6 +1037,16 @@ void TilesetEditor::on_actionLayer_Grid_triggered(bool checked) {
|
|||
porymapConfig.showTilesetEditorLayerGrid = checked;
|
||||
}
|
||||
|
||||
void TilesetEditor::on_actionShow_Tileset_Divider_triggered(bool checked) {
|
||||
this->metatileSelector->showDivider = checked;
|
||||
this->metatileSelector->draw();
|
||||
|
||||
this->tileSelector->showDivider = checked;
|
||||
this->tileSelector->draw();
|
||||
|
||||
porymapConfig.showTilesetEditorDivider = checked;
|
||||
}
|
||||
|
||||
void TilesetEditor::countMetatileUsage() {
|
||||
// do not double count
|
||||
metatileSelector->usedMetatiles.fill(0);
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ QImage TilesetEditorMetatileSelector::buildImage(int metatileIdStart, int numMet
|
|||
void TilesetEditorMetatileSelector::draw() {
|
||||
this->setPixmap(QPixmap::fromImage(this->buildAllMetatilesImage()));
|
||||
this->drawGrid();
|
||||
this->drawDivider();
|
||||
this->drawSelection();
|
||||
this->drawFilters();
|
||||
}
|
||||
|
|
@ -186,6 +187,20 @@ void TilesetEditorMetatileSelector::drawGrid() {
|
|||
this->setPixmap(pixmap);
|
||||
}
|
||||
|
||||
void TilesetEditorMetatileSelector::drawDivider() {
|
||||
if (!this->showDivider)
|
||||
return;
|
||||
|
||||
const int y = this->numRows(this->primaryTileset->numMetatiles()) * 32;
|
||||
|
||||
QPixmap pixmap = this->pixmap();
|
||||
QPainter painter(&pixmap);
|
||||
painter.setPen(Qt::white);
|
||||
painter.drawLine(0, y, this->numMetatilesWide * 32, y);
|
||||
painter.end();
|
||||
this->setPixmap(pixmap);
|
||||
}
|
||||
|
||||
void TilesetEditorMetatileSelector::drawFilters() {
|
||||
if (selectorShowUnused) {
|
||||
drawUnused();
|
||||
|
|
|
|||
|
|
@ -46,6 +46,17 @@ void TilesetEditorTileSelector::draw() {
|
|||
painter.drawImage(origin, tileImage);
|
||||
}
|
||||
|
||||
if (this->showDivider) {
|
||||
int row = this->primaryTileset->tiles.length() / this->numTilesWide;
|
||||
if (this->primaryTileset->tiles.length() % this->numTilesWide != 0) {
|
||||
// Round up height for incomplete last row
|
||||
row++;
|
||||
}
|
||||
const int y = row * 16;
|
||||
painter.setPen(Qt::white);
|
||||
painter.drawLine(0, y, this->numTilesWide * 16, y);
|
||||
}
|
||||
|
||||
painter.end();
|
||||
this->setPixmap(QPixmap::fromImage(image));
|
||||
|
||||
|
|
@ -219,66 +230,32 @@ QPoint TilesetEditorTileSelector::getTileCoordsOnWidget(uint16_t tile) {
|
|||
}
|
||||
|
||||
QImage TilesetEditorTileSelector::buildPrimaryTilesIndexedImage() {
|
||||
if (!this->primaryTileset || !this->secondaryTileset) {
|
||||
if (!this->primaryTileset)
|
||||
return QImage();
|
||||
}
|
||||
|
||||
int primaryLength = this->primaryTileset->tiles.length();
|
||||
int height = qCeil(primaryLength / static_cast<double>(this->numTilesWide));
|
||||
QImage image(this->numTilesWide * 8, height * 8, QImage::Format_RGBA8888);
|
||||
|
||||
QPainter painter(&image);
|
||||
for (uint16_t tile = 0; tile < primaryLength; tile++) {
|
||||
QImage tileImage;
|
||||
if (tile < primaryLength) {
|
||||
tileImage = getGreyscaleTileImage(tile, this->primaryTileset, this->secondaryTileset);
|
||||
} else {
|
||||
tileImage = QImage(8, 8, QImage::Format_RGBA8888);
|
||||
tileImage.fill(qRgb(0, 0, 0));
|
||||
}
|
||||
|
||||
int y = tile / this->numTilesWide;
|
||||
int x = tile % this->numTilesWide;
|
||||
QPoint origin = QPoint(x * 8, y * 8);
|
||||
painter.drawImage(origin, tileImage);
|
||||
}
|
||||
|
||||
painter.end();
|
||||
|
||||
// Image is first converted using greyscale so that palettes with duplicate colors
|
||||
// are properly represented in the final image.
|
||||
QImage indexedImage = image.convertToFormat(QImage::Format::Format_Indexed8, greyscalePalette.toVector());
|
||||
QList<QRgb> palette = Tileset::getPalette(this->paletteId, this->primaryTileset, this->secondaryTileset, true);
|
||||
indexedImage.setColorTable(palette.toVector());
|
||||
return indexedImage;
|
||||
return buildImage(0, this->primaryTileset->tiles.length());
|
||||
}
|
||||
|
||||
QImage TilesetEditorTileSelector::buildSecondaryTilesIndexedImage() {
|
||||
if (!this->primaryTileset || !this->secondaryTileset) {
|
||||
if (!this->secondaryTileset)
|
||||
return QImage();
|
||||
}
|
||||
|
||||
int secondaryLength = this->secondaryTileset->tiles.length();
|
||||
int height = qCeil(secondaryLength / static_cast<double>(this->numTilesWide));
|
||||
return buildImage(Project::getNumTilesPrimary(), this->secondaryTileset->tiles.length());
|
||||
}
|
||||
|
||||
QImage TilesetEditorTileSelector::buildImage(int tileIdStart, int numTiles) {
|
||||
int height = qCeil(numTiles / static_cast<double>(this->numTilesWide));
|
||||
QImage image(this->numTilesWide * 8, height * 8, QImage::Format_RGBA8888);
|
||||
image.fill(0);
|
||||
|
||||
QPainter painter(&image);
|
||||
uint16_t primaryLength = static_cast<uint16_t>(Project::getNumTilesPrimary());
|
||||
for (uint16_t tile = 0; tile < secondaryLength; tile++) {
|
||||
QImage tileImage;
|
||||
if (tile < secondaryLength) {
|
||||
tileImage = getGreyscaleTileImage(tile + primaryLength, this->primaryTileset, this->secondaryTileset);
|
||||
} else {
|
||||
tileImage = QImage(8, 8, QImage::Format_RGBA8888);
|
||||
tileImage.fill(qRgb(0, 0, 0));
|
||||
}
|
||||
|
||||
int y = tile / this->numTilesWide;
|
||||
int x = tile % this->numTilesWide;
|
||||
for (int i = 0; i < numTiles; i++) {
|
||||
QImage tileImage = getGreyscaleTileImage(tileIdStart + i, this->primaryTileset, this->secondaryTileset);
|
||||
int y = i / this->numTilesWide;
|
||||
int x = i % this->numTilesWide;
|
||||
QPoint origin = QPoint(x * 8, y * 8);
|
||||
painter.drawImage(origin, tileImage);
|
||||
}
|
||||
|
||||
painter.end();
|
||||
|
||||
// Image is first converted using greyscale so that palettes with duplicate colors
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user