mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2025-02-21 19:00:56 +00:00
- removed all occurences of FVector2 and FVector3 from the playsim code.
This commit is contained in:
parent
64dabc3c0b
commit
584147b8bb
4 changed files with 25 additions and 25 deletions
|
@ -865,13 +865,13 @@ public:
|
||||||
// more precise, but slower version, being used in a few places
|
// more precise, but slower version, being used in a few places
|
||||||
fixed_t Distance2D(AActor *other, bool absolute = false)
|
fixed_t Distance2D(AActor *other, bool absolute = false)
|
||||||
{
|
{
|
||||||
return xs_RoundToInt(FVector2(X() - other->X(), Y() - other->Y()).Length());
|
return xs_RoundToInt(TVector2<double>(X() - other->X(), Y() - other->Y()).Length());
|
||||||
}
|
}
|
||||||
|
|
||||||
// a full 3D version of the above
|
// a full 3D version of the above
|
||||||
fixed_t Distance3D(AActor *other, bool absolute = false)
|
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<double>(X() - other->X(), Y() - other->Y(), Z() - other->Z()).Length());
|
||||||
}
|
}
|
||||||
|
|
||||||
angle_t AngleTo(AActor *other, bool absolute = false) const
|
angle_t AngleTo(AActor *other, bool absolute = false) const
|
||||||
|
|
|
@ -804,7 +804,7 @@ static void CreateStartSpot (fixed_t *pos, FMapThing *start)
|
||||||
|
|
||||||
static void CalcPlane (SlopeWork &slope, secplane_t &plane)
|
static void CalcPlane (SlopeWork &slope, secplane_t &plane)
|
||||||
{
|
{
|
||||||
FVector3 pt[3];
|
TVector3<double> pt[3];
|
||||||
long j;
|
long j;
|
||||||
|
|
||||||
slope.x[0] = slope.wal->x; slope.y[0] = slope.wal->y;
|
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.dy, slope.x[2]-slope.wal->x);
|
||||||
slope.z[2] += Scale (slope.heinum, j, slope.i);
|
slope.z[2] += Scale (slope.heinum, j, slope.i);
|
||||||
|
|
||||||
pt[0] = FVector3(slope.dx, -slope.dy, 0);
|
pt[0] = TVector3<double>(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[1] = TVector3<double>(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();
|
pt[2] = (pt[0] ^ pt[1]).Unit();
|
||||||
|
|
||||||
if ((pt[2][2] < 0 && plane.c > 0) || (pt[2][2] > 0 && plane.c < 0))
|
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];
|
pt[2] = -pt[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
plane.a = fixed_t(pt[2][0]*65536.f);
|
plane.a = FLOAT2FIXED(pt[2][0]);
|
||||||
plane.b = fixed_t(pt[2][1]*65536.f);
|
plane.b = FLOAT2FIXED(pt[2][1]);
|
||||||
plane.c = fixed_t(pt[2][2]*65536.f);
|
plane.c = FLOAT2FIXED(pt[2][2]);
|
||||||
plane.ic = fixed_t(65536.f/pt[2][2]);
|
plane.ic = DivScale32(1, plane.c);
|
||||||
plane.d = -TMulScale8
|
plane.d = -TMulScale8
|
||||||
(plane.a, slope.x[0]<<4, plane.b, (-slope.y[0])<<4, plane.c, slope.z[0]);
|
(plane.a, slope.x[0]<<4, plane.b, (-slope.y[0])<<4, plane.c, slope.z[0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
// Answer: No, because this way, you can set up sets of parallel missiles.
|
||||||
|
|
||||||
fixedvec3 fixvel = source->Vec3To(dest);
|
fixedvec3 fixvel = source->Vec3To(dest);
|
||||||
FVector3 velocity(fixvel.x, fixvel.y, fixvel.z);
|
TVector3<double> velocity(fixvel.x, fixvel.y, fixvel.z);
|
||||||
// Floor and ceiling huggers should never have a vertical component to their velocity
|
// Floor and ceiling huggers should never have a vertical component to their velocity
|
||||||
if (th->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))
|
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.Z += (dest->height - z + source->Z());
|
||||||
}
|
}
|
||||||
velocity.Resize (speed);
|
velocity.Resize (speed);
|
||||||
th->velx = (fixed_t)(velocity.X);
|
th->velx = xs_CRoundToInt(velocity.X);
|
||||||
th->vely = (fixed_t)(velocity.Y);
|
th->vely = xs_CRoundToInt(velocity.Y);
|
||||||
th->velz = (fixed_t)(velocity.Z);
|
th->velz = xs_CRoundToInt(velocity.Z);
|
||||||
|
|
||||||
// invisible target: rotate velocity vector in 2D
|
// invisible target: rotate velocity vector in 2D
|
||||||
// [RC] Now monsters can aim at invisible player as if they were fully visible.
|
// [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];
|
vz = -finesine[pitch>>ANGLETOFINESHIFT];
|
||||||
speed = MissileActor->Speed;
|
speed = MissileActor->Speed;
|
||||||
|
|
||||||
FVector3 vec(vx, vy, vz);
|
TVector3<double> vec(vx, vy, vz);
|
||||||
|
|
||||||
if (MissileActor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))
|
if (MissileActor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))
|
||||||
{
|
{
|
||||||
vec.Z = 0;
|
vec.Z = 0;
|
||||||
}
|
}
|
||||||
vec.Resize(speed);
|
vec.Resize(speed);
|
||||||
MissileActor->velx = (fixed_t)vec.X;
|
MissileActor->velx = xs_CRoundToInt(vec.X);
|
||||||
MissileActor->vely = (fixed_t)vec.Y;
|
MissileActor->vely = xs_CRoundToInt(vec.Y);
|
||||||
MissileActor->velz = (fixed_t)vec.Z;
|
MissileActor->velz = xs_CRoundToInt(vec.Z);
|
||||||
|
|
||||||
if (MissileActor->flags4 & MF4_SPECTRAL)
|
if (MissileActor->flags4 & MF4_SPECTRAL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1187,8 +1187,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile)
|
||||||
{
|
{
|
||||||
if (CMF_OFFSETPITCH & flags)
|
if (CMF_OFFSETPITCH & flags)
|
||||||
{
|
{
|
||||||
FVector2 velocity (missile->velx, missile->vely);
|
TVector2<double> velocity (missile->velx, missile->vely);
|
||||||
pitch += R_PointToAngle2(0,0, (fixed_t)velocity.Length(), missile->velz);
|
pitch += R_PointToAngle2(0,0, xs_CRoundToInt(velocity.Length()), missile->velz);
|
||||||
}
|
}
|
||||||
ang = pitch >> ANGLETOFINESHIFT;
|
ang = pitch >> ANGLETOFINESHIFT;
|
||||||
missilespeed = abs(FixedMul(finecosine[ang], missile->Speed));
|
missilespeed = abs(FixedMul(finecosine[ang], missile->Speed));
|
||||||
|
@ -1196,8 +1196,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FVector2 velocity (missile->velx, missile->vely);
|
TVector2<double> velocity (missile->velx, missile->vely);
|
||||||
missilespeed = (fixed_t)velocity.Length();
|
missilespeed = xs_CRoundToInt(velocity.Length());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CMF_SAVEPITCH & flags)
|
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
|
// This original implementation is to aim straight ahead and then offset
|
||||||
// the angle from the resulting direction.
|
// the angle from the resulting direction.
|
||||||
FVector3 velocity(misl->velx, misl->vely, 0);
|
TVector3<double> velocity(misl->velx, misl->vely, 0);
|
||||||
fixed_t missilespeed = (fixed_t)velocity.Length();
|
fixed_t missilespeed = xs_CRoundToInt(velocity.Length());
|
||||||
misl->angle += angle;
|
misl->angle += angle;
|
||||||
angle_t an = misl->angle >> ANGLETOFINESHIFT;
|
angle_t an = misl->angle >> ANGLETOFINESHIFT;
|
||||||
misl->velx = FixedMul (missilespeed, finecosine[an]);
|
misl->velx = FixedMul (missilespeed, finecosine[an]);
|
||||||
|
@ -6751,8 +6751,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMovementDirection)
|
||||||
if (!(flags & FMDF_NOPITCH))
|
if (!(flags & FMDF_NOPITCH))
|
||||||
{
|
{
|
||||||
fixed_t current = mobj->pitch;
|
fixed_t current = mobj->pitch;
|
||||||
const FVector2 velocity(mobj->velx, mobj->vely);
|
const TVector2<double> velocity(mobj->velx, mobj->vely);
|
||||||
const fixed_t pitch = R_PointToAngle2(0, 0, (fixed_t)velocity.Length(), -mobj->velz);
|
const fixed_t pitch = R_PointToAngle2(0, 0, xs_CRoundToInt(velocity.Length()), -mobj->velz);
|
||||||
if (pitchlimit > 0)
|
if (pitchlimit > 0)
|
||||||
{
|
{
|
||||||
// [MC] angle_t for pitchlimit was required because otherwise
|
// [MC] angle_t for pitchlimit was required because otherwise
|
||||||
|
|
Loading…
Reference in a new issue