paint river rafts station and refactor

This commit is contained in:
Ted John 2016-05-22 14:58:15 +01:00
parent c30d9ded65
commit f1edf9c9d6
4 changed files with 77 additions and 42 deletions

View File

@ -445,6 +445,43 @@ bool track_paint_util_draw_station_covers(enum edge edge, bool hasFence, const r
return true;
}
void track_paint_util_draw_station_platform(rct_ride *ride, uint8 direction, int height, int zOffset, rct_map_element * mapElement)
{
rct_xy16 position = {RCT2_GLOBAL(0x009DE56A, sint16), RCT2_GLOBAL(0x009DE56E, sint16)};
const rct_ride_entrance_definition * entranceStyle = &RideEntranceDefinitions[ride->entrance_style];
if (direction & 1) {
bool hasFence = track_paint_util_has_fence(EDGE_NE, position, mapElement, ride, get_current_rotation());
uint32 imageId = (hasFence ? SPR_STATION_NARROW_EDGE_FENCED_NE : SPR_STATION_NARROW_EDGE_NE) | RCT2_GLOBAL(0x00F4419C, uint32);
sub_98196C(imageId, 0, 0, 8, 32, 1, height + zOffset, get_current_rotation());
track_paint_util_draw_station_covers(EDGE_NE, hasFence, entranceStyle, direction, height);
imageId = SPR_STATION_NARROW_EDGE_SW | RCT2_GLOBAL(0x00F4419C, uint32);
sub_98196C(imageId, 24, 0, 8, 32, 1, height + zOffset, get_current_rotation());
hasFence = track_paint_util_has_fence(EDGE_SW, position, mapElement, ride, get_current_rotation());
if (hasFence) {
imageId = SPR_STATION_FENCE_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32);
sub_98196C(imageId, 31, 0, 1, 32, 7, height + zOffset + 2, get_current_rotation());
}
track_paint_util_draw_station_covers(EDGE_SW, hasFence, entranceStyle, direction, height);
} else {
bool hasFence = track_paint_util_has_fence(EDGE_NW, position, mapElement, ride, get_current_rotation());
uint32 imageId = (hasFence ? SPR_STATION_NARROW_EDGE_FENCED_NW : SPR_STATION_NARROW_EDGE_NW) | RCT2_GLOBAL(0x00F4419C, uint32);
sub_98196C(imageId, 0, 0, 32, 8, 1, height + zOffset, get_current_rotation());
track_paint_util_draw_station_covers(EDGE_NW, hasFence, entranceStyle, direction, height);
imageId = SPR_STATION_NARROW_EDGE_SE | RCT2_GLOBAL(0x00F4419C, uint32);
sub_98196C(imageId, 0, 24, 32, 8, 1, height + zOffset, get_current_rotation());
hasFence = track_paint_util_has_fence(EDGE_SE, position, mapElement, ride, get_current_rotation());
if (hasFence) {
imageId = SPR_STATION_FENCE_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32);
sub_98196C(imageId, 0, 31, 32, 1, 7, height + zOffset + 2, get_current_rotation());
}
track_paint_util_draw_station_covers(EDGE_SE, hasFence, entranceStyle, direction, height);
}
}
void track_paint_util_draw_pier(rct_ride * ride, const rct_ride_entrance_definition * entranceStyle, rct_xy16 position, uint8 direction, int height, rct_map_element * mapElement, uint8 rotation)
{
bool hasFence;

View File

@ -165,6 +165,7 @@ bool track_paint_util_has_fence(enum edge edge, rct_xy16 position, rct_map_eleme
void track_paint_util_paint_floor(uint8 edges, uint32 colourFlags, uint16 height, const uint32 floorSprites[4], uint8 rotation);
void track_paint_util_paint_fences(uint8 edges, rct_xy16 position, rct_map_element * mapElement, rct_ride * ride, uint32 colourFlags, uint16 height, const uint32 fenceSprites[4], uint8 rotation);
bool track_paint_util_draw_station_covers(enum edge edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height);
void track_paint_util_draw_station_platform(rct_ride *ride, uint8 direction, int height, int zOffset, rct_map_element * mapElement);
void track_paint_util_draw_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement);
bool track_paint_util_should_paint_supports(rct_xy16 position);
void track_paint_util_draw_pier(rct_ride * ride, const rct_ride_entrance_definition * entranceStyle, rct_xy16 position, uint8 direction, int height, rct_map_element * mapElement, uint8 rotation);

View File

@ -63,6 +63,38 @@ static void paint_river_rafts_track_flat(uint8 rideIndex, uint8 trackSequence, u
paint_util_set_general_support_height(height + 32, 0x20);
}
/** rct2: 0x0089B1A0 */
static void paint_river_rafts_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
rct_ride *ride = get_ride(rideIndex);
if (direction & 1) {
uint32 imageId = (direction == 1 ? SPR_RIVER_RAFTS_FLAT_NW_SE : SPR_RIVER_RAFTS_FLAT_SE_NW) | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(imageId, 0, 0, 20, 32, 1, height, 6, 0, height + 3, get_current_rotation());
imageId = SPR_STATION_BASE_B_NW_SE | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98196C(imageId, 0, 0, 32, 32, 1, height, get_current_rotation());
} else {
uint32 imageId = (direction == 0 ? SPR_RIVER_RAFTS_FLAT_SW_NE : SPR_RIVER_RAFTS_FLAT_NE_SW) | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(imageId, 0, 0, 32, 20, 1, height, 0, 6, height + 3, get_current_rotation());
imageId = SPR_STATION_BASE_B_SW_NE | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98196C(imageId, 0, 0, 32, 32, 1, height, get_current_rotation());
}
track_paint_util_draw_station_platform(ride, direction, height, 7, mapElement);
wooden_a_supports_paint_setup((direction & 1), 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL);
if (direction & 1) {
paint_util_push_tunnel_right(height, TUNNEL_6);
} else {
paint_util_push_tunnel_left(height, TUNNEL_6);
}
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 32, 0x20);
}
static void paint_river_rafts_track_s_bend(uint32 baseImageId, uint8 trackSequence, uint8 direction, int height, const uint8 supportTypes[][4], uint16 ssegs1, uint16 ssegs2)
{
@ -155,9 +187,10 @@ TRACK_PAINT_FUNCTION get_track_paint_function_river_rafts(int trackType, int dir
switch (trackType) {
case TRACK_ELEM_FLAT: return paint_river_rafts_track_flat;
case TRACK_ELEM_END_STATION: break;
case TRACK_ELEM_BEGIN_STATION: break;
case TRACK_ELEM_MIDDLE_STATION: break;
case TRACK_ELEM_END_STATION:
case TRACK_ELEM_BEGIN_STATION:
case TRACK_ELEM_MIDDLE_STATION:
return paint_river_rafts_station;
case TRACK_ELEM_LEFT_QUARTER_TURN_5_TILES: break;
case TRACK_ELEM_RIGHT_QUARTER_TURN_5_TILES: break;

View File

@ -283,46 +283,10 @@ static void paint_river_rapids_track_flat(uint8 rideIndex, uint8 trackSequence,
/** rct2: 0x007576C0 */
static void paint_river_rapids_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
rct_ride *ride = get_ride(rideIndex);
paint_river_rapids_track_flat(rideIndex, trackSequence, direction, height, mapElement);
rct_xy16 position = {RCT2_GLOBAL(0x009DE56A, sint16), RCT2_GLOBAL(0x009DE56E, sint16)};
rct_ride * ride = get_ride(rideIndex);
const rct_ride_entrance_definition * entranceStyle = &RideEntranceDefinitions[ride->entrance_style];
uint32 imageId;
bool hasFence;
if (direction & 1) {
hasFence = track_paint_util_has_fence(EDGE_NE, position, mapElement, ride, get_current_rotation());
imageId = (hasFence ? SPR_STATION_NARROW_EDGE_FENCED_NE : SPR_STATION_NARROW_EDGE_NE) | RCT2_GLOBAL(0x00F4419C, uint32);
sub_98196C(imageId, 0, 0, 8, 32, 1, height + 12, get_current_rotation());
track_paint_util_draw_station_covers(EDGE_NE, hasFence, entranceStyle, direction, height);
imageId = SPR_STATION_NARROW_EDGE_SW | RCT2_GLOBAL(0x00F4419C, uint32);
sub_98196C(imageId, 24, 0, 8, 32, 1, height + 12, get_current_rotation());
hasFence = track_paint_util_has_fence(EDGE_SW, position, mapElement, ride, get_current_rotation());
if (hasFence) {
imageId = SPR_STATION_FENCE_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32);
sub_98196C(imageId, 31, 0, 1, 32, 7, height + 14, get_current_rotation());
}
track_paint_util_draw_station_covers(EDGE_SW, hasFence, entranceStyle, direction, height);
} else {
hasFence = track_paint_util_has_fence(EDGE_NW, position, mapElement, ride, get_current_rotation());
imageId = (hasFence ? SPR_STATION_NARROW_EDGE_FENCED_NW : SPR_STATION_NARROW_EDGE_NW) | RCT2_GLOBAL(0x00F4419C, uint32);
sub_98196C(imageId, 0, 0, 32, 8, 1, height + 12, get_current_rotation());
track_paint_util_draw_station_covers(EDGE_NW, hasFence, entranceStyle, direction, height);
imageId = SPR_STATION_NARROW_EDGE_SE | RCT2_GLOBAL(0x00F4419C, uint32);
sub_98196C(imageId, 0, 24, 32, 8, 1, height + 12, get_current_rotation());
hasFence = track_paint_util_has_fence(EDGE_SE, position, mapElement, ride, get_current_rotation());
if (hasFence) {
imageId = SPR_STATION_FENCE_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32);
sub_98196C(imageId, 0, 31, 32, 1, 7, height + 14, get_current_rotation());
}
track_paint_util_draw_station_covers(EDGE_SE, hasFence, entranceStyle, direction, height);
}
track_paint_util_draw_station_platform(ride, direction, height, 12, mapElement);
paint_util_set_general_support_height(height + 32, 0x20);
}