From 6a69729afb9f2242d0a3f6f5f2415bdb3e954692 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Thu, 10 Sep 2020 03:50:32 +1000 Subject: [PATCH] q3compat: enable default and custom CPMA sounds for func_door and func_plat --- qcsrc/common/mapobjects/func/door.qc | 15 ++++++++++++++- qcsrc/common/mapobjects/func/plat.qc | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/qcsrc/common/mapobjects/func/door.qc b/qcsrc/common/mapobjects/func/door.qc index 48e11ad87..173c9d9cd 100644 --- a/qcsrc/common/mapobjects/func/door.qc +++ b/qcsrc/common/mapobjects/func/door.qc @@ -653,12 +653,25 @@ void door_init_shared(entity this) } // TODO: other soundpacks - if (this.sounds > 0) + if (this.sounds > 0 || q3compat) { + // Doors in Q3 always have sounds (they're hard coded in Q3 engine) this.noise2 = "plats/medplat1.wav"; this.noise1 = "plats/medplat2.wav"; } + if (q3compat) + { + // CPMA adds these fields for overriding the engine sounds + string s = GetField_fullspawndata(this, "sound_start", true); + string e = GetField_fullspawndata(this, "sound_end", true); + + if (s) + this.noise2 = strzone(s); + if (e) + this.noise1 = strzone(e); + } + // sound when door stops moving if(this.noise1 && this.noise1 != "") { diff --git a/qcsrc/common/mapobjects/func/plat.qc b/qcsrc/common/mapobjects/func/plat.qc index 64275a357..d001fe299 100644 --- a/qcsrc/common/mapobjects/func/plat.qc +++ b/qcsrc/common/mapobjects/func/plat.qc @@ -76,8 +76,9 @@ spawnfunc(func_plat) this.noise1 = "plats/plat2.wav"; } - if (this.sounds == 2) + if (this.sounds == 2 || q3compat) { + // Plats in Q3 always have sounds (they're hard coded in Q3 engine) this.noise = "plats/medplat1.wav"; this.noise1 = "plats/medplat2.wav"; } @@ -88,6 +89,18 @@ spawnfunc(func_plat) if (this.sound2) this.noise1 = this.sound2; + if (q3compat) + { + // CPMA adds these fields for overriding the engine sounds + string s = GetField_fullspawndata(this, "sound_start", true); + string e = GetField_fullspawndata(this, "sound_end", true); + + if (s) + this.noise = strzone(s); + if (e) + this.noise1 = strzone(e); + } + if(this.noise && this.noise != "") { precache_sound(this.noise); -- 2.39.2