Add new map config options
This commit is contained in:
parent
ce4d8bfc54
commit
089e214d2e
4 changed files with 127 additions and 50 deletions
|
@ -47,6 +47,9 @@ determined by this file.
|
||||||
``enable_floor_number``, 1 if ``pokefirered``, project, yes, Adds ``Floor Number`` to map headers
|
``enable_floor_number``, 1 if ``pokefirered``, project, yes, Adds ``Floor Number`` to map headers
|
||||||
``create_map_text_file``, 1 if not ``pokeemerald``, project, yes, A ``text.inc`` or ``text.pory`` file will be created for any new map
|
``create_map_text_file``, 1 if not ``pokeemerald``, project, yes, A ``text.inc`` or ``text.pory`` file will be created for any new map
|
||||||
``enable_triple_layer_metatiles``, 0, project, yes, Enables triple-layer metatiles (See https://github.com/pret/pokeemerald/wiki/Triple-layer-metatiles)
|
``enable_triple_layer_metatiles``, 0, project, yes, Enables triple-layer metatiles (See https://github.com/pret/pokeemerald/wiki/Triple-layer-metatiles)
|
||||||
|
``new_map_metatile``, 1, project, yes, The metatile id that will be used to fill new maps
|
||||||
|
``new_map_elevation``, 3, project, yes, The elevation that will be used to fill new maps
|
||||||
|
``new_map_border_metatiles``, "``468,469,476,477`` or ``20,21,28,29``", project, yes, The list of metatile ids that will be used to fill the 2x2 border of new maps
|
||||||
``custom_scripts``, , project, yes, A list of script files to load into the scripting engine
|
``custom_scripts``, , project, yes, A list of script files to load into the scripting engine
|
||||||
``prefabs_filepath``, ``<project_root>/prefabs.json``, project, yes, The filepath containing prefab JSON data
|
``prefabs_filepath``, ``<project_root>/prefabs.json``, project, yes, The filepath containing prefab JSON data
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
#include <QMultiMap>
|
#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})
|
||||||
|
|
||||||
enum MapSortOrder {
|
enum MapSortOrder {
|
||||||
Group = 0,
|
Group = 0,
|
||||||
Area = 1,
|
Area = 1,
|
||||||
|
@ -28,7 +32,8 @@ protected:
|
||||||
virtual QMap<QString, QString> getKeyValueMap() = 0;
|
virtual QMap<QString, QString> getKeyValueMap() = 0;
|
||||||
virtual void onNewConfigFileCreated() = 0;
|
virtual void onNewConfigFileCreated() = 0;
|
||||||
virtual void setUnreadKeys() = 0;
|
virtual void setUnreadKeys() = 0;
|
||||||
void setConfigBool(QString key, bool * field, QString value);
|
bool getConfigBool(QString key, QString value);
|
||||||
|
int getConfigInteger(QString key, QString value, int min, int max, int defaultValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
class PorymapConfig: public KeyValueConfigBase
|
class PorymapConfig: public KeyValueConfigBase
|
||||||
|
@ -157,6 +162,9 @@ public:
|
||||||
this->enableFloorNumber = false;
|
this->enableFloorNumber = false;
|
||||||
this->createMapTextFile = false;
|
this->createMapTextFile = false;
|
||||||
this->enableTripleLayerMetatiles = false;
|
this->enableTripleLayerMetatiles = false;
|
||||||
|
this->newMapMetatileId = 1;
|
||||||
|
this->newMapElevation = 3;
|
||||||
|
this->newMapBorderMetatileIds = DEFAULT_BORDER_RSE;
|
||||||
this->prefabFilepath = QString();
|
this->prefabFilepath = QString();
|
||||||
this->customScripts.clear();
|
this->customScripts.clear();
|
||||||
this->readKeys.clear();
|
this->readKeys.clear();
|
||||||
|
@ -192,6 +200,12 @@ public:
|
||||||
bool getCreateMapTextFileEnabled();
|
bool getCreateMapTextFileEnabled();
|
||||||
void setTripleLayerMetatilesEnabled(bool enable);
|
void setTripleLayerMetatilesEnabled(bool enable);
|
||||||
bool getTripleLayerMetatilesEnabled();
|
bool getTripleLayerMetatilesEnabled();
|
||||||
|
void setNewMapMetatileId(int metatileId);
|
||||||
|
int getNewMapMetatileId();
|
||||||
|
void setNewMapElevation(int elevation);
|
||||||
|
int getNewMapElevation();
|
||||||
|
void setNewMapBorderMetatileIds(QList<int> metatileIds);
|
||||||
|
QList<int> getNewMapBorderMetatileIds();
|
||||||
void setCustomScripts(QList<QString> scripts);
|
void setCustomScripts(QList<QString> scripts);
|
||||||
QList<QString> getCustomScripts();
|
QList<QString> getCustomScripts();
|
||||||
void setPrefabFilepath(QString filepath);
|
void setPrefabFilepath(QString filepath);
|
||||||
|
@ -218,6 +232,9 @@ private:
|
||||||
bool enableFloorNumber;
|
bool enableFloorNumber;
|
||||||
bool createMapTextFile;
|
bool createMapTextFile;
|
||||||
bool enableTripleLayerMetatiles;
|
bool enableTripleLayerMetatiles;
|
||||||
|
int newMapMetatileId;
|
||||||
|
int newMapElevation;
|
||||||
|
QList<int> newMapBorderMetatileIds;
|
||||||
QList<QString> customScripts;
|
QList<QString> customScripts;
|
||||||
QStringList readKeys;
|
QStringList readKeys;
|
||||||
QString prefabFilepath;
|
QString prefabFilepath;
|
||||||
|
|
125
src/config.cpp
125
src/config.cpp
|
@ -1,6 +1,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "shortcut.h"
|
#include "shortcut.h"
|
||||||
|
#include "map.h"
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
|
@ -79,12 +80,23 @@ void KeyValueConfigBase::save() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyValueConfigBase::setConfigBool(QString key, bool * field, QString value) {
|
bool KeyValueConfigBase::getConfigBool(QString key, QString value) {
|
||||||
bool ok;
|
bool ok;
|
||||||
*field = value.toInt(&ok);
|
int result = value.toInt(&ok);
|
||||||
if (!ok) {
|
if (!ok || (result != 0 && result != 1)) {
|
||||||
logWarn(QString("Invalid config value for %1: '%2'. Must be 0 or 1.").arg(key).arg(value));
|
logWarn(QString("Invalid config value for %1: '%2'. Must be 0 or 1.").arg(key).arg(value));
|
||||||
}
|
}
|
||||||
|
return (result != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int KeyValueConfigBase::getConfigInteger(QString key, QString value, int min, int max, int defaultValue) {
|
||||||
|
bool ok;
|
||||||
|
int result = value.toInt(&ok);
|
||||||
|
if (!ok) {
|
||||||
|
logWarn(QString("Invalid config value for %1: '%2'. Must be an integer.").arg(key).arg(value));
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
return qMin(max, qMax(min, result));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QMap<MapSortOrder, QString> mapSortOrderMap = {
|
const QMap<MapSortOrder, QString> mapSortOrderMap = {
|
||||||
|
@ -117,9 +129,9 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) {
|
||||||
if (key == "recent_project") {
|
if (key == "recent_project") {
|
||||||
this->recentProject = value;
|
this->recentProject = value;
|
||||||
} else if (key == "reopen_on_launch") {
|
} else if (key == "reopen_on_launch") {
|
||||||
setConfigBool(key, &this->reopenOnLaunch, value);
|
this->reopenOnLaunch = getConfigBool(key, value);
|
||||||
} else if (key == "pretty_cursors") {
|
} else if (key == "pretty_cursors") {
|
||||||
setConfigBool(key, &this->prettyCursors, value);
|
this->prettyCursors = getConfigBool(key, value);
|
||||||
} else if (key == "map_sort_order") {
|
} else if (key == "map_sort_order") {
|
||||||
QString sortOrder = value.toLower();
|
QString sortOrder = value.toLower();
|
||||||
if (mapSortOrderReverseMap.contains(sortOrder)) {
|
if (mapSortOrderReverseMap.contains(sortOrder)) {
|
||||||
|
@ -137,12 +149,7 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) {
|
||||||
} else if (key == "main_splitter_state") {
|
} else if (key == "main_splitter_state") {
|
||||||
this->mainSplitterState = bytesFromString(value);
|
this->mainSplitterState = bytesFromString(value);
|
||||||
} else if (key == "collision_opacity") {
|
} else if (key == "collision_opacity") {
|
||||||
bool ok;
|
this->collisionOpacity = getConfigInteger(key, value, 0, 100, 50);
|
||||||
this->collisionOpacity = qMax(0, qMin(100, value.toInt(&ok)));
|
|
||||||
if (!ok) {
|
|
||||||
logWarn(QString("Invalid config value for collision_opacity: '%1'. Must be an integer.").arg(value));
|
|
||||||
this->collisionOpacity = 50;
|
|
||||||
}
|
|
||||||
} else if (key == "tileset_editor_geometry") {
|
} else if (key == "tileset_editor_geometry") {
|
||||||
this->tilesetEditorGeometry = bytesFromString(value);
|
this->tilesetEditorGeometry = bytesFromString(value);
|
||||||
} else if (key == "tileset_editor_state") {
|
} else if (key == "tileset_editor_state") {
|
||||||
|
@ -156,22 +163,17 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) {
|
||||||
} else if (key == "region_map_editor_state") {
|
} else if (key == "region_map_editor_state") {
|
||||||
this->regionMapEditorState = bytesFromString(value);
|
this->regionMapEditorState = bytesFromString(value);
|
||||||
} else if (key == "metatiles_zoom") {
|
} else if (key == "metatiles_zoom") {
|
||||||
bool ok;
|
this->metatilesZoom = getConfigInteger(key, value, 10, 100, 30);
|
||||||
this->metatilesZoom = qMax(10, qMin(100, value.toInt(&ok)));
|
|
||||||
if (!ok) {
|
|
||||||
logWarn(QString("Invalid config value for metatiles_zoom: '%1'. Must be an integer.").arg(value));
|
|
||||||
this->metatilesZoom = 30;
|
|
||||||
}
|
|
||||||
} else if (key == "show_player_view") {
|
} else if (key == "show_player_view") {
|
||||||
setConfigBool(key, &this->showPlayerView, value);
|
this->showPlayerView = getConfigBool(key, value);
|
||||||
} else if (key == "show_cursor_tile") {
|
} else if (key == "show_cursor_tile") {
|
||||||
setConfigBool(key, &this->showCursorTile, value);
|
this->showCursorTile = getConfigBool(key, value);
|
||||||
} else if (key == "show_border") {
|
} else if (key == "show_border") {
|
||||||
setConfigBool(key, &this->showBorder, value);
|
this->showBorder = getConfigBool(key, value);
|
||||||
} else if (key == "show_grid") {
|
} else if (key == "show_grid") {
|
||||||
setConfigBool(key, &this->showGrid, value);
|
this->showGrid = getConfigBool(key, value);
|
||||||
} else if (key == "monitor_files") {
|
} else if (key == "monitor_files") {
|
||||||
setConfigBool(key, &this->monitorFiles, value);
|
this->monitorFiles = getConfigBool(key, value);
|
||||||
} else if (key == "region_map_dimensions") {
|
} else if (key == "region_map_dimensions") {
|
||||||
bool ok1, ok2;
|
bool ok1, ok2;
|
||||||
QStringList dims = value.split("x");
|
QStringList dims = value.split("x");
|
||||||
|
@ -471,29 +473,47 @@ void ProjectConfig::parseConfigKeyValue(QString key, QString value) {
|
||||||
} else if (key == "recent_map") {
|
} else if (key == "recent_map") {
|
||||||
this->recentMap = value;
|
this->recentMap = value;
|
||||||
} else if (key == "use_encounter_json") {
|
} else if (key == "use_encounter_json") {
|
||||||
setConfigBool(key, &this->useEncounterJson, value);
|
this->useEncounterJson = getConfigBool(key, value);
|
||||||
} else if (key == "use_poryscript") {
|
} else if (key == "use_poryscript") {
|
||||||
setConfigBool(key, &this->usePoryScript, value);
|
this->usePoryScript = getConfigBool(key, value);
|
||||||
} else if (key == "use_custom_border_size") {
|
} else if (key == "use_custom_border_size") {
|
||||||
setConfigBool(key, &this->useCustomBorderSize, value);
|
this->useCustomBorderSize = getConfigBool(key, value);
|
||||||
} else if (key == "enable_event_weather_trigger") {
|
} else if (key == "enable_event_weather_trigger") {
|
||||||
setConfigBool(key, &this->enableEventWeatherTrigger, value);
|
this->enableEventWeatherTrigger = getConfigBool(key, value);
|
||||||
} else if (key == "enable_event_secret_base") {
|
} else if (key == "enable_event_secret_base") {
|
||||||
setConfigBool(key, &this->enableEventSecretBase, value);
|
this->enableEventSecretBase = getConfigBool(key, value);
|
||||||
} else if (key == "enable_hidden_item_quantity") {
|
} else if (key == "enable_hidden_item_quantity") {
|
||||||
setConfigBool(key, &this->enableHiddenItemQuantity, value);
|
this->enableHiddenItemQuantity = getConfigBool(key, value);
|
||||||
} else if (key == "enable_hidden_item_requires_itemfinder") {
|
} else if (key == "enable_hidden_item_requires_itemfinder") {
|
||||||
setConfigBool(key, &this->enableHiddenItemRequiresItemfinder, value);
|
this->enableHiddenItemRequiresItemfinder = getConfigBool(key, value);
|
||||||
} else if (key == "enable_heal_location_respawn_data") {
|
} else if (key == "enable_heal_location_respawn_data") {
|
||||||
setConfigBool(key, &this->enableHealLocationRespawnData, value);
|
this->enableHealLocationRespawnData = getConfigBool(key, value);
|
||||||
} else if (key == "enable_event_clone_object") {
|
} else if (key == "enable_event_clone_object") {
|
||||||
setConfigBool(key, &this->enableEventCloneObject, value);
|
this->enableEventCloneObject = getConfigBool(key, value);
|
||||||
} else if (key == "enable_floor_number") {
|
} else if (key == "enable_floor_number") {
|
||||||
setConfigBool(key, &this->enableFloorNumber, value);
|
this->enableFloorNumber = getConfigBool(key, value);
|
||||||
} else if (key == "create_map_text_file") {
|
} else if (key == "create_map_text_file") {
|
||||||
setConfigBool(key, &this->createMapTextFile, value);
|
this->createMapTextFile = getConfigBool(key, value);
|
||||||
} else if (key == "enable_triple_layer_metatiles") {
|
} else if (key == "enable_triple_layer_metatiles") {
|
||||||
setConfigBool(key, &this->enableTripleLayerMetatiles, value);
|
this->enableTripleLayerMetatiles = getConfigBool(key, value);
|
||||||
|
} else if (key == "new_map_metatile") {
|
||||||
|
this->newMapMetatileId = getConfigInteger(key, value, 0, 1023, 0);
|
||||||
|
} else if (key == "new_map_elevation") {
|
||||||
|
this->newMapElevation = getConfigInteger(key, value, 0, 15, 3);
|
||||||
|
} else if (key == "new_map_border_metatiles") {
|
||||||
|
this->newMapBorderMetatileIds.clear();
|
||||||
|
QList<QString> metatileIds = value.split(",");
|
||||||
|
const int maxSize = DEFAULT_BORDER_WIDTH * DEFAULT_BORDER_HEIGHT;
|
||||||
|
const int size = qMin(metatileIds.size(), maxSize);
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < size; i++) {
|
||||||
|
int metatileId = getConfigInteger(key, metatileIds.at(i), 0, 1023, 0);
|
||||||
|
this->newMapBorderMetatileIds.append(metatileId);
|
||||||
|
}
|
||||||
|
for (; i < maxSize; i++) {
|
||||||
|
// Set any metatiles not provided to 0
|
||||||
|
this->newMapBorderMetatileIds.append(0);
|
||||||
|
}
|
||||||
} else if (key == "custom_scripts") {
|
} else if (key == "custom_scripts") {
|
||||||
this->customScripts.clear();
|
this->customScripts.clear();
|
||||||
QList<QString> paths = value.split(",");
|
QList<QString> paths = value.split(",");
|
||||||
|
@ -523,6 +543,7 @@ void ProjectConfig::setUnreadKeys() {
|
||||||
if (!readKeys.contains("enable_event_clone_object")) this->enableEventCloneObject = isPokefirered;
|
if (!readKeys.contains("enable_event_clone_object")) this->enableEventCloneObject = isPokefirered;
|
||||||
if (!readKeys.contains("enable_floor_number")) this->enableFloorNumber = isPokefirered;
|
if (!readKeys.contains("enable_floor_number")) this->enableFloorNumber = isPokefirered;
|
||||||
if (!readKeys.contains("create_map_text_file")) this->createMapTextFile = (this->baseGameVersion != BaseGameVersion::pokeemerald);
|
if (!readKeys.contains("create_map_text_file")) this->createMapTextFile = (this->baseGameVersion != BaseGameVersion::pokeemerald);
|
||||||
|
if (!readKeys.contains("new_map_border_metatiles")) this->newMapBorderMetatileIds = isPokefirered ? DEFAULT_BORDER_FRLG : DEFAULT_BORDER_RSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, QString> ProjectConfig::getKeyValueMap() {
|
QMap<QString, QString> ProjectConfig::getKeyValueMap() {
|
||||||
|
@ -541,6 +562,12 @@ QMap<QString, QString> ProjectConfig::getKeyValueMap() {
|
||||||
map.insert("enable_floor_number", QString::number(this->enableFloorNumber));
|
map.insert("enable_floor_number", QString::number(this->enableFloorNumber));
|
||||||
map.insert("create_map_text_file", QString::number(this->createMapTextFile));
|
map.insert("create_map_text_file", QString::number(this->createMapTextFile));
|
||||||
map.insert("enable_triple_layer_metatiles", QString::number(this->enableTripleLayerMetatiles));
|
map.insert("enable_triple_layer_metatiles", QString::number(this->enableTripleLayerMetatiles));
|
||||||
|
map.insert("new_map_metatile", QString::number(this->newMapMetatileId));
|
||||||
|
map.insert("new_map_elevation", QString::number(this->newMapElevation));
|
||||||
|
QStringList metatiles;
|
||||||
|
for (auto metatile : this->newMapBorderMetatileIds)
|
||||||
|
metatiles << QString::number(metatile);
|
||||||
|
map.insert("new_map_border_metatiles", metatiles.join(","));
|
||||||
map.insert("custom_scripts", this->customScripts.join(","));
|
map.insert("custom_scripts", this->customScripts.join(","));
|
||||||
map.insert("prefabs_filepath", this->prefabFilepath);
|
map.insert("prefabs_filepath", this->prefabFilepath);
|
||||||
return map;
|
return map;
|
||||||
|
@ -585,6 +612,9 @@ void ProjectConfig::onNewConfigFileCreated() {
|
||||||
this->useEncounterJson = true;
|
this->useEncounterJson = true;
|
||||||
this->usePoryScript = false;
|
this->usePoryScript = false;
|
||||||
this->enableTripleLayerMetatiles = false;
|
this->enableTripleLayerMetatiles = false;
|
||||||
|
this->newMapMetatileId = 1;
|
||||||
|
this->newMapElevation = 3;
|
||||||
|
this->newMapBorderMetatileIds = isPokefirered ? DEFAULT_BORDER_FRLG : DEFAULT_BORDER_RSE;
|
||||||
this->customScripts.clear();
|
this->customScripts.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -726,6 +756,33 @@ bool ProjectConfig::getTripleLayerMetatilesEnabled() {
|
||||||
return this->enableTripleLayerMetatiles;
|
return this->enableTripleLayerMetatiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::setNewMapMetatileId(int metatileId) {
|
||||||
|
this->newMapMetatileId = metatileId;
|
||||||
|
this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProjectConfig::getNewMapMetatileId() {
|
||||||
|
return this->newMapMetatileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::setNewMapElevation(int elevation) {
|
||||||
|
this->newMapElevation = elevation;
|
||||||
|
this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProjectConfig::getNewMapElevation() {
|
||||||
|
return this->newMapElevation;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::setNewMapBorderMetatileIds(QList<int> metatileIds) {
|
||||||
|
this->newMapBorderMetatileIds = metatileIds;
|
||||||
|
this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<int> ProjectConfig::getNewMapBorderMetatileIds() {
|
||||||
|
return this->newMapBorderMetatileIds;
|
||||||
|
}
|
||||||
|
|
||||||
void ProjectConfig::setCustomScripts(QList<QString> scripts) {
|
void ProjectConfig::setCustomScripts(QList<QString> scripts) {
|
||||||
this->customScripts = scripts;
|
this->customScripts = scripts;
|
||||||
this->save();
|
this->save();
|
||||||
|
|
|
@ -1179,11 +1179,14 @@ bool Project::loadBlockdata(MapLayout *layout) {
|
||||||
|
|
||||||
void Project::setNewMapBlockdata(Map *map) {
|
void Project::setNewMapBlockdata(Map *map) {
|
||||||
map->layout->blockdata.clear();
|
map->layout->blockdata.clear();
|
||||||
for (int i = 0; i < map->getWidth() * map->getHeight(); i++) {
|
int width = map->getWidth();
|
||||||
map->layout->blockdata.append(qint16(0x3001));
|
int height = map->getHeight();
|
||||||
|
Block block(projectConfig.getNewMapMetatileId(), 0, projectConfig.getNewMapElevation());
|
||||||
|
for (int i = 0; i < width * height; i++) {
|
||||||
|
map->layout->blockdata.append(block);
|
||||||
}
|
}
|
||||||
map->layout->lastCommitBlocks.blocks = map->layout->blockdata;
|
map->layout->lastCommitBlocks.blocks = map->layout->blockdata;
|
||||||
map->layout->lastCommitBlocks.mapDimensions = QSize(map->getWidth(), map->getHeight());
|
map->layout->lastCommitBlocks.mapDimensions = QSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Project::loadLayoutBorder(MapLayout *layout) {
|
bool Project::loadLayoutBorder(MapLayout *layout) {
|
||||||
|
@ -1204,23 +1207,20 @@ bool Project::loadLayoutBorder(MapLayout *layout) {
|
||||||
|
|
||||||
void Project::setNewMapBorder(Map *map) {
|
void Project::setNewMapBorder(Map *map) {
|
||||||
map->layout->border.clear();
|
map->layout->border.clear();
|
||||||
if (map->getBorderWidth() != DEFAULT_BORDER_WIDTH || map->getBorderHeight() != DEFAULT_BORDER_HEIGHT) {
|
int width = map->getBorderWidth();
|
||||||
for (int i = 0; i < map->getBorderWidth() * map->getBorderHeight(); i++) {
|
int height = map->getBorderHeight();
|
||||||
|
if (width != DEFAULT_BORDER_WIDTH || height != DEFAULT_BORDER_HEIGHT) {
|
||||||
|
for (int i = 0; i < width * height; i++) {
|
||||||
map->layout->border.append(0);
|
map->layout->border.append(0);
|
||||||
}
|
}
|
||||||
} else if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokefirered) {
|
|
||||||
map->layout->border.append(qint16(0x0014));
|
|
||||||
map->layout->border.append(qint16(0x0015));
|
|
||||||
map->layout->border.append(qint16(0x001C));
|
|
||||||
map->layout->border.append(qint16(0x001D));
|
|
||||||
} else {
|
} else {
|
||||||
map->layout->border.append(qint16(0x01D4));
|
QList<int> metatileIds = projectConfig.getNewMapBorderMetatileIds();
|
||||||
map->layout->border.append(qint16(0x01D5));
|
for (int i = 0; i < DEFAULT_BORDER_WIDTH * DEFAULT_BORDER_HEIGHT; i++) {
|
||||||
map->layout->border.append(qint16(0x01DC));
|
map->layout->border.append(qint16(metatileIds.at(i)));
|
||||||
map->layout->border.append(qint16(0x01DD));
|
}
|
||||||
}
|
}
|
||||||
map->layout->lastCommitBlocks.border = map->layout->border;
|
map->layout->lastCommitBlocks.border = map->layout->border;
|
||||||
map->layout->lastCommitBlocks.borderDimensions = QSize(map->getBorderWidth(), map->getBorderHeight());
|
map->layout->lastCommitBlocks.borderDimensions = QSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::saveLayoutBorder(Map *map) {
|
void Project::saveLayoutBorder(Map *map) {
|
||||||
|
|
Loading…
Reference in a new issue