1 #ifndef _sprchunk_hpp
2 #define _sprchunk_hpp
3 #include "chunk.hpp"
4 #include "chnktype.hpp"
5 
6 struct Frame
7 {
8 	int Texture;
9 	int CentreX;
10 	int CentreY;
11 	int UVCoords[4][2];
12 };
13 
14 class Sprite_Header_Chunk : public Chunk_With_Children
15 {
16 public:
17 	Sprite_Header_Chunk(Chunk_With_Children* const parent,const char*,size_t const);
18 	Sprite_Header_Chunk(const char* file_name, Chunk_With_Children * parent = NULL);
Sprite_Header_Chunk()19 	Sprite_Header_Chunk()
20 	: Chunk_With_Children(0,"SPRIHEAD"){}
Sprite_Header_Chunk(Chunk_With_Children * parent)21 	Sprite_Header_Chunk(Chunk_With_Children* parent)
22 	: Chunk_With_Children(parent,"SPRIHEAD"){}
23 
24 	int write_file(const char* fname);
25 	virtual BOOL output_chunk(HANDLE &hand);
26 };
27 
28 class PC_Sprite_Chunk : public Chunk_With_Children
29 {
30 public:
31 	PC_Sprite_Chunk(Sprite_Header_Chunk* parent,const char*,size_t);
PC_Sprite_Chunk(Sprite_Header_Chunk * parent)32 	PC_Sprite_Chunk(Sprite_Header_Chunk* parent)
33 	: Chunk_With_Children(parent,"SPRITEPC"){}
34 };
35 
36 class Saturn_Sprite_Chunk : public Chunk_With_Children
37 {
38 public:
39 	Saturn_Sprite_Chunk(Sprite_Header_Chunk* parent,const char*,size_t);
Saturn_Sprite_Chunk(Sprite_Header_Chunk * parent)40 	Saturn_Sprite_Chunk(Sprite_Header_Chunk* parent)
41 	: Chunk_With_Children(parent,"SPRITESA"){}
42 };
43 class Playstation_Sprite_Chunk : public Chunk_With_Children
44 {
45 public:
46 	Playstation_Sprite_Chunk(Sprite_Header_Chunk* parent,const char*,size_t);
Playstation_Sprite_Chunk(Sprite_Header_Chunk * parent)47 	Playstation_Sprite_Chunk(Sprite_Header_Chunk* parent)
48 	: Chunk_With_Children(parent,"SPRITEPS"){}
49 };
50 
51 
52 #define SpriteActionFlag_FlipSecondSide 	0x00000001 //for actions where only right facing views are available
53 class Sprite_Action_Chunk  : public Chunk
54 {
55 public:
56 	Sprite_Action_Chunk(Chunk_With_Children* parent,const char*,size_t);
57 	Sprite_Action_Chunk(Chunk_With_Children* parent);
58 	~Sprite_Action_Chunk();
59 
60 	virtual BOOL output_chunk (HANDLE &hand);
61 
62 	virtual size_t size_chunk();
63 
64 	virtual void fill_data_block(char* data_start);
65 
66 public:
67 
68 	int Action;
69 	int NumYaw;
70 	int NumPitch;
71 	int NumFrames;
72 	Frame*** FrameList;
73 	int Flags;
74 	int FrameTime;
75 
76 };
77 #define SpriteFlag_NoLight			0x00000001
78 #define SpriteFlag_SemiTrans		0x00000002 //for playstation
79 class Sprite_Size_Chunk  : public Chunk
80 {
81 public:
82 	Sprite_Size_Chunk(Chunk_With_Children* parent,const char*,size_t);
83 	Sprite_Size_Chunk(Chunk_With_Children* parent);
84 
85 	virtual BOOL output_chunk (HANDLE &hand);
86 
87 	virtual size_t size_chunk();
88 
89 	virtual void fill_data_block(char* data_start);
90 
91 public:
92 
93 	double scale;
94 	double maxy;
95 	double maxx;
96 	int radius;
97 	int Flags ;
98 };
99 
100 class Sprite_Extent_Chunk  : public Chunk
101 {
102 public:
103 	Sprite_Extent_Chunk(Chunk_With_Children* parent,const char*,size_t);
104 	Sprite_Extent_Chunk(Chunk_With_Children* parent);
105 
106 
107 	virtual size_t size_chunk();
108 
109 	virtual void fill_data_block(char* data_start);
110 
111 public:
112 
113 	double minx;
114 	double maxx;
115 	double miny;
116 	double maxy;
117 	int spare1,spare2;
118 };
119 
120 class Sprite_Version_Number_Chunk  : public Chunk
121 {
122 public:
123 	Sprite_Version_Number_Chunk(Chunk_With_Children* parent,const char*,size_t);
124 	Sprite_Version_Number_Chunk(Chunk_With_Children* parent);
125 
126 	virtual BOOL output_chunk (HANDLE &hand);
127 
128 	virtual size_t size_chunk();
129 
130 	virtual void fill_data_block(char* data_start);
131 
132 public:
133 	int version_num;
134 };
135 
136 class Sprite_Bitmap_Scale_Chunk : public Chunk
137 {
138 public :
139 	Sprite_Bitmap_Scale_Chunk(Chunk_With_Children* parent,const char*,size_t);
140 	Sprite_Bitmap_Scale_Chunk(Chunk_With_Children* parent);
141 	~Sprite_Bitmap_Scale_Chunk();
142 
143 	virtual size_t size_chunk();
144 	virtual void fill_data_block(char* data_start);
145 
146 	int NumBitmaps;
147 	float* Scale;
148 };
149 
150 class Sprite_Bitmap_Centre_Chunk : public Chunk
151 {
152 public :
153 	Sprite_Bitmap_Centre_Chunk(Chunk_With_Children* parent,const char*,size_t);
154 	Sprite_Bitmap_Centre_Chunk(Chunk_With_Children* parent);
155 	~Sprite_Bitmap_Centre_Chunk();
156 
157 	virtual size_t size_chunk();
158 	virtual void fill_data_block(char* data_start);
159 
160 	int NumBitmaps;
161 	int* CentreX;
162 	int* CentreY;
163 	int* OffsetX;
164 	int* OffsetY;
165 	int spare;
166 
167 };
168 #endif
169