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 {
|
2023-02-01 15:09:50 +00:00
|
|
|
SortByGroup = 0,
|
|
|
|
SortByArea = 1,
|
|
|
|
SortByLayout = 2,
|
2018-12-21 15:25:28 +00:00
|
|
|
};
|
|
|
|
|
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();
|
|
|
|
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;
|
2024-07-15 21:14:38 +01:00
|
|
|
virtual void init() = 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);
|
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();
|
2024-07-16 21:26:59 +01:00
|
|
|
this->projectManuallyClosed = false;
|
2022-07-04 20:47:03 +01:00
|
|
|
this->reopenOnLaunch = true;
|
2023-02-01 15:09:50 +00:00
|
|
|
this->mapSortOrder = MapSortOrder::SortByGroup;
|
2018-12-25 20:41:06 +00:00
|
|
|
this->prettyCursors = true;
|
2024-08-04 22:39:56 +01:00
|
|
|
this->mirrorConnectingMaps = true;
|
2024-07-24 20:46:20 +01:00
|
|
|
this->showDiveEmergeMaps = false;
|
|
|
|
this->diveEmergeMapOpacity = 30;
|
|
|
|
this->diveMapOpacity = 15;
|
|
|
|
this->emergeMapOpacity = 15;
|
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";
|
2024-08-23 21:00:42 +01:00
|
|
|
this->wildMonChartTheme = "";
|
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);
|
2024-07-15 21:14:38 +01:00
|
|
|
QString getRecentProject();
|
|
|
|
QStringList getRecentProjects();
|
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);
|
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();
|
2024-07-15 21:14:38 +01:00
|
|
|
|
2022-07-04 20:47:03 +01:00
|
|
|
bool reopenOnLaunch;
|
2024-07-16 21:26:59 +01:00
|
|
|
bool projectManuallyClosed;
|
2018-12-25 20:41:06 +00:00
|
|
|
MapSortOrder mapSortOrder;
|
|
|
|
bool prettyCursors;
|
2024-08-04 22:39:56 +01:00
|
|
|
bool mirrorConnectingMaps;
|
2024-07-24 20:46:20 +01:00
|
|
|
bool showDiveEmergeMaps;
|
|
|
|
int diveEmergeMapOpacity;
|
|
|
|
int diveMapOpacity;
|
|
|
|
int emergeMapOpacity;
|
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;
|
2024-08-23 21:00:42 +01:00
|
|
|
QString wildMonChartTheme;
|
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;
|
2024-08-23 21:00:42 +01:00
|
|
|
QByteArray wildMonChartGeometry;
|
2024-07-15 21:14:38 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual QString getConfigFilepath() override;
|
|
|
|
virtual void parseConfigKeyValue(QString key, QString value) override;
|
|
|
|
virtual QMap<QString, QString> getKeyValueMap() override;
|
|
|
|
virtual void init() override {};
|
|
|
|
virtual void setUnreadKeys() override {};
|
|
|
|
|
|
|
|
private:
|
|
|
|
QString stringFromByteArray(QByteArray);
|
|
|
|
QByteArray bytesFromString(QString);
|
|
|
|
|
|
|
|
QStringList recentProjects;
|
|
|
|
QByteArray mainWindowGeometry;
|
|
|
|
QByteArray mainWindowState;
|
|
|
|
QByteArray mapSplitterState;
|
|
|
|
QByteArray mainSplitterState;
|
|
|
|
QByteArray metatilesSplitterState;
|
|
|
|
QByteArray tilesetEditorGeometry;
|
|
|
|
QByteArray tilesetEditorState;
|
|
|
|
QByteArray tilesetEditorSplitterState;
|
|
|
|
QByteArray paletteEditorGeometry;
|
|
|
|
QByteArray paletteEditorState;
|
|
|
|
QByteArray regionMapEditorGeometry;
|
|
|
|
QByteArray regionMapEditorState;
|
|
|
|
QByteArray projectSettingsEditorGeometry;
|
|
|
|
QByteArray projectSettingsEditorState;
|
|
|
|
QByteArray customScriptsEditorGeometry;
|
|
|
|
QByteArray customScriptsEditorState;
|
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 {
|
2024-07-16 02:10:54 +01:00
|
|
|
none,
|
2018-12-25 21:26:13 +00:00
|
|
|
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,
|
2024-08-27 21:14:02 +01:00
|
|
|
define_max_encounter_rate,
|
2023-12-18 07:19:12 +00:00
|
|
|
define_tiles_primary,
|
|
|
|
define_tiles_total,
|
|
|
|
define_metatiles_primary,
|
|
|
|
define_pals_primary,
|
|
|
|
define_pals_total,
|
2024-08-29 17:39:25 +01:00
|
|
|
define_tiles_per_metatile,
|
2023-12-18 07:19:12 +00:00
|
|
|
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,
|
2024-08-22 04:28:33 +01:00
|
|
|
define_species_prefix,
|
2023-12-18 07:19:12 +00:00
|
|
|
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,
|
|
|
|
};
|
|
|
|
|
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,
|
2024-08-27 21:14:02 +01:00
|
|
|
wild_encounter,
|
2022-10-24 13:03:51 +01:00
|
|
|
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;
|
2024-07-15 21:14:38 +01:00
|
|
|
this->tripleLayerMetatilesEnabled = 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;
|
2024-07-16 02:10:54 +01:00
|
|
|
static BaseGameVersion stringToBaseGameVersion(const QString &string);
|
2024-07-15 21:14:38 +01:00
|
|
|
|
2023-08-24 02:07:13 +01:00
|
|
|
void reset(BaseGameVersion baseGameVersion);
|
2023-12-18 07:19:12 +00:00
|
|
|
void setFilePath(ProjectFilePath pathId, const QString &path);
|
2024-07-15 21:14:38 +01:00
|
|
|
void setFilePath(const QString &pathId, const QString &path);
|
2023-12-18 07:19:12 +00:00
|
|
|
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);
|
2024-07-15 21:14:38 +01:00
|
|
|
QString getBaseGameVersionString(BaseGameVersion version);
|
|
|
|
QString getBaseGameVersionString();
|
|
|
|
int getNumLayersInMetatile();
|
|
|
|
int getNumTilesInMetatile();
|
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-05 07:01:44 +00:00
|
|
|
|
2018-12-25 21:26:13 +00:00
|
|
|
BaseGameVersion baseGameVersion;
|
|
|
|
QString projectDir;
|
2019-10-22 13:48:41 +01:00
|
|
|
bool usePoryScript;
|
2020-03-13 06:23:47 +00:00
|
|
|
bool useCustomBorderSize;
|
2024-07-15 21:14:38 +01:00
|
|
|
bool eventWeatherTriggerEnabled;
|
|
|
|
bool eventSecretBaseEnabled;
|
|
|
|
bool hiddenItemQuantityEnabled;
|
|
|
|
bool hiddenItemRequiresItemfinderEnabled;
|
|
|
|
bool healLocationRespawnDataEnabled;
|
|
|
|
bool eventCloneObjectEnabled;
|
|
|
|
bool floorNumberEnabled;
|
|
|
|
bool createMapTextFileEnabled;
|
|
|
|
bool tripleLayerMetatilesEnabled;
|
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;
|
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;
|
2024-07-15 21:14:38 +01:00
|
|
|
bool mapAllowFlagsEnabled;
|
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;
|
2024-07-15 21:14:38 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual QString getConfigFilepath() override;
|
|
|
|
virtual void parseConfigKeyValue(QString key, QString value) override;
|
|
|
|
virtual QMap<QString, QString> getKeyValueMap() override;
|
|
|
|
virtual void init() override;
|
|
|
|
virtual void setUnreadKeys() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QStringList readKeys;
|
|
|
|
QMap<ProjectIdentifier, QString> identifiers;
|
|
|
|
QMap<ProjectFilePath, QString> filePaths;
|
|
|
|
QMap<Event::Group, QString> eventIconPaths;
|
|
|
|
QHash<QString, QString> pokemonIconPaths;
|
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();
|
2023-02-22 20:41:29 +00:00
|
|
|
this->recentLayout = QString();
|
2022-09-01 05:57:31 +01:00
|
|
|
this->useEncounterJson = true;
|
|
|
|
this->customScripts.clear();
|
|
|
|
this->readKeys.clear();
|
|
|
|
}
|
2024-07-15 21:14:38 +01:00
|
|
|
void parseCustomScripts(QString input);
|
|
|
|
QString outputCustomScripts();
|
2023-09-05 22:02:35 +01:00
|
|
|
void setCustomScripts(QStringList scripts, QList<bool> enabled);
|
|
|
|
QStringList getCustomScriptPaths();
|
|
|
|
QList<bool> getCustomScriptsEnabled();
|
2024-07-15 21:14:38 +01:00
|
|
|
|
|
|
|
QString projectDir;
|
|
|
|
QString recentMap;
|
2024-09-24 16:31:06 +01:00
|
|
|
QString recentLayout;
|
2024-07-15 21:14:38 +01:00
|
|
|
bool useEncounterJson;
|
|
|
|
|
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;
|
2024-07-15 21:14:38 +01:00
|
|
|
virtual void init() override;
|
2022-09-01 05:57:31 +01:00
|
|
|
virtual void setUnreadKeys() override;
|
|
|
|
#ifdef CONFIG_BACKWARDS_COMPATABILITY
|
|
|
|
friend class ProjectConfig;
|
2024-07-15 21:14:38 +01:00
|
|
|
#endif
|
|
|
|
|
2022-09-01 05:57:31 +01:00
|
|
|
private:
|
|
|
|
QStringList readKeys;
|
2024-07-15 21:14:38 +01:00
|
|
|
QMap<QString, bool> customScripts;
|
2022-09-01 05:57:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
2024-07-15 21:14:38 +01:00
|
|
|
virtual void init() override { };
|
2020-11-08 13:36:02 +00:00
|
|
|
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
|