Files
CHOMPStation2/code/game/sound.dm
Cael_Aislinn 990090326d compile fixes and cleanup
Signed-off-by: Cael_Aislinn <cael_aislinn@yahoo.com.au>
2013-01-07 02:36:52 +10:00

94 lines
4.1 KiB
Plaintext

/proc/playsound(var/atom/source, soundin, vol as num, vary, extrarange as num)
//Frequency stuff only works with 45kbps oggs.
switch(soundin)
if ("shatter") soundin = pick('sound/effects/Glassbr1.ogg','sound/effects/Glassbr2.ogg','sound/effects/Glassbr3.ogg')
if ("explosion") soundin = pick('sound/effects/Explosion1.ogg','sound/effects/Explosion2.ogg')
if ("sparks") soundin = pick('sound/effects/sparks1.ogg','sound/effects/sparks2.ogg','sound/effects/sparks3.ogg','sound/effects/sparks4.ogg')
if ("rustle") soundin = pick('sound/effects/rustle1.ogg','sound/effects/rustle2.ogg','sound/effects/rustle3.ogg','sound/effects/rustle4.ogg','sound/effects/rustle5.ogg')
if ("punch") soundin = pick('sound/weapons/punch1.ogg','sound/weapons/punch2.ogg','sound/weapons/punch3.ogg','sound/weapons/punch4.ogg')
if ("clownstep") soundin = pick('sound/effects/clownstep1.ogg','sound/effects/clownstep2.ogg')
if ("swing_hit") soundin = pick('sound/weapons/genhit1.ogg', 'sound/weapons/genhit2.ogg', 'sound/weapons/genhit3.ogg')
if ("hiss") soundin = pick('sound/voice/hiss1.ogg','sound/voice/hiss2.ogg','sound/voice/hiss3.ogg','sound/voice/hiss4.ogg')
if ("pageturn") soundin = pick('sound/effects/pageturn1.ogg', 'sound/effects/pageturn2.ogg','sound/effects/pageturn3.ogg')
var/sound/S = sound(soundin)
S.wait = 0 //No queue
S.channel = 0 //Any channel
S.volume = vol
if (vary)
S.frequency = rand(32000, 55000)
for (var/A in range(world.view+extrarange, source)) // Plays for people in range.
if(ismob(A))
var/mob/M = A
var/mob/M2 = locate(/mob/, M)
if (M2 && M2.client)
if(M2.ear_deaf <= 0 || !M.ear_deaf)
if(isturf(source))
var/dx = source.x - M2.x
S.pan = max(-100, min(100, dx/8.0 * 100))
M2 << S
if (M.client)
if(M.ear_deaf <= 0 || !M.ear_deaf)
if(isturf(source))
var/dx = source.x - M.x
S.pan = max(-100, min(100, dx/8.0 * 100))
M << S
if(istype(A, /obj/structure/closet))
var/obj/O = A
for(var/mob/M in O)
if (M.client)
if(M.ear_deaf <= 0 || !M.ear_deaf)
if(isturf(source))
var/dx = source.x - M.x
S.pan = max(-100, min(100, dx/8.0 * 100))
M << S
for(var/obj/mecha/mech in range(world.view+extrarange, source))
var/mob/M = mech.occupant
if (M && M.client)
if(M.ear_deaf <= 0 || !M.ear_deaf)
if(isturf(source))
var/dx = source.x - M.x
S.pan = max(-100, min(100, dx/8.0 * 100))
M << S
// Now plays for people in lockers! -- Polymorph
/mob/proc/playsound_local(var/atom/source, soundin, vol as num, vary, extrarange as num)
if(!src.client || ear_deaf > 0) return
switch(soundin)
if ("shatter") soundin = pick('sound/effects/Glassbr1.ogg','sound/effects/Glassbr2.ogg','sound/effects/Glassbr3.ogg')
if ("explosion") soundin = pick('sound/effects/Explosion1.ogg','sound/effects/Explosion2.ogg')
if ("sparks") soundin = pick('sound/effects/sparks1.ogg','sound/effects/sparks2.ogg','sound/effects/sparks3.ogg','sound/effects/sparks4.ogg')
if ("rustle") soundin = pick('sound/effects/rustle1.ogg','sound/effects/rustle2.ogg','sound/effects/rustle3.ogg','sound/effects/rustle4.ogg','sound/effects/rustle5.ogg')
if ("punch") soundin = pick('sound/weapons/punch1.ogg','sound/weapons/punch2.ogg','sound/weapons/punch3.ogg','sound/weapons/punch4.ogg')
if ("clownstep") soundin = pick('sound/effects/clownstep1.ogg','sound/effects/clownstep2.ogg')
if ("swing_hit") soundin = pick('sound/weapons/genhit1.ogg', 'sound/weapons/genhit2.ogg', 'sound/weapons/genhit3.ogg')
if ("hiss") soundin = pick('sound/voice/hiss1.ogg','sound/voice/hiss2.ogg','sound/voice/hiss3.ogg','sound/voice/hiss4.ogg')
var/sound/S = sound(soundin)
S.wait = 0 //No queue
S.channel = 0 //Any channel
S.volume = vol
if (vary)
S.frequency = rand(32000, 55000)
if(isturf(source))
var/dx = source.x - src.x
S.pan = max(-100, min(100, dx/8.0 * 100))
src << S
/client/proc/playtitlemusic()
if(!ticker || !ticker.login_music) return
if(prefs.toggles & SOUND_LOBBY)
src << sound(ticker.login_music, repeat = 0, wait = 0, volume = 85, channel = 1) // MAD JAMS