Update implicit zoom conversions

This commit is contained in:
Hielke Morsink committed 2021-12-01 00:08:35 +01:00
1 parent fdce5df6db
commit 53d9bfa8b4
54 files changed
+121 -107

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)
+4 -3
View File
@@ -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<ZoomLevel>(std::ceil(std::log(size / 80)) - 1, 0, ZoomLevel::max());
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);
}
+7 -7
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;
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;
}
+2 -3
View File
@@ -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)
+10 -10
View File
@@ -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 };
}
+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);
+2 -2
View File
@@ -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;
+12 -5
View File
@@ -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;
}
+9 -3
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,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 };
}
};
+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
@@ -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)
+3 -4
View File
@@ -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;
+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 });
}
/**