From f0788598c998bdd2b0e6c358718ff26a0b439c78 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Mon, 9 Sep 2019 23:31:48 -0300 Subject: [PATCH 01/14] Better fades --- src/d_main.c | 4 + src/f_finale.h | 17 ++++ src/f_wipe.c | 150 +++++++++++++++++++++++++++++-- src/hardware/hw_drv.h | 2 + src/hardware/hw_main.c | 5 ++ src/hardware/hw_main.h | 1 + src/hardware/r_opengl/r_opengl.c | 44 +++++++++ src/m_menu.c | 6 +- src/p_setup.c | 15 +++- src/r_data.c | 73 ++++++++++++++- src/r_data.h | 2 + src/r_state.h | 1 + src/sdl/hwsym_sdl.c | 1 + src/sdl/i_video.c | 1 + src/win32/win_dll.c | 2 + 15 files changed, 309 insertions(+), 15 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 9fa506bee..499cde45e 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -461,6 +461,10 @@ static void D_Display(void) if (gamestate != GS_TIMEATTACK) CON_Drawer(); + // Running a wipe, but it doesn't freeze the game + if (WipeInAction && (!WipeFreezeGame)) + F_WipeTicker(); + M_Drawer(); // menu is drawn even on top of everything // focus lost moved to M_Drawer diff --git a/src/f_finale.h b/src/f_finale.h index d640abc8a..ccef4a362 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -108,11 +108,28 @@ void F_MenuPresTicker(boolean run); #define FORCEWIPEOFF -2 extern boolean WipeInAction; +extern boolean WipeFreezeGame; extern INT32 lastwipetic; +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; + void F_WipeStartScreen(void); void F_WipeEndScreen(void); void F_RunWipe(UINT8 wipetype, boolean drawMenu); +void F_WipeTicker(void); tic_t F_GetWipeLength(UINT8 wipetype); boolean F_WipeExists(UINT8 wipetype); diff --git a/src/f_wipe.c b/src/f_wipe.c index 05229f844..cabcbb1a1 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -27,6 +27,13 @@ #include "d_main.h" #include "m_misc.h" // movie mode +#include "doomstat.h" +#include "st_stuff.h" + +#ifdef HAVE_BLUA +#include "lua_hud.h" // level title +#endif + #ifdef HWRENDER #include "hardware/hw_main.h" #endif @@ -82,14 +89,22 @@ UINT8 wipedefs[NUMWIPEDEFS] = { //-------------------------------------------------------------------------- boolean WipeInAction = false; +boolean WipeFreezeGame = true; 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; +static UINT8 maxwipeframe; + /** Create fademask_t from lump * * \param lump Lump name to get data from @@ -148,7 +163,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/8; // 0-31 range + else + *mask++ = FixedDiv((pcolor->s.red+1)<>FRACBITS; } fm.xscale = FixedDiv(vid.width<lvlttl != '\0' +#ifdef HAVE_BLUA + && LUA_HudEnabled(hud_stagetitle) +#endif + ) + ST_drawLevelTitle(TICRATE); +} + /** Wipe ticker * * \param fademask pixels to change @@ -242,7 +273,7 @@ static void F_DoWipe(fademask_t *fademask) relativepos = (draw_linestart * vid.width) + draw_rowstart; draw_linestogo = draw_lineend - draw_linestart; - if (*mask == 0) + if ((*mask == 0) && (wipestyle == WIPESTYLE_NORMAL)) { // shortcut - memcpy source to work while (draw_linestogo--) @@ -251,7 +282,7 @@ static void F_DoWipe(fademask_t *fademask) relativepos += vid.width; } } - else if (*mask == 10) + else if ((*mask >= maxwipeframe) && (wipestyle == WIPESTYLE_NORMAL)) { // shortcut - memcpy target to work while (draw_linestogo--) @@ -262,8 +293,25 @@ static void F_DoWipe(fademask_t *fademask) } else { - // pointer to transtable that this mask would use - transtbl = transtables + ((9 - *mask)<drawroutine) diff --git a/src/p_setup.c b/src/p_setup.c index 65335be3f..51cb38fe0 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2679,6 +2679,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. @@ -2699,11 +2700,17 @@ 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; F_WipeEndScreen(); F_RunWipe(wipedefs[wipe_speclevel_towhite], false); + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0); + I_OsPolling(); + I_FinishUpdate(); // page flip or blit buffer + if (moviemode) + M_SaveFrame(); + nowtime = lastwipetic; // Hold on white for extra effect. @@ -2737,7 +2744,8 @@ boolean P_SetupLevel(boolean skipprecip) if (rendermode != render_none && !ranspecialwipe) { F_WipeStartScreen(); - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); + wipestyleflags |= WSF_FADEOUT; + //V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); F_WipeEndScreen(); // for titlemap: run a specific wipe if specified @@ -3180,6 +3188,9 @@ boolean P_SetupLevel(boolean skipprecip) } // Stage title! + wipestyleflags |= WSF_FADEIN; + wipestyleflags &= ~WSF_FADEOUT; + WipeFreezeGame = false; if (rendermode != render_none && (!titlemapinaction) && ranspecialwipe != 2 diff --git a/src/r_data.c b/src/r_data.c index 6889bddde..2699cf599 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -112,6 +112,7 @@ INT32 *texturetranslation; sprcache_t *spritecachedinfo; lighttable_t *colormaps; +lighttable_t *fadecolormap = NULL; // for debugging/info purposes static size_t flatmemory, spritememory, texturememory; @@ -1294,18 +1295,82 @@ static void R_InitSpriteLumps(void) Z_Malloc(max_spritelumps*sizeof(*spritecachedinfo), PU_STATIC, &spritecachedinfo); } +// +// R_CreateFadeColormaps +// +static void R_CreateFadeColormaps(size_t len) +{ + UINT8 px, fade; + RGBA_t rgba; + INT32 r, g, b; + size_t i; + + fadecolormap = Z_MallocAlign(len*2, PU_STATIC, NULL, 8); + +#define GETCOLOR \ + px = colormaps[i%256]; \ + fade = (i/256) * 8; \ + rgba = V_GetColor(px); + + // to black + for (i = 0; i < len; i++) + { + // find pixel and fade amount + GETCOLOR; + + // subtractive color blending + r = rgba.s.red - fade*3; + g = rgba.s.green - fade*2; + b = rgba.s.blue - fade; + + // 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 + for (i = len; i < len*2; i++) + { + // find pixel and fade amount + GETCOLOR; + + // additive color blending + r = rgba.s.red + fade*3; + g = rgba.s.green + fade*2; + b = rgba.s.blue + fade; + + // 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(len); + // Init Boom colormaps. R_ClearColormaps(); #ifdef EXTRACOLORMAPLUMPS @@ -1334,6 +1399,9 @@ void R_ReInitColormaps(UINT16 num) } W_ReadLumpHeader(lump, colormaps, W_LumpLength(basecolormaplump), 0U); + if (fadecolormap) + Z_Free(fadecolormap); + R_CreateFadeColormaps(W_LumpLength(lump)); // Init Boom colormaps. R_ClearColormaps(); @@ -1615,7 +1683,6 @@ extracolormap_t *R_ColormapForName(char *name) // static double deltas[256][3], map[256][3]; -static UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b); static int RoundUp(double number); lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap) @@ -2027,7 +2094,7 @@ extracolormap_t *R_AddColormaps(extracolormap_t *exc_augend, extracolormap_t *ex // Thanks to quake2 source! // utils3/qdata/images.c -static UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b) +UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b) { int dr, dg, db; int distortion, bestdistortion = 256 * 256 * 4, bestcolor = 0, i; diff --git a/src/r_data.h b/src/r_data.h index b6b0a16a1..77e615799 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -148,6 +148,8 @@ const char *R_NameForColormap(extracolormap_t *extra_colormap); #define R_PutRgbaRGB(r, g, b) (R_PutRgbaR(r) + R_PutRgbaG(g) + R_PutRgbaB(b)) #define R_PutRgbaRGBA(r, g, b, a) (R_PutRgbaRGB(r, g, b) + R_PutRgbaA(a)) +UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b); + extern INT32 numtextures; #endif 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 05ac6450e..a07d9eb03 100644 --- a/src/sdl/hwsym_sdl.c +++ b/src/sdl/hwsym_sdl.c @@ -98,6 +98,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 5a4fd7a02..998fae239 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1519,6 +1519,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/win32/win_dll.c b/src/win32/win_dll.c index 71eda0437..b6353f80d 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}, From eb1b6eedeb69e579d5ef67f8d89669e4529a8183 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Tue, 10 Sep 2019 16:54:40 -0300 Subject: [PATCH 02/14] some adjusts --- src/f_finale.h | 7 +++++++ src/f_wipe.c | 15 ++++---------- src/r_data.c | 54 +++++++++++++++++++++++++++++++++++++++----------- 3 files changed, 53 insertions(+), 23 deletions(-) diff --git a/src/f_finale.h b/src/f_finale.h index ccef4a362..6f7087dbb 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -126,6 +126,13 @@ typedef enum } wipestyleflags_t; extern wipestyleflags_t wipestyleflags; +#define FADECOLORMAPDIV 8 +#define FADECOLORMAPROWS (256/FADECOLORMAPDIV) + +#define FADEREDFACTOR 20 +#define FADEGREENFACTOR 20 +#define FADEBLUEFACTOR 10 + void F_WipeStartScreen(void); void F_WipeEndScreen(void); void F_RunWipe(UINT8 wipetype, boolean drawMenu); diff --git a/src/f_wipe.c b/src/f_wipe.c index cabcbb1a1..f1d31f1f8 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -103,7 +103,6 @@ static fixed_t paldiv = 0; static UINT8 curwipetype; static UINT8 curwipeframe; -static UINT8 maxwipeframe; /** Create fademask_t from lump * @@ -164,7 +163,7 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) { // Determine pixel to use from fademask pcolor = &pMasterPalette[*lump++]; if (wipestyle == WIPESTYLE_LEVEL) - *mask++ = pcolor->s.red/8; // 0-31 range + *mask++ = pcolor->s.red / FADECOLORMAPDIV; else *mask++ = FixedDiv((pcolor->s.red+1)<>FRACBITS; } @@ -282,7 +281,7 @@ static void F_DoWipe(fademask_t *fademask) relativepos += vid.width; } } - else if ((*mask >= maxwipeframe) && (wipestyle == WIPESTYLE_NORMAL)) + else if ((*mask >= 10) && (wipestyle == WIPESTYLE_NORMAL)) { // shortcut - memcpy target to work while (draw_linestogo--) @@ -299,11 +298,11 @@ static void F_DoWipe(fademask_t *fademask) UINT8 *fade = fadecolormap; if (wipestyleflags & WSF_TOWHITE) - fade = fadecolormap + (32 * 256); + fade = fadecolormap + (FADECOLORMAPROWS * 256); nmask = *mask; if (wipestyleflags & WSF_FADEIN) - nmask = 31 - nmask; + nmask = (FADECOLORMAPROWS-1) - nmask; transtbl = fade + (nmask * 256); } @@ -406,15 +405,9 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu) // don't know where else to put this. // this any good? if (gamestate == GS_LEVEL || gamestate == GS_TITLESCREEN) - { wipestyle = WIPESTYLE_LEVEL; - maxwipeframe = 31; - } else - { wipestyle = WIPESTYLE_NORMAL; - maxwipeframe = 10; - } curwipetype = wipetype; curwipeframe = 0; diff --git a/src/r_data.c b/src/r_data.c index 2699cf599..3e167c45d 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -23,6 +23,7 @@ #include "z_zone.h" #include "p_setup.h" // levelflats #include "v_video.h" // pMasterPalette +#include "f_finale.h" // wipes #include "dehacked.h" #ifdef _WIN32 @@ -112,7 +113,7 @@ INT32 *texturetranslation; sprcache_t *spritecachedinfo; lighttable_t *colormaps; -lighttable_t *fadecolormap = NULL; +lighttable_t *fadecolormap; // for debugging/info purposes static size_t flatmemory, spritememory, texturememory; @@ -1298,30 +1299,58 @@ static void R_InitSpriteLumps(void) // // R_CreateFadeColormaps // -static void R_CreateFadeColormaps(size_t len) + +static void R_CreateFadeColormaps() { UINT8 px, fade; RGBA_t rgba; INT32 r, g, b; - size_t i; + 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) * 8; \ + 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 - fade*3; - g = rgba.s.green - fade*2; - b = rgba.s.blue - fade; + 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; @@ -1333,15 +1362,16 @@ static void R_CreateFadeColormaps(size_t len) } // to white + makewhite: for (i = len; i < len*2; i++) { // find pixel and fade amount GETCOLOR; // additive color blending - r = rgba.s.red + fade*3; - g = rgba.s.green + fade*2; - b = rgba.s.blue + fade; + 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; @@ -1369,7 +1399,7 @@ static void R_InitColormaps(void) W_ReadLump(lump, colormaps); // Make colormap for fades - R_CreateFadeColormaps(len); + R_CreateFadeColormaps(); // Init Boom colormaps. R_ClearColormaps(); @@ -1401,7 +1431,7 @@ void R_ReInitColormaps(UINT16 num) W_ReadLumpHeader(lump, colormaps, W_LumpLength(basecolormaplump), 0U); if (fadecolormap) Z_Free(fadecolormap); - R_CreateFadeColormaps(W_LumpLength(lump)); + R_CreateFadeColormaps(); // Init Boom colormaps. R_ClearColormaps(); From 00d76bd9efed243bb7dbf49cd46a10c4a5cf038a Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Tue, 5 Nov 2019 12:10:42 -0300 Subject: [PATCH 03/14] fix fades for real --- src/d_main.c | 2 +- src/f_finale.c | 15 +++---- src/f_finale.h | 2 + src/f_wipe.c | 21 ++++++++-- src/hardware/hw_main.c | 94 +++++++++++++++++++++++------------------- src/hardware/hw_main.h | 3 +- src/p_setup.c | 18 ++++++-- 7 files changed, 97 insertions(+), 58 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 24d026827..6d1335d36 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -267,7 +267,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); } diff --git a/src/f_finale.c b/src/f_finale.c index eb1415042..b9a2cfc9b 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -763,7 +763,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); } @@ -773,10 +773,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); } @@ -786,7 +787,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); } @@ -833,7 +834,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, 0, cutscene_disptext); @@ -846,7 +847,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, 0, cutscene_disptext); @@ -859,7 +860,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, 0, cutscene_disptext); @@ -872,7 +873,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, 0, cutscene_disptext); diff --git a/src/f_finale.h b/src/f_finale.h index 0619a7e74..4766af652 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -138,6 +138,8 @@ void F_WipeStartScreen(void); void F_WipeEndScreen(void); void F_RunWipe(UINT8 wipetype, boolean drawMenu); void F_WipeTicker(void); +void F_WipeTitleCard(void); +void F_WipeColorFill(UINT8 color); tic_t F_GetWipeLength(UINT8 wipetype); boolean F_WipeExists(UINT8 wipetype); diff --git a/src/f_wipe.c b/src/f_wipe.c index e67e7e3ad..8b69f39ca 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -103,6 +103,7 @@ static fixed_t paldiv = 0; static UINT8 curwipetype; static UINT8 curwipeframe; +static UINT8 wipecolorfill = 31; /** Create fademask_t from lump * @@ -186,7 +187,7 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) { return NULL; } -static void F_WipeTitleCard(void) +void F_WipeTitleCard(void) { if (wipestyle == WIPESTYLE_LEVEL && (!titlemapinaction) @@ -199,6 +200,12 @@ static void F_WipeTitleCard(void) ST_drawLevelTitle(TICRATE); } +void F_WipeColorFill(UINT8 color) +{ + wipecolorfill = color; + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, wipecolorfill); +} + /** Wipe ticker * * \param fademask pixels to change @@ -430,10 +437,17 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu) #ifdef HWRENDER if (rendermode == render_opengl) - HWR_DoWipe(wipetype, wipeframe-1); // send in the wipe type and wipeframe because we need to cache the graphic + { + // send in the wipe type and wipe frame because we need to cache the graphic + if (wipestyle == WIPESTYLE_LEVEL) + HWR_DoTintedWipe(wipetype, wipeframe-1); + else + HWR_DoWipe(wipetype, wipeframe-1); + } else #endif F_DoWipe(fmask); + I_OsPolling(); I_UpdateNoBlit(); @@ -473,8 +487,9 @@ void F_WipeTicker(void) } #ifdef HWRENDER + // send in the wipe type and wipe frame because we need to cache the graphic if (rendermode == render_opengl) - HWR_DoWipeLevel(curwipetype, curwipeframe-1); + HWR_DoLevelWipe(curwipetype, curwipeframe-1, wipecolorfill); // also send the wipe color else #endif F_DoWipe(fmask); diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 92def01a9..9d1c2d219 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -39,6 +39,7 @@ #include "../st_stuff.h" #include "../i_system.h" #include "../m_cheat.h" +#include "../f_finale.h" #ifdef ESLOPE #include "../p_slopes.h" #endif @@ -6991,73 +6992,82 @@ void HWR_DrawIntermissionBG(void) HWD.pfnDrawIntermissionBG(); } -void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum) +// +// hwr mode wipes +// +static char wipelumpname[9]; +static lumpnum_t wipelumpnum; + +// puts wipe lumpname in wipename[9] +static boolean check_wipe(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 + // write FADE prefix into wipelumpname + strncpy(wipelumpname, "FADEmmss", 8); - // puts the numbers into the lumpname - sprintf(&lumpname[4], "%.2hu%.2hu", (UINT16)wipenum, (UINT16)scrnnum); - lumpnum = W_CheckNumForName(lumpname); + // 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 - if (lumpnum == LUMPERROR) // again, shouldn't be here really - return; + // puts the numbers into the wipename + sprintf(&wipelumpname[4], "%.2hu%.2hu", (UINT16)wipenum, (UINT16)scrnnum); + wipelumpnum = W_CheckNumForName(wipelumpname); - 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 + CONS_Alert(CONS_WARNING, "Fade mask lump %s of incorrect size, ignored\n", wipelumpname); + 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 (!check_wipe(wipenum, scrnnum)) + return; + + HWR_GetFadeMask(wipelumpnum); HWD.pfnDoScreenWipe(HWRWipeCounter); // Still send in wipecounter since old stuff might not support multitexturing HWRWipeCounter += 0.05f; // increase opacity of end screen - if (HWRWipeCounter > 1.0f) HWRWipeCounter = 1.0f; } -void HWR_DoWipeLevel(UINT8 wipenum, UINT8 scrnnum) +void HWR_DoTintedWipe(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 - - // puts the numbers into the lumpname - sprintf(&lumpname[4], "%.2hu%.2hu", (UINT16)wipenum, (UINT16)scrnnum); - lumpnum = W_CheckNumForName(lumpname); - - if (lumpnum == LUMPERROR) // again, shouldn't be here really + if (!check_wipe(wipenum, scrnnum)) return; - lsize = W_LumpLength(lumpnum); - - 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 - } - - HWR_EndScreenWipe(); - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); - HWR_StartScreenWipe(); - HWR_GetFadeMask(lumpnum); - - HWD.pfnDoScreenWipeLevel(); + HWR_GetFadeMask(wipelumpnum); + HWD.pfnDoScreenWipe(HWRWipeCounter); HWRWipeCounter += 0.05f; // increase opacity of end screen + if (HWRWipeCounter > 1.0f) + HWRWipeCounter = 1.0f; +} +void HWR_DoLevelWipe(UINT8 wipenum, UINT8 scrnnum, UINT8 wipecolorfill) +{ + if (!check_wipe(wipenum, scrnnum)) + return; + + HWR_EndScreenWipe(); + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, wipecolorfill); + HWR_StartScreenWipe(); + HWR_GetFadeMask(wipelumpnum); + + HWD.pfnDoScreenWipeLevel(); + F_WipeTitleCard(); + + HWRWipeCounter += 0.05f; // increase opacity of end screen if (HWRWipeCounter > 1.0f) HWRWipeCounter = 1.0f; } diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 6d340ec6b..e1cb01444 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -67,7 +67,8 @@ void HWR_StartScreenWipe(void); void HWR_EndScreenWipe(void); void HWR_DrawIntermissionBG(void); void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum); -void HWR_DoWipeLevel(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/p_setup.c b/src/p_setup.c index 1223c85d0..ea619c641 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2691,10 +2691,15 @@ boolean P_SetupLevel(boolean skipprecip) F_WipeStartScreen(); 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); - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0); I_OsPolling(); I_FinishUpdate(); // page flip or blit buffer if (moviemode) @@ -2734,7 +2739,12 @@ boolean P_SetupLevel(boolean skipprecip) { F_WipeStartScreen(); wipestyleflags |= WSF_FADEOUT; - //V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); + +#ifdef HWRENDER + // uh.......... + if (rendermode == render_opengl) + F_WipeColorFill(31); +#endif F_WipeEndScreen(); // for titlemap: run a specific wipe if specified @@ -3130,7 +3140,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(); @@ -3203,7 +3213,7 @@ boolean P_SetupLevel(boolean skipprecip) I_Sleep(); lasttime = nowtime; - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol); + F_WipeColorFill(levelfadecol); stplyr = &players[consoleplayer]; ST_drawLevelTitle(nowtime - starttime); if (splitscreen) From 5ebb90cdd6c6b35ced01d274d6e7b199c4e9cd58 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Tue, 5 Nov 2019 12:28:01 -0300 Subject: [PATCH 04/14] tweak fade colormaps just a little bit --- src/f_finale.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/f_finale.h b/src/f_finale.h index 4766af652..def8232b0 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -130,8 +130,8 @@ extern wipestyleflags_t wipestyleflags; #define FADECOLORMAPDIV 8 #define FADECOLORMAPROWS (256/FADECOLORMAPDIV) -#define FADEREDFACTOR 20 -#define FADEGREENFACTOR 20 +#define FADEREDFACTOR 15 +#define FADEGREENFACTOR 15 #define FADEBLUEFACTOR 10 void F_WipeStartScreen(void); From 044d3fd3253ed7ee16b360c169ade1340c29a75d Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Tue, 5 Nov 2019 12:31:50 -0300 Subject: [PATCH 05/14] Update hw_main.c --- src/hardware/hw_main.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 9d1c2d219..3c56f7da7 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -6999,7 +6999,7 @@ static char wipelumpname[9]; static lumpnum_t wipelumpnum; // puts wipe lumpname in wipename[9] -static boolean check_wipe(UINT8 wipenum, UINT8 scrnnum) +static boolean HWR_WipeCheck(UINT8 wipenum, UINT8 scrnnum) { size_t lsize; @@ -7030,7 +7030,7 @@ static boolean check_wipe(UINT8 wipenum, UINT8 scrnnum) void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum) { - if (!check_wipe(wipenum, scrnnum)) + if (!HWR_WipeCheck(wipenum, scrnnum)) return; HWR_GetFadeMask(wipelumpnum); @@ -7043,20 +7043,13 @@ void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum) void HWR_DoTintedWipe(UINT8 wipenum, UINT8 scrnnum) { - if (!check_wipe(wipenum, scrnnum)) - return; - - HWR_GetFadeMask(wipelumpnum); - HWD.pfnDoScreenWipe(HWRWipeCounter); - - HWRWipeCounter += 0.05f; // increase opacity of end screen - if (HWRWipeCounter > 1.0f) - HWRWipeCounter = 1.0f; + // It does the same thing + HWR_DoWipe(wipenum, scrnnum); } void HWR_DoLevelWipe(UINT8 wipenum, UINT8 scrnnum, UINT8 wipecolorfill) { - if (!check_wipe(wipenum, scrnnum)) + if (!HWR_WipeCheck(wipenum, scrnnum)) return; HWR_EndScreenWipe(); From 76488d835f850a135ee8aee006749385d03b8bf6 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Thu, 14 Nov 2019 21:31:20 -0300 Subject: [PATCH 06/14] F_WipeColorFill --- src/d_main.c | 2 +- src/f_finale.h | 4 +++- src/f_wipe.c | 8 +------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index a8b96d651..47ecb5fbf 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -448,7 +448,7 @@ static void D_Display(void) framecount = 0; demostarttime = I_GetTime(); } - + wipetypepost = -1; } else diff --git a/src/f_finale.h b/src/f_finale.h index e096690a1..6fd94d9c0 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -166,12 +166,14 @@ extern wipestyleflags_t wipestyleflags; #define FADEGREENFACTOR 15 #define FADEBLUEFACTOR 10 +extern UINT8 wipecolorfill; + void F_WipeStartScreen(void); void F_WipeEndScreen(void); void F_RunWipe(UINT8 wipetype, boolean drawMenu); void F_WipeTicker(void); void F_WipeTitleCard(void); -void F_WipeColorFill(UINT8 color); +#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 8b69f39ca..b5b60403e 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -103,7 +103,7 @@ static fixed_t paldiv = 0; static UINT8 curwipetype; static UINT8 curwipeframe; -static UINT8 wipecolorfill = 31; +UINT8 wipecolorfill = 31; /** Create fademask_t from lump * @@ -200,12 +200,6 @@ void F_WipeTitleCard(void) ST_drawLevelTitle(TICRATE); } -void F_WipeColorFill(UINT8 color) -{ - wipecolorfill = color; - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, wipecolorfill); -} - /** Wipe ticker * * \param fademask pixels to change From c15ee6501589112105e4875bb05b1adb292648b3 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Fri, 15 Nov 2019 18:21:12 -0300 Subject: [PATCH 07/14] LEVELWIPES --- src/d_main.c | 6 ++++-- src/doomdef.h | 3 +++ src/f_finale.h | 2 +- src/f_wipe.c | 20 ++++++++++++++------ src/hardware/hw_main.c | 2 ++ src/m_menu.c | 2 +- src/p_setup.c | 2 +- 7 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 47ecb5fbf..011e38e2a 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -417,9 +417,11 @@ static void D_Display(void) if (gamestate != GS_TIMEATTACK) CON_Drawer(); - // Running a wipe, but it doesn't freeze the game - if (WipeInAction && (!WipeFreezeGame)) +#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 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.h b/src/f_finale.h index 6fd94d9c0..ba4afec42 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -141,7 +141,7 @@ void F_MenuPresTicker(boolean run); #define FORCEWIPEOFF -2 extern boolean WipeInAction; -extern boolean WipeFreezeGame; +extern boolean WipeInLevel; extern INT32 lastwipetic; typedef enum diff --git a/src/f_wipe.c b/src/f_wipe.c index b5b60403e..203d7c08d 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -89,7 +89,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = { //-------------------------------------------------------------------------- boolean WipeInAction = false; -boolean WipeFreezeGame = true; +boolean WipeInLevel = false; INT32 lastwipetic = 0; wipestyle_t wipestyle = WIPESTYLE_NORMAL; @@ -273,7 +273,7 @@ static void F_DoWipe(fademask_t *fademask) relativepos = (draw_linestart * vid.width) + draw_rowstart; draw_linestogo = draw_lineend - draw_linestart; - if ((*mask == 0) && (wipestyle == WIPESTYLE_NORMAL)) + if (*mask == 0) { // shortcut - memcpy source to work while (draw_linestogo--) @@ -282,7 +282,7 @@ static void F_DoWipe(fademask_t *fademask) relativepos += vid.width; } } - else if ((*mask >= 10) && (wipestyle == WIPESTYLE_NORMAL)) + else if (*mask >= ((wipestyle == WIPESTYLE_LEVEL) ? FADECOLORMAPROWS : 10)) { // shortcut - memcpy target to work while (draw_linestogo--) @@ -412,8 +412,10 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu) curwipetype = wipetype; curwipeframe = 0; - if (!WipeFreezeGame) +#ifdef LEVELWIPES + if (WipeInLevel) return; +#endif // lastwipetic should either be 0 or the tic we last wiped // on for fade-to-black @@ -454,13 +456,17 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu) M_SaveFrame(); } WipeInAction = false; - WipeFreezeGame = true; + WipeInLevel = false; #endif } // Works On My Machine seal of approval void F_WipeTicker(void) { +#ifndef NOWIPE +#ifndef LEVELWIPES + WipeInAction = false; +#else fademask_t *fmask; // Wait, what? @@ -476,7 +482,7 @@ void F_WipeTicker(void) { // stop WipeInAction = false; - WipeFreezeGame = true; + WipeInLevel = false; return; } @@ -487,6 +493,8 @@ void F_WipeTicker(void) else #endif F_DoWipe(fmask); +#endif +#endif } /** Returns tic length of wipe diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index fb45ca4f7..4cb407621 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -7079,6 +7079,7 @@ void HWR_DoTintedWipe(UINT8 wipenum, UINT8 scrnnum) void HWR_DoLevelWipe(UINT8 wipenum, UINT8 scrnnum, UINT8 wipecolorfill) { +#ifdef LEVELWIPES if (!HWR_WipeCheck(wipenum, scrnnum)) return; @@ -7089,6 +7090,7 @@ void HWR_DoLevelWipe(UINT8 wipenum, UINT8 scrnnum, UINT8 wipecolorfill) HWD.pfnDoScreenWipeLevel(); F_WipeTitleCard(); +#endif } void HWR_MakeScreenFinalTexture(void) diff --git a/src/m_menu.c b/src/m_menu.c index 098f34b97..28799a9c3 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3364,7 +3364,7 @@ boolean M_Responder(event_t *ev) void M_Drawer(void) { boolean wipe = WipeInAction; - if (!WipeFreezeGame) + if (WipeInLevel) wipe = false; if (currentMenu == &MessageDef) diff --git a/src/p_setup.c b/src/p_setup.c index 77fb3b511..60e507e86 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3247,7 +3247,7 @@ boolean P_SetupLevel(boolean skipprecip) // Stage title! wipestyleflags |= WSF_FADEIN; wipestyleflags &= ~WSF_FADEOUT; - WipeFreezeGame = false; + WipeInLevel = true; if (rendermode != render_none && (!titlemapinaction) && ranspecialwipe != 2 From f55b0f52caaa92a0ebae40f8561e62d578b7840b Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Fri, 15 Nov 2019 18:53:32 -0300 Subject: [PATCH 08/14] Accidental missing (void) --- src/r_data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_data.c b/src/r_data.c index 04c85b39f..574c4e194 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -1461,7 +1461,7 @@ static void R_InitSpriteLumps(void) // R_CreateFadeColormaps // -static void R_CreateFadeColormaps() +static void R_CreateFadeColormaps(void) { UINT8 px, fade; RGBA_t rgba; From 7ba76200593f39c398680158fc1f2f9a0a310258 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Fri, 15 Nov 2019 18:58:45 -0300 Subject: [PATCH 09/14] Shadowed declaration and unused parameters --- src/hardware/hw_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 4cb407621..45d1cdf27 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -7077,14 +7077,18 @@ void HWR_DoTintedWipe(UINT8 wipenum, UINT8 scrnnum) HWR_DoWipe(wipenum, scrnnum); } -void HWR_DoLevelWipe(UINT8 wipenum, UINT8 scrnnum, UINT8 wipecolorfill) +void HWR_DoLevelWipe(UINT8 wipenum, UINT8 scrnnum, UINT8 colfill) { -#ifdef LEVELWIPES +#ifndef LEVELWIPES + (void)wipenum; + (void)scrnnum; + (void)colfill; +#else if (!HWR_WipeCheck(wipenum, scrnnum)) return; HWR_EndScreenWipe(); - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, wipecolorfill); + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, colfill); HWR_StartScreenWipe(); HWR_GetFadeMask(wipelumpnum); From 41835e07ea82b9d3f0bcd8ca7319049b2d49a1e7 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Fri, 15 Nov 2019 19:04:40 -0300 Subject: [PATCH 10/14] I don't get it --- src/hardware/hw_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 45d1cdf27..0a12c9660 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -7029,10 +7029,10 @@ void HWR_DrawIntermissionBG(void) // // hwr mode wipes // -static char wipelumpname[9]; +static char wipelumpname[10]; static lumpnum_t wipelumpnum; -// puts wipe lumpname in wipename[9] +// puts wipe lumpname in wipename[10] static boolean HWR_WipeCheck(UINT8 wipenum, UINT8 scrnnum) { size_t lsize; From 5b0730839b6f443144676e591ffaa30842d87ae3 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Fri, 15 Nov 2019 19:09:02 -0300 Subject: [PATCH 11/14] Move scope of wipelumpname --- src/hardware/hw_main.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 0a12c9660..4cba4cfad 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -7029,24 +7029,21 @@ void HWR_DrawIntermissionBG(void) // // hwr mode wipes // -static char wipelumpname[10]; static lumpnum_t wipelumpnum; // puts wipe lumpname in wipename[10] static boolean HWR_WipeCheck(UINT8 wipenum, UINT8 scrnnum) { + static char lumpname[10] = "FADEmmss"; size_t lsize; - // write FADE prefix into wipelumpname - strncpy(wipelumpname, "FADEmmss", 8); - // 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 wipename - sprintf(&wipelumpname[4], "%.2hu%.2hu", (UINT16)wipenum, (UINT16)scrnnum); - wipelumpnum = W_CheckNumForName(wipelumpname); + sprintf(&lumpname[4], "%.2hu%.2hu", (UINT16)wipenum, (UINT16)scrnnum); + wipelumpnum = W_CheckNumForName(lumpname); // again, shouldn't be here really if (wipelumpnum == LUMPERROR) @@ -7055,7 +7052,7 @@ static boolean HWR_WipeCheck(UINT8 wipenum, UINT8 scrnnum) 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", wipelumpname); + CONS_Alert(CONS_WARNING, "Fade mask lump %s of incorrect size, ignored\n", lumpname); return false; // again, shouldn't get here if it is a bad size } From 55c42d9cb789cbdbcfce858fab2f9ca90780bca4 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Fri, 15 Nov 2019 19:36:25 -0300 Subject: [PATCH 12/14] Small mistake --- src/f_finale.h | 2 +- src/f_wipe.c | 32 ++++++++++++++++++++++++-------- src/hardware/hw_main.c | 2 +- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/f_finale.h b/src/f_finale.h index ba4afec42..d28ed0b01 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -172,7 +172,7 @@ void F_WipeStartScreen(void); void F_WipeEndScreen(void); void F_RunWipe(UINT8 wipetype, boolean drawMenu); void F_WipeTicker(void); -void F_WipeTitleCard(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 203d7c08d..8e767932f 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 "w_wad.h" #include "z_zone.h" @@ -25,6 +26,7 @@ #include "m_menu.h" #include "console.h" #include "d_main.h" +#include "g_game.h" #include "m_misc.h" // movie mode #include "doomstat.h" @@ -187,17 +189,27 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) { return NULL; } -void F_WipeTitleCard(void) +/** Draw the stage title. + */ +void F_WipeStageTitle(void) { if (wipestyle == WIPESTYLE_LEVEL - && (!titlemapinaction) - && (wipestyleflags & WSF_FADEIN) - && *mapheaderinfo[gamemap-1]->lvlttl != '\0' + && (!titlemapinaction) + && (wipestyleflags & WSF_FADEIN) + && *mapheaderinfo[gamemap-1]->lvlttl != '\0' #ifdef HAVE_BLUA - && LUA_HudEnabled(hud_stagetitle) + && LUA_HudEnabled(hud_stagetitle) #endif - ) + ) + { + stplyr = &players[consoleplayer]; ST_drawLevelTitle(TICRATE); + if (splitscreen) + { + stplyr = &players[secondarydisplayplayer]; + ST_drawLevelTitle(TICRATE); + } + } } /** Wipe ticker @@ -344,7 +356,8 @@ static void F_DoWipe(fademask_t *fademask) free(scrxpos); free(scrypos); } - F_WipeTitleCard(); + if (wipestyle == WIPESTYLE_LEVEL) + F_WipeStageTitle(); } #endif @@ -460,7 +473,8 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu) #endif } -// Works On My Machine seal of approval +/** Run and display the fade with the level. + */ void F_WipeTicker(void) { #ifndef NOWIPE @@ -524,6 +538,8 @@ tic_t F_GetWipeLength(UINT8 wipetype) #endif } +/** Does the specified wipe exist? + */ boolean F_WipeExists(UINT8 wipetype) { #ifdef NOWIPE diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 4cba4cfad..a6863f8d8 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -7090,7 +7090,7 @@ void HWR_DoLevelWipe(UINT8 wipenum, UINT8 scrnnum, UINT8 colfill) HWR_GetFadeMask(wipelumpnum); HWD.pfnDoScreenWipeLevel(); - F_WipeTitleCard(); + F_WipeStageTitle(); #endif } From 12e8c11382ab41593292417b333d0c060c258593 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Fri, 15 Nov 2019 19:40:58 -0300 Subject: [PATCH 13/14] Update hw_main.c --- src/hardware/hw_main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index a6863f8d8..52bdbcf5a 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -7031,10 +7031,10 @@ void HWR_DrawIntermissionBG(void) // static lumpnum_t wipelumpnum; -// puts wipe lumpname in wipename[10] +// puts wipe lumpname in wipename[9] static boolean HWR_WipeCheck(UINT8 wipenum, UINT8 scrnnum) { - static char lumpname[10] = "FADEmmss"; + static char lumpname[9] = "FADEmmss"; size_t lsize; // not a valid wipe number @@ -7042,7 +7042,10 @@ static boolean HWR_WipeCheck(UINT8 wipenum, UINT8 scrnnum) return false; // shouldn't end up here really, the loop should've stopped running beforehand // puts the numbers into the wipename - sprintf(&lumpname[4], "%.2hu%.2hu", (UINT16)wipenum, (UINT16)scrnnum); + lumpname[4] = '0'+(wipenum/10); + lumpname[5] = '0'+(wipenum%10); + lumpname[6] = '0'+(scrnnum/10); + lumpname[7] = '0'+(scrnnum%10); wipelumpnum = W_CheckNumForName(lumpname); // again, shouldn't be here really From 1698e2d98653712d1c4119f2338ff4e344bf5fd6 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Mon, 18 Nov 2019 19:08:04 -0300 Subject: [PATCH 14/14] adjust duration --- src/f_wipe.c | 9 --------- src/st_stuff.c | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/f_wipe.c b/src/f_wipe.c index ad0e89c13..17ffbe0c4 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -450,15 +450,6 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu) #endif F_DoWipe(fmask); - // draw level title - if ((WipeStageTitle && st_overlay) - && !(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD) - && *mapheaderinfo[gamemap-1]->lvlttl != '\0') - { - ST_runTitleCard(); - ST_drawWipeTitleCard(); - } - I_OsPolling(); I_UpdateNoBlit(); diff --git a/src/st_stuff.c b/src/st_stuff.c index 2b1b8e3ca..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;