]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Partially fix water jumping (still a bit broken on the jumping)
authorMario <mario@smbclan.net>
Fri, 4 Dec 2015 07:19:08 +0000 (17:19 +1000)
committerMario <mario@smbclan.net>
Fri, 4 Dec 2015 07:19:08 +0000 (17:19 +1000)
qcsrc/common/movetypes/movetypes.qc
qcsrc/common/physics.qc
qcsrc/common/physics.qh
qcsrc/lib/csqcmodel/cl_player.qc

index 69e73bcebb37d85fe80ee5fd2eb4ce9abcfef127..f6b52dae0784e60fc08b8ddbcc20111d179ba136 100644 (file)
@@ -264,16 +264,16 @@ bool _Movetype_CheckWater(entity this)  // SV_CheckWater
        this.move_watertype = CONTENT_EMPTY;
 
        int supercontents = Mod_Q1BSP_SuperContentsFromNativeContents(nativecontents);
-       if(supercontents & (DPCONTENTS_LIQUIDSMASK))
+       if(supercontents & DPCONTENTS_LIQUIDSMASK)
        {
                this.move_watertype = nativecontents;
                this.move_waterlevel = WATERLEVEL_WETFEET;
                point.z = this.move_origin.z + (this.mins.z + this.maxs.z) * 0.5;
-               if(Mod_Q1BSP_SuperContentsFromNativeContents(pointcontents(point)) & (DPCONTENTS_LIQUIDSMASK))
+               if(Mod_Q1BSP_SuperContentsFromNativeContents(pointcontents(point)) & DPCONTENTS_LIQUIDSMASK)
                {
                        this.move_waterlevel = WATERLEVEL_SWIMMING;
                        point.z = this.move_origin.z + this.view_ofs.z;
-                       if(Mod_Q1BSP_SuperContentsFromNativeContents(pointcontents(point)) & (DPCONTENTS_LIQUIDSMASK))
+                       if(Mod_Q1BSP_SuperContentsFromNativeContents(pointcontents(point)) & DPCONTENTS_LIQUIDSMASK)
                                this.move_waterlevel = WATERLEVEL_SUBMERGED;
                }
        }
index be93c620edfc0655efe0e1c138c1c05453ef2be6..f7551e253a5341be8df131b048529c4a3f011f05 100644 (file)
@@ -186,8 +186,8 @@ void PM_ClientMovement_UpdateStatus(entity this, bool ground)
                }
        }
 
-       if (IS_ONGROUND(this) || this.velocity.z <= 0 || PHYS_TELEPORT_TIME(this) <= 0)
-               PHYS_TELEPORT_TIME(this) = 0;
+       if (IS_ONGROUND(this) || this.velocity.z <= 0 || pmove_waterjumptime <= 0)
+               pmove_waterjumptime = 0;
 #endif
 }
 
@@ -546,7 +546,11 @@ void CheckWaterJump(entity this)
                        this.velocity_z = 225;
                        this.flags |= FL_WATERJUMP;
                        SET_JUMP_HELD(this);
+               #ifdef SVQC
                        PHYS_TELEPORT_TIME(this) = time + 2;    // safety net
+               #elif defined(CSQC)
+                       pmove_waterjumptime = time + 2;
+               #endif
                }
        }
 }
@@ -803,7 +807,9 @@ void PM_fly(entity this, float maxspd_mod)
        // acceleration
        vector wishdir = normalize(wishvel);
        float wishspeed = min(vlen(wishvel), PHYS_MAXSPEED(this) * maxspd_mod);
+#ifdef SVQC
        if(time >= PHYS_TELEPORT_TIME(this))
+#endif
                PM_Accelerate(this, wishdir, wishspeed, wishspeed, PHYS_ACCELERATE(this) * maxspd_mod, 1, 0, 0, 0);
        PM_ClientMovement_Move(this);
 }
@@ -832,7 +838,9 @@ void PM_swim(entity this, float maxspd_mod)
                        {
                                this.velocity = forward * 50;
                                this.velocity_z = 310;
-                               PHYS_TELEPORT_TIME(this) = 2;
+                       #ifdef CSQC
+                               pmove_waterjumptime = 2;
+                       #endif
                                UNSET_ONGROUND(this);
                                SET_JUMP_HELD(this);
                        }
@@ -1163,7 +1171,11 @@ void PM_air(entity this, float buttons_prev, float maxspd_mod)
        vector wishdir = normalize(wishvel);
        float wishspeed = vlen(wishvel);
 
-       if(PHYS_TELEPORT_TIME(this) < time)
+#ifdef SVQC
+       if(time >= PHYS_TELEPORT_TIME(this))
+#elif defined(CSQC)
+       if(pmove_waterjumptime <= 0)
+#endif
        {
                float maxairspd = PHYS_MAXAIRSPEED(this) * min(maxspd_mod, 1);
 
@@ -1258,7 +1270,7 @@ void PM_Main(entity this)
        this.team = myteam + 1; // is this correct?
        if (!(PHYS_INPUT_BUTTON_JUMP(this))) // !jump
                UNSET_JUMP_HELD(this); // canjump = true
-       PHYS_TELEPORT_TIME(this) -= PHYS_INPUT_TIMELENGTH;
+       pmove_waterjumptime -= PHYS_INPUT_TIMELENGTH;
 
        PM_ClientMovement_UpdateStatus(this, true);
 #endif
index 408603e762ec3644d70894a1abd266fb1b17cda7..6ea77fda90c7be395b29e83d87fc533b4b89b107 100644 (file)
@@ -117,7 +117,7 @@ bool IsFlying(entity a);
 
        #define PHYS_GRAVITY(s)                     STAT(MOVEVARS_GRAVITY, s)
 
-       #define PHYS_TELEPORT_TIME(s)                           pmove_waterjumptime
+       #define PHYS_TELEPORT_TIME(s)                           s.teleport_time
 
        #define TICRATE ticrate
 
index ff8d4ff620a811090b92f57bf62adc5f00ca6db6..ecc98b1a3c96c326bf4f9dcfcb13cb47bd7632fc 100644 (file)
@@ -147,10 +147,23 @@ void Movetype_Physics_Spam(entity this)  // optimized
        setorigin(this, this.move_origin);
 }
 
+void CSQCPlayer_CheckWater(entity this)
+{
+       this.move_origin = this.origin;
+       this.move_waterlevel = this.waterlevel;
+       this.move_watertype = this.watertype;
+       _Movetype_CheckWater(this);
+       this.waterlevel = this.move_waterlevel;
+       this.watertype = this.move_watertype;
+}
+
 void CSQCPlayer_Physics(entity this)
 {
        if(autocvar_cl_movement)
        {
+               if(autocvar_cl_movement == 3)
+                       CSQCPlayer_CheckWater(this); // we apparently need to check water *before* physics so it can use this for water jump
+
                CSQC_ClientMovement_PlayerMove_Frame(this);
 
                if(autocvar_cl_movement == 3)