From 891b3da1038a0a3cb759e39678881d480c2bed82 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 7 Aug 2014 22:43:23 -0500 Subject: [PATCH] Remove extra magnitude from magic texture mapping values - These used to be fixed point, but now they're floating point, so the excess magnitude is unneeded. --- src/r_bsp.cpp | 24 ++++++++++++------------ src/r_main.cpp | 4 +--- src/r_main.h | 1 - 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index c56255888..146ea5673 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -809,17 +809,17 @@ void FWallTmapVals::InitFromWallCoords(const FWallCoords *wallc) { if (MirrorFlags & RF_XFLIP) { - UoverZorg = (float)wallc->tx2 * WallTMapScale; - UoverZstep = (float)(-wallc->ty2) * 32.f; - InvZorg = (float)(wallc->tx2 - wallc->tx1) * WallTMapScale; - InvZstep = (float)(wallc->ty1 - wallc->ty2) * 32.f; + UoverZorg = (float)wallc->tx2 * centerx; + UoverZstep = (float)(-wallc->ty2); + InvZorg = (float)(wallc->tx2 - wallc->tx1) * centerx; + InvZstep = (float)(wallc->ty1 - wallc->ty2); } else { - UoverZorg = (float)wallc->tx1 * WallTMapScale; - UoverZstep = (float)(-wallc->ty1) * 32.f; - InvZorg = (float)(wallc->tx1 - wallc->tx2) * WallTMapScale; - InvZstep = (float)(wallc->ty2 - wallc->ty1) * 32.f; + UoverZorg = (float)wallc->tx1 * centerx; + UoverZstep = (float)(-wallc->ty1); + InvZorg = (float)(wallc->tx1 - wallc->tx2) * centerx; + InvZstep = (float)(wallc->ty2 - wallc->ty1); } InitDepth(); } @@ -837,10 +837,10 @@ void FWallTmapVals::InitFromLine(int tx1, int ty1, int tx2, int ty2) fullx2 = -fullx2; } - UoverZorg = (float)fullx1 * WallTMapScale; - UoverZstep = (float)(-fully1) * 32.f; - InvZorg = (float)(fullx1 - fullx2) * WallTMapScale; - InvZstep = (float)(fully2 - fully1) * 32.f; + UoverZorg = (float)fullx1 * centerx; + UoverZstep = (float)(-fully1); + InvZorg = (float)(fullx1 - fullx2) * centerx; + InvZstep = (float)(fully2 - fully1); InitDepth(); } diff --git a/src/r_main.cpp b/src/r_main.cpp index bc3c4c7c0..dbf4cbeb5 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -117,7 +117,6 @@ FDynamicColormap*basecolormap; // [RH] colormap currently drawing with int fixedlightlev; lighttable_t *fixedcolormap; FSpecialColormap *realfixedcolormap; -float WallTMapScale; float WallTMapScale2; @@ -386,8 +385,7 @@ void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight, iyaspectmulfloat = (float)virtwidth * r_Yaspect / 320.f / (float)virtheight; InvZtoScale = yaspectmul * centerx; - WallTMapScale = (float)centerx * 32.f; - WallTMapScale2 = iyaspectmulfloat * 2.f / (float)centerx; + WallTMapScale2 = iyaspectmulfloat * 64.f / (float)centerx; // psprite scales pspritexscale = (centerxwide << FRACBITS) / 160; diff --git a/src/r_main.h b/src/r_main.h index 0126d3906..715a60610 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -42,7 +42,6 @@ extern fixed_t FocalLengthX, FocalLengthY; extern float FocalLengthXfloat; extern fixed_t InvZtoScale; -extern float WallTMapScale; extern float WallTMapScale2; extern int viewwindowx;