From 5d08a812404b463ce6b2008f8b74092a2b501c6e Mon Sep 17 00:00:00 2001 From: raa-eruanna Date: Thu, 13 Oct 2016 02:37:38 -0400 Subject: [PATCH] - fixed: compiler warning with bad copy-paste - fixed: speed up sky compositing in truecolor mode with large buffers - only the last 4 buffers used are checked. --- src/r_plane.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/r_plane.cpp b/src/r_plane.cpp index a3facc342..d69e8a5c4 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -889,7 +889,7 @@ static const BYTE *R_GetOneSkyColumn (FTexture *fronttex, int x) // Get a column of sky when there are two overlapping sky textures static const BYTE *R_GetTwoSkyColumns (FTexture *fronttex, int x) { - DWORD ang, angle1, angle2 = (DWORD)((UMulScale16(ang, backcyl) + backpos) >> FRACBITS); + DWORD ang, angle1, angle2; if (r_linearsky) { @@ -946,11 +946,12 @@ static const BYTE *R_GetTwoSkyColumns (FTexture *fronttex, int x) else { //return R_GetOneSkyColumn(fronttex, x); - for (i = 0; i < MAXSKYBUF; ++i) + for (i = skycolplace_bgra - 4; i < skycolplace_bgra; ++i) { - if (lastskycol_bgra[i] == skycol) + int ic = (i % MAXSKYBUF); // i "checker" - can wrap around the ends of the array + if (lastskycol_bgra[ic] == skycol) { - return (BYTE*)(skybuf_bgra[i]); + return (BYTE*)(skybuf_bgra[ic]); } }