diff --git a/src/openrct2-ui/input/MouseInput.cpp b/src/openrct2-ui/input/MouseInput.cpp index d4c15a7b31..b875acab4c 100644 --- a/src/openrct2-ui/input/MouseInput.cpp +++ b/src/openrct2-ui/input/MouseInput.cpp @@ -1619,11 +1619,11 @@ void InputScrollViewport(const ScreenCoordsXY& scrollScreenCoords) } // Clamp to the map maximum value (scenario specific) - if (mapCoord.x > gMapSizeMinus2 || mapCoord.y > gMapSizeMinus2) + if (mapCoord.x > GetMapSizeMinus2() || mapCoord.y > GetMapSizeMinus2()) { at_map_edge = 1; } - if (mapCoord_dy.x > gMapSizeMinus2 || mapCoord_dy.y > gMapSizeMinus2) + if (mapCoord_dy.x > GetMapSizeMinus2() || mapCoord_dy.y > GetMapSizeMinus2()) { at_map_edge_dy = 1; } diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index 08dcfd61d7..4429b7d17a 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -1375,9 +1375,6 @@ static void map_window_increase_map_size() } gMapSize++; - gMapSizeUnits = (gMapSize - 1) * 32; - gMapSizeMinus2 = (gMapSize * 32) + MAXIMUM_MAP_SIZE_PRACTICAL; - gMapSizeMaxXY = ((gMapSize - 1) * 32) - 1; map_extend_boundary_surface(); window_map_init_map(); window_map_centre_on_view_point(); @@ -1397,9 +1394,6 @@ static void map_window_decrease_map_size() } gMapSize--; - gMapSizeUnits = (gMapSize - 1) * 32; - gMapSizeMinus2 = (gMapSize * 32) + MAXIMUM_MAP_SIZE_PRACTICAL; - gMapSizeMaxXY = ((gMapSize - 1) * 32) - 1; map_remove_out_of_range_elements(); window_map_init_map(); window_map_centre_on_view_point(); diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index fa6da74546..b5e470b26a 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -2395,15 +2395,9 @@ static void sub_6CBCE2( if (ride == nullptr) return; - int16_t preserveMapSizeUnits = gMapSizeUnits; - int16_t preserveMapSizeMinus2 = gMapSizeMinus2; - int16_t preserveMapSize = gMapSize; - int16_t preserveMapSizeMaxXY = gMapSizeMaxXY; + int32_t preserveMapSize = gMapSize; - gMapSizeUnits = MAXIMUM_TILE_START_XY; - gMapSizeMinus2 = ((MAXIMUM_MAP_SIZE_TECHNICAL - 1) * 32) + 286; gMapSize = MAXIMUM_MAP_SIZE_TECHNICAL; - gMapSizeMaxXY = MAXIMUM_MAP_SIZE_BIG - 1; auto trackBlock = TrackBlocks[trackType]; while (trackBlock->index != 255) @@ -2463,10 +2457,7 @@ static void sub_6CBCE2( trackBlock++; } - gMapSizeUnits = preserveMapSizeUnits; - gMapSizeMinus2 = preserveMapSizeMinus2; gMapSize = preserveMapSize; - gMapSizeMaxXY = preserveMapSizeMaxXY; PaintSessionArrange(session); PaintDrawStructs(session); diff --git a/src/openrct2/actions/ClearAction.cpp b/src/openrct2/actions/ClearAction.cpp index e866d14dea..cfeea2f993 100644 --- a/src/openrct2/actions/ClearAction.cpp +++ b/src/openrct2/actions/ClearAction.cpp @@ -72,8 +72,8 @@ GameActions::Result::Ptr ClearAction::QueryExecute(bool executing) const auto x0 = std::max(_range.GetLeft(), 32); auto y0 = std::max(_range.GetTop(), 32); - auto x1 = std::min(_range.GetRight(), static_cast(gMapSizeMaxXY)); - auto y1 = std::min(_range.GetBottom(), static_cast(gMapSizeMaxXY)); + auto x1 = std::min(_range.GetRight(), GetMapSizeMaxXY()); + auto y1 = std::min(_range.GetBottom(), GetMapSizeMaxXY()); for (int32_t y = y0; y <= y1; y += COORDS_XY_STEP) { diff --git a/src/openrct2/actions/FootpathPlaceAction.cpp b/src/openrct2/actions/FootpathPlaceAction.cpp index 5b1894b9b8..6124336ffd 100644 --- a/src/openrct2/actions/FootpathPlaceAction.cpp +++ b/src/openrct2/actions/FootpathPlaceAction.cpp @@ -390,10 +390,10 @@ void FootpathPlaceAction::AutomaticallySetPeepSpawn() const if (_loc.x != 32) { direction++; - if (_loc.y != gMapSizeUnits - 32) + if (_loc.y != GetMapSizeUnits() - 32) { direction++; - if (_loc.x != gMapSizeUnits - 32) + if (_loc.x != GetMapSizeUnits() - 32) { direction++; if (_loc.y != 32) diff --git a/src/openrct2/actions/LandBuyRightsAction.cpp b/src/openrct2/actions/LandBuyRightsAction.cpp index 46096f3886..4b23324081 100644 --- a/src/openrct2/actions/LandBuyRightsAction.cpp +++ b/src/openrct2/actions/LandBuyRightsAction.cpp @@ -65,9 +65,9 @@ GameActions::Result::Ptr LandBuyRightsAction::QueryExecute(bool isExecuting) con MapRange normRange = _range.Normalise(); // Keep big coordinates within map boundaries auto aX = std::max(32, normRange.GetLeft()); - auto bX = std::min(gMapSizeMaxXY, normRange.GetRight()); + auto bX = std::min(GetMapSizeMaxXY(), normRange.GetRight()); auto aY = std::max(32, normRange.GetTop()); - auto bY = std::min(gMapSizeMaxXY, normRange.GetBottom()); + auto bY = std::min(GetMapSizeMaxXY(), normRange.GetBottom()); MapRange validRange = MapRange{ aX, aY, bX, bY }; diff --git a/src/openrct2/actions/LandLowerAction.cpp b/src/openrct2/actions/LandLowerAction.cpp index 53cbb4b901..9efbffedb6 100644 --- a/src/openrct2/actions/LandLowerAction.cpp +++ b/src/openrct2/actions/LandLowerAction.cpp @@ -63,9 +63,9 @@ GameActions::Result::Ptr LandLowerAction::QueryExecute(bool isExecuting) const // Keep big coordinates within map boundaries auto aX = std::max(32, _range.GetLeft()); - auto bX = std::min(gMapSizeMaxXY, _range.GetRight()); + auto bX = std::min(GetMapSizeMaxXY(), _range.GetRight()); auto aY = std::max(32, _range.GetTop()); - auto bY = std::min(gMapSizeMaxXY, _range.GetBottom()); + auto bY = std::min(GetMapSizeMaxXY(), _range.GetBottom()); MapRange validRange = MapRange{ aX, aY, bX, bY }; diff --git a/src/openrct2/actions/LandRaiseAction.cpp b/src/openrct2/actions/LandRaiseAction.cpp index 05c33c6045..d7a971c7bf 100644 --- a/src/openrct2/actions/LandRaiseAction.cpp +++ b/src/openrct2/actions/LandRaiseAction.cpp @@ -64,9 +64,9 @@ GameActions::Result::Ptr LandRaiseAction::QueryExecute(bool isExecuting) const // Keep big coordinates within map boundaries auto aX = std::max(32, _range.GetLeft()); - auto bX = std::min(gMapSizeMaxXY, _range.GetRight()); + auto bX = std::min(GetMapSizeMaxXY(), _range.GetRight()); auto aY = std::max(32, _range.GetTop()); - auto bY = std::min(gMapSizeMaxXY, _range.GetBottom()); + auto bY = std::min(GetMapSizeMaxXY(), _range.GetBottom()); MapRange validRange = MapRange{ aX, aY, bX, bY }; diff --git a/src/openrct2/actions/LandSetHeightAction.cpp b/src/openrct2/actions/LandSetHeightAction.cpp index 43144fcfe0..5275232f34 100644 --- a/src/openrct2/actions/LandSetHeightAction.cpp +++ b/src/openrct2/actions/LandSetHeightAction.cpp @@ -183,7 +183,7 @@ rct_string_id LandSetHeightAction::CheckParameters() const return STR_OFF_EDGE_OF_MAP; } - if (_coords.x > gMapSizeMaxXY || _coords.y > gMapSizeMaxXY) + if (_coords.x > GetMapSizeMaxXY() || _coords.y > GetMapSizeMaxXY()) { return STR_OFF_EDGE_OF_MAP; } diff --git a/src/openrct2/actions/LandSetRightsAction.cpp b/src/openrct2/actions/LandSetRightsAction.cpp index 3510399c91..ab0d0203f4 100644 --- a/src/openrct2/actions/LandSetRightsAction.cpp +++ b/src/openrct2/actions/LandSetRightsAction.cpp @@ -70,9 +70,9 @@ GameActions::Result::Ptr LandSetRightsAction::QueryExecute(bool isExecuting) con MapRange normRange = _range.Normalise(); // Keep big coordinates within map boundaries auto aX = std::max(32, normRange.GetLeft()); - auto bX = std::min(gMapSizeMaxXY, normRange.GetRight()); + auto bX = std::min(GetMapSizeMaxXY(), normRange.GetRight()); auto aY = std::max(32, normRange.GetTop()); - auto bY = std::min(gMapSizeMaxXY, normRange.GetBottom()); + auto bY = std::min(GetMapSizeMaxXY(), normRange.GetBottom()); MapRange validRange = MapRange{ aX, aY, bX, bY }; diff --git a/src/openrct2/actions/LargeScenerySetColourAction.cpp b/src/openrct2/actions/LargeScenerySetColourAction.cpp index 794d863794..5119b4200a 100644 --- a/src/openrct2/actions/LargeScenerySetColourAction.cpp +++ b/src/openrct2/actions/LargeScenerySetColourAction.cpp @@ -53,7 +53,7 @@ GameActions::Result::Ptr LargeScenerySetColourAction::QueryExecute(bool isExecut res->Position.z = tile_element_height(_loc); res->ErrorTitle = STR_CANT_REPAINT_THIS; - if (_loc.x < 0 || _loc.y < 0 || _loc.x > gMapSizeMaxXY || _loc.y > gMapSizeMaxXY) + if (_loc.x < 0 || _loc.y < 0 || _loc.x > GetMapSizeMaxXY() || _loc.y > GetMapSizeMaxXY()) { log_error("Invalid x / y coordinates: x = %d, y = %d", _loc.x, _loc.y); return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS); diff --git a/src/openrct2/actions/PlaceParkEntranceAction.cpp b/src/openrct2/actions/PlaceParkEntranceAction.cpp index 288d921007..8b4e3db1d2 100644 --- a/src/openrct2/actions/PlaceParkEntranceAction.cpp +++ b/src/openrct2/actions/PlaceParkEntranceAction.cpp @@ -50,8 +50,8 @@ GameActions::Result::Ptr PlaceParkEntranceAction::Query() const res->Expenditure = ExpenditureType::LandPurchase; res->Position = { _loc.x, _loc.y, _loc.z }; - if (!LocationValid(_loc) || _loc.x <= 32 || _loc.y <= 32 || _loc.x >= (gMapSizeUnits - 32) - || _loc.y >= (gMapSizeUnits - 32)) + if (!LocationValid(_loc) || _loc.x <= 32 || _loc.y <= 32 || _loc.x >= (GetMapSizeUnits() - 32) + || _loc.y >= (GetMapSizeUnits() - 32)) { return std::make_unique( GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_TOO_CLOSE_TO_EDGE_OF_MAP); diff --git a/src/openrct2/actions/PlacePeepSpawnAction.cpp b/src/openrct2/actions/PlacePeepSpawnAction.cpp index 9af4289dd1..b4ce3a211f 100644 --- a/src/openrct2/actions/PlacePeepSpawnAction.cpp +++ b/src/openrct2/actions/PlacePeepSpawnAction.cpp @@ -47,8 +47,8 @@ GameActions::Result::Ptr PlacePeepSpawnAction::Query() const res->Expenditure = ExpenditureType::LandPurchase; res->Position = _location; - if (!LocationValid(_location) || _location.x <= 16 || _location.y <= 16 || _location.x >= (gMapSizeUnits - 16) - || _location.y >= (gMapSizeUnits - 16)) + if (!LocationValid(_location) || _location.x <= 16 || _location.y <= 16 || _location.x >= (GetMapSizeUnits() - 16) + || _location.y >= (GetMapSizeUnits() - 16)) { return std::make_unique( GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_OFF_EDGE_OF_MAP); diff --git a/src/openrct2/actions/SetCheatAction.cpp b/src/openrct2/actions/SetCheatAction.cpp index ee749f9911..5f6887bd81 100644 --- a/src/openrct2/actions/SetCheatAction.cpp +++ b/src/openrct2/actions/SetCheatAction.cpp @@ -683,7 +683,7 @@ void SetCheatAction::SetStaffSpeed(uint8_t value) const void SetCheatAction::OwnAllLand() const { const int32_t min = 32; - const int32_t max = gMapSizeUnits - 32; + const int32_t max = GetMapSizeUnits() - 32; for (CoordsXY coords = { min, min }; coords.y <= max; coords.y += COORDS_XY_STEP) { diff --git a/src/openrct2/actions/SmallSceneryPlaceAction.cpp b/src/openrct2/actions/SmallSceneryPlaceAction.cpp index d78fc3fea1..5a4ed72cd3 100644 --- a/src/openrct2/actions/SmallSceneryPlaceAction.cpp +++ b/src/openrct2/actions/SmallSceneryPlaceAction.cpp @@ -121,7 +121,7 @@ GameActions::Result::Ptr SmallSceneryPlaceAction::Query() const return std::make_unique(GameActions::Status::NoFreeElements); } - if (!_trackDesignDrawingPreview && (_loc.x > gMapSizeMaxXY || _loc.y > gMapSizeMaxXY)) + if (!_trackDesignDrawingPreview && (_loc.x > GetMapSizeMaxXY() || _loc.y > GetMapSizeMaxXY())) { return std::make_unique(GameActions::Status::InvalidParameters); } diff --git a/src/openrct2/actions/SurfaceSetStyleAction.cpp b/src/openrct2/actions/SurfaceSetStyleAction.cpp index 7847228cd1..47c1a32108 100644 --- a/src/openrct2/actions/SurfaceSetStyleAction.cpp +++ b/src/openrct2/actions/SurfaceSetStyleAction.cpp @@ -42,8 +42,8 @@ GameActions::Result::Ptr SurfaceSetStyleAction::Query() const auto normRange = _range.Normalise(); auto x0 = std::max(normRange.GetLeft(), 32); auto y0 = std::max(normRange.GetTop(), 32); - auto x1 = std::min(normRange.GetRight(), static_cast(gMapSizeMaxXY)); - auto y1 = std::min(normRange.GetBottom(), static_cast(gMapSizeMaxXY)); + auto x1 = std::min(normRange.GetRight(), GetMapSizeMaxXY()); + auto y1 = std::min(normRange.GetBottom(), GetMapSizeMaxXY()); MapRange validRange{ x0, y0, x1, y1 }; @@ -160,8 +160,8 @@ GameActions::Result::Ptr SurfaceSetStyleAction::Execute() const auto normRange = _range.Normalise(); auto x0 = std::max(normRange.GetLeft(), 32); auto y0 = std::max(normRange.GetTop(), 32); - auto x1 = std::min(normRange.GetRight(), static_cast(gMapSizeMaxXY)); - auto y1 = std::min(normRange.GetBottom(), static_cast(gMapSizeMaxXY)); + auto x1 = std::min(normRange.GetRight(), GetMapSizeMaxXY()); + auto y1 = std::min(normRange.GetBottom(), GetMapSizeMaxXY()); MapRange validRange{ x0, y0, x1, y1 }; diff --git a/src/openrct2/actions/WallPlaceAction.cpp b/src/openrct2/actions/WallPlaceAction.cpp index e250a017b4..466f90c252 100644 --- a/src/openrct2/actions/WallPlaceAction.cpp +++ b/src/openrct2/actions/WallPlaceAction.cpp @@ -109,7 +109,7 @@ GameActions::Result::Ptr WallPlaceAction::Query() const return std::make_unique(GameActions::Status::NotOwned); } } - else if (!_trackDesignDrawingPreview && (_loc.x > gMapSizeMaxXY || _loc.y > gMapSizeMaxXY)) + else if (!_trackDesignDrawingPreview && (_loc.x > GetMapSizeMaxXY() || _loc.y > GetMapSizeMaxXY())) { log_error("Invalid x/y coordinates. x = %d y = %d", _loc.x, _loc.y); return std::make_unique(GameActions::Status::InvalidParameters); diff --git a/src/openrct2/actions/WaterLowerAction.cpp b/src/openrct2/actions/WaterLowerAction.cpp index 0403fc2bcc..2bd0e66a66 100644 --- a/src/openrct2/actions/WaterLowerAction.cpp +++ b/src/openrct2/actions/WaterLowerAction.cpp @@ -46,9 +46,9 @@ GameActions::Result::Ptr WaterLowerAction::QueryExecute(bool isExecuting) const // Keep big coordinates within map boundaries auto aX = std::max(32, _range.GetLeft()); - auto bX = std::min(gMapSizeMaxXY, _range.GetRight()); + auto bX = std::min(GetMapSizeMaxXY(), _range.GetRight()); auto aY = std::max(32, _range.GetTop()); - auto bY = std::min(gMapSizeMaxXY, _range.GetBottom()); + auto bY = std::min(GetMapSizeMaxXY(), _range.GetBottom()); MapRange validRange = MapRange{ aX, aY, bX, bY }; diff --git a/src/openrct2/actions/WaterRaiseAction.cpp b/src/openrct2/actions/WaterRaiseAction.cpp index 231ef43027..dbf10f83d6 100644 --- a/src/openrct2/actions/WaterRaiseAction.cpp +++ b/src/openrct2/actions/WaterRaiseAction.cpp @@ -46,9 +46,9 @@ GameActions::Result::Ptr WaterRaiseAction::QueryExecute(bool isExecuting) const // Keep big coordinates within map boundaries auto aX = std::max(32, _range.GetLeft()); - auto bX = std::min(gMapSizeMaxXY, _range.GetRight()); + auto bX = std::min(GetMapSizeMaxXY(), _range.GetRight()); auto aY = std::max(32, _range.GetTop()); - auto bY = std::min(gMapSizeMaxXY, _range.GetBottom()); + auto bY = std::min(GetMapSizeMaxXY(), _range.GetBottom()); MapRange validRange = MapRange{ aX, aY, bX, bY }; diff --git a/src/openrct2/actions/WaterSetHeightAction.cpp b/src/openrct2/actions/WaterSetHeightAction.cpp index 43d41bfe87..bf4eb860c2 100644 --- a/src/openrct2/actions/WaterSetHeightAction.cpp +++ b/src/openrct2/actions/WaterSetHeightAction.cpp @@ -133,7 +133,7 @@ GameActions::Result::Ptr WaterSetHeightAction::Execute() const rct_string_id WaterSetHeightAction::CheckParameters() const { - if (_coords.x > gMapSizeMaxXY || _coords.y > gMapSizeMaxXY) + if (_coords.x > GetMapSizeMaxXY() || _coords.y > GetMapSizeMaxXY()) { return STR_OFF_EDGE_OF_MAP; } diff --git a/src/openrct2/drawing/Drawing.h b/src/openrct2/drawing/Drawing.h index 2e28549e81..c494e66674 100644 --- a/src/openrct2/drawing/Drawing.h +++ b/src/openrct2/drawing/Drawing.h @@ -105,11 +105,11 @@ struct rct_gx struct rct_drawpixelinfo { uint8_t* bits{}; - int16_t x{}; - int16_t y{}; - int16_t width{}; - int16_t height{}; - int16_t pitch{}; // note: this is actually (pitch - width) + int32_t x{}; + int32_t y{}; + int32_t width{}; + int32_t height{}; + int32_t pitch{}; // note: this is actually (pitch - width) ZoomLevel zoom_level{}; /** diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index 6fde1dba5a..6aa028ae56 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -225,7 +225,7 @@ void viewports_invalidate(int32_t left, int32_t top, int32_t right, int32_t bott */ CoordsXYZ viewport_adjust_for_map_height(const ScreenCoordsXY& startCoords) { - int16_t height = 0; + int32_t height = 0; uint32_t rotation = get_current_rotation(); CoordsXY pos{}; @@ -236,7 +236,7 @@ CoordsXYZ viewport_adjust_for_map_height(const ScreenCoordsXY& startCoords) // HACK: This is to prevent the x and y values being set to values outside // of the map. This can happen when the height is larger than the map size. - int16_t max = gMapSizeMinus2; + auto max = GetMapSizeMinus2(); if (pos.x > max && pos.y > max) { const CoordsXY corr[] = { { -1, -1 }, { 1, -1 }, { 1, 1 }, { -1, 1 } }; @@ -327,10 +327,10 @@ static void viewport_redraw_after_shift( } else { - int16_t left = viewport->pos.x; - int16_t right = viewport->pos.x + viewport->width; - int16_t top = viewport->pos.y; - int16_t bottom = viewport->pos.y + viewport->height; + auto left = viewport->pos.x; + auto right = viewport->pos.x + viewport->width; + auto top = viewport->pos.y; + auto bottom = viewport->pos.y + viewport->height; // if moved more than the viewport size if (abs(coords.x) < viewport->width && abs(coords.y) < viewport->height) @@ -341,14 +341,14 @@ static void viewport_redraw_after_shift( if (coords.x > 0) { // draw left - int16_t _right = viewport->pos.x + coords.x; + auto _right = viewport->pos.x + coords.x; window_draw_all(dpi, left, top, _right, bottom); left += coords.x; } else if (coords.x < 0) { // draw right - int16_t _left = viewport->pos.x + viewport->width + coords.x; + auto _left = viewport->pos.x + viewport->width + coords.x; window_draw_all(dpi, _left, top, right, bottom); right += coords.x; } @@ -375,7 +375,7 @@ static void viewport_redraw_after_shift( } static void viewport_shift_pixels( - rct_drawpixelinfo* dpi, rct_window* window, rct_viewport* viewport, int16_t x_diff, int16_t y_diff) + rct_drawpixelinfo* dpi, rct_window* window, rct_viewport* viewport, int32_t x_diff, int32_t y_diff) { auto it = window_get_iterator(window); for (; it != g_window_list.end(); it++) @@ -429,8 +429,8 @@ static void viewport_move(const ScreenCoordsXY& coords, rct_window* w, rct_viewp // Note: do not do the subtraction and then divide! // Note: Due to arithmetic shift != /zoom a shift will have to be used // hopefully when 0x006E7FF3 is finished this can be converted to /zoom. - int16_t x_diff = (viewport->viewPos.x / viewport->zoom) - (coords.x / viewport->zoom); - int16_t y_diff = (viewport->viewPos.y / viewport->zoom) - (coords.y / viewport->zoom); + auto x_diff = (viewport->viewPos.x / viewport->zoom) - (coords.x / viewport->zoom); + auto y_diff = (viewport->viewPos.y / viewport->zoom) - (coords.y / viewport->zoom); viewport->viewPos = coords; @@ -578,14 +578,14 @@ void viewport_update_position(rct_window* window) } // Clamp to the map maximum value (scenario specific) - if (mapCoord.x > gMapSizeMinus2) + if (mapCoord.x > GetMapSizeMinus2()) { - mapCoord.x = gMapSizeMinus2; + mapCoord.x = GetMapSizeMinus2(); at_map_edge = 1; } - if (mapCoord.y > gMapSizeMinus2) + if (mapCoord.y > GetMapSizeMinus2()) { - mapCoord.y = gMapSizeMinus2; + mapCoord.y = GetMapSizeMinus2(); at_map_edge = 1; } @@ -960,13 +960,13 @@ static void viewport_paint_column(paint_session* session) * ebp: bottom */ void viewport_paint( - const rct_viewport* viewport, rct_drawpixelinfo* dpi, int16_t left, int16_t top, int16_t right, int16_t bottom, + const rct_viewport* viewport, rct_drawpixelinfo* dpi, int32_t left, int32_t top, int32_t right, int32_t bottom, std::vector* recorded_sessions) { uint32_t viewFlags = viewport->flags; - uint16_t width = right - left; - uint16_t height = bottom - top; - uint16_t bitmask = viewport->zoom >= 0 ? 0xFFFF & (0xFFFF * viewport->zoom) : 0xFFFF; + uint32_t width = right - left; + uint32_t height = bottom - top; + uint32_t bitmask = viewport->zoom >= 0 ? 0xFFFFFFFF & (0xFFFFFFFF * viewport->zoom) : 0xFFFFFFFF; width &= bitmask; height &= bitmask; @@ -975,11 +975,11 @@ void viewport_paint( right = left + width; bottom = top + height; - int16_t x = static_cast(left - static_cast(viewport->viewPos.x & bitmask)); + auto x = left - static_cast(viewport->viewPos.x & bitmask); x = x / viewport->zoom; x += viewport->pos.x; - int16_t y = static_cast(top - static_cast(viewport->viewPos.y & bitmask)); + auto y = top - static_cast(viewport->viewPos.y & bitmask); y = y / viewport->zoom; y += viewport->pos.y; @@ -995,10 +995,10 @@ void viewport_paint( dpi1.remX = std::max(0, dpi->x - x); dpi1.remY = std::max(0, dpi->y - y); - // make sure, the compare operation is done in int16_t to avoid the loop becoming an infiniteloop. + // make sure, the compare operation is done in int32_t to avoid the loop becoming an infiniteloop. // this as well as the [x += 32] in the loop causes signed integer overflow -> undefined behaviour. - const int16_t rightBorder = dpi1.x + dpi1.width; - const int16_t alignedX = floor2(dpi1.x, 32); + auto rightBorder = dpi1.x + dpi1.width; + auto alignedX = floor2(dpi1.x, 32); _paintColumns.clear(); @@ -1016,8 +1016,8 @@ void viewport_paint( size_t index = 0; if (recorded_sessions != nullptr) { - const uint16_t columnSize = rightBorder - alignedX; - const uint16_t columnCount = (columnSize + 31) / 32; + auto columnSize = rightBorder - alignedX; + auto columnCount = (columnSize + 31) / 32; recorded_sessions->resize(columnCount); } @@ -1030,17 +1030,17 @@ void viewport_paint( rct_drawpixelinfo& dpi2 = session->DPI; if (x >= dpi2.x) { - int16_t leftPitch = x - dpi2.x; + auto leftPitch = x - dpi2.x; dpi2.width -= leftPitch; dpi2.bits += leftPitch / dpi2.zoom_level; dpi2.pitch += leftPitch / dpi2.zoom_level; dpi2.x = x; } - int16_t paintRight = dpi2.x + dpi2.width; + auto paintRight = dpi2.x + dpi2.width; if (paintRight >= x + 32) { - int16_t rightPitch = paintRight - x - 32; + auto rightPitch = paintRight - x - 32; paintRight -= rightPitch; dpi2.pitch += rightPitch / dpi2.zoom_level; } @@ -1102,8 +1102,8 @@ std::optional screen_pos_to_map_pos(const ScreenCoordsXY& screenCoords } else { - int16_t mod_x = mapCoords->x & 0x1F; - int16_t mod_y = mapCoords->y & 0x1F; + auto mod_x = mapCoords->x & 0x1F; + auto mod_y = mapCoords->y & 0x1F; if (mod_x <= 16) { if (mod_y < 16) @@ -1376,9 +1376,9 @@ static bool is_pixel_present_bmp( /** * rct2: 0x0067933B, 0x00679788, 0x00679C4A, 0x0067A117 */ -static bool is_pixel_present_rle(const uint8_t* esi, int16_t x_start_point, int16_t y_start_point, int32_t round) +static bool is_pixel_present_rle(const uint8_t* esi, int32_t x_start_point, int32_t y_start_point, int32_t round) { - uint16_t start_offset = esi[y_start_point * 2] | (esi[y_start_point * 2 + 1] << 8); + uint32_t start_offset = esi[y_start_point * 2] | (esi[y_start_point * 2 + 1] << 8); const uint8_t* ebx = esi + start_offset; uint8_t last_data_line = 0; @@ -1489,8 +1489,8 @@ static bool is_sprite_interacted_with_palette_set( // TODO: SAR in dpi done with `>> 1`, in coordinates with `/ 2` rct_drawpixelinfo zoomed_dpi = { /* .bits = */ dpi->bits, - /* .x = */ static_cast(dpi->x >> 1), - /* .y = */ static_cast(dpi->y >> 1), + /* .x = */ dpi->x >> 1, + /* .y = */ dpi->y >> 1, /* .height = */ dpi->height, /* .width = */ dpi->width, /* .pitch = */ dpi->pitch, @@ -1511,8 +1511,8 @@ static bool is_sprite_interacted_with_palette_set( } origin.y += g1->y_offset; - int16_t yStartPoint = 0; - int16_t height = g1->height; + int32_t yStartPoint = 0; + int32_t height = g1->height; if (dpi->zoom_level != 0) { if (height % 2) @@ -1537,7 +1537,7 @@ static bool is_sprite_interacted_with_palette_set( } origin.y = floor2(origin.y, round); - int16_t yEndPoint = height; + int32_t yEndPoint = height; origin.y -= dpi->y; if (origin.y < 0) { @@ -1562,8 +1562,8 @@ static bool is_sprite_interacted_with_palette_set( } } - int16_t xStartPoint = 0; - int16_t xEndPoint = g1->width; + int32_t xStartPoint = 0; + int32_t xEndPoint = g1->width; origin.x += g1->x_offset; origin.x = floor2(origin.x, round); @@ -1852,7 +1852,7 @@ std::optional screen_get_map_xy(const ScreenCoordsXY& screenCoords, rc * * rct2: 0x006894D4 */ -std::optional screen_get_map_xy_with_z(const ScreenCoordsXY& screenCoords, int16_t z) +std::optional screen_get_map_xy_with_z(const ScreenCoordsXY& screenCoords, int32_t z) { rct_viewport* viewport = viewport_find_from_point(screenCoords); if (viewport == nullptr) @@ -1888,7 +1888,7 @@ std::optional screen_get_map_xy_quadrant(const ScreenCoordsXY& screenC * * rct2: 0x0068964B */ -std::optional screen_get_map_xy_quadrant_with_z(const ScreenCoordsXY& screenCoords, int16_t z, uint8_t* quadrant) +std::optional screen_get_map_xy_quadrant_with_z(const ScreenCoordsXY& screenCoords, int32_t z, uint8_t* quadrant) { auto mapCoords = screen_get_map_xy_with_z(screenCoords, z); if (!mapCoords) @@ -1916,7 +1916,7 @@ std::optional screen_get_map_xy_side(const ScreenCoordsXY& screenCoord * * rct2: 0x006896DC */ -std::optional screen_get_map_xy_side_with_z(const ScreenCoordsXY& screenCoords, int16_t z, uint8_t* side) +std::optional screen_get_map_xy_side_with_z(const ScreenCoordsXY& screenCoords, int32_t z, uint8_t* side) { auto mapCoords = screen_get_map_xy_with_z(screenCoords, z); if (!mapCoords) @@ -1949,7 +1949,7 @@ uint8_t get_current_rotation() return rotation_masked; } -int16_t get_height_marker_offset() +int32_t get_height_marker_offset() { // Height labels in units if (gConfigGeneral.show_height_as_units) diff --git a/src/openrct2/interface/Viewport.h b/src/openrct2/interface/Viewport.h index 0c7afab621..e5ae588f0b 100644 --- a/src/openrct2/interface/Viewport.h +++ b/src/openrct2/interface/Viewport.h @@ -119,7 +119,7 @@ void viewport_render( rct_drawpixelinfo* dpi, const rct_viewport* viewport, int32_t left, int32_t top, int32_t right, int32_t bottom, std::vector* sessions = nullptr); void viewport_paint( - const rct_viewport* viewport, rct_drawpixelinfo* dpi, int16_t left, int16_t top, int16_t right, int16_t bottom, + const rct_viewport* viewport, rct_drawpixelinfo* dpi, int32_t left, int32_t top, int32_t right, int32_t bottom, std::vector* sessions = nullptr); CoordsXYZ viewport_adjust_for_map_height(const ScreenCoordsXY& startCoords); @@ -151,14 +151,14 @@ CoordsXY ViewportInteractionGetTileStartAtCursor(const ScreenCoordsXY& screenCoo void viewport_invalidate(const rct_viewport* viewport, int32_t left, int32_t top, int32_t right, int32_t bottom); std::optional screen_get_map_xy(const ScreenCoordsXY& screenCoords, rct_viewport** viewport); -std::optional screen_get_map_xy_with_z(const ScreenCoordsXY& screenCoords, int16_t z); +std::optional screen_get_map_xy_with_z(const ScreenCoordsXY& screenCoords, int32_t z); std::optional screen_get_map_xy_quadrant(const ScreenCoordsXY& screenCoords, uint8_t* quadrant); -std::optional screen_get_map_xy_quadrant_with_z(const ScreenCoordsXY& screenCoords, int16_t z, uint8_t* quadrant); +std::optional screen_get_map_xy_quadrant_with_z(const ScreenCoordsXY& screenCoords, int32_t z, uint8_t* quadrant); std::optional screen_get_map_xy_side(const ScreenCoordsXY& screenCoords, uint8_t* side); -std::optional screen_get_map_xy_side_with_z(const ScreenCoordsXY& screenCoords, int16_t z, uint8_t* side); +std::optional screen_get_map_xy_side_with_z(const ScreenCoordsXY& screenCoords, int32_t z, uint8_t* side); uint8_t get_current_rotation(); -int16_t get_height_marker_offset(); +int32_t get_height_marker_offset(); void viewport_set_saved_view(); diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index 6d54804b2c..000d6e4d3b 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -732,7 +732,7 @@ void window_push_others_right(rct_window* window) w->Invalidate(); if (window->windowPos.x + window->width + 13 >= context_get_width()) return; - uint16_t push_amount = window->windowPos.x + window->width - w->windowPos.x + 3; + auto push_amount = window->windowPos.x + window->width - w->windowPos.x + 3; w->windowPos.x += push_amount; w->Invalidate(); if (w->viewport != nullptr) @@ -834,15 +834,15 @@ void window_scroll_to_location(rct_window* w, const CoordsXYZ& coords) bool found = false; while (!found) { - int16_t x2 = w->viewport->pos.x + static_cast(w->viewport->width * window_scroll_locations[i][0]); - int16_t y2 = w->viewport->pos.y + static_cast(w->viewport->height * window_scroll_locations[i][1]); + auto x2 = w->viewport->pos.x + static_cast(w->viewport->width * window_scroll_locations[i][0]); + auto y2 = w->viewport->pos.y + static_cast(w->viewport->height * window_scroll_locations[i][1]); auto it = window_get_iterator(w); for (; it != g_window_list.end(); it++) { auto w2 = (*it).get(); - int16_t x1 = w2->windowPos.x - 10; - int16_t y1 = w2->windowPos.y - 10; + auto x1 = w2->windowPos.x - 10; + auto y1 = w2->windowPos.y - 10; if (x2 >= x1 && x2 <= w2->width + x1 + 20) { if (y2 >= y1 && y2 <= w2->height + y1 + 20) @@ -871,8 +871,8 @@ void window_scroll_to_location(rct_window* w, const CoordsXYZ& coords) if (!(w->flags & WF_NO_SCROLLING)) { w->savedViewPos = screenCoords - - ScreenCoordsXY{ static_cast(w->viewport->view_width * window_scroll_locations[i][0]), - static_cast(w->viewport->view_height * window_scroll_locations[i][1]) }; + - ScreenCoordsXY{ static_cast(w->viewport->view_width * window_scroll_locations[i][0]), + static_cast(w->viewport->view_height * window_scroll_locations[i][1]) }; w->flags |= WF_SCROLLING_TO_LOCATION; } } @@ -940,7 +940,7 @@ void window_rotate_camera(rct_window* w, int32_t direction) } void window_viewport_get_map_coords_by_cursor( - rct_window* w, int16_t* map_x, int16_t* map_y, int16_t* offset_x, int16_t* offset_y) + rct_window* w, int32_t* map_x, int32_t* map_y, int32_t* offset_x, int32_t* offset_y) { // Get mouse position to offset against. auto mouseCoords = context_get_cursor_position_scaled(); @@ -971,7 +971,7 @@ void window_viewport_get_map_coords_by_cursor( *offset_y = (w->savedViewPos.y - (centreLoc->y + rebased_y)) * w->viewport->zoom; } -void window_viewport_centre_tile_around_cursor(rct_window* w, int16_t map_x, int16_t map_y, int16_t offset_x, int16_t offset_y) +void window_viewport_centre_tile_around_cursor(rct_window* w, int32_t map_x, int32_t map_y, int32_t offset_x, int32_t offset_y) { // Get viewport coordinates centring around the tile. int32_t z = tile_element_height({ map_x, map_y }); @@ -1019,10 +1019,10 @@ void window_zoom_set(rct_window* w, ZoomLevel zoomLevel, bool atCursor) return; // Zooming to cursor? Remember where we're pointing at the moment. - int16_t saved_map_x = 0; - int16_t saved_map_y = 0; - int16_t offset_x = 0; - int16_t offset_y = 0; + int32_t saved_map_x = 0; + int32_t saved_map_y = 0; + int32_t offset_x = 0; + int32_t offset_y = 0; if (gConfigGeneral.zoom_to_cursor && atCursor) { window_viewport_get_map_coords_by_cursor(w, &saved_map_x, &saved_map_y, &offset_x, &offset_y); @@ -1281,8 +1281,8 @@ void window_resize(rct_window* w, int32_t dw, int32_t dh) w->Invalidate(); // Clamp new size to minimum and maximum - w->width = std::clamp(w->width + dw, w->min_width, w->max_width); - w->height = std::clamp(w->height + dh, w->min_height, w->max_height); + w->width = std::clamp(w->width + dw, w->min_width, w->max_width); + w->height = std::clamp(w->height + dh, w->min_height, w->max_height); window_event_resize_call(w); window_event_invalidate_call(w); @@ -2078,7 +2078,7 @@ bool window_is_visible(rct_window* w) * right (dx) * bottom (bp) */ -void window_draw_all(rct_drawpixelinfo* dpi, int16_t left, int16_t top, int16_t right, int16_t bottom) +void window_draw_all(rct_drawpixelinfo* dpi, int32_t left, int32_t top, int32_t right, int32_t bottom) { auto windowDPI = dpi->Crop({ left, top }, { right - left, bottom - top }); window_visit_each([&windowDPI, left, top, right, bottom](rct_window* w) { diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index 17db7753c0..4b8b721224 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -147,12 +147,12 @@ struct rct_widget */ struct rct_viewport { - int16_t width; - int16_t height; + int32_t width; + int32_t height; ScreenCoordsXY pos; ScreenCoordsXY viewPos; - int16_t view_width; - int16_t view_height; + int32_t view_width; + int32_t view_height; uint32_t flags; ZoomLevel zoom; uint8_t var_11; @@ -768,8 +768,8 @@ rct_window* window_get_main(); void window_scroll_to_location(rct_window* w, const CoordsXYZ& coords); void window_rotate_camera(rct_window* w, int32_t direction); void window_viewport_get_map_coords_by_cursor( - rct_window* w, int16_t* map_x, int16_t* map_y, int16_t* offset_x, int16_t* offset_y); -void window_viewport_centre_tile_around_cursor(rct_window* w, int16_t map_x, int16_t map_y, int16_t offset_x, int16_t offset_y); + rct_window* w, int32_t* map_x, int32_t* map_y, int32_t* offset_x, int32_t* offset_y); +void window_viewport_centre_tile_around_cursor(rct_window* w, int32_t map_x, int32_t map_y, int32_t offset_x, int32_t offset_y); void window_check_all_valid_zoom(); void window_zoom_set(rct_window* w, ZoomLevel zoomLevel, bool atCursor); void window_zoom_in(rct_window* w, bool atCursor); @@ -778,7 +778,7 @@ void main_window_zoom(bool zoomIn, bool atCursor); void window_show_textinput(rct_window* w, rct_widgetindex widgetIndex, uint16_t title, uint16_t text, int32_t value); -void window_draw_all(rct_drawpixelinfo* dpi, int16_t left, int16_t top, int16_t right, int16_t bottom); +void window_draw_all(rct_drawpixelinfo* dpi, int32_t left, int32_t top, int32_t right, int32_t bottom); void window_draw(rct_drawpixelinfo* dpi, rct_window* w, int32_t left, int32_t top, int32_t right, int32_t bottom); void WindowDrawWidgets(rct_window* w, rct_drawpixelinfo* dpi); void window_draw_viewport(rct_drawpixelinfo* dpi, rct_window* w); diff --git a/src/openrct2/paint/Paint.cpp b/src/openrct2/paint/Paint.cpp index d39013413c..f88b011bf7 100644 --- a/src/openrct2/paint/Paint.cpp +++ b/src/openrct2/paint/Paint.cpp @@ -52,13 +52,13 @@ bool gPaintBoundingBoxes; bool gPaintBlockedTiles; static void PaintAttachedPS(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t viewFlags); -static void PaintPSImageWithBoundingBoxes(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int16_t x, int16_t y); -static void PaintPSImage(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int16_t x, int16_t y); +static void PaintPSImageWithBoundingBoxes(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int32_t x, int32_t y); +static void PaintPSImage(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int32_t x, int32_t y); static uint32_t PaintPSColourifyImage(uint32_t imageId, ViewportInteractionItem spriteType, uint32_t viewFlags); static constexpr int32_t CalculatePositionHash(const paint_struct& ps, uint8_t rotation) { - auto pos = CoordsXY{ static_cast(ps.bounds.x), static_cast(ps.bounds.y) }.Rotate(rotation); + auto pos = CoordsXY{ ps.bounds.x, ps.bounds.y }.Rotate(rotation); switch (rotation) { case 0: @@ -189,8 +189,7 @@ static paint_struct* CreateNormalPaintStruct( template void PaintSessionGenerateRotate(paint_session* session) { // Optimised modified version of viewport_coord_to_map_coord - ScreenCoordsXY screenCoord = { static_cast((session->DPI.x) & 0xFFE0), - static_cast((session->DPI.y - 16) & 0xFFE0) }; + ScreenCoordsXY screenCoord = { floor2(session->DPI.x, 32), floor2((session->DPI.y - 16), 32) }; CoordsXY mapTile = { screenCoord.y - screenCoord.x / 2, screenCoord.y + screenCoord.x / 2 }; mapTile = mapTile.Rotate(direction); @@ -445,8 +444,8 @@ static void PaintDrawStruct(paint_session* session, paint_struct* ps) { rct_drawpixelinfo* dpi = &session->DPI; - int16_t x = ps->x; - int16_t y = ps->y; + auto x = ps->x; + auto y = ps->y; if (ps->sprite_type == ViewportInteractionItem::Entity) { @@ -522,7 +521,7 @@ static void PaintAttachedPS(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t v } } -static void PaintPSImageWithBoundingBoxes(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int16_t x, int16_t y) +static void PaintPSImageWithBoundingBoxes(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int32_t x, int32_t y) { const uint8_t colour = BoundBoxDebugColours[EnumValue(ps->sprite_type)]; const uint8_t rotation = get_current_rotation(); @@ -608,7 +607,7 @@ static void PaintPSImageWithBoundingBoxes(rct_drawpixelinfo* dpi, paint_struct* gfx_draw_line(dpi, { screenCoordFrontTop, screenCoordRightTop }, colour); } -static void PaintPSImage(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int16_t x, int16_t y) +static void PaintPSImage(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int32_t x, int32_t y) { if (ps->flags & PAINT_STRUCT_FLAG_IS_MASKED) { @@ -700,8 +699,8 @@ paint_struct* PaintAddImageAsParent( } paint_struct* PaintAddImageAsParent( - paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x, - int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset) + paint_session* session, uint32_t image_id, int32_t x_offset, int32_t y_offset, int32_t bound_box_length_x, + int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset) { return PaintAddImageAsParent( session, image_id, { x_offset, y_offset, z_offset }, { bound_box_length_x, bound_box_length_y, bound_box_length_z }); @@ -742,9 +741,9 @@ paint_struct* PaintAddImageAsParent( } paint_struct* PaintAddImageAsParent( - paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x, - int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x, - int16_t bound_box_offset_y, int16_t bound_box_offset_z) + paint_session* session, uint32_t image_id, int32_t x_offset, int32_t y_offset, int32_t bound_box_length_x, + int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset, int32_t bound_box_offset_x, + int32_t bound_box_offset_y, int32_t bound_box_offset_z) { return PaintAddImageAsParent( session, image_id, { x_offset, y_offset, z_offset }, { bound_box_length_x, bound_box_length_y, bound_box_length_z }, @@ -769,12 +768,12 @@ paint_struct* PaintAddImageAsParent( * Creates a paint struct but does not allocate to a paint quadrant. Result cannot be ignored! */ [[nodiscard]] paint_struct* PaintAddImageAsOrphan( - paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x, - int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x, - int16_t bound_box_offset_y, int16_t bound_box_offset_z) + paint_session* session, uint32_t image_id, int32_t x_offset, int32_t y_offset, int32_t bound_box_length_x, + int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset, int32_t bound_box_offset_x, + int32_t bound_box_offset_y, int32_t bound_box_offset_z) { - assert(static_cast(bound_box_length_x) == static_cast(bound_box_length_x)); - assert(static_cast(bound_box_length_y) == static_cast(bound_box_length_y)); + assert(bound_box_length_x > 0); + assert(bound_box_length_y > 0); session->LastPS = nullptr; session->LastAttachedPS = nullptr; @@ -831,12 +830,12 @@ paint_struct* PaintAddImageAsChild( } paint_struct* PaintAddImageAsChild( - paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x, - int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x, - int16_t bound_box_offset_y, int16_t bound_box_offset_z) + paint_session* session, uint32_t image_id, int32_t x_offset, int32_t y_offset, int32_t bound_box_length_x, + int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset, int32_t bound_box_offset_x, + int32_t bound_box_offset_y, int32_t bound_box_offset_z) { - assert(static_cast(bound_box_length_x) == static_cast(bound_box_length_x)); - assert(static_cast(bound_box_length_y) == static_cast(bound_box_length_y)); + assert(bound_box_length_x > 0); + assert(bound_box_length_y > 0); return PaintAddImageAsChild( session, image_id, { x_offset, y_offset, z_offset }, { bound_box_length_x, bound_box_length_y, bound_box_length_z }, { bound_box_offset_x, bound_box_offset_y, bound_box_offset_z }); @@ -850,7 +849,7 @@ paint_struct* PaintAddImageAsChild( * @param y (cx) * @return (!CF) success */ -bool PaintAttachToPreviousAttach(paint_session* session, uint32_t image_id, int16_t x, int16_t y) +bool PaintAttachToPreviousAttach(paint_session* session, uint32_t image_id, int32_t x, int32_t y) { auto* previousAttachedPS = session->LastAttachedPS; if (previousAttachedPS == nullptr) @@ -883,7 +882,7 @@ bool PaintAttachToPreviousAttach(paint_session* session, uint32_t image_id, int1 * @param y (cx) * @return (!CF) success */ -bool PaintAttachToPreviousPS(paint_session* session, uint32_t image_id, int16_t x, int16_t y) +bool PaintAttachToPreviousPS(paint_session* session, uint32_t image_id, int32_t x, int32_t y) { auto* masterPs = session->LastPS; if (masterPs == nullptr) @@ -920,7 +919,7 @@ bool PaintAttachToPreviousPS(paint_session* session, uint32_t image_id, int16_t * @param rotation (ebp) */ void PaintFloatingMoneyEffect( - paint_session* session, money64 amount, rct_string_id string_id, int16_t y, int16_t z, int8_t y_offsets[], int16_t offset_x, + paint_session* session, money64 amount, rct_string_id string_id, int32_t y, int32_t z, int8_t y_offsets[], int32_t offset_x, uint32_t rotation) { auto* ps = session->AllocateStringPaintEntry(); diff --git a/src/openrct2/paint/Paint.h b/src/openrct2/paint/Paint.h index 303d9102c8..87dfaee9cc 100644 --- a/src/openrct2/paint/Paint.h +++ b/src/openrct2/paint/Paint.h @@ -21,27 +21,21 @@ struct TileElement; enum class ViewportInteractionItem : uint8_t; -#pragma pack(push, 1) -/* size 0x12 */ struct attached_paint_struct { - uint32_t image_id; // 0x00 + uint32_t image_id; union { uint32_t tertiary_colour; // If masked image_id is masked_id uint32_t colour_image_id; }; - int16_t x; // 0x08 - int16_t y; // 0x0A - uint8_t flags; // 0x0C + int32_t x; + int32_t y; + uint8_t flags; uint8_t pad_0D; - attached_paint_struct* next; // 0x0E + attached_paint_struct* next; }; -#ifdef PLATFORM_32BIT -// TODO: drop packing from this when all rendering is done. -assert_struct_size(attached_paint_struct, 0x12); -#endif enum PAINT_QUADRANT_FLAGS { @@ -52,44 +46,39 @@ enum PAINT_QUADRANT_FLAGS struct paint_struct_bound_box { - uint16_t x; - uint16_t y; - uint16_t z; - uint16_t x_end; - uint16_t y_end; - uint16_t z_end; + int32_t x; + int32_t y; + int32_t z; + int32_t x_end; + int32_t y_end; + int32_t z_end; }; -/* size 0x34 */ struct paint_struct { - uint32_t image_id; // 0x00 + uint32_t image_id; union { - uint32_t tertiary_colour; // 0x04 + uint32_t tertiary_colour; // If masked image_id is masked_id - uint32_t colour_image_id; // 0x04 + uint32_t colour_image_id; }; - paint_struct_bound_box bounds; // 0x08 - int16_t x; // 0x14 - int16_t y; // 0x16 + paint_struct_bound_box bounds; + int32_t x; + int32_t y; uint16_t quadrant_index; uint8_t flags; uint8_t quadrant_flags; - attached_paint_struct* attached_ps; // 0x1C + attached_paint_struct* attached_ps; paint_struct* children; - paint_struct* next_quadrant_ps; // 0x24 - ViewportInteractionItem sprite_type; // 0x28 + paint_struct* next_quadrant_ps; + ViewportInteractionItem sprite_type; uint8_t var_29; uint16_t pad_2A; - uint16_t map_x; // 0x2C - uint16_t map_y; // 0x2E - TileElement* tileElement; // 0x30 (or sprite pointer) + int32_t map_x; + int32_t map_y; + TileElement* tileElement; }; -#ifdef PLATFORM_32BIT -// TODO: drop packing from this when all rendering is done. -assert_struct_size(paint_struct, 0x34); -#endif struct paint_string_struct { @@ -100,7 +89,6 @@ struct paint_string_struct uint32_t args[4]; // 0x0A uint8_t* y_offsets; // 0x1A }; -#pragma pack(pop) union paint_entry { @@ -290,47 +278,47 @@ extern bool gPaintBlockedTiles; extern bool gPaintWidePathsAsGhost; paint_struct* PaintAddImageAsParent( - paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x, - int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset); + paint_session* session, uint32_t image_id, int32_t x_offset, int32_t y_offset, int32_t bound_box_length_x, + int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset); paint_struct* PaintAddImageAsParent( paint_session* session, uint32_t image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize); paint_struct* PaintAddImageAsParent( - paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x, - int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x, - int16_t bound_box_offset_y, int16_t bound_box_offset_z); + paint_session* session, uint32_t image_id, int32_t x_offset, int32_t y_offset, int32_t bound_box_length_x, + int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset, int32_t bound_box_offset_x, + int32_t bound_box_offset_y, int32_t bound_box_offset_z); paint_struct* PaintAddImageAsParent( paint_session* session, uint32_t image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize, const CoordsXYZ& boundBoxOffset); [[nodiscard]] paint_struct* PaintAddImageAsOrphan( - paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x, - int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x, - int16_t bound_box_offset_y, int16_t bound_box_offset_z); + paint_session* session, uint32_t image_id, int32_t x_offset, int32_t y_offset, int32_t bound_box_length_x, + int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset, int32_t bound_box_offset_x, + int32_t bound_box_offset_y, int32_t bound_box_offset_z); paint_struct* PaintAddImageAsChild( - paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x, - int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x, - int16_t bound_box_offset_y, int16_t bound_box_offset_z); + paint_session* session, uint32_t image_id, int32_t x_offset, int32_t y_offset, int32_t bound_box_length_x, + int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset, int32_t bound_box_offset_x, + int32_t bound_box_offset_y, int32_t bound_box_offset_z); paint_struct* PaintAddImageAsChild( paint_session* session, uint32_t image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxLength, const CoordsXYZ& boundBoxOffset); paint_struct* PaintAddImageAsParentRotated( - paint_session* session, uint8_t direction, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x, - int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset); + paint_session* session, uint8_t direction, uint32_t image_id, int32_t x_offset, int32_t y_offset, + int32_t bound_box_length_x, int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset); paint_struct* PaintAddImageAsParentRotated( - paint_session* session, uint8_t direction, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x, - int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x, - int16_t bound_box_offset_y, int16_t bound_box_offset_z); + paint_session* session, uint8_t direction, uint32_t image_id, int32_t x_offset, int32_t y_offset, + int32_t bound_box_length_x, int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset, + int32_t bound_box_offset_x, int32_t bound_box_offset_y, int32_t bound_box_offset_z); paint_struct* PaintAddImageAsChildRotated( - paint_session* session, uint8_t direction, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x, - int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x, - int16_t bound_box_offset_y, int16_t bound_box_offset_z); + paint_session* session, uint8_t direction, uint32_t image_id, int32_t x_offset, int32_t y_offset, + int32_t bound_box_length_x, int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset, + int32_t bound_box_offset_x, int32_t bound_box_offset_y, int32_t bound_box_offset_z); void paint_util_push_tunnel_rotated(paint_session* session, uint8_t direction, uint16_t height, uint8_t type); -bool PaintAttachToPreviousAttach(paint_session* session, uint32_t image_id, int16_t x, int16_t y); -bool PaintAttachToPreviousPS(paint_session* session, uint32_t image_id, int16_t x, int16_t y); +bool PaintAttachToPreviousAttach(paint_session* session, uint32_t image_id, int32_t x, int32_t y); +bool PaintAttachToPreviousPS(paint_session* session, uint32_t image_id, int32_t x, int32_t y); void PaintFloatingMoneyEffect( - paint_session* session, money64 amount, rct_string_id string_id, int16_t y, int16_t z, int8_t y_offsets[], int16_t offset_x, + paint_session* session, money64 amount, rct_string_id string_id, int32_t y, int32_t z, int8_t y_offsets[], int32_t offset_x, uint32_t rotation); paint_session* PaintSessionAlloc(rct_drawpixelinfo* dpi, uint32_t viewFlags); diff --git a/src/openrct2/paint/PaintHelpers.cpp b/src/openrct2/paint/PaintHelpers.cpp index e50c12f97e..bc934fc77e 100644 --- a/src/openrct2/paint/PaintHelpers.cpp +++ b/src/openrct2/paint/PaintHelpers.cpp @@ -12,8 +12,8 @@ #include "Paint.h" paint_struct* PaintAddImageAsParentRotated( - paint_session* session, uint8_t direction, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x, - int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset) + paint_session* session, uint8_t direction, uint32_t image_id, int32_t x_offset, int32_t y_offset, + int32_t bound_box_length_x, int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset) { if (direction & 1) { @@ -30,9 +30,9 @@ paint_struct* PaintAddImageAsParentRotated( } paint_struct* PaintAddImageAsParentRotated( - paint_session* session, uint8_t direction, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x, - int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x, - int16_t bound_box_offset_y, int16_t bound_box_offset_z) + paint_session* session, uint8_t direction, uint32_t image_id, int32_t x_offset, int32_t y_offset, + int32_t bound_box_length_x, int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset, + int32_t bound_box_offset_x, int32_t bound_box_offset_y, int32_t bound_box_offset_z) { if (direction & 1) { @@ -49,9 +49,9 @@ paint_struct* PaintAddImageAsParentRotated( } paint_struct* PaintAddImageAsChildRotated( - paint_session* session, uint8_t direction, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x, - int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x, - int16_t bound_box_offset_y, int16_t bound_box_offset_z) + paint_session* session, uint8_t direction, uint32_t image_id, int32_t x_offset, int32_t y_offset, + int32_t bound_box_length_x, int32_t bound_box_length_y, int32_t bound_box_length_z, int32_t z_offset, + int32_t bound_box_offset_x, int32_t bound_box_offset_y, int32_t bound_box_offset_z) { if (direction & 1) { diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 3a5781ba5d..b32404921e 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -347,10 +347,10 @@ void S6Exporter::Export() _s6.cash = ENCRYPT_MONEY(ToMoney32(gCash)); // pad_013587FC _s6.park_rating_casualty_penalty = gParkRatingCasualtyPenalty; - _s6.map_size_units = gMapSizeUnits; - _s6.map_size_minus_2 = gMapSizeMinus2; + _s6.map_size_units = GetMapSizeUnits(); + _s6.map_size_minus_2 = GetMapSizeMinus2(); _s6.map_size = gMapSize; - _s6.map_max_xy = gMapSizeMaxXY; + _s6.map_max_xy = GetMapSizeMaxXY(); _s6.same_price_throughout = gSamePriceThroughoutPark & 0xFFFFFFFF; _s6.suggested_max_guests = _suggestedGuestMaximum; _s6.park_rating_warning_days = gScenarioParkRatingWarningDays; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 3bbced91e5..441926fb5a 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -353,10 +353,7 @@ public: gCash = ToMoney64(DECRYPT_MONEY(_s6.cash)); // pad_013587FC gParkRatingCasualtyPenalty = _s6.park_rating_casualty_penalty; - gMapSizeUnits = _s6.map_size_units; - gMapSizeMinus2 = _s6.map_size_minus_2; gMapSize = _s6.map_size; - gMapSizeMaxXY = _s6.map_max_xy; gSamePriceThroughoutPark = _s6.same_price_throughout | (static_cast(_s6.same_price_throughout_extended) << 32); _suggestedGuestMaximum = _s6.suggested_max_guests; diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 6c8c745329..63e9dfc8d2 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -2086,8 +2086,6 @@ static void track_design_preview_clear_map() { auto numTiles = MAXIMUM_MAP_SIZE_TECHNICAL * MAXIMUM_MAP_SIZE_TECHNICAL; - gMapSizeUnits = 255 * COORDS_XY_STEP; - gMapSizeMinus2 = (264 * 32) - 2; gMapSize = 256; // Reserve ~8 elements per tile diff --git a/src/openrct2/ride/gentle/CrookedHouse.cpp b/src/openrct2/ride/gentle/CrookedHouse.cpp index d61ed4ed51..e8a8ff47e9 100644 --- a/src/openrct2/ride/gentle/CrookedHouse.cpp +++ b/src/openrct2/ride/gentle/CrookedHouse.cpp @@ -32,7 +32,7 @@ static constexpr const rct_crooked_house_bound_box crooked_house_data[] = { { 6, * rct2: 0x0088ABA4 */ static void paint_crooked_house_structure( - paint_session* session, uint8_t direction, uint8_t x_offset, uint8_t y_offset, uint32_t segment, int32_t height) + paint_session* session, uint8_t direction, int32_t x_offset, int32_t y_offset, uint32_t segment, int32_t height) { const TileElement* original_tile_element = static_cast(session->CurrentlyDrawnItem); @@ -88,16 +88,16 @@ static void paint_crooked_house( switch (trackSequence) { case 3: - paint_crooked_house_structure(session, direction, 32, 224, 0, height); + paint_crooked_house_structure(session, direction, 32, -32, 0, height); break; - // case 5: sub_88ABA4(direction, 0, 224, 1, height); break; + // case 5: sub_88ABA4(direction, 0, -32, 1, height); break; case 6: - paint_crooked_house_structure(session, direction, 224, 32, 4, height); + paint_crooked_house_structure(session, direction, -32, 32, 4, height); break; case 7: - paint_crooked_house_structure(session, direction, 224, 224, 2, height); + paint_crooked_house_structure(session, direction, -32, -32, 2, height); break; - // case 8: sub_88ABA4(rideIndex, 224, 0, 3, height); break; + // case 8: sub_88ABA4(rideIndex, -32, 0, 3, height); break; } int32_t cornerSegments = 0; diff --git a/src/openrct2/ride/thrill/TopSpin.cpp b/src/openrct2/ride/thrill/TopSpin.cpp index 2e63f3565c..c0f86c3a18 100644 --- a/src/openrct2/ride/thrill/TopSpin.cpp +++ b/src/openrct2/ride/thrill/TopSpin.cpp @@ -43,13 +43,13 @@ static int8_t TopSpinSeatPositionOffset[] = { * rct2: 0x0076750D */ static void top_spin_paint_vehicle( - paint_session* session, int8_t al, int8_t cl, const Ride* ride, uint8_t direction, int32_t height, - const TrackElement& trackElement) + paint_session* session, int32_t al, int32_t cl, const Ride* ride, uint8_t direction, int32_t height, + const TrackElement& tileElement) { if (ride == nullptr) return; - uint16_t boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ; + int32_t boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ; // As we will be drawing a vehicle we need to backup the trackElement that // is assigned to the drawings. const TileElement* curTileElement = static_cast(session->CurrentlyDrawnItem); @@ -74,10 +74,8 @@ static void top_spin_paint_vehicle( boundBoxOffsetY = cl + 16; boundBoxOffsetZ = height; - // di - uint8_t lengthX = 24; - // si - uint8_t lengthY = 24; + auto lengthX = 24; + auto lengthY = 24; uint32_t image_id = session->TrackColours[SCHEME_MISC]; if (image_id == IMAGE_TYPE_REMAP) diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 4dcbba361a..04e5f8e4aa 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -93,11 +93,8 @@ uint8_t gMapSelectArrowDirection; TileCoordsXY gWidePathTileLoopPosition; uint16_t gGrassSceneryTileLoopPosition; -int16_t gMapSizeUnits; -int16_t gMapSizeMinus2; -int16_t gMapSize; -int16_t gMapSizeMaxXY; -int16_t gMapBaseZ; +int32_t gMapSize; +int32_t gMapBaseZ; std::vector gMapSelectionTiles; std::vector gPeepSpawns; @@ -108,8 +105,8 @@ bool gClearSmallScenery; bool gClearLargeScenery; bool gClearFootpath; -uint16_t gLandRemainingOwnershipSales; -uint16_t gLandRemainingConstructionSales; +uint32_t gLandRemainingOwnershipSales; +uint32_t gLandRemainingConstructionSales; bool gMapLandRightsUpdateSuccess; @@ -119,8 +116,6 @@ static TilePointerIndex _tileIndexStash; static std::vector _tileElementsStash; static size_t _tileElementsInUse; static size_t _tileElementsInUseStash; -static int32_t _mapSizeUnitsStash; -static int32_t _mapSizeMinus2Stash; static int32_t _mapSizeStash; static int32_t _currentRotationStash; @@ -128,8 +123,6 @@ void StashMap() { _tileIndexStash = std::move(_tileIndex); _tileElementsStash = std::move(_tileElements); - _mapSizeUnitsStash = gMapSizeUnits; - _mapSizeMinus2Stash = gMapSizeMinus2; _mapSizeStash = gMapSize; _currentRotationStash = gCurrentRotation; _tileElementsInUseStash = _tileElementsInUse; @@ -139,8 +132,6 @@ void UnstashMap() { _tileIndex = std::move(_tileIndexStash); _tileElements = std::move(_tileElementsStash); - gMapSizeUnits = _mapSizeUnitsStash; - gMapSizeMinus2 = _mapSizeMinus2Stash; gMapSize = _mapSizeStash; gCurrentRotation = _currentRotationStash; _tileElementsInUse = _tileElementsInUseStash; @@ -403,10 +394,7 @@ void map_init(int32_t size) gGrassSceneryTileLoopPosition = 0; gWidePathTileLoopPosition = {}; - gMapSizeUnits = size * 32 - 32; - gMapSizeMinus2 = size * 32 - 2; gMapSize = size; - gMapSizeMaxXY = size * 32 - 33; gMapBaseZ = 7; map_remove_out_of_range_elements(); AutoCreateMapAnimations(); @@ -752,7 +740,7 @@ bool map_is_location_valid(const CoordsXY& coords) bool map_is_edge(const CoordsXY& coords) { - return (coords.x < 32 || coords.y < 32 || coords.x >= gMapSizeUnits || coords.y >= gMapSizeUnits); + return (coords.x < 32 || coords.y < 32 || coords.x >= GetMapSizeUnits() || coords.y >= GetMapSizeUnits()); } bool map_can_build_at(const CoordsXYZ& loc) @@ -938,8 +926,7 @@ int32_t tile_element_get_corner_height(const SurfaceElement* surfaceElement, int uint8_t map_get_lowest_land_height(const MapRange& range) { MapRange validRange = { std::max(range.GetLeft(), 32), std::max(range.GetTop(), 32), - std::min(range.GetRight(), static_cast(gMapSizeMaxXY)), - std::min(range.GetBottom(), static_cast(gMapSizeMaxXY)) }; + std::min(range.GetRight(), GetMapSizeMaxXY()), std::min(range.GetBottom(), GetMapSizeMaxXY()) }; uint8_t min_height = 0xFF; for (int32_t yi = validRange.GetTop(); yi <= validRange.GetBottom(); yi += COORDS_XY_STEP) @@ -968,8 +955,7 @@ uint8_t map_get_lowest_land_height(const MapRange& range) uint8_t map_get_highest_land_height(const MapRange& range) { MapRange validRange = { std::max(range.GetLeft(), 32), std::max(range.GetTop(), 32), - std::min(range.GetRight(), static_cast(gMapSizeMaxXY)), - std::min(range.GetBottom(), static_cast(gMapSizeMaxXY)) }; + std::min(range.GetRight(), GetMapSizeMaxXY()), std::min(range.GetBottom(), GetMapSizeMaxXY()) }; uint8_t max_height = 0; for (int32_t yi = validRange.GetTop(); yi <= validRange.GetBottom(); yi += COORDS_XY_STEP) @@ -1610,7 +1596,7 @@ void map_restore_provisional_elements() */ void map_remove_out_of_range_elements() { - int32_t mapMaxXY = gMapSizeMaxXY; + int32_t mapMaxXY = GetMapSizeMaxXY(); // Ensure that we can remove elements // diff --git a/src/openrct2/world/Map.h b/src/openrct2/world/Map.h index 9fae19b987..2f6ccb551a 100644 --- a/src/openrct2/world/Map.h +++ b/src/openrct2/world/Map.h @@ -101,11 +101,21 @@ extern const TileCoordsXY TileDirectionDelta[]; extern TileCoordsXY gWidePathTileLoopPosition; extern uint16_t gGrassSceneryTileLoopPosition; -extern int16_t gMapSizeUnits; -extern int16_t gMapSizeMinus2; -extern int16_t gMapSize; -extern int16_t gMapSizeMaxXY; -extern int16_t gMapBaseZ; +extern int32_t gMapSize; +extern int32_t gMapBaseZ; + +inline int32_t GetMapSizeUnits() +{ + return (gMapSize - 1) * COORDS_XY_STEP; +} +inline int32_t GetMapSizeMinus2() +{ + return (gMapSize * COORDS_XY_STEP) + (8 * COORDS_XY_STEP - 2); +} +inline int32_t GetMapSizeMaxXY() +{ + return GetMapSizeUnits() - 1; +} extern uint16_t gMapSelectFlags; extern uint16_t gMapSelectType; @@ -126,8 +136,8 @@ extern bool gClearSmallScenery; extern bool gClearLargeScenery; extern bool gClearFootpath; -extern uint16_t gLandRemainingOwnershipSales; -extern uint16_t gLandRemainingConstructionSales; +extern uint32_t gLandRemainingOwnershipSales; +extern uint32_t gLandRemainingConstructionSales; extern bool gMapLandRightsUpdateSuccess; diff --git a/test/testpaint/Compat.cpp b/test/testpaint/Compat.cpp index 7c2f408090..5c23207e35 100644 --- a/test/testpaint/Compat.cpp +++ b/test/testpaint/Compat.cpp @@ -33,7 +33,6 @@ rct_sprite* sprite_list = RCT2_ADDRESS(0x010E63BC, rct_sprite); bool gCheatsEnableAllDrawableTrackPieces = false; Ride gRideList[MAX_RIDES]; -int16_t gMapSizeUnits; int16_t gMapBaseZ; bool gTrackDesignSaveMode = false; ride_id_t gTrackDesignSaveRideIndex = RIDE_ID_NULL; @@ -212,7 +211,7 @@ TileElement* map_get_first_element_at(const CoordsXY& elementPos) return gTileElementTilePointers[tileElementPos.x + tileElementPos.y * 256]; } -int16_t get_height_marker_offset() +int32_t get_height_marker_offset() { return 0; }