yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
sprite.cc
Go to the documentation of this file.
1#include "sprite.h"
2
4
5namespace yaze {
6namespace app {
7namespace zelda3 {
8
9void Sprite::UpdateMapProperties(uint16_t map_id) {
10 map_x_ = x_;
11 map_y_ = y_;
12 name_ = kSpriteDefaultNames[id_];
13}
14
15void Sprite::UpdateCoordinates(int map_x, int map_y) {
16 map_x_ = map_x;
17 map_y_ = map_y;
18}
19
21 lower_x_ = 1;
22 lower_y_ = 1;
23 higher_x_ = 15;
24 higher_x_ = 15;
25}
26
28 uint8_t x = nx_;
29 uint8_t y = ny_;
30
31 if (overlord_ == 0x07) {
32 if (id_ == 0x1A) {
33 DrawSpriteTile((x * 16), (y * 16), 14, 6, 11); // bomb
34 } else if (id_ == 0x05) {
35 DrawSpriteTile((x * 16), (y * 16) - 12, 12, 16, 12, false, true);
36 DrawSpriteTile((x * 16), (y * 16), 0, 16, 12, false, true);
37 } else if (id_ == 0x06) {
38 DrawSpriteTile((x * 16), (y * 16), 10, 26, 14, true, true, 2,
39 2); // snek
40 } else if (id_ == 0x09) {
41 DrawSpriteTile((x * 16), (y * 16), 6, 26, 14);
42 DrawSpriteTile((x * 16) + 8, (y * 16) + 8, 8, 26, 14);
43 DrawSpriteTile((x * 16), (y * 16) + 16, 10, 27, 14, false, false, 1, 1);
44 } else if (id_ == 0x14) {
45 DrawSpriteTile((x * 16), (y * 16) + 8, 12, 06, 12, false, false, 2,
46 1); // shadow tile
47 DrawSpriteTile((x * 16), (y * 16) - 8, 3, 29, 8, false, false, 1,
48 1); // tile
49 DrawSpriteTile((x * 16) + 8, (y * 16) - 8, 3, 29, 8, true, false, 1,
50 1); // tile
51 DrawSpriteTile((x * 16), (y * 16), 3, 29, 8, false, true, 1,
52 1); // tile
53 DrawSpriteTile((x * 16) + 8, (y * 16), 3, 29, 8, true, true, 1,
54 1); // tile
55 } else {
56 DrawSpriteTile((x * 16), (y * 16), 4, 4, 5);
57 }
58
59 if (nx_ != x || ny_ != y) {
60 bounding_box_.x = (lower_x_ + (nx_ * 16));
61 bounding_box_.y = (lower_y_ + (ny_ * 16));
64 } else {
65 bounding_box_.x = (lower_x_ + (x * 16));
66 bounding_box_.y = (lower_y_ + (y * 16));
69 }
70
71 return;
72 }
73
74 if (id_ == 0x00) {
75 DrawSpriteTile((x * 16), (y * 16), 4, 28, 10);
76 } else if (id_ == 0x01) {
77 DrawSpriteTile((x * 16) - 8, (y * 16), 6, 24, 12, false, false, 2, 2);
78 DrawSpriteTile((x * 16) + 8, (y * 16), 6, 24, 12, true, false, 2, 2);
79 } else if (id_ == 0x02) {
80 DrawSpriteTile((x * 16), (y * 16), 0, 16, 10);
81 } else if (id_ == 0x04) {
82 uint8_t p = 3;
83
84 DrawSpriteTile((x * 16), (y * 16), 14, 28, p);
85 DrawSpriteTile((x * 16), (y * 16), 14, 30, p);
86 } else if (id_ == 0x05) {
87 uint8_t p = 3;
88
89 DrawSpriteTile((x * 16), (y * 16), 14, 28, p);
90 DrawSpriteTile((x * 16), (y * 16), 14, 30, p);
91 } else if (id_ == 0x06) {
92 uint8_t p = 3;
93
94 DrawSpriteTile((x * 16), (y * 16), 14, 28, p);
95 DrawSpriteTile((x * 16), (y * 16), 14, 30, p);
96 } else if (id_ == 0x07) {
97 uint8_t p = 3;
98
99 DrawSpriteTile((x * 16), (y * 16), 14, 28, p);
100 DrawSpriteTile((x * 16), (y * 16), 14, 30, p);
101 } else if (id_ == 0x08) {
102 DrawSpriteTile((x * 16), (y * 16), 0, 24, 6);
103 DrawSpriteTile((x * 16) + 4, (y * 16) + 6, 0, 24, 6, false, false, 1, 1);
104 } else if (id_ == 0x09) {
105 DrawSpriteTile((x * 16) - 22, (y * 16) - 24, 12, 24, 12, false, false, 2,
106 2); // Moldorm tail
107 DrawSpriteTile((x * 16) - 16, (y * 16) - 20, 8, 24, 12, false, false, 2,
108 2); // Moldorm b2
109 DrawSpriteTile((x * 16) - 12, (y * 16) - 16, 4, 24, 12, false, false, 4,
110 4); // Moldorm b
111 DrawSpriteTile((x * 16), (y * 16), 0, 24, 12, false, false, 4,
112 4); // Moldorm head
113
114 DrawSpriteTile((x * 16) + 20, (y * 16) + 12, 8, 26, 14, false, false, 2,
115 2); // Moldorm eye
116 DrawSpriteTile((x * 16) + 12, (y * 16) + 20, 8, 26, 14, false, false, 2,
117 2); // Moldorm eye
118 } else if (id_ == 0x0A) {
119 DrawSpriteTile((x * 16), (y * 16), 0, 24, 8);
120 DrawSpriteTile((x * 16) + 4, (y * 16) + 6, 0, 24, 8, false, false, 1, 1);
121 } else if (id_ == 0x0B) {
122 DrawSpriteTile((x * 16), (y * 16), 10, 30, 10);
123 } else if (id_ == 0x0C) {
124 DrawSpriteTile((x * 16), (y * 16), 0, 24, 8);
125 DrawSpriteTile((x * 16) + 4, (y * 16) + 6, 0, 24, 8, false, false, 1, 1);
126 } else if (id_ == 0x0D) {
127 DrawSpriteTile((x * 16), (y * 16), 14, 28, 12);
128 } else if (id_ == 0x0E) {
129 DrawSpriteTile((x * 16), (y * 16), 8, 18, 10, false, false, 3, 2);
130 } else if (id_ == 0x0F) {
131 DrawSpriteTile((x * 16), (y * 16), 14, 24, 8, false, false, 2, 3);
132 DrawSpriteTile((x * 16) + 16, (y * 16), 30, 8, 8, true, false, 1, 3);
133 } else if (id_ == 0x10) {
134 DrawSpriteTile((x * 16), (y * 16), 12, 31, 8, false, false, 1, 1);
135 } else if (id_ == 0x11) {
136 DrawSpriteTile((x * 16), (y * 16) + 16, 6, 16, 8, false, false, 2,
137 2); // Feet
138 DrawSpriteTile((x * 16) - 8, (y * 16) + 8, 4, 18, 8, false, false, 2,
139 2); // Body1
140 DrawSpriteTile((x * 16) + 8, (y * 16) + 8, 4, 18, 8, true, false, 2,
141 2); // Body2
142 DrawSpriteTile((x * 16), (y * 16), 0, 16, 8, false, false, 2,
143 2); // Head
144 } else if (id_ == 0x12) {
145 DrawSpriteTile((x * 16), (y * 16) + 8, 8, 26, 8);
146 DrawSpriteTile((x * 16), (y * 16), 6, 24, 8);
147 } else if (id_ == 0x13) {
148 DrawSpriteTile((x * 16), (y * 16), 4, 22, 2);
149 } else if (id_ == 0x15) {
150 // Antifairy
151 DrawSpriteTile((x * 16) + 2, (y * 16) + 8, 3, 30, 5, false, false, 1, 1);
152 DrawSpriteTile((x * 16) + 8, (y * 16) + 2, 3, 30, 5, false, false, 1, 1);
153 DrawSpriteTile((x * 16) + 14, (y * 16) + 8, 3, 30, 5, false, false, 1, 1);
154 DrawSpriteTile((x * 16) + 8, (y * 16) + 14, 3, 30, 5, false, false, 1, 1);
155 DrawSpriteTile((x * 16) + 8, (y * 16) + 8, 1, 30, 5, false, false, 1,
156 1); // Middle
157 } else if (id_ == 0x16) {
158 DrawSpriteTile((x * 16), (y * 16) + 8, 2, 26, 2);
159 DrawSpriteTile((x * 16), (y * 16), 0, 26, 2);
160 } else if (id_ == 0x17) // Bush hoarder
161 {
162 DrawSpriteTile((x * 16), (y * 16), 8, 30, 10);
163 } else if (id_ == 0x18) // Mini moldorm
164 {
165 DrawSpriteTile((x * 16) + 13, (y * 16) + 17, 13, 21, 8, false, false, 1,
166 1); // Tail
167 DrawSpriteTile((x * 16) + 5, (y * 16) + 8, 2, 22, 8); // Body
168 DrawSpriteTile((x * 16), (y * 16), 0, 22, 8); // Head
169 DrawSpriteTile((x * 16), (y * 16) - 4, 13, 20, 8, false, false, 1,
170 1); // Eyes
171 DrawSpriteTile((x * 16) - 4, (y * 16), 13, 20, 8, false, false, 1,
172 1); // Eyes
173 } else if (id_ == 0x19) // Poe - ghost
174 {
175 DrawSpriteTile((x * 16), (y * 16), 6, 31, 2); //
176 } else if (id_ == 0x1A) // Smith
177 {
178 // DrawSpriteTile((x*16), (y *16), 2, 4, 10,true); // Smitty
179 // DrawSpriteTile((x*16)+12, (y *16) - 7, 0, 6, 10); // Hammer
180 DrawSpriteTile((x * 16), (y * 16), 4, 22, 10);
181 } else if (id_ == 0x1C) // Statue
182 {
183 DrawSpriteTile((x * 16), (y * 16) + 8, 0, 28, 15);
184 DrawSpriteTile((x * 16), (y * 16), 2, 28, 15, false, false, 1, 1);
185 DrawSpriteTile((x * 16) + 8, (y * 16), 2, 28, 15, true, false, 1, 1);
186 } else if (id_ == 0x1E) // Crystal switch
187 {
188 DrawSpriteTile((x * 16), (y * 16), 4, 30, 5);
189 } else if (id_ == 0x1F) // Sick kid
190 {
191 DrawSpriteTile((x * 16) - 8, (y * 16) + 8, 10, 16, 14);
192 DrawSpriteTile((x * 16) + 16 - 8, (y * 16) + 8, 10, 16, 14, true);
193 DrawSpriteTile((x * 16) - 8, (y * 16) + 16, 10, 16, 14, false, true, 2, 2);
194 DrawSpriteTile((x * 16) + 16 - 8, (y * 16) + 16, 10, 16, 14, true, true, 2,
195 2);
196 DrawSpriteTile((x * 16), (y * 16) - 4, 14, 16, 10);
197 } else if (id_ == 0x20) {
198 DrawSpriteTile((x * 16), (y * 16), 2, 24, 7);
199 } else if (id_ == 0x21) // Push switch
200 {
201 DrawSpriteTile((x * 16) + 4, (y * 16) + 20, 13, 29, 3, false, false, 1, 1);
202 DrawSpriteTile((x * 16) + 4, (y * 16) + 28, 12, 29, 3, false, false, 1, 1);
203 DrawSpriteTile((x * 16), (y * 16) + 8, 10, 28, 3);
204 } else if (id_ == 0x22) // Rope
205 {
206 DrawSpriteTile((x * 16), (y * 16), 8, 26, 5);
207 } else if (id_ == 0x23) // Red bari
208 {
209 DrawSpriteTile((x * 16), (y * 16), 2, 18, 4, false, false, 1, 2);
210 DrawSpriteTile((x * 16) + 8, (y * 16), 2, 18, 4, true, false, 1, 2);
211 } else if (id_ == 0x24) // Blue bari
212 {
213 DrawSpriteTile((x * 16), (y * 16), 2, 18, 6, false, false, 1, 2);
214 DrawSpriteTile((x * 16) + 8, (y * 16), 2, 18, 6, true, false, 1, 2);
215 } else if (id_ == 0x25) // Talking tree?
216 {
217 // TODO: Add something here?
218 } else if (id_ == 0x26) // Hardhat beetle
219 {
220 if ((x & 0x01) == 0x00) {
221 DrawSpriteTile((x * 16), (y * 16), 4, 20, 8);
222 DrawSpriteTile((x * 16), (y * 16) - 6, 0, 20, 8);
223 } else {
224 DrawSpriteTile((x * 16), (y * 16), 4, 20, 10);
225 DrawSpriteTile((x * 16), (y * 16) - 6, 0, 20, 10);
226 }
227 } else if (id_ == 0x27) // Deadrock
228 {
229 DrawSpriteTile((x * 16), (y * 16), 2, 30, 10);
230 } else if (id_ == 0x28) // Npcs
231 {
232 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
233 } else if (id_ == 0x29) // Npcs
234 {
235 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
236 } else if (id_ == 0x2A) // Npcs
237 {
238 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
239 } else if (id_ == 0x2B) // ???
240 {
241 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
242 } else if (id_ == 0x2C) // Lumberjack
243 {
244 DrawSpriteTile((x * 16) - 24, (y * 16) + 12, 6, 26, 12, true); // Body
245 DrawSpriteTile((x * 16) - 24, (y * 16), 8, 26, 12, true); // Head
246
247 DrawSpriteTile((x * 16) - 14, (y * 16) + 12, 14, 27, 10, false, false, 1,
248 1); // Saw left edge
249 DrawSpriteTile((x * 16) - 6, (y * 16) + 12, 15, 27, 10, false, false, 1,
250 1); // Saw left edge
251 DrawSpriteTile((x * 16) + 2, (y * 16) + 12, 15, 27, 10, false, false, 1,
252 1); // Saw left edge
253 DrawSpriteTile((x * 16) + 10, (y * 16) + 12, 15, 27, 10, false, false, 1,
254 1); // Saw left edge
255 DrawSpriteTile((x * 16) + 18, (y * 16) + 12, 15, 27, 10, false, false, 1,
256 1); // Saw left edge
257 DrawSpriteTile((x * 16) + 26, (y * 16) + 12, 15, 27, 10, false, false, 1,
258 1); // Saw left edge
259 DrawSpriteTile((x * 16) + 34, (y * 16) + 12, 14, 27, 10, true, false, 1,
260 1); // Saw left edge
261
262 DrawSpriteTile((x * 16) + 40, (y * 16) + 12, 4, 26, 12); // Body
263 DrawSpriteTile((x * 16) + 40, (y * 16), 8, 26, 12); // Head
264 } else if (id_ == 0x2D) // Npcs
265 {
266 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
267 } else if (id_ == 0x2E) // Npcs
268 {
269 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
270 } else if (id_ == 0x2F) // Npcs
271 {
272 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
273 } else if (id_ == 0x30) // Npcs
274 {
275 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
276 } else if (id_ == 0x31) // Npcs
277 {
278 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
279 } else if (id_ == 0x32) // Npcs
280 {
281 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
282 }
283 /*
284 else if (id_== 0x33) // Pull for rupees
285 {
286
287 }
288 */
289 else if (id_ == 0x34) // Npcs
290 {
291 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
292 } else if (id_ == 0x35) // Npcs
293 {
294 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
295 } else if (id_ == 0x36) // Npcs
296 {
297 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
298 }
299 /*
300 else if (id_== 0x37) // Waterfall
301 {
302 DrawSpriteTile((x*16), (y *16), 14, 6, 10);
303 }
304 */
305 else if (id_ == 0x38) // Arrowtarget
306 {
307 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
308 } else if (id_ == 0x39) // Npcs
309 {
310 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
311 } else if (id_ == 0x3A) // Npcs
312 {
313 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
314 } else if (id_ == 0x3B) // Dash item
315 {
316 } else if (id_ == 0x3C) // Npcs
317 {
318 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
319 } else if (id_ == 0x3D) // Npcs
320 {
321 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
322 } else if (id_ == 0x3E) // Npcs
323 {
324 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
325 } else if (id_ == 0x3F) // Npcs
326 {
327 DrawSpriteTile((x * 16), (y * 16), 14, 22, 10);
328 } else if (id_ == 0x40) // Lightning lock (agah tower)
329 {
330 DrawSpriteTile((x * 16) - 24, (y * 16), 10, 28, 2, false, false, 1, 2);
331 DrawSpriteTile((x * 16) - 16, (y * 16), 6, 30, 2);
332 DrawSpriteTile((x * 16), (y * 16), 8, 30, 2);
333 DrawSpriteTile((x * 16) + 16, (y * 16), 6, 30, 2);
334 DrawSpriteTile((x * 16) + 24, (y * 16), 10, 28, 2, false, false, 1, 2);
335 } else if (id_ == 0x41) // Blue soldier
336 {
337 DrawSpriteTile((x * 16) - 4, (y * 16) + 8, 6, 20, 10);
338 DrawSpriteTile((x * 16) + 12, (y * 16) + 8, 6, 20, 10, true, false, 1, 2);
339 DrawSpriteTile((x * 16), (y * 16), 0, 20, 10);
340 DrawSpriteTile((x * 16) + 12, (y * 16) + 8, 13, 22, 10, false, false, 1,
341 2); // Shield
342 DrawSpriteTile((x * 16) - 4, (y * 16) + 16, 14, 22, 10, false, true, 1,
343 2); // Sword
344 } else if (id_ == 0x42) // Green soldier
345 {
346 DrawSpriteTile((x * 16) - 4, (y * 16) + 8, 6, 20, 12);
347 DrawSpriteTile((x * 16) + 12, (y * 16) + 8, 6, 20, 12, true, false, 1, 2);
348 DrawSpriteTile((x * 16), (y * 16), 0, 20, 12);
349 DrawSpriteTile((x * 16) + 12, (y * 16) + 8, 13, 22, 12, false, false, 1,
350 2); // Shield
351 DrawSpriteTile((x * 16) - 4, (y * 16) + 16, 14, 22, 12, false, true, 1,
352 2); // Sword
353 } else if (id_ == 0x43) // Red spear soldier
354 {
355 DrawSpriteTile((x * 16) - 4, (y * 16) + 8, 6, 20, 8);
356 DrawSpriteTile((x * 16) + 12, (y * 16) + 8, 6, 20, 8, true, false, 1, 2);
357 DrawSpriteTile((x * 16), (y * 16), 0, 20, 8);
358 DrawSpriteTile((x * 16) + 12, (y * 16) + 8, 13, 22, 8, false, false, 1,
359 2); // Shield
360 DrawSpriteTile((x * 16) - 4, (y * 16) + 16, 11, 22, 8, false, true, 1,
361 2); // Spear
362 } else if (id_ == 0x44) // Sword blue holding up
363 {
364 DrawSpriteTile((x * 16) + 4, (y * 16) + 8, 6, 16, 10);
365 DrawSpriteTile((x * 16) - 4, (y * 16) + 8, 6, 20, 10, false, false, 1, 2);
366 DrawSpriteTile((x * 16), (y * 16), 0, 16, 10); // Head
367 DrawSpriteTile((x * 16) + 12, (y * 16) + 8, 14, 22, 10, false, true, 1,
368 2); // Sword
369 } else if (id_ == 0x45) // Green spear soldier
370 {
371 DrawSpriteTile((x * 16) - 4, (y * 16) + 8, 6, 20, 12);
372 DrawSpriteTile((x * 16) + 12, (y * 16) + 8, 6, 20, 12, true, false, 1, 2);
373 DrawSpriteTile((x * 16), (y * 16), 0, 20, 12);
374 DrawSpriteTile((x * 16) + 12, (y * 16) + 8, 13, 22, 12, false, false, 1,
375 2); // Shield
376 DrawSpriteTile((x * 16) - 4, (y * 16) + 16, 11, 22, 12, false, true, 1,
377 2); // Spear
378 } else if (id_ == 0x46) // Blue archer
379 {
380 DrawSpriteTile((x * 16) - 4, (y * 16) + 8, 6, 20, 10);
381 DrawSpriteTile((x * 16) + 12, (y * 16) + 8, 6, 20, 10, true, false, 1, 2);
382 DrawSpriteTile((x * 16), (y * 16), 0, 20, 10); // Head
383 DrawSpriteTile((x * 16), (y * 16) + 16, 10, 16, 10, false, false, 1,
384 1); // Bow1
385 DrawSpriteTile((x * 16) + 8, (y * 16) + 16, 10, 16, 10, true, false, 1,
386 1); // Bow2
387 } else if (id_ == 0x47) // Green archer
388 {
389 DrawSpriteTile((x * 16), (y * 16) + 8, 14, 16, 12);
390 DrawSpriteTile((x * 16), (y * 16), 0, 20, 12);
391 DrawSpriteTile((x * 16), (y * 16) + 16, 10, 16, 12, false, false, 1,
392 1); // Bow1
393 DrawSpriteTile((x * 16) + 8, (y * 16) + 16, 10, 16, 12, true, false, 1,
394 1); // Bow2
395 } else if (id_ == 0x48) // Javelin soldier red
396 {
397 DrawSpriteTile((x * 16) + 4, (y * 16) + 8, 6, 16, 8);
398 DrawSpriteTile((x * 16) - 4, (y * 16) + 8, 6, 20, 8, false, false, 1, 2);
399 DrawSpriteTile((x * 16), (y * 16), 0, 16, 8); // Head
400 DrawSpriteTile((x * 16) + 12, (y * 16) + 8, 11, 22, 8, false, true, 1,
401 2); // Sword
402 } else if (id_ == 0x49) // Javelin soldier red from bush
403 {
404 DrawSpriteTile((x * 16) + 4, (y * 16) + 8, 6, 16, 8);
405 DrawSpriteTile((x * 16) - 4, (y * 16) + 8, 6, 20, 8, false, false, 1, 2);
406 DrawSpriteTile((x * 16), (y * 16), 0, 18, 8); // Head
407 DrawSpriteTile((x * 16), (y * 16) + 24, 0, 20, 2);
408 DrawSpriteTile((x * 16) + 12, (y * 16) + 8, 11, 22, 8, false, true, 1,
409 2); // Sword
410 } else if (id_ == 0x4A) // Red bomb soldier
411 {
412 DrawSpriteTile((x * 16) + 4, (y * 16) + 8, 6, 16, 8);
413 DrawSpriteTile((x * 16) - 4, (y * 16) + 8, 6, 20, 8, false, false, 1, 2);
414 DrawSpriteTile((x * 16), (y * 16), 0, 16, 8); // Head
415 DrawSpriteTile((x * 16) + 8, (y * 16) - 8, 14, 22, 11); // Bomb
416 } else if (id_ == 0x4B) // Green soldier recruit
417 {
418 // 0,4
419 DrawSpriteTile((x * 16), (y * 16), 6, 24, 12);
420 DrawSpriteTile((x * 16), (y * 16) - 10, 0, 20, 12);
421 } else if (id_ == 0x4C) // Jazzhand
422 {
423 DrawSpriteTile((x * 16), (y * 16), 0, 26, 14, false, false, 6, 2);
424 } else if (id_ == 0x4D) // Rabit??
425 {
426 DrawSpriteTile((x * 16), (y * 16), 0, 26, 12, false, false, 6, 2);
427 } else if (id_ == 0x4E) // Popo1
428 {
429 DrawSpriteTile((x * 16), (y * 16), 0, 20, 10);
430 } else if (id_ == 0x4F) // Popo2
431 {
432 DrawSpriteTile((x * 16), (y * 16), 2, 20, 10);
433 } else if (id_ == 0x50) // Canon ball
434 {
435 DrawSpriteTile((x * 16), (y * 16), 0, 24, 10);
436 } else if (id_ == 0x51) // Armos
437 {
438 DrawSpriteTile((x * 16), (y * 16), 0, 28, 11, false, false, 2, 4);
439 } else if (id_ == 0x53) // Armos Knight
440 {
441 DrawSpriteTile((x * 16), (y * 16), 0, 28, 10, false, false, 4, 4);
442 } else if (id_ == 0x54) {
443 DrawSpriteTile((x * 16), (y * 16), 2, 28, 12);
444 DrawSpriteTile((x * 16) + 8, (y * 16) + 10, 6, 28, 12);
445 DrawSpriteTile((x * 16) + 16, (y * 16) + 18, 10, 28, 12);
446 } else if (id_ == 0x55) // Fireball Zora
447 {
448 DrawSpriteTile((x * 16), (y * 16), 4, 26, 11);
449 } else if (id_ == 0x56) // Zora
450 {
451 DrawSpriteTile((x * 16), (y * 16), 10, 20, 2);
452 DrawSpriteTile((x * 16), (y * 16) + 8, 8, 30, 2);
453 } else if (id_ == 0x57) // Desert Rocks
454 {
455 DrawSpriteTile((x * 16), (y * 16), 14, 24, 2, false, false, 2, 4);
456 DrawSpriteTile((x * 16) + 16, (y * 16), 14, 24, 2, true, false, 2, 4);
457 } else if (id_ == 0x58) // Crab
458 {
459 DrawSpriteTile((x * 16), (y * 16), 14, 24, 12);
460 DrawSpriteTile((x * 16) + 16, (y * 16), 14, 24, 12, true);
461 } else if (id_ == 0x5B) // Spark
462 {
463 DrawSpriteTile((x * 16), (y * 16), 8, 18, 4);
464 } else if (id_ == 0x5C) // Spark
465 {
466 DrawSpriteTile((x * 16), (y * 16), 8, 18, 4, true);
467 } else if (id_ == 0x5D) // Roller vertical1
468 {
469 // Subset3
470 if (((y * 16) & 0x10) == 0x10) {
471 DrawSpriteTile((x * 16), (y * 16), 8, 24, 11);
472
473 for (int i = 0; i < 7; i++) {
474 DrawSpriteTile((x * 16) + 8 + (i * 16), (y * 16), 9, 24, 11);
475 }
476
477 DrawSpriteTile((x * 16) + (16 * 7), (y * 16), 8, 24, 11, true);
478 } else {
479 DrawSpriteTile((x * 16), (y * 16), 8, 24, 11);
480 DrawSpriteTile((x * 16) + 16, (y * 16), 9, 24, 11);
481 DrawSpriteTile((x * 16) + 32, (y * 16), 9, 24, 11);
482 DrawSpriteTile((x * 16) + 48, (y * 16), 8, 24, 11, true);
483 }
484
485 } else if (id_ == 0x5E) // Roller vertical2
486 {
487 // Subset3
488 if (((y * 16) & 0x10) == 0x10) {
489 DrawSpriteTile((x * 16), (y * 16), 8, 24, 11);
490
491 for (int i = 0; i < 7; i++) {
492 DrawSpriteTile((x * 16) + 8 + (i * 16), (y * 16), 9, 24, 11);
493 }
494
495 DrawSpriteTile((x * 16) + (16 * 7), (y * 16), 8, 24, 11, true);
496 } else {
497 DrawSpriteTile((x * 16), (y * 16), 8, 24, 11);
498 DrawSpriteTile((x * 16) + 16, (y * 16), 9, 24, 11);
499 DrawSpriteTile((x * 16) + 32, (y * 16), 9, 24, 11);
500 DrawSpriteTile((x * 16) + 48, (y * 16), 8, 24, 11, true);
501 }
502 } else if (id_ == 0x5F) // Roller horizontal
503 {
504 if (((x * 16) & 0x10) == 0x10) {
505 DrawSpriteTile((x * 16), (y * 16), 14, 24, 11);
506 DrawSpriteTile((x * 16), (y * 16) + 16, 14, 25, 11);
507 DrawSpriteTile((x * 16), (y * 16) + 32, 14, 25, 11);
508 DrawSpriteTile((x * 16), (y * 16) + 48, 14, 24, 11, false, true);
509 } else {
510 for (int i = 0; i < 7; i++) {
511 DrawSpriteTile((x * 16), (y * 16) + i * 16, 14, 25, 11);
512 }
513
514 DrawSpriteTile((x * 16), (y * 16), 14, 24, 11);
515 DrawSpriteTile((x * 16), (y * 16) + (7 * 16), 14, 24, 11, false, true);
516 }
517 } else if (id_ == 0x60) // Roller horizontal2 (right to left)
518 {
519 // Subset3
520 if (((x * 16) & 0x10) == 0x10) {
521 DrawSpriteTile((x * 16), (y * 16), 14, 24, 11);
522 DrawSpriteTile((x * 16), (y * 16) + 16, 14, 25, 11);
523 DrawSpriteTile((x * 16), (y * 16) + 32, 14, 25, 11);
524 DrawSpriteTile((x * 16), (y * 16) + 48, 14, 24, 11, false, true);
525 } else {
526 for (int i = 0; i < 7; i++) {
527 DrawSpriteTile((x * 16), (y * 16) + i * 16, 14, 25, 11);
528 }
529
530 DrawSpriteTile((x * 16), (y * 16), 14, 24, 11);
531 DrawSpriteTile((x * 16), (y * 16) + (7 * 16), 14, 24, 11, false, true);
532 }
533
534 } else if (id_ == 0x61) // Beamos
535 {
536 DrawSpriteTile((x * 16), (y * 16) - 16, 8, 20, 14, false, false, 2, 4);
537 DrawSpriteTile((x * 16) + 4, (y * 16) - 8, 10, 20, 14, false, false, 1, 1);
538 } else if (id_ == 0x63) // Devalant non-shooter
539 {
540 DrawSpriteTile((x * 16) - 8, (y * 16) - 8, 2, 16, 2);
541 DrawSpriteTile((x * 16) + 8, (y * 16) - 8, 2, 16, 2, true);
542 DrawSpriteTile((x * 16) - 8, (y * 16) + 8, 2, 16, 2, false, true);
543 DrawSpriteTile((x * 16) + 8, (y * 16) + 8, 2, 16, 2, true, true);
544 DrawSpriteTile((x * 16), (y * 16), 0, 16, 10);
545 } else if (id_ == 0x64) // Devalant non-shooter
546 {
547 DrawSpriteTile((x * 16) - 8, (y * 16) - 8, 2, 16, 2);
548 DrawSpriteTile((x * 16) + 8, (y * 16) - 8, 2, 16, 2, true);
549 DrawSpriteTile((x * 16) - 8, (y * 16) + 8, 2, 16, 2, false, true);
550 DrawSpriteTile((x * 16) + 8, (y * 16) + 8, 2, 16, 2, true, true);
551 DrawSpriteTile((x * 16), (y * 16), 0, 16, 8);
552 } else if (id_ == 0x66) // Moving wall canon right
553 {
554 DrawSpriteTile((x * 16), (y * 16), 14, 16, 14, true);
555 } else if (id_ == 0x67) // Moving wall canon right
556 {
557 DrawSpriteTile((x * 16), (y * 16), 14, 16, 14);
558 } else if (id_ == 0x68) // Moving wall canon right
559 {
560 DrawSpriteTile((x * 16), (y * 16), 12, 16, 14);
561 } else if (id_ == 0x69) // Moving wall canon right
562 {
563 DrawSpriteTile((x * 16), (y * 16), 12, 16, 14, false, true);
564 } else if (id_ == 0x6A) // Chainball soldier
565 {
566 DrawSpriteTile((x * 16) + 4, (y * 16) + 8, 6, 16, 14);
567 DrawSpriteTile((x * 16) - 4, (y * 16) + 8, 6, 20, 14, false, false, 1, 2);
568 DrawSpriteTile((x * 16), (y * 16), 0, 16, 14); // Head
569 DrawSpriteTile((x * 16) + 12, (y * 16) - 16, 10, 18, 14); // Ball
570 } else if (id_ == 0x6B) // Cannon soldier
571 {
572 DrawSpriteTile((x * 16) + 4, (y * 16) + 8, 6, 16, 14);
573 DrawSpriteTile((x * 16) - 4, (y * 16) + 8, 6, 20, 14, false, false, 1, 2);
574 DrawSpriteTile((x * 16), (y * 16), 0, 16, 14); // Head
575 DrawSpriteTile((x * 16) + 12, (y * 16) + 8, 4, 18, 14); // Cannon
576 } else if (id_ == 0x6C) // Mirror portal
577 {
578 // Useless
579 } else if (id_ == 0x6D) // Rat
580 {
581 DrawSpriteTile((x * 16), (y * 16), 14, 24, 5);
582 } else if (id_ == 0x6E) // Rope
583 {
584 DrawSpriteTile((x * 16), (y * 16), 10, 26, 5);
585 } else if (id_ == 0x6F) {
586 DrawSpriteTile((x * 16), (y * 16), 4, 24, 10);
587 } else if (id_ == 0x70) // Helma fireball
588 {
589 DrawSpriteTile((x * 16), (y * 16), 10, 28, 4);
590 } else if (id_ == 0x71) // Leever
591 {
592 DrawSpriteTile((x * 16), (y * 16), 6, 16, 4);
593 } else if (id_ == 0x73) // Uncle priest
594 {
595 } else if (id_ == 0x79) // Bee
596 {
597 DrawSpriteTile((x * 16), (y * 16), 4, 14, 11, false, false, 1, 1);
598 } else if (id_ == 0x7C) // Skull head
599 {
600 DrawSpriteTile((x * 16), (y * 16), 0, 16, 10);
601 } else if (id_ == 0x7D) // Big spike
602 {
603 DrawSpriteTile((x * 16), (y * 16), 4, 28, 11);
604 DrawSpriteTile((x * 16) + 16, (y * 16), 4, 28, 11, true);
605 DrawSpriteTile((x * 16), (y * 16) + 16, 4, 28, 11, false, true);
606 DrawSpriteTile((x * 16) + 16, (y * 16) + 16, 4, 28, 11, true, true);
607 } else if (id_ == 0x7E) // Guruguru clockwise
608 {
609 DrawSpriteTile((x * 16), (y * 16) - 14, 8, 18, 4);
610 DrawSpriteTile((x * 16), (y * 16) - 28, 8, 18, 4);
611 DrawSpriteTile((x * 16), (y * 16) - 42, 8, 18, 4);
612 DrawSpriteTile((x * 16), (y * 16) - 56, 8, 18, 4);
613 } else if (id_ == 0x7F) // Guruguru Counterclockwise
614 {
615 DrawSpriteTile((x * 16), (y * 16) - 14, 8, 18, 4);
616 DrawSpriteTile((x * 16), (y * 16) - 28, 8, 18, 4);
617 DrawSpriteTile((x * 16), (y * 16) - 42, 8, 18, 4);
618 DrawSpriteTile((x * 16), (y * 16) - 56, 8, 18, 4);
619 } else if (id_ == 0x80) // Winder (moving firebar)
620 {
621 DrawSpriteTile((x * 16), (y * 16), 8, 18, 4);
622 DrawSpriteTile((x * 16) - 14, (y * 16), 8, 18, 4);
623 DrawSpriteTile((x * 16) - 28, (y * 16), 8, 18, 4);
624 DrawSpriteTile((x * 16) - 42, (y * 16), 8, 18, 4);
625 DrawSpriteTile((x * 16) - 56, (y * 16), 8, 18, 4);
626 } else if (id_ == 0x81) // Water tektite
627 {
628 DrawSpriteTile((x * 16), (y * 16), 0, 24, 11);
629 } else if (id_ == 0x82) // circle antifairy
630 {
631 // Antifairy top
632 DrawSpriteTile((x * 16 + 2) - 4, (y * 16 + 8) - 16, 3, 30, 5, false, false,
633 1, 1);
634 DrawSpriteTile((x * 16 + 8) - 4, (y * 16 + 2) - 16, 3, 30, 5, false, false,
635 1, 1);
636 DrawSpriteTile((x * 16 + 14) - 4, (y * 16 + 8) - 16, 3, 30, 5, false, false,
637 1, 1);
638 DrawSpriteTile((x * 16 + 8) - 4, (y * 16 + 14) - 16, 3, 30, 5, false, false,
639 1, 1);
640 DrawSpriteTile((x * 16 + 8) - 4, (y * 16 + 8) - 16, 1, 30, 5, false, false,
641 1, 1); // Middle
642 // Left
643 DrawSpriteTile((x * 16 + 2) - 16, (y * 16 + 8) - 4, 3, 30, 5, false, false,
644 1, 1);
645 DrawSpriteTile((x * 16 + 8) - 16, (y * 16 + 2) - 4, 3, 30, 5, false, false,
646 1, 1);
647 DrawSpriteTile((x * 16 + 14) - 16, (y * 16 + 8) - 4, 3, 30, 5, false, false,
648 1, 1);
649 DrawSpriteTile((x * 16 + 8) - 16, (y * 16 + 14) - 4, 3, 30, 5, false, false,
650 1, 1);
651 DrawSpriteTile((x * 16 + 8) - 16, (y * 16 + 8) - 4, 1, 30, 5, false, false,
652 1, 1); // Middle
653
654 DrawSpriteTile((x * 16 + 2) - 4, (y * 16 + 8) + 8, 3, 30, 5, false, false,
655 1, 1);
656 DrawSpriteTile((x * 16 + 8) - 4, (y * 16 + 2) + 8, 3, 30, 5, false, false,
657 1, 1);
658 DrawSpriteTile((x * 16 + 14) - 4, (y * 16 + 8) + 8, 3, 30, 5, false, false,
659 1, 1);
660 DrawSpriteTile((x * 16 + 8) - 4, (y * 16 + 14) + 8, 3, 30, 5, false, false,
661 1, 1);
662 DrawSpriteTile((x * 16 + 8) - 4, (y * 16 + 8) + 8, 1, 30, 5, false, false,
663 1, 1); // Middle
664 // Left
665 DrawSpriteTile((x * 16 + 2) + 8, (y * 16 + 8) - 4, 3, 30, 5, false, false,
666 1, 1);
667 DrawSpriteTile((x * 16 + 8) + 8, (y * 16 + 2) - 4, 3, 30, 5, false, false,
668 1, 1);
669 DrawSpriteTile((x * 16 + 14) + 8, (y * 16 + 8) - 4, 3, 30, 5, false, false,
670 1, 1);
671 DrawSpriteTile((x * 16 + 8) + 8, (y * 16 + 14) - 4, 3, 30, 5, false, false,
672 1, 1);
673 DrawSpriteTile((x * 16 + 8) + 8, (y * 16 + 8) - 4, 1, 30, 5, false, false,
674 1, 1); // Middle
675 } else if (id_ == 0x83) // Green eyegore
676 {
677 DrawSpriteTile((x * 16), (y * 16), 12, 24, 14, false, false, 2, 3);
678 DrawSpriteTile((x * 16) + 16, (y * 16), 12, 24, 14, true, false, 1, 3);
679 } else if (id_ == 0x84) // Red eyegore
680 {
681 DrawSpriteTile((x * 16), (y * 16), 12, 24, 8, false, false, 2, 3);
682 DrawSpriteTile((x * 16) + 16, (y * 16), 12, 24, 8, true, false, 1, 3);
683 } else if (id_ == 0x85) // Yellow stalfos
684 {
685 DrawSpriteTile((x * 16), (y * 16), 10, 16, 11);
686 DrawSpriteTile((x * 16), (y * 16) - 12, 0, 16, 11); // Head
687 } else if (id_ == 0x86) // Kodongo
688 {
689 DrawSpriteTile((x * 16), (y * 16), 4, 26, 14);
690 } else if (id_ == 0x88) // Mothula
691 {
692 DrawSpriteTile((x * 16), (y * 16), 8, 24, 14, false, false, 2, 4);
693 DrawSpriteTile((x * 16) + 16, (y * 16), 8, 24, 14, true, false, 2, 4);
694 } else if (id_ == 0x8A) // Spike
695 {
696 DrawSpriteTile((x * 16), (y * 16), 6, 30, 15);
697 } else if (id_ == 0x8B) // Gibdo
698 {
699 DrawSpriteTile((x * 16), (y * 16), 10, 24, 14);
700 DrawSpriteTile((x * 16), (y * 16) - 8, 0, 24, 14);
701 } else if (id_ == 0x8C) // Arrghus
702 {
703 DrawSpriteTile((x * 16), (y * 16), 0, 24, 14, false, false, 2, 4);
704 DrawSpriteTile((x * 16) + 16, (y * 16), 0, 24, 14, true, false, 2, 4);
705 } else if (id_ == 0x8D) // Arrghus spawn
706 {
707 DrawSpriteTile((x * 16), (y * 16), 6, 24, 14);
708 } else if (id_ == 0x8E) // Terrorpin
709 {
710 DrawSpriteTile((x * 16), (y * 16), 14, 24, 12);
711 } else if (id_ == 0x8F) // Slime
712 {
713 DrawSpriteTile((x * 16), (y * 16), 0, 20, 12);
714 } else if (id_ == 0x90) // Wall master
715 {
716 DrawSpriteTile((x * 16), (y * 16), 6, 26, 12);
717 DrawSpriteTile((x * 16) + 16, (y * 16), 15, 26, 12, false, false, 1, 1);
718 DrawSpriteTile((x * 16) + 16, (y * 16) + 8, 9, 26, 12, false, false, 1, 2);
719 DrawSpriteTile((x * 16), (y * 16) + 16, 10, 27, 12, false, false, 1, 1);
720 DrawSpriteTile((x * 16) + 8, (y * 16) + 16, 8, 27, 12, false, false, 1, 1);
721 } else if (id_ == 0x91) // Stalfos knight
722 {
723 DrawSpriteTile((x * 16) - 2, (y * 16) + 12, 4, 22, 12, false, false, 1, 2);
724 DrawSpriteTile((x * 16) + 10, (y * 16) + 12, 4, 22, 12, true, false, 1, 2);
725 DrawSpriteTile((x * 16) - 4, (y * 16) + 4, 1, 22, 12);
726 DrawSpriteTile((x * 16) + 12, (y * 16) + 4, 3, 22, 12, false, false, 1, 2);
727 DrawSpriteTile((x * 16), (y * 16) - 8, 6, 20, 12);
728 } else if (id_ == 0x92) // Helmaking
729 {
730 DrawSpriteTile((x * 16), (y * 16) + 32, 14, 26, 14);
731 DrawSpriteTile((x * 16) + 16, (y * 16) + 32, 0, 28, 14);
732 DrawSpriteTile((x * 16) + 32, (y * 16) + 32, 14, 26, 14, true);
733
734 DrawSpriteTile((x * 16), (y * 16) + 16 + 32, 2, 28, 14);
735 DrawSpriteTile((x * 16) + 16, (y * 16) + 16 + 32, 4, 28, 14);
736 DrawSpriteTile((x * 16) + 32, (y * 16) + 16 + 32, 2, 28, 14, true);
737
738 DrawSpriteTile((x * 16) + 8, (y * 16) + 32 + 32, 6, 28, 14);
739 DrawSpriteTile((x * 16) + 24, (y * 16) + 32 + 32, 6, 28, 14, true);
740 } else if (id_ == 0x93) // Bumper
741 {
742 DrawSpriteTile((x * 16), (y * 16), 12, 30, 7);
743 DrawSpriteTile((x * 16) + 16, (y * 16), 12, 30, 7, true);
744 DrawSpriteTile((x * 16) + 16, (y * 16) + 16, 12, 30, 7, true, true);
745 DrawSpriteTile((x * 16), (y * 16) + 16, 12, 30, 7, false, true);
746 } else if (id_ == 0x95) // Right laser eye
747 {
748 DrawSpriteTile((x * 16), (y * 16), 9, 28, 3, true, false, 1, 2);
749 DrawSpriteTile((x * 16), (y * 16) + 16, 9, 28, 3, true, true, 1, 1);
750 } else if (id_ == 0x96) // Left laser eye
751 {
752 DrawSpriteTile((x * 16) + 8, (y * 16) - 4, 9, 28, 3, false, false, 1, 2);
753 DrawSpriteTile((x * 16) + 8, (y * 16) + 12, 9, 28, 3, false, true, 1, 1);
754 } else if (id_ == 0x97) // Right laser eye
755 {
756 DrawSpriteTile((x * 16), (y * 16), 6, 28, 3, false, false, 2, 1);
757 DrawSpriteTile((x * 16) + 16, (y * 16), 6, 28, 3, true, false, 1, 1);
758 } else if (id_ == 0x98) // Right laser eye
759 {
760 DrawSpriteTile((x * 16), (y * 16), 6, 28, 3, false, true, 2, 1);
761 DrawSpriteTile((x * 16) + 16, (y * 16), 6, 28, 3, true, true, 1, 1);
762 } else if (id_ == 0x99) {
763 DrawSpriteTile((x * 16), (y * 16), 6, 24, 12);
764 DrawSpriteTile((x * 16), (y * 16) - 8, 0, 24, 12);
765 } else if (id_ == 0x9A) // Water bubble kyameron
766 {
767 DrawSpriteTile((x * 16), (y * 16), 10, 24, 6);
768 } else if (id_ == 0x9B) // Water bubble kyameron
769 {
770 DrawSpriteTile((x * 16), (y * 16), 6, 24, 11);
771 DrawSpriteTile((x * 16), (y * 16) - 8, 2, 27, 11, false, false, 2, 1);
772 } else if (id_ == 0x9C) // Water bubble kyameron
773 {
774 DrawSpriteTile((x * 16), (y * 16), 12, 22, 11);
775 DrawSpriteTile((x * 16) + 16, (y * 16), 13, 22, 11, false, false, 1, 2);
776 } else if (id_ == 0x9D) // Water bubble kyameron
777 {
778 DrawSpriteTile((x * 16), (y * 16), 14, 21, 11);
779 DrawSpriteTile((x * 16), (y * 16) - 16, 14, 20, 11, false, false, 2, 1);
780 } else if (id_ == 0xA1) {
781 DrawSpriteTile((x * 16) - 8, (y * 16) + 8, 6, 26, 14);
782 DrawSpriteTile((x * 16) + 8, (y * 16) + 8, 6, 26, 14, true);
783 } else if (id_ == 0xA2) {
784 DrawSpriteTile((x * 16), (y * 16) + 8, 0, 24, 14, false, false, 4, 4);
785 } else if (id_ == 0xA5) {
786 DrawSpriteTile((x * 16), (y * 16), 0, 26, 10, false, false, 3, 2);
787 DrawSpriteTile((x * 16) + 4, (y * 16) - 8, 0, 24, 10);
788 } else if (id_ == 0xA6) {
789 DrawSpriteTile((x * 16), (y * 16), 0, 26, 8, false, false, 3, 2);
790 DrawSpriteTile((x * 16) + 4, (y * 16) - 8, 0, 24, 8);
791 } else if (id_ == 0xA7) {
792 DrawSpriteTile((x * 16), (y * 16) + 12, 12, 16, 10);
793 DrawSpriteTile((x * 16), (y * 16), 0, 16, 10);
794 } else if (id_ == 0xAC) {
795 DrawSpriteTile((x * 16), (y * 16), 5, 14, 4);
796 } else if (id_ == 0xAD) {
797 DrawSpriteTile((x * 16), (y * 16) + 8, 14, 10, 10);
798 DrawSpriteTile((x * 16), (y * 16), 12, 10, 10);
799 } else if (id_ == 0xBA) {
800 DrawSpriteTile((x * 16), (y * 16), 14, 14, 6);
801 } else if (id_ == 0xC1 || id_ == 0x7A) {
802 DrawSpriteTile((x * 16), (y * 16) - 16, 2, 24, 12, false, false, 2, 4);
803 DrawSpriteTile((x * 16) + 16, (y * 16) - 16, 2, 24, 12, true, false, 2, 4);
804 } else if (id_ == 0xC3) {
805 DrawSpriteTile((x * 16), (y * 16), 10, 14, 12);
806 } else if (id_ == 0xC4) {
807 DrawSpriteTile((x * 16), (y * 16), 0, 18, 14);
808 DrawSpriteTile((x * 16), (y * 16) - 8, 0, 16, 14);
809 } else if (id_ == 0xC5) {
810 } else if (id_ == 0xC6) {
811 DrawSpriteTile((x * 16) + 4, (y * 16) + 14, 3, 30, 14, false, false, 1, 1);
812 DrawSpriteTile((x * 16) + 14, (y * 16) + 4, 3, 30, 14, false, false, 1, 1);
813 DrawSpriteTile((x * 16) + 4, (y * 16) + 2, 1, 31, 14, false, false, 1, 1);
814 DrawSpriteTile((x * 16) - 6, (y * 16) + 4, 3, 30, 14, false, false, 1, 1);
815 DrawSpriteTile((x * 16) + 4, (y * 16) - 6, 3, 30, 14, false, false, 1, 1);
816 } else if (id_ == 0xC7) {
817 DrawSpriteTile((x * 16), (y * 16), 0, 26, 4);
818 DrawSpriteTile((x * 16), (y * 16) - 10, 0, 26, 4);
819 DrawSpriteTile((x * 16), (y * 16) - 20, 0, 26, 4);
820 DrawSpriteTile((x * 16), (y * 16) - 30, 2, 26, 4);
821 } else if (id_ == 0xC8) {
822 DrawSpriteTile((x * 16), (y * 16), 12, 24, 12, false, false, 2, 3);
823 DrawSpriteTile((x * 16) + 16, (y * 16), 12, 24, 12, true, false, 1, 3);
824 } else if (id_ == 0xC9) {
825 DrawSpriteTile((x * 16), (y * 16), 8, 28, 8, false);
826 DrawSpriteTile((x * 16) + 16, (y * 16), 8, 28, 8, true);
827 } else if (id_ == 0xCA) {
828 DrawSpriteTile((x * 16), (y * 16), 8, 10, 10);
829 } else if (id_ == 0xD0) {
830 DrawSpriteTile((x * 16), (y * 16), 7, 14, 11, false, false, 3, 2);
831 DrawSpriteTile((x * 16), (y * 16) - 10, 8, 12, 11);
832 } else if (id_ == 0xD1) {
833 DrawSpriteTile((x * 16) + 2, (y * 16) + 8, 7, 13, 11, true, true, 1, 1);
834 DrawSpriteTile((x * 16) + 8, (y * 16) + 2, 7, 13, 11, true, false, 1, 1);
835 DrawSpriteTile((x * 16) + 14, (y * 16) + 8, 7, 13, 11, true, true, 1, 1);
836 DrawSpriteTile((x * 16) + 8, (y * 16) + 14, 7, 13, 11, false, true, 1, 1);
837 DrawSpriteTile((x * 16) + 8, (y * 16) + 8, 7, 13, 11, false, false, 1,
838 1); // Middle
839 // 6,7 / 13
840 } else if (id_ == 0xD4) {
841 DrawSpriteTile((x * 16) - 4, (y * 16), 0, 7, 7, false, false, 1, 1);
842 DrawSpriteTile((x * 16) + 4, (y * 16), 0, 7, 7, true, false, 1, 1);
843 } else if (id_ == 0xE3) // Fairy
844 {
845 DrawSpriteTile((x * 16), (y * 16), 10, 14, 10);
846 } else if (id_ == 0xE4) // Key
847 {
848 DrawSpriteTile((x * 16), (y * 16), 11, 06, 11, false, false, 1, 2);
849 } else if (id_ == 0xE7) // Mushroom
850 {
851 DrawSpriteTile((x * 16), (y * 16), 14, 30, 16);
852 } else if (id_ == 0xE8) // Fake ms
853 {
854 DrawSpriteTile((x * 16) + 4, (y * 16), 4, 31, 10, false, false, 1, 1);
855 DrawSpriteTile((x * 16) + 4, (y * 16) + 8, 5, 31, 10, false, false, 1, 1);
856 } else if (id_ == 0xEB) {
857 DrawSpriteTile((x * 16), (y * 16), 0, 14, 5);
858 } else if (id_ == 0xF2) {
859 DrawSpriteTile((x * 16), (y * 16) - 16, 12, 24, 2, false, false, 2, 4);
860 DrawSpriteTile((x * 16) + 16, (y * 16) - 16, 12, 24, 2, true, false, 2, 4);
861 } else if (id_ == 0xF4) {
862 DrawSpriteTile((x * 16), (y * 16), 12, 28, 5, false, false, 4, 4);
863 } else {
864 DrawSpriteTile((x * 16), (y * 16), 4, 4, 5);
865 }
866
867 bounding_box_.x = (lower_x_ + (x * 16));
868 bounding_box_.y = (lower_y_ + (y * 16));
871}
872
873void Sprite::DrawSpriteTile(int x, int y, int srcx, int srcy, int pal,
874 bool mirror_x, bool mirror_y, int sizex,
875 int sizey) {
876 if (current_gfx_.empty()) {
877 std::cout << "No gfx loaded" << std::endl;
878 return;
879 }
880
881 x += 16;
882 y += 16;
883 int drawid_ = (srcx + (srcy * 16)) + 512;
884 for (auto yl = 0; yl < sizey * 8; yl++) {
885 for (auto xl = 0; xl < (sizex * 8) / 2; xl++) {
886 int mx = xl;
887 int my = yl;
888
889 if (mirror_x) {
890 mx = (((sizex * 8) / 2) - 1) - xl;
891 }
892 if (mirror_y) {
893 my = ((sizey * 8) - 1) - yl;
894 }
895
896 // Formula information to get tile index position in the array
897 //((ID / nbrofXtiles) * (imgwidth/2) + (ID - ((ID/16)*16) ))
898
899 int tx = ((drawid_ / 0x10) * 0x400) +
900 ((drawid_ - ((drawid_ / 0x10) * 0x10)) * 8);
901 auto pixel = current_gfx_[tx + (yl * 0x80) + xl];
902 // nx,ny = object position, xx,yy = tile position, xl,yl = pixel
903 // position
904 int index = (x) + (y * 64) + (mx + (my * 0x80));
905
906 if (index >= 0 && index <= 4096) {
907 preview_gfx_[index] = (uint8_t)((pixel & 0x0F) + 112 + (pal * 8));
908 }
909 }
910 }
911}
912
913} // namespace zelda3
914} // namespace app
915} // namespace yaze
void UpdateMapProperties(uint16_t map_id) override
Definition sprite.cc:9
std::vector< uint8_t > preview_gfx_
Definition sprite.h:387
void UpdateCoordinates(int map_x, int map_y)
Definition sprite.cc:15
std::vector< uint8_t > current_gfx_
Definition sprite.h:388
void DrawSpriteTile(int x, int y, int srcx, int srcy, int pal, bool mirror_x=false, bool mirror_y=false, int sizex=2, int sizey=2)
Definition sprite.cc:873
Definition common.cc:22