Compare commits

..

No commits in common. "master" and "testing" have entirely different histories.

View File

@ -311,11 +311,6 @@ 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
@ -335,6 +330,16 @@ 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 = {}
@ -346,22 +351,10 @@ 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"""
@ -1177,6 +1170,91 @@ 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
@ -1269,11 +1347,6 @@ class DoomLauncher(QMainWindow):
'min': 1,
'max': 5,
'default': 3
},
'use_toby_maps': {
'type': 'checkbox',
'label': 'Use Toby Doom Deathmatch Maps',
'default': True
}
}
@ -1294,11 +1367,10 @@ class DoomLauncher(QMainWindow):
# Add selected mod
gameFiles.append(selectedMod)
# 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)
# Add deathmatch map
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)
@ -1558,9 +1630,13 @@ class DoomLauncher(QMainWindow):
for flag in gameFlags:
content.append(f" {flag} ^")
# Add TTS powershell script (this is the final line, no ^ needed)
# Remove the trailing ^ from the last line
if content[-1].endswith(" ^"):
content[-1] = content[-1][:-2]
# Add TTS powershell script
content.append(" | powershell -ExecutionPolicy Bypass -File DoomTTS.ps1")
else:
# Linux/Mac: save in ~/.local/games/doom
baseDir = Path.home() / ".local/games/doom"
@ -2071,11 +2147,6 @@ class DoomLauncher(QMainWindow):
'min': 1,
'max': 5,
'default': 3
},
'use_toby_maps': {
'type': 'checkbox',
'label': 'Use Toby Doom Deathmatch Maps',
'default': True
}
}
@ -2096,11 +2167,10 @@ class DoomLauncher(QMainWindow):
# Add selected mod
gameFiles.append(selectedMod)
# 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)
# Add deathmatch map
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)
@ -2455,11 +2525,6 @@ class DoomLauncher(QMainWindow):
'min': 1,
'max': 5,
'default': 3
},
'use_toby_maps': {
'type': 'checkbox',
'label': 'Use Toby Doom Deathmatch Maps',
'default': True
}
}
@ -2467,13 +2532,10 @@ class DoomLauncher(QMainWindow):
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)
# 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)])
@ -2496,97 +2558,6 @@ 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 = {