Remove hard-coded new map constants

This commit is contained in:
GriffinR 2020-03-16 03:57:39 -04:00
parent ffddc35b60
commit 3fa77609c6
3 changed files with 10 additions and 14 deletions

View file

@ -126,6 +126,7 @@ public:
void saveTilesetTilesImage(Tileset*); void saveTilesetTilesImage(Tileset*);
void saveTilesetPalettes(Tileset*, bool); void saveTilesetPalettes(Tileset*, bool);
QString defaultSong;
QStringList getSongNames(); QStringList getSongNames();
QStringList getVisibilities(); QStringList getVisibilities();
QMap<QString, QStringList> getTilesetLabels(); QMap<QString, QStringList> getTilesetLabels();

View file

@ -412,21 +412,19 @@ QString Project::readMapLocation(QString map_name) {
void Project::setNewMapHeader(Map* map, int mapIndex) { void Project::setNewMapHeader(Map* map, int mapIndex) {
map->layoutId = QString("%1").arg(mapIndex); map->layoutId = QString("%1").arg(mapIndex);
map->location = "MAPSEC_LITTLEROOT_TOWN"; map->location = mapSectionValueToName.value(0);
map->requiresFlash = "FALSE"; map->requiresFlash = "FALSE";
map->weather = "WEATHER_SUNNY"; map->weather = weatherNames->at(0);
map->type = "MAP_TYPE_TOWN"; map->type = mapTypes->at(0);
map->song = defaultSong;
if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokeruby) { if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokeruby) {
map->song = "MUS_DAN02";
map->show_location = "TRUE"; map->show_location = "TRUE";
} else if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokeemerald) { } else if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokeemerald) {
map->song = "MUS_DAN02";
map->allowBiking = "1"; map->allowBiking = "1";
map->allowEscapeRope = "0"; map->allowEscapeRope = "0";
map->allowRunning = "1"; map->allowRunning = "1";
map->show_location = "1"; map->show_location = "1";
} else if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokefirered) { } else if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokefirered) {
map->song = "MUS_MASARA";
map->allowBiking = "1"; map->allowBiking = "1";
map->allowEscapeRope = "0"; map->allowEscapeRope = "0";
map->allowRunning = "1"; map->allowRunning = "1";
@ -434,7 +432,7 @@ void Project::setNewMapHeader(Map* map, int mapIndex) {
map->floorNumber = 0; map->floorNumber = 0;
} }
map->battle_scene = "MAP_BATTLE_SCENE_NORMAL"; map->battle_scene = mapBattleScenes->at(0);
} }
bool Project::loadMapLayout(Map* map) { bool Project::loadMapLayout(Map* map) {
@ -2083,6 +2081,7 @@ QStringList Project::getSongNames() {
songDefinePrefixes << "SE_" << "MUS_"; songDefinePrefixes << "SE_" << "MUS_";
QMap<QString, int> songDefines = parser.readCDefines("include/constants/songs.h", songDefinePrefixes); QMap<QString, int> songDefines = parser.readCDefines("include/constants/songs.h", songDefinePrefixes);
QStringList names = songDefines.keys(); QStringList names = songDefines.keys();
this->defaultSong = names.at(0);
return names; return names;
} }

View file

@ -150,15 +150,11 @@ void NewMapPopup::on_pushButton_NewMap_Accept_clicked() {
newMap->name = newMapName; newMap->name = newMapName;
newMap->type = this->ui->comboBox_NewMap_Type->currentText(); newMap->type = this->ui->comboBox_NewMap_Type->currentText();
newMap->location = this->ui->comboBox_NewMap_Location->currentText(); newMap->location = this->ui->comboBox_NewMap_Location->currentText();
if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokefirered) { newMap->song = this->project->defaultSong;
newMap->song = "MUS_MASARA";
} else {
newMap->song = "MUS_DAN02";
}
newMap->requiresFlash = "0"; newMap->requiresFlash = "0";
newMap->weather = "WEATHER_SUNNY"; newMap->weather = this->project->weatherNames->at(0);
newMap->show_location = "1"; newMap->show_location = "1";
newMap->battle_scene = "MAP_BATTLE_SCENE_NORMAL"; newMap->battle_scene = this->project->mapBattleScenes->at(0);
if (this->existingLayout) { if (this->existingLayout) {
layout = this->project->mapLayouts.value(this->layoutId); layout = this->project->mapLayouts.value(this->layoutId);