diff --git a/CHANGELOG.md b/CHANGELOG.md index febc3703..b992da85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d - The prompt to reload the project when a file has changed will now only appear when Porymap is the active application. - `Script` dropdowns now autocomplete only with scripts from the current map, rather than every script in the project. The old behavior is available via a new setting. - The options for `Encounter Type` and `Terrain Type` in the Tileset Editor are not hardcoded anymore, they're now read from the project. +- The `symbol_wild_encounters` setting was replaced; this value is now read from the project. - A project may now be opened even if it has no maps or map groups. A minimum of one map layout is required. - The file extensions that are expected for `.png` and `.pal` data files and the extensions outputted when creating a new tileset can now be customized. - Miscellaneous performance improvements, especially for opening projects. diff --git a/docsrc/manual/project-files.rst b/docsrc/manual/project-files.rst index 4917be1d..caac85c2 100644 --- a/docsrc/manual/project-files.rst +++ b/docsrc/manual/project-files.rst @@ -83,7 +83,6 @@ In addition to these files, there are some specific symbol and macro names that ``symbol_facing_directions``, ``gInitialMovementTypeFacingDirections``, to set sprite frame for Object Events based on movement type ``symbol_obj_event_gfx_pointers``, ``gObjectEventGraphicsInfoPointers``, to map Object Event graphics IDs to graphics data ``symbol_pokemon_icon_table``, ``gMonIconTable``, to map species constants to icon images - ``symbol_wild_encounters``, ``gWildMonHeaders``, output as the ``label`` property for the top-level wild ecounters JSON object ``symbol_attribute_table``, ``sMetatileAttrMasks``, optionally read to get settings on ``Tilesets`` tab ``symbol_tilesets_prefix``, ``gTileset_``, for new tileset names and to extract base tileset names ``symbol_dynamic_map_name``, ``Dynamic``, reserved map name to display for ``define_map_dynamic`` diff --git a/include/config.h b/include/config.h index 0786c761..eb9c9ac3 100644 --- a/include/config.h +++ b/include/config.h @@ -200,7 +200,6 @@ enum ProjectIdentifier { symbol_facing_directions, symbol_obj_event_gfx_pointers, symbol_pokemon_icon_table, - symbol_wild_encounters, symbol_attribute_table, symbol_tilesets_prefix, symbol_dynamic_map_name, diff --git a/include/project.h b/include/project.h index 855bda18..9a031c0d 100644 --- a/include/project.h +++ b/include/project.h @@ -146,6 +146,7 @@ public: bool readWildMonData(); tsl::ordered_map> wildMonData; + QString wildMonTableName; QVector wildMonFields; QVector encounterGroupLabels; QVector extraEncounterGroups; diff --git a/src/config.cpp b/src/config.cpp index 62ab31f3..d74adbcb 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -69,13 +69,11 @@ const QList defaultWarpBehaviors_FRLG = { 0x71, // MB_UNION_ROOM_WARP }; -// TODO: symbol_wild_encounters should ultimately be removed from the table below. We can determine this name when we read the project. const QMap> ProjectConfig::defaultIdentifiers = { // Symbols {ProjectIdentifier::symbol_facing_directions, {"symbol_facing_directions", "gInitialMovementTypeFacingDirections"}}, {ProjectIdentifier::symbol_obj_event_gfx_pointers, {"symbol_obj_event_gfx_pointers", "gObjectEventGraphicsInfoPointers"}}, {ProjectIdentifier::symbol_pokemon_icon_table, {"symbol_pokemon_icon_table", "gMonIconTable"}}, - {ProjectIdentifier::symbol_wild_encounters, {"symbol_wild_encounters", "gWildMonHeaders"}}, {ProjectIdentifier::symbol_attribute_table, {"symbol_attribute_table", "sMetatileAttrMasks"}}, {ProjectIdentifier::symbol_tilesets_prefix, {"symbol_tilesets_prefix", "gTileset_"}}, {ProjectIdentifier::symbol_dynamic_map_name, {"symbol_dynamic_map_name", "Dynamic"}}, diff --git a/src/project.cpp b/src/project.cpp index bc2156ce..bbbc052c 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -738,7 +738,7 @@ void Project::saveWildMonData() { OrderedJson::array wildEncounterGroups; OrderedJson::object monHeadersObject; - monHeadersObject["label"] = projectConfig.getIdentifier(ProjectIdentifier::symbol_wild_encounters); + monHeadersObject["label"] = this->wildMonTableName; monHeadersObject["for_maps"] = true; OrderedJson::array fieldsInfoArray; @@ -1597,6 +1597,7 @@ bool Project::readWildMonData() { this->extraEncounterGroups.clear(); this->wildMonFields.clear(); this->wildMonData.clear(); + this->wildMonTableName.clear(); this->encounterGroupLabels.clear(); this->pokemonMinLevel = 0; this->pokemonMaxLevel = 100; @@ -1658,6 +1659,16 @@ bool Project::readWildMonData() { continue; } + // If multiple "for_maps" data sets are found they will be collapsed into a single set. + QString label = mainArrayObject["label"].string_value(); + if (this->wildMonTableName.isEmpty()) { + this->wildMonTableName = label; + } else { + logWarn(QString("Wild encounters table '%1' will be combined with '%2'. Only one table with \"for_maps\" set to 'true' is expected.") + .arg(label) + .arg(this->wildMonTableName)); + } + // Parse the "fields" data. This is like the header for the wild encounters data. // Each element describes a type of wild encounter Porymap can expect to find, and we represent this data with an EncounterField. // They should contain a name ("type"), the number of encounter slots and the ratio at which they occur ("encounter_rates"),