In
3d8f1ca7b142c0a9fd8c3b4a494b62dcce39ab71 a horizontal player speed
calculation was changed to include the vertical velocity and to no
longer be the speed, by use of the wrong macro.
This patch reverts those changes and adds a macro for this calculation.
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
wishspeed *= 0.5;
// apply edge friction
- speed = VectorLength2(s->velocity);
+ speed = Vector2Length(s->velocity);
if (speed > 0)
{
friction = cl.movevars_friction;
#define Vector2Set(a,b,c) ((a)[0]=(b),(a)[1]=(c))
#define Vector2Scale(in, scale, out) ((out)[0] = (in)[0] * (scale),(out)[1] = (in)[1] * (scale))
#define Vector2Normalize2(v,dest) {float ilength = (float)DotProduct2((v),(v));if (ilength) ilength = 1.0f / sqrt(ilength);dest[0] = (v)[0] * ilength;dest[1] = (v)[1] * ilength;}
+#define Vector2Length(a) (sqrt(DotProduct2(a, a)))
#define DotProduct4(a,b) ((a)[0]*(b)[0]+(a)[1]*(b)[1]+(a)[2]*(b)[2]+(a)[3]*(b)[3])
#define Vector4Clear(a) ((a)[0]=(a)[1]=(a)[2]=(a)[3]=0)
vec3_t start, stop;
trace_t trace;
- speed = sqrt(PRVM_serveredictvector(host_client->edict, velocity)[0]*PRVM_serveredictvector(host_client->edict, velocity)[0]+PRVM_serveredictvector(host_client->edict, velocity)[1]*PRVM_serveredictvector(host_client->edict, velocity)[1]);
+ speed = Vector2Length(PRVM_serveredictvector(host_client->edict, velocity));
if (!speed)
return;