From 493bea79301eee7d539c084002a21ed54149bd84 Mon Sep 17 00:00:00 2001 From: danicotra <32748257+danicotra@users.noreply.github.com> Date: Sat, 2 Jan 2021 21:04:36 +0100 Subject: [PATCH 1/5] Update ZDLMainWindow.cpp Fix "deathmatch" bug --- src/ZDLMainWindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ZDLMainWindow.cpp b/src/ZDLMainWindow.cpp index 3a115aa3..b1a26053 100644 --- a/src/ZDLMainWindow.cpp +++ b/src/ZDLMainWindow.cpp @@ -505,7 +505,7 @@ QString ZDLMainWindow::getArgumentsString(bool native_sep) } if (tGameType == "2"){ - args.append(" -deathmath"); + args.append(" -deathmatch"); } else if (tGameType == "3"){ args.append(" -altdeath"); } @@ -736,7 +736,7 @@ QStringList ZDLMainWindow::getArgumentsList() } if (tGameType == "2"){ - args<<"-deathmath"; + args<<"-deathmatch"; } else if (tGameType == "3"){ args<<"-altdeath"; } From 365a53a5db725e16090f8c767689c18ff3b87a4f Mon Sep 17 00:00:00 2001 From: danicotra <32748257+danicotra@users.noreply.github.com> Date: Thu, 7 Jan 2021 22:12:56 +0100 Subject: [PATCH 2/5] Adding monsters box drop-down-list Adding monsters box drop-down-list that lets management for -nomonsters, -fast and -respawn parameters --- src/ZDLMainWindow.cpp | 45 +++++++++++++++++++++++------------------ src/ZDLSettingsPane.cpp | 39 ++++++++++++++++++++++++++++++++++- 2 files changed, 63 insertions(+), 21 deletions(-) diff --git a/src/ZDLMainWindow.cpp b/src/ZDLMainWindow.cpp index b1a26053..1a55d629 100644 --- a/src/ZDLMainWindow.cpp +++ b/src/ZDLMainWindow.cpp @@ -402,19 +402,30 @@ 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"); + QString s_monsters=zconf->getValue("zdl.save", "monsters"); + int i_monsters=s_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")){ + QString skill=zconf->getValue("zdl.save", "skill"); + args.append(" -skill "); + args.append(skill); + } + if (zconf->hasValue("zdl.save", "warp")){ QString map_arg=zconf->getValue("zdl.save", "warp"); QStringList warp_args=WarpBackwardCompat(iwadPath, map_arg); @@ -639,20 +650,14 @@ QStringList ZDLMainWindow::getArgumentsList() } } - if (zconf->hasValue("zdl.save", "skill")){ - 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"<hasValue("zdl.save", "monsters")){ + QString monsters=zconf->getValue("zdl.save", "monsters"); + args<hasValue("zdl.save", "skill")){ - args<<"-skill"<getValue("zdl.save", "skill"); + QString skill=zconf->getValue("zdl.save", "skill"); + args<<"-skill"<hasValue("zdl.save", "warp")){ 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; From d803f9e671d4f8afb1ae755e5c5443214dcb9be7 Mon Sep 17 00:00:00 2001 From: danicotra <32748257+danicotra@users.noreply.github.com> Date: Thu, 7 Jan 2021 22:13:52 +0100 Subject: [PATCH 3/5] Adding monsters box drop-down-list Adding monsters box drop-down-list that lets management for -nomonsters, -fast and -respawn parameters --- include/ZDLSettingsPane.h | 1 + 1 file changed, 1 insertion(+) 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; From 0d2da334e4cc1291457993e5f7ebe7dfe41711e4 Mon Sep 17 00:00:00 2001 From: danicotra <32748257+danicotra@users.noreply.github.com> Date: Sat, 23 Jan 2021 13:44:07 +0100 Subject: [PATCH 4/5] optimizating: simplified code a little --- src/ZDLMainWindow.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/ZDLMainWindow.cpp b/src/ZDLMainWindow.cpp index 1a55d629..d21d38fa 100644 --- a/src/ZDLMainWindow.cpp +++ b/src/ZDLMainWindow.cpp @@ -404,8 +404,7 @@ QString ZDLMainWindow::getArgumentsString(bool native_sep) if (zconf->hasValue("zdl.save", "monsters")){ bool ok; - QString s_monsters=zconf->getValue("zdl.save", "monsters"); - int i_monsters=s_monsters.toInt(&ok, 10); + int i_monsters=zconf->getValue("zdl.save", "monsters").toInt(&ok, 10); if (i_monsters > 0){ if (i_monsters == 1){ args.append(" -nomonsters"); @@ -421,9 +420,8 @@ QString ZDLMainWindow::getArgumentsString(bool native_sep) } if (zconf->hasValue("zdl.save", "skill")){ - QString skill=zconf->getValue("zdl.save", "skill"); args.append(" -skill "); - args.append(skill); + args.append(zconf->getValue("zdl.save", "skill")); } if (zconf->hasValue("zdl.save", "warp")){ @@ -651,13 +649,11 @@ QStringList ZDLMainWindow::getArgumentsList() } if (zconf->hasValue("zdl.save", "monsters")){ - QString monsters=zconf->getValue("zdl.save", "monsters"); - args<getValue("zdl.save", "monsters"); } if (zconf->hasValue("zdl.save", "skill")){ - QString skill=zconf->getValue("zdl.save", "skill"); - args<<"-skill"<getValue("zdl.save", "skill"); } if (zconf->hasValue("zdl.save", "warp")){ From ff389b81f2e100b1f74f0c9acaab2c5db44011d4 Mon Sep 17 00:00:00 2001 From: danicotra <32748257+danicotra@users.noreply.github.com> Date: Thu, 23 Feb 2023 19:45:33 +0100 Subject: [PATCH 5/5] Added needed missing code --- src/ZDLMainWindow.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ZDLMainWindow.cpp b/src/ZDLMainWindow.cpp index d21d38fa..acd30d93 100644 --- a/src/ZDLMainWindow.cpp +++ b/src/ZDLMainWindow.cpp @@ -649,7 +649,16 @@ QStringList ZDLMainWindow::getArgumentsList() } if (zconf->hasValue("zdl.save", "monsters")){ - args<getValue("zdl.save", "monsters"); + bool ok; + int i_monsters=zconf->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"; + } + } } if (zconf->hasValue("zdl.save", "skill")){