]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move swamps across (as with all physics related stuff, currently does not work)
authorMario <zacjardine@y7mail.com>
Fri, 30 Jan 2015 09:06:25 +0000 (20:06 +1100)
committerMario <zacjardine@y7mail.com>
Fri, 30 Jan 2015 09:06:25 +0000 (20:06 +1100)
qcsrc/client/Main.qc
qcsrc/common/constants.qh
qcsrc/common/physics.qc
qcsrc/common/triggers/trigger/include.qc
qcsrc/common/triggers/trigger/include.qh
qcsrc/common/triggers/trigger/swamp.qc [new file with mode: 0644]
qcsrc/common/triggers/trigger/swamp.qh [new file with mode: 0644]
qcsrc/server/defs.qh
qcsrc/server/progs.src
qcsrc/server/t_swamp.qc [deleted file]

index 10c7dd1d0f5571ee42eaff2fa8f4dd62302fcc51..56c0eb8c942d9d2b0ff57a38dae55bc4a3779891 100644 (file)
@@ -835,6 +835,7 @@ void CSQC_Ent_Update(float bIsNewEntity)
                case ENT_CLIENT_DOOR_TRIGGER: ent_door_trigger(); break;
                case ENT_CLIENT_PLAT: ent_plat(); break;
                case ENT_CLIENT_PLAT_TRIGGER: ent_plat_trigger(); break;
+               case ENT_CLIENT_SWAMP: ent_swamp(); break;
 
                default:
                        //error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype));
index a3a8093a7f1a0a06eda143a977786fae784c9950..f296e81f412cf8fec0a7496b1928e8e3a2005004 100644 (file)
@@ -108,6 +108,7 @@ const float ENT_CLIENT_DOOR = 65;
 const float ENT_CLIENT_DOOR_TRIGGER = 66;
 const float ENT_CLIENT_PLAT = 67;
 const float ENT_CLIENT_PLAT_TRIGGER = 68;
+const float ENT_CLIENT_SWAMP = 69;
 
 const float ENT_CLIENT_HEALING_ORB = 80;
 
index 5351570cc151678d9101e80087ab4a32149f05b7..26e14e4de525fc80cddfc8b06990682e2e8b9b31 100644 (file)
@@ -1839,11 +1839,8 @@ void PM_Main()
 
        maxspeed_mod = 1;
 
-#ifdef SVQC
-       if (self.in_swamp) {
+       if (self.in_swamp)
                maxspeed_mod *= self.swamp_slowdown; //cvar("g_balance_swamp_moverate");
-       }
-#endif
 
        // conveyors: first fix velocity
        if (self.conveyor.state)
index 36e1883e804b3f7717a2598fe584b647b7393aa9..0de1d26d6e8458d1b806b17657ecefca1e2c3c85 100644 (file)
@@ -15,3 +15,4 @@
 #include "relay.qc"
 #include "relay_activators.qc"
 #include "relay_teamcheck.qc"
+#include "swamp.qc"
index 46b50b4fb24a94e8dd9fc4684882da52ee174334..dd841de1423886321eac793d99503de4d37c3b3b 100644 (file)
@@ -1,2 +1,3 @@
 #include "multi.qh"
 #include "jumppads.qh"
