diff --git a/src/openrct2/drawing/Drawing.h b/src/openrct2/drawing/Drawing.h index 0b96ee5f34..0d5fe903ad 100644 --- a/src/openrct2/drawing/Drawing.h +++ b/src/openrct2/drawing/Drawing.h @@ -576,7 +576,7 @@ void scrolling_text_invalidate(); class Formatter; -int32_t scrolling_text_setup( +ImageId scrolling_text_setup( struct paint_session& session, StringId stringId, Formatter& ft, uint16_t scroll, uint16_t scrollingMode, colour_t colour); rct_size16 FASTCALL gfx_get_sprite_size(uint32_t image_id); diff --git a/src/openrct2/drawing/ScrollingText.cpp b/src/openrct2/drawing/ScrollingText.cpp index 2c830eba9d..7d2a88d240 100644 --- a/src/openrct2/drawing/ScrollingText.cpp +++ b/src/openrct2/drawing/ScrollingText.cpp @@ -1446,7 +1446,7 @@ void scrolling_text_invalidate() } } -int32_t scrolling_text_setup( +ImageId scrolling_text_setup( paint_session& session, StringId stringId, Formatter& ft, uint16_t scroll, uint16_t scrollingMode, colour_t colour) { std::scoped_lock lock(_scrollingTextMutex); @@ -1456,13 +1456,13 @@ int32_t scrolling_text_setup( rct_drawpixelinfo* dpi = &session.DPI; if (dpi->zoom_level > ZoomLevel{ 0 }) - return SPR_SCROLLING_TEXT_DEFAULT; + return ImageId(SPR_SCROLLING_TEXT_DEFAULT); _drawSCrollNextIndex++; ft.Rewind(); int32_t scrollIndex = scrolling_text_get_matching_or_oldest(stringId, ft, scroll, scrollingMode, colour); if (scrollIndex >= SPR_SCROLLING_TEXT_START) - return scrollIndex; + return ImageId(scrollIndex); // Setup scrolling text auto scrollText = &_drawScrollTextList[scrollIndex]; @@ -1491,7 +1491,7 @@ int32_t scrolling_text_setup( uint32_t imageId = SPR_SCROLLING_TEXT_START + scrollIndex; drawing_engine_invalidate_image(imageId); - return imageId; + return ImageId(imageId); } static void scrolling_text_set_bitmap_for_sprite( diff --git a/src/openrct2/entity/Balloon.cpp b/src/openrct2/entity/Balloon.cpp index d0cb58732e..1646712e41 100644 --- a/src/openrct2/entity/Balloon.cpp +++ b/src/openrct2/entity/Balloon.cpp @@ -119,6 +119,6 @@ void Balloon::Paint(paint_session& session, int32_t imageDirection) const imageId += 8; } - imageId = imageId | (colour << 19) | IMAGE_TYPE_REMAP; - PaintAddImageAsParent(session, imageId, { 0, 0, z }, { 1, 1, 0 }); + auto image = ImageId(imageId, colour); + PaintAddImageAsParent(session, image, { 0, 0, z }, { 1, 1, 0 }); } diff --git a/src/openrct2/entity/Duck.cpp b/src/openrct2/entity/Duck.cpp index a9d0b741d5..e2ecc11d76 100644 --- a/src/openrct2/entity/Duck.cpp +++ b/src/openrct2/entity/Duck.cpp @@ -376,6 +376,6 @@ void Duck::Paint(paint_session& session, int32_t imageDirection) const uint32_t imageId = GetFrameImage(imageDirection); if (imageId != 0) { - PaintAddImageAsParent(session, imageId, { 0, 0, z }, { 1, 1, 0 }); + PaintAddImageAsParent(session, ImageId(imageId), { 0, 0, z }, { 1, 1, 0 }); } } diff --git a/src/openrct2/entity/Litter.cpp b/src/openrct2/entity/Litter.cpp index 0b48db252b..d8c74208b2 100644 --- a/src/openrct2/entity/Litter.cpp +++ b/src/openrct2/entity/Litter.cpp @@ -188,5 +188,5 @@ void Litter::Paint(paint_session& session, int32_t imageDirection) const // In the following call to PaintAddImageAsParent, we add 4 (instead of 2) to the // bound_box_offset_z to make sure litter is drawn on top of railways - PaintAddImageAsParent(session, image_id, { 0, 0, z }, { 5, 5, -1 }, { -4, -4, z + 4 }); + PaintAddImageAsParent(session, ImageId(image_id), { 0, 0, z }, { 5, 5, -1 }, { -4, -4, z + 4 }); } diff --git a/src/openrct2/entity/Particle.cpp b/src/openrct2/entity/Particle.cpp index bd8f30c6cc..465cbfcd5a 100644 --- a/src/openrct2/entity/Particle.cpp +++ b/src/openrct2/entity/Particle.cpp @@ -162,8 +162,8 @@ void VehicleCrashParticle::Paint(paint_session& session, int32_t imageDirection) } uint32_t imageId = _VehicleCrashParticleSprites[crashed_sprite_base] + frame / 256; - imageId = imageId | (colour[0] << 19) | (colour[1] << 24) | IMAGE_TYPE_REMAP | IMAGE_TYPE_REMAP_2_PLUS; - PaintAddImageAsParent(session, imageId, { 0, 0, z }, { 1, 1, 0 }); + auto image = ImageId(imageId, colour[0], colour[1]); + PaintAddImageAsParent(session, image, { 0, 0, z }, { 1, 1, 0 }); } /** @@ -209,7 +209,7 @@ void CrashSplashParticle::Paint(paint_session& session, int32_t imageDirection) // TODO: Create constant in sprites.h uint32_t imageId = 22927 + (frame / 256); - PaintAddImageAsParent(session, imageId, { 0, 0, z }, { 1, 1, 0 }); + PaintAddImageAsParent(session, ImageId(imageId), { 0, 0, z }, { 1, 1, 0 }); } /** @@ -268,7 +268,7 @@ void SteamParticle::Paint(paint_session& session, int32_t imageDirection) const // TODO: Create constant in sprites.h uint32_t imageId = 22637 + (frame / 256); - PaintAddImageAsParent(session, imageId, { 0, 0, z }, { 1, 1, 0 }); + PaintAddImageAsParent(session, ImageId(imageId), { 0, 0, z }, { 1, 1, 0 }); } /** @@ -313,7 +313,7 @@ void ExplosionCloud::Paint(paint_session& session, int32_t imageDirection) const PROFILED_FUNCTION(); uint32_t imageId = 22878 + (frame / 256); - PaintAddImageAsParent(session, imageId, { 0, 0, z }, { 1, 1, 0 }); + PaintAddImageAsParent(session, ImageId(imageId), { 0, 0, z }, { 1, 1, 0 }); } /** @@ -359,5 +359,5 @@ void ExplosionFlare::Paint(paint_session& session, int32_t imageDirection) const // TODO: Create constant in sprites.h uint32_t imageId = 22896 + (frame / 256); - PaintAddImageAsParent(session, imageId, { 0, 0, z }, { 1, 1, 0 }); + PaintAddImageAsParent(session, ImageId(imageId), { 0, 0, z }, { 1, 1, 0 }); } diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index 370e7db5db..baaf5f0681 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -2798,7 +2798,7 @@ void Peep::Paint(paint_session& session, int32_t imageDirection) const // In the following 4 calls to PaintAddImageAsParent/PaintAddImageAsChild, we add 5 (instead of 3) to the // bound_box_offset_z to make sure peeps are drawn on top of railways uint32_t baseImageId = (imageDirection >> 3) + GetPeepAnimation(SpriteType, actionSpriteType).base_image + imageOffset * 4; - uint32_t imageId = baseImageId | TshirtColour << 19 | TrousersColour << 24 | IMAGE_TYPE_REMAP | IMAGE_TYPE_REMAP_2_PLUS; + auto imageId = ImageId(baseImageId, TshirtColour, TrousersColour); PaintAddImageAsParent(session, imageId, { 0, 0, z }, { 1, 1, 11 }, { 0, 0, z + 5 }); auto* guest = As(); @@ -2806,21 +2806,21 @@ void Peep::Paint(paint_session& session, int32_t imageDirection) const { if (baseImageId >= 10717 && baseImageId < 10749) { - imageId = (baseImageId + 32) | guest->HatColour << 19 | IMAGE_TYPE_REMAP; + imageId = ImageId(baseImageId + 32, guest->HatColour); PaintAddImageAsChild(session, imageId, { 0, 0, z }, { 1, 1, 11 }, { 0, 0, z + 5 }); return; } if (baseImageId >= 10781 && baseImageId < 10813) { - imageId = (baseImageId + 32) | guest->BalloonColour << 19 | IMAGE_TYPE_REMAP; + imageId = ImageId(baseImageId + 32, guest->BalloonColour); PaintAddImageAsChild(session, imageId, { 0, 0, z }, { 1, 1, 11 }, { 0, 0, z + 5 }); return; } if (baseImageId >= 11197 && baseImageId < 11229) { - imageId = (baseImageId + 32) | guest->UmbrellaColour << 19 | IMAGE_TYPE_REMAP; + imageId = ImageId(baseImageId + 32, guest->UmbrellaColour); PaintAddImageAsChild(session, imageId, { 0, 0, z }, { 1, 1, 11 }, { 0, 0, z + 5 }); return; } diff --git a/src/openrct2/paint/Paint.cpp b/src/openrct2/paint/Paint.cpp index 1d3f8ec7f8..52f1803842 100644 --- a/src/openrct2/paint/Paint.cpp +++ b/src/openrct2/paint/Paint.cpp @@ -688,22 +688,16 @@ void PaintSessionFree([[maybe_unused]] paint_session* session) * @return (ebp) paint_struct on success (CF == 0), nullptr on failure (CF == 1) */ paint_struct* PaintAddImageAsParent( - paint_session& session, uint32_t image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize) + paint_session& session, const ImageId& image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize) { - return PaintAddImageAsParent(session, ImageId::FromUInt32(image_id), offset, { offset, boundBoxSize }); + return PaintAddImageAsParent(session, image_id, offset, { offset, boundBoxSize }); } paint_struct* PaintAddImageAsParent( - paint_session& session, uint32_t image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize, + paint_session& session, const ImageId& image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize, const CoordsXYZ& boundBoxOffset) { - return PaintAddImageAsParent(session, ImageId::FromUInt32(image_id), offset, { boundBoxOffset, boundBoxSize }); -} - -paint_struct* PaintAddImageAsParent( - paint_session& session, ImageId imageId, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize) -{ - return PaintAddImageAsParent(session, imageId, offset, { offset, boundBoxSize }); + return PaintAddImageAsParent(session, image_id, offset, { boundBoxOffset, boundBoxSize }); } /** @@ -723,7 +717,7 @@ paint_struct* PaintAddImageAsParent( */ // Track Pieces, Shops. paint_struct* PaintAddImageAsParent( - paint_session& session, ImageId image_id, const CoordsXYZ& offset, const BoundBoxXYZ& boundBox) + paint_session& session, const ImageId& image_id, const CoordsXYZ& offset, const BoundBoxXYZ& boundBox) { session.LastPS = nullptr; session.LastAttachedPS = nullptr; @@ -739,13 +733,6 @@ paint_struct* PaintAddImageAsParent( return ps; } -paint_struct* PaintAddImageAsParent( - paint_session& session, ImageId image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize, - const CoordsXYZ& boundBoxOffset) -{ - return PaintAddImageAsParent(session, image_id, offset, { boundBoxOffset, boundBoxSize }); -} - /** * * rct2: 0x00686EF0, 0x00687056, 0x006871C8, 0x0068733C, 0x0098198C @@ -764,7 +751,7 @@ paint_struct* PaintAddImageAsParent( * Creates a paint struct but does not allocate to a paint quadrant. Result cannot be ignored! */ [[nodiscard]] paint_struct* PaintAddImageAsOrphan( - paint_session& session, ImageId imageId, const CoordsXYZ& offset, const BoundBoxXYZ& boundBox) + paint_session& session, const ImageId& imageId, const CoordsXYZ& offset, const BoundBoxXYZ& boundBox) { session.LastPS = nullptr; session.LastAttachedPS = nullptr; @@ -772,14 +759,7 @@ paint_struct* PaintAddImageAsParent( } paint_struct* PaintAddImageAsChild( - paint_session& session, uint32_t image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxLength, - const CoordsXYZ& boundBoxOffset) -{ - return PaintAddImageAsChild(session, ImageId::FromUInt32(image_id), offset, { boundBoxOffset, boundBoxLength }); -} - -paint_struct* PaintAddImageAsChild( - paint_session& session, ImageId imageId, const CoordsXYZ& offset, const CoordsXYZ& boundBoxLength, + paint_session& session, const ImageId& imageId, const CoordsXYZ& offset, const CoordsXYZ& boundBoxLength, const CoordsXYZ& boundBoxOffset) { return PaintAddImageAsChild(session, imageId, offset, { boundBoxOffset, boundBoxLength }); @@ -803,7 +783,7 @@ paint_struct* PaintAddImageAsChild( * If there is no parent paint struct then image is added as a parent */ paint_struct* PaintAddImageAsChild( - paint_session& session, ImageId image_id, const CoordsXYZ& offset, const BoundBoxXYZ& boundBox) + paint_session& session, const ImageId& image_id, const CoordsXYZ& offset, const BoundBoxXYZ& boundBox) { paint_struct* parentPS = session.LastPS; if (parentPS == nullptr) @@ -830,7 +810,7 @@ paint_struct* PaintAddImageAsChild( * @param y (cx) * @return (!CF) success */ -bool PaintAttachToPreviousAttach(paint_session& session, ImageId imageId, int32_t x, int32_t y) +bool PaintAttachToPreviousAttach(paint_session& session, const ImageId& imageId, int32_t x, int32_t y) { auto* previousAttachedPS = session.LastAttachedPS; if (previousAttachedPS == nullptr) @@ -863,12 +843,7 @@ bool PaintAttachToPreviousAttach(paint_session& session, ImageId imageId, int32_ * @param y (cx) * @return (!CF) success */ -bool PaintAttachToPreviousPS(paint_session& session, uint32_t image_id, int32_t x, int32_t y) -{ - return PaintAttachToPreviousPS(session, ImageId::FromUInt32(image_id), x, y); -} - -bool PaintAttachToPreviousPS(paint_session& session, ImageId image_id, int32_t x, int32_t y) +bool PaintAttachToPreviousPS(paint_session& session, const ImageId& image_id, int32_t x, int32_t y) { auto* masterPs = session.LastPS; if (masterPs == nullptr) diff --git a/src/openrct2/paint/Paint.h b/src/openrct2/paint/Paint.h index 7350138c96..02dfebba49 100644 --- a/src/openrct2/paint/Paint.h +++ b/src/openrct2/paint/Paint.h @@ -296,27 +296,19 @@ extern bool gPaintBlockedTiles; extern bool gPaintWidePathsAsGhost; paint_struct* PaintAddImageAsParent( - paint_session& session, uint32_t image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize); + paint_session& session, const ImageId& image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize); paint_struct* PaintAddImageAsParent( - paint_session& session, uint32_t image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize, + paint_session& session, const ImageId& image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize, const CoordsXYZ& boundBoxOffset); paint_struct* PaintAddImageAsParent( - paint_session& session, ImageId imageId, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize); -paint_struct* PaintAddImageAsParent( - paint_session& session, ImageId image_id, const CoordsXYZ& offset, const BoundBoxXYZ& boundBox); -paint_struct* PaintAddImageAsParent( - paint_session& session, ImageId image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize, - const CoordsXYZ& boundBoxOffset); + paint_session& session, const ImageId& image_id, const CoordsXYZ& offset, const BoundBoxXYZ& boundBox); [[nodiscard]] paint_struct* PaintAddImageAsOrphan( - paint_session& session, ImageId image_id, const CoordsXYZ& offset, const BoundBoxXYZ& boundBox); + paint_session& session, const ImageId& image_id, const CoordsXYZ& offset, const BoundBoxXYZ& boundBox); paint_struct* PaintAddImageAsChild( - paint_session& session, uint32_t image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxLength, + paint_session& session, const ImageId& image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxLength, const CoordsXYZ& boundBoxOffset); paint_struct* PaintAddImageAsChild( - paint_session& session, ImageId imageId, const CoordsXYZ& offset, const CoordsXYZ& boundBoxLength, - const CoordsXYZ& boundBoxOffset); -paint_struct* PaintAddImageAsChild( - paint_session& session, ImageId image_id, const CoordsXYZ& offset, const BoundBoxXYZ& boundBox); + paint_session& session, const ImageId& image_id, const CoordsXYZ& offset, const BoundBoxXYZ& boundBox); paint_struct* PaintAddImageAsChildRotated( paint_session& session, const uint8_t direction, const ImageId& image_id, const CoordsXYZ& offset, @@ -324,21 +316,14 @@ paint_struct* PaintAddImageAsChildRotated( paint_struct* PaintAddImageAsParentRotated( paint_session& session, const uint8_t direction, const ImageId& image_id, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize); -paint_struct* PaintAddImageAsParentRotated( - paint_session& session, const uint8_t direction, const uint32_t image_id, const CoordsXYZ& offset, - const CoordsXYZ& boundBoxSize); paint_struct* PaintAddImageAsParentRotated( paint_session& session, const uint8_t direction, const ImageId& imageId, const CoordsXYZ& offset, const CoordsXYZ& boundBoxSize, const CoordsXYZ& boundBoxOffset); -paint_struct* PaintAddImageAsParentRotated( - paint_session& session, const uint8_t direction, const uint32_t image_id, const CoordsXYZ& offset, - const CoordsXYZ& boundBoxSize, const CoordsXYZ& boundBoxOffset); void paint_util_push_tunnel_rotated(paint_session& session, uint8_t direction, uint16_t height, uint8_t type); -bool PaintAttachToPreviousAttach(paint_session& session, ImageId imageId, int32_t x, int32_t y); -bool PaintAttachToPreviousPS(paint_session& session, ImageId image_id, int32_t x, int32_t y); -bool PaintAttachToPreviousPS(paint_session& session, uint32_t image_id, int32_t x, int32_t y); +bool PaintAttachToPreviousAttach(paint_session& session, const ImageId& imageId, int32_t x, int32_t y); +bool PaintAttachToPreviousPS(paint_session& session, const ImageId& image_id, int32_t x, int32_t y); void PaintFloatingMoneyEffect( paint_session& session, money64 amount, StringId string_id, int32_t y, int32_t z, int8_t y_offsets[], int32_t offset_x, uint32_t rotation); diff --git a/src/openrct2/paint/VirtualFloor.cpp b/src/openrct2/paint/VirtualFloor.cpp index 0ae25c522f..1a4e74acfc 100644 --- a/src/openrct2/paint/VirtualFloor.cpp +++ b/src/openrct2/paint/VirtualFloor.cpp @@ -363,9 +363,9 @@ void virtual_floor_paint(paint_session& session) } } - uint32_t remap_base = SPRITE_ID_PALETTE_COLOUR_1(COLOUR_DARK_PURPLE); - uint32_t remap_edge = SPRITE_ID_PALETTE_COLOUR_1(COLOUR_WHITE); - uint32_t remap_lit = SPRITE_ID_PALETTE_COLOUR_1(COLOUR_DARK_BROWN); + const ImageId remap_base = ImageId(0, COLOUR_DARK_PURPLE); + const ImageId remap_edge = ImageId(0, COLOUR_WHITE); + const ImageId remap_lit = ImageId(0, COLOUR_DARK_BROWN); // Edges which are internal to objects (i.e., the tile on both sides // is occupied/lit) are not rendered to provide visual clarity. @@ -375,35 +375,31 @@ void virtual_floor_paint(paint_session& session) const auto virtualFloorOffset = CoordsXYZ{ 0, 0, _virtualFloorHeight }; if (paintEdges & EDGE_NE) { + const auto baseImg = !(occupiedEdges & EDGE_NE) ? ((litEdges & EDGE_NE) ? remap_lit : remap_base) : remap_edge; PaintAddImageAsParent( - session, - SPR_G2_SELECTION_EDGE_NE - | (!(occupiedEdges & EDGE_NE) ? ((litEdges & EDGE_NE) ? remap_lit : remap_base) : remap_edge), - virtualFloorOffset, { 0, 0, 1 }, { 5, 5, _virtualFloorHeight + ((dullEdges & EDGE_NE) ? -2 : 0) }); + session, baseImg.WithIndex(SPR_G2_SELECTION_EDGE_NE), virtualFloorOffset, { 0, 0, 1 }, + { 5, 5, _virtualFloorHeight + ((dullEdges & EDGE_NE) ? -2 : 0) }); } if (paintEdges & EDGE_SE) { + const auto baseImg = !(occupiedEdges & EDGE_SE) ? ((litEdges & EDGE_SE) ? remap_lit : remap_base) : remap_edge; PaintAddImageAsParent( - session, - SPR_G2_SELECTION_EDGE_SE - | (!(occupiedEdges & EDGE_SE) ? ((litEdges & EDGE_SE) ? remap_lit : remap_base) : remap_edge), - virtualFloorOffset, { 1, 1, 1 }, { 16, 27, _virtualFloorHeight + ((dullEdges & EDGE_SE) ? -2 : 0) }); + session, baseImg.WithIndex(SPR_G2_SELECTION_EDGE_SE), virtualFloorOffset, { 1, 1, 1 }, + { 16, 27, _virtualFloorHeight + ((dullEdges & EDGE_SE) ? -2 : 0) }); } if (paintEdges & EDGE_SW) { + const auto baseImg = !(occupiedEdges & EDGE_SW) ? ((litEdges & EDGE_SW) ? remap_lit : remap_base) : remap_edge; PaintAddImageAsParent( - session, - SPR_G2_SELECTION_EDGE_SW - | (!(occupiedEdges & EDGE_SW) ? ((litEdges & EDGE_SW) ? remap_lit : remap_base) : remap_edge), - virtualFloorOffset, { 1, 1, 1 }, { 27, 16, _virtualFloorHeight + ((dullEdges & EDGE_SW) ? -2 : 0) }); + session, baseImg.WithIndex(SPR_G2_SELECTION_EDGE_SW), virtualFloorOffset, { 1, 1, 1 }, + { 27, 16, _virtualFloorHeight + ((dullEdges & EDGE_SW) ? -2 : 0) }); } if (paintEdges & EDGE_NW) { + const auto baseImg = !(occupiedEdges & EDGE_NW) ? ((litEdges & EDGE_NW) ? remap_lit : remap_base) : remap_edge; PaintAddImageAsParent( - session, - SPR_G2_SELECTION_EDGE_NW - | (!(occupiedEdges & EDGE_NW) ? ((litEdges & EDGE_NW) ? remap_lit : remap_base) : remap_edge), - virtualFloorOffset, { 0, 0, 1 }, { 5, 5, _virtualFloorHeight + ((dullEdges & EDGE_NW) ? -2 : 0) }); + session, baseImg.WithIndex(SPR_G2_SELECTION_EDGE_NW), virtualFloorOffset, { 0, 0, 1 }, + { 5, 5, _virtualFloorHeight + ((dullEdges & EDGE_NW) ? -2 : 0) }); } if (gConfigGeneral.virtual_floor_style != VirtualFloorStyles::Glassy) @@ -411,8 +407,7 @@ void virtual_floor_paint(paint_session& session) if (!weAreOccupied && !weAreLit && weAreAboveGround && weAreOwned) { - int32_t imageColourFlats = SPR_G2_SURFACE_GLASSY_RECOLOURABLE | IMAGE_TYPE_REMAP | IMAGE_TYPE_TRANSPARENT - | EnumValue(FilterPaletteID::PaletteWater) << 19; + auto imageColourFlats = ImageId(SPR_G2_SURFACE_GLASSY_RECOLOURABLE, FilterPaletteID::PaletteWater).WithBlended(true); PaintAddImageAsParent(session, imageColourFlats, virtualFloorOffset, { 30, 30, 0 }, { 2, 2, _virtualFloorHeight - 3 }); } } diff --git a/src/openrct2/paint/tile_element/Paint.Entrance.cpp b/src/openrct2/paint/tile_element/Paint.Entrance.cpp index dd8f887a4d..ae1ff7d934 100644 --- a/src/openrct2/paint/tile_element/Paint.Entrance.cpp +++ b/src/openrct2/paint/tile_element/Paint.Entrance.cpp @@ -246,7 +246,7 @@ static void PaintParkEntranceScrollingText( auto imageIndex = scrolling_text_setup( session, STR_BANNER_TEXT_FORMAT, ft, scroll, scrollingMode + direction / 2, COLOUR_BLACK); auto textHeight = height + entrance.GetTextHeight(); - PaintAddImageAsChild(session, ImageId(imageIndex), { 0, 0, textHeight }, { { 2, 2, textHeight }, { 28, 28, 47 } }); + PaintAddImageAsChild(session, imageIndex, { 0, 0, textHeight }, { { 2, 2, textHeight }, { 28, 28, 47 } }); } static void PaintParkEntranceLightEffects(paint_session& session) diff --git a/src/openrct2/paint/tile_element/Paint.Surface.cpp b/src/openrct2/paint/tile_element/Paint.Surface.cpp index 66824fe54d..5221ec8d22 100644 --- a/src/openrct2/paint/tile_element/Paint.Surface.cpp +++ b/src/openrct2/paint/tile_element/Paint.Surface.cpp @@ -535,7 +535,7 @@ static void viewport_surface_smoothen_edge( return; } - const uint32_t image_id = maskImageBase + byte_97B444[self.slope]; + const auto image_id = ImageId(maskImageBase + byte_97B444[self.slope]); if (PaintAttachToPreviousPS(session, image_id, 0, 0)) { @@ -1092,17 +1092,17 @@ void PaintSurface(paint_session& session, uint8_t direction, uint16_t height, co image_id += get_height_marker_offset(); image_id -= gMapBaseZ; - PaintAddImageAsParent(session, image_id, { 16, 16, surfaceHeight }, { 1, 1, 0 }); + PaintAddImageAsParent(session, ImageId(image_id), { 16, 16, surfaceHeight }, { 1, 1, 0 }); } bool has_surface = false; if (session.VerticalTunnelHeight * COORDS_Z_PER_TINY_Z == height) { // Vertical tunnels - PaintAddImageAsParent(session, 1575, { 0, 0, height }, { 1, 30, 39 }, { -2, 1, height - 40 }); - PaintAddImageAsParent(session, 1576, { 0, 0, height }, { 30, 1, 0 }, { 1, 31, height }); - PaintAddImageAsParent(session, 1577, { 0, 0, height }, { 1, 30, 0 }, { 31, 1, height }); - PaintAddImageAsParent(session, 1578, { 0, 0, height }, { 30, 1, 39 }, { 1, -2, height - 40 }); + PaintAddImageAsParent(session, ImageId(1575), { 0, 0, height }, { 1, 30, 39 }, { -2, 1, height - 40 }); + PaintAddImageAsParent(session, ImageId(1576), { 0, 0, height }, { 30, 1, 0 }, { 1, 31, height }); + PaintAddImageAsParent(session, ImageId(1577), { 0, 0, height }, { 1, 30, 0 }, { 31, 1, height }); + PaintAddImageAsParent(session, ImageId(1578), { 0, 0, height }, { 30, 1, 39 }, { 1, -2, height - 40 }); } else { @@ -1154,10 +1154,10 @@ void PaintSurface(paint_session& session, uint8_t direction, uint16_t height, co { if ((spawn.x & 0xFFE0) == pos.x && (spawn.y & 0xFFE0) == pos.y) { - PaintAddImageAsParent(session, SPR_TERRAIN_SELECTION_SQUARE_SIMPLE, { 0, 0, spawn.z }, { 32, 32, 16 }); + PaintAddImageAsParent(session, ImageId(SPR_TERRAIN_SELECTION_SQUARE_SIMPLE), { 0, 0, spawn.z }, { 32, 32, 16 }); const int32_t offset = (direction_reverse(spawn.direction) + rotation) & 3; - const uint32_t image_id = (PEEP_SPAWN_ARROW_0 + offset) | 0x20380000; + const auto image_id = ImageId(PEEP_SPAWN_ARROW_0 + offset, COLOUR_LIGHT_BLUE); PaintAddImageAsParent(session, image_id, { 0, 0, spawn.z }, { 32, 32, 19 }); } } @@ -1169,14 +1169,14 @@ void PaintSurface(paint_session& session, uint8_t direction, uint16_t height, co if (tileElement.GetOwnership() & OWNERSHIP_OWNED) { assert(surfaceShape < std::size(byte_97B444)); - PaintAttachToPreviousPS(session, SPR_TERRAIN_SELECTION_SQUARE + byte_97B444[surfaceShape], 0, 0); + PaintAttachToPreviousPS(session, ImageId(SPR_TERRAIN_SELECTION_SQUARE + byte_97B444[surfaceShape]), 0, 0); } else if (tileElement.GetOwnership() & OWNERSHIP_AVAILABLE) { const CoordsXY& pos = session.MapPosition; const int32_t height2 = (tile_element_height({ pos.x + 16, pos.y + 16 })) + 3; paint_struct* backup = session.LastPS; - PaintAddImageAsParent(session, SPR_LAND_OWNERSHIP_AVAILABLE, { 16, 16, height2 }, { 1, 1, 0 }); + PaintAddImageAsParent(session, ImageId(SPR_LAND_OWNERSHIP_AVAILABLE), { 16, 16, height2 }, { 1, 1, 0 }); session.LastPS = backup; } } @@ -1186,14 +1186,15 @@ void PaintSurface(paint_session& session, uint8_t direction, uint16_t height, co if (tileElement.GetOwnership() & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED) { assert(surfaceShape < std::size(byte_97B444)); - PaintAttachToPreviousPS(session, SPR_TERRAIN_SELECTION_DOTTED + byte_97B444[surfaceShape], 0, 0); + PaintAttachToPreviousPS(session, ImageId(SPR_TERRAIN_SELECTION_DOTTED + byte_97B444[surfaceShape]), 0, 0); } else if (tileElement.GetOwnership() & OWNERSHIP_CONSTRUCTION_RIGHTS_AVAILABLE) { const CoordsXY& pos = session.MapPosition; const int32_t height2 = tile_element_height({ pos.x + 16, pos.y + 16 }); paint_struct* backup = session.LastPS; - PaintAddImageAsParent(session, SPR_LAND_CONSTRUCTION_RIGHTS_AVAILABLE, { 16, 16, height2 + 3 }, { 1, 1, 0 }); + PaintAddImageAsParent( + session, ImageId(SPR_LAND_CONSTRUCTION_RIGHTS_AVAILABLE), { 16, 16, height2 + 3 }, { 1, 1, 0 }); session.LastPS = backup; } } @@ -1214,16 +1215,17 @@ void PaintSurface(paint_session& session, uint8_t direction, uint16_t height, co { // Walls // loc_661089: - const uint32_t eax = ((((mapSelectionType - 9) + rotation) & 3) + 0x21) << 19; - const uint32_t image_id = (SPR_TERRAIN_SELECTION_EDGE + byte_97B444[surfaceShape]) | eax | IMAGE_TYPE_REMAP; + const auto fpId = static_cast((((mapSelectionType - 9) + rotation) & 3) + 0x21); + const auto image_id = ImageId(SPR_TERRAIN_SELECTION_EDGE + byte_97B444[surfaceShape], fpId); PaintAttachToPreviousPS(session, image_id, 0, 0); } else if (mapSelectionType >= MAP_SELECT_TYPE_QUARTER_0) { // loc_661051:(no jump) // Selection split into four quarter segments - const uint32_t eax = ((((mapSelectionType - MAP_SELECT_TYPE_QUARTER_0) + rotation) & 3) + 0x27) << 19; - const uint32_t image_id = (SPR_TERRAIN_SELECTION_QUARTER + byte_97B444[surfaceShape]) | eax | IMAGE_TYPE_REMAP; + const auto fpId = static_cast( + (((mapSelectionType - MAP_SELECT_TYPE_QUARTER_0) + rotation) & 3) + 0x27); + const auto image_id = ImageId(SPR_TERRAIN_SELECTION_QUARTER + byte_97B444[surfaceShape], fpId); PaintAttachToPreviousPS(session, image_id, 0, 0); } else if (mapSelectionType <= MAP_SELECT_TYPE_FULL) @@ -1235,8 +1237,8 @@ void PaintSurface(paint_session& session, uint8_t direction, uint16_t height, co eax = (mapSelectionType + rotation) & 3; } - eax = (eax + 0x21) << 19; - const uint32_t image_id = (SPR_TERRAIN_SELECTION_CORNER + byte_97B444[surfaceShape]) | eax | IMAGE_TYPE_REMAP; + const auto fpId = static_cast(eax + 0x21); + const auto image_id = ImageId(SPR_TERRAIN_SELECTION_CORNER + byte_97B444[surfaceShape], fpId); PaintAttachToPreviousPS(session, image_id, 0, 0); } else @@ -1244,7 +1246,8 @@ void PaintSurface(paint_session& session, uint8_t direction, uint16_t height, co // The water tool should draw its grid _on_ the water, rather than on the surface under water. auto [local_height, local_surfaceShape] = surface_get_height_above_water(tileElement, height, surfaceShape); - const int32_t image_id = (SPR_TERRAIN_SELECTION_CORNER + byte_97B444[local_surfaceShape]) | 0x21300000; + const auto fpId = static_cast(38); + const auto image_id = ImageId(SPR_TERRAIN_SELECTION_CORNER + byte_97B444[local_surfaceShape], fpId); paint_struct* backup = session.LastPS; PaintAddImageAsParent(session, image_id, { 0, 0, local_height }, { 32, 32, 1 }); @@ -1264,13 +1267,14 @@ void PaintSurface(paint_session& session, uint8_t direction, uint16_t height, co continue; } - uint32_t colours = COLOUR_GREY << 24 | COLOUR_BRIGHT_PURPLE << 19; + colour_t colour1 = COLOUR_BRIGHT_PURPLE; + colour_t colour2 = COLOUR_GREY; if (gMapSelectFlags & MAP_SELECT_FLAG_GREEN) { - colours = COLOUR_GREY << 24 | COLOUR_SATURATED_GREEN << 19; + colour1 = COLOUR_SATURATED_GREEN; } - const uint32_t image_id = (SPR_TERRAIN_SELECTION_CORNER + byte_97B444[surfaceShape]) | colours | IMAGE_TYPE_REMAP; + const auto image_id = ImageId(SPR_TERRAIN_SELECTION_CORNER + byte_97B444[surfaceShape], colour1, colour2); PaintAttachToPreviousPS(session, image_id, 0, 0); break; } @@ -1327,13 +1331,12 @@ void PaintSurface(paint_session& session, uint8_t direction, uint16_t height, co image_offset = byte_97B740[surfaceShape & 0xF]; } - const int32_t image_id = (SPR_WATER_MASK + image_offset) | IMAGE_TYPE_REMAP | IMAGE_TYPE_TRANSPARENT - | EnumValue(FilterPaletteID::PaletteWater) << 19; + const auto image_id = ImageId(SPR_WATER_MASK + image_offset, FilterPaletteID::PaletteWater).WithBlended(true); PaintAddImageAsParent(session, image_id, { 0, 0, waterHeight }, { 32, 32, -1 }); const bool transparent = gConfigGeneral.transparent_water || (session.ViewFlags & VIEWPORT_FLAG_UNDERGROUND_INSIDE); const uint32_t overlayStart = transparent ? SPR_WATER_OVERLAY : SPR_RCT1_WATER_OVERLAY; - PaintAttachToPreviousPS(session, overlayStart + image_offset, 0, 0); + PaintAttachToPreviousPS(session, ImageId(overlayStart + image_offset), 0, 0); if (!(session.ViewFlags & VIEWPORT_FLAG_HIDE_VERTICAL)) { @@ -1408,7 +1411,7 @@ void PaintSurface(paint_session& session, uint8_t direction, uint16_t height, co } PaintAddImageAsParent( - session, image_id, { fenceData.offset, local_height }, { fenceData.Boundbox.length, 9 }, + session, ImageId(image_id), { fenceData.offset, local_height }, { fenceData.Boundbox.length, 9 }, { fenceData.Boundbox.offset, local_height + 1 }); } } diff --git a/src/openrct2/paint/tile_element/Paint.TileElement.cpp b/src/openrct2/paint/tile_element/Paint.TileElement.cpp index a965173a83..172087fe8b 100644 --- a/src/openrct2/paint/tile_element/Paint.TileElement.cpp +++ b/src/openrct2/paint/tile_element/Paint.TileElement.cpp @@ -104,7 +104,7 @@ static void blank_tiles_paint(paint_session& session, int32_t x, int32_t y) session.SpritePosition.x = x; session.SpritePosition.y = y; session.InteractionType = ViewportInteractionItem::None; - PaintAddImageAsParent(session, SPR_BLANK_TILE, { 0, 0, 16 }, { 32, 32, -1 }); + PaintAddImageAsParent(session, ImageId(SPR_BLANK_TILE), { 0, 0, 16 }, { 32, 32, -1 }); } bool gShowSupportSegmentHeights = false; @@ -315,12 +315,12 @@ static void PaintTileElementBase(paint_session& session, const CoordsXY& origCoo for (int32_t sx = 0; sx < 3; sx++) { uint16_t segmentHeight = session.SupportSegments[segmentPositions[sy][sx]].height; - int32_t imageColourFlats = 0b101111 << 19 | IMAGE_TYPE_TRANSPARENT; + auto imageColourFlats = ImageId(0, FilterPaletteID::PaletteDarken3); if (segmentHeight == 0xFFFF) { segmentHeight = session.Support.height; // white: 0b101101 - imageColourFlats = 0b111011 << 19 | IMAGE_TYPE_TRANSPARENT; + imageColourFlats = ImageId(0, FilterPaletteID::PaletteTranslucentBordeauxRedHighlight); } // Only draw supports below the clipping height. @@ -330,7 +330,7 @@ static void PaintTileElementBase(paint_session& session, const CoordsXY& origCoo int32_t xOffset = sy * 10; int32_t yOffset = -22 + sx * 10; paint_struct* ps = PaintAddImageAsParent( - session, 5504 | imageColourFlats, { xOffset, yOffset, segmentHeight }, { 10, 10, 1 }, + session, imageColourFlats.WithIndex(SPR_LAND_TOOL_SIZE_1), { xOffset, yOffset, segmentHeight }, { 10, 10, 1 }, { xOffset + 1, yOffset + 16, segmentHeight }); if (ps != nullptr) { diff --git a/src/openrct2/ride/VehiclePaint.cpp b/src/openrct2/ride/VehiclePaint.cpp index 1b9c37cbef..ad0458a85d 100644 --- a/src/openrct2/ride/VehiclePaint.cpp +++ b/src/openrct2/ride/VehiclePaint.cpp @@ -3613,7 +3613,7 @@ static void vehicle_visual_splash1_effect(paint_session& session, int32_t z, con } int32_t image_id = 29014 + ((((vehicle->sprite_direction / 8) + session.CurrentRotation) & 3) * 8) + ((gCurrentTicks / 2) & 7); - PaintAddImageAsChild(session, image_id, { 0, 0, z }, { 0, 0, 0 }, { 0, 0, z }); + PaintAddImageAsChild(session, ImageId(image_id), { 0, 0, z }, { 0, 0, 0 }, { 0, 0, z }); } /** @@ -3636,7 +3636,7 @@ static void vehicle_visual_splash2_effect(paint_session& session, int32_t z, con } int32_t image_id = 29046 + ((((vehicle->sprite_direction / 8) + session.CurrentRotation) & 3) * 8) + ((gCurrentTicks / 2) & 7); - PaintAddImageAsChild(session, image_id, { 0, 0, z }, { 0, 0, 0 }, { 0, 0, z }); + PaintAddImageAsChild(session, ImageId(image_id), { 0, 0, z }, { 0, 0, 0 }, { 0, 0, z }); } /** @@ -3659,7 +3659,7 @@ static void vehicle_visual_splash3_effect(paint_session& session, int32_t z, con } int32_t image_id = 29014 + ((((vehicle->sprite_direction / 8) + session.CurrentRotation) & 3) * 8) + ((gCurrentTicks / 2) & 7); - PaintAddImageAsChild(session, image_id, { 0, 0, z }, { 0, 0, 0 }, { 0, 0, z }); + PaintAddImageAsChild(session, ImageId(image_id), { 0, 0, z }, { 0, 0, 0 }, { 0, 0, z }); } /** @@ -3687,7 +3687,7 @@ static void vehicle_visual_splash4_effect(paint_session& session, int32_t z, con } int32_t image_id = 29078 + ((((vehicle->sprite_direction / 8) + session.CurrentRotation) & 3) * 8) + ((gCurrentTicks / 2) & 7); - PaintAddImageAsChild(session, image_id, { 0, 0, z }, { 1, 1, 0 }, { 0, 0, z }); + PaintAddImageAsChild(session, ImageId(image_id), { 0, 0, z }, { 1, 1, 0 }, { 0, 0, z }); } /** @@ -3719,7 +3719,7 @@ static void vehicle_visual_splash5_effect(paint_session& session, int32_t z, con } int32_t image_id = 29078 + ((((vehicle->sprite_direction / 8) + session.CurrentRotation) & 3) * 8) + ((gCurrentTicks / 2) & 7); - PaintAddImageAsChild(session, image_id, { 0, 0, z }, { 1, 1, 0 }, { 0, 0, z }); + PaintAddImageAsChild(session, ImageId(image_id), { 0, 0, z }, { 1, 1, 0 }, { 0, 0, z }); } void vehicle_visual_splash_effect(paint_session& session, int32_t z, const Vehicle* vehicle, const CarEntry* carEntry) @@ -3765,7 +3765,7 @@ void Vehicle::Paint(paint_session& session, int32_t imageDirection) const if (IsCrashedVehicle) { - PaintAddImageAsParent(session, 22965 + animation_frame, { 0, 0, z }, { 1, 1, 0 }, { 0, 0, z + 2 }); + PaintAddImageAsParent(session, ImageId(22965 + animation_frame), { 0, 0, z }, { 1, 1, 0 }, { 0, 0, z + 2 }); return; } diff --git a/src/openrct2/ride/coaster/VirginiaReel.cpp b/src/openrct2/ride/coaster/VirginiaReel.cpp index 026224af48..1fba3511a5 100644 --- a/src/openrct2/ride/coaster/VirginiaReel.cpp +++ b/src/openrct2/ride/coaster/VirginiaReel.cpp @@ -189,10 +189,10 @@ void vehicle_visual_virginia_reel( const vehicle_boundbox* bb = &_virginiaReelBoundbox[baseImage_id >> 3]; baseImage_id += carEntry->base_image_id; - int32_t image_id = baseImage_id | SPRITE_ID_PALETTE_COLOUR_2(vehicle->colours.Body, vehicle->colours.Trim); + auto image_id = ImageId(baseImage_id, vehicle->colours.Body, vehicle->colours.Trim); if (vehicle->IsGhost()) { - image_id = (image_id & 0x7FFFF) | CONSTRUCTION_MARKER; + image_id = ConstructionMarker.WithIndex(image_id.GetIndex()); } PaintAddImageAsParent( session, image_id, { 0, 0, z }, { bb->length_x, bb->length_y, bb->length_z }, @@ -210,7 +210,7 @@ void vehicle_visual_virginia_reel( { if (riding_peep_sprites[i] != 0xFF) { - image_id = (baseImage_id + ((i + 1) * 72)) | SPRITE_ID_PALETTE_COLOUR_1(riding_peep_sprites[i]); + image_id = ImageId(baseImage_id + ((i + 1) * 72), riding_peep_sprites[i]); PaintAddImageAsChild( 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 }); diff --git a/src/openrct2/ride/gentle/Maze.cpp b/src/openrct2/ride/gentle/Maze.cpp index 8d33d65bbe..70ce2919a3 100644 --- a/src/openrct2/ride/gentle/Maze.cpp +++ b/src/openrct2/ride/gentle/Maze.cpp @@ -157,26 +157,29 @@ static void maze_paint_setup( if (maze_entry & (MAZE_ENTRY_FLAG_0 | MAZE_ENTRY_FLAG_13 | MAZE_ENTRY_FLAG_14)) PaintAddImageAsParent( - session, base_image_id + SPR_MAZE_OFFSET_COLUMN_TOP_LEFT, { 14, 0, height }, { 2, 1, 9 }, { 15, 1, height + 2 }); + session, ImageId(base_image_id + SPR_MAZE_OFFSET_COLUMN_TOP_LEFT), { 14, 0, height }, { 2, 1, 9 }, + { 15, 1, height + 2 }); if (maze_entry & (MAZE_ENTRY_FLAG_5 | MAZE_ENTRY_FLAG_6 | MAZE_ENTRY_FLAG_8)) PaintAddImageAsParent( - session, base_image_id + SPR_MAZE_OFFSET_COLUMN_BOTTOM_RIGHT, { 14, 30, height }, { 2, 1, 9 }, + session, ImageId(base_image_id + SPR_MAZE_OFFSET_COLUMN_BOTTOM_RIGHT), { 14, 30, height }, { 2, 1, 9 }, { 15, 30, height + 2 }); if (maze_entry & (MAZE_ENTRY_FLAG_1 | MAZE_ENTRY_FLAG_2 | MAZE_ENTRY_FLAG_4)) PaintAddImageAsParent( - session, base_image_id + SPR_MAZE_OFFSET_COLUMN_TOP_RIGHT, { 0, 14, height }, { 1, 2, 9 }, { 1, 15, height + 2 }); + session, ImageId(base_image_id + SPR_MAZE_OFFSET_COLUMN_TOP_RIGHT), { 0, 14, height }, { 1, 2, 9 }, + { 1, 15, height + 2 }); if (maze_entry & (MAZE_ENTRY_FLAG_9 | MAZE_ENTRY_FLAG_10 | MAZE_ENTRY_FLAG_12)) PaintAddImageAsParent( - session, base_image_id + SPR_MAZE_OFFSET_COLUMN_BOTTOM_LEFT, { 30, 14, height }, { 1, 2, 9 }, + session, ImageId(base_image_id + SPR_MAZE_OFFSET_COLUMN_BOTTOM_LEFT), { 30, 14, height }, { 1, 2, 9 }, { 30, 15, height + 2 }); if (maze_entry & (MAZE_ENTRY_FLAG_2 | MAZE_ENTRY_FLAG_6 | MAZE_ENTRY_FLAG_10 | MAZE_ENTRY_FLAG_14)) { PaintAddImageAsParent( - session, base_image_id + SPR_MAZE_OFFSET_COLUMN_CENTRE, { 14, 14, height }, { 2, 2, 8 }, { 15, 15, height + 2 }); + session, ImageId(base_image_id + SPR_MAZE_OFFSET_COLUMN_CENTRE), { 14, 14, height }, { 2, 2, 8 }, + { 15, 15, height + 2 }); paint_util_set_segment_support_height(session, SEGMENT_C4, height + 12, 0x20); } diff --git a/src/openrct2/ride/gentle/MiniGolf.cpp b/src/openrct2/ride/gentle/MiniGolf.cpp index 26b8f8f9c7..db11bf90a7 100644 --- a/src/openrct2/ride/gentle/MiniGolf.cpp +++ b/src/openrct2/ride/gentle/MiniGolf.cpp @@ -1232,9 +1232,9 @@ void vehicle_visual_mini_golf_player( uint8_t frame = mini_golf_peep_animation_frames[EnumValue(vehicle->mini_golf_current_animation)][vehicle->animation_frame]; uint32_t ebx = (frame << 2) + OpenRCT2::Entity::Yaw::YawTo4(imageDirection); - uint32_t image_id = rideEntry->Cars[0].base_image_id + 1 + ebx; - uint32_t peep_palette = peep->TshirtColour << 19 | peep->TrousersColour << 24 | 0x0A0000000; - PaintAddImageAsParent(session, image_id | peep_palette, { 0, 0, z }, { 1, 1, 11 }, { 0, 0, z + 5 }); + ImageIndex index = rideEntry->Cars[0].base_image_id + 1 + ebx; + auto image = ImageId(index, peep->TshirtColour, peep->TrousersColour); + PaintAddImageAsParent(session, image, { 0, 0, z }, { 1, 1, 11 }, { 0, 0, z + 5 }); } /** @@ -1263,5 +1263,5 @@ void vehicle_visual_mini_golf_ball( return; uint32_t image_id = rideEntry->Cars[0].base_image_id; - PaintAddImageAsParent(session, image_id, { 0, 0, z }, { 1, 1, 0 }, { 0, 0, z + 3 }); + PaintAddImageAsParent(session, ImageId(image_id), { 0, 0, z }, { 1, 1, 0 }, { 0, 0, z + 3 }); } diff --git a/src/openrct2/ride/thrill/LaunchedFreefall.cpp b/src/openrct2/ride/thrill/LaunchedFreefall.cpp index 91bc691486..7e0a74a0ad 100644 --- a/src/openrct2/ride/thrill/LaunchedFreefall.cpp +++ b/src/openrct2/ride/thrill/LaunchedFreefall.cpp @@ -33,19 +33,19 @@ void vehicle_visual_launched_freefall( paint_session& session, int32_t x, int32_t imageDirection, int32_t y, int32_t z, const Vehicle* vehicle, const CarEntry* carEntry) { - auto imageFlags = SPRITE_ID_PALETTE_COLOUR_2(vehicle->colours.Body, vehicle->colours.Trim); + auto imageFlags = ImageId(0, vehicle->colours.Body, vehicle->colours.Trim); if (vehicle->IsGhost()) { - imageFlags = CONSTRUCTION_MARKER; + imageFlags = ConstructionMarker; } // Draw back: int32_t baseImage_id = carEntry->base_image_id + ((vehicle->restraints_position / 64) * 2); - auto image_id = (baseImage_id + 2) | imageFlags; + auto image_id = imageFlags.WithIndex(baseImage_id + 2); PaintAddImageAsParent(session, image_id, { 0, 0, z }, { 2, 2, 41 }, { -11, -11, z + 1 }); // Draw front: - image_id = (baseImage_id + 1) | imageFlags; + image_id = imageFlags.WithIndex(baseImage_id + 1); PaintAddImageAsParent(session, image_id, { 0, 0, z }, { 16, 16, 41 }, { -5, -5, z + 1 }); // Draw peeps: @@ -57,25 +57,28 @@ void vehicle_visual_launched_freefall( baseImage_id += 2; // Draw peeps sitting without transparent area between them for restraints } auto directionOffset = OpenRCT2::Entity::Yaw::YawTo4(imageDirection); - image_id = (baseImage_id + (((directionOffset + 0) & 3) * 3)) - | SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[0], vehicle->peep_tshirt_colours[1]); + image_id = ImageId( + baseImage_id + (((directionOffset + 0) & 3) * 3), vehicle->peep_tshirt_colours[0], vehicle->peep_tshirt_colours[1]); PaintAddImageAsChild(session, image_id, { 0, 0, z }, { 16, 16, 41 }, { -5, -5, z + 1 }); if (vehicle->num_peeps > 2) { - image_id = (baseImage_id + (((directionOffset + 1) & 3) * 3)) - | SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[2], vehicle->peep_tshirt_colours[3]); + image_id = ImageId( + baseImage_id + (((directionOffset + 1) & 3) * 3), vehicle->peep_tshirt_colours[2], + vehicle->peep_tshirt_colours[3]); PaintAddImageAsChild(session, image_id, { 0, 0, z }, { 16, 16, 41 }, { -5, -5, z + 1 }); } if (vehicle->num_peeps > 4) { - image_id = (baseImage_id + (((directionOffset + 2) & 3) * 3)) - | SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[4], vehicle->peep_tshirt_colours[5]); + image_id = ImageId( + baseImage_id + (((directionOffset + 2) & 3) * 3), vehicle->peep_tshirt_colours[4], + vehicle->peep_tshirt_colours[5]); PaintAddImageAsChild(session, image_id, { 0, 0, z }, { 16, 16, 41 }, { -5, -5, z + 1 }); } if (vehicle->num_peeps > 6) { - image_id = (baseImage_id + (((directionOffset + 3) & 3) * 3)) - | SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[6], vehicle->peep_tshirt_colours[7]); + image_id = ImageId( + baseImage_id + (((directionOffset + 3) & 3) * 3), vehicle->peep_tshirt_colours[6], + vehicle->peep_tshirt_colours[7]); PaintAddImageAsChild(session, image_id, { 0, 0, z }, { 16, 16, 41 }, { -5, -5, z + 1 }); } } diff --git a/src/openrct2/ride/thrill/RotoDrop.cpp b/src/openrct2/ride/thrill/RotoDrop.cpp index 74cceae291..90c84073e1 100644 --- a/src/openrct2/ride/thrill/RotoDrop.cpp +++ b/src/openrct2/ride/thrill/RotoDrop.cpp @@ -39,13 +39,13 @@ void vehicle_visual_roto_drop( { imageDirection = OpenRCT2::Entity::Yaw::YawTo32(imageDirection); - auto imageFlags = SPRITE_ID_PALETTE_COLOUR_2(vehicle->colours.Body, vehicle->colours.Trim); + auto imageFlags = ImageId(0, vehicle->colours.Body, vehicle->colours.Trim); if (vehicle->IsGhost()) { - imageFlags = CONSTRUCTION_MARKER; + imageFlags = ConstructionMarker; } - int32_t image_id; + ImageId image_id; int32_t baseImage_id = (carEntry->base_image_id + 4) + ((vehicle->animation_frame / 4) & 0x3); if (vehicle->restraints_position >= 64) { @@ -54,11 +54,11 @@ void vehicle_visual_roto_drop( } // Draw back: - image_id = baseImage_id | imageFlags; + image_id = imageFlags.WithIndex(baseImage_id); PaintAddImageAsParent(session, image_id, { 0, 0, z }, { 2, 2, 41 }, { -11, -11, z + 1 }); // Draw front: - image_id = (baseImage_id + 4) | imageFlags; + image_id = imageFlags.WithIndex(baseImage_id + 4); PaintAddImageAsParent(session, image_id, { 0, 0, z }, { 16, 16, 41 }, { -5, -5, z + 1 }); if (vehicle->num_peeps > 0 && !vehicle->IsGhost()) @@ -87,7 +87,7 @@ void vehicle_visual_roto_drop( baseImage_id += 64; baseImage_id += vehicle->restraints_position / 64; } - image_id = baseImage_id | SPRITE_ID_PALETTE_COLOUR_1(riding_peep_sprites[i]); + image_id = ImageId(baseImage_id, riding_peep_sprites[i]); PaintAddImageAsChild(session, image_id, { 0, 0, z }, { 16, 16, 41 }, { -5, -5, z + 1 }); } } diff --git a/src/openrct2/ride/water/LogFlume.cpp b/src/openrct2/ride/water/LogFlume.cpp index 00bbf99097..7e4327a419 100644 --- a/src/openrct2/ride/water/LogFlume.cpp +++ b/src/openrct2/ride/water/LogFlume.cpp @@ -802,7 +802,7 @@ static void paint_log_flume_track_on_ride_photo( paint_session& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, const TrackElement& trackElement) { - PaintAddImageAsParent(session, SPR_STATION_BASE_D | IMAGE_TYPE_REMAP, { 0, 0, height }, { 32, 32, 1 }); + PaintAddImageAsParent(session, ImageId(SPR_STATION_BASE_D, COLOUR_BLACK), { 0, 0, height }, { 32, 32, 1 }); if (direction & 1) { diff --git a/src/openrct2/ride/water/RiverRapids.cpp b/src/openrct2/ride/water/RiverRapids.cpp index 641c7e825b..0093071286 100644 --- a/src/openrct2/ride/water/RiverRapids.cpp +++ b/src/openrct2/ride/water/RiverRapids.cpp @@ -183,7 +183,7 @@ void vehicle_visual_river_rapids( { imageDirection = OpenRCT2::Entity::Yaw::YawTo32(imageDirection); - int32_t image_id; + ImageId image_id; int32_t baseImage_id = imageDirection; uint32_t rotation = session.CurrentRotation; int32_t ecx = ((vehicle->spin_sprite / 8) + (rotation * 8)) & 31; @@ -224,11 +224,10 @@ void vehicle_visual_river_rapids( baseImage_id += carEntry->base_image_id; const vehicle_boundbox* bb = &_riverRapidsBoundbox[j]; - image_id = baseImage_id | SPRITE_ID_PALETTE_COLOUR_2(vehicle->colours.Body, vehicle->colours.Trim); + image_id = ImageId(baseImage_id, vehicle->colours.Body, vehicle->colours.Trim); if (vehicle->IsGhost()) { - image_id &= 0x7FFFF; - image_id |= CONSTRUCTION_MARKER; + image_id = ConstructionMarker.WithIndex(image_id.GetIndex()); } PaintAddImageAsParent( session, image_id, { 0, 0, z }, { bb->length_x, bb->length_y, bb->length_z }, @@ -239,16 +238,15 @@ void vehicle_visual_river_rapids( // 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...) int32_t peeps = ((ecx / 8) + 0) & 3; - image_id = (baseImage_id + ((peeps + 1) * 72)) - | SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[0], vehicle->peep_tshirt_colours[1]); + image_id = ImageId(baseImage_id + ((peeps + 1) * 72), vehicle->peep_tshirt_colours[0], vehicle->peep_tshirt_colours[1]); PaintAddImageAsChild( 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 (vehicle->num_peeps > 2) { peeps = ((ecx / 8) + 2) & 3; - image_id = (baseImage_id + ((peeps + 1) * 72)) - | SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[2], vehicle->peep_tshirt_colours[3]); + image_id = ImageId( + baseImage_id + ((peeps + 1) * 72), vehicle->peep_tshirt_colours[2], vehicle->peep_tshirt_colours[3]); PaintAddImageAsChild( 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 }); @@ -256,8 +254,8 @@ void vehicle_visual_river_rapids( if (vehicle->num_peeps > 4) { peeps = ((ecx / 8) + 1) & 3; - image_id = (baseImage_id + ((peeps + 1) * 72)) - | SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[4], vehicle->peep_tshirt_colours[5]); + image_id = ImageId( + baseImage_id + ((peeps + 1) * 72), vehicle->peep_tshirt_colours[4], vehicle->peep_tshirt_colours[5]); PaintAddImageAsChild( 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 }); @@ -265,8 +263,8 @@ void vehicle_visual_river_rapids( if (vehicle->num_peeps > 6) { peeps = ((ecx / 8) + 3) & 3; - image_id = (baseImage_id + ((peeps + 1) * 72)) - | SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[6], vehicle->peep_tshirt_colours[7]); + image_id = ImageId( + baseImage_id + ((peeps + 1) * 72), vehicle->peep_tshirt_colours[6], vehicle->peep_tshirt_colours[7]); PaintAddImageAsChild( 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 });