- 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

@ -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;
}