mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-29 12:40:58 +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;
|
sep = (~sep) & 255;
|
||||||
#endif
|
#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
|
// Assigns the handle to one of the channels in the
|
||||||
// mix/output buffer.
|
// mix/output buffer.
|
||||||
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority);
|
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority);
|
||||||
|
|
15
src/screen.c
15
src/screen.c
|
@ -478,11 +478,16 @@ void SCR_ClosedCaptions(void)
|
||||||
const mobj_t *o = (const mobj_t *)closedcaptions[i].c->origin;
|
const mobj_t *o = (const mobj_t *)closedcaptions[i].c->origin;
|
||||||
if (o)
|
if (o)
|
||||||
{
|
{
|
||||||
angle_t angle = R_PointToAngle(o->x, o->y) - localangle;
|
if (!splitscreen)
|
||||||
if (angle > ANGLE_45 && angle < ANGLE_135)
|
{
|
||||||
dir = '\x1C';
|
angle_t angle = R_PointToAngle(o->x, o->y) - localangle;
|
||||||
else if (angle > ANGLE_225 && angle < ANGLE_315)
|
if (angle > ANGLE_45 && angle < ANGLE_135)
|
||||||
dir = '\x1D';
|
dir = '\x1C';
|
||||||
|
else if (angle > ANGLE_225 && angle < ANGLE_315)
|
||||||
|
dir = '\x1D';
|
||||||
|
else
|
||||||
|
dir = '\x1E';
|
||||||
|
}
|
||||||
else
|
else
|
||||||
dir = '\x1E';
|
dir = '\x1E';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue