Fix bound boxes and draw order

This commit is contained in:
Ted John 2016-09-18 13:16:20 +01:00
parent 09cb01b28a
commit df761fb64d
3 changed files with 49 additions and 17 deletions

View File

@ -524,6 +524,36 @@ paint_struct * sub_98199C(
return ps;
}
paint_struct * sub_98197C_rotated(
uint8 direction,
uint32 image_id,
sint8 x_offset, sint8 y_offset,
sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z,
sint16 z_offset,
sint16 bound_box_offset_x, sint16 bound_box_offset_y, sint16 bound_box_offset_z)
{
if (direction & 1) {
return sub_98197C(image_id, x_offset, y_offset, bound_box_length_y, bound_box_length_x, bound_box_length_z, z_offset, bound_box_offset_y, bound_box_offset_x, bound_box_offset_z, get_current_rotation());
} else {
return sub_98197C(image_id, x_offset, y_offset, bound_box_length_x, bound_box_length_y, bound_box_length_z, z_offset, bound_box_offset_x, bound_box_offset_y, bound_box_offset_z, get_current_rotation());
}
}
paint_struct * sub_98199C_rotated(
uint8 direction,
uint32 image_id,
sint8 x_offset, sint8 y_offset,
sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z,
sint16 z_offset,
sint16 bound_box_offset_x, sint16 bound_box_offset_y, sint16 bound_box_offset_z)
{
if (direction & 1) {
return sub_98199C(image_id, x_offset, y_offset, bound_box_length_y, bound_box_length_x, bound_box_length_z, z_offset, bound_box_offset_y, bound_box_offset_x, bound_box_offset_z, get_current_rotation());
} else {
return sub_98199C(image_id, x_offset, y_offset, bound_box_length_x, bound_box_length_y, bound_box_length_z, z_offset, bound_box_offset_x, bound_box_offset_y, bound_box_offset_z, get_current_rotation());
}
}
/**
* rct2: 0x006881D0
*

View File

@ -158,6 +158,9 @@ paint_struct * sub_98197C(uint32 image_id, sint8 x_offset, sint8 y_offset, sint1
paint_struct * sub_98198C(uint32 image_id, sint8 x_offset, sint8 y_offset, sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z, sint16 z_offset, sint16 bound_box_offset_x, sint16 bound_box_offset_y, sint16 bound_box_offset_z, uint32 rotation);
paint_struct * sub_98199C(uint32 image_id, sint8 x_offset, sint8 y_offset, sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z, sint16 z_offset, sint16 bound_box_offset_x, sint16 bound_box_offset_y, sint16 bound_box_offset_z, uint32 rotation);
paint_struct * sub_98197C_rotated(uint8 direction, uint32 image_id, sint8 x_offset, sint8 y_offset, sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z, sint16 z_offset, sint16 bound_box_offset_x, sint16 bound_box_offset_y, sint16 bound_box_offset_z);
paint_struct * sub_98199C_rotated(uint8 direction, uint32 image_id, sint8 x_offset, sint8 y_offset, sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z, sint16 z_offset, sint16 bound_box_offset_x, sint16 bound_box_offset_y, sint16 bound_box_offset_z);
bool paint_attach_to_previous_attach(uint32 image_id, uint16 x, uint16 y);
bool paint_attach_to_previous_ps(uint32 image_id, uint16 x, uint16 y);
void sub_685EBC(money32 amount, rct_string_id string_id, sint16 y, sint16 z, sint8 y_offsets[], sint16 offset_x, uint32 rotation);

View File

@ -14,7 +14,6 @@
*****************************************************************************/
#pragma endregion
#include "../../config.h"
#include "../../drawing/drawing.h"
#include "../../paint/supports.h"
#include "../../interface/viewport.h"
@ -266,11 +265,12 @@ static void paint_reverse_freefall_rc_station(uint8 rideIndex, uint8 trackSequen
static void paint_reverse_freefall_rc_slope(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element *mapElement)
{
static const sint8 bbHeights03[] = { 1, 6, 14, 37, 64 };
static const sint8 bbHeights12[] = { 1, 6, 14, 27, 59 };
static const sint32 supportHeights[] = { 48, 64, 128, 176, 208, 240, 240 };
uint32 supportsImageId = reverse_freefall_rc_track_pieces_slope_supports[trackSequence][direction] | gTrackColours[SCHEME_SUPPORTS];
uint32 trackImageId = reverse_freefall_rc_track_pieces_slope[trackSequence][direction] | gTrackColours[SCHEME_TRACK];
uint32 floorImageId;
switch (trackSequence) {
case 0:
@ -278,13 +278,15 @@ static void paint_reverse_freefall_rc_slope(uint8 rideIndex, uint8 trackSequence
case 2:
case 3:
case 4:
if (!(direction & 1)) {
sub_98197C(supportsImageId, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation());
sub_98199C(trackImageId, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation());
if (direction == 0 || direction == 3) {
sint8 bbHeight = bbHeights03[trackSequence];
sub_98197C_rotated(direction, supportsImageId, 0, 0, 32, 20, bbHeight, height, 0, 6, height);
sub_98199C_rotated(direction, trackImageId, 0, 0, 32, 20, bbHeight, height, 0, 6, height);
paint_util_push_tunnel_left(height, TUNNEL_6);
} else {
sub_98197C(supportsImageId, 0, 0, 20, 32, 1, height, 6, 0, height, get_current_rotation());
sub_98199C(trackImageId, 0, 0, 20, 32, 1, height, 6, 0, height, get_current_rotation());
sint8 bbHeight = bbHeights12[trackSequence];
sub_98197C_rotated(direction, trackImageId, 0, 0, 32, 20, bbHeight, height, 0, 6, height);
sub_98199C_rotated(direction, supportsImageId, 0, 0, 32, 20, bbHeight, height, 0, 6, height);
paint_util_push_tunnel_right(height, TUNNEL_6);
}
wooden_a_supports_paint_setup(direction & 1, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
@ -293,6 +295,7 @@ static void paint_reverse_freefall_rc_slope(uint8 rideIndex, uint8 trackSequence
break;
case 5:
if (wooden_a_supports_paint_setup(direction & 1, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL)) {
uint32 floorImageId;
if (direction & 1) {
floorImageId = SPR_FLOOR_PLANKS_90_DEG | gTrackColours[SCHEME_SUPPORTS];
} else {
@ -307,12 +310,12 @@ static void paint_reverse_freefall_rc_slope(uint8 rideIndex, uint8 trackSequence
paint_util_set_general_support_height(height + supportHeights[trackSequence], 0x20);
break;
case 6:
if (!(direction & 1)) {
sub_98197C(supportsImageId, 0, 0, 5, 20, 79, height, 0, 6, height + 128, get_current_rotation());
sub_98199C(trackImageId, 0, 0, 5, 20, 79, height, 0, 6, height + 128, get_current_rotation());
if (direction == 0 || direction == 3) {
sub_98197C_rotated(direction, supportsImageId, 0, 0, 5, 20, 79, height, 0, 6, height + 128);
sub_98199C_rotated(direction, trackImageId, 0, 0, 5, 20, 79, height, 0, 6, height + 128);
} else {
sub_98197C(supportsImageId, 0, 0, 20, 5, 79, height, 6, 0, height, get_current_rotation());
sub_98199C(trackImageId, 0, 0, 20, 5, 79, height, 6, 0, height, get_current_rotation());
sub_98197C_rotated(direction, trackImageId, 0, 0, 1, 20, 126, height, 27, 6, height);
sub_98199C_rotated(direction, supportsImageId, 0, 0, 1, 20, 126, height, 27, 6, height);
}
wooden_a_supports_paint_setup(direction & 1, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
@ -333,11 +336,7 @@ static void paint_reverse_freefall_rc_vertical(uint8 rideIndex, uint8 trackSeque
break;
case 1:
trackImageId = reverse_freefall_rc_track_pieces_vertical[direction] | gTrackColours[SCHEME_TRACK];
if (!(direction & 1)) {
sub_98197C(trackImageId, 0, 0, 2, 20, 79, height, 0, 6, height, get_current_rotation());
} else {
sub_98197C(trackImageId, 0, 0, 20, 2, 79, height, 6, 0, height, get_current_rotation());
}
sub_98197C_rotated(direction, trackImageId, 0, 0, 2, 20, 79, height, 0, 6, height);
paint_util_set_vertical_tunnel(height + 80);
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 80, 0x20);