Merge pull request #12246 from Gymnasiast/refactor/constants

Small constants cleanup
This commit is contained in:
Michael Steenbeek 2020-07-14 00:05:03 +02:00 committed by GitHub
commit 821dc60a7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 18 deletions

View File

@ -1765,7 +1765,7 @@ private:
gPeepSpawns.clear();
for (size_t i = 0; i < RCT12_MAX_PEEP_SPAWNS; i++)
{
if (_s4.peep_spawn[i].x != PEEP_SPAWN_UNDEFINED)
if (_s4.peep_spawn[i].x != RCT12_PEEP_SPAWN_UNDEFINED)
{
PeepSpawn spawn = { _s4.peep_spawn[i].x, _s4.peep_spawn[i].y, _s4.peep_spawn[i].z * 16,
_s4.peep_spawn[i].direction };

View File

@ -339,7 +339,7 @@ bool RCT12SmallSceneryElement::NeedsSupports() const
uint32_t RCT12LargeSceneryElement::GetEntryIndex() const
{
return entryIndex & TILE_ELEMENT_LARGE_TYPE_MASK;
return entryIndex & RCT12_TILE_ELEMENT_LARGE_TYPE_MASK;
}
uint16_t RCT12LargeSceneryElement::GetSequenceIndex() const
@ -448,7 +448,7 @@ uint8_t RCT12EntranceElement::GetRideIndex() const
uint8_t RCT12EntranceElement::GetStationIndex() const
{
return (index & MAP_ELEM_TRACK_SEQUENCE_STATION_INDEX_MASK) >> 4;
return (index & RCT12_TRACK_ELEMENT_SEQUENCE_STATION_INDEX_MASK) >> 4;
}
uint8_t RCT12EntranceElement::GetSequenceIndex() const
@ -523,13 +523,13 @@ void RCT12TileElement::ClearAs(uint8_t newType)
void RCT12LargeSceneryElement::SetEntryIndex(uint32_t newIndex)
{
entryIndex &= ~TILE_ELEMENT_LARGE_TYPE_MASK;
entryIndex |= (newIndex & TILE_ELEMENT_LARGE_TYPE_MASK);
entryIndex &= ~RCT12_TILE_ELEMENT_LARGE_TYPE_MASK;
entryIndex |= (newIndex & RCT12_TILE_ELEMENT_LARGE_TYPE_MASK);
}
void RCT12LargeSceneryElement::SetSequenceIndex(uint16_t sequence)
{
entryIndex &= TILE_ELEMENT_LARGE_TYPE_MASK;
entryIndex &= RCT12_TILE_ELEMENT_LARGE_TYPE_MASK;
entryIndex |= (sequence << 10);
}
@ -974,7 +974,7 @@ void RCT12EntranceElement::SetSequenceIndex(uint8_t newSequenceIndex)
void RCT12EntranceElement::SetStationIndex(uint8_t stationIndex)
{
index &= ~MAP_ELEM_TRACK_SEQUENCE_STATION_INDEX_MASK;
index &= ~RCT12_TRACK_ELEMENT_SEQUENCE_STATION_INDEX_MASK;
index |= (stationIndex << 4);
}

View File

@ -54,6 +54,8 @@ constexpr const uint8_t RCT12_TILE_ELEMENT_SURFACE_EDGE_STYLE_MASK = 0xE0; //
constexpr const uint8_t RCT12_TILE_ELEMENT_SURFACE_WATER_HEIGHT_MASK = 0x1F; // in RCT12TileElement.properties.surface.terrain
constexpr const uint8_t RCT12_TILE_ELEMENT_SURFACE_TERRAIN_MASK = 0xE0; // in RCT12TileElement.properties.surface.terrain
constexpr const uint16_t RCT12_TILE_ELEMENT_LARGE_TYPE_MASK = 0x3FF;
constexpr uint16_t const RCT12_XY8_UNDEFINED = 0xFFFF;
using RCT12ObjectEntryIndex = uint8_t;
@ -68,6 +70,8 @@ constexpr const uint32_t RCT12_RESEARCHED_ITEMS_END_2 = 0xFFFFFFFD;
constexpr const uint8_t RCT12_MAX_ELEMENT_HEIGHT = 255;
constexpr const uint16_t RCT12_PEEP_SPAWN_UNDEFINED = 0xFFFF;
enum class RCT12TrackDesignVersion : uint8_t
{
TD4,

View File

@ -439,7 +439,7 @@ void S6Exporter::ExportPeepSpawns()
}
else
{
_s6.peep_spawns[i] = { PEEP_SPAWN_UNDEFINED, PEEP_SPAWN_UNDEFINED, 0, 0 };
_s6.peep_spawns[i] = { RCT12_PEEP_SPAWN_UNDEFINED, RCT12_PEEP_SPAWN_UNDEFINED, 0, 0 };
}
}
}

