mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 23:34:37 +01:00
Move gWidePathTileLoopPosition and gGrassSceneryTileLoopPosition to GameState_t
This commit is contained in:
@@ -109,6 +109,9 @@ namespace OpenRCT2
|
||||
|
||||
News::ItemQueues NewsItems;
|
||||
|
||||
uint16_t GrassSceneryTileLoopPosition;
|
||||
CoordsXY WidePathTileLoopPosition;
|
||||
|
||||
colour_t StaffHandymanColour;
|
||||
colour_t StaffMechanicColour;
|
||||
colour_t StaffSecurityColour;
|
||||
|
||||
@@ -549,8 +549,8 @@ namespace OpenRCT2
|
||||
cs.ReadWrite(gameState.LandPrice);
|
||||
cs.ReadWrite(gameState.ConstructionRightsPrice);
|
||||
}
|
||||
cs.ReadWrite(gGrassSceneryTileLoopPosition);
|
||||
cs.ReadWrite(gWidePathTileLoopPosition);
|
||||
cs.ReadWrite(gameState.GrassSceneryTileLoopPosition);
|
||||
cs.ReadWrite(gameState.WidePathTileLoopPosition);
|
||||
|
||||
auto& rideRatings = gameState.RideRatingUpdateStates;
|
||||
if (os.GetHeader().TargetVersion >= 21)
|
||||
|
||||
@@ -448,7 +448,7 @@ namespace RCT2
|
||||
ImportRideRatingsCalcData();
|
||||
ImportRideMeasurements();
|
||||
gameState.NextGuestNumber = _s6.NextGuestIndex;
|
||||
gGrassSceneryTileLoopPosition = _s6.GrassAndSceneryTilepos;
|
||||
gameState.GrassSceneryTileLoopPosition = _s6.GrassAndSceneryTilepos;
|
||||
// unk_13CA73E
|
||||
// Pad13CA73F
|
||||
// unk_13CA740
|
||||
@@ -496,8 +496,7 @@ namespace RCT2
|
||||
|
||||
// Pad13CE730
|
||||
// rct1_scenario_flags
|
||||
gWidePathTileLoopPosition.x = _s6.WidePathTileLoopX;
|
||||
gWidePathTileLoopPosition.y = _s6.WidePathTileLoopY;
|
||||
gameState.WidePathTileLoopPosition = { _s6.WidePathTileLoopX, _s6.WidePathTileLoopY };
|
||||
// Pad13CE778
|
||||
|
||||
// Fix and set dynamic variables
|
||||
|
||||
@@ -88,9 +88,6 @@ CoordsXY gMapSelectPositionB;
|
||||
CoordsXYZ gMapSelectArrowPosition;
|
||||
uint8_t gMapSelectArrowDirection;
|
||||
|
||||
TileCoordsXY gWidePathTileLoopPosition;
|
||||
uint16_t gGrassSceneryTileLoopPosition;
|
||||
|
||||
std::vector<CoordsXY> gMapSelectionTiles;
|
||||
|
||||
bool gLandMountainMode;
|
||||
@@ -462,8 +459,8 @@ void MapInit(const TileCoordsXY& size)
|
||||
|
||||
auto& gameState = GetGameState();
|
||||
|
||||
gGrassSceneryTileLoopPosition = 0;
|
||||
gWidePathTileLoopPosition = {};
|
||||
gameState.GrassSceneryTileLoopPosition = 0;
|
||||
gameState.WidePathTileLoopPosition = {};
|
||||
gameState.MapSize = size;
|
||||
MapRemoveOutOfRangeElements();
|
||||
MapAnimationAutoCreate();
|
||||
@@ -761,26 +758,23 @@ void MapUpdatePathWideFlags()
|
||||
// Presumably update_path_wide_flags is too computationally expensive to call for every
|
||||
// tile every update, so gWidePathTileLoopX and gWidePathTileLoopY store the x and y
|
||||
// progress. A maximum of 128 calls is done per update.
|
||||
auto x = gWidePathTileLoopPosition.x;
|
||||
auto y = gWidePathTileLoopPosition.y;
|
||||
CoordsXY& loopPosition = GetGameState().WidePathTileLoopPosition;
|
||||
for (int32_t i = 0; i < 128; i++)
|
||||
{
|
||||
FootpathUpdatePathWideFlags({ x, y });
|
||||
FootpathUpdatePathWideFlags(loopPosition);
|
||||
|
||||
// Next x, y tile
|
||||
x += COORDS_XY_STEP;
|
||||
if (x >= MAXIMUM_MAP_SIZE_BIG)
|
||||
loopPosition.x += COORDS_XY_STEP;
|
||||
if (loopPosition.x >= MAXIMUM_MAP_SIZE_BIG)
|
||||
{
|
||||
x = 0;
|
||||
y += COORDS_XY_STEP;
|
||||
if (y >= MAXIMUM_MAP_SIZE_BIG)
|
||||
loopPosition.x = 0;
|
||||
loopPosition.y += COORDS_XY_STEP;
|
||||
if (loopPosition.y >= MAXIMUM_MAP_SIZE_BIG)
|
||||
{
|
||||
y = 0;
|
||||
loopPosition.y = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
gWidePathTileLoopPosition.x = x;
|
||||
gWidePathTileLoopPosition.y = y;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1266,7 +1260,7 @@ void MapUpdateTiles()
|
||||
int32_t x = 0;
|
||||
int32_t y = 0;
|
||||
|
||||
uint16_t interleaved_xy = gGrassSceneryTileLoopPosition;
|
||||
uint16_t interleaved_xy = gameState.GrassSceneryTileLoopPosition;
|
||||
for (int32_t i = 0; i < 8; i++)
|
||||
{
|
||||
x = (x << 1) | (interleaved_xy & 1);
|
||||
@@ -1293,7 +1287,7 @@ void MapUpdateTiles()
|
||||
}
|
||||
}
|
||||
|
||||
gGrassSceneryTileLoopPosition++;
|
||||
gameState.GrassSceneryTileLoopPosition++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,9 +107,6 @@ enum
|
||||
extern const std::array<CoordsXY, 8> CoordsDirectionDelta;
|
||||
extern const TileCoordsXY TileDirectionDelta[];
|
||||
|
||||
extern TileCoordsXY gWidePathTileLoopPosition;
|
||||
extern uint16_t gGrassSceneryTileLoopPosition;
|
||||
|
||||
CoordsXY GetMapSizeUnits();
|
||||
CoordsXY GetMapSizeMinus2();
|
||||
CoordsXY GetMapSizeMaxXY();
|
||||
|
||||
Reference in New Issue
Block a user