mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-15 16:51:31 +00:00
- use typedefs for TVector<double> etc.
(Better have this out of the way before messing around with this stuff...)
This commit is contained in:
parent
2e588c2099
commit
f8ebfb541e
23 changed files with 72 additions and 67 deletions
|
@ -851,14 +851,14 @@ public:
|
|||
fixed_t Distance2D(AActor *other, bool absolute = false)
|
||||
{
|
||||
fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this);
|
||||
return xs_RoundToInt(TVector2<double>(X() - otherpos.x, Y() - otherpos.y).Length());
|
||||
return xs_RoundToInt(DVector2(X() - otherpos.x, Y() - otherpos.y).Length());
|
||||
}
|
||||
|
||||
// a full 3D version of the above
|
||||
fixed_t Distance3D(AActor *other, bool absolute = false)
|
||||
{
|
||||
fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this);
|
||||
return xs_RoundToInt(TVector3<double>(X() - otherpos.x, Y() - otherpos.y, Z() - otherpos.z).Length());
|
||||
return xs_RoundToInt(DVector3(X() - otherpos.x, Y() - otherpos.y, Z() - otherpos.z).Length());
|
||||
}
|
||||
|
||||
angle_t AngleTo(AActor *other, bool absolute = false)
|
||||
|
|
|
@ -470,7 +470,7 @@ fixed_t FCajunMaster::FakeFire (AActor *source, AActor *dest, ticcmd_t *cmd)
|
|||
float speed = (float)th->Speed;
|
||||
|
||||
fixedvec3 fixvel = source->Vec3To(dest);
|
||||
TVector3<double> velocity(fixvel.x, fixvel.y, fixvel.z);
|
||||
DVector3 velocity(fixvel.x, fixvel.y, fixvel.z);
|
||||
velocity.MakeUnit();
|
||||
th->velx = FLOAT2FIXED(velocity[0] * speed);
|
||||
th->vely = FLOAT2FIXED(velocity[1] * speed);
|
||||
|
|
|
@ -177,7 +177,7 @@ void AAimingCamera::Tick ()
|
|||
if (MaxPitchChange)
|
||||
{ // Aim camera's pitch; use floats for precision
|
||||
fixedvec2 fv3 = tracer->Vec2To(this);
|
||||
TVector2<double> vect(fv3.x, fv3.y);
|
||||
DVector2 vect(fv3.x, fv3.y);
|
||||
double dz = Z() - tracer->Z() - tracer->height/2;
|
||||
double dist = vect.Length();
|
||||
double ang = dist != 0.f ? atan2 (dz, dist) : 0;
|
||||
|
|
|
@ -25,7 +25,7 @@ int ALoreShot::DoSpecialDamage (AActor *victim, int damage, FName damagetype)
|
|||
if (victim != NULL && target != NULL && !(victim->flags7 & MF7_DONTTHRUST))
|
||||
{
|
||||
fixedvec3 fixthrust = victim->Vec3To(target);
|
||||
TVector3<double> thrust(fixthrust.x, fixthrust.y, fixthrust.z);
|
||||
DVector3 thrust(fixthrust.x, fixthrust.y, fixthrust.z);
|
||||
|
||||
thrust.MakeUnit();
|
||||
thrust *= double((255*50*FRACUNIT) / (victim->Mass ? victim->Mass : 1));
|
||||
|
|
|
@ -5341,7 +5341,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args)
|
|||
return FLOAT2FIXED(sqrt(FIXED2DBL(args[0])));
|
||||
|
||||
case ACSF_VectorLength:
|
||||
return FLOAT2FIXED(TVector2<double>(FIXED2DBL(args[0]), FIXED2DBL(args[1])).Length());
|
||||
return FLOAT2FIXED(DVector2(FIXED2DBL(args[0]), FIXED2DBL(args[1])).Length());
|
||||
|
||||
case ACSF_SetHUDClipRect:
|
||||
ClipRectLeft = argCount > 0 ? args[0] : 0;
|
||||
|
|
|
@ -804,7 +804,7 @@ static void CreateStartSpot (fixed_t *pos, FMapThing *start)
|
|||
|
||||
static void CalcPlane (SlopeWork &slope, secplane_t &plane)
|
||||
{
|
||||
TVector3<double> pt[3];
|
||||
DVector3 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] = TVector3<double>(slope.dx, -slope.dy, 0);
|
||||
pt[1] = TVector3<double>(slope.x[2] - slope.x[0], slope.y[0] - slope.y[2], (slope.z[2] - slope.z[0]) / 16);
|
||||
pt[0] = DVector3(slope.dx, -slope.dy, 0);
|
||||
pt[1] = DVector3(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))
|
||||
|
|
|
@ -651,12 +651,12 @@ void P_DrawSplash2 (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, i
|
|||
}
|
||||
}
|
||||
|
||||
void P_DrawRailTrail(AActor *source, const TVector3<double> &start, const TVector3<double> &end, int color1, int color2, double maxdiff_d, int flags, PClassActor *spawnclass, angle_t angle, int duration, double sparsity, double drift, int SpiralOffset)
|
||||
void P_DrawRailTrail(AActor *source, const DVector3 &start, const DVector3 &end, int color1, int color2, double maxdiff_d, int flags, PClassActor *spawnclass, angle_t angle, int duration, double sparsity, double drift, int SpiralOffset)
|
||||
{
|
||||
double length, lengthsquared;
|
||||
int steps, i;
|
||||
TAngle<double> deg;
|
||||
TVector3<double> step, dir, pos, extend;
|
||||
DVector3 step, dir, pos, extend;
|
||||
bool fullbright;
|
||||
float maxdiff = (float)maxdiff_d;
|
||||
|
||||
|
@ -681,7 +681,7 @@ void P_DrawRailTrail(AActor *source, const TVector3<double> &start, const TVecto
|
|||
// The railgun's sound is special. It gets played from the
|
||||
// point on the slug's trail that is closest to the hearing player.
|
||||
AActor *mo = players[consoleplayer].camera;
|
||||
TVector3<double> point;
|
||||
DVector3 point;
|
||||
double r;
|
||||
double dirz;
|
||||
|
||||
|
@ -728,7 +728,7 @@ void P_DrawRailTrail(AActor *source, const TVector3<double> &start, const TVecto
|
|||
minelem = fabs(dir[i]);
|
||||
}
|
||||
}
|
||||
TVector3<double> tempvec(0, 0, 0);
|
||||
DVector3 tempvec(0, 0, 0);
|
||||
tempvec[epos] = 1;
|
||||
extend = tempvec - (dir | tempvec) * dir;
|
||||
//
|
||||
|
@ -739,7 +739,7 @@ void P_DrawRailTrail(AActor *source, const TVector3<double> &start, const TVecto
|
|||
// Create the outer spiral.
|
||||
if (color1 != -1 && (!r_rail_smartspiral || color2 == -1) && r_rail_spiralsparsity > 0 && (spawnclass == NULL))
|
||||
{
|
||||
TVector3<double> spiral_step = step * r_rail_spiralsparsity * sparsity;
|
||||
DVector3 spiral_step = step * r_rail_spiralsparsity * sparsity;
|
||||
int spiral_steps = (int)(steps * r_rail_spiralsparsity / sparsity);
|
||||
|
||||
color1 = color1 == 0 ? -1 : ParticleColor(color1);
|
||||
|
@ -748,7 +748,7 @@ void P_DrawRailTrail(AActor *source, const TVector3<double> &start, const TVecto
|
|||
for (i = spiral_steps; i; i--)
|
||||
{
|
||||
particle_t *p = NewParticle ();
|
||||
TVector3<double> tempvec;
|
||||
DVector3 tempvec;
|
||||
|
||||
if (!p)
|
||||
return;
|
||||
|
@ -761,7 +761,7 @@ void P_DrawRailTrail(AActor *source, const TVector3<double> &start, const TVecto
|
|||
p->size = 3;
|
||||
p->bright = fullbright;
|
||||
|
||||
tempvec = TMatrix3x3<double>(dir, deg) * extend;
|
||||
tempvec = DMatrix3x3(dir, deg) * extend;
|
||||
p->velx = FLOAT2FIXED(tempvec.X * drift)>>4;
|
||||
p->vely = FLOAT2FIXED(tempvec.Y * drift)>>4;
|
||||
p->velz = FLOAT2FIXED(tempvec.Z * drift)>>4;
|
||||
|
@ -795,11 +795,11 @@ void P_DrawRailTrail(AActor *source, const TVector3<double> &start, const TVecto
|
|||
// Create the inner trail.
|
||||
if (color2 != -1 && r_rail_trailsparsity > 0 && spawnclass == NULL)
|
||||
{
|
||||
TVector3<double> trail_step = step * r_rail_trailsparsity * sparsity;
|
||||
DVector3 trail_step = step * r_rail_trailsparsity * sparsity;
|
||||
int trail_steps = xs_FloorToInt(steps * r_rail_trailsparsity / sparsity);
|
||||
|
||||
color2 = color2 == 0 ? -1 : ParticleColor(color2);
|
||||
TVector3<double> diff(0, 0, 0);
|
||||
DVector3 diff(0, 0, 0);
|
||||
|
||||
pos = start;
|
||||
for (i = trail_steps; i; i--)
|
||||
|
@ -822,7 +822,7 @@ void P_DrawRailTrail(AActor *source, const TVector3<double> &start, const TVecto
|
|||
diff.Z = clamp<double>(diff.Z + ((rnd & 32) ? 1 : -1), -maxdiff, maxdiff);
|
||||
}
|
||||
|
||||
TVector3<double> postmp = pos + diff;
|
||||
DVector3 postmp = pos + diff;
|
||||
|
||||
p->size = 2;
|
||||
p->x = FLOAT2FIXED(postmp.X);
|
||||
|
@ -857,9 +857,9 @@ void P_DrawRailTrail(AActor *source, const TVector3<double> &start, const TVecto
|
|||
if (sparsity < 1)
|
||||
sparsity = 32;
|
||||
|
||||
TVector3<double> trail_step = (step / 3) * sparsity;
|
||||
DVector3 trail_step = (step / 3) * sparsity;
|
||||
int trail_steps = (int)((steps * 3) / sparsity);
|
||||
TVector3<double> diff(0, 0, 0);
|
||||
DVector3 diff(0, 0, 0);
|
||||
|
||||
pos = start;
|
||||
for (i = trail_steps; i; i--)
|
||||
|
@ -874,7 +874,7 @@ void P_DrawRailTrail(AActor *source, const TVector3<double> &start, const TVecto
|
|||
if (rnd & 4)
|
||||
diff.Z = clamp<double>(diff.Z + ((rnd & 32) ? 1 : -1), -maxdiff, maxdiff);
|
||||
}
|
||||
TVector3<double> postmp = pos + diff;
|
||||
DVector3 postmp = pos + diff;
|
||||
|
||||
AActor *thing = Spawn (spawnclass, FLOAT2FIXED(postmp.X), FLOAT2FIXED(postmp.Y), FLOAT2FIXED(postmp.Z), ALLOW_REPLACE);
|
||||
if (thing)
|
||||
|
|
|
@ -89,7 +89,7 @@ void P_RunEffects (void);
|
|||
|
||||
void P_RunEffect (AActor *actor, int effects);
|
||||
|
||||
void P_DrawRailTrail(AActor *source, const TVector3<double> &start, const TVector3<double> &end, int color1, int color2, double maxdiff = 0, int flags = 0, PClassActor *spawnclass = NULL, angle_t angle = 0, int duration = 35, double sparsity = 1.0, double drift = 1.0, int SpiralOffset = 270);
|
||||
void P_DrawRailTrail(AActor *source, const DVector3 &start, const DVector3 &end, int color1, int color2, double maxdiff = 0, int flags = 0, PClassActor *spawnclass = NULL, angle_t angle = 0, int duration = 35, double sparsity = 1.0, double drift = 1.0, int SpiralOffset = 270);
|
||||
void P_DrawSplash (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, int kind);
|
||||
void P_DrawSplash2 (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, int updown, int kind);
|
||||
void P_DisconnectEffect (AActor *actor);
|
||||
|
|
|
@ -2871,7 +2871,7 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, a
|
|||
if (max_pitch <= ANGLE_180)
|
||||
{
|
||||
fixedvec2 pos = self->Vec2To(other);
|
||||
TVector2<double> dist(pos.x, pos.y);
|
||||
DVector2 dist(pos.x, pos.y);
|
||||
|
||||
// Positioning ala missile spawning, 32 units above foot level
|
||||
fixed_t source_z = self->Z() + 32*FRACUNIT + self->GetBobOffset();
|
||||
|
@ -3007,7 +3007,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail)
|
|||
{
|
||||
// We probably won't hit the target, but aim at it anyway so we don't look stupid.
|
||||
fixedvec2 pos = self->Vec2To(self->target);
|
||||
TVector2<double> xydiff(pos.x, pos.y);
|
||||
DVector2 xydiff(pos.x, pos.y);
|
||||
double zdiff = (self->target->Z() + (self->target->height>>1)) - (self->Z() + (self->height>>1) - self->floorclip);
|
||||
self->pitch = int(atan2(zdiff, xydiff.Length()) * ANGLE_180 / -M_PI);
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ static int CheckForMissingSegs()
|
|||
if (seg->sidedef!=NULL)
|
||||
{
|
||||
// check all the segs and calculate the length they occupy on their sidedef
|
||||
TVector2<double> vec1(seg->v2->x - seg->v1->x, seg->v2->y - seg->v1->y);
|
||||
DVector2 vec1(seg->v2->x - seg->v1->x, seg->v2->y - seg->v1->y);
|
||||
added_seglen[seg->sidedef - sides] += float(vec1.Length());
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ static int CheckForMissingSegs()
|
|||
side_t * side =&sides[i];
|
||||
line_t * line = side->linedef;
|
||||
|
||||
TVector2<double> lvec(line->dx, line->dy);
|
||||
DVector2 lvec(line->dx, line->dy);
|
||||
float linelen = float(lvec.Length());
|
||||
|
||||
missing += (added_seglen[i] < linelen - FRACUNIT);
|
||||
|
|
|
@ -4704,7 +4704,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
|
|||
{
|
||||
fixed_t vx, vy, vz;
|
||||
angle_t angle, pitch;
|
||||
TVector3<double> start, end;
|
||||
DVector3 start, end;
|
||||
FTraceResults trace;
|
||||
fixed_t shootz;
|
||||
|
||||
|
|
|
@ -1728,7 +1728,7 @@ bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool preci
|
|||
AActor *target;
|
||||
fixed_t speed;
|
||||
|
||||
speed = !usecurspeed ? actor->Speed : xs_CRoundToInt(TVector3<double>(actor->velx, actor->vely, actor->velz).Length());
|
||||
speed = !usecurspeed ? actor->Speed : xs_CRoundToInt(DVector3(actor->velx, actor->vely, actor->velz).Length());
|
||||
target = actor->tracer;
|
||||
if (target == NULL || !actor->CanSeek(target))
|
||||
{
|
||||
|
@ -1787,7 +1787,7 @@ bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool preci
|
|||
if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
|
||||
{ // Need to seek vertically
|
||||
fixedvec2 vec = actor->Vec2To(target);
|
||||
double dist = MAX(1.0, TVector2<double>(vec.x, vec.y).Length());
|
||||
double dist = MAX(1.0, DVector2(vec.x, vec.y).Length());
|
||||
// Aim at a player's eyes and at the middle of the actor for everything else.
|
||||
fixed_t aimheight = target->height/2;
|
||||
if (target->IsKindOf(RUNTIME_CLASS(APlayerPawn)))
|
||||
|
@ -2139,7 +2139,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
|||
//dest->x - source->x
|
||||
fixedvec3 vect = mo->Vec3To(origin);
|
||||
vect.z += origin->height / 2;
|
||||
TVector3<double> velocity(vect.x, vect.y, vect.z);
|
||||
DVector3 velocity(vect.x, vect.y, vect.z);
|
||||
velocity.Resize(speed);
|
||||
mo->velx = (fixed_t)(velocity.X);
|
||||
mo->vely = (fixed_t)(velocity.Y);
|
||||
|
@ -5828,7 +5828,7 @@ bool P_CheckMissileSpawn (AActor* th, fixed_t maxdist)
|
|||
if (maxdist > 0)
|
||||
{
|
||||
// move a little forward so an angle can be computed if it immediately explodes
|
||||
TVector3<double> advance(FIXED2DBL(th->velx), FIXED2DBL(th->vely), FIXED2DBL(th->velz));
|
||||
DVector3 advance(FIXED2DBL(th->velx), FIXED2DBL(th->vely), FIXED2DBL(th->velz));
|
||||
double maxsquared = FIXED2DBL(maxdist);
|
||||
maxsquared *= maxsquared;
|
||||
|
||||
|
@ -5838,7 +5838,7 @@ bool P_CheckMissileSpawn (AActor* th, fixed_t maxdist)
|
|||
{
|
||||
advance *= 0.5f;
|
||||
}
|
||||
while (TVector2<double>(advance).LengthSquared() >= maxsquared);
|
||||
while (DVector2(advance).LengthSquared() >= maxsquared);
|
||||
th->SetXYZ(
|
||||
th->X() + FLOAT2FIXED(advance.X),
|
||||
th->Y() + FLOAT2FIXED(advance.Y),
|
||||
|
@ -6000,7 +6000,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);
|
||||
TVector3<double> velocity(fixvel.x, fixvel.y, fixvel.z);
|
||||
DVector3 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))
|
||||
{
|
||||
|
@ -6288,7 +6288,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z,
|
|||
vz = -finesine[pitch>>ANGLETOFINESHIFT];
|
||||
speed = MissileActor->Speed;
|
||||
|
||||
TVector3<double> vec(vx, vy, vz);
|
||||
DVector3 vec(vx, vy, vz);
|
||||
|
||||
if (MissileActor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))
|
||||
{
|
||||
|
|
|
@ -77,7 +77,7 @@ static void P_SlopeLineToPoint (int lineid, fixed_t x, fixed_t y, fixed_t z, boo
|
|||
plane = &sec->floorplane;
|
||||
}
|
||||
|
||||
TVector3<double> p, v1, v2, cross;
|
||||
DVector3 p, v1, v2, cross;
|
||||
|
||||
p[0] = FIXED2DBL (line->v1->x);
|
||||
p[1] = FIXED2DBL (line->v1->y);
|
||||
|
@ -189,7 +189,7 @@ void P_SetSlope (secplane_t *plane, bool setCeil, int xyangi, int zangi,
|
|||
}
|
||||
xyang = (angle_t)Scale (xyangi, ANGLE_90, 90 << ANGLETOFINESHIFT);
|
||||
|
||||
TVector3<double> norm;
|
||||
DVector3 norm;
|
||||
|
||||
if (ib_compatflags & BCOMPATF_SETSLOPEOVERFLOW)
|
||||
{
|
||||
|
@ -228,7 +228,7 @@ void P_VavoomSlope(sector_t * sec, int id, fixed_t x, fixed_t y, fixed_t z, int
|
|||
|
||||
if (l->args[0]==id)
|
||||
{
|
||||
TVector3<double> v1, v2, cross;
|
||||
DVector3 v1, v2, cross;
|
||||
secplane_t *srcplane = (which == 0) ? &sec->floorplane : &sec->ceilingplane;
|
||||
fixed_t srcheight = (which == 0) ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling);
|
||||
|
||||
|
@ -336,8 +336,8 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt,
|
|||
sector_t *sec = §ors[i];
|
||||
if (sec->linecount != 3) continue; // only works with triangular sectors
|
||||
|
||||
TVector3<double> vt1, vt2, vt3, cross;
|
||||
TVector3<double> vec1, vec2;
|
||||
DVector3 vt1, vt2, vt3, cross;
|
||||
DVector3 vec1, vec2;
|
||||
int vi1, vi2, vi3;
|
||||
|
||||
vi1 = int(sec->lines[0]->v1 - vertexes);
|
||||
|
@ -376,7 +376,7 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt,
|
|||
vec2 = vt2 - vt3;
|
||||
}
|
||||
|
||||
TVector3<double> cross = vec1 ^ vec2;
|
||||
DVector3 cross = vec1 ^ vec2;
|
||||
|
||||
double len = cross.Length();
|
||||
if (len == 0)
|
||||
|
@ -521,7 +521,7 @@ static void P_AlignPlane (sector_t *sec, line_t *line, int which)
|
|||
|
||||
refsec = line->frontsector == sec ? line->backsector : line->frontsector;
|
||||
|
||||
TVector3<double> p, v1, v2, cross;
|
||||
DVector3 p, v1, v2, cross;
|
||||
|
||||
secplane_t *srcplane;
|
||||
fixed_t srcheight, destheight;
|
||||
|
|
|
@ -122,7 +122,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
|
|||
ceilingheight = destsect->ceilingplane.ZatPoint (x, y);
|
||||
if (thing->flags & MF_MISSILE)
|
||||
{ // We don't measure z velocity, because it doesn't change.
|
||||
missilespeed = xs_CRoundToInt(TVector2<double>(thing->velx, thing->vely).Length());
|
||||
missilespeed = xs_CRoundToInt(DVector2(thing->velx, thing->vely).Length());
|
||||
}
|
||||
if (flags & TELF_KEEPHEIGHT)
|
||||
{
|
||||
|
|
|
@ -257,7 +257,7 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
|
|||
{
|
||||
fixedvec3 vect = mobj->Vec3To(targ);
|
||||
vect.z += targ->height / 2;
|
||||
TVector3<double> aim(vect.x, vect.y, vect.z);
|
||||
DVector3 aim(vect.x, vect.y, vect.z);
|
||||
|
||||
if (leadTarget && speed > 0 && (targ->velx | targ->vely | targ->velz))
|
||||
{
|
||||
|
@ -268,7 +268,7 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
|
|||
// with the math. I don't think I would have thought of using
|
||||
// trig alone had I been left to solve it by myself.
|
||||
|
||||
TVector3<double> tvel(targ->velx, targ->vely, targ->velz);
|
||||
DVector3 tvel(targ->velx, targ->vely, targ->velz);
|
||||
if (!(targ->flags & MF_NOGRAVITY) && targ->waterlevel < 3)
|
||||
{ // If the target is subject to gravity and not underwater,
|
||||
// assume that it isn't moving vertically. Thanks to gravity,
|
||||
|
@ -289,14 +289,14 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
|
|||
|
||||
// Use the cross product of two of the triangle's sides to get a
|
||||
// rotation vector.
|
||||
TVector3<double> rv(tvel ^ aim);
|
||||
DVector3 rv(tvel ^ aim);
|
||||
// The vector must be normalized.
|
||||
rv.MakeUnit();
|
||||
// Now combine the rotation vector with angle b to get a rotation matrix.
|
||||
TMatrix3x3<double> rm(rv, cos(asin(sinb)), sinb);
|
||||
DMatrix3x3 rm(rv, cos(asin(sinb)), sinb);
|
||||
// And multiply the original aim vector with the matrix to get a
|
||||
// new aim vector that leads the target.
|
||||
TVector3<double> aimvec = rm * aim;
|
||||
DVector3 aimvec = rm * aim;
|
||||
// And make the projectile follow that vector at the desired speed.
|
||||
double aimscale = fspeed / dist;
|
||||
mobj->velx = fixed_t (aimvec[0] * aimscale);
|
||||
|
|
|
@ -1607,7 +1607,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
double ulen = TVector3<double>(fp[0], fp[1], fp[2]).Length();
|
||||
double ulen = DVector3(fp[0], fp[1], fp[2]).Length();
|
||||
|
||||
// normalize the vector, it must have a length of 1
|
||||
sec->floorplane.a = FLOAT2FIXED(fp[0] / ulen);
|
||||
|
@ -1625,7 +1625,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
double ulen = TVector3<double>(cp[0], cp[1], cp[2]).Length();
|
||||
double ulen = DVector3(cp[0], cp[1], cp[2]).Length();
|
||||
|
||||
// normalize the vector, it must have a length of 1
|
||||
sec->ceilingplane.a = FLOAT2FIXED(cp[0] / ulen);
|
||||
|
|
|
@ -2753,13 +2753,13 @@ void P_PredictionLerpReset()
|
|||
|
||||
bool P_LerpCalculate(PredictPos from, PredictPos to, PredictPos &result, float scale)
|
||||
{
|
||||
TVector3<double> vecFrom(FIXED2DBL(from.x), FIXED2DBL(from.y), FIXED2DBL(from.z));
|
||||
TVector3<double> vecTo(FIXED2DBL(to.x), FIXED2DBL(to.y), FIXED2DBL(to.z));
|
||||
TVector3<double> vecResult;
|
||||
DVector3 vecFrom(FIXED2DBL(from.x), FIXED2DBL(from.y), FIXED2DBL(from.z));
|
||||
DVector3 vecTo(FIXED2DBL(to.x), FIXED2DBL(to.y), FIXED2DBL(to.z));
|
||||
DVector3 vecResult;
|
||||
vecResult = vecTo - vecFrom;
|
||||
vecResult *= scale;
|
||||
vecResult = vecResult + vecFrom;
|
||||
TVector3<double> delta = vecResult - vecTo;
|
||||
DVector3 delta = vecResult - vecTo;
|
||||
|
||||
result.x = FLOAT2FIXED(vecResult.X);
|
||||
result.y = FLOAT2FIXED(vecResult.Y);
|
||||
|
|
|
@ -577,7 +577,7 @@ bool EV_MovePolyTo(line_t *line, int polyNum, int speed, fixed_t targx, fixed_t
|
|||
{
|
||||
DMovePolyTo *pe = NULL;
|
||||
FPolyObj *poly;
|
||||
TVector2<double> dist;
|
||||
DVector2 dist;
|
||||
double distlen;
|
||||
|
||||
if ((poly = PO_GetPolyobj(polyNum)) == NULL)
|
||||
|
|
|
@ -1700,8 +1700,8 @@ static bool sv_compare(vissprite_t *a, vissprite_t *b)
|
|||
// the viewpoint.
|
||||
static bool sv_compare2d(vissprite_t *a, vissprite_t *b)
|
||||
{
|
||||
return TVector2<double>(a->deltax, a->deltay).LengthSquared() <
|
||||
TVector2<double>(b->deltax, b->deltay).LengthSquared();
|
||||
return DVector2(a->deltax, a->deltay).LengthSquared() <
|
||||
DVector2(b->deltax, b->deltay).LengthSquared();
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -615,7 +615,7 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
|
|||
{
|
||||
fixedvec3a &start = i == 0 ? oldpos : InterpolationPath[i - 1];
|
||||
fixedvec3a &end = InterpolationPath[i];
|
||||
pathlen += xs_CRoundToInt(TVector2<double>(end.x - start.x, end.y - start.y).Length());
|
||||
pathlen += xs_CRoundToInt(DVector2(end.x - start.x, end.y - start.y).Length());
|
||||
totalzdiff += start.z;
|
||||
totaladiff += start.angle;
|
||||
}
|
||||
|
@ -625,7 +625,7 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
|
|||
{
|
||||
fixedvec3a &start = i == 0 ? oldpos : InterpolationPath[i - 1];
|
||||
fixedvec3a &end = InterpolationPath[i];
|
||||
fixed_t fraglen = xs_CRoundToInt(TVector2<double>(end.x - start.x, end.y - start.y).Length());
|
||||
fixed_t fraglen = xs_CRoundToInt(DVector2(end.x - start.x, end.y - start.y).Length());
|
||||
zdiff += start.z;
|
||||
adiff += start.angle;
|
||||
if (fraglen <= interpolatedlen)
|
||||
|
|
|
@ -316,7 +316,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetDistance)
|
|||
if (checkz)
|
||||
diff.z += (target->height - self->height) / 2;
|
||||
|
||||
const double length = TVector3<double>(FIXED2DBL(diff.x), FIXED2DBL(diff.y), (checkz) ? FIXED2DBL(diff.z) : 0).Length();
|
||||
const double length = DVector3(FIXED2DBL(diff.x), FIXED2DBL(diff.y), (checkz) ? FIXED2DBL(diff.z) : 0).Length();
|
||||
ret->SetFloat(length);
|
||||
}
|
||||
return 1;
|
||||
|
@ -1260,7 +1260,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile)
|
|||
{
|
||||
if (CMF_OFFSETPITCH & flags)
|
||||
{
|
||||
TVector2<double> velocity (missile->velx, missile->vely);
|
||||
DVector2 velocity (missile->velx, missile->vely);
|
||||
pitch += R_PointToAngle2(0,0, xs_CRoundToInt(velocity.Length()), missile->velz);
|
||||
}
|
||||
ang = pitch >> ANGLETOFINESHIFT;
|
||||
|
@ -1269,7 +1269,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile)
|
|||
}
|
||||
else
|
||||
{
|
||||
TVector2<double> velocity (missile->velx, missile->vely);
|
||||
DVector2 velocity (missile->velx, missile->vely);
|
||||
missilespeed = xs_CRoundToInt(velocity.Length());
|
||||
}
|
||||
|
||||
|
@ -1677,7 +1677,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile)
|
|||
{
|
||||
// This original implementation is to aim straight ahead and then offset
|
||||
// the angle from the resulting direction.
|
||||
TVector3<double> velocity(misl->velx, misl->vely, 0);
|
||||
DVector3 velocity(misl->velx, misl->vely, 0);
|
||||
fixed_t missilespeed = xs_CRoundToInt(velocity.Length());
|
||||
misl->angle += angle;
|
||||
angle_t an = misl->angle >> ANGLETOFINESHIFT;
|
||||
|
@ -1932,7 +1932,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
|
|||
{
|
||||
// We probably won't hit the target, but aim at it anyway so we don't look stupid.
|
||||
fixedvec2 pos = self->Vec2To(self->target);
|
||||
TVector2<double> xydiff(pos.x, pos.y);
|
||||
DVector2 xydiff(pos.x, pos.y);
|
||||
double zdiff = (self->target->Z() + (self->target->height>>1)) -
|
||||
(self->Z() + (self->height>>1) - self->floorclip);
|
||||
self->pitch = int(atan2(zdiff, xydiff.Length()) * ANGLE_180 / -M_PI);
|
||||
|
@ -5514,7 +5514,7 @@ static bool DoRadiusGive(AActor *self, AActor *thing, PClassActor *item, int amo
|
|||
{ // check if inside a sphere
|
||||
double distsquared = double(distance) * double(distance);
|
||||
double minsquared = double(mindist) * double(mindist);
|
||||
double lengthsquared = TVector3<double>(diff.x, diff.y, diff.z).LengthSquared();
|
||||
double lengthsquared = DVector3(diff.x, diff.y, diff.z).LengthSquared();
|
||||
if (lengthsquared > distsquared || (minsquared && (lengthsquared < minsquared)))
|
||||
{
|
||||
return false;
|
||||
|
@ -6814,7 +6814,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMovementDirection)
|
|||
if (!(flags & FMDF_NOPITCH))
|
||||
{
|
||||
fixed_t current = mobj->pitch;
|
||||
const TVector2<double> velocity(mobj->velx, mobj->vely);
|
||||
const DVector2 velocity(mobj->velx, mobj->vely);
|
||||
const fixed_t pitch = R_PointToAngle2(0, 0, xs_CRoundToInt(velocity.Length()), -mobj->velz);
|
||||
if (pitchlimit > 0)
|
||||
{
|
||||
|
|
|
@ -1279,7 +1279,7 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
|||
ds_x1 = x1;
|
||||
ds_x2 = x2 - 1;
|
||||
|
||||
TVector2<double> tex(x1 - originx, y - originy);
|
||||
DVector2 tex(x1 - originx, y - originy);
|
||||
if (dorotate)
|
||||
{
|
||||
double t = tex.X;
|
||||
|
|
|
@ -1232,4 +1232,9 @@ typedef TRotator<float> FRotator;
|
|||
typedef TMatrix3x3<float> FMatrix3x3;
|
||||
//typedef TAngle<float> FAngle;
|
||||
|
||||
typedef TVector2<double> DVector2;
|
||||
typedef TVector3<double> DVector3;
|
||||
typedef TRotator<double> DRotator;
|
||||
typedef TMatrix3x3<double> DMatrix3x3;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue