physics: we should rather not use fast maths functions here

(Brahma: please remove what can be removed)

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6680 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lucas GAUTHERON
2011-10-31 15:47:13 +00:00
parent 3512de2639
commit 7f2923812f
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -86,8 +86,11 @@ struct vec
float magnitude() const { return sqrtf(squaredlen()); }
vec &normalize() { div(magnitude()); return *this; }
// should NOT be used
float fmag() const { return fSqrt(squaredlen()); }
float ufmag() const { return ufSqrt(squaredlen()); }
float fmagxy() const { return fSqrt(x*x + y*y); }
float ufmagxy() const { return ufSqrt(x*x + y*y); }
float dist(const vec &e) const { vec t; return dist(e, t); }
float dist(const vec &e, vec &t) const { t = *this; t.sub(e); return t.magnitude(); }
@@ -95,9 +98,6 @@ struct vec
float distxy(const vec &e) const { float dx = e.x - x, dy = e.y - y; return sqrtf(dx*dx + dy*dy); }
float magnitudexy() const { return sqrtf(x*x + y*y); }
float fmagxy() const { return fSqrt(x*x + y*y); }
float ufmagxy() const { return ufSqrt(x*x + y*y); }
bool reject(const vec &o, float max) const { return x>o.x+max || x<o.x-max || y>o.y+max || y<o.y-max; }
vec &cross(const vec &a, const vec &b) { x = a.y*b.z-a.z*b.y; y = a.z*b.x-a.x*b.z; z = a.x*b.y-a.y*b.x; return *this; }
+1 -1
View File
@@ -548,7 +548,7 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime)
if (cornersurface)
{
float ct2f = (cornersurface == 2 ? -1.0 : 1.0);
float diag = f*d.ufmagxy()*2;
float diag = f*d.magnitudexy()*2;
vec vd = vec((d.y*ct2f+d.x >= 0.0f ? diag : -diag), (d.x*ct2f+d.y >= 0.0f ? diag : -diag), 0);
pl->o.x -= f*d.x;
pl->o.y -= f*d.y;