Merge branch 'master' into random-00
This commit is contained in:
commit
772ca7c957
17 changed files with 111 additions and 53 deletions
|
@ -14,9 +14,12 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Collapse the map list by default.
|
- Collapse the map list by default.
|
||||||
|
- Collision view now has a transparency slider to help make it easier to view the underlying metatiles.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fix bug where smart paths could bes auto-enabled, despite the checkbox being disabled.
|
- Fix bug where smart paths could bes auto-enabled, despite the checkbox being disabled.
|
||||||
|
- Fix crash that could occur when changing the palette id in the tileset palette editor.
|
||||||
|
- Fix crash that could occur when shrinking the number of metatiles in a tileset.
|
||||||
|
|
||||||
## [1.1.0] - 2018-12-27
|
## [1.1.0] - 2018-12-27
|
||||||
### Breaking Changes
|
### Breaking Changes
|
||||||
|
|
|
@ -369,7 +369,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="toolButton_Shift">
|
<widget class="QToolButton" name="toolButton_Shift">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Map Shift</p><p><span style=" font-weight:600;">Click and drag</span> on the map to shift the positions all metatiles at once. This is useful after resizing a map.</p></body></html></string>
|
<string><html><head/><body><p>Map Shift</p><p><span style=" font-weight:600;">Click and drag</span> on the map to shift the positions of all metatiles at once. This is useful after resizing a map.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Shift</string>
|
<string>Shift</string>
|
||||||
|
@ -1112,7 +1112,7 @@
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QGraphicsView" name="graphicsView_Collision">
|
<widget class="QGraphicsView" name="graphicsView_Collision">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
@ -1128,20 +1128,20 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="3" column="1">
|
||||||
<spacer name="horizontalSpacer_18">
|
<spacer name="verticalSpacer_6">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>20</width>
|
||||||
<height>20</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="2" column="2">
|
||||||
<spacer name="horizontalSpacer_19">
|
<spacer name="horizontalSpacer_19">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
@ -1154,19 +1154,42 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="0">
|
||||||
<spacer name="verticalSpacer_6">
|
<spacer name="horizontalSpacer_18">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>40</width>
|
||||||
<height>40</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QSlider" name="horizontalSlider_CollisionTransparency">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>50</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Transparency</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -32,17 +32,20 @@ public:
|
||||||
this->recentMap = "";
|
this->recentMap = "";
|
||||||
this->mapSortOrder = MapSortOrder::Group;
|
this->mapSortOrder = MapSortOrder::Group;
|
||||||
this->prettyCursors = true;
|
this->prettyCursors = true;
|
||||||
|
this->collisionOpacity = 50;
|
||||||
}
|
}
|
||||||
void setRecentProject(QString project);
|
void setRecentProject(QString project);
|
||||||
void setRecentMap(QString map);
|
void setRecentMap(QString map);
|
||||||
void setMapSortOrder(MapSortOrder order);
|
void setMapSortOrder(MapSortOrder order);
|
||||||
void setPrettyCursors(bool enabled);
|
void setPrettyCursors(bool enabled);
|
||||||
void setGeometry(QByteArray, QByteArray, QByteArray, QByteArray, QByteArray);
|
void setGeometry(QByteArray, QByteArray, QByteArray, QByteArray, QByteArray);
|
||||||
|
void setCollisionOpacity(int opacity);
|
||||||
QString getRecentProject();
|
QString getRecentProject();
|
||||||
QString getRecentMap();
|
QString getRecentMap();
|
||||||
MapSortOrder getMapSortOrder();
|
MapSortOrder getMapSortOrder();
|
||||||
bool getPrettyCursors();
|
bool getPrettyCursors();
|
||||||
QMap<QString, QByteArray> getGeometry();
|
QMap<QString, QByteArray> getGeometry();
|
||||||
|
int getCollisionOpacity();
|
||||||
protected:
|
protected:
|
||||||
QString getConfigFilepath();
|
QString getConfigFilepath();
|
||||||
void parseConfigKeyValue(QString key, QString value);
|
void parseConfigKeyValue(QString key, QString value);
|
||||||
|
@ -60,6 +63,7 @@ private:
|
||||||
QByteArray mapSplitterState;
|
QByteArray mapSplitterState;
|
||||||
QByteArray eventsSlpitterState;
|
QByteArray eventsSlpitterState;
|
||||||
QByteArray mainSplitterState;
|
QByteArray mainSplitterState;
|
||||||
|
int collisionOpacity;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern PorymapConfig porymapConfig;
|
extern PorymapConfig porymapConfig;
|
||||||
|
|
|
@ -59,7 +59,7 @@ public:
|
||||||
int getWidth();
|
int getWidth();
|
||||||
int getHeight();
|
int getHeight();
|
||||||
QPixmap render(bool ignoreCache);
|
QPixmap render(bool ignoreCache);
|
||||||
QPixmap renderCollision(bool ignoreCache);
|
QPixmap renderCollision(qreal opacity, bool ignoreCache);
|
||||||
bool blockChanged(int, Blockdata*);
|
bool blockChanged(int, Blockdata*);
|
||||||
void cacheBlockdata();
|
void cacheBlockdata();
|
||||||
void cacheCollision();
|
void cacheCollision();
|
||||||
|
|
|
@ -114,6 +114,7 @@ public:
|
||||||
|
|
||||||
int scale_exp = 0;
|
int scale_exp = 0;
|
||||||
double scale_base = sqrt(2); // adjust scale factor with this
|
double scale_base = sqrt(2); // adjust scale factor with this
|
||||||
|
qreal collisionOpacity = 0.5;
|
||||||
|
|
||||||
void objectsView_onMousePress(QMouseEvent *event);
|
void objectsView_onMousePress(QMouseEvent *event);
|
||||||
void objectsView_onMouseMove(QMouseEvent *event);
|
void objectsView_onMouseMove(QMouseEvent *event);
|
||||||
|
|
|
@ -57,7 +57,6 @@ private slots:
|
||||||
void on_action_Exit_triggered();
|
void on_action_Exit_triggered();
|
||||||
void on_comboBox_Song_activated(const QString &arg1);
|
void on_comboBox_Song_activated(const QString &arg1);
|
||||||
void on_comboBox_Location_activated(const QString &arg1);
|
void on_comboBox_Location_activated(const QString &arg1);
|
||||||
void on_comboBox_Visibility_activated(const QString &arg1);
|
|
||||||
void on_comboBox_Weather_activated(const QString &arg1);
|
void on_comboBox_Weather_activated(const QString &arg1);
|
||||||
void on_comboBox_Type_activated(const QString &arg1);
|
void on_comboBox_Type_activated(const QString &arg1);
|
||||||
void on_comboBox_BattleScene_activated(const QString &arg1);
|
void on_comboBox_BattleScene_activated(const QString &arg1);
|
||||||
|
@ -150,6 +149,8 @@ private slots:
|
||||||
|
|
||||||
void selectedEventIndexChanged(int index);
|
void selectedEventIndexChanged(int index);
|
||||||
|
|
||||||
|
void on_horizontalSlider_CollisionTransparency_valueChanged(int value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
TilesetEditor *tilesetEditor = nullptr;
|
TilesetEditor *tilesetEditor = nullptr;
|
||||||
|
|
|
@ -10,17 +10,19 @@
|
||||||
class CollisionPixmapItem : public MapPixmapItem {
|
class CollisionPixmapItem : public MapPixmapItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CollisionPixmapItem(Map *map, MovementPermissionsSelector *movementPermissionsSelector, MetatileSelector *metatileSelector, Settings *settings)
|
CollisionPixmapItem(Map *map, MovementPermissionsSelector *movementPermissionsSelector, MetatileSelector *metatileSelector, Settings *settings, qreal *opacity)
|
||||||
: MapPixmapItem(map, metatileSelector, settings){
|
: MapPixmapItem(map, metatileSelector, settings){
|
||||||
this->movementPermissionsSelector = movementPermissionsSelector;
|
this->movementPermissionsSelector = movementPermissionsSelector;
|
||||||
|
this->opacity = opacity;
|
||||||
}
|
}
|
||||||
MovementPermissionsSelector *movementPermissionsSelector;
|
MovementPermissionsSelector *movementPermissionsSelector;
|
||||||
|
qreal *opacity;
|
||||||
void updateMovementPermissionSelection(QGraphicsSceneMouseEvent *event);
|
void updateMovementPermissionSelection(QGraphicsSceneMouseEvent *event);
|
||||||
virtual void paint(QGraphicsSceneMouseEvent*);
|
virtual void paint(QGraphicsSceneMouseEvent*);
|
||||||
virtual void floodFill(QGraphicsSceneMouseEvent*);
|
virtual void floodFill(QGraphicsSceneMouseEvent*);
|
||||||
virtual void magicFill(QGraphicsSceneMouseEvent*);
|
virtual void magicFill(QGraphicsSceneMouseEvent*);
|
||||||
virtual void pick(QGraphicsSceneMouseEvent*);
|
virtual void pick(QGraphicsSceneMouseEvent*);
|
||||||
virtual void draw(bool ignoreCache = false);
|
void draw(bool ignoreCache = false);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void mouseEvent(QGraphicsSceneMouseEvent *, CollisionPixmapItem *);
|
void mouseEvent(QGraphicsSceneMouseEvent *, CollisionPixmapItem *);
|
||||||
|
|
|
@ -26,6 +26,7 @@ public:
|
||||||
explicit PaletteEditor(Project*, Tileset*, Tileset*, QWidget *parent = nullptr);
|
explicit PaletteEditor(Project*, Tileset*, Tileset*, QWidget *parent = nullptr);
|
||||||
~PaletteEditor();
|
~PaletteEditor();
|
||||||
void setPaletteId(int);
|
void setPaletteId(int);
|
||||||
|
void setTilesets(Tileset*, Tileset*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::PaletteEditor *ui;
|
Ui::PaletteEditor *ui;
|
||||||
|
|
|
@ -48,7 +48,6 @@ private slots:
|
||||||
void onSelectedTilesChanged();
|
void onSelectedTilesChanged();
|
||||||
void onMetatileLayerTileChanged(int, int);
|
void onMetatileLayerTileChanged(int, int);
|
||||||
void onMetatileLayerSelectionChanged(QPoint, int, int);
|
void onMetatileLayerSelectionChanged(QPoint, int, int);
|
||||||
void onPaletteEditorClosed();
|
|
||||||
void onPaletteEditorChangedPaletteColor();
|
void onPaletteEditorChangedPaletteColor();
|
||||||
void onPaletteEditorChangedPalette(int);
|
void onPaletteEditorChangedPalette(int);
|
||||||
|
|
||||||
|
|
|
@ -129,6 +129,13 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) {
|
||||||
this->eventsSlpitterState = bytesFromString(value);
|
this->eventsSlpitterState = bytesFromString(value);
|
||||||
} else if (key == "main_splitter_state") {
|
} else if (key == "main_splitter_state") {
|
||||||
this->mainSplitterState = bytesFromString(value);
|
this->mainSplitterState = bytesFromString(value);
|
||||||
|
} else if (key == "collision_opacity") {
|
||||||
|
bool ok;
|
||||||
|
this->collisionOpacity = qMax(0, qMin(100, value.toInt(&ok)));
|
||||||
|
if (!ok) {
|
||||||
|
logWarn(QString("Invalid config value for collision_opacity: '%1'. Must be an integer.").arg(value));
|
||||||
|
this->collisionOpacity = 50;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
logWarn(QString("Invalid config key found in config file %1: '%2'").arg(this->getConfigFilepath()).arg(key));
|
logWarn(QString("Invalid config key found in config file %1: '%2'").arg(this->getConfigFilepath()).arg(key));
|
||||||
}
|
}
|
||||||
|
@ -145,6 +152,7 @@ QMap<QString, QString> PorymapConfig::getKeyValueMap() {
|
||||||
map.insert("map_splitter_state", stringFromByteArray(this->mapSplitterState));
|
map.insert("map_splitter_state", stringFromByteArray(this->mapSplitterState));
|
||||||
map.insert("events_splitter_state", stringFromByteArray(this->eventsSlpitterState));
|
map.insert("events_splitter_state", stringFromByteArray(this->eventsSlpitterState));
|
||||||
map.insert("main_splitter_state", stringFromByteArray(this->mainSplitterState));
|
map.insert("main_splitter_state", stringFromByteArray(this->mainSplitterState));
|
||||||
|
map.insert("collision_opacity", QString("%1").arg(this->collisionOpacity));
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,6 +203,11 @@ void PorymapConfig::setGeometry(QByteArray windowGeometry_, QByteArray windowSta
|
||||||
this->save();
|
this->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PorymapConfig::setCollisionOpacity(int opacity) {
|
||||||
|
this->collisionOpacity = opacity;
|
||||||
|
// don't auto-save here because this can be called very frequently.
|
||||||
|
}
|
||||||
|
|
||||||
QString PorymapConfig::getRecentProject() {
|
QString PorymapConfig::getRecentProject() {
|
||||||
return this->recentProject;
|
return this->recentProject;
|
||||||
}
|
}
|
||||||
|
@ -223,6 +236,10 @@ QMap<QString, QByteArray> PorymapConfig::getGeometry() {
|
||||||
return geometry;
|
return geometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int PorymapConfig::getCollisionOpacity() {
|
||||||
|
return this->collisionOpacity;
|
||||||
|
}
|
||||||
|
|
||||||
const QMap<BaseGameVersion, QString> baseGameVersionMap = {
|
const QMap<BaseGameVersion, QString> baseGameVersionMap = {
|
||||||
{BaseGameVersion::pokeruby, "pokeruby"},
|
{BaseGameVersion::pokeruby, "pokeruby"},
|
||||||
{BaseGameVersion::pokeemerald, "pokeemerald"},
|
{BaseGameVersion::pokeemerald, "pokeemerald"},
|
||||||
|
|
|
@ -110,7 +110,7 @@ void Map::cacheCollision() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap Map::renderCollision(bool ignoreCache) {
|
QPixmap Map::renderCollision(qreal opacity, bool ignoreCache) {
|
||||||
bool changed_any = false;
|
bool changed_any = false;
|
||||||
int width_ = getWidth();
|
int width_ = getWidth();
|
||||||
int height_ = getHeight();
|
int height_ = getHeight();
|
||||||
|
@ -141,7 +141,7 @@ QPixmap Map::renderCollision(bool ignoreCache) {
|
||||||
painter.setOpacity(1);
|
painter.setOpacity(1);
|
||||||
painter.drawImage(metatile_origin, metatile_image);
|
painter.drawImage(metatile_origin, metatile_image);
|
||||||
painter.save();
|
painter.save();
|
||||||
painter.setOpacity(0.55);
|
painter.setOpacity(opacity);
|
||||||
painter.drawImage(metatile_origin, collision_metatile_image);
|
painter.drawImage(metatile_origin, collision_metatile_image);
|
||||||
painter.restore();
|
painter.restore();
|
||||||
}
|
}
|
||||||
|
|
|
@ -575,7 +575,7 @@ void Editor::displayMapMovementPermissions() {
|
||||||
scene->removeItem(collision_item);
|
scene->removeItem(collision_item);
|
||||||
delete collision_item;
|
delete collision_item;
|
||||||
}
|
}
|
||||||
collision_item = new CollisionPixmapItem(map, this->movement_permissions_selector_item, this->metatile_selector_item, this->settings);
|
collision_item = new CollisionPixmapItem(map, this->movement_permissions_selector_item, this->metatile_selector_item, this->settings, &this->collisionOpacity);
|
||||||
connect(collision_item, SIGNAL(mouseEvent(QGraphicsSceneMouseEvent*,CollisionPixmapItem*)),
|
connect(collision_item, SIGNAL(mouseEvent(QGraphicsSceneMouseEvent*,CollisionPixmapItem*)),
|
||||||
this, SLOT(mouseEvent_collision(QGraphicsSceneMouseEvent*,CollisionPixmapItem*)));
|
this, SLOT(mouseEvent_collision(QGraphicsSceneMouseEvent*,CollisionPixmapItem*)));
|
||||||
connect(collision_item, SIGNAL(hoveredMapMovementPermissionChanged(int, int)),
|
connect(collision_item, SIGNAL(hoveredMapMovementPermissionChanged(int, int)),
|
||||||
|
|
|
@ -205,6 +205,10 @@ void MainWindow::loadUserSettings() {
|
||||||
ui->actionBetter_Cursors->setChecked(porymapConfig.getPrettyCursors());
|
ui->actionBetter_Cursors->setChecked(porymapConfig.getPrettyCursors());
|
||||||
this->editor->settings->betterCursors = porymapConfig.getPrettyCursors();
|
this->editor->settings->betterCursors = porymapConfig.getPrettyCursors();
|
||||||
mapSortOrder = porymapConfig.getMapSortOrder();
|
mapSortOrder = porymapConfig.getMapSortOrder();
|
||||||
|
ui->horizontalSlider_CollisionTransparency->blockSignals(true);
|
||||||
|
this->editor->collisionOpacity = static_cast<qreal>(porymapConfig.getCollisionOpacity()) / 100;
|
||||||
|
ui->horizontalSlider_CollisionTransparency->setValue(porymapConfig.getCollisionOpacity());
|
||||||
|
ui->horizontalSlider_CollisionTransparency->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::restoreWindowState() {
|
void MainWindow::restoreWindowState() {
|
||||||
|
@ -493,13 +497,6 @@ void MainWindow::on_comboBox_Location_activated(const QString &location)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_comboBox_Visibility_activated(const QString &requiresFlash)
|
|
||||||
{
|
|
||||||
if (editor && editor->map) {
|
|
||||||
editor->map->requiresFlash = requiresFlash;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_comboBox_Weather_activated(const QString &weather)
|
void MainWindow::on_comboBox_Weather_activated(const QString &weather)
|
||||||
{
|
{
|
||||||
if (editor && editor->map) {
|
if (editor && editor->map) {
|
||||||
|
@ -1569,6 +1566,12 @@ void MainWindow::selectedEventIndexChanged(int index)
|
||||||
editor->selectMapEvent(selectedEvent);
|
editor->selectMapEvent(selectedEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_horizontalSlider_CollisionTransparency_valueChanged(int value) {
|
||||||
|
this->editor->collisionOpacity = static_cast<qreal>(value) / 100;
|
||||||
|
porymapConfig.setCollisionOpacity(value);
|
||||||
|
this->editor->collision_item->draw(true);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::on_toolButton_deleteObject_clicked()
|
void MainWindow::on_toolButton_deleteObject_clicked()
|
||||||
{
|
{
|
||||||
if (editor && editor->selected_events) {
|
if (editor && editor->selected_events) {
|
||||||
|
@ -1848,6 +1851,7 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
||||||
this->ui->splitter_events->saveState(),
|
this->ui->splitter_events->saveState(),
|
||||||
this->ui->splitter_main->saveState()
|
this->ui->splitter_main->saveState()
|
||||||
);
|
);
|
||||||
|
porymapConfig.save();
|
||||||
|
|
||||||
QMainWindow::closeEvent(event);
|
QMainWindow::closeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ void CollisionPixmapItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
|
||||||
|
|
||||||
void CollisionPixmapItem::draw(bool ignoreCache) {
|
void CollisionPixmapItem::draw(bool ignoreCache) {
|
||||||
if (map) {
|
if (map) {
|
||||||
setPixmap(map->renderCollision(ignoreCache));
|
setPixmap(map->renderCollision(*this->opacity, ignoreCache));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -260,22 +260,25 @@ void MapPixmapItem::magicFill(QGraphicsSceneMouseEvent *event) {
|
||||||
int initialX = static_cast<int>(pos.x()) / 16;
|
int initialX = static_cast<int>(pos.x()) / 16;
|
||||||
int initialY = static_cast<int>(pos.y()) / 16;
|
int initialY = static_cast<int>(pos.y()) / 16;
|
||||||
Block *block = map->getBlock(initialX, initialY);
|
Block *block = map->getBlock(initialX, initialY);
|
||||||
QList<uint16_t> *selectedMetatiles = this->metatileSelector->getSelectedMetatiles();
|
|
||||||
QPoint selectionDimensions = this->metatileSelector->getSelectionDimensions();
|
|
||||||
uint16_t tile = block->tile;
|
|
||||||
|
|
||||||
for (int y = 0; y < map->getHeight(); y++) {
|
if (block) {
|
||||||
for (int x = 0; x < map->getWidth(); x++) {
|
QList<uint16_t> *selectedMetatiles = this->metatileSelector->getSelectedMetatiles();
|
||||||
block = map->getBlock(x, y);
|
QPoint selectionDimensions = this->metatileSelector->getSelectionDimensions();
|
||||||
if (block && block->tile == tile) {
|
uint16_t tile = block->tile;
|
||||||
int xDiff = x - initialX;
|
|
||||||
int yDiff = y - initialY;
|
for (int y = 0; y < map->getHeight(); y++) {
|
||||||
int i = xDiff % selectionDimensions.x();
|
for (int x = 0; x < map->getWidth(); x++) {
|
||||||
int j = yDiff % selectionDimensions.y();
|
block = map->getBlock(x, y);
|
||||||
if (i < 0) i = selectionDimensions.x() + i;
|
if (block && block->tile == tile) {
|
||||||
if (j < 0) j = selectionDimensions.y() + j;
|
int xDiff = x - initialX;
|
||||||
block->tile = selectedMetatiles->at(j * selectionDimensions.x() + i);
|
int yDiff = y - initialY;
|
||||||
map->_setBlock(x, y, *block);
|
int i = xDiff % selectionDimensions.x();
|
||||||
|
int j = yDiff % selectionDimensions.y();
|
||||||
|
if (i < 0) i = selectionDimensions.x() + i;
|
||||||
|
if (j < 0) j = selectionDimensions.y() + j;
|
||||||
|
block->tile = selectedMetatiles->at(j * selectionDimensions.x() + i);
|
||||||
|
map->_setBlock(x, y, *block);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,6 +188,13 @@ void PaletteEditor::setPaletteId(int paletteId) {
|
||||||
this->ui->spinBox_PaletteId->blockSignals(false);
|
this->ui->spinBox_PaletteId->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PaletteEditor::setTilesets(Tileset *primaryTileset, Tileset *secondaryTileset) {
|
||||||
|
this->primaryTileset = primaryTileset;
|
||||||
|
this->secondaryTileset = secondaryTileset;
|
||||||
|
this->refreshColorSliders();
|
||||||
|
this->refreshColors();
|
||||||
|
}
|
||||||
|
|
||||||
void PaletteEditor::setColor(int colorIndex) {
|
void PaletteEditor::setColor(int colorIndex) {
|
||||||
int paletteNum = this->ui->spinBox_PaletteId->value();
|
int paletteNum = this->ui->spinBox_PaletteId->value();
|
||||||
int red = this->sliders[colorIndex][0]->value() * 8;
|
int red = this->sliders[colorIndex][0]->value() * 8;
|
||||||
|
|
|
@ -79,9 +79,9 @@ void TilesetEditor::setTilesets(QString primaryTilesetLabel, QString secondaryTi
|
||||||
|
|
||||||
void TilesetEditor::refresh() {
|
void TilesetEditor::refresh() {
|
||||||
this->metatileSelector->setTilesets(this->primaryTileset, this->secondaryTileset);
|
this->metatileSelector->setTilesets(this->primaryTileset, this->secondaryTileset);
|
||||||
|
this->metatileSelector->select(this->metatileSelector->getSelectedMetatile());
|
||||||
this->tileSelector->setTilesets(this->primaryTileset, this->secondaryTileset);
|
this->tileSelector->setTilesets(this->primaryTileset, this->secondaryTileset);
|
||||||
this->metatileLayersItem->setTilesets(this->primaryTileset, this->secondaryTileset);
|
this->metatileLayersItem->setTilesets(this->primaryTileset, this->secondaryTileset);
|
||||||
this->metatileSelector->select(this->metatileSelector->getSelectedMetatile());
|
|
||||||
this->drawSelectedTiles();
|
this->drawSelectedTiles();
|
||||||
|
|
||||||
this->ui->graphicsView_Tiles->setSceneRect(0, 0, this->tileSelector->pixmap().width() + 2, this->tileSelector->pixmap().height() + 2);
|
this->ui->graphicsView_Tiles->setSceneRect(0, 0, this->tileSelector->pixmap().width() + 2, this->tileSelector->pixmap().height() + 2);
|
||||||
|
@ -313,6 +313,7 @@ void TilesetEditor::on_actionSave_Tileset_triggered()
|
||||||
{
|
{
|
||||||
this->project->saveTilesets(this->primaryTileset, this->secondaryTileset);
|
this->project->saveTilesets(this->primaryTileset, this->secondaryTileset);
|
||||||
emit this->tilesetsSaved(this->primaryTileset->name, this->secondaryTileset->name);
|
emit this->tilesetsSaved(this->primaryTileset->name, this->secondaryTileset->name);
|
||||||
|
this->paletteEditor->setTilesets(this->primaryTileset, this->secondaryTileset);
|
||||||
this->ui->statusbar->showMessage(QString("Saved primary and secondary Tilesets!"), 5000);
|
this->ui->statusbar->showMessage(QString("Saved primary and secondary Tilesets!"), 5000);
|
||||||
this->hasUnsavedChanges = false;
|
this->hasUnsavedChanges = false;
|
||||||
}
|
}
|
||||||
|
@ -483,18 +484,10 @@ void TilesetEditor::on_actionChange_Metatiles_Count_triggered()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TilesetEditor::onPaletteEditorClosed() {
|
|
||||||
if (this->paletteEditor) {
|
|
||||||
delete this->paletteEditor;
|
|
||||||
this->paletteEditor = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TilesetEditor::on_actionChange_Palettes_triggered()
|
void TilesetEditor::on_actionChange_Palettes_triggered()
|
||||||
{
|
{
|
||||||
if (!this->paletteEditor) {
|
if (!this->paletteEditor) {
|
||||||
this->paletteEditor = new PaletteEditor(this->project, this->primaryTileset, this->secondaryTileset, this);
|
this->paletteEditor = new PaletteEditor(this->project, this->primaryTileset, this->secondaryTileset, this);
|
||||||
connect(this->paletteEditor, SIGNAL(closed()), this, SLOT(onPaletteEditorClosed()));
|
|
||||||
connect(this->paletteEditor, SIGNAL(changedPaletteColor()), this, SLOT(onPaletteEditorChangedPaletteColor()));
|
connect(this->paletteEditor, SIGNAL(changedPaletteColor()), this, SLOT(onPaletteEditorChangedPaletteColor()));
|
||||||
connect(this->paletteEditor, SIGNAL(changedPalette(int)), this, SLOT(onPaletteEditorChangedPalette(int)));
|
connect(this->paletteEditor, SIGNAL(changedPalette(int)), this, SLOT(onPaletteEditorChangedPalette(int)));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue