From: TimePath Date: Sat, 26 Sep 2015 11:12:45 +0000 (+0000) Subject: Merge branch 'TimePath/soundregistry' into 'master' X-Git-Tag: xonotic-v0.8.2~1914 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=c6437cd43edc4489ad69746a30b5532f18c1af74;hp=4fd4f693e6f21ac27beb4439bc2892f238e1b746 Merge branch 'TimePath/soundregistry' into 'master' Sound registry Destringified sounds in favor of constants Automated precaching Closes #1303 See merge request !226 --- diff --git a/qcsrc/Makefile b/qcsrc/Makefile index 6dd476c2d3..51440d4a3c 100644 --- a/qcsrc/Makefile +++ b/qcsrc/Makefile @@ -9,32 +9,34 @@ QCCVERSIONFILE := qccversion.$(shell (cd server && $(QCC) --version) > qccversio QCCFLAGS_WTFS ?= \ -Wno-field-redeclared -QCCFLAGS ?= \ - -std=gmqcc \ - -O3 -flno \ - -Werror -fno-bail-on-werror -Wall \ - -fftepp -fftepp-predefs -Wcpp -futf8 -frelaxed-switch -freturn-assignments \ - $(QCCFLAGS_WTFS) \ - $(QCCFLAGS_FEATURES) \ - $(QCCFLAGS_EXTRA) $(QCCFLAGS_WATERMARK) - QCCFLAGS_FEATURES ?= \ -DVEHICLES_ENABLED=1 \ -DVEHICLES_USE_ODE=0 \ -DBUILD_MOD=$(BUILD_MOD) +QCCFLAGS ?= \ + -std=gmqcc \ + -O3 \ + -Werror -Wall -Wcpp \ + $(QCCFLAGS_WTFS) \ + -fftepp -flno -futf8 -fno-bail-on-werror -fftepp-predefs \ + -frelaxed-switch -freturn-assignments \ + $(QCCFLAGS_WATERMARK) \ + $(QCCFLAGS_FEATURES) \ + $(QCCFLAGS_EXTRA) + # xonotic build system overrides this by command line argument to turn off the update-cvarcount step XON_BUILDSYSTEM = -all: qc .PHONY: all +all: qc .PHONY: qc qc: ../menu.dat ../progs.dat ../csprogs.dat .PHONY: clean clean: - rm -f ../progs.dat ../menu.dat ../csprogs.dat server/precache-for-csqc.inc + rm -f ../progs.dat ../menu.dat ../csprogs.dat $(QCCVERSIONFILE): $(RM) qccversion.* @@ -45,11 +47,8 @@ FILES_CSPROGS = $(shell find client lib common warpzonelib csqcmodellib -type f @echo make[1]: Entering directory \`$(PWD)/client\' cd client && $(QCC) $(QCCFLAGS) -DCSQC -server/precache-for-csqc.inc: $(FILES_CSPROGS) - sh collect-precache.sh - FILES_PROGS = $(shell find server lib common warpzonelib csqcmodellib -type f -not -name fteqcc.log -not -name qc.asm) -../progs.dat: $(FILES_PROGS) $(QCCVERSIONFILE) server/precache-for-csqc.inc +../progs.dat: $(FILES_PROGS) $(QCCVERSIONFILE) @echo make[1]: Entering directory \`$(PWD)/server\' cd server && $(QCC) $(QCCFLAGS) -DSVQC diff --git a/qcsrc/client/_all.qh b/qcsrc/client/_all.qh index 66fd813143..12dc1b4a3a 100644 --- a/qcsrc/client/_all.qh +++ b/qcsrc/client/_all.qh @@ -9,5 +9,6 @@ #include "../dpdefs/csprogsdefs.qh" #include "../common/models/models.qh" +#include "../common/sounds/sounds.qh" #endif diff --git a/qcsrc/client/controlpoint.qc b/qcsrc/client/controlpoint.qc index aec000d64c..a83260b104 100644 --- a/qcsrc/client/controlpoint.qc +++ b/qcsrc/client/controlpoint.qc @@ -4,7 +4,6 @@ #include "../common/movetypes/movetypes.qh" .float alpha; -bool cpicon_precached; .int count; .float pain_finished; @@ -21,14 +20,6 @@ bool cpicon_precached; .entity icon_realmodel; -void cpicon_precache() -{ - if(cpicon_precached) - return; // already precached - - cpicon_precached = true; -} - void cpicon_draw() {SELFPARAM(); if(time < self.move_time) { return; } @@ -186,7 +177,6 @@ void ent_cpicon() self.count = (self.health - self.max_health) * frametime; cpicon_changeteam(); - cpicon_precache(); cpicon_construct(); } diff --git a/qcsrc/client/controlpoint.qh b/qcsrc/client/controlpoint.qh index 8469b5226f..a2ce395917 100644 --- a/qcsrc/client/controlpoint.qh +++ b/qcsrc/client/controlpoint.qh @@ -8,6 +8,5 @@ const int CPSF_STATUS = 4; const int CPSF_SETUP = 8; void ent_cpicon(); -void cpicon_precache(); #endif diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 022afd9d11..0c25e60064 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -1,4 +1,3 @@ -#include "csqcmodel_hooks.qh" #include "_all.qh" #include "gibs.qh" @@ -591,7 +590,7 @@ void CSQCModel_Effects_Apply(void) { if(!self.snd_looping) { - sound(self, CH_TRIGGER_SINGLE, "misc/jetpack_fly.wav", VOL_BASE, autocvar_g_jetpack_attenuation); + sound(self, CH_TRIGGER_SINGLE, SND_JETPACK_FLY, VOL_BASE, autocvar_g_jetpack_attenuation); self.snd_looping = CH_TRIGGER_SINGLE; } } @@ -599,17 +598,12 @@ void CSQCModel_Effects_Apply(void) { if(self.snd_looping) { - sound(self, self.snd_looping, "misc/null.wav", VOL_BASE, autocvar_g_jetpack_attenuation); + sound(self, self.snd_looping, SND_Null, VOL_BASE, autocvar_g_jetpack_attenuation); self.snd_looping = 0; } } } -void CSQCPlayer_Precache() -{ - precache_sound("misc/jetpack_fly.wav"); -} - // general functions .int csqcmodel_predraw_run; .int anim_frame; diff --git a/qcsrc/client/csqcmodel_hooks.qh b/qcsrc/client/csqcmodel_hooks.qh deleted file mode 100644 index 8995880593..0000000000 --- a/qcsrc/client/csqcmodel_hooks.qh +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef CSQCMODEL_HOOKS -#define CSQCMODEL_HOOKS - -void CSQCPlayer_Precache(); - -#endif diff --git a/qcsrc/client/damage.qc b/qcsrc/client/damage.qc index ec6da98428..4f25aef13e 100644 --- a/qcsrc/client/damage.qc +++ b/qcsrc/client/damage.qc @@ -228,35 +228,33 @@ void Ent_DamageInfo(float isNew) // spiderbot case DEATH_VH_SPID_MINIGUN: - string _snd; - _snd = W_Sound(strcat("ric", ftos(1 + rint(random() * 2)))); - sound(self, CH_SHOTS, _snd, VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM); pointparticles(particleeffectnum(EFFECT_SPIDERBOT_MINIGUN_IMPACT), self.origin, w_backoff * 1000, 1); break; case DEATH_VH_SPID_ROCKET: - sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); pointparticles(particleeffectnum(EFFECT_SPIDERBOT_ROCKET_EXPLODE), self.origin, w_backoff * 1000, 1); break; case DEATH_VH_SPID_DEATH: - sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_MIN); + sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_MIN); pointparticles(particleeffectnum(EFFECT_EXPLOSION_BIG), self.origin, w_backoff * 1000, 1); break; case DEATH_VH_WAKI_GUN: - sound(self, CH_SHOTS, W_Sound("laserimpact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM); pointparticles(particleeffectnum(EFFECT_RACER_IMPACT), self.origin, w_backoff * 1000, 1); break; case DEATH_VH_WAKI_ROCKET: - sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); pointparticles(particleeffectnum(EFFECT_RACER_ROCKET_EXPLODE), self.origin, w_backoff * 1000, 1); break; case DEATH_VH_WAKI_DEATH: - sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_MIN); + sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_MIN); pointparticles(particleeffectnum(EFFECT_EXPLOSION_BIG), self.origin, w_backoff * 1000, 1); break; case DEATH_VH_RAPT_CANNON: - sound(self, CH_SHOTS, W_Sound("laserimpact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM); pointparticles(particleeffectnum(EFFECT_RAPTOR_CANNON_IMPACT), self.origin, w_backoff * 1000, 1); break; case DEATH_VH_RAPT_FRAGMENT: @@ -268,19 +266,19 @@ void Ent_DamageInfo(float isNew) ang = vectoangles(vel); RaptorCBShellfragToss(w_org, vel, ang + '0 0 1' * (120 * i)); } - sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); pointparticles(particleeffectnum(EFFECT_RAPTOR_BOMB_SPREAD), self.origin, w_backoff * 1000, 1); break; case DEATH_VH_RAPT_BOMB: - sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); pointparticles(particleeffectnum(EFFECT_RAPTOR_BOMB_IMPACT), self.origin, w_backoff * 1000, 1); break; case DEATH_VH_RAPT_DEATH: - sound(self, CH_SHOTS, W_Sound("laserimpact"), VOL_BASE, ATTEN_MIN); + sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_MIN); pointparticles(particleeffectnum(EFFECT_EXPLOSION_BIG), self.origin, w_backoff * 1000, 1); break; case DEATH_VH_BUMB_GUN: - sound(self, CH_SHOTS, W_Sound("fireball_impact2"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM); pointparticles(particleeffectnum(EFFECT_BIGPLASMA_IMPACT), self.origin, w_backoff * 1000, 1); break; } @@ -289,7 +287,6 @@ void Ent_DamageInfo(float isNew) if(DEATH_ISTURRET(w_deathtype)) { - string _snd; traceline(w_org - normalize(force) * 16, w_org + normalize(force) * 16, MOVE_NOMONSTERS, world); if(trace_plane_normal != '0 0 0') w_backoff = trace_plane_normal; @@ -301,38 +298,36 @@ void Ent_DamageInfo(float isNew) switch(w_deathtype) { case DEATH_TURRET_EWHEEL: - sound(self, CH_SHOTS, W_Sound("laserimpact"), VOL_BASE, ATTEN_MIN); + sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_MIN); pointparticles(particleeffectnum(EFFECT_BLASTER_IMPACT), self.origin, w_backoff * 1000, 1); break; case DEATH_TURRET_FLAC: pointparticles(particleeffectnum(EFFECT_HAGAR_EXPLODE), w_org, '0 0 0', 1); - _snd = W_Sound(strcat("hagexp", ftos(1 + rint(random() * 2)))); - sound(self, CH_SHOTS, _snd, VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_HAGEXP_RANDOM(), VOL_BASE, ATTEN_NORM); break; case DEATH_TURRET_MLRS: case DEATH_TURRET_HK: case DEATH_TURRET_WALK_ROCKET: case DEATH_TURRET_HELLION: - sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_MIN); + sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_MIN); pointparticles(particleeffectnum(EFFECT_ROCKET_EXPLODE), self.origin, w_backoff * 1000, 1); break; case DEATH_TURRET_MACHINEGUN: case DEATH_TURRET_WALK_GUN: - _snd = W_Sound(strcat("ric", ftos(1 + rint(random() * 2)))); - sound(self, CH_SHOTS, _snd, VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM); pointparticles(particleeffectnum(EFFECT_MACHINEGUN_IMPACT), self.origin, w_backoff * 1000, 1); break; case DEATH_TURRET_PLASMA: - sound(self, CH_SHOTS, W_Sound("electro_impact"), VOL_BASE, ATTEN_MIN); + sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_MIN); pointparticles(particleeffectnum(EFFECT_ELECTRO_IMPACT), self.origin, w_backoff * 1000, 1); break; case DEATH_TURRET_WALK_MELEE: - sound(self, CH_SHOTS, W_Sound("ric1"), VOL_BASE, ATTEN_MIN); + sound(self, CH_SHOTS, SND_RIC1, VOL_BASE, ATTEN_MIN); pointparticles(particleeffectnum(EFFECT_TE_SPARK), self.origin, w_backoff * 1000, 1); break; diff --git a/qcsrc/client/generator.qc b/qcsrc/client/generator.qc index c9358b6795..148a8f521b 100644 --- a/qcsrc/client/generator.qc +++ b/qcsrc/client/generator.qc @@ -1,22 +1,8 @@ #include "generator.qh" -bool generator_precached; .int count; .float max_health; -void generator_precache() -{ - if(generator_precached) - return; // already precached - - precache_sound("onslaught/shockwave.wav"); - precache_sound(W_Sound("grenade_impact")); - precache_sound(W_Sound("rocket_impact")); - precache_sound("onslaught/electricity_explode.wav"); - - generator_precached = true; -} - void ons_generator_ray_draw() {SELFPARAM(); if(time < self.move_time) @@ -68,7 +54,7 @@ void generator_draw() if(random() < 0.01) { pointparticles(particleeffectnum(EFFECT_ELECTRO_BALLEXPLODE), self.origin + randompos('-50 -50 -20', '50 50 50'), '0 0 0', 1); - sound(self, CH_TRIGGER, "onslaught/electricity_explode.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_TRIGGER, SND_ONS_ELECTRICITY_EXPLODE, VOL_BASE, ATTEN_NORM); } else pointparticles(particleeffectnum(EFFECT_ONS_GENERATOR_DAMAGED), self.origin + randompos('-60 -60 -20', '60 60 60'), '0 0 0', 1); @@ -87,7 +73,7 @@ void generator_draw() // White shockwave if(self.count==40||self.count==20) { - sound(self, CH_TRIGGER, "onslaught/shockwave.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_TRIGGER, SND_ONS_SHOCKWAVE, VOL_BASE, ATTEN_NORM); pointparticles(particleeffectnum(EFFECT_ELECTRO_COMBO), self.origin, '0 0 0', 6); } @@ -108,7 +94,7 @@ void generator_draw() if(random() < 0.25) { te_explosion(self.origin); - sound(self, CH_TRIGGER, W_Sound("grenade_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM); } // Particles @@ -121,7 +107,7 @@ void generator_draw() org = self.origin; te_explosion(org); pointparticles(particleeffectnum(EFFECT_ONS_GENERATOR_EXPLODE2), org, '0 0 0', 1); - sound(self, CH_TRIGGER, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_TRIGGER, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); } self.move_time = time + 0.05; @@ -213,7 +199,6 @@ void ent_generator() self.count = 40; generator_changeteam(); - generator_precache(); generator_construct(); } diff --git a/qcsrc/client/generator.qh b/qcsrc/client/generator.qh index e4e1611f31..744bc5589f 100644 --- a/qcsrc/client/generator.qh +++ b/qcsrc/client/generator.qh @@ -7,5 +7,4 @@ const int GSF_STATUS = 4; const int GSF_SETUP = 8; void ent_generator(); -void generator_precache(); #endif diff --git a/qcsrc/client/gibs.qc b/qcsrc/client/gibs.qc index 0302f18415..5c4c338f15 100644 --- a/qcsrc/client/gibs.qc +++ b/qcsrc/client/gibs.qc @@ -85,7 +85,7 @@ void Gib_Touch() } if(!self.silent) - sound(self, CH_PAIN, strcat("misc/gib_splat0", ftos(floor(prandom() * 4 + 1)), ".wav"), VOL_BASE, ATTEN_NORM); + sound(self, CH_PAIN, SND_GIB_SPLAT_RANDOM(), VOL_BASE, ATTEN_NORM); pointparticles(_particleeffectnum(strcat(species_prefix(self.cnt), "blood")), self.origin + '0 0 1', '0 0 30', 10); Gib_Delete(); @@ -218,7 +218,7 @@ void Ent_GibSplash(bool isNew) { case 0x01: if(!issilent) - sound (self, CH_PAIN, "misc/gib.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_PAIN, SND_GIB, VOL_BASE, ATTEN_NORM); if(prandom() < amount) TossGib ("models/gibs/eye.md3", org, org, vel, prandomvec() * 150, specnum, 0, issilent); @@ -272,12 +272,3 @@ void Ent_GibSplash(bool isNew) break; } } - -void GibSplash_Precache() -{ - precache_sound ("misc/gib.wav"); - precache_sound ("misc/gib_splat01.wav"); - precache_sound ("misc/gib_splat02.wav"); - precache_sound ("misc/gib_splat03.wav"); - precache_sound ("misc/gib_splat04.wav"); -} diff --git a/qcsrc/client/gibs.qh b/qcsrc/client/gibs.qh index b33a1a5e06..5b8b16bfd8 100644 --- a/qcsrc/client/gibs.qh +++ b/qcsrc/client/gibs.qh @@ -23,5 +23,4 @@ void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector void Ent_GibSplash(bool isNew); -void GibSplash_Precache(); #endif diff --git a/qcsrc/client/hook.qc b/qcsrc/client/hook.qc index 528646979e..dd70c760c3 100644 --- a/qcsrc/client/hook.qc +++ b/qcsrc/client/hook.qc @@ -44,7 +44,7 @@ void Draw_GrapplingHook() if(self.teleport_time) if(time > self.teleport_time) { - sound (self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM); // safeguard + sound (self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); // safeguard self.teleport_time = 0; } @@ -168,7 +168,7 @@ void Draw_GrapplingHook() void Remove_GrapplingHook() {SELFPARAM(); - sound (self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); } void Ent_ReadHook(float bIsNew, float type) @@ -228,7 +228,7 @@ void Ent_ReadHook(float bIsNew, float type) self.drawmask = MASK_NORMAL; break; case ENT_CLIENT_ARC_BEAM: - sound (self, CH_SHOTS_SINGLE, W_Sound("lgbeam_fly"), VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS_SINGLE, SND_LGBEAM_FLY, VOL_BASE, ATTEN_NORM); break; } } @@ -236,9 +236,4 @@ void Ent_ReadHook(float bIsNew, float type) self.teleport_time = time + 10; } -void Hook_Precache() -{ - precache_sound(W_Sound("lgbeam_fly")); -} - // TODO: hook: temporarily transform self.origin for drawing the model along warpzones! diff --git a/qcsrc/client/hook.qh b/qcsrc/client/hook.qh index 8401dce049..e513ed6afa 100644 --- a/qcsrc/client/hook.qh +++ b/qcsrc/client/hook.qh @@ -2,7 +2,6 @@ #define HOOK_H void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg); -void Hook_Precache(); void Ent_ReadHook(float bIsNew, float type); diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index c534cc7a5d..2d01f777ed 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -2,7 +2,6 @@ #include "_all.qh" #include "controlpoint.qh" -#include "csqcmodel_hooks.qh" #include "damage.qh" #include "effects.qh" #include "generator.qh" @@ -156,15 +155,9 @@ void CSQC_Init(void) initialize_minigames(); // precaches - precache_sound("misc/hit.wav"); - precache_sound("misc/typehit.wav"); - generator_precache(); Projectile_Precache(); - Hook_Precache(); - GibSplash_Precache(); Tuba_Precache(); - CSQCPlayer_Precache(); if(autocvar_cl_reticle) { @@ -778,7 +771,7 @@ void Ent_ReadSpawnEvent(float is_new) } if(autocvar_cl_spawn_event_sound) { - sound(self, CH_TRIGGER, "misc/spawn.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_TRIGGER, SND_SPAWN, VOL_BASE, ATTEN_NORM); } } } @@ -935,7 +928,7 @@ void Ent_Remove() if(self.snd_looping > 0) { - sound(self, self.snd_looping, "misc/null.wav", VOL_BASE, autocvar_g_jetpack_attenuation); + sound(self, self.snd_looping, SND_Null, VOL_BASE, autocvar_g_jetpack_attenuation); self.snd_looping = 0; } diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index 3511c743f0..945f312ab2 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -630,8 +630,6 @@ void GameTypeVote_ReadOption(int i) void MapVote_Init() { - precache_sound ("misc/invshot.wav"); - mv_active = 1; if(autocvar_hud_cursormode) { setcursormode(1); } else { mv_mousepos = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight; } diff --git a/qcsrc/client/tuba.qc b/qcsrc/client/tuba.qc index 1acfbd7eb7..91ccbba5c8 100644 --- a/qcsrc/client/tuba.qc +++ b/qcsrc/client/tuba.qc @@ -65,7 +65,7 @@ void tubasound(entity e, bool restart) if (restart) { snd1 = TUBA_STARTNOTE(e.tuba_instrument, e.note); } - sound(e, CH_TUBA_SINGLE, snd1, e.tuba_volume, e.tuba_attenuate * autocvar_g_balance_tuba_attenuation); + _sound(e, CH_TUBA_SINGLE, snd1, e.tuba_volume, e.tuba_attenuate * autocvar_g_balance_tuba_attenuation); } } @@ -79,9 +79,9 @@ void Ent_TubaNote_Think() } self.nextthink = time; if (self.tuba_volume <= 0) { - sound(self, CH_TUBA_SINGLE, "misc/null.wav", 0, 0); + sound(self, CH_TUBA_SINGLE, SND_Null, 0, 0); if (self.enemy) { - sound(self.enemy, CH_TUBA_SINGLE, "misc/null.wav", 0, 0); + sound(self.enemy, CH_TUBA_SINGLE, SND_Null, 0, 0); remove(self.enemy); } remove(self); diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 146d322fcc..26089f9158 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -517,7 +517,7 @@ void UpdateHitsound() // todo: avoid very long and very short sounds from wave stretching using different sound files? seems unnecessary // todo: normalize sound pressure levels? seems unnecessary - sound7(world, CH_INFO, "misc/hit.wav", VOL_BASE, ATTN_NONE, pitch_shift * 100, 0); + sound7(world, CH_INFO, SND(HIT), VOL_BASE, ATTN_NONE, pitch_shift * 100, 0); } unaccounted_damage = 0; hitsound_time_prev = time; @@ -527,7 +527,7 @@ void UpdateHitsound() float typehit_time = getstatf(STAT_TYPEHIT_TIME); if (COMPARE_INCREASING(typehit_time, typehit_time_prev) > autocvar_cl_hitsound_antispam_time) { - sound(world, CH_INFO, "misc/typehit.wav", VOL_BASE, ATTN_NONE); + sound(world, CH_INFO, SND_TYPEHIT, VOL_BASE, ATTN_NONE); typehit_time_prev = typehit_time; } } diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index 1be6f8974b..a943f75b3c 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -170,7 +170,7 @@ void loopsound(entity e, int ch, string samp, float vol, float attn) if(self.silent) return; - sound(e, ch, samp, vol, attn); + _sound(e, ch, samp, vol, attn); e.snd_looping = ch; } @@ -347,7 +347,7 @@ void Ent_Projectile() { case PROJECTILE_ELECTRO: // only new engines support sound moving with object - loopsound(self, CH_SHOTS_SINGLE, W_Sound("electro_fly"), VOL_BASE, ATTEN_NORM); + loopsound(self, CH_SHOTS_SINGLE, SND(ELECTRO_FLY), VOL_BASE, ATTEN_NORM); self.mins = '0 0 -4'; self.maxs = '0 0 -4'; self.move_movetype = MOVETYPE_BOUNCE; @@ -357,7 +357,7 @@ void Ent_Projectile() break; case PROJECTILE_RPC: case PROJECTILE_ROCKET: - loopsound(self, CH_SHOTS_SINGLE, W_Sound("rocket_fly"), VOL_BASE, ATTEN_NORM); + loopsound(self, CH_SHOTS_SINGLE, SND(ROCKET_FLY), VOL_BASE, ATTEN_NORM); self.mins = '-3 -3 -3'; self.maxs = '3 3 3'; break; @@ -405,12 +405,12 @@ void Ent_Projectile() break; case PROJECTILE_NAPALM_FOUNTAIN: case PROJECTILE_FIREBALL: - loopsound(self, CH_SHOTS_SINGLE, W_Sound("fireball_fly2"), VOL_BASE, ATTEN_NORM); + loopsound(self, CH_SHOTS_SINGLE, SND(FIREBALL_FLY2), VOL_BASE, ATTEN_NORM); self.mins = '-16 -16 -16'; self.maxs = '16 16 16'; break; case PROJECTILE_FIREMINE: - loopsound(self, CH_SHOTS_SINGLE, W_Sound("fireball_fly"), VOL_BASE, ATTEN_NORM); + loopsound(self, CH_SHOTS_SINGLE, SND(FIREBALL_FLY), VOL_BASE, ATTEN_NORM); self.move_movetype = MOVETYPE_BOUNCE; self.move_touch = func_null; self.mins = '-4 -4 -4'; @@ -425,7 +425,7 @@ void Ent_Projectile() self.maxs = '2 2 2'; break; case PROJECTILE_SEEKER: - loopsound(self, CH_SHOTS_SINGLE, W_Sound("tag_rocket_fly"), VOL_BASE, ATTEN_NORM); + loopsound(self, CH_SHOTS_SINGLE, SND(TAG_ROCKET_FLY), VOL_BASE, ATTEN_NORM); self.mins = '-4 -4 -4'; self.maxs = '4 4 4'; break; @@ -438,17 +438,17 @@ void Ent_Projectile() case PROJECTILE_RAPTORCANNON: break; case PROJECTILE_SPIDERROCKET: - loopsound(self, CH_SHOTS_SINGLE, W_Sound("tag_rocket_fly"), VOL_BASE, ATTEN_NORM); + loopsound(self, CH_SHOTS_SINGLE, SND(TAG_ROCKET_FLY), VOL_BASE, ATTEN_NORM); break; case PROJECTILE_WAKIROCKET: - loopsound(self, CH_SHOTS_SINGLE, W_Sound("tag_rocket_fly"), VOL_BASE, ATTEN_NORM); + loopsound(self, CH_SHOTS_SINGLE, SND(TAG_ROCKET_FLY), VOL_BASE, ATTEN_NORM); break; /* case PROJECTILE_WAKICANNON: break; case PROJECTILE_BUMBLE_GUN: // only new engines support sound moving with object - loopsound(self, CH_SHOTS_SINGLE, W_Sound("electro_fly"), VOL_BASE, ATTEN_NORM); + loopsound(self, CH_SHOTS_SINGLE, SND(ELECTRO_FLY), VOL_BASE, ATTEN_NORM); self.mins = '0 0 -4'; self.maxs = '0 0 -4'; self.move_movetype = MOVETYPE_BOUNCE; @@ -508,11 +508,5 @@ void Ent_Projectile() void Projectile_Precache() { - precache_sound(W_Sound("electro_fly")); - precache_sound(W_Sound("rocket_fly")); - precache_sound(W_Sound("fireball_fly")); - precache_sound(W_Sound("fireball_fly2")); - precache_sound(W_Sound("tag_rocket_fly")); - MUTATOR_CALLHOOK(PrecacheProjectiles); } diff --git a/qcsrc/collect-precache.sh b/qcsrc/collect-precache.sh deleted file mode 100755 index 302220c096..0000000000 --- a/qcsrc/collect-precache.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -{ - grep -h '\ server/precache-for-csqc.inc - diff --git a/qcsrc/common/models/models.qh b/qcsrc/common/models/models.qh index c668959655..0d17f43ab4 100644 --- a/qcsrc/common/models/models.qh +++ b/qcsrc/common/models/models.qh @@ -18,10 +18,7 @@ CLASS(Model, Object) } METHOD(Model, model_precache, void(entity this)) { string s = this.model_str(); - int fh = fopen(s, FILE_READ); - if (fh >= 0) { - fclose(fh); - } else if (s && s != "" && s != "null") { + if (s != "" && s != "null" && !fexists(s)) { LOG_WARNINGF("Missing model: \"%s\"\n", s); return; } diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index d2881e9ba9..534005db93 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -91,7 +91,7 @@ void M_Mage_Attack_Spike_Explode() {SELFPARAM(); self.event_damage = func_null; - sound(self, CH_SHOTS, W_Sound("grenade_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM); self.realowner.mage_spike = world; @@ -258,7 +258,7 @@ void M_Mage_Defend_Heal() void M_Mage_Attack_Push() {SELFPARAM(); - sound(self, CH_SHOTS, W_Sound("tagexp1"), 1, ATTEN_NORM); + sound(self, CH_SHOTS, SND_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(EFFECT_TE_EXPLOSION, self.origin, '0 0 0', 1); @@ -422,8 +422,6 @@ bool M_Mage(int req) } case MR_PRECACHE: { - precache_sound (W_Sound("grenade_impact")); - precache_sound (W_Sound("tagexp1")); return true; } #endif diff --git a/qcsrc/common/monsters/monster/shambler.qc b/qcsrc/common/monsters/monster/shambler.qc index ea7fbbf7cc..55e0f46e95 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -50,7 +50,7 @@ void M_Shambler_Attack_Smash() {SELFPARAM(); makevectors(self.angles); Send_Effect(EFFECT_EXPLOSION_MEDIUM, (self.origin + (v_forward * 150)) - ('0 0 1' * self.maxs.z), '0 0 0', 1); - sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); // RadiusDamage does NOT support custom starting location, which means we must use this hack... @@ -75,7 +75,7 @@ void M_Shambler_Attack_Lightning_Explode() {SELFPARAM(); entity head; - sound(self, CH_SHOTS, W_Sound("electro_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM); Send_Effect(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 fb71c2f222..f6c3089ce3 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -63,7 +63,7 @@ void M_Spider_Attack_Web() {SELFPARAM(); monster_makevectors(self.enemy); - sound(self, CH_SHOTS, W_Sound("electro_fire2"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_ELECTRO_FIRE2, VOL_BASE, ATTEN_NORM); entity proj = spawn (); proj.classname = "plasma"; @@ -176,7 +176,6 @@ bool M_Spider(int req) } case MR_PRECACHE: { - precache_sound (W_Sound("electro_fire2")); return true; } #endif diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 8eab200a6d..73e6d9060e 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -1085,7 +1085,7 @@ void Monster_Damage(entity inflictor, entity attacker, float damage, int deathty self.dmg_time = time; if(sound_allowed(MSG_BROADCAST, attacker) && deathtype != DEATH_DROWN) - spamsound (self, CH_PAIN, "misc/bodyimpact1.wav", VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER + spamsound (self, CH_PAIN, SND(BODYIMPACT1), VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER self.velocity += force * self.damageforcescale; diff --git a/qcsrc/common/mutators/mutator/casings.qc b/qcsrc/common/mutators/mutator/casings.qc index fedcf9fe57..7a05c85ea3 100644 --- a/qcsrc/common/mutators/mutator/casings.qc +++ b/qcsrc/common/mutators/mutator/casings.qc @@ -63,6 +63,19 @@ void Casing_Draw() } } +SOUND(BRASS1, W_Sound("brass1")); +SOUND(BRASS2, W_Sound("brass2")); +SOUND(BRASS3, W_Sound("brass3")); +Sound SND_BRASS_RANDOM() { + return SOUNDS[SND_BRASS1.m_id + floor(prandom() * 3)]; +} +SOUND(CASINGS1, W_Sound("casings1")); +SOUND(CASINGS2, W_Sound("casings2")); +SOUND(CASINGS3, W_Sound("casings3")); +Sound SND_CASINGS_RANDOM() { + return SOUNDS[SND_CASINGS1.m_id + floor(prandom() * 3)]; +} + void Casing_Touch() {SELFPARAM(); if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) @@ -78,16 +91,14 @@ void Casing_Touch() { if (time >= self.nextthink) { - string s; - int f = floor(prandom() * 3) + 1; - + Sound s; switch (self.state) { case 1: - s = W_Sound(strcat("casings", itos(f))); + s = SND_CASINGS_RANDOM(); break; default: - s = W_Sound(strcat("brass", itos(f))); + s = SND_BRASS_RANDOM(); break; } @@ -163,13 +174,4 @@ MUTATOR_HOOKFUNCTION(casings, CSQC_Parse_TempEntity) RubbleLimit("casing", autocvar_cl_casings_maxcount, Casing_Delete); } -STATIC_INIT(Casings) -{ - precache_sound(W_Sound("brass1")); - precache_sound(W_Sound("brass2")); - precache_sound(W_Sound("brass3")); - precache_sound(W_Sound("casings1")); - precache_sound(W_Sound("casings2")); - precache_sound(W_Sound("casings3")); -} #endif diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index 626c42c7d6..f219569819 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -1286,7 +1286,7 @@ void Local_Notification_sound( )); #endif - sound( + _sound( world, soundchannel, sprintf( diff --git a/qcsrc/common/sounds/sounds.inc b/qcsrc/common/sounds/sounds.inc new file mode 100644 index 0000000000..0e17504c2a --- /dev/null +++ b/qcsrc/common/sounds/sounds.inc @@ -0,0 +1,276 @@ +// Global list of sounds +// TODO: remove uses of _sound + +string W_Sound(string w_snd); + +SOUND(ARC_FIRE, W_Sound("arc_fire")); +SOUND(ARC_LOOP, W_Sound("arc_loop")); +SOUND(ARC_LOOP_OVERHEAT, W_Sound("arc_loop_overheat")); +SOUND(ARC_STOP, W_Sound("arc_stop")); +SOUND(CAMPINGRIFLE_FIRE2, W_Sound("campingrifle_fire2")); +SOUND(CAMPINGRIFLE_FIRE, W_Sound("campingrifle_fire")); +SOUND(CRYLINK_FIRE2, W_Sound("crylink_fire2")); +SOUND(CRYLINK_FIRE, W_Sound("crylink_fire")); +SOUND(CRYLINK_IMPACT2, W_Sound("crylink_impact2")); +SOUND(CRYLINK_IMPACT, W_Sound("crylink_impact")); +SOUND(CRYLINK_LINKJOIN, W_Sound("crylink_linkjoin")); +SOUND(DRYFIRE, W_Sound("dryfire")); +SOUND(ELECTRO_BOUNCE, W_Sound("electro_bounce")); +SOUND(ELECTRO_FIRE2, W_Sound("electro_fire2")); +SOUND(ELECTRO_FIRE, W_Sound("electro_fire")); +SOUND(ELECTRO_FLY, W_Sound("electro_fly")); +SOUND(ELECTRO_IMPACT, W_Sound("electro_impact")); +SOUND(ELECTRO_IMPACT_COMBO, W_Sound("electro_impact_combo")); +SOUND(FIREBALL_FIRE2, W_Sound("fireball_fire2")); +SOUND(FIREBALL_FIRE, W_Sound("fireball_fire")); +SOUND(FIREBALL_FLY2, W_Sound("fireball_fly2")); +SOUND(FIREBALL_FLY, W_Sound("fireball_fly")); +SOUND(FIREBALL_IMPACT2, W_Sound("fireball_impact2")); +SOUND(FIREBALL_PREFIRE2, W_Sound("fireball_prefire2")); +SOUND(FLAC_FIRE, W_Sound("flac_fire")); +SOUND(GRENADE_BOUNCE1, W_Sound("grenade_bounce1")); +SOUND(GRENADE_BOUNCE2, W_Sound("grenade_bounce2")); +SOUND(GRENADE_BOUNCE3, W_Sound("grenade_bounce3")); +SOUND(GRENADE_BOUNCE4, W_Sound("grenade_bounce4")); +SOUND(GRENADE_BOUNCE5, W_Sound("grenade_bounce5")); +SOUND(GRENADE_BOUNCE6, W_Sound("grenade_bounce6")); +Sound SND_GRENADE_BOUNCE_RANDOM() { + return SOUNDS[SND_GRENADE_BOUNCE1.m_id + rint(random() * 5)]; +} +SOUND(GRENADE_FIRE, W_Sound("grenade_fire")); +SOUND(GRENADE_IMPACT, W_Sound("grenade_impact")); +SOUND(GRENADE_STICK, W_Sound("grenade_stick")); +SOUND(HAGAR_BEEP, W_Sound("hagar_beep")); +SOUND(HAGAR_FIRE, W_Sound("hagar_fire")); +SOUND(HAGAR_LOAD, W_Sound("hagar_load")); +SOUND(HAGEXP1, W_Sound("hagexp1")); +SOUND(HAGEXP2, W_Sound("hagexp2")); +SOUND(HAGEXP3, W_Sound("hagexp3")); +Sound SND_HAGEXP_RANDOM() { + return SOUNDS[SND_HAGEXP1.m_id + rint(random() * 2)]; +} + +SOUND(HOOKBOMB_FIRE, W_Sound("hookbomb_fire")); +SOUND(HOOKBOMB_IMPACT, W_Sound("hookbomb_impact")); +SOUND(HOOK_FIRE, W_Sound("hook_fire")); +SOUND(HOOK_IMPACT, W_Sound("hook_impact")); +SOUND(LASERGUN_FIRE, W_Sound("lasergun_fire")); +SOUND(LASERIMPACT, W_Sound("laserimpact")); +SOUND(LGBEAM_FLY, W_Sound("lgbeam_fly")); +SOUND(MINE_DET, W_Sound("mine_det")); +SOUND(MINE_EXP, W_Sound("mine_exp")); +SOUND(MINE_FIRE, W_Sound("mine_fire")); +SOUND(MINE_STICK, W_Sound("mine_stick")); +SOUND(MINE_TRIGGER, W_Sound("mine_trigger")); +SOUND(MINSTANEXFIRE, W_Sound("minstanexfire")); +SOUND(NEXCHARGE, W_Sound("nexcharge")); +SOUND(NEXFIRE, W_Sound("nexfire")); +SOUND(NEXIMPACT, W_Sound("neximpact")); +SOUND(NEXWHOOSH1, W_Sound("nexwhoosh1")); +SOUND(NEXWHOOSH2, W_Sound("nexwhoosh2")); +SOUND(NEXWHOOSH3, W_Sound("nexwhoosh3")); +Sound SND_NEXWHOOSH_RANDOM() { + return SOUNDS[SND_NEXWHOOSH1.m_id + rint(random() * 2)]; +} +SOUND(RELOAD, W_Sound("reload")); // until weapons have individual reload sounds, precache the reload sound here + +SOUND(RIC1, W_Sound("ric1")); +SOUND(RIC2, W_Sound("ric2")); +SOUND(RIC3, W_Sound("ric3")); +Sound SND_RIC_RANDOM() { + return SOUNDS[SND_RIC1.m_id + rint(random() * 2)]; +} + +SOUND(ROCKET_DET, W_Sound("rocket_det")); +SOUND(ROCKET_FIRE, W_Sound("rocket_fire")); +SOUND(ROCKET_FLY, W_Sound("rocket_fly")); +SOUND(ROCKET_IMPACT, W_Sound("rocket_impact")); +SOUND(ROCKET_MODE, W_Sound("rocket_mode")); +SOUND(SEEKEREXP1, W_Sound("seekerexp1")); +SOUND(SEEKEREXP2, W_Sound("seekerexp2")); +SOUND(SEEKEREXP3, W_Sound("seekerexp3")); +SOUND(SEEKER_FIRE, W_Sound("seeker_fire")); +SOUND(SHOTGUN_FIRE, W_Sound("shotgun_fire")); +SOUND(SHOTGUN_MELEE, W_Sound("shotgun_melee")); +SOUND(STRENGTH_FIRE, W_Sound("strength_fire")); +SOUND(TAGEXP1, W_Sound("tagexp1")); +SOUND(TAGEXP2, W_Sound("tagexp2")); +SOUND(TAGEXP3, W_Sound("tagexp3")); +SOUND(TAG_FIRE, W_Sound("tag_fire")); +SOUND(TAG_IMPACT, W_Sound("tag_impact")); +SOUND(TAG_ROCKET_FLY, W_Sound("tag_rocket_fly")); +SOUND(UNAVAILABLE, W_Sound("unavailable")); +SOUND(UZI_FIRE, W_Sound("uzi_fire")); +SOUND(WEAPONPICKUP, W_Sound("weaponpickup")); +SOUND(WEAPONPICKUP_NEW_TOYS, W_Sound("weaponpickup_new_toys")); +SOUND(WEAPON_SWITCH, W_Sound("weapon_switch")); + +SOUND(CTF_CAPTURE_NEUTRAL, "ctf/capture.ogg"); +SOUND(CTF_CAPTURE_RED, "ctf/red_capture.wav"); +SOUND(CTF_CAPTURE_BLUE, "ctf/blue_capture.wav"); +SOUND(CTF_CAPTURE_YELLOW, "ctf/yellow_capture.ogg"); +SOUND(CTF_CAPTURE_PINK, "ctf/pink_capture.ogg"); +Sound SND_CTF_CAPTURE(string teamname) { + switch (teamname) { + case "red": return SND_CTF_CAPTURE_RED; + case "blue": return SND_CTF_CAPTURE_BLUE; + case "yellow": return SND_CTF_CAPTURE_YELLOW; + case "pink": return SND_CTF_CAPTURE_PINK; + } + return SND_CTF_CAPTURE_NEUTRAL; +} + +SOUND(CTF_DROPPED_NEUTRAL, "ctf/neutral_dropped.wav"); +SOUND(CTF_DROPPED_RED, "ctf/red_dropped.wav"); +SOUND(CTF_DROPPED_BLUE, "ctf/blue_dropped.wav"); +SOUND(CTF_DROPPED_YELLOW, "ctf/yellow_dropped.wav"); +SOUND(CTF_DROPPED_PINK, "ctf/pink_dropped.wav"); +Sound SND_CTF_DROPPED(string teamname) { + switch (teamname) { + case "red": return SND_CTF_DROPPED_RED; + case "blue": return SND_CTF_DROPPED_BLUE; + case "yellow": return SND_CTF_DROPPED_YELLOW; + case "pink": return SND_CTF_DROPPED_PINK; + default: return SND_CTF_DROPPED_NEUTRAL; + } +} + +SOUND(CTF_PASS, "ctf/pass.wav"); +SOUND(CTF_RESPAWN, "ctf/flag_respawn.wav"); + +SOUND(CTF_RETURNED_NEUTRAL, "ctf/return.wav"); +SOUND(CTF_RETURNED_RED, "ctf/red_returned.wav"); +SOUND(CTF_RETURNED_BLUE, "ctf/blue_returned.wav"); +SOUND(CTF_RETURNED_YELLOW, "ctf/yellow_returned.wav"); +SOUND(CTF_RETURNED_PINK, "ctf/pink_returned.wav"); +Sound SND_CTF_RETURNED(string teamname) { + switch (teamname) { + case "red": return SND_CTF_RETURNED_RED; + case "blue": return SND_CTF_RETURNED_BLUE; + case "yellow": return SND_CTF_RETURNED_YELLOW; + case "pink": return SND_CTF_RETURNED_PINK; + default: return SND_CTF_RETURNED_NEUTRAL; + } +} + +SOUND(CTF_TAKEN_NEUTRAL, "ctf/neutral_taken.wav"); +SOUND(CTF_TAKEN_RED, "ctf/red_taken.wav"); +SOUND(CTF_TAKEN_BLUE, "ctf/blue_taken.wav"); +SOUND(CTF_TAKEN_YELLOW, "ctf/yellow_taken.wav"); +SOUND(CTF_TAKEN_PINK, "ctf/pink_taken.wav"); +Sound SND_CTF_TAKEN(string teamname) { + switch (teamname) { + case "red": return SND_CTF_TAKEN_RED; + case "blue": return SND_CTF_TAKEN_BLUE; + case "yellow": return SND_CTF_TAKEN_YELLOW; + case "pink": return SND_CTF_TAKEN_PINK; + default: return SND_CTF_TAKEN_NEUTRAL; + } +} + +SOUND(CTF_TOUCH, "ctf/touch.wav"); + +SOUND(DOM_CLAIM, "domination/claim.wav"); + +SOUND(KA_DROPPED, "keepaway/dropped.wav"); +SOUND(KA_PICKEDUP, "keepaway/pickedup.wav"); +SOUND(KA_RESPAWN, "keepaway/respawn.wav"); +SOUND(KA_TOUCH, "keepaway/touch.wav"); + +SOUND(KH_ALARM, "kh/alarm.wav"); +SOUND(KH_CAPTURE, "kh/capture.wav"); +SOUND(KH_COLLECT, "kh/collect.wav"); +SOUND(KH_DESTROY, "kh/destroy.wav"); +SOUND(KH_DROP, "kh/drop.wav"); + +SOUND(NB_BOUNCE, "nexball/bounce.ogg"); +SOUND(NB_DROP, "nexball/drop.ogg"); +SOUND(NB_SHOOT1, "nexball/shoot1.ogg"); +SOUND(NB_SHOOT2, "nexball/shoot2.ogg"); +SOUND(NB_STEAL, "nexball/steal.ogg"); + +SOUND(ONS_CONTROLPOINT_BUILD, "onslaught/controlpoint_build.ogg"); +SOUND(ONS_CONTROLPOINT_BUILT, "onslaught/controlpoint_built.ogg"); +SOUND(ONS_CONTROLPOINT_UNDERATTACK, "onslaught/controlpoint_underattack.ogg"); +SOUND(ONS_DAMAGEBLOCKEDBYSHIELD, "onslaught/damageblockedbyshield.wav"); +SOUND(ONS_ELECTRICITY_EXPLODE, "onslaught/electricity_explode.ogg"); +SOUND(ONS_GENERATOR_DECAY, "onslaught/generator_decay.ogg"); +SOUND(ONS_GENERATOR_UNDERATTACK, "onslaught/generator_underattack.ogg"); +SOUND(ONS_HIT1, "onslaught/ons_hit1.ogg"); +SOUND(ONS_HIT2, "onslaught/ons_hit2.ogg"); +SOUND(ONS_SPARK1, "onslaught/ons_spark1.ogg"); +SOUND(ONS_SPARK2, "onslaught/ons_spark2.ogg"); +SOUND(ONS_SHOCKWAVE, "onslaught/shockwave.ogg"); + +SOUND(PORTO_BOUNCE, "porto/bounce.ogg"); +SOUND(PORTO_CREATE, "porto/create.ogg"); +SOUND(PORTO_EXPIRE, "porto/expire.ogg"); +SOUND(PORTO_EXPLODE, "porto/explode.ogg"); +SOUND(PORTO_FIRE, "porto/fire.ogg"); +SOUND(PORTO_UNSUPPORTED, "porto/unsupported.ogg"); + +SOUND(TUR_PHASER, "turrets/phaser.ogg"); + +SOUND(VEH_ALARM, "vehicles/alarm.wav"); +SOUND(VEH_ALARM_SHIELD, "vehicles/alarm_shield.wav"); +SOUND(VEH_MISSILE_ALARM, "vehicles/missile_alarm.wav"); + +SOUND(VEH_BUMBLEBEE_FIRE, W_Sound("flacexp3")); + +SOUND(VEH_RACER_BOOST, "vehicles/racer_boost.wav"); +SOUND(VEH_RACER_IDLE, "vehicles/racer_idle.wav"); +SOUND(VEH_RACER_MOVE, "vehicles/racer_move.wav"); + +SOUND(VEH_RAPTOR_FLY, "vehicles/raptor_fly.wav"); +SOUND(VEH_RAPTOR_SPEED, "vehicles/raptor_speed.wav"); + +SOUND(VEH_SPIDERBOT_DIE, "vehicles/spiderbot_die.wav"); +SOUND(VEH_SPIDERBOT_IDLE, "vehicles/spiderbot_idle.wav"); +SOUND(VEH_SPIDERBOT_JUMP, "vehicles/spiderbot_jump.wav"); +SOUND(VEH_SPIDERBOT_LAND, "vehicles/spiderbot_land.wav"); +SOUND(VEH_SPIDERBOT_STRAFE, "vehicles/spiderbot_strafe.wav"); +SOUND(VEH_SPIDERBOT_WALK, "vehicles/spiderbot_walk.wav"); + +SOUND(NADE_BEEP, "overkill/grenadebip.ogg"); + +SOUND(BUFF_LOST, "relics/relic_effect.wav"); + +SOUND(POWEROFF, "misc/poweroff.wav"); +SOUND(POWERUP, "misc/powerup.ogg"); +SOUND(SHIELD_RESPAWN, "misc/shield_respawn.wav"); +SOUND(STRENGTH_RESPAWN, "misc/strength_respawn.wav"); + +SOUND(ARMOR25, "misc/armor25.wav"); +SOUND(ARMORIMPACT, "misc/armorimpact.wav"); +SOUND(BODYIMPACT1, "misc/bodyimpact1.wav"); +SOUND(BODYIMPACT2, "misc/bodyimpact2.wav"); + +SOUND(ITEMPICKUP, "misc/itempickup.ogg"); +SOUND(ITEMRESPAWNCOUNTDOWN, "misc/itemrespawncountdown.ogg"); +SOUND(ITEMRESPAWN, "misc/itemrespawn.ogg"); +SOUND(MEGAHEALTH, "misc/megahealth.ogg"); + +SOUND(LAVA, "player/lava.wav"); +SOUND(SLIME, "player/slime.wav"); + +SOUND(GIB, "misc/gib.wav"); +SOUND(GIB_SPLAT01, "misc/gib_splat01.wav"); +SOUND(GIB_SPLAT02, "misc/gib_splat02.wav"); +SOUND(GIB_SPLAT03, "misc/gib_splat03.wav"); +SOUND(GIB_SPLAT04, "misc/gib_splat04.wav"); +Sound SND_GIB_SPLAT_RANDOM() { + return SOUNDS[SND_GIB_SPLAT01.m_id + floor(prandom() * 4)]; +} + +SOUND(HIT, "misc/hit.wav"); +SOUND(TYPEHIT, "misc/typehit.wav"); + +SOUND(SPAWN, "misc/spawn.ogg"); + +SOUND(TALK, "misc/talk.wav"); + +SOUND(TELEPORT, "misc/teleport.ogg"); + +SOUND(INVSHOT, "misc/invshot.wav"); + +SOUND(JETPACK_FLY, "misc/jetpack_fly.ogg"); diff --git a/qcsrc/common/sounds/sounds.qh b/qcsrc/common/sounds/sounds.qh new file mode 100644 index 0000000000..e01a1300d3 --- /dev/null +++ b/qcsrc/common/sounds/sounds.qh @@ -0,0 +1,57 @@ +#ifndef SOUNDS_H +#define SOUNDS_H + +// Play all sounds via sound7, for access to the extra channels. +// Otherwise, channels 8 to 15 would be blocked for a weird QW feature. +#ifdef SVQC + #define _sound(e, c, s, v, a) do { \ + entity __e = e; \ + if (!sound_allowed(MSG_BROADCAST, __e)) break; \ + sound7(__e, c, s, v, a, 0, 0); \ + } while (0) +#else + #define _sound(e, c, s, v, a) sound7(e, c, s, v, a, 0, 0) +#endif +#define sound(e, c, s, v, a) _sound(e, c, s.sound_str(), v, a) +// Used in places where a string is required +#define SND(id) (SND_##id.sound_str()) + +void RegisterSounds(); +const int MAX_SOUNDS = 128; +entity SOUNDS[MAX_SOUNDS], SOUNDS_first, SOUNDS_last; +int SOUNDS_COUNT; + +CLASS(Sound, Object) + ATTRIB(Sound, m_id, int, 0) + ATTRIB(Sound, sound_str, string(), func_null) + CONSTRUCTOR(Sound, string() path) + { + CONSTRUCT(Sound); + this.sound_str = path; + } + METHOD(Sound, sound_precache, void(entity this)) { + string s = this.sound_str(); + if (s && s != "" && !fexists(strcat("sound/", s))) { + LOG_WARNINGF("Missing sound: \"%s\"\n", s); + return; + } + LOG_TRACEF("precache_sound(\"%s\")\n", s); + precache_sound(s); + } +ENDCLASS(Sound) + +#define SOUND(name, path) \ + string SND_##name##_get() { return path; } \ + REGISTER(RegisterSounds, SND, SOUNDS, SOUNDS_COUNT, name, m_id, NEW(Sound, SND_##name##_get)) +REGISTER_REGISTRY(RegisterSounds) + +STATIC_INIT(RegisterSounds_precache) { + FOREACH(SOUNDS, true, LAMBDA({ + it.sound_precache(it); + })); +} + +SOUND(Null, "misc/null.wav"); +#include "sounds.inc" + +#endif diff --git a/qcsrc/common/triggers/func/breakable.qc b/qcsrc/common/triggers/func/breakable.qc index 0430db2d41..b2a4894a52 100644 --- a/qcsrc/common/triggers/func/breakable.qc +++ b/qcsrc/common/triggers/func/breakable.qc @@ -162,7 +162,7 @@ void func_breakable_behave_restore() self.nextthink = 0; // cancel auto respawn func_breakable_colormod(); if (self.noise1) - sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); + _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); } void func_breakable_init_for_player(entity player) @@ -207,7 +207,7 @@ void func_breakable_destroy() func_breakable_destroyed(); if(self.noise) - sound (self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); + _sound (self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); if(self.dmg) RadiusDamage(self, activator, self.dmg, self.dmg_edge, self.dmg_radius, self, world, self.dmg_force, DEATH_HURTTRIGGER, world); diff --git a/qcsrc/common/triggers/func/button.qc b/qcsrc/common/triggers/func/button.qc index 228b3f810a..a55f02ef2f 100644 --- a/qcsrc/common/triggers/func/button.qc +++ b/qcsrc/common/triggers/func/button.qc @@ -44,7 +44,7 @@ void button_fire() return; if (self.noise != "") - sound (self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); + _sound (self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); self.state = STATE_UP; SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, button_wait); diff --git a/qcsrc/common/triggers/func/door.qc b/qcsrc/common/triggers/func/door.qc index 8d19a740c2..422295fa86 100644 --- a/qcsrc/common/triggers/func/door.qc +++ b/qcsrc/common/triggers/func/door.qc @@ -87,7 +87,7 @@ void door_blocked() void door_hit_top() {SELFPARAM(); if (self.noise1 != "") - sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); + _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); self.state = STATE_TOP; if (self.spawnflags & DOOR_TOGGLE) return; // don't come down automatically @@ -104,14 +104,14 @@ void door_hit_top() void door_hit_bottom() {SELFPARAM(); if (self.noise1 != "") - sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); + _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); self.state = STATE_BOTTOM; } void door_go_down() {SELFPARAM(); if (self.noise2 != "") - sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); + _sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); if (self.max_health) { self.takedamage = DAMAGE_YES; @@ -134,7 +134,7 @@ void door_go_up() } if (self.noise2 != "") - sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); + _sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); self.state = STATE_UP; SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, door_hit_top); @@ -180,7 +180,7 @@ float door_check_keys(void) if (other.key_door_messagetime <= time) { - play2(other, "misc/talk.wav"); + play2(other, SND(TALK)); Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_ALSONEED, item_keys_keylist(door.itemkeys)); other.key_door_messagetime = time + 2; } @@ -190,7 +190,7 @@ float door_check_keys(void) // no keys were used if (other.key_door_messagetime <= time) { - play2(other, "misc/talk.wav"); + play2(other, SND(TALK)); Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_NEED, item_keys_keylist(door.itemkeys)); other.key_door_messagetime = time + 2; @@ -202,7 +202,7 @@ float door_check_keys(void) { #ifdef SVQC // door is now unlocked - play2(other, "misc/talk.wav"); + play2(other, SND(TALK)); Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_UNLOCKED); #endif return true; @@ -321,7 +321,7 @@ void door_touch() { if (IS_CLIENT(other)) centerprint(other, self.owner.message); - play2(other, "misc/talk.wav"); + play2(other, SND(TALK)); } #endif } @@ -367,7 +367,7 @@ void door_generic_plat_blocked() void door_rotating_hit_top() {SELFPARAM(); if (self.noise1 != "") - sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); + _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); self.state = STATE_TOP; if (self.spawnflags & DOOR_TOGGLE) return; // don't come down automatically @@ -378,7 +378,7 @@ void door_rotating_hit_top() void door_rotating_hit_bottom() {SELFPARAM(); if (self.noise1 != "") - sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); + _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); if (self.lip==666) // self.lip is used to remember reverse opening direction for door_rotating { self.pos2 = '0 0 0' - self.pos2; @@ -390,7 +390,7 @@ void door_rotating_hit_bottom() void door_rotating_go_down() {SELFPARAM(); if (self.noise2 != "") - sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); + _sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); if (self.max_health) { self.takedamage = DAMAGE_YES; @@ -412,7 +412,7 @@ void door_rotating_go_up() return; } if (self.noise2 != "") - sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); + _sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); self.state = STATE_UP; SUB_CalcAngleMove (self.pos2, TSPEED_LINEAR, self.speed, door_rotating_hit_top); diff --git a/qcsrc/common/triggers/func/door_secret.qc b/qcsrc/common/triggers/func/door_secret.qc index b793228784..5b2cfc5ba0 100644 --- a/qcsrc/common/triggers/func/door_secret.qc +++ b/qcsrc/common/triggers/func/door_secret.qc @@ -35,7 +35,7 @@ void fd_secret_use() // Make a sound, wait a little... if (self.noise1 != "") - sound(self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); self.SUB_NEXTTHINK = self.SUB_LTIME + 0.1; temp = 1 - (self.spawnflags & SECRET_1ST_LEFT); // 1 or -1 @@ -60,7 +60,7 @@ void fd_secret_use() self.dest2 = self.dest1 + v_forward * self.t_length; SUB_CalcMove(self.dest1, TSPEED_LINEAR, self.speed, fd_secret_move1); if (self.noise2 != "") - sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); } void fd_secret_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) @@ -74,14 +74,14 @@ void fd_secret_move1() self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0; self.think = fd_secret_move2; if (self.noise3 != "") - sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); } // Start moving sideways w/sound... void fd_secret_move2() {SELFPARAM(); if (self.noise2 != "") - sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); SUB_CalcMove(self.dest2, TSPEED_LINEAR, self.speed, fd_secret_move3); } @@ -89,7 +89,7 @@ void fd_secret_move2() void fd_secret_move3() {SELFPARAM(); if (self.noise3 != "") - sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); if (!(self.spawnflags & SECRET_OPEN_ONCE)) { self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait; @@ -101,7 +101,7 @@ void fd_secret_move3() void fd_secret_move4() {SELFPARAM(); if (self.noise2 != "") - sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); SUB_CalcMove(self.dest1, TSPEED_LINEAR, self.speed, fd_secret_move5); } @@ -111,13 +111,13 @@ void fd_secret_move5() self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0; self.think = fd_secret_move6; if (self.noise3 != "") - sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); } void fd_secret_move6() {SELFPARAM(); if (self.noise2 != "") - sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); SUB_CalcMove(self.oldorigin, TSPEED_LINEAR, self.speed, fd_secret_done); } @@ -130,7 +130,7 @@ void fd_secret_done() //self.th_pain = fd_secret_use; } if (self.noise3 != "") - sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); } void secret_blocked() @@ -161,7 +161,7 @@ void secret_touch() { if (IS_CLIENT(other)) centerprint(other, self.message); - play2(other, "misc/talk.wav"); + play2(other, SND(TALK)); } } diff --git a/qcsrc/common/triggers/func/pointparticles.qc b/qcsrc/common/triggers/func/pointparticles.qc index 3c11b2a5b6..058f1199f4 100644 --- a/qcsrc/common/triggers/func/pointparticles.qc +++ b/qcsrc/common/triggers/func/pointparticles.qc @@ -230,7 +230,7 @@ void Draw_PointParticles() if(self.noise != "") { setorigin(self, p); - sound(self, CH_AMBIENT, self.noise, VOL_BASE * self.volume, self.atten); + _sound(self, CH_AMBIENT, self.noise, VOL_BASE * self.volume, self.atten); } self.just_toggled = 0; } diff --git a/qcsrc/common/triggers/func/train.qc b/qcsrc/common/triggers/func/train.qc index 4149b538dc..187fd3f1b9 100644 --- a/qcsrc/common/triggers/func/train.qc +++ b/qcsrc/common/triggers/func/train.qc @@ -98,7 +98,7 @@ void train_next() } if(self.noise != "") - sound(self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_IDLE); + _sound(self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_IDLE); } #ifdef SVQC diff --git a/qcsrc/common/triggers/platforms.qc b/qcsrc/common/triggers/platforms.qc index b4f387470c..dc568cae09 100644 --- a/qcsrc/common/triggers/platforms.qc +++ b/qcsrc/common/triggers/platforms.qc @@ -65,7 +65,7 @@ void plat_spawn_inside_trigger() void plat_hit_top() {SELFPARAM(); - sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); + _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); self.state = 1; self.SUB_THINK = plat_go_down; @@ -74,20 +74,20 @@ void plat_hit_top() void plat_hit_bottom() {SELFPARAM(); - sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); + _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); self.state = 2; } void plat_go_down() {SELFPARAM(); - sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM); + _sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM); self.state = 3; SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, plat_hit_bottom); } void plat_go_up() {SELFPARAM(); - sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM); + _sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM); self.state = 4; SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, plat_hit_top); } diff --git a/qcsrc/common/triggers/target/music.qc b/qcsrc/common/triggers/target/music.qc index 33261eabdb..879c304232 100644 --- a/qcsrc/common/triggers/target/music.qc +++ b/qcsrc/common/triggers/target/music.qc @@ -182,9 +182,9 @@ void TargetMusic_Advance() if(vol != vol0) { if(vol0 < 0) - sound(e, CH_BGM_SINGLE, e.noise, vol, ATTEN_NONE); // restart + _sound(e, CH_BGM_SINGLE, e.noise, vol, ATTEN_NONE); // restart else - sound(e, CH_BGM_SINGLE, "", vol, ATTEN_NONE); + _sound(e, CH_BGM_SINGLE, "", vol, ATTEN_NONE); e.lastvol = vol; } } @@ -223,7 +223,7 @@ void Net_TargetMusic() strunzone(e.noise); e.noise = strzone(noi); precache_sound(e.noise); - sound(e, CH_BGM_SINGLE, e.noise, 0, ATTEN_NONE); + _sound(e, CH_BGM_SINGLE, e.noise, 0, ATTEN_NONE); if(getsoundtime(e, CH_BGM_SINGLE) < 0) { LOG_TRACEF("Cannot initialize sound %s\n", e.noise); @@ -310,7 +310,7 @@ void Ent_ReadTriggerMusic() if(self.noise != s) { precache_sound(self.noise); - sound(self, CH_BGM_SINGLE, self.noise, 0, ATTEN_NONE); + _sound(self, CH_BGM_SINGLE, self.noise, 0, ATTEN_NONE); if(getsoundtime(self, CH_BGM_SINGLE) < 0) { LOG_TRACEF("Cannot initialize sound %s\n", self.noise); diff --git a/qcsrc/common/triggers/target/speaker.qc b/qcsrc/common/triggers/target/speaker.qc index e0701dc14f..75f733c09e 100644 --- a/qcsrc/common/triggers/target/speaker.qc +++ b/qcsrc/common/triggers/target/speaker.qc @@ -10,9 +10,9 @@ void target_speaker_use_activator() { var .string sample = GetVoiceMessageSampleField(substring(self.noise, 1, -1)); if(GetPlayerSoundSampleField_notFound) - snd = "misc/null.wav"; + snd = SND(Null); else if(activator.(sample) == "") - snd = "misc/null.wav"; + snd = SND(Null); else { tokenize_console(activator.(sample)); @@ -36,9 +36,9 @@ void target_speaker_use_on() { var .string sample = GetVoiceMessageSampleField(substring(self.noise, 1, -1)); if(GetPlayerSoundSampleField_notFound) - snd = "misc/null.wav"; + snd = SND(Null); else if(activator.(sample) == "") - snd = "misc/null.wav"; + snd = SND(Null); else { tokenize_console(activator.(sample)); @@ -52,13 +52,13 @@ void target_speaker_use_on() } else snd = self.noise; - sound(self, CH_TRIGGER_SINGLE, snd, VOL_BASE * self.volume, self.atten); + _sound(self, CH_TRIGGER_SINGLE, snd, VOL_BASE * self.volume, self.atten); if(self.spawnflags & 3) self.use = target_speaker_use_off; } void target_speaker_use_off() {SELFPARAM(); - sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASE * self.volume, self.atten); + sound(self, CH_TRIGGER_SINGLE, SND_Null, VOL_BASE * self.volume, self.atten); self.use = target_speaker_use_on; } void target_speaker_reset() diff --git a/qcsrc/common/triggers/teleporters.qc b/qcsrc/common/triggers/teleporters.qc index bc43986019..94f2bd26bc 100644 --- a/qcsrc/common/triggers/teleporters.qc +++ b/qcsrc/common/triggers/teleporters.qc @@ -79,7 +79,7 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle if(self.pushltime < time) // only show one teleport effect per teleporter per 0.2 seconds, for better fps { if(tflags & TELEPORT_FLAG_SOUND) - sound (player, CH_TRIGGER, "misc/teleport.wav", VOL_BASE, ATTEN_NORM); + sound (player, CH_TRIGGER, SND_TELEPORT, VOL_BASE, ATTEN_NORM); if(tflags & TELEPORT_FLAG_PARTICLES) { Send_Effect(EFFECT_TELEPORT, player.origin, '0 0 0', 1); diff --git a/qcsrc/common/triggers/trigger/gravity.qc b/qcsrc/common/triggers/trigger/gravity.qc index 659a336901..f329c71b0d 100644 --- a/qcsrc/common/triggers/trigger/gravity.qc +++ b/qcsrc/common/triggers/trigger/gravity.qc @@ -80,7 +80,7 @@ void trigger_gravity_touch() { other.gravity = g; if(self.noise != "") - sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); + _sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); UpdateCSQCProjectile(self.owner); } } diff --git a/qcsrc/common/triggers/trigger/heal.qc b/qcsrc/common/triggers/trigger/heal.qc index 323a4a160d..49042427e6 100644 --- a/qcsrc/common/triggers/trigger/heal.qc +++ b/qcsrc/common/triggers/trigger/heal.qc @@ -19,7 +19,7 @@ void trigger_heal_touch() { other.health = min(other.health + self.health, self.max_health); other.pauserothealth_finished = max(other.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot); - sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); + _sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); } } } diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index 5eb2522182..cdc181ceb6 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -182,7 +182,7 @@ void trigger_push_touch() { // flash when activated Send_Effect(EFFECT_JUMPPAD, other.origin, other.velocity, 1); - sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); + _sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); self.pushltime = time + 0.2; } if(IS_REAL_CLIENT(other) || IS_BOT_CLIENT(other)) diff --git a/qcsrc/common/triggers/trigger/keylock.qc b/qcsrc/common/triggers/trigger/keylock.qc index 17313f0aa8..f792185bc0 100644 --- a/qcsrc/common/triggers/trigger/keylock.qc +++ b/qcsrc/common/triggers/trigger/keylock.qc @@ -146,7 +146,7 @@ void spawnfunc_trigger_keylock(void) if(self.sounds == 1) self.noise = "misc/secret.wav"; else if(self.sounds == 2) - self.noise = "misc/talk.wav"; + self.noise = SND(TALK); else //if (self.sounds == 3) { self.noise = "misc/trigger1.wav"; } @@ -157,7 +157,7 @@ void spawnfunc_trigger_keylock(void) // set closed sourd if(self.noise2 == "") - self.noise2 = "misc/talk.wav"; + self.noise2 = SND(TALK); // delay between triggering message2 and trigger2 if(!self.wait) { self.wait = 5; } diff --git a/qcsrc/common/triggers/trigger/multi.qc b/qcsrc/common/triggers/trigger/multi.qc index 007e6da2f5..2aa8f5c1dd 100644 --- a/qcsrc/common/triggers/trigger/multi.qc +++ b/qcsrc/common/triggers/trigger/multi.qc @@ -32,7 +32,7 @@ void multi_trigger() } if (self.noise) - sound (self.enemy, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); + _sound (self.enemy, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); // don't trigger again until reset self.takedamage = DAMAGE_NO; @@ -149,8 +149,7 @@ void spawnfunc_trigger_multiple() } else if (self.sounds == 2) { - precache_sound ("misc/talk.wav"); - self.noise = "misc/talk.wav"; + self.noise = SND(TALK); } else if (self.sounds == 3) { diff --git a/qcsrc/common/triggers/triggers.qc b/qcsrc/common/triggers/triggers.qc index a44c688ed9..73c5c49651 100644 --- a/qcsrc/common/triggers/triggers.qc +++ b/qcsrc/common/triggers/triggers.qc @@ -173,7 +173,7 @@ void SUB_UseTargets() { centerprint(activator, self.message); if (self.noise == "") - play2(activator, "misc/talk.wav"); + play2(activator, SND(TALK)); } // diff --git a/qcsrc/common/turrets/cl_turrets.qc b/qcsrc/common/turrets/cl_turrets.qc index 232f546c12..e25b0b41a9 100644 --- a/qcsrc/common/turrets/cl_turrets.qc +++ b/qcsrc/common/turrets/cl_turrets.qc @@ -272,7 +272,7 @@ void turret_gibboom() {SELFPARAM(); float i; - sound (self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); pointparticles(particleeffectnum(EFFECT_ROCKET_EXPLODE), self.origin, '0 0 0', 1); for (i = 1; i < 5; i = i + 1) @@ -318,7 +318,7 @@ entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, flo void turret_die() {SELFPARAM(); - sound (self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); pointparticles(particleeffectnum(EFFECT_ROCKET_EXPLODE), self.origin, '0 0 0', 1); if (!autocvar_cl_nogibs) { diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index 9c02d7ad91..337b2789ac 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -457,7 +457,7 @@ entity turret_projectile(string _snd, float _size, float _health, float _death, {SELFPARAM(); entity proj; - sound (self, CH_WEAPON_A, _snd, VOL_BASE, ATTEN_NORM); + _sound (self, CH_WEAPON_A, _snd, VOL_BASE, ATTEN_NORM); proj = spawn (); setorigin(proj, self.tur_shotorg); setsize(proj, '-0.5 -0.5 -0.5' * _size, '0.5 0.5 0.5' * _size); diff --git a/qcsrc/common/turrets/turrets.qc b/qcsrc/common/turrets/turrets.qc index 37c85ca65a..a75a806195 100644 --- a/qcsrc/common/turrets/turrets.qc +++ b/qcsrc/common/turrets/turrets.qc @@ -4,22 +4,6 @@ entity turret_info[TUR_MAXCOUNT]; entity dummy_turret_info; -void turrets_common_precache() -{ - precache_sound (W_Sound("rocket_impact")); - -#ifdef SVQC - precache_sound(W_Sound("rocket_impact")); -#endif - -#ifdef TURRET_DEBUG - precache_model ("models/pathlib/goodsquare.md3"); - precache_model ("models/pathlib/badsquare.md3"); - precache_model ("models/pathlib/square.md3"); - precache_model ("models/pathlib/edge.md3"); -#endif -} - void register_turret(float id, float(float) func, float turretflags, vector min_s, vector max_s, string modelname, string headmodelname, string shortname, string mname) { entity e; @@ -36,10 +20,6 @@ void register_turret(float id, float(float) func, float turretflags, vector min_ e.maxs = max_s; e.model = strzone(strcat("models/turrets/", modelname)); e.head_model = strzone(strcat("models/turrets/", headmodelname)); - - #ifndef MENUQC - turrets_common_precache(); - #endif } float t_null(float dummy) { return 0; } void register_turrets_done() diff --git a/qcsrc/common/turrets/unit/ewheel.qc b/qcsrc/common/turrets/unit/ewheel.qc index e61897cdd8..23942ce242 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(W_Sound("lasergun_fire"), 1, 0, DEATH_TURRET_EWHEEL, PROJECTILE_BLASTER, TRUE, TRUE); + _mis = turret_projectile(SND(LASERGUN_FIRE), 1, 0, DEATH_TURRET_EWHEEL, PROJECTILE_BLASTER, TRUE, TRUE); _mis.missile_flags = MIF_SPLASH; Send_Effect(EFFECT_BLASTER_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 228049f411..975f9045eb 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(W_Sound("hagar_fire"), 5, 0, DEATH_TURRET_FLAC, PROJECTILE_HAGAR, TRUE, TRUE); + proj = turret_projectile(SND(HAGAR_FIRE), 5, 0, DEATH_TURRET_FLAC, PROJECTILE_HAGAR, TRUE, TRUE); Send_Effect(EFFECT_BLASTER_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 f785f4e953..596b95fa08 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(W_Sound("rocket_fire"), 6, 10, DEATH_TURRET_HELLION, PROJECTILE_ROCKET, FALSE, FALSE); + missile = turret_projectile(SND(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 f01275187d..dc3a89b23b 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(W_Sound("rocket_fire"), 6, 10, DEATH_TURRET_HK, PROJECTILE_ROCKET, FALSE, FALSE); + missile = turret_projectile(SND(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 afecb7fa56..de6030deff 100644 --- a/qcsrc/common/turrets/unit/machinegun.qc +++ b/qcsrc/common/turrets/unit/machinegun.qc @@ -48,7 +48,6 @@ float t_machinegun(float req) } case TR_PRECACHE: { - 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 1a3c9220b8..37fde41c82 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(W_Sound("rocket_fire"), 6, 10, DEATH_TURRET_MLRS, PROJECTILE_ROCKET, TRUE, TRUE); + missile = turret_projectile(SND(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 e1ddef3a9d..a1f766f018 100644 --- a/qcsrc/common/turrets/unit/phaser.qc +++ b/qcsrc/common/turrets/unit/phaser.qc @@ -26,7 +26,7 @@ void beam_think() self.owner.attack_finished_single = time + self.owner.shot_refire; self.owner.fireflag = 2; self.owner.tur_head.frame = 10; - sound (self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); remove(self); return; } @@ -36,7 +36,7 @@ void beam_think() if (time - self.shot_spread > 0) { self.shot_spread = time + 2; - sound (self, CH_SHOTS_SINGLE, "turrets/phaser.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS_SINGLE, SND_TUR_PHASER, VOL_BASE, ATTEN_NORM); } @@ -83,7 +83,7 @@ float t_phaser(float req) beam.enemy = self.enemy; beam.bot_dodge = true; beam.bot_dodgerating = beam.shot_dmg; - sound (beam, CH_SHOTS_SINGLE, "turrets/phaser.wav", VOL_BASE, ATTEN_NORM); + sound (beam, CH_SHOTS_SINGLE, SND_TUR_PHASER, VOL_BASE, ATTEN_NORM); self.fireflag = 1; beam.attack_finished_single = self.attack_finished_single; @@ -91,7 +91,7 @@ float t_phaser(float req) setattachment(beam,self.tur_head,"tag_fire"); - soundat (self, trace_endpos, CH_SHOTS, W_Sound("neximpact"), VOL_BASE, ATTEN_NORM); + soundat (self, trace_endpos, CH_SHOTS, SND(NEXIMPACT), VOL_BASE, ATTEN_NORM); if (self.tur_head.frame == 0) self.tur_head.frame = 1; @@ -137,7 +137,6 @@ float t_phaser(float req) } case TR_PRECACHE: { - precache_sound ("turrets/phaser.wav"); return true; } } diff --git a/qcsrc/common/turrets/unit/plasma.qc b/qcsrc/common/turrets/unit/plasma.qc index df986d79e0..38a7eeacb6 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(W_Sound("hagar_fire"), 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, TRUE, TRUE); + entity missile = turret_projectile(SND(HAGAR_FIRE), 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, TRUE, TRUE); missile.missile_flags = MIF_SPLASH; Send_Effect(EFFECT_BLASTER_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 f3bd32448f..3bf87db228 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(W_Sound("hagar_fire"), 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, TRUE, TRUE); + entity missile = turret_projectile(SND(HAGAR_FIRE), 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, TRUE, TRUE); missile.missile_flags = MIF_SPLASH; Send_Effect(EFFECT_BLASTER_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 9e7b0cbe13..ae904bcd03 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, W_Sound("hagar_fire"), VOL_BASE, ATTEN_NORM); + sound (self, CH_WEAPON_A, SND_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, W_Sound("uzi_fire"), VOL_BASE, ATTEN_NORM); + sound (self, CH_WEAPON_A, SND_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(EFFECT_BLASTER_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1); @@ -634,7 +634,6 @@ float t_walker(float req) } case TR_PRECACHE: { - precache_sound (W_Sound("rocket_impact")); return true; } } diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index a054edde8a..a506a59fcd 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -271,15 +271,6 @@ string fstrunzone(string s) return sc; } -bool fexists(string f) -{ - int fh = fopen(f, FILE_READ); - if (fh < 0) - return false; - fclose(fh); - return true; -} - // Databases (hash tables) const float DB_BUCKETS = 8192; void db_save(float db, string pFilename) diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index e3fab47b7d..d43136c673 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -230,10 +230,6 @@ const float XENCODE_LEN = 5; string xencode(float f); float xdecode(string s); -// Play all sounds via sound7, for access to the extra channels. -// Otherwise, channels 8 to 15 would be blocked for a weird QW feature. -#define sound(e,c,s,v,a) sound7(e,c,s,v,a,0,0) - int lowestbit(float f); #ifdef CSQC diff --git a/qcsrc/common/vehicles/all.qc b/qcsrc/common/vehicles/all.qc index 3f3b77ea33..6e26f17126 100644 --- a/qcsrc/common/vehicles/all.qc +++ b/qcsrc/common/vehicles/all.qc @@ -16,14 +16,7 @@ #ifndef MENUQC STATIC_INIT(vehicles_common_initialize) { -#ifdef CSQC - precache_sound ("vehicles/alarm.wav"); - precache_sound ("vehicles/alarm_shield.wav"); -#endif // CSQC #ifdef SVQC - precache_sound("onslaught/ons_hit2.wav"); - precache_sound("onslaught/electricity_explode.wav"); - addstat(STAT_HUD, AS_INT, hud); addstat(STAT_VEHICLESTAT_HEALTH, AS_INT, vehicle_health); addstat(STAT_VEHICLESTAT_SHIELD, AS_INT, vehicle_shield); diff --git a/qcsrc/common/vehicles/cl_vehicles.qc b/qcsrc/common/vehicles/cl_vehicles.qc index b6c8844abd..a91e3e212a 100644 --- a/qcsrc/common/vehicles/cl_vehicles.qc +++ b/qcsrc/common/vehicles/cl_vehicles.qc @@ -23,7 +23,7 @@ void vehicle_alarm(entity e, int ch, string s0und) if(!autocvar_cl_vehicles_alarm) return; - sound(e, ch, s0und, VOL_BASEVOICE, ATTEN_NONE); + _sound(e, ch, s0und, VOL_BASEVOICE, ATTEN_NONE); } void AuxiliaryXhair_Draw2D() @@ -79,8 +79,8 @@ void Net_VehicleSetup() // hud_id == 0 means we exited a vehicle, so stop alarm sound/s if(hud_id == 0) { - sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE); - sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE); + sound(self, CH_TRIGGER_SINGLE, SND_Null, VOL_BASEVOICE, ATTEN_NONE); + sound(self, CH_PAIN_SINGLE, SND_Null, VOL_BASEVOICE, ATTEN_NONE); return; } @@ -235,7 +235,7 @@ void Vehicles_drawHUD( if(alarm1time < time) { alarm1time = time + 2; - vehicle_alarm(self, CH_PAIN_SINGLE, "vehicles/alarm.wav"); + vehicle_alarm(self, CH_PAIN_SINGLE, SND(VEH_ALARM)); } drawpic_skin(tmpPos, "vehicle_icon_health", tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL); } @@ -243,7 +243,7 @@ void Vehicles_drawHUD( { if(alarm1time) { - vehicle_alarm(self, CH_PAIN_SINGLE, "misc/null.wav"); + vehicle_alarm(self, CH_PAIN_SINGLE, SND(Null)); alarm1time = 0; } drawpic_skin(tmpPos, "vehicle_icon_health", tmpSize, '1 1 1', hudAlpha, DRAWFLAG_NORMAL); @@ -257,7 +257,7 @@ void Vehicles_drawHUD( if(alarm2time < time) { alarm2time = time + 1; - vehicle_alarm(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav"); + vehicle_alarm(self, CH_TRIGGER_SINGLE, SND(VEH_ALARM_SHIELD)); } drawpic_skin(tmpPos, "vehicle_icon_shield", tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL); } @@ -265,7 +265,7 @@ void Vehicles_drawHUD( { if(alarm2time) { - vehicle_alarm(self, CH_TRIGGER_SINGLE, "misc/null.wav"); + vehicle_alarm(self, CH_TRIGGER_SINGLE, SND(Null)); alarm2time = 0; } drawpic_skin(tmpPos, "vehicle_icon_shield", tmpSize, '1 1 1', hudAlpha, DRAWFLAG_NORMAL); diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 73ff86b4be..8f2f7581a2 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -289,7 +289,7 @@ entity vehicles_projectile(string _mzlfx, string _mzlsound, proj.flags = FL_PROJECTILE | FL_NOTARGET; if(_mzlsound) - sound (self, CH_WEAPON_A, _mzlsound, VOL_BASE, ATTEN_NORM); + _sound (self, CH_WEAPON_A, _mzlsound, VOL_BASE, ATTEN_NORM); if(_mzlfx) Send_Effect_(_mzlfx, proj.origin, proj.velocity, 1); @@ -303,7 +303,7 @@ entity vehicles_projectile(string _mzlfx, string _mzlsound, void vehicles_gib_explode() {SELFPARAM(); - sound (self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1); Send_Effect(EFFECT_EXPLOSION_SMALL, self.wp00.origin + '0 0 64', '0 0 0', 1); remove(self); @@ -907,7 +907,7 @@ void vehicles_exit(bool eject) _vehicle.team = _vehicle.tur_head.team; - sound (_vehicle, CH_TRIGGER_SINGLE, "misc/null.wav", 1, ATTEN_NORM); + sound (_vehicle, CH_TRIGGER_SINGLE, SND_Null, 1, ATTEN_NORM); _vehicle.vehicle_hudmodel.viewmodelforclient = _vehicle; _vehicle.phase = time + 1; diff --git a/qcsrc/common/vehicles/unit/bumblebee.qc b/qcsrc/common/vehicles/unit/bumblebee.qc index 96fef6c05c..6f8a2bf8f5 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(EFFECT_BIGPLASMA_MUZZLEFLASH.eent_eff_name, W_Sound("flacexp3"), + vehicles_projectile(EFFECT_BIGPLASMA_MUZZLEFLASH.eent_eff_name, SND(VEH_BUMBLEBEE_FIRE), 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, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); Send_Effect(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, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); Send_Effect(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 62a6e850fd..a1dc7ced65 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(EFFECT_RACER_MUZZLEFLASH.eent_eff_name, W_Sound("lasergun_fire"), + bolt = vehicles_projectile(EFFECT_RACER_MUZZLEFLASH.eent_eff_name, SND(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) {SELFPARAM(); vector v = gettaginfo(self, gettagindex(self, tagname)); - entity rocket = vehicles_projectile(EFFECT_RACER_ROCKETLAUNCH.eent_eff_name, W_Sound("rocket_fire"), + entity rocket = vehicles_projectile(EFFECT_RACER_ROCKETLAUNCH.eent_eff_name, SND(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); @@ -385,7 +385,7 @@ float racer_frame() { self.sounds = 1; self.sound_nexttime = time + 10.922667; //soundlength("vehicles/racer_move.wav"); - sound (self, CH_TRIGGER_SINGLE, "vehicles/racer_move.wav", VOL_VEHICLEENGINE, ATTEN_NORM); + sound (self, CH_TRIGGER_SINGLE, SND_VEH_RACER_MOVE, VOL_VEHICLEENGINE, ATTEN_NORM); } #endif } @@ -396,7 +396,7 @@ float racer_frame() { self.sounds = 0; self.sound_nexttime = time + 11.888604; //soundlength("vehicles/racer_idle.wav"); - sound (self, CH_TRIGGER_SINGLE, "vehicles/racer_idle.wav", VOL_VEHICLEENGINE, ATTEN_NORM); + sound (self, CH_TRIGGER_SINGLE, SND_VEH_RACER_IDLE, VOL_VEHICLEENGINE, ATTEN_NORM); } } #endif @@ -435,14 +435,14 @@ float racer_frame() if(racer.strength_finished < time) { racer.strength_finished = time + 10.922667; //soundlength("vehicles/racer_boost.wav"); - sound (racer.tur_head, CH_TRIGGER_SINGLE, "vehicles/racer_boost.wav", VOL_VEHICLEENGINE, ATTEN_NORM); + sound (racer.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RACER_BOOST, VOL_VEHICLEENGINE, ATTEN_NORM); } #endif } else { racer.strength_finished = 0; - sound (racer.tur_head, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_VEHICLEENGINE, ATTEN_NORM); + sound (racer.tur_head, CH_TRIGGER_SINGLE, SND_Null, VOL_VEHICLEENGINE, ATTEN_NORM); } if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME) @@ -589,7 +589,7 @@ void racer_exit(float eject) self.think = racer_think; self.nextthink = time; self.movetype = MOVETYPE_BOUNCE; - sound (self.tur_head, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_VEHICLEENGINE, ATTEN_NORM); + sound (self.tur_head, CH_TRIGGER_SINGLE, SND_Null, VOL_VEHICLEENGINE, ATTEN_NORM); if(!self.owner) return; @@ -856,14 +856,6 @@ bool v_racer(int req) case VR_PRECACHE: { - #ifdef SVQC - precache_sound (W_Sound("lasergun_fire")); - precache_sound (W_Sound("rocket_fire")); - - precache_sound ("vehicles/racer_idle.wav"); - precache_sound ("vehicles/racer_move.wav"); - precache_sound ("vehicles/racer_boost.wav"); - #endif return true; } } diff --git a/qcsrc/common/vehicles/unit/raptor.qc b/qcsrc/common/vehicles/unit/raptor.qc index 96a84892cf..742ef7b9b2 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) {SELFPARAM(); - vehicles_projectile(EFFECT_RAPTOR_MUZZLEFLASH.eent_eff_name, W_Sound("lasergun_fire"), + vehicles_projectile(EFFECT_RAPTOR_MUZZLEFLASH.eent_eff_name, SND(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); @@ -334,15 +334,15 @@ float raptor_frame() if(self.sound_nexttime < time) { self.sound_nexttime = time + 7.955812; - //sound (self.tur_head, CH_TRIGGER_SINGLE, "vehicles/raptor_fly.wav", 1 - ftmp, ATTEN_NORM ); - sound (self, CH_TRIGGER_SINGLE, "vehicles/raptor_speed.wav", 1, ATTEN_NORM); + //sound (self.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_FLY, 1 - ftmp, ATTEN_NORM ); + sound (self, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, 1, ATTEN_NORM); self.wait = ftmp; } /* else if(fabs(ftmp - self.wait) > 0.2) { - sound (self.tur_head, CH_TRIGGER_SINGLE, "", 1 - ftmp, ATTEN_NORM ); - sound (self, CH_TRIGGER_SINGLE, "", ftmp, ATTEN_NORM); + sound (self.tur_head, CH_TRIGGER_SINGLE, SND_Null, 1 - ftmp, ATTEN_NORM ); + sound (self, CH_TRIGGER_SINGLE, SND_Null, ftmp, ATTEN_NORM); self.wait = ftmp; } */ @@ -629,7 +629,7 @@ float raptor_frame() } if(_incomming) - sound(self, CH_PAIN_SINGLE, "vehicles/missile_alarm.wav", VOL_BASE, ATTEN_NONE); + sound(self, CH_PAIN_SINGLE, SND_VEH_MISSILE_ALARM, VOL_BASE, ATTEN_NONE); self.bomb1.cnt = time + 1; } @@ -661,7 +661,7 @@ float raptor_takeoff() if(self.sound_nexttime < time) { self.sound_nexttime = time + 7.955812; //soundlength("vehicles/raptor_fly.wav"); - sound (self, CH_TRIGGER_SINGLE, "vehicles/raptor_speed.wav", VOL_VEHICLEENGINE, ATTEN_NORM); + sound (self, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, VOL_VEHICLEENGINE, ATTEN_NORM); } // Takeoff sequense @@ -727,7 +727,7 @@ void raptor_diethink() if(random() < 0.05) { - sound (self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1); } self.nextthink = time; @@ -969,10 +969,6 @@ float v_raptor(float req) } case VR_PRECACHE: { - precache_sound ("vehicles/raptor_fly.wav"); - precache_sound ("vehicles/raptor_speed.wav"); - precache_sound ("vehicles/missile_alarm.wav"); - return true; } } diff --git a/qcsrc/common/vehicles/unit/spiderbot.qc b/qcsrc/common/vehicles/unit/spiderbot.qc index 7d03c7736f..f8efe528dd 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(EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, W_Sound("rocket_fire"), + rocket = vehicles_projectile(EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND(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(EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, W_Sound("rocket_fire"), + rocket = vehicles_projectile(EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND(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(EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, W_Sound("rocket_fire"), + rocket = vehicles_projectile(EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND(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); @@ -407,7 +407,7 @@ float spiderbot_frame() if(spider.flags & FL_ONGROUND) if(spider.frame == 4 && self.tur_head.wait != 0) { - sound (self, CH_TRIGGER_SINGLE, "vehicles/spiderbot_land.wav", VOL_VEHICLEENGINE, ATTEN_NORM); + sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_LAND, VOL_VEHICLEENGINE, ATTEN_NORM); spider.frame = 5; } @@ -416,7 +416,7 @@ float spiderbot_frame() if((spider.flags & FL_ONGROUND) && player.BUTTON_JUMP && !spider.BUTTON_JUMP && self.tur_head.wait < time) { - sound (self, CH_TRIGGER_SINGLE, "vehicles/spiderbot_jump.wav", VOL_VEHICLEENGINE, ATTEN_NORM); + sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_JUMP, VOL_VEHICLEENGINE, ATTEN_NORM); //dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n"); self.delay = 0; @@ -452,7 +452,7 @@ float spiderbot_frame() self.delay = 3; self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_idle.wav"); //dprint("spiderbot_idle:", ftos(soundlength("vehicles/spiderbot_idle.wav")), "\n"); - sound (self, CH_TRIGGER_SINGLE, "vehicles/spiderbot_idle.wav", VOL_VEHICLEENGINE, ATTEN_NORM); + sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_IDLE, VOL_VEHICLEENGINE, ATTEN_NORM); } movelib_beak_simple(autocvar_g_vehicle_spiderbot_speed_stop); spider.frame = 5; @@ -496,7 +496,7 @@ float spiderbot_frame() { self.delay = 1; self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_walk.wav"); - sound (self, CH_TRIGGER_SINGLE, "vehicles/spiderbot_walk.wav", VOL_VEHICLEENGINE, ATTEN_NORM); + sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_WALK, VOL_VEHICLEENGINE, ATTEN_NORM); //dprint("spiderbot_walk:", ftos(soundlength("vehicles/spiderbot_walk.wav")), "\n"); } } @@ -526,7 +526,7 @@ float spiderbot_frame() { self.delay = 2; self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_strafe.wav"); - sound (self, CH_TRIGGER_SINGLE, "vehicles/spiderbot_strafe.wav", VOL_VEHICLEENGINE, ATTEN_NORM); + sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_STRAFE, VOL_VEHICLEENGINE, ATTEN_NORM); //dprint("spiderbot_strafe:", ftos(soundlength("vehicles/spiderbot_strafe.wav")), "\n"); } } @@ -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, W_Sound("uzi_fire"), VOL_BASE, ATTEN_NORM); + sound (gun, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM); //trailparticles(self, _particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos); pointparticles(particleeffectnum(EFFECT_SPIDERBOT_MINIGUN_MUZZLEFLASH), v, v_forward * 2500, 1); @@ -678,7 +678,7 @@ void spiderbot_headfade() { if(self.alpha > 0.1) { - sound (self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); Send_Effect(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, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1); } self.nextthink = time + 0.1; @@ -925,15 +925,6 @@ float v_spiderbot(float req) } case VR_PRECACHE: { - precache_sound (W_Sound("uzi_fire") ); - precache_sound (W_Sound("rocket_impact")); - - precache_sound ("vehicles/spiderbot_die.wav"); - precache_sound ("vehicles/spiderbot_idle.wav"); - precache_sound ("vehicles/spiderbot_jump.wav"); - precache_sound ("vehicles/spiderbot_strafe.wav"); - precache_sound ("vehicles/spiderbot_walk.wav"); - precache_sound ("vehicles/spiderbot_land.wav"); return true; } } diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index 046298a4c4..b972cfdec4 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -331,7 +331,16 @@ int GetAmmoStat(.int ammotype) string W_Sound(string w_snd) { - string output = strcat("weapons/", w_snd, ".wav"); + #define extensions(X) X(wav) X(ogg) + #define tryext(ext) { if (fexists(strcat("sound/", output = strcat("weapons/", w_snd, "."#ext)))) break; } + string output; + do { + extensions(tryext); + #undef tryext + #undef extensions + output = strcat("weapons/", w_snd); + } while (0); + #ifdef SVQC MUTATOR_CALLHOOK(WeaponSound, w_snd, output); return weapon_sound_output; diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index a6a0730996..400c950c8c 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/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, W_Sound("arc_stop"), VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM); } } @@ -579,7 +579,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, W_Sound("arc_fire"), VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_A, SND_ARC_FIRE, VOL_BASE, ATTN_NORM); entity beam = self.arc_beam = spawn(); beam.classname = "W_Arc_Beam"; @@ -611,7 +611,7 @@ void Arc_Smoke() if ( !self.arc_smoke_sound ) { self.arc_smoke_sound = 1; - sound(self, CH_SHOTS_SINGLE, W_Sound("arc_loop_overheat"), VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS_SINGLE, SND_ARC_LOOP_OVERHEAT, VOL_BASE, ATTN_NORM); } } } @@ -627,7 +627,7 @@ void Arc_Smoke() !( self.BUTTON_ATCK || self.BUTTON_ATCK2 ) ) || self.switchweapon != WEP_ARC.m_id ) { self.arc_smoke_sound = 0; - sound(self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); } } @@ -695,7 +695,7 @@ bool W_Arc(int req) if(self.arc_BUTTON_ATCK_prev != 0) { - sound(self, CH_WEAPON_A, W_Sound("arc_stop"), VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_A, SND_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(); } @@ -716,10 +716,6 @@ bool W_Arc(int req) } case WR_INIT: { - 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); @@ -1158,7 +1154,7 @@ void Draw_ArcBeam(void) void Remove_ArcBeam(void) {SELFPARAM(); remove(self.beam_muzzleentity); - sound(self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); } void Ent_ReadArcBeam(float isnew) @@ -1180,7 +1176,7 @@ void Ent_ReadArcBeam(float isnew) self.draw = Draw_ArcBeam; self.entremove = Remove_ArcBeam; self.move_time = time; - loopsound(self, CH_SHOTS_SINGLE, W_Sound("arc_loop"), VOL_BASE, ATTEN_NORM); + loopsound(self, CH_SHOTS_SINGLE, SND(ARC_LOOP), VOL_BASE, ATTEN_NORM); flash = spawn(); flash.owner = self; @@ -1524,7 +1520,6 @@ bool W_Arc(int req) } case WR_INIT: { - precache_sound(W_Sound("arc_loop")); return true; } case WR_ZOOMRETICLE: diff --git a/qcsrc/common/weapons/weapon/blaster.qc b/qcsrc/common/weapons/weapon/blaster.qc index b20713c029..6b6d207bfa 100644 --- a/qcsrc/common/weapons/weapon/blaster.qc +++ b/qcsrc/common/weapons/weapon/blaster.qc @@ -95,7 +95,7 @@ void W_Blaster_Attack( {SELFPARAM(); vector s_forward = v_forward * cos(atk_shotangle * DEG2RAD) + v_up * sin(atk_shotangle * DEG2RAD); - W_SetupShot_Dir(self, s_forward, false, 3, W_Sound("lasergun_fire"), CH_WEAPON_B, atk_damage); + W_SetupShot_Dir(self, s_forward, false, 3, SND(LASERGUN_FIRE), CH_WEAPON_B, atk_damage); Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); entity missile = spawn(); @@ -223,7 +223,6 @@ bool W_Blaster(int request) case WR_INIT: { - precache_sound(W_Sound("lasergun_fire")); BLASTER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -269,13 +268,12 @@ bool W_Blaster(int request) vector org2; org2 = w_org + w_backoff * 6; pointparticles(particleeffectnum(EFFECT_BLASTER_IMPACT), org2, w_backoff * 1000, 1); - if(!w_issilent) { sound(self, CH_SHOTS, W_Sound("laserimpact"), VOL_BASE, ATTN_NORM); } + if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); } return true; } case WR_INIT: { - precache_sound(W_Sound("laserimpact")); return true; } case WR_ZOOMRETICLE: diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index 6821d5a0e1..43771079e2 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/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, W_Sound("crylink_fire"), CH_WEAPON_A, maxdmg); + W_SetupShot(self, false, 2, SND(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, W_Sound("crylink_fire2"), CH_WEAPON_A, maxdmg); + W_SetupShot(self, false, 2, SND(CRYLINK_FIRE2), CH_WEAPON_A, maxdmg); forward = v_forward; right = v_right; up = v_up; @@ -638,9 +638,6 @@ bool W_Crylink(int req) } case WR_INIT: { - 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; } @@ -671,7 +668,7 @@ bool W_Crylink(int req) } case WR_RELOAD: { - W_Reload(min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), W_Sound("reload")); + W_Reload(min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND(RELOAD)); return true; } case WR_SUICIDEMESSAGE: @@ -699,21 +696,19 @@ bool W_Crylink(int req) { pointparticles(particleeffectnum(EFFECT_CRYLINK_IMPACT2), org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, W_Sound("crylink_impact2"), VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, SND_CRYLINK_IMPACT2, VOL_BASE, ATTN_NORM); } else { pointparticles(particleeffectnum(EFFECT_CRYLINK_IMPACT), org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, W_Sound("crylink_impact"), VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, SND_CRYLINK_IMPACT, VOL_BASE, ATTN_NORM); } return true; } case WR_INIT: { - precache_sound(W_Sound("crylink_impact2")); - precache_sound(W_Sound("crylink_impact")); return true; } case WR_ZOOMRETICLE: diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index cb2d16659c..a011846315 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -295,7 +295,7 @@ void W_Devastator_Think(void) { Send_Effect(EFFECT_ROCKET_GUIDE, self.origin, self.velocity, 1); // TODO add a better sound here - sound(self.realowner, CH_WEAPON_B, W_Sound("rocket_mode"), VOL_BASE, ATTN_NORM); + sound(self.realowner, CH_WEAPON_B, SND_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, W_Sound("rocket_fire"), CH_WEAPON_A, WEP_CVAR(devastator, damage)); + W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 5, SND(ROCKET_FIRE), CH_WEAPON_A, WEP_CVAR(devastator, damage)); Send_Effect(EFFECT_ROCKET_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, W_Sound("rocket_det"), VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM); } } @@ -567,12 +567,6 @@ bool W_Devastator(int req) } case WR_INIT: { - //if(autocvar_sv_precacheweapons) - //{ - 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; } @@ -633,7 +627,7 @@ bool W_Devastator(int req) } case WR_RELOAD: { - W_Reload(WEP_CVAR(devastator, ammo), W_Sound("reload")); + W_Reload(WEP_CVAR(devastator, ammo), SND(RELOAD)); return true; } case WR_SUICIDEMESSAGE: @@ -662,13 +656,12 @@ bool W_Devastator(int req) org2 = w_org + w_backoff * 12; pointparticles(particleeffectnum(EFFECT_ROCKET_EXPLODE), org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTN_NORM); return true; } case WR_INIT: { - precache_sound(W_Sound("rocket_impact")); return true; } case WR_ZOOMRETICLE: diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 7f02a00ce2..fbc0733880 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -255,7 +255,7 @@ void W_Electro_Attack_Bolt(void) '0 0 -3', false, 2, - W_Sound("electro_fire"), + SND(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, W_Sound("electro_bounce"), VOL_BASE, ATTEN_NORM); + spamsound(self, CH_SHOTS, SND(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, - W_Sound("electro_fire2"), + SND(ELECTRO_FIRE2), CH_WEAPON_A, WEP_CVAR_SEC(electro, damage) ); @@ -498,11 +498,6 @@ bool W_Electro(int req) } case WR_INIT: { - 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; } @@ -538,7 +533,7 @@ bool W_Electro(int req) } case WR_RELOAD: { - W_Reload(min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), W_Sound("reload")); + W_Reload(min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND(RELOAD)); return true; } case WR_SUICIDEMESSAGE: @@ -579,7 +574,7 @@ bool W_Electro(int req) { pointparticles(particleeffectnum(EFFECT_ELECTRO_BALLEXPLODE), org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, W_Sound("electro_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM); } else { @@ -588,13 +583,13 @@ bool W_Electro(int req) // this is sent as "primary (w_deathtype & HITTYPE_BOUNCE)" to distinguish it from (w_deathtype & HITTYPE_SECONDARY) bounced balls pointparticles(particleeffectnum(EFFECT_ELECTRO_COMBO), org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, W_Sound("electro_impact_combo"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_ELECTRO_IMPACT_COMBO, VOL_BASE, ATTEN_NORM); } else { pointparticles(particleeffectnum(EFFECT_ELECTRO_IMPACT), org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, W_Sound("electro_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM); } } @@ -602,8 +597,6 @@ bool W_Electro(int req) } case WR_INIT: { - precache_sound(W_Sound("electro_impact")); - precache_sound(W_Sound("electro_impact_combo")); return true; } case WR_ZOOMRETICLE: diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index a37ae8f099..2bf2a6267a 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -182,7 +182,7 @@ void W_Fireball_Attack1(void) {SELFPARAM(); entity proj; - 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)); + W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 2, SND(FIREBALL_FIRE2), CH_WEAPON_A, WEP_CVAR_PRI(fireball, damage) + WEP_CVAR_PRI(fireball, bfgdamage)); Send_Effect(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) {SELFPARAM(); W_Fireball_AttackEffect(0, '-1.25 -3.75 0'); - sound(self, CH_WEAPON_SINGLE, W_Sound("fireball_prefire2"), VOL_BASE, ATTEN_NORM); + sound(self, CH_WEAPON_SINGLE, SND_FIREBALL_PREFIRE2, VOL_BASE, ATTEN_NORM); weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame1); } @@ -316,7 +316,7 @@ 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, W_Sound("fireball_fire"), CH_WEAPON_A, WEP_CVAR_SEC(fireball, damage)); + W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 2, SND(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; @@ -399,9 +399,6 @@ bool W_Fireball(int req) } case WR_INIT: { - 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; } @@ -460,14 +457,13 @@ bool W_Fireball(int req) org2 = w_org + w_backoff * 16; pointparticles(particleeffectnum(EFFECT_FIREBALL_EXPLODE), org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, W_Sound("fireball_impact2"), VOL_BASE, ATTEN_NORM * 0.25); // long range boom + sound(self, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM * 0.25); // long range boom } return true; } case WR_INIT: { - precache_sound(W_Sound("fireball_impact2")); return true; } case WR_ZOOMRETICLE: diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index d55a1b6072..8001ce15e8 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -127,7 +127,7 @@ void W_Hagar_Attack(void) W_DecreaseAmmo(WEP_CVAR_PRI(hagar, ammo)); - W_SetupShot(self, false, 2, W_Sound("hagar_fire"), CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage)); + W_SetupShot(self, false, 2, SND(HAGAR_FIRE), CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage)); Send_Effect(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, W_Sound("hagar_fire"), CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage)); + W_SetupShot(self, false, 2, SND(HAGAR_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage)); Send_Effect(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, W_Sound("hagar_fire"), CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage)); + W_SetupShot(self, false, 2, SND(HAGAR_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage)); Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); forward = v_forward; @@ -319,7 +319,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, W_Sound("hagar_beep"), VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_A, SND_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(); @@ -338,7 +338,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, W_Sound("hagar_load"), VOL_BASE * 0.8, ATTN_NORM); // sound is too loud according to most + sound(self, CH_WEAPON_B, SND_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)) stopped = true; @@ -349,7 +349,7 @@ void W_Hagar_Attack2_Load(void) if(stopped && !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, W_Sound("hagar_beep"), VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM); self.hagar_loadbeep = true; self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_hold) * W_WeaponRateFactor(); } @@ -369,7 +369,7 @@ void W_Hagar_Attack2_Load(void) if(!self.hagar_warning) // 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, W_Sound("hagar_beep"), VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM); self.hagar_warning = true; } } @@ -451,9 +451,6 @@ bool W_Hagar(int req) } case WR_INIT: { - 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; } @@ -502,7 +499,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)), W_Sound("reload")); + W_Reload(min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND(RELOAD)); return true; } @@ -534,20 +531,17 @@ bool W_Hagar(int req) if(!w_issilent) { if(w_random<0.15) - sound(self, CH_SHOTS, W_Sound("hagexp1"), VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, SND_HAGEXP1, VOL_BASE, ATTN_NORM); else if(w_random<0.7) - sound(self, CH_SHOTS, W_Sound("hagexp2"), VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, SND_HAGEXP2, VOL_BASE, ATTN_NORM); else - sound(self, CH_SHOTS, W_Sound("hagexp3"), VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, SND_HAGEXP3, VOL_BASE, ATTN_NORM); } return true; } case WR_INIT: { - precache_sound(W_Sound("hagexp1")); - precache_sound(W_Sound("hagexp2")); - precache_sound(W_Sound("hagexp3")); return true; } case WR_ZOOMRETICLE: diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index 074b760538..a0408d6b9e 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/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, W_Sound("lasergun_fire"), CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage)); + W_SetupShot(self, false, 3, SND(LASERGUN_FIRE), CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage)); Send_Effect(EFFECT_BLASTER_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, W_Sound("lasergun_fire"), CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage)); + W_SetupShot(self, false, 3, SND(LASERGUN_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage)); Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); missile = spawn(); @@ -241,7 +241,6 @@ bool W_HLAC(int req) } case WR_INIT: { - precache_sound(W_Sound("lasergun_fire")); HLAC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -264,7 +263,7 @@ bool W_HLAC(int req) } case WR_RELOAD: { - W_Reload(min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), W_Sound("reload")); + W_Reload(min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND(RELOAD)); return true; } case WR_SUICIDEMESSAGE: @@ -290,13 +289,12 @@ bool W_HLAC(int req) org2 = w_org + w_backoff * 6; pointparticles(particleeffectnum(EFFECT_BLASTER_IMPACT), org2, w_backoff * 1000, 1); if(!w_issilent) - sound(self, CH_SHOTS, W_Sound("laserimpact"), VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); return true; } case WR_INIT: { - precache_sound(W_Sound("laserimpact")); return true; } case WR_ZOOMRETICLE: diff --git a/qcsrc/common/weapons/weapon/hmg.qc b/qcsrc/common/weapons/weapon/hmg.qc index c55304118b..03196daf67 100644 --- a/qcsrc/common/weapons/weapon/hmg.qc +++ b/qcsrc/common/weapons/weapon/hmg.qc @@ -61,7 +61,7 @@ void W_HeavyMachineGun_Attack_Auto() W_DecreaseAmmo(WEP_CVAR(hmg, ammo)); - W_SetupShot (self, true, 0, W_Sound("uzi_fire"), CH_WEAPON_A, WEP_CVAR(hmg, damage)); + W_SetupShot (self, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(hmg, damage)); if(!autocvar_g_norecoil) { @@ -118,7 +118,6 @@ bool W_HeavyMachineGun(int req) } case WR_INIT: { - precache_sound (W_Sound("uzi_fire")); HMG_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -147,7 +146,7 @@ bool W_HeavyMachineGun(int req) } case WR_RELOAD: { - W_Reload(WEP_CVAR(hmg, ammo), W_Sound("reload")); + W_Reload(WEP_CVAR(hmg, ammo), SND(RELOAD)); return true; } case WR_SUICIDEMESSAGE: @@ -177,19 +176,16 @@ bool W_HeavyMachineGun(int req) pointparticles(particleeffectnum(EFFECT_MACHINEGUN_IMPACT), org2, w_backoff * 1000, 1); if(!w_issilent) if(w_random < 0.05) - sound(self, CH_SHOTS, W_Sound("ric1"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_RIC1, VOL_BASE, ATTEN_NORM); else if(w_random < 0.1) - sound(self, CH_SHOTS, W_Sound("ric2"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_RIC2, VOL_BASE, ATTEN_NORM); else if(w_random < 0.2) - sound(self, CH_SHOTS, W_Sound("ric3"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_RIC3, VOL_BASE, ATTEN_NORM); return true; } case WR_INIT: { - precache_sound(W_Sound("ric1")); - precache_sound(W_Sound("ric2")); - precache_sound(W_Sound("ric3")); return true; } case WR_ZOOMRETICLE: diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index b7f51b54c4..af52ec15bb 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/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, W_Sound("hookbomb_fire"), CH_WEAPON_A, WEP_CVAR_SEC(hook, damage)); + W_SetupShot(self, false, 4, SND(HOOKBOMB_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hook, damage)); gren = spawn(); gren.owner = gren.realowner = self; @@ -288,9 +288,6 @@ bool W_Hook(int req) } case WR_INIT: { - 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; } @@ -344,13 +341,12 @@ bool W_Hook(int req) org2 = w_org + w_backoff * 2; pointparticles(particleeffectnum(EFFECT_HOOK_EXPLODE), org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, W_Sound("hookbomb_impact"), VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, SND_HOOKBOMB_IMPACT, VOL_BASE, ATTN_NORM); return true; } case WR_INIT: { - precache_sound(W_Sound("hookbomb_impact")); return true; } case WR_ZOOMRETICLE: diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index 01efced0f5..6db6d1633d 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -104,7 +104,7 @@ void W_MachineGun_MuzzleFlash(void) void W_MachineGun_Attack(int deathtype) {SELFPARAM(); - 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))); + W_SetupShot(self, true, 0, SND(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, W_Sound("uzi_fire"), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage)); + W_SetupShot(self, true, 0, SND(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) {SELFPARAM(); - W_SetupShot(self, true, 0, W_Sound("uzi_fire"), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage)); + W_SetupShot(self, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage)); if(!autocvar_g_norecoil) { self.punchangle_x = random() - 0.5; @@ -304,7 +304,6 @@ bool W_MachineGun(int req) } case WR_INIT: { - precache_sound(W_Sound("uzi_fire")); MACHINEGUN_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -347,7 +346,7 @@ bool W_MachineGun(int req) } case WR_RELOAD: { - W_Reload(min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), W_Sound("reload")); + W_Reload(min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND(RELOAD)); return true; } case WR_SUICIDEMESSAGE: @@ -377,19 +376,16 @@ bool W_MachineGun(int req) pointparticles(particleeffectnum(EFFECT_MACHINEGUN_IMPACT), org2, w_backoff * 1000, 1); if(!w_issilent) if(w_random < 0.05) - sound(self, CH_SHOTS, W_Sound("ric1"), VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, SND_RIC1, VOL_BASE, ATTN_NORM); else if(w_random < 0.1) - sound(self, CH_SHOTS, W_Sound("ric2"), VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, SND_RIC2, VOL_BASE, ATTN_NORM); else if(w_random < 0.2) - sound(self, CH_SHOTS, W_Sound("ric3"), VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, SND_RIC3, VOL_BASE, ATTN_NORM); return true; } case WR_INIT: { - precache_sound(W_Sound("ric1")); - precache_sound(W_Sound("ric2")); - precache_sound(W_Sound("ric3")); return true; } case WR_ZOOMRETICLE: diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index 1c7e89fde2..05dde98527 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -61,7 +61,7 @@ void spawnfunc_weapon_minelayer(void) { weapon_defaultspawnfunc(WEP_MINE_LAYER.m void W_MineLayer_Stick(entity to) {SELFPARAM(); - spamsound(self, CH_SHOTS, W_Sound("mine_stick"), VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, SND(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 @@ -221,7 +221,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, W_Sound("mine_trigger"), VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, SND(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. } @@ -244,7 +244,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, W_Sound("mine_trigger"), VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, SND(MINE_TRIGGER), VOL_BASE, ATTN_NORM); self.mine_time = time + WEP_CVAR(minelayer, time); } head = head.chain; @@ -316,14 +316,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, W_Sound("unavailable")); + play2(self, SND(UNAVAILABLE)); return; } } W_DecreaseAmmo(WEP_CVAR(minelayer, ammo)); - W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 5, W_Sound("mine_fire"), CH_WEAPON_A, WEP_CVAR(minelayer, damage)); + W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 5, SND(MINE_FIRE), CH_WEAPON_A, WEP_CVAR(minelayer, damage)); Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); mine = WarpZone_RefSys_SpawnSameRefSys(self); @@ -523,17 +523,13 @@ bool W_MineLayer(int req) if(self.BUTTON_ATCK2) { if(W_MineLayer_PlacedMines(true)) - sound(self, CH_WEAPON_B, W_Sound("mine_det"), VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_B, SND_MINE_DET, VOL_BASE, ATTN_NORM); } return true; } case WR_INIT: { - 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; } @@ -567,7 +563,7 @@ bool W_MineLayer(int req) } case WR_RELOAD: { - W_Reload(WEP_CVAR(minelayer, ammo), W_Sound("reload")); + W_Reload(WEP_CVAR(minelayer, ammo), SND(RELOAD)); return true; } case WR_SUICIDEMESSAGE: @@ -593,13 +589,12 @@ bool W_MineLayer(int req) org2 = w_org + w_backoff * 12; pointparticles(particleeffectnum(EFFECT_ROCKET_EXPLODE), org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, W_Sound("mine_exp"), VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, SND_MINE_EXP, VOL_BASE, ATTN_NORM); return true; } case WR_INIT: { - precache_sound(W_Sound("mine_exp")); return true; } case WR_ZOOMRETICLE: diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index d03eb8e565..665367fd78 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -137,27 +137,14 @@ void W_Mortar_Grenade_Touch1(void) } else if(WEP_CVAR_PRI(mortar, type) == 1) // bounce { - float r; - r = random() * 6; - if(r < 1) - spamsound(self, CH_SHOTS, W_Sound("grenade_bounce1"), VOL_BASE, ATTN_NORM); - else if(r < 2) - spamsound(self, CH_SHOTS, W_Sound("grenade_bounce2"), VOL_BASE, ATTN_NORM); - else if(r < 3) - spamsound(self, CH_SHOTS, W_Sound("grenade_bounce3"), VOL_BASE, ATTN_NORM); - else if(r < 4) - spamsound(self, CH_SHOTS, W_Sound("grenade_bounce4"), VOL_BASE, ATTN_NORM); - else if(r < 5) - spamsound(self, CH_SHOTS, W_Sound("grenade_bounce5"), VOL_BASE, ATTN_NORM); - else - spamsound(self, CH_SHOTS, W_Sound("grenade_bounce6"), VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, SND(GRENADE_BOUNCE_RANDOM()), VOL_BASE, ATTN_NORM); Send_Effect(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, W_Sound("grenade_stick"), VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, SND(GRENADE_STICK), VOL_BASE, ATTN_NORM); // let it stick whereever it is self.oldvelocity = self.velocity; @@ -182,20 +169,7 @@ void W_Mortar_Grenade_Touch2(void) } else if(WEP_CVAR_SEC(mortar, type) == 1) // bounce { - float r; - r = random() * 6; - if(r < 1) - spamsound(self, CH_SHOTS, W_Sound("grenade_bounce1"), VOL_BASE, ATTN_NORM); - else if(r < 2) - spamsound(self, CH_SHOTS, W_Sound("grenade_bounce2"), VOL_BASE, ATTN_NORM); - else if(r < 3) - spamsound(self, CH_SHOTS, W_Sound("grenade_bounce3"), VOL_BASE, ATTN_NORM); - else if(r < 4) - spamsound(self, CH_SHOTS, W_Sound("grenade_bounce4"), VOL_BASE, ATTN_NORM); - else if(r < 5) - spamsound(self, CH_SHOTS, W_Sound("grenade_bounce5"), VOL_BASE, ATTN_NORM); - else - spamsound(self, CH_SHOTS, W_Sound("grenade_bounce6"), VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, SND(GRENADE_BOUNCE_RANDOM()), VOL_BASE, ATTN_NORM); Send_Effect(EFFECT_HAGAR_BOUNCE, self.origin, self.velocity, 1); self.projectiledeathtype |= HITTYPE_BOUNCE; self.gl_bouncecnt += 1; @@ -206,7 +180,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, W_Sound("grenade_stick"), VOL_BASE, ATTN_NORM); + spamsound(self, CH_SHOTS, SND(GRENADE_STICK), VOL_BASE, ATTN_NORM); // let it stick whereever it is self.oldvelocity = self.velocity; @@ -228,7 +202,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, W_Sound("grenade_fire"), CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage)); + W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, SND(GRENADE_FIRE), CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage)); w_shotdir = v_forward; // no TrueAim for grenades please Send_Effect(EFFECT_GRENADE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); @@ -277,7 +251,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, W_Sound("grenade_fire"), CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage)); + W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, SND(GRENADE_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage)); w_shotdir = v_forward; // no TrueAim for grenades please Send_Effect(EFFECT_GRENADE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); @@ -392,7 +366,7 @@ bool W_Mortar(int req) } } if(nadefound) - sound(self, CH_WEAPON_B, W_Sound("rocket_det"), VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM); } else if(weapon_prepareattack(1, WEP_CVAR_SEC(mortar, refire))) { @@ -405,14 +379,6 @@ bool W_Mortar(int req) } case WR_INIT: { - 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; } @@ -435,7 +401,7 @@ bool W_Mortar(int req) } case WR_RELOAD: { - W_Reload(min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), W_Sound("reload")); // WEAPONTODO + W_Reload(min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND(RELOAD)); // WEAPONTODO return true; } case WR_SUICIDEMESSAGE: @@ -467,13 +433,12 @@ bool W_Mortar(int req) org2 = w_org + w_backoff * 12; pointparticles(particleeffectnum(EFFECT_GRENADE_EXPLODE), org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, W_Sound("grenade_impact"), VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, SND_GRENADE_IMPACT, VOL_BASE, ATTN_NORM); return true; } case WR_INIT: { - precache_sound(W_Sound("grenade_impact")); return true; } case WR_ZOOMRETICLE: diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index 58c28716ae..d764286b70 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -132,19 +132,19 @@ void W_Porto_Touch(void) if(self.realowner.playerid != self.playerid) { - sound(self, CH_SHOTS, "porto/unsupported.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); remove(self); } else if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK || trace_dphitcontents & DPCONTENTS_PLAYERCLIP) { - spamsound(self, CH_SHOTS, "porto/bounce.wav", VOL_BASE, ATTEN_NORM); + spamsound(self, CH_SHOTS, SND(PORTO_BOUNCE), VOL_BASE, ATTEN_NORM); // just reflect self.right_vector = self.right_vector - 2 * trace_plane_normal * (self.right_vector * trace_plane_normal); self.angles = vectoangles(self.velocity - 2 * trace_plane_normal * (self.velocity * trace_plane_normal)); } else if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) { - sound(self, CH_SHOTS, "porto/unsupported.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); W_Porto_Fail(0); if(self.cnt < 0) Portal_ClearAll_PortalsOnly(self.realowner); @@ -154,14 +154,14 @@ void W_Porto_Touch(void) // in-portal only if(Portal_SpawnInPortalAtTrace(self.realowner, self.right_vector, self.portal_id)) { - sound(self, CH_SHOTS, "porto/create.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_PORTO_CREATE, VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_IN); W_Porto_Success(); } else { - sound(self, CH_SHOTS, "porto/unsupported.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; W_Porto_Fail(0); } @@ -171,14 +171,14 @@ void W_Porto_Touch(void) // out-portal only if(Portal_SpawnOutPortalAtTrace(self.realowner, self.right_vector, self.portal_id)) { - sound(self, CH_SHOTS, "porto/create.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_PORTO_CREATE, VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_OUT); W_Porto_Success(); } else { - sound(self, CH_SHOTS, "porto/unsupported.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; W_Porto_Fail(0); } @@ -188,7 +188,7 @@ void W_Porto_Touch(void) self.effects += EF_BLUE - EF_RED; if(Portal_SpawnInPortalAtTrace(self.realowner, self.right_vector, self.portal_id)) { - sound(self, CH_SHOTS, "porto/create.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_PORTO_CREATE, VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_IN); self.right_vector = self.right_vector - 2 * trace_plane_normal * (self.right_vector * norm); @@ -197,7 +197,7 @@ void W_Porto_Touch(void) } else { - sound(self, CH_SHOTS, "porto/unsupported.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; Portal_ClearAll_PortalsOnly(self.realowner); W_Porto_Fail(0); @@ -209,21 +209,21 @@ void W_Porto_Touch(void) { if(Portal_SpawnOutPortalAtTrace(self.realowner, self.right_vector, self.portal_id)) { - sound(self, CH_SHOTS, "porto/create.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_PORTO_CREATE, VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_OUT); W_Porto_Success(); } else { - sound(self, CH_SHOTS, "porto/unsupported.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); Portal_ClearAll_PortalsOnly(self.realowner); W_Porto_Fail(0); } } else { - sound(self, CH_SHOTS, "porto/unsupported.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM); Portal_ClearAll_PortalsOnly(self.realowner); W_Porto_Fail(0); } @@ -234,7 +234,7 @@ void W_Porto_Attack(float type) {SELFPARAM(); entity gren; - W_SetupShot(self, false, 4, "porto/fire.wav", CH_WEAPON_A, 0); + W_SetupShot(self, false, 4, SND(PORTO_FIRE), CH_WEAPON_A, 0); // always shoot from the eye w_shotdir = v_forward; w_shotorg = self.origin + self.view_ofs + ((w_shotorg - self.origin - self.view_ofs) * v_forward) * v_forward; @@ -373,12 +373,6 @@ bool W_Porto(int req) } case WR_INIT: { - precache_sound("porto/bounce.wav"); - precache_sound("porto/create.wav"); - precache_sound("porto/expire.wav"); - precache_sound("porto/explode.wav"); - precache_sound("porto/fire.wav"); - precache_sound("porto/unsupported.wav"); PORTO_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } diff --git a/qcsrc/common/weapons/weapon/rifle.qc b/qcsrc/common/weapons/weapon/rifle.qc index 66be38175f..6d4a58f272 100644 --- a/qcsrc/common/weapons/weapon/rifle.qc +++ b/qcsrc/common/weapons/weapon/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), W_Sound("campingrifle_fire")); + 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), SND(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), W_Sound("campingrifle_fire2")); + 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), SND(CAMPINGRIFLE_FIRE2)); } .void(void) rifle_bullethail_attackfunc; @@ -204,8 +204,6 @@ bool W_Rifle(int req) } case WR_INIT: { - precache_sound(W_Sound("campingrifle_fire")); - precache_sound(W_Sound("campingrifle_fire2")); RIFLE_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -233,7 +231,7 @@ bool W_Rifle(int req) } case WR_RELOAD: { - W_Reload(min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), W_Sound("reload")); + W_Reload(min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND(RELOAD)); return true; } case WR_SUICIDEMESSAGE: @@ -274,20 +272,17 @@ bool W_Rifle(int req) if(!w_issilent) { if(w_random < 0.2) - sound(self, CH_SHOTS, W_Sound("ric1"), VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, SND_RIC1, VOL_BASE, ATTN_NORM); else if(w_random < 0.4) - sound(self, CH_SHOTS, W_Sound("ric2"), VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, SND_RIC2, VOL_BASE, ATTN_NORM); else if(w_random < 0.5) - sound(self, CH_SHOTS, W_Sound("ric3"), VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, SND_RIC3, VOL_BASE, ATTN_NORM); } return true; } case WR_INIT: { - precache_sound(W_Sound("ric1")); - precache_sound(W_Sound("ric2")); - precache_sound(W_Sound("ric3")); if(autocvar_cl_reticle && autocvar_cl_reticle_weapon) { precache_pic("gfx/reticle_nex"); diff --git a/qcsrc/common/weapons/weapon/rpc.qc b/qcsrc/common/weapons/weapon/rpc.qc index 51c0404405..5fe7552ccb 100644 --- a/qcsrc/common/weapons/weapon/rpc.qc +++ b/qcsrc/common/weapons/weapon/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, W_Sound("rocket_fire"), CH_WEAPON_A, WEP_CVAR(rpc, damage)); + W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', false, 5, SND(ROCKET_FIRE), CH_WEAPON_A, WEP_CVAR(rpc, damage)); Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); PROJECTILE_MAKETRIGGER(missile); @@ -182,7 +182,6 @@ bool W_RocketPropelledChainsaw(int req) } case WR_INIT: { - precache_sound (W_Sound("rocket_fire")); RPC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -203,7 +202,7 @@ bool W_RocketPropelledChainsaw(int req) } case WR_RELOAD: { - W_Reload(WEP_CVAR(rpc, ammo), W_Sound("reload")); + W_Reload(WEP_CVAR(rpc, ammo), SND(RELOAD)); return true; } case WR_SUICIDEMESSAGE: @@ -239,13 +238,12 @@ bool W_RocketPropelledChainsaw(int req) org2 = w_org + w_backoff * 12; pointparticles(particleeffectnum(EFFECT_ROCKET_EXPLODE), org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); return true; } case WR_INIT: { - precache_sound(W_Sound("rocket_impact")); return true; } case WR_ZOOMRETICLE: diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index 0687437afb..b79bb081e2 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/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, W_Sound("seeker_fire"), CH_WEAPON_A, 0); + W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND(SEEKER_FIRE), CH_WEAPON_A, 0); w_shotorg += f_diff; Send_Effect(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, W_Sound("flac_fire"), CH_WEAPON_A, WEP_CVAR(seeker, flac_damage)); + W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND(FLAC_FIRE), CH_WEAPON_A, WEP_CVAR(seeker, flac_damage)); w_shotorg += f_diff; Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); @@ -559,7 +559,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, W_Sound("tag_fire"), 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, SND(TAG_FIRE), CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count)); missile = spawn(); missile.owner = missile.realowner = self; @@ -662,9 +662,6 @@ bool W_Seeker(int req) } case WR_INIT: { - 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; } @@ -703,7 +700,7 @@ bool W_Seeker(int req) } case WR_RELOAD: { - W_Reload(min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), W_Sound("reload")); + W_Reload(min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND(RELOAD)); return true; } case WR_SUICIDEMESSAGE: @@ -735,7 +732,7 @@ bool W_Seeker(int req) if(w_deathtype & HITTYPE_SECONDARY) { if(!w_issilent) - sound(self, CH_SHOTS, W_Sound("tag_impact"), 1, ATTEN_NORM); + sound(self, CH_SHOTS, SND_TAG_IMPACT, 1, ATTEN_NORM); } else { @@ -743,11 +740,11 @@ bool W_Seeker(int req) if(!w_issilent) { if(w_random<0.15) - sound(self, CH_SHOTS, W_Sound("tagexp1"), 1, ATTEN_NORM); + sound(self, CH_SHOTS, SND_TAGEXP1, 1, ATTEN_NORM); else if(w_random<0.7) - sound(self, CH_SHOTS, W_Sound("tagexp2"), 1, ATTEN_NORM); + sound(self, CH_SHOTS, SND_TAGEXP2, 1, ATTEN_NORM); else - sound(self, CH_SHOTS, W_Sound("tagexp3"), 1, ATTEN_NORM); + sound(self, CH_SHOTS, SND_TAGEXP3, 1, ATTEN_NORM); } } } @@ -757,24 +754,17 @@ bool W_Seeker(int req) if(!w_issilent) { if(w_random<0.15) - sound(self, CH_SHOTS, W_Sound("seekerexp1"), 1, ATTEN_NORM); + sound(self, CH_SHOTS, SND_SEEKEREXP1, 1, ATTEN_NORM); else if(w_random<0.7) - sound(self, CH_SHOTS, W_Sound("seekerexp2"), 1, ATTEN_NORM); + sound(self, CH_SHOTS, SND_SEEKEREXP2, 1, ATTEN_NORM); else - sound(self, CH_SHOTS, W_Sound("seekerexp3"), 1, ATTEN_NORM); + sound(self, CH_SHOTS, SND_SEEKEREXP3, 1, ATTEN_NORM); } } return true; } case WR_INIT: { - precache_sound(W_Sound("seekerexp1")); - precache_sound(W_Sound("seekerexp2")); - precache_sound(W_Sound("seekerexp3")); - precache_sound(W_Sound("tagexp1")); - precache_sound(W_Sound("tagexp2")); - precache_sound(W_Sound("tagexp3")); - precache_sound(W_Sound("tag_impact")); return true; } case WR_ZOOMRETICLE: diff --git a/qcsrc/common/weapons/weapon/shockwave.qc b/qcsrc/common/weapons/weapon/shockwave.qc index b56a41fbbf..0ef52fbd9d 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -229,7 +229,7 @@ void W_Shockwave_Melee_Think(void) void W_Shockwave_Melee(void) {SELFPARAM(); - sound(self, CH_WEAPON_A, W_Sound("shotgun_melee"), VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_A, SND_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, W_Sound("lasergun_fire"), CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage)); + W_SetupShot(self, false, 3, SND(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; @@ -708,9 +708,6 @@ bool W_Shockwave(int req) } case WR_INIT: { - precache_sound("misc/itempickup.wav"); - precache_sound(W_Sound("lasergun_fire")); - precache_sound(W_Sound("shotgun_melee")); SHOCKWAVE_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -875,9 +872,6 @@ bool W_Shockwave(int req) } case WR_INIT: { - //precache_sound(W_Sound("ric1")); - //precache_sound(W_Sound("ric2")); - //precache_sound(W_Sound("ric3")); return false; } case WR_ZOOMRETICLE: diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index 814d573036..9a8d9d0db7 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -61,7 +61,7 @@ void W_Shotgun_Attack(float isprimary) W_DecreaseAmmo(WEP_CVAR_PRI(shotgun, ammo)); - 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)); + W_SetupShot(self, true, 5, SND(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) {SELFPARAM(); - sound(self, CH_WEAPON_A, W_Sound("shotgun_melee"), VOL_BASE, ATTEN_NORM); + sound(self, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTEN_NORM); weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(shotgun, animtime), w_ready); entity meleetemp; @@ -203,7 +203,7 @@ void W_Shotgun_Attack3_Frame2() return; } - sound(self, CH_WEAPON_SINGLE, "misc/null.wav", VOL_BASE, ATTN_NORM); // kill previous sound + sound(self, CH_WEAPON_SINGLE, SND_Null, VOL_BASE, ATTN_NORM); // kill previous sound W_Shotgun_Attack(true); // actually is secondary, but we trick the last shot into playing full reload sound weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), w_ready); } @@ -286,9 +286,6 @@ float W_Shotgun(float req) } case WR_INIT: { - precache_sound("misc/itempickup.wav"); - precache_sound(W_Sound("shotgun_fire")); - precache_sound(W_Sound("shotgun_melee")); SHOTGUN_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); return true; } @@ -327,7 +324,7 @@ float W_Shotgun(float req) } case WR_RELOAD: { - W_Reload(WEP_CVAR_PRI(shotgun, ammo), W_Sound("reload")); // WEAPONTODO + W_Reload(WEP_CVAR_PRI(shotgun, ammo), SND(RELOAD)); // WEAPONTODO return true; } case WR_SUICIDEMESSAGE: @@ -359,11 +356,11 @@ float W_Shotgun(float req) if(!w_issilent && time - self.prevric > 0.25) { if(w_random < 0.0165) - sound(self, CH_SHOTS, W_Sound("ric1"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_RIC1, VOL_BASE, ATTEN_NORM); else if(w_random < 0.033) - sound(self, CH_SHOTS, W_Sound("ric2"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_RIC2, VOL_BASE, ATTEN_NORM); else if(w_random < 0.05) - sound(self, CH_SHOTS, W_Sound("ric3"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_RIC3, VOL_BASE, ATTEN_NORM); self.prevric = time; } @@ -371,9 +368,6 @@ float W_Shotgun(float req) } case WR_INIT: { - precache_sound(W_Sound("ric1")); - precache_sound(W_Sound("ric2")); - precache_sound(W_Sound("ric3")); return true; } case WR_ZOOMRETICLE: diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 13c3fef8c6..2abddeace2 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -77,7 +77,7 @@ void W_Vaporizer_Attack(void) W_SetupShot(self, true, 0, "", CH_WEAPON_A, vaporizer_damage); // 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, W_Sound("minstanexfire"), VOL_BASE * 0.8, ATTEN_NORM); + sound (self, CH_WEAPON_A, SND_MINSTANEXFIRE, VOL_BASE * 0.8, ATTEN_NORM); yoda = 0; damage_goodhits = 0; @@ -174,7 +174,7 @@ void W_RocketMinsta_Attack2(void) float w = self.weapon; self.weapon = WEP_ELECTRO.m_id; - W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, W_Sound("crylink_fire"), CH_WEAPON_A, autocvar_g_rm_laser_damage); + W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND(CRYLINK_FIRE), CH_WEAPON_A, autocvar_g_rm_laser_damage); self.weapon = w; Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); @@ -227,7 +227,7 @@ void W_RocketMinsta_Attack3 (void) int w = self.weapon; self.weapon = WEP_ELECTRO.m_id; - W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, W_Sound("electro_fire2"), CH_WEAPON_A, autocvar_g_rm_laser_damage); + W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND(ELECTRO_FIRE2), CH_WEAPON_A, autocvar_g_rm_laser_damage); self.weapon = w; Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); @@ -362,10 +362,6 @@ float W_Vaporizer(float req) } case WR_INIT: { - 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; @@ -408,7 +404,7 @@ float W_Vaporizer(float req) else used_ammo = vaporizer_ammo; - W_Reload(used_ammo, W_Sound("reload")); + W_Reload(used_ammo, SND(RELOAD)); return true; } case WR_SUICIDEMESSAGE: @@ -434,19 +430,17 @@ float W_Vaporizer(float req) if(w_deathtype & HITTYPE_SECONDARY) { pointparticles(particleeffectnum(EFFECT_BLASTER_IMPACT), org2, w_backoff * 1000, 1); - if(!w_issilent) { sound(self, CH_SHOTS, W_Sound("laserimpact"), VOL_BASE, ATTN_NORM); } + if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); } } else { pointparticles(particleeffectnum(EFFECT_VORTEX_IMPACT), org2, '0 0 0', 1); - if(!w_issilent) { sound(self, CH_SHOTS, W_Sound("neximpact"), VOL_BASE, ATTN_NORM); } + if(!w_issilent) { sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM); } } return true; } case WR_INIT: { - precache_sound(W_Sound("laserimpact")); - precache_sound(W_Sound("neximpact")); if(autocvar_cl_reticle && autocvar_cl_reticle_weapon) { precache_pic("gfx/reticle_nex"); diff --git a/qcsrc/common/weapons/weapon/vortex.qc b/qcsrc/common/weapons/weapon/vortex.qc index 2e515137c5..8584b8ab91 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -103,10 +103,10 @@ void W_Vortex_Attack(float issecondary) mydmg *= charge; myforce *= charge; - W_SetupShot(self, true, 5, W_Sound("nexfire"), CH_WEAPON_A, mydmg); + W_SetupShot(self, true, 5, SND(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, W_Sound("nexcharge"), 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, SND_NEXCHARGE, VOL_BASE * (charge - 0.5 * WEP_CVAR(vortex, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(vortex, charge_animlimit)), ATTN_NORM); } yoda = 0; @@ -253,11 +253,6 @@ bool W_Vortex(int req) } case WR_INIT: { - 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; } @@ -298,7 +293,7 @@ bool W_Vortex(int req) } case WR_RELOAD: { - W_Reload(min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), W_Sound("reload")); + W_Reload(min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND(RELOAD)); return true; } case WR_SUICIDEMESSAGE: @@ -325,13 +320,12 @@ bool W_Vortex(int req) org2 = w_org + w_backoff * 6; pointparticles(particleeffectnum(EFFECT_VORTEX_IMPACT), org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, W_Sound("neximpact"), VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM); return true; } case WR_INIT: { - precache_sound(W_Sound("neximpact")); if(autocvar_cl_reticle && autocvar_cl_reticle_weapon) { precache_pic("gfx/reticle_nex"); diff --git a/qcsrc/lib/_all.inc b/qcsrc/lib/_all.inc index 668e7decd6..cda9b3a880 100644 --- a/qcsrc/lib/_all.inc +++ b/qcsrc/lib/_all.inc @@ -7,6 +7,7 @@ #include "cvar.qh" #include "defer.qh" #include "draw.qh" +#include "file.qh" #include "i18n.qh" #include "lazy.qh" #include "log.qh" diff --git a/qcsrc/lib/file.qh b/qcsrc/lib/file.qh new file mode 100644 index 0000000000..f732bfe2c1 --- /dev/null +++ b/qcsrc/lib/file.qh @@ -0,0 +1,13 @@ +#ifndef FILE_H +#define FILE_H + +bool fexists(string f) +{ + int fh = fopen(f, FILE_READ); + if (fh < 0) + return false; + fclose(fh); + return true; +} + +#endif diff --git a/qcsrc/server/_all.qh b/qcsrc/server/_all.qh index 9d7617e006..d3771bafc8 100644 --- a/qcsrc/server/_all.qh +++ b/qcsrc/server/_all.qh @@ -10,5 +10,6 @@ #include "../dpdefs/dpextensions.qh" #include "../common/models/models.qh" +#include "../common/sounds/sounds.qh" #endif diff --git a/qcsrc/server/bot/scripting.qc b/qcsrc/server/bot/scripting.qc index 46193160da..72951cd662 100644 --- a/qcsrc/server/bot/scripting.qc +++ b/qcsrc/server/bot/scripting.qc @@ -1050,7 +1050,7 @@ float bot_cmd_sound() atten = stof(argv(2)); precache_sound(f); - sound(self, chan, sample, vol, atten); + _sound(self, chan, sample, vol, atten); return CMD_STATUS_FINISHED; } diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 26af000d2d..361afadee6 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -283,7 +283,7 @@ float CheatImpulse(float i) e = self; Send_Effect(EFFECT_ROCKET_EXPLODE, e.origin, '0 0 0', 1); - sound(e, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound(e, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); e2 = spawn(); setorigin(e2, e.origin); diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index bd9c46a9b0..c46da27f7f 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -1447,7 +1447,7 @@ void play_countdown(float finished, string samp) if(IS_REAL_CLIENT(self)) if(floor(finished - time - frametime) != floor(finished - time)) if(finished - time < 6) - sound (self, CH_INFO, samp, VOL_BASE, ATTEN_NORM); + _sound (self, CH_INFO, samp, VOL_BASE, ATTEN_NORM); } void player_powerups (void) @@ -1472,7 +1472,7 @@ void player_powerups (void) { if (self.items & ITEM_Strength.m_itemid) { - play_countdown(self.strength_finished, "misc/poweroff.wav"); + play_countdown(self.strength_finished, SND(POWEROFF)); self.effects = self.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT); if (time > self.strength_finished) { @@ -1492,7 +1492,7 @@ void player_powerups (void) } if (self.items & ITEM_Shield.m_itemid) { - play_countdown(self.invincible_finished, "misc/poweroff.wav"); + play_countdown(self.invincible_finished, SND(POWEROFF)); self.effects = self.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT); if (time > self.invincible_finished) { @@ -1525,7 +1525,7 @@ void player_powerups (void) } else { - play_countdown(self.superweapons_finished, "misc/poweroff.wav"); + play_countdown(self.superweapons_finished, SND(POWEROFF)); if (time > self.superweapons_finished) { self.items = self.items - (self.items & IT_SUPERWEAPON); diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index f7f3c03b72..182c330411 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -182,11 +182,11 @@ void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, int de if(sound_allowed(MSG_BROADCAST, attacker)) { if (save > 10) - sound (self, CH_SHOTS, "misc/armorimpact.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS, SND_ARMORIMPACT, VOL_BASE, ATTEN_NORM); else if (take > 30) - sound (self, CH_SHOTS, "misc/bodyimpact2.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS, SND_BODYIMPACT2, VOL_BASE, ATTEN_NORM); else if (take > 10) - sound (self, CH_SHOTS, "misc/bodyimpact1.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS, SND_BODYIMPACT1, VOL_BASE, ATTEN_NORM); } if (take > 50) @@ -395,11 +395,11 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp if(sound_allowed(MSG_BROADCAST, attacker)) { if (save > 10) - sound (self, CH_SHOTS, "misc/armorimpact.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS, SND_ARMORIMPACT, VOL_BASE, ATTEN_NORM); else if (take > 30) - sound (self, CH_SHOTS, "misc/bodyimpact2.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS, SND_BODYIMPACT2, VOL_BASE, ATTEN_NORM); else if (take > 10) - sound (self, CH_SHOTS, "misc/bodyimpact1.wav", VOL_BASE, ATTEN_NORM); // FIXME possibly remove them? + sound (self, CH_SHOTS, SND_BODYIMPACT1, VOL_BASE, ATTEN_NORM); // FIXME possibly remove them? } if (take > 50) @@ -1225,7 +1225,7 @@ void GlobalSound(string sample, float chan, float voicetype) } break; case VOICETYPE_PLAYERSOUND: - sound(self, chan, sample, VOL_BASE, ATTEN_NORM); + _sound(self, chan, sample, VOL_BASE, ATTEN_NORM); break; default: backtrace("Invalid voice type!"); diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 5072e49002..02e80845b7 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -147,7 +147,9 @@ const float MAX_DAMAGEEXTRARADIUS = 16; .float pauserothealth_finished; .float pauserotarmor_finished; .float pauserotfuel_finished; +// string overrides entity .string item_pickupsound; +.entity item_pickupsound_ent; // definitions for weaponsystem // more WEAPONTODO: move these to their proper files diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index 6a95a61fe0..779ec90c99 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -91,7 +91,7 @@ void GrapplingHookThink(); void GrapplingHook_Stop() {SELFPARAM(); Send_Effect(EFFECT_HOOK_IMPACT, self.origin, '0 0 0', 1); - sound (self, CH_SHOTS, W_Sound("hook_impact"), VOL_BASE, ATTEN_NORM); + sound (self, CH_SHOTS, SND_HOOK_IMPACT, VOL_BASE, ATTEN_NORM); self.state = 1; self.think = GrapplingHookThink; @@ -357,7 +357,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, W_Sound("hook_fire"), VOL_BASE, ATTEN_NORM); + sound (self, CH_WEAPON_B, SND_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/item_key.qc b/qcsrc/server/item_key.qc index 6a1527745e..780607871f 100644 --- a/qcsrc/server/item_key.qc +++ b/qcsrc/server/item_key.qc @@ -234,7 +234,7 @@ void spawnfunc_item_key() self.message = strzone(strcat("You've picked up the ", self.netname, "!")); if (self.noise == "") - self.noise = "misc/itempickup.wav"; + self.noise = SND(ITEMPICKUP); // save the name for later item_keys_names[lowestbit(self.itemkeys)] = self.netname; diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index eb8277abc2..bcba19e30a 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -764,14 +764,6 @@ float sound_allowed(float destin, entity e) return true; } -#undef sound -void sound(entity e, float chan, string samp, float vol, float attenu) -{ - if (!sound_allowed(MSG_BROADCAST, e)) - return; - sound7(e, chan, samp, vol, attenu, 0, 0); -} - void soundtoat(float _dest, entity e, vector o, float chan, string samp, float vol, float attenu) { float entno, idx; @@ -847,7 +839,7 @@ void stopsoundto(float _dest, entity e, float chan) if (entno >= 8192 || chan < 0 || chan > 7) { float idx, sflags; - idx = precache_sound_index("misc/null.wav"); + idx = precache_sound_index(SND(Null)); sflags = SND_LARGEENTITY; if (idx >= 256) sflags |= SND_LARGESOUND; @@ -895,7 +887,7 @@ float spamsound(entity e, float chan, string samp, float vol, float _atten) if (time > e.spamtime) { e.spamtime = time; - sound(e, chan, samp, vol, _atten); + _sound(e, chan, samp, vol, _atten); return true; } return false; @@ -920,7 +912,7 @@ void play2all(string samp) if (autocvar_bot_sound_monopoly) return; - sound(world, CH_INFO, samp, VOL_BASE, ATTEN_NONE); + _sound(world, CH_INFO, samp, VOL_BASE, ATTEN_NONE); } void PrecachePlayerSounds(string f); @@ -1013,36 +1005,8 @@ void precache() } // gore and miscellaneous sounds - //precache_sound ("misc/h2ohit.wav"); - precache_sound ("misc/armorimpact.wav"); - precache_sound ("misc/bodyimpact1.wav"); - precache_sound ("misc/bodyimpact2.wav"); - precache_sound ("misc/gib.wav"); - precache_sound ("misc/gib_splat01.wav"); - precache_sound ("misc/gib_splat02.wav"); - precache_sound ("misc/gib_splat03.wav"); - precache_sound ("misc/gib_splat04.wav"); PrecacheGlobalSound((globalsound_fall = "misc/hitground 4")); PrecacheGlobalSound((globalsound_metalfall = "misc/metalhitground 4")); - precache_sound ("misc/null.wav"); - precache_sound ("misc/spawn.wav"); - precache_sound ("misc/talk.wav"); - precache_sound ("misc/teleport.wav"); - precache_sound ("misc/poweroff.wav"); - precache_sound ("player/lava.wav"); - precache_sound ("player/slime.wav"); - - // common weapon precaches - 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 (W_Sound("hook_fire")); // hook - precache_sound (W_Sound("hook_impact")); // hook - } #if 0 // Disabled this code because it simply does not work (e.g. ignores bgmvolume, overlaps with "cd loop" controlled tracks). @@ -1057,8 +1021,6 @@ void precache() ambientsound ('0 0 0', self.noise, VOL_BASE, ATTEN_NONE); } #endif - -#include "precache-for-csqc.inc" } diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 060752c111..988534e2b3 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -239,7 +239,7 @@ void ctf_Handle_Drop(entity flag, entity player, int droptype) // messages and sounds Send_Notification(NOTIF_ALL, world, MSG_INFO, ((flag.team) ? APP_TEAM_ENT_4(flag, INFO_CTF_LOST_) : INFO_CTF_LOST_NEUTRAL), player.netname); - sound(flag, CH_TRIGGER, flag.snd_flag_dropped, VOL_BASE, ATTEN_NONE); + _sound(flag, CH_TRIGGER, flag.snd_flag_dropped, VOL_BASE, ATTEN_NONE); ctf_EventLog("dropped", player.team, player); // scoring @@ -296,7 +296,7 @@ void ctf_Handle_Retrieve(entity flag, entity player) flag.ctf_status = FLAG_CARRY; // messages and sounds - sound(player, CH_TRIGGER, flag.snd_flag_pass, VOL_BASE, ATTEN_NORM); + _sound(player, CH_TRIGGER, flag.snd_flag_pass, VOL_BASE, ATTEN_NORM); ctf_EventLog("receive", flag.team, player); FOR_EACH_REALPLAYER(tmp_player) @@ -363,7 +363,7 @@ void ctf_Handle_Throw(entity player, entity receiver, int droptype) flag.ctf_status = FLAG_PASSING; // other - sound(player, CH_TRIGGER, flag.snd_flag_touch, VOL_BASE, ATTEN_NORM); + _sound(player, CH_TRIGGER, flag.snd_flag_touch, VOL_BASE, ATTEN_NORM); WarpZone_TrailParticles(world, _particleeffectnum(flag.passeffect), player.origin, targ_origin); ctf_EventLog("pass", flag.team, player); break; @@ -436,7 +436,7 @@ void ctf_Handle_Capture(entity flag, entity toucher, int capturetype) // messages and sounds Send_Notification(NOTIF_ONE, player, MSG_CENTER, ((enemy_flag.team) ? APP_TEAM_ENT_4(enemy_flag, CENTER_CTF_CAPTURE_) : CENTER_CTF_CAPTURE_NEUTRAL)); ctf_CaptureRecord(enemy_flag, player); - sound(player, CH_TRIGGER, ((ctf_oneflag) ? player_team_flag.snd_flag_capture : ((DIFF_TEAM(player, flag)) ? enemy_flag.snd_flag_capture : flag.snd_flag_capture)), VOL_BASE, ATTEN_NONE); + _sound(player, CH_TRIGGER, ((ctf_oneflag) ? player_team_flag.snd_flag_capture : ((DIFF_TEAM(player, flag)) ? enemy_flag.snd_flag_capture : flag.snd_flag_capture)), VOL_BASE, ATTEN_NONE); switch(capturetype) { @@ -485,7 +485,7 @@ void ctf_Handle_Return(entity flag, entity player) Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT_4(flag, CENTER_CTF_RETURN_)); Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_RETURN_), player.netname); } - sound(player, CH_TRIGGER, flag.snd_flag_returned, VOL_BASE, ATTEN_NONE); + _sound(player, CH_TRIGGER, flag.snd_flag_returned, VOL_BASE, ATTEN_NONE); ctf_EventLog("return", flag.team, player); // scoring @@ -573,7 +573,7 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype) else Send_Notification(NOTIF_ONE, tmp_entity, MSG_CHOICE, ((SAME_TEAM(flag, player)) ? CHOICE_CTF_PICKUP_ENEMY_TEAM : CHOICE_CTF_PICKUP_ENEMY), Team_ColorCode(player.team), player.netname); - sound(player, CH_TRIGGER, flag.snd_flag_taken, VOL_BASE, ATTEN_NONE); + _sound(player, CH_TRIGGER, flag.snd_flag_taken, VOL_BASE, ATTEN_NONE); // scoring PlayerScore_Add(player, SP_CTF_PICKUPS, 1); @@ -641,7 +641,7 @@ void ctf_CheckFlagReturn(entity flag, int returntype) case RETURN_TIMEOUT: { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((flag.team) ? APP_TEAM_ENT_4(flag, INFO_CTF_FLAGRETURN_TIMEOUT_) : INFO_CTF_FLAGRETURN_TIMEOUT_NEUTRAL)); break; } } - sound(flag, CH_TRIGGER, flag.snd_flag_respawn, VOL_BASE, ATTEN_NONE); + _sound(flag, CH_TRIGGER, flag.snd_flag_respawn, VOL_BASE, ATTEN_NONE); ctf_EventLog("returned", flag.team, world); ctf_RespawnFlag(flag); } @@ -941,7 +941,7 @@ void ctf_FlagTouch() if(time > self.wait) // if we haven't in a while, play a sound/effect { Send_Effect_(self.toucheffect, self.origin, '0 0 0', 1); - sound(self, CH_TRIGGER, self.snd_flag_touch, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER, self.snd_flag_touch, VOL_BASE, ATTEN_NORM); self.wait = time + FLAG_TOUCHRATE; } return; @@ -1133,22 +1133,18 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e set_flag_string(flag, capeffect, "%s_cap", teamname); // sounds - set_flag_string(flag, snd_flag_taken, "ctf/%s_taken.wav", teamname); - set_flag_string(flag, snd_flag_returned, "ctf/%s_returned.wav", teamname); - set_flag_string(flag, snd_flag_capture, "ctf/%s_capture.wav", teamname); - set_flag_string(flag, snd_flag_dropped, "ctf/%s_dropped.wav", teamname); - if(flag.snd_flag_respawn == "") { flag.snd_flag_respawn = "ctf/flag_respawn.wav"; } // if there is ever a team-based sound for this, update the code to match. - if(flag.snd_flag_touch == "") { flag.snd_flag_touch = "ctf/touch.wav"; } // again has no team-based sound - if(flag.snd_flag_pass == "") { flag.snd_flag_pass = "ctf/pass.wav"; } // same story here - - // precache - precache_sound(flag.snd_flag_taken); - precache_sound(flag.snd_flag_returned); - precache_sound(flag.snd_flag_capture); + flag.snd_flag_taken = SND(CTF_TAKEN(teamname)); + flag.snd_flag_returned = SND(CTF_RETURNED(teamname)); + flag.snd_flag_capture = SND(CTF_CAPTURE(teamname)); + flag.snd_flag_dropped = SND(CTF_DROPPED(teamname)); + if (flag.snd_flag_respawn == "") flag.snd_flag_respawn = SND(CTF_RESPAWN); // if there is ever a team-based sound for this, update the code to match. precache_sound(flag.snd_flag_respawn); - precache_sound(flag.snd_flag_dropped); + if (flag.snd_flag_touch == "") flag.snd_flag_touch = SND(CTF_TOUCH); // again has no team-based sound precache_sound(flag.snd_flag_touch); + if (flag.snd_flag_pass == "") flag.snd_flag_pass = SND(CTF_PASS); // same story here precache_sound(flag.snd_flag_pass); + + // precache precache_model(flag.model); // appearence diff --git a/qcsrc/server/mutators/gamemode_domination.qc b/qcsrc/server/mutators/gamemode_domination.qc index 6fa778309f..66f4c8da31 100644 --- a/qcsrc/server/mutators/gamemode_domination.qc +++ b/qcsrc/server/mutators/gamemode_domination.qc @@ -61,9 +61,9 @@ void dompoint_captured () if (head.noise != "") if(self.enemy) - sound(self.enemy, CH_TRIGGER, head.noise, VOL_BASE, ATTEN_NORM); + _sound(self.enemy, CH_TRIGGER, head.noise, VOL_BASE, ATTEN_NORM); else - sound(self, CH_TRIGGER, head.noise, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER, head.noise, VOL_BASE, ATTEN_NORM); if (head.noise1 != "") play2all(head.noise1); @@ -581,12 +581,12 @@ void dom_spawnpoint(vector org) // spawn some default teams if the map is not set up for domination void dom_spawnteams(float teams) { - dom_spawnteam("Red", NUM_TEAM_1-1, "models/domination/dom_red.md3", 0, "domination/claim.wav", "", "Red team has captured a control point"); - dom_spawnteam("Blue", NUM_TEAM_2-1, "models/domination/dom_blue.md3", 0, "domination/claim.wav", "", "Blue team has captured a control point"); + dom_spawnteam("Red", NUM_TEAM_1-1, "models/domination/dom_red.md3", 0, SND(DOM_CLAIM), "", "Red team has captured a control point"); + dom_spawnteam("Blue", NUM_TEAM_2-1, "models/domination/dom_blue.md3", 0, SND(DOM_CLAIM), "", "Blue team has captured a control point"); if(teams >= 3) - dom_spawnteam("Yellow", NUM_TEAM_3-1, "models/domination/dom_yellow.md3", 0, "domination/claim.wav", "", "Yellow team has captured a control point"); + dom_spawnteam("Yellow", NUM_TEAM_3-1, "models/domination/dom_yellow.md3", 0, SND(DOM_CLAIM), "", "Yellow team has captured a control point"); if(teams >= 4) - dom_spawnteam("Pink", NUM_TEAM_4-1, "models/domination/dom_pink.md3", 0, "domination/claim.wav", "", "Pink team has captured a control point"); + dom_spawnteam("Pink", NUM_TEAM_4-1, "models/domination/dom_pink.md3", 0, SND(DOM_CLAIM), "", "Pink team has captured a control point"); dom_spawnteam("", 0, "models/domination/dom_unclaimed.md3", 0, "", "", ""); } @@ -622,8 +622,6 @@ void dom_DelayedInit() // Do this check with a delay so we can wait for teams to void dom_Initialize() { - precache_sound("domination/claim.wav"); - InitializeEntity(world, dom_DelayedInit, INITPRIO_GAMETYPE); } diff --git a/qcsrc/server/mutators/gamemode_keepaway.qc b/qcsrc/server/mutators/gamemode_keepaway.qc index 6d7c8c9901..b265e41d3d 100644 --- a/qcsrc/server/mutators/gamemode_keepaway.qc +++ b/qcsrc/server/mutators/gamemode_keepaway.qc @@ -53,7 +53,7 @@ void ka_RespawnBall() // runs whenever the ball needs to be relocated WaypointSprite_Spawn(WP_KaBall, 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER); WaypointSprite_Ping(self.waypointsprite_attachedforcarrier); - sound(self, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere) + sound(self, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere) } void ka_TimeScoring() @@ -82,7 +82,7 @@ void ka_TouchEvent() // runs any time that the ball comes in contact with someth if (!IS_PLAYER(other)) { // The ball just touched an object, most likely the world Send_Effect(EFFECT_BALL_SPARKS, self.origin, '0 0 0', 1); - sound(self, CH_TRIGGER, "keepaway/touch.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_TRIGGER, SND_KA_TOUCH, VOL_BASE, ATTEN_NORM); return; } else if(self.wait > time) { return; } @@ -112,7 +112,7 @@ void ka_TouchEvent() // runs any time that the ball comes in contact with someth Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_KEEPAWAY_PICKUP, other.netname); Send_Notification(NOTIF_ALL_EXCEPT, other, MSG_CENTER, CENTER_KEEPAWAY_PICKUP, other.netname); Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_KEEPAWAY_PICKUP_SELF); - sound(self.owner, CH_TRIGGER, "keepaway/pickedup.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere) + sound(self.owner, CH_TRIGGER, SND_KA_PICKEDUP, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere) // scoring PlayerScore_Add(other, SP_KEEPAWAY_PICKUPS, 1); @@ -154,7 +154,7 @@ void ka_DropEvent(entity plyr) // runs any time that a player is supposed to los ka_EventLog("dropped", plyr); Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_KEEPAWAY_DROPPED, plyr.netname); Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_KEEPAWAY_DROPPED, plyr.netname); - sound(other, CH_TRIGGER, "keepaway/dropped.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere) + sound(other, CH_TRIGGER, SND_KA_DROPPED, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere) // scoring // PlayerScore_Add(plyr, SP_KEEPAWAY_DROPS, 1); Not anymore, this is 100% the same as pickups and is useless. @@ -428,11 +428,6 @@ void ka_Initialize() // run at the start of a match, initiates game mode if(!g_keepaway) return; - precache_sound("keepaway/pickedup.wav"); - precache_sound("keepaway/dropped.wav"); - precache_sound("keepaway/respawn.wav"); - precache_sound("keepaway/touch.wav"); - ka_ScoreRules(); ka_SpawnBall(); } diff --git a/qcsrc/server/mutators/gamemode_keyhunt.qc b/qcsrc/server/mutators/gamemode_keyhunt.qc index 56e55d86d9..c02b42513b 100644 --- a/qcsrc/server/mutators/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/gamemode_keyhunt.qc @@ -63,12 +63,6 @@ float kh_interferemsg_time, kh_interferemsg_team; .float kh_previous_owner_playerid; .float kh_cp_duration; -string kh_sound_capture = "kh/capture.wav"; -string kh_sound_destroy = "kh/destroy.wav"; -string kh_sound_drop = "kh/drop.wav"; -string kh_sound_collect = "kh/collect.wav"; -string kh_sound_alarm = "kh/alarm.wav"; // the new siren/alarm - float kh_key_dropped, kh_key_carried; const float ST_KH_CAPS = 1; @@ -430,7 +424,7 @@ void kh_Key_Damage(entity inflictor, entity attacker, float damage, int deathtyp void kh_Key_Collect(entity key, entity player) //a player picks up a dropped key { - sound(player, CH_TRIGGER, kh_sound_collect, VOL_BASE, ATTEN_NORM); + sound(player, CH_TRIGGER, SND_KH_COLLECT, VOL_BASE, ATTEN_NORM); if(key.kh_dropperteam != player.team) { @@ -575,7 +569,7 @@ void kh_WinnerTeam(float teem) // runs when a team wins // Samual: Teem?.... TE midpoint = midpoint * (1 / kh_teams); te_customflash(midpoint, 1000, 1, Team_ColorRGB(teem) * 0.5 + '0.5 0.5 0.5'); // make the color >=0.5 in each component - play2all(kh_sound_capture); + play2all(SND(KH_CAPTURE)); kh_FinishRound(); } @@ -664,7 +658,7 @@ void kh_LoserTeam(float teem, entity lostkey) // runs when a player pushes a fl Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(lostkey, INFO_KEYHUNT_LOST_), lostkey.kh_previous_owner.netname); - play2all(kh_sound_destroy); + play2all(SND(KH_DESTROY)); te_tarexplosion(lostkey.origin); kh_FinishRound(); @@ -696,7 +690,7 @@ void kh_Key_Think() // runs all the time { if(self.siren_time < time) { - sound(self.owner, CH_TRIGGER, kh_sound_alarm, VOL_BASE, ATTEN_NORM); // play a simple alarm + sound(self.owner, CH_TRIGGER, SND_KH_ALARM, VOL_BASE, ATTEN_NORM); // play a simple alarm self.siren_time = time + 2.5; // repeat every 2.5 seconds } @@ -832,7 +826,7 @@ void kh_Key_DropOne(entity key) key.pushltime = time + autocvar_g_balance_keyhunt_protecttime; key.kh_dropperteam = key.team; - sound(player, CH_TRIGGER, kh_sound_drop, VOL_BASE, ATTEN_NORM); + sound(player, CH_TRIGGER, SND_KH_DROP, VOL_BASE, ATTEN_NORM); } void kh_Key_DropAll(entity player, float suicide) // runs whenever a player dies @@ -858,7 +852,7 @@ void kh_Key_DropAll(entity player, float suicide) // runs whenever a player dies if(suicide) key.kh_dropperteam = player.team; } - sound(player, CH_TRIGGER, kh_sound_drop, VOL_BASE, ATTEN_NORM); + sound(player, CH_TRIGGER, SND_KH_DROP, VOL_BASE, ATTEN_NORM); } } @@ -1003,12 +997,6 @@ float kh_HandleFrags(entity attacker, entity targ, float f) // adds to the play void kh_Initialize() // sets up th KH environment { - precache_sound(kh_sound_capture); - precache_sound(kh_sound_destroy); - precache_sound(kh_sound_drop); - precache_sound(kh_sound_collect); - precache_sound(kh_sound_alarm); // the new siren - // setup variables kh_teams = autocvar_g_keyhunt_teams_override; if(kh_teams < 2) diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index e3480a42e0..a318748fda 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -207,7 +207,7 @@ void InitBall(void) self.teamtime = 0; self.pusher = world; self.team = false; - sound(self, CH_TRIGGER, self.noise1, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER, self.noise1, VOL_BASE, ATTEN_NORM); WaypointSprite_Ping(self.waypointsprite_attachedforcarrier); LogNB("init", world); } @@ -254,7 +254,7 @@ void football_touch(void) { if(time > self.lastground + 0.1) { - sound(self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); self.lastground = time; } if(vlen(self.velocity) && !self.cnt) @@ -310,7 +310,7 @@ void basketball_touch(void) } else if(other.solid == SOLID_BSP) { - sound(self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); if(vlen(self.velocity) && !self.cnt) self.nextthink = min(time + autocvar_g_nexball_delay_idle, self.teamtime); } @@ -376,7 +376,7 @@ void GoalTouch(void) pscore = 1; } - sound(ball, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NONE); + _sound(ball, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NONE); if(ball.team && pscore) { @@ -515,13 +515,13 @@ void SpawnBall(void) if(!autocvar_g_nexball_sound_bounce) self.noise = ""; else if(self.noise == "") - self.noise = "sound/nexball/bounce.wav"; + self.noise = SND(NB_BOUNCE); //bounce sound placeholder (FIXME) if(self.noise1 == "") - self.noise1 = "sound/nexball/drop.wav"; + self.noise1 = SND(NB_DROP); //ball drop sound placeholder (FIXME) if(self.noise2 == "") - self.noise2 = "sound/nexball/steal.wav"; + self.noise2 = SND(NB_STEAL); //stealing sound placeholder (FIXME) if(self.noise) precache_sound(self.noise); precache_sound(self.noise1); @@ -623,7 +623,7 @@ void spawnfunc_nexball_fault(void) {SELFPARAM(); self.team = GOAL_FAULT; if(self.noise == "") - self.noise = "misc/typehit.wav"; + self.noise = SND(TYPEHIT); SpawnGoal(); } @@ -631,7 +631,7 @@ void spawnfunc_nexball_out(void) {SELFPARAM(); self.team = GOAL_OUT; if(self.noise == "") - self.noise = "misc/typehit.wav"; + self.noise = SND(TYPEHIT); SpawnGoal(); } @@ -705,7 +705,7 @@ void W_Nexball_Touch(void) if(!attacker.ballcarried) { LogNB("stole", attacker); - sound(other, CH_TRIGGER, ball.noise2, VOL_BASE, ATTEN_NORM); + _sound(other, CH_TRIGGER, ball.noise2, VOL_BASE, ATTEN_NORM); if(SAME_TEAM(attacker, other) && time > attacker.teamkill_complain) { @@ -727,7 +727,7 @@ void W_Nexball_Attack(float t) if(!(ball = self.ballcarried)) return; - W_SetupShot(self, false, 4, "nexball/shoot1.wav", CH_WEAPON_A, 0); + W_SetupShot(self, false, 4, SND(NB_SHOOT1), CH_WEAPON_A, 0); tracebox(w_shotorg, BALL_MINS, BALL_MAXS, w_shotorg, MOVE_WORLDONLY, world); if(trace_startsolid) { @@ -761,7 +761,7 @@ void W_Nexball_Attack2(void) if(self.ballcarried.enemy) { entity _ball = self.ballcarried; - W_SetupShot(self, false, 4, "nexball/shoot1.wav", CH_WEAPON_A, 0); + W_SetupShot(self, false, 4, SND(NB_SHOOT1), CH_WEAPON_A, 0); DropBall(_ball, w_shotorg, trigger_push_calculatevelocity(_ball.origin, _ball.enemy, 32)); _ball.think = W_Nexball_Think; _ball.nextthink = time; @@ -774,7 +774,7 @@ void W_Nexball_Attack2(void) entity missile; if(!(balls & BALL_BASKET)) return; - W_SetupShot(self, false, 2, "nexball/shoot2.wav", CH_WEAPON_A, 0); + W_SetupShot(self, false, 2, SND(NB_SHOOT2), CH_WEAPON_A, 0); missile = spawn(); missile.owner = self; @@ -860,9 +860,6 @@ float w_nexball_weapon(float req) } else if(req == WR_INIT) { - precache_sound("nexball/shoot1.wav"); - precache_sound("nexball/shoot2.wav"); - precache_sound("misc/typehit.wav"); } else if(req == WR_SETUP) { diff --git a/qcsrc/server/mutators/gamemode_onslaught.qc b/qcsrc/server/mutators/gamemode_onslaught.qc index e5d127748b..3fccbe34c5 100644 --- a/qcsrc/server/mutators/gamemode_onslaught.qc +++ b/qcsrc/server/mutators/gamemode_onslaught.qc @@ -31,7 +31,7 @@ void ons_CaptureShield_Touch() if(IS_REAL_CLIENT(other)) { - play2(other, "onslaught/damageblockedbyshield.wav"); + play2(other, SND(ONS_DAMAGEBLOCKEDBYSHIELD)); if(self.enemy.classname == "onslaught_generator") Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_ONS_GENERATOR_SHIELDED); @@ -353,7 +353,7 @@ void ons_ControlPoint_Icon_Damage(entity inflictor, entity attacker, float damag if (time > self.pain_finished) if (IS_PLAYER(attacker)) { - play2(attacker, "onslaught/damageblockedbyshield.wav"); + play2(attacker, SND(ONS_DAMAGEBLOCKEDBYSHIELD)); self.pain_finished = time + 1; attacker.typehitsound += 1; // play both sounds (shield is way too quiet) } @@ -364,7 +364,7 @@ void ons_ControlPoint_Icon_Damage(entity inflictor, entity attacker, float damag if(IS_PLAYER(attacker)) if(time - ons_notification_time[self.team] > 10) { - play2team(self.team, "onslaught/controlpoint_underattack.wav"); + play2team(self.team, SND(ONS_CONTROLPOINT_UNDERATTACK)); ons_notification_time[self.team] = time; } @@ -378,13 +378,13 @@ void ons_ControlPoint_Icon_Damage(entity inflictor, entity attacker, float damag pointparticles(particleeffectnum(EFFECT_SPARKS), hitloc, force*-1, 1); //sound on every hit if (random() < 0.5) - sound(self, CH_TRIGGER, "onslaught/ons_hit1.wav", VOL_BASE+0.3, ATTEN_NORM); + sound(self, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE+0.3, ATTEN_NORM); else - sound(self, CH_TRIGGER, "onslaught/ons_hit2.wav", VOL_BASE+0.3, ATTEN_NORM); + sound(self, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE+0.3, ATTEN_NORM); if (self.health < 0) { - sound(self, CH_TRIGGER, W_Sound("grenade_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM); pointparticles(particleeffectnum(EFFECT_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); @@ -490,9 +490,9 @@ void ons_ControlPoint_Icon_Think() Send_Effect(EFFECT_ELECTRIC_SPARKS, self.origin + randompos('-10 -10 -20', '10 10 20'), '0 0 0', 1); if(random() > 0.8) - sound(self, CH_PAIN, "onslaught/ons_spark1.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_PAIN, SND_ONS_SPARK1, VOL_BASE, ATTEN_NORM); else if (random() > 0.5) - sound(self, CH_PAIN, "onslaught/ons_spark2.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_PAIN, SND_ONS_SPARK2, VOL_BASE, ATTEN_NORM); } } @@ -516,7 +516,7 @@ void ons_ControlPoint_Icon_BuildThink() self.health = self.max_health; self.count = autocvar_g_onslaught_cp_regen * ONS_CP_THINKRATE; // slow repair rate from now on self.think = ons_ControlPoint_Icon_Think; - sound(self, CH_TRIGGER, "onslaught/controlpoint_built.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_TRIGGER, SND_ONS_CONTROLPOINT_BUILT, VOL_BASE, ATTEN_NORM); self.owner.iscaptured = true; self.solid = SOLID_BBOX; @@ -572,7 +572,7 @@ void ons_ControlPoint_Icon_Spawn(entity cp, entity player) e.colormap = 1024 + (e.team - 1) * 17; e.count = (e.max_health - e.health) * ONS_CP_THINKRATE / autocvar_g_onslaught_cp_buildtime; // how long it takes to build - sound(e, CH_TRIGGER, "onslaught/controlpoint_build.wav", VOL_BASE, ATTEN_NORM); + sound(e, CH_TRIGGER, SND_ONS_CONTROLPOINT_BUILD, VOL_BASE, ATTEN_NORM); cp.goalentity = e; cp.team = e.team; @@ -751,15 +751,6 @@ void ons_ControlPoint_Setup(entity cp) if(cp.message == "") { cp.message = "a"; } - // precache - TODO: clean up! - precache_sound("onslaught/controlpoint_build.wav"); - precache_sound("onslaught/controlpoint_built.wav"); - precache_sound(W_Sound("grenade_impact")); - precache_sound("onslaught/damageblockedbyshield.wav"); - precache_sound("onslaught/controlpoint_underattack.wav"); - precache_sound("onslaught/ons_spark1.wav"); - precache_sound("onslaught/ons_spark2.wav"); - // appearence setmodel_fixsize(cp, MDL_ONS_CP_PAD1); @@ -838,7 +829,7 @@ void ons_GeneratorDamage(entity inflictor, entity attacker, float damage, int de if (time > self.pain_finished) if (IS_PLAYER(attacker)) { - play2(attacker, "onslaught/damageblockedbyshield.wav"); + play2(attacker, SND(ONS_DAMAGEBLOCKEDBYSHIELD)); attacker.typehitsound += 1; self.pain_finished = time + 1; } @@ -849,7 +840,7 @@ void ons_GeneratorDamage(entity inflictor, entity attacker, float damage, int de self.pain_finished = time + 10; entity head; FOR_EACH_REALPLAYER(head) if(SAME_TEAM(head, self)) { Send_Notification(NOTIF_ONE, head, MSG_CENTER, CENTER_GENERATOR_UNDERATTACK); } - play2team(self.team, "onslaught/generator_underattack.wav"); + play2team(self.team, SND(ONS_GENERATOR_UNDERATTACK)); } } self.health = self.health - damage; @@ -890,7 +881,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, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_TRIGGER, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); } else { @@ -899,9 +890,9 @@ void ons_GeneratorDamage(entity inflictor, entity attacker, float damage, int de //sound on every hit if (random() < 0.5) - sound(self, CH_TRIGGER, "onslaught/ons_hit1.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE, ATTEN_NORM); else - sound(self, CH_TRIGGER, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE, ATTEN_NORM); } self.SendFlags |= GSF_STATUS; @@ -921,7 +912,7 @@ void ons_GeneratorThink() if(SAME_TEAM(e, self)) { Send_Notification(NOTIF_ONE, e, MSG_CENTER, CENTER_ONS_NOTSHIELDED_TEAM); - soundto(MSG_ONE, e, CHAN_AUTO, "kh/alarm.wav", VOL_BASE, ATTEN_NONE); // FIXME: unique sound? + soundto(MSG_ONE, e, CHAN_AUTO, SND(KH_ALARM), VOL_BASE, ATTEN_NONE); // FIXME: unique sound? } else Send_Notification(NOTIF_ONE, e, MSG_CENTER, APP_TEAM_NUM_4(self.team, CENTER_ONS_NOTSHIELDED_)); @@ -1008,16 +999,6 @@ void ons_GeneratorSetup(entity gen) // called when spawning a generator entity o gen.isshielded = true; gen.touch = onslaught_generator_touch; - // precache - TODO: clean up! - precache_sound("onslaught/generator_decay.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"); - precache_sound("onslaught/ons_hit2.wav"); - precache_sound("onslaught/generator_underattack.wav"); - // appearence // model handled by CSQC setsize(gen, GENERATOR_MIN, GENERATOR_MAX); @@ -1095,7 +1076,7 @@ bool Onslaught_CheckWinner() if (!wpforenemy_announced) { Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT); - sound(world, CH_INFO, "onslaught/generator_decay.wav", VOL_BASE, ATTEN_NONE); + sound(world, CH_INFO, SND_ONS_GENERATOR_DECAY, VOL_BASE, ATTEN_NONE); wpforenemy_announced = true; } @@ -1149,7 +1130,7 @@ bool Onslaught_CheckWinner() ons_stalemate = false; - play2all(sprintf("ctf/%s_capture.wav", Static_Team_ColorName_Lower(winner_team))); + play2all(SND(CTF_CAPTURE(Static_Team_ColorName_Lower(winner_team)))); round_handler_Init(7, autocvar_g_onslaught_warmup, autocvar_g_onslaught_round_timelimit); @@ -1658,7 +1639,7 @@ bool ons_Teleport(entity player, entity tele_target, float range, bool tele_effe if ( tele_effects ) { Send_Effect(EFFECT_TELEPORT, player.origin, '0 0 0', 1); - sound (player, CH_TRIGGER, "misc/teleport.wav", VOL_BASE, ATTEN_NORM); + sound (player, CH_TRIGGER, SND_TELEPORT, VOL_BASE, ATTEN_NORM); } setorigin(player, loc); player.angles = '0 1 0' * ( theta * RAD2DEG + 180 ); @@ -2114,11 +2095,6 @@ void ons_DelayedInit() // Do this check with a delay so we can wait for teams to void ons_Initialize() { - precache_sound("ctf/red_capture.wav"); - precache_sound("ctf/blue_capture.wav"); - precache_sound("ctf/yellow_capture.wav"); - precache_sound("ctf/pink_capture.wav"); - ons_captureshield_force = autocvar_g_onslaught_shield_force; addstat(STAT_ROUNDLOST, AS_INT, ons_roundlost); diff --git a/qcsrc/server/mutators/mutator_buffs.qc b/qcsrc/server/mutators/mutator_buffs.qc index 79004e1c41..fb0c2b7b6f 100644 --- a/qcsrc/server/mutators/mutator_buffs.qc +++ b/qcsrc/server/mutators/mutator_buffs.qc @@ -140,7 +140,7 @@ void buff_Respawn(entity ent) WaypointSprite_Ping(ent.buff_waypoint); - sound(ent, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere) + sound(ent, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere) } void buff_Touch() @@ -178,7 +178,7 @@ void buff_Touch() Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ITEM_BUFF_LOST, other.netname, buffid); other.buffs = 0; - //sound(other, CH_TRIGGER, "relics/relic_effect.wav", VOL_BASE, ATTN_NORM); + //sound(other, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM); } else { return; } // do nothing } @@ -191,7 +191,7 @@ void buff_Touch() Send_Notification(NOTIF_ALL_EXCEPT, other, MSG_INFO, INFO_ITEM_BUFF, other.netname, buffid); Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(self), '0 0 0', 1); - sound(other, CH_TRIGGER, "misc/shield_respawn.wav", VOL_BASE, ATTN_NORM); + sound(other, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTN_NORM); other.buffs |= (self.buffs); } @@ -271,7 +271,7 @@ void buff_Think() if(!self.buff_activetime) { self.buff_active = true; - sound(self, CH_TRIGGER, "misc/strength_respawn.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_TRIGGER, SND_STRENGTH_RESPAWN, VOL_BASE, ATTN_NORM); Send_Effect(EFFECT_ITEM_RESPAWN, CENTER_OR_VIEWOFS(self), '0 0 0', 1); } } @@ -596,7 +596,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerUseKey) Send_Notification(NOTIF_ALL_EXCEPT, self, MSG_INFO, INFO_ITEM_BUFF_LOST, self.netname, buffid); self.buffs = 0; - sound(self, CH_TRIGGER, "relics/relic_effect.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM); return true; } return false; @@ -661,8 +661,8 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerThrowKey) Send_Effect(EFFECT_ELECTRO_COMBO, their_org, '0 0 0', 1); Send_Effect(EFFECT_ELECTRO_COMBO, my_org, '0 0 0', 1); - sound(self, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NORM); - sound(closest, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NORM); + sound(self, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NORM); + sound(closest, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NORM); // TODO: add a counter to handle how many times one can teleport, and a delay to prevent spam self.buffs = 0; @@ -771,7 +771,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerThink) if(buff_lost >= 2) { Send_Notification(NOTIF_ONE, self, MSG_MULTI, ITEM_BUFF_DROP, buffid); // TODO: special timeout message? - sound(self, CH_TRIGGER, "relics/relic_effect.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM); } self.buffs = 0; } @@ -957,12 +957,6 @@ void buffs_DelayedInit() void buffs_Initialize() { - precache_sound("misc/strength_respawn.wav"); - precache_sound("misc/shield_respawn.wav"); - precache_sound("relics/relic_effect.wav"); - precache_sound(W_Sound("rocket_impact")); - precache_sound("keepaway/respawn.wav"); - addstat(STAT_BUFFS, AS_INT, buffs); addstat(STAT_BUFF_TIME, AS_FLOAT, buff_time); diff --git a/qcsrc/server/mutators/mutator_instagib.qc b/qcsrc/server/mutators/mutator_instagib.qc index 7488fd2954..67be082909 100644 --- a/qcsrc/server/mutators/mutator_instagib.qc +++ b/qcsrc/server/mutators/mutator_instagib.qc @@ -187,7 +187,7 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerPowerups) if (self.items & ITEM_Invisibility.m_itemid) { - play_countdown(self.strength_finished, "misc/poweroff.wav"); + play_countdown(self.strength_finished, SND(POWEROFF)); if (time > self.strength_finished) { self.alpha = default_player_alpha; @@ -210,7 +210,7 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerPowerups) if (self.items & ITEM_Speed.m_itemid) { - play_countdown(self.invincible_finished, "misc/poweroff.wav"); + play_countdown(self.invincible_finished, SND(POWEROFF)); if (time > self.invincible_finished) { self.items &= ~ITEM_Speed.m_itemid; diff --git a/qcsrc/server/mutators/mutator_nades.qc b/qcsrc/server/mutators/mutator_nades.qc index 99c7854825..99941a100b 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, W_Sound("fireball_fire"), VOL_BASE, ATTEN_NORM); + spamsound(self, CH_SHOTS, SND(FIREBALL_FIRE), VOL_BASE, ATTEN_NORM); proj = spawn (); proj.owner = self.owner; @@ -260,7 +260,7 @@ void nade_ice_think() default: expef = EFFECT_NADE_NEUTRAL_EXPLODE; break; } Send_Effect(expef, self.origin + '0 0 1', '0 0 0', 1); - sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_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); @@ -530,8 +530,8 @@ void nade_boom() if(expef) 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, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); + sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); self.event_damage = func_null; // prevent somehow calling damage in the next call @@ -584,7 +584,7 @@ void nade_touch() //UpdateCSQCProjectile(self); if(self.health == self.max_health) { - spamsound(self, CH_SHOTS, W_Sound(strcat("grenade_bounce", ftos(1 + rint(random() * 5)))), VOL_BASE, ATTEN_NORM); + spamsound(self, CH_SHOTS, SND(GRENADE_BOUNCE_RANDOM()), VOL_BASE, ATTEN_NORM); return; } @@ -594,7 +594,7 @@ void nade_touch() void nade_beep() {SELFPARAM(); - sound(self, CH_SHOTS_SINGLE, "overkill/grenadebip.ogg", VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX)); + sound(self, CH_SHOTS_SINGLE, SND_NADE_BEEP, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX)); self.think = nade_boom; self.nextthink = max(self.wait, time); } @@ -649,7 +649,7 @@ void nade_damage(entity inflictor, entity attacker, float damage, int deathtype, if(self.health == self.max_health) { - sound(self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX)); + sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX)); self.nextthink = max(time + autocvar_g_nades_nade_lifetime, time); self.think = nade_beep; } @@ -759,7 +759,7 @@ void nades_GiveBonus(entity player, float score) if ( player.bonus_nade_score >= 1 ) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_NADE_BONUS); - play2(player,"kh/alarm.wav"); + play2(player, SND(KH_ALARM)); player.bonus_nades++; player.bonus_nade_score -= 1; } @@ -1198,15 +1198,6 @@ void nades_Initialize() addstat(STAT_NADE_BONUS_SCORE, AS_FLOAT, bonus_nade_score); addstat(STAT_HEALING_ORB, AS_FLOAT, stat_healing_orb); addstat(STAT_HEALING_ORB_ALPHA, AS_FLOAT, stat_healing_orb_alpha); - - 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"); } MUTATOR_DEFINITION(mutator_nades) diff --git a/qcsrc/server/mutators/mutator_new_toys.qc b/qcsrc/server/mutators/mutator_new_toys.qc index 172ee4d651..9b51d9abb8 100644 --- a/qcsrc/server/mutators/mutator_new_toys.qc +++ b/qcsrc/server/mutators/mutator_new_toys.qc @@ -190,8 +190,10 @@ MUTATOR_HOOKFUNCTION(nt_SetWeaponreplace) MUTATOR_HOOKFUNCTION(nt_FilterItem) {SELFPARAM(); - if(nt_IsNewToy(self.weapon) && autocvar_g_new_toys_use_pickupsound) - self.item_pickupsound = W_Sound("weaponpickup_new_toys"); + if(nt_IsNewToy(self.weapon) && autocvar_g_new_toys_use_pickupsound) { + self.item_pickupsound = string_null; + self.item_pickupsound_ent = SND_WEAPONPICKUP_NEW_TOYS; + } return 0; } @@ -207,8 +209,6 @@ MUTATOR_DEFINITION(mutator_new_toys) if(time > 1) // game loads at time 1 error("This cannot be added at runtime\n"); - precache_sound(W_Sound("weaponpickup_new_toys")); - // mark the guns as ok to use by e.g. impulse 99 float i; for(i = WEP_FIRST; i <= WEP_LAST; ++i) diff --git a/qcsrc/server/mutators/mutator_overkill.qc b/qcsrc/server/mutators/mutator_overkill.qc index 5b7018b303..3bc1e79589 100644 --- a/qcsrc/server/mutators/mutator_overkill.qc +++ b/qcsrc/server/mutators/mutator_overkill.qc @@ -174,7 +174,7 @@ MUTATOR_HOOKFUNCTION(ok_PlayerPreThink) { //Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_OVERKILL_CHARGE); self.ok_notice_time = time + 2; - play2(self, W_Sound("dryfire")); + play2(self, SND(DRYFIRE)); } if(self.weaponentity.state != WS_CLEAR) w_ready(); @@ -316,8 +316,6 @@ void ok_Initialize() precache_all_playermodels("models/ok_player/*.dpm"); - 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 4f49d550d9..faa74bb1dc 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, W_Sound("grenade_impact"), VOL_BASE, ATTEN_NORM); + sound(self, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM); Send_Effect(EFFECT_EXPLOSION_SMALL, org, '0 0 0', 1); entity e; diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index 509e920511..ed3ffc5e77 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -30,7 +30,7 @@ void sandbox_ObjectFunction_Touch() intensity -= autocvar_g_sandbox_object_material_velocity_min; // start from minimum velocity, not actual velocity intensity = bound(0, intensity * autocvar_g_sandbox_object_material_velocity_factor, 1); - sound(self, CH_TRIGGER, strcat("object/impact_", self.material, "_", ftos(ceil(random() * 5)) , ".wav"), VOL_BASE * intensity, ATTEN_NORM); + _sound(self, CH_TRIGGER, strcat("object/impact_", self.material, "_", ftos(ceil(random() * 5)) , ".wav"), VOL_BASE * intensity, ATTEN_NORM); Send_Effect_(strcat("impact_", self.material), self.origin, '0 0 0', ceil(intensity * 10)); // allow a count from 1 to 10 } diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index 7501b63607..30fa073849 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -414,14 +414,14 @@ void Portal_Remove(entity portal, float killed) if(killed) { fixedmakevectors(portal.mangle); - sound(portal, CH_SHOTS, "porto/explode.wav", VOL_BASE, ATTEN_NORM); + sound(portal, CH_SHOTS, SND_PORTO_EXPLODE, VOL_BASE, ATTEN_NORM); Send_Effect(EFFECT_ROCKET_EXPLODE, portal.origin + v_forward * 16, v_forward * 1024, 4); remove(portal); } else { Portal_MakeBrokenPortal(portal); - sound(portal, CH_SHOTS, "porto/expire.wav", VOL_BASE, ATTEN_NORM); + sound(portal, CH_SHOTS, SND_PORTO_EXPIRE, VOL_BASE, ATTEN_NORM); SUB_SetFade(portal, time, 0.5); } } diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index 948e2d3743..138051827b 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -90,7 +90,7 @@ void CreatureFrame (void) if (self.watersound_finished < time) { self.watersound_finished = time + 0.5; - sound (self, CH_PLAYER_SINGLE, "player/lava.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_PLAYER_SINGLE, SND_LAVA, VOL_BASE, ATTEN_NORM); } Damage (self, world, world, autocvar_g_balance_contents_playerdamage_lava * autocvar_g_balance_contents_damagerate * self.waterlevel, DEATH_LAVA, self.origin, '0 0 0'); } @@ -99,7 +99,7 @@ void CreatureFrame (void) if (self.watersound_finished < time) { self.watersound_finished = time + 0.5; - sound (self, CH_PLAYER_SINGLE, "player/slime.wav", VOL_BASE, ATTEN_NORM); + sound (self, CH_PLAYER_SINGLE, SND_SLIME, VOL_BASE, ATTEN_NORM); } Damage (self, world, world, autocvar_g_balance_contents_playerdamage_slime * autocvar_g_balance_contents_damagerate * self.waterlevel, DEATH_SLIME, self.origin, '0 0 0'); } diff --git a/qcsrc/server/sys-pre.qh b/qcsrc/server/sys-pre.qh index bfdcdb860e..067e014097 100644 --- a/qcsrc/server/sys-pre.qh +++ b/qcsrc/server/sys-pre.qh @@ -3,7 +3,6 @@ #define objerror builtin_objerror #define droptofloor builtin_droptofloor -#define sound builtin_sound #define remove builtin_remove #define cvar_set builtin_cvar_set #define cvar_string builtin_cvar_string diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 408bc4388a..68cc43fb9f 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -436,11 +436,11 @@ void Item_Respawn (void) Item_Show(self, 1); // this is ugly... if(self.items == ITEM_Strength.m_itemid) - sound (self, CH_TRIGGER, "misc/strength_respawn.wav", VOL_BASE, ATTEN_NORM); // play respawn sound + sound (self, CH_TRIGGER, SND_STRENGTH_RESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound else if(self.items == ITEM_Shield.m_itemid) - sound (self, CH_TRIGGER, "misc/shield_respawn.wav", VOL_BASE, ATTEN_NORM); // play respawn sound + sound (self, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound else - sound (self, CH_TRIGGER, "misc/itemrespawn.wav", VOL_BASE, ATTEN_NORM); // play respawn sound + sound (self, CH_TRIGGER, SND_ITEMRESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound setorigin (self, self.origin); if (Item_ItemsTime_Allow(self.itemdef, self.weapons)) @@ -507,7 +507,7 @@ void Item_RespawnCountdown (void) if(self.waypointsprite_visible_for_player(e)) { msg_entity = e; - soundto(MSG_ONE, this, CH_TRIGGER, "misc/itemrespawncountdown.wav", VOL_BASE, ATTEN_NORM); // play respawn sound + soundto(MSG_ONE, this, CH_TRIGGER, SND(ITEMRESPAWNCOUNTDOWN), VOL_BASE, ATTEN_NORM); // play respawn sound } setself(this); @@ -515,7 +515,7 @@ void Item_RespawnCountdown (void) //WaypointSprite_UpdateHealth(self.waypointsprite_attached, self.count); } else - sound(self, CH_TRIGGER, "misc/itemrespawncountdown.wav", VOL_BASE, ATTEN_NORM); // play respawn sound + sound(self, CH_TRIGGER, SND_ITEMRESPAWNCOUNTDOWN, VOL_BASE, ATTEN_NORM); // play respawn sound } } @@ -759,7 +759,7 @@ void Item_Touch (void) other.last_pickup = time; Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(self), '0 0 0', 1); - sound (other, CH_TRIGGER, self.item_pickupsound, VOL_BASE, ATTEN_NORM); + _sound (other, CH_TRIGGER, (self.item_pickupsound ? self.item_pickupsound : self.item_pickupsound_ent.sound_str()), VOL_BASE, ATTEN_NORM); if (self.classname == "droppedweapon") remove (self); @@ -1128,14 +1128,6 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, precache_model (self.model); precache_sound (self.item_pickupsound); - precache_sound ("misc/itemrespawncountdown.wav"); - if(itemid == ITEM_Strength.m_itemid) - precache_sound ("misc/strength_respawn.wav"); - else if(itemid == ITEM_Shield.m_itemid) - precache_sound ("misc/shield_respawn.wav"); - else - precache_sound ("misc/itemrespawn.wav"); - if((itemflags & (FL_POWERUP | FL_WEAPON)) || (itemid & (IT_HEALTH | IT_ARMOR | IT_KEY1 | IT_KEY2))) self.target = "###item###"; // for finding the nearest item using find() @@ -1380,7 +1372,6 @@ void spawnfunc_item_health100() { spawnfunc_item_health_mega(); } void spawnfunc_item_strength() {SELFPARAM(); - precache_sound("weapons/strength_fire.wav"); if(!self.strength_finished) self.strength_finished = autocvar_g_balance_powerup_strength_time; StartItemA (ITEM_Strength); @@ -1434,13 +1425,6 @@ void spawnfunc_target_items (void) if(!self.superweapons_finished) self.superweapons_finished = autocvar_g_balance_superweapons_time; - precache_sound("misc/itempickup.wav"); - precache_sound("misc/megahealth.wav"); - precache_sound("misc/armor25.wav"); - precache_sound("misc/powerup.wav"); - precache_sound("misc/poweroff.wav"); - precache_sound(W_Sound("weaponpickup")); - n = tokenize_console(self.netname); if(argv(0) == "give") { @@ -1669,12 +1653,12 @@ void GiveSound(entity e, float v0, float v1, float t, string snd_incr, string sn if(v1 <= v0 - t) { if(snd_decr != "") - sound (e, CH_TRIGGER, snd_decr, VOL_BASE, ATTEN_NORM); + _sound (e, CH_TRIGGER, snd_decr, VOL_BASE, ATTEN_NORM); } else if(v0 >= v0 + t) { if(snd_incr != "") - sound (e, CH_TRIGGER, snd_incr, VOL_BASE, ATTEN_NORM); + _sound (e, CH_TRIGGER, snd_incr, VOL_BASE, ATTEN_NORM); } } @@ -1840,31 +1824,31 @@ float GiveItems(entity e, float beginarg, float endarg) op = OP_SET; } - POSTGIVE_BIT(e, items, ITEM_JetpackRegen.m_itemid, "misc/itempickup.wav", string_null); - POSTGIVE_BIT(e, items, IT_UNLIMITED_SUPERWEAPONS, "misc/powerup.wav", "misc/poweroff.wav"); - POSTGIVE_BIT(e, items, IT_UNLIMITED_WEAPON_AMMO, "misc/powerup.wav", "misc/poweroff.wav"); - POSTGIVE_BIT(e, items, ITEM_Jetpack.m_itemid, "misc/itempickup.wav", string_null); + POSTGIVE_BIT(e, items, ITEM_JetpackRegen.m_itemid, SND(ITEMPICKUP), string_null); + POSTGIVE_BIT(e, items, IT_UNLIMITED_SUPERWEAPONS, SND(POWERUP), SND(POWEROFF)); + POSTGIVE_BIT(e, items, IT_UNLIMITED_WEAPON_AMMO, SND(POWERUP), SND(POWEROFF)); + POSTGIVE_BIT(e, items, ITEM_Jetpack.m_itemid, SND(ITEMPICKUP), string_null); for(j = WEP_FIRST; j <= WEP_LAST; ++j) { wi = get_weaponinfo(j); if(wi.weapon) { - POSTGIVE_WEAPON(e, j, W_Sound("weaponpickup"), string_null); + POSTGIVE_WEAPON(e, j, SND(WEAPONPICKUP), string_null); if (!(save_weapons & WepSet_FromWeapon(j))) if(e.weapons & WepSet_FromWeapon(j)) WEP_ACTION(wi.weapon, WR_INIT); } } - POSTGIVE_VALUE(e, strength_finished, 1, "misc/powerup.wav", "misc/poweroff.wav"); - POSTGIVE_VALUE(e, invincible_finished, 1, "misc/powerup_shield.wav", "misc/poweroff.wav"); - POSTGIVE_VALUE(e, ammo_nails, 0, "misc/itempickup.wav", string_null); - POSTGIVE_VALUE(e, ammo_cells, 0, "misc/itempickup.wav", string_null); - POSTGIVE_VALUE(e, ammo_plasma, 0, "misc/itempickup.wav", string_null); - POSTGIVE_VALUE(e, ammo_shells, 0, "misc/itempickup.wav", string_null); - POSTGIVE_VALUE(e, ammo_rockets, 0, "misc/itempickup.wav", string_null); - POSTGIVE_VALUE_ROT(e, ammo_fuel, 1, pauserotfuel_finished, autocvar_g_balance_pause_fuel_rot, pauseregen_finished, autocvar_g_balance_pause_fuel_regen, "misc/itempickup.wav", string_null); - POSTGIVE_VALUE_ROT(e, armorvalue, 1, pauserotarmor_finished, autocvar_g_balance_pause_armor_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, "misc/armor25.wav", string_null); - POSTGIVE_VALUE_ROT(e, health, 1, pauserothealth_finished, autocvar_g_balance_pause_health_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, "misc/megahealth.wav", string_null); + POSTGIVE_VALUE(e, strength_finished, 1, SND(POWERUP), SND(POWEROFF)); + POSTGIVE_VALUE(e, invincible_finished, 1, "misc/powerup_shield.wav", SND(POWEROFF)); + POSTGIVE_VALUE(e, ammo_nails, 0, SND(ITEMPICKUP), string_null); + POSTGIVE_VALUE(e, ammo_cells, 0, SND(ITEMPICKUP), string_null); + POSTGIVE_VALUE(e, ammo_plasma, 0, SND(ITEMPICKUP), string_null); + POSTGIVE_VALUE(e, ammo_shells, 0, SND(ITEMPICKUP), string_null); + POSTGIVE_VALUE(e, ammo_rockets, 0, SND(ITEMPICKUP), string_null); + POSTGIVE_VALUE_ROT(e, ammo_fuel, 1, pauserotfuel_finished, autocvar_g_balance_pause_fuel_rot, pauseregen_finished, autocvar_g_balance_pause_fuel_regen, SND(ITEMPICKUP), string_null); + POSTGIVE_VALUE_ROT(e, armorvalue, 1, pauserotarmor_finished, autocvar_g_balance_pause_armor_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, SND(ARMOR25), string_null); + POSTGIVE_VALUE_ROT(e, health, 1, pauserothealth_finished, autocvar_g_balance_pause_health_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, SND(MEGAHEALTH), string_null); if(e.superweapons_finished <= 0) if(self.weapons & WEPSET_SUPERWEAPONS) diff --git a/qcsrc/server/weapons/common.qc b/qcsrc/server/weapons/common.qc index db712933d0..f1720757f6 100644 --- a/qcsrc/server/weapons/common.qc +++ b/qcsrc/server/weapons/common.qc @@ -30,7 +30,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, W_Sound("strength_fire"), VOL_BASE, ATTEN_NORM); + sound(player, CH_TRIGGER, SND_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 de240ce2ef..ce464c18e4 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -63,7 +63,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) if (complain) if(IS_REAL_CLIENT(cl)) { - play2(cl, W_Sound("unavailable")); + play2(cl, SND(UNAVAILABLE)); Send_WeaponComplain (cl, wpn, 0); } return false; @@ -107,7 +107,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) Send_WeaponComplain (cl, wpn, 2); } - play2(cl, W_Sound("unavailable")); + play2(cl, SND(UNAVAILABLE)); } return false; } diff --git a/qcsrc/server/weapons/spawning.qc b/qcsrc/server/weapons/spawning.qc index 202b29fda7..81261383f5 100644 --- a/qcsrc/server/weapons/spawning.qc +++ b/qcsrc/server/weapons/spawning.qc @@ -177,7 +177,8 @@ 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, string_null, self.respawntime, self.respawntimejitter, e.message, 0, e.weapon, f, weapon_pickupevalfunc, e.bot_pickupbasevalue); + self.item_pickupsound_ent = SND_WEAPONPICKUP; #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 7c033fa889..69821aaaf6 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -131,7 +131,7 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m if (snd != "") { - sound (ent, chan, snd, VOL_BASE, ATTN_NORM); + _sound (ent, chan, snd, VOL_BASE, ATTN_NORM); W_PlayStrengthSound(ent); } @@ -287,7 +287,7 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f if(f <= 0) continue; - snd = W_Sound(strcat("nexwhoosh", ftos(floor(random() * 3) + 1))); + snd = SND(NEXWHOOSH_RANDOM()); 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 076a172c8d..ba33c515ff 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -474,7 +474,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, W_Sound("dryfire"), VOL_BASE, ATTEN_NORM); + sound (self, CH_WEAPON_A, SND_DRYFIRE, VOL_BASE, ATTEN_NORM); self.prevdryfire = time; } @@ -732,7 +732,7 @@ void W_WeaponFrame() if(ATTACK_FINISHED(self) <= time + self.weapon_frametime * 0.5) { #endif - sound(self, CH_WEAPON_SINGLE, W_Sound("weapon_switch"), VOL_BASE, ATTN_NORM); + sound(self, CH_WEAPON_SINGLE, SND_WEAPON_SWITCH, VOL_BASE, ATTN_NORM); self.weaponentity.state = WS_DROP; weapon_thinkf(WFRAME_DONTCHANGE, oldwep.switchdelay_drop, w_clear); #ifndef INDEPENDENT_ATTACK_FINISHED @@ -927,7 +927,7 @@ void W_Reload(float sent_ammo_min, string sent_sound) { if(IS_REAL_CLIENT(self) && self.reload_complain < time) { - play2(self, W_Sound("unavailable")); + play2(self, SND(UNAVAILABLE)); sprint(self, strcat("You don't have enough ammo to reload the ^2", WEP_NAME(self.weapon), "\n")); self.reload_complain = time + 1; } @@ -951,7 +951,7 @@ void W_Reload(float sent_ammo_min, string sent_sound) // now begin the reloading process - sound(self, CH_WEAPON_SINGLE, self.reload_sound, VOL_BASE, ATTEN_NORM); + _sound(self, CH_WEAPON_SINGLE, self.reload_sound, VOL_BASE, ATTEN_NORM); // do not set ATTACK_FINISHED in reload code any more. This causes annoying delays if eg: You start reloading a weapon, // then quickly switch to another weapon and back. Reloading is canceled, but the reload delay is still there,