mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-30 11:56:37 -05:00
Read wild pokemon table name from project rather than settings
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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``
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -146,6 +146,7 @@ public:
|
||||
bool readWildMonData();
|
||||
tsl::ordered_map<QString, tsl::ordered_map<QString, WildPokemonHeader>> wildMonData;
|
||||
|
||||
QString wildMonTableName;
|
||||
QVector<EncounterField> wildMonFields;
|
||||
QVector<QString> encounterGroupLabels;
|
||||
QVector<poryjson::Json::object> extraEncounterGroups;
|
||||
|
||||
@@ -69,13 +69,11 @@ const QList<uint32_t> 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<ProjectIdentifier, QPair<QString, QString>> 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"}},
|
||||
|
||||
@@ -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"),
|
||||
|
||||
Reference in New Issue
Block a user