+ else if (IN_GFX_DOOR_2(x, y))
+ redraw_mask |= REDRAW_DOOR_2;
+ else if (IN_GFX_DOOR_3(x, y))
+ redraw_mask |= REDRAW_DOOR_3;
+ else
+ redraw_mask |= REDRAW_ALL;
+}
+
+void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text,
+ int font_nr, int mask_mode)
+{
+ struct FontBitmapInfo *font = getFontBitmapInfo(font_nr);
+ int font_width = getFontWidth(font_nr);
+ int font_height = getFontHeight(font_nr);
+ Bitmap *src_bitmap;
+ int src_x, src_y;
+ char *text_ptr = text;
+
+ if (font->bitmap == NULL)
+ return;
+
+ /* skip text to be printed outside the window (left/right will be clipped) */
+ if (dst_y < 0 || dst_y + font_height > video.height)
+ return;
+
+ /* add offset for drawing font characters */
+ dst_x += font->draw_xoffset;
+ dst_y += font->draw_yoffset;
+
+ while (*text_ptr)
+ {
+ char c = *text_ptr++;
+
+ if (c == '\n')
+ c = ' '; /* print space instead of newline */
+
+ getFontCharSource(font_nr, c, &src_bitmap, &src_x, &src_y);
+
+ /* clip text at the left side of the window */
+ if (dst_x < 0)
+ {
+ dst_x += font_width;
+
+ continue;
+ }
+
+ /* clip text at the right side of the window */
+ if (dst_x + font_width > video.width)
+ break;
+
+ if (mask_mode == BLIT_INVERSE) /* special mode for text gadgets */
+ {
+ /* first step: draw solid colored rectangle (use "cursor" character) */
+ if (strlen(text) == 1) /* only one char inverted => draw cursor */
+ {
+ Bitmap *cursor_bitmap;
+ int cursor_x, cursor_y;
+
+ getFontCharSource(font_nr, FONT_ASCII_CURSOR, &cursor_bitmap,
+ &cursor_x, &cursor_y);
+
+ BlitBitmap(cursor_bitmap, dst_bitmap, cursor_x, cursor_y,
+ font_width, font_height, dst_x, dst_y);
+ }
+
+ /* second step: draw masked inverted character */
+ SDLCopyInverseMasked(src_bitmap, dst_bitmap, src_x, src_y,
+ font_width, font_height, dst_x, dst_y);
+ }
+ else if (mask_mode == BLIT_MASKED || mask_mode == BLIT_ON_BACKGROUND)
+ {
+ if (mask_mode == BLIT_ON_BACKGROUND)
+ {
+ /* clear font character background */
+ ClearRectangleOnBackground(dst_bitmap, dst_x, dst_y,
+ font_width, font_height);
+ }
+
+ BlitBitmapMasked(src_bitmap, dst_bitmap, src_x, src_y,
+ font_width, font_height, dst_x, dst_y);
+ }
+ else /* normal, non-masked font blitting */
+ {
+ BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y,
+ font_width, font_height, dst_x, dst_y);
+ }
+
+ dst_x += font_width;
+ }