From 69027a81e4e5740ed6ea3f2b3c0a9da347c65193 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 4 Aug 2016 00:36:42 +0200 Subject: [PATCH] Add constants for flat ride tracks (#4209) --- src/ride/gentle/circus_show.c | 3 ++- src/ride/gentle/crooked_house.c | 3 ++- src/ride/gentle/dodgems.c | 3 ++- src/ride/gentle/ferris_wheel.c | 3 ++- src/ride/gentle/flying_saucers.c | 3 ++- src/ride/gentle/haunted_house.c | 3 ++- src/ride/gentle/maze.c | 3 ++- src/ride/gentle/merry_go_round.c | 3 ++- src/ride/gentle/space_rings.c | 3 ++- src/ride/gentle/spiral_slide.c | 3 ++- src/ride/ride.c | 4 ++-- src/ride/shops/facility.c | 3 ++- src/ride/shops/shop.c | 5 +++-- src/ride/thrill/3d_cinema.c | 3 ++- src/ride/thrill/enterprise.c | 3 ++- src/ride/thrill/magic_carpet.c | 3 ++- src/ride/thrill/motion_simulator.c | 3 ++- src/ride/thrill/pirate_ship.c | 3 ++- src/ride/thrill/swinging_inverter_ship.c | 3 ++- src/ride/thrill/top_spin.c | 2 +- src/ride/thrill/twist.c | 3 ++- src/ride/track.h | 13 +++++++++++++ src/ride/track_design.c | 2 +- 23 files changed, 56 insertions(+), 24 deletions(-) diff --git a/src/ride/gentle/circus_show.c b/src/ride/gentle/circus_show.c index 54d7ca0a4a..36f05b7a3b 100644 --- a/src/ride/gentle/circus_show.c +++ b/src/ride/gentle/circus_show.c @@ -18,6 +18,7 @@ #include "../../paint/paint.h" #include "../../paint/supports.h" #include "../track_paint.h" +#include "../track.h" /** * rct2: 0x0077084A @@ -102,7 +103,7 @@ static void paint_circus_show(uint8 rideIndex, uint8 trackSequence, uint8 direct */ TRACK_PAINT_FUNCTION get_track_paint_function_circus_show(int trackType, int direction) { - if (trackType != 123) { + if (trackType != FLAT_TRACK_ELEM_3_X_3) { return NULL; } diff --git a/src/ride/gentle/crooked_house.c b/src/ride/gentle/crooked_house.c index 1e4e581747..f2a01fb2e8 100644 --- a/src/ride/gentle/crooked_house.c +++ b/src/ride/gentle/crooked_house.c @@ -18,6 +18,7 @@ #include "../../paint/paint.h" #include "../../paint/supports.h" #include "../track_paint.h" +#include "../track.h" typedef struct rct_crooked_house_bound_box { sint16 offset_x; @@ -121,7 +122,7 @@ static void paint_crooked_house(uint8 rideIndex, uint8 trackSequence, uint8 dire } TRACK_PAINT_FUNCTION get_track_paint_function_crooked_house(int trackType, int direction) { - if (trackType != 123) { + if (trackType != FLAT_TRACK_ELEM_3_X_3) { return NULL; } diff --git a/src/ride/gentle/dodgems.c b/src/ride/gentle/dodgems.c index 3610bec821..2cc7634911 100644 --- a/src/ride/gentle/dodgems.c +++ b/src/ride/gentle/dodgems.c @@ -18,6 +18,7 @@ #include "../../paint/paint.h" #include "../../paint/supports.h" #include "../track_paint.h" +#include "../track.h" enum { SPR_DODGEMS_FLOOR = 21925, @@ -92,7 +93,7 @@ static void paint_dodgems(uint8 rideIndex, uint8 trackSequence, uint8 direction, * rct2: */ TRACK_PAINT_FUNCTION get_track_paint_function_dodgems(int trackType, int direction) { - if (trackType != 111) { + if (trackType != FLAT_TRACK_ELEM_4_X_4) { return NULL; } diff --git a/src/ride/gentle/ferris_wheel.c b/src/ride/gentle/ferris_wheel.c index 230395164d..cd7781e490 100644 --- a/src/ride/gentle/ferris_wheel.c +++ b/src/ride/gentle/ferris_wheel.c @@ -18,6 +18,7 @@ #include "../../paint/paint.h" #include "../../paint/supports.h" #include "../track_paint.h" +#include "../track.h" static const uint8 edges_1x4_ne_sw[] = { EDGE_NW | EDGE_SE, @@ -182,7 +183,7 @@ static void paint_ferris_wheel(uint8 rideIndex, uint8 trackSequence, uint8 direc */ TRACK_PAINT_FUNCTION get_track_paint_function_ferris_wheel(int trackType, int direction) { - if (trackType != 122) { + if (trackType != FLAT_TRACK_ELEM_1_X_4_C) { return NULL; } diff --git a/src/ride/gentle/flying_saucers.c b/src/ride/gentle/flying_saucers.c index d81d4e4159..d931aee6c8 100644 --- a/src/ride/gentle/flying_saucers.c +++ b/src/ride/gentle/flying_saucers.c @@ -18,6 +18,7 @@ #include "../../paint/paint.h" #include "../../paint/supports.h" #include "../track_paint.h" +#include "../track.h" enum { @@ -62,7 +63,7 @@ static void paint_flying_saucers(uint8 rideIndex, uint8 trackSequence, uint8 dir */ TRACK_PAINT_FUNCTION get_track_paint_function_flying_saucers(int trackType, int direction) { - if (trackType != 111) { + if (trackType != FLAT_TRACK_ELEM_4_X_4) { return NULL; } diff --git a/src/ride/gentle/haunted_house.c b/src/ride/gentle/haunted_house.c index 751b48b502..b96e47f02a 100644 --- a/src/ride/gentle/haunted_house.c +++ b/src/ride/gentle/haunted_house.c @@ -18,6 +18,7 @@ #include "../../paint/paint.h" #include "../../paint/supports.h" #include "../track_paint.h" +#include "../track.h" typedef struct haunted_house_bound_box @@ -133,7 +134,7 @@ static void paint_haunted_house(uint8 rideIndex, uint8 trackSequence, uint8 dire */ TRACK_PAINT_FUNCTION get_track_paint_function_haunted_house(int trackType, int direction) { - if (trackType != 123) { + if (trackType != FLAT_TRACK_ELEM_3_X_3) { return NULL; } diff --git a/src/ride/gentle/maze.c b/src/ride/gentle/maze.c index 698633e513..ae5221edb5 100644 --- a/src/ride/gentle/maze.c +++ b/src/ride/gentle/maze.c @@ -22,6 +22,7 @@ #include "../../world/map.h" #include "../track_paint.h" #include "../../paint/map_element/surface.h" +#include "../track.h" enum { SPR_MAZE_BASE_HEDGE = 21938, @@ -178,7 +179,7 @@ static void maze_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 directi * rct2: 0x008A81E8 */ TRACK_PAINT_FUNCTION get_track_paint_function_maze(int trackType, int direction) { - if (trackType != 101) { + if (trackType != TRACK_ELEM_MAZE) { return NULL; } diff --git a/src/ride/gentle/merry_go_round.c b/src/ride/gentle/merry_go_round.c index 537d06faed..947f876875 100644 --- a/src/ride/gentle/merry_go_round.c +++ b/src/ride/gentle/merry_go_round.c @@ -18,6 +18,7 @@ #include "../../paint/paint.h" #include "../../paint/supports.h" #include "../track_paint.h" +#include "../track.h" /** rct2: 0x0142805C */ static const uint32 merry_go_round_rider_offsets[] = { @@ -155,7 +156,7 @@ static void paint_merry_go_round(uint8 rideIndex, uint8 trackSequence, uint8 dir */ TRACK_PAINT_FUNCTION get_track_paint_function_merry_go_round(int trackType, int direction) { - if (trackType != 123) { + if (trackType != FLAT_TRACK_ELEM_3_X_3) { return NULL; } diff --git a/src/ride/gentle/space_rings.c b/src/ride/gentle/space_rings.c index d307562f08..0f4c063b1c 100644 --- a/src/ride/gentle/space_rings.c +++ b/src/ride/gentle/space_rings.c @@ -19,6 +19,7 @@ #include "../track_paint.h" #include "../../paint/supports.h" #include "../../paint/paint.h" +#include "../track.h" enum { @@ -142,7 +143,7 @@ static void paint_space_rings(uint8 rideIndex, uint8 trackSequence, uint8 direct */ TRACK_PAINT_FUNCTION get_track_paint_function_space_rings(int trackType, int direction) { - if (trackType != 123) { + if (trackType != FLAT_TRACK_ELEM_3_X_3) { return NULL; } diff --git a/src/ride/gentle/spiral_slide.c b/src/ride/gentle/spiral_slide.c index ddf648306f..242a11a30a 100644 --- a/src/ride/gentle/spiral_slide.c +++ b/src/ride/gentle/spiral_slide.c @@ -18,6 +18,7 @@ #include "../../paint/paint.h" #include "../../paint/supports.h" #include "../track_paint.h" +#include "../track.h" enum { SPIRAL_SLIDE_LEFT_R0 = 20548, @@ -191,7 +192,7 @@ static void paint_spiral_slide(uint8 rideIndex, uint8 trackSequence, uint8 direc * rct2: 0x0074840C */ TRACK_PAINT_FUNCTION get_track_paint_function_spiral_slide(int trackType, int direction) { - if (trackType != 110) { + if (trackType != FLAT_TRACK_ELEM_2_X_2) { return NULL; } diff --git a/src/ride/ride.c b/src/ride/ride.c index 7ddbed6d0d..4e6193187a 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -4586,8 +4586,8 @@ static rct_vehicle *vehicle_create_car( direction = 4; } else { if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_16)) { - if (RCT2_GLOBAL(0x0097CC68 + (ride->type * 2), uint8) != 119) { - if (RCT2_GLOBAL(0x0097CC68 + (ride->type * 2), uint8) != 95) { + if (RCT2_GLOBAL(0x0097CC68 + (ride->type * 2), uint8) != FLAT_TRACK_ELEM_1_X_4_B) { + if (RCT2_GLOBAL(0x0097CC68 + (ride->type * 2), uint8) != FLAT_TRACK_ELEM_1_X_4_A) { if (ride->type == RIDE_TYPE_ENTERPRISE) { direction += 5; } else { diff --git a/src/ride/shops/facility.c b/src/ride/shops/facility.c index a24fc11a35..261d407eaa 100644 --- a/src/ride/shops/facility.c +++ b/src/ride/shops/facility.c @@ -21,6 +21,7 @@ #include "../../sprites.h" #include "../../world/map.h" #include "../track_paint.h" +#include "../track.h" /** * @@ -72,7 +73,7 @@ static void facility_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 dir TRACK_PAINT_FUNCTION get_track_paint_function_facility(int trackType, int direction) { switch (trackType) { - case 118: return facility_paint_setup; + case FLAT_TRACK_ELEM_1_X_1_A: return facility_paint_setup; } return NULL; } diff --git a/src/ride/shops/shop.c b/src/ride/shops/shop.c index d652fe90e9..e3b80d54a0 100644 --- a/src/ride/shops/shop.c +++ b/src/ride/shops/shop.c @@ -21,6 +21,7 @@ #include "../../sprites.h" #include "../../world/map.h" #include "../track_paint.h" +#include "../track.h" /** * @@ -61,8 +62,8 @@ static void shop_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 directi TRACK_PAINT_FUNCTION get_track_paint_function_shop(int trackType, int direction) { switch (trackType) { - case 118: - case 121: return shop_paint_setup; + case FLAT_TRACK_ELEM_1_X_1_A: + case FLAT_TRACK_ELEM_1_X_1_B: return shop_paint_setup; } return NULL; } diff --git a/src/ride/thrill/3d_cinema.c b/src/ride/thrill/3d_cinema.c index 4ec11a518c..d764db3809 100644 --- a/src/ride/thrill/3d_cinema.c +++ b/src/ride/thrill/3d_cinema.c @@ -18,6 +18,7 @@ #include "../../paint/paint.h" #include "../../paint/supports.h" #include "../track_paint.h" +#include "../track.h" /** * rct2: 0x007664C2 @@ -103,7 +104,7 @@ static void paint_3d_cinema(uint8 rideIndex, uint8 trackSequence, uint8 directio /* 0x0076554C */ TRACK_PAINT_FUNCTION get_track_paint_function_3d_cinema(int trackType, int direction) { - if (trackType != 123) { + if (trackType != FLAT_TRACK_ELEM_3_X_3) { return NULL; } diff --git a/src/ride/thrill/enterprise.c b/src/ride/thrill/enterprise.c index 616534293a..5f32d7a2d7 100644 --- a/src/ride/thrill/enterprise.c +++ b/src/ride/thrill/enterprise.c @@ -19,6 +19,7 @@ #include "../track_paint.h" #include "../../paint/supports.h" #include "../../paint/paint.h" +#include "../track.h" /** rct2: 0x008A2ABC */ static void paint_enterprise_structure(rct_ride * ride, sint8 xOffset, sint8 yOffset, uint16 height, rct_map_element * mapElement) @@ -123,7 +124,7 @@ static void paint_enterprise(uint8 rideIndex, uint8 trackSequence, uint8 directi */ TRACK_PAINT_FUNCTION get_track_paint_function_enterprise(int trackType, int direction) { - if (trackType != 111) { + if (trackType != FLAT_TRACK_ELEM_4_X_4) { return NULL; } diff --git a/src/ride/thrill/magic_carpet.c b/src/ride/thrill/magic_carpet.c index d7da8e1150..b9341be915 100644 --- a/src/ride/thrill/magic_carpet.c +++ b/src/ride/thrill/magic_carpet.c @@ -18,6 +18,7 @@ #include "../../paint/paint.h" #include "../../paint/supports.h" #include "../track_paint.h" +#include "../track.h" enum { PLANE_BACK, @@ -224,7 +225,7 @@ static void paint_magic_carpet(uint8 rideIndex, uint8 trackSequence, uint8 direc TRACK_PAINT_FUNCTION get_track_paint_function_magic_carpet(int trackType, int direction) { switch (trackType) { - case 95: return paint_magic_carpet; + case FLAT_TRACK_ELEM_1_X_4_A: return paint_magic_carpet; } return NULL; } diff --git a/src/ride/thrill/motion_simulator.c b/src/ride/thrill/motion_simulator.c index 906f2748c9..2bfa440d85 100644 --- a/src/ride/thrill/motion_simulator.c +++ b/src/ride/thrill/motion_simulator.c @@ -18,6 +18,7 @@ #include "../../paint/paint.h" #include "../../paint/supports.h" #include "../track_paint.h" +#include "../track.h" enum { SPR_MOTION_SIMULATOR_STAIRS_R0 = 22154, @@ -152,7 +153,7 @@ static void paint_motionsimulator(uint8 rideIndex, uint8 trackSequence, uint8 di TRACK_PAINT_FUNCTION get_track_paint_function_motionsimulator(int trackType, int direction) { switch (trackType) { - case 110: return paint_motionsimulator; + case FLAT_TRACK_ELEM_2_X_2: return paint_motionsimulator; } return NULL; } diff --git a/src/ride/thrill/pirate_ship.c b/src/ride/thrill/pirate_ship.c index efeba0029c..524b6b94b8 100644 --- a/src/ride/thrill/pirate_ship.c +++ b/src/ride/thrill/pirate_ship.c @@ -18,6 +18,7 @@ #include "../../paint/paint.h" #include "../../paint/supports.h" #include "../track_paint.h" +#include "../track.h" // 1 2 0 3 4 static const uint8 track_map_1x5[][5] = { @@ -262,7 +263,7 @@ static void paint_pirate_ship(uint8 rideIndex, uint8 trackSequence, uint8 direct */ TRACK_PAINT_FUNCTION get_track_paint_function_pirate_ship(int trackType, int direction) { - if (trackType != 116) { + if (trackType != FLAT_TRACK_ELEM_1_X_5) { return NULL; } diff --git a/src/ride/thrill/swinging_inverter_ship.c b/src/ride/thrill/swinging_inverter_ship.c index dd11d42c84..74f6d7444d 100644 --- a/src/ride/thrill/swinging_inverter_ship.c +++ b/src/ride/thrill/swinging_inverter_ship.c @@ -18,6 +18,7 @@ #include "../../paint/paint.h" #include "../../paint/supports.h" #include "../track_paint.h" +#include "../track.h" /** rct2: 0x01428010 */ static const uint32 swinging_inverter_ship_base_sprite_offset[] = { @@ -173,7 +174,7 @@ static void paint_swinging_inverter_ship(uint8 rideIndex, uint8 trackSequence, u */ TRACK_PAINT_FUNCTION get_track_paint_function_swinging_inverter_ship(int trackType, int direction) { - if (trackType != 119) { + if (trackType != FLAT_TRACK_ELEM_1_X_4_B) { return NULL; } diff --git a/src/ride/thrill/top_spin.c b/src/ride/thrill/top_spin.c index c57ee9deca..121757671b 100644 --- a/src/ride/thrill/top_spin.c +++ b/src/ride/thrill/top_spin.c @@ -305,7 +305,7 @@ static void paint_top_spin(uint8 rideIndex, uint8 trackSequence, uint8 direction /* 0x0076659C */ TRACK_PAINT_FUNCTION get_track_paint_function_topspin(int trackType, int direction) { - if (trackType != 123) { + if (trackType != FLAT_TRACK_ELEM_3_X_3) { return NULL; } diff --git a/src/ride/thrill/twist.c b/src/ride/thrill/twist.c index 9f1fa7ea17..eaa8006123 100644 --- a/src/ride/thrill/twist.c +++ b/src/ride/thrill/twist.c @@ -19,6 +19,7 @@ #include "../track_paint.h" #include "../../paint/supports.h" #include "../../paint/paint.h" +#include "../track.h" /** rct2: 0x0076E5C9 */ static void paint_twist_structure(rct_ride * ride, uint8 direction, sint8 xOffset, sint8 yOffset, uint16 height) @@ -146,7 +147,7 @@ static void paint_twist(uint8 rideIndex, uint8 trackSequence, uint8 direction, i */ TRACK_PAINT_FUNCTION get_track_paint_function_twist(int trackType, int direction) { - if (trackType != 123) { + if (trackType != FLAT_TRACK_ELEM_3_X_3) { return NULL; } diff --git a/src/ride/track.h b/src/ride/track.h index 117ffcf1b0..f6445d9b1f 100644 --- a/src/ride/track.h +++ b/src/ride/track.h @@ -292,6 +292,7 @@ enum { TRACK_ELEM_BRAKES, TRACK_ELEM_ROTATION_CONTROL_TOGGLE = 100, TRACK_ELEM_INVERTED_90_DEG_UP_TO_FLAT_QUARTER_LOOP, + TRACK_ELEM_MAZE = 101, TRACK_ELEM_LEFT_QUARTER_BANKED_HELIX_LARGE_UP, TRACK_ELEM_RIGHT_QUARTER_BANKED_HELIX_LARGE_UP, TRACK_ELEM_LEFT_QUARTER_BANKED_HELIX_LARGE_DOWN, @@ -447,6 +448,18 @@ enum { TRACK_ELEM_MULTIDIM_FLAT_TO_90_DEG_DOWN_QUARTER_LOOP, }; +enum { + FLAT_TRACK_ELEM_1_X_4_A = 95, + FLAT_TRACK_ELEM_2_X_2 = 110, + FLAT_TRACK_ELEM_4_X_4 = 111, + FLAT_TRACK_ELEM_1_X_5 = 116, + FLAT_TRACK_ELEM_1_X_1_A = 118, + FLAT_TRACK_ELEM_1_X_4_B = 119, + FLAT_TRACK_ELEM_1_X_1_B = 121, + FLAT_TRACK_ELEM_1_X_4_C = 122, + FLAT_TRACK_ELEM_3_X_3 = 123, +}; + enum { TRACK_ELEMENT_LOCATION_IS_UNDERGROUND = 2, }; diff --git a/src/ride/track_design.c b/src/ride/track_design.c index 7b604be643..e730c51c1c 100644 --- a/src/ride/track_design.c +++ b/src/ride/track_design.c @@ -1599,7 +1599,7 @@ static money32 place_maze_design(uint8 flags, uint8 rideIndex, uint16 mazeEntry, rct_map_element *mapElement = map_element_insert(fx >> 5, fy >> 5, fz, 15); mapElement->clearance_height = fz + 4; mapElement->type = MAP_ELEMENT_TYPE_TRACK; - mapElement->properties.track.type = 101; + mapElement->properties.track.type = TRACK_ELEM_MAZE; mapElement->properties.track.ride_index = rideIndex; mapElement->properties.track.maze_entry = mazeEntry; if (flags & GAME_COMMAND_FLAG_GHOST) {