- renamed all ZatPoint variants that return a fixed point value to ZatPointFixed, to avoid accidental mixup with the floating point variants.

This commit is contained in:
Christoph Oelckers 2016-04-02 20:45:32 +02:00
parent 6a150f7248
commit 9a07f81269
6 changed files with 45 additions and 43 deletions

View file

@ -1265,10 +1265,6 @@ public:
if (!moving) Prev.Z = Z(); if (!moving) Prev.Z = Z();
} }
// These are not for general use as they do not link the actor into the world!
void SetXY(fixed_t xx, fixed_t yy) = delete;
void SetXYZ(fixed_t xx, fixed_t yy, fixed_t zz) = delete;
void SetXY(const DVector2 &npos) void SetXY(const DVector2 &npos)
{ {
__Pos.X = npos.X; __Pos.X = npos.X;

View file

@ -395,8 +395,8 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
} }
} }
fixed_t refceilz = s->ceilingplane.ZatPoint (viewx, viewy); fixed_t refceilz = s->ceilingplane.ZatPointFixed (viewx, viewy);
fixed_t orgceilz = sec->ceilingplane.ZatPoint (viewx, viewy); fixed_t orgceilz = sec->ceilingplane.ZatPointFixed(viewx, viewy);
#if 1 #if 1
// [RH] Allow viewing underwater areas through doors/windows that // [RH] Allow viewing underwater areas through doors/windows that
@ -405,8 +405,8 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
// sectors at the same time. // sectors at the same time.
if (back && !r_fakingunderwater && curline->frontsector->heightsec == NULL) if (back && !r_fakingunderwater && curline->frontsector->heightsec == NULL)
{ {
if (rw_frontcz1 <= s->floorplane.ZatPoint (curline->v1->fixX(), curline->v1->fixY()) && if (rw_frontcz1 <= s->floorplane.ZatPointFixed (curline->v1) &&
rw_frontcz2 <= s->floorplane.ZatPoint (curline->v2->fixX(), curline->v2->fixY())) rw_frontcz2 <= s->floorplane.ZatPointFixed(curline->v2))
{ {
// Check that the window is actually visible // Check that the window is actually visible
for (int z = WallC.sx1; z < WallC.sx2; ++z) for (int z = WallC.sx1; z < WallC.sx2; ++z)
@ -581,10 +581,10 @@ void R_AddLine (seg_t *line)
{ {
backsector = line->backsector; backsector = line->backsector;
} }
rw_frontcz1 = frontsector->ceilingplane.ZatPoint (line->v1->fixX(), line->v1->fixY()); rw_frontcz1 = frontsector->ceilingplane.ZatPointFixed(line->v1);
rw_frontfz1 = frontsector->floorplane.ZatPoint (line->v1->fixX(), line->v1->fixY()); rw_frontfz1 = frontsector->floorplane.ZatPointFixed(line->v1);
rw_frontcz2 = frontsector->ceilingplane.ZatPoint (line->v2->fixX(), line->v2->fixY()); rw_frontcz2 = frontsector->ceilingplane.ZatPointFixed(line->v2);
rw_frontfz2 = frontsector->floorplane.ZatPoint (line->v2->fixX(), line->v2->fixY()); rw_frontfz2 = frontsector->floorplane.ZatPointFixed(line->v2);
rw_mustmarkfloor = rw_mustmarkceiling = false; rw_mustmarkfloor = rw_mustmarkceiling = false;
rw_havehigh = rw_havelow = false; rw_havehigh = rw_havelow = false;
@ -603,10 +603,10 @@ void R_AddLine (seg_t *line)
} }
doorclosed = 0; // killough 4/16/98 doorclosed = 0; // killough 4/16/98
rw_backcz1 = backsector->ceilingplane.ZatPoint (line->v1->fixX(), line->v1->fixY()); rw_backcz1 = backsector->ceilingplane.ZatPointFixed (line->v1);
rw_backfz1 = backsector->floorplane.ZatPoint (line->v1->fixX(), line->v1->fixY()); rw_backfz1 = backsector->floorplane.ZatPointFixed(line->v1);
rw_backcz2 = backsector->ceilingplane.ZatPoint (line->v2->fixX(), line->v2->fixY()); rw_backcz2 = backsector->ceilingplane.ZatPointFixed(line->v2);
rw_backfz2 = backsector->floorplane.ZatPoint (line->v2->fixX(), line->v2->fixY()); rw_backfz2 = backsector->floorplane.ZatPointFixed(line->v2);
// Cannot make these walls solid, because it can result in // Cannot make these walls solid, because it can result in
// sprite clipping problems for sprites near the wall // sprite clipping problems for sprites near the wall

View file

@ -365,11 +365,25 @@ public:
} }
// Returns the value of z at (x,y) // Returns the value of z at (x,y)
fixed_t ZatPoint (fixed_t x, fixed_t y) const fixed_t ZatPoint(fixed_t x, fixed_t y) const = delete; // it is not allowed to call this.
fixed_t ZatPointFixed(fixed_t x, fixed_t y) const
{ {
return FixedMul (ic, -d - DMulScale16 (a, x, b, y)); return FixedMul (ic, -d - DMulScale16 (a, x, b, y));
} }
// This is for the software renderer
fixed_t ZatPointFixed(const DVector2 &pos) const
{
return xs_CRoundToInt((d + a*pos.X + b*pos.Y) * ic / (-65536.0));
}
fixed_t ZatPointFixed(const vertex_t *v) const
{
return FixedMul(ic, -d - DMulScale16(a, v->fixX(), b, v->fixY()));
}
// Returns the value of z at (x,y) as a double // Returns the value of z at (x,y) as a double
double ZatPoint (double x, double y) const double ZatPoint (double x, double y) const
{ {
@ -381,12 +395,6 @@ public:
return (d + a*pos.X + b*pos.Y) * ic / (-65536.0 * 65536.0); return (d + a*pos.X + b*pos.Y) * ic / (-65536.0 * 65536.0);
} }
// This is for the software renderer
fixed_t ZatPointFixed(const DVector2 &pos) const
{
return xs_CRoundToInt((d + a*pos.X + b*pos.Y) * ic / (-65536.0));
}
double ZatPoint(const vertex_t *v) const double ZatPoint(const vertex_t *v) const
{ {

View file

@ -728,10 +728,8 @@ void R_EnterPortal (PortalDrawseg* pds, int depth)
viewx = FLOAT2FIXED((x1 + r * dx)*2 - x); viewx = FLOAT2FIXED((x1 + r * dx)*2 - x);
viewy = FLOAT2FIXED((y1 + r * dy)*2 - y); viewy = FLOAT2FIXED((y1 + r * dy)*2 - y);
} }
ViewAngle = pds->src->Delta().Angle(); viewangle = pds->src->Delta().Angle().BAMs() - startang;
viewangle = 2*R_PointToAngle2 (pds->src->v1->fixX(), pds->src->v1->fixY(), ViewAngle = AngleToFloat(viewangle);
pds->src->v2->fixX(), pds->src->v2->fixY()) - startang;
} }
else else
{ {

View file

@ -274,7 +274,7 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
{ {
if (!(fake3D & FAKE3D_CLIPTOP)) if (!(fake3D & FAKE3D_CLIPTOP))
{ {
sclipTop = sec->ceilingplane.ZatPoint(viewx, viewy); sclipTop = sec->ceilingplane.ZatPointFixed(viewx, viewy);
} }
for (i = frontsector->e->XFloor.lightlist.Size() - 1; i >= 0; i--) for (i = frontsector->e->XFloor.lightlist.Size() - 1; i >= 0; i--)
{ {
@ -1385,10 +1385,10 @@ static void wallscan_np2_ds(drawseg_t *ds, int x1, int x2, short *uwal, short *d
{ {
if (rw_pic->GetHeight() != 1 << rw_pic->HeightBits) if (rw_pic->GetHeight() != 1 << rw_pic->HeightBits)
{ {
fixed_t frontcz1 = ds->curline->frontsector->ceilingplane.ZatPoint(ds->curline->v1->fixX(), ds->curline->v1->fixY()); fixed_t frontcz1 = ds->curline->frontsector->ceilingplane.ZatPointFixed(ds->curline->v1);
fixed_t frontfz1 = ds->curline->frontsector->floorplane.ZatPoint(ds->curline->v1->fixX(), ds->curline->v1->fixY()); fixed_t frontfz1 = ds->curline->frontsector->floorplane.ZatPointFixed(ds->curline->v1);
fixed_t frontcz2 = ds->curline->frontsector->ceilingplane.ZatPoint(ds->curline->v2->fixX(), ds->curline->v2->fixY()); fixed_t frontcz2 = ds->curline->frontsector->ceilingplane.ZatPointFixed(ds->curline->v2);
fixed_t frontfz2 = ds->curline->frontsector->floorplane.ZatPoint(ds->curline->v2->fixX(), ds->curline->v2->fixY()); fixed_t frontfz2 = ds->curline->frontsector->floorplane.ZatPointFixed(ds->curline->v2);
fixed_t top = MAX(frontcz1, frontcz2); fixed_t top = MAX(frontcz1, frontcz2);
fixed_t bot = MIN(frontfz1, frontfz2); fixed_t bot = MIN(frontfz1, frontfz2);
if (fake3D & FAKE3D_CLIPTOP) if (fake3D & FAKE3D_CLIPTOP)
@ -2783,7 +2783,7 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
x -= MulScale30 (frac, x - curline->v1->fixX()); x -= MulScale30 (frac, x - curline->v1->fixX());
y -= MulScale30 (frac, y - curline->v1->fixY()); y -= MulScale30 (frac, y - curline->v1->fixY());
} }
z1 = viewz - plane.ZatPoint (x, y); z1 = viewz - plane.ZatPointFixed(x, y);
if (wallc->sx2 > wallc->sx1 + 1) if (wallc->sx2 > wallc->sx1 + 1)
{ {
@ -2795,7 +2795,7 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
x += MulScale30 (frac, curline->v2->fixX() - x); x += MulScale30 (frac, curline->v2->fixX() - x);
y += MulScale30 (frac, curline->v2->fixY() - y); y += MulScale30 (frac, curline->v2->fixY() - y);
} }
z2 = viewz - plane.ZatPoint (x, y); z2 = viewz - plane.ZatPointFixed(x, y);
} }
else else
{ {
@ -2812,7 +2812,7 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
x += MulScale30 (frac, curline->v2->fixX() - x); x += MulScale30 (frac, curline->v2->fixX() - x);
y += MulScale30 (frac, curline->v2->fixY() - y); y += MulScale30 (frac, curline->v2->fixY() - y);
} }
z1 = viewz - plane.ZatPoint (x, y); z1 = viewz - plane.ZatPointFixed(x, y);
if (wallc->sx2 > wallc->sx1 + 1) if (wallc->sx2 > wallc->sx1 + 1)
{ {
@ -2824,7 +2824,7 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
x -= MulScale30 (frac, x - curline->v1->fixX()); x -= MulScale30 (frac, x - curline->v1->fixX());
y -= MulScale30 (frac, y - curline->v1->fixY()); y -= MulScale30 (frac, y - curline->v1->fixY());
} }
z2 = viewz - plane.ZatPoint (x, y); z2 = viewz - plane.ZatPointFixed(x, y);
} }
else else
{ {

View file

@ -937,19 +937,19 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
{ {
if (fakeside == FAKED_AboveCeiling) if (fakeside == FAKED_AboveCeiling)
{ {
if (gzt < heightsec->ceilingplane.ZatPoint (fx, fy)) if (gzt < heightsec->ceilingplane.ZatPointFixed(fx, fy))
return; return;
} }
else if (fakeside == FAKED_BelowFloor) else if (fakeside == FAKED_BelowFloor)
{ {
if (gzb >= heightsec->floorplane.ZatPoint (fx, fy)) if (gzb >= heightsec->floorplane.ZatPointFixed(fx, fy))
return; return;
} }
else else
{ {
if (gzt < heightsec->floorplane.ZatPoint (fx, fy)) if (gzt < heightsec->floorplane.ZatPointFixed(fx, fy))
return; return;
if (!(heightsec->MoreFlags & SECF_FAKEFLOORONLY) && gzb >= heightsec->ceilingplane.ZatPoint (fx, fy)) if (!(heightsec->MoreFlags & SECF_FAKEFLOORONLY) && gzb >= heightsec->ceilingplane.ZatPointFixed(fx, fy))
return; return;
} }
} }
@ -1931,7 +1931,7 @@ void R_DrawSprite (vissprite_t *spr)
{ {
if (!(fake3D & FAKE3D_CLIPTOP)) if (!(fake3D & FAKE3D_CLIPTOP))
{ {
sclipTop = spr->sector->ceilingplane.ZatPoint(viewx, viewy); sclipTop = spr->sector->ceilingplane.ZatPointFixed(viewx, viewy);
} }
sector_t *sec = NULL; sector_t *sec = NULL;
for (i = spr->sector->e->XFloor.lightlist.Size() - 1; i >= 0; i--) for (i = spr->sector->e->XFloor.lightlist.Size() - 1; i >= 0; i--)
@ -2031,7 +2031,7 @@ void R_DrawSprite (vissprite_t *spr)
{ // only things in specially marked sectors { // only things in specially marked sectors
if (spr->FakeFlatStat != FAKED_AboveCeiling) if (spr->FakeFlatStat != FAKED_AboveCeiling)
{ {
fixed_t hz = spr->heightsec->floorplane.ZatPoint (spr->gx, spr->gy); fixed_t hz = spr->heightsec->floorplane.ZatPointFixed(spr->gx, spr->gy);
fixed_t h = (centeryfrac - FixedMul (hz-viewz, scale)) >> FRACBITS; fixed_t h = (centeryfrac - FixedMul (hz-viewz, scale)) >> FRACBITS;
if (spr->FakeFlatStat == FAKED_BelowFloor) if (spr->FakeFlatStat == FAKED_BelowFloor)
@ -2053,7 +2053,7 @@ void R_DrawSprite (vissprite_t *spr)
} }
if (spr->FakeFlatStat != FAKED_BelowFloor && !(spr->heightsec->MoreFlags & SECF_FAKEFLOORONLY)) if (spr->FakeFlatStat != FAKED_BelowFloor && !(spr->heightsec->MoreFlags & SECF_FAKEFLOORONLY))
{ {
fixed_t hz = spr->heightsec->ceilingplane.ZatPoint (spr->gx, spr->gy); fixed_t hz = spr->heightsec->ceilingplane.ZatPointFixed(spr->gx, spr->gy);
fixed_t h = (centeryfrac - FixedMul (hz-viewz, scale)) >> FRACBITS; fixed_t h = (centeryfrac - FixedMul (hz-viewz, scale)) >> FRACBITS;
if (spr->FakeFlatStat == FAKED_AboveCeiling) if (spr->FakeFlatStat == FAKED_AboveCeiling)