mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-27 02:56:17 -05:00
Write config with project settings editor
This commit is contained in:
@@ -10,8 +10,8 @@
|
||||
#include <QMultiMap>
|
||||
|
||||
// In both versions the default new map border is a generic tree
|
||||
#define DEFAULT_BORDER_RSE (QList<int>{468, 469, 476, 477})
|
||||
#define DEFAULT_BORDER_FRLG (QList<int>{20, 21, 28, 29})
|
||||
#define DEFAULT_BORDER_RSE (QList<uint16_t>{0x1D4, 0x1D5, 0x1DC, 0x1DD})
|
||||
#define DEFAULT_BORDER_FRLG (QList<uint16_t>{0x14, 0x15, 0x1C, 0x1D})
|
||||
|
||||
#define CONFIG_BACKWARDS_COMPATABILITY
|
||||
|
||||
@@ -26,6 +26,7 @@ class KeyValueConfigBase
|
||||
public:
|
||||
void save();
|
||||
void load();
|
||||
void setSaveDisabled(bool disabled);
|
||||
virtual ~KeyValueConfigBase();
|
||||
virtual void reset() = 0;
|
||||
protected:
|
||||
@@ -37,6 +38,8 @@ protected:
|
||||
bool getConfigBool(QString key, QString value);
|
||||
int getConfigInteger(QString key, QString value, int min, int max, int defaultValue);
|
||||
uint32_t getConfigUint32(QString key, QString value, uint32_t min, uint32_t max, uint32_t defaultValue);
|
||||
private:
|
||||
bool saveDisabled = false;
|
||||
};
|
||||
|
||||
class PorymapConfig: public KeyValueConfigBase
|
||||
@@ -203,20 +206,11 @@ public:
|
||||
}
|
||||
virtual void reset() override {
|
||||
this->baseGameVersion = BaseGameVersion::pokeemerald;
|
||||
this->useCustomBorderSize = false;
|
||||
this->enableEventWeatherTrigger = true;
|
||||
this->enableEventSecretBase = true;
|
||||
this->enableHiddenItemQuantity = false;
|
||||
this->enableHiddenItemRequiresItemfinder = false;
|
||||
this->enableHealLocationRespawnData = false;
|
||||
this->enableEventCloneObject = false;
|
||||
this->enableFloorNumber = false;
|
||||
this->createMapTextFile = false;
|
||||
// Reset non-version-specific settings
|
||||
this->usePoryScript = false;
|
||||
this->enableTripleLayerMetatiles = false;
|
||||
this->newMapMetatileId = 1;
|
||||
this->newMapElevation = 3;
|
||||
this->newMapBorderMetatileIds = DEFAULT_BORDER_RSE;
|
||||
this->defaultPrimaryTileset = "gTileset_General";
|
||||
this->prefabFilepath = QString();
|
||||
this->prefabImportPrompted = false;
|
||||
@@ -225,10 +219,12 @@ public:
|
||||
this->filePaths.clear();
|
||||
this->readKeys.clear();
|
||||
}
|
||||
static const QStringList baseGameVersions;
|
||||
static const QStringList versionStrings;
|
||||
void reset(BaseGameVersion baseGameVersion);
|
||||
void setBaseGameVersion(BaseGameVersion baseGameVersion);
|
||||
BaseGameVersion getBaseGameVersion();
|
||||
QString getBaseGameVersionString();
|
||||
BaseGameVersion stringToBaseGameVersion(QString string, bool * ok = nullptr);
|
||||
void setUsePoryScript(bool usePoryScript);
|
||||
bool getUsePoryScript();
|
||||
void setProjectDir(QString projectDir);
|
||||
@@ -255,16 +251,17 @@ public:
|
||||
bool getTripleLayerMetatilesEnabled();
|
||||
int getNumLayersInMetatile();
|
||||
int getNumTilesInMetatile();
|
||||
void setNewMapMetatileId(int metatileId);
|
||||
int getNewMapMetatileId();
|
||||
QString getNewMapMetatileIdString();
|
||||
void setNewMapMetatileId(uint16_t metatileId);
|
||||
uint16_t getNewMapMetatileId();
|
||||
void setNewMapElevation(int elevation);
|
||||
int getNewMapElevation();
|
||||
void setNewMapBorderMetatileIds(QList<int> metatileIds);
|
||||
QList<int> getNewMapBorderMetatileIds();
|
||||
void setNewMapBorderMetatileIds(QList<uint16_t> metatileIds);
|
||||
QList<uint16_t> getNewMapBorderMetatileIds();
|
||||
QString getNewMapBorderMetatileIdsString();
|
||||
QString getDefaultPrimaryTileset();
|
||||
QString getDefaultSecondaryTileset();
|
||||
void setDefaultPrimaryTileset(QString tilesetName);
|
||||
void setDefaultSecondaryTileset(QString tilesetName);
|
||||
void setFilePath(ProjectFilePath pathId, QString path);
|
||||
QString getFilePath(ProjectFilePath pathId);
|
||||
void setPrefabFilepath(QString filepath);
|
||||
@@ -276,12 +273,17 @@ public:
|
||||
void setTilesetsHaveIsCompressed(bool has);
|
||||
bool getTilesetsHaveIsCompressed();
|
||||
int getMetatileAttributesSize();
|
||||
void setMetatileAttributesSize(int size);
|
||||
uint32_t getMetatileBehaviorMask();
|
||||
uint32_t getMetatileTerrainTypeMask();
|
||||
uint32_t getMetatileEncounterTypeMask();
|
||||
uint32_t getMetatileLayerTypeMask();
|
||||
static QString getMaskString(uint32_t mask);
|
||||
void setMetatileBehaviorMask(uint32_t mask);
|
||||
void setMetatileTerrainTypeMask(uint32_t mask);
|
||||
void setMetatileEncounterTypeMask(uint32_t mask);
|
||||
void setMetatileLayerTypeMask(uint32_t mask);
|
||||
bool getMapAllowFlagsEnabled();
|
||||
void setMapAllowFlagsEnabled(bool enabled);
|
||||
protected:
|
||||
virtual QString getConfigFilepath() override;
|
||||
virtual void parseConfigKeyValue(QString key, QString value) override;
|
||||
@@ -303,9 +305,9 @@ private:
|
||||
bool enableFloorNumber;
|
||||
bool createMapTextFile;
|
||||
bool enableTripleLayerMetatiles;
|
||||
int newMapMetatileId;
|
||||
uint16_t newMapMetatileId;
|
||||
int newMapElevation;
|
||||
QList<int> newMapBorderMetatileIds;
|
||||
QList<uint16_t> newMapBorderMetatileIds;
|
||||
QString defaultPrimaryTileset;
|
||||
QString defaultSecondaryTileset;
|
||||
QStringList readKeys;
|
||||
|
||||
@@ -93,6 +93,7 @@ public:
|
||||
static QPoint coordFromPixmapCoord(const QPointF &pixelCoord);
|
||||
static int getDefaultAttributesSize(BaseGameVersion version);
|
||||
static void setCustomLayout(Project*);
|
||||
static QString getMetatileIdString(uint16_t metatileId) { return "0x" + QString("%1").arg(metatileId, 3, 16, QChar('0')).toUpper(); };
|
||||
|
||||
private:
|
||||
// Stores how each attribute should be laid out for all metatiles, according to the user's config
|
||||
|
||||
@@ -198,9 +198,7 @@ private slots:
|
||||
void on_checkBox_AllowBiking_stateChanged(int selected);
|
||||
void on_checkBox_AllowEscaping_stateChanged(int selected);
|
||||
void on_spinBox_FloorNumber_valueChanged(int offset);
|
||||
void on_actionUse_Encounter_Json_triggered(bool checked);
|
||||
void on_actionMonitor_Project_Files_triggered(bool checked);
|
||||
void on_actionUse_Poryscript_triggered(bool checked);
|
||||
void on_actionOpen_Recent_Project_On_Launch_triggered(bool checked);
|
||||
void on_actionEdit_Shortcuts_triggered();
|
||||
|
||||
|
||||
@@ -31,11 +31,17 @@ private:
|
||||
NoScrollComboBox *combo_baseGameVersion;
|
||||
NoScrollComboBox *combo_attributesSize;
|
||||
|
||||
bool hasUnsavedChanges = false;
|
||||
|
||||
void initUi();
|
||||
void saveFields();
|
||||
void connectSignals();
|
||||
void refresh();
|
||||
bool prompt(const QString &text);
|
||||
|
||||
private slots:
|
||||
void dialogButtonClicked(QAbstractButton *button);
|
||||
void markEdited();
|
||||
};
|
||||
|
||||
#endif // PROJECTSETTINGSEDITOR_H
|
||||
|
||||
Reference in New Issue
Block a user