fix invalidation issue with picked up staff

This commit is contained in:
zsilencer 2015-07-10 21:01:58 -06:00
parent a58458bbb3
commit e8d8f7c684
5 changed files with 24 additions and 18 deletions

View File

@ -454,22 +454,9 @@ void gfx_draw_rain(int left, int top, int width, int height, sint32 x_start, sin
*
* rct2: 0x006843DC
*/
void redraw_peep_and_rain()
void redraw_rain()
{
if (RCT2_GLOBAL(0x009ABDF2, uint32) != 0) {
int sprite = RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, sint32);
if (sprite != -1) {
sprite = sprite & 0x7FFFF;
rct_g1_element *g1_elements = &g1Elements[sprite];
int left = RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_X, sint16) + g1_elements->x_offset;
int top = RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_Y, sint16) + g1_elements->y_offset;
int right = left + g1_elements->width;
int bottom = top + g1_elements->height;
gfx_set_dirty_blocks(left, top, right, bottom);
}
int rain_no_pixels = RCT2_GLOBAL(RCT2_ADDRESS_NO_RAIN_PIXELS, uint32);
if (rain_no_pixels == 0) {
return;
@ -495,6 +482,24 @@ void redraw_peep_and_rain()
RCT2_GLOBAL(RCT2_ADDRESS_NO_RAIN_PIXELS, uint32) = 0;
}
void gfx_invalidate_pickedup_peep()
{
if (RCT2_GLOBAL(0x009ABDF2, uint32) != 0) {
int sprite = RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, sint32);
if (sprite != -1) {
sprite = sprite & 0x7FFFF;
rct_g1_element *g1_elements = &g1Elements[sprite];
int left = RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_X, sint16) + g1_elements->x_offset;
int top = RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_Y, sint16) + g1_elements->y_offset;
int right = left + g1_elements->width;
int bottom = top + g1_elements->height;
gfx_set_dirty_blocks(left, top, right, bottom);
}
}
}
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);

View File

@ -93,6 +93,7 @@ void load_palette();
void gfx_draw_rain(int left, int top, int width, int height, sint32 x_start, sint32 y_start);
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();
// line
void gfx_draw_line(rct_drawpixelinfo *dpi, int x1, int y1, int x2, int y2, int colour);
@ -134,7 +135,7 @@ void sub_6C1F57(rct_drawpixelinfo *dpi, int x, int y, int width, int colour, rct
// rain
void update_rain_animation();
void redraw_peep_and_rain();
void redraw_rain();
// unknown
void sub_681DE2(rct_drawpixelinfo *dpi, int x, int y, int image1, int image2);

View File

@ -325,6 +325,7 @@ 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();

View File

@ -66,7 +66,7 @@ void screenshot_check()
}
RCT2_GLOBAL(0x009A8C29, uint8) &= ~1;
redraw_peep_and_rain();
redraw_rain();
}
}
}

View File

@ -216,8 +216,7 @@ void rct2_update()
void rct2_draw()
{
// Handles picked-up peep and rain redraw
redraw_peep_and_rain();
redraw_rain();
window_update_all();
update_rain_animation();
update_palette_effects();