-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix SKYDEFS scroll speed #2135
fix SKYDEFS scroll speed #2135
Conversation
I tried this approach for interpolation but couldn't spot a difference between capped and uncapped rendering, probably because we are already at sub-pixel-per-second precision. What do you say @rfomin ? diff --git a/src/r_plane.c b/src/r_plane.c
index 914a8e71..068bd894 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"
@@ -415,7 +416,17 @@ static void DrawSkyTex(visplane_t *pl, skytex_t *skytex)
dc_texturemid += skytex->curry;
- angle_t an = viewangle + (skytex->currx << (ANGLETOSKYSHIFT - FRACBITS));
+ fixed_t deltax;
+ if (uncapped)
+ {
+ deltax = LerpFixed(skytex->prevx, skytex->currx);
+ }
+ else
+ {
+ deltax = 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 fc5a7148..908bbc04 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 0f20b3cf..c4d54810 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; |
Interpolation works, try to reduce the game speed to notice it. I'm using this test WAD: sky.zip Looks good! |
How about diff --git a/src/r_plane.c b/src/r_plane.c
index 068bd894..bc919251 100644
--- a/src/r_plane.c
+++ b/src/r_plane.c
@@ -414,18 +414,20 @@ 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;
- if (uncapped)
+ 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 + (deltax << (ANGLETOSKYSHIFT - FRACBITS));
for (int x = pl->minx; x <= pl->maxx; x++) |
Co-Authored-By: @rfomin
Fixes #2107