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 = AccessibleComboBox()
|
||||||
dialogWidget.addItems(opt['items'])
|
dialogWidget.addItems(opt['items'])
|
||||||
dialogLayout.addWidget(QLabel(opt['label']))
|
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:
|
else:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -330,16 +335,6 @@ class MenuDialog(QDialog):
|
|||||||
|
|
||||||
dialogLayout.addWidget(buttonBox)
|
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:
|
def get_dialog_values(self) -> dict:
|
||||||
"""Get the current values from all dialog widgets"""
|
"""Get the current values from all dialog widgets"""
|
||||||
values = {}
|
values = {}
|
||||||
@ -351,10 +346,22 @@ class MenuDialog(QDialog):
|
|||||||
values[key] = widget.currentText()
|
values[key] = widget.currentText()
|
||||||
elif isinstance(widget, QRadioButton):
|
elif isinstance(widget, QRadioButton):
|
||||||
values[key] = widget.isChecked()
|
values[key] = widget.isChecked()
|
||||||
|
elif hasattr(widget, 'isChecked'): # QCheckBox
|
||||||
|
values[key] = widget.isChecked()
|
||||||
else:
|
else:
|
||||||
values[key] = widget.text()
|
values[key] = widget.text()
|
||||||
return values
|
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:
|
class AudioPlayer:
|
||||||
"""Handles cross-platform audio playback using VLC if available"""
|
"""Handles cross-platform audio playback using VLC if available"""
|
||||||
@ -1170,91 +1177,6 @@ class DoomLauncher(QMainWindow):
|
|||||||
if gameFiles:
|
if gameFiles:
|
||||||
self.generate_launcher_script(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):
|
def generate_custom_deathmatch_script(self):
|
||||||
"""Generate script for custom deathmatch"""
|
"""Generate script for custom deathmatch"""
|
||||||
# First find available PK3s for customization
|
# First find available PK3s for customization
|
||||||
@ -1347,6 +1269,11 @@ class DoomLauncher(QMainWindow):
|
|||||||
'min': 1,
|
'min': 1,
|
||||||
'max': 5,
|
'max': 5,
|
||||||
'default': 3
|
'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
|
# Add selected mod
|
||||||
gameFiles.append(selectedMod)
|
gameFiles.append(selectedMod)
|
||||||
|
|
||||||
# Add deathmatch map
|
# Add deathmatch map only if checkbox is checked
|
||||||
deathMatchMap = str(self.gamePath / "Addons/MAPS/TobyDeathArena_V1-5.wad")
|
if values.get('use_toby_maps', True):
|
||||||
if Path(deathMatchMap).exists():
|
deathMatchMap = str(self.gamePath / "Addons/MAPS/TobyDeathArena_V1-5.wad")
|
||||||
gameFiles.append(deathMatchMap)
|
if Path(deathMatchMap).exists():
|
||||||
|
gameFiles.append(deathMatchMap)
|
||||||
|
|
||||||
# Get deathmatch flags and add map selection
|
# Get deathmatch flags and add map selection
|
||||||
gameFlags = self.get_deathmatch_flags(values)
|
gameFlags = self.get_deathmatch_flags(values)
|
||||||
@ -2143,6 +2071,11 @@ class DoomLauncher(QMainWindow):
|
|||||||
'min': 1,
|
'min': 1,
|
||||||
'max': 5,
|
'max': 5,
|
||||||
'default': 3
|
'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
|
# Add selected mod
|
||||||
gameFiles.append(selectedMod)
|
gameFiles.append(selectedMod)
|
||||||
|
|
||||||
# Add deathmatch map
|
# Add deathmatch map only if checkbox is checked
|
||||||
deathMatchMap = str(self.gamePath / "Addons/MAPS/TobyDeathArena_V1-5.wad")
|
if values.get('use_toby_maps', True):
|
||||||
if Path(deathMatchMap).exists():
|
deathMatchMap = str(self.gamePath / "Addons/MAPS/TobyDeathArena_V1-5.wad")
|
||||||
gameFiles.append(deathMatchMap)
|
if Path(deathMatchMap).exists():
|
||||||
|
gameFiles.append(deathMatchMap)
|
||||||
|
|
||||||
# Get deathmatch flags and add map selection
|
# Get deathmatch flags and add map selection
|
||||||
gameFlags = self.get_deathmatch_flags(values)
|
gameFlags = self.get_deathmatch_flags(values)
|
||||||
@ -2521,6 +2455,11 @@ class DoomLauncher(QMainWindow):
|
|||||||
'min': 1,
|
'min': 1,
|
||||||
'max': 5,
|
'max': 5,
|
||||||
'default': 3
|
'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():
|
if dialog.exec():
|
||||||
values = dialog.get_dialog_values()
|
values = dialog.get_dialog_values()
|
||||||
gameFiles = self.get_selected_game_files()
|
gameFiles = self.get_selected_game_files()
|
||||||
# Add deathmatch map
|
|
||||||
deathMatchMap = str(self.gamePath / "Addons/MAPS/TobyDeathArena_V1-5.wad")
|
# Add deathmatch map only if checkbox is checked
|
||||||
if Path(deathMatchMap).exists():
|
if values.get('use_toby_maps', True):
|
||||||
gameFiles.append(deathMatchMap)
|
deathMatchMap = str(self.gamePath / "Addons/MAPS/TobyDeathArena_V1-5.wad")
|
||||||
|
if Path(deathMatchMap).exists():
|
||||||
|
gameFiles.append(deathMatchMap)
|
||||||
|
|
||||||
gameFlags = self.get_deathmatch_flags(values)
|
gameFlags = self.get_deathmatch_flags(values)
|
||||||
# Add map selection flag
|
# Add map selection flag
|
||||||
gameFlags.extend(["-warp", str(mapIndex)])
|
gameFlags.extend(["-warp", str(mapIndex)])
|
||||||
@ -2554,6 +2496,97 @@ class DoomLauncher(QMainWindow):
|
|||||||
else:
|
else:
|
||||||
self.launch_game(gameFiles, gameFlags)
|
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):
|
def show_coop_dialog(self):
|
||||||
"""Show co-op configuration dialog"""
|
"""Show co-op configuration dialog"""
|
||||||
options = {
|
options = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user