X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fcommon%2Fphysics%2Fmovetypes%2Fwalk.qc;h=13224f8a3443d022658aa9307dca2f522979d16f;hb=ba17f8c303822e20bf2de08d616b3884f00f9b1f;hp=24c9c8c5ea64d6f8e171b85bd26ebe71c33bf311;hpb=7666560c6a475aefe6b55ff74a20444f328e0093;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/physics/movetypes/walk.qc b/qcsrc/common/physics/movetypes/walk.qc index 24c9c8c5e..13224f8a3 100644 --- a/qcsrc/common/physics/movetypes/walk.qc +++ b/qcsrc/common/physics/movetypes/walk.qc @@ -1,25 +1,32 @@ +#include "walk.qh" void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove { - vector stepnormal = '0 0 0'; - // if frametime is 0 (due to client sending the same timestamp twice), don't move if (dt <= 0) return; if (GAMEPLAYFIX_UNSTICKPLAYERS(this)) - _Movetype_UnstickEntity(this); + _Movetype_CheckStuck(this); bool applygravity = (!_Movetype_CheckWater(this) && this.move_movetype == MOVETYPE_WALK && !(this.flags & FL_WATERJUMP)); _Movetype_CheckVelocity(this); // do a regular slide move unless it looks like you ran into a step - bool oldonground = (this.flags & FL_ONGROUND); + bool oldonground = IS_ONGROUND(this); vector start_origin = this.origin; vector start_velocity = this.velocity; - int clip = _Movetype_FlyMove(this, dt, applygravity, stepnormal, GAMEPLAYFIX_STEPMULTIPLETIMES(this) ? PHYS_STEPHEIGHT(this) : 0); + if(PHYS_WALLCLIP(this) && this.pm_time) + { + if(dt >= this.pm_time || (this.flags & FL_WATERJUMP)) + this.pm_time = 0; + else + this.pm_time -= dt; + } + + int clip = _Movetype_FlyMove(this, dt, applygravity, false, GAMEPLAYFIX_STEPMULTIPLETIMES(this) ? PHYS_STEPHEIGHT(this) : 0); if (GAMEPLAYFIX_DOWNTRACEONGROUND(this) && !(clip & 1)) { @@ -43,7 +50,9 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove // if the move did not hit the ground at any point, we're not on ground if (!(clip & 1)) - this.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(this); + else if(PHYS_WALLCLIP(this) && !this.groundentity && (PHYS_WALLCLIP(this) == 2 || start_velocity.z < -200)) // don't do landing time if we were just going down a slope + this.pm_time = 0.25; _Movetype_CheckVelocity(this); _Movetype_LinkEdict(this, true); @@ -61,7 +70,7 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove vector originalvelocity = this.velocity; // originalmove_clip = clip; int originalflags = this.flags; - entity originalmove_groundentity = this.move_groundentity; + entity originalmove_groundentity = this.groundentity; // if move didn't block on a step, return if (clip & 2) @@ -89,10 +98,7 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove // move up vector upmove = '0 0 1' * PHYS_STEPHEIGHT(this); - _Movetype_PushEntity(this, upmove, true); - if(wasfreed(this)) - return; - if(trace_startsolid) + if(!_Movetype_PushEntity(this, upmove, true, true)) { // we got teleported when upstepping... must abort the move return; @@ -100,7 +106,7 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove // move forward this.velocity_z = 0; - clip = _Movetype_FlyMove(this, dt, applygravity, stepnormal, 0); + clip = _Movetype_FlyMove(this, dt, applygravity, true, 0); this.velocity_z += start_velocity.z; if (clip & 8) { @@ -124,7 +130,7 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove this.velocity = originalvelocity; // clip = originalmove_clip; this.flags = originalflags; - this.move_groundentity = originalmove_groundentity; + this.groundentity = originalmove_groundentity; // now try to unstick if needed // clip = SV_TryUnstick (ent, oldvel); return; @@ -134,21 +140,18 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove // extra friction based on view angle if ((clip & 2) && PHYS_WALLFRICTION(this)) - _Movetype_WallFriction(this, stepnormal); + _Movetype_WallFriction(this, move_stepnormal); } // don't do the down move if stepdown is disabled, moving upward, not in water, or the move started offground or ended onground - else if (!GAMEPLAYFIX_STEPDOWN(this) || this.waterlevel >= 3 || start_velocity.z >= (1.0 / 32.0) || !oldonground || (this.flags & FL_ONGROUND)) + else if (!GAMEPLAYFIX_STEPDOWN(this) || this.waterlevel >= 3 || start_velocity.z >= (1.0 / 32.0) || !oldonground || IS_ONGROUND(this)) { return; } // move down - vector downmove = '0 0 1' * (-PHYS_STEPHEIGHT(this) + start_velocity.z * dt); - _Movetype_PushEntity(this, downmove, true); - if(wasfreed(this)) - return; - - if(trace_startsolid) + vector downmove = '0 0 0'; + downmove.z = -PHYS_STEPHEIGHT(this) + start_velocity.z * dt; + if(!_Movetype_PushEntity(this, downmove, true, true)) { // we got teleported when downstepping... must abort the move return; @@ -158,6 +161,13 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove { // this has been disabled so that you can't jump when you are stepping // up while already jumping (also known as the Quake2 double jump bug) + // LordHavoc: disabled this check so you can walk on monsters/players + //if (PRVM_serveredictfloat(ent, solid) == SOLID_BSP) + if(GAMEPLAYFIX_STEPDOWN(this) == 2) + { + SET_ONGROUND(this); + this.groundentity = trace_ent; + } } else { @@ -168,7 +178,7 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove this.origin = originalorigin; this.velocity = originalvelocity; this.flags = originalflags; - this.move_groundentity = originalmove_groundentity; + this.groundentity = originalmove_groundentity; } _Movetype_CheckVelocity(this);