From e4a631da48af2a1dac3de0d47bfec39b7d34b2bd Mon Sep 17 00:00:00 2001 From: TimePath Date: Tue, 6 Oct 2015 21:13:40 +1100 Subject: [PATCH] Sounds: rename registry globals --- qcsrc/client/_all.qh | 2 +- qcsrc/common/mutators/mutator/casings.qc | 4 ++-- qcsrc/common/sounds/{sounds.inc => all.inc} | 10 +++++----- qcsrc/common/sounds/{sounds.qh => all.qh} | 17 +++++++---------- qcsrc/server/_all.qh | 2 +- 5 files changed, 16 insertions(+), 19 deletions(-) rename qcsrc/common/sounds/{sounds.inc => all.inc} (97%) rename qcsrc/common/sounds/{sounds.qh => all.qh} (83%) diff --git a/qcsrc/client/_all.qh b/qcsrc/client/_all.qh index 12dc1b4a3..a1fcb931f 100644 --- a/qcsrc/client/_all.qh +++ b/qcsrc/client/_all.qh @@ -9,6 +9,6 @@ #include "../dpdefs/csprogsdefs.qh" #include "../common/models/models.qh" -#include "../common/sounds/sounds.qh" +#include "../common/sounds/all.qh" #endif diff --git a/qcsrc/common/mutators/mutator/casings.qc b/qcsrc/common/mutators/mutator/casings.qc index 7a05c85ea..d60854e2d 100644 --- a/qcsrc/common/mutators/mutator/casings.qc +++ b/qcsrc/common/mutators/mutator/casings.qc @@ -67,13 +67,13 @@ 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)]; + 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)]; + return Sounds[SND_CASINGS1.m_id + floor(prandom() * 3)]; } void Casing_Touch() diff --git a/qcsrc/common/sounds/sounds.inc b/qcsrc/common/sounds/all.inc similarity index 97% rename from qcsrc/common/sounds/sounds.inc rename to qcsrc/common/sounds/all.inc index 7993450ab..0e5bd7ffb 100644 --- a/qcsrc/common/sounds/sounds.inc +++ b/qcsrc/common/sounds/all.inc @@ -35,7 +35,7 @@ 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)]; + return Sounds[SND_GRENADE_BOUNCE1.m_id + rint(random() * 5)]; } SOUND(GRENADE_FIRE, W_Sound("grenade_fire")); SOUND(GRENADE_IMPACT, W_Sound("grenade_impact")); @@ -47,7 +47,7 @@ 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)]; + return Sounds[SND_HAGEXP1.m_id + rint(random() * 2)]; } SOUND(HOOKBOMB_FIRE, W_Sound("hookbomb_fire")); @@ -70,7 +70,7 @@ 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)]; + 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 @@ -78,7 +78,7 @@ 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)]; + return Sounds[SND_RIC1.m_id + rint(random() * 2)]; } SOUND(ROCKET_DET, W_Sound("rocket_det")); @@ -259,7 +259,7 @@ 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)]; + return Sounds[SND_GIB_SPLAT01.m_id + floor(prandom() * 4)]; } SOUND(HIT, "misc/hit.wav"); diff --git a/qcsrc/common/sounds/sounds.qh b/qcsrc/common/sounds/all.qh similarity index 83% rename from qcsrc/common/sounds/sounds.qh rename to qcsrc/common/sounds/all.qh index c9838b2f6..d567d0a44 100644 --- a/qcsrc/common/sounds/sounds.qh +++ b/qcsrc/common/sounds/all.qh @@ -1,5 +1,5 @@ -#ifndef SOUNDS_H -#define SOUNDS_H +#ifndef SOUNDS_ALL_H +#define SOUNDS_ALL_H #include "../teams.qh" @@ -18,10 +18,8 @@ // 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; +REGISTRY(Sounds, 128) +REGISTER_REGISTRY(RegisterSounds) CLASS(Sound, Object) ATTRIB(Sound, m_id, int, 0) @@ -44,16 +42,15 @@ 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) + REGISTER(RegisterSounds, SND, Sounds, Sounds_COUNT, name, m_id, NEW(Sound, SND_##name##_get)) STATIC_INIT(RegisterSounds_precache) { - FOREACH(SOUNDS, true, LAMBDA({ + FOREACH(Sounds, true, LAMBDA({ it.sound_precache(it); })); } SOUND(Null, "misc/null.wav"); -#include "sounds.inc" +#include "all.inc" #endif diff --git a/qcsrc/server/_all.qh b/qcsrc/server/_all.qh index d3771bafc..f5644c004 100644 --- a/qcsrc/server/_all.qh +++ b/qcsrc/server/_all.qh @@ -10,6 +10,6 @@ #include "../dpdefs/dpextensions.qh" #include "../common/models/models.qh" -#include "../common/sounds/sounds.qh" +#include "../common/sounds/all.qh" #endif -- 2.39.2