From: Holger Schemel Date: Fri, 3 Jun 2016 17:04:31 +0000 (+0200) Subject: fixed bug with wrong high score list width when using font draw offsets X-Git-Tag: 4.0.0.0-rc3~21 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=e304657d0ac135b0b20bc046b1bc530b1c6b0a87;p=rocksndiamonds.git fixed bug with wrong high score list width when using font draw offsets --- diff --git a/src/libgame/text.c b/src/libgame/text.c index aa71f15b..eb755ba5 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -59,6 +59,20 @@ int getFontHeight(int font_nr) return gfx.font_bitmap_info[font_bitmap_id].height; } +int getFontDrawOffsetX(int font_nr) +{ + int font_bitmap_id = gfx.select_font_function(font_nr); + + return gfx.font_bitmap_info[font_bitmap_id].draw_xoffset; +} + +int getFontDrawOffsetY(int font_nr) +{ + int font_bitmap_id = gfx.select_font_function(font_nr); + + return gfx.font_bitmap_info[font_bitmap_id].draw_yoffset; +} + int getTextWidth(char *text, int font_nr) { return (text != NULL ? strlen(text) * getFontWidth(font_nr) : 0); diff --git a/src/libgame/text.h b/src/libgame/text.h index b4f37f45..0a45204e 100644 --- a/src/libgame/text.h +++ b/src/libgame/text.h @@ -83,6 +83,8 @@ struct FontBitmapInfo *getFontBitmapInfo(int); int getFontWidth(int); int getFontHeight(int); +int getFontDrawOffsetX(int); +int getFontDrawOffsetY(int); int getTextWidth(char *, int); void getFontCharSource(int, char, Bitmap **, int *, int *); diff --git a/src/screens.c b/src/screens.c index 12fa2331..4802015c 100644 --- a/src/screens.c +++ b/src/screens.c @@ -4186,9 +4186,10 @@ static void drawHallOfFameList(int first_entry, int highlight_position) int font_nr2 = (active ? FONT_TEXT_2_ACTIVE : FONT_TEXT_2); int font_nr3 = (active ? FONT_TEXT_3_ACTIVE : FONT_TEXT_3); int font_nr4 = (active ? FONT_TEXT_4_ACTIVE : FONT_TEXT_4); + int dxoff = getFontDrawOffsetX(font_nr1); int dx1 = 3 * getFontWidth(font_nr1); int dx2 = dx1 + getFontWidth(font_nr1); - int dx3 = SXSIZE - 2 * (mSX - SX) - 5 * getFontWidth(font_nr4); + int dx3 = SXSIZE - 2 * (mSX - SX + dxoff) - 5 * getFontWidth(font_nr4); int num_dots = (dx3 - dx2) / getFontWidth(font_nr3); int sy = mSY + 64 + i * 32;