From 1c9b6930874a4e14ab4314bf4787120a57e86d01 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 24 Oct 2009 04:39:36 +0000 Subject: [PATCH] - Fixed drawing of wide high resolution skies. (At least for the samples I received. I'm not convinced that it's yet fixed for the general case.) SVN r1930 (trunk) --- docs/rh-log.txt | 4 ++++ src/r_anim.cpp | 4 ++-- src/r_plane.cpp | 17 ++++++++++------- src/r_sky.cpp | 10 ++++------ 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 39c76062e..ed25d858d 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,7 @@ +October 23, 2009 +- Fixed drawing of wide high resolution skies. (At least for the samples I + received. I'm not convinced that it's yet fixed for the general case.) + October 19, 2009 (Changes by Graf Zahl) - fixed: Setting the first state's duration of a fast projectile to 0 caused an underflow and blocked all further state changes. diff --git a/src/r_anim.cpp b/src/r_anim.cpp index 22c85c50d..43e3b50a3 100644 --- a/src/r_anim.cpp +++ b/src/r_anim.cpp @@ -834,6 +834,6 @@ void R_UpdateAnimations (DWORD mstime) // Scroll the sky double ms = (double)mstime * FRACUNIT; - sky1pos = fixed_t(fmod (ms * level.skyspeed1, double(TexMan[sky1texture]->GetWidth() << FRACBITS))); - sky2pos = fixed_t(fmod (ms * level.skyspeed2, double(TexMan[sky2texture]->GetWidth() << FRACBITS))); + sky1pos = fixed_t(fmod (ms * level.skyspeed1, double(TexMan[sky1texture]->GetScaledWidth() << FRACBITS))); + sky2pos = fixed_t(fmod (ms * level.skyspeed2, double(TexMan[sky2texture]->GetScaledWidth() << FRACBITS))); } diff --git a/src/r_plane.cpp b/src/r_plane.cpp index 69af40223..d177241c6 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -764,17 +764,16 @@ static int skycolplace; // Get a column of sky when there is only one sky texture. static const BYTE *R_GetOneSkyColumn (FTexture *fronttex, int x) { - angle_t column = MulScale16 (frontxScale, viewangle + xtoviewangle[x]); - - return fronttex->GetColumn ((((column^skyflip) >> sky1shift) + frontpos) >> FRACBITS, NULL); + angle_t column = (viewangle + xtoviewangle[x]) ^ skyflip; + return fronttex->GetColumn (MulScale32((column >> sky1shift) + frontpos, frontxScale), NULL); } // Get a column of sky when there are two overlapping sky textures static const BYTE *R_GetTwoSkyColumns (FTexture *fronttex, int x) { - DWORD ang = (viewangle + xtoviewangle[x])^skyflip; - DWORD angle1 = (((DWORD)MulScale16 (frontxScale, ang) >> sky1shift) + frontpos) >> FRACBITS; - DWORD angle2 = (((DWORD)MulScale16 (backxScale, ang) >> sky2shift) + backpos) >> FRACBITS; + DWORD ang = (viewangle + xtoviewangle[x]) ^ skyflip; + DWORD angle1 = (DWORD)MulScale32((ang >> sky1shift) + frontpos, frontxScale); + DWORD angle2 = (DWORD)MulScale32((ang >> sky2shift) + backpos, backxScale); // Check if this column has already been built. If so, there's // no reason to waste time building it again. @@ -825,7 +824,6 @@ static void R_DrawSky (visplane_t *pl) dc_iscale = skyiscale >> skystretch; clearbuf (swall+pl->minx, pl->maxx-pl->minx+1, dc_iscale<<2); - rw_offset = frontpos; if (MirrorFlags & RF_XFLIP) { @@ -1328,6 +1326,11 @@ void R_DrawSkyPlane (visplane_t *pl) skyflip = l->args[2] ? 0u : ~0u; } } +// frontpos = FixedMul(frontpos, frontskytex->xScale/2); + if (backskytex != NULL) + { + backpos = FixedMul(backpos, backskytex->xScale); + } bool fakefixed = false; if (fixedcolormap) diff --git a/src/r_sky.cpp b/src/r_sky.cpp index 76e4d9d62..0ef9b259f 100644 --- a/src/r_sky.cpp +++ b/src/r_sky.cpp @@ -115,11 +115,9 @@ void R_InitSkyMap () } // The (standard Doom) sky map is 256*128*4 maps. - sky1shift = 22+skystretch-16; - sky2shift = 22+skystretch-16; - if (skytex1->WidthBits >= 9) - sky1shift -= skystretch; - if (skytex2->WidthBits >= 9) - sky2shift -= skystretch; + int swidth = skytex1->GetScaledWidth(); + sky1shift = 22 - 16 + (skystretch && swidth < 512) - (swidth >= 1024 && skytex1->xScale >= 4*FRACUNIT); + swidth = skytex2->GetScaledWidth(); + sky2shift = 22 - 16 + (skystretch && swidth < 512) - (swidth >= 1024 && skytex2->xScale >= 4*FRACUNIT); }