diff --git a/projects/openrct2.vcxproj.user b/projects/openrct2.vcxproj.user index 1846f60e7b..42ca88b12a 100644 --- a/projects/openrct2.vcxproj.user +++ b/projects/openrct2.vcxproj.user @@ -4,7 +4,7 @@ $(TargetDir) WindowsLocalDebugger $(TargetDir)\openrct2.exe - screenshot "C:\Program Files (x86)\Infogrames\RollerCoaster Tycoon 2\Scenarios\Six Flags Magic Mountain.SC6" "test.png" 1920 1080 + screenshot "C:\GOG Games\RollerCoaster Tycoon 2 Triple Thrill Pack\Scenarios\Six Flags Magic Mountain.SC6" "test.png" 16000 8000 c c 0 0 false diff --git a/src/editor.c b/src/editor.c index b51cd723f2..ada8445aa8 100644 --- a/src/editor.c +++ b/src/editor.c @@ -598,7 +598,7 @@ static void editor_finalise_main_view() w->saved_view_y -= viewport->view_height >> 1; window_invalidate(w); - sub_69E9A7(); + reset_all_sprite_quadrant_placements(); scenery_set_default_placement_configuration(); window_new_ride_init_vars(); RCT2_GLOBAL(0x009DEB7C, uint16) = 0; diff --git a/src/game.c b/src/game.c index aa7834491e..7923bcff6d 100644 --- a/src/game.c +++ b/src/game.c @@ -705,7 +705,7 @@ int game_load_save(const char *path) mainWindow->saved_view_y -= mainWindow->viewport->view_height >> 1; window_invalidate(mainWindow); - sub_69E9A7(); + reset_all_sprite_quadrant_placements(); scenery_set_default_placement_configuration(); window_new_ride_init_vars(); RCT2_GLOBAL(0x009DEB7C, uint16) = 0; @@ -722,8 +722,9 @@ int game_load_save(const char *path) /* * * rct2: 0x0069E9A7 + * Call after a rotation or loading of a save to reset sprite quadrants */ -void sub_69E9A7() +void reset_all_sprite_quadrant_placements() { for (rct_sprite* spr = g_sprite_list; spr < (rct_sprite*)RCT2_ADDRESS_SPRITES_NEXT_INDEX; spr++) if (spr->unknown.sprite_identifier != 0xFF) diff --git a/src/game.h b/src/game.h index 2b2e4cf914..9a07a8dcc1 100644 --- a/src/game.h +++ b/src/game.h @@ -97,7 +97,7 @@ void game_reduce_game_speed(); void game_create_windows(); void game_update(); void game_logic_update(); -void sub_69E9A7(); +void reset_all_sprite_quadrant_placements(); void update_palette_effects(); int game_do_command(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp); diff --git a/src/interface/screenshot.c b/src/interface/screenshot.c index 21674bc123..2ded7156c1 100644 --- a/src/interface/screenshot.c +++ b/src/interface/screenshot.c @@ -392,7 +392,7 @@ int cmdline_for_screenshot(const char **argv, int argc) customY = (mapSize / 2) * 32 + 16; int x, y; - int z = map_element_height(customX, customY); + int z = map_element_height(customX, customY) & 0xFFFF; switch (customRotation) { case 0: x = customY - customX; @@ -417,6 +417,8 @@ int cmdline_for_screenshot(const char **argv, int argc) viewport.zoom = customZoom; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8) = customRotation; + + reset_all_sprite_quadrant_placements(); } else { viewport.view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16) - (viewport.view_width / 2); viewport.view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16) - (viewport.view_height / 2); diff --git a/src/interface/viewport.c b/src/interface/viewport.c index 74a03069e8..dea4b08741 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -821,7 +821,7 @@ void sub_0x6736FC(rct_litter* litter, int ebx, int edx){ * Paint Quadrant * rct2: 0x0069E8B0 */ -void sub_0x69E8B0(uint32 eax, uint32 ecx){ +void sub_0x69E8B0(uint16 eax, uint16 ecx){ uint32 _eax = eax, _ecx = ecx; rct_drawpixelinfo* dpi; @@ -1231,36 +1231,42 @@ void sub_68B35F(int ax, int cx) void sub_0x68B6C2(){ rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); sint16 ax, bx, cx, dx; + uint16 num_vertical_quadrants = 0; + rct_xy16 mapTile; switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)){ case 0: - ax = dpi->y; - bx = dpi->x; + mapTile.x = dpi->x & 0xFFE0; + mapTile.y = (dpi->y - 16) & 0xFFE0; + + bx = mapTile.x / 2; + mapTile.x = mapTile.y - bx; + mapTile.y = mapTile.y + bx; - ax -= 16; - bx &= 0xFFE0; - ax &= 0xFFE0; - bx >>= 1; - cx = ax; - ax -= bx; - cx += bx; - ax &= 0xFFE0; - cx &= 0xFFE0; - dx = dpi->height; - dx += 2128; - dx >>= 5; - for (int i = dx; i > 0; --i){ - sub_68B35F(ax, cx); - sub_0x69E8B0(ax, cx); - cx += 0x20; - ax -= 0x20; - sub_0x69E8B0(ax, cx); - ax += 0x20; - sub_68B35F(ax, cx); - sub_0x69E8B0(ax, cx); - ax += 0x20; - cx -= 0x20; - sub_0x69E8B0(ax, cx); - cx += 0x20; + mapTile.x &= 0xFFE0; + mapTile.y &= 0xFFE0; + + num_vertical_quadrants = (dpi->height + 2128) / 32; + + for (; num_vertical_quadrants > 0; --num_vertical_quadrants){ + sub_68B35F(mapTile.x, mapTile.y); + sub_0x69E8B0(mapTile.x, mapTile.y); + + mapTile.x -= 32; + mapTile.y += 32; + + sub_0x69E8B0(mapTile.x, mapTile.y); + + mapTile.x += 32; + + sub_68B35F(mapTile.x, mapTile.y); + sub_0x69E8B0(mapTile.x, mapTile.y); + + mapTile.x += 32; + mapTile.y -= 32; + + sub_0x69E8B0(mapTile.x, mapTile.y); + + mapTile.y += 32; } break; case 1: @@ -1513,8 +1519,8 @@ void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, in left &= bitmask; top &= bitmask; - RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, uint16) = left; - RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_Y, uint16) = top; + RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, sint16) = left; + RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_Y, sint16) = top; RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_WIDTH, uint16) = width; RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_HEIGHT, uint16) = height; @@ -1522,11 +1528,11 @@ void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, in RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_PITCH, uint16) = (dpi->width + dpi->pitch) - width; - int x = (sint16)(left - (sint16)(viewport->view_x & bitmask)); + sint16 x = (sint16)(left - (sint16)(viewport->view_x & bitmask)); x >>= viewport->zoom; x += viewport->x; - int y = (sint16)(top - (sint16)(viewport->view_y & bitmask)); + sint16 y = (sint16)(top - (sint16)(viewport->view_y & bitmask)); y >>= viewport->zoom; y += viewport->y; @@ -1534,16 +1540,16 @@ void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, in RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_BITS_PTR, uint8*) = bits_pointer; rct_drawpixelinfo* dpi2 = RCT2_ADDRESS(RCT2_ADDRESS_VIEWPORT_DPI, rct_drawpixelinfo); - dpi2->y = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_Y, uint16); + dpi2->y = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_Y, sint16); dpi2->height = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_HEIGHT, uint16); dpi2->zoom_level = (uint8)RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_ZOOM, uint16); //Splits the screen into 32 pixel columns and renders them. - for (x = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, uint16) & 0xFFFFFFE0; - x < RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, uint16) + RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_WIDTH, uint16); + for (x = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, sint16) & 0xFFFFFFE0; + x < RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, sint16) + RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_WIDTH, uint16); x += 32){ - int start_x = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, uint16); + int start_x = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, sint16); int width_col = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_WIDTH, uint16); bits_pointer = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_BITS_PTR, uint8*); int pitch = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_PITCH, uint16); diff --git a/src/interface/window.c b/src/interface/window.c index 03fac892cb..0c79b4257a 100644 --- a/src/interface/window.c +++ b/src/interface/window.c @@ -1220,7 +1220,7 @@ void window_rotate_camera(rct_window *w) window_invalidate(w); sub_688956(); - sub_69E9A7(); + reset_all_sprite_quadrant_placements(); } /** diff --git a/src/scenario.c b/src/scenario.c index 69c7742e6d..4fdae3f241 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -248,7 +248,7 @@ int scenario_load_and_play_from_path(const char *path) mainWindow->saved_view_y -= mainWindow->viewport->view_height >> 1; window_invalidate(mainWindow); - sub_69E9A7(); + reset_all_sprite_quadrant_placements(); window_new_ride_init_vars(); // Set the scenario pseduo-random seeds diff --git a/src/title.c b/src/title.c index a747336f5c..411ff5c612 100644 --- a/src/title.c +++ b/src/title.c @@ -203,7 +203,7 @@ static void title_update_showcase() } window_invalidate(w); - sub_69E9A7(); + reset_all_sprite_quadrant_placements(); window_new_ride_init_vars(); sub_684AC3(); scenery_set_default_placement_configuration();