1 /*
2  * Seven Kingdoms: Ancient Adversaries
3  *
4  * Copyright 1997,1998 Enlight Software Ltd.
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 //Filename    : OSFRMRES.H
22 //Description : Header file of Object SpriteFrame resource
23 
24 #ifndef __OSFRMRES_H
25 #define __OSFRMRES_H
26 
27 #ifndef __ALL_H
28 #include <ALL.h>
29 #endif
30 
31 
32 //-------- Define struct SpriteFrameRec ----------//
33 
34 struct SpriteFrameRec
35 {
36 	enum { NAME_LEN=8, ACTION_LEN=2, DIR_LEN=2, FRAME_ID_LEN=2, OFFSET_LEN=4,
37 			 WIDTH_LEN=3, HEIGHT_LEN=3, FILE_NAME_LEN=8, BITMAP_OFFSET_LEN=4 };
38 
39 	char sprite_name[NAME_LEN];
40 	char action[ACTION_LEN];
41 	char dir[DIR_LEN];
42 	char frame_id[FRAME_ID_LEN];
43 
44 	char offset_x[OFFSET_LEN];
45 	char offset_y[OFFSET_LEN];
46 	char width[WIDTH_LEN];
47 	char height[HEIGHT_LEN];
48 
49 	char file_name[FILE_NAME_LEN];
50 	char bitmap_offset[BITMAP_OFFSET_LEN];
51 };
52 
53 //------- Define struct SpriteFrame --------//
54 
55 struct SpriteFrame
56 {
57 	char  offset_x, offset_y;
58 	short width, height;
59 	uint32_t bitmap_offset;
60 };
61 
62 //--------- Define class SpriteFrameRes --------//
63 
64 class SpriteFrameRes
65 {
66 public:
67 	int  sprite_frame_count;
68 	char init_flag;
69 
70 private:
71 	SpriteFrame* sprite_frame_array;
72 
73 public:
SpriteFrameRes()74 	SpriteFrameRes() 	{ init_flag=0; }
75 
76 	void init();
77 	void deinit();
78 
79 	void load_info();
80 
81 	#ifdef DYNARRAY_DEBUG_ELEMENT_ACCESS
82 		SpriteFrame* operator[](int recNo);
83 	#else
84 		SpriteFrame* operator[](int recNo)   { return sprite_frame_array+recNo-1; }
85 	#endif
86 };
87 
88 extern SpriteFrameRes sprite_frame_res;
89 
90 //----------------------------------------------//
91 
92 #endif
93 
94