From 584147b8bb26dd2fa2cb84e330d4f77536f30f01 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 11 Feb 2016 20:01:12 +0100 Subject: [PATCH] - removed all occurences of FVector2 and FVector3 from the playsim code. --- src/actor.h | 4 ++-- src/p_buildmap.cpp | 14 +++++++------- src/p_mobj.cpp | 16 ++++++++-------- src/thingdef/thingdef_codeptr.cpp | 16 ++++++++-------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/actor.h b/src/actor.h index 7cfee5500..579656ae0 100644 --- a/src/actor.h +++ b/src/actor.h @@ -865,13 +865,13 @@ public: // more precise, but slower version, being used in a few places fixed_t Distance2D(AActor *other, bool absolute = false) { - return xs_RoundToInt(FVector2(X() - other->X(), Y() - other->Y()).Length()); + return xs_RoundToInt(TVector2(X() - other->X(), Y() - other->Y()).Length()); } // a full 3D version of the above fixed_t Distance3D(AActor *other, bool absolute = false) { - return xs_RoundToInt(FVector3(X() - other->X(), Y() - other->Y(), Z() - other->Z()).Length()); + return xs_RoundToInt(TVector3(X() - other->X(), Y() - other->Y(), Z() - other->Z()).Length()); } angle_t AngleTo(AActor *other, bool absolute = false) const diff --git a/src/p_buildmap.cpp b/src/p_buildmap.cpp index 295dff831..6705addd6 100644 --- a/src/p_buildmap.cpp +++ b/src/p_buildmap.cpp @@ -804,7 +804,7 @@ static void CreateStartSpot (fixed_t *pos, FMapThing *start) static void CalcPlane (SlopeWork &slope, secplane_t &plane) { - FVector3 pt[3]; + TVector3 pt[3]; long j; slope.x[0] = slope.wal->x; slope.y[0] = slope.wal->y; @@ -823,8 +823,8 @@ static void CalcPlane (SlopeWork &slope, secplane_t &plane) -slope.dy, slope.x[2]-slope.wal->x); slope.z[2] += Scale (slope.heinum, j, slope.i); - pt[0] = FVector3(slope.dx, -slope.dy, 0); - pt[1] = FVector3(slope.x[2] - slope.x[0], slope.y[0] - slope.y[2], (slope.z[2] - slope.z[0]) / 16); + pt[0] = TVector3(slope.dx, -slope.dy, 0); + pt[1] = TVector3(slope.x[2] - slope.x[0], slope.y[0] - slope.y[2], (slope.z[2] - slope.z[0]) / 16); pt[2] = (pt[0] ^ pt[1]).Unit(); if ((pt[2][2] < 0 && plane.c > 0) || (pt[2][2] > 0 && plane.c < 0)) @@ -832,10 +832,10 @@ static void CalcPlane (SlopeWork &slope, secplane_t &plane) pt[2] = -pt[2]; } - plane.a = fixed_t(pt[2][0]*65536.f); - plane.b = fixed_t(pt[2][1]*65536.f); - plane.c = fixed_t(pt[2][2]*65536.f); - plane.ic = fixed_t(65536.f/pt[2][2]); + plane.a = FLOAT2FIXED(pt[2][0]); + plane.b = FLOAT2FIXED(pt[2][1]); + plane.c = FLOAT2FIXED(pt[2][2]); + plane.ic = DivScale32(1, plane.c); plane.d = -TMulScale8 (plane.a, slope.x[0]<<4, plane.b, (-slope.y[0])<<4, plane.c, slope.z[0]); } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index dde1c80b8..cce1ac05b 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -5875,7 +5875,7 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, // Answer: No, because this way, you can set up sets of parallel missiles. fixedvec3 fixvel = source->Vec3To(dest); - FVector3 velocity(fixvel.x, fixvel.y, fixvel.z); + TVector3 velocity(fixvel.x, fixvel.y, fixvel.z); // Floor and ceiling huggers should never have a vertical component to their velocity if (th->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)) { @@ -5887,9 +5887,9 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, velocity.Z += (dest->height - z + source->Z()); } velocity.Resize (speed); - th->velx = (fixed_t)(velocity.X); - th->vely = (fixed_t)(velocity.Y); - th->velz = (fixed_t)(velocity.Z); + th->velx = xs_CRoundToInt(velocity.X); + th->vely = xs_CRoundToInt(velocity.Y); + th->velz = xs_CRoundToInt(velocity.Z); // invisible target: rotate velocity vector in 2D // [RC] Now monsters can aim at invisible player as if they were fully visible. @@ -6163,16 +6163,16 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, vz = -finesine[pitch>>ANGLETOFINESHIFT]; speed = MissileActor->Speed; - FVector3 vec(vx, vy, vz); + TVector3 vec(vx, vy, vz); if (MissileActor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)) { vec.Z = 0; } vec.Resize(speed); - MissileActor->velx = (fixed_t)vec.X; - MissileActor->vely = (fixed_t)vec.Y; - MissileActor->velz = (fixed_t)vec.Z; + MissileActor->velx = xs_CRoundToInt(vec.X); + MissileActor->vely = xs_CRoundToInt(vec.Y); + MissileActor->velz = xs_CRoundToInt(vec.Z); if (MissileActor->flags4 & MF4_SPECTRAL) { diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 2eb53c87d..e4744c8b4 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -1187,8 +1187,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile) { if (CMF_OFFSETPITCH & flags) { - FVector2 velocity (missile->velx, missile->vely); - pitch += R_PointToAngle2(0,0, (fixed_t)velocity.Length(), missile->velz); + TVector2 velocity (missile->velx, missile->vely); + pitch += R_PointToAngle2(0,0, xs_CRoundToInt(velocity.Length()), missile->velz); } ang = pitch >> ANGLETOFINESHIFT; missilespeed = abs(FixedMul(finecosine[ang], missile->Speed)); @@ -1196,8 +1196,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile) } else { - FVector2 velocity (missile->velx, missile->vely); - missilespeed = (fixed_t)velocity.Length(); + TVector2 velocity (missile->velx, missile->vely); + missilespeed = xs_CRoundToInt(velocity.Length()); } if (CMF_SAVEPITCH & flags) @@ -1603,8 +1603,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile) { // This original implementation is to aim straight ahead and then offset // the angle from the resulting direction. - FVector3 velocity(misl->velx, misl->vely, 0); - fixed_t missilespeed = (fixed_t)velocity.Length(); + TVector3 velocity(misl->velx, misl->vely, 0); + fixed_t missilespeed = xs_CRoundToInt(velocity.Length()); misl->angle += angle; angle_t an = misl->angle >> ANGLETOFINESHIFT; misl->velx = FixedMul (missilespeed, finecosine[an]); @@ -6751,8 +6751,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMovementDirection) if (!(flags & FMDF_NOPITCH)) { fixed_t current = mobj->pitch; - const FVector2 velocity(mobj->velx, mobj->vely); - const fixed_t pitch = R_PointToAngle2(0, 0, (fixed_t)velocity.Length(), -mobj->velz); + const TVector2 velocity(mobj->velx, mobj->vely); + const fixed_t pitch = R_PointToAngle2(0, 0, xs_CRoundToInt(velocity.Length()), -mobj->velz); if (pitchlimit > 0) { // [MC] angle_t for pitchlimit was required because otherwise