|
|
|
@ -25,7 +25,7 @@
|
|
|
|
|
#include "SmallScenery.h"
|
|
|
|
|
#include "Sprite.h"
|
|
|
|
|
|
|
|
|
|
using map_animation_invalidate_event_handler = bool (*)(int32_t x, int32_t y, int32_t baseZ);
|
|
|
|
|
using map_animation_invalidate_event_handler = bool (*)(CoordsXYZ loc);
|
|
|
|
|
|
|
|
|
|
static std::vector<MapAnimation> _mapAnimations;
|
|
|
|
|
|
|
|
|
@ -37,7 +37,7 @@ static bool DoesAnimationExist(int32_t type, const CoordsXYZ& location)
|
|
|
|
|
{
|
|
|
|
|
for (const auto& a : _mapAnimations)
|
|
|
|
|
{
|
|
|
|
|
if (a.type == type && a.location.x == location.x && a.location.y == location.y && a.location.z == location.z)
|
|
|
|
|
if (a.type == type && a.location == location)
|
|
|
|
|
{
|
|
|
|
|
// Animation already exists
|
|
|
|
|
return true;
|
|
|
|
@ -46,15 +46,14 @@ static bool DoesAnimationExist(int32_t type, const CoordsXYZ& location)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void map_animation_create(int32_t type, int32_t x, int32_t y, int32_t z)
|
|
|
|
|
void map_animation_create(int32_t type, const CoordsXYZ loc)
|
|
|
|
|
{
|
|
|
|
|
auto location = CoordsXYZ{ x, y, z };
|
|
|
|
|
if (!DoesAnimationExist(type, location))
|
|
|
|
|
if (!DoesAnimationExist(type, loc))
|
|
|
|
|
{
|
|
|
|
|
if (_mapAnimations.size() < MAX_ANIMATED_OBJECTS)
|
|
|
|
|
{
|
|
|
|
|
// Create new animation
|
|
|
|
|
_mapAnimations.push_back({ (uint8_t)type, location });
|
|
|
|
|
_mapAnimations.push_back({ (uint8_t)type, loc });
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -88,14 +87,15 @@ void map_animation_invalidate_all()
|
|
|
|
|
*
|
|
|
|
|
* rct2: 0x00666670
|
|
|
|
|
*/
|
|
|
|
|
static bool map_animation_invalidate_ride_entrance(int32_t x, int32_t y, int32_t baseZ)
|
|
|
|
|
static bool map_animation_invalidate_ride_entrance(CoordsXYZ loc)
|
|
|
|
|
{
|
|
|
|
|
auto tileElement = map_get_first_element_at(x >> 5, y >> 5);
|
|
|
|
|
TileCoordsXYZ tileLoc{ loc };
|
|
|
|
|
auto tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
|
|
|
|
|
if (tileElement == nullptr)
|
|
|
|
|
return true;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (tileElement->base_height != baseZ)
|
|
|
|
|
if (tileElement->base_height != tileLoc.z)
|
|
|
|
|
continue;
|
|
|
|
|
if (tileElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE)
|
|
|
|
|
continue;
|
|
|
|
@ -108,8 +108,8 @@ static bool map_animation_invalidate_ride_entrance(int32_t x, int32_t y, int32_t
|
|
|
|
|
auto stationObj = ride_get_station_object(ride);
|
|
|
|
|
if (stationObj != nullptr)
|
|
|
|
|
{
|
|
|
|
|
int32_t height = (tileElement->base_height * 8) + stationObj->Height + 8;
|
|
|
|
|
map_invalidate_tile_zoom1(x, y, height, height + 16);
|
|
|
|
|
int32_t height = loc.z + stationObj->Height + 8;
|
|
|
|
|
map_invalidate_tile_zoom1(loc.x, loc.y, height, height + 16);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
@ -122,16 +122,17 @@ static bool map_animation_invalidate_ride_entrance(int32_t x, int32_t y, int32_t
|
|
|
|
|
*
|
|
|
|
|
* rct2: 0x006A7BD4
|
|
|
|
|
*/
|
|
|
|
|
static bool map_animation_invalidate_queue_banner(int32_t x, int32_t y, int32_t baseZ)
|
|
|
|
|
static bool map_animation_invalidate_queue_banner(CoordsXYZ loc)
|
|
|
|
|
{
|
|
|
|
|
TileCoordsXYZ tileLoc{ loc };
|
|
|
|
|
TileElement* tileElement;
|
|
|
|
|
|
|
|
|
|
tileElement = map_get_first_element_at(x >> 5, y >> 5);
|
|
|
|
|
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
|
|
|
|
|
if (tileElement == nullptr)
|
|
|
|
|
return true;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (tileElement->base_height != baseZ)
|
|
|
|
|
if (tileElement->base_height != tileLoc.z)
|
|
|
|
|
continue;
|
|
|
|
|
if (tileElement->GetType() != TILE_ELEMENT_TYPE_PATH)
|
|
|
|
|
continue;
|
|
|
|
@ -143,8 +144,7 @@ static bool map_animation_invalidate_queue_banner(int32_t x, int32_t y, int32_t
|
|
|
|
|
int32_t direction = (tileElement->AsPath()->GetQueueBannerDirection() + get_current_rotation()) & 3;
|
|
|
|
|
if (direction == TILE_ELEMENT_DIRECTION_NORTH || direction == TILE_ELEMENT_DIRECTION_EAST)
|
|
|
|
|
{
|
|
|
|
|
baseZ = tileElement->base_height * 8;
|
|
|
|
|
map_invalidate_tile_zoom1(x, y, baseZ + 16, baseZ + 30);
|
|
|
|
|
map_invalidate_tile_zoom1(loc.x, loc.y, loc.z + 16, loc.z + 30);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
} while (!(tileElement++)->IsLastForTile());
|
|
|
|
@ -156,19 +156,20 @@ static bool map_animation_invalidate_queue_banner(int32_t x, int32_t y, int32_t
|
|
|
|
|
*
|
|
|
|
|
* rct2: 0x006E32C9
|
|
|
|
|
*/
|
|
|
|
|
static bool map_animation_invalidate_small_scenery(int32_t x, int32_t y, int32_t baseZ)
|
|
|
|
|
static bool map_animation_invalidate_small_scenery(CoordsXYZ loc)
|
|
|
|
|
{
|
|
|
|
|
TileCoordsXYZ tileLoc{ loc };
|
|
|
|
|
TileElement* tileElement;
|
|
|
|
|
rct_scenery_entry* sceneryEntry;
|
|
|
|
|
rct_sprite* sprite;
|
|
|
|
|
Peep* peep;
|
|
|
|
|
|
|
|
|
|
tileElement = map_get_first_element_at(x >> 5, y >> 5);
|
|
|
|
|
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
|
|
|
|
|
if (tileElement == nullptr)
|
|
|
|
|
return true;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (tileElement->base_height != baseZ)
|
|
|
|
|
if (tileElement->base_height != tileLoc.z)
|
|
|
|
|
continue;
|
|
|
|
|
if (tileElement->GetType() != TILE_ELEMENT_TYPE_SMALL_SCENERY)
|
|
|
|
|
continue;
|
|
|
|
@ -184,7 +185,7 @@ static bool map_animation_invalidate_small_scenery(int32_t x, int32_t y, int32_t
|
|
|
|
|
SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_1 | SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_4 | SMALL_SCENERY_FLAG_SWAMP_GOO
|
|
|
|
|
| SMALL_SCENERY_FLAG_HAS_FRAME_OFFSETS))
|
|
|
|
|
{
|
|
|
|
|
map_invalidate_tile_zoom1(x, y, tileElement->base_height * 8, tileElement->clearance_height * 8);
|
|
|
|
|
map_invalidate_tile_zoom1(loc.x, loc.y, loc.z, tileElement->clearance_height * 8);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -194,8 +195,8 @@ static bool map_animation_invalidate_small_scenery(int32_t x, int32_t y, int32_t
|
|
|
|
|
if (!(gCurrentTicks & 0x3FF) && game_is_not_paused())
|
|
|
|
|
{
|
|
|
|
|
int32_t direction = tileElement->GetDirection();
|
|
|
|
|
int32_t x2 = x - CoordsDirectionDelta[direction].x;
|
|
|
|
|
int32_t y2 = y - CoordsDirectionDelta[direction].y;
|
|
|
|
|
int32_t x2 = loc.x - CoordsDirectionDelta[direction].x;
|
|
|
|
|
int32_t y2 = loc.y - CoordsDirectionDelta[direction].y;
|
|
|
|
|
|
|
|
|
|
uint16_t spriteIdx = sprite_get_first_in_quadrant(x2, y2);
|
|
|
|
|
for (; spriteIdx != SPRITE_INDEX_NULL; spriteIdx = sprite->generic.next_in_quadrant)
|
|
|
|
@ -207,7 +208,7 @@ static bool map_animation_invalidate_small_scenery(int32_t x, int32_t y, int32_t
|
|
|
|
|
peep = &sprite->peep;
|
|
|
|
|
if (peep->state != PEEP_STATE_WALKING)
|
|
|
|
|
continue;
|
|
|
|
|
if (peep->z != tileElement->base_height * 8)
|
|
|
|
|
if (peep->z != loc.z)
|
|
|
|
|
continue;
|
|
|
|
|
if (peep->action < PEEP_ACTION_NONE_1)
|
|
|
|
|
continue;
|
|
|
|
@ -220,7 +221,7 @@ static bool map_animation_invalidate_small_scenery(int32_t x, int32_t y, int32_t
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
map_invalidate_tile_zoom1(x, y, tileElement->base_height * 8, tileElement->clearance_height * 8);
|
|
|
|
|
map_invalidate_tile_zoom1(loc.x, loc.y, loc.z, tileElement->clearance_height * 8);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -232,16 +233,17 @@ static bool map_animation_invalidate_small_scenery(int32_t x, int32_t y, int32_t
|
|
|
|
|
*
|
|
|
|
|
* rct2: 0x00666C63
|
|
|
|
|
*/
|
|
|
|
|
static bool map_animation_invalidate_park_entrance(int32_t x, int32_t y, int32_t baseZ)
|
|
|
|
|
static bool map_animation_invalidate_park_entrance(CoordsXYZ loc)
|
|
|
|
|
{
|
|
|
|
|
TileCoordsXYZ tileLoc{ loc };
|
|
|
|
|
TileElement* tileElement;
|
|
|
|
|
|
|
|
|
|
tileElement = map_get_first_element_at(x >> 5, y >> 5);
|
|
|
|
|
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
|
|
|
|
|
if (tileElement == nullptr)
|
|
|
|
|
return true;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (tileElement->base_height != baseZ)
|
|
|
|
|
if (tileElement->base_height != tileLoc.z)
|
|
|
|
|
continue;
|
|
|
|
|
if (tileElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE)
|
|
|
|
|
continue;
|
|
|
|
@ -250,8 +252,7 @@ static bool map_animation_invalidate_park_entrance(int32_t x, int32_t y, int32_t
|
|
|
|
|
if (tileElement->AsEntrance()->GetSequenceIndex())
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
baseZ = tileElement->base_height * 8;
|
|
|
|
|
map_invalidate_tile_zoom1(x, y, baseZ + 32, baseZ + 64);
|
|
|
|
|
map_invalidate_tile_zoom1(loc.x, loc.y, loc.z + 32, loc.z + 64);
|
|
|
|
|
return false;
|
|
|
|
|
} while (!(tileElement++)->IsLastForTile());
|
|
|
|
|
|
|
|
|
@ -262,24 +263,24 @@ static bool map_animation_invalidate_park_entrance(int32_t x, int32_t y, int32_t
|
|
|
|
|
*
|
|
|
|
|
* rct2: 0x006CE29E
|
|
|
|
|
*/
|
|
|
|
|
static bool map_animation_invalidate_track_waterfall(int32_t x, int32_t y, int32_t baseZ)
|
|
|
|
|
static bool map_animation_invalidate_track_waterfall(CoordsXYZ loc)
|
|
|
|
|
{
|
|
|
|
|
TileCoordsXYZ tileLoc{ loc };
|
|
|
|
|
TileElement* tileElement;
|
|
|
|
|
|
|
|
|
|
tileElement = map_get_first_element_at(x >> 5, y >> 5);
|
|
|
|
|
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
|
|
|
|
|
if (tileElement == nullptr)
|
|
|
|
|
return true;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (tileElement->base_height != baseZ)
|
|
|
|
|
if (tileElement->base_height != tileLoc.z)
|
|
|
|
|
continue;
|
|
|
|
|
if (tileElement->GetType() != TILE_ELEMENT_TYPE_TRACK)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (tileElement->AsTrack()->GetTrackType() == TRACK_ELEM_WATERFALL)
|
|
|
|
|
{
|
|
|
|
|
int32_t z = tileElement->base_height * 8;
|
|
|
|
|
map_invalidate_tile_zoom1(x, y, z + 14, z + 46);
|
|
|
|
|
map_invalidate_tile_zoom1(loc.x, loc.y, loc.z + 14, loc.z + 46);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} while (!(tileElement++)->IsLastForTile());
|
|
|
|
@ -291,24 +292,24 @@ static bool map_animation_invalidate_track_waterfall(int32_t x, int32_t y, int32
|
|
|
|
|
*
|
|
|
|
|
* rct2: 0x006CE2F3
|
|
|
|
|
*/
|
|
|
|
|
static bool map_animation_invalidate_track_rapids(int32_t x, int32_t y, int32_t baseZ)
|
|
|
|
|
static bool map_animation_invalidate_track_rapids(CoordsXYZ loc)
|
|
|
|
|
{
|
|
|
|
|
TileCoordsXYZ tileLoc{ loc };
|
|
|
|
|
TileElement* tileElement;
|
|
|
|
|
|
|
|
|
|
tileElement = map_get_first_element_at(x >> 5, y >> 5);
|
|
|
|
|
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
|
|
|
|
|
if (tileElement == nullptr)
|
|
|
|
|
return true;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (tileElement->base_height != baseZ)
|
|
|
|
|
if (tileElement->base_height != tileLoc.z)
|
|
|
|
|
continue;
|
|
|
|
|
if (tileElement->GetType() != TILE_ELEMENT_TYPE_TRACK)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (tileElement->AsTrack()->GetTrackType() == TRACK_ELEM_RAPIDS)
|
|
|
|
|
{
|
|
|
|
|
int32_t z = tileElement->base_height * 8;
|
|
|
|
|
map_invalidate_tile_zoom1(x, y, z + 14, z + 18);
|
|
|
|
|
map_invalidate_tile_zoom1(loc.x, loc.y, loc.z + 14, loc.z + 18);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} while (!(tileElement++)->IsLastForTile());
|
|
|
|
@ -320,23 +321,24 @@ static bool map_animation_invalidate_track_rapids(int32_t x, int32_t y, int32_t
|
|
|
|
|
*
|
|
|
|
|
* rct2: 0x006CE39D
|
|
|
|
|
*/
|
|
|
|
|
static bool map_animation_invalidate_track_onridephoto(int32_t x, int32_t y, int32_t baseZ)
|
|
|
|
|
static bool map_animation_invalidate_track_onridephoto(CoordsXYZ loc)
|
|
|
|
|
{
|
|
|
|
|
TileCoordsXYZ tileLoc{ loc };
|
|
|
|
|
TileElement* tileElement;
|
|
|
|
|
|
|
|
|
|
tileElement = map_get_first_element_at(x >> 5, y >> 5);
|
|
|
|
|
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
|
|
|
|
|
if (tileElement == nullptr)
|
|
|
|
|
return true;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (tileElement->base_height != baseZ)
|
|
|
|
|
if (tileElement->base_height != tileLoc.z)
|
|
|
|
|
continue;
|
|
|
|
|
if (tileElement->GetType() != TILE_ELEMENT_TYPE_TRACK)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (tileElement->AsTrack()->GetTrackType() == TRACK_ELEM_ON_RIDE_PHOTO)
|
|
|
|
|
{
|
|
|
|
|
map_invalidate_tile_zoom1(x, y, tileElement->base_height * 8, tileElement->clearance_height * 8);
|
|
|
|
|
map_invalidate_tile_zoom1(loc.x, loc.y, loc.z, tileElement->clearance_height * 8);
|
|
|
|
|
if (game_is_paused())
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
@ -360,24 +362,24 @@ static bool map_animation_invalidate_track_onridephoto(int32_t x, int32_t y, int
|
|
|
|
|
*
|
|
|
|
|
* rct2: 0x006CE348
|
|
|
|
|
*/
|
|
|
|
|
static bool map_animation_invalidate_track_whirlpool(int32_t x, int32_t y, int32_t baseZ)
|
|
|
|
|
static bool map_animation_invalidate_track_whirlpool(CoordsXYZ loc)
|
|
|
|
|
{
|
|
|
|
|
TileCoordsXYZ tileLoc{ loc };
|
|
|
|
|
TileElement* tileElement;
|
|
|
|
|
|
|
|
|
|
tileElement = map_get_first_element_at(x >> 5, y >> 5);
|
|
|
|
|
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
|
|
|
|
|
if (tileElement == nullptr)
|
|
|
|
|
return true;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (tileElement->base_height != baseZ)
|
|
|
|
|
if (tileElement->base_height != tileLoc.z)
|
|
|
|
|
continue;
|
|
|
|
|
if (tileElement->GetType() != TILE_ELEMENT_TYPE_TRACK)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (tileElement->AsTrack()->GetTrackType() == TRACK_ELEM_WHIRLPOOL)
|
|
|
|
|
{
|
|
|
|
|
int32_t z = tileElement->base_height * 8;
|
|
|
|
|
map_invalidate_tile_zoom1(x, y, z + 14, z + 18);
|
|
|
|
|
map_invalidate_tile_zoom1(loc.x, loc.y, loc.z + 14, loc.z + 18);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} while (!(tileElement++)->IsLastForTile());
|
|
|
|
@ -389,24 +391,24 @@ static bool map_animation_invalidate_track_whirlpool(int32_t x, int32_t y, int32
|
|
|
|
|
*
|
|
|
|
|
* rct2: 0x006CE3FA
|
|
|
|
|
*/
|
|
|
|
|
static bool map_animation_invalidate_track_spinningtunnel(int32_t x, int32_t y, int32_t baseZ)
|
|
|
|
|
static bool map_animation_invalidate_track_spinningtunnel(CoordsXYZ loc)
|
|
|
|
|
{
|
|
|
|
|
TileCoordsXYZ tileLoc{ loc };
|
|
|
|
|
TileElement* tileElement;
|
|
|
|
|
|
|
|
|
|
tileElement = map_get_first_element_at(x >> 5, y >> 5);
|
|
|
|
|
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
|
|
|
|
|
if (tileElement == nullptr)
|
|
|
|
|
return true;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (tileElement->base_height != baseZ)
|
|
|
|
|
if (tileElement->base_height != tileLoc.z)
|
|
|
|
|
continue;
|
|
|
|
|
if (tileElement->GetType() != TILE_ELEMENT_TYPE_TRACK)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (tileElement->AsTrack()->GetTrackType() == TRACK_ELEM_SPINNING_TUNNEL)
|
|
|
|
|
{
|
|
|
|
|
int32_t z = tileElement->base_height * 8;
|
|
|
|
|
map_invalidate_tile_zoom1(x, y, z + 14, z + 32);
|
|
|
|
|
map_invalidate_tile_zoom1(loc.x, loc.y, loc.z + 14, loc.z + 32);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} while (!(tileElement++)->IsLastForTile());
|
|
|
|
@ -418,8 +420,7 @@ static bool map_animation_invalidate_track_spinningtunnel(int32_t x, int32_t y,
|
|
|
|
|
*
|
|
|
|
|
* rct2: 0x0068DF8F
|
|
|
|
|
*/
|
|
|
|
|
static bool map_animation_invalidate_remove(
|
|
|
|
|
[[maybe_unused]] int32_t x, [[maybe_unused]] int32_t y, [[maybe_unused]] int32_t baseZ)
|
|
|
|
|
static bool map_animation_invalidate_remove([[maybe_unused]] CoordsXYZ loc)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -428,22 +429,21 @@ static bool map_animation_invalidate_remove(
|
|
|
|
|
*
|
|
|
|
|
* rct2: 0x006BA2BB
|
|
|
|
|
*/
|
|
|
|
|
static bool map_animation_invalidate_banner(int32_t x, int32_t y, int32_t baseZ)
|
|
|
|
|
static bool map_animation_invalidate_banner(CoordsXYZ loc)
|
|
|
|
|
{
|
|
|
|
|
TileCoordsXYZ tileLoc{ loc };
|
|
|
|
|
TileElement* tileElement;
|
|
|
|
|
|
|
|
|
|
tileElement = map_get_first_element_at(x >> 5, y >> 5);
|
|
|
|
|
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
|
|
|
|
|
if (tileElement == nullptr)
|
|
|
|
|
return true;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (tileElement->base_height != baseZ)
|
|
|
|
|
if (tileElement->base_height != tileLoc.z)
|
|
|
|
|
continue;
|
|
|
|
|
if (tileElement->GetType() != TILE_ELEMENT_TYPE_BANNER)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
baseZ = tileElement->base_height * 8;
|
|
|
|
|
map_invalidate_tile_zoom1(x, y, baseZ, baseZ + 16);
|
|
|
|
|
map_invalidate_tile_zoom1(loc.x, loc.y, loc.z, loc.z + 16);
|
|
|
|
|
return false;
|
|
|
|
|
} while (!(tileElement++)->IsLastForTile());
|
|
|
|
|
|
|
|
|
@ -454,18 +454,19 @@ static bool map_animation_invalidate_banner(int32_t x, int32_t y, int32_t baseZ)
|
|
|
|
|
*
|
|
|
|
|
* rct2: 0x006B94EB
|
|
|
|
|
*/
|
|
|
|
|
static bool map_animation_invalidate_large_scenery(int32_t x, int32_t y, int32_t baseZ)
|
|
|
|
|
static bool map_animation_invalidate_large_scenery(CoordsXYZ loc)
|
|
|
|
|
{
|
|
|
|
|
TileCoordsXYZ tileLoc{ loc };
|
|
|
|
|
TileElement* tileElement;
|
|
|
|
|
rct_scenery_entry* sceneryEntry;
|
|
|
|
|
|
|
|
|
|
bool wasInvalidated = false;
|
|
|
|
|
tileElement = map_get_first_element_at(x >> 5, y >> 5);
|
|
|
|
|
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
|
|
|
|
|
if (tileElement == nullptr)
|
|
|
|
|
return true;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (tileElement->base_height != baseZ)
|
|
|
|
|
if (tileElement->base_height != tileLoc.z)
|
|
|
|
|
continue;
|
|
|
|
|
if (tileElement->GetType() != TILE_ELEMENT_TYPE_LARGE_SCENERY)
|
|
|
|
|
continue;
|
|
|
|
@ -473,8 +474,7 @@ static bool map_animation_invalidate_large_scenery(int32_t x, int32_t y, int32_t
|
|
|
|
|
sceneryEntry = tileElement->AsLargeScenery()->GetEntry();
|
|
|
|
|
if (sceneryEntry->large_scenery.flags & LARGE_SCENERY_FLAG_ANIMATED)
|
|
|
|
|
{
|
|
|
|
|
int32_t z = tileElement->base_height * 8;
|
|
|
|
|
map_invalidate_tile_zoom1(x, y, z, z + 16);
|
|
|
|
|
map_invalidate_tile_zoom1(loc.x, loc.y, loc.z, loc.z + 16);
|
|
|
|
|
wasInvalidated = true;
|
|
|
|
|
}
|
|
|
|
|
} while (!(tileElement++)->IsLastForTile());
|
|
|
|
@ -486,8 +486,9 @@ static bool map_animation_invalidate_large_scenery(int32_t x, int32_t y, int32_t
|
|
|
|
|
*
|
|
|
|
|
* rct2: 0x006E5B50
|
|
|
|
|
*/
|
|
|
|
|
static bool map_animation_invalidate_wall_door(int32_t x, int32_t y, int32_t baseZ)
|
|
|
|
|
static bool map_animation_invalidate_wall_door(CoordsXYZ loc)
|
|
|
|
|
{
|
|
|
|
|
TileCoordsXYZ tileLoc{ loc };
|
|
|
|
|
TileElement* tileElement;
|
|
|
|
|
rct_scenery_entry* sceneryEntry;
|
|
|
|
|
|
|
|
|
@ -495,12 +496,12 @@ static bool map_animation_invalidate_wall_door(int32_t x, int32_t y, int32_t bas
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
bool removeAnimation = true;
|
|
|
|
|
tileElement = map_get_first_element_at(x >> 5, y >> 5);
|
|
|
|
|
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
|
|
|
|
|
if (tileElement == nullptr)
|
|
|
|
|
return removeAnimation;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (tileElement->base_height != baseZ)
|
|
|
|
|
if (tileElement->base_height != tileLoc.z)
|
|
|
|
|
continue;
|
|
|
|
|
if (tileElement->GetType() != TILE_ELEMENT_TYPE_WALL)
|
|
|
|
|
continue;
|
|
|
|
@ -539,8 +540,7 @@ static bool map_animation_invalidate_wall_door(int32_t x, int32_t y, int32_t bas
|
|
|
|
|
tileElement->AsWall()->SetAnimationFrame(currentFrame);
|
|
|
|
|
if (invalidate)
|
|
|
|
|
{
|
|
|
|
|
int32_t z = tileElement->base_height * 8;
|
|
|
|
|
map_invalidate_tile_zoom1(x, y, z, z + 32);
|
|
|
|
|
map_invalidate_tile_zoom1(loc.x, loc.y, loc.z, loc.z + 32);
|
|
|
|
|
}
|
|
|
|
|
} while (!(tileElement++)->IsLastForTile());
|
|
|
|
|
|
|
|
|
@ -551,18 +551,19 @@ static bool map_animation_invalidate_wall_door(int32_t x, int32_t y, int32_t bas
|
|
|
|
|
*
|
|
|
|
|
* rct2: 0x006E5EE4
|
|
|
|
|
*/
|
|
|
|
|
static bool map_animation_invalidate_wall(int32_t x, int32_t y, int32_t baseZ)
|
|
|
|
|
static bool map_animation_invalidate_wall(CoordsXYZ loc)
|
|
|
|
|
{
|
|
|
|
|
TileCoordsXYZ tileLoc{ loc };
|
|
|
|
|
TileElement* tileElement;
|
|
|
|
|
rct_scenery_entry* sceneryEntry;
|
|
|
|
|
|
|
|
|
|
bool wasInvalidated = false;
|
|
|
|
|
tileElement = map_get_first_element_at(x >> 5, y >> 5);
|
|
|
|
|
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
|
|
|
|
|
if (tileElement == nullptr)
|
|
|
|
|
return true;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (tileElement->base_height != baseZ)
|
|
|
|
|
if (tileElement->base_height != tileLoc.z)
|
|
|
|
|
continue;
|
|
|
|
|
if (tileElement->GetType() != TILE_ELEMENT_TYPE_WALL)
|
|
|
|
|
continue;
|
|
|
|
@ -574,8 +575,7 @@ static bool map_animation_invalidate_wall(int32_t x, int32_t y, int32_t baseZ)
|
|
|
|
|
&& sceneryEntry->wall.scrolling_mode == SCROLLING_MODE_NONE))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
int32_t z = tileElement->base_height * 8;
|
|
|
|
|
map_invalidate_tile_zoom1(x, y, z, z + 16);
|
|
|
|
|
map_invalidate_tile_zoom1(loc.x, loc.y, loc.z, loc.z + 16);
|
|
|
|
|
wasInvalidated = true;
|
|
|
|
|
} while (!(tileElement++)->IsLastForTile());
|
|
|
|
|
|
|
|
|
@ -610,7 +610,7 @@ static bool InvalidateMapAnimation(const MapAnimation& a)
|
|
|
|
|
{
|
|
|
|
|
if (a.type < std::size(_animatedObjectEventHandlers))
|
|
|
|
|
{
|
|
|
|
|
return _animatedObjectEventHandlers[a.type](a.location.x, a.location.y, a.location.z);
|
|
|
|
|
return _animatedObjectEventHandlers[a.type](a.location);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -634,11 +634,11 @@ void AutoCreateMapAnimations()
|
|
|
|
|
while (tile_element_iterator_next(&it))
|
|
|
|
|
{
|
|
|
|
|
auto el = it.element;
|
|
|
|
|
auto loc = CoordsXYZ{ it.x * 32, it.y * 32, el->base_height };
|
|
|
|
|
auto loc = CoordsXYZ{ it.x * 32, it.y * 32, el->base_height * 8 };
|
|
|
|
|
switch (el->GetType())
|
|
|
|
|
{
|
|
|
|
|
case TILE_ELEMENT_TYPE_BANNER:
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_BANNER, loc.x, loc.y, loc.z);
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_BANNER, loc);
|
|
|
|
|
break;
|
|
|
|
|
case TILE_ELEMENT_TYPE_WALL:
|
|
|
|
|
{
|
|
|
|
@ -647,7 +647,7 @@ void AutoCreateMapAnimations()
|
|
|
|
|
if (entry != nullptr
|
|
|
|
|
&& ((entry->wall.flags2 & WALL_SCENERY_2_ANIMATED) || entry->wall.scrolling_mode != SCROLLING_MODE_NONE))
|
|
|
|
|
{
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_WALL, loc.x, loc.y, loc.z);
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_WALL, loc);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -657,7 +657,7 @@ void AutoCreateMapAnimations()
|
|
|
|
|
auto entry = sceneryEl->GetEntry();
|
|
|
|
|
if (entry != nullptr && scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_ANIMATED))
|
|
|
|
|
{
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_SMALL_SCENERY, loc.x, loc.y, loc.z);
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_SMALL_SCENERY, loc);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -667,7 +667,7 @@ void AutoCreateMapAnimations()
|
|
|
|
|
auto entry = sceneryEl->GetEntry();
|
|
|
|
|
if (entry != nullptr && (entry->large_scenery.flags & LARGE_SCENERY_FLAG_ANIMATED))
|
|
|
|
|
{
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_LARGE_SCENERY, loc.x, loc.y, loc.z);
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_LARGE_SCENERY, loc);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -676,7 +676,7 @@ void AutoCreateMapAnimations()
|
|
|
|
|
auto path = el->AsPath();
|
|
|
|
|
if (path->HasQueueBanner())
|
|
|
|
|
{
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_QUEUE_BANNER, loc.x, loc.y, loc.z);
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_QUEUE_BANNER, loc);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -688,11 +688,11 @@ void AutoCreateMapAnimations()
|
|
|
|
|
case ENTRANCE_TYPE_PARK_ENTRANCE:
|
|
|
|
|
if (entrance->GetSequenceIndex() == 0)
|
|
|
|
|
{
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_PARK_ENTRANCE, loc.x, loc.y, loc.z);
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_PARK_ENTRANCE, loc);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ENTRANCE_TYPE_RIDE_ENTRANCE:
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_RIDE_ENTRANCE, loc.x, loc.y, loc.z);
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_RIDE_ENTRANCE, loc);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
@ -703,16 +703,16 @@ void AutoCreateMapAnimations()
|
|
|
|
|
switch (track->GetTrackType())
|
|
|
|
|
{
|
|
|
|
|
case TRACK_ELEM_WATERFALL:
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_TRACK_WATERFALL, loc.x, loc.y, loc.z);
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_TRACK_WATERFALL, loc);
|
|
|
|
|
break;
|
|
|
|
|
case TRACK_ELEM_RAPIDS:
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_TRACK_RAPIDS, loc.x, loc.y, loc.z);
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_TRACK_RAPIDS, loc);
|
|
|
|
|
break;
|
|
|
|
|
case TRACK_ELEM_WHIRLPOOL:
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_TRACK_WHIRLPOOL, loc.x, loc.y, loc.z);
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_TRACK_WHIRLPOOL, loc);
|
|
|
|
|
break;
|
|
|
|
|
case TRACK_ELEM_SPINNING_TUNNEL:
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_TRACK_SPINNINGTUNNEL, loc.x, loc.y, loc.z);
|
|
|
|
|
map_animation_create(MAP_ANIMATION_TYPE_TRACK_SPINNINGTUNNEL, loc);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|