1 /*
2  *  ready.h - Information from the 'ready.dat' file.
3  *
4  *  Copyright (C) 2000-2013  The Exult Team
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, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  */
20 
21 #ifndef INCL_READY
22 #define INCL_READY  1
23 
24 /*
25  *  Internal Exult types describing how a shape may be worn.
26  */
27 enum Ready_type_Exult {
28     head = 0x00,
29     backpack = 0x01,
30     belt = 0x02,
31     lhand = 0x03,
32     lfinger = 0x04,
33     legs = 0x05,
34     feet = 0x06,
35     rfinger = 0x07,             // Only for usecode or for alternate slot.
36     rhand = 0x08,
37     torso = 0x09,
38     amulet = 0x0a,
39     quiver = 0x0b,
40     back_2h = 0x0c,             // Only for usecode or for alternate slot
41     back_shield = 0x0d,         // Only for usecode or for alternate slot
42     earrings = 0x0e,
43     cloak = 0x0f,
44     gloves = 0x10,
45     ucont = 0x11,
46     // The following four entries are not actual spots, but mark an object as
47     // filling multiple spots of the given type.
48     both_hands = 0x12,          // Uses both hands.
49     lrgloves = 0x13,            // Uses gloves spot, fills ring.
50     neck = 0x14,                // Uses amulet spot, fills cloak.
51     // Used for alternate slot only:
52     scabbard = 0x15,            // Uses belt spot, fills back_2h, back_shield.
53     // Marks as firing triple crossbow bolts:
54     triple_bolts = 0x16,
55     // Used for paperdolling only:
56     cloak_clasp = 102,
57     invalid_spot = 0xff
58 };
59 
60 // Black Gate Ready types
61 enum Ready_type_BG {
62     backpack_bg = 0x00,
63     lhand_bg = 0x01,
64     rhand_bg = 0x02,            // Only for usecode or for alternate slot
65     belt_bg = 0x03,             // Only for usecode or for alternate slot
66     neck_bg = 0x04,
67     torso_bg = 0x05,
68     lfinger_bg = 0x06,
69     rfinger_bg = 0x07,          // Only for usecode or for alternate slot
70     quiver_bg = 0x08,
71     head_bg = 0x09,
72     legs_bg = 0x0a,
73     feet_bg = 0x0b,
74     ucont_bg = 0x0c,            // Porting from SI
75     cloak_bg = 0x0d,            // Porting from SI
76     gloves_bg = 0x0e,           // Porting from SI
77     triple_bolts_bg = 0x0f,
78     earrings_bg = 0x10,         // Porting from SI
79     back_shield_bg = 0x11,      // Porting from SI
80     tongs_bg = 0x12,            // Silently converted to lhand_bg
81     back_2h_bg = 0x13,          // Porting from SI
82     both_hands_bg = 0x14,
83     lrgloves_bg = 0x15,
84     amulet_bg = 0x16,
85     scabbard_bg = 0x17          // Only for alternate slot
86 };
87 
88 // Serpent Isle Ready types
89 enum Ready_type_SI {
90     rhand_si = 0x00,
91     lhand_si = 0x01,
92     cloak_si = 0x02,
93     amulet_si = 0x03,
94     head_si = 0x04,
95     gloves_si = 0x05,
96     ucont_si = 0x06,
97     rfinger_si = 0x07,          // Only for usecode or for alternate slot
98     lfinger_si = 0x08,
99     earrings_si = 0x09,
100     quiver_si = 0x0a,
101     belt_si = 0x0b,
102     torso_si = 0x0c,
103     feet_si = 0x0d,
104     legs_si = 0x0e,
105     backpack_si = 0x0f,
106     back_shield_si = 0x10,      // Only for usecode or for alternate slot
107     back_2h_si = 0x11,          // Only for usecode or for alternate slot
108     triple_bolts_si = 0x12,     // Porting from BG
109     both_hands_si = 0x14,
110     lrgloves_si = 0x15,         // Porting from BG
111     neck_si = 0x16,
112     scabbard_si = 0x17          // Only for alternate slot
113 };
114 
115 /*
116  *  Convert to BG ready spot # from ours (or invalid_spot if not found).
117  */
118 
Ready_spot_to_BG(int spot)119 inline int Ready_spot_to_BG(int spot) {
120 	switch (spot) {
121 	case head:
122 		return head_bg;
123 	case backpack:
124 		return backpack_bg;
125 	case belt:
126 		return belt_bg;
127 	case lhand:
128 		return lhand_bg;
129 	case lfinger:
130 		return lfinger_bg;
131 	case legs:
132 		return legs_bg;
133 	case feet:
134 		return feet_bg;
135 	case rfinger:
136 		return rfinger_bg;
137 	case rhand:
138 		return rhand_bg;
139 	case torso:
140 		return torso_bg;
141 	case amulet:
142 		return amulet_bg;
143 	case quiver:
144 		return quiver_bg;
145 	case back_2h:
146 		return back_2h_bg;
147 	case back_shield:
148 		return back_shield_bg;
149 	case earrings:
150 		return earrings_bg;
151 	case cloak:
152 		return cloak_bg;
153 	case gloves:
154 		return gloves_bg;
155 	case ucont:
156 		return ucont_bg;
157 	case both_hands:
158 		return both_hands_bg;
159 	case lrgloves:
160 		return lrgloves_bg;
161 	case triple_bolts:
162 		return triple_bolts_bg;
163 	case scabbard:
164 		return scabbard_bg;
165 	case neck:
166 		return neck_bg;
167 	default:
168 		return invalid_spot;
169 	}
170 }
171 
172 /*
173  *  Convert to SI ready spot # from ours (or invalid_spot if not found).
174  */
175 
Ready_spot_to_SI(int spot)176 inline int Ready_spot_to_SI(int spot) {
177 	switch (spot) {
178 	case head:
179 		return head_si;
180 	case backpack:
181 		return backpack_si;
182 	case belt:
183 		return belt_si;
184 	case lhand:
185 		return lhand_si;
186 	case lfinger:
187 		return lfinger_si;
188 	case legs:
189 		return legs_si;
190 	case feet:
191 		return feet_si;
192 	case rfinger:
193 		return rfinger_si;
194 	case rhand:
195 		return rhand_si;
196 	case torso:
197 		return torso_si;
198 	case amulet:
199 		return amulet_si;
200 	case quiver:
201 		return quiver_si;
202 	case back_2h:
203 		return back_2h_si;
204 	case back_shield:
205 		return back_shield_si;
206 	case earrings:
207 		return earrings_si;
208 	case cloak:
209 		return cloak_si;
210 	case gloves:
211 		return gloves_si;
212 	case ucont:
213 		return ucont_si;
214 	case both_hands:
215 		return both_hands_si;
216 	case lrgloves:
217 		return lrgloves_si;
218 	case triple_bolts:
219 		return triple_bolts_si;
220 	case scabbard:
221 		return scabbard_si;
222 	case neck:
223 		return neck_si;
224 	default:
225 		return invalid_spot;
226 	}
227 }
228 
229 
230 /*
231  *  Convert from BG ready spot # to ours (or invalid_spot if not found).
232  */
233 
Ready_spot_from_BG(int spot)234 inline int Ready_spot_from_BG(int spot) {
235 	switch (spot) {
236 	case head_bg:
237 		return head;
238 	case backpack_bg:
239 		return backpack;
240 	case belt_bg:
241 		return belt;
242 	case lhand_bg:
243 		return lhand;
244 	case lfinger_bg:
245 		return lfinger;
246 	case legs_bg:
247 		return legs;
248 	case feet_bg:
249 		return feet;
250 	case rfinger_bg:
251 		return rfinger;
252 	case rhand_bg:
253 		return rhand;
254 	case torso_bg:
255 		return torso;
256 	case amulet_bg:
257 		return amulet;
258 	case quiver_bg:
259 		return quiver;
260 	case back_2h_bg:
261 		return back_2h;
262 	case back_shield_bg:
263 		return back_shield;
264 	case earrings_bg:
265 		return earrings;
266 	case cloak_bg:
267 		return cloak;
268 	case gloves_bg:
269 		return gloves;
270 	case ucont_bg:
271 		return ucont;
272 	case both_hands_bg:
273 		return both_hands;
274 	case lrgloves_bg:
275 		return lrgloves;
276 	case triple_bolts_bg:
277 		return triple_bolts;
278 	case tongs_bg:
279 		return lhand;
280 	case scabbard_bg:
281 		return scabbard;
282 	case neck_bg:
283 		return neck;
284 	default:
285 		return invalid_spot;
286 	}
287 }
288 
289 /*
290  *  Convert from SI ready spot # to ours (or invalid_spot if not found).
291  */
292 
Ready_spot_from_SI(int spot)293 inline int Ready_spot_from_SI(int spot) {
294 	switch (spot) {
295 	case head_si:
296 		return head;
297 	case backpack_si:
298 		return backpack;
299 	case belt_si:
300 		return belt;
301 	case lhand_si:
302 		return lhand;
303 	case lfinger_si:
304 		return lfinger;
305 	case legs_si:
306 		return legs;
307 	case feet_si:
308 		return feet;
309 	case rfinger_si:
310 		return rfinger;
311 	case rhand_si:
312 		return rhand;
313 	case torso_si:
314 		return torso;
315 	case amulet_si:
316 		return amulet;
317 	case quiver_si:
318 		return quiver;
319 	case back_2h_si:
320 		return back_2h;
321 	case back_shield_si:
322 		return back_shield;
323 	case earrings_si:
324 		return earrings;
325 	case cloak_si:
326 		return cloak;
327 	case gloves_si:
328 		return gloves;
329 	case ucont_si:
330 		return ucont;
331 	case both_hands_si:
332 		return both_hands;
333 	case lrgloves_si:
334 		return lrgloves;
335 	case triple_bolts_si:
336 		return triple_bolts;
337 	case scabbard_si:
338 		return scabbard;
339 	case neck_si:
340 		return neck;
341 	default:
342 		return invalid_spot;
343 	}
344 }
345 
346 #endif  /* INCL_READY   */
347 
348