# sprite.h

Go to the documentation of this file.

    00001 /* $Id: sprite.h 17248 2009-08-21 20:21:05Z rubidium $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    00008  */
    00009
    00012 #ifndef SPRITE_H
    00013 #define SPRITE_H
    00014
    00015 #include "gfx_type.h"
    00016
    00017 #define GENERAL_SPRITE_COLOUR(colour) ((colour) + PALETTE_RECOLOUR_START)
    00018 #define COMPANY_SPRITE_COLOUR(owner) (GENERAL_SPRITE_COLOUR(_company_colours[owner]))
    00019
    00027 #define IS_CUSTOM_SPRITE(sprite) ((sprite) >= SPR_SIGNALS_BASE)
    00028
    00029 /* The following describes bunch of sprites to be drawn together in a single 3D
    00030  * bounding box. Used especially for various multi-sprite buildings (like
    00031  * depots or stations): */
    00032
    00034 struct DrawTileSeqStruct {
    00035   int8 delta_x;
    00036   int8 delta_y;
    00037   int8 delta_z;
    00038   byte size_x;
    00039   byte size_y;
    00040   byte size_z;
    00041   PalSpriteID image;
    00042 };
    00043
    00045 struct DrawTileSprites {
    00046   PalSpriteID ground;
    00047   const DrawTileSeqStruct *seq;
    00048 };
    00049
    00054 struct DrawBuildingsTileStruct {
    00055   PalSpriteID ground;
    00056   PalSpriteID building;
    00057   byte subtile_x;
    00058   byte subtile_y;
    00059   byte width;
    00060   byte height;
    00061   byte dz;
    00062   byte draw_proc;  // this allows to specify a special drawing procedure.
    00063 };
    00064
    00066 #define foreach_draw_tile_seq(idx, list) for (idx = list; ((byte) idx->delta_x) != 0x80; idx++)
    00067
    00068 bool SkipSpriteData(byte type, uint16 num);
    00069
    00070 #endif /* SPRITE_H */