From: TimePath Date: Wed, 23 Sep 2015 02:31:49 +0000 (+1000) Subject: Create a sound list X-Git-Tag: xonotic-v0.8.2~1914^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3b8a6707fbceb9f57b5d3ab5321e36033da6059d;p=xonotic%2Fxonotic-data.pk3dir.git Create a sound list --- diff --git a/qcsrc/Makefile b/qcsrc/Makefile index 34bf30fdc..5d64da090 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 66fd81314..12dc1b4a3 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 aec000d64..a83260b10 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 8469b5226..a2ce39591 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 022afd9d1..400ca7387 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" @@ -605,11 +604,6 @@ void CSQCModel_Effects_Apply(void) } } -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 899588059..000000000 --- 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/generator.qc b/qcsrc/client/generator.qc index c9358b679..f43b5ed02 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) @@ -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 e4e1611f3..744bc5589 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 0302f1841..63d818054 100644 --- a/qcsrc/client/gibs.qc +++ b/qcsrc/client/gibs.qc @@ -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 b33a1a5e0..5b8b16bfd 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 528646979..22ec447d5 100644 --- a/qcsrc/client/hook.qc +++ b/qcsrc/client/hook.qc @@ -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 8401dce04..e513ed6af 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 c534cc7a5..0f4cd950d 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) { diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index 3511c743f..945f312ab 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/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index 1be6f8974..5398870cb 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -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 302220c09..000000000 --- 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 c66895965..0d17f43ab 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 d2881e9ba..0c99a34f0 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -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/spider.qc b/qcsrc/common/monsters/monster/spider.qc index fb71c2f22..fc4a694fc 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -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/mutators/mutator/casings.qc b/qcsrc/common/mutators/mutator/casings.qc index fedcf9fe5..771575c69 100644 --- a/qcsrc/common/mutators/mutator/casings.qc +++ b/qcsrc/common/mutators/mutator/casings.qc @@ -163,13 +163,11 @@ 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")); -} +SOUND(BRASS1, W_Sound("brass1")); +SOUND(BRASS2, W_Sound("brass2")); +SOUND(BRASS3, W_Sound("brass3")); +SOUND(CASINGS1, W_Sound("casings1")); +SOUND(CASINGS2, W_Sound("casings2")); +SOUND(CASINGS3, W_Sound("casings3")); + #endif diff --git a/qcsrc/common/sounds/sounds.inc b/qcsrc/common/sounds/sounds.inc new file mode 100644 index 000000000..707c66136 --- /dev/null +++ b/qcsrc/common/sounds/sounds.inc @@ -0,0 +1,186 @@ +// Global list of sounds + +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(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(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(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(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_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(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(NB_SHOOT1, "nexball/shoot1.ogg"); +SOUND(NB_SHOOT2, "nexball/shoot2.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_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(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 000000000..6b6a8a1ad --- /dev/null +++ b/qcsrc/common/sounds/sounds.qh @@ -0,0 +1,44 @@ +#ifndef SOUNDS_H +#define SOUNDS_H + +#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/turrets/turrets.qc b/qcsrc/common/turrets/turrets.qc index 37c85ca65..a75a80619 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/machinegun.qc b/qcsrc/common/turrets/unit/machinegun.qc index afecb7fa5..de6030def 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/phaser.qc b/qcsrc/common/turrets/unit/phaser.qc index e1ddef3a9..67d82dbf5 100644 --- a/qcsrc/common/turrets/unit/phaser.qc +++ b/qcsrc/common/turrets/unit/phaser.qc @@ -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/walker.qc b/qcsrc/common/turrets/unit/walker.qc index 9e7b0cbe1..7f33fb5f2 100644 --- a/qcsrc/common/turrets/unit/walker.qc +++ b/qcsrc/common/turrets/unit/walker.qc @@ -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 a054edde8..a506a59fc 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/vehicles/all.qc b/qcsrc/common/vehicles/all.qc index 3f3b77ea3..6e26f1712 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/unit/racer.qc b/qcsrc/common/vehicles/unit/racer.qc index 62a6e850f..e3dd5334b 100644 --- a/qcsrc/common/vehicles/unit/racer.qc +++ b/qcsrc/common/vehicles/unit/racer.qc @@ -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 96a84892c..a01623468 100644 --- a/qcsrc/common/vehicles/unit/raptor.qc +++ b/qcsrc/common/vehicles/unit/raptor.qc @@ -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 7d03c7736..c641ec602 100644 --- a/qcsrc/common/vehicles/unit/spiderbot.qc +++ b/qcsrc/common/vehicles/unit/spiderbot.qc @@ -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 046298a4c..611af7796 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 a6a073099..c748e1837 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -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); @@ -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 b20713c02..ba28f8277 100644 --- a/qcsrc/common/weapons/weapon/blaster.qc +++ b/qcsrc/common/weapons/weapon/blaster.qc @@ -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; } @@ -275,7 +274,6 @@ bool W_Blaster(int request) 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 6821d5a0e..78c7dc8b2 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -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; } @@ -712,8 +709,6 @@ bool W_Crylink(int req) } 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 cb2d16659..86a1ba10e 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -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; } @@ -668,7 +662,6 @@ bool W_Devastator(int req) } 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 7f02a00ce..08febe047 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -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; } @@ -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 a37ae8f09..e8da0a199 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -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; } @@ -467,7 +464,6 @@ bool W_Fireball(int req) } 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 d55a1b607..882781a2b 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -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; } @@ -545,9 +542,6 @@ bool W_Hagar(int req) } 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 074b76053..dffd5e4df 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -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; } @@ -296,7 +295,6 @@ bool W_HLAC(int req) } 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 c55304118..8afb8ab80 100644 --- a/qcsrc/common/weapons/weapon/hmg.qc +++ b/qcsrc/common/weapons/weapon/hmg.qc @@ -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; } @@ -187,9 +186,6 @@ bool W_HeavyMachineGun(int 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/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index b7f51b54c..fff06f15f 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -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; } @@ -350,7 +347,6 @@ bool W_Hook(int req) } 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 01efced0f..dcad706f9 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -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; } @@ -387,9 +386,6 @@ bool W_MachineGun(int 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/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index 1c7e89fde..0e7216175 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -530,10 +530,6 @@ bool W_MineLayer(int req) } 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; } @@ -599,7 +595,6 @@ bool W_MineLayer(int req) } 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 d03eb8e56..99d444695 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -405,14 +405,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; } @@ -473,7 +465,6 @@ bool W_Mortar(int req) } 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 58c28716a..0f87f82a6 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -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 66be38175..fd2c1a0e8 100644 --- a/qcsrc/common/weapons/weapon/rifle.qc +++ b/qcsrc/common/weapons/weapon/rifle.qc @@ -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; } @@ -285,9 +283,6 @@ bool W_Rifle(int req) } 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 51c040440..f6abe5c1e 100644 --- a/qcsrc/common/weapons/weapon/rpc.qc +++ b/qcsrc/common/weapons/weapon/rpc.qc @@ -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; } @@ -245,7 +244,6 @@ bool W_RocketPropelledChainsaw(int req) } 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 0687437af..54c4bb464 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -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; } @@ -768,13 +765,6 @@ bool W_Seeker(int req) } 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 b56a41fbb..a0451d87e 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -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 814d57303..ad4d8cc43 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -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; } @@ -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 13c3fef8c..601773fdc 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -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; @@ -445,8 +441,6 @@ float W_Vaporizer(float req) } 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 2e515137c..0ba4a2642 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -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; } @@ -331,7 +326,6 @@ bool W_Vortex(int req) } 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 aa541bd69..5bc9c1b4c 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 000000000..f732bfe2c --- /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 9d7617e00..d3771bafc 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/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 356a2b74a..e401b53cf 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -1011,36 +1011,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). @@ -1055,8 +1027,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_domination.qc b/qcsrc/server/mutators/gamemode_domination.qc index 6fa778309..dbf8e1ef8 100644 --- a/qcsrc/server/mutators/gamemode_domination.qc +++ b/qcsrc/server/mutators/gamemode_domination.qc @@ -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 6d7c8c990..e0d4fd954 100644 --- a/qcsrc/server/mutators/gamemode_keepaway.qc +++ b/qcsrc/server/mutators/gamemode_keepaway.qc @@ -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_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index e3480a42e..1d159cea7 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -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 e5d127748..bcdb833b0 100644 --- a/qcsrc/server/mutators/gamemode_onslaught.qc +++ b/qcsrc/server/mutators/gamemode_onslaught.qc @@ -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); @@ -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); @@ -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 79004e1c4..38181fd53 100644 --- a/qcsrc/server/mutators/mutator_buffs.qc +++ b/qcsrc/server/mutators/mutator_buffs.qc @@ -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_nades.qc b/qcsrc/server/mutators/mutator_nades.qc index 99c785482..a1f55c297 100644 --- a/qcsrc/server/mutators/mutator_nades.qc +++ b/qcsrc/server/mutators/mutator_nades.qc @@ -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 172ee4d65..b8891b283 100644 --- a/qcsrc/server/mutators/mutator_new_toys.qc +++ b/qcsrc/server/mutators/mutator_new_toys.qc @@ -207,8 +207,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 5b7018b30..0aef8e9a0 100644 --- a/qcsrc/server/mutators/mutator_overkill.qc +++ b/qcsrc/server/mutators/mutator_overkill.qc @@ -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/t_items.qc b/qcsrc/server/t_items.qc index 0fbbf2732..8b5978d96 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -1119,14 +1119,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() @@ -1371,7 +1363,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); @@ -1425,13 +1416,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") {