+#include "swamp.qh"
diff --git a/qcsrc/common/triggers/trigger/swamp.qc b/qcsrc/common/triggers/trigger/swamp.qc
new file mode 100644 (file)
index 0000000..a13aa67
--- /dev/null
@@ -0,0 +1,170 @@
+#ifdef SVQC
+void spawnfunc_trigger_swamp(void);
+#endif
+void swamp_touch(void);
+void swampslug_think();
+
+
+/*
+* Uses a entity calld swampslug to handle players in the swamp
+* It works like this: When the plyer enters teh swamp the spawnfunc_trigger_swamp
+* attaches a new "swampslug" to the player. As long as the plyer is inside
+* the swamp the swamp gives the slug new health. But the slug slowly kills itself
+* so when the player goes outside the swamp, it dies and releases the player from the
+* swamps curses (dmg/slowdown)
+*
+* I do it this way becuz there is no "untouch" event.
+*/
+void swampslug_think(void)
+{
+       //Slowly kill the slug
+       self.health = self.health - 1;
+
+       //Slug dead? then remove curses.
+       if(self.health <= 0)
+       {
+               self.owner.in_swamp = 0;
+               remove(self);
+               //centerprint(self.owner,"Killing slug...\n");
+               return;
+       }
+
+       // Slug still alive, so we are still in the swamp
+       // Or we have exited it very recently.
+       // Do the damage and renew the timer.
+#ifdef SVQC
+       Damage (self.owner, self, self, self.dmg, DEATH_SWAMP, other.origin, '0 0 0');
+#endif
+
+       self.nextthink = time + self.swamp_interval;
+}
+
+void swamp_touch(void)
+{
+       // If whatever thats touching the swamp is not a player
+       // or if its a dead player, just dont care abt it.
+       if(!IS_PLAYER(other) || PHYS_DEAD(other))
+               return;
+
+       EXACTTRIGGER_TOUCH;
+
+       // Chech if player alredy got a swampslug.
+       if(other.in_swamp != 1)
+       {
+               // If not attach one.
+               //centerprint(other,"Entering swamp!\n");
+               other.swampslug = spawn();
+               other.swampslug.health = 2;
+               other.swampslug.think = swampslug_think;
+               other.swampslug.nextthink = time;
+               other.swampslug.owner = other;
+               other.swampslug.dmg = self.dmg;
+               other.swampslug.swamp_interval = self.swamp_interval;
+               other.swamp_slowdown = self.swamp_slowdown;
+               other.in_swamp = 1;
+               return;
+       }
+
+       //other.in_swamp = 1;
+
+       //Revitalize players swampslug
+       other.swampslug.health = 2;
+}
+
+#ifdef SVQC
+float swamp_send(entity to, float sf)
+{
+       WriteByte(MSG_ENTITY, ENT_CLIENT_LADDER);
+
+       WriteByte(MSG_ENTITY, self.warpzone_isboxy);
+       WriteByte(MSG_ENTITY, self.scale);
+       WriteByte(MSG_ENTITY, self.dmg); // can probably get away with using a single byte here
+       WriteByte(MSG_ENTITY, self.swamp_slowdown);
+       WriteByte(MSG_ENTITY, self.swamp_interval);
+       WriteCoord(MSG_ENTITY, self.origin_x);
+       WriteCoord(MSG_ENTITY, self.origin_y);
+       WriteCoord(MSG_ENTITY, self.origin_z);
+
+       WriteCoord(MSG_ENTITY, self.mins_x);
+       WriteCoord(MSG_ENTITY, self.mins_y);
+       WriteCoord(MSG_ENTITY, self.mins_z);
+       WriteCoord(MSG_ENTITY, self.maxs_x);
+       WriteCoord(MSG_ENTITY, self.maxs_y);
+       WriteCoord(MSG_ENTITY, self.maxs_z);
+
+       WriteCoord(MSG_ENTITY, self.movedir_x);
+       WriteCoord(MSG_ENTITY, self.movedir_y);
+       WriteCoord(MSG_ENTITY, self.movedir_z);
+
+       WriteAngle(MSG_ENTITY, self.angles_x);
+       WriteAngle(MSG_ENTITY, self.angles_y);
+       WriteAngle(MSG_ENTITY, self.angles_z);
+
+       return TRUE;
+}
+
+void swamp_link()
+{
+       Net_LinkEntity(self, FALSE, 0, func_ladder_send);
+}
+
+/*QUAKED spawnfunc_trigger_swamp (.5 .5 .5) ?
+Players gettin into the swamp will
+get slowd down and damaged
+*/
+void spawnfunc_trigger_swamp(void)
+{
+       // Init stuff
+       EXACTTRIGGER_INIT;
+       self.touch = swamp_touch;
+
+       // Setup default keys, if missing
+       if(self.dmg <= 0)
+               self.dmg = 5;
+       if(self.swamp_interval <= 0)
+               self.swamp_interval = 1;
+       if(self.swamp_slowdown <= 0)
+               self.swamp_slowdown = 0.5;
+
+       swamp_link();
+}
+
+#elif defined(CSQC)
+
+void ent_swamp()
+{
+       self.warpzone_isboxy = ReadByte();
+       self.scale = ReadByte();
+       self.dmg = ReadByte();
+       self.swamp_slowdown = ReadByte();
+       self.swamp_interval = ReadByte();
+
+       self.origin_x = ReadCoord();
+       self.origin_y = ReadCoord();
+       self.origin_z = ReadCoord();
+       setorigin(self, self.origin);
+
+       self.mins_x = ReadCoord();
+       self.mins_y = ReadCoord();
+       self.mins_z = ReadCoord();
+       self.maxs_x = ReadCoord();
+       self.maxs_y = ReadCoord();
+       self.maxs_z = ReadCoord();
+       setsize(self, self.mins, self.maxs);
+
+       self.movedir_x = ReadCoord();
+       self.movedir_y = ReadCoord();
+       self.movedir_z = ReadCoord();
+
+       self.angles_x = ReadAngle();
+       self.angles_y = ReadAngle();
+       self.angles_z = ReadAngle();
+
+       self.classname = "trigger_swamp";
+       self.solid = SOLID_TRIGGER;
+       self.draw = trigger_draw_generic;
+       self.trigger_touch = swamp_touch;
+       self.drawmask = MASK_NORMAL;
+       self.move_time = time;
+}
+#endif
diff --git a/qcsrc/common/triggers/trigger/swamp.qh b/qcsrc/common/triggers/trigger/swamp.qh
new file mode 100644 (file)
index 0000000..c58ac5f
--- /dev/null
@@ -0,0 +1,10 @@
+.float swamp_interval; //Hurt players in swamp with this interval
+.float swamp_slowdown; //Players in swamp get slowd down by this mutch 0-1 is slowdown 1-~ is speedup (!?)
+.entity swampslug;
+
+.float in_swamp;              // bool
+.entity swampslug;            // Uses this to release from swamp ("untouch" fix)
+
+#ifdef CSQC
+void ent_swamp();
+#endif
index 752bc99cd4d80c7a50ed0479396428bb89fb0e4c..c4b5574d3b78ea1bd7bb5b522c4a92d50ab95b42 100644 (file)
@@ -179,10 +179,6 @@ float alreadychangedlevel;
 
 .float version;
 
