2018-09-27 00:33:08 +01:00
|
|
|
#ifndef PROJECT_H
|
|
|
|
#define PROJECT_H
|
|
|
|
|
|
|
|
#include "map.h"
|
|
|
|
#include "blockdata.h"
|
|
|
|
#include "heallocation.h"
|
2019-04-05 19:34:28 +01:00
|
|
|
#include "event.h"
|
2018-09-27 00:33:08 +01:00
|
|
|
|
|
|
|
#include <QStringList>
|
|
|
|
#include <QList>
|
|
|
|
#include <QStandardItem>
|
|
|
|
|
|
|
|
static QString NONE_MAP_CONSTANT = "MAP_NONE";
|
|
|
|
static QString NONE_MAP_NAME = "None";
|
|
|
|
|
|
|
|
class Project
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Project();
|
|
|
|
QString root;
|
|
|
|
QStringList *groupNames = nullptr;
|
|
|
|
QMap<QString, int> *map_groups;
|
|
|
|
QList<QStringList> groupedMapNames;
|
|
|
|
QStringList *mapNames = nullptr;
|
|
|
|
QList<HealLocation> flyableMaps;
|
|
|
|
QMap<QString, QString>* mapConstantsToMapNames;
|
|
|
|
QMap<QString, QString>* mapNamesToMapConstants;
|
|
|
|
QList<QString> mapLayoutsTable;
|
|
|
|
QList<QString> mapLayoutsTableMaster;
|
2019-02-01 17:43:25 +00:00
|
|
|
QString layoutsLabel;
|
2018-09-27 00:33:08 +01:00
|
|
|
QMap<QString, MapLayout*> mapLayouts;
|
|
|
|
QMap<QString, MapLayout*> mapLayoutsMaster;
|
2019-02-25 18:31:34 +00:00
|
|
|
QMap<QString, QString> *mapSecToMapHoverName;
|
|
|
|
QMap<QString, int> mapSectionNameToValue;
|
|
|
|
QMap<int, QString> mapSectionValueToName;
|
2018-09-27 00:33:08 +01:00
|
|
|
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;
|
2018-10-03 01:01:09 +01:00
|
|
|
QMap<QString, int> metatileBehaviorMap;
|
|
|
|
QMap<int, QString> metatileBehaviorMapInverse;
|
2019-04-03 00:51:33 +01:00
|
|
|
QMap<QString, QString> facingDirections;
|
2018-09-27 00:33:08 +01:00
|
|
|
|
|
|
|
QMap<QString, Map*> *map_cache;
|
|
|
|
Map* loadMap(QString);
|
|
|
|
Map* getMap(QString);
|
|
|
|
|
|
|
|
QMap<QString, Tileset*> *tileset_cache = nullptr;
|
2018-10-03 01:01:15 +01:00
|
|
|
Tileset* loadTileset(QString, Tileset *tileset = nullptr);
|
|
|
|
Tileset* getTileset(QString, bool forceLoad = false);
|
2018-09-27 00:33:08 +01:00
|
|
|
|
|
|
|
Blockdata* readBlockdata(QString);
|
|
|
|
void loadBlockdata(Map*);
|
|
|
|
|
|
|
|
QString readTextFile(QString path);
|
|
|
|
void saveTextFile(QString path, QString text);
|
|
|
|
void appendTextFile(QString path, QString text);
|
|
|
|
void deleteFile(QString path);
|
|
|
|
|
|
|
|
void readMapGroups();
|
|
|
|
Map* addNewMapToGroup(QString mapName, int groupNum);
|
2019-01-07 23:14:44 +00:00
|
|
|
Map* addNewMapToGroup(QString, int, Map*, bool);
|
2018-09-27 00:33:08 +01:00
|
|
|
QString getNewMapName();
|
|
|
|
QString getProjectTitle();
|
|
|
|
|
2018-10-05 07:02:40 +01:00
|
|
|
QString readMapLayoutId(QString map_name);
|
|
|
|
QString readMapLocation(QString map_name);
|
|
|
|
|
2018-09-27 00:33:08 +01:00
|
|
|
QList<QStringList>* getLabelMacros(QList<QStringList>*, QString);
|
|
|
|
QStringList* getLabelValues(QList<QStringList>*, QString);
|
2019-02-03 16:38:45 +00:00
|
|
|
QMap<QString, bool> getTopLevelMapFields();
|
2019-02-01 17:43:25 +00:00
|
|
|
bool loadMapData(Map*);
|
|
|
|
void readMapLayouts();
|
|
|
|
void loadMapLayout(Map*);
|
2018-09-27 00:33:08 +01:00
|
|
|
void loadMapTilesets(Map*);
|
|
|
|
void loadTilesetAssets(Tileset*);
|
2018-10-03 01:01:24 +01:00
|
|
|
void loadTilesetTiles(Tileset*, QImage);
|
|
|
|
void loadTilesetMetatiles(Tileset*);
|
2018-09-27 00:33:08 +01:00
|
|
|
|
2019-02-01 17:43:25 +00:00
|
|
|
void saveLayoutBlockdata(Map*);
|
|
|
|
void saveLayoutBorder(Map*);
|
2018-09-27 00:33:08 +01:00
|
|
|
void writeBlockdata(QString, Blockdata*);
|
|
|
|
void saveAllMaps();
|
|
|
|
void saveMap(Map*);
|
|
|
|
void saveAllDataStructures();
|
2019-02-01 17:43:25 +00:00
|
|
|
void saveMapLayouts();
|
|
|
|
void saveMapGroups();
|
2018-09-27 00:33:08 +01:00
|
|
|
void saveMapConstantsHeader();
|
|
|
|
void saveHealLocationStruct(Map*);
|
2018-10-03 01:01:09 +01:00
|
|
|
void saveTilesets(Tileset*, Tileset*);
|
2019-03-21 23:50:50 +00:00
|
|
|
void saveTilesetMetatileAttributes(Tileset*);
|
|
|
|
void saveTilesetMetatiles(Tileset*);
|
|
|
|
void saveTilesetTilesImage(Tileset*);
|
|
|
|
void saveTilesetPalettes(Tileset*, bool);
|
2018-09-27 00:33:08 +01:00
|
|
|
|
|
|
|
QList<QStringList>* parseAsm(QString text);
|
|
|
|
QStringList getSongNames();
|
|
|
|
QStringList getVisibilities();
|
2019-03-23 14:49:30 +00:00
|
|
|
QMap<QString, QStringList> getTilesetLabels();
|
2018-09-27 00:33:08 +01:00
|
|
|
void readTilesetProperties();
|
|
|
|
void readRegionMapSections();
|
|
|
|
void readItemNames();
|
|
|
|
void readFlagNames();
|
|
|
|
void readVarNames();
|
|
|
|
void readMovementTypes();
|
2019-04-03 00:51:33 +01:00
|
|
|
void readInitialFacingDirections();
|
2018-09-27 00:33:08 +01:00
|
|
|
void readMapTypes();
|
|
|
|
void readMapBattleScenes();
|
|
|
|
void readWeatherNames();
|
|
|
|
void readCoordEventWeatherNames();
|
|
|
|
void readSecretBaseIds();
|
|
|
|
void readBgEventFacingDirections();
|
2018-10-03 01:01:09 +01:00
|
|
|
void readMetatileBehaviors();
|
2018-09-27 00:33:08 +01:00
|
|
|
|
|
|
|
void loadEventPixmaps(QList<Event*> objects);
|
|
|
|
QMap<QString, int> getEventObjGfxConstants();
|
2018-10-03 01:01:41 +01:00
|
|
|
QString fixPalettePath(QString path);
|
2018-09-27 00:33:08 +01:00
|
|
|
QString fixGraphicPath(QString path);
|
|
|
|
|
|
|
|
void loadMapBorder(Map *map);
|
|
|
|
|
2019-02-01 17:43:25 +00:00
|
|
|
void saveMapHealEvents(Map *map);
|
2018-09-27 00:33:08 +01:00
|
|
|
|
|
|
|
QStringList readCArray(QString text, QString label);
|
|
|
|
QString readCIncbin(QString text, QString label);
|
|
|
|
QMap<QString, int> readCDefines(QString text, QStringList prefixes);
|
2019-04-03 00:51:33 +01:00
|
|
|
QMap<QString, QString> readNamedIndexCArray(QString text, QString label);
|
2018-09-27 00:33:08 +01:00
|
|
|
|
|
|
|
static int getNumTilesPrimary();
|
|
|
|
static int getNumTilesTotal();
|
|
|
|
static int getNumMetatilesPrimary();
|
|
|
|
static int getNumMetatilesTotal();
|
|
|
|
static int getNumPalettesPrimary();
|
|
|
|
static int getNumPalettesTotal();
|
|
|
|
private:
|
|
|
|
void updateMapLayout(Map*);
|
|
|
|
void readCDefinesSorted(QString, QStringList, QStringList*);
|
|
|
|
void readCDefinesSorted(QString, QStringList, QStringList*, QString, int);
|
|
|
|
|
|
|
|
void setNewMapHeader(Map* map, int mapIndex);
|
|
|
|
void setNewMapLayout(Map* map);
|
|
|
|
void setNewMapBlockdata(Map* map);
|
|
|
|
void setNewMapBorder(Map *map);
|
|
|
|
void setNewMapEvents(Map *map);
|
|
|
|
void setNewMapConnections(Map *map);
|
|
|
|
|
|
|
|
static int num_tiles_primary;
|
|
|
|
static int num_tiles_total;
|
|
|
|
static int num_metatiles_primary;
|
|
|
|
static int num_metatiles_total;
|
|
|
|
static int num_pals_primary;
|
|
|
|
static int num_pals_total;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PROJECT_H
|