From b47ae975aab2dffac110dc49a8195797d1a417be Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Wed, 12 Oct 2022 23:01:51 +1000 Subject: [PATCH] func_door: fix bug where doors blocked by players never reversed direction This bug was inherited from Nexuiz. It worked properly in Quake which didn't have this condition, and in Quake 3. --- qcsrc/common/mapobjects/func/door.qc | 37 ++++++++++++++-------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/qcsrc/common/mapobjects/func/door.qc b/qcsrc/common/mapobjects/func/door.qc index 2de9cb0b4..df81f43b8 100644 --- a/qcsrc/common/mapobjects/func/door.qc +++ b/qcsrc/common/mapobjects/func/door.qc @@ -47,31 +47,29 @@ void door_blocked(entity this, entity blocker) Damage (blocker, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0'); #endif - // don't change direction for dead or dying stuff - if(IS_DEAD(blocker) + // don't change direction for dead or dying stuff + if(!IS_DEAD(blocker) #ifdef SVQC - && (blocker.takedamage == DAMAGE_NO) + && blocker.takedamage != DAMAGE_NO #endif + && this.wait >= 0 ) { - if (this.wait >= 0) + if (this.state == STATE_DOWN) { - if (this.state == STATE_DOWN) - { - if (this.classname == "door") - door_go_up(this, NULL, NULL); - else - door_rotating_go_up(this, blocker); - } + if (this.classname == "door") + door_go_up(this, NULL, NULL); else - { - if (this.classname == "door") - door_go_down(this); - else - door_rotating_go_down(this); - } - reverse = true; + door_rotating_go_up(this, blocker); + } + else + { + if (this.classname == "door") + door_go_down(this); + else + door_rotating_go_down(this); } + reverse = true; } #ifdef SVQC else @@ -82,7 +80,8 @@ void door_blocked(entity this, entity blocker) } #endif } - if (!reverse && this.classname == "door") + // if we didn't change direction and are using a non-linear movement controller, we must pause it + if (!reverse && this.classname == "door" && this.move_controller) SUB_CalcMovePause(this); } -- 2.39.2