1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

Properly export tile elements to S6

This commit is contained in:
Gymnasiast
2019-08-18 18:18:44 +02:00
parent 18844f9244
commit 169d2980ca
6 changed files with 686 additions and 9 deletions

View File

@@ -479,3 +479,439 @@ uint8_t RCT12TileElement::GetBannerIndex()
return BANNER_INDEX_NULL;
}
}
void RCT12TileElementBase::SetDirection(uint8_t direction)
{
this->type &= ~TILE_ELEMENT_DIRECTION_MASK;
this->type |= (direction & TILE_ELEMENT_DIRECTION_MASK);
}
void RCT12TileElement::ClearAs(uint8_t newType)
{
type = newType;
flags = 0;
base_height = 2;
clearance_height = 2;
std::fill_n(pad_04, sizeof(pad_04), 0x00);
}
void RCT12LargeSceneryElement::SetEntryIndex(uint32_t newIndex)
{
entryIndex &= ~TILE_ELEMENT_LARGE_TYPE_MASK;
entryIndex |= (newIndex & TILE_ELEMENT_LARGE_TYPE_MASK);
}
void RCT12LargeSceneryElement::SetSequenceIndex(uint16_t sequence)
{
entryIndex &= TILE_ELEMENT_LARGE_TYPE_MASK;
entryIndex |= (sequence << 10);
}
void RCT12LargeSceneryElement::SetPrimaryColour(colour_t newColour)
{
assert(newColour <= 31);
colour[0] &= ~TILE_ELEMENT_COLOUR_MASK;
colour[0] |= newColour;
}
void RCT12LargeSceneryElement::SetSecondaryColour(colour_t newColour)
{
assert(newColour <= 31);
colour[1] &= ~TILE_ELEMENT_COLOUR_MASK;
colour[1] |= newColour;
}
void RCT12LargeSceneryElement::SetBannerIndex(BannerIndex newIndex)
{
type |= newIndex & 0xC0;
colour[0] |= (newIndex & 0x38) << 2;
colour[1] |= (newIndex & 7) << 5;
}
void RCT12SurfaceElement::SetSurfaceStyle(uint32_t newStyle)
{
// Bit 3 for terrain is stored in element.type bit 0
if (newStyle & 8)
type |= 1;
else
type &= ~1;
// Bits 0, 1, 2 for terrain are stored in element.terrain bit 5, 6, 7
terrain &= ~0xE0;
terrain |= (newStyle & 7) << 5;
}
void RCT12SurfaceElement::SetEdgeStyle(uint32_t newStyle)
{
// Bit 3 for terrain is stored in element.type bit 7
if (newStyle & 8)
type |= 128;
else
type &= ~128;
// Bits 0, 1, 2 for terrain are stored in element.slope bit 5, 6, 7
slope &= ~TILE_ELEMENT_SURFACE_EDGE_STYLE_MASK;
slope |= (newStyle & 7) << 5;
}
void RCT12SurfaceElement::SetWaterHeight(uint32_t newWaterHeight)
{
newWaterHeight &= 0x1F;
terrain &= ~TILE_ELEMENT_SURFACE_WATER_HEIGHT_MASK;
terrain |= newWaterHeight;
}
void RCT12SurfaceElement::SetGrassLength(uint8_t newLength)
{
grass_length = newLength;
}
void RCT12SurfaceElement::SetOwnership(uint8_t newOwnership)
{
ownership &= ~TILE_ELEMENT_SURFACE_OWNERSHIP_MASK;
ownership |= (newOwnership & TILE_ELEMENT_SURFACE_OWNERSHIP_MASK);
}
void RCT12SurfaceElement::SetParkFences(uint8_t newParkFences)
{
ownership &= ~TILE_ELEMENT_SURFACE_PARK_FENCE_MASK;
ownership |= (newParkFences & TILE_ELEMENT_SURFACE_PARK_FENCE_MASK);
}
void RCT12SurfaceElement::SetSlope(uint8_t newSlope)
{
slope &= ~TILE_ELEMENT_SURFACE_SLOPE_MASK;
slope |= (newSlope & TILE_ELEMENT_SURFACE_SLOPE_MASK);
}
void RCT12SurfaceElement::SetHasTrackThatNeedsWater(bool on)
{
type &= ~SURFACE_ELEMENT_HAS_TRACK_THAT_NEEDS_WATER;
if (on)
type |= SURFACE_ELEMENT_HAS_TRACK_THAT_NEEDS_WATER;
}
void RCT12PathElement::SetPathEntryIndex(uint8_t newEntryIndex)
{
entryIndex &= ~FOOTPATH_PROPERTIES_TYPE_MASK;
entryIndex |= (newEntryIndex << 4);
}
void RCT12PathElement::SetQueueBannerDirection(uint8_t direction)
{
type &= ~FOOTPATH_ELEMENT_TYPE_DIRECTION_MASK;
type |= (direction << 6);
}
void RCT12PathElement::SetRideIndex(uint8_t newRideIndex)
{
rideIndex = newRideIndex;
}
void RCT12PathElement::SetAdditionStatus(uint8_t newStatus)
{
additionStatus = newStatus;
}
void RCT12PathElement::SetEdges(uint8_t newEdges)
{
edges &= ~FOOTPATH_PROPERTIES_EDGES_EDGES_MASK;
edges |= (newEdges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK);
}
void RCT12PathElement::SetCorners(uint8_t newCorners)
{
edges &= ~FOOTPATH_PROPERTIES_EDGES_CORNERS_MASK;
edges |= (newCorners << 4);
}
void RCT12PathElement::SetSloped(bool isSloped)
{
entryIndex &= ~FOOTPATH_PROPERTIES_FLAG_IS_SLOPED;
if (isSloped)
entryIndex |= FOOTPATH_PROPERTIES_FLAG_IS_SLOPED;
}
void RCT12PathElement::SetSlopeDirection(uint8_t newSlope)
{
entryIndex &= ~FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK;
entryIndex |= newSlope & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK;
}
void RCT12PathElement::SetStationIndex(uint8_t newStationIndex)
{
additions &= ~FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK;
additions |= ((newStationIndex << 4) & FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK);
}
void RCT12PathElement::SetWide(bool isWide)
{
type &= ~FOOTPATH_ELEMENT_TYPE_FLAG_IS_WIDE;
if (isWide)
type |= FOOTPATH_ELEMENT_TYPE_FLAG_IS_WIDE;
}
void RCT12PathElement::SetIsQueue(bool isQueue)
{
type &= ~FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE;
if (isQueue)
type |= FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE;
}
void RCT12PathElement::SetHasQueueBanner(bool hasQueueBanner)
{
entryIndex &= ~FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER;
if (hasQueueBanner)
entryIndex |= FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER;
}
void RCT12PathElement::SetAddition(uint8_t newAddition)
{
additions &= ~FOOTPATH_PROPERTIES_ADDITIONS_TYPE_MASK;
additions |= newAddition;
}
void RCT12PathElement::SetAdditionIsGhost(bool isGhost)
{
additions &= ~FOOTPATH_ADDITION_FLAG_IS_GHOST;
if (isGhost)
additions |= FOOTPATH_ADDITION_FLAG_IS_GHOST;
}
void RCT12TrackElement::SetTrackType(uint8_t newType)
{
trackType = newType;
}
void RCT12TrackElement::SetSequenceIndex(uint8_t newSequenceIndex)
{
sequence &= ~MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK;
sequence |= (newSequenceIndex & MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK);
}
void RCT12TrackElement::SetStationIndex(uint8_t newStationIndex)
{
sequence &= ~MAP_ELEM_TRACK_SEQUENCE_STATION_INDEX_MASK;
sequence |= (newStationIndex << 4);
}
void RCT12TrackElement::SetRideIndex(uint8_t newRideIndex)
{
rideIndex = newRideIndex;
}
void RCT12TrackElement::SetColourScheme(uint8_t newColourScheme)
{
colour &= ~0x3;
colour |= (newColourScheme & 0x3);
}
void RCT12TrackElement::SetHasCableLift(bool on)
{
colour &= ~TRACK_ELEMENT_COLOUR_FLAG_CABLE_LIFT;
if (on)
colour |= TRACK_ELEMENT_COLOUR_FLAG_CABLE_LIFT;
}
void RCT12TrackElement::SetInverted(bool inverted)
{
if (inverted)
{
colour |= TRACK_ELEMENT_COLOUR_FLAG_INVERTED;
}
else
{
colour &= ~TRACK_ELEMENT_COLOUR_FLAG_INVERTED;
}
}
void RCT12TrackElement::SetBrakeBoosterSpeed(uint8_t speed)
{
sequence &= ~0b11110000;
sequence |= ((speed >> 1) << 4);
}
void RCT12TrackElement::SetBlockBrakeClosed(bool isClosed)
{
if (isClosed)
{
flags |= TILE_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED;
}
else
{
flags &= ~TILE_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED;
}
}
void RCT12TrackElement::SetHasGreenLight(uint8_t greenLight)
{
sequence &= ~MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT;
if (greenLight)
{
sequence |= MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT;
}
}
void RCT12TrackElement::SetHasChain(bool on)
{
if (on)
{
type |= TRACK_ELEMENT_TYPE_FLAG_CHAIN_LIFT;
}
else
{
type &= ~TRACK_ELEMENT_TYPE_FLAG_CHAIN_LIFT;
}
}
void RCT12TrackElement::SetSeatRotation(uint8_t newSeatRotation)
{
colour &= 0x0F;
colour |= (newSeatRotation << 4);
}
void RCT12TrackElement::SetMazeEntry(uint16_t newMazeEntry)
{
mazeEntry = newMazeEntry;
}
void RCT12TrackElement::SetPhotoTimeout(uint8_t value)
{
sequence &= MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK;
sequence |= (value << 4);
}
void RCT12SmallSceneryElement::SetEntryIndex(uint8_t newIndex)
{
this->entryIndex = newIndex;
}
void RCT12SmallSceneryElement::SetAge(uint8_t newAge)
{
this->age = newAge;
}
void RCT12SmallSceneryElement::SetPrimaryColour(colour_t colour)
{
assert(colour <= 31);
colour_1 &= ~TILE_ELEMENT_COLOUR_MASK;
colour_1 |= colour;
}
void RCT12SmallSceneryElement::SetSecondaryColour(colour_t colour)
{
assert(colour <= 31);
colour_2 &= ~TILE_ELEMENT_COLOUR_MASK;
colour_2 |= colour;
}
void RCT12SmallSceneryElement::SetSceneryQuadrant(uint8_t newQuadrant)
{
type &= ~TILE_ELEMENT_QUADRANT_MASK;
type |= (newQuadrant << 6);
}
void RCT12SmallSceneryElement::SetNeedsSupports()
{
colour_1 |= MAP_ELEM_SMALL_SCENERY_COLOUR_FLAG_NEEDS_SUPPORTS;
}
void RCT12WallElement::SetEntryIndex(uint8_t newIndex)
{
entryIndex = newIndex;
}
void RCT12WallElement::SetBannerIndex(BannerIndex newIndex)
{
banner_index = newIndex;
}
void RCT12WallElement::SetAcrossTrack(bool acrossTrack)
{
animation &= ~WALL_ANIMATION_FLAG_ACROSS_TRACK;
if (acrossTrack)
animation |= WALL_ANIMATION_FLAG_ACROSS_TRACK;
}
void RCT12WallElement::SetAnimationIsBackwards(bool isBackwards)
{
animation &= ~WALL_ANIMATION_FLAG_DIRECTION_BACKWARD;
if (isBackwards)
animation |= WALL_ANIMATION_FLAG_DIRECTION_BACKWARD;
}
void RCT12WallElement::SetSlope(uint8_t newSlope)
{
type &= ~TILE_ELEMENT_QUADRANT_MASK;
type |= (newSlope << 6);
}
void RCT12WallElement::SetPrimaryColour(colour_t newColour)
{
assert(newColour <= 31);
colour_1 &= ~TILE_ELEMENT_COLOUR_MASK;
colour_1 |= newColour;
}
void RCT12WallElement::SetSecondaryColour(colour_t newColour)
{
colour_1 &= TILE_ELEMENT_COLOUR_MASK;
colour_1 |= (newColour & 0x7) << 5;
flags &= ~0x60;
flags |= (newColour & 0x18) << 2;
}
void RCT12WallElement::SetTertiaryColour(colour_t newColour)
{
assert(newColour <= 31);
colour_3 &= ~TILE_ELEMENT_COLOUR_MASK;
colour_3 |= newColour;
}
void RCT12WallElement::SetAnimationFrame(uint8_t frameNum)
{
animation &= WALL_ANIMATION_FLAG_ALL_FLAGS;
animation |= (frameNum & 0xF) << 3;
}
void RCT12EntranceElement::SetEntranceType(uint8_t newType)
{
entranceType = newType;
}
void RCT12EntranceElement::SetRideIndex(uint8_t newRideIndex)
{
rideIndex = newRideIndex;
}
void RCT12EntranceElement::SetPathType(uint8_t newPathType)
{
pathType = newPathType;
}
void RCT12EntranceElement::SetSequenceIndex(uint8_t newSequenceIndex)
{
index &= ~0xF;
index |= (newSequenceIndex & 0xF);
}
void RCT12EntranceElement::SetStationIndex(uint8_t stationIndex)
{
index &= ~MAP_ELEM_TRACK_SEQUENCE_STATION_INDEX_MASK;
index |= (stationIndex << 4);
}
void RCT12BannerElement::SetIndex(BannerIndex newIndex)
{
index = newIndex;
}
void RCT12BannerElement::SetPosition(uint8_t newPosition)
{
position = newPosition;
}
void RCT12BannerElement::SetAllowedEdges(uint8_t newEdges)
{
flags &= ~0b00001111;
flags |= (newEdges & 0b00001111);
}

