* Draw a sprite in a viewport. * @param img Image number to draw * @param pal Palette to use. * @param x Left coordinate of image in viewport, scaled by zoom * @param y Top coordinate of image in viewport, scaled by zoom * @param sub If available, draw only specified part of the sprite */
| 1004 | * @param sub If available, draw only specified part of the sprite |
| 1005 | */ |
| 1006 | void DrawSpriteViewport(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub) |
| 1007 | { |
| 1008 | SpriteID real_sprite = GB(img, 0, SPRITE_WIDTH); |
| 1009 | if (HasBit(img, PALETTE_MODIFIER_TRANSPARENT)) { |
| 1010 | pal = GB(pal, 0, PALETTE_WIDTH); |
| 1011 | _colour_remap_ptr = GetNonSprite(pal, SpriteType::Recolour) + 1; |
| 1012 | GfxMainBlitterViewport(GetSprite(real_sprite, SpriteType::Normal), x, y, pal == PALETTE_TO_TRANSPARENT ? BlitterMode::Transparent : BlitterMode::TransparentRemap, sub, real_sprite); |
| 1013 | } else if (pal != PAL_NONE) { |
| 1014 | if (HasBit(pal, PALETTE_TEXT_RECOLOUR)) { |
| 1015 | SetColourRemap((TextColour)GB(pal, 0, PALETTE_WIDTH)); |
| 1016 | } else { |
| 1017 | _colour_remap_ptr = GetNonSprite(GB(pal, 0, PALETTE_WIDTH), SpriteType::Recolour) + 1; |
| 1018 | } |
| 1019 | GfxMainBlitterViewport(GetSprite(real_sprite, SpriteType::Normal), x, y, GetBlitterMode(pal), sub, real_sprite); |
| 1020 | } else { |
| 1021 | GfxMainBlitterViewport(GetSprite(real_sprite, SpriteType::Normal), x, y, BlitterMode::Normal, sub, real_sprite); |
| 1022 | } |
| 1023 | } |
| 1024 | |
| 1025 | /** |
| 1026 | * Draw a sprite, not in a viewport |
no test coverage detected