# sprite.cpp File Reference

Handling of sprites. More...

`#include "stdafx.h"`
`#include "sprite.h"`
`#include "tile_cmd.h"`
`#include "viewport_func.h"`
`#include "landscape.h"`
`#include "spritecache.h"`
`#include "table/sprites.h"`

Go to the source code of this file.

## Functions
void | DrawCommonTileSeq (const TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, int32 orig_offset, uint32 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 orig_offset, uint32 newgrf_offset, PaletteID default_palette, bool child_offset_is_unsigned)
| Draws a tile sprite sequence in the GUI.

## Detailed Description

Handling of sprites.

Definition in file sprite.cpp.

## Function Documentation

void DrawCommonTileSeq | ( | const TileInfo * | ti,
|  | const DrawTileSprites * | dts,
|  | TransparencyOption | to,
|  | int32 | orig_offset,
|  | uint32 | newgrf_offset,
|  | PaletteID | default_palette,
|  | bool | child_offset_is_unsigned |
| ) |  |  |

Draws a tile sprite sequence.

Parameters:

  | ti | The tile to draw on
  | dts | Sprite and subsprites to draw
  | to | The transparancy bit that toggles drawing of these sprites
  | orig_offset | Sprite-Offset for original sprites
  | newgrf_offset | Sprite-Offset for NewGRF defined sprites
  | default_palette | The default recolour sprite to use (typically company colour)
  | child_offset_is_unsigned | Whether child sprite offsets are interpreted signed or unsigned

Definition at line 31 of file sprite.cpp.

References AddChildSpriteScreen(), AddSortableSpriteToDraw(), DrawTileSeqStruct::delta_x, DrawTileSeqStruct::delta_y, DrawTileSeqStruct::delta_z, DrawGroundSprite(), foreach_draw_tile_seq, GB(), HasBit(), DrawTileSeqStruct::image, IsInvisibilitySet(), IsTransparencySet(), PalSpriteID::pal, PALETTE_MODIFIER_TRANSPARENT, DrawTileSprites::seq, SetBit(), DrawTileSeqStruct::size_x, DrawTileSeqStruct::size_y, DrawTileSeqStruct::size_z, PalSpriteID::sprite, SPRITE_MODIFIER_CUSTOM_SPRITE, SPRITE_MODIFIER_OPAQUE, SPRITE_WIDTH, SpriteLayoutPaletteTransform(), TileInfo::x, TileInfo::y, and TileInfo::z.

Referenced by DrawNewGRFTileSeq(), DrawOrigTileSeq(), and DrawRailTileSeq().

void DrawCommonTileSeqInGUI | ( | int | x,
|  | int | y,
|  | const DrawTileSprites * | dts,
|  | int32 | orig_offset,
|  | uint32 | newgrf_offset,
|  | PaletteID | default_palette,
|  | bool | child_offset_is_unsigned |
| ) |  |  |

Draws a tile sprite sequence in the GUI.

Parameters:

  | x | X position to draw to
  | y | Y position to draw to
  | dts | Sprite and subsprites to draw
  | orig_offset | Sprite-Offset for original sprites
  | newgrf_offset | Sprite-Offset for NewGRF defined sprites
  | default_palette | The default recolour sprite to use (typically company colour)
  | child_offset_is_unsigned | Whether child sprite offsets are interpreted signed or unsigned

Definition at line 84 of file sprite.cpp.

References DrawTileSeqStruct::delta_x, DrawTileSeqStruct::delta_y, DrawTileSeqStruct::delta_z, DrawSprite(), foreach_draw_tile_seq, GB(), HasBit(), DrawTileSeqStruct::image, PalSpriteID::pal, DrawTileSprites::seq, PalSpriteID::sprite, SPRITE_MASK, SPRITE_MODIFIER_CUSTOM_SPRITE, SPRITE_WIDTH, SpriteLayoutPaletteTransform(), ST_NORMAL, Point::x, Sprite::x_offs, Point::y, and Sprite::y_offs.

Referenced by DrawOrigTileSeqInGUI(), and DrawRailTileSeqInGUI().