Implement slope

This commit is contained in:
Ted John 2016-09-18 03:25:08 +01:00
parent a62277c44f
commit f713eb201a
1 changed files with 216 additions and 9 deletions

View File

@ -20,8 +20,6 @@
#include "../../interface/viewport.h"
#include "../../paint/map_element/map_element.h"
#include "../../paint/paint.h"
#include "../../interface/window.h"
#include "../../localisation/localisation.h"
#include "../../sprites.h"
#include "../../world/map.h"
#include "../../world/sprite.h"
@ -34,6 +32,59 @@ enum {
SPR_REVERSE_FREEFALL_RC_STATION_NW_SE = 22163,
SPR_REVERSE_FREEFALL_RC_FLAT_SW_NE = 22164,
SPR_REVERSE_FREEFALL_RC_FLAT_NW_SE = 22165,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SW_NE_0 = 22174,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SW_NE_1 = 22175,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SW_NE_2 = 22176,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SW_NE_3 = 22177,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SW_NE_4 = 22178,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SW_NE_6 = 22179,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NW_SE_0 = 22180,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NW_SE_1 = 22181,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NW_SE_2 = 22182,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NW_SE_3 = 22183,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NW_SE_4 = 22184,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NW_SE_6 = 22185,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NE_SW_0 = 22186,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NE_SW_1 = 22187,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NE_SW_2 = 22188,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NE_SW_3 = 22189,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NE_SW_4 = 22190,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NE_SW_6 = 22191,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SE_NW_0 = 22192,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SE_NW_1 = 22193,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SE_NW_2 = 22194,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SE_NW_3 = 22195,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SE_NW_4 = 22196,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SE_NW_6 = 22197,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SW_NE_0 = 22198,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SW_NE_1 = 22199,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SW_NE_2 = 22200,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SW_NE_3 = 22201,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SW_NE_4 = 22202,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SW_NE_6 = 22203,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SW_NE_5 = 22204,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NW_SE_0 = 22205,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NW_SE_1 = 22206,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NW_SE_2 = 22207,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NW_SE_3 = 22208,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NW_SE_4 = 22209,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NW_SE_6 = 22210,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NW_SE_5 = 22211,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NE_SW_0 = 22212,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NE_SW_1 = 22213,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NE_SW_2 = 22214,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NE_SW_3 = 22215,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NE_SW_4 = 22216,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NE_SW_6 = 22217,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NE_SW_5 = 22218,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SE_NW_0 = 22219,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SE_NW_1 = 22220,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SE_NW_2 = 22221,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SE_NW_3 = 22222,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SE_NW_4 = 22223,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SE_NW_6 = 22224,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SE_NW_5 = 22225,
};
static const uint32 reverse_freefall_rc_track_pieces_station[4] = {
@ -43,6 +94,96 @@ static const uint32 reverse_freefall_rc_track_pieces_station[4] = {
SPR_REVERSE_FREEFALL_RC_STATION_NW_SE,
};
static const uint32 reverse_freefall_rc_track_pieces_slope[7][4] = {
{
SPR_REVERSE_FREEFALL_RC_VERTICAL_SW_NE_0,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NW_SE_0,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NE_SW_0,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SE_NW_0,
},
{
SPR_REVERSE_FREEFALL_RC_VERTICAL_SW_NE_1,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NW_SE_1,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NE_SW_1,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SE_NW_1,
},
{
SPR_REVERSE_FREEFALL_RC_VERTICAL_SW_NE_2,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NW_SE_2,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NE_SW_2,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SE_NW_2,
},
{
SPR_REVERSE_FREEFALL_RC_VERTICAL_SW_NE_3,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NW_SE_3,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NE_SW_3,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SE_NW_3,
},
{
SPR_REVERSE_FREEFALL_RC_VERTICAL_SW_NE_4,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NW_SE_4,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NE_SW_4,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SE_NW_4,
},
{
0,
0,
0,
0
},
{
SPR_REVERSE_FREEFALL_RC_VERTICAL_SW_NE_6,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NW_SE_6,
SPR_REVERSE_FREEFALL_RC_VERTICAL_NE_SW_6,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SE_NW_6,
},
};
static const uint32 reverse_freefall_rc_track_pieces_slope_supports[7][4] = {
{
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SW_NE_0,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NW_SE_0,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NE_SW_0,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SE_NW_0,
},
{
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SW_NE_1,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NW_SE_1,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NE_SW_1,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SE_NW_1,
},
{
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SW_NE_2,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NW_SE_2,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NE_SW_2,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SE_NW_2,
},
{
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SW_NE_3,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NW_SE_3,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NE_SW_3,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SE_NW_3,
},
{
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SW_NE_4,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NW_SE_4,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NE_SW_4,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SE_NW_4,
},
{
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SW_NE_5,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NW_SE_5,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NE_SW_5,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SE_NW_5,
},
{
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SW_NE_6,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NW_SE_6,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NE_SW_6,
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SE_NW_6,
},
};
static void paint_reverse_freefall_rc_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element *mapElement)
{
uint32 imageId = 0;
@ -58,10 +199,7 @@ static void paint_reverse_freefall_rc_flat(uint8 rideIndex, uint8 trackSequence,
paint_util_push_tunnel_left(height, TUNNEL_0);
}
if (track_paint_util_should_paint_supports(gPaintMapPosition)) {
wooden_a_supports_paint_setup((direction & 1) ? 1 : 0, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
}
wooden_a_supports_paint_setup((direction & 1) ? 1 : 0, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 32, 0x20);
}
@ -83,6 +221,9 @@ static void paint_reverse_freefall_rc_station(uint8 rideIndex, uint8 trackSequen
imageId = reverse_freefall_rc_track_pieces_station[direction] | gTrackColours[SCHEME_TRACK];
sub_98199C(imageId, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation());
wooden_a_supports_paint_setup((direction & 1) ? 1 : 0, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
paint_util_push_tunnel_left(height, TUNNEL_6);
} else if (direction == 1 || direction == 3) {
// height -= 2 (height - 2)
imageId = SPR_STATION_BASE_B_NW_SE | gTrackColours[SCHEME_MISC];
@ -91,10 +232,10 @@ static void paint_reverse_freefall_rc_station(uint8 rideIndex, uint8 trackSequen
imageId = reverse_freefall_rc_track_pieces_station[direction] | gTrackColours[SCHEME_TRACK];
sub_98199C(imageId, 0, 0, 20, 32, 1, height, 6, 0, height, get_current_rotation());
}
wooden_a_supports_paint_setup((direction & 1) ? 1 : 0, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
paint_util_push_tunnel_right(height, TUNNEL_6);
wooden_a_supports_paint_setup((direction & 1) ? 1 : 0, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
paint_util_push_tunnel_right(height, TUNNEL_6);
}
track_paint_util_draw_station_platform(ride, direction, height, 5, mapElement);
@ -102,6 +243,68 @@ static void paint_reverse_freefall_rc_station(uint8 rideIndex, uint8 trackSequen
paint_util_set_general_support_height(height + 32, 0x20);
}
static void paint_reverse_freefall_rc_slope(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element *mapElement)
{
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:
case 1:
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());
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());
paint_util_push_tunnel_right(height, TUNNEL_6);
}
wooden_a_supports_paint_setup(direction & 1, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + supportHeights[trackSequence], 0x20);
break;
case 5:
if (wooden_a_supports_paint_setup(direction & 1, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL)) {
if (direction & 1) {
floorImageId = SPR_FLOOR_PLANKS_90_DEG | gTrackColours[SCHEME_SUPPORTS];
} else {
floorImageId = SPR_FLOOR_PLANKS | gTrackColours[SCHEME_SUPPORTS];
}
sub_98197C(floorImageId, 0, 0, 26, 26, 126, height, 3, 3, height, get_current_rotation());
sub_98199C(supportsImageId, 0, 0, 26, 26, 126, height, 3, 3, height, get_current_rotation());
} else {
sub_98197C(supportsImageId, 0, 0, 26, 26, 126, height, 3, 3, height, get_current_rotation());
}
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
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());
} 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());
}
wooden_a_supports_paint_setup(direction & 1, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + supportHeights[trackSequence], 0x20);
break;
}
}
static void paint_reverse_freefall_rc_vertical(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element *mapElement)
{
// 0x00768E04
}
TRACK_PAINT_FUNCTION get_track_paint_function_reverse_freefall_rc(int trackType, int direction)
{
switch (trackType) {
@ -111,6 +314,10 @@ TRACK_PAINT_FUNCTION get_track_paint_function_reverse_freefall_rc(int trackType,
case TRACK_ELEM_BEGIN_STATION:
case TRACK_ELEM_MIDDLE_STATION:
return paint_reverse_freefall_rc_station;
case TRACK_ELEM_REVERSE_WHOA_BELLY_SLOPE:
return paint_reverse_freefall_rc_slope;
case TRACK_ELEM_REVERSE_WHOA_BELLY_VERTICAL:
return paint_reverse_freefall_rc_vertical;
}
return NULL;
}