Encore wiggle

This commit is contained in:
TehRealSalt 2019-08-10 01:59:23 -04:00
parent aad0dbd076
commit 5da84b78a2
5 changed files with 60 additions and 12 deletions

View file

@ -318,7 +318,7 @@ static void D_Display(void)
F_WipeStartScreen(); F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK, "FADEMAP0", false); F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK, "FADEMAP0", false, false);
} }
if (gamestate != GS_LEVEL && rendermode != render_none) if (gamestate != GS_LEVEL && rendermode != render_none)
@ -549,7 +549,7 @@ static void D_Display(void)
if (rendermode != render_none) if (rendermode != render_none)
{ {
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK, "FADEMAP0", true); F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK, "FADEMAP0", true, false);
} }
} }

View file

@ -220,7 +220,7 @@ void F_StartIntro(void)
F_WipeStartScreen(); F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_level_final], false, "FADEMAP0", false); F_RunWipe(wipedefs[wipe_level_final], false, "FADEMAP0", false, false);
} }
if (introtoplay) if (introtoplay)
@ -306,7 +306,7 @@ void F_IntroDrawer(void)
F_WipeStartScreen(); F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(99, true, "FADEMAP0", false); F_RunWipe(99, true, "FADEMAP0", false, false);
} }
// Stay on black for a bit. =) // Stay on black for a bit. =)
@ -1420,7 +1420,7 @@ void F_CutsceneDrawer(void)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, cutscenes[cutnum]->scene[scenenum].fadecolor); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, cutscenes[cutnum]->scene[scenenum].fadecolor);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(cutscenes[cutnum]->scene[scenenum].fadeinid, true, NULL, false); F_RunWipe(cutscenes[cutnum]->scene[scenenum].fadeinid, true, NULL, false, false);
F_WipeStartScreen(); F_WipeStartScreen();
} }
@ -1440,7 +1440,7 @@ void F_CutsceneDrawer(void)
if (dofadenow && rendermode != render_none) if (dofadenow && rendermode != render_none)
{ {
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(cutscenes[cutnum]->scene[scenenum].fadeoutid, true, NULL, false); F_RunWipe(cutscenes[cutnum]->scene[scenenum].fadeoutid, true, NULL, false, false);
} }
V_DrawString(textxpos, textypos, 0, cutscene_disptext); V_DrawString(textxpos, textypos, 0, cutscene_disptext);

View file

@ -74,7 +74,7 @@ extern INT32 lastwipetic;
void F_WipeStartScreen(void); void F_WipeStartScreen(void);
void F_WipeEndScreen(void); void F_WipeEndScreen(void);
void F_RunWipe(UINT8 wipetype, boolean drawMenu, const char *colormap, boolean reverse); void F_RunWipe(UINT8 wipetype, boolean drawMenu, const char *colormap, boolean reverse, boolean encorewiggle);
enum enum
{ {

View file

@ -356,10 +356,55 @@ void F_WipeEndScreen(void)
#endif #endif
} }
/** Wiggle post processor for encore wipes
*/
static void F_DoEncoreWiggle(UINT8 time)
{
UINT8 *tmpscr = wipe_scr_start;
UINT8 *srcscr = wipe_scr;
angle_t disStart = (time * 128) & FINEMASK;
INT32 y, sine, newpix, scanline;
for (y = 0; y < vid.height; y++)
{
sine = (FINESINE(disStart) * (time*12))>>FRACBITS;
scanline = y / vid.dupy;
if (scanline & 1)
sine = -sine;
newpix = abs(sine);
if (sine < 0)
{
M_Memcpy(&tmpscr[(y*vid.width)+newpix], &srcscr[(y*vid.width)], vid.width-newpix);
// Cleanup edge
while (newpix)
{
tmpscr[(y*vid.width)+newpix] = srcscr[(y*vid.width)];
newpix--;
}
}
else
{
M_Memcpy(&tmpscr[(y*vid.width)], &srcscr[(y*vid.width) + sine], vid.width-newpix);
// Cleanup edge
while (newpix)
{
tmpscr[(y*vid.width) + vid.width - newpix] = srcscr[(y*vid.width) + (vid.width-1)];
newpix--;
}
}
disStart += (time*8); //the offset into the displacement map, increment each game loop
disStart &= FINEMASK; //clip it to FINEMASK
}
}
/** After setting up the screens you want to wipe, /** After setting up the screens you want to wipe,
* calling this will do a 'typical' wipe. * calling this will do a 'typical' wipe.
*/ */
void F_RunWipe(UINT8 wipetype, boolean drawMenu, const char *colormap, boolean reverse) void F_RunWipe(UINT8 wipetype, boolean drawMenu, const char *colormap, boolean reverse, boolean encorewiggle)
{ {
#ifdef NOWIPE #ifdef NOWIPE
(void)wipetype; (void)wipetype;
@ -415,6 +460,9 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu, const char *colormap, boolean r
else else
#endif #endif
F_DoWipe(fmask, fcolor, reverse); F_DoWipe(fmask, fcolor, reverse);
if (encorewiggle)
F_DoEncoreWiggle(wipeframe);
I_OsPolling(); I_OsPolling();
I_UpdateNoBlit(); I_UpdateNoBlit();

View file

@ -2863,7 +2863,7 @@ boolean P_SetupLevel(boolean skipprecip)
V_EncoreInvertScreen(); V_EncoreInvertScreen();
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_encore_toinvert], false, NULL, false); F_RunWipe(wipedefs[wipe_encore_toinvert], false, NULL, false, false);
// Hold on invert for extra effect. // Hold on invert for extra effect.
// (This define might be useful for other areas of code? Not sure) // (This define might be useful for other areas of code? Not sure)
@ -2889,7 +2889,7 @@ boolean P_SetupLevel(boolean skipprecip)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_level_toblack], false, "FADEMAP1", false); F_RunWipe(99, false, "FADEMAP1", false, true); // wiggle the screen during this!
// THEN fade to a black screen. // THEN fade to a black screen.
F_WipeStartScreen(); F_WipeStartScreen();
@ -2897,7 +2897,7 @@ boolean P_SetupLevel(boolean skipprecip)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_level_toblack], false, "FADEMAP0", false); F_RunWipe(wipedefs[wipe_level_toblack], false, "FADEMAP0", false, false);
// Wait a bit longer. // Wait a bit longer.
WAIT((3*TICRATE)/4); WAIT((3*TICRATE)/4);
@ -2922,7 +2922,7 @@ boolean P_SetupLevel(boolean skipprecip)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_level_toblack], false, ((levelfadecol == 0) ? "FADEMAP1" : "FADEMAP0"), false); F_RunWipe(wipedefs[wipe_level_toblack], false, ((levelfadecol == 0) ? "FADEMAP1" : "FADEMAP0"), false, false);
} }
// Reset the palette now all fades have been done // Reset the palette now all fades have been done