diff --git a/src/st_stuff.c b/src/st_stuff.c index 1e738dc5f..8db0d630b 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -117,6 +117,7 @@ void ST_Ticker(boolean run) // 0 is default, any others are special palettes. INT32 st_palette = 0; UINT32 st_translucency = 10; +fixed_t st_fadein = 0; void ST_doPaletteStuff(void) { @@ -1424,6 +1425,35 @@ void ST_DrawServerSplash(boolean timelimited) } } +static fixed_t ST_CalculateFadeIn(player_t *player) +{ + const tic_t length = TICRATE/4; + + if (player->tally.hudSlide != 0) + { + tic_t timer = length - player->tally.hudSlide; + + return ((timer * FRACUNIT) + (FRACUNIT - rendertimefrac)) / length; + } + + tic_t timer = lt_exitticker; + + if (K_CheckBossIntro() == true || G_IsTitleCardAvailable() == false) + { + if (leveltime <= 16) + timer = 0; + else + timer = leveltime-16; + } + + if (timer < length) + { + return ((timer * FRACUNIT) + rendertimefrac) / length; + } + + return FRACUNIT; +} + void ST_Drawer(void) { boolean stagetitle = false; // Decide whether to draw the stage title or not @@ -1479,6 +1509,7 @@ void ST_Drawer(void) for (i = 0; i <= r_splitscreen; i++) { stplyr = &players[displayplayers[i]]; + st_fadein = ST_FadeIn(stplyr); R_SetViewContext(VIEWCONTEXT_PLAYER1 + i); R_InterpolateView(rendertimefrac); // to assist with object tracking ST_overlayDrawer(); diff --git a/src/st_stuff.h b/src/st_stuff.h index c406bdcaf..741e8c013 100644 --- a/src/st_stuff.h +++ b/src/st_stuff.h @@ -87,6 +87,7 @@ boolean ST_SameTeam(player_t *a, player_t *b); extern boolean st_overlay; // sb overlay on or off when fullscreen extern INT32 st_palette; // 0 is default, any others are special palettes. extern UINT32 st_translucency; +extern fixed_t st_fadein; // transitioning value per player, FRACUNIT = fully in view extern lumpnum_t st_borderpatchnum; // patches, also used in intermission diff --git a/src/v_video.cpp b/src/v_video.cpp index 9e679607a..9efcbb90a 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -573,33 +573,14 @@ void V_AdjustXYWithSnap(INT32 *x, INT32 *y, UINT32 options, INT32 dupx, INT32 du if ((options & V_SLIDEIN)) { - const tic_t length = TICRATE/4; - tic_t timer = lt_exitticker; - - if (K_CheckBossIntro() == true || G_IsTitleCardAvailable() == false) - { - if (leveltime <= 16) - timer = 0; - else - timer = leveltime-16; - } - - if (stplyr->tally.hudSlide != 0) - { - timer = length - stplyr->tally.hudSlide; - } - - if (timer < length) + if (st_fadein < FRACUNIT) { if ((options & (V_SNAPTORIGHT|V_SNAPTOLEFT|V_SPLITSCREEN)) != 0) { boolean slidefromright = false; - const INT32 offsetAmount = (screenwidth * FRACUNIT/2) / length; - fixed_t offset = (screenwidth * FRACUNIT/2) - (timer * offsetAmount); - - offset += FixedMul(offsetAmount, renderdeltatics); - offset /= FRACUNIT; + const fixed_t offsetAmount = (screenwidth * FRACUNIT/2); + INT32 offset = (offsetAmount - FixedMul(offsetAmount, st_fadein)) / FRACUNIT; if (r_splitscreen > 1) { @@ -621,11 +602,8 @@ void V_AdjustXYWithSnap(INT32 *x, INT32 *y, UINT32 options, INT32 dupx, INT32 du } else { - const INT32 offsetAmount = (screenheight * FRACUNIT/2) / length; - fixed_t offset = (screenheight * FRACUNIT/2) - (timer * offsetAmount); - - offset += FixedMul(offsetAmount, renderdeltatics); - offset /= FRACUNIT; + const fixed_t offsetAmount = (screenheight * FRACUNIT/2); + INT32 offset = (offsetAmount - FixedMul(offsetAmount, st_fadein)) / FRACUNIT; if (options & V_SNAPTOBOTTOM) {