6 // Play all sounds via sound7, for access to the extra channels.
7 // Otherwise, channels 8 to 15 would be blocked for a weird QW feature.
9 #define _sound(e, c, s, v, a) do { \
11 if (!sound_allowed(MSG_BROADCAST, __e)) break; \
12 sound7(__e, c, s, v, a, 0, 0); \
15 #define _sound(e, c, s, v, a) sound7(e, c, s, v, a, 0, 0)
17 #define sound(e, c, s, v, a) _sound(e, c, s.sound_str(), v, a)
18 // Used in places where a string is required
19 #define SND(id) (SND_##id.sound_str())
22 REGISTER_REGISTRY(RegisterSounds)
25 ATTRIB(Sound, m_id, int, 0)
26 ATTRIB(Sound, sound_str, string(), func_null)
27 CONSTRUCTOR(Sound, string() path)
30 this.sound_str = path;
32 METHOD(Sound, sound_precache, void(entity this)) {
33 string s = this.sound_str();
34 if (s && s != "" && !fexists(strcat("sound/", s))) {
35 LOG_WARNINGF("Missing sound: \"%s\"\n", s);
38 LOG_TRACEF("precache_sound(\"%s\")\n", s);
43 #define SOUND(name, path) \
44 string SND_##name##_get() { return path; } \
45 REGISTER(RegisterSounds, SND, Sounds, Sounds_COUNT, name, m_id, NEW(Sound, SND_##name##_get))
47 STATIC_INIT(RegisterSounds_precache) {
48 FOREACH(Sounds, true, LAMBDA({
49 it.sound_precache(it);
53 SOUND(Null, "misc/null.wav");