]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix some issues with movetype prediction, also make jumppads predicted
authorMario <mario@smbclan.net>
Sun, 29 Nov 2015 10:01:59 +0000 (20:01 +1000)
committerMario <mario@smbclan.net>
Sun, 29 Nov 2015 10:01:59 +0000 (20:01 +1000)
qcsrc/common/csqcmodel_settings.qh
qcsrc/common/movetypes/movetypes.qc
qcsrc/common/movetypes/movetypes.qh
qcsrc/common/physics.qc
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/swamp.qc
qcsrc/lib/csqcmodel/cl_player.qc

index d86efb5e979f7bf81ba8b44c2a049a6a8c609d38..9f9fa43f30f8ec2363fce01e214345dfa5aa0abc 100644 (file)
 # define TAG_VIEWLOC_NAME tag_networkviewloc
 # define TAG_VIEWLOC_TYPE int
 .float tag_networkviewloc;
+
+# define MOVETYPE_NAME move_movetype
 #else
 # define TAG_ENTITY_NAME tag_entity
 # define TAG_ENTITY_TYPE entity
 
 # define TAG_VIEWLOC_NAME viewloc
 # define TAG_VIEWLOC_TYPE entity
+
+# define MOVETYPE_NAME movetype
 #endif
 
 // new fields
@@ -63,7 +67,8 @@
        CSQCMODEL_PROPERTY_SCALED(BIT(12), float, ReadByte, WriteByte, scale, 16, 0, 255) \
        CSQCMODEL_PROPERTY(BIT(13), int, ReadInt24_t, WriteInt24_t, dphitcontentsmask) \
        CSQCMODEL_PROPERTY(BIT(14), TAG_VIEWLOC_TYPE, ReadShort, WriteEntity, TAG_VIEWLOC_NAME) \
-       CSQCMODEL_PROPERTY(BIT(15), int, ReadByte, WriteByte, multijump_count)
+       CSQCMODEL_PROPERTY(BIT(15), int, ReadByte, WriteByte, multijump_count) \
+       CSQCMODEL_PROPERTY(BIT(16), int, ReadByte, WriteByte, MOVETYPE_NAME)
 // TODO get rid of colormod/glowmod here, find good solution for vortex charge glowmod hack; also get rid of some useless properties on non-players that only exist for CopyBody
 
 // add hook function calls here
index 07625658bff1e21869d6ac31c37242370d476e9b..be592e7743a91fa37d6037b87a0654ae1ec06f11 100644 (file)
@@ -343,6 +343,7 @@ void _Movetype_LinkEdict_TouchAreaGrid(entity this)  // SV_LinkEdict_TouchAreaGr
 
        for (entity e = findradius(0.5 * (this.absmin + this.absmax), 0.5 * vlen(this.absmax - this.absmin)); e; e = e.chain)
        {
+               if(e.move_nomonsters != MOVE_NOMONSTERS && e.move_nomonsters != MOVE_WORLDONLY)
                if(e.move_touch && boxesoverlap(e.absmin, e.absmax, this.absmin, this.absmax))
                {
                        other = this;
@@ -413,7 +414,7 @@ bool _Movetype_TestEntityPosition(entity this, vector ofs)  // SV_TestEntityPosi
 
        int cont = this.dphitcontentsmask;
        this.dphitcontentsmask = DPCONTENTS_SOLID;
-       tracebox(this.move_origin, this.mins, this.maxs, this.move_origin, MOVE_NOMONSTERS, this);
+       tracebox(this.move_origin, this.mins, this.maxs, this.move_origin, ((this.move_movetype == MOVETYPE_FLY_WORLDONLY) ? MOVE_WORLDONLY : MOVE_NOMONSTERS), this);
        this.dphitcontentsmask = cont;
 
        if(trace_startsolid)
@@ -469,6 +470,8 @@ void _Movetype_PushEntityTrace(entity this, vector push)
                type = max(0, this.move_nomonsters);
        else if(this.move_movetype == MOVETYPE_FLYMISSILE)
                type = MOVE_MISSILE;
+       else if(this.move_movetype == MOVETYPE_FLY_WORLDONLY)
+               type = MOVE_WORLDONLY;
        else if(this.solid == SOLID_TRIGGER || this.solid == SOLID_NOT)
                type = MOVE_NOMONSTERS;
        else
@@ -582,11 +585,51 @@ void _Movetype_Physics_Frame(entity this, float movedt)
                case MOVETYPE_BOUNCEMISSILE:
                case MOVETYPE_FLYMISSILE:
                case MOVETYPE_FLY:
+               case MOVETYPE_FLY_WORLDONLY:
                        _Movetype_Physics_Toss(this, movedt);
                        break;
        }
 }
 
