Draw spinning tunnel

This commit is contained in:
Marijn van der Werf 2016-05-25 14:43:32 +02:00
parent e74435af64
commit 3e11d70272
4 changed files with 107 additions and 69 deletions

View File

@ -161,37 +161,6 @@ static const uint32 car_ride_track_pieces_quarter_turn_3_tiles[4][3] = {
}
};
static const uint32 car_ride_track_pieces_tunnel[2][2][4] = {
{
{
SPR_SPINNING_TUNNEL_BACK_SW_NE_FRAME_0,
SPR_SPINNING_TUNNEL_BACK_SW_NE_FRAME_1,
SPR_SPINNING_TUNNEL_BACK_SW_NE_FRAME_2,
SPR_SPINNING_TUNNEL_BACK_SW_NE_FRAME_3
},
{
SPR_SPINNING_TUNNEL_FRONT_SW_NE_FRAME_0,
SPR_SPINNING_TUNNEL_FRONT_SW_NE_FRAME_1,
SPR_SPINNING_TUNNEL_FRONT_SW_NE_FRAME_2,
SPR_SPINNING_TUNNEL_FRONT_SW_NE_FRAME_3
}
},
{
{
SPR_SPINNING_TUNNEL_BACK_NW_SE_FRAME_0,
SPR_SPINNING_TUNNEL_BACK_NW_SE_FRAME_1,
SPR_SPINNING_TUNNEL_BACK_NW_SE_FRAME_2,
SPR_SPINNING_TUNNEL_BACK_NW_SE_FRAME_3
},
{
SPR_SPINNING_TUNNEL_FRONT_NW_SE_FRAME_0,
SPR_SPINNING_TUNNEL_FRONT_NW_SE_FRAME_1,
SPR_SPINNING_TUNNEL_FRONT_NW_SE_FRAME_2,
SPR_SPINNING_TUNNEL_FRONT_NW_SE_FRAME_3
}
}
};
/** rct2: 0x006F72C8 */
static void paint_car_ride_track_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
@ -434,27 +403,7 @@ static void paint_car_ride_track_spinning_tunnel(uint8 rideIndex, uint8 trackSeq
sub_98196C(imageId, 6, 0, 20, 32, 1, height, get_current_rotation());
}
int frame = gScenarioTicks >> 2 & 3;
uint32 colourFlags = RCT2_GLOBAL(0x00F4419C, uint32);
uint32 colourFlags2 = RCT2_GLOBAL(0x00F44198, uint32);
if (colourFlags2 & (IMAGE_TYPE_UNKNOWN << 28)) {
colourFlags |= colourFlags2 & (IMAGE_TYPE_UNKNOWN << 28 | 0x1F << 24);
}
imageId = car_ride_track_pieces_tunnel[direction & 1][0][frame] | colourFlags;
if (direction == 0 || direction == 2) {
sub_98199C(imageId, 0, 0, 28, 20, 1, height, 2, 6, height, get_current_rotation());
} else {
sub_98199C(imageId, 0, 0, 20, 28, 1, height, 6, 2, height, get_current_rotation());
}
imageId = car_ride_track_pieces_tunnel[direction & 1][1][frame] | colourFlags;
if (direction == 0 || direction == 2) {
sub_98197C(imageId, 0, 0, 26, 1, 23, height, 4, 28, height, get_current_rotation());
} else {
sub_98197C(imageId, 0, 0, 1, 26, 23, height, 28, 4, height, get_current_rotation());
}
track_paint_util_spinning_tunnel_paint(1, height, direction, get_current_rotation());
if (direction == 0 || direction == 2) {
paint_util_push_tunnel_left(height, TUNNEL_0);

View File

@ -56,6 +56,10 @@ enum
SPR_GHOST_TRAIN_QUARTER_TURN_1_TILE_NE_SE = 28849,
SPR_GHOST_TRAIN_QUARTER_TURN_1_TILE_SE_SW = 28850,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_TRACK_SW_NE = 28863,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_TRACK_NW_SE = 28864,
SPR_GHOST_TRAIN_TRACK_BRAKES_SW_NE = 28881,
SPR_GHOST_TRAIN_TRACK_BRAKES_NW_SE = 28882
};
@ -95,6 +99,13 @@ static const uint32 ghost_train_track_pieces_quarter_turn_1_tile[4] = {
SPR_GHOST_TRAIN_QUARTER_TURN_1_TILE_SE_SW,
};
static const uint32 ghost_train_track_pieces_spinning_tunnel_track[4] = {
SPR_GHOST_TRAIN_SPINNING_TUNNEL_TRACK_SW_NE,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_TRACK_NW_SE,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_TRACK_SW_NE,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_TRACK_NW_SE,
};
static const uint32 ghost_train_track_pieces_brakes[4] = {
SPR_GHOST_TRAIN_TRACK_BRAKES_SW_NE,
SPR_GHOST_TRAIN_TRACK_BRAKES_NW_SE,
@ -306,9 +317,29 @@ static void paint_ghost_train_track_right_quarter_turn_1_tile(uint8 rideIndex, u
paint_ghost_train_track_left_quarter_turn_1_tile(rideIndex, trackSequence, (direction + 3) % 4, height, mapElement);
}
/** rct2: 0x */
/** rct2: 0x00770CCC */
static void paint_ghost_train_track_spinning_tunnel(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
uint32 imageId = ghost_train_track_pieces_spinning_tunnel_track[direction] | RCT2_GLOBAL(0x00F44198, uint32);
if (direction == 0 || direction == 2) {
sub_98197C(imageId, 0, 0, 28, 20, 3, height, 2, 6, height, get_current_rotation());
} else {
sub_98197C(imageId, 0, 0, 20, 28, 3, height, 6, 2, height, get_current_rotation());
}
track_paint_util_spinning_tunnel_paint(3, height, direction, get_current_rotation());
if (direction == 0 || direction == 2) {
paint_util_push_tunnel_left(height, TUNNEL_0);
} else {
paint_util_push_tunnel_right(height, TUNNEL_0);
}
wooden_a_supports_paint_setup((direction & 1), 0, height, RCT2_GLOBAL(0x00F441A0, uint32), NULL);
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 32, 0x20);
}
/** rct2: 0x00770CDC */

