1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef CREATE_KYRADAT_TYPES_H
24 #define CREATE_KYRADAT_TYPES_H
25 
26 #include "create_kyradat.h"
27 
28 struct Room {
29 	byte index;
30 	uint16 north, east, south, west;
31 };
32 
33 struct Shape {
34 	byte imageIndex;
35 	byte x, y, w, h;
36 	int8 xOffset, yOffset;
37 };
38 
39 struct AmigaSfxTable {
40 	byte note;
41 	byte patch;
42 	uint16 duration;
43 	byte volume;
44 	byte pan;
45 };
46 
47 struct HoFSequence {
48 	uint16 flags;
49 	char wsaFile[14];
50 	char cpsFile[14];
51 	byte fadeInTransitionType;
52 	byte fadeOutTransitionType;
53 	uint16 stringIndex1;
54 	uint16 stringIndex2;
55 	uint16 startFrame;
56 	uint16 numFrames;
57 	uint16 duration;
58 	uint16 xPos;
59 	uint16 yPos;
60 	uint16 timeout;
61 };
62 
63 struct FrameControl {
64 	uint16 index;
65 	uint16 delay;
66 };
67 
68 struct HoFNestedSequence {
69 	uint16 flags;
70 	char wsaFile[14];
71 	uint16 startFrame;
72 	uint16 endFrame;
73 	uint16 frameDelay;
74 	uint16 x;
75 	uint16 y;
76 	uint16 numControls;
77 	const FrameControl *wsaControl;
78 	uint16 fadeInTransitionType;
79 	uint16 fadeOutTransitionType;
80 };
81 
82 struct HoFSeqItemAnimData {
83 	int16 itemIndex;
84 	uint16 y;
85 	uint16 frames[20];
86 };
87 
88 struct ItemAnimDefinition {
89 	int16 itemIndex;
90 	byte numFrames;
91 	const FrameControl *frames;
92 };
93 
94 struct LoLCharacter {
95 	uint16 flags;
96 	char name[11];
97 	byte raceClassSex;
98 	int16 id;
99 	byte curFaceFrame;
100 	byte tempFaceFrame;
101 	byte screamSfx;
102 	/*uint32 unused;*/
103 	uint16 itemsMight[8];
104 	uint16 protectionAgainstItems[8];
105 	uint16 itemProtection;
106 	int16 hitPointsCur;
107 	uint16 hitPointsMax;
108 	int16 magicPointsCur;
109 	uint16 magicPointsMax;
110 	byte field_41;
111 	uint16 damageSuffered;
112 	uint16 weaponHit;
113 	uint16 totalMightModifier;
114 	uint16 totalProtectionModifier;
115 	uint16 might;
116 	uint16 protection;
117 	int16 nextAnimUpdateCountdown;
118 	uint16 items[11];
119 	byte skillLevels[3];
120 	byte skillModifiers[3];
121 	uint32 experiencePts[3];
122 	byte characterUpdateEvents[5];
123 	byte characterUpdateDelay[5];
124 };
125 
126 struct SpellProperty {
127 	uint16 spellNameCode;
128 	uint16 mpRequired[4];
129 	uint16 field_a;
130 	uint16 field_c;
131 	uint16 hpRequired[4];
132 	uint16 field_16;
133 	uint16 field_18;
134 	uint16 flags;
135 };
136 
137 struct CompassDef {
138 	byte shapeIndex;
139 	int8 x, y;
140 	byte flags;
141 };
142 
143 struct FlyingObjectShape {
144 	byte shapeFront;
145 	byte shapeBack;
146 	byte shapeLeft;
147 	byte drawFlags;
148 	byte flipFlags;
149 };
150 
151 struct LoLButtonDef {
152 	uint16 buttonFlags;
153 	uint16 keyCode;
154 	uint16 keyCode2;
155 	int16 x, y;
156 	uint16 w, h;
157 	uint16 index;
158 	uint16 screenDim;
159 };
160 
161 struct DarkMoonAnimCommand {
162 	byte command;
163 	byte obj;
164 	int16 x1;
165 	byte y1;
166 	byte delay;
167 	byte pal;
168 	byte x2, y2;
169 	byte w, h;
170 };
171 
172 struct DarkMoonShapeDef {
173 	int16 index;
174 	byte x, y, w, h;
175 };
176 
177 struct EoBCharacter {
178 	byte id;
179 	byte flags;
180 	char name[11];
181 	int8 strengthCur, strengthMax;
182 	int8 strengthExtCur, strengthExtMax;
183 	int8 intelligenceCur, intelligenceMax;
184 	int8 wisdomCur, wisdomMax;
185 	int8 dexterityCur, dexterityMax;
186 	int8 constitutionCur, constitutionMax;
187 	int8 charismaCur, charismaMax;
188 	int16 hitPointsCur, hitPointsMax;
189 	int8 armorClass;
190 	byte disabledSlots;
191 	byte raceSex;
192 	byte cClass;
193 	byte alignment;
194 	int8 portrait;
195 	byte food;
196 	byte level[3];
197 	uint32 experience[3];
198 	uint32 mageSpellsAvailableFlags;
199 	uint16 inventory[27];
200 };
201 
202 template<typename Type>
203 struct ArrayProvider {
204 	uint numEntries;
205 	const Type *data;
206 };
207 
208 typedef ArrayProvider<const char *> StringListProvider;
209 typedef ArrayProvider<byte> ByteProvider;
210 typedef ArrayProvider<Room> RoomProvider;
211 typedef ArrayProvider<Shape> ShapeProvider;
212 typedef ArrayProvider<AmigaSfxTable> AmigaSfxTableProvider;
213 
214 struct HoFSequenceProvider {
215 	uint numSequences;
216 	const HoFSequence *sequences;
217 
218 	uint numNestedSequences;
219 	const HoFNestedSequence *nestedSequences;
220 };
221 
222 typedef ArrayProvider<HoFSeqItemAnimData> HoFSeqItemAnimDataProvider;
223 typedef ArrayProvider<ItemAnimDefinition> ItemAnimDefinitionProvider;
224 typedef ArrayProvider<LoLCharacter> LoLCharacterProvider;
225 typedef ArrayProvider<SpellProperty> SpellPropertyProvider;
226 typedef ArrayProvider<CompassDef> CompassDefProvider;
227 typedef ArrayProvider<FlyingObjectShape> FlyingObjectShapeProvider;
228 typedef ArrayProvider<LoLButtonDef> LoLButtonDefProvider;
229 typedef ArrayProvider<uint16> Uint16Provider;
230 typedef ArrayProvider<uint32> Uint32Provider;
231 typedef ArrayProvider<DarkMoonAnimCommand> DarkMoonAnimCommandProvider;
232 typedef ArrayProvider<DarkMoonShapeDef> DarkMoonShapeDefProvider;
233 typedef ArrayProvider<EoBCharacter> EoBCharacterProvider;
234 
235 class PAKFile;
236 void writeResource(PAKFile &out, const char *filename, ResTypes type, const void *provider);
237 
238 #endif
239