4
/*****************************************\
6
* SPRITES.H - A couple of routines to *
7
* decode and encode TTD .GRF *
11
* Copyright (C) 2000 by Josef Drexler *
12
* <jdrexler@julian.uwo.ca> *
14
* Permission granted to copy and redist- *
15
* ribute under the terms of the GNU GPL. *
16
* For more info please read the file *
17
* COPYING which should have come with *
20
\*****************************************/
29
# define SPRITES_EXTERN
30
# define SPRITES_INIT = 0
32
# define SPRITES_EXTERN extern
37
// Define some of the bits in info[0]
38
#define DONOTCROP(info) (info[0] & 64)
39
#define HASTRANSPARENCY(info) (info[0] & 8)
40
#define SIZEISCOMPRESSED(info) (info[0] & 2)
43
// minimum and maximum overlap to search for in the compression routines
45
#define MAXOVERLAP 15 // must be <= 15 b/o how it's encoded
49
class spriteinfowriter : public bandnotify {
51
virtual void addsprite(int /*x*/, U8 /*info*/[8]) { };
52
virtual void adddata(U16 /*size*/, U8 * /*data*/) { };
57
virtual ~spritestorage(){}
58
virtual void newsprite() {};
59
virtual void setsize(int /*sx*/, int /*sy*/) {};
60
virtual int curspritex() {return 0;};
61
virtual void newrow() {};
62
virtual void nextpixel(U8 /*colour*/) {};
63
virtual void spritedone(int /*sx*/, int /*sy*/) {};
64
virtual void spritedone() {};
68
SPRITES_EXTERN int maxx SPRITES_INIT, maxy SPRITES_INIT, maxs SPRITES_INIT;
70
int decodesprite(FILE *grf, spritestorage *store, spriteinfowriter *writer);
72
U16 getlasttilesize();
73
U16 encodetile(FILE *grf, const U8 *image, long imgsize, U8 background, int sx, int sy, const U8 inf[8], int docompress, int spriteno);
74
U16 encoderegular(FILE *grf, const U8 *image, long imgsize, const U8 inf[8], int docompress);
76
#endif /* _SPRITES_H */