tron@2186: /* $Id$ */ tron@2186: rubidium@9111: /** @file sprite.h Base for drawing complex sprites. */ belugas@6420: darkvater@406: #ifndef SPRITE_H darkvater@406: #define SPRITE_H darkvater@406: rubidium@8123: #include "gfx_type.h" rubidium@8123: rubidium@8113: #define GENERAL_SPRITE_COLOR(color) ((color) + PALETTE_RECOLOR_START) rubidium@10207: #define COMPANY_SPRITE_COLOR(owner) (GENERAL_SPRITE_COLOR(_company_colours[owner])) rubidium@8113: rubidium@8113: /** rubidium@8113: * Whether a sprite comes from the original graphics files or a new grf file rubidium@8113: * (either supplied by OpenTTD or supplied by the user). rubidium@8113: * rubidium@8113: * @param sprite The sprite to check rubidium@8113: * @return True if it is a new sprite, or false if it is original. rubidium@8113: */ rubidium@8113: #define IS_CUSTOM_SPRITE(sprite) ((sprite) >= SPR_SIGNALS_BASE) darkvater@406: darkvater@406: /* The following describes bunch of sprites to be drawn together in a single 3D darkvater@406: * bounding box. Used especially for various multi-sprite buildings (like darkvater@406: * depots or stations): */ darkvater@406: rubidium@10233: /** A tile child sprite and palette to draw for stations etc, with 3D bounding box */ rubidium@6248: struct DrawTileSeqStruct { rubidium@10233: int8 delta_x; ///< \c 0x80 is sequence terminator darkvater@406: int8 delta_y; darkvater@406: int8 delta_z; tron@4230: byte size_x; tron@4230: byte size_y; tron@4230: byte size_z; frosch@8570: PalSpriteID image; rubidium@6248: }; darkvater@406: rubidium@10233: /** Ground palette sprite of a tile, together with its child sprites */ rubidium@6248: struct DrawTileSprites { rubidium@10233: PalSpriteID ground; ///< Palette and sprite for the ground rubidium@10233: const DrawTileSeqStruct *seq; ///< Array of child sprites. Terminated with a terminator entry rubidium@6248: }; darkvater@406: belugas@3654: /** belugas@3654: * This structure is the same for both Industries and Houses. belugas@3654: * Buildings here reference a general type of construction belugas@3654: */ rubidium@6248: struct DrawBuildingsTileStruct { peter1138@5668: PalSpriteID ground; peter1138@5668: PalSpriteID building; rubidium@7606: byte subtile_x; rubidium@7606: byte subtile_y; rubidium@7606: byte width; rubidium@7606: byte height; belugas@3654: byte dz; belugas@3654: byte draw_proc; /* this allows to specify a special drawing procedure.*/ rubidium@6248: }; belugas@3654: belugas@6420: /** Iterate through all DrawTileSeqStructs in DrawTileSprites. */ darkvater@406: #define foreach_draw_tile_seq(idx, list) for (idx = list; ((byte) idx->delta_x) != 0x80; idx++) darkvater@406: rubidium@10032: void SkipSpriteData(byte type, uint16 num); darkvater@406: Darkvater@2436: #endif /* SPRITE_H */