Skip to content

Commit 866f5d8

Browse files
fix SKYDEFS scroll speed (#2135)
* fix SKYDEFS scroll speed Fixes #2107 * add scrolling sky interpolation * add `scrolly` interpolation, check fo pause/menu Co-Authored-By: @rfomin
1 parent 18032f6 commit 866f5d8

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

src/r_plane.c

+15-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "doomstat.h"
4040
#include "doomtype.h"
4141
#include "i_system.h"
42+
#include "i_video.h"
4243
#include "m_fixed.h"
4344
#include "r_bmaps.h" // [crispy] R_BrightmapForTexName()
4445
#include "r_data.h"
@@ -413,9 +414,21 @@ static void DrawSkyTex(visplane_t *pl, skytex_t *skytex)
413414
dc_texheight = textureheight[texture] >> FRACBITS;
414415
dc_iscale = FixedMul(skyiscale, skytex->scaley);
415416

416-
dc_texturemid += skytex->curry;
417+
fixed_t deltax, deltay;
418+
if (uncapped && leveltime > oldleveltime)
419+
{
420+
deltax = LerpFixed(skytex->prevx, skytex->currx);
421+
deltay = LerpFixed(skytex->prevy, skytex->curry);
422+
}
423+
else
424+
{
425+
deltax = skytex->currx;
426+
deltay = skytex->curry;
427+
}
428+
429+
dc_texturemid += deltay;
417430

418-
angle_t an = viewangle + FixedToAngle(skytex->currx);
431+
angle_t an = viewangle + (deltax << (ANGLETOSKYSHIFT - FRACBITS));
419432

420433
for (int x = pl->minx; x <= pl->maxx; x++)
421434
{

src/r_sky.c

+4
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,16 @@ void R_UpdateSky(void)
176176
}
177177

178178
skytex_t *background = &sky->skytex;
179+
background->prevx = background->currx;
180+
background->prevy = background->curry;
179181
background->currx += background->scrollx;
180182
background->curry += background->scrolly;
181183

182184
if (sky->type == SkyType_WithForeground)
183185
{
184186
skytex_t *foreground = &sky->foreground;
187+
foreground->prevx = foreground->currx;
188+
foreground->prevy = foreground->curry;
185189
foreground->currx += foreground->scrollx;
186190
foreground->curry += foreground->scrolly;
187191
}

src/r_skydefs.h

+2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ typedef struct
3737
double mid;
3838
fixed_t scrollx;
3939
fixed_t currx;
40+
fixed_t prevx;
4041
fixed_t scrolly;
4142
fixed_t curry;
43+
fixed_t prevy;
4244
fixed_t scalex;
4345
fixed_t scaley;
4446
} skytex_t;

0 commit comments

Comments
 (0)