From 2df3cb90d7fd9df40088f1886b98d167e66cc696 Mon Sep 17 00:00:00 2001 From: Ivan Mogilko Date: Sun, 12 Jan 2025 00:42:51 +0300 Subject: [PATCH] Engine: in create_textual_image() moved text color set out of a loop --- Engine/ac/display.cpp | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/Engine/ac/display.cpp b/Engine/ac/display.cpp index 88d2d4df29f..fb5e7bca0dd 100644 --- a/Engine/ac/display.cpp +++ b/Engine/ac/display.cpp @@ -261,24 +261,32 @@ Bitmap *create_textual_image(const char *text, DisplayTextStyle style, color_t t &ttxleft, &ttxtop, &adjustedXX, &adjustedYY, &wii, &text_color, 0, usingGui); } - for (size_t ee = 0; ee= 0) && + ((game.options[OPT_SPEECHTYPE] >= 2) || (isThought))) + text_color = text_window_ds->GetCompatibleColor(guis[usingGui].FgColor); + else + text_color = text_window_ds->GetCompatibleColor(text_color); + } + else + { + text_color = text_window_ds->GetCompatibleColor(text_color); + } + + // Print the lines of text + for (size_t i = 0; i < Lines.Count(); ++i) + { + int ttyp = ttxtop + i * disp.Linespacing; // if it's inside a text box then don't centre the text if (style == kDisplayTextStyle_TextWindow) { - if ((usingGui >= 0) && - ((game.options[OPT_SPEECHTYPE] >= 2) || (isThought))) - text_color = text_window_ds->GetCompatibleColor(guis[usingGui].FgColor); - else - text_color = text_window_ds->GetCompatibleColor(text_color); - - wouttext_aligned(text_window_ds, ttxleft, ttyp, oriwid, usingfont, text_color, Lines[ee].GetCStr(), play.text_align); + wouttext_aligned(text_window_ds, ttxleft, ttyp, oriwid, usingfont, text_color, Lines[i].GetCStr(), play.text_align); } else { - text_color = text_window_ds->GetCompatibleColor(text_color); - wouttext_aligned(text_window_ds, ttxleft, ttyp, wii, usingfont, text_color, Lines[ee].GetCStr(), play.speech_text_align); + wouttext_aligned(text_window_ds, ttxleft, ttyp, wii, usingfont, text_color, Lines[i].GetCStr(), play.speech_text_align); } } } @@ -291,8 +299,8 @@ Bitmap *create_textual_image(const char *text, DisplayTextStyle style, color_t t adjust_y_coordinate_for_text(&yoffs, usingfont); - for (size_t ee = 0; ee