- implemented subtitle display for Blackbird's voiceover messages.

This commit is contained in:
Christoph Oelckers 2019-05-19 12:16:13 +02:00
commit 04334aa0fe
8 changed files with 41 additions and 5 deletions

View file

@ -84,6 +84,7 @@ EXTERN_CVAR (Bool, am_showtotaltime)
EXTERN_CVAR (Bool, noisedebug)
EXTERN_CVAR (Int, con_scaletext)
EXTERN_CVAR(Bool, vid_fps)
EXTERN_CVAR(Bool, inter_subtitles)
CVAR(Int, hud_scale, 0, CVAR_ARCHIVE);
@ -1216,7 +1217,8 @@ void DBaseStatusBar::DrawLog ()
FFont *font = C_GetDefaultHUDFont();
int linelen = hudwidth<640? Scale(hudwidth,9,10)-40 : 560;
auto lines = V_BreakLines (font, linelen, CPlayer->LogText[0] == '$'? GStrings(CPlayer->LogText.GetChars()+1) : CPlayer->LogText.GetChars());
const FString & text = (inter_subtitles && CPlayer->SubtitleCounter) ? CPlayer->SubtitleText : CPlayer->LogText;
auto lines = V_BreakLines (font, linelen, text[0] == '$'? GStrings(text.GetChars()+1) : text.GetChars());
int height = 20;
for (unsigned i = 0; i < lines.Size(); i++) height += font->GetHeight ();
@ -1232,7 +1234,7 @@ void DBaseStatusBar::DrawLog ()
else
{
x=(hudwidth>>1)-300;
y=hudheight*3/10-(height>>1);
y=hudheight/8-(height>>1);
if (y<0) y=0;
w=600;
}
@ -1242,7 +1244,7 @@ void DBaseStatusBar::DrawLog ()
y+=10;
for (const FBrokenLines &line : lines)
{
screen->DrawText (font, CR_UNTRANSLATED, x, y, line.Text,
screen->DrawText (font, CPlayer->SubtitleCounter? CR_CYAN : CR_UNTRANSLATED, x, y, line.Text,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE);
y += font->GetHeight ();
@ -1321,7 +1323,7 @@ void DBaseStatusBar::DrawTopStuff (EHudState state)
DrawConsistancy ();
DrawWaiting ();
if (ShowLog && MustDrawLog(state)) DrawLog ();
if ((ShowLog && MustDrawLog(state)) || (inter_subtitles && CPlayer->SubtitleCounter > 0)) DrawLog ();
if (noisedebug)
{