Fix music loading when maps are loaded last.

This commit is contained in:
Storm Dragon
2025-10-09 17:41:49 -04:00
parent d1917ffc03
commit 1b3b90b4df
+22
View File
@@ -1560,6 +1560,7 @@ class DoomLauncher(QMainWindow):
# Add music files with custom music mod priority
optional_files = config.get('optional_files', [])
music_added = False
selectedMusicPath = None # Store music for later if map_after_files is true
# Check if any optional files are music-related (contain metal/music keywords)
has_music_optionals = any('metal' in opt.lower() or 'music' in opt.lower() for opt in optional_files)
@@ -1568,6 +1569,9 @@ class DoomLauncher(QMainWindow):
# First try to find custom music mod (highest priority)
customMusicMod = self.find_custom_music_mod()
if customMusicMod:
if config.get('map_after_files', False):
selectedMusicPath = str(customMusicMod)
else:
gameFiles.append(str(customMusicMod))
music_added = True
else:
@@ -1575,6 +1579,9 @@ class DoomLauncher(QMainWindow):
for optFile in optional_files:
optPath = self.find_file_in_paths(optFile)
if optPath.exists():
if config.get('map_after_files', False):
selectedMusicPath = str(optPath)
else:
gameFiles.append(str(optPath))
music_added = True
break
@@ -1594,6 +1601,10 @@ class DoomLauncher(QMainWindow):
else:
gameFiles.append(selectedMapPath)
# Add music after map if map_after_files is true (ensures music overrides everything)
if selectedMusicPath:
gameFiles.append(selectedMusicPath)
# Get any custom flags
gameFlags = config.get('flags', [])
@@ -2693,6 +2704,7 @@ class DoomLauncher(QMainWindow):
# Add music files with custom music mod priority
optional_files = config.get('optional_files', [])
music_added = False
selectedMusicPath = None # Store music for later if map_after_files is true
# Check if any optional files are music-related (contain metal/music keywords)
has_music_optionals = any('metal' in opt.lower() or 'music' in opt.lower() for opt in optional_files)
@@ -2701,6 +2713,9 @@ class DoomLauncher(QMainWindow):
# First try to find custom music mod (highest priority)
customMusicMod = self.find_custom_music_mod()
if customMusicMod:
if config.get('map_after_files', False):
selectedMusicPath = str(customMusicMod)
else:
gameFiles.append(str(customMusicMod))
music_added = True
else:
@@ -2708,6 +2723,9 @@ class DoomLauncher(QMainWindow):
for optFile in optional_files:
optPath = self.find_file_in_paths(optFile)
if optPath.exists():
if config.get('map_after_files', False):
selectedMusicPath = str(optPath)
else:
gameFiles.append(str(optPath))
music_added = True
break
@@ -2727,6 +2745,10 @@ class DoomLauncher(QMainWindow):
else:
gameFiles.append(selectedMapPath)
# Add music after map if map_after_files is true (ensures music overrides everything)
if selectedMusicPath:
gameFiles.append(selectedMusicPath)
# Get any custom flags
gameFlags = config.get('flags', [])