From d47f758b0e285d4ce46aa55c8be19ed02a34a300 Mon Sep 17 00:00:00 2001 From: Olivier Wervers Date: Wed, 4 Oct 2017 14:51:48 +0200 Subject: [PATCH] Fix #6118, #6245, #6366: Tracked animated vehicles not animating --- distribution/changelog.txt | 1 + src/openrct2/ride/vehicle.h | 4 ++-- src/openrct2/ride/vehicle_paint.c | 21 ++++++++++++++------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index caafbef200..34696693a6 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -17,6 +17,7 @@ - Fix: [#5788] Empty scenario names cause invisible entries in scenario list. - Fix: [#6101] Rides remain in ride list window briefly after demolition. - Fix: [#6115] Random title screen music not random on launch. +- Fix: [#6118, #6245, #6366] Tracked animated vehicles not animating. - Fix: [#6133] Construction rights not shown after selecting buy mode. - Fix: [#6188] Viewports not being clipped properly when zoomed out in OpenGL mode. - Fix: [#6193] All rings in Space Rings use the same secondary colour. diff --git a/src/openrct2/ride/vehicle.h b/src/openrct2/ride/vehicle.h index 50d39c533f..4bb4f67103 100644 --- a/src/openrct2/ride/vehicle.h +++ b/src/openrct2/ride/vehicle.h @@ -232,7 +232,7 @@ enum { VEHICLE_ENTRY_FLAG_ENABLE_ADDITIONAL_COLOUR_2 = 1 << 9, VEHICLE_ENTRY_FLAG_10 = 1 << 10, VEHICLE_ENTRY_FLAG_11 = 1 << 11, - VEHICLE_ENTRY_FLAG_OVERRIDE_NUM_VERTICAL_FRAMES = 1 << 12, // Setting this will cause the game to set vehicleEntry->num_vertical_frames to vehicleEntry->num_vertical_frames_override, rather than determining it itself. + VEHICLE_ENTRY_FLAG_OVERRIDE_NUM_VERTICAL_FRAMES = 1 << 12, // Setting this will cause the game to set vehicleEntry->num_vertical_frames to vehicleEntry->num_vertical_frames_override, rather than determining it itself. VEHICLE_ENTRY_FLAG_13 = 1 << 13, VEHICLE_ENTRY_FLAG_14 = 1 << 14, VEHICLE_ENTRY_FLAG_15 = 1 << 15, @@ -243,7 +243,7 @@ enum { VEHICLE_ENTRY_FLAG_RIDERS_SCREAM = 1 << 20, VEHICLE_ENTRY_FLAG_21 = 1 << 21, VEHICLE_ENTRY_FLAG_22 = 1 << 22, - VEHICLE_ENTRY_FLAG_23 = 1 << 23, + VEHICLE_ENTRY_FLAG_23 = 1 << 23, // Set on animated vehicles like the Multi-dimension coaster trains, Miniature Railway locomotives and Helicycles. VEHICLE_ENTRY_FLAG_24 = 1 << 24, VEHICLE_ENTRY_FLAG_25 = 1 << 25, VEHICLE_ENTRY_FLAG_26 = 1 << 26, diff --git a/src/openrct2/ride/vehicle_paint.c b/src/openrct2/ride/vehicle_paint.c index 83a4ae4fbf..213e1a5ebd 100644 --- a/src/openrct2/ride/vehicle_paint.c +++ b/src/openrct2/ride/vehicle_paint.c @@ -895,25 +895,32 @@ static void vehicle_sprite_paint(paint_session * session, rct_vehicle *vehicle, sint32 baseImage_id = ebx; vehicle_boundbox bb = VehicleBoundboxes[vehicleEntry->draw_order][ecx]; - if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_14) { + if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_14) + { baseImage_id += (vehicle->var_BA / 8) & 31; } - if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_7) { + if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_23) + { baseImage_id += vehicle->var_C5; } uint32 rotation = get_current_rotation(); sint32 image_id = baseImage_id | (vehicle->colours.body_colour << 19) | (vehicle->colours.trim_colour << 24) | IMAGE_TYPE_REMAP_2_PLUS; paint_struct* ps = sub_98197C(session, image_id, 0, 0, bb.length_x, bb.length_y, bb.length_z, z, bb.offset_x, bb.offset_y, bb.offset_z + z, rotation); - if (ps != NULL) { + if (ps != NULL) + { ps->tertiary_colour = vehicle->colours_extended; } rct_drawpixelinfo* dpi = session->Unk140E9A8; - if (dpi->zoom_level < 2 && vehicle->num_peeps > 0 && vehicleEntry->no_seating_rows > 0) { + if (dpi->zoom_level < 2 && vehicle->num_peeps > 0 && vehicleEntry->no_seating_rows > 0) + { baseImage_id += vehicleEntry->no_vehicle_images; - for (sint32 i = 0; i < 8; i++){ - if (vehicle->num_peeps > (i * 2) && vehicleEntry->no_seating_rows > i) { + for (sint32 i = 0; i < 8; i++) + { + if (vehicle->num_peeps > (i * 2) && vehicleEntry->no_seating_rows > i) + { image_id = baseImage_id | SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[i * 2], vehicle->peep_tshirt_colours[(i * 2) + 1]); - if (i == 0 && vehicleEntry->flags & VEHICLE_ENTRY_FLAG_24) { + if (i == 0 && vehicleEntry->flags & VEHICLE_ENTRY_FLAG_24) + { image_id += (vehicleEntry->no_vehicle_images * vehicle->var_C5); } sub_98199C(session, image_id, 0, 0, bb.length_x, bb.length_y, bb.length_z, z, bb.offset_x, bb.offset_y, bb.offset_z + z, rotation);