diff --git a/src/r_plane.c b/src/r_plane.c index 1f550aa9f..bc9192512 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -39,6 +39,7 @@ #include "doomstat.h" #include "doomtype.h" #include "i_system.h" +#include "i_video.h" #include "m_fixed.h" #include "r_bmaps.h" // [crispy] R_BrightmapForTexName() #include "r_data.h" @@ -413,9 +414,21 @@ static void DrawSkyTex(visplane_t *pl, skytex_t *skytex) dc_texheight = textureheight[texture] >> FRACBITS; dc_iscale = FixedMul(skyiscale, skytex->scaley); - dc_texturemid += skytex->curry; + fixed_t deltax, deltay; + if (uncapped && leveltime > oldleveltime) + { + deltax = LerpFixed(skytex->prevx, skytex->currx); + deltay = LerpFixed(skytex->prevy, skytex->curry); + } + else + { + deltax = skytex->currx; + deltay = skytex->curry; + } + + dc_texturemid += deltay; - angle_t an = viewangle + FixedToAngle(skytex->currx); + angle_t an = viewangle + (deltax << (ANGLETOSKYSHIFT - FRACBITS)); for (int x = pl->minx; x <= pl->maxx; x++) { diff --git a/src/r_sky.c b/src/r_sky.c index fc5a71480..908bbc04b 100644 --- a/src/r_sky.c +++ b/src/r_sky.c @@ -176,12 +176,16 @@ void R_UpdateSky(void) } skytex_t *background = &sky->skytex; + background->prevx = background->currx; + background->prevy = background->curry; background->currx += background->scrollx; background->curry += background->scrolly; if (sky->type == SkyType_WithForeground) { skytex_t *foreground = &sky->foreground; + foreground->prevx = foreground->currx; + foreground->prevy = foreground->curry; foreground->currx += foreground->scrollx; foreground->curry += foreground->scrolly; } diff --git a/src/r_skydefs.h b/src/r_skydefs.h index 0f20b3cff..c4d548108 100644 --- a/src/r_skydefs.h +++ b/src/r_skydefs.h @@ -37,8 +37,10 @@ typedef struct double mid; fixed_t scrollx; fixed_t currx; + fixed_t prevx; fixed_t scrolly; fixed_t curry; + fixed_t prevy; fixed_t scalex; fixed_t scaley; } skytex_t;