diff --git a/src/f_finale.c b/src/f_finale.c index cdc51d4f0..55efd8a14 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -830,16 +830,6 @@ void F_IntroDrawer(void) V_DrawString(cx, cy, V_ALLOWLOWERCASE, cutscene_disptext); } -static void F_IntroDoCrossfade(void) -{ - wipe_t wipe = {0}; - wipe.flags = WSF_CROSSFADE; - wipe.style = WIPESTYLE_NORMAL; - wipe.type = 99; - wipe.drawmenuontop = false; - F_StartWipeParametrized(&wipe); -} - static void F_IntroCheckMidSceneWipe(void) { boolean do_crossfade = false; @@ -858,10 +848,7 @@ static void F_IntroCheckMidSceneWipe(void) do_crossfade = true; if (do_crossfade) - { - F_IntroDoCrossfade(); - timetonext--; - } + F_WipeDoCrossfade(99); } static void F_PlayIntroMusic(void) @@ -872,7 +859,6 @@ static void F_PlayIntroMusic(void) static void F_IntroDoSpecialWipe(INT32 scene) { wipe_t wipe = {0}; - wipe.style = WIPESTYLE_NORMAL; wipe.type = 99; wipe.drawmenuontop = true; @@ -883,18 +869,15 @@ static void F_IntroDoSpecialWipe(INT32 scene) case INTRO_STJR: // The intro music is timed with the fade out and fade in wipe.callback = F_PlayIntroMusic; - wipe.style = WIPESTYLE_COLORMAP; do_fade_in = true; break; case INTRO_SKYRUNNER: wipe.flags = WSF_TOWHITE; - wipe.style = WIPESTYLE_COLORMAP; wipe.type = 0; wipe.holdframes = 17; do_fade_in = true; break; case INTRO_LAST: - wipe.style = WIPESTYLE_COLORMAP; wipe.holdframes = NEWTICRATE*2; wipe.callback = D_StartTitle; break; @@ -903,6 +886,8 @@ static void F_IntroDoSpecialWipe(INT32 scene) break; } + wipe.style = F_WipeGetStyle(wipe.flags); + F_StartWipeParametrized(&wipe); if (do_fade_in) @@ -954,7 +939,7 @@ void F_IntroTicker(void) { if (F_IntroSceneCrossfades(intro_scenenum)) { - F_IntroDoCrossfade(); + F_WipeDoCrossfade(99); next = false; } @@ -3842,8 +3827,8 @@ static void F_AdvanceToNextScene(void) if (cutscenes[cutnum]->scene[scenenum].fadecolor) { wipe_t wipe = {0}; - wipe.flags = 0; - wipe.style = WIPESTYLE_NORMAL; + wipe.flags = WSF_CROSSFADE; + wipe.style = F_WipeGetStyle(wipe.flags); wipe.type = cutscenes[cutnum]->scene[scenenum].fadeinid; wipe.drawmenuontop = true; wipe.callback = F_PlayCutsceneMusic; @@ -3853,7 +3838,7 @@ static void F_AdvanceToNextScene(void) } else { - F_WipeDoCrossfade(); + F_WipeDoCrossfade(DEFAULTWIPE); } // Don't increment until after endcutscene check diff --git a/src/f_finale.h b/src/f_finale.h index ca3919077..cd8bd6494 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -170,11 +170,9 @@ extern boolean wipe_drawmenuontop; typedef enum { - WIPESTYLE_UNDEFINED, WIPESTYLE_NORMAL, WIPESTYLE_COLORMAP } wipestyle_t; -extern wipestyle_t wipe_style; typedef enum { @@ -182,7 +180,6 @@ typedef enum WSF_TOWHITE = 1<<1, WSF_CROSSFADE = 1<<2 } wipeflags_t; -extern wipeflags_t wipe_flags; typedef void (*wipe_callback_t)(void); @@ -214,11 +211,13 @@ void F_DisplayWipe(void); void F_StopWipe(void); void F_StopAllWipes(void); void F_SetupFadeOut(wipeflags_t flags); -void F_QueuePreWipe(INT16 wipetypepre, wipeflags_t flags, wipe_callback_t callback); -void F_QueuePostWipe(INT16 wipetypepost, wipeflags_t flags, wipe_callback_t callback); -void F_WipeDoCrossfade(void); +void F_DoGenericTransition(void); +void F_QueuePreWipe(INT16 type, wipeflags_t flags, wipe_callback_t callback); +void F_QueuePostWipe(INT16 type, wipeflags_t flags, wipe_callback_t callback); +void F_WipeDoCrossfade(INT16 type); void F_StartPendingWipe(void); wipe_t *F_GetQueuedWipe(void); +wipestyle_t F_WipeGetStyle(wipeflags_t flags); #define F_WipeColorFill(c) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, c) diff --git a/src/f_wipe.c b/src/f_wipe.c index 71b83570a..e38e04d8a 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -53,7 +53,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = { 99, // wipe_credits_intermediate (0) 0, // wipe_level_toblack - UINT8_MAX, // wipe_intermission_toblack + 0, // wipe_intermission_toblack 0, // wipe_continuing_toblack 0, // wipe_titlescreen_toblack 0, // wipe_timeattack_toblack @@ -98,8 +98,9 @@ static UINT8 wipe_frame; static boolean wipe_stopped = false; static tic_t wipe_holdframes = 0; -wipestyle_t wipe_style = WIPESTYLE_UNDEFINED; -wipeflags_t wipe_flags = WSF_CROSSFADE; +static wipestyle_t wipe_style = WIPESTYLE_NORMAL; +static wipeflags_t wipe_flags = WSF_CROSSFADE; + specialwipe_t ranspecialwipe = SPECIALWIPE_NONE; boolean wipe_running = false; @@ -422,7 +423,7 @@ void F_WipeEndScreen(void) #ifdef HWRENDER if (rendermode == render_opengl) { - HWR_EndScreenWipe(false); + HWR_EndScreenWipe(); return; } #endif @@ -442,7 +443,7 @@ static boolean F_WipeCanTint(wipeflags_t flags) /** Decides what wipe style to use. */ -static wipestyle_t F_WipeGetStyle(wipeflags_t flags) +wipestyle_t F_WipeGetStyle(wipeflags_t flags) { if (F_WipeCanTint(flags)) return WIPESTYLE_COLORMAP; @@ -495,7 +496,7 @@ void F_StartWipeParametrized(wipe_t *wipe) paldiv = FixedDiv(257<= WIPEQUEUESIZE) + if (wipe_numqueued >= WIPEQUEUESIZE || wipe->type == UINT8_MAX) { // Can't queue it, but its callback has to run. if (wipe->callback) @@ -672,11 +673,11 @@ wipe_t *F_GetQueuedWipe(void) void F_SetupFadeOut(wipeflags_t flags) { +#ifndef NOWIPE F_WipeStartScreen(); UINT8 wipecolor = (flags & WSF_TOWHITE) ? 0 : 31; -#ifndef NOWIPE if (F_WipeCanTint(flags)) { #ifdef HWRENDER @@ -685,46 +686,47 @@ void F_SetupFadeOut(wipeflags_t flags) #endif } else -#endif { F_WipeColorFill(wipecolor); } F_WipeEndScreen(); +#endif +} + +void F_DoGenericTransition(void) +{ + F_QueuePreWipe(DEFAULTWIPE, 0, NULL); + F_QueuePostWipe(DEFAULTWIPE, WSF_FADEIN, NULL); } /** Starts the "pre" type of a wipe. */ -void F_QueuePreWipe(INT16 wipetypepre, wipeflags_t flags, wipe_callback_t callback) +void F_QueuePreWipe(INT16 type, wipeflags_t flags, wipe_callback_t callback) { - if (wipetypepre == DEFAULTWIPE || !F_WipeExists(wipetypepre)) - wipetypepre = wipedefs[F_GetWipedefIndex()]; + if (type == DEFAULTWIPE || !F_WipeExists(type)) + type = wipedefs[F_GetWipedefIndex()]; - // Fade to black first - if (!(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction)) // fades to black on its own timing, always - && wipetypepre != UINT8_MAX) - { - wipe_t wipe = {0}; - wipe.flags = flags; - wipe.style = F_WipeGetStyle(wipe.flags); - wipe.type = wipetypepre; - wipe.drawmenuontop = gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN; - wipe.callback = callback; - F_StartWipeParametrized(&wipe); - } + wipe_t wipe = {0}; + wipe.flags = flags; + wipe.style = F_WipeGetStyle(flags); + wipe.type = type; + wipe.drawmenuontop = gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN; + wipe.callback = callback; + F_StartWipeParametrized(&wipe); } /** Starts the "post" type of a wipe. */ -void F_QueuePostWipe(INT16 wipetypepost, wipeflags_t flags, wipe_callback_t callback) +void F_QueuePostWipe(INT16 type, wipeflags_t flags, wipe_callback_t callback) { - if (wipetypepost == DEFAULTWIPE || !F_WipeExists(wipetypepost)) - wipetypepost = wipedefs[F_GetWipedefIndex() + WIPEFINALSHIFT]; + if (type == DEFAULTWIPE || !F_WipeExists(type)) + type = wipedefs[F_GetWipedefIndex() + WIPEFINALSHIFT]; wipe_t wipe = {0}; wipe.flags = flags; - wipe.style = F_WipeGetStyle(wipe.flags); - wipe.type = wipetypepost; + wipe.style = F_WipeGetStyle(flags); + wipe.type = type; wipe.drawmenuontop = gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN; wipe.callback = callback; F_StartWipeParametrized(&wipe); @@ -732,12 +734,12 @@ void F_QueuePostWipe(INT16 wipetypepost, wipeflags_t flags, wipe_callback_t call /** Does a crossfade. */ -void F_WipeDoCrossfade(void) +void F_WipeDoCrossfade(INT16 type) { wipe_t wipe = {0}; - wipe.flags = WSF_CROSSFADE | WSF_FADEIN; - wipe.style = WIPESTYLE_NORMAL; - wipe.type = wipedefs[F_GetWipedefIndex()]; + wipe.flags = WSF_CROSSFADE; + wipe.style = F_WipeGetStyle(wipe.flags); + wipe.type = type == DEFAULTWIPE ? wipedefs[F_GetWipedefIndex()] : type; wipe.drawmenuontop = false; F_StartWipeParametrized(&wipe); } diff --git a/src/g_game.c b/src/g_game.c index 892504889..cc105edf2 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -79,7 +79,7 @@ static void G_DoContinued(void); static void G_DoWorldDone(void); static void G_CheckPlayerReborn(void); -static inline void G_TickerEnd(void); +static void G_TickerEnd(void); char mapmusname[7]; // Music name UINT16 mapmusflags; // Track and reset bit @@ -2087,7 +2087,7 @@ static void G_DoLevelFadeIn(void) if (ranspecialwipe == SPECIALWIPE_SSTAGE) flags |= WSF_TOWHITE; wipe_t wipe = {0}; - wipe.style = WIPESTYLE_COLORMAP; + wipe.style = F_WipeGetStyle(wipe.flags); wipe.flags = flags; wipe.type = wipedefs[wipe_level_final]; wipe.drawmenuontop = true; @@ -2180,7 +2180,7 @@ void TitleCard_Run(void) { if (!cv_showhud.value) { - F_WipeDoCrossfade(); + F_WipeDoCrossfade(DEFAULTWIPE); } else { @@ -2563,7 +2563,6 @@ static void G_MarathonTicker(void) void G_Ticker(boolean run) { UINT32 i; - INT32 buf; // Bot players queued for removal for (i = MAXPLAYERS-1; i != UINT32_MAX; i--) @@ -2601,8 +2600,12 @@ void G_Ticker(boolean run) } // Run the title card - if (titlecard.running && (wipe_flags & WSF_FADEIN)) - TitleCard_Run(); + if (titlecard.running) + { + wipe_t *wipe = F_GetQueuedWipe(); + if (wipe && wipe->flags & WSF_FADEIN) + TitleCard_Run(); + } // Run Marathon Mode in-game timer G_MarathonTicker(); @@ -2638,16 +2641,15 @@ void G_Ticker(boolean run) default: I_Error("gameaction = %d\n", gameaction); } - buf = gametic % BACKUPTICS; - // Generate ticcmds for bots FIRST, then copy received ticcmds for players. // This emulates pre-2.2.10 behaviour where the bot referenced their leader's last copied ticcmd, // which is desirable because P_PlayerThink can override inputs (e.g. while PF_STASIS is applied or in a waterslide), // and the bot AI needs to respect that. -#define ISHUMAN (players[i].bot == BOT_NONE || players[i].bot == BOT_2PHUMAN) + INT32 buf = gametic % BACKUPTICS; + for (i = 0; i < MAXPLAYERS; i++) { - if (playeringame[i] && !ISHUMAN) // Less work is required if we're building a bot ticcmd. + if (playeringame[i] && !P_IsHuman(&players[i])) // Less work is required if we're building a bot ticcmd. { players[i].lastbuttons = players[i].cmd.buttons; // Save last frame's button readings B_BuildTiccmd(&players[i], &players[i].cmd); @@ -2660,7 +2662,7 @@ void G_Ticker(boolean run) for (i = 0; i < MAXPLAYERS; i++) { - if (playeringame[i] && ISHUMAN) + if (playeringame[i] && P_IsHuman(&players[i])) { players[i].lastbuttons = players[i].cmd.buttons; // Save last frame's button readings G_CopyTiccmd(&players[i].cmd, &netcmds[buf][i], 1); @@ -2677,7 +2679,6 @@ void G_Ticker(boolean run) players[i].cmd.angleturn = (players[i].angleturn & ~TICCMD_RECEIVED) | (players[i].cmd.angleturn & TICCMD_RECEIVED); } } -#undef ISHUMAN // do main actions switch (gamestate) @@ -2776,7 +2777,7 @@ void G_Ticker(boolean run) G_TickerEnd(); } -static inline void G_TickerEnd(void) +static void G_TickerEnd(void) { if (pausedelay && pausedelay != INT32_MIN) { @@ -3562,9 +3563,7 @@ void G_DoReborn(INT32 playernum) P_ClearStarPost(players[i].starpostnum); } - // Do a wipe - // TODO should be done after rendering - F_WipeDoCrossfade(); + F_WipeDoCrossfade(DEFAULTWIPE); if (camera.chase) P_ResetCamera(&players[displayplayer], &camera); diff --git a/src/hardware/hw_drv.h b/src/hardware/hw_drv.h index f8556849e..1c4cd99ab 100644 --- a/src/hardware/hw_drv.h +++ b/src/hardware/hw_drv.h @@ -58,7 +58,7 @@ EXPORT INT32 HWRAPI(GetTextureUsed) (void); EXPORT void HWRAPI(FlushScreenTextures) (void); EXPORT void HWRAPI(StartScreenWipe) (void); -EXPORT void HWRAPI(EndScreenWipe) (boolean restore); +EXPORT void HWRAPI(EndScreenWipe) (void); EXPORT void HWRAPI(DoScreenWipe) (void); EXPORT void HWRAPI(DrawIntermissionBG) (void); EXPORT void HWRAPI(MakeScreenTexture) (void); diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index f8e22318d..4e3ff432b 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -6924,10 +6924,10 @@ void HWR_StartScreenWipe(void) HWD.pfnStartScreenWipe(); } -void HWR_EndScreenWipe(boolean restore) +void HWR_EndScreenWipe(void) { //CONS_Debug(DBG_RENDER, "In HWR_EndScreenWipe()\n"); - HWD.pfnEndScreenWipe(restore); + HWD.pfnEndScreenWipe(); } void HWR_DrawIntermissionBG(void) diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index d2353e66f..cce4e8f0a 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -58,7 +58,7 @@ void transform(float *cx, float *cy, float *cz); INT32 HWR_GetTextureUsed(void); void HWR_DoPostProcessor(player_t *player); void HWR_StartScreenWipe(void); -void HWR_EndScreenWipe(boolean restore); +void HWR_EndScreenWipe(void); void HWR_DrawIntermissionBG(void); void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum); void HWR_DoTintedWipe(UINT8 wipenum, UINT8 scrnnum); diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 47a2851e9..a59d67bc3 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -3242,7 +3242,7 @@ EXPORT void HWRAPI(StartScreenWipe) (void) } // Create Screen to fade to -EXPORT void HWRAPI(EndScreenWipe)(boolean restore) +EXPORT void HWRAPI(EndScreenWipe)(void) { INT32 texsize = 2048; boolean firstTime = (endScreenWipe == 0); @@ -3270,10 +3270,6 @@ EXPORT void HWRAPI(EndScreenWipe)(boolean restore) pglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texsize, texsize); tex_downloaded = endScreenWipe; - - // Draw the start screen wipe texture - if (restore) - DrawScreenTexture(startScreenWipe); } // Draw the last scene under the intermission diff --git a/src/p_local.h b/src/p_local.h index 84a0aace0..448272ce9 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -147,6 +147,7 @@ void P_ForceLocalAngle(player_t *player, angle_t angle); boolean P_PlayerFullbright(player_t *player); boolean P_PlayerCanEnterSpinGaps(player_t *player); boolean P_PlayerShouldUseSpinHeight(player_t *player); +boolean P_IsHuman(player_t *player); UINT16 P_GetPlayerColor(player_t *player); boolean P_IsObjectInGoop(mobj_t *mo); diff --git a/src/p_setup.c b/src/p_setup.c index 7779510a8..e1ba78e7e 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -7541,14 +7541,14 @@ void P_RunSpecialStageWipe(void) if (RESETMUSIC || strnicmp(S_MusicName(), (mapmusflags & MUSIC_RELOADRESET) ? mapheaderinfo[gamemap - 1]->musname : mapmusname, 7)) - S_FadeOutStopMusic(MUSICRATE/4); //FixedMul(FixedDiv(F_GetWipeLength(wipedefs[wipe_speclevel_towhite])*NEWTICRATERATIO, NEWTICRATE), MUSICRATE) + S_FadeOutStopMusic(MUSICRATE/4); if (titlemapinaction || F_GetQueuedWipe()) return; wipe_t wipe = {0}; - wipe.style = WIPESTYLE_COLORMAP; wipe.flags = WSF_TOWHITE; + wipe.style = F_WipeGetStyle(wipe.flags); wipe.callback = G_DoLoadLevel; wipe.type = wipedefs[wipe_speclevel_towhite]; wipe.drawmenuontop = false; @@ -7562,8 +7562,8 @@ void P_RunLevelWipe(void) return; wipe_t wipe = {0}; - wipe.style = WIPESTYLE_COLORMAP; wipe.flags = 0; + wipe.style = F_WipeGetStyle(wipe.flags); wipe.callback = G_DoLoadLevel; wipe.type = wipedefs[wipe_level_toblack]; wipe.drawmenuontop = false; @@ -7945,8 +7945,8 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) if (ranspecialwipe == SPECIALWIPE_RETRY) { wipe_t wipe = {0}; - wipe.style = WIPESTYLE_COLORMAP; wipe.flags = WSF_TOWHITE | WSF_FADEIN; + wipe.style = F_WipeGetStyle(wipe.flags); wipe.type = wipedefs[wipe_level_final]; wipe.drawmenuontop = true; F_StartWipeParametrized(&wipe); diff --git a/src/p_user.c b/src/p_user.c index 0c21a1cc1..e8c37b7c7 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -13235,6 +13235,14 @@ boolean P_PlayerShouldUseSpinHeight(player_t *player) || JUMPCURLED(player)); } +boolean P_IsHuman(player_t *player) +{ + if (!player) + return true; + + return player->bot == BOT_NONE || player->bot == BOT_2PHUMAN; +} + UINT16 P_GetPlayerColor(player_t *player) { if (G_GametypeHasTeams() && player->ctfteam) diff --git a/src/y_inter.c b/src/y_inter.c index e69af03ad..e27ccb433 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1363,7 +1363,7 @@ void Y_StartIntermission(void) } usetile = false; - F_WipeDoCrossfade(); + F_WipeDoCrossfade(DEFAULTWIPE); // set up the "got through act" message according to skin name if (stagefailed) @@ -1440,23 +1440,7 @@ void Y_StartIntermission(void) // tile if using the default background usetile = !useinterpic; - F_QueuePreWipe(DEFAULTWIPE, 0, NULL); - F_QueuePostWipe(DEFAULTWIPE, WSF_FADEIN, NULL); - - // get special stage specific patches -/* if (!stagefailed && ALL7EMERALDS(emeralds)) - { - data.spec.cemerald = W_CachePatchName("GOTEMALL", PU_PATCH); - data.spec.headx = 70; - data.spec.nowsuper = players[consoleplayer].skin - ? NULL : W_CachePatchName("NOWSUPER", PU_PATCH); - } - else - { - data.spec.cemerald = W_CachePatchName("CEMERALD", PU_PATCH); - data.spec.headx = 48; - data.spec.nowsuper = NULL; - } */ + F_DoGenericTransition(); // Super form stuff (normally blank) data.spec.passed3[0] = '\0'; @@ -1532,8 +1516,7 @@ void Y_StartIntermission(void) usetile = true; useinterpic = false; - F_QueuePreWipe(DEFAULTWIPE, 0, NULL); - F_QueuePostWipe(DEFAULTWIPE, WSF_FADEIN, NULL); + F_DoGenericTransition(); break; } @@ -1559,8 +1542,7 @@ void Y_StartIntermission(void) usetile = true; useinterpic = false; - F_QueuePreWipe(DEFAULTWIPE, 0, NULL); - F_QueuePostWipe(DEFAULTWIPE, WSF_FADEIN, NULL); + F_DoGenericTransition(); break; } @@ -1587,8 +1569,7 @@ void Y_StartIntermission(void) usetile = true; useinterpic = false; - F_QueuePreWipe(DEFAULTWIPE, 0, NULL); - F_QueuePostWipe(DEFAULTWIPE, WSF_FADEIN, NULL); + F_DoGenericTransition(); break; } @@ -1614,8 +1595,7 @@ void Y_StartIntermission(void) usetile = true; useinterpic = false; - F_QueuePreWipe(-1, 0, NULL); - F_QueuePostWipe(-1, WSF_FADEIN, NULL); + F_DoGenericTransition(); break; }