diff --git a/include/project.h b/include/project.h index 4948b7e0..1c01b07a 100644 --- a/include/project.h +++ b/include/project.h @@ -126,6 +126,7 @@ public: void saveTilesetTilesImage(Tileset*); void saveTilesetPalettes(Tileset*, bool); + QString defaultSong; QStringList getSongNames(); QStringList getVisibilities(); QMap getTilesetLabels(); diff --git a/src/project.cpp b/src/project.cpp index e9677e37..d48616b7 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -412,21 +412,19 @@ QString Project::readMapLocation(QString map_name) { void Project::setNewMapHeader(Map* map, int mapIndex) { map->layoutId = QString("%1").arg(mapIndex); - map->location = "MAPSEC_LITTLEROOT_TOWN"; + map->location = mapSectionValueToName.value(0); map->requiresFlash = "FALSE"; - map->weather = "WEATHER_SUNNY"; - map->type = "MAP_TYPE_TOWN"; + map->weather = weatherNames->at(0); + map->type = mapTypes->at(0); + map->song = defaultSong; if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokeruby) { - map->song = "MUS_DAN02"; map->show_location = "TRUE"; } else if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokeemerald) { - map->song = "MUS_DAN02"; map->allowBiking = "1"; map->allowEscapeRope = "0"; map->allowRunning = "1"; map->show_location = "1"; } else if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokefirered) { - map->song = "MUS_MASARA"; map->allowBiking = "1"; map->allowEscapeRope = "0"; map->allowRunning = "1"; @@ -434,7 +432,7 @@ void Project::setNewMapHeader(Map* map, int mapIndex) { map->floorNumber = 0; } - map->battle_scene = "MAP_BATTLE_SCENE_NORMAL"; + map->battle_scene = mapBattleScenes->at(0); } bool Project::loadMapLayout(Map* map) { @@ -2083,6 +2081,7 @@ QStringList Project::getSongNames() { songDefinePrefixes << "SE_" << "MUS_"; QMap songDefines = parser.readCDefines("include/constants/songs.h", songDefinePrefixes); QStringList names = songDefines.keys(); + this->defaultSong = names.at(0); return names; } diff --git a/src/ui/newmappopup.cpp b/src/ui/newmappopup.cpp index 833d35a0..18767135 100644 --- a/src/ui/newmappopup.cpp +++ b/src/ui/newmappopup.cpp @@ -150,15 +150,11 @@ void NewMapPopup::on_pushButton_NewMap_Accept_clicked() { newMap->name = newMapName; newMap->type = this->ui->comboBox_NewMap_Type->currentText(); newMap->location = this->ui->comboBox_NewMap_Location->currentText(); - if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokefirered) { - newMap->song = "MUS_MASARA"; - } else { - newMap->song = "MUS_DAN02"; - } + newMap->song = this->project->defaultSong; newMap->requiresFlash = "0"; - newMap->weather = "WEATHER_SUNNY"; + newMap->weather = this->project->weatherNames->at(0); newMap->show_location = "1"; - newMap->battle_scene = "MAP_BATTLE_SCENE_NORMAL"; + newMap->battle_scene = this->project->mapBattleScenes->at(0); if (this->existingLayout) { layout = this->project->mapLayouts.value(this->layoutId);