mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-10 01:45:34 -05:00
Support map JSON data
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <QString>
|
||||
#include <QPixmap>
|
||||
#include <QMap>
|
||||
#include <QJsonObject>
|
||||
|
||||
class EventType
|
||||
{
|
||||
@@ -64,13 +65,13 @@ public:
|
||||
static Event* createNewHiddenItemEvent();
|
||||
static Event* createNewSecretBaseEvent();
|
||||
|
||||
QString buildObjectEventMacro(int);
|
||||
QString buildWarpEventMacro(QMap<QString, QString>*);
|
||||
QString buildTriggerEventMacro();
|
||||
QString buildWeatherTriggerEventMacro();
|
||||
QString buildSignEventMacro();
|
||||
QString buildHiddenItemEventMacro();
|
||||
QString buildSecretBaseEventMacro();
|
||||
QJsonObject buildObjectEventJSON();
|
||||
QJsonObject buildWarpEventJSON(QMap<QString, QString>*);
|
||||
QJsonObject buildTriggerEventJSON();
|
||||
QJsonObject buildWeatherTriggerEventJSON();
|
||||
QJsonObject buildSignEventJSON();
|
||||
QJsonObject buildHiddenItemEventJSON();
|
||||
QJsonObject buildSecretBaseEventJSON();
|
||||
void setPixmapFromSpritesheet(QImage, int, int);
|
||||
int getPixelX();
|
||||
int getPixelY();
|
||||
|
||||
@@ -24,18 +24,13 @@ public:
|
||||
QString name;
|
||||
QString constantName;
|
||||
QString group_num;
|
||||
QString layout_label;
|
||||
QString events_label;
|
||||
QString scripts_label;
|
||||
QString connections_label;
|
||||
QString song;
|
||||
QString layout_id;
|
||||
QString layoutId;
|
||||
QString location;
|
||||
QString requiresFlash;
|
||||
QString isFlyable;
|
||||
QString weather;
|
||||
QString type;
|
||||
QString unknown;
|
||||
QString show_location;
|
||||
QString allowRunning;
|
||||
QString allowBiking;
|
||||
|
||||
@@ -10,14 +10,12 @@
|
||||
class MapLayout {
|
||||
public:
|
||||
MapLayout() {}
|
||||
int index;
|
||||
static QString layoutConstantFromName(QString mapName);
|
||||
QString id;
|
||||
QString name;
|
||||
QString label;
|
||||
QString width;
|
||||
QString height;
|
||||
QString border_label;
|
||||
QString border_path;
|
||||
QString blockdata_label;
|
||||
QString blockdata_path;
|
||||
QString tileset_primary_label;
|
||||
QString tileset_secondary_label;
|
||||
@@ -31,11 +29,6 @@ public:
|
||||
Blockdata *cached_collision = nullptr;
|
||||
Blockdata *cached_border = nullptr;
|
||||
bool has_unsaved_changes = false;
|
||||
public:
|
||||
static QString getNameFromLabel(QString label) {
|
||||
// ASSUMPTION: strip off "_Layout" from layout label. Directories in 'data/layouts/' must be well-formed.
|
||||
return label.replace(label.lastIndexOf("_Layout"), label.length(), "");
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MAPLAYOUT_H
|
||||
|
||||
@@ -226,6 +226,7 @@ private:
|
||||
enum MapListUserRoles {
|
||||
GroupRole = Qt::UserRole + 1, // Used to hold the map group number.
|
||||
TypeRole, // Used to differentiate between the different layers of the map list tree view.
|
||||
TypeRole2, // Used for various extra data needed.
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
QMap<QString, QString>* mapNamesToMapConstants;
|
||||
QList<QString> mapLayoutsTable;
|
||||
QList<QString> mapLayoutsTableMaster;
|
||||
QString layoutsLabel;
|
||||
QMap<QString, MapLayout*> mapLayouts;
|
||||
QMap<QString, MapLayout*> mapLayoutsMaster;
|
||||
QStringList *regionMapSections = nullptr;
|
||||
@@ -39,7 +40,6 @@ public:
|
||||
QStringList *coordEventWeatherNames = nullptr;
|
||||
QStringList *secretBaseIds = nullptr;
|
||||
QStringList *bgEventFacingDirections = nullptr;
|
||||
QStringList mapsWithConnections;
|
||||
QMap<QString, int> metatileBehaviorMap;
|
||||
QMap<int, QString> metatileBehaviorMapInverse;
|
||||
|
||||
@@ -70,25 +70,22 @@ public:
|
||||
|
||||
QList<QStringList>* getLabelMacros(QList<QStringList>*, QString);
|
||||
QStringList* getLabelValues(QList<QStringList>*, QString);
|
||||
bool readMapHeader(Map*);
|
||||
void readMapLayoutsTable();
|
||||
void readAllMapLayouts();
|
||||
QStringList* readLayoutValues(QString layoutName);
|
||||
void readMapLayout(Map*);
|
||||
void readMapsWithConnections();
|
||||
bool loadMapData(Map*);
|
||||
void readMapLayouts();
|
||||
void loadMapLayout(Map*);
|
||||
void loadMapTilesets(Map*);
|
||||
void loadTilesetAssets(Tileset*);
|
||||
void loadTilesetTiles(Tileset*, QImage);
|
||||
void loadTilesetMetatiles(Tileset*);
|
||||
|
||||
void saveBlockdata(Map*);
|
||||
void saveMapBorder(Map*);
|
||||
void saveLayoutBlockdata(Map*);
|
||||
void saveLayoutBorder(Map*);
|
||||
void writeBlockdata(QString, Blockdata*);
|
||||
void saveAllMaps();
|
||||
void saveMap(Map*);
|
||||
void saveAllDataStructures();
|
||||
void saveAllMapLayouts();
|
||||
void saveMapGroupsTable();
|
||||
void saveMapLayouts();
|
||||
void saveMapGroups();
|
||||
void saveMapConstantsHeader();
|
||||
void saveHealLocationStruct(Map*);
|
||||
void saveTilesets(Tileset*, Tileset*);
|
||||
@@ -116,12 +113,9 @@ public:
|
||||
QString fixPalettePath(QString path);
|
||||
QString fixGraphicPath(QString path);
|
||||
|
||||
void readMapEvents(Map *map);
|
||||
void loadMapConnections(Map *map);
|
||||
|
||||
void loadMapBorder(Map *map);
|
||||
|
||||
void saveMapEvents(Map *map);
|
||||
void saveMapHealEvents(Map *map);
|
||||
|
||||
QStringList readCArray(QString text, QString label);
|
||||
QString readCIncbin(QString text, QString label);
|
||||
@@ -134,17 +128,10 @@ public:
|
||||
static int getNumPalettesPrimary();
|
||||
static int getNumPalettesTotal();
|
||||
private:
|
||||
QString getMapLayoutsTableFilepath();
|
||||
QString getMapLayoutFilepath(QString);
|
||||
void saveMapHeader(Map*);
|
||||
void saveMapConnections(Map*);
|
||||
void saveTilesetMetatileAttributes(Tileset*);
|
||||
void saveTilesetMetatiles(Tileset*);
|
||||
void saveTilesetTilesImage(Tileset*);
|
||||
void saveTilesetPalettes(Tileset*, bool);
|
||||
void updateMapsWithConnections(Map*);
|
||||
void saveMapsWithConnections();
|
||||
void saveMapLayoutsTable();
|
||||
void updateMapLayout(Map*);
|
||||
void readCDefinesSorted(QString, QStringList, QStringList*);
|
||||
void readCDefinesSorted(QString, QStringList, QStringList*, QString, int);
|
||||
|
||||
@@ -19,8 +19,8 @@ public:
|
||||
~NewMapPopup();
|
||||
Map *map;
|
||||
int group;
|
||||
bool changeLayout;
|
||||
QString layoutName;
|
||||
bool existingLayout;
|
||||
QString layoutId;
|
||||
void init(int, int, QString, QString);
|
||||
void useLayout(QString);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user