From: Mario Date: Fri, 4 Dec 2015 07:19:08 +0000 (+1000) Subject: Partially fix water jumping (still a bit broken on the jumping) X-Git-Tag: xonotic-v0.8.2~1557 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=833c58a54c6a305b2bb6dc544c67fab3824b7188;p=xonotic%2Fxonotic-data.pk3dir.git Partially fix water jumping (still a bit broken on the jumping) --- diff --git a/qcsrc/common/movetypes/movetypes.qc b/qcsrc/common/movetypes/movetypes.qc index 69e73bceb..f6b52dae0 100644 --- a/qcsrc/common/movetypes/movetypes.qc +++ b/qcsrc/common/movetypes/movetypes.qc @@ -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; } } diff --git a/qcsrc/common/physics.qc b/qcsrc/common/physics.qc index be93c620e..f7551e253 100644 --- a/qcsrc/common/physics.qc +++ b/qcsrc/common/physics.qc @@ -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 diff --git a/qcsrc/common/physics.qh b/qcsrc/common/physics.qh index 408603e76..6ea77fda9 100644 --- a/qcsrc/common/physics.qh +++ b/qcsrc/common/physics.qh @@ -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 diff --git a/qcsrc/lib/csqcmodel/cl_player.qc b/qcsrc/lib/csqcmodel/cl_player.qc index ff8d4ff62..ecc98b1a3 100644 --- a/qcsrc/lib/csqcmodel/cl_player.qc +++ b/qcsrc/lib/csqcmodel/cl_player.qc @@ -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)