+void _Movetype_Physics_ClientFrame(entity this, float movedt)
+{
+       this.move_didgravity = -1;
+       switch (this.move_movetype)
+       {
+               case MOVETYPE_PUSH:
+               case MOVETYPE_FAKEPUSH:
+                       _Movetype_Physics_Pusher(this, movedt);
+                       break;
+               case MOVETYPE_NONE:
+                       break;
+               case MOVETYPE_FOLLOW:
+                       _Movetype_Physics_Follow(this);
+                       break;
+               case MOVETYPE_NOCLIP:
+                       _Movetype_CheckWater(this);
+                       this.move_origin = this.move_origin + TICRATE * this.move_velocity;
+                       this.move_angles = this.move_angles + TICRATE * this.move_avelocity;
+                       _Movetype_LinkEdict(this, false);
+                       break;
+               case MOVETYPE_STEP:
+                       _Movetype_Physics_Step(this, movedt);
+                       break;
+               case MOVETYPE_WALK:
+               case MOVETYPE_FLY:
+               case MOVETYPE_FLY_WORLDONLY:
+                       _Movetype_Physics_Walk(this, movedt);
+                       break;
+               case MOVETYPE_TOSS:
+               case MOVETYPE_BOUNCE:
+               case MOVETYPE_BOUNCEMISSILE:
+               case MOVETYPE_FLYMISSILE:
+                       _Movetype_Physics_Toss(this, movedt);
+                       break;
+               case MOVETYPE_PHYSICS:
+                       break;
+       }
+}
+
 void Movetype_Physics_NoMatchServer(entity this)  // optimized
 {
        float movedt = time - this.move_time;
index d913c5dc501d7f0ceb3b73a2dfcc2a5a0a7dde9d..7578ae2fa446faae30fe97a44e84522c2a58e67d 100644 (file)
@@ -69,6 +69,7 @@ const int MOVETYPE_FLYMISSILE       = 9;
 const int MOVETYPE_BOUNCE           = 10;
 const int MOVETYPE_BOUNCEMISSILE    = 11;  // Like bounce but doesn't lose speed on bouncing
 const int MOVETYPE_FOLLOW           = 12;
+const int MOVETYPE_PHYSICS          = 32;
 const int MOVETYPE_FLY_WORLDONLY    = 33;
 
 const int FL_ITEM                   = 256;
index 482135ed6168f9e98296f2cf475890d70ead207b..7e85ef3b81d13782c24e41c8387bf790b2dd1274 100644 (file)
@@ -1428,7 +1428,11 @@ void PM_Main(entity this)
        else if (MUTATOR_CALLHOOK(PM_Physics, this, maxspeed_mod))
                { }
 
+#ifdef SVQC
        else if (this.movetype == MOVETYPE_NOCLIP || this.movetype == MOVETYPE_FLY || this.movetype == MOVETYPE_FLY_WORLDONLY || MUTATOR_CALLHOOK(IsFlying, this))
+#elif defined(CSQC)
+       else if (this.move_movetype == MOVETYPE_NOCLIP || this.move_movetype == MOVETYPE_FLY || this.move_movetype == MOVETYPE_FLY_WORLDONLY || MUTATOR_CALLHOOK(IsFlying, this))
+#endif
                PM_fly(this, maxspeed_mod);
 
        else if (this.waterlevel >= WATERLEVEL_SWIMMING)
index be3671b924db4fcb909977129ddd174f60be7e49..c6ba73b73c7c7225ea10e798d66224ce67489710 100644 (file)
@@ -318,8 +318,8 @@ void trigger_push_findtarget()
 }
 
 #ifdef SVQC
