Merge pull request #15489

This commit is contained in:
Hielke Morsink authored and GitHub committed 2021-12-03 00:16:06 +01:00
commit 325b986c56
55 files changed
+206 -179

No files matched your search

+1 -1
View File
@@ -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;
@@ -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;
}
@@ -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;
}
@@ -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);
+2 -1
View File
@@ -142,7 +142,8 @@ namespace OpenRCT2::Scripting
auto w = GetWindow();
if (w != nullptr)
{
window_zoom_set(w, value, false);
auto i8Value = static_cast<int8_t>(value);
window_zoom_set(w, ZoomLevel{ i8Value }, false);
}
}
@@ -267,7 +267,7 @@ private:
RotateView(command.Rotations);
break;
case TitleScript::Zoom:
SetViewZoom(command.Zoom);
SetViewZoom(ZoomLevel{ static_cast<int8_t>(command.Zoom) });
break;
case TitleScript::Speed:
gGameSpeed = std::clamp<uint8_t>(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)
+5 -4
View File
@@ -778,7 +778,7 @@ static std::unique_ptr<TrackDesign> _trackDesign;
struct RideOverallView
{
CoordsXYZ loc;
uint8_t zoom;
ZoomLevel zoom;
};
static std::vector<RideOverallView> ride_overall_views = {};
@@ -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<int32_t>(std::ceil(std::log(size / 80)) - 1, 0, 3);
const auto zoomValue = static_cast<int8_t>(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 };
}
}
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -111,7 +111,7 @@ static std::vector<RecordedPaintSession> 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
+1 -1
View File
@@ -62,7 +62,7 @@ template<DrawBlendOp TBlendOp> static void FASTCALL DrawBMPSpriteMinify(rct_draw
template<DrawBlendOp TBlendOp> static void FASTCALL DrawBMPSprite(rct_drawpixelinfo& dpi, const DrawSpriteArgs& args)
{
if (dpi.zoom_level < 0)
if (dpi.zoom_level < ZoomLevel{ 0 })
{
DrawBMPSpriteMagnify<TBlendOp>(dpi, args);
}
+8 -8
View File
@@ -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;
const auto zoom_level = dpi->zoom_level;
const 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);
+1 -1
View File
@@ -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)
{
+6 -6
View File
@@ -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<uint32_t>(
0x00, entry->LightIntensity - static_cast<int8_t>(_current_view_zoom_front) * 5);
if (_current_view_zoom_front > 0)
if (_current_view_zoom_front > ZoomLevel{ 0 })
{
if (GetLightTypeSize(entry->Type) < static_cast<int8_t>(_current_view_zoom_front))
{
+1 -1
View File
@@ -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++;
+1 -1
View File
@@ -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);
+6 -6
View File
@@ -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;
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -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;
}
+29 -25
View File
@@ -387,11 +387,10 @@ 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 mainWindow = window_get_main();
auto vp = window_get_viewport(mainWindow);
const auto rotation = get_current_rotation();
auto zoom = ZoomLevel{ 0 };
auto* mainWindow = window_get_main();
const auto* vp = window_get_viewport(mainWindow);
if (mainWindow != nullptr && vp != nullptr)
{
zoom = vp->zoom;
@@ -447,50 +446,53 @@ static void benchgfx_render_screenshots(const char* inputPath, std::unique_ptr<I
gScreenFlags = SCREEN_FLAGS_PLAYING;
// Create Viewport and DPI for every rotation and zoom.
constexpr int32_t MAX_ROTATIONS = 4;
constexpr int32_t MAX_ZOOM_LEVEL = 3;
std::array<rct_drawpixelinfo, MAX_ROTATIONS * MAX_ZOOM_LEVEL> dpis;
std::array<rct_viewport, MAX_ROTATIONS * MAX_ZOOM_LEVEL> viewports;
// We iterate from the default zoom level to the max zoomed out zoom level, then run GetGiantViewport once for each
// rotation.
constexpr int32_t NUM_ROTATIONS = 4;
constexpr auto NUM_ZOOM_LEVELS = static_cast<int8_t>(ZoomLevel::max());
std::array<rct_drawpixelinfo, NUM_ROTATIONS * NUM_ZOOM_LEVELS> dpis;
std::array<rct_viewport, NUM_ROTATIONS * NUM_ZOOM_LEVELS> viewports;
for (int32_t zoom = 0; zoom < MAX_ZOOM_LEVEL; zoom++)
for (ZoomLevel zoom{ 0 }; zoom < ZoomLevel::max(); zoom++)
{
for (int32_t rotation = 0; rotation < MAX_ROTATIONS; rotation++)
int32_t zoomIndex{ static_cast<int8_t>(zoom) };
for (int32_t rotation = 0; rotation < NUM_ROTATIONS; rotation++)
{
auto& viewport = viewports[zoom * MAX_ZOOM_LEVEL + rotation];
auto& dpi = dpis[zoom * MAX_ZOOM_LEVEL + rotation];
auto& viewport = viewports[zoomIndex * NUM_ZOOM_LEVELS + rotation];
auto& dpi = dpis[zoomIndex * NUM_ZOOM_LEVELS + rotation];
viewport = GetGiantViewport(gMapSize, rotation, zoom);
dpi = CreateDPI(viewport);
}
}
const uint32_t totalRenderCount = iterationCount * MAX_ROTATIONS * MAX_ZOOM_LEVEL;
const uint32_t totalRenderCount = iterationCount * NUM_ROTATIONS * NUM_ZOOM_LEVELS;
try
{
double totalTime = 0.0;
std::array<double, MAX_ZOOM_LEVEL> zoomAverages;
std::array<double, NUM_ZOOM_LEVELS> zoomAverages;
// Render at every zoom.
for (int32_t zoom = 0; zoom < MAX_ZOOM_LEVEL; zoom++)
for (int32_t zoom = 0; zoom < NUM_ZOOM_LEVELS; zoom++)
{
double zoomLevelTime = 0.0;
// Render at every rotation.
for (int32_t rotation = 0; rotation < MAX_ROTATIONS; rotation++)
for (int32_t rotation = 0; rotation < NUM_ROTATIONS; rotation++)
{
// N iterations.
for (uint32_t i = 0; i < iterationCount; i++)
{
auto& dpi = dpis[zoom * MAX_ZOOM_LEVEL + rotation];
auto& viewport = viewports[zoom * MAX_ZOOM_LEVEL + rotation];
auto& dpi = dpis[zoom * NUM_ZOOM_LEVELS + rotation];
auto& viewport = viewports[zoom * NUM_ZOOM_LEVELS + rotation];
double elapsed = MeasureFunctionTime([&viewport, &dpi]() { RenderViewport(nullptr, viewport, dpi); });
totalTime += elapsed;
zoomLevelTime += elapsed;
}
}
zoomAverages[zoom] = zoomLevelTime / static_cast<double>(MAX_ROTATIONS * iterationCount);
zoomAverages[zoom] = zoomLevelTime / static_cast<double>(NUM_ROTATIONS * iterationCount);
}
const double average = totalTime / static_cast<double>(totalRenderCount);
@@ -498,10 +500,11 @@ static void benchgfx_render_screenshots(const char* inputPath, std::unique_ptr<I
const auto engineName = format_string(engineStringId, nullptr);
std::printf("Engine: %s\n", engineName.c_str());
std::printf("Render Count: %u\n", totalRenderCount);
for (int32_t zoom = 0; zoom < MAX_ZOOM_LEVEL; zoom++)
for (ZoomLevel zoom{ 0 }; zoom < ZoomLevel::max(); zoom++)
{
const auto zoomAverage = zoomAverages[zoom];
std::printf("Zoom[%d] average: %.06fs, %.f FPS\n", zoom, zoomAverage, 1.0 / zoomAverage);
int32_t zoomIndex{ static_cast<int8_t>(zoom) };
const auto zoomAverage = zoomAverages[zoomIndex];
std::printf("Zoom[%d] average: %.06fs, %.f FPS\n", zoomIndex, zoomAverage, 1.0 / zoomAverage);
}
std::printf("Total average: %.06fs, %.f FPS\n", average, 1.0 / average);
std::printf("Time: %.05fs\n", totalTime);
@@ -648,7 +651,8 @@ int32_t cmdline_for_screenshot(const char** argv, int32_t argc, ScreenshotOption
rct_viewport viewport{};
if (giantScreenshot)
{
auto zoom = std::atoi(argv[3]);
auto customZoom = static_cast<int8_t>(std::atoi(argv[3]));
auto zoom = ZoomLevel{ customZoom };
auto rotation = std::atoi(argv[4]) & 3;
viewport = GetGiantViewport(gMapSize, rotation, zoom);
gCurrentRotation = rotation;
@@ -706,7 +710,7 @@ int32_t cmdline_for_screenshot(const char** argv, int32_t argc, ScreenshotOption
viewport.viewPos = { coords2d.x - ((viewport.view_width << customZoom) / 2),
coords2d.y - ((viewport.view_height << customZoom) / 2) };
viewport.zoom = customZoom;
viewport.zoom = ZoomLevel{ static_cast<int8_t>(customZoom) };
gCurrentRotation = customRotation;
}
else
+17 -15
View File
@@ -175,10 +175,10 @@ void viewport_create(rct_window* w, const ScreenCoordsXY& screenCoords, int32_t
viewport->pos = screenCoords;
viewport->width = width;
viewport->height = height;
const auto zoom = focus.zoom;
viewport->view_width = width << zoom;
viewport->view_height = height << zoom;
const auto zoom = focus.zoom;
viewport->view_width = width * zoom;
viewport->view_height = height * zoom;
viewport->zoom = zoom;
viewport->flags = 0;
@@ -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);
}
@@ -947,10 +947,10 @@ void viewport_paint(
const rct_viewport* viewport, rct_drawpixelinfo* dpi, const ScreenRect& screenRect,
std::vector<RecordedPaintSession>* recorded_sessions)
{
uint32_t viewFlags = viewport->flags;
const 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;
const uint32_t bitmask = viewport->zoom >= ZoomLevel{ 0 } ? 0xFFFFFFFF & (0xFFFFFFFF * viewport->zoom) : 0xFFFFFFFF;
ScreenCoordsXY topLeft = screenRect.Point1;
width &= bitmask;
@@ -978,7 +978,7 @@ 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 int32_t to avoid the loop becoming an infiniteloop.
// make sure, the compare operation is done in int32_t to avoid the loop becoming an infinite loop.
// this as well as the [x += 32] in the loop causes signed integer overflow -> undefined behaviour.
auto rightBorder = dpi1.x + dpi1.width;
auto alignedX = floor2(dpi1.x, 32);
@@ -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;
@@ -1976,10 +1976,12 @@ void viewport_set_saved_view()
ZoomLevel ZoomLevel::min()
{
#ifndef DISABLE_OPENGL
if (drawing_engine_get_type() == DrawingEngine::OpenGL)
{
return -2;
return ZoomLevel{ -2 };
}
#endif
return 0;
return ZoomLevel{ 0 };
}
+1 -1
View File
@@ -106,7 +106,7 @@ void viewport_init_all();
std::optional<ScreenCoordsXY> 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);
+17 -11
View File
@@ -1081,17 +1081,23 @@ void window_zoom_out(rct_window* w, bool atCursor)
void main_window_zoom(bool zoomIn, bool atCursor)
{
auto* mainWindow = window_get_main();
if (mainWindow != nullptr)
return;
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gEditorStep == EditorStep::LandscapeEditor)
{
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER))
{
auto* mainWindow = window_get_main();
if (mainWindow != nullptr)
window_zoom_set(mainWindow, mainWindow->viewport->zoom + (zoomIn ? -1 : 1), atCursor);
}
}
if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR && gEditorStep != EditorStep::LandscapeEditor)
return;
if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)
return;
if (zoomIn)
window_zoom_in(mainWindow, atCursor);
else
window_zoom_out(mainWindow, atCursor);
}
/**
@@ -1791,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;
+2 -2
View File
@@ -200,10 +200,10 @@ struct Focus
using CoordinateFocus = CoordsXYZ;
using EntityFocus = uint16_t;
uint8_t zoom = 0;
ZoomLevel zoom{};
std::variant<CoordinateFocus, EntityFocus> data;
template<typename T> constexpr explicit Focus(T newValue, uint8_t newZoom = 0)
template<typename T> constexpr explicit Focus(T newValue, ZoomLevel newZoom = {})
{
data = newValue;
zoom = newZoom;
+6 -29
View File
@@ -9,11 +9,6 @@
#include "ZoomLevel.h"
ZoomLevel::operator int8_t() const
{
return _level;
}
ZoomLevel ZoomLevel::operator++(int)
{
ZoomLevel tmp(*this);
@@ -70,32 +65,14 @@ ZoomLevel operator-(ZoomLevel lhs, const ZoomLevel& rhs)
return lhs;
}
bool operator==(const ZoomLevel& lhs, const ZoomLevel& rhs)
ZoomLevel operator+(ZoomLevel lhs, int8_t rhs)
{
return lhs._level == rhs._level;
lhs += ZoomLevel{ rhs };
return lhs;
}
bool operator!=(const ZoomLevel& lhs, const ZoomLevel& rhs)
ZoomLevel operator-(ZoomLevel lhs, int8_t rhs)
{
return lhs._level != rhs._level;
}
bool operator>=(const ZoomLevel& lhs, const ZoomLevel& rhs)
{
return lhs._level >= rhs._level;
}
bool operator<=(const ZoomLevel& lhs, const ZoomLevel& rhs)
{
return lhs._level <= rhs._level;
}
bool operator>(const ZoomLevel& lhs, const ZoomLevel& rhs)
{
return lhs._level > rhs._level;
}
bool operator<(const ZoomLevel& lhs, const ZoomLevel& rhs)
{
return lhs._level < rhs._level;
lhs -= ZoomLevel{ rhs };
return lhs;
}
+45 -9
View File
@@ -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,12 +44,14 @@ public:
friend ZoomLevel operator+(ZoomLevel lhs, const ZoomLevel& rhs);
friend ZoomLevel operator-(ZoomLevel lhs, const ZoomLevel& rhs);
friend bool operator==(const ZoomLevel& lhs, const ZoomLevel& rhs);
friend bool operator!=(const ZoomLevel& lhs, const ZoomLevel& rhs);
friend bool operator>=(const ZoomLevel& lhs, const ZoomLevel& rhs);
friend bool operator<=(const ZoomLevel& lhs, const ZoomLevel& rhs);
friend bool operator>(const ZoomLevel& lhs, const ZoomLevel& rhs);
friend bool operator<(const 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);
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);
template<typename T> friend T operator*(const T& lhs, const ZoomLevel& rhs)
{
@@ -67,6 +73,36 @@ public:
static constexpr ZoomLevel max()
{
return 3;
return ZoomLevel{ 3 };
}
};
constexpr bool operator==(const ZoomLevel& lhs, const ZoomLevel& rhs)
{
return lhs._level == rhs._level;
}
constexpr bool operator!=(const ZoomLevel& lhs, const ZoomLevel& rhs)
{
return lhs._level != rhs._level;
}
constexpr bool operator>=(const ZoomLevel& lhs, const ZoomLevel& rhs)
{
return lhs._level >= rhs._level;
}
constexpr bool operator<=(const ZoomLevel& lhs, const ZoomLevel& rhs)
{
return lhs._level <= rhs._level;
}
constexpr bool operator>(const ZoomLevel& lhs, const ZoomLevel& rhs)
{
return lhs._level > rhs._level;
}
constexpr bool operator<(const ZoomLevel& lhs, const ZoomLevel& rhs)
{
return lhs._level < rhs._level;
}
+1 -1
View File
@@ -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;
}
+3 -3
View File
@@ -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);
}
@@ -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;
@@ -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;
@@ -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;
@@ -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))
@@ -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]);
@@ -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 });
}
+1 -1
View File
@@ -2371,7 +2371,7 @@ namespace RCT1
void ImportSavedView()
{
gSavedView = ScreenCoordsXY{ _s4.view_x, _s4.view_y };
gSavedViewZoom = _s4.view_zoom;
gSavedViewZoom = ZoomLevel{ static_cast<int8_t>(_s4.view_zoom) };
gSavedViewRotation = _s4.view_rotation;
}
+1 -1
View File
@@ -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<int8_t>(_s6.saved_view_zoom) };
gSavedViewRotation = _s6.saved_view_rotation;
ImportRideRatingsCalcData();
+1 -1
View File
@@ -4588,7 +4588,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)
+5 -6
View File
@@ -2099,8 +2099,7 @@ void TrackDesignDrawPreview(TrackDesign* td6, uint8_t* pixels)
size_z = 0;
}
int32_t zoom_level = 1;
ZoomLevel zoom_level{ 1 };
if (size_x < size_y)
{
size_x = size_y;
@@ -2108,16 +2107,16 @@ 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;
size_y = 217 << zoom_level;
size_x = 370 * zoom_level;
size_y = 217 * zoom_level;
rct_viewport view;
view.width = 370;
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -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++)
+1 -1
View File
@@ -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++)
+1 -1
View File
@@ -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)
{
+1 -1
View File
@@ -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)
{
+2 -2
View File
@@ -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;
}
+1 -1
View File
@@ -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)
+2 -1
View File
@@ -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++)
{
@@ -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)
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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]);
+1 -1
View File
@@ -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)
{
+1 -1
View File
@@ -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...)
+4 -4
View File
@@ -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 });
}
/**