mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Interpolate captions
This commit is contained in:
parent
c2aa6d4c74
commit
8cf6e8252c
2 changed files with 12 additions and 6 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)
|
||||
|
|
16
src/screen.c
16
src/screen.c
|
@ -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*10);
|
||||
y = (basey-(i*10)) * FRACUNIT;
|
||||
|
||||
if (closedcaptions[i].b)
|
||||
{
|
||||
y -= closedcaptions[i].b * 4;
|
||||
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