projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20060226-3-src
[rocksndiamonds.git]
/
src
/
libgame
/
text.c
diff --git
a/src/libgame/text.c
b/src/libgame/text.c
index 6fd437359014dad05bcacdf93216028f74cab43b..de70abc34c6faeb0289e2330ec0cc0347a9981a1 100644
(file)
--- a/
src/libgame/text.c
+++ b/
src/libgame/text.c
@@
-255,8
+255,11
@@
void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text,
struct FontBitmapInfo *font = &gfx.font_bitmap_info[font_bitmap_id];
int font_width = getFontWidth(font_nr);
int font_height = getFontHeight(font_nr);
struct FontBitmapInfo *font = &gfx.font_bitmap_info[font_bitmap_id];
int font_width = getFontWidth(font_nr);
int font_height = getFontHeight(font_nr);
+ int border_1 = gfx.sx + gfx.sxsize;
+ int border_2 = gfx.dx + gfx.dxsize;
Bitmap *src_bitmap;
int src_x, src_y;
Bitmap *src_bitmap;
int src_x, src_y;
+ int dst_x_start = dst_x;
char *text_ptr = text;
if (font->bitmap == NULL)
char *text_ptr = text;
if (font->bitmap == NULL)
@@
-275,6
+278,11
@@
void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text,
getFontCharSource(font_nr, c, &src_bitmap, &src_x, &src_y);
getFontCharSource(font_nr, c, &src_bitmap, &src_x, &src_y);
+ /* make sure that text does not run off the screen at the right side */
+ if ((dst_x_start < border_1 && dst_x + font_width > border_1) ||
+ (dst_x_start < border_2 && dst_x + font_width > border_2))
+ break;
+
if (mask_mode == BLIT_INVERSE) /* special mode for text gadgets */
{
/* first step: draw solid colored rectangle (use "cursor" character) */
if (mask_mode == BLIT_INVERSE) /* special mode for text gadgets */
{
/* first step: draw solid colored rectangle (use "cursor" character) */