Merge pull request #4507 from marijnvdwerf/paint-setup/various-fixes

Paint setup/various fixes
This commit is contained in:
Ted John 2016-10-01 11:17:05 +01:00 committed by GitHub
commit aee8c2d847
8 changed files with 91 additions and 60 deletions

View File

@ -363,11 +363,11 @@ install(FILES ${DOC_FILES} DESTINATION share/doc/${PROJECT})
if (UNIX AND (NOT USE_MMAP) AND (NOT DISABLE_RCT2) AND (NOT FORCE64))
file(GLOB_RECURSE ORCT2_RIDE_SOURCES "src/ride/*/*.c")
file(GLOB_RECURSE ORCT2_RIDE_DEP_SOURCES "src/ride/ride_data.c" "src/ride/track_data.c" "src/ride/track_data_old.c" "src/ride/track_paint.c" "src/addresses.c" "src/diagnostic.c" "src/hook.c" "src/paint/map_element/map_element.c")
file(GLOB_RECURSE ORCT2_RIDE_DEP_SOURCES "src/ride/ride_data.c" "src/ride/track_data.c" "src/ride/track_data_old.c" "src/ride/track_paint.c" "src/addresses.c" "src/diagnostic.c" "src/hook.c" "src/paint/map_element/map_element.c" "src/paint/paint_helpers.c")
file(GLOB_RECURSE ORCT2_TESTPAINT_SOURCES "test/testpaint/*.c" "test/testpaint/*.cpp" "test/testpaint/*.h")
add_executable(testpaint EXCLUDE_FROM_ALL ${ORCT2_RIDE_SOURCES} ${ORCT2_RIDE_DEP_SOURCES} ${ORCT2_TESTPAINT_SOURCES} ${RCT2_SECTIONS})
set_target_properties(testpaint PROPERTIES COMPILE_FLAGS "-DNO_VEHICLES")
set_target_properties(testpaint PROPERTIES COMPILE_FLAGS "-DNO_VEHICLES -D__TESTPAINT__")
add_dependencies(testpaint segfiles)
endif ()

View File

