From 056abd0461a5523c5c177bf3bdd7a838407f69c1 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Sat, 21 Dec 2019 16:26:22 -0600 Subject: [PATCH] Add smooth rendering to Record/NiGHTS Attack, F_SkyScroll --- src/f_finale.c | 12 ++++++------ src/m_menu.c | 30 ++++++++++++++++-------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index b5715b863..2c45aecc9 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -62,8 +62,6 @@ static tic_t stoptimer; static boolean keypressed = false; // (no longer) De-Demo'd Title Screen -static tic_t xscrolltimer; -static tic_t yscrolltimer; static INT32 menuanimtimer; // Title screen: background animation timing mobj_t *titlemapcameraref = NULL; @@ -2320,6 +2318,7 @@ void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname) INT32 pw, ph; // scaled by dupz patch_t *pat; INT32 i, j; + fixed_t fracmenuanimtimer, xscrolltimer, yscrolltimer; if (rendermode == render_none) return; @@ -2346,12 +2345,13 @@ void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname) tilex = max(FixedCeil(FixedDiv(vid.width, pw)) >> FRACBITS, 1)+2; // one tile on both sides of center tiley = max(FixedCeil(FixedDiv(vid.height, ph)) >> FRACBITS, 1)+2; - xscrolltimer = ((menuanimtimer*scrollxspeed)/16 + patwidth*xneg) % (patwidth); - yscrolltimer = ((menuanimtimer*scrollyspeed)/16 + patheight*yneg) % (patheight); + fracmenuanimtimer = (menuanimtimer * FRACUNIT) - (FRACUNIT - rendertimefrac); + xscrolltimer = ((fracmenuanimtimer*scrollxspeed)/16 + patwidth*xneg*FRACUNIT) % (patwidth * FRACUNIT); + yscrolltimer = ((fracmenuanimtimer*scrollyspeed)/16 + patheight*yneg*FRACUNIT) % (patheight * FRACUNIT); // coordinate offsets - xscrolled = xscrolltimer * dupz; - yscrolled = yscrolltimer * dupz; + xscrolled = FixedInt(xscrolltimer * dupz); + yscrolled = FixedInt(yscrolltimer * dupz); for (x = (xispos) ? -pw*(tilex-1)+pw : 0, i = 0; i < tilex; diff --git a/src/m_menu.c b/src/m_menu.c index 246d3c79e..368e7778e 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -171,8 +171,8 @@ static INT32 vidm_nummodes; static INT32 vidm_column_size; // new menus -static tic_t recatkdrawtimer = 0; -static tic_t ntsatkdrawtimer = 0; +static fixed_t recatkdrawtimer = 0; +static fixed_t ntsatkdrawtimer = 0; static tic_t charseltimer = 0; static fixed_t char_scroll = 0; @@ -5810,7 +5810,7 @@ static void M_DrawRecordAttackForeground(void) for (i = -12; i < (BASEVIDHEIGHT/height) + 12; i++) { - INT32 y = ((i*height) - (height - ((recatkdrawtimer*2)%height))); + INT32 y = ((i*height) - (height - ((FixedInt(recatkdrawtimer*2))%height))); // don't draw above the screen { INT32 sy = FixedMul(y, dupz<> FRACBITS; @@ -5827,17 +5827,18 @@ static void M_DrawRecordAttackForeground(void) } // draw clock - fa = (FixedAngle(((recatkdrawtimer * 4) % 360)<>ANGLETOFINESHIFT) & FINEMASK; + fa = (FixedAngle(((FixedInt(recatkdrawtimer * 4)) % 360)<>ANGLETOFINESHIFT) & FINEMASK; V_DrawSciencePatch(160<width; @@ -5853,7 +5854,7 @@ static void M_DrawNightsAttackMountains(void) if (x < BASEVIDWIDTH) V_DrawScaledPatch(x, y, V_SNAPTOLEFT, background); - bgscrollx += (FRACUNIT/2); + bgscrollx += FixedMul(FRACUNIT/2, renderdeltatics); if (bgscrollx > w<>ANGLETOFINESHIFT) & FINEMASK; + INT32 timer = FixedInt(ntsatkdrawtimer/4) % 2; + angle_t fa = (FixedAngle((FixedInt(ntsatkdrawtimer * 4) % 360)<>ANGLETOFINESHIFT) & FINEMASK; V_DrawFixedPatch(235<