From: Holger Schemel Date: Sun, 5 Nov 2017 17:25:30 +0000 (+0100) Subject: fixed bug with invisible initial fonts X-Git-Tag: 4.1.0.0~68 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=72b5ebcb15f3d2c9a30733c4fafffd7b0e7a1d9c;p=rocksndiamonds.git fixed bug with invisible initial fonts - this bug was introduced by the commit with the following message: "added support for font definitions with different character offset and size" (no commit ID given here due to frequent use of "git rebase") --- diff --git a/src/init.c b/src/init.c index cf83e504..b0043d49 100644 --- a/src/init.c +++ b/src/init.c @@ -552,13 +552,9 @@ void InitFontGraphicInfo() font_bitmap_info[font_bitmap_id].height = graphic_info[graphic].height; font_bitmap_info[font_bitmap_id].offset_x = - (graphic_info[graphic].offset_x != 0 ? - graphic_info[graphic].offset_x : - graphic_info[graphic].width); + graphic_info[graphic].offset_x; font_bitmap_info[font_bitmap_id].offset_y = - (graphic_info[graphic].offset_y != 0 ? - graphic_info[graphic].offset_y : - graphic_info[graphic].height); + graphic_info[graphic].offset_y; font_bitmap_info[font_bitmap_id].draw_xoffset = graphic_info[graphic].draw_xoffset; diff --git a/src/libgame/text.c b/src/libgame/text.c index e7765fc6..c7d8499b 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -101,10 +101,12 @@ void getFontCharSource(int font_nr, char c, Bitmap **bitmap, int *x, int *y) int font_bitmap_id = gfx.select_font_function(font_nr); struct FontBitmapInfo *font = &gfx.font_bitmap_info[font_bitmap_id]; int font_pos = getFontCharPosition(font_nr, c); + int offset_x = (font->offset_x != 0 ? font->offset_x : font->width); + int offset_y = (font->offset_y != 0 ? font->offset_y : font->height); *bitmap = font->bitmap; - *x = font->src_x + (font_pos % font->num_chars_per_line) * font->offset_x; - *y = font->src_y + (font_pos / font->num_chars_per_line) * font->offset_y; + *x = font->src_x + (font_pos % font->num_chars_per_line) * offset_x; + *y = font->src_y + (font_pos / font->num_chars_per_line) * offset_y; }