mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-25 21:19:00 +01:00
Added 3d soundz
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
#define METEOR_TEMPERATURE
|
||||
|
||||
/var/const/meteor_wave_delay = 625 //minimum wait between waves in tenths of seconds
|
||||
//set to at least 100 unless you want evarr ruining every round
|
||||
|
||||
@@ -95,18 +93,9 @@
|
||||
icon_state = "smallf"
|
||||
pass_flags = PASSTABLE | PASSGRILLE
|
||||
|
||||
/obj/effect/meteor/Move()
|
||||
var/turf/T = src.loc
|
||||
if (istype(T, /turf))
|
||||
T.hotspot_expose(METEOR_TEMPERATURE, 1000)
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/effect/meteor/Bump(atom/A)
|
||||
spawn(0)
|
||||
for(var/mob/M in range(10, src))
|
||||
if(!M.stat && !istype(M, /mob/living/silicon/ai)) //bad idea to shake an ai's view
|
||||
shake_camera(M, 3, 1)
|
||||
|
||||
if (A)
|
||||
A.meteorhit(src)
|
||||
playsound(src.loc, 'sound/effects/meteorimpact.ogg', 40, 1)
|
||||
@@ -117,9 +106,7 @@
|
||||
if(!istype(A,/obj/machinery/power/emitter) && \
|
||||
!istype(A,/obj/machinery/field_generator) && \
|
||||
prob(15))
|
||||
|
||||
explosion(src.loc, 4, 5, 6, 7, 0)
|
||||
playsound(src.loc, "explosion", 50, 1)
|
||||
del(src)
|
||||
return
|
||||
|
||||
@@ -146,16 +133,18 @@
|
||||
if(--src.hits <= 0)
|
||||
del(src) //Dont blow up singularity containment if we get stuck there.
|
||||
|
||||
for(var/mob/M in range(10, src))
|
||||
if(!M.stat && !istype(M, /mob/living/silicon/ai)) //bad idea to shake an ai's view
|
||||
shake_camera(M, 3, 1)
|
||||
if (A)
|
||||
for(var/mob/M in player_list)
|
||||
var/turf/T = get_turf(M)
|
||||
if(!T || T.z != src.z)
|
||||
continue
|
||||
shake_camera(M, 3, get_dist(M.loc, src.loc) > 20 ? 1 : 3)
|
||||
M.playsound_local(src.loc, 'sound/effects/meteorimpact.ogg', 50, 1, get_rand_frequency(), 10)
|
||||
explosion(src.loc, 0, 1, 2, 3, 0)
|
||||
playsound(src.loc, 'sound/effects/meteorimpact.ogg', 40, 1)
|
||||
|
||||
if (--src.hits <= 0)
|
||||
if(prob(15) && !istype(A, /obj/structure/grille))
|
||||
explosion(src.loc, 1, 2, 3, 4, 0)
|
||||
playsound(src.loc, "explosion", 50, 1)
|
||||
del(src)
|
||||
return
|
||||
|
||||
|
||||
+58
-76
@@ -1,81 +1,29 @@
|
||||
/proc/playsound(var/atom/source, soundin, vol as num, vary, extrarange as num)
|
||||
//Frequency stuff only works with 45kbps oggs.
|
||||
/proc/playsound(var/atom/source, soundin, vol as num, vary, extrarange as num, falloff)
|
||||
|
||||
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 ("jackboot") soundin = pick('sound/effects/jackboot1.ogg','sound/effects/jackboot2.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')
|
||||
soundin = get_sfx(soundin) // same sound for everyone
|
||||
|
||||
var/sound/S = sound(soundin)
|
||||
S.wait = 0 //No queue
|
||||
S.channel = 0 //Any channel
|
||||
S.volume = vol
|
||||
if(isarea(source))
|
||||
error("[source] is an area and is trying to make the sound: [soundin]")
|
||||
return
|
||||
|
||||
if (vary)
|
||||
S.frequency = rand(32000, 55000)
|
||||
var/frequency = get_rand_frequency() // Same frequency for everybody
|
||||
|
||||
for (var/A in range(world.view+extrarange, source)) // Plays for people in range.
|
||||
// Looping through the player list has the added bonus of working for mobs inside containers
|
||||
for (var/P in player_list)
|
||||
var/mob/M = P
|
||||
if(!M || !M.client)
|
||||
continue
|
||||
var/turf/T = get_turf(M)
|
||||
if(T && T.z == source.z)
|
||||
if(get_dist(T, source) <= world.view + extrarange)
|
||||
M.playsound_local(source, soundin, vol, vary, frequency, falloff)
|
||||
|
||||
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))
|
||||
var/const/FALLOFF_SOUNDS = 1
|
||||
var/const/SURROUND_CAP = 7
|
||||
|
||||
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)
|
||||
/mob/proc/playsound_local(var/atom/source, soundin, vol as num, vary, frequency, falloff)
|
||||
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 ("jackboot") soundin = pick('sound/effects/jackboot1.ogg','sound/effects/jackboot2.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')
|
||||
soundin = get_sfx(soundin)
|
||||
|
||||
var/sound/S = sound(soundin)
|
||||
S.wait = 0 //No queue
|
||||
@@ -83,14 +31,48 @@
|
||||
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))
|
||||
if(frequency)
|
||||
S.frequency = frequency
|
||||
else
|
||||
S.frequency = get_rand_frequency()
|
||||
|
||||
var/turf/turf_source = get_turf(source)
|
||||
if(isturf(turf_source))
|
||||
// 3D sounds, the technology is here!
|
||||
var/turf/T = get_turf(src)
|
||||
var/dx = turf_source.x - T.x // Hearing from the right/left
|
||||
|
||||
S.x = round(max(-SURROUND_CAP, min(SURROUND_CAP, dx)), 1)
|
||||
|
||||
var/dz = turf_source.y - T.y // Hearing from infront/behind
|
||||
S.z = round(max(-SURROUND_CAP, min(SURROUND_CAP, dz)), 1)
|
||||
|
||||
// The y value is for above your head, but there is no ceiling in 2d spessmens.
|
||||
S.y = 1
|
||||
S.falloff = (falloff ? falloff : FALLOFF_SOUNDS)
|
||||
|
||||
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
|
||||
src << sound(ticker.login_music, repeat = 0, wait = 0, volume = 85, channel = 1) // MAD JAMS
|
||||
|
||||
/proc/get_rand_frequency()
|
||||
return rand(32000, 55000) //Frequency stuff only works with 45kbps oggs.
|
||||
|
||||
/proc/get_sfx(soundin)
|
||||
if(istext(soundin))
|
||||
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 ("jackboot") soundin = pick('sound/effects/jackboot1.ogg','sound/effects/jackboot2.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')
|
||||
if ("gunshot") soundin = pick('sound/weapons/Gunshot.ogg', 'sound/weapons/Gunshot2.ogg','sound/weapons/Gunshot3.ogg','sound/weapons/Gunshot4.ogg')
|
||||
return soundin
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user