From: Holger Schemel Date: Sat, 2 Oct 2021 12:41:52 +0000 (+0200) Subject: fixed drawing initial header and item text to screen X-Git-Tag: 4.3.0.0~24 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=b926e47e037013dece14e987b3e6b9fffe05e304;p=rocksndiamonds.git fixed drawing initial header and item text to screen This commit partially reverts and fixes commit 6c9f59b4, removing a speed bottleneck introduced by that commit, while keeping the fix from that commit that should prevent not displaying the first of a series of items displayed together with a header text. --- diff --git a/src/libgame/text.c b/src/libgame/text.c index 117c9b1c..17475e8c 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -136,8 +136,12 @@ int maxWordLengthInRequestString(char *text) // simple text drawing functions // ============================================================================ -void DrawInitText(char *text, int ypos, int font_nr) +static void DrawInitTextExt(char *text, int ypos, int font_nr, boolean update) { + LimitScreenUpdates(TRUE); + + UPDATE_BUSY_STATE(); + if (window != NULL && gfx.draw_init_text && gfx.num_fonts > 0 && @@ -151,28 +155,24 @@ void DrawInitText(char *text, int ypos, int font_nr) ClearRectangle(drawto, 0, y, width, height); DrawTextExt(drawto, x, y, text, font_nr, BLIT_OPAQUE); - BlitBitmap(drawto, window, 0, 0, video.width, video.height, 0, 0); + if (update) + BlitBitmap(drawto, window, 0, 0, video.width, video.height, 0, 0); } } -void DrawInitTextHead(char *text) +void DrawInitText(char *text, int ypos, int font_nr) { - // always draw headlines when loading initial stuff - LimitScreenUpdates(FALSE); - - UPDATE_BUSY_STATE(); + DrawInitTextExt(text, ypos, font_nr, FALSE); +} - DrawInitText(text, 120, FC_GREEN); +void DrawInitTextHead(char *text) +{ + DrawInitTextExt(text, 120, FC_GREEN, FALSE); } void DrawInitTextItem(char *text) { - // limit drawing (potentially many) loading items - LimitScreenUpdates(TRUE); - - UPDATE_BUSY_STATE(); - - DrawInitText(text, 150, FC_YELLOW); + DrawInitTextExt(text, 150, FC_YELLOW, TRUE); } void DrawTextF(int x, int y, int font_nr, char *format, ...)