From 8ffb8dca7d7981ab22d35105a70da8073eb671b9 Mon Sep 17 00:00:00 2001 From: LoboEire <67418208+LoboEire@users.noreply.github.com> Date: Sun, 8 Dec 2024 01:10:34 +0100 Subject: [PATCH] Rough autoscaling for intermission texts For those texts that are just too many lines to fit on screen. --- source_files/edge/f_finale.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/source_files/edge/f_finale.cc b/source_files/edge/f_finale.cc index dbef44f6f..a225ffa23 100644 --- a/source_files/edge/f_finale.cc +++ b/source_files/edge/f_finale.cc @@ -435,6 +435,28 @@ static void TextWrite(void) h = h * txtscale; } + //Autoscale if there are too many lines of text to fit onscreen + float TempHeight = StringLines(finale_text) * h; + if (TempHeight > 200) + { + //Too big, need to scale + float TempScale = 1.0f; + + TempScale = 200.0f / TempHeight; + txtscale = TempScale; + HUDSetScale(txtscale); + + //Need to recalculate this + h = 11; // set a default + if (style->fonts_[t_type]) + { + HUDSetFont(style->fonts_[t_type]); + h = style->fonts_[t_type]->NominalHeight(); + h = h + (3 * txtscale); // bit of spacing + h = h * txtscale; + } + } + int cy = h; char line[200];