1 #ifndef TILESET_HH
2 #define TILESET_HH
3 #include <lcdf/vector.hh>
4 class Tile;
5 class SwDrawable;
6 
7 class Tileset {
8  protected:
9 
10   int _xborder;
11   int _yborder;
12   int _shadow;
13   int _width;
14   int _height;
15 
16   int _ntiles;
17   int _npictures;
18   int _nmatches;
19   Vector<short> _pictures;
20   Vector<short> _matches;
21 
22   void initialize_ivory();
23 
24  public:
25 
26   enum Shadow {
27     shadowNW = 0, shadowNE = 1, shadowSW = 2, shadowSE = 3
28   };
29 
30   Tileset(short ntiles, short npictures, short nmatches);
31   Tileset(const char *);		// set up by name, e.g. "ivory"
~Tileset()32   virtual ~Tileset()			{ }
33 
34   virtual bool ok() const = 0;
35 
xborder() const36   int xborder() const			{ return _xborder; }
yborder() const37   int yborder() const			{ return _yborder; }
shadow() const38   int shadow() const			{ return _shadow; }
width() const39   int width() const			{ return _width; }
height() const40   int height() const			{ return _height; }
41 
ntiles() const42   int ntiles() const			{ return _ntiles; }
npictures() const43   int npictures() const			{ return _npictures; }
nmatches() const44   int nmatches() const			{ return _nmatches; }
45 
picture(short tile) const46   short picture(short tile) const	{ return _pictures[tile]; }
match(short tile) const47   short match(short tile) const		{ return _matches[tile]; }
48 
49   virtual void draw_normal(const Tile *, SwDrawable *, short x, short y) = 0;
50   virtual void draw_lit(const Tile *, SwDrawable *, short x, short y) = 0;
51   virtual void draw_obscured(const Tile *, SwDrawable *, short x, short y) = 0;
52 
53   // Information about the normal tileset, called `ivory'.
54   static const char *ivory_picture_name(int);
55   static const int IVORY_NTILES = 144;
56   static const int IVORY_NPICTURES = 42;
57   static const int IVORY_NMATCHES = 36;
58 
59 };
60 
61 /* Requirement:
62    If x % 2 == 0 && x >= 0 && x < ntiles(), then match(x) == match(x + 1). */
63 
64 #endif
65