Implemented junior rollercoaster paint

This commit is contained in:
duncanspumpkin 2015-10-28 20:35:01 +00:00
parent 2d1cbc916f
commit 9652f68024
8 changed files with 4646 additions and 13 deletions

View File

@ -492,7 +492,6 @@ bool metal_a_supports_paint_setup(int supportType, int segment, int special, int
image_id += z - 1;
image_id |= imageColourFlags;
sub_98197C(image_id, xOffset, yOffset, 0, 0, 0, height, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ, rotation);
height += z;

File diff suppressed because it is too large Load Diff

View File

@ -380,7 +380,7 @@ enum {
TRACK_ELEM_LEFT_FLYER_TWIST_UP,
TRACK_ELEM_RIGHT_FLYER_TWIST_UP,
TRACK_ELEM_LEFT_FLYER_TWIST_DOWN,
TRACK_ELEM_RIGHT_FLYER_TWIST_DOWN,
TRACK_ELEM_RIGHT_FLYER_TWIST_DOWN = 190,
TRACK_ELEM_FLYER_HALF_LOOP_UP,
TRACK_ELEM_FLYER_HALF_LOOP_DOWN,
TRACK_ELEM_LEFT_FLYER_CORKSCREW_UP,
@ -390,7 +390,7 @@ enum {
TRACK_ELEM_HEARTLINE_TRANSFER_UP,
TRACK_ELEM_HEARTLINE_TRANSFER_DOWN,
TRACK_ELEM_LEFT_HEARTLINE_ROLL,
TRACK_ELEM_RIGHT_HEARTLINE_ROLL,
TRACK_ELEM_RIGHT_HEARTLINE_ROLL = 200,
TRACK_ELEM_MINI_GOLF_HOLE_A,
TRACK_ELEM_MINI_GOLF_HOLE_B,
TRACK_ELEM_MINI_GOLF_HOLE_C,
@ -400,7 +400,7 @@ enum {
TRACK_ELEM_90_DEG_TO_INVERTED_FLAT_QUARTER_LOOP_UP,
TRACK_ELEM_INVERTED_FLAT_TO_90_DEG_QUARTER_LOOP_DOWN,
TRACK_ELEM_LEFT_CURVED_LIFT_HILL,
TRACK_ELEM_RIGHT_CURVED_LIFT_HILL,
TRACK_ELEM_RIGHT_CURVED_LIFT_HILL = 210,
TRACK_ELEM_LEFT_REVERSER,
TRACK_ELEM_RIGHT_REVERSER,
TRACK_ELEM_AIR_THRUST_TOP_CAP,

View File

@ -5566,7 +5566,7 @@ const TRACK_PAINT_FUNCTION_GETTER RideTypeTrackPaintFunctions[91] = {
0, // RIDE_TYPE_STAND_UP_ROLLER_COASTER
0, // RIDE_TYPE_SUSPENDED_SWINGING_COASTER
0, // RIDE_TYPE_INVERTED_ROLLER_COASTER
0, // RIDE_TYPE_JUNIOR_ROLLER_COASTER
get_track_paint_function_junior_rc, // RIDE_TYPE_JUNIOR_ROLLER_COASTER
0, // RIDE_TYPE_MINIATURE_RAILWAY
get_track_paint_function_monorail, // RIDE_TYPE_MONORAIL
0, // RIDE_TYPE_MINI_SUSPENDED_COASTER

View File

@ -551,6 +551,354 @@ void track_paint_util_draw_pier(rct_ride * ride, const rct_ride_entrance_definit
}
}
const rct_xy16 defaultRightHelixUpSmallQuarterBoundLengths[4][3][2] = {
{
{32, 20},
{16, 16},
{20, 32}
},
{
{20, 32},
{16, 16},
{ {32, 20}, {32, 1} }
},
{
{ {0}, {32, 1} },
{16, 16},
{ {0}, {32, 20} }
},
{
{ {20, 32}, {1, 32} },
{16, 16},
{32, 20},
}
};
const rct_xyz16 defaultRightHelixUpSmallQuarterBoundOffsets[4][3][2] = {
{
{0, 6},
{16, 16},
{6, 0},
},
{
{6, 0},
{16, 0},
{ {0, 6}, {0, 21} },
},
{
{ {0}, {0, 21} },
{0, 0, 21},
{ {0}, {21, 0} },
},
{
{ {6, 0}, {21, 0} },
{0, 16},
{0, 6},
}
};
static const sint8 right_helix_up_small_quarter_tiles_sprite_map[] = {0, -1, 1, 2};
void track_paint_util_right_helix_up_small_quarter_tiles_paint(const sint8 thickness[2], sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4][3][2], const rct_xy16 offsets[4][3][2], const rct_xy16 boundsLengths[4][3][2], const rct_xyz16 boundsOffsets[4][3][2], uint8 rotation)
{
int index = right_helix_up_small_quarter_tiles_sprite_map[trackSequence];
if (index < 0) {
return;
}
if (sprites[direction][index][0] != 0) {
uint32 imageId = sprites[direction][index][0] | colourFlags;
rct_xy16 offset = (offsets == NULL ? (rct_xy16) { 0, 0 } : offsets[direction][index][0]);
rct_xy16 boundsLength = boundsLengths[direction][index][0];
rct_xyz16 boundsOffset = (boundsOffsets == NULL ? (rct_xyz16) { .x = offset.x, .y = offset.y, .z = 0 } : boundsOffsets[direction][index][0]);
sub_98197C(imageId, (sint8)offset.x, (sint8)offset.y, boundsLength.x, boundsLength.y, thickness[0], height, boundsOffset.x, boundsOffset.y, height + boundsOffset.z, rotation);
}
if (sprites[direction][index][1] != 0) {
uint32 imageId = sprites[direction][index][1] | colourFlags;
rct_xy16 offset = (offsets == NULL ? (rct_xy16){0, 0} : offsets[direction][index][1]);
rct_xy16 boundsLength = boundsLengths[direction][index][1];
rct_xyz16 boundsOffset = (boundsOffsets == NULL ? (rct_xyz16){.x = offset.x, .y = offset.y, .z = 0} : boundsOffsets[direction][index][1]);
sub_98197C(imageId, (sint8) offset.x, (sint8) offset.y, boundsLength.x, boundsLength.y, thickness[1], height, boundsOffset.x, boundsOffset.y, height + boundsOffset.z, rotation);
}
}
const rct_xyz16 defaultRightHelixUpLargeQuarterBoundOffsets[4][5][2] = {
{
{0, 6},
{0, 16},
{0, 0},
{16, 0},
{6, 0},
},
{
{6, 0},
{16, 0},
{0, 16},
{0, 0},
{ {0, 6}, {0, 27} },
},
{
{ {0}, {0, 27} },
{0, 0, 27},
{16, 16, 27},
{0, 0, 27},
{ {0}, {27, 0} },
},
{
{{6, 0}, {27, 0} },
{0, 0},
{16, 0},
{0, 16},
{0, 6},
}
};
const rct_xy16 defaultRightHelixUpLargeQuarterBoundLengths[4][5][2] = {
{
{32, 20},
{32, 16},
{16, 16},
{16, 32},
{20, 32},
},
{
{20, 32},
{16, 32},
{16, 16},
{32, 16},
{ {32, 20}, {32, 1} },
},
{
{ {0}, {32, 1} },
{32, 16},
{16, 16},
{16, 32},
{ {0}, {1, 32} },
},
{
{{20, 32}, {1, 32} },
{16, 32},
{16, 16},
{32, 16},
{32, 20},
}
};
static const sint8 right_helix_up_large_quarter_sprite_map[] = {0, -1, 1, 2, -1, 3, 4};
void track_paint_util_right_helix_up_large_quarter_tiles_paint(const sint8 thickness[2], sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4][5][2], const rct_xy16 offsets[4][5][2], const rct_xy16 boundsLengths[4][5][2], const rct_xyz16 boundsOffsets[4][5][2], uint8 rotation)
{
int index = right_helix_up_large_quarter_sprite_map[trackSequence];
if (index < 0) {
return;
}
if (sprites[direction][index][0] != 0) {
uint32 imageId = sprites[direction][index][0] | colourFlags;
rct_xy16 offset = (offsets == NULL ? (rct_xy16) { 0, 0 } : offsets[direction][index][0]);
rct_xy16 boundsLength = boundsLengths[direction][index][0];
rct_xyz16 boundsOffset = (boundsOffsets == NULL ? (rct_xyz16) { .x = offset.x, .y = offset.y, .z = 0 } : boundsOffsets[direction][index][0]);
sub_98197C(imageId, (sint8)offset.x, (sint8)offset.y, boundsLength.x, boundsLength.y, thickness[0], height, boundsOffset.x, boundsOffset.y, height + boundsOffset.z, rotation);
}
if (sprites[direction][index][1] != 0) {
uint32 imageId = sprites[direction][index][1] | colourFlags;
rct_xy16 offset = (offsets == NULL ? (rct_xy16){0, 0} : offsets[direction][index][1]);
rct_xy16 boundsLength = boundsLengths[direction][index][1];
rct_xyz16 boundsOffset = (boundsOffsets == NULL ? (rct_xyz16){.x = offset.x, .y = offset.y, .z = 0} : boundsOffsets[direction][index][1]);
sub_98197C(imageId, (sint8) offset.x, (sint8) offset.y, boundsLength.x, boundsLength.y, thickness[1], height, boundsOffset.x, boundsOffset.y, height + boundsOffset.z, rotation);
}
}
const rct_xy16 defaultLeftEighthToDiagBoundLengths[4][4] = {
{
{32, 20},
{32, 16},
{16, 16},
{16, 16},
},
{
{20, 32},
{16, 34},
{16, 16},
{18, 16},
},
{
{32, 20},
{32, 16},
{16, 16},
{16, 16},
},
{
{20, 32},
{16, 32},
{16, 16},
{16, 16},
},
};
const rct_xyz16 defaultLeftEighthToDiagBoundOffsets[4][4] = {
{
{0, 6},
{0, 0},
{0, 16},
{16, 16},
},
{
{6, 0},
{0, 0},
{16, 16},
{16, 0},
},
{
{0, 6},
{0, 16},
{16, 0},
{0, 0},
},
{
{6, 0},
{16, 0},
{0, 0},
{0, 16},
},
};
const rct_xy16 defaultRightEighthToDiagBoundLengths[4][4] = {
{
{32, 20},
{32, 16},
{16, 16},
{16, 16},
},
{
{20, 32},
{16, 32},
{16, 16},
{16, 16},
},
{
{32, 20},
{34, 16},
{28, 28},
{16, 18},
},
{
{20, 32},
{16, 32},
{16, 16},
{16, 16},
},
};
const rct_xyz16 defaultRightEighthToDiagBoundOffsets[4][4] = {
{
{0, 6},
{0, 16},
{0, 0},
{16, 0},
},
{
{6, 0},
{16, 0},
{0, 16},
{0, 0},
},
{
{0, 6},
{0, 0},
{4, 4},
{0, 16},
},
{
{6, 0},
{0, 0},
{16, 0},
{16, 16},
},
};
const sint8 defaultEighthToDiagThickness[4][4] = {
{
1,
1,
1,
1,
},
{
1,
1,
1,
1,
},
{
1,
1,
1,
1,
},
{
1,
1,
1,
1,
},
};
static const sint8 eighth_to_diag_sprite_map[] = {0, 1, 2, -1, 3};
void track_paint_util_eighth_to_diag_tiles_paint(const sint8 thickness[4][4], sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4][4], const rct_xy16 offsets[4][4], const rct_xy16 boundsLengths[4][4], const rct_xyz16 boundsOffsets[4][4], uint8 rotation)
{
int index = eighth_to_diag_sprite_map[trackSequence];
if (index < 0) {
return;
}
uint32 imageId = sprites[direction][index] | colourFlags;
rct_xy16 offset = (offsets == NULL ? (rct_xy16) { 0, 0 } : offsets[direction][index]);
rct_xy16 boundsLength = boundsLengths[direction][index];
rct_xyz16 boundsOffset = (boundsOffsets == NULL ? (rct_xyz16) { .x = offset.x, .y = offset.y, .z = 0 } : boundsOffsets[direction][index]);
sub_98197C(imageId, (sint8)offset.x, (sint8)offset.y, boundsLength.x, boundsLength.y, thickness[direction][index], height, boundsOffset.x, boundsOffset.y, height + boundsOffset.z, rotation);
}
const rct_xy16 defaultDiagTileOffsets[4] = {
{-16, -16},
{-16, -16},
{-16, -16},
{-16, -16},
};
const rct_xy16 defaultDiagBoundLengths[4] = {
{32, 32},
{32, 32},
{32, 32},
{32, 32},
};
static const sint8 diag_sprite_map[4][4] = {
{-1, 0, -1, -1},
{-1, -1, -1, 0},
{-1, -1, 0, -1},
{0, -1, -1, -1},
};
void track_paint_util_diag_tiles_paint(sint8 thickness, sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4], const rct_xy16 offsets[4], const rct_xy16 boundsLengths[4], const rct_xyz16 boundsOffsets[4], uint8 rotation)
{
int index = diag_sprite_map[direction][trackSequence];
if (index < 0) {
return;
}
uint32 imageId = sprites[direction] | colourFlags;
rct_xy16 offset = (offsets == NULL ? (rct_xy16) { 0, 0 } : offsets[direction]);
rct_xy16 boundsLength = boundsLengths[direction];
rct_xyz16 boundsOffset = (boundsOffsets == NULL ? (rct_xyz16) { .x = offset.x, .y = offset.y, .z = 0 } : boundsOffsets[direction]);
sub_98197C(imageId, (sint8)offset.x, (sint8)offset.y, boundsLength.x, boundsLength.y, thickness, height, boundsOffset.x, boundsOffset.y, height + boundsOffset.z, rotation);
}
const uint8 mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[] = {6, 4, 5, 3, 1, 2, 0};
const rct_xy16 defaultRightQuarterTurn5TilesOffsets[4][5] = {
@ -916,7 +1264,7 @@ void track_paint(uint8 direction, int height, rct_map_element *mapElement)
}
int rideType = ride->type;
if (rideType == RIDE_TYPE_JUNIOR_ROLLER_COASTER) {
if (rideType == RIDE_TYPE_JUNIOR_ROLLER_COASTER && gUseOriginalRidePaint) {
switch (trackType) {
case TRACK_ELEM_60_DEG_UP:
case TRACK_ELEM_25_DEG_UP_TO_60_DEG_UP:

View File

@ -187,6 +187,21 @@ extern const uint8 mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[];
extern const rct_xy16 defaultRightQuarterTurn3TilesOffsets[4][3];
extern const rct_xy16 defaultRightQuarterTurn3TilesBoundLengths[4][3];
extern const rct_xy16 defaultRightHelixUpSmallQuarterBoundLengths[4][3][2];
extern const rct_xyz16 defaultRightHelixUpSmallQuarterBoundOffsets[4][3][2];
extern const rct_xy16 defaultRightHelixUpLargeQuarterBoundLengths[4][5][2];
extern const rct_xyz16 defaultRightHelixUpLargeQuarterBoundOffsets[4][5][2];
extern const rct_xyz16 defaultLeftEighthToDiagBoundOffsets[4][4];
extern const rct_xy16 defaultLeftEighthToDiagBoundLengths[4][4];
extern const rct_xyz16 defaultRightEighthToDiagBoundOffsets[4][4];
extern const rct_xy16 defaultRightEighthToDiagBoundLengths[4][4];
extern const sint8 defaultEighthToDiagThickness[4][4];
extern const rct_xy16 defaultDiagBoundLengths[4];
extern const rct_xy16 defaultDiagTileOffsets[4];
extern bool gUseOriginalRidePaint;
bool track_paint_util_has_fence(enum edge edge, rct_xy16 position, rct_map_element * mapElement, rct_ride * ride, uint8 rotation);
@ -207,6 +222,10 @@ void track_paint_util_left_quarter_turn_3_tiles_tunnel(sint16 height, uint8 dire
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);
void track_paint_util_right_helix_up_small_quarter_tiles_paint(const sint8 thickness[2], sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4][3][2], const rct_xy16 offsets[4][3][2], const rct_xy16 boundsLengths[4][3][2], const rct_xyz16 boundsOffsets[4][3][2], uint8 rotation);
void track_paint_util_right_helix_up_large_quarter_tiles_paint(const sint8 thickness[2], sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4][5][2], const rct_xy16 offsets[4][5][2], const rct_xy16 boundsLengths[4][5][2], const rct_xyz16 boundsOffsets[4][5][2], uint8 rotation);
void track_paint_util_eighth_to_diag_tiles_paint(const sint8 thickness[4][4], sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4][4], const rct_xy16 offsets[4][4], const rct_xy16 boundsLengths[4][4], const rct_xyz16 boundsOffsets[4][4], uint8 rotation);
void track_paint_util_diag_tiles_paint(sint8 thickness, sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4], const rct_xy16 offsets[4], const rct_xy16 boundsLengths[4], const rct_xyz16 boundsOffsets[4], 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);
@ -248,5 +267,6 @@ TRACK_PAINT_FUNCTION get_track_paint_function_magic_carpet(int trackType, int di
TRACK_PAINT_FUNCTION get_track_paint_function_submarine_ride(int trackType, int direction);
TRACK_PAINT_FUNCTION get_track_paint_function_river_rafts(int trackType, int direction);
TRACK_PAINT_FUNCTION get_track_paint_function_enterprise(int trackType, int direction);
TRACK_PAINT_FUNCTION get_track_paint_function_junior_rc(int trackType, int direction);
#endif

View File

@ -5644,13 +5644,13 @@ static void check_and_apply_block_section_stop_site(rct_vehicle *vehicle)
switch (trackType) {
case TRACK_ELEM_BLOCK_BRAKES:
if (ride_is_block_sectioned(ride))
apply_block_brakes(vehicle, trackElement->flags & MAP_ELEMENT_FLAG_BLOCK_BREAK_CLOSED);
apply_block_brakes(vehicle, trackElement->flags & MAP_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED);
else
apply_non_stop_block_brake(vehicle, true);
break;
case TRACK_ELEM_END_STATION:
if (trackElement->flags & MAP_ELEMENT_FLAG_BLOCK_BREAK_CLOSED)
if (trackElement->flags & MAP_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED)
RCT2_GLOBAL(0x00F64E18, uint32) |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_10;
break;
@ -5661,12 +5661,11 @@ static void check_and_apply_block_section_stop_site(rct_vehicle *vehicle)
case TRACK_ELEM_DIAG_60_DEG_UP_TO_FLAT:
if(ride_is_block_sectioned(ride)){
if(trackType == TRACK_ELEM_CABLE_LIFT_HILL || track_element_is_lift_hill(trackElement)) {
if (trackElement->flags & MAP_ELEMENT_FLAG_BLOCK_BREAK_CLOSED) {
if (trackElement->flags & MAP_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED) {
apply_block_brakes(vehicle, true);
}
}
}
break;
}
}
@ -5727,7 +5726,7 @@ static void vehicle_update_block_breaks_open_previous_section(rct_vehicle *vehic
if (mapElement == NULL) {
return;
}
mapElement->flags &= ~MAP_ELEMENT_FLAG_BLOCK_BREAK_CLOSED;
mapElement->flags &= ~MAP_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED;
map_invalidate_element(x, y, mapElement);
int trackType = mapElement->properties.track.type;
@ -6992,7 +6991,7 @@ static bool vehicle_update_track_motion_forwards_get_new_track(rct_vehicle *vehi
if (track_element_is_block_start(mapElement)) {
if (vehicle->next_vehicle_on_train == SPRITE_INDEX_NULL) {
mapElement->flags |= MAP_ELEMENT_FLAG_BLOCK_BREAK_CLOSED;
mapElement->flags |= MAP_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED;
if (trackType == TRACK_ELEM_BLOCK_BRAKES || trackType == TRACK_ELEM_END_STATION) {
if (!(rideEntry->vehicles[0].flags_b & VEHICLE_ENTRY_FLAG_B_3)) {
audio_play_sound_at_location(SOUND_49, vehicle->track_x, vehicle->track_y, vehicle->track_z);

View File

@ -149,7 +149,7 @@ enum {
enum {
MAP_ELEMENT_FLAG_GHOST = (1 << 4),
MAP_ELEMENT_FLAG_BROKEN = (1 << 5),
MAP_ELEMENT_FLAG_BLOCK_BREAK_CLOSED = (1 << 5),
MAP_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED = (1 << 5),
MAP_ELEMENT_FLAG_LAST_TILE = (1 << 7)
};