mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-10 01:52:33 +00:00
V_AdjustXYWithSnap: refactor V_SLIDEIN, separate timer calculation, fix interpolation
- Move timer calculation to ST_CalculateFadeIn, cache in st_fadein - Fix interpolation by using rendertimefrac instead of renderdeltatics
This commit is contained in:
parent
eeda1b3ad5
commit
653db93022
3 changed files with 37 additions and 27 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue