X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Ftext.c;h=0974481a785548081f20af77278c0e45ffc3fb03;hb=bfc32a480c54857e24987e9f38d12cd5139dde4b;hp=e7765fc68282ee2582894df215a379548ececc2c;hpb=3f5f1e9af1b0c10a0b0486c579c55c5e6947807d;p=rocksndiamonds.git diff --git a/src/libgame/text.c b/src/libgame/text.c index e7765fc6..0974481a 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; } @@ -112,14 +114,16 @@ void getFontCharSource(int font_nr, char c, Bitmap **bitmap, int *x, int *y) /* text string helper functions */ /* ========================================================================= */ -int maxWordLengthInString(char *text) +int maxWordLengthInRequestString(char *text) { char *text_ptr; int word_len = 0, max_word_len = 0; for (text_ptr = text; *text_ptr; text_ptr++) { - word_len = (*text_ptr != ' ' ? word_len + 1 : 0); + word_len = (*text_ptr != ' ' && + *text_ptr != '?' && + *text_ptr != '!' ? word_len + 1 : 0); max_word_len = MAX(word_len, max_word_len); }