32 bool parent_sprite_encountered =
false;
34 bool skip_childs =
false;
57 parent_sprite_encountered =
true;
60 ti->
x + dtss->
delta_x, ti->
y + dtss->delta_y,
61 dtss->size_x, dtss->size_y,
66 int offs_x = child_offset_is_unsigned ? (uint8_t)dtss->
delta_x : dtss->
delta_x;
67 int offs_y = child_offset_is_unsigned ? (uint8_t)dtss->delta_y : dtss->delta_y;
69 if (parent_sprite_encountered) {
95 Point child_offset = {0, 0};
97 bool skip_childs =
false;
126 int offs_x = child_offset_is_unsigned ? (uint8_t)dtss->
delta_x : dtss->
delta_x;
127 int offs_y = child_offset_is_unsigned ? (uint8_t)dtss->delta_y : dtss->delta_y;
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
constexpr static debug_inline uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
@ Normal
The most basic (normal) sprite.
uint32_t PaletteID
The number of the palette.
Functions related to OTTD's landscape.
Point RemapCoords(int x, int y, int z)
Map 3D world or tile coordinate to equivalent 2D coordinate as used in the viewports and smallmap.
A number of safeguards to prevent using unsafe methods.
void DrawCommonTileSeq(const TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, int32_t orig_offset, uint32_t newgrf_offset, PaletteID default_palette, bool child_offset_is_unsigned)
Draws a tile sprite sequence.
void DrawCommonTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32_t orig_offset, uint32_t newgrf_offset, PaletteID default_palette, bool child_offset_is_unsigned)
Draws a tile sprite sequence in the GUI.
Base for drawing complex sprites.
#define foreach_draw_tile_seq(idx, list)
Iterate through all DrawTileSeqStructs in DrawTileSprites.
PaletteID SpriteLayoutPaletteTransform(SpriteID image, PaletteID pal, PaletteID default_pal)
Applies PALETTE_MODIFIER_TRANSPARENT and PALETTE_MODIFIER_COLOUR to a palette entry of a sprite layou...
Functions to cache sprites in memory.
static constexpr uint8_t SPRITE_MODIFIER_OPAQUE
Set when a sprite must not ever be displayed transparently.
static constexpr uint32_t SPRITE_MASK
The mask to for the main sprite.
static constexpr uint8_t PALETTE_MODIFIER_TRANSPARENT
when a sprite is to be displayed transparently, this bit needs to be set.
static constexpr uint8_t SPRITE_MODIFIER_CUSTOM_SPRITE
these masks change the colours of the palette for a sprite.
static constexpr uint8_t SPRITE_WIDTH
number of bits for the sprite number
static const PaletteID PALETTE_TO_TRANSPARENT
This sets the sprite to transparent.
Definition of base types and functions in a cross-platform compatible way.
A tile child sprite and palette to draw for stations etc, with 3D bounding box.
int8_t delta_z
0x80 identifies child sprites
bool IsParentSprite() const
Check whether this is a parent sprite with a boundingbox.
int8_t delta_x
0x80 is sequence terminator
Ground palette sprite of a tile, together with its sprite layout.
const DrawTileSeqStruct * seq
Array of child sprites. Terminated with a terminator entry.
SpriteID sprite
The 'real' sprite.
PaletteID pal
The palette (use PAL_NONE) if not needed)
Coordinates of a point in 2D.
Data structure describing a sprite.
int16_t y_offs
Number of pixels to shift the sprite downwards.
int16_t x_offs
Number of pixels to shift the sprite to the right.
Tile information, used while rendering the tile.
int x
X position of the tile in unit coordinates.
int y
Y position of the tile in unit coordinates.
TransparencyOption
Transparency option bits: which position in _transparency_opt stands for which transparency.
bool IsTransparencySet(TransparencyOption to)
Check if the transparency option bit is set and if we aren't in the game menu (there's never transpar...
bool IsInvisibilitySet(TransparencyOption to)
Check if the invisibility option bit is set and if we aren't in the game menu (there's never transpar...
void AddSortableSpriteToDraw(SpriteID image, PaletteID pal, int x, int y, int w, int h, int dz, int z, bool transparent, int bb_offset_x, int bb_offset_y, int bb_offset_z, const SubSprite *sub)
Draw a (transparent) sprite at given coordinates with a given bounding box.
void AddChildSpriteScreen(SpriteID image, PaletteID pal, int x, int y, bool transparent, const SubSprite *sub, bool scale, bool relative)
Add a child sprite to a parent sprite.
void DrawGroundSprite(SpriteID image, PaletteID pal, const SubSprite *sub, int extra_offs_x, int extra_offs_y)
Draws a ground sprite for the current tile.
Functions related to (drawing on) viewports.
Functions related to zooming.
int ScaleSpriteTrad(int value)
Scale traditional pixel dimensions to GUI zoom level, for drawing sprites.
int UnScaleGUI(int value)
Short-hand to apply GUI zoom level.