From 2130c85e9094a9188a3240f8e868f83a776f8643 Mon Sep 17 00:00:00 2001 From: Marco Costa Date: Thu, 17 Jul 2014 23:29:39 -0400 Subject: [PATCH 1/2] Implemented draw_rain_animation Implemented the first level of the rain drawing routine. Still not sure what the parameter means, so I keep its register name. --- src/game.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/game.c b/src/game.c index 65b25027f6..9ded791c29 100644 --- a/src/game.c +++ b/src/game.c @@ -69,6 +69,32 @@ void update_water_animation() RCT2_CALLPROC_EBPSAFE(0x006838BD); } +/** +* +* rct2: 0x00684266 +*/ +void draw_rain_animation(uint32 eax) +{ + RCT2_GLOBAL(0x00EE7850, uint32) = eax; + + rct_drawpixelinfo *screenDPI = RCT2_ADDRESS(RCT2_ADDRESS_SCREEN_DPI, rct_drawpixelinfo); + + short ax = screenDPI->x; + short bx = screenDPI->y; + short dx = screenDPI->width; + short bp = screenDPI->height; + + dx += ax; + bp += bx; + + rct_window* g_window_list = RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_LIST, rct_window); + rct_window* newWindow = (RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*)); + + for (rct_window* esi = g_window_list; esi < newWindow; esi++) { + RCT2_CALLPROC_X(0x006842AF, ax, bx, 0, dx, (int)esi, 0, bp); + } +} + /** * * rct2: 0x00684218 @@ -91,7 +117,7 @@ void update_rain_animation() // Get rain draw function and draw rain uint32 eax = RCT2_ADDRESS(0x009AC058, uint32)[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_RAIN_LEVEL, uint8)]; if (eax != 0xFFFFFFFF && !(RCT2_GLOBAL(0x009DEA6F, uint8) & 1)) - RCT2_CALLPROC_X(0x00684266, eax, 0, 0, 0, 0, 0, 0); + draw_rain_animation(eax); } void game_update() From a13da0f7eccbd44fb3745fd53f3d2f3c3b6efe88 Mon Sep 17 00:00:00 2001 From: Marco Costa Date: Fri, 18 Jul 2014 19:36:06 -0400 Subject: [PATCH 2/2] Rename variables in draw_rain_animation Renamed variables to better represent their meaning. Use global g_window_list instead of manually fetching it. --- src/game.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/game.c b/src/game.c index 9ded791c29..50039681ce 100644 --- a/src/game.c +++ b/src/game.c @@ -78,20 +78,15 @@ void draw_rain_animation(uint32 eax) RCT2_GLOBAL(0x00EE7850, uint32) = eax; rct_drawpixelinfo *screenDPI = RCT2_ADDRESS(RCT2_ADDRESS_SCREEN_DPI, rct_drawpixelinfo); + short left = screenDPI->x; + short right = left + screenDPI->width; + short top = screenDPI->y; + short bottom = top + screenDPI->height; - short ax = screenDPI->x; - short bx = screenDPI->y; - short dx = screenDPI->width; - short bp = screenDPI->height; - - dx += ax; - bp += bx; - - rct_window* g_window_list = RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_LIST, rct_window); rct_window* newWindow = (RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*)); - for (rct_window* esi = g_window_list; esi < newWindow; esi++) { - RCT2_CALLPROC_X(0x006842AF, ax, bx, 0, dx, (int)esi, 0, bp); + for (rct_window* w = g_window_list; w < newWindow; w++) { + RCT2_CALLPROC_X(0x006842AF, left, top, 0, right, (int)w, 0, bottom); } }