From af35be5bb6d426756e8a5427e55e11fb392e2a62 Mon Sep 17 00:00:00 2001 From: Misa Date: Tue, 28 Nov 2023 18:56:25 -0800 Subject: [PATCH] Name conditionals in text box loop With the recent change to drawing overlays (images and sprites) from PR #1058, it's starting to get a bit hairy. This names the conditionals responsible for determining if the text box is transparent (checking that all of its RGB is 0) and if overlays should be drawn or not (which is now either when it's opaque or transparent). --- desktop_version/src/Graphics.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 2d12ea85..0c722130 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -853,7 +853,6 @@ void Graphics::drawgui(void) { int text_yoff; int yp; - bool opaque; int font_height = font::height(textboxes[i].print_flags); if (flipmode) { @@ -872,7 +871,9 @@ void Graphics::drawgui(void) char buffer[SCREEN_WIDTH_CHARS + 1]; - if (textboxes[i].r == 0 && textboxes[i].g == 0 && textboxes[i].b == 0) + const bool transparent = (textboxes[i].r | textboxes[i].g | textboxes[i].b) == 0; + + if (transparent) { /* To avoid the outlines for different lines overlapping the text itself, * first draw all the outlines and then draw the text. */ @@ -937,9 +938,10 @@ void Graphics::drawgui(void) } } - opaque = textboxes[i].tl >= 1.0; + const bool opaque = textboxes[i].tl >= 1.0; + const bool draw_overlays = opaque || transparent; - if (!opaque && textboxes[i].r != 0 && textboxes[i].g != 0 && textboxes[i].b != 0) + if (!draw_overlays) { continue; }