From: Freddy Date: Mon, 5 Mar 2018 12:26:24 +0000 (+0100) Subject: Replace magic numbers in door_rotating, fix sound precache issues X-Git-Tag: xonotic-v0.8.5~2176^2~49 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=88f2303be7570b1183aa8edb66490194d8661ca2;p=xonotic%2Fxonotic-data.pk3dir.git Replace magic numbers in door_rotating, fix sound precache issues Also remove useless spawnflag check --- diff --git a/qcsrc/common/triggers/func/door_rotating.qc b/qcsrc/common/triggers/func/door_rotating.qc index c61a02686..04cd81a40 100644 --- a/qcsrc/common/triggers/func/door_rotating.qc +++ b/qcsrc/common/triggers/func/door_rotating.qc @@ -52,9 +52,9 @@ spawnfunc(func_door_rotating) // this.deathtype = " got in the way"; // I abuse "movedir" for denoting the axis for now - if (this.spawnflags & 64) // X (untested) + if (this.spawnflags & DOOR_ROTATING_XAXIS) this.movedir = '0 0 1'; - else if (this.spawnflags & 128) // Y (untested) + else if (this.spawnflags & DOOR_ROTATING_YAXIS) this.movedir = '1 0 0'; else // Z this.movedir = '0 1 0'; @@ -75,21 +75,24 @@ spawnfunc(func_door_rotating) setblocked(this, door_blocked); this.use = door_use; - if(this.spawnflags & 8) - this.dmg = 10000; - if(this.dmg && (this.message == "")) this.message = "was squished"; if(this.dmg && (this.message2 == "")) this.message2 = "was squished by"; - if (this.sounds > 0) + if (this.sounds > 0) { - precache_sound ("plats/medplat1.wav"); - precache_sound ("plats/medplat2.wav"); this.noise2 = "plats/medplat1.wav"; this.noise1 = "plats/medplat2.wav"; } + if(this.noise1 && this.noise1 != "") + { + precache_sound(this.noise1); + } + if(this.noise2 && this.noise2 != "") + { + precache_sound(this.noise2); + } if (!this.speed) this.speed = 50; diff --git a/qcsrc/common/triggers/func/door_rotating.qh b/qcsrc/common/triggers/func/door_rotating.qh index 6f70f09be..2e299b205 100644 --- a/qcsrc/common/triggers/func/door_rotating.qh +++ b/qcsrc/common/triggers/func/door_rotating.qh @@ -1 +1,5 @@ #pragma once + + +const int DOOR_ROTATING_XAXIS = BIT(6); +const int DOOR_ROTATING_YAXIS = BIT(7);