View File

@ -967,14 +967,14 @@ public:
|| String::Equals(_s6.scenario_filename, "South America - Rio Carnival.SC6"))
{
_s6.peep_spawns[0] = { 2160, 3167, 6, 1 };
_s6.peep_spawns[1].x = PEEP_SPAWN_UNDEFINED;
_s6.peep_spawns[1].x = RCT12_PEEP_SPAWN_UNDEFINED;
}
// In this park, peep_spawns[0] is correct. Just clear the other.
else if (
String::Equals(_s6.scenario_filename, "Great Wall of China Tourism Enhancement.SC6")
|| String::Equals(_s6.scenario_filename, "Asia - Great Wall of China Tourism Enhancement.SC6"))
{
_s6.peep_spawns[1].x = PEEP_SPAWN_UNDEFINED;
_s6.peep_spawns[1].x = RCT12_PEEP_SPAWN_UNDEFINED;
}
// Amity Airfield has peeps entering from the corner of the tile, instead of the middle.
else if (String::Equals(_s6.scenario_filename, "Amity Airfield.SC6"))
@ -991,7 +991,7 @@ public:
gPeepSpawns.clear();
for (size_t i = 0; i < RCT12_MAX_PEEP_SPAWNS; i++)
{
if (_s6.peep_spawns[i].x != PEEP_SPAWN_UNDEFINED)
if (_s6.peep_spawns[i].x != RCT12_PEEP_SPAWN_UNDEFINED)
{
PeepSpawn spawn = { _s6.peep_spawns[i].x, _s6.peep_spawns[i].y, _s6.peep_spawns[i].z * 16,
_s6.peep_spawns[i].direction };

View File

@ -37,9 +37,6 @@ constexpr const uint32_t MAX_TILE_ELEMENTS_WITH_SPARE_ROOM = 0x30000;
constexpr const uint32_t MAX_TILE_ELEMENTS = MAX_TILE_ELEMENTS_WITH_SPARE_ROOM - 512;
#define MAX_TILE_TILE_ELEMENT_POINTERS (MAXIMUM_MAP_SIZE_TECHNICAL * MAXIMUM_MAP_SIZE_TECHNICAL)
#define MAX_PEEP_SPAWNS 2
#define PEEP_SPAWN_UNDEFINED 0xFFFF
#define TILE_ELEMENT_LARGE_TYPE_MASK 0x3FF
#define TILE_UNDEFINED_TILE_ELEMENT NULL

View File

@ -638,10 +638,6 @@ enum
#define TILE_ELEMENT_COLOUR_MASK 0b00011111
#define MAP_ELEM_TRACK_SEQUENCE_STATION_INDEX_MASK 0b01110000
#define MAP_ELEM_TRACK_SEQUENCE_SEQUENCE_MASK 0b00001111
#define MAP_ELEM_TRACK_SEQUENCE_TAKING_PHOTO_MASK 0b11110000
BannerIndex tile_element_get_banner_index(TileElement* tileElement);
bool tile_element_is_underground(TileElement* tileElement);