Merge pull request #10059 from tupaschoal/track-design-maze-element

Create TrackDesignMazeElement struct
This commit is contained in:
Duncan 2019-10-09 05:22:03 +01:00 committed by GitHub
commit 0a00f62e3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 14 deletions

View File

@ -253,13 +253,18 @@ private:
if (td->type == RIDE_TYPE_MAZE)
{
rct_td46_maze_element mazeElement{};
mazeElement.all = !0;
while (mazeElement.all != 0)
rct_td46_maze_element t4MazeElement{};
t4MazeElement.all = !0;
while (t4MazeElement.all != 0)
{
_stream.Read(&mazeElement, sizeof(rct_td46_maze_element));
if (mazeElement.all != 0)
_stream.Read(&t4MazeElement, sizeof(rct_td46_maze_element));
if (t4MazeElement.all != 0)
{
TrackDesignMazeElement mazeElement{};
mazeElement.x = t4MazeElement.x;
mazeElement.y = t4MazeElement.y;
mazeElement.direction = t4MazeElement.direction;
mazeElement.type = t4MazeElement.type;
td->maze_elements.push_back(mazeElement);
}
}

View File

@ -138,13 +138,18 @@ public:
if (td->type == RIDE_TYPE_MAZE)
{
rct_td46_maze_element mazeElement{};
mazeElement.all = !0;
while (mazeElement.all != 0)
rct_td46_maze_element t4MazeElement{};
t4MazeElement.all = !0;
while (t4MazeElement.all != 0)
{
_stream.Read(&mazeElement, sizeof(rct_td46_maze_element));
if (mazeElement.all != 0)
_stream.Read(&t4MazeElement, sizeof(rct_td46_maze_element));
if (t4MazeElement.all != 0)
{
TrackDesignMazeElement mazeElement{};
mazeElement.x = t4MazeElement.x;
mazeElement.y = t4MazeElement.y;
mazeElement.direction = t4MazeElement.direction;
mazeElement.type = t4MazeElement.type;
td->maze_elements.push_back(mazeElement);
}
}

View File

@ -379,7 +379,7 @@ rct_string_id TrackDesign::CreateTrackDesignMaze(const Ride& ride)
if (tileElement->AsTrack()->GetRideIndex() != ride.id)
continue;
rct_td46_maze_element maze{};
TrackDesignMazeElement maze{};
maze.maze_entry = tileElement->AsTrack()->GetMazeEntry();
maze.x = (x - startLoc.x) / 32;
@ -418,7 +418,7 @@ rct_string_id TrackDesign::CreateTrackDesignMaze(const Ride& ride)
// Add something that stops this from walking off the end
uint8_t entranceDirection = tileElement->GetDirection();
rct_td46_maze_element mazeEntrance{};
TrackDesignMazeElement mazeEntrance{};
mazeEntrance.direction = entranceDirection;
mazeEntrance.type = 8;
mazeEntrance.x = (int8_t)((entranceLoc.x - startLoc.x) / 32);
@ -445,7 +445,7 @@ rct_string_id TrackDesign::CreateTrackDesignMaze(const Ride& ride)
// Add something that stops this from walking off the end
uint8_t exit_direction = tileElement->GetDirection();
rct_td46_maze_element mazeExit{};
TrackDesignMazeElement mazeExit{};
mazeExit.direction = exit_direction;
mazeExit.type = 0x80;
mazeExit.x = (int8_t)((exitLoc.x - startLoc.x) / 32);

View File

@ -53,6 +53,29 @@ struct TrackDesignTrackElement
uint8_t flags; // 0x01
};
/* Maze Element entry size: 0x04 */
struct TrackDesignMazeElement
{
union
{
uint32_t all;
struct
{
int8_t x;
int8_t y;
union
{
uint16_t maze_entry;
struct
{
uint8_t direction;
uint8_t type;
};
};
};
};
};
struct TrackDesign
{
uint8_t type;
@ -96,7 +119,7 @@ struct TrackDesign
uint8_t lift_hill_speed;
uint8_t num_circuits;
std::vector<rct_td46_maze_element> maze_elements;
std::vector<TrackDesignMazeElement> maze_elements;
std::vector<TrackDesignTrackElement> track_elements;
std::vector<TrackDesignEntranceElement> entrance_elements;
std::vector<TrackDesignSceneryElement> scenery_elements;