From 88f2303be7570b1183aa8edb66490194d8661ca2 Mon Sep 17 00:00:00 2001 From: Freddy Date: Mon, 5 Mar 2018 13:26:24 +0100 Subject: [PATCH] Replace magic numbers in door_rotating, fix sound precache issues Also remove useless spawnflag check --- qcsrc/common/triggers/func/door_rotating.qc | 19 +++++++++++-------- qcsrc/common/triggers/func/door_rotating.qh | 4 ++++ 2 files changed, 15 insertions(+), 8 deletions(-) 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); -- 2.39.2