X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Flib%2Fvector.qh;h=0a887cfebb03c4544df88a8d0316bd6f8aa4ab8d;hb=28d902eb626eef4ab7c484ce2eb78e80ca0e2d3f;hp=98b15115c8f40af83533683b978d548ac3b7efee;hpb=b340de8dfe7a16e38bccf8aef7a530061ce72902;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/lib/vector.qh b/qcsrc/lib/vector.qh index 98b15115c..0a887cfeb 100644 --- a/qcsrc/lib/vector.qh +++ b/qcsrc/lib/vector.qh @@ -101,7 +101,7 @@ noref vector _vec2; noref vector _vec3; #define vec3(_x, _y, _z) (_vec3.x = (_x), _vec3.y = (_y), _vec3.z = (_z), _vec3) -vector rotate(vector v, float a) +vector Rotate(vector v, float a) { float a_sin = sin(a), a_cos = cos(a); vector r = '0 0 0'; @@ -131,7 +131,18 @@ vector vec_reflect(vector vel, vector norm, float bounce) return vel - (1 + bounce) * (vel * norm) * norm; } -#ifndef MENUQC +vector vec_epsilon(vector this, float eps) +{ + if (this.x > -eps && this.x < eps) this.x = 0; + if (this.y > -eps && this.y < eps) this.y = 0; + if (this.z > -eps && this.z < eps) this.z = 0; + return this; +} + +#define ClipVelocity(in, normal, out, overbounce) \ + (out = vec_epsilon(vec_reflect(in, normal, (overbounce) - 1), 0.1)) + +#ifdef GAMEQC vector get_corner_position(entity box, int corner) { switch (corner)