mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-21 11:21:11 +00:00
Merge branch 'interpolate-captions' into 'next'
Interpolate captions, Untie captions from resolution See merge request STJr/SRB2!1930
This commit is contained in:
commit
7962b243de
2 changed files with 13 additions and 7 deletions
|
@ -513,7 +513,7 @@ void S_StartCaption(sfxenum_t sfx_id, INT32 cnum, UINT16 lifespan)
|
|||
closedcaptions[set].c = ((cnum == -1) ? NULL : &channels[cnum]);
|
||||
closedcaptions[set].s = sfx;
|
||||
closedcaptions[set].t = lifespan;
|
||||
closedcaptions[set].b = 2; // bob
|
||||
closedcaptions[set].b = 3; // bob
|
||||
}
|
||||
|
||||
void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||
|
|
18
src/screen.c
18
src/screen.c
|
@ -552,7 +552,7 @@ void SCR_ClosedCaptions(void)
|
|||
{
|
||||
UINT8 i;
|
||||
boolean gamestopped = (paused || P_AutoPause());
|
||||
INT32 basey = BASEVIDHEIGHT;
|
||||
INT32 basey = BASEVIDHEIGHT - 20;
|
||||
|
||||
if (gamestate != wipegamestate)
|
||||
return;
|
||||
|
@ -572,7 +572,8 @@ void SCR_ClosedCaptions(void)
|
|||
|
||||
for (i = 0; i < NUMCAPTIONS; i++)
|
||||
{
|
||||
INT32 flags, y;
|
||||
INT32 flags;
|
||||
fixed_t y;
|
||||
char dot;
|
||||
boolean music;
|
||||
|
||||
|
@ -585,14 +586,19 @@ void SCR_ClosedCaptions(void)
|
|||
continue;
|
||||
|
||||
flags = V_SNAPTORIGHT|V_SNAPTOBOTTOM|V_ALLOWLOWERCASE;
|
||||
y = basey-((i + 2)*10);
|
||||
y = (basey-(i*10)) * FRACUNIT;
|
||||
|
||||
if (closedcaptions[i].b)
|
||||
{
|
||||
y -= closedcaptions[i].b * vid.dup;
|
||||
if (renderisnewtic)
|
||||
{
|
||||
closedcaptions[i].b--;
|
||||
|
||||
if (closedcaptions[i].b) // If the caption hasn't reached its final destination...
|
||||
{
|
||||
y -= closedcaptions[i].b * 4 * FRACUNIT; // ...move it per tic...
|
||||
y += (rendertimefrac % FRACUNIT) * 4; // ...and interpolate it per frame
|
||||
// We have to modulo it by FRACUNIT, so that it won't be a tic ahead with interpolation disabled
|
||||
// Unlike everything else, captions are (intentionally) interpolated from T to T+1 instead of T-1 to T
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -606,7 +612,7 @@ void SCR_ClosedCaptions(void)
|
|||
else
|
||||
dot = ' ';
|
||||
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH - 20, y, flags,
|
||||
V_DrawRightAlignedStringAtFixed((BASEVIDWIDTH-20) * FRACUNIT, y, flags,
|
||||
va("%c [%s]", dot, (closedcaptions[i].s->caption[0] ? closedcaptions[i].s->caption : closedcaptions[i].s->name)));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue