From: Mario Date: Mon, 24 Aug 2015 04:45:06 +0000 (+1000) Subject: Add a function to control weapon sound paths with hooks X-Git-Tag: xonotic-v0.8.2~2040^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d8825c487a0be97a0f132bb878bf3c1a13736b00;p=xonotic%2Fxonotic-data.pk3dir.git Add a function to control weapon sound paths with hooks --- diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index 2418bfc0c..f6dcb022e 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -86,7 +86,7 @@ void mage_spike_explode() { self.event_damage = func_null; - sound(self, CH_SHOTS, "weapons/grenade_impact.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, W_Sound("grenade_impact"), VOL_BASE, ATTEN_NORM); self.realowner.mage_spike = world; @@ -252,7 +252,7 @@ void mage_heal() void mage_push() { - sound(self, CH_SHOTS, "weapons/tagexp1.wav", 1, ATTEN_NORM); + sound(self, CH_SHOTS, W_Sound("tagexp1"), 1, ATTEN_NORM); RadiusDamage (self, self, (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_radius), world, world, (autocvar_g_monster_mage_attack_push_force), DEATH_MONSTER_MAGE, self.enemy); Send_Effect("TE_EXPLOSION", self.origin, '0 0 0', 1); @@ -399,7 +399,7 @@ float m_mage(float req) case MR_PRECACHE: { precache_model("models/monsters/mage.dpm"); - precache_sound ("weapons/grenade_impact.wav"); + precache_sound (W_Sound("grenade_impact")); precache_sound ("weapons/tagexp1.wav"); return true; } diff --git a/qcsrc/common/monsters/monster/shambler.qc b/qcsrc/common/monsters/monster/shambler.qc index f4f29d9fb..47e371a97 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -44,7 +44,7 @@ void shambler_smash() { makevectors(self.angles); Send_Effect("explosion_medium", (self.origin + (v_forward * 150)) - ('0 0 1' * self.maxs.z), '0 0 0', 1); - sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); tracebox(self.origin + v_forward * 50, self.mins * 0.5, self.maxs * 0.5, self.origin + v_forward * 500, MOVE_NORMAL, self); @@ -67,7 +67,7 @@ void shambler_lightning_explode() { entity head; - sound(self, CH_SHOTS, "weapons/electro_impact.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, W_Sound("electro_impact"), VOL_BASE, ATTEN_NORM); Send_Effect("electro_impact", '0 0 0', '0 0 0', 1); self.event_damage = func_null; diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index 65ba8dad5..de5f2c459 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -59,7 +59,7 @@ void spider_shootweb() { monster_makevectors(self.enemy); - sound(self, CH_SHOTS, "weapons/electro_fire2.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, W_Sound("electro_fire2"), VOL_BASE, ATTEN_NORM); entity proj = spawn (); proj.classname = "plasma"; @@ -154,7 +154,7 @@ float m_spider(float req) case MR_PRECACHE: { precache_model("models/monsters/spider.dpm"); - precache_sound ("weapons/electro_fire2.wav"); + precache_sound (W_Sound("electro_fire2")); return true; } } diff --git a/qcsrc/common/turrets/turrets.qc b/qcsrc/common/turrets/turrets.qc index a47b97569..e37de95e6 100644 --- a/qcsrc/common/turrets/turrets.qc +++ b/qcsrc/common/turrets/turrets.qc @@ -21,6 +21,10 @@ void turrets_common_precache() precache_model ("models/turrets/c512.md3"); precache_model ("models/marker.md3"); +#ifdef SVQC + precache_sound(W_Sound("rocket_impact")); +#endif + #ifdef TURRET_DEBUG precache_model ("models/turrets/c512.md3"); precache_model ("models/pathlib/goodsquare.md3"); diff --git a/qcsrc/common/turrets/unit/ewheel.qc b/qcsrc/common/turrets/unit/ewheel.qc index 495e60ff3..f0c02cb3f 100644 --- a/qcsrc/common/turrets/unit/ewheel.qc +++ b/qcsrc/common/turrets/unit/ewheel.qc @@ -136,7 +136,7 @@ float t_ewheel(float req) { turret_do_updates(self); - _mis = turret_projectile("weapons/lasergun_fire.wav", 1, 0, DEATH_TURRET_EWHEEL, PROJECTILE_BLASTER, TRUE, TRUE); + _mis = turret_projectile(W_Sound("lasergun_fire"), 1, 0, DEATH_TURRET_EWHEEL, PROJECTILE_BLASTER, TRUE, TRUE); _mis.missile_flags = MIF_SPLASH; Send_Effect("laser_muzzleflash", self.tur_shotorg, self.tur_shotdir_updated * 1000, 1); diff --git a/qcsrc/common/turrets/unit/flac.qc b/qcsrc/common/turrets/unit/flac.qc index 614df1d2f..65d00be38 100644 --- a/qcsrc/common/turrets/unit/flac.qc +++ b/qcsrc/common/turrets/unit/flac.qc @@ -40,7 +40,7 @@ float t_flac(float req) turret_tag_fire_update(); - proj = turret_projectile("weapons/hagar_fire.wav", 5, 0, DEATH_TURRET_FLAC, PROJECTILE_HAGAR, TRUE, TRUE); + proj = turret_projectile(W_Sound("hagar_fire"), 5, 0, DEATH_TURRET_FLAC, PROJECTILE_HAGAR, TRUE, TRUE); Send_Effect("laser_muzzleflash", self.tur_shotorg, self.tur_shotdir_updated * 1000, 1); proj.think = turret_flac_projectile_think_explode; proj.nextthink = time + self.tur_impacttime + (random() * 0.01 - random() * 0.01); diff --git a/qcsrc/common/turrets/unit/hellion.qc b/qcsrc/common/turrets/unit/hellion.qc index f64534f86..882f852bc 100644 --- a/qcsrc/common/turrets/unit/hellion.qc +++ b/qcsrc/common/turrets/unit/hellion.qc @@ -91,7 +91,7 @@ float t_hellion(float req) else self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire2")); - missile = turret_projectile("weapons/rocket_fire.wav", 6, 10, DEATH_TURRET_HELLION, PROJECTILE_ROCKET, FALSE, FALSE); + missile = turret_projectile(W_Sound("rocket_fire"), 6, 10, DEATH_TURRET_HELLION, PROJECTILE_ROCKET, FALSE, FALSE); te_explosion (missile.origin); missile.think = turret_hellion_missile_think; missile.nextthink = time; diff --git a/qcsrc/common/turrets/unit/hk.qc b/qcsrc/common/turrets/unit/hk.qc index 64d9a8c6a..fec2a6936 100644 --- a/qcsrc/common/turrets/unit/hk.qc +++ b/qcsrc/common/turrets/unit/hk.qc @@ -283,7 +283,7 @@ float t_hk(float req) { entity missile; - missile = turret_projectile("weapons/rocket_fire.wav", 6, 10, DEATH_TURRET_HK, PROJECTILE_ROCKET, FALSE, FALSE); + missile = turret_projectile(W_Sound("rocket_fire"), 6, 10, DEATH_TURRET_HK, PROJECTILE_ROCKET, FALSE, FALSE); te_explosion (missile.origin); missile.think = turret_hk_missile_think; diff --git a/qcsrc/common/turrets/unit/machinegun.qc b/qcsrc/common/turrets/unit/machinegun.qc index f952d4b15..5d5d62c83 100644 --- a/qcsrc/common/turrets/unit/machinegun.qc +++ b/qcsrc/common/turrets/unit/machinegun.qc @@ -50,7 +50,7 @@ float t_machinegun(float req) { precache_model ("models/turrets/base.md3"); precache_model ("models/turrets/machinegun.md3"); - precache_sound ("weapons/uzi_fire.wav"); + precache_sound (W_Sound("uzi_fire")); return true; } } diff --git a/qcsrc/common/turrets/unit/mlrs.qc b/qcsrc/common/turrets/unit/mlrs.qc index 014220215..a71ba4c3b 100644 --- a/qcsrc/common/turrets/unit/mlrs.qc +++ b/qcsrc/common/turrets/unit/mlrs.qc @@ -22,7 +22,7 @@ float t_mlrs(float req) entity missile; turret_tag_fire_update(); - missile = turret_projectile("weapons/rocket_fire.wav", 6, 10, DEATH_TURRET_MLRS, PROJECTILE_ROCKET, TRUE, TRUE); + missile = turret_projectile(W_Sound("rocket_fire"), 6, 10, DEATH_TURRET_MLRS, PROJECTILE_ROCKET, TRUE, TRUE); missile.nextthink = time + max(self.tur_impacttime,(self.shot_radius * 2) / self.shot_speed); missile.missile_flags = MIF_SPLASH; te_explosion (missile.origin); diff --git a/qcsrc/common/turrets/unit/phaser.qc b/qcsrc/common/turrets/unit/phaser.qc index 449c09f85..7d377174f 100644 --- a/qcsrc/common/turrets/unit/phaser.qc +++ b/qcsrc/common/turrets/unit/phaser.qc @@ -93,7 +93,7 @@ float t_phaser(float req) setattachment(beam,self.tur_head,"tag_fire"); - soundat (self, trace_endpos, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTEN_NORM); + soundat (self, trace_endpos, CH_SHOTS, W_Sound("neximpact"), VOL_BASE, ATTEN_NORM); if (self.tur_head.frame == 0) self.tur_head.frame = 1; diff --git a/qcsrc/common/turrets/unit/plasma.qc b/qcsrc/common/turrets/unit/plasma.qc index da86d3bf7..dfebe1a40 100644 --- a/qcsrc/common/turrets/unit/plasma.qc +++ b/qcsrc/common/turrets/unit/plasma.qc @@ -42,7 +42,7 @@ float t_plasma(float req) } else { - entity missile = turret_projectile("weapons/hagar_fire.wav", 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, TRUE, TRUE); + entity missile = turret_projectile(W_Sound("hagar_fire"), 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, TRUE, TRUE); missile.missile_flags = MIF_SPLASH; Send_Effect("laser_muzzleflash", self.tur_shotorg, self.tur_shotdir_updated * 1000, 1); diff --git a/qcsrc/common/turrets/unit/plasma_dual.qc b/qcsrc/common/turrets/unit/plasma_dual.qc index f7cf54941..79e2ba815 100644 --- a/qcsrc/common/turrets/unit/plasma_dual.qc +++ b/qcsrc/common/turrets/unit/plasma_dual.qc @@ -42,7 +42,7 @@ float t_plasma_dual(float req) } else { - entity missile = turret_projectile("weapons/hagar_fire.wav", 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, TRUE, TRUE); + entity missile = turret_projectile(W_Sound("hagar_fire"), 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, TRUE, TRUE); missile.missile_flags = MIF_SPLASH; Send_Effect("laser_muzzleflash", self.tur_shotorg, self.tur_shotdir_updated * 1000, 1); self.tur_head.frame += 1; diff --git a/qcsrc/common/turrets/unit/walker.qc b/qcsrc/common/turrets/unit/walker.qc index 4a63f9dee..169f10b24 100644 --- a/qcsrc/common/turrets/unit/walker.qc +++ b/qcsrc/common/turrets/unit/walker.qc @@ -221,7 +221,7 @@ void walker_fire_rocket(vector org) rocket = spawn (); setorigin(rocket, org); - sound (self, CH_WEAPON_A, "weapons/hagar_fire.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_WEAPON_A, W_Sound("hagar_fire"), VOL_BASE, ATTEN_NORM); setsize (rocket, '-3 -3 -3', '3 3 3'); // give it some size so it can be shot rocket.classname = "walker_rocket"; @@ -342,7 +342,7 @@ float t_walker(float req) { case TR_ATTACK: { - sound (self, CH_WEAPON_A, "weapons/uzi_fire.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_WEAPON_A, W_Sound("uzi_fire"), VOL_BASE, ATTEN_NORM); fireBullet (self.tur_shotorg, self.tur_shotdir_updated, self.shot_spread, 0, self.shot_dmg, self.shot_force, DEATH_TURRET_WALK_GUN, 0); Send_Effect("laser_muzzleflash", self.tur_shotorg, self.tur_shotdir_updated * 1000, 1); @@ -637,7 +637,7 @@ float t_walker(float req) precache_model ("models/turrets/walker_body.md3"); precache_model ("models/turrets/walker_head_minigun.md3"); precache_model ("models/turrets/rocket.md3"); - precache_sound ("weapons/rocket_impact.wav"); + precache_sound (W_Sound("rocket_impact")); return true; } } diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index d4b1e1acf..dbc7964b0 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -303,7 +303,7 @@ entity vehicles_projectile(string _mzlfx, string _mzlsound, void vehicles_gib_explode() { - sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); Send_Effect("explosion_small", randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1); Send_Effect("explosion_small", self.wp00.origin + '0 0 64', '0 0 0', 1); remove(self); diff --git a/qcsrc/common/vehicles/unit/bumblebee.qc b/qcsrc/common/vehicles/unit/bumblebee.qc index f6cfb65fe..65eb13168 100644 --- a/qcsrc/common/vehicles/unit/bumblebee.qc +++ b/qcsrc/common/vehicles/unit/bumblebee.qc @@ -104,7 +104,7 @@ float bumble_raygun_send(entity to, int sf); void bumblebee_fire_cannon(entity _gun, string _tagname, entity _owner) { vector v = gettaginfo(_gun, gettagindex(_gun, _tagname)); - vehicles_projectile("bigplasma_muzzleflash", "weapons/flacexp3.wav", + vehicles_projectile("bigplasma_muzzleflash", W_Sound("flacexp3"), v, normalize(v_forward + randomvec() * autocvar_g_vehicle_bumblebee_cannon_spread) * autocvar_g_vehicle_bumblebee_cannon_speed, autocvar_g_vehicle_bumblebee_cannon_damage, autocvar_g_vehicle_bumblebee_cannon_radius, autocvar_g_vehicle_bumblebee_cannon_force, 0, DEATH_VH_BUMB_GUN, PROJECTILE_BUMBLE_GUN, 0, true, true, _owner); @@ -716,7 +716,7 @@ void bumblebee_blowup() autocvar_g_vehicle_bumblebee_blowup_forceintensity, DEATH_VH_BUMB_DEATH, world); - sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); Send_Effect("explosion_big", (self.origin + '0 0 100') + (randomvec() * 80), '0 0 0', 1); if(self.owner.deadflag == DEAD_DYING) @@ -732,7 +732,7 @@ void bumblebee_diethink() if(random() < 0.1) { - sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); Send_Effect("explosion_small", randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1); } diff --git a/qcsrc/common/vehicles/unit/racer.qc b/qcsrc/common/vehicles/unit/racer.qc index d6fbbcc2f..f83df2873 100644 --- a/qcsrc/common/vehicles/unit/racer.qc +++ b/qcsrc/common/vehicles/unit/racer.qc @@ -174,7 +174,7 @@ void racer_fire_cannon(string tagname) entity bolt; v = gettaginfo(self, gettagindex(self, tagname)); - bolt = vehicles_projectile("wakizashi_gun_muzzleflash", "weapons/lasergun_fire.wav", + bolt = vehicles_projectile("wakizashi_gun_muzzleflash", W_Sound("lasergun_fire"), v, normalize(v_forward + randomvec() * autocvar_g_vehicle_racer_cannon_spread) * autocvar_g_vehicle_racer_cannon_speed, autocvar_g_vehicle_racer_cannon_damage, autocvar_g_vehicle_racer_cannon_radius, autocvar_g_vehicle_racer_cannon_force, 0, DEATH_VH_WAKI_GUN, PROJECTILE_WAKICANNON, 0, true, true, self.owner); @@ -292,7 +292,7 @@ void racer_rocket_tracker() void racer_fire_rocket(string tagname, entity trg) { vector v = gettaginfo(self, gettagindex(self, tagname)); - entity rocket = vehicles_projectile("wakizashi_rocket_launch", "weapons/rocket_fire.wav", + entity rocket = vehicles_projectile("wakizashi_rocket_launch", W_Sound("rocket_fire"), v, v_forward * autocvar_g_vehicle_racer_rocket_speed, autocvar_g_vehicle_racer_rocket_damage, autocvar_g_vehicle_racer_rocket_radius, autocvar_g_vehicle_racer_rocket_force, 3, DEATH_VH_WAKI_ROCKET, PROJECTILE_WAKIROCKET, 20, false, false, self.owner); @@ -857,8 +857,8 @@ bool v_racer(int req) case VR_PRECACHE: { #ifdef SVQC - precache_sound ("weapons/lasergun_fire.wav"); - precache_sound ("weapons/rocket_fire.wav"); + precache_sound (W_Sound("lasergun_fire")); + precache_sound (W_Sound("rocket_fire")); precache_sound ("vehicles/racer_idle.wav"); precache_sound ("vehicles/racer_move.wav"); diff --git a/qcsrc/common/vehicles/unit/raptor.qc b/qcsrc/common/vehicles/unit/raptor.qc index 93e1605ae..035c20b8b 100644 --- a/qcsrc/common/vehicles/unit/raptor.qc +++ b/qcsrc/common/vehicles/unit/raptor.qc @@ -195,7 +195,7 @@ void raptor_bombdrop() void raptor_fire_cannon(entity gun, string tagname) { - vehicles_projectile("raptor_cannon_muzzleflash", "weapons/lasergun_fire.wav", + vehicles_projectile("raptor_cannon_muzzleflash", W_Sound("lasergun_fire"), gettaginfo(gun, gettagindex(gun, tagname)), normalize(v_forward + randomvec() * autocvar_g_vehicle_raptor_cannon_spread) * autocvar_g_vehicle_raptor_cannon_speed, autocvar_g_vehicle_raptor_cannon_damage, autocvar_g_vehicle_raptor_cannon_radius, autocvar_g_vehicle_raptor_cannon_force, 0, DEATH_VH_RAPT_CANNON, PROJECTILE_RAPTORCANNON, 0, true, true, self.owner); @@ -727,7 +727,7 @@ void raptor_diethink() if(random() < 0.05) { - sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); Send_Effect("explosion_small", randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1); } self.nextthink = time; diff --git a/qcsrc/common/vehicles/unit/spiderbot.qc b/qcsrc/common/vehicles/unit/spiderbot.qc index 0ad0da41d..8c238f865 100644 --- a/qcsrc/common/vehicles/unit/spiderbot.qc +++ b/qcsrc/common/vehicles/unit/spiderbot.qc @@ -269,7 +269,7 @@ void spiderbot_rocket_do() switch(self.vehicle_weapon2mode) { case SBRM_VOLLY: - rocket = vehicles_projectile("spiderbot_rocket_launch", "weapons/rocket_fire.wav", + rocket = vehicles_projectile("spiderbot_rocket_launch", W_Sound("rocket_fire"), v, normalize(randomvec() * autocvar_g_vehicle_spiderbot_rocket_spread + v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed, autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1, DEATH_VH_SPID_ROCKET, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, self.owner); @@ -283,7 +283,7 @@ void spiderbot_rocket_do() self.wait = -10; break; case SBRM_GUIDE: - rocket = vehicles_projectile("spiderbot_rocket_launch", "weapons/rocket_fire.wav", + rocket = vehicles_projectile("spiderbot_rocket_launch", W_Sound("rocket_fire"), v, normalize(v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed, autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1, DEATH_VH_SPID_ROCKET, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, false, self.owner); @@ -295,7 +295,7 @@ void spiderbot_rocket_do() break; case SBRM_ARTILLERY: - rocket = vehicles_projectile("spiderbot_rocket_launch", "weapons/rocket_fire.wav", + rocket = vehicles_projectile("spiderbot_rocket_launch", W_Sound("rocket_fire"), v, normalize(v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed, autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1, DEATH_VH_SPID_ROCKET, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, self.owner); @@ -558,7 +558,7 @@ float spiderbot_frame() fireBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration, autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN, 0); - sound (gun, CH_WEAPON_A, "weapons/uzi_fire.wav", VOL_BASE, ATTEN_NORM); + sound (gun, CH_WEAPON_A, W_Sound("uzi_fire"), VOL_BASE, ATTEN_NORM); //trailparticles(self, particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos); pointparticles(particleeffectnum("spiderbot_minigun_muzzleflash"), v, v_forward * 2500, 1); @@ -678,7 +678,7 @@ void spiderbot_headfade() { if(self.alpha > 0.1) { - sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); Send_Effect("explosion_big", self.origin + '0 0 100', '0 0 0', 1); } remove(self); @@ -691,7 +691,7 @@ void spiderbot_blowup() { if(random() < 0.1) { - sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); Send_Effect("explosion_small", randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1); } self.nextthink = time + 0.1; @@ -932,8 +932,8 @@ float v_spiderbot(float req) precache_model ("models/vehicles/spiderbot_cockpit.dpm"); precache_model ( "models/uziflash.md3"); - precache_sound ("weapons/uzi_fire.wav" ); - precache_sound ("weapons/rocket_impact.wav"); + precache_sound (W_Sound("uzi_fire") ); + precache_sound (W_Sound("rocket_impact")); precache_sound ("vehicles/spiderbot_die.wav"); precache_sound ("vehicles/spiderbot_idle.wav"); diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index 3f0d6a097..4dcb2d6e7 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -330,4 +330,21 @@ int GetAmmoStat(.int ammotype) } } #endif + +#ifdef SVQC +string W_Sound(string w_snd) +{ + string output = strcat("weapons/", w_snd, ".wav"); + MUTATOR_CALLHOOK(WeaponSound, w_snd, output); + return output; +} + +string W_Model(string w_mdl) +{ + string output = strcat("models/weapons/", w_mdl); + MUTATOR_CALLHOOK(WeaponModel, w_mdl, output); + return output; +} +#endif + #endif diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index 3773765aa..91ca10557 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -90,6 +90,11 @@ string GetAmmoPicture(.int ammotype); int GetAmmoStat(.int ammotype); #endif +#ifdef SVQC +string W_Sound(string w_snd); +string W_Model(string w_mdl); +#endif + // ammo types .int ammo_shells; .int ammo_nails; diff --git a/qcsrc/common/weapons/w_arc.qc b/qcsrc/common/weapons/w_arc.qc index d0647c912..63a80c45e 100644 --- a/qcsrc/common/weapons/w_arc.qc +++ b/qcsrc/common/weapons/w_arc.qc @@ -267,7 +267,7 @@ void W_Arc_Beam_Think(void) { Send_Effect("arc_overheat", self.beam_start, self.beam_wantdir, 1 ); - sound(self, CH_WEAPON_A, "weapons/arc_stop.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_A, W_Sound("arc_stop"), VOL_BASE, ATTN_NORM); } } @@ -580,9 +580,7 @@ void W_Arc_Beam(float burst) // only play fire sound if 1 sec has passed since player let go the fire button if(time - self.beam_prev > 1) - { - sound(self, CH_WEAPON_A, "weapons/arc_fire.wav", VOL_BASE, ATTN_NORM); - } + sound(self, CH_WEAPON_A, W_Sound("arc_fire"), VOL_BASE, ATTN_NORM); entity beam = self.arc_beam = spawn(); beam.classname = "W_Arc_Beam"; @@ -617,7 +615,7 @@ void Arc_Smoke() if ( !self.arc_smoke_sound ) { self.arc_smoke_sound = 1; - sound(self, CH_SHOTS_SINGLE, "weapons/arc_loop_overheat.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS_SINGLE, W_Sound("arc_loop_overheat"), VOL_BASE, ATTN_NORM); } } } @@ -701,7 +699,7 @@ bool W_Arc(int req) if(self.arc_BUTTON_ATCK_prev != 0) { - sound(self, CH_WEAPON_A, "weapons/arc_stop.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_A, W_Sound("arc_stop"), VOL_BASE, ATTN_NORM); weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready); ATTACK_FINISHED(self) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor(); } @@ -722,13 +720,13 @@ bool W_Arc(int req) } case WR_INIT: { - precache_model("models/weapons/g_arc.md3"); - precache_model("models/weapons/v_arc.md3"); - precache_model("models/weapons/h_arc.iqm"); - precache_sound("weapons/arc_fire.wav"); - precache_sound("weapons/arc_loop.wav"); - precache_sound("weapons/arc_stop.wav"); - precache_sound("weapons/arc_loop_overheat.wav"); + precache_model(W_Model("g_arc.md3")); + precache_model(W_Model("v_arc.md3")); + precache_model(W_Model("h_arc.iqm")); + precache_sound(W_Sound("arc_fire")); + precache_sound(W_Sound("arc_loop")); + precache_sound(W_Sound("arc_stop")); + precache_sound(W_Sound("arc_loop_overheat")); if(!arc_shotorigin[0]) { arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 1); diff --git a/qcsrc/common/weapons/w_blaster.qc b/qcsrc/common/weapons/w_blaster.qc index 95a416726..85e78e7a8 100644 --- a/qcsrc/common/weapons/w_blaster.qc +++ b/qcsrc/common/weapons/w_blaster.qc @@ -95,7 +95,7 @@ void W_Blaster_Attack( { vector s_forward = v_forward * cos(atk_shotangle * DEG2RAD) + v_up * sin(atk_shotangle * DEG2RAD); - W_SetupShot_Dir(self, s_forward, false, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, atk_damage); + W_SetupShot_Dir(self, s_forward, false, 3, W_Sound("lasergun_fire"), CH_WEAPON_B, atk_damage); Send_Effect("laser_muzzleflash", w_shotorg, w_shotdir * 1000, 1); entity missile = spawn(); @@ -227,10 +227,10 @@ bool W_Blaster(int request) case WR_INIT: { - precache_model("models/weapons/g_laser.md3"); - precache_model("models/weapons/v_laser.md3"); - precache_model("models/weapons/h_laser.iqm"); - precache_sound("weapons/lasergun_fire.wav"); + precache_model(W_Model("g_laser.md3")); + precache_model(W_Model("v_laser.md3")); + precache_model(W_Model("h_laser.iqm")); + precache_sound(W_Sound("lasergun_fire")); BLASTER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } diff --git a/qcsrc/common/weapons/w_crylink.qc b/qcsrc/common/weapons/w_crylink.qc index f6484d080..c688b8ef2 100644 --- a/qcsrc/common/weapons/w_crylink.qc +++ b/qcsrc/common/weapons/w_crylink.qc @@ -354,7 +354,7 @@ void W_Crylink_Attack(void) if(WEP_CVAR_PRI(crylink, joinexplode)) maxdmg += WEP_CVAR_PRI(crylink, joinexplode_damage); - W_SetupShot(self, false, 2, "weapons/crylink_fire.wav", CH_WEAPON_A, maxdmg); + W_SetupShot(self, false, 2, W_Sound("crylink_fire"), CH_WEAPON_A, maxdmg); forward = v_forward; right = v_right; up = v_up; @@ -463,7 +463,7 @@ void W_Crylink_Attack2(void) if(WEP_CVAR_SEC(crylink, joinexplode)) maxdmg += WEP_CVAR_SEC(crylink, joinexplode_damage); - W_SetupShot(self, false, 2, "weapons/crylink_fire2.wav", CH_WEAPON_A, maxdmg); + W_SetupShot(self, false, 2, W_Sound("crylink_fire2"), CH_WEAPON_A, maxdmg); forward = v_forward; right = v_right; up = v_up; @@ -638,12 +638,12 @@ bool W_Crylink(int req) } case WR_INIT: { - precache_model("models/weapons/g_crylink.md3"); - precache_model("models/weapons/v_crylink.md3"); - precache_model("models/weapons/h_crylink.iqm"); - precache_sound("weapons/crylink_fire.wav"); - precache_sound("weapons/crylink_fire2.wav"); - precache_sound("weapons/crylink_linkjoin.wav"); + precache_model(W_Model("g_crylink.md3")); + precache_model(W_Model("v_crylink.md3")); + precache_model(W_Model("h_crylink.iqm")); + precache_sound(W_Sound("crylink_fire")); + precache_sound(W_Sound("crylink_fire2")); + precache_sound(W_Sound("crylink_linkjoin")); CRYLINK_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -674,7 +674,7 @@ bool W_Crylink(int req) } case WR_RELOAD: { - W_Reload(min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), "weapons/reload.wav"); + W_Reload(min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), W_Sound("reload")); return true; } case WR_SUICIDEMESSAGE: diff --git a/qcsrc/common/weapons/w_devastator.qc b/qcsrc/common/weapons/w_devastator.qc index 9d77f7158..1591d2ed5 100644 --- a/qcsrc/common/weapons/w_devastator.qc +++ b/qcsrc/common/weapons/w_devastator.qc @@ -295,7 +295,7 @@ void W_Devastator_Think(void) { Send_Effect("rocket_guide", self.origin, self.velocity, 1); // TODO add a better sound here - sound(self.realowner, CH_WEAPON_B, "weapons/rocket_mode.wav", VOL_BASE, ATTN_NORM); + sound(self.realowner, CH_WEAPON_B, W_Sound("rocket_mode"), VOL_BASE, ATTN_NORM); self.count = 1; } } @@ -342,7 +342,7 @@ void W_Devastator_Attack(void) W_DecreaseAmmo(WEP_CVAR(devastator, ammo)); - W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 5, "weapons/rocket_fire.wav", CH_WEAPON_A, WEP_CVAR(devastator, damage)); + W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 5, W_Sound("rocket_fire"), CH_WEAPON_A, WEP_CVAR(devastator, damage)); Send_Effect("rocketlauncher_muzzleflash", w_shotorg, w_shotdir * 1000, 1); missile = WarpZone_RefSys_SpawnSameRefSys(self); @@ -559,7 +559,7 @@ bool W_Devastator(int req) } } if(rockfound) - sound(self, CH_WEAPON_B, "weapons/rocket_det.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_B, W_Sound("rocket_det"), VOL_BASE, ATTN_NORM); } } @@ -570,12 +570,12 @@ bool W_Devastator(int req) //if(autocvar_sv_precacheweapons) //{ precache_model("models/flash.md3"); - precache_model("models/weapons/g_rl.md3"); - precache_model("models/weapons/v_rl.md3"); - precache_model("models/weapons/h_rl.iqm"); - precache_sound("weapons/rocket_det.wav"); - precache_sound("weapons/rocket_fire.wav"); - precache_sound("weapons/rocket_mode.wav"); + precache_model(W_Model("g_rl.md3")); + precache_model(W_Model("v_rl.md3")); + precache_model(W_Model("h_rl.iqm")); + precache_sound(W_Sound("rocket_det")); + precache_sound(W_Sound("rocket_fire")); + precache_sound(W_Sound("rocket_mode")); //} DEVASTATOR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; @@ -637,7 +637,7 @@ bool W_Devastator(int req) } case WR_RELOAD: { - W_Reload(WEP_CVAR(devastator, ammo), "weapons/reload.wav"); + W_Reload(WEP_CVAR(devastator, ammo), W_Sound("reload")); return true; } case WR_SUICIDEMESSAGE: diff --git a/qcsrc/common/weapons/w_electro.qc b/qcsrc/common/weapons/w_electro.qc index d1e79c561..2c614c771 100644 --- a/qcsrc/common/weapons/w_electro.qc +++ b/qcsrc/common/weapons/w_electro.qc @@ -255,7 +255,7 @@ void W_Electro_Attack_Bolt(void) '0 0 -3', false, 2, - "weapons/electro_fire.wav", + W_Sound("electro_fire"), CH_WEAPON_A, WEP_CVAR_PRI(electro, damage) ); @@ -296,7 +296,7 @@ void W_Electro_Orb_Touch(void) else { //UpdateCSQCProjectile(self); - spamsound(self, CH_SHOTS, "weapons/electro_bounce.wav", VOL_BASE, ATTEN_NORM); + spamsound(self, CH_SHOTS, W_Sound("electro_bounce"), VOL_BASE, ATTEN_NORM); self.projectiledeathtype |= HITTYPE_BOUNCE; } } @@ -353,7 +353,7 @@ void W_Electro_Attack_Orb(void) '0 0 -4', false, 2, - "weapons/electro_fire2.wav", + W_Sound("electro_fire2"), CH_WEAPON_A, WEP_CVAR_SEC(electro, damage) ); @@ -498,14 +498,14 @@ bool W_Electro(int req) } case WR_INIT: { - precache_model("models/weapons/g_electro.md3"); - precache_model("models/weapons/v_electro.md3"); - precache_model("models/weapons/h_electro.iqm"); - precache_sound("weapons/electro_bounce.wav"); - precache_sound("weapons/electro_fire.wav"); - precache_sound("weapons/electro_fire2.wav"); - precache_sound("weapons/electro_impact.wav"); - precache_sound("weapons/electro_impact_combo.wav"); + precache_model(W_Model("g_electro.md3")); + precache_model(W_Model("v_electro.md3")); + precache_model(W_Model("h_electro.iqm")); + precache_sound(W_Sound("electro_bounce")); + precache_sound(W_Sound("electro_fire")); + precache_sound(W_Sound("electro_fire2")); + precache_sound(W_Sound("electro_impact")); + precache_sound(W_Sound("electro_impact_combo")); ELECTRO_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -541,7 +541,7 @@ bool W_Electro(int req) } case WR_RELOAD: { - W_Reload(min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), "weapons/reload.wav"); + W_Reload(min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), W_Sound("reload")); return true; } case WR_SUICIDEMESSAGE: diff --git a/qcsrc/common/weapons/w_fireball.qc b/qcsrc/common/weapons/w_fireball.qc index f9a4928b7..7ea22e07f 100644 --- a/qcsrc/common/weapons/w_fireball.qc +++ b/qcsrc/common/weapons/w_fireball.qc @@ -182,7 +182,7 @@ void W_Fireball_Attack1(void) { entity proj; - W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 2, "weapons/fireball_fire2.wav", CH_WEAPON_A, WEP_CVAR_PRI(fireball, damage) + WEP_CVAR_PRI(fireball, bfgdamage)); + W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 2, W_Sound("fireball_fire2"), CH_WEAPON_A, WEP_CVAR_PRI(fireball, damage) + WEP_CVAR_PRI(fireball, bfgdamage)); Send_Effect("fireball_muzzleflash", w_shotorg, w_shotdir * 1000, 1); @@ -251,7 +251,7 @@ void W_Fireball_Attack1_Frame1(void) void W_Fireball_Attack1_Frame0(void) { W_Fireball_AttackEffect(0, '-1.25 -3.75 0'); - sound(self, CH_WEAPON_SINGLE, "weapons/fireball_prefire2.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_WEAPON_SINGLE, W_Sound("fireball_prefire2"), VOL_BASE, ATTEN_NORM); weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame1); } @@ -316,8 +316,8 @@ void W_Fireball_Attack2(void) f_diff = '+1.25 +3.75 0'; break; } - W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 2, "weapons/fireball_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(fireball, damage)); - traceline(w_shotorg, w_shotorg + f_diff.x * v_up + f_diff.y * v_right, MOVE_NORMAL, self); + W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 2, W_Sound("fireball_fire"), CH_WEAPON_A, WEP_CVAR_SEC(fireball, damage)); + traceline(w_shotorg, w_shotorg + f_diff_x * v_up + f_diff_y * v_right, MOVE_NORMAL, self); w_shotorg = trace_endpos; Send_Effect("fireball_muzzleflash", w_shotorg, w_shotdir * 1000, 1); @@ -399,13 +399,13 @@ bool W_Fireball(int req) } case WR_INIT: { - precache_model("models/weapons/g_fireball.md3"); - precache_model("models/weapons/v_fireball.md3"); - precache_model("models/weapons/h_fireball.iqm"); + precache_model(W_Model("g_fireball.md3")); + precache_model(W_Model("v_fireball.md3")); + precache_model(W_Model("h_fireball.iqm")); precache_model("models/sphere/sphere.md3"); - precache_sound("weapons/fireball_fire.wav"); - precache_sound("weapons/fireball_fire2.wav"); - precache_sound("weapons/fireball_prefire2.wav"); + precache_sound(W_Sound("fireball_fire")); + precache_sound(W_Sound("fireball_fire2")); + precache_sound(W_Sound("fireball_prefire2")); FIREBALL_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } diff --git a/qcsrc/common/weapons/w_hagar.qc b/qcsrc/common/weapons/w_hagar.qc index 967fd8f5a..2b1cb08c1 100644 --- a/qcsrc/common/weapons/w_hagar.qc +++ b/qcsrc/common/weapons/w_hagar.qc @@ -127,7 +127,7 @@ void W_Hagar_Attack(void) W_DecreaseAmmo(WEP_CVAR_PRI(hagar, ammo)); - W_SetupShot(self, false, 2, "weapons/hagar_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage)); + W_SetupShot(self, false, 2, W_Sound("hagar_fire"), CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage)); Send_Effect("hagar_muzzleflash", w_shotorg, w_shotdir * 1000, 1); @@ -170,7 +170,7 @@ void W_Hagar_Attack2(void) W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo)); - W_SetupShot(self, false, 2, "weapons/hagar_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage)); + W_SetupShot(self, false, 2, W_Sound("hagar_fire"), CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage)); Send_Effect("hagar_muzzleflash", w_shotorg, w_shotdir * 1000, 1); @@ -223,7 +223,7 @@ void W_Hagar_Attack2_Load_Release(void) weapon_prepareattack_do(1, WEP_CVAR_SEC(hagar, refire)); - W_SetupShot(self, false, 2, "weapons/hagar_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage)); + W_SetupShot(self, false, 2, W_Sound("hagar_fire"), CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage)); Send_Effect("hagar_muzzleflash", w_shotorg, w_shotdir * 1000, 1); forward = v_forward; @@ -317,7 +317,7 @@ void W_Hagar_Attack2_Load(void) self.weaponentity.state = WS_READY; W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo self.hagar_load = 0; - sound(self, CH_WEAPON_A, "weapons/hagar_beep.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_A, W_Sound("hagar_beep"), VOL_BASE, ATTN_NORM); // pause until we can load rockets again, once we re-press the alt fire button self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor(); @@ -336,7 +336,7 @@ void W_Hagar_Attack2_Load(void) W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo)); self.weaponentity.state = WS_INUSE; self.hagar_load += 1; - sound(self, CH_WEAPON_B, "weapons/hagar_load.wav", VOL_BASE * 0.8, ATTN_NORM); // sound is too loud according to most + sound(self, CH_WEAPON_B, W_Sound("hagar_load"), VOL_BASE * 0.8, ATTN_NORM); // sound is too loud according to most if(self.hagar_load >= WEP_CVAR_SEC(hagar, load_max)) self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_hold) * W_WeaponRateFactor(); @@ -347,7 +347,7 @@ void W_Hagar_Attack2_Load(void) else if(!self.hagar_loadbeep && self.hagar_load) // prevents the beep from playing each frame { // if this is the last rocket we can load, play a beep sound to notify the player - sound(self, CH_WEAPON_A, "weapons/hagar_beep.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_A, W_Sound("hagar_beep"), VOL_BASE, ATTN_NORM); self.hagar_loadbeep = true; } } @@ -366,7 +366,7 @@ void W_Hagar_Attack2_Load(void) if(!self.hagar_warning && self.hagar_load) // prevents the beep from playing each frame { // we're about to automatically release after holding time, play a beep sound to notify the player - sound(self, CH_WEAPON_A, "weapons/hagar_beep.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_A, W_Sound("hagar_beep"), VOL_BASE, ATTN_NORM); self.hagar_warning = true; } } @@ -449,12 +449,12 @@ bool W_Hagar(int req) } case WR_INIT: { - precache_model("models/weapons/g_hagar.md3"); - precache_model("models/weapons/v_hagar.md3"); - precache_model("models/weapons/h_hagar.iqm"); - precache_sound("weapons/hagar_fire.wav"); - precache_sound("weapons/hagar_load.wav"); - precache_sound("weapons/hagar_beep.wav"); + precache_model(W_Model("g_hagar.md3")); + precache_model(W_Model("v_hagar.md3")); + precache_model(W_Model("h_hagar.iqm")); + precache_sound(W_Sound("hagar_fire")); + precache_sound(W_Sound("hagar_load")); + precache_sound(W_Sound("hagar_beep")); HAGAR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -503,7 +503,7 @@ bool W_Hagar(int req) case WR_RELOAD: { if(!self.hagar_load) // require releasing loaded rockets first - W_Reload(min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), "weapons/reload.wav"); + W_Reload(min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), W_Sound("reload")); return true; } diff --git a/qcsrc/common/weapons/w_hlac.qc b/qcsrc/common/weapons/w_hlac.qc index fa3f48c87..d2428ffb4 100644 --- a/qcsrc/common/weapons/w_hlac.qc +++ b/qcsrc/common/weapons/w_hlac.qc @@ -77,7 +77,7 @@ void W_HLAC_Attack(void) if(self.crouch) spread = spread * WEP_CVAR_PRI(hlac, spread_crouchmod); - W_SetupShot(self, false, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage)); + W_SetupShot(self, false, 3, W_Sound("lasergun_fire"), CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage)); Send_Effect("laser_muzzleflash", w_shotorg, w_shotdir * 1000, 1); if(!autocvar_g_norecoil) { @@ -125,7 +125,7 @@ void W_HLAC_Attack2(void) if(self.crouch) spread = spread * WEP_CVAR_SEC(hlac, spread_crouchmod); - W_SetupShot(self, false, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage)); + W_SetupShot(self, false, 3, W_Sound("lasergun_fire"), CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage)); Send_Effect("laser_muzzleflash", w_shotorg, w_shotdir * 1000, 1); missile = spawn(); @@ -241,10 +241,10 @@ bool W_HLAC(int req) } case WR_INIT: { - precache_model("models/weapons/g_hlac.md3"); - precache_model("models/weapons/v_hlac.md3"); - precache_model("models/weapons/h_hlac.iqm"); - precache_sound("weapons/lasergun_fire.wav"); + precache_model(W_Model("g_hlac.md3")); + precache_model(W_Model("v_hlac.md3")); + precache_model(W_Model("h_hlac.iqm")); + precache_sound(W_Sound("lasergun_fire")); HLAC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -267,7 +267,7 @@ bool W_HLAC(int req) } case WR_RELOAD: { - W_Reload(min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), "weapons/reload.wav"); + W_Reload(min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), W_Sound("reload")); return true; } case WR_SUICIDEMESSAGE: diff --git a/qcsrc/common/weapons/w_hmg.qc b/qcsrc/common/weapons/w_hmg.qc index 2668aca2c..2c315f104 100644 --- a/qcsrc/common/weapons/w_hmg.qc +++ b/qcsrc/common/weapons/w_hmg.qc @@ -61,7 +61,7 @@ void W_HeavyMachineGun_Attack_Auto() W_DecreaseAmmo(WEP_CVAR(hmg, ammo)); - W_SetupShot (self, true, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, WEP_CVAR(hmg, damage)); + W_SetupShot (self, true, 0, W_Sound("uzi_fire"), CH_WEAPON_A, WEP_CVAR(hmg, damage)); if(!autocvar_g_norecoil) { @@ -119,10 +119,10 @@ bool W_HeavyMachineGun(int req) case WR_INIT: { precache_model ("models/uziflash.md3"); - precache_model ("models/weapons/g_ok_hmg.md3"); - precache_model ("models/weapons/v_ok_hmg.md3"); - precache_model ("models/weapons/h_ok_hmg.iqm"); - precache_sound ("weapons/uzi_fire.wav"); + precache_model(W_Model("g_ok_hmg.md3")); + precache_model(W_Model("v_ok_hmg.md3")); + precache_model(W_Model("h_ok_hmg.iqm")); + precache_sound (W_Sound("uzi_fire")); HMG_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -151,7 +151,7 @@ bool W_HeavyMachineGun(int req) } case WR_RELOAD: { - W_Reload(WEP_CVAR(hmg, ammo), "weapons/reload.wav"); + W_Reload(WEP_CVAR(hmg, ammo), W_Sound("reload")); return true; } case WR_SUICIDEMESSAGE: diff --git a/qcsrc/common/weapons/w_hook.qc b/qcsrc/common/weapons/w_hook.qc index a8d33e870..b877254c3 100644 --- a/qcsrc/common/weapons/w_hook.qc +++ b/qcsrc/common/weapons/w_hook.qc @@ -134,7 +134,7 @@ void W_Hook_Attack2(void) entity gren; //W_DecreaseAmmo(WEP_CVAR_SEC(hook, ammo)); // WEAPONTODO: Figure out how to handle ammo with hook secondary (gravitybomb) - W_SetupShot(self, false, 4, "weapons/hookbomb_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hook, damage)); + W_SetupShot(self, false, 4, W_Sound("hookbomb_fire"), CH_WEAPON_A, WEP_CVAR_SEC(hook, damage)); gren = spawn(); gren.owner = gren.realowner = self; @@ -288,12 +288,12 @@ bool W_Hook(int req) } case WR_INIT: { - precache_model("models/weapons/g_hookgun.md3"); - precache_model("models/weapons/v_hookgun.md3"); - precache_model("models/weapons/h_hookgun.iqm"); - precache_sound("weapons/hook_impact.wav"); // done by g_hook.qc - precache_sound("weapons/hook_fire.wav"); - precache_sound("weapons/hookbomb_fire.wav"); + precache_model(W_Model("g_hookgun.md3")); + precache_model(W_Model("v_hookgun.md3")); + precache_model(W_Model("h_hookgun.iqm")); + precache_sound(W_Sound("hook_impact")); // done by g_hook.qc + precache_sound(W_Sound("hook_fire")); + precache_sound(W_Sound("hookbomb_fire")); HOOK_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } diff --git a/qcsrc/common/weapons/w_machinegun.qc b/qcsrc/common/weapons/w_machinegun.qc index f320f7114..ac5bc2cb3 100644 --- a/qcsrc/common/weapons/w_machinegun.qc +++ b/qcsrc/common/weapons/w_machinegun.qc @@ -104,7 +104,7 @@ void W_MachineGun_MuzzleFlash(void) void W_MachineGun_Attack(int deathtype) { - W_SetupShot(self, true, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, ((self.misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage))); + W_SetupShot(self, true, 0, W_Sound("uzi_fire"), CH_WEAPON_A, ((self.misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage))); if(!autocvar_g_norecoil) { self.punchangle_x = random() - 0.5; @@ -180,7 +180,7 @@ void W_MachineGun_Attack_Auto(void) W_DecreaseAmmo(WEP_CVAR(machinegun, sustained_ammo)); - W_SetupShot(self, true, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage)); + W_SetupShot(self, true, 0, W_Sound("uzi_fire"), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage)); if(!autocvar_g_norecoil) { self.punchangle_x = random() - 0.5; @@ -206,7 +206,7 @@ void W_MachineGun_Attack_Auto(void) void W_MachineGun_Attack_Burst(void) { - W_SetupShot(self, true, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage)); + W_SetupShot(self, true, 0, W_Sound("uzi_fire"), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage)); if(!autocvar_g_norecoil) { self.punchangle_x = random() - 0.5; @@ -305,10 +305,10 @@ bool W_MachineGun(int req) case WR_INIT: { precache_model("models/uziflash.md3"); - precache_model("models/weapons/g_uzi.md3"); - precache_model("models/weapons/v_uzi.md3"); - precache_model("models/weapons/h_uzi.iqm"); - precache_sound("weapons/uzi_fire.wav"); + precache_model(W_Model("g_uzi.md3")); + precache_model(W_Model("v_uzi.md3")); + precache_model(W_Model("h_uzi.iqm")); + precache_sound(W_Sound("uzi_fire")); MACHINEGUN_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } diff --git a/qcsrc/common/weapons/w_minelayer.qc b/qcsrc/common/weapons/w_minelayer.qc index 25ac30e4b..61ae5362a 100644 --- a/qcsrc/common/weapons/w_minelayer.qc +++ b/qcsrc/common/weapons/w_minelayer.qc @@ -61,7 +61,7 @@ void spawnfunc_weapon_minelayer(void) { weapon_defaultspawnfunc(WEP_MINE_LAYER.m void W_MineLayer_Stick(entity to) { - spamsound(self, CH_SHOTS, "weapons/mine_stick.wav", VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, W_Sound("mine_stick"), VOL_BASE, ATTN_NORM); // in order for mines to face properly when sticking to the ground, they must be a server side entity rather than a csqc projectile @@ -225,7 +225,7 @@ void W_MineLayer_Think(void) if((time > self.cnt) && (!self.mine_time) && (self.cnt > 0)) { if(WEP_CVAR(minelayer, lifetime_countdown) > 0) - spamsound(self, CH_SHOTS, "weapons/mine_trigger.wav", VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, W_Sound("mine_trigger"), VOL_BASE, ATTN_NORM); self.mine_time = time + WEP_CVAR(minelayer, lifetime_countdown); self.mine_explodeanyway = 1; // make the mine super aggressive -- Samual: Rather, make it not care if a team mate is near. } @@ -248,7 +248,7 @@ void W_MineLayer_Think(void) if(head != self.realowner && DIFF_TEAM(head, self.realowner)) // don't trigger for team mates if(!self.mine_time) { - spamsound(self, CH_SHOTS, "weapons/mine_trigger.wav", VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, W_Sound("mine_trigger"), VOL_BASE, ATTN_NORM); self.mine_time = time + WEP_CVAR(minelayer, time); } head = head.chain; @@ -320,14 +320,14 @@ void W_MineLayer_Attack(void) { // the refire delay keeps this message from being spammed Send_Notification(NOTIF_ONE, self, MSG_MULTI, WEAPON_MINELAYER_LIMIT, WEP_CVAR(minelayer, limit)); - play2(self, "weapons/unavailable.wav"); + play2(self, W_Sound("unavailable")); return; } } W_DecreaseAmmo(WEP_CVAR(minelayer, ammo)); - W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 5, "weapons/mine_fire.wav", CH_WEAPON_A, WEP_CVAR(minelayer, damage)); + W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 5, W_Sound("mine_fire"), CH_WEAPON_A, WEP_CVAR(minelayer, damage)); Send_Effect("rocketlauncher_muzzleflash", w_shotorg, w_shotdir * 1000, 1); mine = WarpZone_RefSys_SpawnSameRefSys(self); @@ -527,7 +527,7 @@ bool W_MineLayer(int req) if(self.BUTTON_ATCK2) { if(W_MineLayer_PlacedMines(true)) - sound(self, CH_WEAPON_B, "weapons/mine_det.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_B, W_Sound("mine_det"), VOL_BASE, ATTN_NORM); } return true; @@ -536,13 +536,13 @@ bool W_MineLayer(int req) { precache_model("models/flash.md3"); precache_model("models/mine.md3"); - precache_model("models/weapons/g_minelayer.md3"); - precache_model("models/weapons/v_minelayer.md3"); - precache_model("models/weapons/h_minelayer.iqm"); - precache_sound("weapons/mine_det.wav"); - precache_sound("weapons/mine_fire.wav"); - precache_sound("weapons/mine_stick.wav"); - precache_sound("weapons/mine_trigger.wav"); + precache_model(W_Model("g_minelayer.md3")); + precache_model(W_Model("v_minelayer.md3")); + precache_model(W_Model("h_minelayer.iqm")); + precache_sound(W_Sound("mine_det")); + precache_sound(W_Sound("mine_fire")); + precache_sound(W_Sound("mine_stick")); + precache_sound(W_Sound("mine_trigger")); MINELAYER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -576,7 +576,7 @@ bool W_MineLayer(int req) } case WR_RELOAD: { - W_Reload(WEP_CVAR(minelayer, ammo), "weapons/reload.wav"); + W_Reload(WEP_CVAR(minelayer, ammo), W_Sound("reload")); return true; } case WR_SUICIDEMESSAGE: diff --git a/qcsrc/common/weapons/w_mortar.qc b/qcsrc/common/weapons/w_mortar.qc index 9e4912a84..1bea5edf7 100644 --- a/qcsrc/common/weapons/w_mortar.qc +++ b/qcsrc/common/weapons/w_mortar.qc @@ -140,24 +140,24 @@ void W_Mortar_Grenade_Touch1(void) float r; r = random() * 6; if(r < 1) - spamsound(self, CH_SHOTS, "weapons/grenade_bounce1.wav", VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, W_Sound("grenade_bounce1"), VOL_BASE, ATTN_NORM); else if(r < 2) - spamsound(self, CH_SHOTS, "weapons/grenade_bounce2.wav", VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, W_Sound("grenade_bounce2"), VOL_BASE, ATTN_NORM); else if(r < 3) - spamsound(self, CH_SHOTS, "weapons/grenade_bounce3.wav", VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, W_Sound("grenade_bounce3"), VOL_BASE, ATTN_NORM); else if(r < 4) - spamsound(self, CH_SHOTS, "weapons/grenade_bounce4.wav", VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, W_Sound("grenade_bounce4"), VOL_BASE, ATTN_NORM); else if(r < 5) - spamsound(self, CH_SHOTS, "weapons/grenade_bounce5.wav", VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, W_Sound("grenade_bounce5"), VOL_BASE, ATTN_NORM); else - spamsound(self, CH_SHOTS, "weapons/grenade_bounce6.wav", VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, W_Sound("grenade_bounce6"), VOL_BASE, ATTN_NORM); Send_Effect("hagar_bounce", self.origin, self.velocity, 1); self.projectiledeathtype |= HITTYPE_BOUNCE; self.gl_bouncecnt += 1; } else if(WEP_CVAR_PRI(mortar, type) == 2 && (!other || (other.takedamage != DAMAGE_AIM && other.movetype == MOVETYPE_NONE))) // stick { - spamsound(self, CH_SHOTS, "weapons/grenade_stick.wav", VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, W_Sound("grenade_stick"), VOL_BASE, ATTN_NORM); // let it stick whereever it is self.oldvelocity = self.velocity; @@ -185,17 +185,17 @@ void W_Mortar_Grenade_Touch2(void) float r; r = random() * 6; if(r < 1) - spamsound(self, CH_SHOTS, "weapons/grenade_bounce1.wav", VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, W_Sound("grenade_bounce1"), VOL_BASE, ATTN_NORM); else if(r < 2) - spamsound(self, CH_SHOTS, "weapons/grenade_bounce2.wav", VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, W_Sound("grenade_bounce2"), VOL_BASE, ATTN_NORM); else if(r < 3) - spamsound(self, CH_SHOTS, "weapons/grenade_bounce3.wav", VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, W_Sound("grenade_bounce3"), VOL_BASE, ATTN_NORM); else if(r < 4) - spamsound(self, CH_SHOTS, "weapons/grenade_bounce4.wav", VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, W_Sound("grenade_bounce4"), VOL_BASE, ATTN_NORM); else if(r < 5) - spamsound(self, CH_SHOTS, "weapons/grenade_bounce5.wav", VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, W_Sound("grenade_bounce5"), VOL_BASE, ATTN_NORM); else - spamsound(self, CH_SHOTS, "weapons/grenade_bounce6.wav", VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, W_Sound("grenade_bounce6"), VOL_BASE, ATTN_NORM); Send_Effect("hagar_bounce", self.origin, self.velocity, 1); self.projectiledeathtype |= HITTYPE_BOUNCE; self.gl_bouncecnt += 1; @@ -206,7 +206,7 @@ void W_Mortar_Grenade_Touch2(void) } else if(WEP_CVAR_SEC(mortar, type) == 2 && (!other || (other.takedamage != DAMAGE_AIM && other.movetype == MOVETYPE_NONE))) // stick { - spamsound(self, CH_SHOTS, "weapons/grenade_stick.wav", VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, W_Sound("grenade_stick"), VOL_BASE, ATTN_NORM); // let it stick whereever it is self.oldvelocity = self.velocity; @@ -228,7 +228,7 @@ void W_Mortar_Attack(void) W_DecreaseAmmo(WEP_CVAR_PRI(mortar, ammo)); - W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, "weapons/grenade_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage)); + W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, W_Sound("grenade_fire"), CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage)); w_shotdir = v_forward; // no TrueAim for grenades please Send_Effect("grenadelauncher_muzzleflash", w_shotorg, w_shotdir * 1000, 1); @@ -277,7 +277,7 @@ void W_Mortar_Attack2(void) W_DecreaseAmmo(WEP_CVAR_SEC(mortar, ammo)); - W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, "weapons/grenade_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage)); + W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, W_Sound("grenade_fire"), CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage)); w_shotdir = v_forward; // no TrueAim for grenades please Send_Effect("grenadelauncher_muzzleflash", w_shotorg, w_shotdir * 1000, 1); @@ -392,7 +392,7 @@ bool W_Mortar(int req) } } if(nadefound) - sound(self, CH_WEAPON_B, "weapons/rocket_det.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_B, W_Sound("rocket_det"), VOL_BASE, ATTN_NORM); } else if(weapon_prepareattack(1, WEP_CVAR_SEC(mortar, refire))) { @@ -405,17 +405,17 @@ bool W_Mortar(int req) } case WR_INIT: { - precache_model("models/weapons/g_gl.md3"); - precache_model("models/weapons/v_gl.md3"); - precache_model("models/weapons/h_gl.iqm"); - precache_sound("weapons/grenade_bounce1.wav"); - precache_sound("weapons/grenade_bounce2.wav"); - precache_sound("weapons/grenade_bounce3.wav"); - precache_sound("weapons/grenade_bounce4.wav"); - precache_sound("weapons/grenade_bounce5.wav"); - precache_sound("weapons/grenade_bounce6.wav"); - precache_sound("weapons/grenade_stick.wav"); - precache_sound("weapons/grenade_fire.wav"); + precache_model(W_Model("g_gl.md3")); + precache_model(W_Model("v_gl.md3")); + precache_model(W_Model("h_gl.iqm")); + precache_sound(W_Sound("grenade_bounce1")); + precache_sound(W_Sound("grenade_bounce2")); + precache_sound(W_Sound("grenade_bounce3")); + precache_sound(W_Sound("grenade_bounce4")); + precache_sound(W_Sound("grenade_bounce5")); + precache_sound(W_Sound("grenade_bounce6")); + precache_sound(W_Sound("grenade_stick")); + precache_sound(W_Sound("grenade_fire")); MORTAR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -438,7 +438,7 @@ bool W_Mortar(int req) } case WR_RELOAD: { - W_Reload(min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), "weapons/reload.wav"); // WEAPONTODO + W_Reload(min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), W_Sound("reload")); // WEAPONTODO return true; } case WR_SUICIDEMESSAGE: diff --git a/qcsrc/common/weapons/w_porto.qc b/qcsrc/common/weapons/w_porto.qc index e604b6164..6d31708b4 100644 --- a/qcsrc/common/weapons/w_porto.qc +++ b/qcsrc/common/weapons/w_porto.qc @@ -369,11 +369,17 @@ bool W_Porto(int req) return true; } + case WR_CHECKAMMO1: + case WR_CHECKAMMO2: + { + // always allow infinite ammo + return true; + } case WR_INIT: { - precache_model("models/weapons/g_porto.md3"); - precache_model("models/weapons/v_porto.md3"); - precache_model("models/weapons/h_porto.iqm"); + precache_model(W_Model("g_porto.md3")); + precache_model(W_Model("v_porto.md3")); + precache_model(W_Model("h_porto.iqm")); precache_model("models/portal.md3"); precache_sound("porto/bounce.wav"); precache_sound("porto/create.wav"); diff --git a/qcsrc/common/weapons/w_rifle.qc b/qcsrc/common/weapons/w_rifle.qc index 17c7ae3c2..687a20cf4 100644 --- a/qcsrc/common/weapons/w_rifle.qc +++ b/qcsrc/common/weapons/w_rifle.qc @@ -76,12 +76,12 @@ void W_Rifle_FireBullet(float pSpread, float pDamage, float pForce, float pSolid void W_Rifle_Attack(void) { - W_Rifle_FireBullet(WEP_CVAR_PRI(rifle, spread), WEP_CVAR_PRI(rifle, damage), WEP_CVAR_PRI(rifle, force), WEP_CVAR_PRI(rifle, solidpenetration), WEP_CVAR_PRI(rifle, ammo), WEP_RIFLE.m_id, WEP_CVAR_PRI(rifle, tracer), WEP_CVAR_PRI(rifle, shots), "weapons/campingrifle_fire.wav"); + W_Rifle_FireBullet(WEP_CVAR_PRI(rifle, spread), WEP_CVAR_PRI(rifle, damage), WEP_CVAR_PRI(rifle, force), WEP_CVAR_PRI(rifle, solidpenetration), WEP_CVAR_PRI(rifle, ammo), WEP_RIFLE.m_id, WEP_CVAR_PRI(rifle, tracer), WEP_CVAR_PRI(rifle, shots), W_Sound("campingrifle_fire")); } void W_Rifle_Attack2(void) { - W_Rifle_FireBullet(WEP_CVAR_SEC(rifle, spread), WEP_CVAR_SEC(rifle, damage), WEP_CVAR_SEC(rifle, force), WEP_CVAR_SEC(rifle, solidpenetration), WEP_CVAR_SEC(rifle, ammo), WEP_RIFLE.m_id | HITTYPE_SECONDARY, WEP_CVAR_SEC(rifle, tracer), WEP_CVAR_SEC(rifle, shots), "weapons/campingrifle_fire2.wav"); + W_Rifle_FireBullet(WEP_CVAR_SEC(rifle, spread), WEP_CVAR_SEC(rifle, damage), WEP_CVAR_SEC(rifle, force), WEP_CVAR_SEC(rifle, solidpenetration), WEP_CVAR_SEC(rifle, ammo), WEP_RIFLE.m_id | HITTYPE_SECONDARY, WEP_CVAR_SEC(rifle, tracer), WEP_CVAR_SEC(rifle, shots), W_Sound("campingrifle_fire2")); } .void(void) rifle_bullethail_attackfunc; @@ -204,11 +204,11 @@ bool W_Rifle(int req) } case WR_INIT: { - precache_model("models/weapons/g_campingrifle.md3"); - precache_model("models/weapons/v_campingrifle.md3"); - precache_model("models/weapons/h_campingrifle.iqm"); - precache_sound("weapons/campingrifle_fire.wav"); - precache_sound("weapons/campingrifle_fire2.wav"); + precache_model(W_Model("g_sniperrifle.md3")); + precache_model(W_Model("v_sniperrifle.md3")); + precache_model(W_Model("h_sniperrifle.iqm")); + precache_sound(W_Sound("campingrifle_fire")); + precache_sound(W_Sound("campingrifle_fire2")); RIFLE_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -236,7 +236,7 @@ bool W_Rifle(int req) } case WR_RELOAD: { - W_Reload(min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), "weapons/reload.wav"); + W_Reload(min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), W_Sound("reload")); return true; } case WR_SUICIDEMESSAGE: diff --git a/qcsrc/common/weapons/w_rpc.qc b/qcsrc/common/weapons/w_rpc.qc index 87ad16f5c..f879fdd64 100644 --- a/qcsrc/common/weapons/w_rpc.qc +++ b/qcsrc/common/weapons/w_rpc.qc @@ -108,7 +108,7 @@ void W_RocketPropelledChainsaw_Attack (void) entity flash = spawn (); W_DecreaseAmmo(WEP_CVAR(rpc, ammo)); - W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', false, 5, "weapons/rocket_fire.wav", CH_WEAPON_A, WEP_CVAR(rpc, damage)); + W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', false, 5, W_Sound("rocket_fire"), CH_WEAPON_A, WEP_CVAR(rpc, damage)); Send_Effect("rocketlauncher_muzzleflash", w_shotorg, w_shotdir * 1000, 1); PROJECTILE_MAKETRIGGER(missile); @@ -183,10 +183,10 @@ bool W_RocketPropelledChainsaw(int req) case WR_INIT: { precache_model ("models/flash.md3"); - precache_model("models/weapons/h_ok_rl.iqm"); - precache_model("models/weapons/v_ok_rl.md3"); - precache_model("models/weapons/g_ok_rl.md3"); - precache_sound ("weapons/rocket_fire.wav"); + precache_model(W_Model("g_ok_rl.md3")); + precache_model(W_Model("v_ok_rl.md3")); + precache_model(W_Model("h_ok_rl.iqm")); + precache_sound (W_Sound("rocket_fire")); RPC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -207,7 +207,7 @@ bool W_RocketPropelledChainsaw(int req) } case WR_RELOAD: { - W_Reload(WEP_CVAR(rpc, ammo), "weapons/reload.wav"); + W_Reload(WEP_CVAR(rpc, ammo), W_Sound("reload")); return true; } case WR_SUICIDEMESSAGE: diff --git a/qcsrc/common/weapons/w_seeker.qc b/qcsrc/common/weapons/w_seeker.qc index 313d5defd..f94984daa 100644 --- a/qcsrc/common/weapons/w_seeker.qc +++ b/qcsrc/common/weapons/w_seeker.qc @@ -250,7 +250,7 @@ void W_Seeker_Fire_Missile(vector f_diff, entity m_target) W_DecreaseAmmo(WEP_CVAR(seeker, missile_ammo)); makevectors(self.v_angle); - W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, "weapons/seeker_fire.wav", CH_WEAPON_A, 0); + W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, W_Sound("seeker_fire.wav"), CH_WEAPON_A, 0); w_shotorg += f_diff; Send_Effect("seeker_muzzleflash", w_shotorg, w_shotdir * 1000, 1); @@ -341,7 +341,7 @@ void W_Seeker_Fire_Flac(void) f_diff = '+1.25 +3.75 0'; break; } - W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, "weapons/flac_fire.wav", CH_WEAPON_A, WEP_CVAR(seeker, flac_damage)); + W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, W_Sound("flac_fire"), CH_WEAPON_A, WEP_CVAR(seeker, flac_damage)); w_shotorg += f_diff; Send_Effect("hagar_muzzleflash", w_shotorg, w_shotdir * 1000, 1); @@ -560,7 +560,7 @@ void W_Seeker_Fire_Tag(void) entity missile; W_DecreaseAmmo(WEP_CVAR(seeker, tag_ammo)); - W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, "weapons/tag_fire.wav", CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count)); + W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, W_Sound("tag_fire"), CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count)); missile = spawn(); missile.owner = missile.realowner = self; @@ -663,12 +663,12 @@ bool W_Seeker(int req) } case WR_INIT: { - precache_model("models/weapons/g_seeker.md3"); - precache_model("models/weapons/v_seeker.md3"); - precache_model("models/weapons/h_seeker.iqm"); - precache_sound("weapons/tag_fire.wav"); - precache_sound("weapons/flac_fire.wav"); - precache_sound("weapons/seeker_fire.wav"); + precache_model(W_Model("g_seeker.md3")); + precache_model(W_Model("v_seeker.md3")); + precache_model(W_Model("h_seeker.iqm")); + precache_sound(W_Sound("tag_fire")); + precache_sound(W_Sound("flac_fire")); + precache_sound(W_Sound("seeker_fire")); SEEKER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -707,7 +707,7 @@ bool W_Seeker(int req) } case WR_RELOAD: { - W_Reload(min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), "weapons/reload.wav"); + W_Reload(min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), W_Sound("reload")); return true; } case WR_SUICIDEMESSAGE: diff --git a/qcsrc/common/weapons/w_shockwave.qc b/qcsrc/common/weapons/w_shockwave.qc index 91961bb18..1c5d080d3 100644 --- a/qcsrc/common/weapons/w_shockwave.qc +++ b/qcsrc/common/weapons/w_shockwave.qc @@ -229,7 +229,7 @@ void W_Shockwave_Melee_Think(void) void W_Shockwave_Melee(void) { - sound(self, CH_WEAPON_A, "weapons/shotgun_melee.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_A, W_Sound("shotgun_melee"), VOL_BASE, ATTN_NORM); weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready); entity meleetemp; @@ -360,7 +360,7 @@ void W_Shockwave_Attack(void) float i, queue = 0; // set up the shot direction - W_SetupShot(self, false, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage)); + W_SetupShot(self, false, 3, W_Sound("lasergun_fire"), CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage)); vector attack_endpos = (w_shotorg + (w_shotdir * WEP_CVAR(shockwave, blast_distance))); WarpZone_TraceLine(w_shotorg, attack_endpos, MOVE_NOMONSTERS, self); vector attack_hitpos = trace_endpos; @@ -709,12 +709,12 @@ bool W_Shockwave(int req) case WR_INIT: { precache_model("models/uziflash.md3"); - precache_model("models/weapons/g_shotgun.md3"); - precache_model("models/weapons/v_shotgun.md3"); - precache_model("models/weapons/h_shotgun.iqm"); + precache_model(W_Model("g_shotgun.md3")); + precache_model(W_Model("v_shotgun.md3")); + precache_model(W_Model("h_shotgun.iqm")); precache_sound("misc/itempickup.wav"); - precache_sound("weapons/lasergun_fire.wav"); - precache_sound("weapons/shotgun_melee.wav"); + precache_sound(W_Sound("lasergun_fire")); + precache_sound(W_Sound("shotgun_melee")); SHOCKWAVE_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } diff --git a/qcsrc/common/weapons/w_shotgun.qc b/qcsrc/common/weapons/w_shotgun.qc index d93e9dd3f..76738a98a 100644 --- a/qcsrc/common/weapons/w_shotgun.qc +++ b/qcsrc/common/weapons/w_shotgun.qc @@ -61,7 +61,7 @@ void W_Shotgun_Attack(float isprimary) W_DecreaseAmmo(WEP_CVAR_PRI(shotgun, ammo)); - W_SetupShot(self, true, 5, "weapons/shotgun_fire.wav", ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), WEP_CVAR_PRI(shotgun, damage) * WEP_CVAR_PRI(shotgun, bullets)); + W_SetupShot(self, true, 5, W_Sound("shotgun_fire"), ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), WEP_CVAR_PRI(shotgun, damage) * WEP_CVAR_PRI(shotgun, bullets)); for(sc = 0;sc < WEP_CVAR_PRI(shotgun, bullets);sc = sc + 1) fireBullet(w_shotorg, w_shotdir, WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, force), WEP_SHOTGUN.m_id, 0); @@ -181,7 +181,7 @@ void W_Shotgun_Melee_Think(void) void W_Shotgun_Attack2(void) { - sound(self, CH_WEAPON_A, "weapons/shotgun_melee.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_WEAPON_A, W_Sound("shotgun_melee"), VOL_BASE, ATTEN_NORM); weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(shotgun, animtime), w_ready); entity meleetemp; @@ -287,12 +287,12 @@ float W_Shotgun(float req) case WR_INIT: { precache_model("models/uziflash.md3"); - precache_model("models/weapons/g_shotgun.md3"); - precache_model("models/weapons/v_shotgun.md3"); - precache_model("models/weapons/h_shotgun.iqm"); + precache_model(W_Model("g_shotgun.md3")); + precache_model(W_Model("v_shotgun.md3")); + precache_model(W_Model("h_shotgun.iqm")); precache_sound("misc/itempickup.wav"); - precache_sound("weapons/shotgun_fire.wav"); - precache_sound("weapons/shotgun_melee.wav"); + precache_sound(W_Sound("shotgun_fire")); + precache_sound(W_Sound("shotgun_melee")); SHOTGUN_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -331,7 +331,7 @@ float W_Shotgun(float req) } case WR_RELOAD: { - W_Reload(WEP_CVAR_PRI(shotgun, ammo), "weapons/reload.wav"); // WEAPONTODO + W_Reload(WEP_CVAR_PRI(shotgun, ammo), W_Sound("reload")); // WEAPONTODO return true; } case WR_SUICIDEMESSAGE: diff --git a/qcsrc/common/weapons/w_tuba.qc b/qcsrc/common/weapons/w_tuba.qc index 86fcca346..bd9dff50e 100644 --- a/qcsrc/common/weapons/w_tuba.qc +++ b/qcsrc/common/weapons/w_tuba.qc @@ -417,13 +417,13 @@ bool W_Tuba(int req) } case WR_INIT: { - precache_model("models/weapons/g_tuba.md3"); - precache_model("models/weapons/v_tuba.md3"); - precache_model("models/weapons/h_tuba.iqm"); - precache_model("models/weapons/v_akordeon.md3"); - precache_model("models/weapons/h_akordeon.iqm"); - precache_model("models/weapons/v_kleinbottle.md3"); - precache_model("models/weapons/h_kleinbottle.iqm"); + precache_model(W_Model("g_tuba.md3")); + precache_model(W_Model("v_tuba.md3")); + precache_model(W_Model("h_tuba.iqm")); + precache_model(W_Model("v_akordeon.md3")); + precache_model(W_Model("h_akordeon.iqm")); + precache_model(W_Model("v_kleinbottle.md3")); + precache_model(W_Model("h_kleinbottle.iqm")); TUBA_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } diff --git a/qcsrc/common/weapons/w_vaporizer.qc b/qcsrc/common/weapons/w_vaporizer.qc index da9414900..9e4f08d40 100644 --- a/qcsrc/common/weapons/w_vaporizer.qc +++ b/qcsrc/common/weapons/w_vaporizer.qc @@ -60,7 +60,7 @@ void W_Vaporizer_Attack(void) W_SetupShot(self, true, 0, "", CH_WEAPON_A, 10000); // handle sound separately so we can change the volume // added bonus: no longer plays the strength sound (strength gives no bonus to instakill anyway) - sound (self, CH_WEAPON_A, "weapons/minstanexfire.wav", VOL_BASE * 0.8, ATTEN_NORM); + sound (self, CH_WEAPON_A, W_Sound("minstanexfire"), VOL_BASE * 0.8, ATTEN_NORM); yoda = 0; damage_goodhits = 0; @@ -191,13 +191,13 @@ float W_Vaporizer(float req) case WR_INIT: { precache_model("models/nexflash.md3"); - precache_model("models/weapons/g_minstanex.md3"); - precache_model("models/weapons/v_minstanex.md3"); - precache_model("models/weapons/h_minstanex.iqm"); - precache_sound("weapons/minstanexfire.wav"); - precache_sound("weapons/nexwhoosh1.wav"); - precache_sound("weapons/nexwhoosh2.wav"); - precache_sound("weapons/nexwhoosh3.wav"); + precache_model(W_Model("g_minstanex.md3")); + precache_model(W_Model("v_minstanex.md3")); + precache_model(W_Model("h_minstanex.iqm")); + precache_sound(W_Sound("minstanexfire")); + precache_sound(W_Sound("nexwhoosh1")); + precache_sound(W_Sound("nexwhoosh2")); + precache_sound(W_Sound("nexwhoosh3")); //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously? VAPORIZER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; @@ -240,7 +240,7 @@ float W_Vaporizer(float req) else used_ammo = vaporizer_ammo; - W_Reload(used_ammo, "weapons/reload.wav"); + W_Reload(used_ammo, W_Sound("reload")); return true; } case WR_SUICIDEMESSAGE: diff --git a/qcsrc/common/weapons/w_vortex.qc b/qcsrc/common/weapons/w_vortex.qc index 0b0dc3013..616bf89d7 100644 --- a/qcsrc/common/weapons/w_vortex.qc +++ b/qcsrc/common/weapons/w_vortex.qc @@ -103,10 +103,10 @@ void W_Vortex_Attack(float issecondary) mydmg *= charge; myforce *= charge; - W_SetupShot(self, true, 5, "weapons/nexfire.wav", CH_WEAPON_A, mydmg); + W_SetupShot(self, true, 5, W_Sound("nexfire"), CH_WEAPON_A, mydmg); if(charge > WEP_CVAR(vortex, charge_animlimit) && WEP_CVAR(vortex, charge_animlimit)) // if the Vortex is overcharged, we play an extra sound { - sound(self, CH_WEAPON_B, "weapons/nexcharge.wav", VOL_BASE * (charge - 0.5 * WEP_CVAR(vortex, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(vortex, charge_animlimit)), ATTN_NORM); + sound(self, CH_WEAPON_B, W_Sound("nexcharge"), VOL_BASE * (charge - 0.5 * WEP_CVAR(vortex, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(vortex, charge_animlimit)), ATTN_NORM); } yoda = 0; @@ -254,14 +254,14 @@ bool W_Vortex(int req) case WR_INIT: { precache_model("models/nexflash.md3"); - precache_model("models/weapons/g_nex.md3"); - precache_model("models/weapons/v_nex.md3"); - precache_model("models/weapons/h_nex.iqm"); - precache_sound("weapons/nexfire.wav"); - precache_sound("weapons/nexcharge.wav"); - precache_sound("weapons/nexwhoosh1.wav"); - precache_sound("weapons/nexwhoosh2.wav"); - precache_sound("weapons/nexwhoosh3.wav"); + precache_model(W_Model("g_nex.md3")); + precache_model(W_Model("v_nex.md3")); + precache_model(W_Model("h_nex.iqm")); + precache_sound(W_Sound("nexfire")); + precache_sound(W_Sound("nexcharge")); + precache_sound(W_Sound("nexwhoosh1")); + precache_sound(W_Sound("nexwhoosh2")); + precache_sound(W_Sound("nexwhoosh3")); VORTEX_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -302,7 +302,7 @@ bool W_Vortex(int req) } case WR_RELOAD: { - W_Reload(min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), "weapons/reload.wav"); + W_Reload(min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), W_Sound("reload")); return true; } case WR_SUICIDEMESSAGE: diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index cb19c007a..502340fd9 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -283,7 +283,7 @@ float CheatImpulse(float i) e = self; Send_Effect("rocket_explode", e.origin, '0 0 0', 1); - sound(e, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM); + sound(e, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); e2 = spawn(); setorigin(e2, e.origin); diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index 71c32df39..866f71f72 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -91,7 +91,7 @@ void GrapplingHookThink(); void GrapplingHook_Stop() { Send_Effect("grapple_impact", self.origin, '0 0 0', 1); - sound (self, CH_SHOTS, "weapons/hook_impact.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS, W_Sound("hook_impact"), VOL_BASE, ATTEN_NORM); self.state = 1; self.think = GrapplingHookThink; @@ -327,7 +327,7 @@ void FireGrapplingHook (void) vs = hook_shotorigin[s]; // UGLY WORKAROUND: play this on CH_WEAPON_B so it can't cut off fire sounds - sound (self, CH_WEAPON_B, "weapons/hook_fire.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_WEAPON_B, W_Sound("hook_fire"), VOL_BASE, ATTEN_NORM); org = self.origin + self.view_ofs + v_forward * vs.x + v_right * -vs.y + v_up * vs.z; tracebox(self.origin + self.view_ofs, '-3 -3 -3', '3 3 3', org, MOVE_NORMAL, self); diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 88744acc0..e757e0172 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -1049,15 +1049,15 @@ void precache() precache_model ("models/sprites/10.spr32"); // common weapon precaches - precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound here - precache_sound ("weapons/weapon_switch.wav"); - precache_sound ("weapons/weaponpickup.wav"); - precache_sound ("weapons/unavailable.wav"); - precache_sound ("weapons/dryfire.wav"); + precache_sound (W_Sound("reload")); // until weapons have individual reload sounds, precache the reload sound here + precache_sound (W_Sound("weapon_switch")); + precache_sound (W_Sound("weaponpickup")); + precache_sound (W_Sound("unavailable")); + precache_sound (W_Sound("dryfire")); if (g_grappling_hook) { - precache_sound ("weapons/hook_fire.wav"); // hook - precache_sound ("weapons/hook_impact.wav"); // hook + precache_sound (W_Sound("hook_fire")); // hook + precache_sound (W_Sound("hook_impact")); // hook } precache_model("models/elaser.mdl"); diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 01cdd168f..0f93f2ebf 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -56,13 +56,33 @@ entity frag_target; int frag_deathtype; MUTATOR_HOOKABLE(PlayerDies, EV_PlayerDies); -/** called when a player dies to e.g. remove stuff he was carrying. */ +/** called when a player dies to e.g. remove stuff he was carrying */ #define EV_PlayHitsound(i, o) \ /**/ i(entity, frag_victim) \ /**/ entity frag_victim; MUTATOR_HOOKABLE(PlayHitsound, EV_PlayHitsound); +/** called when a weapon sound is about to be played, allows custom paths etc. */ +#define EV_WeaponSound(i, o) \ + /**/ i(string, weapon_sound) \ + /**/ i(string, weapon_sound_output) \ + /**/ o(string, weapon_sound_output) \ + /**/ +string weapon_sound; +string weapon_sound_output; +MUTATOR_HOOKABLE(WeaponSound, EV_WeaponSound); + +/** called when a weapon model is about to be set, allows custom paths etc. */ +#define EV_WeaponModel(i, o) \ + /**/ i(string, weapon_model) \ + /**/ i(string, weapon_model_output) \ + /**/ o(string, weapon_model_output) \ + /**/ +string weapon_model; +string weapon_model_output; +MUTATOR_HOOKABLE(WeaponModel, EV_WeaponModel); + /** called when a player presses the jump key */ #define EV_PlayerJump(i, o) \ /**/ i(float, player_multijump) \ diff --git a/qcsrc/server/mutators/gamemode_onslaught.qc b/qcsrc/server/mutators/gamemode_onslaught.qc index fb6e0c10e..9b356404d 100644 --- a/qcsrc/server/mutators/gamemode_onslaught.qc +++ b/qcsrc/server/mutators/gamemode_onslaught.qc @@ -396,7 +396,7 @@ void ons_ControlPoint_Icon_Damage(entity inflictor, entity attacker, float damag if (self.health < 0) { - sound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_TRIGGER, W_Sound("grenade_impact"), VOL_BASE, ATTEN_NORM); pointparticles(particleeffectnum("rocket_explode"), self.origin, '0 0 0', 1); Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(self.team, INFO_ONSLAUGHT_CPDESTROYED_), self.owner.message, attacker.netname); @@ -782,7 +782,7 @@ void ons_ControlPoint_Setup(entity cp) precache_model("models/onslaught/controlpoint_icon_gib4.md3"); precache_sound("onslaught/controlpoint_build.wav"); precache_sound("onslaught/controlpoint_built.wav"); - precache_sound("weapons/grenade_impact.wav"); + precache_sound(W_Sound("grenade_impact")); precache_sound("onslaught/damageblockedbyshield.wav"); precache_sound("onslaught/controlpoint_underattack.wav"); precache_sound("onslaught/ons_spark1.wav"); @@ -918,7 +918,7 @@ void ons_GeneratorDamage(entity inflictor, entity attacker, float damage, int de // Throw some flaming gibs on damage, more damage = more chance for gib if(random() < damage/220) { - sound(self, CH_TRIGGER, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_TRIGGER, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); } else { @@ -1042,8 +1042,8 @@ void ons_GeneratorSetup(entity gen) // called when spawning a generator entity o precache_model("models/onslaught/gen_gib2.md3"); precache_model("models/onslaught/gen_gib3.md3"); precache_sound("onslaught/generator_decay.wav"); - precache_sound("weapons/grenade_impact.wav"); - precache_sound("weapons/rocket_impact.wav"); + precache_sound(W_Sound("grenade_impact")); + precache_sound(W_Sound("rocket_impact")); precache_sound("onslaught/generator_underattack.wav"); precache_sound("onslaught/shockwave.wav"); precache_sound("onslaught/ons_hit1.wav"); diff --git a/qcsrc/server/mutators/mutator_buffs.qc b/qcsrc/server/mutators/mutator_buffs.qc index f144899c8..f6a881f7b 100644 --- a/qcsrc/server/mutators/mutator_buffs.qc +++ b/qcsrc/server/mutators/mutator_buffs.qc @@ -954,7 +954,7 @@ void buffs_Initialize() precache_sound("misc/strength_respawn.wav"); precache_sound("misc/shield_respawn.wav"); precache_sound("relics/relic_effect.wav"); - precache_sound("weapons/rocket_impact.wav"); + precache_sound(W_Sound("rocket_impact")); precache_sound("keepaway/respawn.wav"); addstat(STAT_BUFFS, AS_INT, buffs); diff --git a/qcsrc/server/mutators/mutator_nades.qc b/qcsrc/server/mutators/mutator_nades.qc index 9f2b2d302..a3949dab6 100644 --- a/qcsrc/server/mutators/mutator_nades.qc +++ b/qcsrc/server/mutators/mutator_nades.qc @@ -121,7 +121,7 @@ void nade_napalm_ball() entity proj; vector kick; - spamsound(self, CH_SHOTS, "weapons/fireball_fire.wav", VOL_BASE, ATTEN_NORM); + spamsound(self, CH_SHOTS, W_Sound("fireball_fire"), VOL_BASE, ATTEN_NORM); proj = spawn (); proj.owner = self.owner; @@ -260,7 +260,7 @@ void nade_ice_think() default: expef = "nade_neutral_explode"; break; } Send_Effect(expef, self.origin + '0 0 1', '0 0 0', 1); - sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); RadiusDamage(self, self.realowner, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage, autocvar_g_nades_nade_radius, self, world, autocvar_g_nades_nade_force, self.projectiledeathtype, self.enemy); @@ -533,7 +533,7 @@ void nade_boom() Send_Effect(expef, findbetterlocation(self.origin, 8), '0 0 0', 1); sound(self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM); - sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); self.event_damage = func_null; // prevent somehow calling damage in the next call @@ -577,7 +577,7 @@ void nade_touch() //UpdateCSQCProjectile(self); if(self.health == self.max_health) { - spamsound(self, CH_SHOTS, strcat("weapons/grenade_bounce", ftos(1 + rint(random() * 5)), ".wav"), VOL_BASE, ATTEN_NORM); + spamsound(self, CH_SHOTS, W_Sound(strcat("grenade_bounce", ftos(1 + rint(random() * 5)))), VOL_BASE, ATTEN_NORM); return; } @@ -1193,13 +1193,13 @@ void nades_Initialize() precache_model("models/weapons/v_ok_grenade.md3"); precache_model("models/ctf/shield.md3"); - precache_sound("weapons/rocket_impact.wav"); - precache_sound("weapons/grenade_bounce1.wav"); - precache_sound("weapons/grenade_bounce2.wav"); - precache_sound("weapons/grenade_bounce3.wav"); - precache_sound("weapons/grenade_bounce4.wav"); - precache_sound("weapons/grenade_bounce5.wav"); - precache_sound("weapons/grenade_bounce6.wav"); + precache_sound(W_Sound("rocket_impact")); + precache_sound(W_Sound("grenade_bounce1")); + precache_sound(W_Sound("grenade_bounce2")); + precache_sound(W_Sound("grenade_bounce3")); + precache_sound(W_Sound("grenade_bounce4")); + precache_sound(W_Sound("grenade_bounce5")); + precache_sound(W_Sound("grenade_bounce6")); precache_sound("overkill/grenadebip.ogg"); } diff --git a/qcsrc/server/mutators/mutator_new_toys.qc b/qcsrc/server/mutators/mutator_new_toys.qc index 78875cb70..edbdc8aa8 100644 --- a/qcsrc/server/mutators/mutator_new_toys.qc +++ b/qcsrc/server/mutators/mutator_new_toys.qc @@ -190,7 +190,7 @@ MUTATOR_HOOKFUNCTION(nt_SetWeaponreplace) MUTATOR_HOOKFUNCTION(nt_FilterItem) { if(nt_IsNewToy(self.weapon)) - self.item_pickupsound = "weapons/weaponpickup_new_toys.wav"; + self.item_pickupsound = W_Sound("weaponpickup_new_toys"); return 0; } @@ -206,7 +206,7 @@ MUTATOR_DEFINITION(mutator_new_toys) if(time > 1) // game loads at time 1 error("This cannot be added at runtime\n"); - precache_sound("weapons/weaponpickup_new_toys.wav"); + precache_sound(W_Sound("weaponpickup_new_toys")); // mark the guns as ok to use by e.g. impulse 99 float i; diff --git a/qcsrc/server/mutators/mutator_overkill.qc b/qcsrc/server/mutators/mutator_overkill.qc index c975cda15..220566620 100644 --- a/qcsrc/server/mutators/mutator_overkill.qc +++ b/qcsrc/server/mutators/mutator_overkill.qc @@ -175,7 +175,7 @@ MUTATOR_HOOKFUNCTION(ok_PlayerPreThink) { //Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_OVERKILL_CHARGE); self.ok_notice_time = time + 2; - play2(self, "weapons/dryfire.wav"); + play2(self, W_Sound("dryfire")); } if(self.weaponentity.state != WS_CLEAR) w_ready(); @@ -329,7 +329,7 @@ void ok_Initialize() precache_model("models/weapons/v_ok_sniper.md3"); precache_model("models/weapons/g_ok_sniper.md3"); - precache_sound("weapons/dryfire.wav"); + precache_sound(W_Sound("dryfire")); addstat(STAT_OK_AMMO_CHARGE, AS_FLOAT, ok_use_ammocharge); addstat(STAT_OK_AMMO_CHARGEPOOL, AS_FLOAT, ok_ammo_charge); diff --git a/qcsrc/server/mutators/mutator_touchexplode.qc b/qcsrc/server/mutators/mutator_touchexplode.qc index 5d3dda20d..5ceeff34b 100644 --- a/qcsrc/server/mutators/mutator_touchexplode.qc +++ b/qcsrc/server/mutators/mutator_touchexplode.qc @@ -10,7 +10,7 @@ void PlayerTouchExplode(entity p1, entity p2) org = (p1.origin + p2.origin) * 0.5; org.z += (p1.mins.z + p2.mins.z) * 0.5; - sound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_TRIGGER, W_Sound("grenade_impact"), VOL_BASE, ATTEN_NORM); Send_Effect("explosion_small", org, '0 0 0', 1); entity e; diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 7d173d73a..18d8c19aa 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -1520,7 +1520,7 @@ void spawnfunc_item_health25() { spawnfunc_item_health_medium(); } void spawnfunc_item_health100() { spawnfunc_item_health_mega(); } void spawnfunc_item_strength (void) { - precache_sound("weapons/strength_fire.wav"); + precache_sound(W_Sound("strength_fire")); if(!self.strength_finished) self.strength_finished = autocvar_g_balance_powerup_strength_time; StartItemA (ITEM_Strength); @@ -1578,7 +1578,7 @@ void spawnfunc_target_items (void) precache_sound("misc/armor25.wav"); precache_sound("misc/powerup.wav"); precache_sound("misc/poweroff.wav"); - precache_sound("weapons/weaponpickup.wav"); + precache_sound(W_Sound("weaponpickup")); n = tokenize_console(self.netname); if(argv(0) == "give") @@ -1988,7 +1988,7 @@ float GiveItems(entity e, float beginarg, float endarg) wi = get_weaponinfo(j); if(wi.weapon) { - POSTGIVE_WEAPON(e, j, "weapons/weaponpickup.wav", string_null); + POSTGIVE_WEAPON(e, j, W_Sound("weaponpickup"), string_null); if (!(save_weapons & WepSet_FromWeapon(j))) if(e.weapons & WepSet_FromWeapon(j)) WEP_ACTION(wi.weapon, WR_INIT); diff --git a/qcsrc/server/weapons/common.qc b/qcsrc/server/weapons/common.qc index 8e19fb53d..8c3c88381 100644 --- a/qcsrc/server/weapons/common.qc +++ b/qcsrc/server/weapons/common.qc @@ -32,7 +32,7 @@ void W_PlayStrengthSound(entity player) // void W_PlayStrengthSound && ((time > player.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam || (time > player.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold))) { - sound(player, CH_TRIGGER, "weapons/strength_fire.wav", VOL_BASE, ATTEN_NORM); + sound(player, CH_TRIGGER, W_Sound("strength_fire"), VOL_BASE, ATTEN_NORM); player.prevstrengthsound = time; } player.prevstrengthsoundattempt = time; diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index 868d6b041..f6882302e 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -66,7 +66,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) if (complain) if(IS_REAL_CLIENT(cl)) { - play2(cl, "weapons/unavailable.wav"); + play2(cl, W_Sound("unavailable")); Send_WeaponComplain (cl, wpn, 0); } return false; @@ -109,7 +109,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) Send_WeaponComplain (cl, wpn, 2); } - play2(cl, "weapons/unavailable.wav"); + play2(cl, W_Sound("unavailable")); } return false; } diff --git a/qcsrc/server/weapons/spawning.qc b/qcsrc/server/weapons/spawning.qc index 8e7810bbb..d6d158f49 100644 --- a/qcsrc/server/weapons/spawning.qc +++ b/qcsrc/server/weapons/spawning.qc @@ -179,7 +179,7 @@ void weapon_defaultspawnfunc(float wpn) if(self.team) f |= FL_NO_WEAPON_STAY; - StartItem(e.model, "weapons/weaponpickup.wav", self.respawntime, self.respawntimejitter, e.message, 0, e.weapon, f, weapon_pickupevalfunc, e.bot_pickupbasevalue); + StartItem(e.model, W_Sound("weaponpickup"), self.respawntime, self.respawntimejitter, e.message, 0, e.weapon, f, weapon_pickupevalfunc, e.bot_pickupbasevalue); #if 0 // WEAPONTODO if (self.modelindex) // don't precache if self was removed WEP_ACTION(e.weapon, WR_INIT); diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc index 49f6fdde7..484ac35be 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -287,7 +287,7 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f if(f <= 0) continue; - snd = strcat("weapons/nexwhoosh", ftos(floor(random() * 3) + 1), ".wav"); + snd = W_Sound(strcat("nexwhoosh", ftos(floor(random() * 3) + 1))); if(!pseudoprojectile) pseudoprojectile = spawn(); // we need this so the sound uses the "entchannel4" volume diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index d3b11cf18..fede82567 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -482,7 +482,7 @@ float weapon_prepareattack_checkammo(float secondary) if(self.weapon == self.switchweapon && time - self.prevdryfire > 1) // only play once BEFORE starting to switch weapons { - sound (self, CH_WEAPON_A, "weapons/dryfire.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_WEAPON_A, W_Sound("dryfire"), VOL_BASE, ATTEN_NORM); self.prevdryfire = time; } @@ -740,7 +740,7 @@ void W_WeaponFrame() if(ATTACK_FINISHED(self) <= time + self.weapon_frametime * 0.5) { #endif - sound(self, CH_WEAPON_SINGLE, "weapons/weapon_switch.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_SINGLE, W_Sound("weapon_switch"), VOL_BASE, ATTN_NORM); self.weaponentity.state = WS_DROP; weapon_thinkf(WFRAME_DONTCHANGE, oldwep.switchdelay_drop, w_clear); #ifndef INDEPENDENT_ATTACK_FINISHED @@ -935,7 +935,7 @@ void W_Reload(float sent_ammo_min, string sent_sound) { if(IS_REAL_CLIENT(self) && self.reload_complain < time) { - play2(self, "weapons/unavailable.wav"); + play2(self, W_Sound("unavailable")); sprint(self, strcat("You don't have enough ammo to reload the ^2", WEP_NAME(self.weapon), "\n")); self.reload_complain = time + 1; }