2020-09-13 23:37:55 +01:00
|
|
|
#pragma once
|
2018-12-21 15:25:28 +00:00
|
|
|
#ifndef CONFIG_H
|
|
|
|
#define CONFIG_H
|
|
|
|
|
|
|
|
#include <QString>
|
2018-12-25 21:26:13 +00:00
|
|
|
#include <QObject>
|
2019-01-07 23:14:44 +00:00
|
|
|
#include <QByteArrayList>
|
2019-01-15 22:06:18 +00:00
|
|
|
#include <QSize>
|
2020-11-01 12:35:20 +00:00
|
|
|
#include <QKeySequence>
|
|
|
|
#include <QMultiMap>
|
2024-01-24 16:56:04 +00:00
|
|
|
#include <QDateTime>
|
|
|
|
#include <QUrl>
|
2024-02-07 20:35:11 +00:00
|
|
|
#include <QVersionNumber>
|
2018-12-21 15:25:28 +00:00
|
|
|
|
2023-12-05 07:01:44 +00:00
|
|
|
#include "events.h"
|
|
|
|
|
2024-02-07 20:35:11 +00:00
|
|
|
static const QVersionNumber porymapVersion = QVersionNumber::fromString(PORYMAP_VERSION);
|
|
|
|
|
2022-09-11 04:30:28 +01:00
|
|
|
// In both versions the default new map border is a generic tree
|
2023-08-24 02:07:13 +01:00
|
|
|
#define DEFAULT_BORDER_RSE (QList<uint16_t>{0x1D4, 0x1D5, 0x1DC, 0x1DD})
|
|
|
|
#define DEFAULT_BORDER_FRLG (QList<uint16_t>{0x14, 0x15, 0x1C, 0x1D})
|
2022-09-11 04:30:28 +01:00
|
|
|
|
2022-09-01 05:57:31 +01:00
|
|
|
#define CONFIG_BACKWARDS_COMPATABILITY
|
|
|
|
|
2018-12-21 15:25:28 +00:00
|
|
|
enum MapSortOrder {
|
|
|
|
Group = 0,
|
|
|
|
Area = 1,
|
|
|
|
Layout = 2,
|
|
|
|
};
|
|
|
|
|
2021-02-18 13:43:52 +00:00
|
|
|
class KeyValueConfigBase
|
2018-12-21 15:25:28 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-12-25 20:41:06 +00:00
|
|
|
void save();
|
|
|
|
void load();
|
2023-08-24 02:07:13 +01:00
|
|
|
void setSaveDisabled(bool disabled);
|
2018-12-25 20:41:06 +00:00
|
|
|
virtual ~KeyValueConfigBase();
|
2020-04-07 19:44:14 +01:00
|
|
|
virtual void reset() = 0;
|
2018-12-25 20:41:06 +00:00
|
|
|
protected:
|
2018-12-25 21:26:13 +00:00
|
|
|
virtual QString getConfigFilepath() = 0;
|
2018-12-25 20:41:06 +00:00
|
|
|
virtual void parseConfigKeyValue(QString key, QString value) = 0;
|
|
|
|
virtual QMap<QString, QString> getKeyValueMap() = 0;
|
2018-12-25 21:26:13 +00:00
|
|
|
virtual void onNewConfigFileCreated() = 0;
|
2020-05-26 22:01:18 +01:00
|
|
|
virtual void setUnreadKeys() = 0;
|
2022-09-11 04:30:28 +01:00
|
|
|
bool getConfigBool(QString key, QString value);
|
2023-12-06 21:01:02 +00:00
|
|
|
int getConfigInteger(QString key, QString value, int min = INT_MIN, int max = INT_MAX, int defaultValue = 0);
|
|
|
|
uint32_t getConfigUint32(QString key, QString value, uint32_t min = 0, uint32_t max = UINT_MAX, uint32_t defaultValue = 0);
|
2023-08-24 02:07:13 +01:00
|
|
|
private:
|
|
|
|
bool saveDisabled = false;
|
2018-12-25 20:41:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class PorymapConfig: public KeyValueConfigBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PorymapConfig() {
|
2020-04-07 19:44:14 +01:00
|
|
|
reset();
|
|
|
|
}
|
|
|
|
virtual void reset() override {
|
2023-12-28 05:55:45 +00:00
|
|
|
this->recentProjects.clear();
|
2022-07-04 20:47:03 +01:00
|
|
|
this->reopenOnLaunch = true;
|
2018-12-25 20:41:06 +00:00
|
|
|
this->mapSortOrder = MapSortOrder::Group;
|
|
|
|
this->prettyCursors = true;
|
2019-01-06 18:53:31 +00:00
|
|
|
this->collisionOpacity = 50;
|
2023-12-07 18:45:08 +00:00
|
|
|
this->collisionZoom = 30;
|
2019-02-16 20:32:19 +00:00
|
|
|
this->metatilesZoom = 30;
|
2024-01-07 21:42:46 +00:00
|
|
|
this->tilesetEditorMetatilesZoom = 30;
|
|
|
|
this->tilesetEditorTilesZoom = 30;
|
2019-01-09 15:35:34 +00:00
|
|
|
this->showPlayerView = false;
|
|
|
|
this->showCursorTile = true;
|
2021-11-08 03:00:20 +00:00
|
|
|
this->showBorder = true;
|
|
|
|
this->showGrid = false;
|
2023-12-20 02:21:16 +00:00
|
|
|
this->showTilesetEditorMetatileGrid = false;
|
|
|
|
this->showTilesetEditorLayerGrid = true;
|
2020-04-08 05:42:38 +01:00
|
|
|
this->monitorFiles = true;
|
2022-11-28 19:04:47 +00:00
|
|
|
this->tilesetCheckerboardFill = true;
|
2019-08-14 23:02:00 +01:00
|
|
|
this->theme = "default";
|
2020-12-01 12:12:32 +00:00
|
|
|
this->textEditorOpenFolder = "";
|
|
|
|
this->textEditorGotoLine = "";
|
2023-12-08 20:13:21 +00:00
|
|
|
this->paletteEditorBitDepth = 24;
|
|
|
|
this->projectSettingsTab = 0;
|
2023-12-19 17:57:45 +00:00
|
|
|
this->warpBehaviorWarningDisabled = false;
|
2024-01-21 04:02:43 +00:00
|
|
|
this->checkForUpdates = true;
|
2024-01-24 16:56:04 +00:00
|
|
|
this->lastUpdateCheckTime = QDateTime();
|
2024-02-07 20:35:11 +00:00
|
|
|
this->lastUpdateCheckVersion = porymapVersion;
|
2024-01-24 16:56:04 +00:00
|
|
|
this->rateLimitTimes.clear();
|
2018-12-25 20:41:06 +00:00
|
|
|
}
|
2023-12-28 05:55:45 +00:00
|
|
|
void addRecentProject(QString project);
|
|
|
|
void setRecentProjects(QStringList projects);
|
2022-07-04 20:47:03 +01:00
|
|
|
void setReopenOnLaunch(bool enabled);
|
2018-12-25 20:41:06 +00:00
|
|
|
void setMapSortOrder(MapSortOrder order);
|
|
|
|
void setPrettyCursors(bool enabled);
|
2024-01-13 03:47:50 +00:00
|
|
|
void setMainGeometry(QByteArray, QByteArray, QByteArray, QByteArray, QByteArray);
|
|
|
|
void setTilesetEditorGeometry(QByteArray, QByteArray, QByteArray);
|
2020-09-16 02:43:52 +01:00
|
|
|
void setPaletteEditorGeometry(QByteArray, QByteArray);
|
2020-09-16 00:03:15 +01:00
|
|
|
void setRegionMapEditorGeometry(QByteArray, QByteArray);
|
2023-08-29 02:02:52 +01:00
|
|
|
void setProjectSettingsEditorGeometry(QByteArray, QByteArray);
|
2023-09-06 19:45:46 +01:00
|
|
|
void setCustomScriptsEditorGeometry(QByteArray, QByteArray);
|
2019-01-06 18:53:31 +00:00
|
|
|
void setCollisionOpacity(int opacity);
|
2023-12-07 18:45:08 +00:00
|
|
|
void setCollisionZoom(int zoom);
|
2019-02-16 20:32:19 +00:00
|
|
|
void setMetatilesZoom(int zoom);
|
2024-01-07 21:42:46 +00:00
|
|
|
void setTilesetEditorMetatilesZoom(int zoom);
|
|
|
|
void setTilesetEditorTilesZoom(int zoom);
|
2019-01-09 15:35:34 +00:00
|
|
|
void setShowPlayerView(bool enabled);
|
|
|
|
void setShowCursorTile(bool enabled);
|
2021-11-08 03:00:20 +00:00
|
|
|
void setShowBorder(bool enabled);
|
|
|
|
void setShowGrid(bool enabled);
|
2023-12-20 02:21:16 +00:00
|
|
|
void setShowTilesetEditorMetatileGrid(bool enabled);
|
|
|
|
void setShowTilesetEditorLayerGrid(bool enabled);
|
2020-04-08 05:42:38 +01:00
|
|
|
void setMonitorFiles(bool monitor);
|
2022-11-28 19:04:47 +00:00
|
|
|
void setTilesetCheckerboardFill(bool checkerboard);
|
2019-08-14 23:02:00 +01:00
|
|
|
void setTheme(QString theme);
|
2020-12-01 12:12:32 +00:00
|
|
|
void setTextEditorOpenFolder(const QString &command);
|
|
|
|
void setTextEditorGotoLine(const QString &command);
|
2023-02-22 16:21:30 +00:00
|
|
|
void setPaletteEditorBitDepth(int bitDepth);
|
2023-12-08 20:13:21 +00:00
|
|
|
void setProjectSettingsTab(int tab);
|
2023-12-19 17:57:45 +00:00
|
|
|
void setWarpBehaviorWarningDisabled(bool disabled);
|
2024-01-21 04:02:43 +00:00
|
|
|
void setCheckForUpdates(bool enabled);
|
2024-01-24 16:56:04 +00:00
|
|
|
void setLastUpdateCheckTime(QDateTime time);
|
2024-02-07 20:35:11 +00:00
|
|
|
void setLastUpdateCheckVersion(QVersionNumber version);
|
2024-01-24 16:56:04 +00:00
|
|
|
void setRateLimitTimes(QMap<QUrl, QDateTime> map);
|
2018-12-25 20:41:06 +00:00
|
|
|
QString getRecentProject();
|
2023-12-28 05:55:45 +00:00
|
|
|
QStringList getRecentProjects();
|
2022-07-04 20:47:03 +01:00
|
|
|
bool getReopenOnLaunch();
|
2018-12-25 20:41:06 +00:00
|
|
|
MapSortOrder getMapSortOrder();
|
|
|
|
bool getPrettyCursors();
|
2020-09-15 19:57:46 +01:00
|
|
|
QMap<QString, QByteArray> getMainGeometry();
|
|
|
|
QMap<QString, QByteArray> getTilesetEditorGeometry();
|
2020-09-16 02:43:52 +01:00
|
|
|
QMap<QString, QByteArray> getPaletteEditorGeometry();
|
2020-09-16 00:03:15 +01:00
|
|
|
QMap<QString, QByteArray> getRegionMapEditorGeometry();
|
2023-08-29 02:02:52 +01:00
|
|
|
QMap<QString, QByteArray> getProjectSettingsEditorGeometry();
|
2023-09-06 19:45:46 +01:00
|
|
|
QMap<QString, QByteArray> getCustomScriptsEditorGeometry();
|
2019-01-06 18:53:31 +00:00
|
|
|
int getCollisionOpacity();
|
2023-12-07 18:45:08 +00:00
|
|
|
int getCollisionZoom();
|
2019-02-16 20:32:19 +00:00
|
|
|
int getMetatilesZoom();
|
2024-01-07 21:42:46 +00:00
|
|
|
int getTilesetEditorMetatilesZoom();
|
|
|
|
int getTilesetEditorTilesZoom();
|
2019-01-09 15:35:34 +00:00
|
|
|
bool getShowPlayerView();
|
|
|
|
bool getShowCursorTile();
|
2021-11-08 03:00:20 +00:00
|
|
|
bool getShowBorder();
|
|
|
|
bool getShowGrid();
|
2023-12-20 02:21:16 +00:00
|
|
|
bool getShowTilesetEditorMetatileGrid();
|
|
|
|
bool getShowTilesetEditorLayerGrid();
|
2020-04-08 05:42:38 +01:00
|
|
|
bool getMonitorFiles();
|
2022-11-28 19:04:47 +00:00
|
|
|
bool getTilesetCheckerboardFill();
|
2019-08-14 23:02:00 +01:00
|
|
|
QString getTheme();
|
2020-12-01 12:12:32 +00:00
|
|
|
QString getTextEditorOpenFolder();
|
|
|
|
QString getTextEditorGotoLine();
|
2023-02-22 16:21:30 +00:00
|
|
|
int getPaletteEditorBitDepth();
|
2023-12-08 20:13:21 +00:00
|
|
|
int getProjectSettingsTab();
|
2023-12-19 17:57:45 +00:00
|
|
|
bool getWarpBehaviorWarningDisabled();
|
2024-01-21 04:02:43 +00:00
|
|
|
bool getCheckForUpdates();
|
2024-01-24 16:56:04 +00:00
|
|
|
QDateTime getLastUpdateCheckTime();
|
2024-02-07 20:35:11 +00:00
|
|
|
QVersionNumber getLastUpdateCheckVersion();
|
2024-01-24 16:56:04 +00:00
|
|
|
QMap<QUrl, QDateTime> getRateLimitTimes();
|
2018-12-25 20:41:06 +00:00
|
|
|
protected:
|
2020-04-07 19:44:14 +01:00
|
|
|
virtual QString getConfigFilepath() override;
|
|
|
|
virtual void parseConfigKeyValue(QString key, QString value) override;
|
|
|
|
virtual QMap<QString, QString> getKeyValueMap() override;
|
2020-05-26 22:01:18 +01:00
|
|
|
virtual void onNewConfigFileCreated() override {};
|
|
|
|
virtual void setUnreadKeys() override {};
|
2018-12-21 15:25:28 +00:00
|
|
|
private:
|
2023-12-28 05:55:45 +00:00
|
|
|
QStringList recentProjects;
|
2022-07-04 20:47:03 +01:00
|
|
|
bool reopenOnLaunch;
|
2019-01-07 23:14:44 +00:00
|
|
|
QString stringFromByteArray(QByteArray);
|
|
|
|
QByteArray bytesFromString(QString);
|
2018-12-25 20:41:06 +00:00
|
|
|
MapSortOrder mapSortOrder;
|
|
|
|
bool prettyCursors;
|
2020-09-15 19:57:46 +01:00
|
|
|
QByteArray mainWindowGeometry;
|
|
|
|
QByteArray mainWindowState;
|
2019-01-07 23:14:44 +00:00
|
|
|
QByteArray mapSplitterState;
|
|
|
|
QByteArray mainSplitterState;
|
2024-01-13 03:47:50 +00:00
|
|
|
QByteArray metatilesSplitterState;
|
2020-09-15 19:57:46 +01:00
|
|
|
QByteArray tilesetEditorGeometry;
|
|
|
|
QByteArray tilesetEditorState;
|
2024-01-13 03:47:50 +00:00
|
|
|
QByteArray tilesetEditorSplitterState;
|
2020-09-16 02:43:52 +01:00
|
|
|
QByteArray paletteEditorGeometry;
|
|
|
|
QByteArray paletteEditorState;
|
2020-09-16 00:03:15 +01:00
|
|
|
QByteArray regionMapEditorGeometry;
|
|
|
|
QByteArray regionMapEditorState;
|
2023-08-29 02:02:52 +01:00
|
|
|
QByteArray projectSettingsEditorGeometry;
|
|
|
|
QByteArray projectSettingsEditorState;
|
2023-09-06 19:45:46 +01:00
|
|
|
QByteArray customScriptsEditorGeometry;
|
|
|
|
QByteArray customScriptsEditorState;
|
2019-01-06 18:53:31 +00:00
|
|
|
int collisionOpacity;
|
2023-12-07 18:45:08 +00:00
|
|
|
int collisionZoom;
|
2019-02-16 20:32:19 +00:00
|
|
|
int metatilesZoom;
|
2024-01-07 21:42:46 +00:00
|
|
|
int tilesetEditorMetatilesZoom;
|
|
|
|
int tilesetEditorTilesZoom;
|
2019-01-09 15:35:34 +00:00
|
|
|
bool showPlayerView;
|
|
|
|
bool showCursorTile;
|
2021-11-08 03:00:20 +00:00
|
|
|
bool showBorder;
|
|
|
|
bool showGrid;
|
2023-12-20 02:21:16 +00:00
|
|
|
bool showTilesetEditorMetatileGrid;
|
|
|
|
bool showTilesetEditorLayerGrid;
|
2020-04-08 05:42:38 +01:00
|
|
|
bool monitorFiles;
|
2022-11-28 19:04:47 +00:00
|
|
|
bool tilesetCheckerboardFill;
|
2019-08-14 23:02:00 +01:00
|
|
|
QString theme;
|
2020-12-01 12:12:32 +00:00
|
|
|
QString textEditorOpenFolder;
|
|
|
|
QString textEditorGotoLine;
|
2023-02-22 16:21:30 +00:00
|
|
|
int paletteEditorBitDepth;
|
2023-12-08 20:13:21 +00:00
|
|
|
int projectSettingsTab;
|
2023-12-19 17:57:45 +00:00
|
|
|
bool warpBehaviorWarningDisabled;
|
2024-01-21 04:02:43 +00:00
|
|
|
bool checkForUpdates;
|
2024-01-24 16:56:04 +00:00
|
|
|
QDateTime lastUpdateCheckTime;
|
2024-02-07 20:35:11 +00:00
|
|
|
QVersionNumber lastUpdateCheckVersion;
|
2024-01-24 16:56:04 +00:00
|
|
|
QMap<QUrl, QDateTime> rateLimitTimes;
|
2018-12-21 15:25:28 +00:00
|
|
|
};
|
|
|
|
|
2018-12-25 20:41:06 +00:00
|
|
|
extern PorymapConfig porymapConfig;
|
|
|
|
|
2018-12-25 21:26:13 +00:00
|
|
|
enum BaseGameVersion {
|
|
|
|
pokeruby,
|
2019-01-09 00:04:41 +00:00
|
|
|
pokefirered,
|
2018-12-25 21:26:13 +00:00
|
|
|
pokeemerald,
|
|
|
|
};
|
|
|
|
|
2023-12-18 07:19:12 +00:00
|
|
|
enum ProjectIdentifier {
|
|
|
|
symbol_facing_directions,
|
|
|
|
symbol_obj_event_gfx_pointers,
|
|
|
|
symbol_pokemon_icon_table,
|
|
|
|
symbol_wild_encounters,
|
2024-01-04 17:22:06 +00:00
|
|
|
symbol_heal_locations_type,
|
2023-12-18 07:19:12 +00:00
|
|
|
symbol_heal_locations,
|
|
|
|
symbol_spawn_points,
|
|
|
|
symbol_spawn_maps,
|
|
|
|
symbol_spawn_npcs,
|
|
|
|
symbol_attribute_table,
|
|
|
|
symbol_tilesets_prefix,
|
|
|
|
define_obj_event_count,
|
|
|
|
define_min_level,
|
|
|
|
define_max_level,
|
|
|
|
define_tiles_primary,
|
|
|
|
define_tiles_total,
|
|
|
|
define_metatiles_primary,
|
|
|
|
define_pals_primary,
|
|
|
|
define_pals_total,
|
|
|
|
define_map_size,
|
|
|
|
define_mask_metatile,
|
|
|
|
define_mask_collision,
|
|
|
|
define_mask_elevation,
|
|
|
|
define_mask_behavior,
|
|
|
|
define_mask_layer,
|
|
|
|
define_attribute_behavior,
|
|
|
|
define_attribute_layer,
|
|
|
|
define_attribute_terrain,
|
|
|
|
define_attribute_encounter,
|
|
|
|
define_metatile_label_prefix,
|
|
|
|
define_heal_locations_prefix,
|
|
|
|
define_spawn_prefix,
|
|
|
|
define_map_prefix,
|
|
|
|
define_map_dynamic,
|
|
|
|
define_map_empty,
|
|
|
|
define_map_section_prefix,
|
|
|
|
define_map_section_empty,
|
|
|
|
define_map_section_count,
|
|
|
|
regex_behaviors,
|
|
|
|
regex_obj_event_gfx,
|
|
|
|
regex_items,
|
|
|
|
regex_flags,
|
|
|
|
regex_vars,
|
|
|
|
regex_movement_types,
|
|
|
|
regex_map_types,
|
|
|
|
regex_battle_scenes,
|
|
|
|
regex_weather,
|
|
|
|
regex_coord_event_weather,
|
|
|
|
regex_secret_bases,
|
|
|
|
regex_sign_facing_directions,
|
|
|
|
regex_trainer_types,
|
|
|
|
regex_music,
|
|
|
|
regex_species,
|
|
|
|
};
|
|
|
|
|
2022-09-01 17:14:47 +01:00
|
|
|
enum ProjectFilePath {
|
|
|
|
data_map_folders,
|
|
|
|
data_scripts_folders,
|
|
|
|
data_layouts_folders,
|
2022-09-27 23:06:43 +01:00
|
|
|
data_tilesets_folders,
|
2022-09-01 17:14:47 +01:00
|
|
|
data_event_scripts,
|
|
|
|
json_map_groups,
|
|
|
|
json_layouts,
|
|
|
|
json_wild_encounters,
|
|
|
|
json_region_map_entries,
|
|
|
|
json_region_porymap_cfg,
|
|
|
|
tilesets_headers,
|
|
|
|
tilesets_graphics,
|
|
|
|
tilesets_metatiles,
|
2022-09-28 01:17:55 +01:00
|
|
|
tilesets_headers_asm,
|
|
|
|
tilesets_graphics_asm,
|
|
|
|
tilesets_metatiles_asm,
|
2022-09-01 17:14:47 +01:00
|
|
|
data_obj_event_gfx_pointers,
|
|
|
|
data_obj_event_gfx_info,
|
|
|
|
data_obj_event_pic_tables,
|
|
|
|
data_obj_event_gfx,
|
|
|
|
data_pokemon_gfx,
|
|
|
|
data_heal_locations,
|
|
|
|
constants_global,
|
|
|
|
constants_map_groups,
|
|
|
|
constants_items,
|
|
|
|
constants_flags,
|
|
|
|
constants_vars,
|
|
|
|
constants_weather,
|
|
|
|
constants_songs,
|
|
|
|
constants_heal_locations,
|
|
|
|
constants_pokemon,
|
|
|
|
constants_map_types,
|
|
|
|
constants_trainer_types,
|
|
|
|
constants_secret_bases,
|
|
|
|
constants_obj_event_movement,
|
|
|
|
constants_obj_events,
|
|
|
|
constants_event_bg,
|
|
|
|
constants_region_map_sections,
|
|
|
|
constants_metatile_labels,
|
|
|
|
constants_metatile_behaviors,
|
2023-12-10 08:49:54 +00:00
|
|
|
constants_species,
|
2022-09-01 17:14:47 +01:00
|
|
|
constants_fieldmap,
|
2023-12-13 07:30:22 +00:00
|
|
|
global_fieldmap,
|
2023-12-15 19:33:36 +00:00
|
|
|
fieldmap,
|
2022-10-24 13:03:51 +01:00
|
|
|
initial_facing_table,
|
|
|
|
pokemon_icon_table,
|
2023-12-10 08:49:54 +00:00
|
|
|
pokemon_gfx,
|
2022-09-01 17:14:47 +01:00
|
|
|
};
|
|
|
|
|
2018-12-25 21:26:13 +00:00
|
|
|
class ProjectConfig: public KeyValueConfigBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ProjectConfig() {
|
2020-04-07 19:44:14 +01:00
|
|
|
reset();
|
|
|
|
}
|
|
|
|
virtual void reset() override {
|
2018-12-25 21:26:13 +00:00
|
|
|
this->baseGameVersion = BaseGameVersion::pokeemerald;
|
2023-08-24 02:07:13 +01:00
|
|
|
// Reset non-version-specific settings
|
2022-10-08 07:18:47 +01:00
|
|
|
this->usePoryScript = false;
|
2020-06-25 06:32:42 +01:00
|
|
|
this->enableTripleLayerMetatiles = false;
|
2023-12-15 19:33:36 +00:00
|
|
|
this->defaultMetatileId = 1;
|
|
|
|
this->defaultElevation = 3;
|
|
|
|
this->defaultCollision = 0;
|
2022-10-24 00:28:55 +01:00
|
|
|
this->defaultPrimaryTileset = "gTileset_General";
|
2022-09-06 02:51:31 +01:00
|
|
|
this->prefabFilepath = QString();
|
2022-09-24 21:28:31 +01:00
|
|
|
this->prefabImportPrompted = false;
|
2022-10-08 07:18:47 +01:00
|
|
|
this->tilesetsHaveCallback = true;
|
|
|
|
this->tilesetsHaveIsCompressed = true;
|
2022-09-01 17:14:47 +01:00
|
|
|
this->filePaths.clear();
|
2023-12-06 21:01:02 +00:00
|
|
|
this->eventIconPaths.clear();
|
2023-12-10 08:49:54 +00:00
|
|
|
this->pokemonIconPaths.clear();
|
2023-12-06 21:01:02 +00:00
|
|
|
this->collisionSheetPath = QString();
|
|
|
|
this->collisionSheetWidth = 2;
|
|
|
|
this->collisionSheetHeight = 16;
|
2023-12-13 00:14:39 +00:00
|
|
|
this->blockMetatileIdMask = 0x03FF;
|
|
|
|
this->blockCollisionMask = 0x0C00;
|
|
|
|
this->blockElevationMask = 0xF000;
|
2023-12-18 07:19:12 +00:00
|
|
|
this->identifiers.clear();
|
2020-05-26 22:01:18 +01:00
|
|
|
this->readKeys.clear();
|
2018-12-25 21:26:13 +00:00
|
|
|
}
|
2023-12-18 07:19:12 +00:00
|
|
|
static const QMap<ProjectIdentifier, QPair<QString, QString>> defaultIdentifiers;
|
2023-12-19 02:07:36 +00:00
|
|
|
static const QMap<ProjectFilePath, QPair<QString, QString>> defaultPaths;
|
2023-08-24 02:07:13 +01:00
|
|
|
static const QStringList versionStrings;
|
|
|
|
void reset(BaseGameVersion baseGameVersion);
|
2018-12-25 21:26:13 +00:00
|
|
|
void setBaseGameVersion(BaseGameVersion baseGameVersion);
|
|
|
|
BaseGameVersion getBaseGameVersion();
|
2021-12-15 04:50:56 +00:00
|
|
|
QString getBaseGameVersionString();
|
2023-08-31 18:47:13 +01:00
|
|
|
QString getBaseGameVersionString(BaseGameVersion version);
|
2023-08-24 02:07:13 +01:00
|
|
|
BaseGameVersion stringToBaseGameVersion(QString string, bool * ok = nullptr);
|
2019-10-22 13:48:41 +01:00
|
|
|
void setUsePoryScript(bool usePoryScript);
|
|
|
|
bool getUsePoryScript();
|
2018-12-25 21:26:13 +00:00
|
|
|
void setProjectDir(QString projectDir);
|
2020-05-08 17:26:23 +01:00
|
|
|
QString getProjectDir();
|
2020-03-13 06:23:47 +00:00
|
|
|
void setUseCustomBorderSize(bool enable);
|
|
|
|
bool getUseCustomBorderSize();
|
2020-05-22 22:51:56 +01:00
|
|
|
void setEventWeatherTriggerEnabled(bool enable);
|
|
|
|
bool getEventWeatherTriggerEnabled();
|
|
|
|
void setEventSecretBaseEnabled(bool enable);
|
|
|
|
bool getEventSecretBaseEnabled();
|
|
|
|
void setHiddenItemQuantityEnabled(bool enable);
|
|
|
|
bool getHiddenItemQuantityEnabled();
|
|
|
|
void setHiddenItemRequiresItemfinderEnabled(bool enable);
|
|
|
|
bool getHiddenItemRequiresItemfinderEnabled();
|
|
|
|
void setHealLocationRespawnDataEnabled(bool enable);
|
|
|
|
bool getHealLocationRespawnDataEnabled();
|
2022-02-06 02:31:54 +00:00
|
|
|
void setEventCloneObjectEnabled(bool enable);
|
|
|
|
bool getEventCloneObjectEnabled();
|
2020-05-22 22:51:56 +01:00
|
|
|
void setFloorNumberEnabled(bool enable);
|
|
|
|
bool getFloorNumberEnabled();
|
2021-02-19 09:04:14 +00:00
|
|
|
void setCreateMapTextFileEnabled(bool enable);
|
|
|
|
bool getCreateMapTextFileEnabled();
|
2020-06-25 06:32:42 +01:00
|
|
|
void setTripleLayerMetatilesEnabled(bool enable);
|
|
|
|
bool getTripleLayerMetatilesEnabled();
|
2022-10-04 02:28:16 +01:00
|
|
|
int getNumLayersInMetatile();
|
|
|
|
int getNumTilesInMetatile();
|
2023-12-15 19:33:36 +00:00
|
|
|
void setDefaultMetatileId(uint16_t metatileId);
|
|
|
|
uint16_t getDefaultMetatileId();
|
2023-12-16 08:36:26 +00:00
|
|
|
void setDefaultElevation(uint16_t elevation);
|
|
|
|
uint16_t getDefaultElevation();
|
|
|
|
void setDefaultCollision(uint16_t collision);
|
|
|
|
uint16_t getDefaultCollision();
|
2023-08-24 02:07:13 +01:00
|
|
|
void setNewMapBorderMetatileIds(QList<uint16_t> metatileIds);
|
|
|
|
QList<uint16_t> getNewMapBorderMetatileIds();
|
2022-10-24 00:28:55 +01:00
|
|
|
QString getDefaultPrimaryTileset();
|
|
|
|
QString getDefaultSecondaryTileset();
|
2023-08-24 02:07:13 +01:00
|
|
|
void setDefaultPrimaryTileset(QString tilesetName);
|
|
|
|
void setDefaultSecondaryTileset(QString tilesetName);
|
2023-12-18 07:19:12 +00:00
|
|
|
void setFilePath(const QString &pathId, const QString &path);
|
|
|
|
void setFilePath(ProjectFilePath pathId, const QString &path);
|
|
|
|
QString getCustomFilePath(ProjectFilePath pathId);
|
|
|
|
QString getCustomFilePath(const QString &pathId);
|
|
|
|
QString getFilePath(ProjectFilePath pathId);
|
|
|
|
void setIdentifier(ProjectIdentifier id, const QString &text);
|
|
|
|
void setIdentifier(const QString &id, const QString &text);
|
|
|
|
QString getCustomIdentifier(ProjectIdentifier id);
|
|
|
|
QString getCustomIdentifier(const QString &id);
|
|
|
|
QString getIdentifier(ProjectIdentifier id);
|
2022-09-06 02:51:31 +01:00
|
|
|
void setPrefabFilepath(QString filepath);
|
2023-08-31 18:47:13 +01:00
|
|
|
QString getPrefabFilepath();
|
2022-09-24 21:28:31 +01:00
|
|
|
void setPrefabImportPrompted(bool prompted);
|
|
|
|
bool getPrefabImportPrompted();
|
2022-10-08 07:18:47 +01:00
|
|
|
void setTilesetsHaveCallback(bool has);
|
|
|
|
bool getTilesetsHaveCallback();
|
|
|
|
void setTilesetsHaveIsCompressed(bool has);
|
|
|
|
bool getTilesetsHaveIsCompressed();
|
2022-10-25 22:51:32 +01:00
|
|
|
int getMetatileAttributesSize();
|
2023-08-24 02:07:13 +01:00
|
|
|
void setMetatileAttributesSize(int size);
|
2022-10-25 22:51:32 +01:00
|
|
|
uint32_t getMetatileBehaviorMask();
|
|
|
|
uint32_t getMetatileTerrainTypeMask();
|
|
|
|
uint32_t getMetatileEncounterTypeMask();
|
|
|
|
uint32_t getMetatileLayerTypeMask();
|
2023-08-24 02:07:13 +01:00
|
|
|
void setMetatileBehaviorMask(uint32_t mask);
|
|
|
|
void setMetatileTerrainTypeMask(uint32_t mask);
|
|
|
|
void setMetatileEncounterTypeMask(uint32_t mask);
|
|
|
|
void setMetatileLayerTypeMask(uint32_t mask);
|
2023-12-13 00:14:39 +00:00
|
|
|
uint16_t getBlockMetatileIdMask();
|
|
|
|
uint16_t getBlockCollisionMask();
|
|
|
|
uint16_t getBlockElevationMask();
|
|
|
|
void setBlockMetatileIdMask(uint16_t mask);
|
|
|
|
void setBlockCollisionMask(uint16_t mask);
|
|
|
|
void setBlockElevationMask(uint16_t mask);
|
2022-10-26 08:56:46 +01:00
|
|
|
bool getMapAllowFlagsEnabled();
|
2023-08-24 02:07:13 +01:00
|
|
|
void setMapAllowFlagsEnabled(bool enabled);
|
2023-12-05 07:01:44 +00:00
|
|
|
void setEventIconPath(Event::Group group, const QString &path);
|
|
|
|
QString getEventIconPath(Event::Group group);
|
2023-12-10 08:49:54 +00:00
|
|
|
void setPokemonIconPath(const QString &species, const QString &path);
|
2023-12-17 01:35:54 +00:00
|
|
|
QString getPokemonIconPath(const QString &species);
|
2023-12-10 08:49:54 +00:00
|
|
|
QHash<QString, QString> getPokemonIconPaths();
|
2023-12-06 21:01:02 +00:00
|
|
|
void setCollisionSheetPath(const QString &path);
|
|
|
|
QString getCollisionSheetPath();
|
|
|
|
void setCollisionSheetWidth(int width);
|
|
|
|
int getCollisionSheetWidth();
|
|
|
|
void setCollisionSheetHeight(int height);
|
|
|
|
int getCollisionSheetHeight();
|
2023-12-22 04:33:36 +00:00
|
|
|
void setWarpBehaviors(const QSet<uint32_t> &behaviors);
|
|
|
|
QSet<uint32_t> getWarpBehaviors();
|
2023-12-05 07:01:44 +00:00
|
|
|
|
2018-12-25 21:26:13 +00:00
|
|
|
protected:
|
2020-04-07 19:44:14 +01:00
|
|
|
virtual QString getConfigFilepath() override;
|
|
|
|
virtual void parseConfigKeyValue(QString key, QString value) override;
|
|
|
|
virtual QMap<QString, QString> getKeyValueMap() override;
|
|
|
|
virtual void onNewConfigFileCreated() override;
|
2020-05-26 22:01:18 +01:00
|
|
|
virtual void setUnreadKeys() override;
|
2018-12-25 21:26:13 +00:00
|
|
|
private:
|
|
|
|
BaseGameVersion baseGameVersion;
|
|
|
|
QString projectDir;
|
2023-12-18 07:19:12 +00:00
|
|
|
QMap<ProjectIdentifier, QString> identifiers;
|
2022-09-01 17:14:47 +01:00
|
|
|
QMap<ProjectFilePath, QString> filePaths;
|
2019-10-22 13:48:41 +01:00
|
|
|
bool usePoryScript;
|
2020-03-13 06:23:47 +00:00
|
|
|
bool useCustomBorderSize;
|
2020-05-22 22:51:56 +01:00
|
|
|
bool enableEventWeatherTrigger;
|
|
|
|
bool enableEventSecretBase;
|
|
|
|
bool enableHiddenItemQuantity;
|
|
|
|
bool enableHiddenItemRequiresItemfinder;
|
|
|
|
bool enableHealLocationRespawnData;
|
2022-02-06 02:31:54 +00:00
|
|
|
bool enableEventCloneObject;
|
2020-05-22 22:51:56 +01:00
|
|
|
bool enableFloorNumber;
|
2021-02-19 09:04:14 +00:00
|
|
|
bool createMapTextFile;
|
2020-06-25 06:32:42 +01:00
|
|
|
bool enableTripleLayerMetatiles;
|
2023-12-15 19:33:36 +00:00
|
|
|
uint16_t defaultMetatileId;
|
|
|
|
uint16_t defaultElevation;
|
|
|
|
uint16_t defaultCollision;
|
2023-08-24 02:07:13 +01:00
|
|
|
QList<uint16_t> newMapBorderMetatileIds;
|
2022-10-24 00:28:55 +01:00
|
|
|
QString defaultPrimaryTileset;
|
|
|
|
QString defaultSecondaryTileset;
|
2020-05-26 22:01:18 +01:00
|
|
|
QStringList readKeys;
|
2022-09-06 02:51:31 +01:00
|
|
|
QString prefabFilepath;
|
2022-09-24 21:28:31 +01:00
|
|
|
bool prefabImportPrompted;
|
2022-10-08 07:18:47 +01:00
|
|
|
bool tilesetsHaveCallback;
|
|
|
|
bool tilesetsHaveIsCompressed;
|
2022-10-25 22:51:32 +01:00
|
|
|
int metatileAttributesSize;
|
|
|
|
uint32_t metatileBehaviorMask;
|
|
|
|
uint32_t metatileTerrainTypeMask;
|
|
|
|
uint32_t metatileEncounterTypeMask;
|
|
|
|
uint32_t metatileLayerTypeMask;
|
2023-12-13 00:14:39 +00:00
|
|
|
uint16_t blockMetatileIdMask;
|
|
|
|
uint16_t blockCollisionMask;
|
|
|
|
uint16_t blockElevationMask;
|
2022-10-26 08:56:46 +01:00
|
|
|
bool enableMapAllowFlags;
|
2023-12-05 07:01:44 +00:00
|
|
|
QMap<Event::Group, QString> eventIconPaths;
|
2023-12-10 08:49:54 +00:00
|
|
|
QHash<QString, QString> pokemonIconPaths;
|
2023-12-06 21:01:02 +00:00
|
|
|
QString collisionSheetPath;
|
|
|
|
int collisionSheetWidth;
|
|
|
|
int collisionSheetHeight;
|
2023-12-22 04:33:36 +00:00
|
|
|
QSet<uint32_t> warpBehaviors;
|
2018-12-25 21:26:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern ProjectConfig projectConfig;
|
|
|
|
|
2022-09-01 05:57:31 +01:00
|
|
|
class UserConfig: public KeyValueConfigBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UserConfig() {
|
|
|
|
reset();
|
|
|
|
}
|
|
|
|
virtual void reset() override {
|
|
|
|
this->recentMap = QString();
|
|
|
|
this->useEncounterJson = true;
|
|
|
|
this->customScripts.clear();
|
|
|
|
this->readKeys.clear();
|
|
|
|
}
|
|
|
|
void setRecentMap(const QString &map);
|
|
|
|
QString getRecentMap();
|
|
|
|
void setEncounterJsonActive(bool active);
|
|
|
|
bool getEncounterJsonActive();
|
|
|
|
void setProjectDir(QString projectDir);
|
|
|
|
QString getProjectDir();
|
2023-09-05 22:02:35 +01:00
|
|
|
void setCustomScripts(QStringList scripts, QList<bool> enabled);
|
|
|
|
QStringList getCustomScriptPaths();
|
|
|
|
QList<bool> getCustomScriptsEnabled();
|
|
|
|
void parseCustomScripts(QString input);
|
|
|
|
QString outputCustomScripts();
|
2022-09-01 05:57:31 +01:00
|
|
|
protected:
|
|
|
|
virtual QString getConfigFilepath() override;
|
|
|
|
virtual void parseConfigKeyValue(QString key, QString value) override;
|
|
|
|
virtual QMap<QString, QString> getKeyValueMap() override;
|
|
|
|
virtual void onNewConfigFileCreated() override;
|
|
|
|
virtual void setUnreadKeys() override;
|
|
|
|
#ifdef CONFIG_BACKWARDS_COMPATABILITY
|
|
|
|
friend class ProjectConfig;
|
|
|
|
#endif
|
|
|
|
private:
|
|
|
|
QString projectDir;
|
|
|
|
QString recentMap;
|
|
|
|
bool useEncounterJson;
|
2023-09-05 22:02:35 +01:00
|
|
|
QMap<QString, bool> customScripts;
|
2022-09-01 05:57:31 +01:00
|
|
|
QStringList readKeys;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern UserConfig userConfig;
|
|
|
|
|
2020-11-01 12:35:20 +00:00
|
|
|
class QAction;
|
2020-11-03 10:58:10 +00:00
|
|
|
class Shortcut;
|
2020-11-01 12:35:20 +00:00
|
|
|
|
|
|
|
class ShortcutsConfig : public KeyValueConfigBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ShortcutsConfig() :
|
2020-11-08 13:36:02 +00:00
|
|
|
user_shortcuts({ }),
|
|
|
|
default_shortcuts({ })
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void reset() override { user_shortcuts.clear(); }
|
|
|
|
|
2020-11-13 04:48:03 +00:00
|
|
|
// Call this before applying user shortcuts so that the user can restore defaults.
|
2020-11-08 13:36:02 +00:00
|
|
|
void setDefaultShortcuts(const QObjectList &objects);
|
|
|
|
QList<QKeySequence> defaultShortcuts(const QObject *object) const;
|
|
|
|
|
|
|
|
void setUserShortcuts(const QObjectList &objects);
|
|
|
|
void setUserShortcuts(const QMultiMap<const QObject *, QKeySequence> &objects_keySequences);
|
|
|
|
QList<QKeySequence> userShortcuts(const QObject *object) const;
|
|
|
|
|
2020-11-01 12:35:20 +00:00
|
|
|
protected:
|
|
|
|
virtual QString getConfigFilepath() override;
|
|
|
|
virtual void parseConfigKeyValue(QString key, QString value) override;
|
|
|
|
virtual QMap<QString, QString> getKeyValueMap() override;
|
2020-11-08 13:36:02 +00:00
|
|
|
virtual void onNewConfigFileCreated() override { };
|
|
|
|
virtual void setUnreadKeys() override { };
|
2020-11-01 12:35:20 +00:00
|
|
|
|
|
|
|
private:
|
2020-11-08 13:36:02 +00:00
|
|
|
QMultiMap<QString, QKeySequence> user_shortcuts;
|
|
|
|
QMultiMap<QString, QKeySequence> default_shortcuts;
|
2020-11-01 12:35:20 +00:00
|
|
|
|
2020-11-05 11:32:31 +00:00
|
|
|
enum StoreType {
|
|
|
|
User,
|
|
|
|
Default
|
|
|
|
};
|
|
|
|
|
2020-11-08 13:36:02 +00:00
|
|
|
QString cfgKey(const QObject *object) const;
|
|
|
|
QList<QKeySequence> currentShortcuts(const QObject *object) const;
|
|
|
|
|
|
|
|
void storeShortcutsFromList(StoreType storeType, const QObjectList &objects);
|
2020-11-05 11:32:31 +00:00
|
|
|
void storeShortcuts(
|
|
|
|
StoreType storeType,
|
|
|
|
const QString &cfgKey,
|
|
|
|
const QList<QKeySequence> &keySequences);
|
2020-11-01 12:35:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern ShortcutsConfig shortcutsConfig;
|
|
|
|
|
2018-12-21 15:25:28 +00:00
|
|
|
#endif // CONFIG_H
|