From 1aa71cc5a3f6378aa2947b3100257c8d372d964e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 23 Apr 2022 18:30:53 +0200 Subject: [PATCH] - prepared DrawFullscreenSubtitle for script export. This needed to get the font passed as argument and take care of stringtable lookup inside the function. --- src/d_main.cpp | 17 +++++++++-------- src/g_level.cpp | 2 +- src/intermission/intermission.cpp | 9 ++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 9b85b2c95..f1dd12c38 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -167,7 +167,7 @@ void G_BuildTiccmd (ticcmd_t* cmd); void D_DoAdvanceDemo (); void D_LoadWadSettings (); void ParseGLDefs(); -void DrawFullscreenSubtitle(const char *text); +void DrawFullscreenSubtitle(FFont* font, const char *text); void D_Cleanup(); void FreeSBarInfoScript(); void I_UpdateWindowTitle(); @@ -1284,7 +1284,8 @@ void D_PageDrawer (void) } if (Subtitle != nullptr) { - DrawFullscreenSubtitle(GStrings[Subtitle]); + FFont* font = generic_ui ? NewSmallFont : SmallFont; + DrawFullscreenSubtitle(font, GStrings[Subtitle]); } if (Advisory != nullptr) { @@ -1362,7 +1363,7 @@ void D_DoStrifeAdvanceDemo () case 3: pagetic = 7 * TICRATE; pagename = "PANEL1"; - subtitle = "TXT_SUB_INTRO1"; + subtitle = "$TXT_SUB_INTRO1"; S_Sound (CHAN_VOICE, CHANF_UI, voices[0], 1, ATTN_NORM); // The new Strife teaser has D_FMINTR. // The full retail Strife has D_INTRO. @@ -1373,35 +1374,35 @@ void D_DoStrifeAdvanceDemo () case 4: pagetic = 9 * TICRATE; pagename = "PANEL2"; - subtitle = "TXT_SUB_INTRO2"; + subtitle = "$TXT_SUB_INTRO2"; S_Sound (CHAN_VOICE, CHANF_UI, voices[1], 1, ATTN_NORM); break; case 5: pagetic = 12 * TICRATE; pagename = "PANEL3"; - subtitle = "TXT_SUB_INTRO3"; + subtitle = "$TXT_SUB_INTRO3"; S_Sound (CHAN_VOICE, CHANF_UI, voices[2], 1, ATTN_NORM); break; case 6: pagetic = 11 * TICRATE; pagename = "PANEL4"; - subtitle = "TXT_SUB_INTRO4"; + subtitle = "$TXT_SUB_INTRO4"; S_Sound (CHAN_VOICE, CHANF_UI, voices[3], 1, ATTN_NORM); break; case 7: pagetic = 10 * TICRATE; pagename = "PANEL5"; - subtitle = "TXT_SUB_INTRO5"; + subtitle = "$TXT_SUB_INTRO5"; S_Sound (CHAN_VOICE, CHANF_UI, voices[4], 1, ATTN_NORM); break; case 8: pagetic = 16 * TICRATE; pagename = "PANEL6"; - subtitle = "TXT_SUB_INTRO6"; + subtitle = "$TXT_SUB_INTRO6"; S_Sound (CHAN_VOICE, CHANF_UI, voices[5], 1, ATTN_NORM); break; diff --git a/src/g_level.cpp b/src/g_level.cpp index eb3c882a9..456778158 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -942,7 +942,7 @@ DIntermissionController* FLevelLocals::CreateIntermission() void RunIntermission(DIntermissionController* intermissionScreen, DObject* statusScreen, std::function completionf) { - runner = CreateRunner(); + runner = CreateRunner(false); GC::WriteBarrier(runner); completion = std::move(completionf); diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index 6bd9d44ce..2cffde500 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -92,15 +92,15 @@ DEFINE_ACTION_FUNCTION(_Screen, GetTextScreenSize) // //========================================================================== -void DrawFullscreenSubtitle(const char *text) +void DrawFullscreenSubtitle(FFont* font, const char *text) { if (!text || !*text || !inter_subtitles) return; + if (*text == '$') text = GStrings[text + 1]; // This uses the same scaling as regular HUD messages auto scale = active_con_scaletext(twod, generic_ui); int hudwidth = twod->GetWidth() / scale; int hudheight = twod->GetHeight() / scale; - FFont *font = generic_ui? NewSmallFont : SmallFont; int linelen = hudwidth < 640 ? Scale(hudwidth, 9, 10) - 40 : 560; auto lines = V_BreakLines(font, linelen, text); @@ -246,9 +246,8 @@ void DIntermissionScreen::Drawer () if (CheckOverlay(i)) DrawTexture(twod, TexMan.GetGameTexture(mOverlays[i].mPic), mOverlays[i].x, mOverlays[i].y, DTA_320x200, true, TAG_DONE); } - const char *sub = mSubtitle.GetChars(); - if (sub && *sub == '$') sub = GStrings[sub + 1]; - if (sub) DrawFullscreenSubtitle(sub); + FFont* font = generic_ui ? NewSmallFont : SmallFont; + DrawFullscreenSubtitle(font, mSubtitle); } void DIntermissionScreen::OnDestroy()