From: bones_was_here Date: Wed, 9 Sep 2020 17:50:32 +0000 (+1000) Subject: q3compat: enable default and custom CPMA sounds for func_door and func_plat X-Git-Tag: xonotic-v0.8.5~352^2~31 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6a69729afb9f2242d0a3f6f5f2415bdb3e954692;p=xonotic%2Fxonotic-data.pk3dir.git q3compat: enable default and custom CPMA sounds for func_door and func_plat --- 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);