diff --git a/src/drawing/string.c b/src/drawing/string.c index fb1337b814..0321f3454a 100644 --- a/src/drawing/string.c +++ b/src/drawing/string.c @@ -128,6 +128,12 @@ int gfx_clip_string(utf8 *text, int width) utf8 *clipCh = text; int codepoint; while ((codepoint = utf8_get_next(ch, &nextCh)) != 0) { + if (utf8_is_format_code(codepoint)) { + ch = nextCh; + ch += utf8_get_format_code_arg_length(codepoint); + continue; + } + for (int i = 0; i < 4; i++) { backup[i] = nextCh[i]; }; for (int i = 0; i < 3; i++) { nextCh[i] = '.'; } nextCh[3] = 0; @@ -175,9 +181,9 @@ int gfx_wrap_string(utf8 *text, int width, int *outNumLines, int *outFontHeight) utf8 *ch = text; utf8 *firstCh = text; - utf8 *lastCh; + utf8 *nextCh; int codepoint; - while ((codepoint = utf8_get_next(ch, &lastCh)) != 0) { + while ((codepoint = utf8_get_next(ch, &nextCh)) != 0) { if (codepoint == ' ') { currentWord = ch; currentWidth = lineWidth; @@ -189,15 +195,19 @@ int gfx_wrap_string(utf8 *text, int width, int *outNumLines, int *outFontHeight) currentWord = NULL; firstCh = ch; continue; + } else if (utf8_is_format_code(codepoint)) { + ch = nextCh; + ch += utf8_get_format_code_arg_length(codepoint); + continue; } - uint8 saveCh = *lastCh; - *lastCh = 0; + uint8 saveCh = *nextCh; + *nextCh = 0; lineWidth = gfx_get_string_width(firstCh); - *lastCh = saveCh; + *nextCh = saveCh; if (lineWidth <= width) { - ch = lastCh; + ch = nextCh; } else if (currentWord == NULL) { // Single word is longer than line, insert null terminator ch += utf8_insert_codepoint(ch, 0); diff --git a/src/input.c b/src/input.c index c5f49fb870..7a816fe9a3 100644 --- a/src/input.c +++ b/src/input.c @@ -959,7 +959,7 @@ void process_mouse_over(int x, int y) int ebx, esi, edi, ebp; cursorId = CURSOR_ARROW; - RCT2_GLOBAL(0x9A9808, sint16) = -1; + RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS, sint16) = -1; window = window_find_from_point(x, y); if (window != NULL) { diff --git a/src/windows/map_tooltip.c b/src/windows/map_tooltip.c index a4dc5695c2..a7fc768074 100644 --- a/src/windows/map_tooltip.c +++ b/src/windows/map_tooltip.c @@ -151,5 +151,5 @@ static void window_map_tooltip_paint(rct_window *w, rct_drawpixelinfo *dpi) if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS, rct_string_id) == (rct_string_id)STR_NONE) return; - gfx_draw_string_centred_wrapped(dpi, (void*)0x009A9808, w->x + (w->width / 2), w->y + (w->height / 2), w->width, 1162, 0); + gfx_draw_string_centred_wrapped(dpi, (void*)RCT2_ADDRESS_MAP_TOOLTIP_ARGS, w->x + (w->width / 2), w->y + (w->height / 2), w->width, 1162, 0); } \ No newline at end of file