From c971cfaeadbb56e2910c8de26decc1a15bdc5ad5 Mon Sep 17 00:00:00 2001 From: ariaworld <143797359+ariaworld@users.noreply.github.com> Date: Fri, 6 Sep 2024 18:39:37 +0200 Subject: [PATCH] Linking specific titles + sounds, perhaps? --- code/controllers/subsystem/ticker.dm | 6 +++++- code/controllers/subsystem/title.dm | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index e3a32aca85..50574f6712 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -129,7 +129,11 @@ SUBSYSTEM_DEF(ticker) music = world.file2list(ROUND_START_MUSIC_LIST, "\n") login_music = pick(music) else - login_music = "[global.config.directory]/title_music/sounds/[pick(music)]" + // Use the sound path from the title subsystem if it exists + if(SStitle.sound_path) + login_music = SStitle.sound_path + else + login_music = "[global.config.directory]/title_music/sounds/[pick(music)]" if(!GLOB.syndicate_code_phrase) diff --git a/code/controllers/subsystem/title.dm b/code/controllers/subsystem/title.dm index 1dbfb1540c..c4f2c2b5e0 100644 --- a/code/controllers/subsystem/title.dm +++ b/code/controllers/subsystem/title.dm @@ -7,6 +7,7 @@ SUBSYSTEM_DEF(title) var/icon/icon var/icon/previous_icon var/turf/closed/indestructible/splashscreen/splash_turf + var/sound_path /datum/controller/subsystem/title/Initialize() if(file_path && icon) @@ -38,6 +39,16 @@ SUBSYSTEM_DEF(title) icon = new(fcopy_rsc(file_path)) + // Check for a corresponding sound file + var/list/L = splittext(file_path, "+") + if(L.len > 1) + var/sound_suffix = L[2] + var/sound_file = "[global.config.directory]/title_music/sounds/[sound_suffix].ogg" + if(fexists(sound_file)) + sound_path = sound_file + else + sound_path = "[global.config.directory]/title_music/sounds/[pick(flist("[global.config.directory]/title_music/sounds/"))]" + if(splash_turf) splash_turf.icon = icon splash_turf.handle_generic_titlescreen_sizes() @@ -63,8 +74,17 @@ SUBSYSTEM_DEF(title) var/atom/movable/screen/splash/S = new(thing, FALSE) S.Fade(FALSE,FALSE) + // Save the sound path + if(sound_path) + var/F = file("data/previous_title_sound.dat") + WRITE_FILE(F, sound_path) + /datum/controller/subsystem/title/Recover() icon = SStitle.icon splash_turf = SStitle.splash_turf file_path = SStitle.file_path previous_icon = SStitle.previous_icon + + // Recover the sound path + if(fexists("data/previous_title_sound.dat")) + sound_path = file2text("data/previous_title_sound.dat")