From 1079748816bbe39aadb3101bccc3d2f9a2f1edc2 Mon Sep 17 00:00:00 2001
From: "p.kosyh"
Date: Mon, 1 Aug 2011 11:05:24 +0000
Subject: [PATCH] scroll fix
---
src/sdl-instead/game.c | 16 ++++++++--------
src/sdl-instead/graphics.c | 6 +++---
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/sdl-instead/game.c b/src/sdl-instead/game.c
index b9eeeaf..6625cf1 100644
--- a/src/sdl-instead/game.c
+++ b/src/sdl-instead/game.c
@@ -2458,11 +2458,11 @@ static void scroll_up(int id, int count)
if (box_isscroll_up(id))
return;
// game_highlight(-1, -1, 0);
- if (game_theme.gfx_mode == GFX_MODE_EMBEDDED)
+// if (game_theme.gfx_mode == GFX_MODE_EMBEDDED)
txt_box_scroll(el_box(id), -(FONT_SZ(game_theme.font_size)) * count);
- else
- for (i = 0; i < count; i++)
- txt_box_prev_line(el_box(id));
+// else
+// for (i = 0; i < count; i++)
+// txt_box_prev_line(el_box(id));
el_clear(id);
el_draw(id);
el_update(id);
@@ -2474,11 +2474,11 @@ static void scroll_down(int id, int count)
if (box_isscroll_down(id))
return;
// game_highlight(-1, -1, 0);
- if (game_theme.gfx_mode == GFX_MODE_EMBEDDED)
+// if (game_theme.gfx_mode == GFX_MODE_EMBEDDED)
txt_box_scroll(el_box(id), (FONT_SZ(game_theme.font_size)) * count);
- else
- for (i = 0; i < count; i++)
- txt_box_next_line(el_box(id));
+// else
+// for (i = 0; i < count; i++)
+// txt_box_next_line(el_box(id));
el_clear(id);
el_draw(id);
el_update(id);
diff --git a/src/sdl-instead/graphics.c b/src/sdl-instead/graphics.c
index 75e9d4e..d9f3f86 100644
--- a/src/sdl-instead/graphics.c
+++ b/src/sdl-instead/graphics.c
@@ -3099,8 +3099,8 @@ void txt_box_scroll_next(textbox_t tbox, int disp)
off = box->off - line->y; /* offset from cur line */
off += disp; /* needed offset */
- while (line->next && off > line->h) {
- off -= line->h;
+ while (line->next && off >= line->next->y - line->y) {
+ off -= (line->next->y - line->y);
line = line->next;
}
box->line = line;
@@ -3122,7 +3122,7 @@ void txt_box_scroll_prev(textbox_t tbox, int disp)
while (line->prev && off < 0) {
line = line->prev;
- off += line->h;
+ off += (line->next->y - line->y);
}
box->line = line;