Validate remaining data loads, and fix duplicating combobox data
This commit is contained in:
parent
a152404ce8
commit
8a4456f7b0
3 changed files with 190 additions and 73 deletions
|
@ -89,13 +89,13 @@ public:
|
||||||
QString readMapLayoutId(QString map_name);
|
QString readMapLayoutId(QString map_name);
|
||||||
QString readMapLocation(QString map_name);
|
QString readMapLocation(QString map_name);
|
||||||
|
|
||||||
void readWildMonData();
|
bool readWildMonData();
|
||||||
QMap<QString, QMap<QString, WildPokemonHeader>> wildMonData;
|
QMap<QString, QMap<QString, WildPokemonHeader>> wildMonData;
|
||||||
QVector<EncounterField> wildMonFields;
|
QVector<EncounterField> wildMonFields;
|
||||||
QVector<QString> encounterGroupLabels;
|
QVector<QString> encounterGroupLabels;
|
||||||
QMap<QString, QJsonObject> extraEncounterGroups;
|
QMap<QString, QJsonObject> extraEncounterGroups;
|
||||||
|
|
||||||
void readSpeciesIconPaths();
|
bool readSpeciesIconPaths();
|
||||||
QMap<QString, QString> speciesToIconPath;
|
QMap<QString, QString> speciesToIconPath;
|
||||||
|
|
||||||
QMap<QString, bool> getTopLevelMapFields();
|
QMap<QString, bool> getTopLevelMapFields();
|
||||||
|
@ -129,22 +129,22 @@ public:
|
||||||
QStringList getSongNames();
|
QStringList getSongNames();
|
||||||
QStringList getVisibilities();
|
QStringList getVisibilities();
|
||||||
QMap<QString, QStringList> getTilesetLabels();
|
QMap<QString, QStringList> getTilesetLabels();
|
||||||
void readTilesetProperties();
|
bool readTilesetProperties();
|
||||||
bool readRegionMapSections();
|
bool readRegionMapSections();
|
||||||
void readItemNames();
|
bool readItemNames();
|
||||||
void readFlagNames();
|
bool readFlagNames();
|
||||||
void readVarNames();
|
bool readVarNames();
|
||||||
void readMovementTypes();
|
bool readMovementTypes();
|
||||||
void readInitialFacingDirections();
|
bool readInitialFacingDirections();
|
||||||
void readMapTypes();
|
bool readMapTypes();
|
||||||
void readMapBattleScenes();
|
bool readMapBattleScenes();
|
||||||
void readWeatherNames();
|
bool readWeatherNames();
|
||||||
void readCoordEventWeatherNames();
|
bool readCoordEventWeatherNames();
|
||||||
void readSecretBaseIds();
|
bool readSecretBaseIds();
|
||||||
void readBgEventFacingDirections();
|
bool readBgEventFacingDirections();
|
||||||
void readMetatileBehaviors();
|
bool readMetatileBehaviors();
|
||||||
void readHealLocations();
|
bool readHealLocations();
|
||||||
void readMiscellaneousConstants();
|
bool readMiscellaneousConstants();
|
||||||
|
|
||||||
void loadEventPixmaps(QList<Event*> objects);
|
void loadEventPixmaps(QList<Event*> objects);
|
||||||
QMap<QString, int> getEventObjGfxConstants();
|
QMap<QString, int> getEventObjGfxConstants();
|
||||||
|
|
|
@ -598,37 +598,48 @@ void MainWindow::on_checkBox_AllowEscapeRope_clicked(bool checked)
|
||||||
bool MainWindow::loadDataStructures() {
|
bool MainWindow::loadDataStructures() {
|
||||||
Project *project = editor->project;
|
Project *project = editor->project;
|
||||||
bool success = project->readMapLayouts()
|
bool success = project->readMapLayouts()
|
||||||
&& project->readRegionMapSections();
|
&& project->readRegionMapSections()
|
||||||
|
&& project->readItemNames()
|
||||||
|
&& project->readFlagNames()
|
||||||
|
&& project->readVarNames()
|
||||||
|
&& project->readMovementTypes()
|
||||||
|
&& project->readInitialFacingDirections()
|
||||||
|
&& project->readMapTypes()
|
||||||
|
&& project->readMapBattleScenes()
|
||||||
|
&& project->readWeatherNames()
|
||||||
|
&& project->readCoordEventWeatherNames()
|
||||||
|
&& project->readSecretBaseIds()
|
||||||
|
&& project->readBgEventFacingDirections()
|
||||||
|
&& project->readMetatileBehaviors()
|
||||||
|
&& project->readTilesetProperties()
|
||||||
|
&& project->readHealLocations()
|
||||||
|
&& project->readMiscellaneousConstants()
|
||||||
|
&& project->readSpeciesIconPaths()
|
||||||
|
&& project->readWildMonData();
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
project->readItemNames();
|
|
||||||
project->readFlagNames();
|
|
||||||
project->readVarNames();
|
|
||||||
project->readMovementTypes();
|
|
||||||
project->readInitialFacingDirections();
|
|
||||||
project->readMapTypes();
|
|
||||||
project->readMapBattleScenes();
|
|
||||||
project->readWeatherNames();
|
|
||||||
project->readCoordEventWeatherNames();
|
|
||||||
project->readSecretBaseIds();
|
|
||||||
project->readBgEventFacingDirections();
|
|
||||||
project->readMetatileBehaviors();
|
|
||||||
project->readTilesetProperties();
|
|
||||||
project->readHealLocations();
|
|
||||||
project->readMiscellaneousConstants();
|
|
||||||
project->readSpeciesIconPaths();
|
|
||||||
project->readWildMonData();
|
|
||||||
|
|
||||||
// set up project ui comboboxes
|
// set up project ui comboboxes
|
||||||
QStringList songs = project->getSongNames();
|
QStringList songs = project->getSongNames();
|
||||||
|
ui->comboBox_Song->clear();
|
||||||
ui->comboBox_Song->addItems(songs);
|
ui->comboBox_Song->addItems(songs);
|
||||||
|
ui->comboBox_Location->clear();
|
||||||
ui->comboBox_Location->addItems(project->mapSectionValueToName.values());
|
ui->comboBox_Location->addItems(project->mapSectionValueToName.values());
|
||||||
|
|
||||||
QMap<QString, QStringList> tilesets = project->getTilesetLabels();
|
QMap<QString, QStringList> tilesets = project->getTilesetLabels();
|
||||||
|
if (tilesets.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ui->comboBox_PrimaryTileset->clear();
|
||||||
ui->comboBox_PrimaryTileset->addItems(tilesets.value("primary"));
|
ui->comboBox_PrimaryTileset->addItems(tilesets.value("primary"));
|
||||||
|
ui->comboBox_SecondaryTileset->clear();
|
||||||
ui->comboBox_SecondaryTileset->addItems(tilesets.value("secondary"));
|
ui->comboBox_SecondaryTileset->addItems(tilesets.value("secondary"));
|
||||||
|
ui->comboBox_Weather->clear();
|
||||||
ui->comboBox_Weather->addItems(*project->weatherNames);
|
ui->comboBox_Weather->addItems(*project->weatherNames);
|
||||||
|
ui->comboBox_BattleScene->clear();
|
||||||
ui->comboBox_BattleScene->addItems(*project->mapBattleScenes);
|
ui->comboBox_BattleScene->addItems(*project->mapBattleScenes);
|
||||||
|
ui->comboBox_Type->clear();
|
||||||
ui->comboBox_Type->addItems(*project->mapTypes);
|
ui->comboBox_Type->addItems(*project->mapTypes);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
182
src/project.cpp
182
src/project.cpp
|
@ -1452,14 +1452,20 @@ void Project::deleteFile(QString path) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readWildMonData() {
|
bool Project::readWildMonData() {
|
||||||
if (!projectConfig.getEncounterJsonActive()) return;
|
extraEncounterGroups.clear();
|
||||||
|
wildMonFields.clear();
|
||||||
|
wildMonData.clear();
|
||||||
|
encounterGroupLabels.clear();
|
||||||
|
if (!projectConfig.getEncounterJsonActive()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
QString wildMonJsonFilepath = QString("%1/src/data/wild_encounters.json").arg(root);
|
QString wildMonJsonFilepath = QString("%1/src/data/wild_encounters.json").arg(root);
|
||||||
QJsonDocument wildMonsJsonDoc;
|
QJsonDocument wildMonsJsonDoc;
|
||||||
if (!parser.tryParseJsonFile(&wildMonsJsonDoc, wildMonJsonFilepath)) {
|
if (!parser.tryParseJsonFile(&wildMonsJsonDoc, wildMonJsonFilepath)) {
|
||||||
logError(QString("Failed to read wild encounters from %1").arg(wildMonJsonFilepath));
|
logError(QString("Failed to read wild encounters from %1").arg(wildMonJsonFilepath));
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject wildMonObj = wildMonsJsonDoc.object();
|
QJsonObject wildMonObj = wildMonsJsonDoc.object();
|
||||||
|
@ -1509,6 +1515,7 @@ void Project::readWildMonData() {
|
||||||
encounterGroupLabels.append(encounter.toObject().value("base_label").toString());
|
encounterGroupLabels.append(encounter.toObject().value("base_label").toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readMapGroups() {
|
void Project::readMapGroups() {
|
||||||
|
@ -1646,7 +1653,12 @@ QMap<QString, QStringList> Project::getTilesetLabels() {
|
||||||
allTilesets.insert("primary", primaryTilesets);
|
allTilesets.insert("primary", primaryTilesets);
|
||||||
allTilesets.insert("secondary", secondaryTilesets);
|
allTilesets.insert("secondary", secondaryTilesets);
|
||||||
|
|
||||||
QString headers_text = parser.readTextFile(root + "/data/tilesets/headers.inc");
|
QString filename = "data/tilesets/headers.inc";
|
||||||
|
QString headers_text = parser.readTextFile(root + "/" + filename);
|
||||||
|
if (headers_text.isEmpty()) {
|
||||||
|
logError(QString("Failed to read tileset labels from %1.").arg(filename));
|
||||||
|
return QMap<QString, QStringList>();
|
||||||
|
}
|
||||||
|
|
||||||
QRegularExpression re("(?<label>[A-Za-z0-9_]*):{1,2}[A-Za-z0-9_@ ]*\\s+.+\\s+\\.byte\\s+(?<isSecondary>[A-Za-z0-9_]+)");
|
QRegularExpression re("(?<label>[A-Za-z0-9_]*):{1,2}[A-Za-z0-9_@ ]*\\s+.+\\s+\\.byte\\s+(?<isSecondary>[A-Za-z0-9_]+)");
|
||||||
QRegularExpressionMatchIterator iter = re.globalMatch(headers_text);
|
QRegularExpressionMatchIterator iter = re.globalMatch(headers_text);
|
||||||
|
@ -1673,7 +1685,7 @@ QMap<QString, QStringList> Project::getTilesetLabels() {
|
||||||
return allTilesets;
|
return allTilesets;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readTilesetProperties() {
|
bool Project::readTilesetProperties() {
|
||||||
QStringList definePrefixes;
|
QStringList definePrefixes;
|
||||||
definePrefixes << "NUM_";
|
definePrefixes << "NUM_";
|
||||||
QMap<QString, int> defines = parser.readCDefines("include/fieldmap.h", definePrefixes);
|
QMap<QString, int> defines = parser.readCDefines("include/fieldmap.h", definePrefixes);
|
||||||
|
@ -1726,6 +1738,7 @@ void Project::readTilesetProperties() {
|
||||||
logWarn(QString("Value for tileset property 'NUM_PALS_TOTAL' not found. Using default (%1) instead.")
|
logWarn(QString("Value for tileset property 'NUM_PALS_TOTAL' not found. Using default (%1) instead.")
|
||||||
.arg(Project::num_pals_total));
|
.arg(Project::num_pals_total));
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Project::readRegionMapSections() {
|
bool Project::readRegionMapSections() {
|
||||||
|
@ -1746,16 +1759,18 @@ bool Project::readRegionMapSections() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readHealLocations() {
|
bool Project::readHealLocations() {
|
||||||
QString text = parser.readTextFile(root + "/src/data/heal_locations.h");
|
dataQualifiers.clear();
|
||||||
|
flyableMaps.clear();
|
||||||
|
|
||||||
|
QString filename = "src/data/heal_locations.h";
|
||||||
|
QString text = parser.readTextFile(root + "/" + filename);
|
||||||
text.replace(QRegularExpression("//.*?(\r\n?|\n)|/\\*.*?\\*/", QRegularExpression::DotMatchesEverythingOption), "");
|
text.replace(QRegularExpression("//.*?(\r\n?|\n)|/\\*.*?\\*/", QRegularExpression::DotMatchesEverythingOption), "");
|
||||||
|
|
||||||
dataQualifiers.insert("heal_locations", getDataQualifiers(text, "sHealLocations"));
|
dataQualifiers.insert("heal_locations", getDataQualifiers(text, "sHealLocations"));
|
||||||
|
|
||||||
QRegularExpression regex("MAP_GROUP[\\(\\s]+(?<map>[A-Za-z0-9_]+)[\\s\\)]+,\\s*MAP_NUM[\\(\\s]+(\\1)[\\s\\)]+,\\s*(?<x>[0-9A-Fa-fx]+),\\s*(?<y>[0-9A-Fa-fx]+)");
|
QRegularExpression regex("MAP_GROUP[\\(\\s]+(?<map>[A-Za-z0-9_]+)[\\s\\)]+,\\s*MAP_NUM[\\(\\s]+(\\1)[\\s\\)]+,\\s*(?<x>[0-9A-Fa-fx]+),\\s*(?<y>[0-9A-Fa-fx]+)");
|
||||||
QRegularExpressionMatchIterator iter = regex.globalMatch(text);
|
QRegularExpressionMatchIterator iter = regex.globalMatch(text);
|
||||||
|
|
||||||
flyableMaps.clear();
|
|
||||||
for (int i = 1; iter.hasNext(); i++) {
|
for (int i = 1; iter.hasNext(); i++) {
|
||||||
QRegularExpressionMatch match = iter.next();
|
QRegularExpressionMatch match = iter.next();
|
||||||
QString mapName = match.captured("map");
|
QString mapName = match.captured("map");
|
||||||
|
@ -1763,71 +1778,155 @@ void Project::readHealLocations() {
|
||||||
unsigned y = match.captured("y").toUShort();
|
unsigned y = match.captured("y").toUShort();
|
||||||
flyableMaps.append(HealLocation(mapName, i, x, y));
|
flyableMaps.append(HealLocation(mapName, i, x, y));
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readItemNames() {
|
bool Project::readItemNames() {
|
||||||
|
itemNames->clear();
|
||||||
QStringList prefixes = (QStringList() << "ITEM_");
|
QStringList prefixes = (QStringList() << "ITEM_");
|
||||||
parser.readCDefinesSorted("include/constants/items.h", prefixes, itemNames);
|
QString filename = "include/constants/items.h";
|
||||||
|
parser.readCDefinesSorted(filename, prefixes, itemNames);
|
||||||
|
if (itemNames->isEmpty()) {
|
||||||
|
logError(QString("Failed to read item constants from %1").arg(filename));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readFlagNames() {
|
bool Project::readFlagNames() {
|
||||||
|
flagNames->clear();
|
||||||
QStringList prefixes = (QStringList() << "FLAG_");
|
QStringList prefixes = (QStringList() << "FLAG_");
|
||||||
parser.readCDefinesSorted("include/constants/flags.h", prefixes, flagNames);
|
QString filename = "include/constants/flags.h";
|
||||||
|
parser.readCDefinesSorted(filename, prefixes, flagNames);
|
||||||
|
if (flagNames->isEmpty()) {
|
||||||
|
logError(QString("Failed to read flag constants from %1").arg(filename));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readVarNames() {
|
bool Project::readVarNames() {
|
||||||
|
varNames->clear();
|
||||||
QStringList prefixes = (QStringList() << "VAR_");
|
QStringList prefixes = (QStringList() << "VAR_");
|
||||||
parser.readCDefinesSorted("include/constants/vars.h", prefixes, varNames);
|
QString filename = "include/constants/vars.h";
|
||||||
|
parser.readCDefinesSorted(filename, prefixes, varNames);
|
||||||
|
if (varNames->isEmpty()) {
|
||||||
|
logError(QString("Failed to read var constants from %1").arg(filename));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readMovementTypes() {
|
bool Project::readMovementTypes() {
|
||||||
|
movementTypes->clear();
|
||||||
QStringList prefixes = (QStringList() << "MOVEMENT_TYPE_");
|
QStringList prefixes = (QStringList() << "MOVEMENT_TYPE_");
|
||||||
parser.readCDefinesSorted("include/constants/event_object_movement_constants.h", prefixes, movementTypes);
|
QString filename = "include/constants/event_object_movement_constants.h";
|
||||||
|
parser.readCDefinesSorted(filename, prefixes, movementTypes);
|
||||||
|
if (movementTypes->isEmpty()) {
|
||||||
|
logError(QString("Failed to read movement type constants from %1").arg(filename));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readInitialFacingDirections() {
|
bool Project::readInitialFacingDirections() {
|
||||||
facingDirections = parser.readNamedIndexCArray("src/event_object_movement.c", "gInitialMovementTypeFacingDirections");
|
QString filename = "src/event_object_movement.c";
|
||||||
|
facingDirections = parser.readNamedIndexCArray(filename, "gInitialMovementTypeFacingDirections");
|
||||||
|
if (facingDirections.isEmpty()) {
|
||||||
|
logError(QString("Failed to read initial movement type facing directions from %1").arg(filename));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readMapTypes() {
|
bool Project::readMapTypes() {
|
||||||
|
mapTypes->clear();
|
||||||
QStringList prefixes = (QStringList() << "MAP_TYPE_");
|
QStringList prefixes = (QStringList() << "MAP_TYPE_");
|
||||||
parser.readCDefinesSorted("include/constants/map_types.h", prefixes, mapTypes);
|
QString filename = "include/constants/map_types.h";
|
||||||
|
parser.readCDefinesSorted(filename, prefixes, mapTypes);
|
||||||
|
if (mapTypes->isEmpty()) {
|
||||||
|
logError(QString("Failed to read map type constants from %1").arg(filename));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readMapBattleScenes() {
|
bool Project::readMapBattleScenes() {
|
||||||
|
mapBattleScenes->clear();
|
||||||
QStringList prefixes = (QStringList() << "MAP_BATTLE_SCENE_");
|
QStringList prefixes = (QStringList() << "MAP_BATTLE_SCENE_");
|
||||||
|
QString filename = "include/constants/map_types.h";
|
||||||
parser.readCDefinesSorted("include/constants/map_types.h", prefixes, mapBattleScenes);
|
parser.readCDefinesSorted("include/constants/map_types.h", prefixes, mapBattleScenes);
|
||||||
|
if (mapBattleScenes->isEmpty()) {
|
||||||
|
logError(QString("Failed to read map battle scene constants from %1").arg(filename));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readWeatherNames() {
|
bool Project::readWeatherNames() {
|
||||||
|
weatherNames->clear();
|
||||||
QStringList prefixes = (QStringList() << "\\bWEATHER_");
|
QStringList prefixes = (QStringList() << "\\bWEATHER_");
|
||||||
parser.readCDefinesSorted("include/constants/weather.h", prefixes, weatherNames);
|
QString filename = "include/constants/weather.h";
|
||||||
|
parser.readCDefinesSorted(filename, prefixes, weatherNames);
|
||||||
|
if (weatherNames->isEmpty()) {
|
||||||
|
logError(QString("Failed to read weather constants from %1").arg(filename));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readCoordEventWeatherNames() {
|
bool Project::readCoordEventWeatherNames() {
|
||||||
|
coordEventWeatherNames->clear();
|
||||||
QStringList prefixes = (QStringList() << "COORD_EVENT_WEATHER_");
|
QStringList prefixes = (QStringList() << "COORD_EVENT_WEATHER_");
|
||||||
parser.readCDefinesSorted("include/constants/weather.h", prefixes, coordEventWeatherNames);
|
QString filename = "include/constants/weather.h";
|
||||||
|
parser.readCDefinesSorted(filename, prefixes, coordEventWeatherNames);
|
||||||
|
if (coordEventWeatherNames->isEmpty()) {
|
||||||
|
logError(QString("Failed to read coord event weather constants from %1").arg(filename));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readSecretBaseIds() {
|
bool Project::readSecretBaseIds() {
|
||||||
|
secretBaseIds->clear();
|
||||||
QStringList prefixes = (QStringList() << "SECRET_BASE_[A-Za-z0-9_]*_[0-9]+");
|
QStringList prefixes = (QStringList() << "SECRET_BASE_[A-Za-z0-9_]*_[0-9]+");
|
||||||
parser.readCDefinesSorted("include/constants/secret_bases.h", prefixes, secretBaseIds);
|
QString filename = "include/constants/secret_bases.h";
|
||||||
|
parser.readCDefinesSorted(filename, prefixes, secretBaseIds);
|
||||||
|
if (secretBaseIds->isEmpty()) {
|
||||||
|
logError(QString("Failed to read secret base id constants from %1").arg(filename));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readBgEventFacingDirections() {
|
bool Project::readBgEventFacingDirections() {
|
||||||
|
bgEventFacingDirections->clear();
|
||||||
QStringList prefixes = (QStringList() << "BG_EVENT_PLAYER_FACING_");
|
QStringList prefixes = (QStringList() << "BG_EVENT_PLAYER_FACING_");
|
||||||
parser.readCDefinesSorted("include/constants/bg_event_constants.h", prefixes, bgEventFacingDirections);
|
QString filename = "include/constants/bg_event_constants.h";
|
||||||
|
parser.readCDefinesSorted(filename, prefixes, bgEventFacingDirections);
|
||||||
|
if (bgEventFacingDirections->isEmpty()) {
|
||||||
|
logError(QString("Failed to read bg event facing direction constants from %1").arg(filename));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readMetatileBehaviors() {
|
bool Project::readMetatileBehaviors() {
|
||||||
this->metatileBehaviorMap.clear();
|
this->metatileBehaviorMap.clear();
|
||||||
this->metatileBehaviorMapInverse.clear();
|
this->metatileBehaviorMapInverse.clear();
|
||||||
|
|
||||||
QStringList prefixes = (QStringList() << "MB_");
|
QStringList prefixes = (QStringList() << "MB_");
|
||||||
this->metatileBehaviorMap = parser.readCDefines("include/constants/metatile_behaviors.h", prefixes);
|
QString filename = "include/constants/metatile_behaviors.h";
|
||||||
|
this->metatileBehaviorMap = parser.readCDefines(filename, prefixes);
|
||||||
|
if (this->metatileBehaviorMap.isEmpty()) {
|
||||||
|
logError(QString("Failed to metatile behaviors from %1.").arg(filename));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (QString defineName : this->metatileBehaviorMap.keys()) {
|
for (QString defineName : this->metatileBehaviorMap.keys()) {
|
||||||
this->metatileBehaviorMapInverse.insert(this->metatileBehaviorMap[defineName], defineName);
|
this->metatileBehaviorMapInverse.insert(this->metatileBehaviorMap[defineName], defineName);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Project::getSongNames() {
|
QStringList Project::getSongNames() {
|
||||||
|
@ -1848,10 +1947,14 @@ QMap<QString, int> Project::getEventObjGfxConstants() {
|
||||||
return constants;
|
return constants;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readMiscellaneousConstants() {
|
bool Project::readMiscellaneousConstants() {
|
||||||
QMap<QString, int> pokemonDefines = parser.readCDefines("include/constants/pokemon.h", QStringList() << "MIN_" << "MAX_");
|
miscConstants.clear();
|
||||||
miscConstants.insert("max_level_define", pokemonDefines.value("MAX_LEVEL") > pokemonDefines.value("MIN_LEVEL") ? pokemonDefines.value("MAX_LEVEL") : 100);
|
if (projectConfig.getEncounterJsonActive()) {
|
||||||
miscConstants.insert("min_level_define", pokemonDefines.value("MIN_LEVEL") < pokemonDefines.value("MAX_LEVEL") ? pokemonDefines.value("MIN_LEVEL") : 1);
|
QMap<QString, int> pokemonDefines = parser.readCDefines("include/constants/pokemon.h", QStringList() << "MIN_" << "MAX_");
|
||||||
|
miscConstants.insert("max_level_define", pokemonDefines.value("MAX_LEVEL") > pokemonDefines.value("MIN_LEVEL") ? pokemonDefines.value("MAX_LEVEL") : 100);
|
||||||
|
miscConstants.insert("min_level_define", pokemonDefines.value("MIN_LEVEL") < pokemonDefines.value("MAX_LEVEL") ? pokemonDefines.value("MIN_LEVEL") : 1);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Project::fixPalettePath(QString path) {
|
QString Project::fixPalettePath(QString path) {
|
||||||
|
@ -1950,12 +2053,15 @@ void Project::loadEventPixmaps(QList<Event*> objects) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readSpeciesIconPaths() {
|
bool Project::readSpeciesIconPaths() {
|
||||||
QMap<QString, QString> monIconNames = parser.readNamedIndexCArray("src/pokemon_icon.c", "gMonIconTable");
|
speciesToIconPath.clear();
|
||||||
|
QString filename = "src/pokemon_icon.c";
|
||||||
|
QMap<QString, QString> monIconNames = parser.readNamedIndexCArray(filename, "gMonIconTable");
|
||||||
for (QString species : monIconNames.keys()) {
|
for (QString species : monIconNames.keys()) {
|
||||||
QString path = parser.readCIncbin("src/data/graphics/pokemon.h", monIconNames.value(species));
|
QString path = parser.readCIncbin("src/data/graphics/pokemon.h", monIconNames.value(species));
|
||||||
speciesToIconPath.insert(species, root + "/" + path.replace("4bpp", "png"));
|
speciesToIconPath.insert(species, root + "/" + path.replace("4bpp", "png"));
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::saveMapHealEvents(Map *map) {
|
void Project::saveMapHealEvents(Map *map) {
|
||||||
|
|
Loading…
Reference in a new issue