Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deatmatch bug + Adding monsters box drop-down-list #15

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/ZDLSettingsPane.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ protected slots:
protected:
QStringList getFilesMaps();
QComboBox *diffList;
QComboBox *monstersList;
QComboBox *sourceList;
QListWidget *IWADList;
QComboBox *warpCombo;
Expand Down
48 changes: 29 additions & 19 deletions src/ZDLMainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -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"<<s_skill;
} else if (i_skill==6) {
args<<"-nomonsters";
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";
}
}
}

Expand Down Expand Up @@ -736,7 +746,7 @@ QStringList ZDLMainWindow::getArgumentsList()
}

if (tGameType == "2"){
args<<"-deathmath";
args<<"-deathmatch";
} else if (tGameType == "3"){
args<<"-altdeath";
}
Expand Down
39 changes: 38 additions & 1 deletion src/ZDLSettingsPane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand All @@ -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;
}

Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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;
Expand Down