* Adds a child sprite to a parent sprite. * In contrast to "AddChildSpriteScreen()" the sprite position is in world coordinates * * @param image the image to draw. * @param pal the provided palette. * @param x position x of the sprite. * @param y position y of the sprite. * @param z position z of the sprite. * @param sub Only draw a part of the sprite. */
| 621 | * @param sub Only draw a part of the sprite. |
| 622 | */ |
| 623 | static void AddCombinedSprite(SpriteID image, PaletteID pal, int x, int y, int z, const SubSprite *sub) |
| 624 | { |
| 625 | Point pt = RemapCoords(x, y, z); |
| 626 | const Sprite *spr = GetSprite(image & SPRITE_MASK, SpriteType::Normal); |
| 627 | |
| 628 | if (pt.x + spr->x_offs >= _vd.dpi.left + _vd.dpi.width || |
| 629 | pt.x + spr->x_offs + spr->width <= _vd.dpi.left || |
| 630 | pt.y + spr->y_offs >= _vd.dpi.top + _vd.dpi.height || |
| 631 | pt.y + spr->y_offs + spr->height <= _vd.dpi.top) |
| 632 | return; |
| 633 | |
| 634 | const ParentSpriteToDraw &pstd = _vd.parent_sprites_to_draw.back(); |
| 635 | AddChildSpriteScreen(image, pal, pt.x - pstd.left, pt.y - pstd.top, false, sub, false); |
| 636 | } |
| 637 | |
| 638 | /** |
| 639 | * Draw a (transparent) sprite at given coordinates with a given bounding box. |
no test coverage detected