From fab8fed8df40162dac28523a20335dc019f152ef Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 27 Feb 2019 22:51:39 +0100 Subject: [PATCH] - reformat the intermission screen if the text is very long. This will ensure better visibility on widescreen displays, at least. --- src/intermission/intermission.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index e9eb6855d3..8c6bc5afd4 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -248,6 +248,7 @@ void DIntermissionScreenFader::Drawer () void DIntermissionScreenText::Init(FIntermissionAction *desc, bool first) { + bool usesDefault = mTextX < 0; Super::Init(desc, first); mText = static_cast(desc)->mText; if (mText[0] == '$') mText = GStrings(&mText[1]); @@ -256,6 +257,16 @@ void DIntermissionScreenText::Init(FIntermissionAction *desc, bool first) if (mTextX < 0) mTextX =gameinfo.TextScreenX; mTextY = static_cast(desc)->mTextY; if (mTextY < 0) mTextY =gameinfo.TextScreenY; + + // If the text is too wide, center it so that it works better on widescreen displays. + // On 4:3 it'd still be cut off, though. + int width = SmallFont->StringWidth(mText); + if (usesDefault && mTextX + width > 320 - mTextX) + { + mTextX = (320 - width) / 2; + } + + mTextLen = (int)mText.CharacterCount(); mTextDelay = static_cast(desc)->mTextDelay; mTextColor = static_cast(desc)->mTextColor;