Close #21379: Move map base z to constant

This commit is contained in:
Harry Hopkinson authored and GitHub committed 2024-02-20 11:49:02 +01:00
1 parent 5fef6d364d
commit d8864e567c
10 files changed
+9 -10

No files matched your search

+1 -1
View File
@@ -5788,7 +5788,7 @@ private:
// Scale modifier
if (listType == GRAPH_ALTITUDE)
{
yUnit -= GetGameState().MapBaseZ * 3;
yUnit -= kMapBaseZ * 3;
}
for (int32_t y = widget->height() - 13; y >= 8; y -= yInterval, yUnit += yUnitInterval)
-1
View File
@@ -66,7 +66,6 @@ namespace OpenRCT2
uint8_t BankLoanInterestRate;
money64 MaxBankLoan;
random_engine_t ScenarioRand;
int32_t MapBaseZ;
TileCoordsXY MapSize;
SCENARIO_CATEGORY ScenarioCategory;
@@ -347,7 +347,7 @@ static void PaintHeightMarkers(PaintSession& session, const EntranceElement& ent
ImageIndex baseImageIndex = SPR_HEIGHT_MARKER_BASE;
baseImageIndex += heightMarkerBaseZ / 16;
baseImageIndex += GetHeightMarkerOffset();
baseImageIndex -= GetGameState().MapBaseZ;
baseImageIndex -= kMapBaseZ;
auto imageId = ImageId(baseImageIndex, COLOUR_GREY);
PaintAddImageAsParent(session, imageId, { 16, 16, height }, { { 31, 31, heightMarkerBaseZ + 64 }, { 1, 1, 0 } });
}
@@ -761,7 +761,7 @@ static void PaintHeightMarkers(PaintSession& session, const PathElement& pathEl)
uint32_t baseImageIndex = SPR_HEIGHT_MARKER_BASE;
baseImageIndex += heightMarkerBaseZ / 16;
baseImageIndex += GetHeightMarkerOffset();
baseImageIndex -= GetGameState().MapBaseZ;
baseImageIndex -= kMapBaseZ;
auto imageId = ImageId(baseImageIndex, COLOUR_GREY);
PaintAddImageAsParent(session, imageId, { 16, 16, heightMarkerBaseZ }, { 1, 1, 0 });
}
@@ -1132,7 +1132,7 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con
int32_t image_id = (SPR_HEIGHT_MARKER_BASE + dx / 16);
image_id += GetHeightMarkerOffset();
image_id -= OpenRCT2::GetGameState().MapBaseZ;
image_id -= kMapBaseZ;
PaintAddImageAsParent(session, ImageId(image_id, COLOUR_OLIVE_GREEN), { 16, 16, surfaceHeight }, { 1, 1, 0 });
}
-2
View File
@@ -1500,8 +1500,6 @@ namespace RCT1
void ImportTileElements()
{
GetGameState().MapBaseZ = 7;
// Build tile pointer cache (needed to get the first element at a certain location)
auto tilePointerIndex = TilePointerIndex<RCT12TileElement>(
Limits::MaxMapSize, _s4.TileElements, std::size(_s4.TileElements));
-1
View File
@@ -410,7 +410,6 @@ namespace RCT2
// rct1_water_colour
// Pad01358842
ImportResearchList(gameState);
gameState.MapBaseZ = _s6.MapBaseZ;
gameState.BankLoanInterestRate = _s6.CurrentInterestRate;
// Pad0135934B
// Preserve compatibility with vanilla RCT2's save format.
+1 -1
View File
@@ -2235,7 +2235,7 @@ void PaintTrack(PaintSession& session, Direction direction, int32_t height, cons
uint16_t ax = ride->GetRideTypeDescriptor().Heights.VehicleZOffset;
// 0x1689 represents 0 height there are -127 to 128 heights above and below it
// There are 3 arrays of 256 heights (units, m, ft) chosen with the GetHeightMarkerOffset()
auto heightNum = (height + 8) / 16 - GetGameState().MapBaseZ;
auto heightNum = (height + 8) / 16 - kMapBaseZ;
auto imageId = ImageId(SPR_HEIGHT_MARKER_BASE + GetHeightMarkerOffset() + heightNum, COLOUR_LIGHT_BLUE);
PaintAddImageAsParent(session, imageId, { 16, 16, height + ax + 3 }, { { 1000, 1000, 2047 }, { 1, 1, 0 } });
-1
View File
@@ -464,7 +464,6 @@ void MapInit(const TileCoordsXY& size)
gGrassSceneryTileLoopPosition = 0;
gWidePathTileLoopPosition = {};
gameState.MapSize = size;
gameState.MapBaseZ = 7;
MapRemoveOutOfRangeElements();
MapAnimationAutoCreate();
+4
View File
@@ -20,6 +20,10 @@ constexpr uint8_t MINIMUM_LAND_HEIGHT = 2;
constexpr uint8_t MAXIMUM_LAND_HEIGHT = 254;
constexpr uint8_t MINIMUM_WATER_HEIGHT = 2;
constexpr uint8_t MAXIMUM_WATER_HEIGHT = 254;
/**
* The land height that counts as 0 metres/feet for the land height labels and altitude graphs.
*/
constexpr uint8_t kMapBaseZ = 7;
#define MINIMUM_MAP_SIZE_TECHNICAL 5
#define MAXIMUM_MAP_SIZE_TECHNICAL 1001