diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 0bfeaf5beaf..aa1445df3b7 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1518,7 +1518,7 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) usr = M . = CB.Invoke() usr = temp - + //Returns a list of all servants of Ratvar and observers. /proc/servants_and_ghosts() . = list() @@ -1542,3 +1542,10 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) D.vv_edit_var(var_name, var_value) //same result generally, unless badmemes else D.vars[var_name] = var_value + +/proc/load_rsc_on_all_clients(thingy) + for(var/thing in GLOB.clients) + var/client/C = thing + if (!C) + continue + C.Export("##action=load_rsc", thingy) \ No newline at end of file diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index 637e65c46fd..5ab39580fe8 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -386,3 +386,11 @@ /datum/config_entry/string/default_view value = "15x15" + + +/datum/config_entry/string/roundend_sound_folder + value = "config/sounds/roundend/" + + +/datum/config_entry/string/lobby_music_folder + value = "config/sounds/title/" diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index b919af09228..8aaba37b985 100755 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -21,7 +21,7 @@ SUBSYSTEM_DEF(ticker) var/login_music //music played in pregame lobby var/round_end_sound //music/jingle played when the world reboots - var/round_end_sound_sent = TRUE //If all clients have loaded it + var/round_end_sound_sent = FALSE //If all clients have loaded it var/list/datum/mind/minds = list() //The characters in the game. Used for objective tracking. @@ -67,58 +67,7 @@ SUBSYSTEM_DEF(ticker) /datum/controller/subsystem/ticker/Initialize(timeofday) load_mode() - 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)]" + login_music = choose_sound(CONFIG_GET(string/lobby_music_folder), trim(file2text("data/last_round_lobby_music.txt"))) if(!GLOB.syndicate_code_phrase) @@ -560,11 +509,7 @@ SUBSYSTEM_DEF(ticker) set waitfor = FALSE round_end_sound_sent = FALSE round_end_sound = fcopy_rsc(the_sound) - for(var/thing in GLOB.clients) - var/client/C = thing - if (!C) - continue - C.Export("##action=load_rsc", round_end_sound) + load_rsc_on_all_clients(round_end_sound) round_end_sound_sent = TRUE /datum/controller/subsystem/ticker/proc/Reboot(reason, end_string, delay) @@ -572,6 +517,11 @@ SUBSYSTEM_DEF(ticker) if(usr && !check_rights(R_SERVER, TRUE)) return + if(!round_end_sound) + round_end_sound_sent = FALSE + round_end_sound = fcopy_rsc(choose_sound(CONFIG_GET(string/roundend_sound_folder))) + load_rsc_on_all_clients(round_end_sound) + round_end_sound_sent = TRUE if(!delay) delay = CONFIG_GET(number/round_end_countdown) * 10 @@ -598,16 +548,55 @@ 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, sound(round_end_sound)) + SEND_SOUND(world, round_end_sound) text2file(login_music, "data/last_round_lobby_music.txt") + +/datum/controller/subsystem/ticker/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 "[folder][pick(sounds)]" \ No newline at end of file diff --git a/config/config.txt b/config/config.txt index a94d900fa57..699d0a1e6f9 100644 --- a/config/config.txt +++ b/config/config.txt @@ -409,3 +409,11 @@ DISABLE_HIGH_POP_MC_MODE_AMOUNT 60 ## For reference, Goonstation uses a resolution of 21x15 for it's widescreen mode. ## Do note that changing this value will affect the title screen. The title screen will have to be updated manually if this is changed. DEFAULT_VIEW 15x15 + +## Where roundend sounds are located. MUST HAVE A TRAILING SLASH! +## Uncomment to change it from the default of 'config/sounds/roundend/'. +#ROUNDEND_SOUND_FOLDER + +## Where lobby music is located. MUST HAVE A TRAILING SLASH! +## Uncomment to change it from the default of 'config/sounds/title/'. +#LOBBY_MUSIC_FOLDER \ No newline at end of file diff --git a/config/title_music/LICENSE.txt b/config/sounds/LICENSE.txt similarity index 100% rename from config/title_music/LICENSE.txt rename to config/sounds/LICENSE.txt diff --git a/config/title_music/README.txt b/config/sounds/README.txt similarity index 93% rename from config/title_music/README.txt rename to config/sounds/README.txt index 6734508a68f..efd4e75de0d 100644 --- a/config/title_music/README.txt +++ b/config/sounds/README.txt @@ -1,4 +1,4 @@ -The enclosed sounds folder holds the sound files used as the title music for the game. OGG and WAV are supported. +The enclosed sound folders 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,6 +6,11 @@ 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. @@ -37,3 +42,4 @@ 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/sound/roundend/apcdestroyed.ogg b/config/sounds/roundend/apcdestroyed.ogg similarity index 100% rename from sound/roundend/apcdestroyed.ogg rename to config/sounds/roundend/apcdestroyed.ogg diff --git a/sound/roundend/bangindonk.ogg b/config/sounds/roundend/bangindonk.ogg similarity index 100% rename from sound/roundend/bangindonk.ogg rename to config/sounds/roundend/bangindonk.ogg diff --git a/sound/roundend/disappointed.ogg b/config/sounds/roundend/disappointed.ogg similarity index 100% rename from sound/roundend/disappointed.ogg rename to config/sounds/roundend/disappointed.ogg diff --git a/sound/roundend/its_only_game.ogg b/config/sounds/roundend/its_only_game.ogg similarity index 100% rename from sound/roundend/its_only_game.ogg rename to config/sounds/roundend/its_only_game.ogg diff --git a/sound/roundend/leavingtg.ogg b/config/sounds/roundend/leavingtg.ogg similarity index 100% rename from sound/roundend/leavingtg.ogg rename to config/sounds/roundend/leavingtg.ogg diff --git a/sound/roundend/newroundsexy.ogg b/config/sounds/roundend/newroundsexy.ogg similarity index 100% rename from sound/roundend/newroundsexy.ogg rename to config/sounds/roundend/newroundsexy.ogg diff --git a/sound/roundend/yeehaw.ogg b/config/sounds/roundend/yeehaw.ogg similarity index 100% rename from sound/roundend/yeehaw.ogg rename to config/sounds/roundend/yeehaw.ogg diff --git a/config/sounds/title/clown.ogg b/config/sounds/title/clown.ogg new file mode 100644 index 00000000000..3214da56fa2 Binary files /dev/null and b/config/sounds/title/clown.ogg differ diff --git a/config/sounds/title/title1.ogg b/config/sounds/title/title1.ogg new file mode 100644 index 00000000000..560fb6342f4 Binary files /dev/null and b/config/sounds/title/title1.ogg differ diff --git a/config/sounds/title/title2.ogg b/config/sounds/title/title2.ogg new file mode 100644 index 00000000000..94e78f83c19 Binary files /dev/null and b/config/sounds/title/title2.ogg differ diff --git a/strings/round_start_sounds.txt b/strings/round_start_sounds.txt deleted file mode 100644 index 0788672367e..00000000000 --- a/strings/round_start_sounds.txt +++ /dev/null @@ -1,4 +0,0 @@ -sound/ambience/title1.ogg -sound/ambience/title2.ogg -sound/ambience/title3.ogg -sound/ambience/clown.ogg