From 4292109753c35f65eaaddbb212d9b3961380b631 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Wed, 13 Aug 2014 20:47:30 +0100 Subject: [PATCH] Added gfx_invalidate_window --- src/gfx.c | 12 ++++++++++++ src/gfx.h | 3 +++ src/window.c | 4 ++-- src/window_game_top_toolbar.c | 2 +- src/window_peep.c | 2 +- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/gfx.c b/src/gfx.c index 59350e680d..ca67b4e4cf 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -1235,6 +1235,18 @@ void gfx_draw_string_centred(rct_drawpixelinfo *dpi, int format, int x, int y, i } } +/** +* +* rct2: 0x006EB13A +*/ +void gfx_invalidate_window(rct_window* w) +{ + if (!w)return; + int width = w->x + w->width; + int height = w->y + w->height; + gfx_set_dirty_blocks(w->x, w->y, width, height); +} + /** * * rct2: 0x006ED7E5 diff --git a/src/gfx.h b/src/gfx.h index 476f7420ac..0755f84e76 100644 --- a/src/gfx.h +++ b/src/gfx.h @@ -92,6 +92,9 @@ void gfx_draw_all_dirty_blocks(); void gfx_redraw_screen_rect(short left, short top, short right, short bottom); void gfx_invalidate_screen(); +typedef struct rct_window rct_window; +void gfx_invalidate_window(rct_window *w); + void gfx_draw_rain(int left, int top, int width, int height, uint32 x_start, uint32 y_start); rct_drawpixelinfo* clip_drawpixelinfo(rct_drawpixelinfo* dpi, int left, int width, int top, int height); diff --git a/src/window.c b/src/window.c index fe9363d2d4..62a32b1b98 100644 --- a/src/window.c +++ b/src/window.c @@ -924,7 +924,7 @@ void window_zoom_in(rct_window *w) w->saved_view_x += v->view_width >> 1; w->saved_view_y += v->view_height >> 1; - RCT2_CALLPROC_X(0x006EB13A, 0, 0, 0, 0, (int)w, 0, 0); + gfx_invalidate_window(w); } /** @@ -951,7 +951,7 @@ void window_zoom_out(rct_window *w) w->saved_view_x -= width / 2; w->saved_view_y -= height >> 1; - RCT2_CALLPROC_X(0x006EB13A, 0, 0, 0, 0, (int)w, 0, 0); + gfx_invalidate_window(w); } /** diff --git a/src/window_game_top_toolbar.c b/src/window_game_top_toolbar.c index ae7981d55a..b0c37d2687 100644 --- a/src/window_game_top_toolbar.c +++ b/src/window_game_top_toolbar.c @@ -447,7 +447,7 @@ static void window_game_top_toolbar_dropdown() default: return; } - RCT2_CALLPROC_X(0x6EB13A, 0, 0, 0, 0, (int)w, 0, 0); + gfx_invalidate_window(w); } } } diff --git a/src/window_peep.c b/src/window_peep.c index 049a36142b..e9d8c91524 100644 --- a/src/window_peep.c +++ b/src/window_peep.c @@ -161,7 +161,7 @@ void window_peep_open(rct_peep* peep){ } window->page = 0; - RCT2_CALLPROC_X(0x006EB13A, 0, 0, 0, 0, (int)window, 0, 0); + gfx_invalidate_window(window); window->widgets = RCT2_GLOBAL(0x981D0C, rct_widget*); window->enabled_widgets = RCT2_GLOBAL(0x981D3C,uint32);