2005-07-24 14:12:37 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2004-11-14 16:45:38 +00:00
|
|
|
#ifndef SPRITE_H
|
|
|
|
#define SPRITE_H
|
|
|
|
|
|
|
|
|
|
|
|
/* 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): */
|
|
|
|
|
|
|
|
typedef 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;
|
|
|
|
byte width,height;
|
|
|
|
byte unk; // 'depth', just z-size; TODO: rename
|
|
|
|
uint32 image;
|
|
|
|
} DrawTileSeqStruct;
|
|
|
|
|
|
|
|
typedef struct DrawTileSprites {
|
|
|
|
SpriteID ground_sprite;
|
2005-10-22 06:39:32 +00:00
|
|
|
const DrawTileSeqStruct* seq;
|
2004-11-14 16:45:38 +00:00
|
|
|
} DrawTileSprites;
|
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
typedef struct DrawBuildingsTileStruct {
|
|
|
|
SpriteID ground;
|
|
|
|
SpriteID building;
|
|
|
|
byte subtile_x:4;
|
|
|
|
byte subtile_y:4;
|
|
|
|
byte width:4;
|
|
|
|
byte height:4;
|
|
|
|
byte dz;
|
|
|
|
byte draw_proc; /* this allows to specify a special drawing procedure.*/
|
|
|
|
} DrawBuildingsTileStruct;
|
|
|
|
|
2004-11-14 18:18:28 +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++)
|
|
|
|
|
|
|
|
|
2006-04-26 17:16:57 +00:00
|
|
|
// XXX Temporary include while juggling about
|
|
|
|
#include "newgrf_spritegroup.h"
|
2004-11-14 16:45:38 +00:00
|
|
|
|
2004-11-14 18:18:28 +00:00
|
|
|
|
2004-11-14 20:50:38 +00:00
|
|
|
/* This takes value (probably of the variable specified in the group) and
|
|
|
|
* chooses corresponding SpriteGroup accordingly to the given
|
|
|
|
* DeterministicSpriteGroup. */
|
2005-07-30 18:04:49 +00:00
|
|
|
SpriteGroup *EvalDeterministicSpriteGroup(const DeterministicSpriteGroup *dsg, int value);
|
2004-11-14 20:50:38 +00:00
|
|
|
/* Get value of a common deterministic SpriteGroup variable. */
|
|
|
|
int GetDeterministicSpriteValue(byte var);
|
2004-11-14 18:18:28 +00:00
|
|
|
|
2004-11-17 08:52:47 +00:00
|
|
|
/* This takes randomized bitmask (probably associated with
|
|
|
|
* vehicle/station/whatever) and chooses corresponding SpriteGroup
|
|
|
|
* accordingly to the given RandomizedSpriteGroup. */
|
2005-07-30 18:04:49 +00:00
|
|
|
SpriteGroup *EvalRandomizedSpriteGroup(const RandomizedSpriteGroup *rsg, byte random_bits);
|
2004-11-17 08:52:47 +00:00
|
|
|
/* Triggers given RandomizedSpriteGroup with given bitmask and returns and-mask
|
|
|
|
* of random bits to be reseeded, or zero if there were no triggers matched
|
|
|
|
* (then they are |ed to @waiting_triggers instead). */
|
2005-07-30 18:04:49 +00:00
|
|
|
byte RandomizedSpriteGroupTriggeredBits(const RandomizedSpriteGroup *rsg, byte triggers, byte *waiting_triggers);
|
2004-11-17 08:52:47 +00:00
|
|
|
|
2005-09-18 20:56:44 +00:00
|
|
|
#endif /* SPRITE_H */
|