- added ability to specify display duration of subtitles

Duration of sound playback and subtitles display will be synchronized if sound id is specified
For existing Strife messages this works out of the box

https://forum.zdoom.org/viewtopic.php?t=65379
This commit is contained in:
alexey.lysiuk 2019-07-26 10:33:41 +03:00 committed by Christoph Oelckers
commit 222dfd17b7
7 changed files with 10 additions and 9 deletions

View file

@ -289,7 +289,7 @@ public:
void SetLogNumber (int num);
void SetLogText (const char *text);
void SendPitchLimits() const;
void SetSubtitle(int num);
void SetSubtitle(int num, FSoundID soundid);
AActor *mo = nullptr;
uint8_t playerstate = 0;

View file

@ -3196,7 +3196,7 @@ FUNC(LS_SendToCommunicator)
if (it->CheckLocalView())
{
S_StopSound (CHAN_VOICE);
it->player->SetSubtitle(arg0);
it->player->SetSubtitle(arg0, name);
S_Sound (CHAN_VOICE, name, 1, ATTN_NORM);
// Get the message from the LANGUAGE lump.

View file

@ -437,7 +437,7 @@ DEFINE_ACTION_FUNCTION(_PlayerInfo, SetLogText)
return 0;
}
void player_t::SetSubtitle(int num)
void player_t::SetSubtitle(int num, FSoundID soundid)
{
char lumpname[36];
@ -449,7 +449,7 @@ void player_t::SetSubtitle(int num)
if (text != nullptr)
{
SubtitleText = lumpname;
SubtitleCounter = 7 * TICRATE;
SubtitleCounter = soundid == 0 ? 7 * TICRATE : S_GetMSLength(soundid) * TICRATE / 1000;
}
}
@ -457,7 +457,8 @@ DEFINE_ACTION_FUNCTION(_PlayerInfo, SetSubtitleNumber)
{
PARAM_SELF_STRUCT_PROLOGUE(player_t);
PARAM_INT(log);
self->SetSubtitle(log);
PARAM_SOUND(soundid);
self->SetSubtitle(log, soundid);
return 0;
}