From ec0b07b5e2e2eef417c10bfec3a1cdfad581d06f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 10 Sep 2010 13:49:08 +0000 Subject: [PATCH] - added Entryway's AM_Rotate optimization. SVN r2739 (trunk) --- src/am_map.cpp | 16 ++++++++++++---- src/win32/fb_d3d9.cpp | 4 ++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index f3f7d7a390..73a7f8c989 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -1940,12 +1940,20 @@ void AM_drawWalls (bool allmap) void AM_rotate(fixed_t *xp, fixed_t *yp, angle_t a) { + static angle_t angle_saved = 0; + static double sinrot = 0; + static double cosrot = 1; + + if (angle_saved != a) + { + angle_saved = a; + double rot = (double)a / (double)(1u << 31) * (double)M_PI; + sinrot = sin(rot); + cosrot = cos(rot); + } + double x = FIXED2FLOAT(*xp); double y = FIXED2FLOAT(*yp); - double rot = (double)a / (double)(1u << 31) * (double)M_PI; - double sinrot = sin(rot); - double cosrot = cos(rot); - double tmpx = (x * cosrot) - (y * sinrot); y = (x * sinrot) + (y * cosrot); x = tmpx; diff --git a/src/win32/fb_d3d9.cpp b/src/win32/fb_d3d9.cpp index 020be2de1a..7453571e5d 100644 --- a/src/win32/fb_d3d9.cpp +++ b/src/win32/fb_d3d9.cpp @@ -3311,8 +3311,8 @@ void D3DFB::FillSimplePoly(FTexture *texture, FVector2 *points, int npoints, quad->NumTris = npoints - 2; yoffs = GatheringWipeScreen ? 0 : LBOffset; - uscale = float(1.f / (texture->GetWidth() * scalex)); - vscale = float(1.f / (texture->GetHeight() * scaley)); + uscale = float(1.f / (texture->GetScaledWidth() * scalex)); + vscale = float(1.f / (texture->GetScaledHeight() * scaley)); ox = float(originx); oy = float(originy);