mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-17 23:21:22 +00:00
Support captions for player 2 in 2-player. (You can't tell which screen the sounds are coming from without visual cues normally, so there isn't two seperate caption lists.)
This commit is contained in:
parent
dd566b77b9
commit
314870bdc2
2 changed files with 68 additions and 5 deletions
|
@ -531,6 +531,64 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
|||
sep = (~sep) & 255;
|
||||
#endif
|
||||
|
||||
// Handle closed caption input.
|
||||
if (cv_closedcaptioning.value && sfx->caption[0] != '/')
|
||||
{
|
||||
UINT8 i, set = NUMCAPTIONS-1, moveup = 255;
|
||||
boolean same = false;
|
||||
for (i = 0; i < set; i++)
|
||||
{
|
||||
same = ((sfx == closedcaptions[i].s) || (closedcaptions[i].s && fastcmp(sfx->caption, closedcaptions[i].s->caption)));
|
||||
if (same)
|
||||
{
|
||||
set = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!same)
|
||||
{
|
||||
for (i = 0; i < set; i++)
|
||||
{
|
||||
if (!(closedcaptions[i].c || closedcaptions[i].s) || (sfx->priority >= closedcaptions[i].s->priority))
|
||||
{
|
||||
set = i;
|
||||
if (closedcaptions[i].s && (sfx->priority >= closedcaptions[i].s->priority))
|
||||
moveup = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = NUMCAPTIONS-1; i > set; i--)
|
||||
{
|
||||
if (sfx == closedcaptions[i].s)
|
||||
{
|
||||
closedcaptions[i].c = NULL;
|
||||
closedcaptions[i].s = NULL;
|
||||
closedcaptions[i].t = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (moveup != 255)
|
||||
{
|
||||
for (i = moveup; i < NUMCAPTIONS-1; i++)
|
||||
{
|
||||
if (!(closedcaptions[i].c || closedcaptions[i].s))
|
||||
break;
|
||||
}
|
||||
for (; i > set; i--)
|
||||
{
|
||||
closedcaptions[i].c = closedcaptions[i-1].c;
|
||||
closedcaptions[i].s = closedcaptions[i-1].s;
|
||||
closedcaptions[i].t = closedcaptions[i-1].t;
|
||||
}
|
||||
}
|
||||
|
||||
closedcaptions[set].c = &channels[cnum];
|
||||
closedcaptions[set].s = sfx;
|
||||
closedcaptions[set].t = TICRATE+2;
|
||||
}
|
||||
|
||||
// Assigns the handle to one of the channels in the
|
||||
// mix/output buffer.
|
||||
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority);
|
||||
|
|
|
@ -477,6 +477,8 @@ void SCR_ClosedCaptions(void)
|
|||
{
|
||||
const mobj_t *o = (const mobj_t *)closedcaptions[i].c->origin;
|
||||
if (o)
|
||||
{
|
||||
if (!splitscreen)
|
||||
{
|
||||
angle_t angle = R_PointToAngle(o->x, o->y) - localangle;
|
||||
if (angle > ANGLE_45 && angle < ANGLE_135)
|
||||
|
@ -486,6 +488,9 @@ void SCR_ClosedCaptions(void)
|
|||
else
|
||||
dir = '\x1E';
|
||||
}
|
||||
else
|
||||
dir = '\x1E';
|
||||
}
|
||||
}
|
||||
V_DrawRightAlignedString(vid.width-(20*vid.dupx), y,
|
||||
flags, va("%c [%s]", dir, (closedcaptions[i].s->caption[0] ? closedcaptions[i].s->caption : closedcaptions[i].s->name)));
|
||||
|
|
Loading…
Reference in a new issue