From b2b3e50c5c81ac9b9b880917a5405f7f3a0006b4 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 21 Apr 2016 19:46:03 -0500 Subject: [PATCH] Renderer floatification: Use floating point for geometry Zs --- src/r_bsp.cpp | 24 ++++++++++++------------ src/r_segs.cpp | 16 +++++++--------- src/r_things.cpp | 10 +++++----- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index 1cc2fa9188..420cfbd212 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -78,10 +78,10 @@ extern short wallbottom[MAXWIDTH]; extern short wallupper[MAXWIDTH]; extern short walllower[MAXWIDTH]; -fixed_t rw_backcz1, rw_backcz2; -fixed_t rw_backfz1, rw_backfz2; -fixed_t rw_frontcz1, rw_frontcz2; -fixed_t rw_frontfz1, rw_frontfz2; +double rw_backcz1, rw_backcz2; +double rw_backfz1, rw_backfz2; +double rw_frontcz1, rw_frontcz2; +double rw_frontfz1, rw_frontfz2; size_t MaxDrawSegs; @@ -596,10 +596,10 @@ void R_AddLine (seg_t *line) { backsector = line->backsector; } - rw_frontcz1 = frontsector->ceilingplane.ZatPointFixed(line->v1); - rw_frontfz1 = frontsector->floorplane.ZatPointFixed(line->v1); - rw_frontcz2 = frontsector->ceilingplane.ZatPointFixed(line->v2); - rw_frontfz2 = frontsector->floorplane.ZatPointFixed(line->v2); + rw_frontcz1 = frontsector->ceilingplane.ZatPoint(line->v1); + rw_frontfz1 = frontsector->floorplane.ZatPoint(line->v1); + rw_frontcz2 = frontsector->ceilingplane.ZatPoint(line->v2); + rw_frontfz2 = frontsector->floorplane.ZatPoint(line->v2); rw_mustmarkfloor = rw_mustmarkceiling = false; rw_havehigh = rw_havelow = false; @@ -618,10 +618,10 @@ void R_AddLine (seg_t *line) } doorclosed = 0; // killough 4/16/98 - rw_backcz1 = backsector->ceilingplane.ZatPointFixed (line->v1); - rw_backfz1 = backsector->floorplane.ZatPointFixed(line->v1); - rw_backcz2 = backsector->ceilingplane.ZatPointFixed(line->v2); - rw_backfz2 = backsector->floorplane.ZatPointFixed(line->v2); + rw_backcz1 = backsector->ceilingplane.ZatPoint(line->v1); + rw_backfz1 = backsector->floorplane.ZatPoint(line->v1); + rw_backcz2 = backsector->ceilingplane.ZatPoint(line->v2); + rw_backfz2 = backsector->floorplane.ZatPoint(line->v2); // Cannot make these walls solid, because it can result in // sprite clipping problems for sprites near the wall diff --git a/src/r_segs.cpp b/src/r_segs.cpp index c979a6b87d..e689e5a89c 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -98,10 +98,10 @@ double lwallscale; // // regular wall // -extern fixed_t rw_backcz1, rw_backcz2; -extern fixed_t rw_backfz1, rw_backfz2; -extern fixed_t rw_frontcz1, rw_frontcz2; -extern fixed_t rw_frontfz1, rw_frontfz2; +extern double rw_backcz1, rw_backcz2; +extern double rw_backfz1, rw_backfz2; +extern double rw_frontcz1, rw_frontcz2; +extern double rw_frontfz1, rw_frontfz2; int rw_ceilstat, rw_floorstat; bool rw_mustmarkfloor, rw_mustmarkceiling; @@ -136,7 +136,7 @@ static fixed_t *maskedtexturecol; static void R_RenderDecal (side_t *wall, DBaseDecal *first, drawseg_t *clipper, int pass); static void WallSpriteColumn (void (*drawfunc)(const BYTE *column, const FTexture::Span *spans)); -void wallscan_np2(int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal, fixed_t yrepeat, fixed_t top, fixed_t bot, bool mask); +void wallscan_np2(int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal, fixed_t yrepeat, double top, double bot, bool mask); static void wallscan_np2_ds(drawseg_t *ds, int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal, fixed_t yrepeat); static void call_wallscan(int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal, fixed_t yrepeat, bool mask); @@ -1317,7 +1317,7 @@ static void call_wallscan(int x1, int x2, short *uwal, short *dwal, fixed_t *swa // //============================================================================= -void wallscan_np2(int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal, fixed_t yrep, fixed_t itop, fixed_t ibot, bool mask) +void wallscan_np2(int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t *lwal, fixed_t yrep, double top, double bot, bool mask) { if (!r_np2) { @@ -1329,8 +1329,6 @@ void wallscan_np2(int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed short *up, *down; double texheight = rw_pic->GetHeight(); double partition; - double top = FIXED2FLOAT(itop); - double bot = FIXED2FLOAT(ibot); double yrepeat = FIXED2FLOAT(yrep); double scaledtexheight = texheight / yrepeat; @@ -1407,7 +1405,7 @@ static void wallscan_np2_ds(drawseg_t *ds, int x1, int x2, short *uwal, short *d { bot = MAX(bot, sclipBottom); } - wallscan_np2(x1, x2, uwal, dwal, swal, lwal, yrepeat, FLOAT2FIXED(top), FLOAT2FIXED(bot), true); + wallscan_np2(x1, x2, uwal, dwal, swal, lwal, yrepeat, top, bot, true); } else { diff --git a/src/r_things.cpp b/src/r_things.cpp index 60ae7213b7..42308a9e76 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -932,19 +932,19 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor { if (fakeside == FAKED_AboveCeiling) { - if (gzt < heightsec->ceilingplane.ZatPointFixed(pos)) + if (gzt < heightsec->ceilingplane.ZatPoint(pos)) return; } else if (fakeside == FAKED_BelowFloor) { - if (gzb >= heightsec->floorplane.ZatPointFixed(pos)) + if (gzb >= heightsec->floorplane.ZatPoint(pos)) return; } else { - if (gzt < heightsec->floorplane.ZatPointFixed(pos)) + if (gzt < heightsec->floorplane.ZatPoint(pos)) return; - if (!(heightsec->MoreFlags & SECF_FAKEFLOORONLY) && gzb >= heightsec->ceilingplane.ZatPointFixed(pos)) + if (!(heightsec->MoreFlags & SECF_FAKEFLOORONLY) && gzb >= heightsec->ceilingplane.ZatPoint(pos)) return; } } @@ -1929,7 +1929,7 @@ void R_DrawSprite (vissprite_t *spr) { if (!(fake3D & FAKE3D_CLIPTOP)) { - sclipTop = spr->sector->ceilingplane.ZatPointFixed(ViewPos); + sclipTop = spr->sector->ceilingplane.ZatPoint(ViewPos); } sector_t *sec = NULL; for (i = spr->sector->e->XFloor.lightlist.Size() - 1; i >= 0; i--)