View File

@@ -166,6 +166,7 @@ struct RCT12TileElementBase
uint8_t GetDirection() const;
bool IsLastForTile() const;
bool IsGhost() const;
void SetDirection(uint8_t direction);
};
/**
* Map element structure
@@ -231,6 +232,15 @@ public:
uint32_t GetWaterHeight() const;
uint8_t GetParkFences() const;
bool HasTrackThatNeedsWater() const;
void SetSlope(uint8_t newSlope);
void SetSurfaceStyle(uint32_t newStyle);
void SetEdgeStyle(uint32_t newStyle);
void SetGrassLength(uint8_t newLength);
void SetOwnership(uint8_t newOwnership);
void SetWaterHeight(uint32_t newWaterHeight);
void SetParkFences(uint8_t newParkFences);
void SetHasTrackThatNeedsWater(bool on);
};
assert_struct_size(RCT12SurfaceElement, 8);
struct RCT12PathElement : RCT12TileElementBase
@@ -257,14 +267,26 @@ public:
bool HasQueueBanner() const;
uint8_t GetEdges() const;
uint8_t GetCorners() const;
uint8_t GetEdgesAndCorners() const;
bool HasAddition() const;
uint8_t GetAddition() const;
uint8_t GetAdditionEntryIndex() const;
bool AdditionIsGhost() const;
uint8_t GetAdditionStatus() const;
uint8_t GetRCT1PathType() const;
uint8_t GetRCT1SupportType() const;
void SetPathEntryIndex(uint8_t newIndex);
void SetQueueBannerDirection(uint8_t direction);
void SetSloped(bool isSloped);
void SetSlopeDirection(uint8_t newSlope);
void SetRideIndex(uint8_t newRideIndex);
void SetStationIndex(uint8_t newStationIndex);
void SetWide(bool isWide);
void SetIsQueue(bool isQueue);
void SetHasQueueBanner(bool hasQueueBanner);
void SetEdges(uint8_t newEdges);
void SetCorners(uint8_t newCorners);
void SetAddition(uint8_t newAddition);
void SetAdditionIsGhost(bool isGhost);
void SetAdditionStatus(uint8_t newStatus);
};
assert_struct_size(RCT12PathElement, 8);
struct RCT12TrackElement : RCT12TileElementBase
@@ -305,13 +327,26 @@ public:
bool HasGreenLight() const;
uint8_t GetSeatRotation() const;
uint16_t GetMazeEntry() const;
bool IsTakingPhoto() const;
uint8_t GetPhotoTimeout() const;
bool IsHighlighted() const;
// Used in RCT1, will be reintroduced at some point.
// (See https://github.com/OpenRCT2/OpenRCT2/issues/7059)
uint8_t GetDoorAState() const;
uint8_t GetDoorBState() const;
void SetTrackType(uint8_t newEntryIndex);
void SetSequenceIndex(uint8_t newSequenceIndex);
void SetRideIndex(uint8_t newRideIndex);
void SetColourScheme(uint8_t newColourScheme);
void SetStationIndex(uint8_t newStationIndex);
void SetHasChain(bool on);
void SetHasCableLift(bool on);
void SetInverted(bool inverted);
void SetBlockBrakeClosed(bool isClosed);
void SetBrakeBoosterSpeed(uint8_t speed);
void SetHasGreenLight(uint8_t greenLight);
void SetSeatRotation(uint8_t newSeatRotation);
void SetMazeEntry(uint16_t newMazeEntry);
void SetPhotoTimeout(uint8_t newValue);
};
assert_struct_size(RCT12TrackElement, 8);
struct RCT12SmallSceneryElement : RCT12TileElementBase
@@ -328,6 +363,13 @@ public:
colour_t GetPrimaryColour() const;
colour_t GetSecondaryColour() const;
bool NeedsSupports() const;
void SetEntryIndex(uint8_t newIndex);
void SetAge(uint8_t newAge);
void SetSceneryQuadrant(uint8_t newQuadrant);
void SetPrimaryColour(colour_t colour);
void SetSecondaryColour(colour_t colour);
void SetNeedsSupports();
};
assert_struct_size(RCT12SmallSceneryElement, 8);
struct RCT12LargeSceneryElement : RCT12TileElementBase
@@ -341,6 +383,12 @@ public:
colour_t GetPrimaryColour() const;
colour_t GetSecondaryColour() const;
BannerIndex GetBannerIndex() const;
void SetEntryIndex(uint32_t newIndex);
void SetSequenceIndex(uint16_t sequence);
void SetPrimaryColour(colour_t colour);
void SetSecondaryColour(colour_t colour);
void SetBannerIndex(BannerIndex newIndex);
};
assert_struct_size(RCT12LargeSceneryElement, 8);
struct RCT12WallElement : RCT12TileElementBase
@@ -367,6 +415,16 @@ public:
uint32_t GetRawRCT1WallTypeData() const;
int32_t GetRCT1WallType(int32_t edge) const;
colour_t GetRCT1WallColour() const;
void SetEntryIndex(uint8_t newIndex);
void SetSlope(uint8_t newslope);
void SetPrimaryColour(colour_t newColour);
void SetSecondaryColour(colour_t newColour);
void SetTertiaryColour(colour_t newColour);
void SetAnimationFrame(uint8_t frameNum);
void SetBannerIndex(BannerIndex newIndex);
void SetAcrossTrack(bool acrossTrack);
void SetAnimationIsBackwards(bool isBackwards);
};
assert_struct_size(RCT12WallElement, 8);
struct RCT12EntranceElement : RCT12TileElementBase
@@ -382,6 +440,12 @@ public:
uint8_t GetStationIndex() const;
uint8_t GetSequenceIndex() const;
uint8_t GetPathType() const;
void SetEntranceType(uint8_t newType);
void SetRideIndex(uint8_t newRideIndex);
void SetStationIndex(uint8_t stationIndex);
void SetSequenceIndex(uint8_t newSequenceIndex);
void SetPathType(uint8_t newPathType);
};
assert_struct_size(RCT12EntranceElement, 8);
struct RCT12BannerElement : RCT12TileElementBase
@@ -398,6 +462,10 @@ public:
BannerIndex GetIndex() const;
uint8_t GetPosition() const;
uint8_t GetAllowedEdges() const;
void SetIndex(BannerIndex newIndex);
void SetPosition(uint8_t newPosition);
void SetAllowedEdges(uint8_t newEdges);
};
assert_struct_size(RCT12BannerElement, 8);

View File

@@ -194,10 +194,7 @@ void S6Exporter::Export()
_s6.scenario_srand_0 = state.s0;
_s6.scenario_srand_1 = state.s1;
std::memcpy(_s6.tile_elements, gTileElements, sizeof(_s6.tile_elements));
_s6.next_free_tile_element_pointer_index = gNextFreeTileElementPointerIndex;
ExportTileElements();
ExportSprites();
ExportParkName();
@@ -1326,6 +1323,173 @@ void S6Exporter::ExportMapAnimations()
}
}
void S6Exporter::ExportTileElements()
{
for (uint32_t index = 0; index < RCT2_MAX_TILE_ELEMENTS; index++)
{
auto src = &gTileElements[index];
auto dst = &_s6.tile_elements[index];
if (src->base_height == 0xFF)
{
std::memcpy(dst, src, sizeof(*src));
}
else
{
auto tileElementType = (RCT12TileElementType)src->GetType();
// Todo: replace with setting invisibility bit
if (tileElementType == RCT12TileElementType::Corrupt || tileElementType == RCT12TileElementType::EightCarsCorrupt14
|| tileElementType == RCT12TileElementType::EightCarsCorrupt15)
std::memcpy(dst, src, sizeof(*dst));
else
ExportTileElement(dst, src);
}
}
_s6.next_free_tile_element_pointer_index = gNextFreeTileElementPointerIndex;
}
void S6Exporter::ExportTileElement(RCT12TileElement* dst, TileElement* src)
{
// Todo: allow for changing defition of OpenRCT2 tile element types - replace with a map
uint8_t tileElementType = src->GetType();
dst->ClearAs(tileElementType);
dst->SetDirection(src->GetDirection());
dst->flags = src->flags;
dst->base_height = src->base_height;
dst->clearance_height = src->clearance_height;
switch (tileElementType)
{
case TILE_ELEMENT_TYPE_SURFACE:
{
auto dst2 = dst->AsSurface();
auto src2 = src->AsSurface();
dst2->SetSlope(src2->GetSlope());
dst2->SetSurfaceStyle(src2->GetSurfaceStyle());
dst2->SetEdgeStyle(src2->GetEdgeStyle());
dst2->SetGrassLength(src2->GetGrassLength());
dst2->SetOwnership(src2->GetOwnership());
dst2->SetParkFences(src2->GetParkFences());
dst2->SetWaterHeight(src2->GetWaterHeight());
dst2->SetHasTrackThatNeedsWater(src2->HasTrackThatNeedsWater());
break;
}
case TILE_ELEMENT_TYPE_PATH:
{
auto dst2 = dst->AsPath();
auto src2 = src->AsPath();
dst2->SetPathEntryIndex(src2->GetPathEntryIndex());
dst2->SetQueueBannerDirection(src2->GetQueueBannerDirection());
dst2->SetSloped(src2->IsSloped());
dst2->SetSlopeDirection(src2->GetSlopeDirection());
dst2->SetRideIndex(src2->GetRideIndex());
dst2->SetStationIndex(src2->GetStationIndex());
dst2->SetWide(src2->IsWide());
dst2->SetIsQueue(src2->IsQueue());
dst2->SetHasQueueBanner(src2->HasQueueBanner());
dst2->SetEdges(src2->GetEdges());
dst2->SetCorners(src2->GetCorners());
dst2->SetAddition(src2->GetAddition());
dst2->SetAdditionIsGhost(src2->AdditionIsGhost());
dst2->SetAdditionStatus(src2->GetAdditionStatus());
break;
}
case TILE_ELEMENT_TYPE_TRACK:
{
auto dst2 = dst->AsTrack();
auto src2 = src->AsTrack();
dst2->SetTrackType(src2->GetTrackType());
dst2->SetSequenceIndex(src2->GetSequenceIndex());
dst2->SetRideIndex(src2->GetRideIndex());
dst2->SetColourScheme(src2->GetColourScheme());
dst2->SetStationIndex(src2->GetStationIndex());
dst2->SetHasChain(src2->HasChain());
dst2->SetHasCableLift(src2->HasCableLift());
dst2->SetInverted(src2->IsInverted());
dst2->SetBrakeBoosterSpeed(src2->GetBrakeBoosterSpeed());
dst2->SetHasGreenLight(src2->HasGreenLight());
dst2->SetSeatRotation(src2->GetSeatRotation());
dst2->SetMazeEntry(src2->GetMazeEntry());
dst2->SetPhotoTimeout(src2->GetPhotoTimeout());
// Skipping IsHighlighted()
break;
}
case TILE_ELEMENT_TYPE_SMALL_SCENERY:
{
auto dst2 = dst->AsSmallScenery();
auto src2 = src->AsSmallScenery();
dst2->SetEntryIndex(src2->GetEntryIndex());
dst2->SetAge(src2->GetAge());
dst2->SetSceneryQuadrant(src2->GetSceneryQuadrant());
dst2->SetPrimaryColour(src2->GetPrimaryColour());
dst2->SetSecondaryColour(src2->GetSecondaryColour());
if (src2->NeedsSupports())
dst2->SetNeedsSupports();
break;
}
case TILE_ELEMENT_TYPE_ENTRANCE:
{
auto dst2 = dst->AsEntrance();
auto src2 = src->AsEntrance();
dst2->SetEntranceType(src2->GetEntranceType());
dst2->SetRideIndex(src2->GetRideIndex());
dst2->SetStationIndex(src2->GetStationIndex());
dst2->SetSequenceIndex(src2->GetSequenceIndex());
dst2->SetPathType(src2->GetPathType());
break;
}
case TILE_ELEMENT_TYPE_WALL:
{
auto dst2 = dst->AsWall();
auto src2 = src->AsWall();
dst2->SetEntryIndex(src2->GetEntryIndex());
dst2->SetSlope(src2->GetSlope());
dst2->SetPrimaryColour(src2->GetPrimaryColour());
dst2->SetSecondaryColour(src2->GetSecondaryColour());
dst2->SetTertiaryColour(src2->GetTertiaryColour());
dst2->SetAnimationFrame(src2->GetAnimationFrame());
dst2->SetBannerIndex(src2->GetBannerIndex());
dst2->SetAcrossTrack(src2->IsAcrossTrack());
dst2->SetAnimationIsBackwards(src2->AnimationIsBackwards());
break;
}
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
{
auto dst2 = dst->AsLargeScenery();
auto src2 = src->AsLargeScenery();
dst2->SetEntryIndex(src2->GetEntryIndex());
dst2->SetSequenceIndex(src2->GetSequenceIndex());
dst2->SetPrimaryColour(src2->GetPrimaryColour());
dst2->SetSecondaryColour(src2->GetSecondaryColour());
dst2->SetBannerIndex(src2->GetBannerIndex());
break;
}
case TILE_ELEMENT_TYPE_BANNER:
{
auto dst2 = dst->AsBanner();
auto src2 = src->AsBanner();
dst2->SetIndex(src2->GetIndex());
dst2->SetPosition(src2->GetPosition());
dst2->SetAllowedEdges(src2->GetAllowedEdges());
break;
}
default:
assert(false);
}
}
opt::optional<uint16_t> S6Exporter::AllocateUserString(const std::string_view& value)
{
auto nextId = _userStrings.size();

View File

@@ -69,6 +69,9 @@ private:
void ExportBanner(RCT12Banner& dst, const Banner& src);
void ExportMapAnimations();
void ExportTileElements();
void ExportTileElement(RCT12TileElement* dst, TileElement* src);
opt::optional<uint16_t> AllocateUserString(const std::string_view& value);
void ExportUserStrings();
};

View File

@@ -1241,6 +1241,11 @@ void TrackElement::SetPhotoTimeout(uint8_t value)
sequence |= (value << 4);
}
uint8_t TrackElement::GetPhotoTimeout() const
{
return (sequence & MAP_ELEM_TRACK_SEQUENCE_TAKING_PHOTO_MASK) >> 4;
}
void TrackElement::DecrementPhotoTimeout()
{
// We should only touch the upper 4 bits, avoid underflow into the lower 4.

View File

@@ -319,6 +319,7 @@ public:
void SetPhotoTimeout();
void SetPhotoTimeout(uint8_t newValue);
void DecrementPhotoTimeout();
uint8_t GetPhotoTimeout() const;
bool IsHighlighted() const;
void SetHighlight(bool on);