]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make projectiles and items interact with jumppads in CSQC
authorMario <mario@smbclan.net>
Fri, 18 Dec 2015 00:55:41 +0000 (10:55 +1000)
committerMario <mario@smbclan.net>
Fri, 18 Dec 2015 00:55:58 +0000 (10:55 +1000)
qcsrc/client/weapons/projectile.qc
qcsrc/client/weapons/projectile.qh
qcsrc/common/movetypes/movetypes.qc
qcsrc/common/physics.qh
qcsrc/common/triggers/teleporters.qc
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/teleport.qc
qcsrc/common/triggers/triggers.qh
qcsrc/server/defs.qh
qcsrc/server/t_items.qc

index 1b79f7d589ca31497f01e4ddddae42ae5fb7ceab..04d728480c114972119d6792757d5027c3259bbb 100644 (file)
@@ -202,6 +202,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew)
 
        int f = ReadByte();
        self.count = (f & 0x80);
+       self.flags |= FL_PROJECTILE;
        self.iflags = (self.iflags & IFLAG_INTERNALMASK) | IFLAG_AUTOANGLES | IFLAG_ANGLES | IFLAG_ORIGIN;
        self.solid = SOLID_TRIGGER;
        // self.effects = EF_NOMODELFLAGS;
index 699f48938e9f10f2402c52b06ea575ba6db5875a..a925f34c68732b715b9647e0319f1c489a259f33 100644 (file)
@@ -29,4 +29,6 @@ void loopsound(entity e, int ch, string samp, float vol, float attn);
 
 void Ent_RemoveProjectile();
 
+const int FL_PROJECTILE = BIT(15);
+
 #endif
index e03e9fae413ca5988090aef046981d96fd0a8dc1..ab7d51fe6de7c59006e876f599058fdaca69bdc1 100644 (file)
@@ -587,6 +587,7 @@ void _Movetype_Physics_Frame(entity this, float movedt)
                case MOVETYPE_FLY:
                case MOVETYPE_FLY_WORLDONLY:
                        _Movetype_Physics_Toss(this, movedt);
+                       _Movetype_LinkEdict(this, true);
                        break;
                case MOVETYPE_PHYSICS:
                        break;
index 1062b683073c98ab1942df2bbc872385a1b73100..92891ead255826e5c52445ab90bd18cbca5c5a60 100644 (file)
@@ -114,7 +114,7 @@ bool IsFlying(entity a);
        #define IS_CLIENT(s)                                            (s).isplayermodel
        #define IS_PLAYER(s)                                            (s).isplayermodel
        #define IS_NOT_A_CLIENT(s)                                 !(s).isplayermodel
-       #define isPushable(s)                                           (s).isplayermodel
+       #define isPushable(s)                                           ((s).isplayermodel || (s).pushable || ((s).flags & FL_PROJECTILE))
 
        //float player_multijump;
        //float player_jumpheight;
index 89653e8b84c42b8234b8c7c4e47ebbbc43218b67..0ddc833103f2050e6abf046fa5b06a002f176e19 100644 (file)
@@ -120,8 +120,12 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle
        player.iflags |= IFLAG_TELEPORTED | IFLAG_V_ANGLE | IFLAG_ANGLES;
        player.csqcmodel_teleported = 1;
        player.v_angle = to_angles;
-       setproperty(VF_ANGLES, player.move_angles);
-       setproperty(VF_CL_VIEWANGLES, player.move_angles);
+
+       if(player.isplayermodel) // not for anything but the main player
+       {
+               setproperty(VF_ANGLES, player.move_angles);
+               setproperty(VF_CL_VIEWANGLES, player.move_angles);
+       }
 
        makevectors(player.move_angles);
 #endif
index 8aa80a031259cce4b13f127db3c5a52d739e6747..1f2f84a7d8602c64a4386b0e41d54a95e0103569 100644 (file)
@@ -134,10 +134,8 @@ void trigger_push_touch()
        if (this.active == ACTIVE_NOT)
                return;
 
-#ifdef SVQC
        if (!isPushable(other))
                return;
-#endif
 
        if(this.team)
                if(((this.spawnflags & 4) == 0) == (DIFF_TEAM(this, other)))
@@ -174,6 +172,22 @@ void trigger_push_touch()
        UNSET_ONGROUND(other);
 #elif defined(CSQC)
        other.move_flags &= ~FL_ONGROUND;
+
+       if (other.flags & FL_PROJECTILE)
+       {
+               other.move_angles = vectoangles (other.move_velocity);
+               switch(other.move_movetype)
+               {
+                       case MOVETYPE_FLY:
+                               other.move_movetype = MOVETYPE_TOSS;
+                               other.gravity = 1;
+                               break;
+                       case MOVETYPE_BOUNCEMISSILE:
+                               other.move_movetype = MOVETYPE_BOUNCE;
+                               other.gravity = 1;
+                               break;
+               }
+       }
 #endif
 
 #ifdef SVQC
@@ -243,11 +257,11 @@ void trigger_push_touch()
                UpdateCSQCProjectile(other);
        }
 
