diff --git a/project.cpp b/project.cpp index 7e5ec69c..bec5ea60 100755 --- a/project.cpp +++ b/project.cpp @@ -466,6 +466,28 @@ void Project::setNewMapAttributes(Map* map) { mapAttributes->insert(map->name, attrs); } +void Project::saveMapGroupsTable() { + QString text = ""; + int groupNum = 0; + for (QStringList* mapNames : *groupedMapNames) { + text += QString("\t.align 2\n"); + text += QString("gMapGroup%1::\n").arg(groupNum); + for (QString mapName : *mapNames) { + text += QString("\t.4byte %1\n").arg(mapName); + } + text += QString("\n"); + groupNum++; + } + + text += QString("\t.align 2\n"); + text += QString("gMapGroups::\n"); + for (int i = 0; i < groupNum; i++) { + text += QString("\t.4byte gMapGroup%1\n").arg(i); + } + + saveTextFile(root + "/data/maps/_groups.inc", text); +} + void Project::getTilesets(Map* map) { map->tileset_primary = getTileset(map->tileset_primary_label); map->tileset_secondary = getTileset(map->tileset_secondary_label); @@ -614,12 +636,13 @@ void Project::saveMap(Map *map) { saveMapHeader(map); saveBlockdata(map); saveMapEvents(map); + map->isPersistedToFile = true; } void Project::saveAllDataStructures() { saveMapAttributesTable(); saveAllMapAttributes(); - // TODO: saveMapGroupsTable(); + saveMapGroupsTable(); } void Project::loadTilesetAssets(Tileset* tileset) { diff --git a/project.h b/project.h index fa5cd9ac..b29c1d77 100755 --- a/project.h +++ b/project.h @@ -67,6 +67,7 @@ public: void saveMap(Map*); void saveAllDataStructures(); void saveAllMapAttributes(); + void saveMapGroupsTable(); QList* parse(QString text); QStringList getSongNames();