X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fphysics%2Fmovetypes%2Fwalk.qc;h=c0f2fac9640be94fa6c550536f029c2197180e38;hb=780df3d4c8c05a74b64af03b46794e6cbc65fa19;hp=e926246266c6761215058a7f293adc421e18562a;hpb=c26d994a788be2bc2eadf6891da23916cf428311;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/physics/movetypes/walk.qc b/qcsrc/common/physics/movetypes/walk.qc index e92624626..c0f2fac96 100644 --- a/qcsrc/common/physics/movetypes/walk.qc +++ b/qcsrc/common/physics/movetypes/walk.qc @@ -1,3 +1,4 @@ +#include "walk.qh" void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove { vector stepnormal = '0 0 0'; @@ -7,17 +8,25 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove return; if (GAMEPLAYFIX_UNSTICKPLAYERS(this)) - _Movetype_UnstickEntity(this); + _Movetype_CheckStuck(this); - bool applygravity = (!_Movetype_CheckWater(this) && this.move_movetype == MOVETYPE_WALK && !(this.move_flags & FL_WATERJUMP)); + 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.move_flags & FL_ONGROUND); + bool oldonground = IS_ONGROUND(this); - vector start_origin = this.move_origin; - vector start_velocity = this.move_velocity; + vector start_origin = this.origin; + vector start_velocity = this.velocity; + + 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, stepnormal, GAMEPLAYFIX_STEPMULTIPLETIMES(this) ? PHYS_STEPHEIGHT(this) : 0); @@ -26,8 +35,8 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove // only try this if there was no floor in the way in the trace (no, // this check seems to be not REALLY necessary, because if clip & 1, // our trace will hit that thing too) - vector upmove = this.move_origin + '0 0 1'; - vector downmove = this.move_origin - '0 0 1'; + vector upmove = this.origin + '0 0 1'; + vector downmove = this.origin - '0 0 1'; int type; if (this.move_movetype == MOVETYPE_FLYMISSILE) type = MOVE_MISSILE; @@ -43,7 +52,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.move_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); @@ -51,17 +62,17 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove if (clip & 8) // teleport return; - if (this.move_flags & FL_WATERJUMP) + if (this.flags & FL_WATERJUMP) return; if (PHYS_NOSTEP(this)) return; - vector originalmove_origin = this.move_origin; - vector originalmove_velocity = this.move_velocity; + vector originalorigin = this.origin; + vector originalvelocity = this.velocity; // originalmove_clip = clip; - int originalmove_flags = this.move_flags; - entity originalmove_groundentity = this.move_groundentity; + int originalflags = this.flags; + entity originalmove_groundentity = this.groundentity; // if move didn't block on a step, return if (clip & 2) @@ -78,14 +89,14 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove // return if attempting to jump while airborn (unless sv_jumpstep) if (!PHYS_JUMPSTEP(this)) - if (!oldonground && this.move_waterlevel == 0) + if (!oldonground && this.waterlevel == 0) return; } // try moving up and forward to go up a step // back to start pos - this.move_origin = start_origin; - this.move_velocity = start_velocity; + this.origin = start_origin; + this.velocity = start_velocity; // move up vector upmove = '0 0 1' * PHYS_STEPHEIGHT(this); @@ -99,9 +110,9 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove } // move forward - this.move_velocity_z = 0; + this.velocity_z = 0; clip = _Movetype_FlyMove(this, dt, applygravity, stepnormal, 0); - this.move_velocity_z += start_velocity.z; + this.velocity_z += start_velocity.z; if (clip & 8) { // we got teleported when upstepping... must abort the move @@ -115,16 +126,16 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove // check for stuckness, possibly due to the limited precision of floats // in the clipping hulls if (clip - && fabs(originalmove_origin.y - this.move_origin.y) < 0.03125 - && fabs(originalmove_origin.x - this.move_origin.x) < 0.03125) + && fabs(originalorigin.y - this.origin.y) < 0.03125 + && fabs(originalorigin.x - this.origin.x) < 0.03125) { // Con_Printf("wall\n"); // stepping up didn't make any progress, revert to original move - this.move_origin = originalmove_origin; - this.move_velocity = originalmove_velocity; + this.origin = originalorigin; + this.velocity = originalvelocity; // clip = originalmove_clip; - this.move_flags = originalmove_flags; - this.move_groundentity = originalmove_groundentity; + this.flags = originalflags; + this.groundentity = originalmove_groundentity; // now try to unstick if needed // clip = SV_TryUnstick (ent, oldvel); return; @@ -137,13 +148,14 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove _Movetype_WallFriction(this, 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.move_waterlevel >= 3 || start_velocity.z >= (1.0 / 32.0) || !oldonground || (this.move_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); + vector downmove = '0 0 0'; + downmove.z = -PHYS_STEPHEIGHT(this) + start_velocity.z * dt; _Movetype_PushEntity(this, downmove, true); if(wasfreed(this)) return; @@ -158,6 +170,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 { @@ -165,10 +184,10 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove // if the push down didn't end up on good ground, use the move without // the step up. This happens near wall / slope combinations, and can // cause the player to hop up higher on a slope too steep to climb - this.move_origin = originalmove_origin; - this.move_velocity = originalmove_velocity; - this.move_flags = originalmove_flags; - this.move_groundentity = originalmove_groundentity; + this.origin = originalorigin; + this.velocity = originalvelocity; + this.flags = originalflags; + this.groundentity = originalmove_groundentity; } _Movetype_CheckVelocity(this);