MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / AddTileSpriteToDraw

Function AddTileSpriteToDraw

src/viewport.cpp:507–518  ·  view source on GitHub ↗

* Schedules a tile sprite for drawing. * * @param image the image to draw. * @param pal the provided palette. * @param x position x (world coordinates) of the sprite. * @param y position y (world coordinates) of the sprite. * @param z position z (world coordinates) of the sprite. * @param sub Only draw a part of the sprite. * @param extra_offs_x Pixel X offset for the sprite position. * @

Source from the content-addressed store, hash-verified

505 * @param extra_offs_y Pixel Y offset for the sprite position.
506 */
507static void AddTileSpriteToDraw(SpriteID image, PaletteID pal, int32_t x, int32_t y, int z, const SubSprite *sub = nullptr, int extra_offs_x = 0, int extra_offs_y = 0)
508{
509 assert((image & SPRITE_MASK) < MAX_SPRITES);
510
511 TileSpriteToDraw &ts = _vd.tile_sprites_to_draw.emplace_back();
512 ts.image = image;
513 ts.pal = pal;
514 ts.sub = sub;
515 Point pt = RemapCoords(x, y, z);
516 ts.x = pt.x + extra_offs_x;
517 ts.y = pt.y + extra_offs_y;
518}
519
520/**
521 * Adds a child sprite to the active foundation.

Callers 2

DrawGroundSpriteAtFunction · 0.85
DrawSelectionSpriteFunction · 0.85

Calls 1

RemapCoordsFunction · 0.85

Tested by

no test coverage detected