426 } |
424 } |
427 } |
425 } |
428 |
426 |
429 int GetStringWidth(const char *str) |
427 int GetStringWidth(const char *str) |
430 { |
428 { |
431 int w = -1; |
429 int w = 0; |
432 byte c; |
430 byte c; |
433 int base = _stringwidth_base; |
431 int base = _stringwidth_base; |
434 |
432 for (c = *str; c != '\0'; c = *(++str)) { |
435 for(;;) { |
|
436 c = *str++; |
|
437 if (c == 0) |
|
438 return w; |
|
439 if (c >= ASCII_LETTERSTART) { |
433 if (c >= ASCII_LETTERSTART) { |
440 w += _stringwidth_table[base + c - ASCII_LETTERSTART]; |
434 w += GetCharacterWidth(base + c); |
441 } else { |
435 } else { |
442 if (c == ASCII_SETX) str++; |
436 if (c == ASCII_SETX) str++; |
443 else if (c == ASCII_SETXY) str += 2; |
437 else if (c == ASCII_SETXY) str += 2; |
444 else if (c == ASCII_TINYFONT) base = 224; |
438 else if (c == ASCII_TINYFONT) base = 224; |
445 else if (c == ASCII_BIGFONT) base = 448; |
439 else if (c == ASCII_BIGFONT) base = 448; |
446 } |
440 } |
447 } |
441 } |
|
442 return w; |
448 } |
443 } |
449 |
444 |
450 void DrawFrameRect(int left, int top, int right, int bottom, int ctab, int flags) { |
445 void DrawFrameRect(int left, int top, int right, int bottom, int ctab, int flags) { |
451 byte color_2 = _color_list[ctab].window_color_1a; |
446 byte color_2 = _color_list[ctab].window_color_1a; |
452 byte color_interior = _color_list[ctab].window_color_bga; |
447 byte color_interior = _color_list[ctab].window_color_bga; |
529 if (c >= ASCII_LETTERSTART) { |
524 if (c >= ASCII_LETTERSTART) { |
530 if (x >= dpi->left + dpi->width) goto skip_char; |
525 if (x >= dpi->left + dpi->width) goto skip_char; |
531 if (x + 26 >= dpi->left) { |
526 if (x + 26 >= dpi->left) { |
532 GfxMainBlitter(GetSprite(base + 2 + c - ASCII_LETTERSTART), x, y, 1); |
527 GfxMainBlitter(GetSprite(base + 2 + c - ASCII_LETTERSTART), x, y, 1); |
533 } |
528 } |
534 x += _stringwidth_table[base + c - ' ']; |
529 x += GetCharacterWidth(base + c); |
535 } else if (c == ASCII_NL) { // newline = {} |
530 } else if (c == ASCII_NL) { // newline = {} |
536 x = xo; |
531 x = xo; |
537 y += 10; |
532 y += 10; |
538 if (base != 0) { |
533 if (base != 0) { |
539 y -= 4; |
534 y -= 4; |