From f8ebfb541e4f56ca978ed1f22152fc3dad601c71 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 10 Mar 2016 20:44:53 +0100 Subject: [PATCH] - use typedefs for TVector etc. (Better have this out of the way before messing around with this stuff...) --- src/actor.h | 4 ++-- src/b_func.cpp | 2 +- src/g_shared/a_camera.cpp | 2 +- src/g_strife/a_loremaster.cpp | 2 +- src/p_acs.cpp | 2 +- src/p_buildmap.cpp | 6 +++--- src/p_effect.cpp | 26 +++++++++++++------------- src/p_effect.h | 2 +- src/p_enemy.cpp | 4 ++-- src/p_glnodes.cpp | 4 ++-- src/p_map.cpp | 2 +- src/p_mobj.cpp | 14 +++++++------- src/p_slopes.cpp | 14 +++++++------- src/p_teleport.cpp | 2 +- src/p_things.cpp | 10 +++++----- src/p_udmf.cpp | 4 ++-- src/p_user.cpp | 8 ++++---- src/po_man.cpp | 2 +- src/r_things.cpp | 4 ++-- src/r_utility.cpp | 4 ++-- src/thingdef/thingdef_codeptr.cpp | 14 +++++++------- src/v_draw.cpp | 2 +- src/vectors.h | 5 +++++ 23 files changed, 72 insertions(+), 67 deletions(-) diff --git a/src/actor.h b/src/actor.h index d91299ce3..e8e0c5351 100644 --- a/src/actor.h +++ b/src/actor.h @@ -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(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(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) diff --git a/src/b_func.cpp b/src/b_func.cpp index 76be764f1..c55e689be 100644 --- a/src/b_func.cpp +++ b/src/b_func.cpp @@ -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 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); diff --git a/src/g_shared/a_camera.cpp b/src/g_shared/a_camera.cpp index deed7911a..7febf80d1 100644 --- a/src/g_shared/a_camera.cpp +++ b/src/g_shared/a_camera.cpp @@ -177,7 +177,7 @@ void AAimingCamera::Tick () if (MaxPitchChange) { // Aim camera's pitch; use floats for precision fixedvec2 fv3 = tracer->Vec2To(this); - TVector2 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; diff --git a/src/g_strife/a_loremaster.cpp b/src/g_strife/a_loremaster.cpp index d409434a0..dbc916d41 100644 --- a/src/g_strife/a_loremaster.cpp +++ b/src/g_strife/a_loremaster.cpp @@ -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 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)); diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 466d8793e..3aefcb46a 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -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(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; diff --git a/src/p_buildmap.cpp b/src/p_buildmap.cpp index 345a9160d..3da00fbaf 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) { - TVector3 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(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[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)) diff --git a/src/p_effect.cpp b/src/p_effect.cpp index ce1b999b8..63355144d 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -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 &start, const TVector3 &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 deg; - TVector3 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 &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 point; + DVector3 point; double r; double dirz; @@ -728,7 +728,7 @@ void P_DrawRailTrail(AActor *source, const TVector3 &start, const TVecto minelem = fabs(dir[i]); } } - TVector3 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 &start, const TVecto // Create the outer spiral. if (color1 != -1 && (!r_rail_smartspiral || color2 == -1) && r_rail_spiralsparsity > 0 && (spawnclass == NULL)) { - TVector3 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 &start, const TVecto for (i = spiral_steps; i; i--) { particle_t *p = NewParticle (); - TVector3 tempvec; + DVector3 tempvec; if (!p) return; @@ -761,7 +761,7 @@ void P_DrawRailTrail(AActor *source, const TVector3 &start, const TVecto p->size = 3; p->bright = fullbright; - tempvec = TMatrix3x3(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 &start, const TVecto // Create the inner trail. if (color2 != -1 && r_rail_trailsparsity > 0 && spawnclass == NULL) { - TVector3 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 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 &start, const TVecto diff.Z = clamp(diff.Z + ((rnd & 32) ? 1 : -1), -maxdiff, maxdiff); } - TVector3 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 &start, const TVecto if (sparsity < 1) sparsity = 32; - TVector3 trail_step = (step / 3) * sparsity; + DVector3 trail_step = (step / 3) * sparsity; int trail_steps = (int)((steps * 3) / sparsity); - TVector3 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 &start, const TVecto if (rnd & 4) diff.Z = clamp(diff.Z + ((rnd & 32) ? 1 : -1), -maxdiff, maxdiff); } - TVector3 postmp = pos + diff; + DVector3 postmp = pos + diff; AActor *thing = Spawn (spawnclass, FLOAT2FIXED(postmp.X), FLOAT2FIXED(postmp.Y), FLOAT2FIXED(postmp.Z), ALLOW_REPLACE); if (thing) diff --git a/src/p_effect.h b/src/p_effect.h index b5a0b3e2f..67ab0024e 100644 --- a/src/p_effect.h +++ b/src/p_effect.h @@ -89,7 +89,7 @@ void P_RunEffects (void); void P_RunEffect (AActor *actor, int effects); -void P_DrawRailTrail(AActor *source, const TVector3 &start, const TVector3 &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); diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 2d8d4980c..2c1339921 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -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 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 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); } diff --git a/src/p_glnodes.cpp b/src/p_glnodes.cpp index 8f2f893b6..ed4b1d345 100644 --- a/src/p_glnodes.cpp +++ b/src/p_glnodes.cpp @@ -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 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 lvec(line->dx, line->dy); + DVector2 lvec(line->dx, line->dy); float linelen = float(lvec.Length()); missing += (added_seglen[i] < linelen - FRACUNIT); diff --git a/src/p_map.cpp b/src/p_map.cpp index 0b7d6fc05..f021c3cc6 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -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 start, end; + DVector3 start, end; FTraceResults trace; fixed_t shootz; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index cf084c433..73214763e 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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(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(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 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 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(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 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 vec(vx, vy, vz); + DVector3 vec(vx, vy, vz); if (MissileActor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)) { diff --git a/src/p_slopes.cpp b/src/p_slopes.cpp index 05ff69512..97cf2fb57 100644 --- a/src/p_slopes.cpp +++ b/src/p_slopes.cpp @@ -77,7 +77,7 @@ static void P_SlopeLineToPoint (int lineid, fixed_t x, fixed_t y, fixed_t z, boo plane = &sec->floorplane; } - TVector3 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 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 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 vt1, vt2, vt3, cross; - TVector3 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 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 p, v1, v2, cross; + DVector3 p, v1, v2, cross; secplane_t *srcplane; fixed_t srcheight, destheight; diff --git a/src/p_teleport.cpp b/src/p_teleport.cpp index 0edec94ed..d93d1096a 100644 --- a/src/p_teleport.cpp +++ b/src/p_teleport.cpp @@ -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(thing->velx, thing->vely).Length()); + missilespeed = xs_CRoundToInt(DVector2(thing->velx, thing->vely).Length()); } if (flags & TELF_KEEPHEIGHT) { diff --git a/src/p_things.cpp b/src/p_things.cpp index db5b49cb8..eecf57ebc 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -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 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 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 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 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 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); diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 2c388e178..778e99adf 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -1607,7 +1607,7 @@ public: } else { - double ulen = TVector3(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(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); diff --git a/src/p_user.cpp b/src/p_user.cpp index 996b151ff..73f8febcd 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -2753,13 +2753,13 @@ void P_PredictionLerpReset() bool P_LerpCalculate(PredictPos from, PredictPos to, PredictPos &result, float scale) { - TVector3 vecFrom(FIXED2DBL(from.x), FIXED2DBL(from.y), FIXED2DBL(from.z)); - TVector3 vecTo(FIXED2DBL(to.x), FIXED2DBL(to.y), FIXED2DBL(to.z)); - TVector3 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 delta = vecResult - vecTo; + DVector3 delta = vecResult - vecTo; result.x = FLOAT2FIXED(vecResult.X); result.y = FLOAT2FIXED(vecResult.Y); diff --git a/src/po_man.cpp b/src/po_man.cpp index 8a1d349d6..64f1fde61 100644 --- a/src/po_man.cpp +++ b/src/po_man.cpp @@ -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 dist; + DVector2 dist; double distlen; if ((poly = PO_GetPolyobj(polyNum)) == NULL) diff --git a/src/r_things.cpp b/src/r_things.cpp index a4a81872f..644ca7899 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -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(a->deltax, a->deltay).LengthSquared() < - TVector2(b->deltax, b->deltay).LengthSquared(); + return DVector2(a->deltax, a->deltay).LengthSquared() < + DVector2(b->deltax, b->deltay).LengthSquared(); } #if 0 diff --git a/src/r_utility.cpp b/src/r_utility.cpp index dbe5fadd6..f4bd85a9a 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -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(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(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) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index a807fb7fd..b9ad61e6f 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -316,7 +316,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetDistance) if (checkz) diff.z += (target->height - self->height) / 2; - const double length = TVector3(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 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 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 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 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(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 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) { diff --git a/src/v_draw.cpp b/src/v_draw.cpp index bf3a65cdf..1ccf04044 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -1279,7 +1279,7 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints, ds_x1 = x1; ds_x2 = x2 - 1; - TVector2 tex(x1 - originx, y - originy); + DVector2 tex(x1 - originx, y - originy); if (dorotate) { double t = tex.X; diff --git a/src/vectors.h b/src/vectors.h index 7a1e4e296..87db3461e 100644 --- a/src/vectors.h +++ b/src/vectors.h @@ -1232,4 +1232,9 @@ typedef TRotator FRotator; typedef TMatrix3x3 FMatrix3x3; //typedef TAngle FAngle; +typedef TVector2 DVector2; +typedef TVector3 DVector3; +typedef TRotator DRotator; +typedef TMatrix3x3 DMatrix3x3; + #endif