Make Toby Deth Match maps optional but enabled by default.
This commit is contained in:
parent
a896792c58
commit
2efd0de68f
@ -311,6 +311,11 @@ class MenuDialog(QDialog):
|
||||
dialogWidget = AccessibleComboBox()
|
||||
dialogWidget.addItems(opt['items'])
|
||||
dialogLayout.addWidget(QLabel(opt['label']))
|
||||
elif opt['type'] == 'checkbox':
|
||||
from PySide6.QtWidgets import QCheckBox
|
||||
dialogWidget = QCheckBox(opt['label'])
|
||||
dialogWidget.setChecked(opt.get('default', False))
|
||||
dialogWidget.setAccessibleName(opt['label'])
|
||||
else:
|
||||
continue
|
||||
|
||||
@ -330,16 +335,6 @@ class MenuDialog(QDialog):
|
||||
|
||||
dialogLayout.addWidget(buttonBox)
|
||||
|
||||
def acceptLaunch(self):
|
||||
"""Accept dialog with launch flag"""
|
||||
self.generateScript = False
|
||||
self.accept()
|
||||
|
||||
def acceptGenerateScript(self):
|
||||
"""Accept dialog with script generation flag"""
|
||||
self.generateScript = True
|
||||
self.accept()
|
||||
|
||||
def get_dialog_values(self) -> dict:
|
||||
"""Get the current values from all dialog widgets"""
|
||||
values = {}
|
||||
@ -351,10 +346,22 @@ class MenuDialog(QDialog):
|
||||
values[key] = widget.currentText()
|
||||
elif isinstance(widget, QRadioButton):
|
||||
values[key] = widget.isChecked()
|
||||
elif hasattr(widget, 'isChecked'): # QCheckBox
|
||||
values[key] = widget.isChecked()
|
||||
else:
|
||||
values[key] = widget.text()
|
||||
return values
|
||||
|
||||
def acceptLaunch(self):
|
||||
"""Accept dialog with launch flag"""
|
||||
self.generateScript = False
|
||||
self.accept()
|
||||
|
||||
def acceptGenerateScript(self):
|
||||
"""Accept dialog with script generation flag"""
|
||||
self.generateScript = True
|
||||
self.accept()
|
||||
|
||||
|
||||
class AudioPlayer:
|
||||
"""Handles cross-platform audio playback using VLC if available"""
|
||||
@ -1170,91 +1177,6 @@ class DoomLauncher(QMainWindow):
|
||||
if gameFiles:
|
||||
self.generate_launcher_script(gameFiles)
|
||||
|
||||
def generate_deathmatch_script(self):
|
||||
"""Open deathmatch dialog and generate script from settings"""
|
||||
# First show map selection
|
||||
mapOptions = {
|
||||
'map': {
|
||||
'type': 'combobox',
|
||||
'label': 'Select Map',
|
||||
'items': self.deathmatchMaps
|
||||
}
|
||||
}
|
||||
|
||||
mapDialog = MenuDialog("Select Map", mapOptions, self)
|
||||
if not mapDialog.exec():
|
||||
return
|
||||
|
||||
selectedMap = mapDialog.get_dialog_values()['map']
|
||||
mapIndex = mapOptions['map']['items'].index(selectedMap) + 1 # 1-based index
|
||||
|
||||
# Show game options dialog
|
||||
options = {
|
||||
'mode': {
|
||||
'type': 'combobox',
|
||||
'label': 'Game Mode',
|
||||
'items': [
|
||||
"Host Game",
|
||||
"Join Game",
|
||||
"Bots Only"
|
||||
]
|
||||
},
|
||||
'ip': {
|
||||
'type': 'text',
|
||||
'placeholder': 'Enter IP address to join (required for joining)'
|
||||
},
|
||||
'fraglimit': {
|
||||
'type': 'spinbox',
|
||||
'label': 'Frag Limit',
|
||||
'min': 1,
|
||||
'max': 500,
|
||||
'default': 20
|
||||
},
|
||||
'players': {
|
||||
'type': 'spinbox',
|
||||
'label': 'Number of Players',
|
||||
'min': 2,
|
||||
'max': 4,
|
||||
'default': 2
|
||||
},
|
||||
'skill': {
|
||||
'type': 'spinbox',
|
||||
'label': 'Skill Level',
|
||||
'min': 1,
|
||||
'max': 5,
|
||||
'default': 3
|
||||
}
|
||||
}
|
||||
|
||||
dialog = MenuDialog("Deathmatch Options", options, self)
|
||||
if dialog.exec():
|
||||
values = dialog.get_dialog_values()
|
||||
gameFiles = self.get_selected_game_files()
|
||||
|
||||
# Add deathmatch map
|
||||
deathMatchMap = str(self.gamePath / "Addons/MAPS/TobyDeathArena_V1-5.wad")
|
||||
if Path(deathMatchMap).exists():
|
||||
gameFiles.append(deathMatchMap)
|
||||
|
||||
gameFlags = self.get_deathmatch_flags(values)
|
||||
|
||||
# Add map selection flag
|
||||
gameFlags.extend(["-warp", str(mapIndex)])
|
||||
|
||||
# Check/set freedm.wad as IWAD
|
||||
freedmPath = self.find_freedm()
|
||||
if not freedmPath:
|
||||
QMessageBox.critical(self, "Error", "Could not find freedm.wad")
|
||||
return
|
||||
|
||||
# Force freedm.wad selection
|
||||
for i in range(self.iwadCombo.count()):
|
||||
if "freedm" in self.iwadCombo.itemText(i).lower():
|
||||
self.iwadCombo.setCurrentIndex(i)
|
||||
break
|
||||
|
||||
self.generate_launcher_script(gameFiles, gameFlags)
|
||||
|
||||
def generate_custom_deathmatch_script(self):
|
||||
"""Generate script for custom deathmatch"""
|
||||
# First find available PK3s for customization
|
||||
@ -1347,6 +1269,11 @@ class DoomLauncher(QMainWindow):
|
||||
'min': 1,
|
||||
'max': 5,
|
||||
'default': 3
|
||||
},
|
||||
'use_toby_maps': {
|
||||
'type': 'checkbox',
|
||||
'label': 'Use Toby Doom Deathmatch Maps',
|
||||
'default': True
|
||||
}
|
||||
}
|
||||
|
||||
@ -1367,10 +1294,11 @@ class DoomLauncher(QMainWindow):
|
||||
# Add selected mod
|
||||
gameFiles.append(selectedMod)
|
||||
|
||||
# Add deathmatch map
|
||||
deathMatchMap = str(self.gamePath / "Addons/MAPS/TobyDeathArena_V1-5.wad")
|
||||
if Path(deathMatchMap).exists():
|
||||
gameFiles.append(deathMatchMap)
|
||||
# Add deathmatch map only if checkbox is checked
|
||||
if values.get('use_toby_maps', True):
|
||||
deathMatchMap = str(self.gamePath / "Addons/MAPS/TobyDeathArena_V1-5.wad")
|
||||
if Path(deathMatchMap).exists():
|
||||
gameFiles.append(deathMatchMap)
|
||||
|
||||
# Get deathmatch flags and add map selection
|
||||
gameFlags = self.get_deathmatch_flags(values)
|
||||
@ -2143,6 +2071,11 @@ class DoomLauncher(QMainWindow):
|
||||
'min': 1,
|
||||
'max': 5,
|
||||
'default': 3
|
||||
},
|
||||
'use_toby_maps': {
|
||||
'type': 'checkbox',
|
||||
'label': 'Use Toby Doom Deathmatch Maps',
|
||||
'default': True
|
||||
}
|
||||
}
|
||||
|
||||
@ -2163,10 +2096,11 @@ class DoomLauncher(QMainWindow):
|
||||
# Add selected mod
|
||||
gameFiles.append(selectedMod)
|
||||
|
||||
# Add deathmatch map
|
||||
deathMatchMap = str(self.gamePath / "Addons/MAPS/TobyDeathArena_V1-5.wad")
|
||||
if Path(deathMatchMap).exists():
|
||||
gameFiles.append(deathMatchMap)
|
||||
# Add deathmatch map only if checkbox is checked
|
||||
if values.get('use_toby_maps', True):
|
||||
deathMatchMap = str(self.gamePath / "Addons/MAPS/TobyDeathArena_V1-5.wad")
|
||||
if Path(deathMatchMap).exists():
|
||||
gameFiles.append(deathMatchMap)
|
||||
|
||||
# Get deathmatch flags and add map selection
|
||||
gameFlags = self.get_deathmatch_flags(values)
|
||||
@ -2521,6 +2455,11 @@ class DoomLauncher(QMainWindow):
|
||||
'min': 1,
|
||||
'max': 5,
|
||||
'default': 3
|
||||
},
|
||||
'use_toby_maps': {
|
||||
'type': 'checkbox',
|
||||
'label': 'Use Toby Doom Deathmatch Maps',
|
||||
'default': True
|
||||
}
|
||||
}
|
||||
|
||||
@ -2528,10 +2467,13 @@ class DoomLauncher(QMainWindow):
|
||||
if dialog.exec():
|
||||
values = dialog.get_dialog_values()
|
||||
gameFiles = self.get_selected_game_files()
|
||||
# Add deathmatch map
|
||||
deathMatchMap = str(self.gamePath / "Addons/MAPS/TobyDeathArena_V1-5.wad")
|
||||
if Path(deathMatchMap).exists():
|
||||
gameFiles.append(deathMatchMap)
|
||||
|
||||
# Add deathmatch map only if checkbox is checked
|
||||
if values.get('use_toby_maps', True):
|
||||
deathMatchMap = str(self.gamePath / "Addons/MAPS/TobyDeathArena_V1-5.wad")
|
||||
if Path(deathMatchMap).exists():
|
||||
gameFiles.append(deathMatchMap)
|
||||
|
||||
gameFlags = self.get_deathmatch_flags(values)
|
||||
# Add map selection flag
|
||||
gameFlags.extend(["-warp", str(mapIndex)])
|
||||
@ -2554,6 +2496,97 @@ class DoomLauncher(QMainWindow):
|
||||
else:
|
||||
self.launch_game(gameFiles, gameFlags)
|
||||
|
||||
def generate_deathmatch_script(self):
|
||||
"""Open deathmatch dialog and generate script from settings"""
|
||||
# First show map selection
|
||||
mapOptions = {
|
||||
'map': {
|
||||
'type': 'combobox',
|
||||
'label': 'Select Map',
|
||||
'items': self.deathmatchMaps
|
||||
}
|
||||
}
|
||||
|
||||
mapDialog = MenuDialog("Select Map", mapOptions, self)
|
||||
if not mapDialog.exec():
|
||||
return
|
||||
|
||||
selectedMap = mapDialog.get_dialog_values()['map']
|
||||
mapIndex = mapOptions['map']['items'].index(selectedMap) + 1 # 1-based index
|
||||
|
||||
# Show game options dialog
|
||||
options = {
|
||||
'mode': {
|
||||
'type': 'combobox',
|
||||
'label': 'Game Mode',
|
||||
'items': [
|
||||
"Host Game",
|
||||
"Join Game",
|
||||
"Bots Only"
|
||||
]
|
||||
},
|
||||
'ip': {
|
||||
'type': 'text',
|
||||
'placeholder': 'Enter IP address to join (required for joining)'
|
||||
},
|
||||
'fraglimit': {
|
||||
'type': 'spinbox',
|
||||
'label': 'Frag Limit',
|
||||
'min': 1,
|
||||
'max': 500,
|
||||
'default': 20
|
||||
},
|
||||
'players': {
|
||||
'type': 'spinbox',
|
||||
'label': 'Number of Players',
|
||||
'min': 2,
|
||||
'max': 4,
|
||||
'default': 2
|
||||
},
|
||||
'skill': {
|
||||
'type': 'spinbox',
|
||||
'label': 'Skill Level',
|
||||
'min': 1,
|
||||
'max': 5,
|
||||
'default': 3
|
||||
},
|
||||
'use_toby_maps': {
|
||||
'type': 'checkbox',
|
||||
'label': 'Use Toby Doom Deathmatch Maps',
|
||||
'default': True
|
||||
}
|
||||
}
|
||||
|
||||
dialog = MenuDialog("Deathmatch Options", options, self)
|
||||
if dialog.exec():
|
||||
values = dialog.get_dialog_values()
|
||||
gameFiles = self.get_selected_game_files()
|
||||
|
||||
# Add deathmatch map only if checkbox is checked
|
||||
if values.get('use_toby_maps', True):
|
||||
deathMatchMap = str(self.gamePath / "Addons/MAPS/TobyDeathArena_V1-5.wad")
|
||||
if Path(deathMatchMap).exists():
|
||||
gameFiles.append(deathMatchMap)
|
||||
|
||||
gameFlags = self.get_deathmatch_flags(values)
|
||||
|
||||
# Add map selection flag
|
||||
gameFlags.extend(["-warp", str(mapIndex)])
|
||||
|
||||
# Check/set freedm.wad as IWAD
|
||||
freedmPath = self.find_freedm()
|
||||
if not freedmPath:
|
||||
QMessageBox.critical(self, "Error", "Could not find freedm.wad")
|
||||
return
|
||||
|
||||
# Force freedm.wad selection
|
||||
for i in range(self.iwadCombo.count()):
|
||||
if "freedm" in self.iwadCombo.itemText(i).lower():
|
||||
self.iwadCombo.setCurrentIndex(i)
|
||||
break
|
||||
|
||||
self.generate_launcher_script(gameFiles, gameFlags)
|
||||
|
||||
def show_coop_dialog(self):
|
||||
"""Show co-op configuration dialog"""
|
||||
options = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user