ACTUALLY let's do this better

This commit is contained in:
toasterbabe 2017-05-14 19:25:46 +01:00
parent b13a9ad9d1
commit 65a202e843

View file

@ -224,18 +224,19 @@ static void F_SkyScroll(INT32 scrollspeed)
{ {
INT32 scrolled, x, mx, fakedwidth; INT32 scrolled, x, mx, fakedwidth;
patch_t *pat; patch_t *pat;
INT16 patwidth;
pat = W_CachePatchName("TITLESKY", PU_CACHE); pat = W_CachePatchName("TITLESKY", PU_CACHE);
fakedwidth = SHORT(pat->width); patwidth = SHORT(pat->width);
animtimer = ((finalecount*scrollspeed)/16 + fakedwidth) % fakedwidth; animtimer = ((finalecount*scrollspeed)/16 + patwidth) % patwidth;
fakedwidth = vid.width / vid.dupx; fakedwidth = vid.width / vid.dupx;
if (rendermode == render_soft) if (rendermode == render_soft)
{ // if only hardware rendering could be this elegant and complete { // if only hardware rendering could be this elegant and complete
scrolled = (SHORT(pat->width) - animtimer) - 1; scrolled = (patwidth - animtimer) - 1;
for (x = 0, mx = scrolled; x < fakedwidth; x++, mx = (mx+1)%SHORT(pat->width)) for (x = 0, mx = scrolled; x < fakedwidth; x++, mx = (mx+1)%patwidth)
F_DrawPatchCol(x, pat, mx); F_DrawPatchCol(x, pat, mx);
} }
#ifdef HWRENDER #ifdef HWRENDER
@ -243,8 +244,8 @@ static void F_SkyScroll(INT32 scrollspeed)
{ // if only software rendering could be this simple and retarded { // if only software rendering could be this simple and retarded
scrolled = animtimer; scrolled = animtimer;
if (scrolled > 0) if (scrolled > 0)
V_DrawScaledPatch(scrolled - SHORT(pat->width), 0, 0, pat); V_DrawScaledPatch(scrolled - patwidth, 0, 0, pat);
for (x = 0; x < fakedwidth; x += SHORT(pat->width)) for (x = 0; x < fakedwidth; x += patwidth)
V_DrawScaledPatch(x + scrolled, 0, 0, pat); V_DrawScaledPatch(x + scrolled, 0, 0, pat);
} }
#endif #endif