diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 790a5a16f67..b919af09228 100755 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -67,7 +67,58 @@ SUBSYSTEM_DEF(ticker) /datum/controller/subsystem/ticker/Initialize(timeofday) load_mode() - login_music = choose_sound("config/sounds/title", trim(file2text("data/last_round_lobby_music.txt"))) + var/list/byond_sound_formats = list( + "mid" = TRUE, + "midi" = TRUE, + "mod" = TRUE, + "it" = TRUE, + "s3m" = TRUE, + "xm" = TRUE, + "oxm" = TRUE, + "wav" = TRUE, + "ogg" = TRUE, + "raw" = TRUE, + "wma" = TRUE, + "aiff" = TRUE + ) + + var/list/provisional_title_music = flist("config/title_music/sounds/") + var/list/music = list() + var/use_rare_music = prob(1) + + for(var/S in provisional_title_music) + var/lower = lowertext(S) + var/list/L = splittext(lower,"+") + switch(L.len) + if(3) //rare+MAP+sound.ogg or MAP+rare.sound.ogg -- Rare Map-specific sounds + if(use_rare_music) + if(L[1] == "rare" && L[2] == SSmapping.config.map_name) + music += S + else if(L[2] == "rare" && L[1] == SSmapping.config.map_name) + music += S + if(2) //rare+sound.ogg or MAP+sound.ogg -- Rare sounds or Map-specific sounds + if((use_rare_music && L[1] == "rare") || (L[1] == SSmapping.config.map_name)) + music += S + if(1) //sound.ogg -- common sound + music += S + + var/old_login_music = trim(file2text("data/last_round_lobby_music.txt")) + if(music.len > 1) + music -= old_login_music + + for(var/S in music) + var/list/L = splittext(S,".") + if(L.len >= 2) + var/ext = lowertext(L[L.len]) //pick the real extension, no 'honk.ogg.exe' nonsense here + if(byond_sound_formats[ext]) + continue + music -= S + + if(isemptylist(music)) + music = world.file2list(ROUND_START_MUSIC_LIST, "\n") + login_music = pick(music) + else + login_music = "config/title_music/sounds/[pick(music)]" if(!GLOB.syndicate_code_phrase) @@ -547,55 +598,16 @@ SUBSYSTEM_DEF(ticker) /datum/controller/subsystem/ticker/Shutdown() gather_newscaster() //called here so we ensure the log is created even upon admin reboot + if(!round_end_sound) + round_end_sound = pick(\ + 'sound/roundend/newroundsexy.ogg', + 'sound/roundend/apcdestroyed.ogg', + 'sound/roundend/bangindonk.ogg', + 'sound/roundend/leavingtg.ogg', + 'sound/roundend/its_only_game.ogg', + 'sound/roundend/yeehaw.ogg', + 'sound/roundend/disappointed.ogg'\ + ) - SEND_SOUND(world, choose_sound("config/sounds/roundend")) + SEND_SOUND(world, sound(round_end_sound)) text2file(login_music, "data/last_round_lobby_music.txt") - -/datum/controller/subsystem/proc/choose_sound(folder, dont_use = "", sound_prob = 1) - var/list/sound_list = flist(folder) - var/list/sounds = list() - var/use_rare_sound = prob(sound_prob) - - var/list/byond_sound_formats = list( - "mid" = TRUE, - "midi" = TRUE, - "mod" = TRUE, - "it" = TRUE, - "s3m" = TRUE, - "xm" = TRUE, - "oxm" = TRUE, - "wav" = TRUE, - "ogg" = TRUE, - "raw" = TRUE, - "wma" = TRUE, - "aiff" = TRUE - ) - - for(var/S in sound_list) - var/lower = lowertext(S) - var/list/L = splittext(lower,"+") - switch(L.len) - if(3) //rare+MAP+sound.ogg or MAP+rare.sound.ogg -- Rare Map-specific sounds - if(use_rare_sound) - if(L[1] == "rare" && L[2] == SSmapping.config.map_name) - sounds += S - else if(L[2] == "rare" && L[1] == SSmapping.config.map_name) - sounds += S - if(2) //rare+sound.ogg or MAP+sound.ogg -- Rare sounds or Map-specific sounds - if((use_rare_sound && L[1] == "rare") || (L[1] == SSmapping.config.map_name)) - sounds += S - if(1) //sound.ogg -- common sound - sounds += S - - if(dont_use && lentext(dont_use) > 1) - sounds -= dont_use - - for(var/S in sounds) - var/list/L = splittext(S,".") - if(L.len >= 2) - var/ext = lowertext(L[L.len]) //pick the real extension, no 'honk.ogg.exe' nonsense here - if(byond_sound_formats[ext]) - continue - sounds -= S - - return pick(sounds) \ No newline at end of file diff --git a/config/sounds/title/clown.ogg b/config/sounds/title/clown.ogg deleted file mode 100644 index 3214da56fa2..00000000000 Binary files a/config/sounds/title/clown.ogg and /dev/null differ diff --git a/config/sounds/title/title1.ogg b/config/sounds/title/title1.ogg deleted file mode 100644 index 560fb6342f4..00000000000 Binary files a/config/sounds/title/title1.ogg and /dev/null differ diff --git a/config/sounds/title/title2.ogg b/config/sounds/title/title2.ogg deleted file mode 100644 index 94e78f83c19..00000000000 Binary files a/config/sounds/title/title2.ogg and /dev/null differ diff --git a/config/sounds/LICENSE.txt b/config/title_music/LICENSE.txt similarity index 100% rename from config/sounds/LICENSE.txt rename to config/title_music/LICENSE.txt diff --git a/config/sounds/README.txt b/config/title_music/README.txt similarity index 93% rename from config/sounds/README.txt rename to config/title_music/README.txt index efd4e75de0d..6734508a68f 100644 --- a/config/sounds/README.txt +++ b/config/title_music/README.txt @@ -1,4 +1,4 @@ -The enclosed sound folders holds the sound files used as the title music for the game. OGG and WAV are supported. +The enclosed sounds folder holds the sound files used as the title music for the game. OGG and WAV are supported. Using unnecessarily huge sounds can cause client side lag and should be avoided. @@ -6,11 +6,6 @@ You may add as many title sounds as you like, if there is more than one a random --- -roundend/ -- Roundend Sounds -title/ -- Title Music - ---- - Naming Conventions: Every title sound you add must have a unique name. It is allowed to name two things the same if they have different file types, but this should be discouraged. @@ -42,4 +37,3 @@ Rare title sounds are a just for fun feature where they will only have a 1% chan Add the phrase "rare+" to the beginning of the name. Again note there are no spaces. An example of a rare sound name is "rare+explosion" - diff --git a/config/sounds/roundend/apcdestroyed.ogg b/sound/roundend/apcdestroyed.ogg similarity index 100% rename from config/sounds/roundend/apcdestroyed.ogg rename to sound/roundend/apcdestroyed.ogg diff --git a/config/sounds/roundend/bangindonk.ogg b/sound/roundend/bangindonk.ogg similarity index 100% rename from config/sounds/roundend/bangindonk.ogg rename to sound/roundend/bangindonk.ogg diff --git a/config/sounds/roundend/disappointed.ogg b/sound/roundend/disappointed.ogg similarity index 100% rename from config/sounds/roundend/disappointed.ogg rename to sound/roundend/disappointed.ogg diff --git a/config/sounds/roundend/its_only_game.ogg b/sound/roundend/its_only_game.ogg similarity index 100% rename from config/sounds/roundend/its_only_game.ogg rename to sound/roundend/its_only_game.ogg diff --git a/config/sounds/roundend/leavingtg.ogg b/sound/roundend/leavingtg.ogg similarity index 100% rename from config/sounds/roundend/leavingtg.ogg rename to sound/roundend/leavingtg.ogg diff --git a/config/sounds/roundend/newroundsexy.ogg b/sound/roundend/newroundsexy.ogg similarity index 100% rename from config/sounds/roundend/newroundsexy.ogg rename to sound/roundend/newroundsexy.ogg diff --git a/config/sounds/roundend/yeehaw.ogg b/sound/roundend/yeehaw.ogg similarity index 100% rename from config/sounds/roundend/yeehaw.ogg rename to sound/roundend/yeehaw.ogg diff --git a/strings/round_start_sounds.txt b/strings/round_start_sounds.txt new file mode 100644 index 00000000000..0788672367e --- /dev/null +++ b/strings/round_start_sounds.txt @@ -0,0 +1,4 @@ +sound/ambience/title1.ogg +sound/ambience/title2.ogg +sound/ambience/title3.ogg +sound/ambience/clown.ogg