mirror of https://github.com/OpenRCT2/OpenRCT2.git
implement sub_666CBE
This commit is contained in:
parent
064cdf4d06
commit
05132b2e04
|
@ -6350,7 +6350,43 @@ void sub_6CB945(int rideIndex)
|
|||
RCT2_CALLPROC_X(0x006CB945, 0, 0, 0, rideIndex, 0, 0, 0);
|
||||
}
|
||||
|
||||
money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 direction, uint8 flags, uint8 rideIndex, uint8 station_num, uint8 is_exit){
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00666CBE
|
||||
*/
|
||||
static void sub_666CBE(int x, int y, rct_map_element *mapElement)
|
||||
{
|
||||
int direction = mapElement->type & MAP_ELEMENT_DIRECTION_MASK;
|
||||
x += TileDirectionDelta[direction].x;
|
||||
y += TileDirectionDelta[direction].y;
|
||||
int z = mapElement->base_height;
|
||||
int rideIndex = mapElement->properties.track.ride_index;
|
||||
|
||||
mapElement = map_get_first_element_at(x >> 5, y >> 5);
|
||||
do {
|
||||
if (mapElement->type != MAP_ELEMENT_TYPE_TRACK) continue;
|
||||
if (mapElement->properties.track.ride_index != rideIndex) continue;
|
||||
if (mapElement->base_height != z) continue;
|
||||
if (mapElement->properties.track.type != TRACK_ELEM_INVERTED_90_DEG_UP_TO_FLAT_QUARTER_LOOP) continue;
|
||||
|
||||
direction <<= 2;
|
||||
direction = (direction + 9) & 0x0F;
|
||||
mapElement->properties.track.sequence &= direction;
|
||||
direction = (direction + 3) & 0x0F;
|
||||
mapElement->properties.track.sequence &= direction;
|
||||
direction = (direction - 2) & 0x0F;
|
||||
mapElement->properties.track.sequence &= direction;
|
||||
direction = (direction + 1) & 0x0F;
|
||||
mapElement->properties.track.sequence &= direction;
|
||||
direction = (direction + 4) & 0x0F;
|
||||
mapElement->properties.track.sequence &= direction;
|
||||
map_invalidate_tile(x, y, mapElement->base_height * 8, mapElement->clearance_height * 8);
|
||||
return;
|
||||
} while (!map_element_is_last_for_tile(mapElement++));
|
||||
}
|
||||
|
||||
money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 direction, uint8 flags, uint8 rideIndex, uint8 station_num, uint8 is_exit)
|
||||
{
|
||||
// Remember when in Unknown station num mode rideIndex is unknown and z is set
|
||||
// When in known station num mode rideIndex is known and z is unknown
|
||||
|
||||
|
@ -6396,9 +6432,7 @@ money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 directio
|
|||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_HIGH;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
rct_ride* ride = GET_RIDE(rideIndex);
|
||||
if (ride->status != RIDE_STATUS_CLOSED) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_MUST_BE_CLOSED_FIRST;
|
||||
|
@ -6419,7 +6453,7 @@ money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 directio
|
|||
|
||||
if (is_exit) {
|
||||
if (ride->exits[station_num] != 0xFFFF) {
|
||||
if (flags & (1 << 6)){
|
||||
if (flags & GAME_COMMAND_FLAG_GHOST) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = 0;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
@ -6428,10 +6462,8 @@ money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 directio
|
|||
remove_y = ((ride->exits[station_num] >> 8) & 0xFF) * 32;
|
||||
requires_remove = 1;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (ride->entrances[station_num] != 0xFFFF){
|
||||
if (flags & (1 << 6)){
|
||||
} else if (ride->entrances[station_num] != 0xFFFF) {
|
||||
if (flags & GAME_COMMAND_FLAG_GHOST) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = 0;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
@ -6440,7 +6472,6 @@ money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 directio
|
|||
remove_y = ((ride->entrances[station_num] >> 8) & 0xFF) * 32;
|
||||
requires_remove = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (requires_remove) {
|
||||
money32 success = game_do_command(
|
||||
|
@ -6461,7 +6492,11 @@ money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 directio
|
|||
z = ride->station_heights[station_num] * 8;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, sint16) = z;
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY && !(flags & 0x48)){
|
||||
if (
|
||||
(flags & GAME_COMMAND_FLAG_APPLY) &&
|
||||
!(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) &&
|
||||
!(flags & GAME_COMMAND_FLAG_GHOST)
|
||||
) {
|
||||
footpath_remove_litter(x, y, z);
|
||||
map_remove_walls_at_z(x, y, z);
|
||||
}
|
||||
|
@ -6492,7 +6527,6 @@ money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 directio
|
|||
}
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY) {
|
||||
|
||||
rct_map_element* mapElement = map_element_insert(x / 32, y / 32, z / 8, 0xF);
|
||||
mapElement->clearance_height = clear_z;
|
||||
mapElement->properties.entrance.type = is_exit;
|
||||
|
@ -6500,14 +6534,13 @@ money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 directio
|
|||
mapElement->properties.entrance.ride_index = rideIndex;
|
||||
mapElement->type = MAP_ELEMENT_TYPE_ENTRANCE | direction;
|
||||
|
||||
if (flags & (1 << 6)){
|
||||
if (flags & GAME_COMMAND_FLAG_GHOST) {
|
||||
mapElement->flags |= MAP_ELEMENT_FLAG_GHOST;
|
||||
}
|
||||
|
||||
if (is_exit) {
|
||||
ride->exits[station_num] = (x / 32) | (y / 32 << 8);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
ride->entrances[station_num] = (x / 32) | (y / 32 << 8);
|
||||
ride->first_peep_in_queue[station_num] = 0xFFFF;
|
||||
ride->queue_length[station_num] = 0;
|
||||
|
@ -6516,8 +6549,8 @@ money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 directio
|
|||
}
|
||||
|
||||
sub_6A7594();
|
||||
if (!(flags & (1 << 6))){
|
||||
RCT2_CALLPROC_X(0x00666CBE, x, 0, y, 0, (int)mapElement, 0, 0);
|
||||
if (!(flags & GAME_COMMAND_FLAG_GHOST)) {
|
||||
sub_666CBE(x, y, mapElement);
|
||||
}
|
||||
footpath_connect_edges(x, y, mapElement, flags);
|
||||
sub_6A759F();
|
||||
|
|
Loading…
Reference in New Issue