]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
q3compat: enable default and custom CPMA sounds for func_door and func_plat
authorbones_was_here <bones_was_here@xa.org.au>
Wed, 9 Sep 2020 17:50:32 +0000 (03:50 +1000)
committerbones_was_here <bones_was_here@xa.org.au>
Wed, 9 Sep 2020 17:50:32 +0000 (03:50 +1000)
qcsrc/common/mapobjects/func/door.qc
qcsrc/common/mapobjects/func/plat.qc

index 48e11ad87bc528c3867b12312a7aa24c86f6710f..173c9d9cdec4b23f949d1e44055be6b91a3a065f 100644 (file)
@@ -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 != "")
        {
index 64275a357aaa216e28a34c528da312aaabd441dc..d001fe299dd835821f9815e59aed842b35e551eb 100644 (file)
@@ -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);