From d91a9c965cd162f4ed53bab105a839f7bad885db Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Mon, 30 Nov 2015 18:00:33 +0000 Subject: [PATCH] Fix #2405. Foundations under shops now correctly drawn. Issue was caused by a mistake in implementation --- src/interface/viewport.c | 2 +- src/interface/viewport.h | 2 +- src/ride/track_paint.c | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/interface/viewport.c b/src/interface/viewport.c index 78b9c5ad12..87a52f7c07 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -1201,7 +1201,7 @@ void sprite_paint_setup(uint16 eax, uint16 ecx){ * dx : height * edi : unknown */ -int sub_6629BC(int height, uint16 ax, uint32 image_id, int edi){ +bool sub_6629BC(int height, uint16 ax, uint32 image_id, int edi){ int eax = ax, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = edi, ebp = image_id; RCT2_CALLFUNC_X(0x006629BC, &eax, &ebx, &ecx, &edx, &esi, &_edi, &ebp); diff --git a/src/interface/viewport.h b/src/interface/viewport.h index d475b00481..b8e4df70fa 100644 --- a/src/interface/viewport.h +++ b/src/interface/viewport.h @@ -133,7 +133,7 @@ void sub_688217(); int sub_98197C(sint8 al, sint8 ah, int image_id, sint8 cl, int height, sint16 length_y, sint16 length_x, uint32 rotation); int sub_98199C(sint8 al, sint8 ah, int image_id, sint8 cl, int height, sint16 length_y, sint16 length_x, uint32 rotation); -int sub_6629BC(int height, uint16 ax, uint32 image_id, int edi); +bool sub_6629BC(int height, uint16 ax, uint32 image_id, int edi); void viewport_invalidate(rct_viewport *viewport, int left, int top, int right, int bottom); diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index bf4ade6109..44d14d0a8d 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -1211,7 +1211,7 @@ TRACK_PAINT_FUNCTION* shop_track_paint_functions[] = { */ void shop_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { - int al = sub_6629BC(height, 0, RCT2_GLOBAL(0x00F441A4, uint32), direction & 1); + bool hasSupports = sub_6629BC(height, 0, RCT2_GLOBAL(0x00F441A4, uint32), direction & 1); RCT2_GLOBAL(0x0141E9D0, sint16) = -1; RCT2_GLOBAL(0x0141E9C4, sint16) = -1; @@ -1236,12 +1236,7 @@ void shop_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int sint16 height16 = (sint16)height; int rotation = get_current_rotation(); - if (al) { - RCT2_GLOBAL(0x009DEA52, uint16) = 2; - RCT2_GLOBAL(0x009DEA54, uint16) = 2; - RCT2_GLOBAL(0x009DEA56, sint16) = height16; - sub_98197C(0, 45, imageId, 0, height, 28, 28, rotation); - } else { + if (hasSupports) { uint32 foundationImageId = RCT2_GLOBAL(0x00F441A4, uint32); foundationImageId |= 3395; @@ -1253,7 +1248,12 @@ void shop_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int RCT2_GLOBAL(0x009DEA52, uint16) = 2; RCT2_GLOBAL(0x009DEA54, uint16) = 2; RCT2_GLOBAL(0x009DEA56, sint16) = height16; - sub_98199C(0, 45, imageId, 0, height, 28, 28, rotation); + sub_98199C(0, 45, imageId, 0, height, 28, 28, rotation); + } else { + RCT2_GLOBAL(0x009DEA52, uint16) = 2; + RCT2_GLOBAL(0x009DEA54, uint16) = 2; + RCT2_GLOBAL(0x009DEA56, sint16) = height16; + sub_98197C(0, 45, imageId, 0, height, 28, 28, rotation); } height16 += 48;