From f954b602db07260bd38d957ea728d6ab70b3a518 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 14 Oct 2024 23:23:42 +0200 Subject: [PATCH] added first and last visible line to wrapped text structure --- src/libgame/text.c | 4 ++++ src/libgame/text.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/libgame/text.c b/src/libgame/text.c index 88a9c248..0f1c05f9 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -768,6 +768,8 @@ int DrawWrappedText(int x, int y, struct WrappedTextInfo *wrapped_text, int star if (start_pos >= wrapped_text->num_lines) return 0; + wrapped_text->line_visible_first = start_pos; + for (i = start_pos; i < wrapped_text->num_lines; i++) { int font_nr = wrapped_text->line[i].font_nr; @@ -786,6 +788,8 @@ int DrawWrappedText(int x, int y, struct WrappedTextInfo *wrapped_text, int star current_line++; } + wrapped_text->line_visible_last = start_pos + current_line - 1; + return current_line; } diff --git a/src/libgame/text.h b/src/libgame/text.h index 06b2a439..2beecb18 100644 --- a/src/libgame/text.h +++ b/src/libgame/text.h @@ -111,6 +111,8 @@ struct WrappedTextInfo // internal info for processing lines int line_width, cut_length, max_height; int line_spacing, mask_mode; + int line_visible_first; + int line_visible_last; }; -- 2.34.1