diff --git a/include/ZDLSettingsPane.h b/include/ZDLSettingsPane.h index 2e69ac25..01112278 100644 --- a/include/ZDLSettingsPane.h +++ b/include/ZDLSettingsPane.h @@ -36,6 +36,7 @@ protected slots: protected: QStringList getFilesMaps(); QComboBox *diffList; + QComboBox *monstersList; QComboBox *sourceList; QListWidget *IWADList; QComboBox *warpCombo; diff --git a/src/ZDLMainWindow.cpp b/src/ZDLMainWindow.cpp index 3a115aa3..acd30d93 100644 --- a/src/ZDLMainWindow.cpp +++ b/src/ZDLMainWindow.cpp @@ -402,19 +402,28 @@ QString ZDLMainWindow::getArgumentsString(bool native_sep) } } - if (zconf->hasValue("zdl.save", "skill")){ + if (zconf->hasValue("zdl.save", "monsters")){ bool ok; - QString s_skill=zconf->getValue("zdl.save", "skill"); - int i_skill=s_skill.toInt(&ok, 10); - - if (i_skill>0&&i_skill<6) { - args.append(" -skill "); - args.append(s_skill); - } else if (i_skill==6) { - args.append(" -nomonsters"); + int i_monsters=zconf->getValue("zdl.save", "monsters").toInt(&ok, 10); + if (i_monsters > 0){ + if (i_monsters == 1){ + args.append(" -nomonsters"); + } else { + if (i_monsters % 2 == 0){ + args.append(" -fast"); + } + if (i_monsters >= 3){ + args.append(" -respawn"); + } + } } } + if (zconf->hasValue("zdl.save", "skill")){ + args.append(" -skill "); + args.append(zconf->getValue("zdl.save", "skill")); + } + if (zconf->hasValue("zdl.save", "warp")){ QString map_arg=zconf->getValue("zdl.save", "warp"); QStringList warp_args=WarpBackwardCompat(iwadPath, map_arg); @@ -505,7 +514,7 @@ QString ZDLMainWindow::getArgumentsString(bool native_sep) } if (tGameType == "2"){ - args.append(" -deathmath"); + args.append(" -deathmatch"); } else if (tGameType == "3"){ args.append(" -altdeath"); } @@ -639,15 +648,16 @@ QStringList ZDLMainWindow::getArgumentsList() } } - if (zconf->hasValue("zdl.save", "skill")){ + if (zconf->hasValue("zdl.save", "monsters")){ bool ok; - QString s_skill=zconf->getValue("zdl.save", "skill"); - int i_skill=s_skill.toInt(&ok, 10); - - if (i_skill>0&&i_skill<6) { - args<<"-skill"<getValue("zdl.save", "monsters").toInt(&ok, 10); + if (i_monsters > 0){ + if (i_monsters == 1){ + args << "-nomonsters"; + } else { + if (i_monsters % 2 == 0) args << "-fast"; + if (i_monsters >= 3) args << "-respawn"; + } } } @@ -736,7 +746,7 @@ QStringList ZDLMainWindow::getArgumentsList() } if (tGameType == "2"){ - args<<"-deathmath"; + args<<"-deathmatch"; } else if (tGameType == "3"){ args<<"-altdeath"; } diff --git a/src/ZDLSettingsPane.cpp b/src/ZDLSettingsPane.cpp index 6ddf8d56..35d6f4ba 100644 --- a/src/ZDLSettingsPane.cpp +++ b/src/ZDLSettingsPane.cpp @@ -61,6 +61,9 @@ ZDLSettingsPane::ZDLSettingsPane(QWidget *parent):ZDLWidget(parent){ QVBoxLayout *skillBox = new QVBoxLayout(); box2->addLayout(skillBox); + QVBoxLayout *monstersBox = new QVBoxLayout(); + box2->addLayout(monstersBox); + warpCombo = new VerboseComboBox(this); connect(warpCombo, SIGNAL(activated(int)), this, SLOT(currentRowChanged(int))); connect(warpCombo, SIGNAL(onPopup()), this, SLOT(VerbosePopup())); @@ -82,9 +85,18 @@ ZDLSettingsPane::ZDLSettingsPane(QWidget *parent):ZDLWidget(parent){ diffList->addItem("Medium"); diffList->addItem("Hard"); diffList->addItem("V. Hard"); - diffList->addItem("No monsters"); skillBox->addWidget(new QLabel("Skill",this)); skillBox->addWidget(diffList); + + monstersList = new QComboBox(this); + monstersList->addItem("(Default)"); + monstersList->addItem("No"); + monstersList->addItem("Fast"); + monstersList->addItem("Respawn"); + monstersList->addItem("Fast & Respawn"); + monstersBox->addWidget(new QLabel("Monsters",this)); + monstersBox->addWidget(monstersList); + LOGDATAO() << "Done" << endl; } @@ -261,6 +273,13 @@ void ZDLSettingsPane::reloadMapList(){ void ZDLSettingsPane::rebuild(){ LOGDATAO() << "Saving config" << endl; ZDLConf *zconf = ZDLConfigurationManager::getActiveConfiguration(); + + if(monstersList->currentIndex() > 0){ + zconf->setValue("zdl.save", "monsters", monstersList->currentIndex()); + }else{ + zconf->deleteValue("zdl.save", "monsters"); + } + if(diffList->currentIndex() > 0){ zconf->setValue("zdl.save", "skill", diffList->currentIndex()); }else{ @@ -333,6 +352,24 @@ void ZDLSettingsPane::rebuild(){ void ZDLSettingsPane::newConfig(){ LOGDATAO() << "Loading new config" << endl; ZDLConf *zconf = ZDLConfigurationManager::getActiveConfiguration(); + + if(zconf->hasValue("zdl.save", "monsters")){ + int index = 0; + int stat = 0; + QString rc = zconf->getValue("zdl.save", "monsters", &stat); + if (rc.length() > 0){ + index = rc.toInt(); + } + if (index >= 0 && index <= 4){ + monstersList->setCurrentIndex(index); + }else{ + zconf->setValue("zdl.save", "monsters", 0); + monstersList->setCurrentIndex(0); + } + }else{ + monstersList->setCurrentIndex(0); + } + if(zconf->hasValue("zdl.save", "skill")){ int index = 0; int stat = 0;