Merge pull request #593 from mzmiric5/bug_resize-while-rain-crashes-game

fixes #590, prevents crash on resize while raining
This commit is contained in:
Ted John 2014-11-24 22:13:09 +00:00
commit 6a58f6597b
1 changed files with 7 additions and 0 deletions

View File

@ -500,12 +500,19 @@ void redraw_peep_and_rain()
if (rain_no_pixels == 0) {
return;
}
rct_window *window = window_get_main();
uint32 numPixels = window->width * window->height;
uint32 *rain_pixels = RCT2_ADDRESS(RCT2_ADDRESS_RAIN_PIXEL_STORE, uint32);
if (rain_pixels) {
uint8 *screen_pixels = RCT2_ADDRESS(RCT2_ADDRESS_SCREEN_DPI, rct_drawpixelinfo)->bits;
for (int i = 0; i < rain_no_pixels; i++) {
uint32 pixel = rain_pixels[i];
//HACK
if (pixel >> 8 > numPixels) {
log_verbose("Pixel error, skipping rain draw in this frame");
break;
}
screen_pixels[pixel >> 8] = pixel & 0xFF;
}
RCT2_GLOBAL(0x009E2C78, uint32) = 1;