Paint crooked house base

This commit is contained in:
Marijn van der Werf 2016-04-11 15:21:13 +02:00
parent 0860cf4540
commit 14caf2c1ca
3 changed files with 289 additions and 2 deletions

View File

@ -5542,7 +5542,7 @@ const uint32 RideTypeTrackPaintFunctionsOld[91] = {
0x008AD280, // RIDE_TYPE_GIGA_COASTER
0x00886074, // RIDE_TYPE_ROTO_DROP
0x00887208, // RIDE_TYPE_FLYING_SAUCERS
0x00889C28, // RIDE_TYPE_CROOKED_HOUSE
0, // RIDE_TYPE_CROOKED_HOUSE
0x0088AC88, // RIDE_TYPE_MONORAIL_CYCLES
0x008AE36C, // RIDE_TYPE_COMPACT_INVERTED_COASTER
0x008AEDE0, // RIDE_TYPE_WATER_COASTER
@ -5637,7 +5637,7 @@ const TRACK_PAINT_FUNCTION_GETTER RideTypeTrackPaintFunctions[91] = {
0, // RIDE_TYPE_GIGA_COASTER
0, // RIDE_TYPE_ROTO_DROP
0, // RIDE_TYPE_FLYING_SAUCERS
0, // RIDE_TYPE_CROOKED_HOUSE
get_track_paint_function_crooked_house, // RIDE_TYPE_CROOKED_HOUSE
0, // RIDE_TYPE_MONORAIL_CYCLES
0, // RIDE_TYPE_COMPACT_INVERTED_COASTER
0, // RIDE_TYPE_WATER_COASTER

View File

@ -990,3 +990,289 @@ TRACK_PAINT_FUNCTION get_track_paint_function_facility(int trackType, int direct
}
return NULL;
}
static void crooked_house_paint_supports(uint8 direction, int height) {
wooden_a_supports_paint_setup((direction & 1), 0, height, RCT2_GLOBAL(0x00F441A0, uint32), NULL);
}
static void crooked_house_paint_floor(int height, int floor_sprite_id) {
uint32 image_id = floor_sprite_id | RCT2_GLOBAL(0x00F44198, uint32);
RCT2_GLOBAL(0x009DEA52, uint16) = 0;
RCT2_GLOBAL(0x009DEA54, uint16) = 0;
RCT2_GLOBAL(0x009DEA56, sint16) = height;
sub_98197C(image_id, 0, 0, 31, 31, 1, height, get_current_rotation());
}
static void crooked_house_paint_support_heights() {
RCT2_GLOBAL(0x0141E9D0, sint16) = -1;
RCT2_GLOBAL(0x0141E9C4, sint16) = -1;
RCT2_GLOBAL(0x0141E9CC, sint16) = -1;
RCT2_GLOBAL(0x0141E9B8, sint16) = -1;
RCT2_GLOBAL(0x0141E9BC, sint16) = -1;
RCT2_GLOBAL(0x0141E9B4, sint16) = -1;
RCT2_GLOBAL(0x0141E9C0, sint16) = -1;
RCT2_GLOBAL(0x0141E9C8, sint16) = -1;
RCT2_GLOBAL(0x0141E9D4, sint16) = -1;
}
static void crooked_house_paint_max_height(int height) {
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) < height) {
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) = height;
RCT2_GLOBAL(0x00141E9DA, uint8) = 32;
}
}
static void crooked_house_fence_top_left(rct_ride *ride, int height, rct_map_element *mapElement) {
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint8 entranceId = (mapElement->properties.entrance.index & 0x70) >> 4;
uint16 entranceLoc =
((x / 32) + loc_7667AE[get_current_rotation()].x) |
(((y / 32) + loc_7667AE[get_current_rotation()].y) << 8);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
uint32 image_id = 22141 | RCT2_GLOBAL(0x00F441A0, uint32);
RCT2_GLOBAL(0x009DEA52, uint16) = 0;
RCT2_GLOBAL(0x009DEA54, uint16) = 2;
RCT2_GLOBAL(0x009DEA56, uint16) = height + 2;
sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0);
}
}
static void crooked_house_fence_top_right(rct_ride *ride, int height, rct_map_element *mapElement) {
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint8 entranceId = (mapElement->properties.entrance.index & 0x70) >> 4;
uint16 entranceLoc =
((x / 32) + loc_7667AC[get_current_rotation()].x) |
(((y / 32) + loc_7667AC[get_current_rotation()].y) << 8);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
uint32 image_id = 22138 | RCT2_GLOBAL(0x00F441A0, uint32);
RCT2_GLOBAL(0x009DEA52, uint16) = 0;
RCT2_GLOBAL(0x009DEA54, uint16) = 2;
RCT2_GLOBAL(0x009DEA56, uint16) = height + 2;
sub_98199C(image_id, 0, 0, 1, 32, 7, height, 0);
}
}
static void crooked_house_fence_bottom_right(rct_ride *ride, int height, rct_map_element *mapElement) {
uint32 image_id = 22139 | RCT2_GLOBAL(0x00F441A0, uint32);
RCT2_GLOBAL(0x009DEA52, uint16) = 0;
RCT2_GLOBAL(0x009DEA54, uint16) = 30;
RCT2_GLOBAL(0x009DEA56, uint16) = height + 2;
sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0);
}
static void crooked_house_fence_bottom_left(rct_ride *ride, int height, rct_map_element *mapElement) {
uint32 image_id = 22140 | RCT2_GLOBAL(0x00F441A0, uint32);
RCT2_GLOBAL(0x009DEA52, uint16) = 30;
RCT2_GLOBAL(0x009DEA54, uint16) = 0;
RCT2_GLOBAL(0x009DEA56, uint16) = height + 2;
sub_98199C(image_id, 0, 0, 1, 32, 7, height, 0);
}
/**
* rct2: 0x0088ABA4
* @param (edi) rideIndex
* @param (al) al
* @param (cl) cl
* @param (ebx) image_id
* @param (edx) height
*/
static void sub_88ABA4(uint8 rideIndex, uint8 al, uint8 cl, uint32 image_id, int height) {
RCT2_CALLPROC_X(0x88ABA4, al, image_id, cl, height, 0, rideIndex * sizeof(rct_ride), 0);
}
static void crooked_house_paint_setup_889F08(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
crooked_house_paint_supports(direction, height);
crooked_house_paint_floor(height, 22137);
crooked_house_paint_support_heights();
crooked_house_paint_max_height(height + 128);
}
static void crooked_house_paint_setup_889FCC(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
crooked_house_paint_supports(direction, height);
crooked_house_paint_floor(height, 22137);
rct_ride *ride = get_ride(rideIndex);
crooked_house_fence_top_left(ride, height, mapElement);
crooked_house_fence_top_right(ride, height, mapElement);
height += 2;
crooked_house_paint_support_heights();
RCT2_GLOBAL(0x141E9B4, sint16) = (height & 0xFF00) | 0x20;
RCT2_GLOBAL(0x141E9C8, sint16) = (height & 0xFF00) | 0x20;
RCT2_GLOBAL(0x141E9CC, sint16) = (height & 0xFF00) | 0x20;
crooked_house_paint_max_height(height + 126);
}
static void crooked_house_paint_setup_88A1D0(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
crooked_house_paint_supports(direction, height);
crooked_house_paint_floor(height, 22136);
rct_ride *ride = get_ride(rideIndex);
crooked_house_fence_top_right(ride, height, mapElement);
crooked_house_fence_bottom_right(ride, height, mapElement);
// unpop edi
sub_88ABA4(rideIndex, 32, 224, 0, height);
height += 2;
crooked_house_paint_support_heights();
RCT2_GLOBAL(0x141E9CC, sint16) = (height & 0xFF00) | 0x20;
RCT2_GLOBAL(0x141E9BC, sint16) = (height & 0xFF00) | 0x20;
RCT2_GLOBAL(0x141E9D4, sint16) = (height & 0xFF00) | 0x20;
crooked_house_paint_max_height(height + 126);
}
static void crooked_house_paint_setup_88A392(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
crooked_house_paint_supports(direction, height);
crooked_house_paint_floor(height, 22135);
rct_ride *ride = get_ride(rideIndex);
crooked_house_fence_top_left(ride, height, mapElement);
crooked_house_fence_bottom_left(ride, height, mapElement);
sub_88ABA4(rideIndex, 224, 32, 4, height);
height += 2;
crooked_house_paint_support_heights();
RCT2_GLOBAL(0x141E9C8, sint16) = (height & 0xFF00) | 0x20;
RCT2_GLOBAL(0x141E9B8, sint16) = (height & 0xFF00) | 0x20;
RCT2_GLOBAL(0x141E9D0, sint16) = (height & 0xFF00) | 0x20;
crooked_house_paint_max_height(height + 126);
}
static void crooked_house_paint_setup_88A554(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
crooked_house_paint_supports(direction, height);
crooked_house_paint_floor(height, 22134);
rct_ride *ride = get_ride(rideIndex);
crooked_house_fence_bottom_left(ride, height, mapElement);
crooked_house_fence_bottom_right(ride, height, mapElement);
sub_88ABA4(rideIndex, 224, 224, 2, height);
height += 2;
crooked_house_paint_support_heights();
RCT2_GLOBAL(0x141E9D0, sint16) = (height & 0xFF00) | 0x20;
RCT2_GLOBAL(0x141E9C0, sint16) = (height & 0xFF00) | 0x20;
RCT2_GLOBAL(0x141E9D4, sint16) = (height & 0xFF00) | 0x20;
crooked_house_paint_max_height(height + 126);
}
static void crooked_house_paint_setup_88A97C(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
crooked_house_paint_supports(direction, height);
crooked_house_paint_floor(height, 22136);
rct_ride *ride = get_ride(rideIndex);
crooked_house_fence_bottom_right(ride, height, mapElement);
sub_88ABA4(rideIndex, 0, 224, 1, height);
crooked_house_paint_support_heights();
crooked_house_paint_max_height(height + 128);
}
static void crooked_house_paint_setup_88A821(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
crooked_house_paint_supports(direction, height);
crooked_house_paint_floor(height, 22137);
rct_ride *ride = get_ride(rideIndex);
crooked_house_fence_top_left(ride, height, mapElement);
crooked_house_paint_support_heights();
crooked_house_paint_max_height(height + 128);
}
static void crooked_house_paint_setup_88A6C6(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
crooked_house_paint_supports(direction, height);
crooked_house_paint_floor(height, 22137);
rct_ride *ride = get_ride(rideIndex);
crooked_house_fence_top_right(ride, height, mapElement);
crooked_house_paint_support_heights();
crooked_house_paint_max_height(height + 128);
}
// bottom center
static void crooked_house_paint_setup_88AA90(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
crooked_house_paint_supports(direction, height);
crooked_house_paint_floor(height, 22135);
rct_ride *ride = get_ride(rideIndex);
crooked_house_fence_bottom_left(ride, height, mapElement);
//sub_88ABA4(rideIndex, 224, 0, 3, height);
crooked_house_paint_support_heights();
crooked_house_paint_max_height(height + 128);
}
TRACK_PAINT_FUNCTION crooked_house_paint_setup_functions[][9] = {
{
crooked_house_paint_setup_889F08,
crooked_house_paint_setup_889FCC,
crooked_house_paint_setup_88A6C6,
crooked_house_paint_setup_88A1D0,
crooked_house_paint_setup_88A821,
crooked_house_paint_setup_88A97C,
crooked_house_paint_setup_88A392,
crooked_house_paint_setup_88A554,
crooked_house_paint_setup_88AA90,
},
{
crooked_house_paint_setup_889F08,
crooked_house_paint_setup_88A1D0,
crooked_house_paint_setup_88A97C,
crooked_house_paint_setup_88A554,
crooked_house_paint_setup_88A6C6,
crooked_house_paint_setup_88AA90,
crooked_house_paint_setup_889FCC,
crooked_house_paint_setup_88A392,
crooked_house_paint_setup_88A821,
},
{
crooked_house_paint_setup_889F08,
crooked_house_paint_setup_88A554,
crooked_house_paint_setup_88AA90,
crooked_house_paint_setup_88A392,
crooked_house_paint_setup_88A97C,
crooked_house_paint_setup_88A821,
crooked_house_paint_setup_88A1D0,
crooked_house_paint_setup_889FCC,
crooked_house_paint_setup_88A6C6,
},
{
crooked_house_paint_setup_889F08,
crooked_house_paint_setup_88A392,
crooked_house_paint_setup_88A821,
crooked_house_paint_setup_889FCC,
crooked_house_paint_setup_88AA90,
crooked_house_paint_setup_88A6C6,
crooked_house_paint_setup_88A554,
crooked_house_paint_setup_88A1D0,
crooked_house_paint_setup_88A97C,
},
};
static void crooked_house_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
crooked_house_paint_setup_functions[direction][trackSequence](rideIndex, trackSequence, direction, height, mapElement);
}
TRACK_PAINT_FUNCTION get_track_paint_function_crooked_house(int trackType, int direction) {
if (trackType != 123) {
return NULL;
}
return crooked_house_paint_setup;
}

View File

@ -9,5 +9,6 @@ typedef TRACK_PAINT_FUNCTION (*TRACK_PAINT_FUNCTION_GETTER)(int trackType, int d
TRACK_PAINT_FUNCTION get_track_paint_function_topspin(int trackType, int direction);
TRACK_PAINT_FUNCTION get_track_paint_function_shop(int trackType, int direction);
TRACK_PAINT_FUNCTION get_track_paint_function_facility(int trackType, int direction);
TRACK_PAINT_FUNCTION get_track_paint_function_crooked_house(int trackType, int direction);
#endif