- floatified the return data from Trace().

This commit is contained in:
Christoph Oelckers 2016-03-23 18:07:04 +01:00
commit 2dbd79cc8d
17 changed files with 105 additions and 108 deletions

View file

@ -94,9 +94,9 @@ struct FTraceInfo
void SetSourcePosition()
{
Results->SrcFromTarget = { StartX, StartY, StartZ };
Results->HitVector = { Vx, Vy, Vz };
Results->SrcAngleToTarget = R_PointToAngle2(0, 0, Results->HitPos.x - StartX, Results->HitPos.y - StartY);
Results->SrcFromTarget = { FIXED2DBL(StartX), FIXED2DBL(StartY), FIXED2DBL(StartZ) };
Results->HitVector = { FIXED2DBL(Vx), FIXED2DBL(Vy), FIXED2DBL(Vz) };
Results->SrcAngleFromTarget = VecToAngle(Results->HitVector);
}
@ -122,7 +122,7 @@ bool Trace (fixed_t x, fixed_t y, fixed_t z, sector_t *sector,
FTraceResults tempResult;
memset(&tempResult, 0, sizeof(tempResult));
tempResult.Fraction = tempResult.Distance = FIXED_MAX;
tempResult.Fraction = tempResult.Distance = NO_VALUE;
ptflags = actorMask ? PT_ADDLINES|PT_ADDTHINGS|PT_COMPATIBLE : PT_ADDLINES;
@ -652,10 +652,10 @@ cont:
if (Results->HitType == TRACE_HitWall)
{
Results->HitPos = { hitx, hity, hitz };
Results->HitPos = { FIXED2DBL(hitx), FIXED2DBL(hity), FIXED2DBL(hitz) };
SetSourcePosition();
Results->Distance = dist;
Results->Fraction = in->frac;
Results->Distance = FIXED2DBL(dist);
Results->Fraction = FIXED2DBL(in->frac);
Results->Line = in->d.line;
Results->Side = lineside;
}
@ -779,10 +779,10 @@ cont1:
Results->HitType = TRACE_HitActor;
Results->HitPos = { hitx, hity, hitz };
Results->HitPos = { FIXED2DBL(hitx), FIXED2DBL(hity), FIXED2DBL(hitz) };
SetSourcePosition();
Results->Distance = dist;
Results->Fraction = in->frac;
Results->Distance = FIXED2DBL(dist);
Results->Fraction = FIXED2DBL(in->frac);
Results->Actor = in->d.thing;
if (TraceCallback != NULL)
@ -836,7 +836,7 @@ bool FTraceInfo::TraceTraverse (int ptflags)
}
// We have something closer in the storage for portal subtraces.
if (TempResults->HitType != TRACE_HitNone && in->frac > TempResults->Fraction)
if (TempResults->HitType != TRACE_HitNone && FIXED2DBL(in->frac) > TempResults->Fraction)
{
break;
}
@ -859,7 +859,7 @@ bool FTraceInfo::TraceTraverse (int ptflags)
// We still need to do a water check here or this may get missed on occasion
if (Results->CrossedWater == NULL &&
CurSector->heightsec != NULL &&
CurSector->heightsec->floorplane.ZatPoint(Results->HitPos) >= Results->HitPos.z)
CurSector->heightsec->floorplane.ZatPoint(Results->HitPos) >= Results->HitPos.Z)
{
// Save the result so that the water check doesn't destroy it.
FTraceResults *res = Results;
@ -896,7 +896,7 @@ bool FTraceInfo::TraceTraverse (int ptflags)
if (Results->CrossedWater == NULL &&
CurSector->heightsec != NULL &&
CurSector->heightsec->floorplane.ZatPoint(Results->HitPos) >= Results->HitPos.z)
CurSector->heightsec->floorplane.ZatPoint(Results->HitPos) >= Results->HitPos.Z)
{
// Save the result so that the water check doesn't destroy it.
FTraceResults *res = Results;
@ -913,12 +913,12 @@ bool FTraceInfo::TraceTraverse (int ptflags)
if (Results->HitType == TRACE_HitNone && Results->Distance == 0)
{
Results->HitPos = {
StartX + FixedMul(Vx, MaxDist),
StartY + FixedMul(Vy, MaxDist),
StartZ + FixedMul(Vz, MaxDist) };
FIXED2DBL(StartX + FixedMul(Vx, MaxDist)),
FIXED2DBL(StartY + FixedMul(Vy, MaxDist)),
FIXED2DBL(StartZ + FixedMul(Vz, MaxDist)) };
SetSourcePosition();
Results->Distance = MaxDist;
Results->Fraction = FRACUNIT;
Results->Distance = FIXED2DBL(MaxDist);
Results->Fraction = 1.;
}
return Results->HitType != TRACE_HitNone;
}
@ -944,12 +944,12 @@ bool FTraceInfo::CheckPlane (const secplane_t &plane)
if (hitdist > EnterDist && hitdist < MaxDist)
{
Results->HitPos = {
StartX + FixedMul(Vx, hitdist),
StartY + FixedMul(Vy, hitdist),
StartZ + FixedMul(Vz, hitdist) };
FIXED2DBL(StartX + FixedMul(Vx, hitdist)),
FIXED2DBL(StartY + FixedMul(Vy, hitdist)),
FIXED2DBL(StartZ + FixedMul(Vz, hitdist)) };
SetSourcePosition();
Results->Distance = hitdist;
Results->Fraction = FixedDiv (hitdist, MaxDist);
Results->Distance = FIXED2DBL(hitdist);
Results->Fraction = FIXED2DBL(FixedDiv (hitdist, MaxDist));
return true;
}
}