-//swamp
-.float in_swamp;              // bool
-.entity swampslug;            // Uses this to release from swamp ("untouch" fix)
-
 // footstep interval
 .float nextstep;
 
index 0750ad3e61e73b522237972c9616a31d1a4b8746..5aa07a33d986d4241cd7fe0fe35465329dfcf6c0 100644 (file)
@@ -180,8 +180,6 @@ antilag.qc
 //nexball.qc
 g_hook.qc
 
-t_swamp.qc
-
 campaign.qc
 ../common/campaign_file.qc
 ../common/campaign_setup.qc
diff --git a/qcsrc/server/t_swamp.qc b/qcsrc/server/t_swamp.qc
deleted file mode 100644 (file)
index e481dc6..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-*              t_swamp.c
-*              Adds spawnfunc_trigger_swamp and suppoart routines for xonotic 1.2.1+
-*              Author tZork (Jakob MG)
-*              jakob@games43.se
-*              2005 11 29
-*/
-
-.float swamp_interval; //Hurt players in swamp with this interval
-.float swamp_slowdown; //Players in swamp get slowd down by this mutch 0-1 is slowdown 1-~ is speedup (!?)
-.entity swampslug;
-
-void spawnfunc_trigger_swamp(void);
-void swamp_touch(void);
-void swampslug_think();
-
-
-/*
-* Uses a entity calld swampslug to handle players in the swamp
-* It works like this: When the plyer enters teh swamp the spawnfunc_trigger_swamp
-* attaches a new "swampslug" to the player. As long as the plyer is inside
-* the swamp the swamp gives the slug new health. But the slug slowly kills itself
-* so when the player goes outside the swamp, it dies and releases the player from the
-* swamps curses (dmg/slowdown)
-*
-* I do it this way becuz there is no "untouch" event.
-*
-* --NOTE--
-* THE ACCTUAL slowdown is done in cl_physics.c on line 57-60
-* --NOTE--
-*/
-void swampslug_think(void)
-{
-       //Slowly kill the slug
-       self.health = self.health - 1;
-
-       //Slug dead? then remove curses.
-       if(self.health <= 0) {
-               self.owner.in_swamp = 0;
-               remove(self);
-               //centerprint(self.owner,"Killing slug...\n");
-               return;
-       }
-
-       // Slug still alive, so we are still in the swamp
-       // Or we have exited it very recently.
-       // Do the damage and renew the timer.
-       Damage (self.owner, self, self, self.dmg, DEATH_SWAMP, other.origin, '0 0 0');
-
-       self.nextthink = time + self.swamp_interval;
-}
-
-void swamp_touch(void)
-{
-       // If whatever thats touching the swamp is not a player
-       // or if its a dead player, just dont care abt it.
-       if(!IS_PLAYER(other) || other.deadflag != DEAD_NO)
-               return;
-
-       EXACTTRIGGER_TOUCH;
-
-       // Chech if player alredy got a swampslug.
-       if(other.in_swamp != 1) {
-               // If not attach one.
-               //centerprint(other,"Entering swamp!\n");
-               other.swampslug = spawn();
-               other.swampslug.health = 2;
-               other.swampslug.think = swampslug_think;
-               other.swampslug.nextthink = time;
-               other.swampslug.owner = other;
-               other.swampslug.dmg = self.dmg;
-               other.swampslug.swamp_interval = self.swamp_interval;
-               other.swamp_slowdown = self.swamp_slowdown;
-               other.in_swamp = 1;
-               return;
-       }
-
-       //other.in_swamp = 1;
-
-       //Revitalize players swampslug
-       other.swampslug.health = 2;
-}
-
-/*QUAKED spawnfunc_trigger_swamp (.5 .5 .5) ?
-Players gettin into the swamp will
-get slowd down and damaged
-*/
-void spawnfunc_trigger_swamp(void)
-{
-       // Init stuff
-       EXACTTRIGGER_INIT;
-       self.touch = swamp_touch;
-
-       // Setup default keys, if missing
-       if(self.dmg <= 0)
-               self.dmg = 5;
-       if(self.swamp_interval <= 0)
-               self.swamp_interval = 1;
-       if(self.swamp_slowdown <= 0)
-               self.swamp_slowdown = 0.5;
-}