]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move entity spawnflags to a common file
authorFreddy <schro.sb@gmail.com>
Tue, 6 Mar 2018 14:42:58 +0000 (15:42 +0100)
committerFreddy <schro.sb@gmail.com>
Tue, 6 Mar 2018 14:42:58 +0000 (15:42 +0100)
16 files changed:
qcsrc/common/triggers/func/bobbing.qc
qcsrc/common/triggers/func/bobbing.qh
qcsrc/common/triggers/func/button.qc
qcsrc/common/triggers/func/button.qh
qcsrc/common/triggers/func/door.qc
qcsrc/common/triggers/func/door.qh
qcsrc/common/triggers/func/door_rotating.qh
qcsrc/common/triggers/func/door_secret.qc
qcsrc/common/triggers/func/door_secret.qh
qcsrc/common/triggers/platforms.qh
qcsrc/common/triggers/spawnflags.qh [new file with mode: 0644]
qcsrc/common/triggers/teleporters.qh
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/jumppads.qh
qcsrc/common/triggers/trigger/viewloc.qh
qcsrc/common/triggers/triggers.qh

index ff8841a570030853d2ce70b1602bc06ba2c31c60..b647e15a826e48164f03db46c5f62114a8e6afc6 100644 (file)
@@ -59,9 +59,9 @@ spawnfunc(func_bobbing)
        this.dmgtime2 = time;
 
        // how far to bob
-       if (this.spawnflags & 1) // X
+       if (this.spawnflags & BOBBING_XAXIS)
                this.movedir = '1 0 0' * this.height;
-       else if (this.spawnflags & 2) // Y
+       else if (this.spawnflags & BOBBING_YAXIS)
                this.movedir = '0 1 0' * this.height;
        else // Z
                this.movedir = '0 0 1' * this.height;
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..7c39519e10e9f29d62f38ee0bc76f0dd4b0ed584 100644 (file)
@@ -1 +1,2 @@
 #pragma once
+#include "../spawnflags.qh"
index 4f2d01fcd1e8254c639823f5f9df0567fa9f9c12..8e5e3530e3512759e9423ddac0975cbdc0ccdd7a 100644 (file)
@@ -1,4 +1,5 @@
 #include "button.qh"
+#include "../spawnflags.qh"
 #ifdef SVQC
 // button and multiple button
 
index 75a6006eb5e703e24b79362c9df7b0f39e328376..6f70f09beec2219624baeca92e2cd7deaa104fb4 100644 (file)
@@ -1,3 +1 @@
 #pragma once
