forked from rosebudai/OpenRCT2-Web
Name map element track sequence flags and use them
This commit is contained in:
1 parent
a67b248956
commit
894d010439
15 files changed
+74
-61
No files matched your search
@@ -3176,7 +3176,7 @@ static void peep_update_ride_sub_state_7(rct_peep* peep){
|
||||
break;
|
||||
}
|
||||
|
||||
uint8 al = (inner_map->properties.track.sequence & 0x70) >> 4;
|
||||
uint8 al = (inner_map->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_STATION_INDEX_MASK) >> 4;
|
||||
if (al == peep->current_ride_station)
|
||||
break;
|
||||
}
|
||||
|
||||
+17
-17
@@ -555,7 +555,7 @@ bool track_block_get_next_from_zero(sint16 x, sint16 y, sint16 z_start, uint8 ri
|
||||
if (mapElement->properties.track.ride_index != rideIndex)
|
||||
continue;
|
||||
|
||||
if ((mapElement->properties.track.sequence & 0xF) != 0)
|
||||
if ((mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK) != 0)
|
||||
continue;
|
||||
|
||||
const rct_preview_track* nextTrackBlock = get_track_def_from_ride(ride, mapElement->properties.track.type);
|
||||
@@ -599,7 +599,7 @@ bool track_block_get_next(rct_xy_element *input, rct_xy_element *output, sint32
|
||||
rct_ride* ride = get_ride(rideIndex);
|
||||
|
||||
const rct_preview_track* trackBlock = get_track_def_from_ride(ride, input->element->properties.track.type);
|
||||
uint8 sequence = input->element->properties.track.sequence & 0xF;
|
||||
uint8 sequence = input->element->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK;
|
||||
trackBlock += sequence;
|
||||
|
||||
const rct_track_coordinates* trackCoordinate = get_track_coord_from_ride(ride, input->element->properties.track.type);
|
||||
@@ -683,7 +683,7 @@ bool track_block_get_previous_from_zero(sint16 x, sint16 y, sint16 z, uint8 ride
|
||||
const rct_preview_track* nextTrackBlock = get_track_def_from_ride(ride, mapElement->properties.track.type);
|
||||
const rct_track_coordinates* nextTrackCoordinate = get_track_coord_from_ride(ride, mapElement->properties.track.type);
|
||||
|
||||
nextTrackBlock += mapElement->properties.track.sequence & 0xF;
|
||||
nextTrackBlock += mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK;
|
||||
if ((nextTrackBlock + 1)->index != 255)
|
||||
continue;
|
||||
|
||||
@@ -759,7 +759,7 @@ bool track_block_get_previous(sint32 x, sint32 y, rct_map_element *mapElement, t
|
||||
rct_ride* ride = get_ride(rideIndex);
|
||||
|
||||
const rct_preview_track* trackBlock = get_track_def_from_ride(ride, mapElement->properties.track.type);
|
||||
uint8 sequence = mapElement->properties.track.sequence & 0xF;
|
||||
uint8 sequence = mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK;
|
||||
trackBlock += sequence;
|
||||
|
||||
const rct_track_coordinates* trackCoordinate = get_track_coord_from_ride(ride, mapElement->properties.track.type);
|
||||
@@ -1258,7 +1258,7 @@ sint32 sub_6C683D(sint32* x, sint32* y, sint32* z, sint32 direction, sint32 type
|
||||
continue;
|
||||
|
||||
successMapElement = mapElement;
|
||||
if ((mapElement->properties.track.sequence & 0x0F) == 0)
|
||||
if ((mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK) == 0)
|
||||
break;
|
||||
} while (!map_element_is_last_for_tile(mapElement++));
|
||||
|
||||
@@ -1269,7 +1269,7 @@ sint32 sub_6C683D(sint32* x, sint32* y, sint32* z, sint32 direction, sint32 type
|
||||
// Possibly z should be & 0xF8
|
||||
const rct_preview_track *trackBlock = get_track_def_from_ride_index(mapElement->properties.track.ride_index, type);
|
||||
|
||||
sint32 sequence = mapElement->properties.track.sequence & 0x0F;
|
||||
sint32 sequence = mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK;
|
||||
uint8 mapDirection = mapElement->type & MAP_ELEMENT_DIRECTION_MASK;
|
||||
|
||||
switch (mapDirection){
|
||||
@@ -1330,7 +1330,7 @@ sint32 sub_6C683D(sint32* x, sint32* y, sint32* z, sint32 direction, sint32 type
|
||||
if ((mapElement->type & MAP_ELEMENT_DIRECTION_MASK) != direction)
|
||||
continue;
|
||||
|
||||
if ((mapElement->properties.track.sequence & 0xF) != trackBlock[i].index)
|
||||
if ((mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK) != trackBlock[i].index)
|
||||
continue;
|
||||
|
||||
if (type == mapElement->properties.track.type) {
|
||||
@@ -1420,7 +1420,7 @@ void ride_remove_provisional_track_piece()
|
||||
next_track.x,
|
||||
105 | ((direction & 3) << 8),
|
||||
next_track.y,
|
||||
next_track.element->properties.track.type | ((next_track.element->properties.track.sequence & 0x0F) << 8),
|
||||
next_track.element->properties.track.type | ((next_track.element->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK) << 8),
|
||||
GAME_COMMAND_REMOVE_TRACK,
|
||||
z,
|
||||
0
|
||||
@@ -4788,7 +4788,7 @@ static void ride_create_vehicles_find_first_block(rct_ride *ride, rct_xy_element
|
||||
do {
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_TRACK) continue;
|
||||
if (mapElement->properties.track.type != trackType) continue;
|
||||
if ((mapElement->properties.track.sequence & 0x0F) != 0) continue;
|
||||
if ((mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK) != 0) continue;
|
||||
if (mapElement->base_height != trackBeginEnd.begin_z / 8) continue;
|
||||
outXYElement->x = trackBeginEnd.begin_x;
|
||||
outXYElement->y = trackBeginEnd.begin_y;
|
||||
@@ -5723,7 +5723,7 @@ sint32 ride_get_refund_price(sint32 ride_id)
|
||||
x,
|
||||
GAME_COMMAND_FLAG_APPLY | (rotation << 8),
|
||||
y,
|
||||
type | ((it.element->properties.track.sequence & 0xF) << 8),
|
||||
type | ((it.element->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK) << 8),
|
||||
GAME_COMMAND_REMOVE_TRACK,
|
||||
z,
|
||||
0);
|
||||
@@ -7220,7 +7220,7 @@ void ride_get_entrance_or_exit_position_from_screen_position(sint32 screenX, sin
|
||||
if (mapElement->properties.track.type == TRACK_ELEM_MAZE) {
|
||||
gRideEntranceExitPlaceStationIndex = 0;
|
||||
} else {
|
||||
gRideEntranceExitPlaceStationIndex = (mapElement->properties.track.sequence & 0x70) >> 4;
|
||||
gRideEntranceExitPlaceStationIndex = (mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_STATION_INDEX_MASK) >> 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7282,7 +7282,7 @@ void ride_get_entrance_or_exit_position_from_screen_position(sint32 screenX, sin
|
||||
continue;
|
||||
|
||||
sint32 eax = (direction + 2 - mapElement->type) & MAP_ELEMENT_DIRECTION_MASK;
|
||||
if (FlatRideTrackSequenceProperties[mapElement->properties.track.type][mapElement->properties.track.sequence & 0x0F] & (1 << eax)) {
|
||||
if (FlatRideTrackSequenceProperties[mapElement->properties.track.type][mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK] & (1 << eax)) {
|
||||
gRideEntranceExitPlaceDirection = direction ^ 2;
|
||||
*outDirection = direction ^ 2;
|
||||
return;
|
||||
@@ -8034,7 +8034,7 @@ void sub_6CB945(sint32 rideIndex)
|
||||
if (mapElement->base_height != location.z) continue;
|
||||
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 ((mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK) != 0) continue;
|
||||
if (!(TrackSequenceProperties[mapElement->properties.track.type][0] & TRACK_SEQUENCE_FLAG_ORIGIN)) continue;
|
||||
|
||||
trackFound = true;
|
||||
@@ -8045,7 +8045,7 @@ void sub_6CB945(sint32 rideIndex)
|
||||
break;
|
||||
}
|
||||
|
||||
mapElement->properties.track.sequence &= 0x8F;
|
||||
mapElement->properties.track.sequence &= ~MAP_ELEM_TRACK_SEQUENCE_STATION_INDEX_MASK;
|
||||
mapElement->properties.track.sequence |= (stationId << 4);
|
||||
|
||||
direction = map_element_get_direction(mapElement);
|
||||
@@ -8080,7 +8080,7 @@ void sub_6CB945(sint32 rideIndex)
|
||||
break;
|
||||
}
|
||||
|
||||
mapElement->properties.track.sequence &= 0x8F;
|
||||
mapElement->properties.track.sequence &= ~MAP_ELEM_TRACK_SEQUENCE_STATION_INDEX_MASK;
|
||||
mapElement->properties.track.sequence |= (stationId << 4);
|
||||
}
|
||||
}
|
||||
@@ -8142,7 +8142,7 @@ void sub_6CB945(sint32 rideIndex)
|
||||
if (trackElement->base_height != mapElement->base_height) continue;
|
||||
|
||||
uint8 trackType = trackElement->properties.track.type;
|
||||
uint8 trackSequence = trackElement->properties.track.sequence & 0xF;
|
||||
uint8 trackSequence = trackElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK;
|
||||
|
||||
uint8 direction = (map_element_get_direction(mapElement) - map_element_get_direction(trackElement) + 2) & 3;
|
||||
|
||||
@@ -8152,7 +8152,7 @@ void sub_6CB945(sint32 rideIndex)
|
||||
|
||||
uint8 stationId = 0;
|
||||
if (trackElement->properties.track.type != TRACK_ELEM_INVERTED_90_DEG_UP_TO_FLAT_QUARTER_LOOP) {
|
||||
stationId = (trackElement->properties.track.sequence >> 4) & 0x7;
|
||||
stationId = (trackElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_STATION_INDEX_MASK) >> 4;
|
||||
}
|
||||
|
||||
if (mapElement->properties.entrance.type == ENTRANCE_TYPE_RIDE_EXIT) {
|
||||
|
||||
@@ -200,7 +200,10 @@ static void ride_ratings_update_state_2()
|
||||
if (mapElement->base_height != z)
|
||||
continue;
|
||||
|
||||
if (trackType == 255 || ((mapElement->properties.track.sequence & 0x0F) == 0 && trackType == mapElement->properties.track.type)) {
|
||||
if (
|
||||
trackType == 255 ||
|
||||
((mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK) == 0 && trackType == mapElement->properties.track.type))
|
||||
{
|
||||
if (trackType == TRACK_ELEM_END_STATION) {
|
||||
sint32 entranceIndex = map_get_station(mapElement);
|
||||
gRideRatingsCalcData.station_flags &= ~RIDE_RATING_STATION_FLAG_NO_ENTRANCE;
|
||||
@@ -538,7 +541,7 @@ static void ride_ratings_score_close_proximity(rct_map_element *inputMapElement)
|
||||
{
|
||||
sint32 trackType = mapElement->properties.track.type;
|
||||
if (trackType == TRACK_ELEM_LEFT_VERTICAL_LOOP || trackType == TRACK_ELEM_RIGHT_VERTICAL_LOOP) {
|
||||
sint32 sequence = mapElement->properties.track.sequence & 0x0F;
|
||||
sint32 sequence = mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK;
|
||||
if (sequence == 3 || sequence == 6) {
|
||||
if (mapElement->base_height - inputMapElement->clearance_height <= 10) {
|
||||
proximity_score_increment(PROXIMITY_THROUGH_VERTICAL_LOOP);
|
||||
|
||||
+19
-17
@@ -24,7 +24,7 @@ static void ride_update_station_bumpercar(rct_ride *ride, sint32 stationIndex);
|
||||
static void ride_update_station_normal(rct_ride *ride, sint32 stationIndex);
|
||||
static void ride_update_station_race(rct_ride *ride, sint32 stationIndex);
|
||||
static void ride_race_init_vehicle_speeds(rct_ride *ride);
|
||||
static void ride_invalidate_station_start(rct_ride *ride, sint32 stationIndex, sint32 dl);
|
||||
static void ride_invalidate_station_start(rct_ride *ride, sint32 stationIndex, bool greenLight);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -65,14 +65,14 @@ static void ride_update_station_blocksection(rct_ride *ride, sint32 stationIndex
|
||||
if ((ride->status == RIDE_STATUS_CLOSED && ride->num_riders == 0) || (mapElement != NULL && mapElement->flags & 0x20)) {
|
||||
ride->station_depart[stationIndex] &= ~STATION_DEPART_FLAG;
|
||||
|
||||
if ((ride->station_depart[stationIndex] & STATION_DEPART_FLAG) || (mapElement != NULL && (mapElement->properties.track.sequence & 0x80)))
|
||||
ride_invalidate_station_start(ride, stationIndex, 0);
|
||||
if ((ride->station_depart[stationIndex] & STATION_DEPART_FLAG) || (mapElement != NULL && (mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT_MASK)))
|
||||
ride_invalidate_station_start(ride, stationIndex, false);
|
||||
} else {
|
||||
if (!(ride->station_depart[stationIndex] & STATION_DEPART_FLAG)) {
|
||||
ride->station_depart[stationIndex] |= STATION_DEPART_FLAG;
|
||||
ride_invalidate_station_start(ride, stationIndex, 1);
|
||||
} else if (mapElement != NULL && mapElement->properties.track.sequence & 0x80) {
|
||||
ride_invalidate_station_start(ride, stationIndex, 1);
|
||||
ride_invalidate_station_start(ride, stationIndex, true);
|
||||
} else if (mapElement != NULL && mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT_MASK) {
|
||||
ride_invalidate_station_start(ride, stationIndex, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,17 +144,17 @@ static void ride_update_station_normal(rct_ride *ride, sint32 stationIndex)
|
||||
time--;
|
||||
|
||||
ride->station_depart[stationIndex] = time;
|
||||
ride_invalidate_station_start(ride, stationIndex, 0);
|
||||
ride_invalidate_station_start(ride, stationIndex, false);
|
||||
} else {
|
||||
if (time == 0) {
|
||||
ride->station_depart[stationIndex] |= STATION_DEPART_FLAG;
|
||||
ride_invalidate_station_start(ride, stationIndex, 1);
|
||||
ride_invalidate_station_start(ride, stationIndex, true);
|
||||
} else {
|
||||
if (time != 127 && !(gCurrentTicks & 31))
|
||||
time--;
|
||||
|
||||
ride->station_depart[stationIndex] = time;
|
||||
ride_invalidate_station_start(ride, stationIndex, 0);
|
||||
ride_invalidate_station_start(ride, stationIndex, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -171,7 +171,7 @@ static void ride_update_station_race(rct_ride *ride, sint32 stationIndex)
|
||||
) {
|
||||
if (ride->station_depart[stationIndex] & STATION_DEPART_FLAG){
|
||||
ride->station_depart[stationIndex] &= ~STATION_DEPART_FLAG;
|
||||
ride_invalidate_station_start(ride, stationIndex, 0);
|
||||
ride_invalidate_station_start(ride, stationIndex, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ static void ride_update_station_race(rct_ride *ride, sint32 stationIndex)
|
||||
ride->lifecycle_flags &= ~RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING;
|
||||
if (ride->station_depart[stationIndex] & STATION_DEPART_FLAG){
|
||||
ride->station_depart[stationIndex] &= ~STATION_DEPART_FLAG;
|
||||
ride_invalidate_station_start(ride, stationIndex, 0);
|
||||
ride_invalidate_station_start(ride, stationIndex, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -207,7 +207,7 @@ static void ride_update_station_race(rct_ride *ride, sint32 stationIndex)
|
||||
if (vehicle->status != VEHICLE_STATUS_WAITING_TO_DEPART && vehicle->status != VEHICLE_STATUS_DEPARTING) {
|
||||
if (ride->station_depart[stationIndex] & STATION_DEPART_FLAG){
|
||||
ride->station_depart[stationIndex] &= ~STATION_DEPART_FLAG;
|
||||
ride_invalidate_station_start(ride, stationIndex, 0);
|
||||
ride_invalidate_station_start(ride, stationIndex, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -218,7 +218,7 @@ static void ride_update_station_race(rct_ride *ride, sint32 stationIndex)
|
||||
ride->lifecycle_flags |= RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING;
|
||||
if (!(ride->station_depart[stationIndex] & STATION_DEPART_FLAG)){
|
||||
ride->station_depart[stationIndex] |= STATION_DEPART_FLAG;
|
||||
ride_invalidate_station_start(ride, stationIndex, 1);
|
||||
ride_invalidate_station_start(ride, stationIndex, true);
|
||||
}
|
||||
ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST;
|
||||
}
|
||||
@@ -268,7 +268,7 @@ static void ride_race_init_vehicle_speeds(rct_ride *ride)
|
||||
*
|
||||
* rct2: 0x006AC2C7
|
||||
*/
|
||||
static void ride_invalidate_station_start(rct_ride *ride, sint32 stationIndex, sint32 dl)
|
||||
static void ride_invalidate_station_start(rct_ride *ride, sint32 stationIndex, bool greenLight)
|
||||
{
|
||||
sint32 x, y;
|
||||
rct_map_element *mapElement;
|
||||
@@ -281,9 +281,11 @@ static void ride_invalidate_station_start(rct_ride *ride, sint32 stationIndex, s
|
||||
if (mapElement == NULL)
|
||||
return;
|
||||
|
||||
mapElement->properties.track.sequence &= 0x7F;
|
||||
if (dl != 0)
|
||||
mapElement->properties.track.sequence |= 0x80;
|
||||
mapElement->properties.track.sequence &= ~MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT_MASK;
|
||||
if (greenLight)
|
||||
{
|
||||
mapElement->properties.track.sequence |= MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT;
|
||||
}
|
||||
|
||||
// Invalidate map tile
|
||||
map_invalidate_tile_zoom1(x, y, mapElement->base_height * 8, mapElement->clearance_height * 8);
|
||||
|
||||
@@ -361,7 +361,7 @@ static void paint_go_karts_station(uint8 rideIndex, uint8 trackSequence, uint8 d
|
||||
}
|
||||
|
||||
if (mapElement->properties.track.type == TRACK_ELEM_END_STATION) {
|
||||
const bool hasGreenLight = (bool) (mapElement->properties.track.sequence & 0x80);
|
||||
const bool hasGreenLight = (bool)(mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT_MASK);
|
||||
|
||||
switch (direction) {
|
||||
case 0:
|
||||
|
||||
@@ -1470,7 +1470,7 @@ static money32 track_remove(uint8 type, uint8 sequence, sint16 originX, sint16 o
|
||||
if ((mapElement->type & MAP_ELEMENT_DIRECTION_MASK) != rotation)
|
||||
continue;
|
||||
|
||||
if ((mapElement->properties.track.sequence & 0xF) != sequence)
|
||||
if ((mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK) != sequence)
|
||||
continue;
|
||||
|
||||
// Probably should add a check for ghost here as well!
|
||||
@@ -1505,7 +1505,7 @@ static money32 track_remove(uint8 type, uint8 sequence, sint16 originX, sint16 o
|
||||
|
||||
rct_ride* ride = get_ride(rideIndex);
|
||||
const rct_preview_track* trackBlock = get_track_def_from_ride(ride, type);
|
||||
trackBlock += mapElement->properties.track.sequence & 0xF;
|
||||
trackBlock += mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK;
|
||||
|
||||
uint8 originDirection = mapElement->type & MAP_ELEMENT_DIRECTION_MASK;
|
||||
switch (originDirection){
|
||||
@@ -1572,7 +1572,7 @@ static money32 track_remove(uint8 type, uint8 sequence, sint16 originX, sint16 o
|
||||
if ((mapElement->type & MAP_ELEMENT_DIRECTION_MASK) != rotation)
|
||||
continue;
|
||||
|
||||
if ((mapElement->properties.track.sequence & 0xF) != trackBlock->index)
|
||||
if ((mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK) != trackBlock->index)
|
||||
continue;
|
||||
|
||||
if (mapElement->properties.track.type != type)
|
||||
@@ -1595,7 +1595,7 @@ static money32 track_remove(uint8 type, uint8 sequence, sint16 originX, sint16 o
|
||||
entranceDirections = TrackSequenceProperties[type][0];
|
||||
}
|
||||
|
||||
if (entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN && ((mapElement->properties.track.sequence & 0xF) == 0)){
|
||||
if (entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN && ((mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK) == 0)){
|
||||
if (!track_remove_station_element(x, y, z / 8, rotation, rideIndex, 0)) {
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
@@ -1616,7 +1616,7 @@ static money32 track_remove(uint8 type, uint8 sequence, sint16 originX, sint16 o
|
||||
if (!(flags & GAME_COMMAND_FLAG_APPLY))
|
||||
continue;
|
||||
|
||||
if (entranceDirections & (1 << 4) && ((mapElement->properties.track.sequence & 0xF) == 0)){
|
||||
if (entranceDirections & (1 << 4) && ((mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK) == 0)){
|
||||
if (!track_remove_station_element(x, y, z / 8, rotation, rideIndex, GAME_COMMAND_FLAG_APPLY)) {
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
@@ -2023,7 +2023,7 @@ void game_command_set_brakes_speed(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32
|
||||
continue;
|
||||
|
||||
mapElement->properties.track.sequence =
|
||||
(mapElement->properties.track.sequence & 0x0F) |
|
||||
(mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK) |
|
||||
((brakesSpeed >> 1) << 4);
|
||||
|
||||
break;
|
||||
|
||||
@@ -1231,7 +1231,7 @@ static bool track_design_place_ride(rct_track_td6 *td6, sint16 x, sint16 y, sint
|
||||
if (map_element_get_type(map_element) != MAP_ELEMENT_TYPE_TRACK) continue;
|
||||
if (map_element->base_height != z) continue;
|
||||
|
||||
sint32 di = (map_element->properties.track.sequence >> 4) & 0x07;
|
||||
sint32 stationIndex = (map_element->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_STATION_INDEX_MASK) >> 4;
|
||||
uint8 bl = 1;
|
||||
if (_trackDesignPlaceOperation == PTD_OPERATION_GET_COST)
|
||||
{
|
||||
@@ -1247,7 +1247,7 @@ static bool track_design_place_ride(rct_track_td6 *td6, sint16 x, sint16 y, sint
|
||||
}
|
||||
|
||||
gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
|
||||
money32 cost = game_do_command(x, bl | (rotation << 8), y, rideIndex | (isExit << 8), GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT, di, 0);
|
||||
money32 cost = game_do_command(x, bl | (rotation << 8), y, rideIndex | (isExit << 8), GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT, stationIndex, 0);
|
||||
_trackDesignPlaceCost += cost;
|
||||
|
||||
if (cost == MONEY32_UNDEFINED)
|
||||
|
||||
@@ -307,7 +307,7 @@ void track_paint_util_draw_station_impl(uint8 rideIndex, uint8 trackSequence, ui
|
||||
rct_xy16 position = {gPaintMapPosition.x, gPaintMapPosition.y};
|
||||
rct_ride * ride = get_ride(rideIndex);
|
||||
const rct_ride_entrance_definition * entranceStyle = &RideEntranceDefinitions[ride->entrance_style];
|
||||
const bool hasGreenLight = (bool) (mapElement->properties.track.sequence & 0x80);
|
||||
const bool hasGreenLight = (bool) (mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT_MASK);
|
||||
|
||||
bool hasFence;
|
||||
uint32 imageId;
|
||||
@@ -441,7 +441,7 @@ void track_paint_util_draw_station_inverted(uint8 rideIndex, uint8 trackSequence
|
||||
rct_xy16 position = {gPaintMapPosition.x, gPaintMapPosition.y};
|
||||
rct_ride * ride = get_ride(rideIndex);
|
||||
const rct_ride_entrance_definition * entranceStyle = &RideEntranceDefinitions[ride->entrance_style];
|
||||
const bool hasGreenLight = (bool) (mapElement->properties.track.sequence & 0x80);
|
||||
const bool hasGreenLight = (bool) (mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT_MASK);
|
||||
|
||||
bool hasFence;
|
||||
uint32 imageId;
|
||||
@@ -1757,7 +1757,7 @@ void track_paint(uint8 direction, sint32 height, rct_map_element *mapElement)
|
||||
|
||||
if (!gTrackDesignSaveMode || rideIndex == gTrackDesignSaveRideIndex) {
|
||||
sint32 trackType = mapElement->properties.track.type;
|
||||
sint32 trackSequence = mapElement->properties.track.sequence & 0x0F;
|
||||
sint32 trackSequence = mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK;
|
||||
sint32 trackColourScheme = mapElement->properties.track.colour & 3;
|
||||
|
||||
if ((gCurrentViewportFlags & VIEWPORT_FLAG_TRACK_HEIGHTS) && dpi->zoom_level == 0) {
|
||||
|
||||
@@ -6926,7 +6926,7 @@ static void loc_6DB481(rct_vehicle *vehicle)
|
||||
*/
|
||||
static void vehicle_trigger_on_ride_photo(rct_vehicle *vehicle, rct_map_element *mapElement)
|
||||
{
|
||||
mapElement->properties.track.sequence &= 0x0F;
|
||||
mapElement->properties.track.sequence &= MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK;
|
||||
mapElement->properties.track.sequence |= 0x30;
|
||||
map_animation_create(
|
||||
MAP_ANIMATION_TYPE_TRACK_ONRIDEPHOTO,
|
||||
@@ -7264,7 +7264,7 @@ static void sub_6DBF3E(rct_vehicle *vehicle)
|
||||
}
|
||||
|
||||
if (_vehicleStationIndex == 0xFF) {
|
||||
_vehicleStationIndex = (mapElement->properties.track.sequence >> 4) & 7;
|
||||
_vehicleStationIndex = (mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_STATION_INDEX_MASK) >> 4;
|
||||
}
|
||||
|
||||
if (trackType == TRACK_ELEM_TOWER_BASE &&
|
||||
|
||||
@@ -1729,7 +1729,7 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_TRACK_RIDE_NAME, gCommonFormatArgs, COLOUR_DARK_GREEN, x, y + 22);
|
||||
// Track
|
||||
sint16 trackType = mapElement->properties.track.type;
|
||||
sint16 sequenceNumber = mapElement->properties.track.sequence & 0x0F;
|
||||
sint16 sequenceNumber = mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK;
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_TRACK_PIECE_ID, &trackType, COLOUR_DARK_GREEN, x, y + 33);
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_TRACK_SEQUENCE, &sequenceNumber, COLOUR_DARK_GREEN, x, y + 44);
|
||||
|
||||
|
||||
@@ -1194,7 +1194,7 @@ static void loc_6A6D7E(
|
||||
}
|
||||
|
||||
const uint8 trackType = mapElement->properties.track.type;
|
||||
const uint8 trackSequence = mapElement->properties.track.sequence & 0x0F;
|
||||
const uint8 trackSequence = mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK;
|
||||
if (!(FlatRideTrackSequenceProperties[trackType][trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH)) {
|
||||
return;
|
||||
}
|
||||
@@ -1286,7 +1286,7 @@ static void loc_6A6C85(
|
||||
return;
|
||||
}
|
||||
const uint8 trackType = mapElement->properties.track.type;
|
||||
const uint8 trackSequence = mapElement->properties.track.sequence & 0x0F;
|
||||
const uint8 trackSequence = mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK;
|
||||
if (!(FlatRideTrackSequenceProperties[trackType][trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2721,7 +2721,7 @@ void game_command_place_large_scenery(sint32* eax, sint32* ebx, sint32* ecx, sin
|
||||
|
||||
sint32 map_get_station(rct_map_element *mapElement)
|
||||
{
|
||||
return (mapElement->properties.track.sequence & 0x70) >> 4;
|
||||
return (mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_STATION_INDEX_MASK) >> 4;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4263,7 +4263,7 @@ rct_map_element *map_get_track_element_at_of_type_seq(sint32 x, sint32 y, sint32
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_TRACK) continue;
|
||||
if (mapElement->base_height != z) continue;
|
||||
if (mapElement->properties.track.type != trackType) continue;
|
||||
if ((mapElement->properties.track.sequence & 0x0F) != sequence) continue;
|
||||
if ((mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK) != sequence) continue;
|
||||
|
||||
return mapElement;
|
||||
} while (!map_element_is_last_for_tile(mapElement++));
|
||||
|
||||
@@ -237,6 +237,11 @@ enum {
|
||||
ELEMENT_IS_UNDERWATER = 1 << 2,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT = (1 << 7),
|
||||
};
|
||||
|
||||
#define MAP_ELEMENT_QUADRANT_MASK 0xC0
|
||||
#define MAP_ELEMENT_TYPE_MASK 0x3C
|
||||
#define MAP_ELEMENT_DIRECTION_MASK 0x03
|
||||
@@ -248,6 +253,9 @@ enum {
|
||||
#define MAP_ELEMENT_WATER_HEIGHT_MASK 0x1F
|
||||
#define MAP_ELEMENT_SURFACE_TERRAIN_MASK 0xE0
|
||||
|
||||
#define MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT_MASK 0x80
|
||||
#define MAP_ELEM_TRACK_SEQUENCE_STATION_INDEX_MASK 0x70
|
||||
#define MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK 0x0F
|
||||
|
||||
#define MINIMUM_MAP_SIZE_TECHNICAL 15
|
||||
#define MAXIMUM_MAP_SIZE_TECHNICAL 256
|
||||
|
||||
@@ -602,7 +602,7 @@ sint32 tile_inspector_track_base_height_offset(sint32 x, sint32 y, sint32 elemen
|
||||
uint8 rideIndex = trackElement->properties.track.ride_index;
|
||||
rct_ride* ride = get_ride(rideIndex);
|
||||
const rct_preview_track* trackBlock = get_track_def_from_ride(ride, type);
|
||||
trackBlock += trackElement->properties.track.sequence & 0x0F;
|
||||
trackBlock += trackElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK;
|
||||
|
||||
uint8 originDirection = map_element_get_direction(trackElement);
|
||||
switch (originDirection)
|
||||
@@ -669,7 +669,7 @@ sint32 tile_inspector_track_base_height_offset(sint32 x, sint32 y, sint32 elemen
|
||||
if ((mapElement->type & MAP_ELEMENT_DIRECTION_MASK) != rotation)
|
||||
continue;
|
||||
|
||||
if ((mapElement->properties.track.sequence & 0x0F) != trackBlock->index)
|
||||
if ((mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK) != trackBlock->index)
|
||||
continue;
|
||||
|
||||
if (mapElement->properties.track.type != type)
|
||||
@@ -734,7 +734,7 @@ sint32 tile_inspector_track_set_chain(sint32 x, sint32 y, sint32 elementIndex, b
|
||||
uint8 rideIndex = trackElement->properties.track.ride_index;
|
||||
rct_ride* ride = get_ride(rideIndex);
|
||||
const rct_preview_track* trackBlock = get_track_def_from_ride(ride, type);
|
||||
trackBlock += trackElement->properties.track.sequence & 0x0F;
|
||||
trackBlock += trackElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK;
|
||||
|
||||
uint8 originDirection = map_element_get_direction(trackElement);
|
||||
switch (originDirection)
|
||||
@@ -801,7 +801,7 @@ sint32 tile_inspector_track_set_chain(sint32 x, sint32 y, sint32 elementIndex, b
|
||||
if ((mapElement->type & MAP_ELEMENT_DIRECTION_MASK) != rotation)
|
||||
continue;
|
||||
|
||||
if ((mapElement->properties.track.sequence & 0x0F) != trackBlock->index)
|
||||
if ((mapElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK) != trackBlock->index)
|
||||
continue;
|
||||
|
||||
if (mapElement->properties.track.type != type)
|
||||
|
||||
@@ -69,7 +69,7 @@ static bool WallCheckObstructionWithTrack(rct_scenery_entry * wall,
|
||||
bool * wallAcrossTrack)
|
||||
{
|
||||
sint32 trackType = trackElement->properties.track.type;
|
||||
sint32 sequence = trackElement->properties.track.sequence & 0x0F;
|
||||
sint32 sequence = trackElement->properties.track.sequence & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK;
|
||||
sint32 direction = (edge - trackElement->type) & 3;
|
||||
rct_ride * ride = get_ride(trackElement->properties.track.ride_index);
|
||||
|
||||
|
||||
Reference in new issue
Block a user