Include data at `0x99ba64` and `0x99ca64`

This commit is contained in:
Marijn van der Werf 2016-08-12 21:51:22 +02:00 committed by Ted John
parent 389d75534d
commit 8903559f75
10 changed files with 577 additions and 45 deletions

View File

@ -440,7 +440,7 @@ bool ride_try_get_origin_element(int rideIndex, rct_xy_element *output)
bool specialTrackPiece = (
it.element->properties.track.type != TRACK_ELEM_BEGIN_STATION &&
it.element->properties.track.type != TRACK_ELEM_MIDDLE_STATION &&
(RCT2_ADDRESS(0x0099BA64, uint8)[it.element->properties.track.type * 16] & 0x10)
(TrackSequenceProperties[it.element->properties.track.type][0] & TRACK_SEQUENCE_FLAG_ORIGIN)
);
// Set result tile to this track piece if first found track or a ???
@ -3239,9 +3239,9 @@ static void ride_shop_connected(rct_ride* ride, int ride_idx)
uint8 track_type = mapElement->properties.track.type;
ride = get_ride(mapElement->properties.track.ride_index);
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE)) {
entrance_directions = RCT2_ADDRESS(0x0099CA64, uint8)[track_type * 16];
entrance_directions = FlatRideTrackSequenceProperties[track_type][0];
} else {
entrance_directions = RCT2_ADDRESS(0x0099BA64, uint8)[track_type * 16];
entrance_directions = TrackSequenceProperties[track_type][0];
}
uint8 tile_direction = mapElement->type & MAP_ELEMENT_DIRECTION_MASK;
@ -4249,7 +4249,7 @@ static int ride_check_station_length(rct_xy_element *input, rct_xy_element *outp
rct_xy_element last_good_station = *output;
do{
if (RCT2_ADDRESS(0x0099BA64, uint8)[output->element->properties.track.type * 16] & 0x10){
if (TrackSequenceProperties[output->element->properties.track.type][0] & TRACK_SEQUENCE_FLAG_ORIGIN){
num_station_elements++;
last_good_station = *output;
}
@ -4293,7 +4293,7 @@ static bool ride_check_start_and_end_is_station(rct_xy_element *input, rct_xy_el
// Check back of the track
track_get_back(input, &trackBack);
trackType = trackBack.element->properties.track.type;
if (!(RCT2_GLOBAL(0x0099BA64 + (trackType * 16), uint32) & 0x10)) {
if (!(TrackSequenceProperties[trackType][0] & TRACK_SEQUENCE_FLAG_ORIGIN)) {
return false;
}
ride->chairlift_bullwheel_location[0].x = trackBack.x >> 5;
@ -4303,7 +4303,7 @@ static bool ride_check_start_and_end_is_station(rct_xy_element *input, rct_xy_el
// Check front of the track
track_get_front(input, &trackFront);
trackType = trackFront.element->properties.track.type;
if (!(RCT2_GLOBAL(0x0099BA64 + (trackType * 16), uint32) & 0x10)) {
if (!(TrackSequenceProperties[trackType][0] & TRACK_SEQUENCE_FLAG_ORIGIN)) {
return false;
}
ride->chairlift_bullwheel_location[1].x = trackFront.x >> 5;
@ -4945,8 +4945,7 @@ static bool ride_initialise_cable_lift_track(rct_ride *ride, bool isApplying)
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_TRACK) continue;
if (mapElement->base_height != z) continue;
int trackType = mapElement->properties.track.type;
if (!(RCT2_ADDRESS(0x0099BA64, uint8)[trackType * 16] & 0x10)) {
if (!(TrackSequenceProperties[mapElement->properties.track.type][0] & TRACK_SEQUENCE_FLAG_ORIGIN)) {
continue;
}
success = true;
@ -5176,12 +5175,11 @@ static rct_map_element *loc_6B4F6B(int rideIndex, int x, int y)
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_TRACK)
continue;
uint32 unk = mapElement->properties.track.type << 4;
if (RCT2_GLOBAL(0x00F43484, uint32) & 0x80000) {
if (!(RCT2_ADDRESS(0x0099CA64, uint8)[unk] & 0x10))
if (!(FlatRideTrackSequenceProperties[mapElement->properties.track.type][0] & TRACK_SEQUENCE_FLAG_ORIGIN))
continue;
} else {
if (!(RCT2_ADDRESS(0x0099BA64, uint8)[unk] & 0x10))
if (!(TrackSequenceProperties[mapElement->properties.track.type][0] & TRACK_SEQUENCE_FLAG_ORIGIN))
continue;
}
@ -7112,8 +7110,8 @@ void ride_get_entrance_or_exit_position_from_screen_position(int screenX, int sc
if (interactionType != 0) {
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_TRACK) {
if (mapElement->properties.track.ride_index == gRideEntranceExitPlaceRideIndex) {
if (RCT2_ADDRESS(0x0099BA64, uint8)[mapElement->properties.track.type << 4] & 0x10) {
if (mapElement->properties.track.type == 101) {
if (TrackSequenceProperties[mapElement->properties.track.type][0] & TRACK_SEQUENCE_FLAG_ORIGIN) {
if (mapElement->properties.track.type == TRACK_ELEM_MAZE) {
gRideEntranceExitPlaceStationIndex = 0;
} else {
gRideEntranceExitPlaceStationIndex = (mapElement->properties.track.sequence & 0x70) >> 4;
@ -7177,9 +7175,8 @@ void ride_get_entrance_or_exit_position_from_screen_position(int screenX, int sc
if (map_get_station(mapElement) != gRideEntranceExitPlaceStationIndex)
continue;
int ebx = (mapElement->properties.track.type << 4) + (mapElement->properties.track.sequence & 0x0F);
int eax = (direction + 2 - mapElement->type) & MAP_ELEMENT_DIRECTION_MASK;
if (RCT2_ADDRESS(0x0099CA64, uint8)[ebx] & (1 << eax)) {
if (FlatRideTrackSequenceProperties[mapElement->properties.track.type][mapElement->properties.track.sequence & 0x0F] & (1 << eax)) {
gRideEntranceExitPlaceDirection = direction ^ 2;
*outDirection = direction ^ 2;
return;
@ -7505,7 +7502,7 @@ static int ride_get_track_length(rct_ride *ride)
continue;
trackType = mapElement->properties.track.type;
if (!(RCT2_GLOBAL(0x0099BA64 + (trackType * 16), uint32) & 0x10))
if (!(TrackSequenceProperties[trackType][0] & TRACK_SEQUENCE_FLAG_ORIGIN))
continue;
if (mapElement->base_height != z)
@ -7908,7 +7905,7 @@ void sub_6CB945(int rideIndex)
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_TRACK) continue;
if (mapElement->properties.track.ride_index != rideIndex) continue;
if ((mapElement->properties.track.sequence & 0x0F) != 0) continue;
if (!(RCT2_ADDRESS(0x0099BA64, uint8)[mapElement->properties.track.type * 16] & (1 << 4))) continue;
if (!(TrackSequenceProperties[mapElement->properties.track.type][0] & TRACK_SEQUENCE_FLAG_ORIGIN)) continue;
trackFound = true;
break;
@ -7943,7 +7940,7 @@ void sub_6CB945(int rideIndex)
do {
if (blockLocation.z != mapElement->base_height) continue;
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_TRACK) continue;
if (!(RCT2_ADDRESS(0x0099BA64, uint8)[mapElement->properties.track.type * 16] & (1 << 4))) continue;
if (!(TrackSequenceProperties[mapElement->properties.track.type][0] & TRACK_SEQUENCE_FLAG_ORIGIN)) continue;
trackFound = true;
break;
@ -8012,12 +8009,12 @@ void sub_6CB945(int rideIndex)
if (trackElement->properties.track.ride_index != rideIndex) continue;
if (trackElement->base_height != mapElement->base_height) continue;
uint32 edi = trackElement->properties.track.type * 16;
edi |= trackElement->properties.track.sequence & 0xF;
uint8 trackType = trackElement->properties.track.type;
uint8 trackSequence = trackElement->properties.track.sequence & 0xF;
uint8 direction = (map_element_get_direction(mapElement) - map_element_get_direction(trackElement) + 2) & 3;
if (!(RCT2_GLOBAL(0x0099BA64 + edi, uint32) & (1 << direction))) {
if (!(TrackSequenceProperties[trackType][trackSequence] & (1 << direction))) {
continue;
}

View File

@ -1203,18 +1203,18 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in
int entranceDirections;
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE)) {
entranceDirections = RCT2_ADDRESS(0x0099CA64, uint8)[type * 16];
entranceDirections = FlatRideTrackSequenceProperties[type][0];
}
else {
entranceDirections = RCT2_ADDRESS(0x0099BA64, uint8)[type * 16];
entranceDirections = TrackSequenceProperties[type][0];
}
if ((entranceDirections & 0x10) && trackBlock->index == 0) {
if ((entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN) && trackBlock->index == 0) {
if (!track_add_station_element(x, y, baseZ, direction, rideIndex, 0)) {
return MONEY32_UNDEFINED;
}
}
//6c55be
if (entranceDirections & 0x20) {
if (entranceDirections & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH) {
entranceDirections &= 0x0F;
if (entranceDirections != 0) {
if (!(flags & GAME_COMMAND_FLAG_APPLY) && !(flags & GAME_COMMAND_FLAG_GHOST)) {
@ -1301,14 +1301,14 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in
if (ride->overall_view != 0xFFFF){
if (!(flags & GAME_COMMAND_FLAG_5)){
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE)) {
entranceDirections = RCT2_ADDRESS(0x0099CA64, uint8)[type * 16];
entranceDirections = FlatRideTrackSequenceProperties[type][0];
}
else {
entranceDirections = RCT2_ADDRESS(0x0099BA64, uint8)[type * 16];
entranceDirections = TrackSequenceProperties[type][0];
}
}
}
if (entranceDirections & (1 << 4) || ride->overall_view == 0xFFFF){
if (entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN || ride->overall_view == 0xFFFF){
ride->overall_view = (x >> 5) | (y << 3);
}
@ -1359,13 +1359,13 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in
mapElement->properties.track.colour |= colour;
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE)) {
entranceDirections = RCT2_ADDRESS(0x0099CA64, uint8)[type * 16];
entranceDirections = FlatRideTrackSequenceProperties[type][0];
}
else {
entranceDirections = RCT2_ADDRESS(0x0099BA64, uint8)[type * 16];
entranceDirections = TrackSequenceProperties[type][0];
}
if (entranceDirections & (1 << 4)) {
if (entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN) {
if (trackBlock->index == 0) {
track_add_station_element(x, y, baseZ, direction, rideIndex, GAME_COMMAND_FLAG_APPLY);
}
@ -1590,13 +1590,13 @@ static money32 track_remove(uint8 type, uint8 sequence, sint16 originX, sint16 o
int entranceDirections;
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE)) {
entranceDirections = RCT2_ADDRESS(0x0099CA64, uint8)[type * 16];
entranceDirections = FlatRideTrackSequenceProperties[type][0];
}
else {
entranceDirections = RCT2_ADDRESS(0x0099BA64, uint8)[type * 16];
entranceDirections = TrackSequenceProperties[type][0];
}
if (entranceDirections & (1 << 4) && ((mapElement->properties.track.sequence & 0xF) == 0)){
if (entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN && ((mapElement->properties.track.sequence & 0xF) == 0)){
if (!track_remove_station_element(x, y, z / 8, rotation, rideIndex, 0)) {
return MONEY32_UNDEFINED;
}

View File

@ -465,6 +465,12 @@ enum {
FLAT_TRACK_ELEM_3_X_3 = 123,
};
enum {
TRACK_SEQUENCE_FLAG_ORIGIN = (1 << 4), // 0x10
TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH = (1 << 5), // 0x20
TRACK_SEQUENCE_FLAG_DISALLOW_DOORS = (1 << 6), // 0x40
};
enum {
TRACK_ELEMENT_LOCATION_IS_UNDERGROUND = 2,
};

View File

@ -279,6 +279,526 @@ const rct_track_coordinates TrackCoordinates[256] = {
{ 0, 2, 0, 128, 64, 0 }
};
/** rct2: 0x0099BA64 */
const uint8 TrackSequenceProperties[][16] = {
{ 0 },
/* TRACK_ELEM_END_STATION */ { 0b1010 | TRACK_SEQUENCE_FLAG_ORIGIN | TRACK_SEQUENCE_FLAG_DISALLOW_DOORS, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
/* TRACK_ELEM_BEGIN_STATION */ { 0b1010 | TRACK_SEQUENCE_FLAG_ORIGIN | TRACK_SEQUENCE_FLAG_DISALLOW_DOORS, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
/* TRACK_ELEM_MIDDLE_STATION */ { 0b1010 | TRACK_SEQUENCE_FLAG_ORIGIN | TRACK_SEQUENCE_FLAG_DISALLOW_DOORS, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{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0 },
/* 66 */ { TRACK_SEQUENCE_FLAG_ORIGIN, 0b1001, 0b0001, 0b0011, 0b1000, 0b0010, 0b1100, 0b0110, 0b0100, 0, 0, 0, 0, 0, 0, 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
/* FLAT_TRACK_ELEM_1_X_4_A */ { 0b1010 | TRACK_SEQUENCE_FLAG_ORIGIN, 0, 0b1010, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
/* 101 */ { 0b1111 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b1111 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b1111 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b1111 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b1111 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b1111 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b1111 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b1111 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b1111 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b1111 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b1111 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b1111 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b1111 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b1111 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b1111 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b1111 | TRACK_SEQUENCE_FLAG_ORIGIN },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
/* FLAT_TRACK_ELEM_2_X_2 */ { 0b1001 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b0011, 0b1100, 0b0110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
/* FLAT_TRACK_ELEM_4_X_4 */ { 0b1001 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b0001, 0b0001, 0b0011, 0b1000, 0, 0, 0b0010, 0b1000, 0, 0, 0b0010, 0b1100, 0b0100, 0b0100, 0b0110 },
{ 0 },
{ 0 },
{ 0 },
/* 115 */ { 0b1001 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b0001, 0b0001, 0b0011, 0b1100, 0b0100, 0b0100, 0b0110, 0, 0, 0, 0, 0, 0, 0, 0 },
/* FLAT_TRACK_ELEM_1_X_5 */ { 0b1010 | TRACK_SEQUENCE_FLAG_ORIGIN, 0, 0b1010, 0b1010, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0 },
/* FLAT_TRACK_ELEM_1_X_1_A */ { 0b0001 | TRACK_SEQUENCE_FLAG_ORIGIN | TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
/* FLAT_TRACK_ELEM_1_X_4_B */ { 0b0010 | TRACK_SEQUENCE_FLAG_ORIGIN, 0, 0b0010, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0 },
/* FLAT_TRACK_ELEM_1_X_1_B */ { 0b1111 | TRACK_SEQUENCE_FLAG_ORIGIN | TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
/* FLAT_TRACK_ELEM_1_X_4_C */ { 0b1010 | TRACK_SEQUENCE_FLAG_ORIGIN, 0b1011, 0b1010, 0b1110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
/* FLAT_TRACK_ELEM_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 0 },
};
// rct2: 0x0097C468 (0 - 31) and 0x0097C5D4 (32 - 63)
const uint64 RideTypePossibleTrackConfigurations[91] = {
/* RIDE_TYPE_SPIRAL_ROLLER_COASTER */ (1ULL << TRACK_STRAIGHT) | (1ULL << TRACK_STATION_END) | (1ULL << TRACK_FLAT_ROLL_BANKING) | (1ULL << TRACK_SLOPE) | (1ULL << TRACK_SLOPE_STEEP) | (1ULL << TRACK_SLOPE_CURVE) | (1ULL << TRACK_SLOPE_CURVE_STEEP) | (1ULL << TRACK_S_BEND) | (1ULL << TRACK_CURVE_SMALL) | (1ULL << TRACK_CURVE) | (1ULL << TRACK_HELIX_SMALL) | (1ULL << TRACK_BRAKES) | (1ULL << TRACK_ON_RIDE_PHOTO) | (1ULL << TRACK_BLOCK_BRAKES) | (1ULL << TRACK_SLOPE_ROLL_BANKING) | (1ULL << TRACK_LIFT_HILL_CURVED),

View File

@ -23,6 +23,9 @@ extern const rct_track_coordinates TrackCoordinates[256];
// 0x009972BB, 0x009972BC, 0x009972BD, 0x009972BF, 0x009972C1, 0x009972C3
extern const rct_track_coordinates* FlatTrackCoordinates;
extern const uint8 TrackSequenceProperties[256][16];
extern const uint8 FlatRideTrackSequenceProperties[256][16];
extern const uint64 RideTypePossibleTrackConfigurations[91];
extern const rct_preview_track *TrackBlocks[256];
extern const rct_preview_track *FlatRideTrackBlocks[255];

View File

@ -6913,7 +6913,7 @@ static void sub_6DBF3E(rct_vehicle *vehicle)
}
int trackType = vehicle->track_type >> 2;
if (!(RCT2_GLOBAL(0x0099BA64 + (trackType * 16), uint32) & 0x10)) {
if (!(TrackSequenceProperties[trackType][0] & TRACK_SEQUENCE_FLAG_ORIGIN)) {
return;
}
@ -8121,7 +8121,7 @@ loc_6DCE02:
goto loc_6DCEB2;
}
trackType = vehicle->track_type >> 2;
if (!(RCT2_GLOBAL(0x0099BA64 + (trackType * 16), uint32) & 0x10)) {
if (!(TrackSequenceProperties[trackType][0] & TRACK_SEQUENCE_FLAG_ORIGIN)) {
goto loc_6DCEB2;
}
RCT2_GLOBAL(0x00F64E18, uint32) |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_3;

View File

@ -39,6 +39,7 @@
#include "../world/sprite.h"
#include "dropdown.h"
#include "../rct1.h"
#include "../ride/track_data.h"
enum {
WINDOW_RIDE_PAGE_MAIN,
@ -1672,7 +1673,7 @@ rct_window *window_ride_open_track(rct_map_element *mapElement)
int rideIndex = mapElement->properties.track.ride_index;
if (
(map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_ENTRANCE) ||
(RCT2_ADDRESS(0x0099BA64, uint8)[mapElement->properties.track.type * 16] & 0x10)
(TrackSequenceProperties[mapElement->properties.track.type][0] & TRACK_SEQUENCE_FLAG_ORIGIN)
) {
// Open ride window in station view
return window_ride_open_station(rideIndex, map_get_station(mapElement));

View File

@ -526,7 +526,7 @@ static void window_track_place_draw_mini_preview_track(rct_track_td6 *td6, int p
bits = (bits & 0x0F) | ((bits & 0xF0) >> 4);
// Station track is a lighter colour
uint8 colour = RCT2_ADDRESS(0x0099BA64, uint8)[trackType * 16] & 0x10 ? 222 : 218;
uint8 colour = TrackSequenceProperties[trackType][0] & TRACK_SEQUENCE_FLAG_ORIGIN ? 222 : 218;
for (int i = 0; i < 4; i++) {
if (bits & 1) pixel[338 + i] = colour;

View File

@ -27,6 +27,8 @@
#include "map.h"
#include "map_animation.h"
#include "scenery.h"
#include "../ride/track.h"
#include "../ride/track_data.h"
void footpath_interrupt_peeps(int x, int y, int z);
void sub_6A7642(int x, int y, rct_map_element *mapElement);
@ -1138,12 +1140,14 @@ static void loc_6A6D7E(
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE)) {
continue;
}
uint16 di = (mapElement->properties.track.sequence & 0x0F) | (mapElement->properties.track.type << 4);
if (!(RCT2_ADDRESS(0x0099CA64, uint8)[di] & (1 << 5))) {
const uint8 trackType = mapElement->properties.track.type;
const uint8 trackSequence = mapElement->properties.track.sequence & 0x0F;
if (!(FlatRideTrackSequenceProperties[trackType][trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH)) {
return;
}
uint16 dx = ((direction - mapElement->type) & 3) ^ 2;
if (!(RCT2_ADDRESS(0x0099CA64, uint16)[di / 2] & (1 << dx))) {
if (!(FlatRideTrackSequenceProperties[trackType][trackSequence] & (1 << dx))) {
return;
}
if (query) {
@ -1229,12 +1233,13 @@ static void loc_6A6C85(
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE)) {
return;
}
uint16 di = (mapElement->properties.track.sequence & 0x0F) | (mapElement->properties.track.type << 4);
if (!(RCT2_ADDRESS(0x0099CA64, uint8)[di] & (1 << 5))) {
const uint8 trackType = mapElement->properties.track.type;
const uint8 trackSequence = mapElement->properties.track.sequence & 0x0F;
if (!(FlatRideTrackSequenceProperties[trackType][trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH)) {
return;
}
uint16 dx = (direction - mapElement->type) & 3;
if (!(RCT2_ADDRESS(0x0099CA64, uint16)[di / 2] & (1 << dx))) {
if (!(FlatRideTrackSequenceProperties[trackType][trackSequence] & (1 << dx))) {
return;
}
}

View File

@ -3170,7 +3170,7 @@ static bool map_place_fence_check_obstruction_with_track(rct_scenery_entry *wall
}
if (sequence == 0) {
if (RCT2_GLOBAL(0x0099BA64 + (trackType * 16), uint8) & 0x40) {
if (TrackSequenceProperties[trackType][0] & TRACK_SEQUENCE_FLAG_DISALLOW_DOORS) {
return false;
}