-
-const int BUTTON_DONTACCUMULATEDMG = 128;
index 6b3161669933f1d0ec90d825e11ca83b77ca5b7d..5b4fae04303818c4300d7c083aca2bd02985a047 100644 (file)
@@ -239,12 +239,12 @@ void door_fire(entity this, entity actor, entity trigger)
                        door_go_up(e, actor, trigger);
                } else {
                        // if the BIDIR spawnflag (==2) is set and the trigger has set trigger_reverse, reverse the opening direction
-                       if ((e.spawnflags & BIDIR) && trigger.trigger_reverse!=0 && e.lip != 666 && e.state == STATE_BOTTOM) {
+                       if ((e.spawnflags & DOOR_ROTATING_BIDIR) && trigger.trigger_reverse!=0 && e.lip != 666 && e.state == STATE_BOTTOM) {
                                e.lip = 666; // e.lip is used to remember reverse opening direction for door_rotating
                                e.pos2 = '0 0 0' - e.pos2;
                        }
                        // if BIDIR_IN_DOWN (==8) is set, prevent the door from reoping during closing if it is triggered from the wrong side
-                       if (!((e.spawnflags & BIDIR) &&  (e.spawnflags & BIDIR_IN_DOWN) && e.state == STATE_DOWN
+                       if (!((e.spawnflags & DOOR_ROTATING_BIDIR) &&  (e.spawnflags & DOOR_ROTATING_BIDIR_IN_DOWN) && e.state == STATE_DOWN
                                && (((e.lip == 666) && (trigger.trigger_reverse == 0)) || ((e.lip != 666) && (trigger.trigger_reverse != 0)))))
                        {
                                door_rotating_go_up(e, trigger);
index 23ba20df142f7244313e8d04293e85697dab8ad3..faf137d6b3960b159e253d994abe79b632316fd0 100644 (file)
@@ -1,17 +1,6 @@
 #pragma once
+#include "../spawnflags.qh"
 
-// door constants
-const int DOOR_START_OPEN = BIT(0);
-const int DOOR_DONT_LINK = BIT(2);
-const int DOOR_TOGGLE = BIT(5);
-
-const int DOOR_NOSPLASH = BIT(8); // generic anti-splashdamage spawnflag
-
-const int DOOR_NONSOLID = BIT(10);
-const int DOOR_CRUSH = BIT(11); // can't use PLAT_CRUSH cause that is the same as DOOR_DONT_LINK
-
-const int SPAWNFLAGS_GOLD_KEY = BIT(3);
-const int SPAWNFLAGS_SILVER_KEY = BIT(4);
 
 #ifdef CSQC
 // stuff for preload
index eaffcf6061467edfd782fa4d014a6b97816cc587..a5cf76932cb727a212eed91e559f8f1965cc5913 100644 (file)
@@ -1,12 +1,6 @@
 #pragma once
 
 
-const int BIDIR = BIT(1);
-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);
index 35b2296f856d17e981a066428984019d24bf059e..78e0dd64e9cafc275eb55c1a6d1302cdcde2cdd5 100644 (file)
@@ -35,12 +35,12 @@ void fd_secret_use(entity this, entity actor, entity trigger)
                _sound(this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM);
        this.nextthink = this.ltime + 0.1;
 
-       temp = 1 - (this.spawnflags & SECRET_1ST_LEFT); // 1 or -1
+       temp = 1 - (this.spawnflags & DOOR_SECRET_1ST_LEFT);    // 1 or -1
        makevectors(this.mangle);
 
        if (!this.t_width)
        {
-               if (this.spawnflags & SECRET_1ST_DOWN)
+               if (this.spawnflags & DOOR_SECRET_1ST_DOWN)
                        this.t_width = fabs(v_up * this.size);
                else
                        this.t_width = fabs(v_right * this.size);
@@ -49,7 +49,7 @@ void fd_secret_use(entity this, entity actor, entity trigger)
        if (!this.t_length)
                this.t_length = fabs(v_forward * this.size);
 
-       if (this.spawnflags & SECRET_1ST_DOWN)
+       if (this.spawnflags & DOOR_SECRET_1ST_DOWN)
                this.dest1 = this.origin - v_up * this.t_width;
        else
                this.dest1 = this.origin + v_right * (this.t_width * temp);
@@ -87,7 +87,7 @@ void fd_secret_move3(entity this)
 {
        if (this.noise3 != "")
                _sound(this, CH_TRIGGER_SINGLE, this.noise3, VOL_BASE, ATTEN_NORM);
-       if (!(this.spawnflags & SECRET_OPEN_ONCE) && this.wait >= 0)
+       if (!(this.spawnflags & DOOR_SECRET_OPEN_ONCE) && this.wait >= 0)
        {
                this.nextthink = this.ltime + this.wait;
                setthink(this, fd_secret_move4);
@@ -120,7 +120,7 @@ void fd_secret_move6(entity this)
 
 void fd_secret_done(entity this)
 {
-       if (this.spawnflags&SECRET_YES_SHOOT)
+       if (this.spawnflags&DOOR_SECRET_YES_SHOOT)
        {
                this.health = 10000;
                this.takedamage = DAMAGE_YES;
@@ -166,7 +166,7 @@ void secret_touch(entity this, entity toucher)
 
 void secret_reset(entity this)
 {
-       if (this.spawnflags & SECRET_YES_SHOOT)
+       if (this.spawnflags & DOOR_SECRET_YES_SHOOT)
        {
                this.health = 10000;
                this.takedamage = DAMAGE_YES;
@@ -248,9 +248,9 @@ spawnfunc(func_door_secret)
        {
        }
        else
-               this.spawnflags |= SECRET_YES_SHOOT;
+               this.spawnflags |= DOOR_SECRET_YES_SHOOT;
 
-       if (this.spawnflags & SECRET_YES_SHOOT)
+       if (this.spawnflags & DOOR_SECRET_YES_SHOOT)
        {
                //this.canteamdamage = true; // TODO
                this.health = 10000;
index 92134648f6680f6a42a4dc08b934fa8cd3ba4666..7c39519e10e9f29d62f38ee0bc76f0dd4b0ed584 100644 (file)
@@ -1,8 +1,2 @@
 #pragma once
-
-
-const int SECRET_OPEN_ONCE = BIT(0);           // stays open - LEGACY, set wait to -1 instead
-const int SECRET_1ST_LEFT = BIT(1);            // 1st move is left of arrow
-const int SECRET_1ST_DOWN = BIT(2);            // 1st move is down from arrow
-const int SECRET_NO_SHOOT = BIT(3);            // only opened by trigger
-const int SECRET_YES_SHOOT = BIT(4);   // shootable even if targeted
+#include "../spawnflags.qh"
index 72e17cd9ecea712f811805e6c18e2faa8822e825..83e77ef66ee5170c45fe45fb29d93d6f1eac4280 100644 (file)
@@ -1,4 +1,5 @@
 #pragma once
+#include "spawnflags.qh"
 
 .float dmgtime2;
 
@@ -8,8 +9,5 @@ void plat_trigger_use(entity this, entity actor, entity trigger);
 void plat_go_up(entity this);
 void plat_go_down(entity this);
 void plat_crush(entity this, entity blocker);
-const float PLAT_LOW_TRIGGER = 1;
-
-const int PLAT_CRUSH = BIT(2);
 
 .float dmg;
diff --git a/qcsrc/common/triggers/spawnflags.qh b/qcsrc/common/triggers/spawnflags.qh
new file mode 100644 (file)
index 0000000..051a243
--- /dev/null
@@ -0,0 +1,59 @@
+#pragma once
+
+// bobbing
+const int BOBBING_XAXIS = BIT(0);
+const int BOBBING_YAXIS = BIT(1);
+
+// button
+const int BUTTON_DONTACCUMULATEDMG = BIT(7);
+
+// door, door_rotating and door_secret
+const int DOOR_START_OPEN = BIT(0);
+const int DOOR_DONT_LINK = BIT(2);
+const int SPAWNFLAGS_GOLD_KEY = BIT(3); // Quake 1 compat, can only be used with func_door!
+const int SPAWNFLAGS_SILVER_KEY = BIT(4); // Quake 1 compat, can only be used with func_door!
+const int DOOR_TOGGLE = BIT(5);
+
+const int DOOR_NOSPLASH = BIT(8); // generic anti-splashdamage spawnflag
+
+const int DOOR_NONSOLID = BIT(10);
+const int DOOR_CRUSH = BIT(11); // can't use PLAT_CRUSH cause that is the same as DOOR_DONT_LINK
+
+const int DOOR_ROTATING_BIDIR = BIT(1);
+const int DOOR_ROTATING_BIDIR_IN_DOWN = BIT(3);
+
+const int DOOR_ROTATING_XAXIS = BIT(6);
+const int DOOR_ROTATING_YAXIS = BIT(7);
+
+const int DOOR_SECRET_OPEN_ONCE = BIT(0); // stays open - LEGACY, set wait to -1 instead
+const int DOOR_SECRET_1ST_LEFT = BIT(1); // 1st move is left of arrow
+const int DOOR_SECRET_1ST_DOWN = BIT(2); // 1st move is down from arrow
+const int DOOR_SECRET_NO_SHOOT = BIT(3); // only opened by trigger
+const int DOOR_SECRET_YES_SHOOT = BIT(4); // shootable even if targeted
+
+// jumppads
+const int PUSH_ONCE = BIT(0);
+const int PUSH_SILENT = BIT(1); // not used?
+
+// viewloc
+const int VIEWLOC_NOSIDESCROLL = BIT(0); // NOTE: currently unimplemented
+const int VIEWLOC_FREEAIM = BIT(1);
+const int VIEWLOC_FREEMOVE = BIT(2);
+
+// platforms
+const int PLAT_LOW_TRIGGER = BIT(0);
+const int PLAT_CRUSH = BIT(2);
+
+// teleport
+const int TELEPORT_FLAG_SOUND = BIT(0);
+const int TELEPORT_FLAG_PARTICLES = BIT(1);
+const int TELEPORT_FLAG_TDEATH = BIT(2);
+const int TELEPORT_FLAG_FORCE_TDEATH = BIT(3);
+
+// triggers
+const int SF_TRIGGER_INIT = BIT(0);
+const int SF_TRIGGER_UPDATE = BIT(1);
+const int SF_TRIGGER_RESET = BIT(2);
+
+const int SPAWNFLAG_NOMESSAGE = BIT(0);
+const int SPAWNFLAG_NOTOUCH = BIT(0); // why are these the same?
index 6f5b2b595d8c09a110839cb4aeb3ca3a3ef11f42..6056e0696638008dba3624d0d77713a522f7550b 100644 (file)
@@ -1,13 +1,10 @@
 #pragma once
+#include "spawnflags.qh"
 
 IntrusiveList g_teleporters;
 STATIC_INIT(g_teleporters) { g_teleporters = IL_NEW(); }
 
 .entity pusher;
-const float TELEPORT_FLAG_SOUND = 1;
-const float TELEPORT_FLAG_PARTICLES = 2;
-const float TELEPORT_FLAG_TDEATH = 4;
-const float TELEPORT_FLAG_FORCE_TDEATH = 8;
 
 #define TELEPORT_FLAGS_WARPZONE   0
 #define TELEPORT_FLAGS_PORTAL     (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH | TELEPORT_FLAG_FORCE_TDEATH)
index fde6e1fb9d6cf58e091ead371e1705dab06fbf49..53e93d4a2c3a7a3ea3028edfc3d84fc5d61787f6 100644 (file)
@@ -1,7 +1,6 @@
 #include "jumppads.qh"
 // TODO: split target_push and put it in the target folder
 #ifdef SVQC
-#include "jumppads.qh"
 #include <common/physics/movetypes/movetypes.qh>
 
 void trigger_push_use(entity this, entity actor, entity trigger)
index 50ed0a343c8c86b7cc53e12274ddac7261bead75..99aa5cb813715308e6917587eecd67cc92d31213 100644 (file)
@@ -1,11 +1,9 @@
 #pragma once
+#include "../spawnflags.qh"
 
 IntrusiveList g_jumppads;
 STATIC_INIT(g_jumppads) { g_jumppads = IL_NEW(); }
 
-const float PUSH_ONCE          = 1;
-const float PUSH_SILENT                = 2;
-
 .float pushltime;
 .float istypefrag;
 .float height;
index 69c6c821ed7f23cde5c765a3f8bb989f1c2de2c8..d8e2bb3d86f63a4dc26ca4dfc405d194bae5c449 100644 (file)
@@ -1,11 +1,8 @@
 #pragma once
+#include "../spawnflags.qh"
 
 .entity viewloc;
 
-const int VIEWLOC_NOSIDESCROLL = BIT(0); // NOTE: currently unimplemented
-const int VIEWLOC_FREEAIM = BIT(1);
-const int VIEWLOC_FREEMOVE = BIT(2);
-
 #ifdef CSQC
 .entity goalentity;
 .entity enemy;
index 2b8274f4b890aa473b5432de2415bb1719e925a1..b609d1d54bad0727544f343f9cf40df362868745 100644 (file)
@@ -1,11 +1,5 @@
 #pragma once
-
-const float SF_TRIGGER_INIT = 1;
-const float SF_TRIGGER_UPDATE = 2;
-const float SF_TRIGGER_RESET = 4;
-
-const float    SPAWNFLAG_NOMESSAGE = 1;
-const float    SPAWNFLAG_NOTOUCH = 1;
+#include "spawnflags.qh"
 
 .bool pushable;