-       if (other.flags & FL_ITEM)
+       /*if (other.flags & FL_ITEM)
        {
                ItemUpdate(other);
                other.SendFlags |= ISF_DROP;
-       }
+       }*/
 
        if (this.spawnflags & PUSH_ONCE)
        {
index 48b0341d33c832315133470715c668d844fd6b4c..5735f0bb5ee4ea0132691d93176dee69a68035bd 100644 (file)
@@ -26,6 +26,9 @@ void Teleport_Touch ()
 
        if(IS_TURRET(other))
                return;
+#elif defined(CSQC)
+       if(!IS_PLAYER(other))
+               return;
 #endif
 
        if(PHYS_DEAD(other))
index 31b8be4416b83f7beb86644549b66197bca4628a..5c000cff16d5ce198f7cc3eb75d2107e40e51e9b 100644 (file)
@@ -10,6 +10,8 @@ const float   SPAWNFLAG_NOTOUCH = 1;
 
 .void() trigger_touch;
 
+.bool pushable;
+
 .float antiwall_flag; // Variable to define what to do with func_clientwall
 // 0 == do nothing, 1 == deactivate, 2 == activate
 
index 1674f6d1daba7ee170d05fbcb0cbb03b5478b7df..28fd9b0c6e949ae746b48e078f9bc50bc3cbd13c 100644 (file)
@@ -129,7 +129,6 @@ const float MAX_DAMAGEEXTRARADIUS = 16;
 .float iscreature;
 .float damagedbycontents;
 .float damagedbytriggers;
-.float pushable;
 .float teleportable;
 .vector oldvelocity;
 
index 432bfc36630a1bb69e4ab96b0b4f7caa110ad5ab..29c8669bb090a06b0756c02e5b1a34b27978fb6f 100644 (file)
 REGISTER_NET_LINKED(ENT_CLIENT_ITEM)
 
 #ifdef CSQC
-void ItemDraw(entity self)
+void ItemDraw(entity this)
 {
-    if(self.gravity)
+    if(this.gravity)
     {
-        Movetype_Physics_MatchServer(self, autocvar_cl_projectiles_sloppy);
-        if(self.move_flags & FL_ONGROUND)
+        Movetype_Physics_MatchServer(this, false);
+        if(this.move_flags & FL_ONGROUND)
         { // For some reason move_avelocity gets set to '0 0 0' here ...
-            self.oldorigin = self.origin;
-            self.gravity = 0;
+            this.oldorigin = this.origin;
+            this.gravity = 0;
 
             if(autocvar_cl_animate_items)
             { // ... so reset it if animations are requested.
-                if(self.ItemStatus & ITS_ANIMATE1)
-                    self.move_avelocity = '0 180 0';
+                if(this.ItemStatus & ITS_ANIMATE1)
+                    this.move_avelocity = '0 180 0';
 
-                if(self.ItemStatus & ITS_ANIMATE2)
-                    self.move_avelocity = '0 -90 0';
+                if(this.ItemStatus & ITS_ANIMATE2)
+                    this.move_avelocity = '0 -90 0';
             }
         }
     }
     else if (autocvar_cl_animate_items)
     {
-        if(self.ItemStatus & ITS_ANIMATE1)
+        if(this.ItemStatus & ITS_ANIMATE1)
         {
-            self.angles += self.move_avelocity * frametime;
-            setorigin(self, '0 0 10' + self.oldorigin + '0 0 8' * sin(time * 2));
+            this.angles += this.move_avelocity * frametime;
+            setorigin(this, '0 0 10' + this.oldorigin + '0 0 8' * sin(time * 2));
         }
 
-        if(self.ItemStatus & ITS_ANIMATE2)
+        if(this.ItemStatus & ITS_ANIMATE2)
         {
-            self.angles += self.move_avelocity * frametime;
-            setorigin(self, '0 0 8' + self.oldorigin + '0 0 4' * sin(time * 3));
+            this.angles += this.move_avelocity * frametime;
+            setorigin(this, '0 0 8' + this.oldorigin + '0 0 4' * sin(time * 3));
         }
     }
 }
 
 void ItemDrawSimple(entity this)
 {
-    if(self.gravity)
+    if(this.gravity)
     {
-        Movetype_Physics_MatchServer(self, autocvar_cl_projectiles_sloppy);
+        Movetype_Physics_MatchServer(this, false);
 
-        if(self.move_flags & FL_ONGROUND)
-            self.gravity = 0;
+        if(this.move_flags & FL_ONGROUND)
+            this.gravity = 0;
     }
 }
 
@@ -172,8 +172,9 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
     if(sf & ISF_MODEL)
     {
         self.drawmask  = MASK_NORMAL;
-               self.move_movetype = self.movetype = MOVETYPE_TOSS;
+               self.move_movetype = MOVETYPE_TOSS;
         self.draw       = ItemDraw;
+        self.solid = SOLID_TRIGGER;
         //self.move_flags |= FL_ITEM;
 
         bool use_bigsize = ReadByte();
@@ -214,7 +215,7 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
 
 
         if(self.mdl == "")
-            LOG_TRACE("^1WARNING!^7 self.mdl is unset for item ", self.classname, " tell tZork aboute this!\n");
+            LOG_TRACE("^1WARNING!^7 self.mdl is unset for item ", self.classname, ", tell tZork about this!\n");
 
         precache_model(self.mdl);
         _setmodel(self, self.mdl);
@@ -228,6 +229,7 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
     if(sf & ISF_DROP)
     {
         self.gravity = 1;
+        self.pushable = true;
         //self.move_angles = '0 0 0';
         self.move_movetype = MOVETYPE_TOSS;
         self.move_velocity_x = ReadCoord();