diff --git a/src/ride/gentle/mini_golf.c b/src/ride/gentle/mini_golf.c index 3ded36af08..4a86b13e85 100644 --- a/src/ride/gentle/mini_golf.c +++ b/src/ride/gentle/mini_golf.c @@ -371,17 +371,18 @@ static const uint32 mini_golf_track_sprites_hole_e[][3][2] = { }, }; -static const uint8 byte_933471[] = {0, 1, 2, 3, 4, 5, 4}; -static const uint8 byte_933478[] = {12, 13, 14, 15, 15}; -static const uint8 byte_93347D[] = {6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 8, 8, 8, 8, 9, 7}; -static const uint8 byte_93348D[] = {12, 13, 14, 15, 14, 13, 12, 15}; -static const uint8 byte_933495[] = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 4}; -static const uint8 byte_9334A5[] = {15, 14, 13, 12, 10}; -static const uint8 byte_9334AA[] = {10, 11, 11, 11, 11, 11, 10, 10, 10, 10, 15}; -static const uint8 byte_9334B5[] = {31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 33, 33, 33, 33, 34, 10}; -static const uint8 byte_9334C5[] = {35, 36, 36, 36, 36, 36, 35, 35, 35, 35, 0}; +static const uint8 byte_933471[] = {0, 1, 2, 3, 4, 5}; +static const uint8 byte_933478[] = {12, 13, 14, 15}; +static const uint8 byte_93347D[] = {6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 8, 8, 8, 8, 9}; +static const uint8 byte_93348D[] = {12, 13, 14, 15, 14, 13, 12}; +static const uint8 byte_933495[] = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30}; +static const uint8 byte_9334A5[] = {15, 14, 13, 12}; +static const uint8 byte_9334AA[] = {10, 11, 11, 11, 11, 11, 10, 10, 10, 10}; +static const uint8 byte_9334B5[] = {31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 33, 33, 33, 33, 34}; +static const uint8 byte_9334C5[] = {35, 36, 36, 36, 36, 36, 35, 35, 35, 35}; -static const uint8 * off_8B8F74[] = { +/** rct2: 0x008B8F74 */ +static const uint8 * mini_golf_peep_animation_frames[] = { byte_933471, byte_933478, byte_93347D, @@ -393,6 +394,18 @@ static const uint8 * off_8B8F74[] = { byte_9334C5, }; +const uint8 mini_golf_peep_animation_lengths[] = { + countof(byte_933471), + countof(byte_933478), + countof(byte_93347D), + countof(byte_93348D), + countof(byte_933495), + countof(byte_9334A5), + countof(byte_9334AA), + countof(byte_9334B5), + countof(byte_9334C5), +}; + static paint_struct * mini_golf_paint_util_7c( uint8 direction, uint32 image_id, @@ -1006,7 +1019,7 @@ void vehicle_visual_mini_golf_player(int x, int imageDirection, int y, int z, rc rct_ride_entry *rideType = get_ride_entry(get_ride(vehicle->ride)->subtype); rct_sprite *sprite = &g_sprite_list[vehicle->peep[0]]; - uint8 frame = off_8B8F74[vehicle->var_D4][vehicle->var_C5]; + uint8 frame = mini_golf_peep_animation_frames[vehicle->var_D4][vehicle->var_C5]; uint32 ebx = (frame << 2) + (imageDirection >> 3); uint32 image_id = rideType->vehicles[0].base_image_id + 1 + ebx; diff --git a/src/ride/vehicle.c b/src/ride/vehicle.c index 7686a8874b..93eb190da8 100644 --- a/src/ride/vehicle.c +++ b/src/ride/vehicle.c @@ -7412,6 +7412,8 @@ loc_6DBE7F: return false; } +extern const uint8 mini_golf_peep_animation_lengths[]; + /** * rct2: 0x006DC3A7 * @@ -7462,10 +7464,9 @@ loc_6DC462: loc_6DC476: if (vehicle->mini_golf_flags & (1 << 2)) { - regs.edi = RCT2_ADDRESS(0x008B8F74, uint32)[vehicle->var_D4]; - regs.al = vehicle->var_C5 + 1; - if ((uint8)regs.al < ((uint8*)regs.edi)[-1]) { - vehicle->var_C5 = regs.al; + uint8 nextFrame = vehicle->var_C5 + 1; + if (nextFrame < mini_golf_peep_animation_lengths[vehicle->var_D4]) { + vehicle->var_C5 = nextFrame; goto loc_6DC985; } vehicle->mini_golf_flags &= ~(1 << 2);