mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-27 08:45:00 +01:00
Move direct access to maze entry to struct methods
This commit is contained in:
committed by
Gymnasiast
parent
75b5c45a97
commit
3f17782692
@@ -233,7 +233,7 @@ public:
|
||||
|
||||
tileElement->AsTrack()->SetTrackType(TRACK_ELEM_MAZE);
|
||||
tileElement->AsTrack()->SetRideIndex(_rideIndex);
|
||||
tileElement->properties.track.maze_entry = 0xFFFF;
|
||||
tileElement->AsTrack()->SetMazeEntry(0xFFFF);
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_GHOST)
|
||||
{
|
||||
@@ -259,12 +259,12 @@ public:
|
||||
{
|
||||
uint8_t segmentOffset = MazeGetSegmentBit(_x, _y);
|
||||
|
||||
tileElement->properties.track.maze_entry &= ~(1 << segmentOffset);
|
||||
tileElement->AsTrack()->MazeEntrySubtract(1 << segmentOffset);
|
||||
|
||||
if (!_initialPlacement)
|
||||
{
|
||||
segmentOffset = byte_993CE9[(_direction + segmentOffset)];
|
||||
tileElement->properties.track.maze_entry &= ~(1 << segmentOffset);
|
||||
tileElement->AsTrack()->MazeEntrySubtract(1 << segmentOffset);
|
||||
|
||||
uint8_t temp_edx = byte_993CFC[segmentOffset];
|
||||
if (temp_edx != 0xFF)
|
||||
@@ -277,11 +277,11 @@ public:
|
||||
|
||||
if (previousTileElement != nullptr)
|
||||
{
|
||||
previousTileElement->properties.track.maze_entry &= ~(1 << temp_edx);
|
||||
previousTileElement->AsTrack()->MazeEntrySubtract(1 << temp_edx);
|
||||
}
|
||||
else
|
||||
{
|
||||
tileElement->properties.track.maze_entry |= (1 << segmentOffset);
|
||||
tileElement->AsTrack()->MazeEntryAdd(1 << segmentOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -312,16 +312,16 @@ public:
|
||||
|
||||
uint32_t segmentBit = MazeGetSegmentBit(previousSegmentX, previousSegmentY);
|
||||
|
||||
tileElement->properties.track.maze_entry |= (1 << segmentBit);
|
||||
tileElement->AsTrack()->MazeEntryAdd(1 << segmentBit);
|
||||
segmentBit--;
|
||||
tileElement->properties.track.maze_entry |= (1 << segmentBit);
|
||||
tileElement->AsTrack()->MazeEntryAdd(1 << segmentBit);
|
||||
segmentBit = (segmentBit - 4) & 0x0F;
|
||||
tileElement->properties.track.maze_entry |= (1 << segmentBit);
|
||||
tileElement->AsTrack()->MazeEntryAdd(1 << segmentBit);
|
||||
segmentBit = (segmentBit + 3) & 0x0F;
|
||||
|
||||
do
|
||||
{
|
||||
tileElement->properties.track.maze_entry |= (1 << segmentBit);
|
||||
tileElement->AsTrack()->MazeEntryAdd(1 << segmentBit);
|
||||
|
||||
uint32_t direction1 = byte_993D0C[segmentBit];
|
||||
uint16_t nextElementX = floor2(previousSegmentX, 32) + CoordsDirectionDelta[direction1].x;
|
||||
@@ -333,7 +333,7 @@ public:
|
||||
if (tmp_tileElement != nullptr)
|
||||
{
|
||||
uint8_t edx11 = byte_993CFC[segmentBit];
|
||||
tmp_tileElement->properties.track.maze_entry |= 1 << (edx11);
|
||||
tmp_tileElement->AsTrack()->MazeEntryAdd(1 << (edx11));
|
||||
}
|
||||
|
||||
segmentBit--;
|
||||
@@ -344,7 +344,7 @@ public:
|
||||
|
||||
map_invalidate_tile(floor2(_x, 32), floor2(_y, 32), tileElement->base_height * 8, tileElement->clearance_height * 8);
|
||||
|
||||
if ((tileElement->properties.track.maze_entry & 0x8888) == 0x8888)
|
||||
if ((tileElement->AsTrack()->GetMazeEntry() & 0x8888) == 0x8888)
|
||||
{
|
||||
Ride* ride = get_ride(_rideIndex);
|
||||
tile_element_remove(tileElement);
|
||||
|
||||
@@ -4754,7 +4754,7 @@ void rct_peep::UpdateRideMazePathfinding()
|
||||
|
||||
} while (!(tileElement++)->IsLastForTile());
|
||||
|
||||
uint16_t mazeEntry = track_element_get_maze_entry(tileElement);
|
||||
uint16_t mazeEntry = tileElement->AsTrack()->GetMazeEntry();
|
||||
uint16_t openHedges = 0;
|
||||
// var_37 is 3, 7, 11 or 15
|
||||
|
||||
|
||||
@@ -2221,9 +2221,24 @@ void TrackElement::DecrementPhotoTimeout()
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t track_element_get_maze_entry(const rct_tile_element* tileElement)
|
||||
uint16_t TrackElement::GetMazeEntry() const
|
||||
{
|
||||
return tileElement->properties.track.maze_entry;
|
||||
return mazeEntry;
|
||||
}
|
||||
|
||||
void TrackElement::SetMazeEntry(uint16_t newMazeEntry)
|
||||
{
|
||||
mazeEntry = newMazeEntry;
|
||||
}
|
||||
|
||||
void TrackElement::MazeEntryAdd(uint16_t addVal)
|
||||
{
|
||||
mazeEntry |= addVal;
|
||||
}
|
||||
|
||||
void TrackElement::MazeEntrySubtract(uint16_t subVal)
|
||||
{
|
||||
mazeEntry &= ~subVal;
|
||||
}
|
||||
|
||||
uint8_t TrackElement::GetTrackType() const
|
||||
|
||||
@@ -559,4 +559,3 @@ void game_command_set_brakes_speed(
|
||||
int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp);
|
||||
bool track_element_is_booster(uint8_t rideType, uint8_t trackType);
|
||||
bool track_element_has_speed_setting(uint8_t trackType);
|
||||
uint16_t track_element_get_maze_entry(const rct_tile_element* tileElement);
|
||||
|
||||
@@ -2108,7 +2108,7 @@ static money32 place_maze_design(uint8_t flags, uint8_t rideIndex, uint16_t maze
|
||||
tileElement->type = TILE_ELEMENT_TYPE_TRACK;
|
||||
tileElement->AsTrack()->SetTrackType(TRACK_ELEM_MAZE);
|
||||
tileElement->AsTrack()->SetRideIndex(rideIndex);
|
||||
tileElement->properties.track.maze_entry = mazeEntry;
|
||||
tileElement->AsTrack()->SetMazeEntry(mazeEntry);
|
||||
if (flags & GAME_COMMAND_FLAG_GHOST)
|
||||
{
|
||||
tileElement->flags |= TILE_ELEMENT_FLAG_GHOST;
|
||||
|
||||
@@ -892,7 +892,7 @@ static bool track_design_save_to_td6_for_maze(uint8_t rideIndex, rct_track_td6*
|
||||
if (tileElement->AsTrack()->GetRideIndex() != rideIndex)
|
||||
continue;
|
||||
|
||||
maze->maze_entry = track_element_get_maze_entry(tileElement);
|
||||
maze->maze_entry = tileElement->AsTrack()->GetMazeEntry();
|
||||
maze->x = (x - startX) / 32;
|
||||
maze->y = (y - startY) / 32;
|
||||
maze++;
|
||||
|
||||
@@ -48,7 +48,7 @@ static void maze_paint_setup(
|
||||
paint_session* session, uint8_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height,
|
||||
const rct_tile_element* tileElement)
|
||||
{
|
||||
uint16_t maze_entry = track_element_get_maze_entry(tileElement);
|
||||
uint16_t maze_entry = tileElement->AsTrack()->GetMazeEntry();
|
||||
maze_entry = rol16(maze_entry, direction * 4);
|
||||
|
||||
uint32_t rotation = session->CurrentRotation;
|
||||
|
||||
@@ -565,9 +565,9 @@ void maze_entrance_hedge_replacement(int32_t x, int32_t y, rct_tile_element* til
|
||||
// Each maze element is split into 4 sections with 4 different walls
|
||||
uint8_t mazeSection = direction * 4;
|
||||
// Add the top outer wall
|
||||
tileElement->properties.track.maze_entry |= (1 << ((mazeSection + 9) & 0x0F));
|
||||
tileElement->AsTrack()->MazeEntryAdd(1 << ((mazeSection + 9) & 0x0F));
|
||||
// Add the bottom outer wall
|
||||
tileElement->properties.track.maze_entry |= (1 << ((mazeSection + 12) & 0x0F));
|
||||
tileElement->AsTrack()->MazeEntryAdd(1 << ((mazeSection + 12) & 0x0F));
|
||||
|
||||
map_invalidate_tile(x, y, tileElement->base_height * 8, tileElement->clearance_height * 8);
|
||||
return;
|
||||
@@ -601,15 +601,15 @@ void maze_entrance_hedge_removal(int32_t x, int32_t y, rct_tile_element* tileEle
|
||||
// Each maze element is split into 4 sections with 4 different walls
|
||||
uint8_t mazeSection = direction * 4;
|
||||
// Remove the top outer wall
|
||||
tileElement->properties.track.maze_entry &= ~(1 << ((mazeSection + 9) & 0x0F));
|
||||
tileElement->AsTrack()->MazeEntrySubtract(1 << ((mazeSection + 9) & 0x0F));
|
||||
// Remove the bottom outer wall
|
||||
tileElement->properties.track.maze_entry &= ~(1 << ((mazeSection + 12) & 0x0F));
|
||||
tileElement->AsTrack()->MazeEntrySubtract(1 << ((mazeSection + 12) & 0x0F));
|
||||
// Remove the intersecting wall
|
||||
tileElement->properties.track.maze_entry &= ~(1 << ((mazeSection + 10) & 0x0F));
|
||||
tileElement->AsTrack()->MazeEntrySubtract(1 << ((mazeSection + 10) & 0x0F));
|
||||
// Remove the top hedge section
|
||||
tileElement->properties.track.maze_entry &= ~(1 << ((mazeSection + 11) & 0x0F));
|
||||
tileElement->AsTrack()->MazeEntrySubtract(1 << ((mazeSection + 11) & 0x0F));
|
||||
// Remove the bottom hedge section
|
||||
tileElement->properties.track.maze_entry &= ~(1 << ((mazeSection + 15) & 0x0F));
|
||||
tileElement->AsTrack()->MazeEntrySubtract(1 << ((mazeSection + 15) & 0x0F));
|
||||
|
||||
map_invalidate_tile(x, y, tileElement->base_height * 8, tileElement->clearance_height * 8);
|
||||
return;
|
||||
|
||||
@@ -287,6 +287,11 @@ public:
|
||||
uint8_t GetSeatRotation() const;
|
||||
void SetSeatRotation(uint8_t newSeatRotation);
|
||||
|
||||
uint16_t GetMazeEntry() const;
|
||||
void SetMazeEntry(uint16_t newMazeEntry);
|
||||
void MazeEntryAdd(uint16_t addVal);
|
||||
void MazeEntrySubtract(uint16_t subVal);
|
||||
|
||||
bool IsTakingPhoto() const;
|
||||
void SetPhotoTimeout();
|
||||
void DecrementPhotoTimeout();
|
||||
|
||||
@@ -194,11 +194,6 @@ bool is_csg_loaded()
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t track_element_get_maze_entry(const rct_tile_element* tileElement)
|
||||
{
|
||||
return tileElement->properties.track.maze_entry;
|
||||
}
|
||||
|
||||
uint8_t TrackElement::GetTrackType() const
|
||||
{
|
||||
return trackType;
|
||||
|
||||
Reference in New Issue
Block a user