View File

@ -160,6 +160,37 @@ const uint32 trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile[4] = {
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SE_SW,
};
static const uint32 trackSpritesGhostTrainSpinningTunnel[2][2][4] = {
{
{
SPR_GHOST_TRAIN_SPINNING_TUNNEL_BACK_SW_NE_FRAME_0,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_BACK_SW_NE_FRAME_1,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_BACK_SW_NE_FRAME_2,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_BACK_SW_NE_FRAME_3
},
{
SPR_GHOST_TRAIN_SPINNING_TUNNEL_FRONT_SW_NE_FRAME_0,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_FRONT_SW_NE_FRAME_1,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_FRONT_SW_NE_FRAME_2,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_FRONT_SW_NE_FRAME_3
}
},
{
{
SPR_GHOST_TRAIN_SPINNING_TUNNEL_BACK_NW_SE_FRAME_0,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_BACK_NW_SE_FRAME_1,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_BACK_NW_SE_FRAME_2,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_BACK_NW_SE_FRAME_3
},
{
SPR_GHOST_TRAIN_SPINNING_TUNNEL_FRONT_NW_SE_FRAME_0,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_FRONT_NW_SE_FRAME_1,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_FRONT_NW_SE_FRAME_2,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_FRONT_NW_SE_FRAME_3
}
}
};
enum
{
SPR_STATION_COVER_OFFSET_NE_SW_BACK_0 = 0,
@ -771,6 +802,32 @@ void track_paint_util_left_quarter_turn_1_tile_tunnel(sint16 height, uint8 direc
}
}
void track_paint_util_spinning_tunnel_paint(sint8 thickness, sint16 height, uint8 direction, uint8 rotation)
{
int frame = gScenarioTicks >> 2 & 3;
uint32 colourFlags = RCT2_GLOBAL(0x00F4419C, uint32);
uint32 colourFlags2 = RCT2_GLOBAL(0x00F44198, uint32);
if (colourFlags2 & (IMAGE_TYPE_UNKNOWN << 28)) {
colourFlags |= colourFlags2 & (IMAGE_TYPE_UNKNOWN << 28 | 0x1F << 24);
}
uint32 imageId = trackSpritesGhostTrainSpinningTunnel[direction & 1][0][frame] | colourFlags;
if (direction == 0 || direction == 2) {
sub_98199C(imageId, 0, 0, 28, 20, thickness, height, 2, 6, height, rotation);
} else {
sub_98199C(imageId, 0, 0, 20, 28, thickness, height, 6, 2, height, rotation);
}
imageId = trackSpritesGhostTrainSpinningTunnel[direction & 1][1][frame] | colourFlags;
if (direction == 0 || direction == 2) {
sub_98197C(imageId, 0, 0, 26, 1, 23, height, 4, 28, height, rotation);
} else {
sub_98197C(imageId, 0, 0, 1, 26, 23, height, 28, 4, height, rotation);
}
}
/**
*
* rct2: 0x006C4794

View File

@ -153,22 +153,22 @@ enum {
SPR_ON_RIDE_PHOTO_SIGN_NE_SW = 25625,
SPR_ON_RIDE_PHOTO_SIGN_SE_NW = 25626,
SPR_SPINNING_TUNNEL_BACK_SW_NE_FRAME_0 = 28865,
SPR_SPINNING_TUNNEL_BACK_SW_NE_FRAME_1 = 28866,
SPR_SPINNING_TUNNEL_BACK_SW_NE_FRAME_2 = 28867,
SPR_SPINNING_TUNNEL_BACK_SW_NE_FRAME_3 = 28868,
SPR_SPINNING_TUNNEL_BACK_NW_SE_FRAME_0 = 28869,
SPR_SPINNING_TUNNEL_BACK_NW_SE_FRAME_1 = 28870,
SPR_SPINNING_TUNNEL_BACK_NW_SE_FRAME_2 = 28871,
SPR_SPINNING_TUNNEL_BACK_NW_SE_FRAME_3 = 28872,
SPR_SPINNING_TUNNEL_FRONT_SW_NE_FRAME_0 = 28873,
SPR_SPINNING_TUNNEL_FRONT_SW_NE_FRAME_1 = 28874,
SPR_SPINNING_TUNNEL_FRONT_SW_NE_FRAME_2 = 28875,
SPR_SPINNING_TUNNEL_FRONT_SW_NE_FRAME_3 = 28876,
SPR_SPINNING_TUNNEL_FRONT_NW_SE_FRAME_0 = 28877,
SPR_SPINNING_TUNNEL_FRONT_NW_SE_FRAME_1 = 28878,
SPR_SPINNING_TUNNEL_FRONT_NW_SE_FRAME_2 = 28879,
SPR_SPINNING_TUNNEL_FRONT_NW_SE_FRAME_3 = 28880,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_BACK_SW_NE_FRAME_0 = 28865,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_BACK_SW_NE_FRAME_1 = 28866,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_BACK_SW_NE_FRAME_2 = 28867,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_BACK_SW_NE_FRAME_3 = 28868,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_BACK_NW_SE_FRAME_0 = 28869,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_BACK_NW_SE_FRAME_1 = 28870,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_BACK_NW_SE_FRAME_2 = 28871,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_BACK_NW_SE_FRAME_3 = 28872,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_FRONT_SW_NE_FRAME_0 = 28873,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_FRONT_SW_NE_FRAME_1 = 28874,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_FRONT_SW_NE_FRAME_2 = 28875,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_FRONT_SW_NE_FRAME_3 = 28876,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_FRONT_NW_SE_FRAME_0 = 28877,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_FRONT_NW_SE_FRAME_1 = 28878,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_FRONT_NW_SE_FRAME_2 = 28879,
SPR_GHOST_TRAIN_SPINNING_TUNNEL_FRONT_NW_SE_FRAME_3 = 28880,
};
extern const uint32 floorSpritesCork[];
@ -202,6 +202,7 @@ void track_paint_util_left_quarter_turn_3_tiles_paint(sint8 thickness, sint16 he
void track_paint_util_left_quarter_turn_3_tiles_tunnel(sint16 height, uint8 direction, uint8 trackSequence);
void track_paint_util_left_quarter_turn_1_tile_paint(sint8 thickness, sint16 height, sint16 boundBoxZOffset, int direction, uint32 colourFlags, const uint32 * sprites, uint8 rotation);
void track_paint_util_left_quarter_turn_1_tile_tunnel(sint16 height, uint8 direction, uint8 trackSequence);
void track_paint_util_spinning_tunnel_paint(sint8 thickness, sint16 height, uint8 direction, uint8 rotation);
typedef void (*TRACK_PAINT_FUNCTION)(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement);
typedef TRACK_PAINT_FUNCTION (*TRACK_PAINT_FUNCTION_GETTER)(int trackType, int direction);