diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index 56f6d66321..3d30bb8a5b 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -535,7 +535,7 @@ public: viewport->zoom = zoom; gCurrentRotation = rotation; - if (zoomDifference != 0) + if (zoomDifference != ZoomLevel{ 0 }) { viewport->view_width = viewport->view_width * zoomDifference; viewport->view_height = viewport->view_height * zoomDifference; diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp index 9216d261d8..13281c0bff 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp @@ -628,7 +628,7 @@ void OpenGLDrawingContext::DrawSprite(rct_drawpixelinfo* dpi, uint32_t image, in return; } - if (dpi->zoom_level > 0) + if (dpi->zoom_level > ZoomLevel{ 0 }) { if (g1Element->flags & G1_FLAG_HAS_ZOOM_SPRITE) { @@ -653,11 +653,11 @@ void OpenGLDrawingContext::DrawSprite(rct_drawpixelinfo* dpi, uint32_t image, in int32_t top = y + g1Element->y_offset; int32_t zoom_mask; - if (dpi->zoom_level >= 0) + if (dpi->zoom_level >= ZoomLevel{ 0 }) zoom_mask = 0xFFFFFFFF * dpi->zoom_level; else zoom_mask = 0xFFFFFFFF; - if (dpi->zoom_level != 0 && (g1Element->flags & G1_FLAG_RLE_COMPRESSION)) + if (dpi->zoom_level != ZoomLevel{ 0 } && (g1Element->flags & G1_FLAG_RLE_COMPRESSION)) { top -= ~zoom_mask; } @@ -673,7 +673,7 @@ void OpenGLDrawingContext::DrawSprite(rct_drawpixelinfo* dpi, uint32_t image, in int32_t right = left + g1Element->width; int32_t bottom = top + g1Element->height; - if (dpi->zoom_level != 0 && (g1Element->flags & G1_FLAG_RLE_COMPRESSION)) + if (dpi->zoom_level != ZoomLevel{ 0 } && (g1Element->flags & G1_FLAG_RLE_COMPRESSION)) { bottom += top & ~zoom_mask; } diff --git a/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp b/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp index 11fe0029c8..178ed50dd2 100644 --- a/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp @@ -396,7 +396,7 @@ rct_drawpixelinfo TextureCache::CreateDPI(int32_t width, int32_t height) dpi.y = 0; dpi.width = width; dpi.height = height; - dpi.zoom_level = 0; + dpi.zoom_level = ZoomLevel{ 0 }; return dpi; } diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index 24b644e0eb..a99d980c2e 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -739,7 +739,7 @@ static Peep* ViewportInteractionGetClosestPeep(ScreenCoordsXY screenCoords, int3 return nullptr; viewport = w->viewport; - if (viewport == nullptr || viewport->zoom >= 2) + if (viewport == nullptr || viewport->zoom >= ZoomLevel{ 2 }) return nullptr; auto viewportCoords = viewport->ScreenToViewportCoord(screenCoords); diff --git a/src/openrct2-ui/scripting/ScViewport.hpp b/src/openrct2-ui/scripting/ScViewport.hpp index c95570b2b4..558fa30868 100644 --- a/src/openrct2-ui/scripting/ScViewport.hpp +++ b/src/openrct2-ui/scripting/ScViewport.hpp @@ -142,7 +142,8 @@ namespace OpenRCT2::Scripting auto w = GetWindow(); if (w != nullptr) { - window_zoom_set(w, value, false); + auto i8Value = static_cast(value); + window_zoom_set(w, ZoomLevel{ i8Value }, false); } } diff --git a/src/openrct2-ui/title/TitleSequencePlayer.cpp b/src/openrct2-ui/title/TitleSequencePlayer.cpp index 069ef308e6..6acaf96dc7 100644 --- a/src/openrct2-ui/title/TitleSequencePlayer.cpp +++ b/src/openrct2-ui/title/TitleSequencePlayer.cpp @@ -267,7 +267,7 @@ private: RotateView(command.Rotations); break; case TitleScript::Zoom: - SetViewZoom(command.Zoom); + SetViewZoom(ZoomLevel{ static_cast(command.Zoom) }); break; case TitleScript::Speed: gGameSpeed = std::clamp(command.Speed, 1, 4); @@ -317,7 +317,7 @@ private: return true; } - void SetViewZoom(const uint32_t& zoom) + void SetViewZoom(ZoomLevel zoom) { rct_window* w = window_get_main(); if (w != nullptr && w->viewport != nullptr) diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 26ced2d122..e51f28c1ac 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -1026,7 +1026,7 @@ static void WindowRideDrawTabVehicle(rct_drawpixelinfo* dpi, rct_window* w) if (rideEntry->flags & RIDE_ENTRY_FLAG_VEHICLE_TAB_SCALE_HALF) { - clipDPI.zoom_level = 1; + clipDPI.zoom_level = ZoomLevel{ 1 }; clipDPI.width *= 2; clipDPI.height *= 2; screenCoords.x *= 2; @@ -1212,12 +1212,13 @@ static void WindowRideUpdateOverallView(Ride* ride) { // Each farther zoom level shows twice as many tiles (log) // Appropriate zoom is lowered by one to fill the entire view with the ride - view.zoom = std::clamp(std::ceil(std::log(size / 80)) - 1, 0, ZoomLevel::max()); + const auto zoomValue = static_cast(std::ceil(std::log(size / 80)) - 1); + view.zoom = std::clamp(ZoomLevel{ zoomValue }, ZoomLevel{ 0 }, ZoomLevel::max()); } else { // Small rides or stalls are zoomed in all the way. - view.zoom = 0; + view.zoom = ZoomLevel{ 0 }; } } diff --git a/src/openrct2/CmdlineSprite.cpp b/src/openrct2/CmdlineSprite.cpp index 78bbe21145..63f9bd2edd 100644 --- a/src/openrct2/CmdlineSprite.cpp +++ b/src/openrct2/CmdlineSprite.cpp @@ -196,7 +196,7 @@ static bool SpriteImageExport(const rct_g1_element& spriteElement, const char* o dpi.width = spriteElement.width; dpi.height = spriteElement.height; dpi.pitch = 0; - dpi.zoom_level = 0; + dpi.zoom_level = ZoomLevel{ 0 }; DrawSpriteArgs args( ImageId(), PaletteMap::GetDefault(), spriteElement, 0, 0, spriteElement.width, spriteElement.height, pixels); diff --git a/src/openrct2/cmdline/BenchSpriteSort.cpp b/src/openrct2/cmdline/BenchSpriteSort.cpp index 65c03e3f90..1f605150a5 100644 --- a/src/openrct2/cmdline/BenchSpriteSort.cpp +++ b/src/openrct2/cmdline/BenchSpriteSort.cpp @@ -111,7 +111,7 @@ static std::vector extract_paint_session(std::string_view y = ((customX + customY) / 2) - z; viewport.viewPos = { x - ((viewport.view_width) / 2), y - ((viewport.view_height) / 2) }; - viewport.zoom = 0; + viewport.zoom = ZoomLevel{ 0 }; gCurrentRotation = 0; // Ensure sprites appear regardless of rotation diff --git a/src/openrct2/drawing/Drawing.Sprite.BMP.cpp b/src/openrct2/drawing/Drawing.Sprite.BMP.cpp index de822f9d83..c90c08c32d 100644 --- a/src/openrct2/drawing/Drawing.Sprite.BMP.cpp +++ b/src/openrct2/drawing/Drawing.Sprite.BMP.cpp @@ -62,7 +62,7 @@ template static void FASTCALL DrawBMPSpriteMinify(rct_draw template static void FASTCALL DrawBMPSprite(rct_drawpixelinfo& dpi, const DrawSpriteArgs& args) { - if (dpi.zoom_level < 0) + if (dpi.zoom_level < ZoomLevel{ 0 }) { DrawBMPSpriteMagnify(dpi, args); } diff --git a/src/openrct2/drawing/Drawing.Sprite.cpp b/src/openrct2/drawing/Drawing.Sprite.cpp index a9286f3d91..9cd00962fb 100644 --- a/src/openrct2/drawing/Drawing.Sprite.cpp +++ b/src/openrct2/drawing/Drawing.Sprite.cpp @@ -435,7 +435,7 @@ void FASTCALL gfx_draw_sprite_palette_set_software( return; } - if (dpi->zoom_level > 0 && (g1->flags & G1_FLAG_HAS_ZOOM_SPRITE)) + if (dpi->zoom_level > ZoomLevel{ 0 } && (g1->flags & G1_FLAG_HAS_ZOOM_SPRITE)) { rct_drawpixelinfo zoomed_dpi = *dpi; zoomed_dpi.bits = dpi->bits; @@ -452,16 +452,16 @@ void FASTCALL gfx_draw_sprite_palette_set_software( return; } - if (dpi->zoom_level > 0 && (g1->flags & G1_FLAG_NO_ZOOM_DRAW)) + if (dpi->zoom_level > ZoomLevel{ 0 } && (g1->flags & G1_FLAG_NO_ZOOM_DRAW)) { return; } // Its used super often so we will define it to a separate variable. auto zoom_level = dpi->zoom_level; - int32_t zoom_mask = zoom_level > 0 ? 0xFFFFFFFF * zoom_level : 0xFFFFFFFF; + int32_t zoom_mask = zoom_level > ZoomLevel{ 0 } ? 0xFFFFFFFF * zoom_level : 0xFFFFFFFF; - if (zoom_level > 0 && g1->flags & G1_FLAG_RLE_COMPRESSION) + if (zoom_level > ZoomLevel{ 0 } && g1->flags & G1_FLAG_RLE_COMPRESSION) { x -= ~zoom_mask; y -= ~zoom_mask; @@ -503,7 +503,7 @@ void FASTCALL gfx_draw_sprite_palette_set_software( } else { - if ((g1->flags & G1_FLAG_RLE_COMPRESSION) && zoom_level > 0) + if ((g1->flags & G1_FLAG_RLE_COMPRESSION) && zoom_level > ZoomLevel{ 0 }) { source_start_y -= dest_start_y & ~zoom_mask; height += dest_start_y & ~zoom_mask; @@ -549,7 +549,7 @@ void FASTCALL gfx_draw_sprite_palette_set_software( } else { - if ((g1->flags & G1_FLAG_RLE_COMPRESSION) && zoom_level > 0) + if ((g1->flags & G1_FLAG_RLE_COMPRESSION) && zoom_level > ZoomLevel{ 0 }) { source_start_x -= dest_start_x & ~zoom_mask; } @@ -613,7 +613,7 @@ void FASTCALL gfx_draw_sprite_raw_masked_software( return; } - if (dpi->zoom_level != 0) + if (dpi->zoom_level != ZoomLevel{ 0 }) { // TODO: Implement other zoom levels (probably not used though) assert(false); diff --git a/src/openrct2/drawing/Drawing.cpp b/src/openrct2/drawing/Drawing.cpp index 30c3543a24..8853313f77 100644 --- a/src/openrct2/drawing/Drawing.cpp +++ b/src/openrct2/drawing/Drawing.cpp @@ -670,7 +670,7 @@ bool clip_drawpixelinfo( int32_t bottom = coords.y + height; *dst = *src; - dst->zoom_level = 0; + dst->zoom_level = ZoomLevel{ 0 }; if (coords.x > dst->x) { diff --git a/src/openrct2/drawing/LightFX.cpp b/src/openrct2/drawing/LightFX.cpp index 59c2ae181d..1f0cbae3eb 100644 --- a/src/openrct2/drawing/LightFX.cpp +++ b/src/openrct2/drawing/LightFX.cpp @@ -77,12 +77,12 @@ static uint32_t LightListCurrentCountFront; static int16_t _current_view_x_front = 0; static int16_t _current_view_y_front = 0; static uint8_t _current_view_rotation_front = 0; -static ZoomLevel _current_view_zoom_front = 0; +static ZoomLevel _current_view_zoom_front{ 0 }; static int16_t _current_view_x_back = 0; static int16_t _current_view_y_back = 0; static uint8_t _current_view_rotation_back = 0; -static ZoomLevel _current_view_zoom_back = 0; -static ZoomLevel _current_view_zoom_back_delay = 0; +static ZoomLevel _current_view_zoom_back{ 0 }; +static ZoomLevel _current_view_zoom_back_delay{ 0 }; static GamePalette gPalette_light; @@ -356,13 +356,13 @@ void lightfx_prepare_light_list() { if (lightIntensityOccluded == 100) break; - if (_current_view_zoom_front > 2) + if (_current_view_zoom_front > ZoomLevel{ 2 }) break; totalSamplePoints += 4; } else if (pat == 4) { - if (_current_view_zoom_front > 1) + if (_current_view_zoom_front > ZoomLevel{ 1 }) break; if (lightIntensityOccluded == 0 || lightIntensityOccluded == 500) break; @@ -390,7 +390,7 @@ void lightfx_prepare_light_list() entry->LightIntensity = std::max( 0x00, entry->LightIntensity - static_cast(_current_view_zoom_front) * 5); - if (_current_view_zoom_front > 0) + if (_current_view_zoom_front > ZoomLevel{ 0 }) { if (GetLightTypeSize(entry->Type) < static_cast(_current_view_zoom_front)) { diff --git a/src/openrct2/drawing/ScrollingText.cpp b/src/openrct2/drawing/ScrollingText.cpp index f348a8eb64..fb951cae56 100644 --- a/src/openrct2/drawing/ScrollingText.cpp +++ b/src/openrct2/drawing/ScrollingText.cpp @@ -1454,7 +1454,7 @@ int32_t scrolling_text_setup( rct_drawpixelinfo* dpi = &session->DPI; - if (dpi->zoom_level > 0) + if (dpi->zoom_level > ZoomLevel{ 0 }) return SPR_SCROLLING_TEXT_DEFAULT; _drawSCrollNextIndex++; diff --git a/src/openrct2/entity/Duck.cpp b/src/openrct2/entity/Duck.cpp index cd0ed2b47c..fa2b3e1c09 100644 --- a/src/openrct2/entity/Duck.cpp +++ b/src/openrct2/entity/Duck.cpp @@ -367,7 +367,7 @@ void Duck::Serialise(DataSerialiser& stream) void Duck::Paint(paint_session* session, int32_t imageDirection) const { rct_drawpixelinfo& dpi = session->DPI; - if (dpi.zoom_level > 1) + if (dpi.zoom_level > ZoomLevel{ 1 }) return; uint32_t imageId = GetFrameImage(imageDirection); diff --git a/src/openrct2/entity/EntityBase.cpp b/src/openrct2/entity/EntityBase.cpp index 291f3e5519..9790f2ec02 100644 --- a/src/openrct2/entity/EntityBase.cpp +++ b/src/openrct2/entity/EntityBase.cpp @@ -34,20 +34,20 @@ void EntityBase::Invalidate() if (x == LOCATION_NULL) return; - int32_t maxZoom = 0; + ZoomLevel maxZoom{ 0 }; switch (Type) { case EntityType::Vehicle: case EntityType::Guest: case EntityType::Staff: - maxZoom = 2; + maxZoom = ZoomLevel{ 2 }; break; case EntityType::CrashedVehicleParticle: case EntityType::JumpingFountain: - maxZoom = 0; + maxZoom = ZoomLevel{ 0 }; break; case EntityType::Duck: - maxZoom = 1; + maxZoom = ZoomLevel{ 1 }; break; case EntityType::SteamParticle: case EntityType::MoneyEffect: @@ -55,10 +55,10 @@ void EntityBase::Invalidate() case EntityType::CrashSplash: case EntityType::ExplosionFlare: case EntityType::Balloon: - maxZoom = 2; + maxZoom = ZoomLevel{ 2 }; break; case EntityType::Litter: - maxZoom = 0; + maxZoom = ZoomLevel{ 0 }; break; default: break; diff --git a/src/openrct2/entity/Fountain.cpp b/src/openrct2/entity/Fountain.cpp index e0ece95800..8dc2c6f63d 100644 --- a/src/openrct2/entity/Fountain.cpp +++ b/src/openrct2/entity/Fountain.cpp @@ -401,7 +401,7 @@ void JumpingFountain::Paint(paint_session* session, int32_t imageDirection) cons constexpr uint32_t JumpingFountainWaterBaseImage = 22973; rct_drawpixelinfo& dpi = session->DPI; - if (dpi.zoom_level > 0) + if (dpi.zoom_level > ZoomLevel{ 0 }) { return; } diff --git a/src/openrct2/entity/Litter.cpp b/src/openrct2/entity/Litter.cpp index fe694f7b7a..e45f82e319 100644 --- a/src/openrct2/entity/Litter.cpp +++ b/src/openrct2/entity/Litter.cpp @@ -172,7 +172,7 @@ static constexpr const LitterSprite _litterSprites[] = { void Litter::Paint(paint_session* session, int32_t imageDirection) const { rct_drawpixelinfo& dpi = session->DPI; - if (dpi.zoom_level > 0) + if (dpi.zoom_level > ZoomLevel{ 0 }) return; // If zoomed at all no litter drawn // litter has no sprite direction so remove that diff --git a/src/openrct2/entity/MoneyEffect.cpp b/src/openrct2/entity/MoneyEffect.cpp index 13b5d95182..27cf7eaede 100644 --- a/src/openrct2/entity/MoneyEffect.cpp +++ b/src/openrct2/entity/MoneyEffect.cpp @@ -169,7 +169,7 @@ void MoneyEffect::Serialise(DataSerialiser& stream) void MoneyEffect::Paint(paint_session* session, int32_t imageDirection) const { rct_drawpixelinfo& dpi = session->DPI; - if (dpi.zoom_level > 0) + if (dpi.zoom_level > ZoomLevel{ 0 }) { return; } diff --git a/src/openrct2/entity/Particle.cpp b/src/openrct2/entity/Particle.cpp index b56f7fde94..ab16adac22 100644 --- a/src/openrct2/entity/Particle.cpp +++ b/src/openrct2/entity/Particle.cpp @@ -152,7 +152,7 @@ void VehicleCrashParticle::Serialise(DataSerialiser& stream) void VehicleCrashParticle::Paint(paint_session* session, int32_t imageDirection) const { rct_drawpixelinfo& dpi = session->DPI; - if (dpi.zoom_level > 0) + if (dpi.zoom_level > ZoomLevel{ 0 }) { return; } diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index 764a3e8bca..d7d3a4f619 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -2710,7 +2710,7 @@ void Peep::Paint(paint_session* session, int32_t imageDirection) const #endif rct_drawpixelinfo* dpi = &session->DPI; - if (dpi->zoom_level > 2) + if (dpi->zoom_level > ZoomLevel{ 2 }) { return; } diff --git a/src/openrct2/interface/Screenshot.cpp b/src/openrct2/interface/Screenshot.cpp index b0f5c3a5b2..826c104ff8 100644 --- a/src/openrct2/interface/Screenshot.cpp +++ b/src/openrct2/interface/Screenshot.cpp @@ -387,9 +387,8 @@ void screenshot_giant() throw std::runtime_error("Giant screenshot failed, unable to find a suitable destination path."); } - int32_t rotation = get_current_rotation(); - ZoomLevel zoom = 0; - + auto rotation = get_current_rotation(); + auto zoom = ZoomLevel{ 0 }; auto mainWindow = window_get_main(); auto vp = window_get_viewport(mainWindow); if (mainWindow != nullptr && vp != nullptr) diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index 999f98d6c1..d269915cb6 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -218,11 +218,11 @@ void viewport_remove(rct_viewport* viewport) _viewports.erase(it); } -void viewports_invalidate(const ScreenRect& screenRect, int32_t maxZoom) +void viewports_invalidate(const ScreenRect& screenRect, ZoomLevel maxZoom) { for (auto& vp : _viewports) { - if (maxZoom == -1 || vp.zoom <= maxZoom) + if (maxZoom == ZoomLevel{ -1 } || vp.zoom <= ZoomLevel{ maxZoom }) { viewport_invalidate(&vp, screenRect); } @@ -950,7 +950,7 @@ void viewport_paint( uint32_t viewFlags = viewport->flags; uint32_t width = screenRect.GetWidth(); uint32_t height = screenRect.GetHeight(); - uint32_t bitmask = viewport->zoom >= 0 ? 0xFFFFFFFF & (0xFFFFFFFF * viewport->zoom) : 0xFFFFFFFF; + uint32_t bitmask = viewport->zoom >= ZoomLevel{ 0 } ? 0xFFFFFFFF & (0xFFFFFFFF * viewport->zoom) : 0xFFFFFFFF; ScreenCoordsXY topLeft = screenRect.Point1; width &= bitmask; @@ -1081,7 +1081,7 @@ static void viewport_paint_weather_gloom(rct_drawpixelinfo* dpi) if (paletteId != FilterPaletteID::PaletteNull) { // Only scale width if zoomed in more than 1:1 - auto zoomLevel = dpi->zoom_level < 0 ? dpi->zoom_level : 0; + auto zoomLevel = dpi->zoom_level < ZoomLevel{ 0 } ? dpi->zoom_level : ZoomLevel{ 0 }; auto x = dpi->x; auto y = dpi->y; auto w = (dpi->width / zoomLevel) - 1; @@ -1482,7 +1482,7 @@ static bool is_sprite_interacted_with_palette_set( return false; } - if (dpi->zoom_level > 0) + if (dpi->zoom_level > ZoomLevel{ 0 }) { if (g1->flags & G1_FLAG_NO_ZOOM_DRAW) { @@ -1518,7 +1518,7 @@ static bool is_sprite_interacted_with_palette_set( origin.y += g1->y_offset; int32_t yStartPoint = 0; int32_t height = g1->height; - if (dpi->zoom_level != 0) + if (dpi->zoom_level != ZoomLevel{ 0 }) { if (height % 2) { @@ -1526,7 +1526,7 @@ static bool is_sprite_interacted_with_palette_set( yStartPoint++; } - if (dpi->zoom_level == 2) + if (dpi->zoom_level == ZoomLevel{ 2 }) { if (height % 4) { @@ -1720,7 +1720,7 @@ InteractionInfo get_map_coordinates_from_pos_window(rct_window* window, const Sc viewLoc.x = viewLoc.x * myviewport->zoom; viewLoc.y = viewLoc.y * myviewport->zoom; viewLoc += myviewport->viewPos; - if (myviewport->zoom > 0) + if (myviewport->zoom > ZoomLevel{ 0 }) { viewLoc.x &= (0xFFFFFFFF * myviewport->zoom) & 0xFFFFFFFF; viewLoc.y &= (0xFFFFFFFF * myviewport->zoom) & 0xFFFFFFFF; @@ -1978,8 +1978,8 @@ ZoomLevel ZoomLevel::min() { if (drawing_engine_get_type() == DrawingEngine::OpenGL) { - return -2; + return ZoomLevel{ -2 }; } - return 0; + return ZoomLevel{ 0 }; } diff --git a/src/openrct2/interface/Viewport.h b/src/openrct2/interface/Viewport.h index d97b8a544f..ac1e394014 100644 --- a/src/openrct2/interface/Viewport.h +++ b/src/openrct2/interface/Viewport.h @@ -106,7 +106,7 @@ void viewport_init_all(); std::optional centre_2d_coordinates(const CoordsXYZ& loc, rct_viewport* viewport); void viewport_create(rct_window* w, const ScreenCoordsXY& screenCoords, int32_t width, int32_t height, const Focus& focus); void viewport_remove(rct_viewport* viewport); -void viewports_invalidate(const ScreenRect& screenRect, int32_t maxZoom = -1); +void viewports_invalidate(const ScreenRect& screenRect, ZoomLevel maxZoom = ZoomLevel{ -1 }); void viewport_update_position(rct_window* window); void viewport_update_sprite_follow(rct_window* window); void viewport_update_smart_sprite_follow(rct_window* window); diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index 378f9b44dd..a14800ed2b 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -1797,9 +1797,9 @@ void window_update_viewport_ride_music() g_music_tracking_viewport = viewport; gWindowAudioExclusive = w; - if (viewport->zoom <= 0) + if (viewport->zoom <= ZoomLevel{ 0 }) OpenRCT2::Audio::gVolumeAdjustZoom = 0; - else if (viewport->zoom == 1) + else if (viewport->zoom == ZoomLevel{ 1 }) OpenRCT2::Audio::gVolumeAdjustZoom = 30; else OpenRCT2::Audio::gVolumeAdjustZoom = 60; diff --git a/src/openrct2/interface/ZoomLevel.cpp b/src/openrct2/interface/ZoomLevel.cpp index 721c45faec..e7ded72fb1 100644 --- a/src/openrct2/interface/ZoomLevel.cpp +++ b/src/openrct2/interface/ZoomLevel.cpp @@ -9,11 +9,6 @@ #include "ZoomLevel.h" -ZoomLevel::operator int8_t() const -{ - return _level; -} - ZoomLevel ZoomLevel::operator++(int) { ZoomLevel tmp(*this); @@ -69,3 +64,15 @@ ZoomLevel operator-(ZoomLevel lhs, const ZoomLevel& rhs) lhs -= rhs; return lhs; } + +ZoomLevel operator+(ZoomLevel lhs, int8_t rhs) +{ + lhs += ZoomLevel{ rhs }; + return lhs; +} + +ZoomLevel operator-(ZoomLevel lhs, int8_t rhs) +{ + lhs -= ZoomLevel{ rhs }; + return lhs; +} diff --git a/src/openrct2/interface/ZoomLevel.h b/src/openrct2/interface/ZoomLevel.h index e8fc36dc59..e901b45959 100644 --- a/src/openrct2/interface/ZoomLevel.h +++ b/src/openrct2/interface/ZoomLevel.h @@ -19,7 +19,7 @@ private: public: constexpr ZoomLevel() = default; - constexpr ZoomLevel(int8_t level) + explicit constexpr ZoomLevel(int8_t level) : _level(level) { } @@ -29,7 +29,11 @@ public: { } - explicit operator int8_t() const; + explicit constexpr operator int8_t() const + { + return _level; + } + ZoomLevel operator++(int); ZoomLevel& operator++(); ZoomLevel operator--(int); @@ -40,6 +44,8 @@ public: friend ZoomLevel operator+(ZoomLevel lhs, const ZoomLevel& rhs); friend ZoomLevel operator-(ZoomLevel lhs, const ZoomLevel& rhs); + friend ZoomLevel operator+(ZoomLevel lhs, int8_t rhs); + friend ZoomLevel operator-(ZoomLevel lhs, int8_t rhs); friend constexpr bool operator==(const ZoomLevel& lhs, const ZoomLevel& rhs); friend constexpr bool operator!=(const ZoomLevel& lhs, const ZoomLevel& rhs); friend constexpr bool operator>=(const ZoomLevel& lhs, const ZoomLevel& rhs); @@ -67,7 +73,7 @@ public: static constexpr ZoomLevel max() { - return 3; + return ZoomLevel{ 3 }; } }; diff --git a/src/openrct2/paint/Paint.Entity.cpp b/src/openrct2/paint/Paint.Entity.cpp index 290d50170f..a39edb542c 100644 --- a/src/openrct2/paint/Paint.Entity.cpp +++ b/src/openrct2/paint/Paint.Entity.cpp @@ -45,7 +45,7 @@ void EntityPaintSetup(paint_session* session, const CoordsXY& pos) } rct_drawpixelinfo* dpi = &session->DPI; - if (dpi->zoom_level > 2) + if (dpi->zoom_level > ZoomLevel{ 2 }) { return; } diff --git a/src/openrct2/paint/Paint.cpp b/src/openrct2/paint/Paint.cpp index 846b71fde0..ba4db50bb1 100644 --- a/src/openrct2/paint/Paint.cpp +++ b/src/openrct2/paint/Paint.cpp @@ -489,11 +489,11 @@ static void PaintDrawStruct(paint_session* session, paint_struct* ps) if (ps->sprite_type == ViewportInteractionItem::Entity) { - if (dpi->zoom_level >= 1) + if (dpi->zoom_level >= ZoomLevel{ 1 }) { x = floor2(x, 2); y = floor2(y, 2); - if (dpi->zoom_level >= 2) + if (dpi->zoom_level >= ZoomLevel{ 2 }) { x = floor2(x, 4); y = floor2(y, 4); @@ -502,7 +502,7 @@ static void PaintDrawStruct(paint_session* session, paint_struct* ps) } uint32_t imageId = PaintPSColourifyImage(ps->image_id, ps->sprite_type, session->ViewFlags); - if (gPaintBoundingBoxes && dpi->zoom_level == 0) + if (gPaintBoundingBoxes && dpi->zoom_level == ZoomLevel{ 0 }) { PaintPSImageWithBoundingBoxes(dpi, ps, imageId, x, y); } diff --git a/src/openrct2/paint/tile_element/Paint.Banner.cpp b/src/openrct2/paint/tile_element/Paint.Banner.cpp index 9006830aa4..69c42b89ce 100644 --- a/src/openrct2/paint/tile_element/Paint.Banner.cpp +++ b/src/openrct2/paint/tile_element/Paint.Banner.cpp @@ -39,7 +39,7 @@ void PaintBanner(paint_session* session, uint8_t direction, int32_t height, cons session->InteractionType = ViewportInteractionItem::Banner; - if (dpi->zoom_level > 1 || gTrackDesignSaveMode || (session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)) + if (dpi->zoom_level > ZoomLevel{ 1 } || gTrackDesignSaveMode || (session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)) return; height -= 16; diff --git a/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp b/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp index 4e806ce90a..948d901c0f 100644 --- a/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp +++ b/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp @@ -302,7 +302,7 @@ void PaintLargeScenery(paint_session* session, uint8_t direction, uint16_t heigh } } rct_drawpixelinfo* dpi = &session->DPI; - if (dpi->zoom_level > 1) + if (dpi->zoom_level > ZoomLevel{ 1 }) { large_scenery_paint_supports(session, direction, height, tileElement, dword_F4387C, tile); return; @@ -402,7 +402,7 @@ void PaintLargeScenery(paint_session* session, uint8_t direction, uint16_t heigh return; } rct_drawpixelinfo* dpi = &session->DPI; - if (dpi->zoom_level > 0) + if (dpi->zoom_level > ZoomLevel{ 0 }) { large_scenery_paint_supports(session, direction, height, tileElement, dword_F4387C, tile); return; diff --git a/src/openrct2/paint/tile_element/Paint.Path.cpp b/src/openrct2/paint/tile_element/Paint.Path.cpp index de6353b834..15cf7647c5 100644 --- a/src/openrct2/paint/tile_element/Paint.Path.cpp +++ b/src/openrct2/paint/tile_element/Paint.Path.cpp @@ -306,7 +306,7 @@ static void path_bit_benches_paint( static void path_bit_jumping_fountains_paint( paint_session* session, PathBitEntry* pathBitEntry, int32_t height, uint32_t pathBitImageFlags, rct_drawpixelinfo* dpi) { - if (dpi->zoom_level > 0) + if (dpi->zoom_level > ZoomLevel{ 0 }) return; uint32_t imageId = pathBitEntry->image; @@ -683,7 +683,7 @@ static void sub_6A3F61( rct_drawpixelinfo* dpi = &session->DPI; - if (dpi->zoom_level <= 1) + if (dpi->zoom_level <= ZoomLevel{ 1 }) { bool paintScenery = true; diff --git a/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp b/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp index 79dc4ede3f..f091f9cd24 100644 --- a/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp +++ b/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp @@ -179,7 +179,7 @@ void PaintSmallScenery(paint_session* session, uint8_t direction, int32_t height if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_ANIMATED)) { rct_drawpixelinfo* dpi = &session->DPI; - if ((sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED)) || (dpi->zoom_level <= 1)) + if ((sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED)) || (dpi->zoom_level <= ZoomLevel{ 1 })) { // 6E01A9: if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_1)) diff --git a/src/openrct2/paint/tile_element/Paint.Surface.cpp b/src/openrct2/paint/tile_element/Paint.Surface.cpp index 4dcc0f2b50..a92ee545c7 100644 --- a/src/openrct2/paint/tile_element/Paint.Surface.cpp +++ b/src/openrct2/paint/tile_element/Paint.Surface.cpp @@ -1062,7 +1062,7 @@ void PaintSurface(paint_session* session, uint8_t direction, uint16_t height, co const bool showGridlines = (session->ViewFlags & VIEWPORT_FLAG_GRIDLINES); auto grassLength = -1; - if (zoomLevel <= 0) + if (zoomLevel <= ZoomLevel{ 0 }) { if ((session->ViewFlags & (VIEWPORT_FLAG_HIDE_BASE | VIEWPORT_FLAG_UNDERGROUND_INSIDE)) == 0) { @@ -1267,7 +1267,7 @@ void PaintSurface(paint_session* session, uint8_t direction, uint16_t height, co } } - if (zoomLevel <= 0 && has_surface && !(session->ViewFlags & VIEWPORT_FLAG_UNDERGROUND_INSIDE) + if (zoomLevel <= ZoomLevel{ 0 } && has_surface && !(session->ViewFlags & VIEWPORT_FLAG_UNDERGROUND_INSIDE) && !(session->ViewFlags & VIEWPORT_FLAG_HIDE_BASE) && gConfigGeneral.landscape_smoothing) { viewport_surface_smoothen_edge(session, EDGE_TOPLEFT, tileDescriptors[0], tileDescriptors[3]); diff --git a/src/openrct2/paint/tile_element/Paint.TileElement.cpp b/src/openrct2/paint/tile_element/Paint.TileElement.cpp index 6da3c716c1..10648863c6 100644 --- a/src/openrct2/paint/tile_element/Paint.TileElement.cpp +++ b/src/openrct2/paint/tile_element/Paint.TileElement.cpp @@ -421,5 +421,5 @@ uint16_t paint_util_rotate_segments(uint16_t segments, uint8_t rotation) bool PaintShouldShowHeightMarkers(const paint_session* session, const uint32_t viewportFlag) { auto dpi = &session->DPI; - return (session->ViewFlags & viewportFlag) && (dpi->zoom_level <= 0); + return (session->ViewFlags & viewportFlag) && (dpi->zoom_level <= ZoomLevel{ 0 }); } diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 8527570c5e..97fa00b34d 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -2371,7 +2371,7 @@ namespace RCT1 void ImportSavedView() { gSavedView = ScreenCoordsXY{ _s4.view_x, _s4.view_y }; - gSavedViewZoom = _s4.view_zoom; + gSavedViewZoom = ZoomLevel{ static_cast(_s4.view_zoom) }; gSavedViewRotation = _s4.view_rotation; } diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 750e6e5192..ec27911ff6 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -417,7 +417,7 @@ namespace RCT2 gSavedAge = _s6.saved_age; gSavedView = ScreenCoordsXY{ _s6.saved_view_x, _s6.saved_view_y }; - gSavedViewZoom = _s6.saved_view_zoom; + gSavedViewZoom = ZoomLevel{ static_cast(_s6.saved_view_zoom) }; gSavedViewRotation = _s6.saved_view_rotation; ImportRideRatingsCalcData(); diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 07e34c2217..a99e9c77bb 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -4587,7 +4587,7 @@ void set_vehicle_type_image_max_sizes(rct_ride_entry_vehicle* vehicle_type, int3 /*.width = */ 200, /*.height = */ 200, /*.pitch = */ 0, - /*.zoom_level = */ 0, + /*.zoom_level = */ ZoomLevel{ 0 }, }; for (int32_t i = 0; i < num_images; ++i) diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 1178e5a1b3..2b0b3cfaf9 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -2099,8 +2099,7 @@ void TrackDesignDrawPreview(TrackDesign* td6, uint8_t* pixels) size_z = 0; } - ZoomLevel zoom_level = 1; - + ZoomLevel zoom_level{ 1 }; if (size_x < size_y) { size_x = size_y; @@ -2108,12 +2107,12 @@ void TrackDesignDrawPreview(TrackDesign* td6, uint8_t* pixels) if (size_x > 1000 || size_z > 280) { - zoom_level = 2; + zoom_level = ZoomLevel{ 2 }; } if (size_x > 1600 || size_z > 1000) { - zoom_level = 3; + zoom_level = ZoomLevel{ 3 }; } size_x = 370 * zoom_level; diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index cf8d78c677..3dbb311f8e 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -958,9 +958,9 @@ static void vehicle_sounds_update_window_setup() g_music_tracking_viewport = viewport; gWindowAudioExclusive = window; - if (viewport->zoom <= 0) + if (viewport->zoom <= ZoomLevel{ 0 }) OpenRCT2::Audio::gVolumeAdjustZoom = 0; - else if (viewport->zoom == 1) + else if (viewport->zoom == ZoomLevel{ 1 }) OpenRCT2::Audio::gVolumeAdjustZoom = 35; else OpenRCT2::Audio::gVolumeAdjustZoom = 70; diff --git a/src/openrct2/ride/VehiclePaint.cpp b/src/openrct2/ride/VehiclePaint.cpp index 0b0f6520e8..5e2f75214f 100644 --- a/src/openrct2/ride/VehiclePaint.cpp +++ b/src/openrct2/ride/VehiclePaint.cpp @@ -965,7 +965,7 @@ static void vehicle_sprite_paint( ps->tertiary_colour = vehicle->colours_extended; } rct_drawpixelinfo* dpi = &session->DPI; - if (dpi->zoom_level < 2 && vehicle->num_peeps > 0 && vehicleEntry->no_seating_rows > 0) + if (dpi->zoom_level < ZoomLevel{ 2 } && vehicle->num_peeps > 0 && vehicleEntry->no_seating_rows > 0) { baseImage_id += vehicleEntry->no_vehicle_images; for (int32_t i = 0; i < 8; i++) diff --git a/src/openrct2/ride/coaster/VirginiaReel.cpp b/src/openrct2/ride/coaster/VirginiaReel.cpp index 3130ddce7b..01213caa11 100644 --- a/src/openrct2/ride/coaster/VirginiaReel.cpp +++ b/src/openrct2/ride/coaster/VirginiaReel.cpp @@ -197,7 +197,7 @@ void vehicle_visual_virginia_reel( session, image_id, { 0, 0, z }, { bb->length_x, bb->length_y, bb->length_z }, { bb->offset_x, bb->offset_y, bb->offset_z + z }); - if (session->DPI.zoom_level < 2 && vehicle->num_peeps > 0 && !vehicle->IsGhost()) + if (session->DPI.zoom_level < ZoomLevel{ 2 } && vehicle->num_peeps > 0 && !vehicle->IsGhost()) { uint8_t riding_peep_sprites[4] = { 0xFF, 0xFF, 0xFF, 0xFF }; for (int32_t i = 0; i < vehicle->num_peeps; i++) diff --git a/src/openrct2/ride/gentle/HauntedHouse.cpp b/src/openrct2/ride/gentle/HauntedHouse.cpp index 1fa9a730ba..86486749d2 100644 --- a/src/openrct2/ride/gentle/HauntedHouse.cpp +++ b/src/openrct2/ride/gentle/HauntedHouse.cpp @@ -63,7 +63,7 @@ static void paint_haunted_house_structure( session, imageId, { xOffset, yOffset, height }, { boundBox.length, 127 }, { boundBox.offset, height }); rct_drawpixelinfo* dpi = &session->DPI; - if (dpi->zoom_level <= 0 && frameNum != 0) + if (dpi->zoom_level <= ZoomLevel{ 0 } && frameNum != 0) { switch (direction) { diff --git a/src/openrct2/ride/gentle/MerryGoRound.cpp b/src/openrct2/ride/gentle/MerryGoRound.cpp index 90b224bc18..ac34417c38 100644 --- a/src/openrct2/ride/gentle/MerryGoRound.cpp +++ b/src/openrct2/ride/gentle/MerryGoRound.cpp @@ -77,7 +77,7 @@ static void paint_merry_go_round_structure( session, imageId, { xOffset, yOffset, height }, { 24, 24, 48 }, { xOffset + 16, yOffset + 16, height }); rct_drawpixelinfo* dpi = &session->DPI; - if (dpi->zoom_level <= 0 && ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && vehicle != nullptr) + if (dpi->zoom_level <= ZoomLevel{ 0 } && ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && vehicle != nullptr) { for (int32_t peep = 0; peep <= 14; peep += 2) { diff --git a/src/openrct2/ride/gentle/MiniGolf.cpp b/src/openrct2/ride/gentle/MiniGolf.cpp index 38cad1ba9e..6f9b5d97fa 100644 --- a/src/openrct2/ride/gentle/MiniGolf.cpp +++ b/src/openrct2/ride/gentle/MiniGolf.cpp @@ -1213,7 +1213,7 @@ void vehicle_visual_mini_golf_player( } rct_drawpixelinfo* edi = &session->DPI; - if (edi->zoom_level >= 2) + if (edi->zoom_level >= ZoomLevel{ 2 }) { return; } @@ -1255,7 +1255,7 @@ void vehicle_visual_mini_golf_ball( } rct_drawpixelinfo* edi = &session->DPI; - if (edi->zoom_level >= 1) + if (edi->zoom_level >= ZoomLevel{ 1 }) { return; } diff --git a/src/openrct2/ride/gentle/SpiralSlide.cpp b/src/openrct2/ride/gentle/SpiralSlide.cpp index 8c315fabd1..fdc29354ee 100644 --- a/src/openrct2/ride/gentle/SpiralSlide.cpp +++ b/src/openrct2/ride/gentle/SpiralSlide.cpp @@ -125,7 +125,7 @@ static void spiral_slide_paint_tile_front( } rct_drawpixelinfo* dpi = &session->DPI; - if (dpi->zoom_level <= 0 && ride->slide_in_use != 0) + if (dpi->zoom_level <= ZoomLevel{ 0 } && ride->slide_in_use != 0) { uint8_t slide_progress = ride->spiral_slide_progress; if (slide_progress != 0) diff --git a/src/openrct2/ride/thrill/Enterprise.cpp b/src/openrct2/ride/thrill/Enterprise.cpp index 49e3185656..2e3c8d5a9e 100644 --- a/src/openrct2/ride/thrill/Enterprise.cpp +++ b/src/openrct2/ride/thrill/Enterprise.cpp @@ -59,7 +59,8 @@ static void paint_enterprise_structure( rct_drawpixelinfo* dpi = &session->DPI; - if (dpi->zoom_level <= 0 && imageOffset < 12 && ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && vehicle != nullptr) + if (dpi->zoom_level <= ZoomLevel{ 0 } && imageOffset < 12 && ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK + && vehicle != nullptr) { for (int32_t i = 0; i < 15; i++) { diff --git a/src/openrct2/ride/thrill/LaunchedFreefall.cpp b/src/openrct2/ride/thrill/LaunchedFreefall.cpp index a01e479290..e11b2c13f0 100644 --- a/src/openrct2/ride/thrill/LaunchedFreefall.cpp +++ b/src/openrct2/ride/thrill/LaunchedFreefall.cpp @@ -49,7 +49,7 @@ void vehicle_visual_launched_freefall( PaintAddImageAsParent(session, image_id, { 0, 0, z }, { 16, 16, 41 }, { -5, -5, z + 1 }); // Draw peeps: - if (session->DPI.zoom_level < 2 && vehicle->num_peeps > 0 && !vehicle->IsGhost()) + if (session->DPI.zoom_level < ZoomLevel{ 2 } && vehicle->num_peeps > 0 && !vehicle->IsGhost()) { baseImage_id = vehicleEntry->base_image_id + 9; if ((vehicle->restraints_position / 64) == 3) diff --git a/src/openrct2/ride/thrill/MagicCarpet.cpp b/src/openrct2/ride/thrill/MagicCarpet.cpp index af801b205f..edb0c494f8 100644 --- a/src/openrct2/ride/thrill/MagicCarpet.cpp +++ b/src/openrct2/ride/thrill/MagicCarpet.cpp @@ -163,7 +163,7 @@ static void paint_magic_carpet_vehicle( // Riders rct_drawpixelinfo* dpi = &session->DPI; - if (dpi->zoom_level <= 1 && (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK)) + if (dpi->zoom_level <= ZoomLevel{ 1 } && (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK)) { auto* vehicle = get_first_vehicle(ride); if (vehicle != nullptr) diff --git a/src/openrct2/ride/thrill/SwingingShip.cpp b/src/openrct2/ride/thrill/SwingingShip.cpp index 0175605a03..5b11e2e3ae 100644 --- a/src/openrct2/ride/thrill/SwingingShip.cpp +++ b/src/openrct2/ride/thrill/SwingingShip.cpp @@ -131,7 +131,7 @@ static void paint_swinging_ship_structure( rct_drawpixelinfo* dpi = &session->DPI; - if (dpi->zoom_level <= 1 && ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && vehicle != nullptr) + if (dpi->zoom_level <= ZoomLevel{ 1 } && ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && vehicle != nullptr) { int32_t peep = 0; int32_t offset = 1; diff --git a/src/openrct2/ride/thrill/TopSpin.cpp b/src/openrct2/ride/thrill/TopSpin.cpp index 08bcdf4995..e535a9ef32 100644 --- a/src/openrct2/ride/thrill/TopSpin.cpp +++ b/src/openrct2/ride/thrill/TopSpin.cpp @@ -168,7 +168,7 @@ static void top_spin_paint_vehicle( seatCoords.z, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ); rct_drawpixelinfo* dpi = &session->DPI; - if (dpi->zoom_level < 2 && vehicle != nullptr && vehicle->num_peeps != 0) + if (dpi->zoom_level < ZoomLevel{ 2 } && vehicle != nullptr && vehicle->num_peeps != 0) { image_id = (seatImageId + (1 * 76)) | SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[0], vehicle->peep_tshirt_colours[1]); diff --git a/src/openrct2/ride/thrill/Twist.cpp b/src/openrct2/ride/thrill/Twist.cpp index 81d5ef838b..2f71f82a02 100644 --- a/src/openrct2/ride/thrill/Twist.cpp +++ b/src/openrct2/ride/thrill/Twist.cpp @@ -64,7 +64,7 @@ static void paint_twist_structure( rct_drawpixelinfo* dpi = &session->DPI; - if (dpi->zoom_level < 1 && ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && vehicle != nullptr) + if (dpi->zoom_level < ZoomLevel{ 1 } && ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && vehicle != nullptr) { for (int32_t i = 0; i < vehicle->num_peeps; i += 2) { diff --git a/src/openrct2/ride/water/RiverRapids.cpp b/src/openrct2/ride/water/RiverRapids.cpp index edbac9f93b..e23d488744 100644 --- a/src/openrct2/ride/water/RiverRapids.cpp +++ b/src/openrct2/ride/water/RiverRapids.cpp @@ -232,7 +232,7 @@ void vehicle_visual_river_rapids( session, image_id, { 0, 0, z }, { bb->length_x, bb->length_y, bb->length_z }, { bb->offset_x, bb->offset_y, bb->offset_z + z }); - if (session->DPI.zoom_level < 2 && vehicle->num_peeps > 0 && !vehicle->IsGhost()) + if (session->DPI.zoom_level < ZoomLevel{ 2 } && vehicle->num_peeps > 0 && !vehicle->IsGhost()) { // Draw peeps: (this particular vehicle doesn't sort them back to front like others so the back ones sometimes clip, but // that's how the original does it...) diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index bc3dd3f8c4..32105f83b6 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -1838,7 +1838,7 @@ ScreenCoordsXY translate_3d_to_2d_with_z(int32_t rotation, const CoordsXYZ& pos) return ScreenCoordsXY{ rotated.y - rotated.x, ((rotated.x + rotated.y) >> 1) - pos.z }; } -static void map_invalidate_tile_under_zoom(int32_t x, int32_t y, int32_t z0, int32_t z1, int32_t maxZoom) +static void map_invalidate_tile_under_zoom(int32_t x, int32_t y, int32_t z0, int32_t z1, ZoomLevel maxZoom) { if (gOpenRCT2Headless) return; @@ -1863,7 +1863,7 @@ static void map_invalidate_tile_under_zoom(int32_t x, int32_t y, int32_t z0, int */ void map_invalidate_tile(const CoordsXYRangedZ& tilePos) { - map_invalidate_tile_under_zoom(tilePos.x, tilePos.y, tilePos.baseZ, tilePos.clearanceZ, -1); + map_invalidate_tile_under_zoom(tilePos.x, tilePos.y, tilePos.baseZ, tilePos.clearanceZ, ZoomLevel{ -1 }); } /** @@ -1872,7 +1872,7 @@ void map_invalidate_tile(const CoordsXYRangedZ& tilePos) */ void map_invalidate_tile_zoom1(const CoordsXYRangedZ& tilePos) { - map_invalidate_tile_under_zoom(tilePos.x, tilePos.y, tilePos.baseZ, tilePos.clearanceZ, 1); + map_invalidate_tile_under_zoom(tilePos.x, tilePos.y, tilePos.baseZ, tilePos.clearanceZ, ZoomLevel{ 1 }); } /** @@ -1881,7 +1881,7 @@ void map_invalidate_tile_zoom1(const CoordsXYRangedZ& tilePos) */ void map_invalidate_tile_zoom0(const CoordsXYRangedZ& tilePos) { - map_invalidate_tile_under_zoom(tilePos.x, tilePos.y, tilePos.baseZ, tilePos.clearanceZ, 0); + map_invalidate_tile_under_zoom(tilePos.x, tilePos.y, tilePos.baseZ, tilePos.clearanceZ, ZoomLevel{ 0 }); } /**