2005-07-24 14:12:37 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
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"
|
|
|
|
|
2007-12-21 19:21:21 +00:00
|
|
|
#define GENERAL_SPRITE_COLOR(color) ((color) + PALETTE_RECOLOR_START)
|
|
|
|
#define PLAYER_SPRITE_COLOR(owner) (GENERAL_SPRITE_COLOR(_player_colors[owner]))
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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): */
|
|
|
|
|
2007-03-07 12:11:48 +00:00
|
|
|
struct DrawTileSeqStruct {
|
2004-11-14 18:18:28 +00:00
|
|
|
int8 delta_x; // 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
|
|
|
|
2007-03-07 12:11:48 +00:00
|
|
|
struct DrawTileSprites {
|
2008-02-15 18:40:42 +00:00
|
|
|
PalSpriteID ground;
|
2007-07-24 17:01:23 +00:00
|
|
|
const DrawTileSeqStruct *seq;
|
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;
|
|
|
|
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++)
|
|
|
|
|
|
|
|
|
2005-09-18 20:56:44 +00:00
|
|
|
#endif /* SPRITE_H */
|