1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

Use type bit 1 on surface element to store more surface styles

This commit is contained in:
Gymnasiast
2020-12-20 18:48:27 +01:00
parent 0f1414a173
commit 31dc155e0b
2 changed files with 10 additions and 7 deletions

View File

@@ -79,8 +79,7 @@ uint8_t RCT12SurfaceElement::GetSlope() const
uint32_t RCT12SurfaceElement::GetSurfaceStyle() const
{
uint32_t retVal = (terrain >> 5) & 7;
if (type & 1)
retVal |= (1 << 3);
retVal |= (type & RCT12_SURFACE_ELEMENT_TYPE_SURFACE_MASK) << 3;
return retVal;
}
@@ -557,11 +556,9 @@ void RCT12LargeSceneryElement::SetBannerIndex(uint8_t newIndex)
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 3, 4 for terrain are stored in element.type bit 0, 1
type &= ~RCT12_SURFACE_ELEMENT_TYPE_SURFACE_MASK;
type |= (newStyle >> 3) & RCT12_SURFACE_ELEMENT_TYPE_SURFACE_MASK;
// Bits 0, 1, 2 for terrain are stored in element.terrain bit 5, 6, 7
terrain &= ~0xE0;

View File

@@ -89,6 +89,12 @@ enum class RCT12TrackDesignVersion : uint8_t
unknown
};
enum
{
RCT12_SURFACE_ELEMENT_TYPE_SURFACE_MASK = 0b00000011,
RCT12_SURFACE_ELEMENT_TYPE_EDGE_MASK = 0b01000000,
};
enum
{
RCT12_TILE_ELEMENT_FLAG_GHOST = (1 << 4),