@ -2164,13 +2164,9 @@ static void junior_rc_left_bank_to_25_deg_up_paint_setup(uint8 rideIndex, uint8
image_id = junior_rc_track_pieces_left_banked_to_25_deg_up[direction][0] | gTrackColours[SCHEME_TRACK];
if (direction & 1) {
sub_98197C(image_id, 0, 0, 20, 32, 1, height, 6, 0, height, get_current_rotation());
paint_util_push_tunnel_right(height, 0);
}
else {
sub_98197C(image_id, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation());
paint_util_push_tunnel_left(height, 0);
}
if (junior_rc_track_pieces_left_banked_to_25_deg_up[direction][1] != 0) {
@ -2190,6 +2186,13 @@ static void junior_rc_left_bank_to_25_deg_up_paint_setup(uint8 rideIndex, uint8
metal_a_supports_paint_setup(edi, 4, 3, height, gTrackColours[SCHEME_SUPPORTS]);
}
switch(direction) {
case 0: paint_util_push_tunnel_left(height, TUNNEL_0); break;
case 1: paint_util_push_tunnel_right(height, TUNNEL_2); break;
case 2: paint_util_push_tunnel_left(height, TUNNEL_2); break;
case 3: paint_util_push_tunnel_right(height, TUNNEL_0); break;
}
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(height + 48, 0x20);
}
@ -2204,13 +2207,9 @@ static void junior_rc_right_bank_to_25_deg_up_paint_setup(uint8 rideIndex, uint8
image_id = junior_rc_track_pieces_right_banked_to_25_deg_up[direction][0] | gTrackColours[SCHEME_TRACK];
if (direction & 1) {
sub_98197C(image_id, 0, 0, 20, 32, 1, height, 6, 0, height, get_current_rotation());
paint_util_push_tunnel_right(height, TUNNEL_2);
}
else {
sub_98197C(image_id, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation());
paint_util_push_tunnel_left(height, TUNNEL_0);
}
if (junior_rc_track_pieces_right_banked_to_25_deg_up[direction][1] != 0) {
@ -2230,6 +2229,13 @@ static void junior_rc_right_bank_to_25_deg_up_paint_setup(uint8 rideIndex, uint8
metal_a_supports_paint_setup(edi, 4, 3, height, gTrackColours[SCHEME_SUPPORTS]);
}
switch(direction) {
case 0: paint_util_push_tunnel_left(height, TUNNEL_0); break;
case 1: paint_util_push_tunnel_right(height, TUNNEL_2); break;
case 2: paint_util_push_tunnel_left(height, TUNNEL_2); break;
case 3: paint_util_push_tunnel_right(height, TUNNEL_0); break;
}
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(height + 48, 0x20);
}
@ -3014,21 +3020,21 @@ static void junior_rc_right_half_banked_helix_down_small_paint_setup(uint8 rideI
}
if (direction == 0 && trackSequence == 0) {
paint_util_push_tunnel_left(height, TUNNEL_0);
}
if (direction == 0 && trackSequence == 3) {
paint_util_push_tunnel_right(height + 8, TUNNEL_0);
}
if (direction == 1 && trackSequence == 3) {
paint_util_push_tunnel_left(height + 8, TUNNEL_0);
}
if (direction == 3 && trackSequence == 0) {
if (direction == 0 && trackSequence == 3) {
paint_util_push_tunnel_right(height, TUNNEL_0);
}
if (direction == 1 && trackSequence == 3) {
paint_util_push_tunnel_left(height, TUNNEL_0);
}
if (direction == 3 && trackSequence == 0) {
paint_util_push_tunnel_right(height + 8, TUNNEL_0);
}
int blockedSegments = 0;
switch (trackSequence) {
case 0: blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC | SEGMENT_D4; break;
@ -3129,21 +3135,21 @@ static void junior_rc_right_half_banked_helix_down_large_paint_setup(uint8 rideI
}
if (direction == 0 && trackSequence == 0) {
paint_util_push_tunnel_left(height, TUNNEL_0);
}
if (direction == 0 && trackSequence == 6) {
paint_util_push_tunnel_right(height + 8, TUNNEL_0);
}
if (direction == 1 && trackSequence == 6) {
paint_util_push_tunnel_left(height + 8, TUNNEL_0);
}
if (direction == 3 && trackSequence == 0) {
if (direction == 0 && trackSequence == 6) {
paint_util_push_tunnel_right(height, TUNNEL_0);
}
if (direction == 1 && trackSequence == 6) {
paint_util_push_tunnel_left(height, TUNNEL_0);
}
if (direction == 3 && trackSequence == 0) {
paint_util_push_tunnel_right(height + 8, TUNNEL_0);
}
switch (trackSequence) {
case 0: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_D4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC, direction), 0xFFFF, 0); break;
case 2: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), 0xFFFF, 0); break;

View File

@ -37,12 +37,13 @@ static void paint_circus_show_tent(uint8 rideIndex, uint8 direction, sint8 al, s
}
uint32 imageColourFlags = gTrackColours[SCHEME_MISC];
uint32 imageId = ride_type->vehicles[0].base_image_id;
if (imageColourFlags == 0x20000000) {
imageColourFlags = ride->vehicle_colours[0].body_colour << 19 | ride->vehicle_colours[0].trim_colour << 24 | 0xA0000000;
imageId += direction;
}
uint32 imageId = (ride_type->vehicles[0].base_image_id + direction) | imageColourFlags;
sub_98197C(imageId, al, cl, 24, 24, 47, height + 3, al + 16, cl + 16, height + 3, get_current_rotation());
sub_98197C(imageId | imageColourFlags, al, cl, 24, 24, 47, height + 3, al + 16, cl + 16, height + 3, get_current_rotation());
g_currently_drawn_item = savedMapElement;
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;

View File

@ -258,8 +258,7 @@ static void paint_ghost_train_track_flat_to_25_deg_up(uint8 rideIndex, uint8 tra
paint_util_set_general_support_height(height + 48, 0x20);
}
/** rct2: 0x00770C1C */
static void paint_ghost_train_track_25_deg_up_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
static void paint_ghost_train_track_25_deg_up_to_flat_shared(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
rct_xy16 position = {gPaintMapPosition.x, gPaintMapPosition.y};
@ -281,25 +280,23 @@ static void paint_ghost_train_track_25_deg_up_to_flat(uint8 rideIndex, uint8 tra
metal_a_supports_paint_setup(3, 4, 6, height, gTrackColours[SCHEME_SUPPORTS]);
}
switch (direction) {
case 0:
paint_util_push_tunnel_left(height - 8, TUNNEL_0);
break;
case 1:
paint_util_push_tunnel_right(height + 8, TUNNEL_12);
break;
case 2:
paint_util_push_tunnel_left(height + 8, TUNNEL_12);
break;
case 3:
paint_util_push_tunnel_right(height - 8, TUNNEL_0);
break;
}
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(height + 40, 0x20);
}
/** rct2: 0x00770C1C */
static void paint_ghost_train_track_25_deg_up_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
paint_ghost_train_track_25_deg_up_to_flat_shared(rideIndex, trackSequence, direction, height, mapElement);
switch (direction) {
case 0: paint_util_push_tunnel_left(height - 8, TUNNEL_0); break;
case 1: paint_util_push_tunnel_right(height + 8, TUNNEL_12); break;
case 2: paint_util_push_tunnel_left(height + 8, TUNNEL_12); break;
case 3: paint_util_push_tunnel_right(height - 8, TUNNEL_0); break;
}
}
/** rct2: 0x00770C2C */
static void paint_ghost_train_track_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
@ -309,7 +306,14 @@ static void paint_ghost_train_track_25_deg_down(uint8 rideIndex, uint8 trackSequ
/** rct2: 0x00770C3C */
static void paint_ghost_train_track_flat_to_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
paint_ghost_train_track_25_deg_up_to_flat(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement);
paint_ghost_train_track_25_deg_up_to_flat_shared(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement);
switch ((direction + 2) % 4) {
case 0: paint_util_push_tunnel_left(height - 8, TUNNEL_0); break;
case 1: paint_util_push_tunnel_right(height + 8, TUNNEL_0); break;
case 2: paint_util_push_tunnel_left(height + 8, TUNNEL_0); break;
case 3: paint_util_push_tunnel_right(height - 8, TUNNEL_0); break;
}
}
/** rct2: 0x00770C4C */

View File

@ -88,15 +88,21 @@ static void paint_observation_tower_base(uint8 rideIndex, uint8 trackSequence, u
imageId = SPR_OBSERVATION_TOWER_SEGMENT_BASE | gTrackColours[SCHEME_TRACK];
sub_98197C(imageId, 0, 0, 2, 2, 27, height, 8, 8, height + 3, get_current_rotation());
height += 32;
imageId = SPR_OBSERVATION_TOWER_SEGMENT | gTrackColours[SCHEME_TRACK];
sub_98197C(imageId, 0, 0, 2, 2, 30, height, 8, 8, height, get_current_rotation());
sub_98197C(imageId, 0, 0, 2, 2, 30, height + 32, 8, 8, height + 32, get_current_rotation());
height += 32;
imageId = SPR_OBSERVATION_TOWER_SEGMENT | gTrackColours[SCHEME_TRACK];
sub_98197C(imageId, 0, 0, 2, 2, 30, height, 8, 8, height, get_current_rotation());
sub_98197C(imageId, 0, 0, 2, 2, 30, height + 64, 8, 8, height + 64, get_current_rotation());
paint_util_set_vertical_tunnel(height + 32);
paint_util_set_vertical_tunnel(height + 96);
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
#ifdef __TESTPAINT__
paint_util_set_general_support_height(height + 32, 0x20);
#else
paint_util_set_general_support_height(height + 96, 0x20);
#endif
return;
}
int blockedSegments = 0;

View File

@ -103,20 +103,26 @@ static void paint_roto_drop_base(uint8 rideIndex, uint8 trackSequence, uint8 dir
imageId = (direction & 1 ? SPR_ROTO_DROP_TOWER_BASE_90_DEG : SPR_ROTO_DROP_TOWER_BASE) | gTrackColours[SCHEME_TRACK];
sub_98197C(imageId, 0, 0, 2, 2, 27, height, 8, 8, height + 3, get_current_rotation());
height += 32;
imageId = (direction & 1 ? SPR_ROTO_DROP_TOWER_BASE_SEGMENT_90_DEG : SPR_ROTO_DROP_TOWER_BASE_SEGMENT) | gTrackColours[SCHEME_TRACK];
sub_98197C(imageId, 0, 0, 2, 2, 30, height, 8, 8, height, get_current_rotation());
sub_98197C(imageId, 0, 0, 2, 2, 30, height + 32, 8, 8, height + 32, get_current_rotation());
height += 32;
imageId = (direction & 1 ? SPR_ROTO_DROP_TOWER_BASE_SEGMENT_90_DEG : SPR_ROTO_DROP_TOWER_BASE_SEGMENT) | gTrackColours[SCHEME_TRACK];
sub_98197C(imageId, 0, 0, 2, 2, 30, height, 8, 8, height, get_current_rotation());
sub_98197C(imageId, 0, 0, 2, 2, 30, height + 64, 8, 8, height + 64, get_current_rotation());
paint_util_set_vertical_tunnel(height + 32);
paint_util_set_vertical_tunnel(height + 96);
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
#ifdef __TESTPAINT__
paint_util_set_general_support_height(height + 32, 0x20);
#else
paint_util_set_general_support_height(height + 96, 0x20);
#endif
return;
}
int blockedSegments = 0;
switch (trackSequence) {
case 0: blockedSegments = SEGMENTS_ALL; break;
case 1: blockedSegments = SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC; break;
case 2: blockedSegments = SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC; break;
case 3: blockedSegments = SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0; break;

View File

@ -68,8 +68,11 @@ static void paint_lift_base(uint8 rideIndex, uint8 trackSequence, uint8 directio
paint_util_set_vertical_tunnel(height + 96);
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
// Original set support height to (height + 32). Caused supports to code with lift cage.
#ifdef __TESTPAINT__
paint_util_set_general_support_height(height + 32, 0x20);
#else
paint_util_set_general_support_height(height + 96, 0x20);
#endif
return;
}

View File

@ -251,6 +251,7 @@ enum {
SPRITEGROUP_FENCE_METAL_A, // 14568
SPRITEGROUP_FENCE_METAL_B, // 14990
SPRITEGROUP_FENCE_SPIRAL_SLIDE, // 20564
SPRITEGROUP_FLOOR_CORK, // 22134
SPRITEGROUP_FENCE_ROPE, // 22138
@ -265,6 +266,10 @@ static int getSpriteGroup(uint16 spriteIndex) {
return SPRITEGROUP_FENCE_METAL_B;
}
if (spriteIndex >= 20564 && spriteIndex <= 20567) {
return SPRITEGROUP_FENCE_SPIRAL_SLIDE;
}
if (spriteIndex >= 22134 && spriteIndex <= 22137) {
return SPRITEGROUP_FLOOR_CORK;
}