From cc456aaeb527399713051aabdbd9c24f30e1eba7 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 15 Nov 2026 01:26:46 +0100 Subject: [PATCH] fix vhs effect bars when rewinding noticed while doing the shader thing basically the effect is supposed to stack but both calls being recursive, updated just the same bar positions, so both sets of bars would just draw over each other this basically just like, keeps seperate positions for when rewind it true this is probably how it was intended to work, otherwise that code makes not much sense --- src/v_video.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/v_video.c b/src/v_video.c index 83170403e..0511cd229 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -1839,8 +1839,11 @@ void V_DrawHorizontallyScaledFullScreenPatch(patch_t *patch) void V_DrawVhsEffect(boolean rewind) { fixed_t uby, dby; - // upbary is the bar going from top to bottom for some reason - static fixed_t upbary = 100*FRACUNIT, downbary = 150*FRACUNIT; + static fixed_t upbary_normal = 100*FRACUNIT, downbary_normal = 150*FRACUNIT; + static fixed_t upbary_rewind = 100*FRACUNIT, downbary_rewind = 150*FRACUNIT; + + fixed_t *upbary = rewind ? &upbary_rewind : &upbary_normal; + fixed_t *downbary = rewind ? &downbary_rewind : &downbary_normal; UINT8 barsize, updistort, downdistort; @@ -1864,20 +1867,20 @@ void V_DrawVhsEffect(boolean rewind) if (rewind) V_DrawVhsEffect(false); // experimentation - upbary -= renderdeltatics * (fixed_t)(vid.udup * (rewind ? 3 : 1.8f)); - downbary += renderdeltatics * (vid.udup * (rewind ? 2 : 1)); + *upbary -= renderdeltatics * (fixed_t)(vid.udup * (rewind ? 3 : 1.8f)); + *downbary += renderdeltatics * (vid.udup * (rewind ? 2 : 1)); - if (upbary < -barsize*FRACUNIT) - upbary = vid.height << FRACBITS; - if (upbary > vid.height << FRACBITS) - upbary = -barsize*FRACUNIT; - if (downbary > vid.height << FRACBITS) - downbary = -barsize*FRACUNIT; - if (downbary < -barsize*FRACUNIT) - downbary = vid.height << FRACBITS; + if (*upbary < -barsize*FRACUNIT) + *upbary = vid.height << FRACBITS; + if (*upbary > vid.height << FRACBITS) + *upbary = -barsize*FRACUNIT; + if (*downbary > vid.height << FRACBITS) + *downbary = -barsize*FRACUNIT; + if (*downbary < -barsize*FRACUNIT) + *downbary = vid.height << FRACBITS; - uby = upbary >> FRACBITS; - dby = downbary >> FRACBITS; + uby = *upbary >> FRACBITS; + dby = *downbary >> FRACBITS; #ifdef HWRENDER if (rendermode == render_opengl)