mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-19 23:25:09 -05:00
Merge branch 'master' into script-editing
This commit is contained in:
@@ -15,7 +15,7 @@ enum MapSortOrder {
|
||||
Layout = 2,
|
||||
};
|
||||
|
||||
class KeyValueConfigBase : public QObject
|
||||
class KeyValueConfigBase
|
||||
{
|
||||
public:
|
||||
void save();
|
||||
@@ -38,7 +38,6 @@ public:
|
||||
}
|
||||
virtual void reset() override {
|
||||
this->recentProject = "";
|
||||
this->recentMap = "";
|
||||
this->mapSortOrder = MapSortOrder::Group;
|
||||
this->prettyCursors = true;
|
||||
this->collisionOpacity = 50;
|
||||
@@ -52,7 +51,6 @@ public:
|
||||
this->textEditorGotoLine = "";
|
||||
}
|
||||
void setRecentProject(QString project);
|
||||
void setRecentMap(QString map);
|
||||
void setMapSortOrder(MapSortOrder order);
|
||||
void setPrettyCursors(bool enabled);
|
||||
void setMainGeometry(QByteArray, QByteArray, QByteArray, QByteArray);
|
||||
@@ -69,7 +67,6 @@ public:
|
||||
void setTextEditorOpenFolder(const QString &command);
|
||||
void setTextEditorGotoLine(const QString &command);
|
||||
QString getRecentProject();
|
||||
QString getRecentMap();
|
||||
MapSortOrder getMapSortOrder();
|
||||
bool getPrettyCursors();
|
||||
QMap<QString, QByteArray> getMainGeometry();
|
||||
@@ -93,7 +90,6 @@ protected:
|
||||
virtual void setUnreadKeys() override {};
|
||||
private:
|
||||
QString recentProject;
|
||||
QString recentMap;
|
||||
QString stringFromByteArray(QByteArray);
|
||||
QByteArray bytesFromString(QString);
|
||||
MapSortOrder mapSortOrder;
|
||||
@@ -136,6 +132,7 @@ public:
|
||||
}
|
||||
virtual void reset() override {
|
||||
this->baseGameVersion = BaseGameVersion::pokeemerald;
|
||||
this->recentMap = QString();
|
||||
this->useEncounterJson = true;
|
||||
this->useCustomBorderSize = false;
|
||||
this->enableEventWeatherTrigger = true;
|
||||
@@ -145,12 +142,15 @@ public:
|
||||
this->enableHealLocationRespawnData = false;
|
||||
this->enableObjectEventInConnection = false;
|
||||
this->enableFloorNumber = false;
|
||||
this->createMapTextFile = false;
|
||||
this->enableTripleLayerMetatiles = false;
|
||||
this->customScripts.clear();
|
||||
this->readKeys.clear();
|
||||
}
|
||||
void setBaseGameVersion(BaseGameVersion baseGameVersion);
|
||||
BaseGameVersion getBaseGameVersion();
|
||||
void setRecentMap(const QString &map);
|
||||
QString getRecentMap();
|
||||
void setEncounterJsonActive(bool active);
|
||||
bool getEncounterJsonActive();
|
||||
void setUsePoryScript(bool usePoryScript);
|
||||
@@ -173,6 +173,8 @@ public:
|
||||
bool getObjectEventInConnectionEnabled();
|
||||
void setFloorNumberEnabled(bool enable);
|
||||
bool getFloorNumberEnabled();
|
||||
void setCreateMapTextFileEnabled(bool enable);
|
||||
bool getCreateMapTextFileEnabled();
|
||||
void setTripleLayerMetatilesEnabled(bool enable);
|
||||
bool getTripleLayerMetatilesEnabled();
|
||||
void setCustomScripts(QList<QString> scripts);
|
||||
@@ -186,6 +188,7 @@ protected:
|
||||
private:
|
||||
BaseGameVersion baseGameVersion;
|
||||
QString projectDir;
|
||||
QString recentMap;
|
||||
bool useEncounterJson;
|
||||
bool usePoryScript;
|
||||
bool useCustomBorderSize;
|
||||
@@ -196,6 +199,7 @@ private:
|
||||
bool enableHealLocationRespawnData;
|
||||
bool enableObjectEventInConnection;
|
||||
bool enableFloorNumber;
|
||||
bool createMapTextFile;
|
||||
bool enableTripleLayerMetatiles;
|
||||
QList<QString> customScripts;
|
||||
QStringList readKeys;
|
||||
|
||||
@@ -10,13 +10,14 @@ public:
|
||||
Block();
|
||||
Block(uint16_t);
|
||||
Block(uint16_t tile, uint16_t collision, uint16_t elevation);
|
||||
Block(const Block&);
|
||||
bool operator ==(Block);
|
||||
bool operator !=(Block);
|
||||
Block(const Block &);
|
||||
Block &operator=(const Block &);
|
||||
bool operator ==(Block) const;
|
||||
bool operator !=(Block) const;
|
||||
uint16_t tile:10;
|
||||
uint16_t collision:2;
|
||||
uint16_t elevation:4;
|
||||
uint16_t rawValue();
|
||||
uint16_t rawValue() const;
|
||||
};
|
||||
|
||||
#endif // BLOCK_H
|
||||
|
||||
@@ -4,31 +4,13 @@
|
||||
|
||||
#include "block.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QByteArray>
|
||||
#include <QVector>
|
||||
|
||||
class Blockdata : public QObject
|
||||
class Blockdata : public QVector<Block>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Blockdata(QObject *parent = nullptr);
|
||||
~Blockdata() {
|
||||
if (blocks) delete blocks;
|
||||
}
|
||||
|
||||
public:
|
||||
QVector<Block> *blocks = nullptr;
|
||||
void addBlock(uint16_t);
|
||||
void addBlock(Block);
|
||||
QByteArray serialize();
|
||||
void copyFrom(Blockdata*);
|
||||
Blockdata* copy();
|
||||
bool equals(Blockdata *);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
QByteArray serialize() const;
|
||||
};
|
||||
|
||||
#endif // BLOCKDATA_H
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#ifndef EDITCOMMANDS_H
|
||||
#define EDITCOMMANDS_H
|
||||
|
||||
#include "blockdata.h"
|
||||
|
||||
#include <QUndoCommand>
|
||||
#include <QList>
|
||||
|
||||
@@ -41,9 +43,8 @@ enum CommandId {
|
||||
class PaintMetatile : public QUndoCommand {
|
||||
public:
|
||||
PaintMetatile(Map *map,
|
||||
Blockdata *oldMetatiles, Blockdata *newMetatiles,
|
||||
const Blockdata &oldMetatiles, const Blockdata &newMetatiles,
|
||||
unsigned actionId, QUndoCommand *parent = nullptr);
|
||||
virtual ~PaintMetatile();
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
@@ -54,8 +55,8 @@ public:
|
||||
private:
|
||||
Map *map;
|
||||
|
||||
Blockdata *newMetatiles;
|
||||
Blockdata *oldMetatiles;
|
||||
Blockdata newMetatiles;
|
||||
Blockdata oldMetatiles;
|
||||
|
||||
unsigned actionId;
|
||||
};
|
||||
@@ -67,7 +68,7 @@ private:
|
||||
class PaintCollision : public PaintMetatile {
|
||||
public:
|
||||
PaintCollision(Map *map,
|
||||
Blockdata *oldCollision, Blockdata *newCollision,
|
||||
const Blockdata &oldCollision, const Blockdata &newCollision,
|
||||
unsigned actionId, QUndoCommand *parent = nullptr)
|
||||
: PaintMetatile(map, oldCollision, newCollision, actionId, parent) {
|
||||
setText("Paint Collision");
|
||||
@@ -82,9 +83,8 @@ public:
|
||||
class PaintBorder : public QUndoCommand {
|
||||
public:
|
||||
PaintBorder(Map *map,
|
||||
Blockdata *oldBorder, Blockdata *newBorder,
|
||||
const Blockdata &oldBorder, const Blockdata &newBorder,
|
||||
unsigned actionId, QUndoCommand *parent = nullptr);
|
||||
~PaintBorder();
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
@@ -95,8 +95,8 @@ public:
|
||||
private:
|
||||
Map *map;
|
||||
|
||||
Blockdata *newBorder;
|
||||
Blockdata *oldBorder;
|
||||
Blockdata newBorder;
|
||||
Blockdata oldBorder;
|
||||
|
||||
unsigned actionId;
|
||||
};
|
||||
@@ -108,7 +108,7 @@ private:
|
||||
class BucketFillMetatile : public PaintMetatile {
|
||||
public:
|
||||
BucketFillMetatile(Map *map,
|
||||
Blockdata *oldMetatiles, Blockdata *newMetatiles,
|
||||
const Blockdata &oldMetatiles, const Blockdata &newMetatiles,
|
||||
unsigned actionId, QUndoCommand *parent = nullptr)
|
||||
: PaintMetatile(map, oldMetatiles, newMetatiles, actionId, parent) {
|
||||
setText("Bucket Fill Metatiles");
|
||||
@@ -124,7 +124,7 @@ public:
|
||||
class BucketFillCollision : public PaintCollision {
|
||||
public:
|
||||
BucketFillCollision(Map *map,
|
||||
Blockdata *oldCollision, Blockdata *newCollision,
|
||||
const Blockdata &oldCollision, const Blockdata &newCollision,
|
||||
QUndoCommand *parent = nullptr)
|
||||
: PaintCollision(map, oldCollision, newCollision, -1, parent) {
|
||||
setText("Flood Fill Collision");
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
class MagicFillMetatile : public PaintMetatile {
|
||||
public:
|
||||
MagicFillMetatile(Map *map,
|
||||
Blockdata *oldMetatiles, Blockdata *newMetatiles,
|
||||
const Blockdata &oldMetatiles, const Blockdata &newMetatiles,
|
||||
unsigned actionId, QUndoCommand *parent = nullptr)
|
||||
: PaintMetatile(map, oldMetatiles, newMetatiles, actionId, parent) {
|
||||
setText("Magic Fill Metatiles");
|
||||
@@ -156,7 +156,7 @@ public:
|
||||
class MagicFillCollision : public PaintCollision {
|
||||
public:
|
||||
MagicFillCollision(Map *map,
|
||||
Blockdata *oldCollision, Blockdata *newCollision,
|
||||
const Blockdata &oldCollision, const Blockdata &newCollision,
|
||||
QUndoCommand *parent = nullptr)
|
||||
: PaintCollision(map, oldCollision, newCollision, -1, parent) {
|
||||
setText("Magic Fill Collision");
|
||||
@@ -172,9 +172,8 @@ public:
|
||||
class ShiftMetatiles : public QUndoCommand {
|
||||
public:
|
||||
ShiftMetatiles(Map *map,
|
||||
Blockdata *oldMetatiles, Blockdata *newMetatiles,
|
||||
const Blockdata &oldMetatiles, const Blockdata &newMetatiles,
|
||||
unsigned actionId, QUndoCommand *parent = nullptr);
|
||||
~ShiftMetatiles();
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
@@ -185,8 +184,8 @@ public:
|
||||
private:
|
||||
Map *map;
|
||||
|
||||
Blockdata *newMetatiles;
|
||||
Blockdata *oldMetatiles;
|
||||
Blockdata newMetatiles;
|
||||
Blockdata oldMetatiles;
|
||||
|
||||
unsigned actionId;
|
||||
};
|
||||
@@ -197,11 +196,10 @@ private:
|
||||
class ResizeMap : public QUndoCommand {
|
||||
public:
|
||||
ResizeMap(Map *map, QSize oldMapDimensions, QSize newMapDimensions,
|
||||
Blockdata *oldMetatiles, Blockdata *newMetatiles,
|
||||
const Blockdata &oldMetatiles, const Blockdata &newMetatiles,
|
||||
QSize oldBorderDimensions, QSize newBorderDimensions,
|
||||
Blockdata *oldBorder, Blockdata *newBorder,
|
||||
const Blockdata &oldBorder, const Blockdata &newBorder,
|
||||
QUndoCommand *parent = nullptr);
|
||||
~ResizeMap();
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
@@ -222,11 +220,11 @@ private:
|
||||
int newBorderWidth;
|
||||
int newBorderHeight;
|
||||
|
||||
Blockdata *newMetatiles;
|
||||
Blockdata *oldMetatiles;
|
||||
Blockdata newMetatiles;
|
||||
Blockdata oldMetatiles;
|
||||
|
||||
Blockdata *newBorder;
|
||||
Blockdata *oldBorder;
|
||||
Blockdata newBorder;
|
||||
Blockdata oldBorder;
|
||||
};
|
||||
|
||||
|
||||
@@ -238,7 +236,6 @@ public:
|
||||
EventMove(QList<Event *> events,
|
||||
int deltaX, int deltaY, unsigned actionId,
|
||||
QUndoCommand *parent = nullptr);
|
||||
~EventMove();
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
@@ -262,7 +259,6 @@ public:
|
||||
EventShift(QList<Event *> events,
|
||||
int deltaX, int deltaY, unsigned actionId,
|
||||
QUndoCommand *parent = nullptr);
|
||||
~EventShift();
|
||||
int id() const override;
|
||||
private:
|
||||
QList<Event *> events;
|
||||
@@ -276,7 +272,6 @@ class EventCreate : public QUndoCommand {
|
||||
public:
|
||||
EventCreate(Editor *editor, Map *map, Event *event,
|
||||
QUndoCommand *parent = nullptr);
|
||||
~EventCreate();
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
@@ -299,7 +294,6 @@ public:
|
||||
EventDelete(Editor *editor, Map *map,
|
||||
QList<Event *> selectedEvents, Event *nextSelectedEvent,
|
||||
QUndoCommand *parent = nullptr);
|
||||
~EventDelete();
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
@@ -321,7 +315,6 @@ class EventDuplicate : public QUndoCommand {
|
||||
public:
|
||||
EventDuplicate(Editor *editor, Map *map, QList<Event *> selectedEvents,
|
||||
QUndoCommand *parent = nullptr);
|
||||
~EventDuplicate();
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
@@ -343,9 +336,8 @@ class ScriptEditMap : public QUndoCommand {
|
||||
public:
|
||||
ScriptEditMap(Map *map,
|
||||
QSize oldMapDimensions, QSize newMapDimensions,
|
||||
Blockdata *oldMetatiles, Blockdata *newMetatiles,
|
||||
const Blockdata &oldMetatiles, const Blockdata &newMetatiles,
|
||||
QUndoCommand *parent = nullptr);
|
||||
~ScriptEditMap();
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
@@ -356,8 +348,8 @@ public:
|
||||
private:
|
||||
Map *map;
|
||||
|
||||
Blockdata *newMetatiles;
|
||||
Blockdata *oldMetatiles;
|
||||
Blockdata newMetatiles;
|
||||
Blockdata oldMetatiles;
|
||||
|
||||
int oldMapWidth;
|
||||
int oldMapHeight;
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
static Event* createNewSecretBaseEvent(Project*);
|
||||
|
||||
OrderedJson::object buildObjectEventJSON();
|
||||
OrderedJson::object buildWarpEventJSON(QMap<QString, QString>*);
|
||||
OrderedJson::object buildWarpEventJSON(const QMap<QString, QString> &);
|
||||
OrderedJson::object buildTriggerEventJSON();
|
||||
OrderedJson::object buildWeatherTriggerEventJSON();
|
||||
OrderedJson::object buildSignEventJSON();
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
QString allowRunning;
|
||||
QString allowBiking;
|
||||
QString allowEscapeRope;
|
||||
int floorNumber;
|
||||
int floorNumber = 0;
|
||||
QString battle_scene;
|
||||
QString sharedEventsMap = "";
|
||||
QString sharedScriptsMap = "";
|
||||
@@ -75,11 +75,11 @@ public:
|
||||
int getBorderHeight();
|
||||
QPixmap render(bool ignoreCache, MapLayout * fromLayout = nullptr);
|
||||
QPixmap renderCollision(qreal opacity, bool ignoreCache);
|
||||
bool mapBlockChanged(int i, Blockdata * cache);
|
||||
bool borderBlockChanged(int i, Blockdata * cache);
|
||||
bool mapBlockChanged(int i, const Blockdata &cache);
|
||||
bool borderBlockChanged(int i, const Blockdata &cache);
|
||||
void cacheBlockdata();
|
||||
void cacheCollision();
|
||||
Block *getBlock(int x, int y);
|
||||
bool getBlock(int x, int y, Block *out);
|
||||
void setBlock(int x, int y, Block block, bool enableScriptCallback = false);
|
||||
void floodFillCollisionElevation(int x, int y, uint16_t collision, uint16_t elevation);
|
||||
void _floodFillCollisionElevation(int x, int y, uint16_t collision, uint16_t elevation);
|
||||
|
||||
@@ -24,15 +24,15 @@ public:
|
||||
QString tileset_secondary_label;
|
||||
Tileset *tileset_primary = nullptr;
|
||||
Tileset *tileset_secondary = nullptr;
|
||||
Blockdata *blockdata = nullptr;
|
||||
Blockdata blockdata;
|
||||
QImage border_image;
|
||||
QPixmap border_pixmap;
|
||||
Blockdata *border = nullptr;
|
||||
Blockdata *cached_blockdata = nullptr;
|
||||
Blockdata *cached_collision = nullptr;
|
||||
Blockdata *cached_border = nullptr;
|
||||
Blockdata border;
|
||||
Blockdata cached_blockdata;
|
||||
Blockdata cached_collision;
|
||||
Blockdata cached_border;
|
||||
struct {
|
||||
Blockdata *blocks = nullptr;
|
||||
Blockdata blocks;
|
||||
QSize dimensions;
|
||||
} lastCommitMapBlocks; // to track map changes
|
||||
};
|
||||
|
||||
@@ -11,16 +11,17 @@ class Metatile
|
||||
{
|
||||
public:
|
||||
Metatile();
|
||||
Metatile(const Metatile &other) = default;
|
||||
Metatile &operator=(const Metatile &other) = default;
|
||||
|
||||
public:
|
||||
QList<Tile> *tiles = nullptr;
|
||||
QList<Tile> tiles;
|
||||
uint16_t behavior; // 8 bits RSE, 9 bits FRLG
|
||||
uint8_t layerType;
|
||||
uint8_t encounterType; // FRLG only
|
||||
uint8_t terrainType; // FRLG only
|
||||
QString label;
|
||||
|
||||
Metatile *copy();
|
||||
void copyInPlace(Metatile*);
|
||||
static int getBlockIndex(int);
|
||||
static QPoint coordFromPixmapCoord(const QPointF &pixelCoord);
|
||||
};
|
||||
|
||||
@@ -4,13 +4,9 @@
|
||||
|
||||
#include "metatile.h"
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
|
||||
class MetatileParser
|
||||
{
|
||||
public:
|
||||
MetatileParser();
|
||||
QList<Metatile*> *parse(QString filepath, bool *error, bool primaryTileset);
|
||||
};
|
||||
namespace MetatileParser {
|
||||
QList<Metatile*> parse(QString filepath, bool *error, bool primaryTileset);
|
||||
}
|
||||
|
||||
#endif // METATILEPARSER_H
|
||||
|
||||
@@ -4,22 +4,10 @@
|
||||
|
||||
#include <QList>
|
||||
#include <QRgb>
|
||||
#include <QString>
|
||||
|
||||
class PaletteUtil
|
||||
{
|
||||
public:
|
||||
PaletteUtil();
|
||||
namespace PaletteUtil {
|
||||
QList<QRgb> parse(QString filepath, bool *error);
|
||||
void writeJASC(QString filepath, QVector<QRgb> colors, int offset, int nColors);
|
||||
private:
|
||||
QList<QRgb> parsePal(QString filepath, bool *error);
|
||||
QList<QRgb> parseJASC(QString filepath, bool *error);
|
||||
QList<QRgb> parseAdvanceMapPal(QString filepath, bool *error);
|
||||
QList<QRgb> parseAdobeColorTable(QString filepath, bool *error);
|
||||
QList<QRgb> parseTileLayerPro(QString filepath, bool *error);
|
||||
QList<QRgb> parseAdvancePaletteEditor(QString filepath, bool *error);
|
||||
int clampColorValue(int value);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // PALETTEUTIL_H
|
||||
|
||||
@@ -39,21 +39,21 @@ public:
|
||||
class ParseUtil
|
||||
{
|
||||
public:
|
||||
ParseUtil();
|
||||
void set_root(QString);
|
||||
static QString readTextFile(QString);
|
||||
void strip_comment(QString*);
|
||||
QList<QStringList>* parseAsm(QString);
|
||||
int evaluateDefine(QString, QMap<QString, int>*);
|
||||
QStringList readCArray(QString text, QString label);
|
||||
QMap<QString, QString> readNamedIndexCArray(QString text, QString label);
|
||||
QString readCIncbin(QString text, QString label);
|
||||
QMap<QString, int> readCDefines(QString filename, QStringList prefixes, QMap<QString, int> = QMap<QString, int>());
|
||||
void readCDefinesSorted(QString, QStringList, QStringList*, QMap<QString, int> = QMap<QString, int>());
|
||||
QList<QStringList>* getLabelMacros(QList<QStringList>*, QString);
|
||||
QStringList* getLabelValues(QList<QStringList>*, QString);
|
||||
bool tryParseJsonFile(QJsonDocument *out, QString filepath);
|
||||
bool ensureFieldsExist(QJsonObject obj, QList<QString> fields);
|
||||
ParseUtil() { };
|
||||
void set_root(const QString &dir);
|
||||
static QString readTextFile(const QString &path);
|
||||
static int textFileLineCount(const QString &path);
|
||||
QList<QStringList> parseAsm(const QString &filename);
|
||||
int evaluateDefine(const QString&, const QMap<QString, int>&);
|
||||
QStringList readCArray(const QString &text, const QString &label);
|
||||
QMap<QString, QString> readNamedIndexCArray(const QString &text, const QString &label);
|
||||
QString readCIncbin(const QString &text, const QString &label);
|
||||
QMap<QString, int> readCDefines(const QString &filename, const QStringList &prefixes, QMap<QString, int> = { });
|
||||
QStringList readCDefinesSorted(const QString&, const QStringList&, const QMap<QString, int>& = { });
|
||||
QList<QStringList> getLabelMacros(const QList<QStringList>&, const QString&);
|
||||
QStringList getLabelValues(const QList<QStringList>&, const QString&);
|
||||
bool tryParseJsonFile(QJsonDocument *out, const QString &filepath);
|
||||
bool ensureFieldsExist(const QJsonObject &obj, const QList<QString> &fields);
|
||||
|
||||
// Returns the 1-indexed line number for the definition of scriptLabel in the scripts file at filePath.
|
||||
// Returns 0 if a definition for scriptLabel cannot be found.
|
||||
@@ -63,9 +63,9 @@ public:
|
||||
static QStringList getGlobalScriptLabels(const QString &filePath);
|
||||
static QStringList getGlobalRawScriptLabels(QString text);
|
||||
static QStringList getGlobalPoryScriptLabels(QString text);
|
||||
static QString &removeStringLiterals(QString &text);
|
||||
static QString &removeLineComments(QString &text, const QString &commentSymbol);
|
||||
static QString &removeLineComments(QString &text, const QStringList &commentSymbols);
|
||||
static QString removeStringLiterals(QString text);
|
||||
static QString removeLineComments(QString text, const QString &commentSymbol);
|
||||
static QString removeLineComments(QString text, const QStringList &commentSymbols);
|
||||
|
||||
static QStringList splitShellCommand(QStringView command);
|
||||
|
||||
@@ -73,10 +73,10 @@ private:
|
||||
QString root;
|
||||
QString text;
|
||||
QString file;
|
||||
QList<Token> tokenizeExpression(QString expression, QMap<QString, int>* knownIdentifiers);
|
||||
QList<Token> generatePostfix(QList<Token> tokens);
|
||||
int evaluatePostfix(QList<Token> postfix);
|
||||
void error(QString message, QString expression);
|
||||
QList<Token> tokenizeExpression(QString expression, const QMap<QString, int> &knownIdentifiers);
|
||||
QList<Token> generatePostfix(const QList<Token> &tokens);
|
||||
int evaluatePostfix(const QList<Token> &postfix);
|
||||
void error(const QString &message, const QString &expression);
|
||||
|
||||
static const QRegularExpression re_incScriptLabel;
|
||||
static const QRegularExpression re_globalIncScriptLabel;
|
||||
|
||||
@@ -79,15 +79,11 @@ public:
|
||||
QString city_map_name;
|
||||
};
|
||||
|
||||
class RegionMap : public QObject
|
||||
class RegionMap
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RegionMap() = default;
|
||||
|
||||
~RegionMap() {};
|
||||
|
||||
Project *project = nullptr;
|
||||
|
||||
QVector<RegionMapSquare> map_squares;
|
||||
|
||||
@@ -6,8 +6,20 @@
|
||||
class Tile
|
||||
{
|
||||
public:
|
||||
Tile() {}
|
||||
Tile(int tile, bool xflip, bool yflip, int palette);
|
||||
Tile() :
|
||||
tile(0),
|
||||
xflip(false),
|
||||
yflip(false),
|
||||
palette(0)
|
||||
{ }
|
||||
|
||||
Tile(int tile, bool xflip, bool yflip, int palette) :
|
||||
tile(tile),
|
||||
xflip(xflip),
|
||||
yflip(yflip),
|
||||
palette(palette)
|
||||
{ }
|
||||
|
||||
public:
|
||||
int tile;
|
||||
bool xflip;
|
||||
|
||||
@@ -9,7 +9,10 @@
|
||||
class Tileset
|
||||
{
|
||||
public:
|
||||
Tileset();
|
||||
Tileset() = default;
|
||||
Tileset(const Tileset &other);
|
||||
Tileset &operator=(const Tileset &other);
|
||||
|
||||
public:
|
||||
QString name;
|
||||
QString is_compressed;
|
||||
@@ -24,14 +27,12 @@ public:
|
||||
QString metatile_attrs_path;
|
||||
QString tilesImagePath;
|
||||
QImage tilesImage;
|
||||
QList<QString> palettePaths;
|
||||
QStringList palettePaths;
|
||||
|
||||
QList<QImage> *tiles = nullptr;
|
||||
QList<Metatile*> *metatiles = nullptr;
|
||||
QList<QList<QRgb>> *palettes = nullptr;
|
||||
QList<QList<QRgb>> *palettePreviews = nullptr;
|
||||
|
||||
Tileset* copy();
|
||||
QList<QImage> tiles;
|
||||
QList<Metatile*> metatiles;
|
||||
QList<QList<QRgb>> palettes;
|
||||
QList<QList<QRgb>> palettePreviews;
|
||||
|
||||
static Tileset* getBlockTileset(int, Tileset*, Tileset*);
|
||||
static Metatile* getMetatile(int, Tileset*, Tileset*);
|
||||
|
||||
@@ -60,7 +60,6 @@ public:
|
||||
void displayCurrentMetatilesSelection();
|
||||
void redrawCurrentMetatilesSelection();
|
||||
void displayMovementPermissionSelector();
|
||||
void displayElevationMetatiles();
|
||||
void displayMapEvents();
|
||||
void displayMapConnections();
|
||||
void displayMapBorder();
|
||||
@@ -75,7 +74,6 @@ public:
|
||||
void setEditingObjects();
|
||||
void setEditingConnections();
|
||||
void setMapEditingButtonsEnabled(bool enabled);
|
||||
void clearWildMonTabWidgets();
|
||||
void setCurrentConnectionDirection(QString curDirection);
|
||||
void updateCurrentConnectionDirection(QString curDirection);
|
||||
void setConnectionsVisibility(bool visible);
|
||||
@@ -99,7 +97,6 @@ public:
|
||||
void selectMapEvent(DraggablePixmapItem *object);
|
||||
void selectMapEvent(DraggablePixmapItem *object, bool toggle);
|
||||
DraggablePixmapItem *addNewEvent(QString event_type);
|
||||
Event* createNewEvent(QString event_type);
|
||||
void deleteEvent(Event *);
|
||||
void updateSelectedEvents();
|
||||
void duplicateSelectedEvents();
|
||||
@@ -143,8 +140,6 @@ public:
|
||||
qreal collisionOpacity = 0.5;
|
||||
|
||||
void objectsView_onMousePress(QMouseEvent *event);
|
||||
void objectsView_onMouseMove(QMouseEvent *event);
|
||||
void objectsView_onMouseRelease(QMouseEvent *event);
|
||||
|
||||
int getBorderDrawDistance(int dimension);
|
||||
|
||||
@@ -154,6 +149,7 @@ public:
|
||||
|
||||
void shouldReselectEvents();
|
||||
void scaleMapView(int);
|
||||
void openInTextEditor(const QString &path, int lineNum = 0) const;
|
||||
|
||||
public slots:
|
||||
void openMapScripts() const;
|
||||
@@ -177,18 +173,9 @@ private:
|
||||
void updateMirroredConnectionMap(MapConnection*, QString);
|
||||
void updateMirroredConnection(MapConnection*, QString, QString, bool isDelete = false);
|
||||
void updateEncounterFields(EncounterFields newFields);
|
||||
Event* createNewObjectEvent();
|
||||
Event* createNewWarpEvent();
|
||||
Event* createNewHealLocationEvent();
|
||||
Event* createNewTriggerEvent();
|
||||
Event* createNewWeatherTriggerEvent();
|
||||
Event* createNewSignEvent();
|
||||
Event* createNewHiddenItemEvent();
|
||||
Event* createNewSecretBaseEvent();
|
||||
QString getMovementPermissionText(uint16_t collision, uint16_t elevation);
|
||||
QString getMetatileDisplayMessage(uint16_t metatileId);
|
||||
bool eventLimitReached(Map *, QString);
|
||||
void openInTextEditor(const QString &path, int lineNum = 0) const;
|
||||
bool startDetachedProcess(const QString &command,
|
||||
const QString &workingDirectory = QString(),
|
||||
qint64 *pid = nullptr) const;
|
||||
|
||||
@@ -77,8 +77,8 @@ public:
|
||||
Q_INVOKABLE void setPrimaryTilesetPalettes(QList<QList<QList<int>>> palettes);
|
||||
Q_INVOKABLE void setSecondaryTilesetPalette(int paletteIndex, QList<QList<int>> colors);
|
||||
Q_INVOKABLE void setSecondaryTilesetPalettes(QList<QList<QList<int>>> palettes);
|
||||
QJSValue getTilesetPalette(QList<QList<QRgb>> *palettes, int paletteIndex);
|
||||
QJSValue getTilesetPalettes(QList<QList<QRgb>> *palettes);
|
||||
QJSValue getTilesetPalette(const QList<QList<QRgb>> &palettes, int paletteIndex);
|
||||
QJSValue getTilesetPalettes(const QList<QList<QRgb>> &palettes);
|
||||
Q_INVOKABLE QJSValue getPrimaryTilesetPalette(int paletteIndex);
|
||||
Q_INVOKABLE QJSValue getPrimaryTilesetPalettes();
|
||||
Q_INVOKABLE QJSValue getSecondaryTilesetPalette(int paletteIndex);
|
||||
@@ -222,6 +222,8 @@ private slots:
|
||||
void on_toolButton_ExpandAll_clicked();
|
||||
void on_toolButton_CollapseAll_clicked();
|
||||
void on_actionAbout_Porymap_triggered();
|
||||
void on_actionOpen_Log_File_triggered();
|
||||
void on_actionOpen_Config_Folder_triggered();
|
||||
void on_pushButton_AddCustomHeaderField_clicked();
|
||||
void on_pushButton_DeleteCustomHeaderField_clicked();
|
||||
void on_tableWidget_CustomHeaderFields_cellChanged(int row, int column);
|
||||
@@ -236,14 +238,14 @@ private slots:
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
QLabel *label_MapRulerStatus;
|
||||
TilesetEditor *tilesetEditor = nullptr;
|
||||
RegionMapEditor *regionMapEditor = nullptr;
|
||||
ShortcutsEditor *shortcutsEditor = nullptr;
|
||||
MapImageExporter *mapImageExporter = nullptr;
|
||||
QLabel *label_MapRulerStatus = nullptr;
|
||||
QPointer<TilesetEditor> tilesetEditor = nullptr;
|
||||
QPointer<RegionMapEditor> regionMapEditor = nullptr;
|
||||
QPointer<ShortcutsEditor> shortcutsEditor = nullptr;
|
||||
QPointer<MapImageExporter> mapImageExporter = nullptr;
|
||||
QPointer<NewMapPopup> newmapprompt = nullptr;
|
||||
QPointer<PreferenceEditor> preferenceEditor = nullptr;
|
||||
FilterChildrenProxyModel *mapListProxyModel;
|
||||
NewMapPopup *newmapprompt = nullptr;
|
||||
PreferenceEditor *preferenceEditor = nullptr;
|
||||
QStandardItemModel *mapListModel;
|
||||
QList<QStandardItem*> *mapGroupItemsList;
|
||||
QMap<QString, QModelIndex> mapListIndexes;
|
||||
|
||||
@@ -31,35 +31,37 @@ public:
|
||||
Project(const Project &) = delete;
|
||||
Project & operator = (const Project &) = delete;
|
||||
|
||||
inline QWidget *parentWidget() const { return static_cast<QWidget *>(parent()); }
|
||||
|
||||
public:
|
||||
QString root;
|
||||
QStringList *groupNames = nullptr;
|
||||
QMap<QString, int> *mapGroups;
|
||||
QStringList groupNames;
|
||||
QMap<QString, int> mapGroups;
|
||||
QList<QStringList> groupedMapNames;
|
||||
QStringList *mapNames = nullptr;
|
||||
QStringList mapNames;
|
||||
QMap<QString, QVariant> miscConstants;
|
||||
QList<HealLocation> healLocations;
|
||||
QMap<QString, QString>* mapConstantsToMapNames;
|
||||
QMap<QString, QString>* mapNamesToMapConstants;
|
||||
QList<QString> mapLayoutsTable;
|
||||
QList<QString> mapLayoutsTableMaster;
|
||||
QMap<QString, QString> mapConstantsToMapNames;
|
||||
QMap<QString, QString> mapNamesToMapConstants;
|
||||
QStringList mapLayoutsTable;
|
||||
QStringList mapLayoutsTableMaster;
|
||||
QString layoutsLabel;
|
||||
QMap<QString, MapLayout*> mapLayouts;
|
||||
QMap<QString, MapLayout*> mapLayoutsMaster;
|
||||
QMap<QString, QString> *mapSecToMapHoverName;
|
||||
QMap<QString, QString> mapSecToMapHoverName;
|
||||
QMap<QString, int> mapSectionNameToValue;
|
||||
QMap<int, QString> mapSectionValueToName;
|
||||
QStringList *itemNames = nullptr;
|
||||
QStringList *flagNames = nullptr;
|
||||
QStringList *varNames = nullptr;
|
||||
QStringList *movementTypes = nullptr;
|
||||
QStringList *mapTypes = nullptr;
|
||||
QStringList *mapBattleScenes = nullptr;
|
||||
QStringList *weatherNames = nullptr;
|
||||
QStringList *coordEventWeatherNames = nullptr;
|
||||
QStringList *secretBaseIds = nullptr;
|
||||
QStringList *bgEventFacingDirections = nullptr;
|
||||
QStringList *trainerTypes = nullptr;
|
||||
QStringList itemNames;
|
||||
QStringList flagNames;
|
||||
QStringList varNames;
|
||||
QStringList movementTypes;
|
||||
QStringList mapTypes;
|
||||
QStringList mapBattleScenes;
|
||||
QStringList weatherNames;
|
||||
QStringList coordEventWeatherNames;
|
||||
QStringList secretBaseIds;
|
||||
QStringList bgEventFacingDirections;
|
||||
QStringList trainerTypes;
|
||||
QStringList eventScriptLabels;
|
||||
QMap<QString, int> metatileBehaviorMap;
|
||||
QMap<int, QString> metatileBehaviorMapInverse;
|
||||
@@ -83,16 +85,16 @@ public:
|
||||
DataQualifiers getDataQualifiers(QString, QString);
|
||||
QMap<QString, DataQualifiers> dataQualifiers;
|
||||
|
||||
QMap<QString, Map*> *mapCache;
|
||||
QMap<QString, Map*> mapCache;
|
||||
Map* loadMap(QString);
|
||||
Map* getMap(QString);
|
||||
|
||||
QMap<QString, Tileset*> *tilesetCache = nullptr;
|
||||
QMap<QString, Tileset*> tilesetCache;
|
||||
Tileset* loadTileset(QString, Tileset *tileset = nullptr);
|
||||
Tileset* getTileset(QString, bool forceLoad = false);
|
||||
QMap<QString, QStringList> tilesetLabels;
|
||||
|
||||
Blockdata* readBlockdata(QString);
|
||||
Blockdata readBlockdata(QString);
|
||||
bool loadBlockdata(Map*);
|
||||
|
||||
void saveTextFile(QString path, QString text);
|
||||
@@ -100,7 +102,6 @@ public:
|
||||
void deleteFile(QString path);
|
||||
|
||||
bool readMapGroups();
|
||||
Map* addNewMapToGroup(QString mapName, int groupNum);
|
||||
Map* addNewMapToGroup(QString, int, Map*, bool);
|
||||
QString getNewMapName();
|
||||
QString getProjectTitle();
|
||||
@@ -130,7 +131,7 @@ public:
|
||||
|
||||
void saveLayoutBlockdata(Map*);
|
||||
void saveLayoutBorder(Map*);
|
||||
void writeBlockdata(QString, Blockdata*);
|
||||
void writeBlockdata(QString, const Blockdata &);
|
||||
void saveAllMaps();
|
||||
void saveMap(Map*);
|
||||
void saveAllDataStructures();
|
||||
@@ -222,7 +223,6 @@ private:
|
||||
static int default_map_size;
|
||||
static int max_object_events;
|
||||
|
||||
QWidget *parent;
|
||||
QStringListModel *eventScriptLabelModel = nullptr;
|
||||
QCompleter *eventScriptLabelCompleter = nullptr;
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
#include "metatileselector.h"
|
||||
#include <QGraphicsPixmapItem>
|
||||
|
||||
class CurrentSelectedMetatilesPixmapItem : public QObject, public QGraphicsPixmapItem {
|
||||
Q_OBJECT
|
||||
class CurrentSelectedMetatilesPixmapItem : public QGraphicsPixmapItem {
|
||||
public:
|
||||
CurrentSelectedMetatilesPixmapItem(Map *map, MetatileSelector *metatileSelector) {
|
||||
this->map = map;
|
||||
|
||||
@@ -33,7 +33,8 @@ public:
|
||||
int last_y;
|
||||
|
||||
void updatePosition();
|
||||
void move(int x, int y);
|
||||
void move(int dx, int dy);
|
||||
void moveTo(const QPoint &pos);
|
||||
void emitPositionChanged();
|
||||
void updatePixmap();
|
||||
void bind(QComboBox *combo, QString key);
|
||||
|
||||
@@ -33,6 +33,7 @@ private:
|
||||
Project *project;
|
||||
void setDefaultValues(int, QString);
|
||||
bool checkNewMapDimensions();
|
||||
bool checkNewMapGroup();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_NewMap_Accept_clicked();
|
||||
|
||||
Reference in New Issue
Block a user