Stop enforcing heal locations table name
This commit is contained in:
parent
28831a7ff0
commit
ef165e29df
6 changed files with 30 additions and 20 deletions
|
@ -12,8 +12,9 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
|
||||||
- Add `metatile_behaviors`, `num_primary_palettes`, and `num_secondary_palettes` to `constants` in the API.
|
- Add `metatile_behaviors`, `num_primary_palettes`, and `num_secondary_palettes` to `constants` in the API.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- The API functions `addImage` and `createImage` now support project-relative paths.
|
|
||||||
- Metatile ID strings are now padded to their current max, not the overall max.
|
- Metatile ID strings are now padded to their current max, not the overall max.
|
||||||
|
- The name of the Heal Locations table is no longer enforced.
|
||||||
|
- The API functions `addImage` and `createImage` now support project-relative paths.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fix the event group tabs sometimes showing an event from the wrong group
|
- Fix the event group tabs sometimes showing an event from the wrong group
|
||||||
|
|
|
@ -86,10 +86,11 @@ In addition to these files, there are some specific symbol and macro names that
|
||||||
``symbol_obj_event_gfx_pointers``, ``gObjectEventGraphicsInfoPointers``, to map Object Event graphics IDs to graphics data
|
``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_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_wild_encounters``, ``gWildMonHeaders``, output as the ``label`` property for the top-level wild ecounters JSON object
|
||||||
``symbol_heal_locations``, ``sHealLocations``, only if ``Respawn Map/NPC`` is disabled
|
``symbol_heal_locations_type``, ``struct HealLocation``, the type for the Heal Locations table
|
||||||
``symbol_spawn_points``, ``sSpawnPoints``, only if ``Respawn Map/NPC`` is enabled
|
``symbol_heal_locations``, ``sHealLocations``, the default Heal Locations table name when ``Respawn Map/NPC`` is disabled
|
||||||
``symbol_spawn_maps``, ``sWhiteoutRespawnHealCenterMapIdxs``, values for Heal Locations ``Respawn Map`` field
|
``symbol_spawn_points``, ``sSpawnPoints``, the default Heal Locations table name when ``Respawn Map/NPC`` is enabled
|
||||||
``symbol_spawn_npcs``, ``sWhiteoutRespawnHealerNpcIds``, values for Heal Locations ``Respawn NPC`` field
|
``symbol_spawn_maps``, ``u16 sWhiteoutRespawnHealCenterMapIdxs``, the type and table name for Heal Location ``Respawn Map`` values
|
||||||
|
``symbol_spawn_npcs``, ``u8 sWhiteoutRespawnHealerNpcIds``, the type and table name for Heal Location ``Respawn NPC`` values
|
||||||
``symbol_attribute_table``, ``sMetatileAttrMasks``, optionally read to get settings on ``Tilesets`` tab
|
``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_tilesets_prefix``, ``gTileset_``, for new tileset names and to extract base tileset names
|
||||||
``define_obj_event_count``, ``OBJECT_EVENT_TEMPLATES_COUNT``, to limit total Object Events
|
``define_obj_event_count``, ``OBJECT_EVENT_TEMPLATES_COUNT``, to limit total Object Events
|
||||||
|
|
|
@ -189,6 +189,7 @@ enum ProjectIdentifier {
|
||||||
symbol_obj_event_gfx_pointers,
|
symbol_obj_event_gfx_pointers,
|
||||||
symbol_pokemon_icon_table,
|
symbol_pokemon_icon_table,
|
||||||
symbol_wild_encounters,
|
symbol_wild_encounters,
|
||||||
|
symbol_heal_locations_type,
|
||||||
symbol_heal_locations,
|
symbol_heal_locations,
|
||||||
symbol_spawn_points,
|
symbol_spawn_points,
|
||||||
symbol_spawn_maps,
|
symbol_spawn_maps,
|
||||||
|
|
|
@ -93,6 +93,7 @@ public:
|
||||||
};
|
};
|
||||||
DataQualifiers getDataQualifiers(QString, QString);
|
DataQualifiers getDataQualifiers(QString, QString);
|
||||||
DataQualifiers healLocationDataQualifiers;
|
DataQualifiers healLocationDataQualifiers;
|
||||||
|
QString healLocationsTableName;
|
||||||
|
|
||||||
QMap<QString, Map*> mapCache;
|
QMap<QString, Map*> mapCache;
|
||||||
Map* loadMap(QString);
|
Map* loadMap(QString);
|
||||||
|
@ -238,7 +239,6 @@ private:
|
||||||
|
|
||||||
void saveHealLocationsData(Map *map);
|
void saveHealLocationsData(Map *map);
|
||||||
void saveHealLocationsConstants();
|
void saveHealLocationsConstants();
|
||||||
QString getHealLocationsTableName();
|
|
||||||
|
|
||||||
void ignoreWatchedFileTemporarily(QString filepath);
|
void ignoreWatchedFileTemporarily(QString filepath);
|
||||||
|
|
||||||
|
|
|
@ -74,10 +74,11 @@ const QMap<ProjectIdentifier, QPair<QString, QString>> ProjectConfig::defaultIde
|
||||||
{ProjectIdentifier::symbol_obj_event_gfx_pointers, {"symbol_obj_event_gfx_pointers", "gObjectEventGraphicsInfoPointers"}},
|
{ProjectIdentifier::symbol_obj_event_gfx_pointers, {"symbol_obj_event_gfx_pointers", "gObjectEventGraphicsInfoPointers"}},
|
||||||
{ProjectIdentifier::symbol_pokemon_icon_table, {"symbol_pokemon_icon_table", "gMonIconTable"}},
|
{ProjectIdentifier::symbol_pokemon_icon_table, {"symbol_pokemon_icon_table", "gMonIconTable"}},
|
||||||
{ProjectIdentifier::symbol_wild_encounters, {"symbol_wild_encounters", "gWildMonHeaders"}},
|
{ProjectIdentifier::symbol_wild_encounters, {"symbol_wild_encounters", "gWildMonHeaders"}},
|
||||||
|
{ProjectIdentifier::symbol_heal_locations_type, {"symbol_heal_locations_type", "struct HealLocation"}},
|
||||||
{ProjectIdentifier::symbol_heal_locations, {"symbol_heal_locations", "sHealLocations"}},
|
{ProjectIdentifier::symbol_heal_locations, {"symbol_heal_locations", "sHealLocations"}},
|
||||||
{ProjectIdentifier::symbol_spawn_points, {"symbol_spawn_points", "sSpawnPoints"}},
|
{ProjectIdentifier::symbol_spawn_points, {"symbol_spawn_points", "sSpawnPoints"}},
|
||||||
{ProjectIdentifier::symbol_spawn_maps, {"symbol_spawn_maps", "sWhiteoutRespawnHealCenterMapIdxs"}},
|
{ProjectIdentifier::symbol_spawn_maps, {"symbol_spawn_maps", "u16 sWhiteoutRespawnHealCenterMapIdxs"}},
|
||||||
{ProjectIdentifier::symbol_spawn_npcs, {"symbol_spawn_npcs", "sWhiteoutRespawnHealerNpcIds"}},
|
{ProjectIdentifier::symbol_spawn_npcs, {"symbol_spawn_npcs", "u8 sWhiteoutRespawnHealerNpcIds"}},
|
||||||
{ProjectIdentifier::symbol_attribute_table, {"symbol_attribute_table", "sMetatileAttrMasks"}},
|
{ProjectIdentifier::symbol_attribute_table, {"symbol_attribute_table", "sMetatileAttrMasks"}},
|
||||||
{ProjectIdentifier::symbol_tilesets_prefix, {"symbol_tilesets_prefix", "gTileset_"}},
|
{ProjectIdentifier::symbol_tilesets_prefix, {"symbol_tilesets_prefix", "gTileset_"}},
|
||||||
// Defines
|
// Defines
|
||||||
|
|
|
@ -748,12 +748,6 @@ void Project::saveHealLocations(Map *map) {
|
||||||
this->saveHealLocationsConstants();
|
this->saveHealLocationsConstants();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Project::getHealLocationsTableName() {
|
|
||||||
if (projectConfig.getHealLocationRespawnDataEnabled())
|
|
||||||
return projectConfig.getIdentifier(ProjectIdentifier::symbol_spawn_points);
|
|
||||||
return projectConfig.getIdentifier(ProjectIdentifier::symbol_heal_locations);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Saves heal location maps/coords/respawn data in root + /src/data/heal_locations.h
|
// Saves heal location maps/coords/respawn data in root + /src/data/heal_locations.h
|
||||||
void Project::saveHealLocationsData(Map *map) {
|
void Project::saveHealLocationsData(Map *map) {
|
||||||
// Update heal locations from map
|
// Update heal locations from map
|
||||||
|
@ -780,11 +774,13 @@ void Project::saveHealLocationsData(Map *map) {
|
||||||
const QString qualifiers = QString(healLocationDataQualifiers.isStatic ? "static " : "")
|
const QString qualifiers = QString(healLocationDataQualifiers.isStatic ? "static " : "")
|
||||||
+ QString(healLocationDataQualifiers.isConst ? "const " : "");
|
+ QString(healLocationDataQualifiers.isConst ? "const " : "");
|
||||||
|
|
||||||
QString locationTableText = QString("%1struct HealLocation %2[] =\n{\n").arg(qualifiers).arg(this->getHealLocationsTableName());
|
QString locationTableText = QString("%1%2 %3[] =\n{\n").arg(qualifiers)
|
||||||
|
.arg(projectConfig.getIdentifier(ProjectIdentifier::symbol_heal_locations_type))
|
||||||
|
.arg(this->healLocationsTableName);
|
||||||
QString respawnMapTableText, respawnNPCTableText;
|
QString respawnMapTableText, respawnNPCTableText;
|
||||||
if (respawnEnabled) {
|
if (respawnEnabled) {
|
||||||
respawnMapTableText = QString("\n%1u16 %2[][2] =\n{\n").arg(qualifiers).arg(projectConfig.getIdentifier(ProjectIdentifier::symbol_spawn_maps));
|
respawnMapTableText = QString("\n%1%2[][2] =\n{\n").arg(qualifiers).arg(projectConfig.getIdentifier(ProjectIdentifier::symbol_spawn_maps));
|
||||||
respawnNPCTableText = QString("\n%1u8 %2[] =\n{\n").arg(qualifiers).arg(projectConfig.getIdentifier(ProjectIdentifier::symbol_spawn_npcs));
|
respawnNPCTableText = QString("\n%1%2[] =\n{\n").arg(qualifiers).arg(projectConfig.getIdentifier(ProjectIdentifier::symbol_spawn_npcs));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate the data tables with the heal location data
|
// Populate the data tables with the heal location data
|
||||||
|
@ -2087,7 +2083,6 @@ bool Project::readHealLocationConstants() {
|
||||||
|
|
||||||
// TODO: Simplify using the new C struct parsing functions (and indexed array parsing functions)
|
// TODO: Simplify using the new C struct parsing functions (and indexed array parsing functions)
|
||||||
bool Project::readHealLocations() {
|
bool Project::readHealLocations() {
|
||||||
this->healLocationDataQualifiers = {};
|
|
||||||
this->healLocations.clear();
|
this->healLocations.clear();
|
||||||
|
|
||||||
if (!this->readHealLocationConstants())
|
if (!this->readHealLocationConstants())
|
||||||
|
@ -2103,8 +2098,19 @@ bool Project::readHealLocations() {
|
||||||
|
|
||||||
bool respawnEnabled = projectConfig.getHealLocationRespawnDataEnabled();
|
bool respawnEnabled = projectConfig.getHealLocationRespawnDataEnabled();
|
||||||
|
|
||||||
// Get data qualifiers for the location data table
|
// Search for the name of the main Heal Locations table
|
||||||
this->healLocationDataQualifiers = this->getDataQualifiers(text, this->getHealLocationsTableName());
|
const QRegularExpression tableNameExpr(QString("%1\\s+(?<name>[A-Za-z0-9_]+)\\[").arg(projectConfig.getIdentifier(ProjectIdentifier::symbol_heal_locations_type)));
|
||||||
|
const QRegularExpressionMatch tableNameMatch = tableNameExpr.match(text);
|
||||||
|
if (tableNameMatch.hasMatch()) {
|
||||||
|
// Found table name, record it and its qualifiers for output when saving.
|
||||||
|
this->healLocationsTableName = tableNameMatch.captured("name");
|
||||||
|
this->healLocationDataQualifiers = this->getDataQualifiers(text, this->healLocationsTableName);
|
||||||
|
} else {
|
||||||
|
// No table name found, initialize default name for output when saving.
|
||||||
|
this->healLocationsTableName = respawnEnabled ? projectConfig.getIdentifier(ProjectIdentifier::symbol_spawn_points)
|
||||||
|
: projectConfig.getIdentifier(ProjectIdentifier::symbol_heal_locations);
|
||||||
|
this->healLocationDataQualifiers = { .isStatic = true, .isConst = true };
|
||||||
|
}
|
||||||
|
|
||||||
// Create regex pattern for the constants (ex: "SPAWN_PALLET_TOWN" or "HEAL_LOCATION_PETALBURG_CITY")
|
// Create regex pattern for the constants (ex: "SPAWN_PALLET_TOWN" or "HEAL_LOCATION_PETALBURG_CITY")
|
||||||
const QString spawnPrefix = projectConfig.getIdentifier(ProjectIdentifier::define_spawn_prefix);
|
const QString spawnPrefix = projectConfig.getIdentifier(ProjectIdentifier::define_spawn_prefix);
|
||||||
|
|
Loading…
Reference in a new issue