diff --git a/src/drawing/drawing.c b/src/drawing/drawing.c index 5d573c2467..85a41e0f9c 100644 --- a/src/drawing/drawing.c +++ b/src/drawing/drawing.c @@ -500,6 +500,22 @@ void gfx_invalidate_pickedup_peep() } } +void gfx_draw_pickedup_peep() +{ + if (RCT2_GLOBAL(0x009ABDF2, uint8) == 0) + return; + + // Draw picked-up peep + if (RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, uint32) != 0xFFFFFFFF) { + gfx_draw_sprite( + (rct_drawpixelinfo*)RCT2_ADDRESS_SCREEN_DPI, + RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, uint32), + RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_X, sint16), + RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_Y, sint16), 0 + ); + } +} + void sub_681DE2(rct_drawpixelinfo *dpi, int x, int y, int image1, int image2) { RCT2_CALLPROC_X(0x00681DE2, 0, image1, x, y, 0, (int)dpi, image2); diff --git a/src/drawing/drawing.h b/src/drawing/drawing.h index c00d051747..6da2217523 100644 --- a/src/drawing/drawing.h +++ b/src/drawing/drawing.h @@ -94,6 +94,7 @@ void gfx_draw_rain(int left, int top, int width, int height, sint32 x_start, sin void gfx_clear(rct_drawpixelinfo *dpi, int colour); void gfx_draw_pixel(rct_drawpixelinfo *dpi, int x, int y, int colour); void gfx_invalidate_pickedup_peep(); +void gfx_draw_pickedup_peep(); // line void gfx_draw_line(rct_drawpixelinfo *dpi, int x1, int y1, int x2, int y2, int colour); diff --git a/src/drawing/rain.c b/src/drawing/rain.c index b1660e5fb6..cfae4449f2 100644 --- a/src/drawing/rain.c +++ b/src/drawing/rain.c @@ -155,16 +155,6 @@ void update_rain_animation() if (RCT2_GLOBAL(0x009ABDF2, uint8) == 0) return; - // Draw picked-up peep - if (RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, uint32) != 0xFFFFFFFF) { - gfx_draw_sprite( - (rct_drawpixelinfo*)RCT2_ADDRESS_SCREEN_DPI, - RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, uint32), - RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_X, sint16), - RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_Y, sint16), 0 - ); - } - // Get rain draw function and draw rain uint32 draw_rain_func = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_RAIN_LEVEL, uint8); if (draw_rain_func > 0 && !(RCT2_GLOBAL(0x009DEA6F, uint8) & 1)) diff --git a/src/game.c b/src/game.c index 021efd0df4..a54de0effc 100644 --- a/src/game.c +++ b/src/game.c @@ -325,7 +325,6 @@ void game_logic_update() peep_update_crowd_noise(); climate_update_sound(); editor_open_windows_for_current_step(); - gfx_invalidate_pickedup_peep(); // Update windows //window_dispatch_update_all(); diff --git a/src/interface/window.c b/src/interface/window.c index 66b34b756c..76f93c12f0 100644 --- a/src/interface/window.c +++ b/src/interface/window.c @@ -178,6 +178,7 @@ void window_update_all() gfx_draw_all_dirty_blocks(); window_update_all_viewports(); + gfx_draw_all_dirty_blocks(); // 1000 tick update RCT2_GLOBAL(0x009DEB7C, sint16) += RCT2_GLOBAL(0x009DE588, sint16); diff --git a/src/openrct2.c b/src/openrct2.c index a64cbef838..4778d89e2a 100644 --- a/src/openrct2.c +++ b/src/openrct2.c @@ -187,7 +187,7 @@ bool openrct2_initialise() title_sequences_load_presets(); // Hooks to allow RCT2 to call OpenRCT2 functions instead - addhook(0x006E732D, (int)gfx_set_dirty_blocks, 0, (int[]){ EAX, EBX, EDX, EBP, END }, 0); // remove after all drawing is decompiled + addhook(0x006E732D, (int)gfx_set_dirty_blocks, 0, (int[]){ EAX, EBX, EDX, EBP, END }, 0); // remove when all callers are decompiled addhook(0x006E7499, (int)gfx_redraw_screen_rect, 0, (int[]){ EAX, EBX, EDX, EBP, END }, 0); // remove when 0x6E7FF3 is decompiled addhook(0x006B752C, (int)ride_crash, 0, (int[]){ EDX, EBX, END }, 0); // remove when all callers are decompiled addhook(0x0069A42F, (int)peep_window_state_update, 0, (int[]){ ESI }, 0); // remove when all callers are decompiled diff --git a/src/rct2.c b/src/rct2.c index a9c5a9a39e..ccc67b8837 100644 --- a/src/rct2.c +++ b/src/rct2.c @@ -218,9 +218,10 @@ void rct2_draw() { redraw_rain(); window_update_all(); + gfx_invalidate_pickedup_peep(); + gfx_draw_pickedup_peep(); update_rain_animation(); update_palette_effects(); - gfx_draw_all_dirty_blocks(); console_draw(RCT2_ADDRESS(RCT2_ADDRESS_SCREEN_DPI, rct_drawpixelinfo));