mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-14 03:45:35 -05:00
Merge branch 'dev' of https://github.com/huderlem/porymap into local-id
This commit is contained in:
@@ -47,6 +47,13 @@ enum CommandId {
|
||||
#define IDMask_EventType_Trigger (1 << 11)
|
||||
#define IDMask_EventType_Heal (1 << 12)
|
||||
|
||||
#define IDMask_ConnectionDirection_Up (1 << 8)
|
||||
#define IDMask_ConnectionDirection_Down (1 << 9)
|
||||
#define IDMask_ConnectionDirection_Left (1 << 10)
|
||||
#define IDMask_ConnectionDirection_Right (1 << 11)
|
||||
#define IDMask_ConnectionDirection_Dive (1 << 12)
|
||||
#define IDMask_ConnectionDirection_Emerge (1 << 13)
|
||||
|
||||
/// Implements a command to commit metatile paint actions
|
||||
/// onto the map using the pencil tool.
|
||||
class PaintMetatile : public QUndoCommand {
|
||||
@@ -400,7 +407,7 @@ public:
|
||||
void redo() override;
|
||||
|
||||
bool mergeWith(const QUndoCommand *command) override;
|
||||
int id() const override { return CommandId::ID_MapConnectionMove; }
|
||||
int id() const override;
|
||||
|
||||
private:
|
||||
MapConnection *connection;
|
||||
@@ -421,7 +428,7 @@ public:
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
||||
int id() const override { return CommandId::ID_MapConnectionChangeDirection; }
|
||||
int id() const override;
|
||||
|
||||
private:
|
||||
QPointer<MapConnection> connection;
|
||||
@@ -443,7 +450,7 @@ public:
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
||||
int id() const override { return CommandId::ID_MapConnectionChangeMap; }
|
||||
int id() const override;
|
||||
|
||||
private:
|
||||
QPointer<MapConnection> connection;
|
||||
@@ -465,7 +472,7 @@ public:
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
||||
int id() const override { return CommandId::ID_MapConnectionAdd; }
|
||||
int id() const override;
|
||||
|
||||
private:
|
||||
Map *map = nullptr;
|
||||
@@ -485,7 +492,7 @@ public:
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
||||
int id() const override { return CommandId::ID_MapConnectionRemove; }
|
||||
int id() const override;
|
||||
|
||||
private:
|
||||
Map *map = nullptr;
|
||||
|
||||
@@ -170,6 +170,7 @@ public:
|
||||
static QString typeToJsonKey(Event::Type type);
|
||||
static Event::Type typeFromJsonKey(QString type);
|
||||
static QList<Event::Type> types();
|
||||
static QList<Event::Group> groups();
|
||||
|
||||
// protected attributes
|
||||
protected:
|
||||
@@ -340,10 +341,12 @@ public:
|
||||
QString getDestinationWarpID() const { return this->destinationWarpID; }
|
||||
|
||||
void setWarningEnabled(bool enabled);
|
||||
bool getWarningEnabled() const { return this->warningEnabled; }
|
||||
|
||||
private:
|
||||
QString destinationMap;
|
||||
QString destinationWarpID;
|
||||
bool warningEnabled = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -622,6 +625,10 @@ private:
|
||||
};
|
||||
|
||||
|
||||
inline uint qHash(const Event::Group &key, uint seed = 0) {
|
||||
return qHash(static_cast<int>(key), seed);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Keeps track of scripts
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
bool hasEvent(Event *) const;
|
||||
|
||||
void deleteConnections();
|
||||
QList<MapConnection*> getConnections() const;
|
||||
QList<MapConnection*> getConnections() const { return m_connections; }
|
||||
void removeConnection(MapConnection *);
|
||||
void addConnection(MapConnection *);
|
||||
void loadConnection(MapConnection *);
|
||||
|
||||
@@ -27,6 +27,11 @@ public:
|
||||
QString direction() const { return m_direction; }
|
||||
void setDirection(const QString &direction, bool mirror = true);
|
||||
|
||||
bool isCardinal() const { return isCardinal(m_direction); }
|
||||
bool isHorizontal() const { return isHorizontal(m_direction); }
|
||||
bool isVertical() const { return isVertical(m_direction); }
|
||||
bool isDiving() const { return isDiving(m_direction); }
|
||||
|
||||
int offset() const { return m_offset; }
|
||||
void setOffset(int offset, bool mirror = true);
|
||||
|
||||
@@ -36,7 +41,8 @@ public:
|
||||
MapConnection* findMirror();
|
||||
MapConnection* createMirror();
|
||||
|
||||
QPixmap getPixmap();
|
||||
QPixmap render() const;
|
||||
QPoint relativePos(bool clipped = false) const;
|
||||
|
||||
static QPointer<Project> project;
|
||||
static const QMap<QString, QString> oppositeDirections;
|
||||
|
||||
@@ -96,9 +96,12 @@ public:
|
||||
int getHeight() const { return height; }
|
||||
int getBorderWidth() const { return border_width; }
|
||||
int getBorderHeight() const { return border_height; }
|
||||
int getBorderDrawWidth() const;
|
||||
int getBorderDrawHeight() const;
|
||||
|
||||
bool isWithinBounds(int x, int y);
|
||||
bool isWithinBorderBounds(int x, int y);
|
||||
bool isWithinBounds(int x, int y) const;
|
||||
bool isWithinBounds(const QRect &rect) const;
|
||||
bool isWithinBorderBounds(int x, int y) const;
|
||||
|
||||
bool getBlock(int x, int y, Block *out);
|
||||
void setBlock(int x, int y, Block block, bool enableScriptCallback = false);
|
||||
@@ -141,6 +144,8 @@ private:
|
||||
void setNewDimensionsBlockdata(int newWidth, int newHeight);
|
||||
void setNewBorderDimensionsBlockdata(int newWidth, int newHeight);
|
||||
|
||||
static int getBorderDrawDistance(int dimension, qreal minimum);
|
||||
|
||||
signals:
|
||||
void dimensionsChanged(const QSize &size);
|
||||
void needsRedrawing();
|
||||
|
||||
@@ -175,8 +175,6 @@ public:
|
||||
|
||||
void eventsView_onMousePress(QMouseEvent *event);
|
||||
|
||||
int getBorderDrawDistance(int dimension);
|
||||
|
||||
bool selectingEvent = false;
|
||||
|
||||
void deleteSelectedEvents();
|
||||
|
||||
@@ -301,6 +301,10 @@ public:
|
||||
Ui::MainWindow *ui;
|
||||
QPointer<Editor> editor = nullptr;
|
||||
|
||||
signals:
|
||||
void mapOpened(Map*);
|
||||
void layoutOpened(Layout*);
|
||||
|
||||
private:
|
||||
QLabel *label_MapRulerStatus = nullptr;
|
||||
QPointer<TilesetEditor> tilesetEditor = nullptr;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#ifndef MAPIMAGEEXPORTER_H
|
||||
#define MAPIMAGEEXPORTER_H
|
||||
|
||||
#include "map.h"
|
||||
#include "editor.h"
|
||||
#include "project.h"
|
||||
|
||||
#include <QDialog>
|
||||
class QGifImage;
|
||||
|
||||
namespace Ui {
|
||||
class MapImageExporter;
|
||||
@@ -17,21 +16,17 @@ enum ImageExporterMode {
|
||||
};
|
||||
|
||||
struct ImageExporterSettings {
|
||||
bool showObjects = false;
|
||||
bool showWarps = false;
|
||||
bool showBGs = false;
|
||||
bool showTriggers = false;
|
||||
bool showHealLocations = false;
|
||||
bool showUpConnections = false;
|
||||
bool showDownConnections = false;
|
||||
bool showLeftConnections = false;
|
||||
bool showRightConnections = false;
|
||||
QSet<Event::Group> showEvents;
|
||||
QSet<QString> showConnections;
|
||||
bool showGrid = false;
|
||||
bool showBorder = false;
|
||||
bool showCollision = false;
|
||||
bool previewActualSize = false;
|
||||
bool disablePreviewScaling = false;
|
||||
bool disablePreviewUpdates = false;
|
||||
int timelapseSkipAmount = 1;
|
||||
int timelapseDelayMs = 200;
|
||||
// Not exposed as a setting in the UI atm (our color input widget has no alpha channel).
|
||||
QColor fillColor = Qt::transparent;
|
||||
};
|
||||
|
||||
class MapImageExporter : public QDialog
|
||||
@@ -39,32 +34,58 @@ class MapImageExporter : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MapImageExporter(QWidget *parent, Editor *editor, ImageExporterMode mode);
|
||||
explicit MapImageExporter(QWidget *parent, Project *project, Map *map, ImageExporterMode mode = ImageExporterMode::Normal)
|
||||
: MapImageExporter(parent, project, map, map->layout(), mode) {};
|
||||
explicit MapImageExporter(QWidget *parent, Project *project, Layout *layout, ImageExporterMode mode = ImageExporterMode::Normal)
|
||||
: MapImageExporter(parent, project, nullptr, layout, mode) {};
|
||||
~MapImageExporter();
|
||||
|
||||
ImageExporterMode mode() const { return m_mode; }
|
||||
|
||||
void setMap(Map *map);
|
||||
void setLayout(Layout *layout);
|
||||
|
||||
private:
|
||||
explicit MapImageExporter(QWidget *parent, Project *project, Map *map, Layout *layout, ImageExporterMode mode);
|
||||
|
||||
Ui::MapImageExporter *ui;
|
||||
|
||||
Layout *m_layout = nullptr;
|
||||
Project *m_project = nullptr;
|
||||
Map *m_map = nullptr;
|
||||
Editor *m_editor = nullptr;
|
||||
Layout *m_layout = nullptr;
|
||||
QGraphicsScene *m_scene = nullptr;
|
||||
|
||||
QPixmap m_preview;
|
||||
QGifImage *m_timelapseGifImage = nullptr;
|
||||
QBuffer *m_timelapseBuffer = nullptr;
|
||||
QMovie *m_timelapseMovie = nullptr;
|
||||
QGraphicsPixmapItem *m_preview = nullptr;
|
||||
|
||||
ImageExporterSettings m_settings;
|
||||
ImageExporterMode m_mode = ImageExporterMode::Normal;
|
||||
ImageExporterMode m_originalMode;
|
||||
|
||||
void updatePreview();
|
||||
void setModeSpecificUi();
|
||||
void setSelectionText(const QString &text);
|
||||
void updateMapSelection();
|
||||
void resetSettings();
|
||||
QString getTitle(ImageExporterMode mode);
|
||||
QString getDescription(ImageExporterMode mode);
|
||||
void updatePreview(bool forceUpdate = false);
|
||||
void scalePreview();
|
||||
void updateShowBorderState();
|
||||
bool eventsEnabled();
|
||||
void setEventGroupEnabled(Event::Group group, bool enable);
|
||||
bool connectionsEnabled();
|
||||
void setConnectionDirectionEnabled(const QString &dir, bool enable);
|
||||
void saveImage();
|
||||
QPixmap getStitchedImage(QProgressDialog *progress, bool includeBorder);
|
||||
QGifImage* createTimelapseGifImage(QProgressDialog *progress);
|
||||
QPixmap getStitchedImage(QProgressDialog *progress);
|
||||
QPixmap getFormattedMapPixmap();
|
||||
QPixmap getFormattedMapPixmap(Map *map, bool ignoreBorder = false);
|
||||
QPixmap getFormattedLayoutPixmap(Layout *layout, bool ignoreBorder = false, bool ignoreGrid = false);
|
||||
void paintGrid(QPixmap *pixmap, bool ignoreBorder = false);
|
||||
bool historyItemAppliesToFrame(const QUndoCommand *command);
|
||||
void paintBorder(QPainter *painter, Layout *layout);
|
||||
void paintCollision(QPainter *painter, Layout *layout);
|
||||
void paintConnections(QPainter *painter, const Map *map);
|
||||
void paintEvents(QPainter *painter, const Map *map);
|
||||
void paintGrid(QPainter *painter, const Layout *layout = nullptr);
|
||||
QMargins getMargins(const Map *map);
|
||||
QPixmap getExpandedPixmap(const QPixmap &pixmap, const QSize &targetSize, const QColor &fillColor);
|
||||
bool currentHistoryAppliesToFrame(QUndoStack *historyStack);
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent *) override;
|
||||
@@ -84,15 +105,16 @@ private slots:
|
||||
void on_checkBox_ConnectionRight_stateChanged(int state);
|
||||
void on_checkBox_AllConnections_stateChanged(int state);
|
||||
|
||||
void on_checkBox_Elevation_stateChanged(int state);
|
||||
void on_checkBox_Collision_stateChanged(int state);
|
||||
void on_checkBox_Grid_stateChanged(int state);
|
||||
void on_checkBox_Border_stateChanged(int state);
|
||||
|
||||
void on_pushButton_Reset_pressed();
|
||||
void on_spinBox_TimelapseDelay_valueChanged(int delayMs);
|
||||
void on_spinBox_FrameSkip_valueChanged(int skip);
|
||||
void on_spinBox_TimelapseDelay_editingFinished();
|
||||
void on_spinBox_FrameSkip_editingFinished();
|
||||
|
||||
void on_checkBox_ActualSize_stateChanged(int state);
|
||||
void on_checkBox_DisablePreviewScaling_stateChanged(int state);
|
||||
void on_checkBox_DisablePreviewUpdates_stateChanged(int state);
|
||||
};
|
||||
|
||||
#endif // MAPIMAGEEXPORTER_H
|
||||
|
||||
Reference in New Issue
Block a user