2005-07-24 14:12:37 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2008-05-06 15:11:33 +00:00
|
|
|
/** @file sprite.h Base for drawing complex sprites. */
|
2007-04-04 01:35:16 +00:00
|
|
|
|
2004-11-14 16:45:38 +00:00
|
|
|
#ifndef SPRITE_H
|
|
|
|
#define SPRITE_H
|
|
|
|
|
2007-12-23 10:56:02 +00:00
|
|
|
#include "gfx_type.h"
|
|
|
|
|
2009-02-09 02:57:15 +00:00
|
|
|
#define GENERAL_SPRITE_COLOUR(colour) ((colour) + PALETTE_RECOLOUR_START)
|
|
|
|
#define COMPANY_SPRITE_COLOUR(owner) (GENERAL_SPRITE_COLOUR(_company_colours[owner]))
|
2007-12-21 19:21:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether a sprite comes from the original graphics files or a new grf file
|
|
|
|
* (either supplied by OpenTTD or supplied by the user).
|
|
|
|
*
|
|
|
|
* @param sprite The sprite to check
|
|
|
|
* @return True if it is a new sprite, or false if it is original.
|
|
|
|
*/
|
|
|
|
#define IS_CUSTOM_SPRITE(sprite) ((sprite) >= SPR_SIGNALS_BASE)
|
2004-11-14 16:45:38 +00:00
|
|
|
|
|
|
|
/* The following describes bunch of sprites to be drawn together in a single 3D
|
|
|
|
* bounding box. Used especially for various multi-sprite buildings (like
|
|
|
|
* depots or stations): */
|
|
|
|
|
2008-10-13 03:26:48 +00:00
|
|
|
/** A tile child sprite and palette to draw for stations etc, with 3D bounding box */
|
2007-03-07 12:11:48 +00:00
|
|
|
struct DrawTileSeqStruct {
|
2008-10-13 03:26:48 +00:00
|
|
|
int8 delta_x; ///< \c 0x80 is sequence terminator
|
2004-11-14 16:45:38 +00:00
|
|
|
int8 delta_y;
|
|
|
|
int8 delta_z;
|
2006-08-06 08:23:19 +00:00
|
|
|
byte size_x;
|
|
|
|
byte size_y;
|
|
|
|
byte size_z;
|
2008-02-15 18:34:26 +00:00
|
|
|
PalSpriteID image;
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2004-11-14 16:45:38 +00:00
|
|
|
|
2008-10-13 03:26:48 +00:00
|
|
|
/** Ground palette sprite of a tile, together with its child sprites */
|
2007-03-07 12:11:48 +00:00
|
|
|
struct DrawTileSprites {
|
2008-10-13 03:26:48 +00:00
|
|
|
PalSpriteID ground; ///< Palette and sprite for the ground
|
|
|
|
const DrawTileSeqStruct *seq; ///< Array of child sprites. Terminated with a terminator entry
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2004-11-14 16:45:38 +00:00
|
|
|
|
2006-04-24 21:10:56 +00:00
|
|
|
/**
|
|
|
|
* This structure is the same for both Industries and Houses.
|
|
|
|
* Buildings here reference a general type of construction
|
|
|
|
*/
|
2007-03-07 12:11:48 +00:00
|
|
|
struct DrawBuildingsTileStruct {
|
2007-01-14 19:57:49 +00:00
|
|
|
PalSpriteID ground;
|
|
|
|
PalSpriteID building;
|
2007-09-20 19:21:01 +00:00
|
|
|
byte subtile_x;
|
|
|
|
byte subtile_y;
|
|
|
|
byte width;
|
|
|
|
byte height;
|
2006-04-24 21:10:56 +00:00
|
|
|
byte dz;
|
2009-03-15 00:32:18 +00:00
|
|
|
byte draw_proc; // this allows to specify a special drawing procedure.
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2006-04-24 21:10:56 +00:00
|
|
|
|
2007-04-04 01:35:16 +00:00
|
|
|
/** Iterate through all DrawTileSeqStructs in DrawTileSprites. */
|
2004-11-14 16:45:38 +00:00
|
|
|
#define foreach_draw_tile_seq(idx, list) for (idx = list; ((byte) idx->delta_x) != 0x80; idx++)
|
|
|
|
|
2009-03-19 23:03:53 +00:00
|
|
|
bool SkipSpriteData(byte type, uint16 num);
|
2004-11-14 16:45:38 +00:00
|
|
|
|
2005-09-18 20:56:44 +00:00
|
|
|
#endif /* SPRITE_H */
|