diff --git a/progs/ssqc.src b/progs/ssqc.src index 5952375..664be71 100644 --- a/progs/ssqc.src +++ b/progs/ssqc.src @@ -20,6 +20,7 @@ defs/standard.qc #endif shared_defs.qc defs/custom.qc +utilities/sound_helper.qc weapon_stats.qc utilities/math.qc clientfuncs.qc diff --git a/source/client/main.qc b/source/client/main.qc index 8148956..10b0e57 100644 --- a/source/client/main.qc +++ b/source/client/main.qc @@ -1141,7 +1141,7 @@ noref void() CSQC_Parse_Event = else track_extension = ".ogg"; - localsound_enhanced(strcat("tracks/", track_name, track_extension), CHAN_MUSIC, 1); + localsound_enhanced(strcat("tracks/", track_name, track_extension), CHAN_MUSIC, 0.85); break; case CSQC_EVENT_GIVEACHIEVEMENT: float achievement_id = readbyte(); diff --git a/source/server/ai/ai_core.qc b/source/server/ai/ai_core.qc index 21c2282..503a138 100644 --- a/source/server/ai/ai_core.qc +++ b/source/server/ai/ai_core.qc @@ -25,7 +25,7 @@ */ -void(float what) play_sound_z; +void(float type) Zombie_PlaySoundType; void() LinkZombiesHitbox; entity() Dog_FindEnemy; @@ -825,7 +825,6 @@ void(float dist) Zombie_Walk = { } if(self.outside == 2) { - //play_sound_z(2); Window_Hop(dist); //handle special walk case for walking to org return; @@ -845,19 +844,26 @@ void() Zombie_AI = { float dist = 0; self.flags = self.flags | FL_PARTIALGROUND; //check_onfire(); + + // + // Try to play some zombie sounds. + // + + // Crawling + if (self.crawling == true) { + Zombie_PlaySoundType(ZOMBIE_SOUND_TYPE_CRAWL); + } else { + // Walking + if (self.walktype < 4) { + Zombie_PlaySoundType(ZOMBIE_SOUND_TYPE_WALK); + } + // Running + else { + Zombie_PlaySoundType(ZOMBIE_SOUND_TYPE_SPRINT); + } + } - if(self.outside == TRUE) { - play_sound_z(2); - //self.calc_time = time + (0.3 * random()); - //Window_Walk(dist); - return; - } else if(self.outside == 2) { - play_sound_z(2); - //Window_Hop(0); - return; - } else if(self.outside == FALSE) { - play_sound_z(2); - //self.calc_time = time + (0.25 + (0.15 * random())); + if(self.outside == FALSE) { Inside_Walk(dist); } } diff --git a/source/server/ai/crawler_core.qc b/source/server/ai/crawler_core.qc index 2528ca6..3177ac8 100644 --- a/source/server/ai/crawler_core.qc +++ b/source/server/ai/crawler_core.qc @@ -44,12 +44,12 @@ void() crawler_footstep if(self.laststep == 1) { self.laststep = 0; - sound(self, 5, "sounds/zombie/sc0.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/zombie/sc0.wav", SOUND_TYPE_PLAYER_FOOTSTEP, SOUND_PRIORITY_PLAYALWAYS); } else { self.laststep = 1; - sound(self, 5, "sounds/zombie/sc1.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/zombie/sc1.wav", SOUND_TYPE_PLAYER_FOOTSTEP, SOUND_PRIORITY_PLAYALWAYS); } } @@ -128,7 +128,7 @@ void(float which) crawler_attack_choose = zombie_decide(); return; } - play_sound_z(1); + Zombie_PlaySoundType(ZOMBIE_SOUND_TYPE_MELEE); crawler_atk1(); }; @@ -153,7 +153,7 @@ void() crawler_die2 =[ 1, crawler_die3] {self.frame = 38;}; void() crawler_die3 =[ 2, SUB_Null] {self.iszomb = 0; self.frame = 39;self.nextthink = time + 3;self.think = removeZombie; if (crawler_num > 0) {crawler_num = crawler_num - 1;}}; //====================== Crawler Tesla Death ============================ -void() crawler_death_wunder1 =[ 72, crawler_death_wunder2 ] {tesla_arc(); play_sound_z(4); }; +void() crawler_death_wunder1 =[ 72, crawler_death_wunder2 ] {tesla_arc(); Zombie_PlaySoundType(ZOMBIE_SOUND_TYPE_DEATH); }; void() crawler_death_wunder2 =[ 73, crawler_death_wunder3 ] {tesla_arc(); }; void() crawler_death_wunder3 =[ 74, crawler_death_wunder4 ] {tesla_arc(); }; void() crawler_death_wunder4 =[ 75, crawler_death_wunder5 ] {tesla_arc(); }; diff --git a/source/server/ai/dog_core.qc b/source/server/ai/dog_core.qc index b886f28..1db2dff 100644 --- a/source/server/ai/dog_core.qc +++ b/source/server/ai/dog_core.qc @@ -69,7 +69,7 @@ void() dog_idleanim6 =[ $dogstand6, dog_idleanim ] {Dog_Think();self.frame = 24; // 25-34 $frame dogmelee1 dogmelee2 dogmelee3 dogmelee4 dogmelee5 dogmelee6 dogmelee7 dogmelee8 dogmelee9 dogmelee10 void() dog_meleeanim =[ $dogmelee1, dog_meleeanim2 ] {Dog_Think(); makevectors(self.angles); self.velocity += v_forward * 50; self.frame = 26;}; -void() dog_meleeanim2 =[ $dogmelee2, dog_meleeanim3 ] {Dog_Think();Zombie_Walk(0);self.frame = 28;sound(self, CHAN_VOICE, "sounds/hound/a0.wav", 1, ATTN_NORM);}; +void() dog_meleeanim2 =[ $dogmelee2, dog_meleeanim3 ] {Dog_Think();Zombie_Walk(0);self.frame = 28; Sound_PlaySound(self, "sounds/hound/a0.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS);}; void() dog_meleeanim3 =[ $dogmelee3, dog_meleeanim4 ] {Dog_Think();Zombie_Walk(0);zombie_attack2();self.frame = 30;}; void() dog_meleeanim4 =[ $dogmelee4, dog_meleeanim5 ] {Dog_Think();Zombie_Walk(0);self.frame = 32;}; void() dog_meleeanim5 =[ $dogmelee5, dog_runanim ] {Dog_Think();Zombie_Walk(0);self.frame = 34;}; @@ -127,10 +127,11 @@ void() Dog_Taunt = self.sound_time = time + 3 * random(); - if (random() > 0.5) - sound(self, CHAN_VOICE, "sounds/hound/t0.wav", 1, ATTN_NORM); - else - sound(self, CHAN_VOICE, "sounds/hound/t1.wav", 1, ATTN_NORM); + if (random() > 0.5) { + Sound_PlaySound(self, "sounds/hound/t0.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); + } else { + Sound_PlaySound(self, "sounds/hound/t1.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); + } } void() Dog_Think = @@ -173,7 +174,7 @@ void(entity ent) Dog_Death_Cleanup = { ent.movetype = MOVETYPE_NONE; ent.takedamage = DAMAGE_NO; - sound(ent, 5, "sounds/null.wav", 1, ATTN_NORM); + sound(ent, CHAN_WEAPON, "sounds/null.wav", 1, ATTN_NORM); ent.usedent = world; ent.health = 0; @@ -184,12 +185,6 @@ void(entity ent) Dog_Death_Cleanup = { void() Dog_Death = { Dog_Death_Cleanup(self); - play_sound_z(3); - //Gotta' make sure we set it back down instead of glitching it up, yo' - if(self.s_time > 0 && sounds_playing > 0) { - sounds_playing --; - self.s_time = 0; - } if(rounds == dogRound && Remaining_Zombies == 0) { Spawn_Powerup(self.origin, PU_MAXAMMO); @@ -198,13 +193,13 @@ void() Dog_Death = { if (self.onfire || self.electro_targeted) { self.frame = 0; setmodel(self, "models/sprites/explosion.spr"); - sound (self, CHAN_WEAPON, "sounds/weapons/grenade/explode.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/grenade/explode.wav", SOUND_TYPE_WEAPON_EXPLODE, SOUND_PRIORITY_PLAYALWAYS); dog_explodeanim(); } else { dog_deathanim(); } - sound(self, CHAN_BODY, "sounds/hound/d0.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/hound/d0.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); self.onfire = 0; self.ads_release = 0; @@ -322,7 +317,7 @@ void(entity where) spawn_a_dogB = sdog.gravity = 1.0; sdog.mins = '-16 -16 -32'; - sdog.maxs = '16 16 4'; + sdog.maxs = '16 16 16'; setsize (sdog, sdog.mins, sdog.maxs); if(pointcontents(sdog.origin - '0 0 36') == -2) @@ -414,7 +409,7 @@ void(entity where) spawn_dog_lightning = dogsprite.ltime = time + 1.3; // we use ltime here to be out remove timer, // since using frames interrupts think() - sound(self, CHAN_AUTO, "sounds/misc/electric_bolt.wav", 1, ATTN_NONE); + Sound_PlaySound(world, "sounds/misc/electric_bolt.wav", SOUND_TYPE_ENV_VOICE, SOUND_PRIORITY_PLAYALWAYS); } float() spawn_a_dogA = diff --git a/source/server/ai/zombie_core.qc b/source/server/ai/zombie_core.qc index 1c00140..ea8d3c8 100644 --- a/source/server/ai/zombie_core.qc +++ b/source/server/ai/zombie_core.qc @@ -46,163 +46,266 @@ float JOG_BBOX = 7; float RUN_BBOX = 8; float CRAWLER_BBOX = 9; -void(float what) play_sound_z = +void(float type) Zombie_PlaySoundType = { + // If we already have ambient groaning type sounds playing, don't allow another. + // We DO want to allow attacks, deaths, etc. though. + if (self.sound_time > time && type != ZOMBIE_SOUND_TYPE_MELEE && type != ZOMBIE_SOUND_TYPE_DEATH) + return; + if(self.classname == "ai_zombie") { - local float e; - e = random(); - - if(what == 1)//attack - { - if (e < 0.125) - sound(self, CHAN_WEAPON, "sounds/zombie/a0.wav", 1, ATTN_NORM); - else if (e < 0.25) - sound(self, CHAN_WEAPON, "sounds/zombie/a1.wav", 1, ATTN_NORM); - else if (e < 0.375) - sound(self, CHAN_WEAPON, "sounds/zombie/a2.wav", 1, ATTN_NORM); - else if( e < 0.5) - sound(self, CHAN_WEAPON, "sounds/zombie/a3.wav", 1, ATTN_NORM); - else if( e < 0.625) - sound(self, CHAN_WEAPON, "sounds/zombie/a4.wav", 1, ATTN_NORM); - else if( e < 0.75) - sound(self, CHAN_WEAPON, "sounds/zombie/a5.wav", 1, ATTN_NORM); - else if( e < 0.875) - sound(self, CHAN_WEAPON, "sounds/zombie/a6.wav", 1, ATTN_NORM); - else - sound(self, CHAN_WEAPON, "sounds/zombie/a7.wav", 1, ATTN_NORM); - return; - } - if(what == 2)//walking! - { - - if(self.s_time < time && self.s_time > 0) - { - sounds_playing --; - self.s_time = 0; - } - if(sounds_playing >= 3) - { - return; - } - sounds_playing++; - self.s_time = time + 1; - - - if(self.sound_time < time) - { - play_sound_z(4); - - if(self.crawling == TRUE) - { - self.sound_time = time + 3 + random()*2; - if(e < 0.2) - sound(self, CHAN_VOICE, "sounds/zombie/t0.wav", 1, ATTN_NORM); - else if (e < 0.4) - sound(self, CHAN_VOICE, "sounds/zombie/t1.wav", 1, ATTN_NORM); - else if (e < 0.6) - sound(self, CHAN_VOICE, "sounds/zombie/t2.wav", 1, ATTN_NORM); - else if (e < 0.8) - sound(self, CHAN_VOICE, "sounds/zombie/t3.wav", 1, ATTN_NORM); - else - sound(self, CHAN_VOICE, "sounds/zombie/t4.wav", 1, ATTN_NORM); - return; - } - if(self.walktype == 1 || self.walktype == 2 || self.walktype == 3) - { - self.sound_time = time + 3 + random(); - if (e < 0.1) - sound(self, CHAN_VOICE, "sounds/zombie/w0.wav", 1, ATTN_NORM); - else if (e < 0.2) - sound(self, CHAN_VOICE, "sounds/zombie/w1.wav", 1, ATTN_NORM); - else if (e < 0.3) - sound(self, CHAN_VOICE, "sounds/zombie/w2.wav", 1, ATTN_NORM); - else if( e < 0.4) - sound(self, CHAN_VOICE, "sounds/zombie/w3.wav", 1, ATTN_NORM); - else if( e < 0.5) - sound(self, CHAN_VOICE, "sounds/zombie/w4.wav", 1, ATTN_NORM); - else if( e < 0.6) - sound(self, CHAN_VOICE, "sounds/zombie/w5.wav", 1, ATTN_NORM); - else if( e < 0.7) - sound(self, CHAN_VOICE, "sounds/zombie/w6.wav", 1, ATTN_NORM); - else if( e < 0.8) - sound(self, CHAN_VOICE, "sounds/zombie/w7.wav", 1, ATTN_NORM); - else if( e < 0.9) - sound(self, CHAN_VOICE, "sounds/zombie/w8.wav", 1, ATTN_NORM); - else - sound(self, CHAN_VOICE, "sounds/zombie/w9.wav", 1, ATTN_NORM); - return; - } - else if(self.walktype == 4 || self.walktype == 5) - { - self.sound_time = time + 4 + random()*2; - if (e < 0.1) - sound(self, CHAN_VOICE, "sounds/zombie/r0.wav", 1, ATTN_NORM); - else if (e < 0.2) - sound(self, CHAN_VOICE, "sounds/zombie/r1.wav", 1, ATTN_NORM); - else if (e < 0.3) - sound(self, CHAN_VOICE, "sounds/zombie/r2.wav", 1, ATTN_NORM); - else if( e < 0.4) - sound(self, CHAN_VOICE, "sounds/zombie/r3.wav", 1, ATTN_NORM); - else if( e < 0.5) - sound(self, CHAN_VOICE, "sounds/zombie/r4.wav", 1, ATTN_NORM); - else if( e < 0.6) - sound(self, CHAN_VOICE, "sounds/zombie/r5.wav", 1, ATTN_NORM); - else if( e < 0.7) - sound(self, CHAN_VOICE, "sounds/zombie/r6.wav", 1, ATTN_NORM); - else if( e < 0.8) - sound(self, CHAN_VOICE, "sounds/zombie/r7.wav", 1, ATTN_NORM); - else if( e < 0.9) - sound(self, CHAN_VOICE, "sounds/zombie/r8.wav", 1, ATTN_NORM); - else - sound(self, CHAN_VOICE, "sounds/zombie/r9.wav", 1, ATTN_NORM); - return; + float next_sound_time = 0; + float curr_sound_len = 0; + float rand = 0; + + switch(type) { + // 8 options. + case ZOMBIE_SOUND_TYPE_MELEE: + rand = rint(random() * 7) + 1; + + switch(rand) { + case 1: + Sound_PlaySound(self.head, "sounds/zombie/a0.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); + curr_sound_len = 1.1; + break; + case 2: + Sound_PlaySound(self.head, "sounds/zombie/a1.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); + curr_sound_len = 0.8; + break; + case 3: + Sound_PlaySound(self.head, "sounds/zombie/a2.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); + curr_sound_len = 0.9; + break; + case 4: + Sound_PlaySound(self.head, "sounds/zombie/a3.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); + curr_sound_len = 0.8; + break; + case 5: + Sound_PlaySound(self.head, "sounds/zombie/a4.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); + curr_sound_len = 1; + break; + case 6: + Sound_PlaySound(self.head, "sounds/zombie/a5.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); + curr_sound_len = 1; + break; + case 7: + Sound_PlaySound(self.head, "sounds/zombie/a6.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); + curr_sound_len = 1; + break; + case 8: + Sound_PlaySound(self.head, "sounds/zombie/a7.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); + curr_sound_len = 1; + break; + default: + break; } + break; + + // 15 options. + case ZOMBIE_SOUND_TYPE_WALK: + rand = rint(random() * 14) + 1; + next_sound_time = rint(random() * 4) + 1; + + // Don't allow overriding current playing sounds. + if (self.s_time > time) + break; - } - } - if(what == 3)//death! - { - if (e < 0.125) - sound(self, CHAN_BODY, "sounds/zombie/d0.wav", 1, ATTN_NORM); - else if (e < 0.25) - sound(self, CHAN_BODY, "sounds/zombie/d1.wav", 1, ATTN_NORM); - else if (e < 0.375) - sound(self, CHAN_BODY, "sounds/zombie/d2.wav", 1, ATTN_NORM); - else if( e < 0.5) - sound(self, CHAN_BODY, "sounds/zombie/d3.wav", 1, ATTN_NORM); - else if( e < 0.625) - sound(self, CHAN_BODY, "sounds/zombie/d4.wav", 1, ATTN_NORM); - else if( e < 0.75) - sound(self, CHAN_BODY, "sounds/zombie/d5.wav", 1, ATTN_NORM); - else if( e < 0.875) - sound(self, CHAN_BODY, "sounds/zombie/d6.wav", 1, ATTN_NORM); - else - sound(self, CHAN_BODY, "sounds/zombie/d7.wav", 1, ATTN_NORM); - return; + switch(rand) { + case 1: + Sound_PlaySound(self.head, "sounds/zombie/w0.wav", SOUND_TYPE_ZOMBIE_QUIET, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 1.3; + break; + case 2: + Sound_PlaySound(self.head, "sounds/zombie/w1.wav", SOUND_TYPE_ZOMBIE_QUIET, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 1.75; + break; + case 3: + Sound_PlaySound(self.head, "sounds/zombie/w2.wav", SOUND_TYPE_ZOMBIE_QUIET, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 1.95; + break; + case 4: + Sound_PlaySound(self.head, "sounds/zombie/w3.wav", SOUND_TYPE_ZOMBIE_QUIET, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 1.4; + break; + case 5: + Sound_PlaySound(self.head, "sounds/zombie/w4.wav", SOUND_TYPE_ZOMBIE_QUIET, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 2.7; + break; + case 6: + Sound_PlaySound(self.head, "sounds/zombie/w5.wav", SOUND_TYPE_ZOMBIE_QUIET, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 1.9; + break; + case 7: + Sound_PlaySound(self.head, "sounds/zombie/w6.wav", SOUND_TYPE_ZOMBIE_QUIET, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 1.6; + break; + case 8: + Sound_PlaySound(self.head, "sounds/zombie/w7.wav", SOUND_TYPE_ZOMBIE_QUIET, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 1.9; + break; + case 9: + Sound_PlaySound(self.head, "sounds/zombie/w8.wav", SOUND_TYPE_ZOMBIE_QUIET, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 2.4; + break; + case 10: + Sound_PlaySound(self.head, "sounds/zombie/w9.wav", SOUND_TYPE_ZOMBIE_QUIET, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 1.5; + break; + case 11: + Sound_PlaySound(self.head, "sounds/zombie/t0.wav", SOUND_TYPE_ZOMBIE_QUIET, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 1.5; + break; + case 12: + Sound_PlaySound(self.head, "sounds/zombie/t1.wav", SOUND_TYPE_ZOMBIE_QUIET, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 1.6; + break; + case 13: + Sound_PlaySound(self.head, "sounds/zombie/t2.wav", SOUND_TYPE_ZOMBIE_QUIET, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 2.3; + break; + case 14: + Sound_PlaySound(self.head, "sounds/zombie/t3.wav", SOUND_TYPE_ZOMBIE_QUIET, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 1.75; + break; + case 15: + Sound_PlaySound(self.head, "sounds/zombie/t4.wav", SOUND_TYPE_ZOMBIE_QUIET, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 1.7; + break; + default: + break; + } + break; + // 5 options. + case ZOMBIE_SOUND_TYPE_CRAWL: + rand = rint(random() * 4) + 1; + next_sound_time = rint(random() * 4) + 1; + + // Don't allow overriding current playing sounds. + if (self.s_time > time) + break; + + switch(rand) { + case 1: + Sound_PlaySound(self.head, "sounds/zombie/t0.wav", SOUND_TYPE_ZOMBIE_CRAWLER, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 1.5; + break; + case 2: + Sound_PlaySound(self.head, "sounds/zombie/t1.wav", SOUND_TYPE_ZOMBIE_CRAWLER, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 1.6; + break; + case 3: + Sound_PlaySound(self.head, "sounds/zombie/t2.wav", SOUND_TYPE_ZOMBIE_CRAWLER, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 2.3; + break; + case 4: + Sound_PlaySound(self.head, "sounds/zombie/t3.wav", SOUND_TYPE_ZOMBIE_CRAWLER, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 1.75; + break; + case 5: + Sound_PlaySound(self.head, "sounds/zombie/t4.wav", SOUND_TYPE_ZOMBIE_CRAWLER, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 1.7; + break; + default: + break; + } + break; + + // 10 options. + case ZOMBIE_SOUND_TYPE_SPRINT: + rand = rint(random() * 9) + 1; + next_sound_time = rint(random() * 4) + 1; + + // Don't allow overriding current playing sounds. + if (self.s_time > time) + break; + + switch(rand) { + case 1: + Sound_PlaySound(self.head, "sounds/zombie/r0.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 3.1; + break; + case 2: + Sound_PlaySound(self.head, "sounds/zombie/r1.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 4.6; + break; + case 3: + Sound_PlaySound(self.head, "sounds/zombie/r2.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 3.4; + break; + case 4: + Sound_PlaySound(self.head, "sounds/zombie/r3.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 5.1; + break; + case 5: + Sound_PlaySound(self.head, "sounds/zombie/r4.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 3.5; + break; + case 6: + Sound_PlaySound(self.head, "sounds/zombie/r5.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 3.2; + break; + case 7: + Sound_PlaySound(self.head, "sounds/zombie/r6.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 5.1; + break; + case 8: + Sound_PlaySound(self.head, "sounds/zombie/r7.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 5.1; + break; + case 9: + Sound_PlaySound(self.head, "sounds/zombie/r8.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 3; + break; + case 10: + Sound_PlaySound(self.head, "sounds/zombie/r9.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_ALLOWSKIP); + curr_sound_len = 4.1; + break; + default: + break; + } + break; + + // 8 options. + case ZOMBIE_SOUND_TYPE_DEATH: + rand = rint(random() * 7) + 1; + next_sound_time = 0.1; + curr_sound_len = 2; + + switch(rand) { + case 1: + Sound_PlaySound(self.head, "sounds/zombie/d0.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); + break; + case 2: + Sound_PlaySound(self.head, "sounds/zombie/d1.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); + break; + case 3: + Sound_PlaySound(self.head, "sounds/zombie/d2.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); + break; + case 4: + Sound_PlaySound(self.head, "sounds/zombie/d3.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); + break; + case 5: + Sound_PlaySound(self.head, "sounds/zombie/d4.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); + break; + case 6: + Sound_PlaySound(self.head, "sounds/zombie/d5.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); + break; + case 7: + Sound_PlaySound(self.head, "sounds/zombie/d6.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); + break; + case 8: + Sound_PlaySound(self.head, "sounds/zombie/d7.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); + break; + default: + break; + } + break; } - if(what == 4)//Taunt! - { - if(random() < 0.83) - return; - - if(e < 0.2) - sound(self, CHAN_ITEM, "sounds/zombie/t0.wav", 1, ATTN_NORM); - else if (e < 0.4) - sound(self, CHAN_ITEM, "sounds/zombie/t1.wav", 1, ATTN_NORM); - else if (e < 0.6) - sound(self, CHAN_ITEM, "sounds/zombie/t2.wav", 1, ATTN_NORM); - else if (e < 0.8) - sound(self, CHAN_ITEM, "sounds/zombie/t3.wav", 1, ATTN_NORM); - else - sound(self, CHAN_ITEM, "sounds/zombie/t4.wav", 1, ATTN_NORM); - return; - } - if (what == 5) // Electric Zap - { - sound(self, CHAN_ITEM, "sounds/machines/elec_shock.wav", 1, ATTN_NORM); - } + + self.sound_time = time + next_sound_time; + self.s_time = time + curr_sound_len; } }; @@ -438,12 +541,12 @@ void() zombie_footstep if(self.laststep == 1) { self.laststep = 0; - sound(self, 5, "sounds/zombie/s0.wav", 0.6, ATTN_NORM); + Sound_PlaySound(self, "sounds/zombie/s0.wav", SOUND_TYPE_PLAYER_FOOTSTEP, SOUND_PRIORITY_PLAYALWAYS); } else { self.laststep = 1; - sound(self, 5, "sounds/zombie/s1.wav", 0.6, ATTN_NORM); + Sound_PlaySound(self, "sounds/zombie/s1.wav", SOUND_TYPE_PLAYER_FOOTSTEP, SOUND_PRIORITY_PLAYALWAYS); } } @@ -743,7 +846,7 @@ void() zombie_ripboardB10 =[ $zripB10, zombie_decide ] {self.frame = 201;Zom //186-188 void() zombie_attack_through_window = { - play_sound_z(1); + Zombie_PlaySoundType(ZOMBIE_SOUND_TYPE_MELEE); local entity who; who = findradius(self.origin, 70); while(who) @@ -789,43 +892,43 @@ void() zombie_attack_through_w19 =[ $zatkw9, zombie_decide ] {self.is_attacki void() zm_swipe_right_slow =[ 1, zm_swipe_right_slow1 ] {self.is_attacking = true; self.frame = 102; SetZombieHitBox(BASE_BBOX); Zombie_Think(); }; void() zm_swipe_right_slow1 =[ 2, zm_swipe_right_slow2 ] {self.frame = 103; Zombie_Think(); }; -void() zm_swipe_right_slow2 =[ 3, zm_swipe_right_slow3 ] {self.frame = 104; Zombie_Think(); }; +void() zm_swipe_right_slow2 =[ 3, zm_swipe_right_slow3 ] {self.frame = 104; Zombie_Think(); Zombie_PlaySoundType(ZOMBIE_SOUND_TYPE_MELEE); }; void() zm_swipe_right_slow3 =[ 4, zm_swipe_right_slow4 ] {zombie_attack2(); self.frame = 105; Zombie_Think(); }; void() zm_swipe_right_slow4 =[ 5, zombie_decide ] {self.is_attacking = false; self.frame = 106; Zombie_Think(); }; -void() zm_swipe_right_fast =[ 1, zm_swipe_right_fast1 ] {self.is_attacking = true; self.frame = 104; Zombie_Think(); }; +void() zm_swipe_right_fast =[ 1, zm_swipe_right_fast1 ] {self.is_attacking = true; self.frame = 104; Zombie_Think(); Zombie_PlaySoundType(ZOMBIE_SOUND_TYPE_MELEE); }; void() zm_swipe_right_fast1 =[ 2, zm_swipe_right_fast2 ] {zombie_attack2(); self.frame = 105; Zombie_Think(); }; void() zm_swipe_right_fast2 =[ 3, zombie_decide ] {self.is_attacking = false; self.frame = 106; Zombie_Think(); }; void() zm_swipe_left_slow =[ 1, zm_swipe_left_slow1 ] {self.is_attacking = true; self.frame = 107; SetZombieHitBox(BASE_BBOX); Zombie_Think(); }; void() zm_swipe_left_slow1 =[ 2, zm_swipe_left_slow2 ] {self.frame = 108; Zombie_Think(); }; -void() zm_swipe_left_slow2 =[ 3, zm_swipe_left_slow3 ] {self.frame = 109; Zombie_Think(); }; +void() zm_swipe_left_slow2 =[ 3, zm_swipe_left_slow3 ] {self.frame = 109; Zombie_Think(); Zombie_PlaySoundType(ZOMBIE_SOUND_TYPE_MELEE); }; void() zm_swipe_left_slow3 =[ 4, zm_swipe_left_slow4 ] {zombie_attack2(); self.frame = 110; Zombie_Think(); }; void() zm_swipe_left_slow4 =[ 5, zm_swipe_left_slow5 ] {self.frame = 111; Zombie_Think(); }; void() zm_swipe_left_slow5 =[ 6, zombie_decide ] {self.is_attacking = false; self.frame = 112; Zombie_Think(); }; -void() zm_swipe_left_fast =[ 1, zm_swipe_left_fast1 ] {self.is_attacking = true; self.frame = 109; SetZombieHitBox(BASE_BBOX); Zombie_Think(); }; +void() zm_swipe_left_fast =[ 1, zm_swipe_left_fast1 ] {self.is_attacking = true; self.frame = 109; SetZombieHitBox(BASE_BBOX); Zombie_Think(); Zombie_PlaySoundType(ZOMBIE_SOUND_TYPE_MELEE); }; void() zm_swipe_left_fast1 =[ 2, zm_swipe_left_fast2 ] {zombie_attack2(); self.frame = 110; Zombie_Think(); }; void() zm_swipe_left_fast2 =[ 3, zm_swipe_left_fast3 ] {self.frame = 111; Zombie_Think(); }; void() zm_swipe_left_fast3 =[ 4, zombie_decide ] {self.is_attacking = false; self.frame = 112; Zombie_Think(); }; void() zm_swipe_both_slow =[ 1, zm_swipe_both_slow1 ] {self.is_attacking = true; self.frame = 102; SetZombieHitBox(BASE_BBOX); Zombie_Think(); }; void() zm_swipe_both_slow1 =[ 2, zm_swipe_both_slow2 ] {self.frame = 103; Zombie_Think(); }; -void() zm_swipe_both_slow2 =[ 3, zm_swipe_both_slow3 ] {self.frame = 104; Zombie_Think(); }; +void() zm_swipe_both_slow2 =[ 3, zm_swipe_both_slow3 ] {self.frame = 104; Zombie_Think(); Zombie_PlaySoundType(ZOMBIE_SOUND_TYPE_MELEE); }; void() zm_swipe_both_slow3 =[ 4, zm_swipe_both_slow4 ] {zombie_attack2(); self.frame = 105; Zombie_Think(); }; void() zm_swipe_both_slow4 =[ 5, zm_swipe_both_slow5 ] {self.frame = 106; Zombie_Think(); }; void() zm_swipe_both_slow5 =[ 6, zm_swipe_both_slow6 ] {self.frame = 107; Zombie_Think(); }; void() zm_swipe_both_slow6 =[ 7, zm_swipe_both_slow7 ] {self.frame = 108; Zombie_Think(); }; void() zm_swipe_both_slow7 =[ 8, zm_swipe_both_slow8 ] {self.frame = 109; Zombie_Think(); }; -void() zm_swipe_both_slow8 =[ 9, zm_swipe_both_slow9 ] {self.frame = 110; Zombie_Think(); }; +void() zm_swipe_both_slow8 =[ 9, zm_swipe_both_slow9 ] {self.frame = 110; Zombie_Think(); Zombie_PlaySoundType(ZOMBIE_SOUND_TYPE_MELEE); }; void() zm_swipe_both_slow9 =[ 10, zombie_decide ] {zombie_attack2(); self.is_attacking = false; self.frame = 111; Zombie_Think(); }; -void() zm_swipe_both_fast =[ 1, zm_swipe_both_fast1 ] {self.is_attacking = true; self.frame = 104; SetZombieHitBox(BASE_BBOX); Zombie_Think(); }; +void() zm_swipe_both_fast =[ 1, zm_swipe_both_fast1 ] {self.is_attacking = true; self.frame = 104; SetZombieHitBox(BASE_BBOX); Zombie_Think(); Zombie_PlaySoundType(ZOMBIE_SOUND_TYPE_MELEE); }; void() zm_swipe_both_fast1 =[ 2, zm_swipe_both_fast2 ] {zombie_attack2(); self.frame = 105; Zombie_Think(); }; void() zm_swipe_both_fast2 =[ 3, zm_swipe_both_fast3 ] {self.frame = 106; Zombie_Think(); }; void() zm_swipe_both_fast3 =[ 4, zm_swipe_both_fast4 ] {self.frame = 109; Zombie_Think(); }; void() zm_swipe_both_fast4 =[ 5, zm_swipe_both_fast5 ] {self.frame = 110; Zombie_Think(); }; -void() zm_swipe_both_fast5 =[ 6, zm_swipe_both_fast6 ] {self.frame = 111; Zombie_Think(); }; +void() zm_swipe_both_fast5 =[ 6, zm_swipe_both_fast6 ] {self.frame = 111; Zombie_Think(); Zombie_PlaySoundType(ZOMBIE_SOUND_TYPE_MELEE); }; void() zm_swipe_both_fast6 =[ 7, zombie_decide ] {zombie_attack2(); self.is_attacking = false; self.frame = 112; Zombie_Think(); }; void(float which) zombie_attack_choose = @@ -840,8 +943,6 @@ void(float which) zombie_attack_choose = return; } } - - play_sound_z(1); // // choose what attack to play @@ -1196,16 +1297,9 @@ void() Zombie_Death = // Death Noises if (self.electro_targeted == false) - play_sound_z(3); + Zombie_PlaySoundType(ZOMBIE_SOUND_TYPE_DEATH); else - play_sound_z(5); - - //Gotta' make sure we set it back down instead of glitching it up, yo' - if(self.s_time > 0 && sounds_playing > 0) - { - sounds_playing --; - self.s_time = 0; - } + Sound_PlaySound(self.head, "sounds/machines/elec_shock.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); if(self.outside == false && self.electro_targeted == false) { @@ -1314,7 +1408,7 @@ void() Z_ElectroShock = } // Play the first Electro-Sound - play_sound_z(5); + Sound_PlaySound(self.head, "sounds/machines/elec_shock.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); } /////////////////////ZOMBIE WAFFE STUFF///////////////////// @@ -1323,14 +1417,14 @@ void() Z_ElectroShock = // 149-152 (FIXME - animate wunder'd zombies) $frame wunder1 wunder2 wunder3 wunder4 wunder5 wunder6 wunder7 wunder8 wunder9 wunder10 -void() zombie_wunder1 =[ $wunder1, zombie_wunder2 ] {tesla_arc(); play_sound_z(4); self.frame = 149;}; +void() zombie_wunder1 =[ $wunder1, zombie_wunder2 ] {tesla_arc(); Zombie_PlaySoundType(ZOMBIE_SOUND_TYPE_CRAWL); self.frame = 149;}; void() zombie_wunder2 =[ $wunder2, zombie_wunder3 ] {tesla_arc(); self.frame = 150;}; void() zombie_wunder3 =[ $wunder3, zombie_wunder4 ] {tesla_arc(); self.frame = 151;}; void() zombie_wunder4 =[ $wunder4, zombie_wunder5 ] {tesla_arc(); self.frame = 152;}; void() zombie_wunder5 =[ $wunder5, zombie_wunder6 ] {tesla_arc(); self.frame = 151;}; void() zombie_wunder6 =[ $wunder6, zombie_wunder7 ] {tesla_arc(); self.frame = 152;}; void() zombie_wunder7 =[ $wunder7, zombie_wunder8 ] {tesla_arc(); self.frame = 151;}; -void() zombie_wunder8 =[ $wunder8, zombie_wunder9 ] {tesla_arc(); play_sound_z(3); self.frame = 152;}; +void() zombie_wunder8 =[ $wunder8, zombie_wunder9 ] {tesla_arc(); Zombie_PlaySoundType(ZOMBIE_SOUND_TYPE_DEATH); self.frame = 152;}; void() zombie_wunder9 =[ $wunder9, zombie_wunder10 ] {tesla_arc(); self.frame = 151;}; void() zombie_wunder10 =[ $wunder10, SUB_Null ] { tesla_arc(); self.iszomb = 0; self.nextthink = time + 3; self.think = removeZombie;self.frame = 152; diff --git a/source/server/damage.qc b/source/server/damage.qc index 7958699..a920481 100644 --- a/source/server/damage.qc +++ b/source/server/damage.qc @@ -150,7 +150,7 @@ void() EndGameSetup = self.movetype = MOVETYPE_TOSS; if (!game_over) { - sound(self, CHAN_AUTO, "sounds/music/end.wav", 1, ATTN_NONE); + Rounds_PlayTransition("sounds/music/end.wav"); NotifyGameEnd(); } game_over = true; @@ -243,7 +243,7 @@ void(entity attacker, float d_style) DieHandler = points_earned = DMG_SCORE_GRENADE; // override their death sound (FIXME: make a new sound..) - sound(self, CHAN_BODY, "sounds/pu/drop.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/pu/drop.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); break; case DMG_TYPE_GRENADE: points_earned = DMG_SCORE_GRENADE; @@ -334,10 +334,11 @@ void(entity victim, entity attacker, float damage, float d_style) DamageHandler victim.punchangle_y = distance_y; // Play pain noise if this isn't done by an electric barrier. - if (d_style != DMG_TYPE_ELECTRICTRAP) - sound (victim, CHAN_AUTO, "sounds/player/pain4.wav", 1, ATTN_NORM); - else - sound (victim, CHAN_AUTO, "sounds/machines/elec_shock.wav", 1, ATTN_NORM); + if (d_style != DMG_TYPE_ELECTRICTRAP) { + Sound_PlaySound(victim, "sounds/player/pain4.wav", SOUND_TYPE_PLAYER_VOICE, SOUND_PRIORITY_PLAYALWAYS); + } else { + Sound_PlaySound(victim, "sounds/machines/elec_shock.wav", SOUND_TYPE_PLAYER_VOICE, SOUND_PRIORITY_PLAYALWAYS); + } if (victim.sprinting) { old_self = self; diff --git a/source/server/defs/custom.qc b/source/server/defs/custom.qc index 50cc0e1..8203253 100644 --- a/source/server/defs/custom.qc +++ b/source/server/defs/custom.qc @@ -385,9 +385,18 @@ float tracemove(vector start, vector min, vector max, vector end, float nomonste .float way_path[40]; .float way_cur; +// +// Zombie Sound System +// + +#define ZOMBIE_SOUND_TYPE_MELEE 0 +#define ZOMBIE_SOUND_TYPE_WALK 1 +#define ZOMBIE_SOUND_TYPE_CRAWL 2 +#define ZOMBIE_SOUND_TYPE_SPRINT 3 +#define ZOMBIE_SOUND_TYPE_DEATH 4 + .float sound_time; .float s_time; -float sounds_playing; .float fall; //.vector lastOrg;//Zombie's last origin, for checking stuckness @@ -518,7 +527,6 @@ float blink_return; float delay_at_round; float spawn_delay; float totalpowerups; -float sounds_playing; float barricade_reward_maximum; .float barricade_reward; diff --git a/source/server/entities/doors.qc b/source/server/entities/doors.qc index 5422706..a6b6a75 100644 --- a/source/server/entities/doors.qc +++ b/source/server/entities/doors.qc @@ -274,19 +274,30 @@ if (self.state == STATE_TOP || self.state == STATE_UP) if (other.points >= self.cost) { door_fire(); - sound(self, 0, "sounds/misc/ching.wav", 1, 1); - sound(self, 1, "sounds/misc/buy.wav", 1, 1); + + // We need to create a new entity with the specific assignment of + // just playing the door sound, due to the door moving if we just + // assign the sound to the door, it cannot be heard when the engine + // supports SOUNDFLAG_FOLLOW. + entity door_sound = spawn(); + setorigin(door_sound, other.origin); + door_sound.think = SUB_Remove; + door_sound.nextthink = time + 5; + + Sound_PlaySound(other, "sounds/misc/ching.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); + Sound_PlaySound(door_sound, "sounds/misc/buy.wav", SOUND_TYPE_ENV_IMPORTANT, SOUND_PRIORITY_PLAYALWAYS); switch(self.sounds) { case 1: - sound(self, 2, "sounds/misc/wood_door.wav", 1, 1); + Sound_PlaySound(door_sound, "sounds/misc/wood_door.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); break; case 2: - sound(self, 2, "sounds/misc/debris.wav", 1, 1); + Sound_PlaySound(door_sound, "sounds/misc/debris.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); break; default: break; } + Player_RemoveScore(other, self.cost); self.solid = SOLID_NOT; } @@ -295,7 +306,7 @@ if (self.state == STATE_TOP || self.state == STATE_UP) if(other.classname == "player" && !other.downed) { centerprint (other, STR_NOTENOUGHPOINTS); - sound(other, 0, "sounds/misc/denybuy.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/denybuy.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); other.semi_actions |= SEMIACTION_USE; } } diff --git a/source/server/entities/explosive_barrel.qc b/source/server/entities/explosive_barrel.qc index 303152f..1af4f05 100644 --- a/source/server/entities/explosive_barrel.qc +++ b/source/server/entities/explosive_barrel.qc @@ -31,7 +31,7 @@ // void() Barrel_Explode = { - sound (self, CHAN_WEAPON, self.oldmodel, 1, ATTN_NORM); + Sound_PlaySound(self, self.oldmodel, SOUND_TYPE_WEAPON_EXPLODE, SOUND_PRIORITY_PLAYALWAYS); DamgageExplode (self, self.enemy, 1, 250, 250); #ifdef FTE diff --git a/source/server/entities/func.qc b/source/server/entities/func.qc index 7351c48..17aff9a 100644 --- a/source/server/entities/func.qc +++ b/source/server/entities/func.qc @@ -174,7 +174,7 @@ void() train_wait = { if (self.wait) { self.nextthink = self.ltime + self.wait; - sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM); + sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM); } else { self.nextthink = self.ltime + 0.1; } @@ -204,7 +204,7 @@ void() train_next = else self.wait = 0; - sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM); + sound(self, CHAN_VOICE, self.noise1, 1, ATTN_NORM); SUB_CalcMove (targ.origin - self.mins, self.speed, train_wait); }; @@ -237,16 +237,16 @@ void() func_train = if (self.sounds == 0) { self.noise = ("sounds/null.wav"); - precache_sound ("sounds/null.wav"); + precache_sound("sounds/null.wav"); self.noise1 = ("sounds/null.wav"); - precache_sound ("sounds/null.wav"); + precache_sound("sounds/null.wav"); } if (self.sounds == 1) { self.noise = ("sounds/misc/debris.wav"); - precache_sound ("sounds/misc/debris.wav"); + precache_sound("sounds/misc/debris.wav"); self.noise1 = ("sounds/misc/debris.wav"); - precache_sound ("sounds/misc/debris.wav"); + precache_sound("sounds/misc/debris.wav"); } self.cnt = 1; @@ -315,7 +315,7 @@ void() button_fire = if (self.state == STATE_UP || self.state == STATE_TOP) return; - sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM); + //sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM); self.state = STATE_UP; SUB_CalcMove (self.pos2, self.speed, button_wait); @@ -349,7 +349,7 @@ void() button_touch = return; } else { centerprint(other, STR_NOTENOUGHPOINTS); - sound(other, 0, "sounds/misc/denybuy.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/denybuy.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); } } } diff --git a/source/server/entities/machines.qc b/source/server/entities/machines.qc index 41aaf45..d370494 100644 --- a/source/server/entities/machines.qc +++ b/source/server/entities/machines.qc @@ -117,7 +117,7 @@ void DrinkPerk() { self.knife_delay = self.reload_delay2 = self.fire_delay2 = self.fire_delay = self.reload_delay = 3 + time; W_HideCrosshair(self); Set_W_Frame (machine.weapon_animduration, machine.weapon2_animduration, 2.25, 0, PERK, GivePerk, machine.weapon2model, true, S_RIGHT, true); - sound(self, CHAN_ITEM, machine.oldmodel, 1, ATTN_NORM); + Sound_PlaySound(self, machine.oldmodel, SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); // Communicate to our engines that this client should display correct Double-Tap icon. if (self.style == P_DOUBLE) { @@ -172,7 +172,7 @@ void() Perk_StopLeaveAnimation = Light_None(self); // Remove light effect SUB_UseTargets(); - sound(self,CHAN_ITEM,"sounds/pu/drop.wav",1,ATTN_NONE); // Play a fitting sound + Sound_PlaySound(self, "sounds/pu/drop.wav", SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); // Play a fitting sound } void() Perk_MachineLeaveAnimation = @@ -200,7 +200,7 @@ void() Perk_MachineGoAwayForReal = self.movetype = MOVETYPE_NOCLIP; self.velocity = v_up * 7; - sound(self, CHAN_ITEM, "sounds/pu/byebye.wav", 1, ATTN_NORM); + Sound_PlaySound(world, "sounds/pu/byebye.wav", SOUND_TYPE_ENV_VOICE, SOUND_PRIORITY_PLAYALWAYS); // Do our silly little animation for 6 seconds self.ltime = time + 6; @@ -277,11 +277,11 @@ void() touch_perk = Player_RemoveScore(other, price); // Play the sound of the bottle "vending" - sound(self, CHAN_ITEM,"sounds/machines/vend.wav", 1, 1); + Sound_PlaySound(self, "sounds/machines/vend.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); // Play Perk Sting if we can and it exists if (self.aistatus && self.ltime < time) { - sound(self, CHAN_AUTO, self.aistatus, 0.8, ATTN_IDLE); + Sound_PlaySound(self, self.aistatus, SOUND_TYPE_ENV_MUSIC, SOUND_PRIORITY_PLAYALWAYS); self.ltime = time + self.anim_weapon_time; } @@ -318,7 +318,7 @@ void() touch_perk = } else if (other.button7 && !(other.semi_actions & SEMIACTION_USE)) { // We tried to use, but we don't have the cash.. centerprint(other, STR_NOTENOUGHPOINTS); - sound(other, 0, "sounds/misc/denybuy.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/denybuy.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); other.semi_actions |= SEMIACTION_USE; } } @@ -387,9 +387,9 @@ void() Perk_Jingle = self.nextthink = time + jinglewaittime; } else { // 15% Chance to Play Jingle - local float chance = random(); + float chance = random(); if (chance <= 0.15) { - sound(self, CHAN_AUTO, self.powerup_vo, 0.8, ATTN_IDLE); + Sound_PlaySound(self, self.powerup_vo, SOUND_TYPE_ENV_MUSIC, SOUND_PRIORITY_PLAYALWAYS); self.ltime = time + self.anim_weapon2_time; jinglewaittime += self.anim_weapon2_time; } @@ -645,7 +645,7 @@ void() touch_power_Switch = if (other.button7 && !isPowerOn) { turnpower1(); isPowerOn = true; - sound(self, CHAN_ITEM, self.oldmodel, 1, ATTN_NONE); + Sound_PlaySound(world, self.oldmodel, SOUND_TYPE_ENV_VOICE, SOUND_PRIORITY_PLAYALWAYS); // Print message if (self.message) { diff --git a/source/server/entities/map_entities.qc b/source/server/entities/map_entities.qc index 488043a..75c72e7 100644 --- a/source/server/entities/map_entities.qc +++ b/source/server/entities/map_entities.qc @@ -53,7 +53,7 @@ void() radioPlay = self.health = 1; if (self.radioState == 1) { - sound (self, CHAN_ITEM, self.tune, 1, ATTN_NORM); + Sound_PlaySound(self, self.tune, SOUND_TYPE_ENV_IMPORTANT, SOUND_PRIORITY_PLAYALWAYS); if (!(self.spawnflags & SPAWNFLAG_RADIO_PLAYONCE)) @@ -69,7 +69,7 @@ void() radioPlay = self.think = radioPlay; } else if (self.radioState == 0) { - sound (self, CHAN_ITEM, "sounds/null.wav", 1, ATTN_NONE); + sound(self, CHAN_ITEM, "sounds/null.wav", 1, ATTN_NONE); self.nextthink = 0; self.think = SUB_Null; } @@ -79,7 +79,7 @@ void() radio_hit = { self.health = 1; - sound (self, CHAN_ITEM, "sounds/misc/radio.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/misc/radio.wav", SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); self.nextthink = time + 1; self.think = radioPlay; @@ -99,7 +99,7 @@ void() item_radio = if (!self.maxs) self.maxs = '8 8 4'; precache_model (self.model); - precache_sound ("sounds/misc/radio.wav"); + precache_sound("sounds/misc/radio.wav"); // Backwards compatibility if (!self.tune) { @@ -107,7 +107,7 @@ void() item_radio = self.length = 10.1; } - precache_sound (self.tune); + precache_sound(self.tune); self.movetype = MOVETYPE_NONE; // so it doesn't get pushed by anything self.solid=SOLID_BBOX; self.classname = "item_radio"; @@ -140,7 +140,7 @@ void() teddy_spawn = self.th_die = teddy_react; if (self.noise) - precache_sound (self.noise); + precache_sound(self.noise); }; /* ================== diff --git a/source/server/entities/mystery_box.qc b/source/server/entities/mystery_box.qc index 16247ed..91e34bb 100644 --- a/source/server/entities/mystery_box.qc +++ b/source/server/entities/mystery_box.qc @@ -86,7 +86,7 @@ inline void() MBOX_Reset = // Plays the open animation for the Mystery Box, // frames 9-12. // -void() MBOX_PlayCloseAnimation = [9, MBOX_CloseAnimation2 ] { self.frame = 9; MBOX_UpdateGlowFrame(); sound (self, CHAN_ITEM, mystery_box_close_sound, 1, ATTN_NORM); Light_None(self); }; +void() MBOX_PlayCloseAnimation = [9, MBOX_CloseAnimation2 ] { self.frame = 9; MBOX_UpdateGlowFrame(); Sound_PlaySound(self, mystery_box_close_sound, SOUND_TYPE_ENV_MUSIC, SOUND_PRIORITY_PLAYALWAYS); Light_None(self); }; void() MBOX_CloseAnimation2 = [10, MBOX_CloseAnimation3 ] { self.frame = 10; MBOX_UpdateGlowFrame(); }; void() MBOX_CloseAnimation3 = [10, MBOX_CloseAnimation4 ] { self.frame = 11; MBOX_UpdateGlowFrame(); }; void() MBOX_CloseAnimation4 = [10, MBOX_Reset ] { self.frame = 12; MBOX_UpdateGlowFrame(); }; @@ -308,7 +308,7 @@ void() MBOX_FindNewSpot = // Spawn some sparkles so it doesn't just "appear" SpawnSpark(new_box.origin, 0.75); // "Woosh" Effect - sound(new_box, CHAN_AUTO, "sounds/pu/drop.wav", 1, ATTN_NORM); + Sound_PlaySound(new_box, "sounds/pu/drop.wav", SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); } // @@ -321,7 +321,7 @@ void() MBOX_StopFlying = // Spark Effect SpawnSpark(self.origin, 0.75); // "Woosh" Effect - sound(self, CHAN_AUTO, "sounds/pu/drop.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/pu/drop.wav", SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); // Disappear! self.model = "models/props/teddy.mdl"; setmodel(self, self.model); @@ -385,9 +385,9 @@ void() MBOX_FlyAway = void() MBOX_Leave = { // Broadcast the laughter - sound(self, CHAN_ITEM, "sounds/pu/byebye.wav", 1, ATTN_NONE); + Sound_PlaySound(world, "sounds/pu/byebye.wav", SOUND_TYPE_ENV_VOICE, SOUND_PRIORITY_PLAYALWAYS); // "Woosh" Effect - sound(self, CHAN_AUTO, "sounds/pu/drop.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/pu/drop.wav", SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); // Spark Effect SpawnSpark(self.origin, 0.75); // Turn off Light & Glow @@ -440,8 +440,9 @@ void() MBOX_PresentTeddy = Player_AddScore(self.owner.owner, mystery_box_cost, false); // Broadcast the bad luck. - sound(self, CHAN_ITEM, "sounds/misc/buy.wav", 1, ATTN_NONE); - sound(self, 2, "sounds/misc/giggle.wav", 1, ATTN_NONE); + Sound_PlaySound(self, "sounds/misc/buy.wav", SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); + Sound_PlaySound(self, "sounds/misc/giggle.wav", SOUND_TYPE_ENV_VOICE, SOUND_PRIORITY_PLAYALWAYS); + // Linger for 2 seconds, and then fly away. self.think = MBOX_TeddyLeave; self.nextthink = time + 2; @@ -621,8 +622,8 @@ void() Create_Floating_Weapon = void() mystery_box_tp_spot = { precache_model ("models/props/teddy.mdl"); - precache_sound ("sounds/pu/byebye.wav"); - precache_sound ("sounds/misc/giggle.wav"); + precache_sound("sounds/pu/byebye.wav"); + precache_sound("sounds/misc/giggle.wav"); self.solid=SOLID_TRIGGER; self.classname = "mystery_box_tp_spot"; @@ -687,7 +688,7 @@ void() MBOX_Touch = { if (other.points >= mystery_box_cost) { - sound (self, CHAN_ITEM, mystery_box_open_sound, 1, ATTN_NORM); + Sound_PlaySound(self, mystery_box_open_sound, SOUND_TYPE_ENV_MUSIC, SOUND_PRIORITY_PLAYALWAYS); Player_RemoveScore(other, mystery_box_cost); self.boxstatus = 1; self.owner = other; @@ -698,7 +699,7 @@ void() MBOX_Touch = } else { centerprint (other, STR_NOTENOUGHPOINTS); - sound(other, 0, "sounds/misc/denybuy.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/denybuy.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); } } if (self.boxstatus == 2) @@ -707,7 +708,7 @@ void() MBOX_Touch = { other.reload_delay = 0; self.owner = world; - sound(self, 0,"sounds/misc/ching.wav", 1, 1); + Sound_PlaySound(self, "sounds/misc/ching.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); tempe = self; self = other; diff --git a/source/server/entities/pack_a_punch.qc b/source/server/entities/pack_a_punch.qc index 1a4ca7e..bc49f9a 100644 --- a/source/server/entities/pack_a_punch.qc +++ b/source/server/entities/pack_a_punch.qc @@ -128,7 +128,7 @@ void() PAP_Tick = if (self.ltime < time) PAP_Reset(); else { - sound(self, CHAN_BODY, "sounds/machines/packapunch/tick.wav", 1, 1); + Sound_PlaySound(self, "sounds/machines/packapunch/tick.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); self.nextthink = time + 0.87; } }; @@ -187,11 +187,11 @@ void(entity pap, entity buyer) PAP_UpgradeWeapon = // Give a nice blue glow and play upgrade sound Light_Cyan(pap, false); - sound(pap, CHAN_ITEM, pap.oldmodel, 0.8, 1); + Sound_PlaySound(pap, pap.oldmodel, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); // Mapper-provided musical sting. if (pap.powerup_vo) - sound(pap, CHAN_AUTO, pap.powerup_vo, 1, ATTN_IDLE); + Sound_PlaySound(pap, pap.powerup_vo, SOUND_TYPE_ENV_MUSIC, SOUND_PRIORITY_PLAYALWAYS); // // Spawn and prepare the floating Weapon @@ -226,7 +226,7 @@ void(entity pap, entity buyer) PAP_UpgradeWeapon = // Play Player's view model animation and sound. self.fire_delay = self.reload_delay = 2.0 + time; - sound(self,CHAN_WEAPON,"sounds/machines/papsound.wav",1,ATTN_NORM); + Sound_PlaySound(self, "sounds/machines/papsound.wav", SOUND_TYPE_PLAYER_VOICE, SOUND_PRIORITY_PLAYALWAYS); pap.weapon = self.weapon; @@ -284,7 +284,7 @@ void() PAP_Touch = else if (other.button7 && other.weapon && !(other.semi_actions & SEMIACTION_USE)) { other.semi_actions |= SEMIACTION_USE; centerprint (other, STR_NOTENOUGHPOINTS); - sound(other, 0, "sounds/misc/denybuy.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/denybuy.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); } } @@ -319,7 +319,7 @@ void() PAP_Touch = void() PAP_Click = { if (!self.active_door.papState) - sound(self, CHAN_ITEM, "sounds/machines/packapunch/gear_shift.wav", 1, 1); + Sound_PlaySound(self, "sounds/machines/packapunch/gear_shift.wav", SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); self.nextthink = time + 0.75; }; @@ -428,7 +428,7 @@ void() perk_pap = if (self.powerup_vo) precache_sound(self.powerup_vo); - precache_sound ("sounds/machines/papsound.wav"); + precache_sound("sounds/machines/papsound.wav"); precache_sound("sounds/weapons/papfire.wav"); precache_sound("sounds/machines/packapunch/gear_shift.wav"); precache_sound("sounds/machines/packapunch/tick.wav"); diff --git a/source/server/entities/powerups.qc b/source/server/entities/powerups.qc index 847c1b9..594b778 100644 --- a/source/server/entities/powerups.qc +++ b/source/server/entities/powerups.qc @@ -314,7 +314,7 @@ void() PU_NukeKill = self.th_die(); // override their death sound - sound(self, CHAN_BODY, "sounds/pu/nuke.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/pu/nuke.wav", SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); // restore self self = oldself; @@ -663,7 +663,7 @@ void() PU_Flash = // void() PU_PlayVO = { - sound(self, CHAN_VOICE, self.powerup_vo, 1, ATTN_NONE); + Sound_PlaySound(world, self.powerup_vo, SOUND_TYPE_ENV_VOICE, SOUND_PRIORITY_ALLOWSKIP); PU_FreeEnt(self); }; @@ -700,7 +700,7 @@ void() PU_Touch = if (other.classname == "player") { // Acquire sound - sound(self.owner, CHAN_VOICE, "sounds/pu/pickup.wav", 1, ATTN_NONE); + Sound_PlaySound(self.owner, "sounds/pu/pickup.wav", SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); // Prepare for VO and destruction self.think = PU_PlayVO; @@ -749,7 +749,7 @@ void() PU_SparkleThink = if(self.calc_time <= time) { - sound(self, CHAN_VOICE, "sounds/pu/powerup.wav", 0.6, ATTN_NORM); + Sound_PlaySound(self, "sounds/pu/powerup.wav", SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); self.calc_time = time + 2.998; } }; @@ -827,8 +827,8 @@ void(vector where, float type) Spawn_Powerup = sparkle.nextthink = time + 0.1; // Drop Sounds - sound(sparkle, CHAN_VOICE, "sounds/pu/powerup.wav", 0.6, ATTN_NORM); - sound(powerup, CHAN_AUTO, "sounds/pu/drop.wav", 1, ATTN_NONE); + Sound_PlaySound(sparkle, "sounds/pu/powerup.wav", SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); + Sound_PlaySound(powerup, "sounds/pu/drop.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); // Check if we were forcefully assigned an ID if (type != -1) { diff --git a/source/server/entities/teleporter.qc b/source/server/entities/teleporter.qc index 7f755cc..f3544cc 100644 --- a/source/server/entities/teleporter.qc +++ b/source/server/entities/teleporter.qc @@ -74,7 +74,7 @@ void() teleport_entities_back = SUB_UseTargets(); self.iszomb = 0; - sound(self.entities[0], CHAN_WEAPON, "sounds/machines/elec_shock.wav", 1, ATTN_NORM); + Sound_PlaySound(self.entities[0], "sounds/machines/elec_shock.wav", SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); for(float i = 0; i < 4; i++) { if (self.entities[i].classname == "player") { @@ -223,7 +223,7 @@ void() teleport_pad_touch = if (other.button7) { self.host.isLinked = true; self.host.waitLink = false; - sound(self, CHAN_WEAPON, "sounds/weapons/tesla/switchon.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/tesla/switchon.wav", SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); } } else { if (self.host.mode == 2) { @@ -242,7 +242,7 @@ void() teleporter_link_touch = local entity en; en = find(world, targetname, self.target2); - sound(self, CHAN_WEAPON, "sounds/weapons/tesla/switchoff.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/tesla/switchoff.wav", SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); self.waitLink = true; en.host = self; } @@ -281,7 +281,7 @@ void() teleport_touch = if (other.points < self.cost) { centerprint(other, STR_NOTENOUGHPOINTS); - sound(other, 0, "sounds/misc/denybuy.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/denybuy.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); return; } @@ -298,7 +298,7 @@ void() teleport_touch = people.movetype = MOVETYPE_NONE; } else if (people.classname == "ai_dog" && !people.electro_targeted) { - sound(self, CHAN_WEAPON, "sounds/machines/elec_shock.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/machines/elec_shock.wav", SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); tempe = self; self = people; @@ -322,7 +322,7 @@ void() teleport_touch = self.think = teleport_entities; self.nextthink = time + 1; SpawnSpark(self.origin + '0 0 32', 1.5); - sound(self, CHAN_WEAPON, "sounds/machines/elec_shock.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/machines/elec_shock.wav", SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); } if (other.button1) { diff --git a/source/server/entities/traps.qc b/source/server/entities/traps.qc index 52d9712..f60e701 100644 --- a/source/server/entities/traps.qc +++ b/source/server/entities/traps.qc @@ -110,7 +110,7 @@ void() zapper_do_damage = // - Dogs should always explode on contact, instantly. // - Trap plays Electro-Shock sound, dog plays explosion. else if (other.classname == "ai_dog") { - sound(self, CHAN_WEAPON, "sounds/machines/elec_shock.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/machines/elec_shock.wav", SOUND_TYPE_ZOMBIE_LOUD, SOUND_PRIORITY_PLAYALWAYS); tempe = self; self = other; @@ -250,7 +250,7 @@ void() zapper_touch = other.semi_actions |= SEMIACTION_USE; if (other.points < self.cost) { centerprint(other, STR_NOTENOUGHPOINTS); - sound(other, 0, "sounds/misc/denybuy.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/denybuy.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); return; } diff --git a/source/server/entities/triggers.qc b/source/server/entities/triggers.qc index 9f1e5f8..1b5a3b5 100644 --- a/source/server/entities/triggers.qc +++ b/source/server/entities/triggers.qc @@ -231,7 +231,7 @@ void() trigger_interact_touch = if (other.button7) { if (self.noise) - sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM); + Sound_PlaySound(other, self.noise, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); multi_trigger(); } } @@ -265,7 +265,7 @@ void() teddy_react = if (self.noise) - sound (dummy, CHAN_ITEM, self.noise, 1, ATTN_NORM); + Sound_PlaySound(dummy, self.noise, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); Ent_FakeRemove(self); } @@ -381,7 +381,7 @@ void() trigger_awardpoints_touch = Player_AddScore(other, self.points, (self.spawnflags & SPAWNFLAG_TRIGGERSCORE_APPLY2XPOINTS)); if (self.noise != "") - sound(self, 0, self.noise, 1, 1); + Sound_PlaySound(self, self.noise, SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); self.health = 0; } diff --git a/source/server/entities/wall_weapon.qc b/source/server/entities/wall_weapon.qc index b6889d6..51d5b7c 100644 --- a/source/server/entities/wall_weapon.qc +++ b/source/server/entities/wall_weapon.qc @@ -52,7 +52,7 @@ void() WallWeapon_Use = return; // Play a sound for it "spawning" - sound(self, 1, "sounds/misc/buy.wav", 1, 1); + Sound_PlaySound(self, "sounds/misc/buy.wav", SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); // MP5K and Waffe were added in late in the mix-up.. needs special case. Also grenade bag. switch(self.sequence + 1) { @@ -186,7 +186,7 @@ void () WallWeapon_TouchTrigger = // Player doesn't have enough points. Abort. if (other.points < wcost) { centerprint(other, STR_NOTENOUGHPOINTS); - sound(other, 0, "sounds/misc/denybuy.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/denybuy.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); return; } @@ -195,7 +195,7 @@ void () WallWeapon_TouchTrigger = // Set the weapon's ammo to the max capacity. Weapon_SetPlayerAmmoInSlot(other, slot, wall_ammo); - sound(other, 0, "sounds/misc/ching.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/ching.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); other.reload_delay = 0; // Subtract the cost from player points. @@ -234,13 +234,13 @@ void () WallWeapon_TouchTrigger = // Player doesn't have enough points. Abort. if (other.points < wcost) { centerprint(other, STR_NOTENOUGHPOINTS); - sound(other, 0, "sounds/misc/denybuy.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/denybuy.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); return; } other.weapons[0].weapon_reserve = getWeaponAmmo(other.weapon); - sound(other, 0, "sounds/misc/ching.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/ching.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); other.reload_delay = 0; // Subtract the cost from player points. @@ -267,14 +267,14 @@ void () WallWeapon_TouchTrigger = if (other.points < self.cost2) { centerprint(other, STR_NOTENOUGHPOINTS); - sound(other, 0, "sounds/misc/denybuy.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/denybuy.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); return; } else { other.ach_tracker_coll++; other.reload_delay = 0; - sound(other, 0, "sounds/misc/ching.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/ching.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); //other.boughtweapon = true; Player_RemoveScore(other, self.cost2); other.grenades = other.grenades | 2; @@ -302,14 +302,14 @@ void () WallWeapon_TouchTrigger = if (other.points < self.cost) { centerprint(other, STR_NOTENOUGHPOINTS); - sound(other, 0, "sounds/misc/denybuy.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/denybuy.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); return; } else { other.ach_tracker_coll++; other.reload_delay = 0; - sound(other, 0, "sounds/misc/ching.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/ching.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); //other.boughtweapon = true; Player_RemoveScore(other, self.cost); other.primary_grenades = 4; @@ -332,12 +332,12 @@ void () WallWeapon_TouchTrigger = { if (other.points < self.cost2) { centerprint(other, STR_NOTENOUGHPOINTS); - sound(other, 0, "sounds/misc/denybuy.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/denybuy.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); return; } else { W_HideCrosshair(other); Player_RemoveScore(other, self.cost2); - sound(other, 0, "sounds/misc/ching.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/ching.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); other.ach_tracker_coll++; if (self.enemy) { @@ -369,12 +369,12 @@ void () WallWeapon_TouchTrigger = other.semi_actions |= SEMIACTION_USE; if (other.points < self.cost) { centerprint (other, STR_NOTENOUGHPOINTS); - sound(other, 0, "sounds/misc/denybuy.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/denybuy.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); return; } other.ach_tracker_coll++; - sound(other, 0, "sounds/misc/ching.wav", 1, 1); + Sound_PlaySound(other, "sounds/misc/ching.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); other.reload_delay = 0; Player_RemoveScore(other, self.cost); if (self.enemy) { diff --git a/source/server/entities/window.qc b/source/server/entities/window.qc index 275db31..23e9a92 100644 --- a/source/server/entities/window.qc +++ b/source/server/entities/window.qc @@ -61,7 +61,7 @@ void() Window_repaired = { if (barricade_reward_maximum > self.enemy.barricade_reward) { - sound(self, 0,"sounds/misc/ching.wav", 1, ATTN_NORM); + Sound_PlaySound(self.enemy, "sounds/misc/ching.wav", SOUND_TYPE_ENV_CHING, SOUND_PRIORITY_PLAYALWAYS); Player_AddScore(self.enemy, 10, true); self.enemy.barricade_reward += 10; @@ -72,7 +72,7 @@ void() Window_repaired = void() Barricade_hit_window = { - sound(self, 0, self.oldmodel, 1, ATTN_NORM); + Sound_PlaySound(self, self.oldmodel, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); } void(void() next) checkForSpeed = { @@ -227,17 +227,17 @@ void() window_repair6_6 =[ 6, window_repair6_7 ] {self.frame = 46;}; void() window_repair6_7 =[ 7, window_repair6_8 ] {self.frame = 47;Barricade_hit_window();}; void() window_repair6_8 =[ 8, SUB_Null ] {self.frame = 48; Window_repaired();}; -void() window_carpenter_1 =[ 1, window_carpenter_2 ] {self.frame = 47;sound(self, 0, self.oldmodel, 1, ATTN_NORM);}; +void() window_carpenter_1 =[ 1, window_carpenter_2 ] {self.frame = 47; Sound_PlaySound(self, self.oldmodel, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); }; void() window_carpenter_2 =[ 2, window_carpenter_3 ] {self.frame = 48;}; -void() window_carpenter_3 =[ 3, window_carpenter_4 ] {self.frame = 55;sound(self, 1, self.oldmodel, 1, ATTN_NORM);}; +void() window_carpenter_3 =[ 3, window_carpenter_4 ] {self.frame = 55; Sound_PlaySound(self, self.oldmodel, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); }; void() window_carpenter_4 =[ 4, window_carpenter_5 ] {self.frame = 56;}; -void() window_carpenter_5 =[ 5, window_carpenter_6 ] {self.frame = 63;sound(self, 2, self.oldmodel, 1, ATTN_NORM);}; +void() window_carpenter_5 =[ 5, window_carpenter_6 ] {self.frame = 63; Sound_PlaySound(self, self.oldmodel, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); }; void() window_carpenter_6 =[ 6, window_carpenter_7 ] {self.frame = 64;}; -void() window_carpenter_7 =[ 7, window_carpenter_8 ] {self.frame = 71;sound(self, 0, self.oldmodel, 1, ATTN_NORM);}; +void() window_carpenter_7 =[ 7, window_carpenter_8 ] {self.frame = 71; Sound_PlaySound(self, self.oldmodel, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); }; void() window_carpenter_8 =[ 8, window_carpenter_9 ] {self.frame = 72;}; -void() window_carpenter_9 =[ 7, window_carpenter_10 ] {self.frame = 79;sound(self, 1, self.oldmodel, 1, ATTN_NORM);}; +void() window_carpenter_9 =[ 7, window_carpenter_10 ] {self.frame = 79; Sound_PlaySound(self, self.oldmodel, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); }; void() window_carpenter_10 =[ 8, window_carpenter_11 ] {self.frame = 80;}; -void() window_carpenter_11 =[ 7, window_carpenter_12 ] {self.frame = 87;sound(self, 2, self.oldmodel, 1, ATTN_NORM);}; +void() window_carpenter_11 =[ 7, window_carpenter_12 ] {self.frame = 87; Sound_PlaySound(self, self.oldmodel, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); }; void() window_carpenter_12 =[ 8, SUB_Null ] {self.frame = 88;self.isspec = 0;}; @@ -246,7 +246,7 @@ void() Window_Damage = if(self.health == 0 || self.owner) return; - sound(self, CHAN_VOICE, self.aistatus, 1, ATTN_NORM); + Sound_PlaySound(self, self.aistatus, SOUND_TYPE_ENV_OBJECT, SOUND_PRIORITY_PLAYALWAYS); self.health = self.health - 1; diff --git a/source/server/main.qc b/source/server/main.qc index 5f70a6a..439e73d 100644 --- a/source/server/main.qc +++ b/source/server/main.qc @@ -145,7 +145,7 @@ void() StartFrame = } else if (time_before_gamestart < time) { InitRounds(); nzp_screenflash(world, SCREENFLASH_COLOR_BLACK, 1, SCREENFLASH_FADE_OUT); - sound(self, CHAN_AUTO, "sounds/rounds/splash.wav", 1, ATTN_NONE); + Rounds_PlayTransition("sounds/rounds/splash.wav"); entity players = find(world, classname, "player"); @@ -277,67 +277,67 @@ void() precaches = precache_sound("sounds/misc/denybuy.wav"); // power-ups - precache_sound ("sounds/pu/pickup.wav"); - precache_sound ("sounds/pu/powerup.wav"); - precache_sound ("sounds/pu/drop.wav"); - precache_sound ("sounds/pu/byebye.wav"); + precache_sound("sounds/pu/pickup.wav"); + precache_sound("sounds/pu/powerup.wav"); + precache_sound("sounds/pu/drop.wav"); + precache_sound("sounds/pu/byebye.wav"); // zombie walk - precache_sound ("sounds/zombie/w0.wav"); - precache_sound ("sounds/zombie/w1.wav"); - precache_sound ("sounds/zombie/w2.wav"); - precache_sound ("sounds/zombie/w3.wav"); - precache_sound ("sounds/zombie/w4.wav"); - precache_sound ("sounds/zombie/w5.wav"); - precache_sound ("sounds/zombie/w6.wav"); - precache_sound ("sounds/zombie/w7.wav"); - precache_sound ("sounds/zombie/w8.wav"); - precache_sound ("sounds/zombie/w9.wav"); + precache_sound("sounds/zombie/w0.wav"); + precache_sound("sounds/zombie/w1.wav"); + precache_sound("sounds/zombie/w2.wav"); + precache_sound("sounds/zombie/w3.wav"); + precache_sound("sounds/zombie/w4.wav"); + precache_sound("sounds/zombie/w5.wav"); + precache_sound("sounds/zombie/w6.wav"); + precache_sound("sounds/zombie/w7.wav"); + precache_sound("sounds/zombie/w8.wav"); + precache_sound("sounds/zombie/w9.wav"); // zombie run - precache_sound ("sounds/zombie/r0.wav"); - precache_sound ("sounds/zombie/r1.wav"); - precache_sound ("sounds/zombie/r2.wav"); - precache_sound ("sounds/zombie/r3.wav"); - precache_sound ("sounds/zombie/r4.wav"); - precache_sound ("sounds/zombie/r5.wav"); - precache_sound ("sounds/zombie/r6.wav"); - precache_sound ("sounds/zombie/r7.wav"); - precache_sound ("sounds/zombie/r8.wav"); - precache_sound ("sounds/zombie/r9.wav"); + precache_sound("sounds/zombie/r0.wav"); + precache_sound("sounds/zombie/r1.wav"); + precache_sound("sounds/zombie/r2.wav"); + precache_sound("sounds/zombie/r3.wav"); + precache_sound("sounds/zombie/r4.wav"); + precache_sound("sounds/zombie/r5.wav"); + precache_sound("sounds/zombie/r6.wav"); + precache_sound("sounds/zombie/r7.wav"); + precache_sound("sounds/zombie/r8.wav"); + precache_sound("sounds/zombie/r9.wav"); // zombie swipe - precache_sound ("sounds/zombie/a0.wav"); - precache_sound ("sounds/zombie/a1.wav"); - precache_sound ("sounds/zombie/a2.wav"); - precache_sound ("sounds/zombie/a3.wav"); - precache_sound ("sounds/zombie/a4.wav"); - precache_sound ("sounds/zombie/a5.wav"); - precache_sound ("sounds/zombie/a6.wav"); - precache_sound ("sounds/zombie/a7.wav"); + precache_sound("sounds/zombie/a0.wav"); + precache_sound("sounds/zombie/a1.wav"); + precache_sound("sounds/zombie/a2.wav"); + precache_sound("sounds/zombie/a3.wav"); + precache_sound("sounds/zombie/a4.wav"); + precache_sound("sounds/zombie/a5.wav"); + precache_sound("sounds/zombie/a6.wav"); + precache_sound("sounds/zombie/a7.wav"); // zombie death - precache_sound ("sounds/zombie/d0.wav"); - precache_sound ("sounds/zombie/d1.wav"); - precache_sound ("sounds/zombie/d2.wav"); - precache_sound ("sounds/zombie/d3.wav"); - precache_sound ("sounds/zombie/d4.wav"); - precache_sound ("sounds/zombie/d5.wav"); - precache_sound ("sounds/zombie/d6.wav"); - precache_sound ("sounds/zombie/d7.wav"); + precache_sound("sounds/zombie/d0.wav"); + precache_sound("sounds/zombie/d1.wav"); + precache_sound("sounds/zombie/d2.wav"); + precache_sound("sounds/zombie/d3.wav"); + precache_sound("sounds/zombie/d4.wav"); + precache_sound("sounds/zombie/d5.wav"); + precache_sound("sounds/zombie/d6.wav"); + precache_sound("sounds/zombie/d7.wav"); // zombie taunt - precache_sound ("sounds/zombie/t0.wav"); - precache_sound ("sounds/zombie/t1.wav"); - precache_sound ("sounds/zombie/t2.wav"); - precache_sound ("sounds/zombie/t3.wav"); - precache_sound ("sounds/zombie/t4.wav"); + precache_sound("sounds/zombie/t0.wav"); + precache_sound("sounds/zombie/t1.wav"); + precache_sound("sounds/zombie/t2.wav"); + precache_sound("sounds/zombie/t3.wav"); + precache_sound("sounds/zombie/t4.wav"); // zombie footsteps - precache_sound ("sounds/zombie/s0.wav"); - precache_sound ("sounds/zombie/s1.wav"); - precache_sound ("sounds/zombie/sc0.wav"); - precache_sound ("sounds/zombie/sc1.wav"); + precache_sound("sounds/zombie/s0.wav"); + precache_sound("sounds/zombie/s1.wav"); + precache_sound("sounds/zombie/sc0.wav"); + precache_sound("sounds/zombie/sc1.wav"); // null precache_sound("sounds/null.wav"); diff --git a/source/server/player/player_core.qc b/source/server/player/player_core.qc index 7c3ad4e..0957cfb 100644 --- a/source/server/player/player_core.qc +++ b/source/server/player/player_core.qc @@ -630,7 +630,7 @@ void() PlayerPostThink = //landsound if((self.oldvelocity_z < -212) && (self.flags & FL_ONGROUND)) { - sound(self, CHAN_BODY, "sounds/player/land.wav", 0.6, 1.75); + Sound_PlaySound(self, "sounds/player/land.wav", SOUND_TYPE_PLAYER_FOOTSTEP, SOUND_PRIORITY_PLAYALWAYS); self.lastsound_time = time - 0.15; } @@ -674,15 +674,15 @@ void() PlayerPostThink = { local float ran = random(); if(ran > 0.8) - sound(self, CHAN_BODY, "sounds/player/footstep1.wav", 0.6, 2.5); + Sound_PlaySound(self, "sounds/player/footstep1.wav", SOUND_TYPE_PLAYER_FOOTSTEP, SOUND_PRIORITY_PLAYALWAYS); else if(ran > 0.6) - sound(self, CHAN_BODY, "sounds/player/footstep2.wav", 0.6, 2.5); + Sound_PlaySound(self, "sounds/player/footstep2.wav", SOUND_TYPE_PLAYER_FOOTSTEP, SOUND_PRIORITY_PLAYALWAYS); else if(ran > 0.4) - sound(self, CHAN_BODY, "sounds/player/footstep3.wav", 0.6, 2.5); + Sound_PlaySound(self, "sounds/player/footstep3.wav", SOUND_TYPE_PLAYER_FOOTSTEP, SOUND_PRIORITY_PLAYALWAYS); else if(ran > 0.2) - sound(self, CHAN_BODY, "sounds/player/footstep4.wav", 0.6, 2.5); + Sound_PlaySound(self, "sounds/player/footstep4.wav", SOUND_TYPE_PLAYER_FOOTSTEP, SOUND_PRIORITY_PLAYALWAYS); else - sound(self, CHAN_BODY, "sounds/player/footstep5.wav", 0.6, 2.5); + Sound_PlaySound(self, "sounds/player/footstep5.wav", SOUND_TYPE_PLAYER_FOOTSTEP, SOUND_PRIORITY_PLAYALWAYS); self.lastsound_time = time; } } diff --git a/source/server/rounds.qc b/source/server/rounds.qc index f4623d9..1a768f8 100644 --- a/source/server/rounds.qc +++ b/source/server/rounds.qc @@ -106,9 +106,7 @@ void(string sound_path) Rounds_PlayTransition = if (music_override > time) return; - // Pick a random player because it needs a source. - entity some_player = find(world, classname, "player"); - sound(some_player, CHAN_AUTO, sound_path, 1, ATTN_NONE); + Sound_PlaySound(world, sound_path, SOUND_TYPE_MUSIC_ROUND, SOUND_PRIORITY_PLAYALWAYS); } void() updateDogRound = @@ -185,7 +183,6 @@ void() NewRound = entity tempe; round_changetime = 0; spawn_time = time + 5; - sounds_playing = 0;//just in case it ever somehow glitches if (delay_at_round > 0.08) { delay_at_round = delay_at_round*0.95; diff --git a/source/server/utilities/sound_helper.qc b/source/server/utilities/sound_helper.qc new file mode 100644 index 0000000..345490a --- /dev/null +++ b/source/server/utilities/sound_helper.qc @@ -0,0 +1,204 @@ +/* + server/utilities/sound_helper.qc + + Logic designed to assist in audio balancing and different types + of audio channels. + + Copyright (C) 2021-2024 NZ:P Team + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + +*/ + +#define SOUND_PRIORITY_ALLOWSKIP 0 +#define SOUND_PRIORITY_PLAYALWAYS 1 + +#define SOUND_TYPE_ZOMBIE_QUIET 0 +#define SOUND_TYPE_ZOMBIE_LOUD 1 +#define SOUND_TYPE_ZOMBIE_CRAWLER 2 +#define SOUND_TYPE_MUSIC_ROUND 3 +#define SOUND_TYPE_WEAPON_FIRE 4 +#define SOUND_TYPE_WEAPON_OTHER 5 +#define SOUND_TYPE_WEAPON_PACK 6 +#define SOUND_TYPE_WEAPON_EXPLODE 7 +#define SOUND_TYPE_PLAYER_VOICE 8 +#define SOUND_TYPE_PLAYER_FOOTSTEP 9 +#define SOUND_TYPE_ENV_OBJECT 10 +#define SOUND_TYPE_ENV_CHING 11 +#define SOUND_TYPE_ENV_VOICE 12 +#define SOUND_TYPE_ENV_MUSIC 13 +#define SOUND_TYPE_ENV_IMPORTANT 14 + +#define SOUND_MAX_ZOMBIE_GROANS 4 +#define SOUND_MAX_WEAPON_EXPLODE 8 +#define SOUND_MAX_ENV_VOICE 1 + +// On FTE, we should always be using SOUNDFLAG_FOLLOW because we want +// sounds like the longer zombie groans to not feel desynconized from +// the actual action, other engines don't support this though, so wrap +// it. +#ifdef FTE + +#define PLAYSOUND(ent, channel, path, volume, attenuation) sound(ent, channel, path, volume, attenuation, 0, SOUNDFLAG_FOLLOW) + +#else + +#define PLAYSOUND(ent, channel, path, volume, attenuation) sound(ent, channel, path, volume, attenuation) + +#endif // FTE + +float zombie_groan_times[SOUND_MAX_ZOMBIE_GROANS]; +float weapon_explode_times[SOUND_MAX_WEAPON_EXPLODE]; +float environment_voice_times[SOUND_MAX_ENV_VOICE]; + +float() Sound_GetEnvironmentVoice = +{ + // Search for an available Explosion slot. + for(float i = 0; i < SOUND_MAX_ENV_VOICE; i++) { + if (environment_voice_times[i] < time) { + return i; + } + } + + // None available. + return -1; +}; + +void(float priority, float index) Sound_SetEnvironmentVoice = +{ + if (priority == SOUND_PRIORITY_PLAYALWAYS) + return; + + environment_voice_times[index] = time + 2; +}; + +float() Sound_GetWeaponExplosion = +{ + // Search for an available Explosion slot. + for(float i = 0; i < SOUND_MAX_WEAPON_EXPLODE; i++) { + if (weapon_explode_times[i] < time) { + return i; + } + } + + // None available. + return -1; +}; + +void(float priority, float index) Sound_SetWeaponExplosion = +{ + if (priority == SOUND_PRIORITY_PLAYALWAYS) + return; + + weapon_explode_times[index] = time + 1.2; +}; + +float() Sound_GetZombieGroan = +{ + // Search for an available Groan slot. + for(float i = 0; i < SOUND_MAX_ZOMBIE_GROANS; i++) { + if (zombie_groan_times[i] < time) { + return i; + } + } + + // None available. + return -1; +}; + +void(float priority, float index) Sound_SetZombieGroan = +{ + if (priority == SOUND_PRIORITY_PLAYALWAYS) + return; + + zombie_groan_times[index] = time + 4.5; +}; + +void(entity source_ent, string path, float type, float priority) Sound_PlaySound = +{ + switch(type) { + case SOUND_TYPE_ZOMBIE_QUIET: + float zombie_quiet_groan = Sound_GetZombieGroan(); + if (priority == SOUND_PRIORITY_PLAYALWAYS || zombie_quiet_groan != -1) { + PLAYSOUND(source_ent, CHAN_VOICE, path, 0.60, 1); + Sound_SetZombieGroan(priority, zombie_quiet_groan); + } + break; + case SOUND_TYPE_ZOMBIE_LOUD: + float zombie_loud_groan = Sound_GetZombieGroan(); + if (priority == SOUND_PRIORITY_PLAYALWAYS || zombie_loud_groan != -1) { + PLAYSOUND(source_ent, CHAN_WEAPON, path, 0.70, 1); + Sound_SetZombieGroan(priority, zombie_loud_groan); + } + break; + case SOUND_TYPE_ZOMBIE_CRAWLER: + float zombie_crawler_groan = Sound_GetZombieGroan(); + if (priority == SOUND_PRIORITY_PLAYALWAYS || zombie_crawler_groan != -1) { + PLAYSOUND(source_ent, CHAN_ITEM, path, 0.60, 1); + Sound_SetZombieGroan(priority, zombie_crawler_groan); + } + break; + case SOUND_TYPE_MUSIC_ROUND: + PLAYSOUND(source_ent, CHAN_ITEM, path, 0.85, 0); + break; + case SOUND_TYPE_WEAPON_FIRE: + PLAYSOUND(source_ent, CHAN_AUTO, path, 0.80, 2); + break; + case SOUND_TYPE_WEAPON_OTHER: + PLAYSOUND(source_ent, CHAN_ITEM, path, 0.60, 2); + break; + case SOUND_TYPE_WEAPON_PACK: + PLAYSOUND(source_ent, CHAN_ITEM, path, 0.95, 2); + break; + case SOUND_TYPE_WEAPON_EXPLODE: + float weapon_explosion_index = Sound_GetWeaponExplosion(); + if (priority == SOUND_PRIORITY_PLAYALWAYS || weapon_explosion_index != -1) { + PLAYSOUND(source_ent, 0, path, 0.70, 1); + Sound_SetWeaponExplosion(priority, weapon_explosion_index); + } + break; + case SOUND_TYPE_PLAYER_VOICE: + PLAYSOUND(source_ent, CHAN_VOICE, path, 0.90, 2); + break; + case SOUND_TYPE_PLAYER_FOOTSTEP: + PLAYSOUND(source_ent, 0, path, 0.40, 3); + break; + case SOUND_TYPE_ENV_OBJECT: + PLAYSOUND(source_ent, CHAN_ITEM, path, 0.50, 2); + break; + case SOUND_TYPE_ENV_CHING: + PLAYSOUND(source_ent, CHAN_AUTO, path, 0.75, 3); + break; + case SOUND_TYPE_ENV_VOICE: + float environment_voice_index = Sound_GetEnvironmentVoice(); + if (priority == SOUND_PRIORITY_PLAYALWAYS || environment_voice_index != -1) { + PLAYSOUND(source_ent, CHAN_VOICE, path, 0.80, 0); + Sound_SetEnvironmentVoice(priority, environment_voice_index); + } + break; + case SOUND_TYPE_ENV_MUSIC: + PLAYSOUND(source_ent, CHAN_WEAPON, path, 0.75, 3); + break; + case SOUND_TYPE_ENV_IMPORTANT: + PLAYSOUND(source_ent, CHAN_ITEM, path, 1, 2); + break; + default: + break; + } +}; diff --git a/source/server/weapons/bouncing_betty.qc b/source/server/weapons/bouncing_betty.qc index e8d2ccc..58e487e 100644 --- a/source/server/weapons/bouncing_betty.qc +++ b/source/server/weapons/bouncing_betty.qc @@ -142,7 +142,7 @@ void() Betty_CheckForRelease = self.grenade_delay = time + 0.05; self.isBuying = true; Set_W_Frame (13, 19, 0.3, 5, GRENADE, Betty_Drop, "models/weapons/grenade/v_betty.mdl", true, S_RIGHT, true); - sound (self, CHAN_WEAPON, "sounds/weapons/grenade/throw.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/grenade/throw.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = time + 0.4; self.throw_delay = time + 0.9; } diff --git a/source/server/weapons/frames_core.qc b/source/server/weapons/frames_core.qc index 3667295..c6348ed 100644 --- a/source/server/weapons/frames_core.qc +++ b/source/server/weapons/frames_core.qc @@ -163,7 +163,7 @@ void () W_Frame_Update = // FIXME: We need a way to play sounds at specific frames for any viewmodel, not just weapons if (self.weaponmodel == "models/weapons/grenade/v_betty.mdl" && self.weaponframe == 9) { - sound (self, CHAN_WEAPON, "sounds/weapons/grenade/prime.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/grenade/prime.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); nzp_rumble(self, 1000, 1200, 75); } return; diff --git a/source/server/weapons/weapon_core.qc b/source/server/weapons/weapon_core.qc index 4d5b0c7..0be8d1e 100644 --- a/source/server/weapons/weapon_core.qc +++ b/source/server/weapons/weapon_core.qc @@ -1149,8 +1149,7 @@ void(float side) W_Fire = Set_W_Frame (startframe, endframe, delay, 0, FIRE, WeaponCore_CheckForReload, modelname, FALSE, side, false); } - - sound (self, CHAN_WEAPON, soundname, 1, ATTN_NORM); + Sound_PlaySound(self, soundname, SOUND_TYPE_WEAPON_FIRE, SOUND_PRIORITY_PLAYALWAYS); if (side == S_RIGHT) { self.weapons[0].weapon_magazine = self.weapons[0].weapon_magazine - 1; @@ -1161,7 +1160,7 @@ void(float side) W_Fire = } if (IsPapWeapon(self.weapon) && !WepDef_DoesNotPlayUpgradedSound(self.weapon)) { - sound (self, 0, "sounds/weapons/papfire.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/papfire.wav", SOUND_TYPE_WEAPON_PACK, SOUND_PRIORITY_PLAYALWAYS); } SetUpdate(self, UT_HUD, 6, 0, 0); @@ -1227,15 +1226,15 @@ void() WeaponCore_Melee = if (!trace_ent.takedamage && !(trace_ent.flags & FL_CLIENT)) { // Hit a solid surface, so play hard melee sound. if (trace_fraction < 1.0) - sound (self, CHAN_WEAPON, "sounds/weapons/knife/knife_hit.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/knife/knife_hit.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); // Dead air, swing! else - sound (self, CHAN_WEAPON, "sounds/weapons/knife/knife.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/knife/knife.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); } else { // AI has a more involved routine than other entities if (trace_ent.aistatus == "1") { // Play a flesh-y impact sound, spawn blood. - sound (self, CHAN_WEAPON, "sounds/weapons/knife/knife_hitbod.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/knife/knife_hitbod.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); SpawnBlood(trace_source + (v_forward * 20), trace_source + (v_forward * 20), 50); // Calculate distance to use for the Lunge velocity @@ -1255,10 +1254,10 @@ void() WeaponCore_Melee = // Is this a player? Play the body hit sound and spawn blood, otherwise, solid swing. if (trace_ent.flags & FL_CLIENT) { - sound (self, CHAN_WEAPON, "sounds/weapons/knife/knife_hitbod.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/knife/knife_hitbod.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); SpawnBlood(trace_source + (v_forward * 20), trace_source + (v_forward * 20), 50); } else { - sound (self, CHAN_WEAPON, "sounds/weapons/knife/knife_hit.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/knife/knife_hit.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); } } @@ -1321,7 +1320,7 @@ void() switch_nade = void() GrenadeExplode = { - sound (self, CHAN_WEAPON, "sounds/weapons/grenade/explode.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/grenade/explode.wav", SOUND_TYPE_WEAPON_EXPLODE, SOUND_PRIORITY_ALLOWSKIP); if (self.classname == "grenade") DamgageExplode (self, self.owner, 200, 50, 200); @@ -1445,7 +1444,7 @@ void() checkHold = self.isBuying = true; Set_W_Frame (3, 6, 0, 5, GRENADE, W_ThrowGrenade, "models/weapons/grenade/v_grenade.mdl", true, S_RIGHT, true); - sound (self, CHAN_WEAPON, "sounds/weapons/grenade/throw.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/grenade/throw.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = time + 0.4; self.throw_delay = time + 0.9; nzp_rumble(self, 1000, 1200, 75); @@ -1479,7 +1478,7 @@ void() W_Grenade = W_HideCrosshair(self); Set_W_Frame (0, 2, 0.6, 0, GRENADE, checkHold, "models/weapons/grenade/v_grenade.mdl", true, S_RIGHT, true); - sound (self, CHAN_WEAPON, "sounds/weapons/grenade/prime.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/grenade/prime.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); self.primary_grenades -= 1; self.reload_delay2 = self.fire_delay2 = self.throw_delay = self.reload_delay = self.fire_delay = time + 6; self.grenade_delay = time + 5; @@ -1568,7 +1567,7 @@ void() dolphin_dive = //naievil W_SprintStop(); PAnim_EnterDive(); - sound(self, CHAN_VOICE, "sounds/player/jump.wav", 1, 1); + Sound_PlaySound(self, "sounds/player/jump.wav", SOUND_TYPE_PLAYER_VOICE, SOUND_PRIORITY_PLAYALWAYS); self.oldz = self.origin_z; Player_SetStance(self, PLAYER_STANCE_PRONE, false); @@ -1747,7 +1746,7 @@ void() CheckPlayer = if (self.dive) { if (self.perks & P_FLOP && dist >= 64) { - sound (self, CHAN_WEAPON, "sounds/weapons/grenade/explode.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/grenade/explode.wav", SOUND_TYPE_WEAPON_EXPLODE, SOUND_PRIORITY_PLAYALWAYS); DamgageExplode (self, self, 5000, 1000, 300); #ifdef FTE diff --git a/source/shared/weapon_stats.qc b/source/shared/weapon_stats.qc index 0ab1da3..3c0f809 100644 --- a/source/shared/weapon_stats.qc +++ b/source/shared/weapon_stats.qc @@ -3090,6 +3090,8 @@ float(float wep) EqualPapWeapon = } } +#ifndef CSQC + float(float wep, float anim_style, float dualwep, float curweaponframe) PlayWeaponSound = { if (anim_style == KNIFE) { @@ -3107,24 +3109,24 @@ float(float wep, float anim_style, float dualwep, float curweaponframe) PlayWeap if (wep == W_KAR || wep == W_ARMAGEDDON || wep == W_KAR_SCOPE || wep == W_HEADCRACKER || wep == W_SPRING || wep == W_PULVERIZER) { if (curweaponframe == 6) { - sound (self ,5, "sounds/weapons/boltaction/boltup.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/boltaction/boltup.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 7) { - sound (self ,5, "sounds/weapons/boltaction/boltback.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/boltaction/boltback.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 9) { - sound (self ,5, "sounds/weapons/boltaction/boltforward.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/boltaction/boltforward.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 10) { - sound (self ,5, "sounds/weapons/boltaction/boltdown.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/boltaction/boltdown.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } } else if (wep == W_TRENCH || wep == W_GUT) { if (curweaponframe == 7) { - sound (self ,5, "sounds/weapons/shotgun/pump.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/shotgun/pump.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } } @@ -3136,13 +3138,13 @@ float(float wep, float anim_style, float dualwep, float curweaponframe) PlayWeap switch (wep) { case W_COLT: if (curweaponframe == 5) { - sound (self ,5, "sounds/weapons/colt/magout.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/colt/magout.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 12) { - sound (self ,5, "sounds/weapons/colt/magin.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/colt/magin.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if(curweaponframe == 18) { - sound (self ,5, "sounds/weapons/colt/slide.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/colt/slide.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; @@ -3151,92 +3153,92 @@ float(float wep, float anim_style, float dualwep, float curweaponframe) PlayWeap case W_SPRING: case W_PULVERIZER: if (curweaponframe == 15) { - sound (self ,5, "sounds/weapons/boltaction/boltup.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/boltaction/boltup.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 16) { - sound (self ,5, "sounds/weapons/boltaction/boltback.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/boltaction/boltback.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 20) { - sound (self ,5, "sounds/weapons/boltaction/clipin.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/boltaction/clipin.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 25) { - sound (self ,5, "sounds/weapons/boltaction/boltforward.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/boltaction/boltforward.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 26) { - sound (self ,5, "sounds/weapons/boltaction/clipoff.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/boltaction/clipoff.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 27) { - sound (self ,5, "sounds/weapons/boltaction/boltdown.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/boltaction/boltdown.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_THOMPSON: case W_GIBS: if (curweaponframe == 6) { - sound (self ,5, "sounds/weapons/thomp/magout.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/thomp/magout.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 12) { - sound (self ,5, "sounds/weapons/thomp/magin.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/thomp/magin.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 19) { - sound (self ,5, "sounds/weapons/thomp/boltback.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/thomp/boltback.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_357: case W_KILLU: if (curweaponframe == 5) { - sound (self ,5, "sounds/weapons/357/open.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/357/open.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 9) { - sound (self ,5, "sounds/weapons/357/out.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/357/out.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 15) { - sound (self ,5, "sounds/weapons/357/in.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/357/in.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 20) { - sound (self ,5, "sounds/weapons/357/close.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/357/close.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_BAR: case W_WIDOW: if (curweaponframe == 6 || curweaponframe == 31) { - sound (self ,5, "sounds/weapons/bar/magout.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/bar/magout.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 19 || curweaponframe == 29) { - sound (self ,5, "sounds/weapons/bar/magin.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/bar/magin.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 23) { - sound (self ,5, "sounds/weapons/bar/maghit.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/bar/maghit.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_BROWNING: case W_ACCELERATOR: if (curweaponframe == 6 || curweaponframe == 60) { - sound (self ,5, "sounds/weapons/browning/boltback.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/browning/boltback.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 16 || curweaponframe == 69) { - sound (self ,5, "sounds/weapons/browning/topopen.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/browning/topopen.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 21) { - sound (self ,5, "sounds/weapons/browning/chainoff.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/browning/chainoff.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 27) { - sound (self ,5, "sounds/weapons/browning/chainon.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/browning/chainon.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 30) { - sound (self ,5, "sounds/weapons/browning/chainplace.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/browning/chainplace.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 36) { - sound (self ,5, "sounds/weapons/browning/topclose.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/browning/topclose.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 41) { - sound (self ,5, "sounds/weapons/browning/tophit.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/browning/tophit.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 48) { - sound (self ,5, "sounds/weapons/browning/boltforward.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/browning/boltforward.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; @@ -3244,63 +3246,63 @@ float(float wep, float anim_style, float dualwep, float curweaponframe) PlayWeap case W_SAWNOFF: case W_BORE: if (curweaponframe == 6) { - sound (self ,5, "sounds/weapons/shotgun/open.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/shotgun/open.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 12) { - sound (self ,5, "sounds/weapons/shotgun/out.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/shotgun/out.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 20) { - sound (self ,5, "sounds/weapons/shotgun/in.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/shotgun/in.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 26) { - sound (self ,5, "sounds/weapons/shotgun/close.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/shotgun/close.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_SNUFF: if (curweaponframe == 15) { - sound (self ,5, "sounds/weapons/shotgun/open.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/shotgun/open.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 23) { - sound (self ,5, "sounds/weapons/shotgun/out.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/shotgun/out.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 33) { - sound (self ,5, "sounds/weapons/shotgun/in.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/shotgun/in.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 40) { - sound (self ,5, "sounds/weapons/shotgun/close.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/shotgun/close.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_FG: case W_IMPELLER: if (curweaponframe == 6) { - sound (self ,5, "sounds/weapons/fg42/magout.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/fg42/magout.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 14) { - sound (self ,5, "sounds/weapons/fg42/magin.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/fg42/magin.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 23) { - sound (self ,5, "sounds/weapons/fg42/boltback.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/fg42/boltback.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 26) { - sound (self ,5, "sounds/weapons/fg42/boltforward.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/fg42/boltforward.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_GEWEHR: case W_COMPRESSOR: if (curweaponframe == 21) { - sound (self ,5, "sounds/weapons/gewehr/magout.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/gewehr/magout.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 32) { - sound (self ,5, "sounds/weapons/gewehr/magin.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/gewehr/magin.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 36) { - sound (self ,5, "sounds/weapons/gewehr/maghit.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/gewehr/maghit.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 45) { - sound (self ,5, "sounds/weapons/gewehr/boltrelease.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/gewehr/boltrelease.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; @@ -3309,231 +3311,231 @@ float(float wep, float anim_style, float dualwep, float curweaponframe) PlayWeap case W_SPRING: case W_PULVERIZER: if (curweaponframe == 15) { - sound (self ,5, "sounds/weapons/boltaction/boltup.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/boltaction/boltup.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 16) { - sound (self ,5, "sounds/weapons/boltaction/boltback.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/boltaction/boltback.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 20) { - sound (self ,5, "sounds/weapons/boltaction/insert.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/boltaction/insert.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 25) { - sound (self ,5, "sounds/weapons/boltaction/boltforward.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/boltaction/boltforward.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 27) { - sound (self ,5, "sounds/weapons/boltaction/boltdown.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/boltaction/boltdown.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_M1: case W_M1000: if (curweaponframe == 5 || curweaponframe == 25) { - sound (self ,5, "sounds/weapons/garand/clipout.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/garand/clipout.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 13) { - sound (self ,5, "sounds/weapons/garand/clipin.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/garand/clipin.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 15) { - sound (self ,5, "sounds/weapons/garand/boltrelease.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/garand/boltrelease.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 24) { - sound (self ,5, "sounds/weapons/garand/clippush.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/garand/clippush.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_M1A1: case W_WIDDER: if (curweaponframe == 6) { - sound (self ,5, "sounds/weapons/m1carbine/magout.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/m1carbine/magout.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 14) { - sound (self ,5, "sounds/weapons/m1carbine/magin.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/m1carbine/magin.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if(curweaponframe == 16) { - sound (self ,5, "sounds/weapons/m1carbine/maghit.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/m1carbine/maghit.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 24) { - sound (self ,5, "sounds/weapons/m1carbine/bolt.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/m1carbine/bolt.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_MP40: case W_AFTERBURNER: if (curweaponframe == 7) { - sound (self ,5, "sounds/weapons/mp40/magout.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/mp40/magout.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 17) { - sound (self ,5, "sounds/weapons/mp40/magin.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/mp40/magin.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 25) { - sound (self ,5, "sounds/weapons/mp40/boltback.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/mp40/boltback.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_MP5K: case W_KOLLIDER: if (curweaponframe == 16) { - sound (self ,5, "sounds/weapons/mp5k/magout.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/mp5k/magout.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 31) { - sound (self ,5, "sounds/weapons/mp5k/magin.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/mp5k/magin.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 39) { - sound (self ,5, "sounds/weapons/mp5k/slap.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/mp5k/slap.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_PANZER: case W_LONGINUS: if (curweaponframe == 12) { - sound (self ,5, "sounds/weapons/panzer/move.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/panzer/move.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 16) { - sound (self ,5, "sounds/weapons/panzer/insert.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/panzer/insert.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_MG: case W_BARRACUDA: if (curweaponframe == 8) { - sound (self ,5, "sounds/weapons/mg42/magout.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/mg42/magout.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 19) { - sound (self ,5, "sounds/weapons/mg42/magin.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/mg42/magin.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 29) { - sound (self ,5, "sounds/weapons/mg42/charge.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/mg42/charge.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_PPSH: case W_REAPER: if (curweaponframe == 8) { - sound (self ,5, "sounds/weapons/ppsh/magout.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/ppsh/magout.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 20) { - sound (self ,5, "sounds/weapons/ppsh/magin.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/ppsh/magin.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 22) { - sound (self ,5, "sounds/weapons/ppsh/maghit.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/ppsh/maghit.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 30) { - sound (self ,5, "sounds/weapons/ppsh/boltback.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/ppsh/boltback.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 33) { - sound (self ,5, "sounds/weapons/ppsh/boltrelease.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/ppsh/boltrelease.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_PTRS: case W_PENETRATOR: if (curweaponframe == 7) { - sound (self ,5, "sounds/weapons/ptrs/open.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/ptrs/open.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 13 || curweaponframe == 31) { - sound (self ,5, "sounds/weapons/ptrs/magin.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/ptrs/magin.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 21) { - sound (self ,5, "sounds/weapons/ptrs/maghit.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/ptrs/maghit.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 23) { - sound (self ,5, "sounds/weapons/ptrs/close.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/ptrs/close.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_RAY: case W_PORTER: if (curweaponframe == 10) { - sound (self ,5, "sounds/weapons/raygun/open.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/raygun/open.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 19) { - sound (self ,5, "sounds/weapons/raygun/out.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/raygun/out.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 33) { - sound (self ,5, "sounds/weapons/raygun/in.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/raygun/in.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 41) { - sound (self ,5, "sounds/weapons/raygun/close.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/raygun/close.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_STG: case W_SPATZ: if (curweaponframe == 15) { - sound (self ,5, "sounds/weapons/stg/magout.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/stg/magout.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 28) { - sound (self ,5, "sounds/weapons/stg/magin.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/stg/magin.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 37) { - sound (self ,5, "sounds/weapons/stg/boltback.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/stg/boltback.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 41) { - sound (self ,5, "sounds/weapons/stg/boltrelease.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/stg/boltrelease.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_TRENCH: case W_GUT: if (curweaponframe == 19) { - sound (self ,5, "sounds/weapons/shotgun/insert.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/shotgun/insert.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_TYPE: case W_SAMURAI: if (curweaponframe == 6) { - sound (self ,5, "sounds/weapons/type100/magout.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/type100/magout.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 15) { - sound (self ,5, "sounds/weapons/type100/magin.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/type100/magin.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 20) { - sound (self ,5, "sounds/weapons/type100/boltpull.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/type100/boltpull.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_BIATCH: if (curweaponframe == 23) { - sound (self ,5, "sounds/weapons/colt/magout.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/colt/magout.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe ==30) { - sound (self ,5, "sounds/weapons/colt/magin.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/colt/magin.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if(curweaponframe == 36) { - sound (self ,5, "sounds/weapons/biatch/slideback.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/biatch/slideback.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if(curweaponframe == 42) { - sound (self ,5, "sounds/weapons/biatch/sliderelease.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/biatch/sliderelease.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_TESLA: case W_DG3: if (curweaponframe == 20) { - sound (self ,5, "sounds/weapons/tesla/switchoff.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/tesla/switchoff.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 25) { - sound (self ,5, "sounds/weapons/tesla/pulllever.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/tesla/pulllever.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 31) { - sound (self ,5, "sounds/weapons/tesla/glassbreak.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/tesla/glassbreak.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 38) { - sound (self ,5, "sounds/weapons/tesla/clipin.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/tesla/clipin.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 43) { - sound (self ,5, "sounds/weapons/tesla/clipoff.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/tesla/clipoff.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } else if (curweaponframe == 51) { - sound (self ,5, "sounds/weapons/tesla/switchon.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/tesla/switchon.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; case W_BK: case W_KRAUS: if (curweaponframe == 41) { - sound(self, 5, "sounds/weapons/ballknife/insert.wav", 1, ATTN_NORM); + Sound_PlaySound(self, "sounds/weapons/ballknife/insert.wav", SOUND_TYPE_WEAPON_OTHER, SOUND_PRIORITY_PLAYALWAYS); return true; } return false; @@ -3544,6 +3546,7 @@ float(float wep, float anim_style, float dualwep, float curweaponframe) PlayWeap return false; } +#endif // CSQC void(float weptype) precache_extra = {