mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-22 03:11:36 +00:00
- implemented subtitles for intermission slideshows.
# Conflicts: # src/d_main.cpp # wadsrc/static/language.csv
This commit is contained in:
parent
0beb8b85bd
commit
1fb5361a82
6 changed files with 111 additions and 3 deletions
|
@ -150,6 +150,7 @@ void D_DoAdvanceDemo ();
|
|||
void D_AddWildFile (TArray<FString> &wadfiles, const char *pattern);
|
||||
void D_LoadWadSettings ();
|
||||
void ParseGLDefs();
|
||||
void DrawFullscreenSubtitle(const char *text);
|
||||
|
||||
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
||||
|
||||
|
@ -246,6 +247,7 @@ gamestate_t wipegamestate = GS_DEMOSCREEN; // can be -1 to force a wipe
|
|||
bool PageBlank;
|
||||
FTexture *Advisory;
|
||||
FTextureID Page;
|
||||
const char *Subtitle;
|
||||
bool nospriterename;
|
||||
FStartupInfo DoomStartupInfo;
|
||||
FString lastIWAD;
|
||||
|
@ -1043,6 +1045,7 @@ void D_DoomLoop ()
|
|||
// Clamp the timer to TICRATE until the playloop has been entered.
|
||||
r_NoInterpolate = true;
|
||||
Page.SetInvalid();
|
||||
Subtitle = nullptr;
|
||||
Advisory = nullptr;
|
||||
|
||||
vid_cursor.Callback();
|
||||
|
@ -1143,7 +1146,11 @@ void D_PageDrawer (void)
|
|||
screen->DrawText (SmallFont, CR_WHITE, 0, 0, "Page graphic goes here", TAG_DONE);
|
||||
}
|
||||
}
|
||||
if (Advisory != NULL)
|
||||
if (Subtitle != nullptr)
|
||||
{
|
||||
DrawFullscreenSubtitle(GStrings[Subtitle]);
|
||||
}
|
||||
if (Advisory != nullptr)
|
||||
{
|
||||
screen->DrawTexture (Advisory, 4, 160, DTA_320x200, true, TAG_DONE);
|
||||
}
|
||||
|
@ -1179,7 +1186,8 @@ void D_DoStrifeAdvanceDemo ()
|
|||
"svox/voc91", "svox/voc92", "svox/voc93", "svox/voc94", "svox/voc95", "svox/voc96"
|
||||
};
|
||||
const char *const *voices = gameinfo.flags & GI_SHAREWARE ? teaserVoices : fullVoices;
|
||||
const char *pagename = NULL;
|
||||
const char *pagename = nullptr;
|
||||
const char *subtitle = nullptr;
|
||||
|
||||
gamestate = GS_DEMOSCREEN;
|
||||
PageBlank = false;
|
||||
|
@ -1218,6 +1226,7 @@ void D_DoStrifeAdvanceDemo ()
|
|||
case 3:
|
||||
pagetic = 7 * TICRATE;
|
||||
pagename = "PANEL1";
|
||||
subtitle = "TXT_SUB_INTRO1";
|
||||
S_Sound (CHAN_VOICE | CHAN_UI, voices[0], 1, ATTN_NORM);
|
||||
// The new Strife teaser has D_FMINTR.
|
||||
// The full retail Strife has D_INTRO.
|
||||
|
@ -1228,30 +1237,35 @@ void D_DoStrifeAdvanceDemo ()
|
|||
case 4:
|
||||
pagetic = 9 * TICRATE;
|
||||
pagename = "PANEL2";
|
||||
subtitle = "TXT_SUB_INTRO2";
|
||||
S_Sound (CHAN_VOICE | CHAN_UI, voices[1], 1, ATTN_NORM);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
pagetic = 12 * TICRATE;
|
||||
pagename = "PANEL3";
|
||||
subtitle = "TXT_SUB_INTRO3";
|
||||
S_Sound (CHAN_VOICE | CHAN_UI, voices[2], 1, ATTN_NORM);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
pagetic = 11 * TICRATE;
|
||||
pagename = "PANEL4";
|
||||
subtitle = "TXT_SUB_INTRO4";
|
||||
S_Sound (CHAN_VOICE | CHAN_UI, voices[3], 1, ATTN_NORM);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
pagetic = 10 * TICRATE;
|
||||
pagename = "PANEL5";
|
||||
subtitle = "TXT_SUB_INTRO5";
|
||||
S_Sound (CHAN_VOICE | CHAN_UI, voices[4], 1, ATTN_NORM);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
pagetic = 16 * TICRATE;
|
||||
pagename = "PANEL6";
|
||||
subtitle = "TXT_SUB_INTRO6";
|
||||
S_Sound (CHAN_VOICE | CHAN_UI, voices[5], 1, ATTN_NORM);
|
||||
break;
|
||||
|
||||
|
@ -1272,7 +1286,15 @@ void D_DoStrifeAdvanceDemo ()
|
|||
if (demosequence == 9 && !(gameinfo.flags & GI_SHAREWARE))
|
||||
demosequence = 10;
|
||||
|
||||
if (pagename != nullptr) Page = TexMan.CheckForTexture(pagename, ETextureType::MiscPatch);
|
||||
if (pagename != nullptr)
|
||||
{
|
||||
Page = TexMan.CheckForTexture(pagename, ETextureType::MiscPatch);
|
||||
Subtitle = subtitle;
|
||||
}
|
||||
else
|
||||
{
|
||||
Subtitle = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -71,6 +71,58 @@ IMPLEMENT_POINTERS_END
|
|||
extern int NoWipe;
|
||||
|
||||
CVAR(Bool, nointerscrollabort, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||
CVAR(Bool, inter_subtitles, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// This also gets used by the title loop.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void DrawFullscreenSubtitle(const char *text)
|
||||
{
|
||||
if (!text || !*text || !inter_subtitles) return;
|
||||
|
||||
// This uses the same scaling as regular HUD messages
|
||||
auto scale = active_con_scaletext(generic_ui);
|
||||
int hudwidth = SCREENWIDTH / scale;
|
||||
int hudheight = SCREENHEIGHT / scale;
|
||||
FFont *font = C_GetDefaultHUDFont();
|
||||
|
||||
int linelen = hudwidth < 640 ? Scale(hudwidth, 9, 10) - 40 : 560;
|
||||
auto lines = V_BreakLines(font, linelen, text);
|
||||
int height = 20;
|
||||
|
||||
for (unsigned i = 0; i < lines.Size(); i++) height += font->GetHeight();
|
||||
|
||||
int x, y, w;
|
||||
|
||||
if (linelen < 560)
|
||||
{
|
||||
x = hudwidth / 20;
|
||||
y = hudheight * 9 / 10 - height;
|
||||
w = hudwidth - 2 * x;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = (hudwidth >> 1) - 300;
|
||||
y = hudheight * 9 / 10 - height;
|
||||
if (y < 0) y = 0;
|
||||
w = 600;
|
||||
}
|
||||
screen->Dim(0, 0.5f, Scale(x, SCREENWIDTH, hudwidth), Scale(y, SCREENHEIGHT, hudheight),
|
||||
Scale(w, SCREENWIDTH, hudwidth), Scale(height, SCREENHEIGHT, hudheight));
|
||||
x += 20;
|
||||
y += 10;
|
||||
for (const FBrokenLines &line : lines)
|
||||
{
|
||||
screen->DrawText(font, CR_UNTRANSLATED, x, y, line.Text,
|
||||
DTA_KeepRatio, true,
|
||||
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE);
|
||||
y += font->GetHeight();
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -152,6 +204,7 @@ void DIntermissionScreen::Init(FIntermissionAction *desc, bool first)
|
|||
mOverlays[i].mPic = TexMan.CheckForTexture(desc->mOverlays[i].mName, ETextureType::MiscPatch);
|
||||
}
|
||||
mTicker = 0;
|
||||
mSubtitle = desc->mSubtitle;
|
||||
}
|
||||
|
||||
|
||||
|
@ -206,6 +259,12 @@ void DIntermissionScreen::Drawer ()
|
|||
screen->DrawTexture (TexMan[mOverlays[i].mPic], mOverlays[i].x, mOverlays[i].y, DTA_320x200, true, TAG_DONE);
|
||||
}
|
||||
if (!mFlatfill) screen->FillBorder (NULL);
|
||||
if (mSubtitle)
|
||||
{
|
||||
const char *sub = mSubtitle.GetChars();
|
||||
if (sub && *sub == '$') sub = GStrings[sub + 1];
|
||||
if (sub) DrawFullscreenSubtitle(sub);
|
||||
}
|
||||
}
|
||||
|
||||
void DIntermissionScreen::OnDestroy()
|
||||
|
|
|
@ -75,6 +75,7 @@ struct FIntermissionAction
|
|||
FString mBackground;
|
||||
FString mPalette;
|
||||
FString mSound;
|
||||
FString mSubtitle;
|
||||
bool mFlatfill;
|
||||
bool mMusicLooping;
|
||||
TArray<FIntermissionPatch> mOverlays;
|
||||
|
@ -162,6 +163,7 @@ class DIntermissionScreen : public DObject
|
|||
protected:
|
||||
int mDuration;
|
||||
FTextureID mBackground;
|
||||
FString mSubtitle;
|
||||
bool mFlatfill;
|
||||
TArray<FIIntermissionPatch> mOverlays;
|
||||
|
||||
|
|
|
@ -150,6 +150,13 @@ bool FIntermissionAction::ParseKey(FScanner &sc)
|
|||
mSound = sc.String;
|
||||
return true;
|
||||
}
|
||||
else if (sc.Compare("Subtitle"))
|
||||
{
|
||||
sc.MustGetToken('=');
|
||||
sc.MustGetToken(TK_StringConst);
|
||||
mSubtitle = sc.String;
|
||||
return true;
|
||||
}
|
||||
else if (sc.Compare("Draw"))
|
||||
{
|
||||
FIntermissionPatch *pat = &mOverlays[mOverlays.Reserve(1)];
|
||||
|
|
|
@ -376,18 +376,21 @@ Intermission Inter_Strife_Good
|
|||
Music = "D_HAPPY"
|
||||
Background = "SS4F1"
|
||||
Sound = "svox/rie01"
|
||||
Subtitle = "$TXT_SUB_GOOD1"
|
||||
Time = 13
|
||||
}
|
||||
Image
|
||||
{
|
||||
Background = "SS4F2"
|
||||
Sound = "svox/bbx01"
|
||||
Subtitle = "$TXT_SUB_GOOD2"
|
||||
Time = 11
|
||||
}
|
||||
Image
|
||||
{
|
||||
Background = "SS4F3"
|
||||
Sound = "svox/bbx02"
|
||||
Subtitle = "$TXT_SUB_GOOD3"
|
||||
Time = 14
|
||||
}
|
||||
Image
|
||||
|
@ -414,18 +417,21 @@ Intermission Inter_Strife_Sad
|
|||
Music = "D_SAD"
|
||||
Background = "SS6F1"
|
||||
Sound = "svox/ss601a"
|
||||
Subtitle = "$TXT_SUB_SAD1"
|
||||
Time = 8
|
||||
}
|
||||
Image
|
||||
{
|
||||
Background = "SS6F2"
|
||||
Sound = "svox/ss602a"
|
||||
Subtitle = "$TXT_SUB_SAD2"
|
||||
Time = 8
|
||||
}
|
||||
Image
|
||||
{
|
||||
Background = "SS6F3"
|
||||
Sound = "svox/ss603a"
|
||||
Subtitle = "$TXT_SUB_SAD3"
|
||||
Time = 9
|
||||
}
|
||||
Wiper
|
||||
|
@ -446,18 +452,21 @@ Intermission Inter_Strife_Lose
|
|||
Music = "D_SAD"
|
||||
Background = "SS5F1"
|
||||
Sound = "svox/ss501b"
|
||||
Subtitle = "$TXT_SUB_BAD1"
|
||||
Time = 11
|
||||
}
|
||||
Image
|
||||
{
|
||||
Background = "SS5F2"
|
||||
Sound = "svox/ss502b"
|
||||
Subtitle = "$TXT_SUB_BAD2"
|
||||
Time = 10
|
||||
}
|
||||
Image
|
||||
{
|
||||
Background = "SS5F3"
|
||||
Sound = "svox/ss503b"
|
||||
Subtitle = "$TXT_SUB_BAD3"
|
||||
Time = 11
|
||||
}
|
||||
Wiper
|
||||
|
@ -484,24 +493,28 @@ Intermission Inter_Strife_MAP03
|
|||
Music = "D_DARK"
|
||||
Background = "SS2F1"
|
||||
Sound = "svox/mac10"
|
||||
Subtitle = "$TXT_SUB_MAP03_1"
|
||||
Time = 9
|
||||
}
|
||||
Image
|
||||
{
|
||||
Background = "SS2F2"
|
||||
Sound = "svox/mac11"
|
||||
Subtitle = "$TXT_SUB_MAP03_2"
|
||||
Time = 10
|
||||
}
|
||||
Image
|
||||
{
|
||||
Background = "SS2F3"
|
||||
Sound = "svox/mac12"
|
||||
Subtitle = "$TXT_SUB_MAP03_3"
|
||||
Time = 12
|
||||
}
|
||||
Image
|
||||
{
|
||||
Background = "SS2F4"
|
||||
Sound = "svox/mac13"
|
||||
Subtitle = "$TXT_SUB_MAP03_4"
|
||||
Time = 17
|
||||
}
|
||||
}
|
||||
|
@ -513,24 +526,28 @@ Intermission Inter_Strife_MAP10
|
|||
Music = "D_DARK"
|
||||
Background = "SS3F1"
|
||||
Sound = "svox/mac16"
|
||||
Subtitle = "$TXT_SUB_MAP10_1"
|
||||
Time = 10
|
||||
}
|
||||
Image
|
||||
{
|
||||
Background = "SS3F2"
|
||||
Sound = "svox/mac17"
|
||||
Subtitle = "$TXT_SUB_MAP10_2"
|
||||
Time = 12
|
||||
}
|
||||
Image
|
||||
{
|
||||
Background = "SS3F3"
|
||||
Sound = "svox/mac18"
|
||||
Subtitle = "$TXT_SUB_MAP10_3"
|
||||
Time = 12
|
||||
}
|
||||
Image
|
||||
{
|
||||
Background = "SS3F4"
|
||||
Sound = "svox/mac19"
|
||||
Subtitle = "$TXT_SUB_MAP10_4"
|
||||
Time = 11
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1444,6 +1444,7 @@ OptionMenu MessageOptions protected
|
|||
Option "$MSGMNU_MESSAGELEVEL", "msg", "MessageLevels"
|
||||
Option "$MSGMNU_DEVELOPER", "developer", "DevMessageLevels"
|
||||
Option "$MSGMNU_CENTERMESSAGES", "con_centernotify", "OnOff"
|
||||
Option "$MSGMNU_SUBTITLES", "inter_subtitles", "OnOff"
|
||||
StaticText " "
|
||||
StaticText "$MSGMNU_MESSAGECOLORS", 1
|
||||
StaticText " "
|
||||
|
|
Loading…
Reference in a new issue