OpenTTD Source 20241224-master-gf74b0cf984
sprite.cpp File Reference

Handling of sprites. More...

#include "stdafx.h"
#include "sprite.h"
#include "viewport_func.h"
#include "landscape.h"
#include "spritecache.h"
#include "zoom_func.h"
#include "safeguards.h"

Go to the source code of this file.

Functions

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.
 

Detailed Description

Handling of sprites.

Definition in file sprite.cpp.

Function Documentation

◆ DrawCommonTileSeq()

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.

Parameters
tiThe tile to draw on
dtsSprite and subsprites to draw
toThe transparency bit that toggles drawing of these sprites
orig_offsetSprite-Offset for original sprites
newgrf_offsetSprite-Offset for NewGRF defined sprites
default_paletteThe default recolour sprite to use (typically company colour)
child_offset_is_unsignedWhether child sprite offsets are interpreted signed or unsigned

Definition at line 30 of file sprite.cpp.

References AddChildSpriteScreen(), AddSortableSpriteToDraw(), DrawTileSeqStruct::delta_x, DrawTileSeqStruct::delta_z, DrawGroundSprite(), foreach_draw_tile_seq, GB(), HasBit(), IsInvisibilitySet(), DrawTileSeqStruct::IsParentSprite(), IsTransparencySet(), PalSpriteID::pal, PALETTE_MODIFIER_TRANSPARENT, PALETTE_TO_TRANSPARENT, DrawTileSprites::seq, SetBit(), 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().

◆ DrawCommonTileSeqInGUI()

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.

Parameters
xX position to draw to
yY position to draw to
dtsSprite and subsprites to draw
orig_offsetSprite-Offset for original sprites
newgrf_offsetSprite-Offset for NewGRF defined sprites
default_paletteThe default recolour sprite to use (typically company colour)
child_offset_is_unsignedWhether child sprite offsets are interpreted signed or unsigned

Definition at line 92 of file sprite.cpp.

References DrawTileSeqStruct::delta_x, DrawTileSeqStruct::delta_z, DrawSprite(), foreach_draw_tile_seq, GB(), HasBit(), DrawTileSeqStruct::IsParentSprite(), Normal, PalSpriteID::pal, RemapCoords(), ScaleSpriteTrad(), DrawTileSprites::seq, PalSpriteID::sprite, SPRITE_MASK, SPRITE_MODIFIER_CUSTOM_SPRITE, SPRITE_WIDTH, SpriteLayoutPaletteTransform(), UnScaleGUI(), Sprite::x_offs, and Sprite::y_offs.

Referenced by DrawNewGRFTileSeqInGUI(), DrawOrigTileSeqInGUI(), DrawRailTileSeqInGUI(), and DrawRoadStopTile().