-float trigger_push_send(entity to, float sf)
-{SELFPARAM();
+float trigger_push_send(entity this, entity to, float sf)
+{
        WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_PUSH);
        WriteByte(MSG_ENTITY, sf);
 
@@ -349,7 +349,7 @@ void trigger_push_updatelink()
 
 void trigger_push_link()
 {
-       //Net_LinkEntity(self, false, 0, trigger_push_send);
+       Net_LinkEntity(self, false, 0, trigger_push_send);
 }
 #endif
 #ifdef SVQC
@@ -404,7 +404,7 @@ bool target_push_send(entity this, entity to, float sf)
 
 void target_push_link()
 {SELFPARAM();
-       //Net_LinkEntity(self, false, 0, target_push_send);
+       Net_LinkEntity(self, false, 0, target_push_send);
        //self.SendFlags |= 1; // update
 }
 
@@ -432,8 +432,8 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH, bool isnew)
 
                self.entremove = trigger_remove_generic;
                self.solid = SOLID_TRIGGER;
-               self.draw = trigger_draw_generic;
-               self.trigger_touch = trigger_push_touch;
+               //self.draw = trigger_draw_generic;
+               self.move_touch = trigger_push_touch;
                self.drawmask = MASK_NORMAL;
                self.move_time = time;
                trigger_push_findtarget();
index ae29a75342fa4fee0a6446a85cf41a5d48ca7e75..535bddbc1a8c36b9ec21319ed70dff665993c4c1 100644 (file)
@@ -148,8 +148,7 @@ NET_HANDLE(ENT_CLIENT_SWAMP, bool isnew)
 
        self.classname = "trigger_swamp";
        self.solid = SOLID_TRIGGER;
-       self.draw = trigger_draw_generic;
-       self.trigger_touch = swamp_touch;
+       self.move_touch = swamp_touch;
        self.drawmask = MASK_NORMAL;
        self.move_time = time;
        self.entremove = trigger_remove_generic;
index 540c8737be2e5f962352eee76f85a6f4070827fe..fc6979ed5d831ed4a3854bbc6c068ad00344d64f 100644 (file)
@@ -129,11 +129,11 @@ void CSQCPlayer_SavePrediction(entity this)
 }
 
 void CSQC_ClientMovement_PlayerMove_Frame(entity this);
-void _Movetype_Physics_Frame(entity this, float movedt);
+void _Movetype_Physics_ClientFrame(entity this, float movedt);
 
 void Movetype_Physics_Spam(entity this)  // optimized
 {
-       _Movetype_Physics_Frame(this, PHYS_INPUT_TIMELENGTH);
+       _Movetype_Physics_ClientFrame(this, PHYS_INPUT_TIMELENGTH);
        if(wasfreed(this))
                return;
 
@@ -154,7 +154,7 @@ void CSQCPlayer_Physics(entity this)
                {
                        this.move_origin = this.origin;
                        this.move_angles = this.angles;
-                       this.move_movetype = MOVETYPE_WALK; // temp
+                       //this.move_movetype = MOVETYPE_WALK; // temp
                        this.move_velocity = this.velocity;
                        this.move_avelocity = this.avelocity;
                        this.move_flags = BITSET(this.move_flags, FL_ONGROUND, boolean(this.flags & FL_ONGROUND));