Part of #13874: Replace Sequence Element Wall table

This commit is contained in:
frutiemax 2021-08-22 10:52:38 -04:00
parent 382315b2c3
commit a29b369ff8
4 changed files with 7 additions and 8 deletions

View File

@ -400,11 +400,10 @@ GameActions::Result::Ptr TrackPlaceAction::Execute() const
uint32_t rideTypeFlags = ride->GetRideTypeDescriptor().Flags; uint32_t rideTypeFlags = ride->GetRideTypeDescriptor().Flags;
const uint8_t(*wallEdges)[16]; const auto& teDescriptor = GetTrackElementDescriptor(_trackType);
wallEdges = &TrackSequenceElementAllowedWallEdges[_trackType]; auto wallEdges = teDescriptor.SequenceElementAllowedWallEdges;
money32 cost = 0; money32 cost = 0;
const auto& teDescriptor = GetTrackElementDescriptor(_trackType);
const rct_preview_track* trackBlock = teDescriptor.Block; const rct_preview_track* trackBlock = teDescriptor.Block;
for (int32_t blockIndex = 0; trackBlock->index != 0xFF; trackBlock++, blockIndex++) for (int32_t blockIndex = 0; trackBlock->index != 0xFF; trackBlock++, blockIndex++)
{ {
@ -452,7 +451,7 @@ GameActions::Result::Ptr TrackPlaceAction::Execute() const
else else
{ {
// Remove walls in the directions this track intersects // Remove walls in the directions this track intersects
uint8_t intersectingDirections = (*wallEdges)[blockIndex]; uint8_t intersectingDirections = wallEdges[blockIndex];
intersectingDirections ^= 0x0F; intersectingDirections ^= 0x0F;
intersectingDirections = rol4(intersectingDirections, _origin.direction); intersectingDirections = rol4(intersectingDirections, _origin.direction);
for (int32_t i = 0; i < NumOrthogonalDirections; i++) for (int32_t i = 0; i < NumOrthogonalDirections; i++)

View File

@ -20,6 +20,7 @@
#include "../world/Surface.h" #include "../world/Surface.h"
#include "../world/Wall.h" #include "../world/Wall.h"
using namespace OpenRCT2::TrackMetaData;
WallPlaceActionResult::WallPlaceActionResult() WallPlaceActionResult::WallPlaceActionResult()
: GameActions::Result(GameActions::Status::Ok, STR_CANT_BUILD_THIS_HERE) : GameActions::Result(GameActions::Status::Ok, STR_CANT_BUILD_THIS_HERE)
{ {
@ -592,7 +593,8 @@ bool WallPlaceAction::TrackIsAllowedWallEdges(
{ {
if (!GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_TRACK_NO_WALLS)) if (!GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_TRACK_NO_WALLS))
{ {
if (TrackSequenceElementAllowedWallEdges[trackType][trackSequence] & (1 << direction)) const auto& teDescriptor = GetTrackElementDescriptor(trackType);
if (teDescriptor.SequenceElementAllowedWallEdges[trackSequence] & (1 << direction))
{ {
return true; return true;
} }

View File

@ -4587,7 +4587,7 @@ const static uint32_t TrackHeightMarkerPositions[TrackElemType::Count] = {
}; };
/** rct2: 0x00999A94 */ /** rct2: 0x00999A94 */
const uint8_t TrackSequenceElementAllowedWallEdges[TrackElemType::Count][MaxSequencesPerPiece] = { const static uint8_t TrackSequenceElementAllowedWallEdges[TrackElemType::Count][MaxSequencesPerPiece] = {
{ 0b1010, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // TrackElemType::Flat { 0b1010, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // TrackElemType::Flat
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // TrackElemType::EndStation { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // TrackElemType::EndStation
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // TrackElemType::BeginStation { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // TrackElemType::BeginStation

View File

@ -57,8 +57,6 @@ constexpr const dodgems_track_size DodgemsTrackSize(track_type_t type)
return { 0, 0, 0, 0 }; return { 0, 0, 0, 0 };
} }
extern const uint8_t TrackSequenceElementAllowedWallEdges[TrackElemType::Count][16];
struct TrackElementDescriptor struct TrackElementDescriptor
{ {
rct_track_coordinates Coordinates; rct_track_coordinates Coordinates;