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
This commit is contained in:
alufolie91 committed 2026-11-15 01:26:57 +01:00
1 parent cc952dfd52
commit 6b84c86197
1 file changed
+17 -14
+17 -14
View File
@@ -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)