diff --git a/src/d_main.c b/src/d_main.c index 475aa6531..e48b26ba8 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -277,7 +277,7 @@ static void D_Display(void) && wipetypepre != UINT8_MAX) { F_WipeStartScreen(); - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); + F_WipeColorFill(31); F_WipeEndScreen(); F_RunWipe(wipetypepre, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN); } @@ -420,6 +420,12 @@ static void D_Display(void) if (gamestate != GS_TIMEATTACK) CON_Drawer(); +#ifdef LEVELWIPES + // Running a level wipe + if (WipeInAction && WipeInLevel) + F_WipeTicker(); +#endif + M_Drawer(); // menu is drawn even on top of everything // focus lost moved to M_Drawer @@ -439,6 +445,7 @@ static void D_Display(void) { F_WipeEndScreen(); // Funny. +#ifndef LEVELWIPES if (WipeStageTitle && st_overlay) { lt_ticker--; @@ -447,6 +454,7 @@ static void D_Display(void) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol); F_WipeStartScreen(); } +#endif F_RunWipe(wipetypepost, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN); } diff --git a/src/doomdef.h b/src/doomdef.h index 511dad858..8cf9e5d09 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -628,6 +628,9 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; #define ROTANGLES 24 // Needs to be a divisor of 360 (45, 60, 90, 120...) #define ROTANGDIFF (360 / ROTANGLES) +/// Level wipes +//#define LEVELWIPES + #ifndef HAVE_PNG #define NO_PNG_LUMPS #endif diff --git a/src/f_finale.c b/src/f_finale.c index 0f1140061..e3809ea25 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -856,7 +856,7 @@ void F_IntroDrawer(void) if (rendermode != render_none) { F_WipeStartScreen(); - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); + F_WipeColorFill(31); F_WipeEndScreen(); F_RunWipe(99,true); } @@ -866,10 +866,11 @@ void F_IntroDrawer(void) else if (intro_scenenum == 10) { // The only fade to white in the entire damn game. + // (not true) if (rendermode != render_none) { F_WipeStartScreen(); - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0); + F_WipeColorFill(0); F_WipeEndScreen(); F_RunWipe(99,true); } @@ -879,7 +880,7 @@ void F_IntroDrawer(void) if (rendermode != render_none) { F_WipeStartScreen(); - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); + F_WipeColorFill(31); F_WipeEndScreen(); F_RunWipe(99,true); } @@ -926,7 +927,7 @@ void F_IntroDrawer(void) patch_t *radar = W_CachePatchName("RADAR", PU_CACHE); F_WipeStartScreen(); - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); + F_WipeColorFill(31); V_DrawScaledPatch(0, 0, 0, radar); W_UnlockCachedPatch(radar); V_DrawString(8, 128, V_ALLOWLOWERCASE, cutscene_disptext); @@ -939,7 +940,7 @@ void F_IntroDrawer(void) patch_t *grass = W_CachePatchName("SGRASS5", PU_CACHE); F_WipeStartScreen(); - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); + F_WipeColorFill(31); V_DrawScaledPatch(0, 0, 0, grass); W_UnlockCachedPatch(grass); V_DrawString(8, 128, V_ALLOWLOWERCASE, cutscene_disptext); @@ -952,7 +953,7 @@ void F_IntroDrawer(void) patch_t *confront = W_CachePatchName("CONFRONT", PU_CACHE); F_WipeStartScreen(); - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); + F_WipeColorFill(31); V_DrawSmallScaledPatch(0, 0, 0, confront); W_UnlockCachedPatch(confront); V_DrawString(8, 128, V_ALLOWLOWERCASE, cutscene_disptext); @@ -965,7 +966,7 @@ void F_IntroDrawer(void) patch_t *sdo = W_CachePatchName("SONICDO2", PU_CACHE); F_WipeStartScreen(); - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); + F_WipeColorFill(31); V_DrawSmallScaledPatch(0, 0, 0, sdo); W_UnlockCachedPatch(sdo); V_DrawString(224, 8, V_ALLOWLOWERCASE, cutscene_disptext); diff --git a/src/f_finale.h b/src/f_finale.h index a2a96f2de..82a7e1408 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -141,7 +141,32 @@ void F_MenuPresTicker(boolean run); #define FORCEWIPEOFF -2 extern boolean WipeInAction; +extern boolean WipeInLevel; extern boolean WipeStageTitle; + +typedef enum +{ + WIPESTYLE_NORMAL, + WIPESTYLE_LEVEL +} wipestyle_t; +extern wipestyle_t wipestyle; + +typedef enum +{ + WSF_FADEOUT = 1, + WSF_FADEIN = 1<<1, + WSF_TOWHITE = 1<<2, +} wipestyleflags_t; +extern wipestyleflags_t wipestyleflags; + +#define FADECOLORMAPDIV 8 +#define FADECOLORMAPROWS (256/FADECOLORMAPDIV) + +#define FADEREDFACTOR 15 +#define FADEGREENFACTOR 15 +#define FADEBLUEFACTOR 10 + +extern UINT8 wipecolorfill; extern INT32 lastwipetic; // Don't know where else to place this constant @@ -151,6 +176,9 @@ extern INT32 lastwipetic; void F_WipeStartScreen(void); void F_WipeEndScreen(void); void F_RunWipe(UINT8 wipetype, boolean drawMenu); +void F_WipeTicker(void); +void F_WipeStageTitle(void); +#define F_WipeColorFill(c) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (wipecolorfill = c)) tic_t F_GetWipeLength(UINT8 wipetype); boolean F_WipeExists(UINT8 wipetype); diff --git a/src/f_wipe.c b/src/f_wipe.c index d3786c69f..17ffbe0c4 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -18,6 +18,7 @@ #include "r_draw.h" // transtable #include "p_pspr.h" // tr_transxxx +#include "p_local.h" #include "st_stuff.h" #include "w_wad.h" #include "z_zone.h" @@ -26,16 +27,19 @@ #include "m_menu.h" #include "console.h" #include "d_main.h" +#include "g_game.h" #include "m_misc.h" // movie mode +#include "doomstat.h" + +#ifdef HAVE_BLUA +#include "lua_hud.h" // level title +#endif + #ifdef HWRENDER #include "hardware/hw_main.h" #endif -#ifdef HAVE_BLUA -#include "lua_hud.h" -#endif - #if NUMSCREENS < 5 #define NOWIPE // do not enable wipe image post processing for ARM, SH and MIPS CPUs #endif @@ -87,15 +91,23 @@ UINT8 wipedefs[NUMWIPEDEFS] = { //-------------------------------------------------------------------------- boolean WipeInAction = false; +boolean WipeInLevel = false; boolean WipeStageTitle = false; INT32 lastwipetic = 0; +wipestyle_t wipestyle = WIPESTYLE_NORMAL; +wipestyleflags_t wipestyleflags = 0; + #ifndef NOWIPE static UINT8 *wipe_scr_start; //screen 3 static UINT8 *wipe_scr_end; //screen 4 static UINT8 *wipe_scr; //screen 0 (main drawing) static fixed_t paldiv = 0; +static UINT8 curwipetype; +static UINT8 curwipeframe; +UINT8 wipecolorfill = 31; + /** Create fademask_t from lump * * \param lump Lump name to get data from @@ -154,7 +166,10 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) { { // Determine pixel to use from fademask pcolor = &pMasterPalette[*lump++]; - *mask++ = FixedDiv((pcolor->s.red+1)<>FRACBITS; + if (wipestyle == WIPESTYLE_LEVEL) + *mask++ = pcolor->s.red / FADECOLORMAPDIV; + else + *mask++ = FixedDiv((pcolor->s.red+1)<>FRACBITS; } fm.xscale = FixedDiv(vid.width<levelflags & LF_NOTITLECARD) + && *mapheaderinfo[gamemap-1]->lvlttl != '\0') + { + ST_runTitleCard(); + ST_drawWipeTitleCard(); + } +} + /** Wipe ticker * * \param fademask pixels to change @@ -257,7 +287,7 @@ static void F_DoWipe(fademask_t *fademask) relativepos += vid.width; } } - else if (*mask == 10) + else if (*mask >= ((wipestyle == WIPESTYLE_LEVEL) ? FADECOLORMAPROWS : 10)) { // shortcut - memcpy target to work while (draw_linestogo--) @@ -268,8 +298,25 @@ static void F_DoWipe(fademask_t *fademask) } else { - // pointer to transtable that this mask would use - transtbl = transtables + ((9 - *mask)<levelflags & LF_NOTITLECARD) - && *mapheaderinfo[gamemap-1]->lvlttl != '\0') - { - ST_runTitleCard(); - ST_drawWipeTitleCard(); - } + F_DoWipe(fmask); I_OsPolling(); I_UpdateNoBlit(); @@ -395,6 +463,47 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu) } WipeInAction = false; + WipeInLevel = false; + WipeStageTitle = false; +#endif +} + +/** Run and display the fade with the level. + */ +void F_WipeTicker(void) +{ +#ifndef NOWIPE +#ifndef LEVELWIPES + WipeInAction = false; +#else + fademask_t *fmask; + + // Wait, what? + if (!WipeInAction) + return; + + if (rendermode == render_soft) + wipe_scr_start = wipe_scr_end = screens[0]; + + // get fademask first so we can tell if it exists or not + fmask = F_GetFadeMask(curwipetype, curwipeframe++); + if (!fmask) + { + // stop + WipeInAction = false; + WipeInLevel = false; + WipeStageTitle = false; + return; + } + +#ifdef HWRENDER + // send in the wipe type and wipe frame because we need to cache the graphic + if (rendermode == render_opengl) + HWR_DoLevelWipe(curwipetype, curwipeframe-1, wipecolorfill); // also send the wipe color + else +#endif + F_DoWipe(fmask); +#endif WipeStageTitle = false; #endif } @@ -426,6 +535,8 @@ tic_t F_GetWipeLength(UINT8 wipetype) #endif } +/** Does the specified wipe exist? + */ boolean F_WipeExists(UINT8 wipetype) { #ifdef NOWIPE diff --git a/src/g_game.c b/src/g_game.c index a0d8d5954..5e1645901 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1728,6 +1728,9 @@ void G_StartTitleCard(void) // start the title card WipeStageTitle = (!titlemapinaction); + WipeInLevel = true; + wipestyleflags |= WSF_FADEIN; + wipestyleflags &= ~WSF_FADEOUT; } // diff --git a/src/hardware/hw_drv.h b/src/hardware/hw_drv.h index aed1611f1..1e40a403d 100644 --- a/src/hardware/hw_drv.h +++ b/src/hardware/hw_drv.h @@ -71,6 +71,7 @@ EXPORT void HWRAPI(FlushScreenTextures) (void); EXPORT void HWRAPI(StartScreenWipe) (void); EXPORT void HWRAPI(EndScreenWipe) (void); EXPORT void HWRAPI(DoScreenWipe) (void); +EXPORT void HWRAPI(DoScreenWipeLevel) (void); EXPORT void HWRAPI(DrawIntermissionBG) (void); EXPORT void HWRAPI(MakeScreenTexture) (void); EXPORT void HWRAPI(MakeScreenFinalTexture) (void); @@ -112,6 +113,7 @@ struct hwdriver_s StartScreenWipe pfnStartScreenWipe; EndScreenWipe pfnEndScreenWipe; DoScreenWipe pfnDoScreenWipe; + DoScreenWipeLevel pfnDoScreenWipeLevel; DrawIntermissionBG pfnDrawIntermissionBG; MakeScreenTexture pfnMakeScreenTexture; MakeScreenFinalTexture pfnMakeScreenFinalTexture; diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index ea82d919b..263344ebe 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -40,6 +40,7 @@ #include "../st_stuff.h" #include "../i_system.h" #include "../m_cheat.h" +#include "../f_finale.h" #ifdef ESLOPE #include "../p_slopes.h" #endif @@ -111,7 +112,6 @@ static consvar_t cv_grclipwalls = {"gr_clipwalls", "Off", 0, CV_OnOff, NULL, 0, static consvar_t cv_gralpha = {"gr_alpha", "160", 0, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cv_grbeta = {"gr_beta", "0", 0, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; -static float HWRWipeCounter = 1.0f; consvar_t cv_grrounddown = {"gr_rounddown", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grfov = {"gr_fov", "90", CV_FLOAT|CV_CALL, grfov_cons_t, CV_grFov_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grfogdensity = {"gr_fogdensity", "150", CV_CALL|CV_NOINIT, CV_Unsigned, @@ -7025,7 +7025,6 @@ void HWR_StartScreenWipe(void) void HWR_EndScreenWipe(void) { - HWRWipeCounter = 0.0f; //CONS_Debug(DBG_RENDER, "In HWR_EndScreenWipe()\n"); HWD.pfnEndScreenWipe(); } @@ -7035,38 +7034,75 @@ void HWR_DrawIntermissionBG(void) HWD.pfnDrawIntermissionBG(); } -void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum) +// +// hwr mode wipes +// +static lumpnum_t wipelumpnum; + +// puts wipe lumpname in wipename[9] +static boolean HWR_WipeCheck(UINT8 wipenum, UINT8 scrnnum) { static char lumpname[9] = "FADEmmss"; - lumpnum_t lumpnum; size_t lsize; - if (wipenum > 99 || scrnnum > 99) // not a valid wipe number - return; // shouldn't end up here really, the loop should've stopped running beforehand + // not a valid wipe number + if (wipenum > 99 || scrnnum > 99) + return false; // shouldn't end up here really, the loop should've stopped running beforehand - // puts the numbers into the lumpname - sprintf(&lumpname[4], "%.2hu%.2hu", (UINT16)wipenum, (UINT16)scrnnum); - lumpnum = W_CheckNumForName(lumpname); + // puts the numbers into the wipename + lumpname[4] = '0'+(wipenum/10); + lumpname[5] = '0'+(wipenum%10); + lumpname[6] = '0'+(scrnnum/10); + lumpname[7] = '0'+(scrnnum%10); + wipelumpnum = W_CheckNumForName(lumpname); - if (lumpnum == LUMPERROR) // again, shouldn't be here really - return; - - lsize = W_LumpLength(lumpnum); + // again, shouldn't be here really + if (wipelumpnum == LUMPERROR) + return false; + lsize = W_LumpLength(wipelumpnum); if (!(lsize == 256000 || lsize == 64000 || lsize == 16000 || lsize == 4000)) { CONS_Alert(CONS_WARNING, "Fade mask lump %s of incorrect size, ignored\n", lumpname); - return; // again, shouldn't get here if it is a bad size + return false; // again, shouldn't get here if it is a bad size } - HWR_GetFadeMask(lumpnum); + return true; +} +void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum) +{ + if (!HWR_WipeCheck(wipenum, scrnnum)) + return; + + HWR_GetFadeMask(wipelumpnum); HWD.pfnDoScreenWipe(); +} - HWRWipeCounter += 0.05f; // increase opacity of end screen +void HWR_DoTintedWipe(UINT8 wipenum, UINT8 scrnnum) +{ + // It does the same thing + HWR_DoWipe(wipenum, scrnnum); +} - if (HWRWipeCounter > 1.0f) - HWRWipeCounter = 1.0f; +void HWR_DoLevelWipe(UINT8 wipenum, UINT8 scrnnum, UINT8 colfill) +{ +#ifndef LEVELWIPES + (void)wipenum; + (void)scrnnum; + (void)colfill; +#else + if (!HWR_WipeCheck(wipenum, scrnnum)) + return; + + HWR_EndScreenWipe(); + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, colfill); + HWR_StartScreenWipe(); + HWR_GetFadeMask(wipelumpnum); + + HWD.pfnDoScreenWipeLevel(); + F_WipeStageTitle(); +#endif } void HWR_MakeScreenFinalTexture(void) diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index fa230289f..fb726f2f9 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -66,6 +66,8 @@ void HWR_StartScreenWipe(void); void HWR_EndScreenWipe(void); void HWR_DrawIntermissionBG(void); void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum); +void HWR_DoTintedWipe(UINT8 wipenum, UINT8 scrnnum); +void HWR_DoLevelWipe(UINT8 wipenum, UINT8 scrnnum, UINT8 wipecolorfill); void HWR_MakeScreenFinalTexture(void); void HWR_DrawScreenFinalTexture(int width, int height); diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index d208580a9..323772cb0 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -2587,6 +2587,10 @@ EXPORT void HWRAPI(DoScreenWipe)(void) tex_downloaded = endScreenWipe; } +EXPORT void HWRAPI(DoScreenWipeLevel)(void) +{ + DoScreenWipe(); +} // Create a texture from the screen. EXPORT void HWRAPI(MakeScreenTexture) (void) diff --git a/src/m_menu.c b/src/m_menu.c index 04bbdba2c..7a5aa8ae6 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3364,13 +3364,17 @@ boolean M_Responder(event_t *ev) // void M_Drawer(void) { + boolean wipe = WipeInAction; + if (WipeInLevel) + wipe = false; + if (currentMenu == &MessageDef) menuactive = true; if (menuactive) { // now that's more readable with a faded background (yeah like Quake...) - if (!WipeInAction && (curfadevalue || (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK))) + if (!wipe && (curfadevalue || (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK))) V_DrawFadeScreen(0xFF00, (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK) ? 16 : curfadevalue); if (currentMenu->drawroutine) diff --git a/src/p_setup.c b/src/p_setup.c index 34a7c1437..bc0829670 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2704,6 +2704,7 @@ boolean P_SetupLevel(boolean skipprecip) // Cancel all d_main.c fadeouts (keep fade in though). wipegamestate = FORCEWIPEOFF; + wipestyleflags = 0; // Special stage fade to white // This is handled BEFORE sounds are stopped. @@ -2724,11 +2725,22 @@ boolean P_SetupLevel(boolean skipprecip) S_FadeOutStopMusic(MUSICRATE/4); //FixedMul(FixedDiv(F_GetWipeLength(wipedefs[wipe_speclevel_towhite])*NEWTICRATERATIO, NEWTICRATE), MUSICRATE) F_WipeStartScreen(); - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0); + wipestyleflags |= WSF_FADEOUT|WSF_TOWHITE; + +#ifdef HWRENDER + // uh.......... + if (rendermode == render_opengl) + F_WipeColorFill(0); +#endif F_WipeEndScreen(); F_RunWipe(wipedefs[wipe_speclevel_towhite], false); + I_OsPolling(); + I_FinishUpdate(); // page flip or blit buffer + if (moviemode) + M_SaveFrame(); + nowtime = lastwipetic; // Hold on white for extra effect. @@ -2762,7 +2774,13 @@ boolean P_SetupLevel(boolean skipprecip) if (rendermode != render_none && !ranspecialwipe) { F_WipeStartScreen(); - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); + wipestyleflags |= WSF_FADEOUT; + +#ifdef HWRENDER + // uh.......... + if (rendermode == render_opengl) + F_WipeColorFill(31); +#endif F_WipeEndScreen(); // for titlemap: run a specific wipe if specified @@ -3177,7 +3195,7 @@ boolean P_SetupLevel(boolean skipprecip) // Remove the loading shit from the screen if (rendermode != render_none && !titlemapinaction) - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol); + F_WipeColorFill(levelfadecol); if (precache || dedicated) R_PrecacheLevel(); diff --git a/src/r_data.c b/src/r_data.c index d9d8a8f30..574c4e194 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -24,6 +24,7 @@ #include "z_zone.h" #include "p_setup.h" // levelflats #include "v_video.h" // pMasterPalette +#include "f_finale.h" // wipes #include "byteptr.h" #include "dehacked.h" @@ -113,6 +114,7 @@ INT32 *texturetranslation; sprcache_t *spritecachedinfo; lighttable_t *colormaps; +lighttable_t *fadecolormap; // for debugging/info purposes size_t flatmemory, spritememory, texturememory; @@ -1455,18 +1457,111 @@ static void R_InitSpriteLumps(void) Z_Malloc(max_spritelumps*sizeof(*spritecachedinfo), PU_STATIC, &spritecachedinfo); } +// +// R_CreateFadeColormaps +// + +static void R_CreateFadeColormaps(void) +{ + UINT8 px, fade; + RGBA_t rgba; + INT32 r, g, b; + size_t len, i; + + len = (256 * FADECOLORMAPROWS); + fadecolormap = Z_MallocAlign(len*2, PU_STATIC, NULL, 8); + for (i = 0; i < len*2; i++) + fadecolormap[i] = (i%256); + + // Load in the light tables, now 64k aligned for smokie... + { + lumpnum_t lump = W_CheckNumForName("FADECMAP"); + lumpnum_t wlump = W_CheckNumForName("FADEWMAP"); + + // to black + if (lump != LUMPERROR) + W_ReadLumpHeader(lump, fadecolormap, len, 0U); + // to white + if (wlump != LUMPERROR) + W_ReadLumpHeader(wlump, fadecolormap+len, len, 0U); + + // missing "to white" colormap lump + if (lump != LUMPERROR && wlump == LUMPERROR) + goto makewhite; + // missing "to black" colormap lump + else if (lump == LUMPERROR && wlump != LUMPERROR) + goto makeblack; + // both lumps found + else if (lump != LUMPERROR && wlump != LUMPERROR) + return; + } + +#define GETCOLOR \ + px = colormaps[i%256]; \ + fade = (i/256) * (256 / FADECOLORMAPROWS); \ + rgba = V_GetColor(px); + + // to black + makeblack: + for (i = 0; i < len; i++) + { + // find pixel and fade amount + GETCOLOR; + + // subtractive color blending + r = rgba.s.red - FADEREDFACTOR*fade/10; + g = rgba.s.green - FADEGREENFACTOR*fade/10; + b = rgba.s.blue - FADEBLUEFACTOR*fade/10; + + // clamp values + if (r < 0) r = 0; + if (g < 0) g = 0; + if (b < 0) b = 0; + + // find nearest color in palette + fadecolormap[i] = NearestColor(r,g,b); + } + + // to white + makewhite: + for (i = len; i < len*2; i++) + { + // find pixel and fade amount + GETCOLOR; + + // additive color blending + r = rgba.s.red + FADEREDFACTOR*fade/10; + g = rgba.s.green + FADEGREENFACTOR*fade/10; + b = rgba.s.blue + FADEBLUEFACTOR*fade/10; + + // clamp values + if (r > 255) r = 255; + if (g > 255) g = 255; + if (b > 255) b = 255; + + // find nearest color in palette + fadecolormap[i] = NearestColor(r,g,b); + } +#undef GETCOLOR +} + // // R_InitColormaps // static void R_InitColormaps(void) { + size_t len; lumpnum_t lump; // Load in the light tables lump = W_GetNumForName("COLORMAP"); - colormaps = Z_MallocAlign(W_LumpLength (lump), PU_STATIC, NULL, 8); + len = W_LumpLength(lump); + colormaps = Z_MallocAlign(len, PU_STATIC, NULL, 8); W_ReadLump(lump, colormaps); + // Make colormap for fades + R_CreateFadeColormaps(); + // Init Boom colormaps. R_ClearColormaps(); #ifdef EXTRACOLORMAPLUMPS @@ -1495,6 +1590,9 @@ void R_ReInitColormaps(UINT16 num) } W_ReadLumpHeader(lump, colormaps, W_LumpLength(basecolormaplump), 0U); + if (fadecolormap) + Z_Free(fadecolormap); + R_CreateFadeColormaps(); // Init Boom colormaps. R_ClearColormaps(); diff --git a/src/r_state.h b/src/r_state.h index da9425bdf..977384926 100644 --- a/src/r_state.h +++ b/src/r_state.h @@ -38,6 +38,7 @@ typedef struct extern sprcache_t *spritecachedinfo; extern lighttable_t *colormaps; +extern lighttable_t *fadecolormap; // Boom colormaps. extern extracolormap_t *extra_colormaps; diff --git a/src/sdl/hwsym_sdl.c b/src/sdl/hwsym_sdl.c index 5f040023a..82a430ee6 100644 --- a/src/sdl/hwsym_sdl.c +++ b/src/sdl/hwsym_sdl.c @@ -97,6 +97,7 @@ void *hwSym(const char *funcName,void *handle) GETFUNC(StartScreenWipe); GETFUNC(EndScreenWipe); GETFUNC(DoScreenWipe); + GETFUNC(DoScreenWipeLevel); GETFUNC(DrawIntermissionBG); GETFUNC(MakeScreenTexture); GETFUNC(MakeScreenFinalTexture); diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index f22c79eca..5f162b00d 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1666,6 +1666,7 @@ void I_StartupGraphics(void) HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL); HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL); HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL); + HWD.pfnDoScreenWipeLevel= hwSym("DoScreenWipeLevel",NULL); HWD.pfnDrawIntermissionBG=hwSym("DrawIntermissionBG",NULL); HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL); HWD.pfnMakeScreenFinalTexture=hwSym("MakeScreenFinalTexture",NULL); diff --git a/src/st_stuff.c b/src/st_stuff.c index a4c5246cb..4e8afa16a 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1202,7 +1202,7 @@ void ST_startTitleCard(void) // initialize HUD variables lt_ticker = lt_exitticker = lt_lasttic = 0; - lt_endtime = 2*TICRATE; + lt_endtime = 2*TICRATE + (10*NEWTICRATERATIO); lt_scroll = BASEVIDWIDTH * FRACUNIT; lt_zigzag = -((lt_patches[1])->width * FRACUNIT); lt_mom = 0; @@ -1294,8 +1294,10 @@ void ST_drawTitleCard(void) return; #endif +#ifndef LEVELWIPES if ((lt_ticker-lt_lasttic) > 1) lt_ticker = lt_lasttic+1; +#endif ST_cacheLevelTitle(); actpat = lt_patches[0]; @@ -1349,7 +1351,9 @@ luahook: void ST_preLevelTitleCardDrawer(tic_t ticker, boolean update) { V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol); +#ifndef LEVELWIPES if (ticker < PRELEVELTIME-1) +#endif ST_drawWipeTitleCard(); I_OsPolling(); diff --git a/src/win32/win_dll.c b/src/win32/win_dll.c index 5378bb52f..1311b6870 100644 --- a/src/win32/win_dll.c +++ b/src/win32/win_dll.c @@ -121,6 +121,7 @@ static loadfunc_t hwdFuncTable[] = { {"StartScreenWipe@0", &hwdriver.pfnStartScreenWipe}, {"EndScreenWipe@0", &hwdriver.pfnEndScreenWipe}, {"DoScreenWipe@4", &hwdriver.pfnDoScreenWipe}, + {"DoScreenWipeLevel@0", &hwdriver.pfnDoScreenWipeLevel}, {"DrawIntermissionBG@0",&hwdriver.pfnDrawIntermissionBG}, {"MakeScreenTexture@0", &hwdriver.pfnMakeScreenTexture}, {"MakeScreenFinalTexture@0", &hwdriver.pfnMakeScreenFinalTexture}, @@ -152,6 +153,7 @@ static loadfunc_t hwdFuncTable[] = { {"StartScreenWipe", &hwdriver.pfnStartScreenWipe}, {"EndScreenWipe", &hwdriver.pfnEndScreenWipe}, {"DoScreenWipe", &hwdriver.pfnDoScreenWipe}, + {"DoScreenWipeLevel", &hwdriver.pfnDoScreenWipeLevel}, {"DrawIntermissionBG", &hwdriver.pfnDrawIntermissionBG}, {"MakeScreenTexture", &hwdriver.pfnMakeScreenTexture}, {"MakeScreenFinalTexture", &hwdriver.pfnMakeScreenFinalTexture},