Add VHS pause/rewind effect

This commit is contained in:
fickleheart 2019-04-08 23:21:11 -05:00
parent 9a049f5a0d
commit ae473585b7
6 changed files with 75 additions and 1 deletions

View file

@ -571,6 +571,9 @@ static void D_Display(void)
if (demo.rewinding)
V_DrawFadeScreen(TC_RAINBOW, (leveltime & 0x20) ? SKINCOLOR_PASTEL : SKINCOLOR_MOONSLAM);
if (cv_vhseffect.value && (paused || (demo.playback && cv_playbackspeed.value > 1)))
V_DrawVhsEffect(demo.rewinding);
// vid size change is now finished if it was on...
vid.recalc = 0;
@ -628,6 +631,9 @@ static void D_Display(void)
V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-10, V_YELLOWMAP, s);
}
if (cv_shittyscreen.value)
V_DrawVhsEffect(cv_shittyscreen.value == 2);
I_FinishUpdate(); // page flip or blit buffer
}
}

View file

@ -932,6 +932,8 @@ void D_RegisterClientCommands(void)
// screen.c
CV_RegisterVar(&cv_fullscreen);
CV_RegisterVar(&cv_renderview);
CV_RegisterVar(&cv_vhseffect);
CV_RegisterVar(&cv_shittyscreen);
CV_RegisterVar(&cv_scr_depth);
CV_RegisterVar(&cv_scr_width);
CV_RegisterVar(&cv_scr_height);

View file

@ -59,6 +59,8 @@ INT32 setmodeneeded; //video mode change needed if > 0 (the mode number to set +
static CV_PossibleValue_t scr_depth_cons_t[] = {{8, "8 bits"}, {16, "16 bits"}, {24, "24 bits"}, {32, "32 bits"}, {0, NULL}};
static CV_PossibleValue_t shittyscreen_cons_t[] = {{0, "Okay"}, {1, "Shitty"}, {2, "Extra Shitty"}, {0, NULL}};
//added : 03-02-98: default screen mode, as loaded/saved in config
#ifdef WII
consvar_t cv_scr_width = {"scr_width", "640", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
@ -70,6 +72,8 @@ consvar_t cv_scr_height = {"scr_height", "800", CV_SAVE, CV_Unsigned, NULL, 0, N
consvar_t cv_scr_depth = {"scr_depth", "16 bits", CV_SAVE, scr_depth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
#endif
consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_vhseffect = {"vhspause", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_shittyscreen = {"televisionsignal", "Okay", CV_NOSHOWHELP, shittyscreen_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static void SCR_ChangeFullscreen (void);

View file

@ -158,7 +158,7 @@ extern INT32 setmodeneeded; // mode number to set if needed, or 0
extern INT32 scr_bpp;
extern UINT8 *scr_borderpatch; // patch used to fill the view borders
extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_fullscreen;
extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_fullscreen, cv_vhseffect, cv_shittyscreen;
// wait for page flipping to end or not
extern consvar_t cv_vidwait;

View file

@ -1214,6 +1214,65 @@ void V_DrawPatchFill(patch_t *pat)
}
}
void V_DrawVhsEffect(boolean rewind)
{
static fixed_t upbary = 100, downbary = 150;
UINT8 *buf = screens[0], *tmp = screens[4];
UINT16 x, y;
UINT32 pos = 0;
UINT8 *normalmapstart = ((UINT8 *)transtables + (8<<FF_TRANSSHIFT|(19<<8)));
//UINT8 *barmapstart = ((UINT8 *)transtables + (6<<FF_TRANSSHIFT|(25<<8)));
UINT8 *thismapstart;
UINT16 randommask;
INT8 offs;
UINT8 barsize = vid.dupy<<5;
UINT8 updistort = vid.dupx<<(rewind ? 5 : 3);
UINT8 downdistort = updistort>>1;
if (rewind)
V_DrawVhsEffect(false); // experimentation
upbary -= vid.dupy * (rewind ? 3 : 1.8f);
downbary += vid.dupy * (rewind ? 2 : 1);
if (upbary < -barsize) upbary = vid.height;
if (downbary > vid.height) downbary = -barsize;
for (y = 0; y < vid.height; y++)
{
randommask = 0x0700;
thismapstart = normalmapstart;
offs = 0;
if (y >= upbary && y < upbary+barsize)
{
//randommask = 0x0300;
thismapstart -= (2<<FF_TRANSSHIFT) - (5<<8);
offs += updistort * 2.0f * min(y-upbary, upbary+barsize-y) / barsize;
}
if (y >= downbary && y < downbary+barsize)
{
//randommask = 0x0300;
//thismapstart = barmapstart;
thismapstart -= (2<<FF_TRANSSHIFT) - (5<<8);
offs -= downdistort * 2.0f * min(y-downbary, downbary+barsize-y) / barsize;
}
offs += M_RandomKey(vid.dupx<<1);
// lazy way to avoid crashes
if (y == 0 && offs < 0) offs = 0;
else if (y == vid.height-1 && offs > 0) offs = 0;
for (x = 0; x < vid.rowbytes; x++, pos++)
tmp[pos] = thismapstart[/*(M_RandomFixed()&randommask)|*/buf[pos+offs]];
}
(void)randommask;
memcpy(buf, tmp, vid.rowbytes*vid.height);
}
//
// Fade all the screen buffer, so that the menu is more readable,
// especially now that we use the small hufont in the menus...

View file

@ -153,6 +153,9 @@ void V_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 c);
// fill a box with a flat as a pattern
void V_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatnum);
// draw wobbly VHS pause stuff
void V_DrawVhsEffect(boolean rewind);
// fade down the screen buffer before drawing the menu over
void V_DrawFadeScreen(UINT16 color, UINT8 strength);