From 5232fc378bd7ecfdc1e34d24feb2b058fcea1800 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Wed, 9 Jul 2014 18:05:34 +0100 Subject: [PATCH] Trying to use the gfx wrap functions. --- src/gfx.h | 1 + src/window_game_bottom_toolbar.c | 6 ++++++ src/window_tooltip.c | 4 +++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gfx.h b/src/gfx.h index f82ae27d02..a259a76bbf 100644 --- a/src/gfx.h +++ b/src/gfx.h @@ -64,6 +64,7 @@ extern int gLastDrawStringY; int gfx_load_g1(); void gfx_load_character_widths(); +int gfx_wrap_string(char* buffer, int width, int* num_lines, int* font_height); void gfx_clear(rct_drawpixelinfo *dpi, int colour); void gfx_draw_pixel(rct_drawpixelinfo *dpi, int x, int y, int colour); void gfx_draw_line(rct_drawpixelinfo *dpi, int x1, int y1, int x2, int y2, int colour); diff --git a/src/window_game_bottom_toolbar.c b/src/window_game_bottom_toolbar.c index 73ad07b02c..79d2a2f83d 100644 --- a/src/window_game_bottom_toolbar.c +++ b/src/window_game_bottom_toolbar.c @@ -250,6 +250,12 @@ static void window_game_bottom_toolbar_tooltip() tool_tip_index = 0; break; } + +#ifdef _MSC_VER + __asm mov ax, tool_tip_index +#else + __asm__("mov ax, %[tool_tip_index] " :[tool_tip_index] "+m" (tool_tip_index)); +#endif } /** diff --git a/src/window_tooltip.c b/src/window_tooltip.c index fc8ebbb22f..a84c03e407 100644 --- a/src/window_tooltip.c +++ b/src/window_tooltip.c @@ -24,6 +24,7 @@ #include "string_ids.h" #include "widget.h" #include "window.h" +#include "gfx.h" enum { WIDX_BACKGROUND @@ -127,7 +128,8 @@ void window_tooltip_open(rct_window *widgetWindow, int widgetIndex, int x, int y esi = 0x0141ED68; edi = ecx + 1; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224; - RCT2_CALLFUNC_X(0x006C21E2, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp); + ecx = gfx_wrap_string((char*) 0x0141ED68, ecx + 1, &edi, &ebx); + //RCT2_CALLFUNC_X(0x006C21E2, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp); ecx &= 0xFFFF; edi &= 0xFFFF;