From e7f9d08042ce40eb6edf29cdc4744bc2b91f2236 Mon Sep 17 00:00:00 2001 From: Freddy Date: Mon, 5 Mar 2018 14:50:18 +0100 Subject: [PATCH] Move door_rotating_* functions into the proper file --- qcsrc/common/triggers/func/door.qc | 62 -------------------- qcsrc/common/triggers/func/door_rotating.qc | 64 ++++++++++++++++++++- qcsrc/common/triggers/func/door_rotating.qh | 5 ++ 3 files changed, 67 insertions(+), 64 deletions(-) diff --git a/qcsrc/common/triggers/func/door.qc b/qcsrc/common/triggers/func/door.qc index cfccf10a4..21ee89b7b 100644 --- a/qcsrc/common/triggers/func/door.qc +++ b/qcsrc/common/triggers/func/door.qc @@ -24,8 +24,6 @@ THINK FUNCTIONS void door_go_down(entity this); void door_go_up(entity this, entity actor, entity trigger); -void door_rotating_go_down(entity this); -void door_rotating_go_up(entity this, entity oth); void door_blocked(entity this, entity blocker) { @@ -351,66 +349,6 @@ void door_generic_plat_blocked(entity this, entity blocker) } } -void door_rotating_hit_top(entity this) -{ - if (this.noise1 != "") - _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM); - this.state = STATE_TOP; - if (this.spawnflags & DOOR_TOGGLE) - return; // don't come down automatically - setthink(this, door_rotating_go_down); - this.nextthink = this.ltime + this.wait; -} - -void door_rotating_hit_bottom(entity this) -{ - if (this.noise1 != "") - _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM); - if (this.lip==666) // this.lip is used to remember reverse opening direction for door_rotating - { - this.pos2 = '0 0 0' - this.pos2; - this.lip = 0; - } - this.state = STATE_BOTTOM; -} - -void door_rotating_go_down(entity this) -{ - if (this.noise2 != "") - _sound (this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM); - if (this.max_health) - { - this.takedamage = DAMAGE_YES; - this.health = this.max_health; - } - - this.state = STATE_DOWN; - SUB_CalcAngleMove (this, this.pos1, TSPEED_LINEAR, this.speed, door_rotating_hit_bottom); -} - -void door_rotating_go_up(entity this, entity oth) -{ - if (this.state == STATE_UP) - return; // already going up - - if (this.state == STATE_TOP) - { // reset top wait time - this.nextthink = this.ltime + this.wait; - return; - } - if (this.noise2 != "") - _sound (this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM); - this.state = STATE_UP; - SUB_CalcAngleMove (this, this.pos2, TSPEED_LINEAR, this.speed, door_rotating_hit_top); - - string oldmessage; - oldmessage = this.message; - this.message = ""; - SUB_UseTargets(this, NULL, oth); // TODO: is oth needed here? - this.message = oldmessage; -} - - /* ========================================= door trigger diff --git a/qcsrc/common/triggers/func/door_rotating.qc b/qcsrc/common/triggers/func/door_rotating.qc index d1849ab8e..f52b221ba 100644 --- a/qcsrc/common/triggers/func/door_rotating.qc +++ b/qcsrc/common/triggers/func/door_rotating.qc @@ -1,5 +1,4 @@ #include "door_rotating.qh" -#ifdef SVQC /*QUAKED spawnfunc_func_door_rotating (0 .5 .8) ? START_OPEN BIDIR DOOR_DONT_LINK BIDIR_IN_DOWN x TOGGLE X_AXIS Y_AXIS if two doors touch, they are assumed to be connected and operate as a unit. @@ -28,6 +27,68 @@ START_OPEN causes the door to move to its destination when spawned, and operate FIXME: only one sound set available at the time being */ +#ifdef GAMEQC +void door_rotating_hit_top(entity this) +{ + if (this.noise1 != "") + _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM); + this.state = STATE_TOP; + if (this.spawnflags & DOOR_TOGGLE) + return; // don't come down automatically + setthink(this, door_rotating_go_down); + this.nextthink = this.ltime + this.wait; +} + +void door_rotating_hit_bottom(entity this) +{ + if (this.noise1 != "") + _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM); + if (this.lip==666) // this.lip is used to remember reverse opening direction for door_rotating + { + this.pos2 = '0 0 0' - this.pos2; + this.lip = 0; + } + this.state = STATE_BOTTOM; +} + +void door_rotating_go_down(entity this) +{ + if (this.noise2 != "") + _sound (this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM); + if (this.max_health) + { + this.takedamage = DAMAGE_YES; + this.health = this.max_health; + } + + this.state = STATE_DOWN; + SUB_CalcAngleMove (this, this.pos1, TSPEED_LINEAR, this.speed, door_rotating_hit_bottom); +} + +void door_rotating_go_up(entity this, entity oth) +{ + if (this.state == STATE_UP) + return; // already going up + + if (this.state == STATE_TOP) + { // reset top wait time + this.nextthink = this.ltime + this.wait; + return; + } + if (this.noise2 != "") + _sound (this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM); + this.state = STATE_UP; + SUB_CalcAngleMove (this, this.pos2, TSPEED_LINEAR, this.speed, door_rotating_hit_top); + + string oldmessage; + oldmessage = this.message; + this.message = ""; + SUB_UseTargets(this, NULL, oth); // TODO: is oth needed here? + this.message = oldmessage; +} +#endif + +#ifdef SVQC void door_rotating_reset(entity this) { this.angles = this.pos1; @@ -44,7 +105,6 @@ void door_rotating_init_startopen(entity this) this.pos1 = this.movedir; } - spawnfunc(func_door_rotating) { // possible TODO: support for Quake1 keys (like func_door) diff --git a/qcsrc/common/triggers/func/door_rotating.qh b/qcsrc/common/triggers/func/door_rotating.qh index efaac5d56..eaffcf606 100644 --- a/qcsrc/common/triggers/func/door_rotating.qh +++ b/qcsrc/common/triggers/func/door_rotating.qh @@ -6,3 +6,8 @@ const int BIDIR_IN_DOWN = BIT(3); const int DOOR_ROTATING_XAXIS = BIT(6); const int DOOR_ROTATING_YAXIS = BIT(7); + +#ifdef GAMEQC +void door_rotating_go_down(entity this); +void door_rotating_go_up(entity this, entity oth); +#endif -- 2.39.2