Add setting to disable/enable map text file creation
This commit is contained in:
parent
80c5f74368
commit
02af128913
4 changed files with 26 additions and 2 deletions
|
@ -44,6 +44,7 @@ determined by this file.
|
||||||
``enable_heal_location_respawn_data``, 1 if ``pokefirered``, project, yes, Adds ``Respawn Map`` and ``Respawn NPC`` to Heal Location events
|
``enable_heal_location_respawn_data``, 1 if ``pokefirered``, project, yes, Adds ``Respawn Map`` and ``Respawn NPC`` to Heal Location events
|
||||||
``enable_object_event_in_connection``, 1 if ``pokefirered``, project, yes, Adds ``In Connection`` to Object events
|
``enable_object_event_in_connection``, 1 if ``pokefirered``, project, yes, Adds ``In Connection`` to Object events
|
||||||
``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
|
||||||
``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)
|
||||||
``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
|
||||||
|
|
||||||
|
|
|
@ -142,6 +142,7 @@ public:
|
||||||
this->enableHealLocationRespawnData = false;
|
this->enableHealLocationRespawnData = false;
|
||||||
this->enableObjectEventInConnection = false;
|
this->enableObjectEventInConnection = false;
|
||||||
this->enableFloorNumber = false;
|
this->enableFloorNumber = false;
|
||||||
|
this->createMapTextFile = false;
|
||||||
this->enableTripleLayerMetatiles = false;
|
this->enableTripleLayerMetatiles = false;
|
||||||
this->customScripts.clear();
|
this->customScripts.clear();
|
||||||
this->readKeys.clear();
|
this->readKeys.clear();
|
||||||
|
@ -172,6 +173,8 @@ public:
|
||||||
bool getObjectEventInConnectionEnabled();
|
bool getObjectEventInConnectionEnabled();
|
||||||
void setFloorNumberEnabled(bool enable);
|
void setFloorNumberEnabled(bool enable);
|
||||||
bool getFloorNumberEnabled();
|
bool getFloorNumberEnabled();
|
||||||
|
void setCreateMapTextFileEnabled(bool enable);
|
||||||
|
bool getCreateMapTextFileEnabled();
|
||||||
void setTripleLayerMetatilesEnabled(bool enable);
|
void setTripleLayerMetatilesEnabled(bool enable);
|
||||||
bool getTripleLayerMetatilesEnabled();
|
bool getTripleLayerMetatilesEnabled();
|
||||||
void setCustomScripts(QList<QString> scripts);
|
void setCustomScripts(QList<QString> scripts);
|
||||||
|
@ -196,6 +199,7 @@ private:
|
||||||
bool enableHealLocationRespawnData;
|
bool enableHealLocationRespawnData;
|
||||||
bool enableObjectEventInConnection;
|
bool enableObjectEventInConnection;
|
||||||
bool enableFloorNumber;
|
bool enableFloorNumber;
|
||||||
|
bool createMapTextFile;
|
||||||
bool enableTripleLayerMetatiles;
|
bool enableTripleLayerMetatiles;
|
||||||
QList<QString> customScripts;
|
QList<QString> customScripts;
|
||||||
QStringList readKeys;
|
QStringList readKeys;
|
||||||
|
|
|
@ -503,6 +503,12 @@ void ProjectConfig::parseConfigKeyValue(QString key, QString value) {
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
logWarn(QString("Invalid config value for enable_floor_number: '%1'. Must be 0 or 1.").arg(value));
|
logWarn(QString("Invalid config value for enable_floor_number: '%1'. Must be 0 or 1.").arg(value));
|
||||||
}
|
}
|
||||||
|
} else if (key == "create_map_text_file") {
|
||||||
|
bool ok;
|
||||||
|
this->createMapTextFile = value.toInt(&ok);
|
||||||
|
if (!ok) {
|
||||||
|
logWarn(QString("Invalid config value for create_map_text_file: '%1'. Must be 0 or 1.").arg(value));
|
||||||
|
}
|
||||||
} else if (key == "enable_triple_layer_metatiles") {
|
} else if (key == "enable_triple_layer_metatiles") {
|
||||||
bool ok;
|
bool ok;
|
||||||
this->enableTripleLayerMetatiles = value.toInt(&ok);
|
this->enableTripleLayerMetatiles = value.toInt(&ok);
|
||||||
|
@ -535,6 +541,7 @@ void ProjectConfig::setUnreadKeys() {
|
||||||
if (!readKeys.contains("enable_heal_location_respawn_data")) this->enableHealLocationRespawnData = isPokefirered;
|
if (!readKeys.contains("enable_heal_location_respawn_data")) this->enableHealLocationRespawnData = isPokefirered;
|
||||||
if (!readKeys.contains("enable_object_event_in_connection")) this->enableObjectEventInConnection = isPokefirered;
|
if (!readKeys.contains("enable_object_event_in_connection")) this->enableObjectEventInConnection = 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, QString> ProjectConfig::getKeyValueMap() {
|
QMap<QString, QString> ProjectConfig::getKeyValueMap() {
|
||||||
|
@ -551,6 +558,7 @@ QMap<QString, QString> ProjectConfig::getKeyValueMap() {
|
||||||
map.insert("enable_heal_location_respawn_data", QString::number(this->enableHealLocationRespawnData));
|
map.insert("enable_heal_location_respawn_data", QString::number(this->enableHealLocationRespawnData));
|
||||||
map.insert("enable_object_event_in_connection", QString::number(this->enableObjectEventInConnection));
|
map.insert("enable_object_event_in_connection", QString::number(this->enableObjectEventInConnection));
|
||||||
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("enable_triple_layer_metatiles", QString::number(this->enableTripleLayerMetatiles));
|
map.insert("enable_triple_layer_metatiles", QString::number(this->enableTripleLayerMetatiles));
|
||||||
map.insert("custom_scripts", this->customScripts.join(","));
|
map.insert("custom_scripts", this->customScripts.join(","));
|
||||||
return map;
|
return map;
|
||||||
|
@ -591,6 +599,7 @@ void ProjectConfig::onNewConfigFileCreated() {
|
||||||
this->enableHealLocationRespawnData = isPokefirered;
|
this->enableHealLocationRespawnData = isPokefirered;
|
||||||
this->enableObjectEventInConnection = isPokefirered;
|
this->enableObjectEventInConnection = isPokefirered;
|
||||||
this->enableFloorNumber = isPokefirered;
|
this->enableFloorNumber = isPokefirered;
|
||||||
|
this->createMapTextFile = (this->baseGameVersion != BaseGameVersion::pokeemerald);
|
||||||
this->useEncounterJson = true;
|
this->useEncounterJson = true;
|
||||||
this->usePoryScript = false;
|
this->usePoryScript = false;
|
||||||
this->enableTripleLayerMetatiles = false;
|
this->enableTripleLayerMetatiles = false;
|
||||||
|
@ -713,6 +722,15 @@ bool ProjectConfig::getFloorNumberEnabled() {
|
||||||
return this->enableFloorNumber;
|
return this->enableFloorNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::setCreateMapTextFileEnabled(bool enable) {
|
||||||
|
this->createMapTextFile = enable;
|
||||||
|
this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProjectConfig::getCreateMapTextFileEnabled() {
|
||||||
|
return this->createMapTextFile;
|
||||||
|
}
|
||||||
|
|
||||||
void ProjectConfig::setTripleLayerMetatilesEnabled(bool enable) {
|
void ProjectConfig::setTripleLayerMetatilesEnabled(bool enable) {
|
||||||
this->enableTripleLayerMetatiles = enable;
|
this->enableTripleLayerMetatiles = enable;
|
||||||
this->save();
|
this->save();
|
||||||
|
|
|
@ -1242,14 +1242,15 @@ void Project::saveMap(Map *map) {
|
||||||
QString text = this->getScriptDefaultString(projectConfig.getUsePoryScript(), map->name);
|
QString text = this->getScriptDefaultString(projectConfig.getUsePoryScript(), map->name);
|
||||||
saveTextFile(root + "/data/maps/" + map->name + "/scripts" + this->getScriptFileExtension(projectConfig.getUsePoryScript()), text);
|
saveTextFile(root + "/data/maps/" + map->name + "/scripts" + this->getScriptFileExtension(projectConfig.getUsePoryScript()), text);
|
||||||
|
|
||||||
if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokeruby || projectConfig.getBaseGameVersion() == BaseGameVersion::pokefirered) {
|
bool usesTextFile = projectConfig.getCreateMapTextFileEnabled();
|
||||||
|
if (usesTextFile) {
|
||||||
// Create file data/maps/<map_name>/text.inc
|
// Create file data/maps/<map_name>/text.inc
|
||||||
saveTextFile(root + "/data/maps/" + map->name + "/text" + this->getScriptFileExtension(projectConfig.getUsePoryScript()), "\n");
|
saveTextFile(root + "/data/maps/" + map->name + "/text" + this->getScriptFileExtension(projectConfig.getUsePoryScript()), "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simply append to data/event_scripts.s.
|
// Simply append to data/event_scripts.s.
|
||||||
text = QString("\n\t.include \"data/maps/%1/scripts.inc\"\n").arg(map->name);
|
text = QString("\n\t.include \"data/maps/%1/scripts.inc\"\n").arg(map->name);
|
||||||
if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokeruby || projectConfig.getBaseGameVersion() == BaseGameVersion::pokefirered) {
|
if (usesTextFile) {
|
||||||
text += QString("\t.include \"data/maps/%1/text.inc\"\n").arg(map->name);
|
text += QString("\t.include \"data/maps/%1/text.inc\"\n").arg(map->name);
|
||||||
}
|
}
|
||||||
appendTextFile(root + "/data/event_scripts.s", text);
|
appendTextFile(root + "/data/event_scripts.s", text);
|
||||||
|
|
Loading…
Reference in a new issue