summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--res/maps/map1.tmx7
-rw-r--r--res/maps/map2.tmx712
-rw-r--r--res/maps/map2_tiles.pngbin0 -> 18049 bytes
-rw-r--r--res/scripts/map1_off_right.lua9
-rw-r--r--src/animation_system.cpp6
-rw-r--r--src/animation_system.h3
-rw-r--r--src/camera_system.cpp6
-rw-r--r--src/camera_system.h4
-rw-r--r--src/game.cpp60
-rw-r--r--src/game.h4
-rw-r--r--src/main.cpp43
-rw-r--r--src/map.cpp5
-rw-r--r--src/map.h12
-rw-r--r--src/renderer.cpp19
-rw-r--r--src/renderer.h3
-rw-r--r--src/script_system.cpp6
-rw-r--r--src/sprite.h2
-rw-r--r--src/system.h2
-rw-r--r--src/transform_system.cpp8
-rw-r--r--src/transform_system.h2
20 files changed, 846 insertions, 67 deletions
diff --git a/res/maps/map1.tmx b/res/maps/map1.tmx index 9b1d1b1..282b2ed 100644 --- a/res/maps/map1.tmx +++ b/res/maps/map1.tmx
@@ -1,5 +1,5 @@
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2<map version="1.4" tiledversion="1.4.3" orientation="orthogonal" renderorder="right-down" width="48" height="32" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="8"> 2<map version="1.4" tiledversion="1.4.3" orientation="orthogonal" renderorder="right-down" width="48" height="32" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="9">
3 <tileset firstgid="1" name="fromRom" tilewidth="16" tileheight="16" tilecount="240" columns="10"> 3 <tileset firstgid="1" name="fromRom" tilewidth="16" tileheight="16" tilecount="240" columns="10">
4 <image source="map1_tiles.png" width="160" height="384"/> 4 <image source="map1_tiles.png" width="160" height="384"/>
5 <tile id="77"> 5 <tile id="77">
@@ -779,6 +779,11 @@
779 <property name="script" value="test_trigger"/> 779 <property name="script" value="test_trigger"/>
780 </properties> 780 </properties>
781 </object> 781 </object>
782 <object id="8" name="moveToRight" type="trigger" x="761" y="359.667" width="18" height="60.3333">
783 <properties>
784 <property name="script" value="map1_off_right"/>
785 </properties>
786 </object>
782 </objectgroup> 787 </objectgroup>
783 <layer id="1" name="Layer 0" width="48" height="32"> 788 <layer id="1" name="Layer 0" width="48" height="32">
784 <data encoding="csv"> 789 <data encoding="csv">
diff --git a/res/maps/map2.tmx b/res/maps/map2.tmx new file mode 100644 index 0000000..5bbe0c6 --- /dev/null +++ b/res/maps/map2.tmx
@@ -0,0 +1,712 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<map version="1.4" tiledversion="1.4.3" orientation="orthogonal" renderorder="right-down" width="64" height="64" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="2">
3 <tileset firstgid="1" name="fromRom" tilewidth="16" tileheight="16" tilecount="180" columns="10">
4 <image source="map2_tiles.png" width="160" height="288"/>
5 <tile id="61">
6 <properties>
7 <property name="runSound" value="grass"/>
8 </properties>
9 </tile>
10 <tile id="62">
11 <properties>
12 <property name="runSound" value="land"/>
13 </properties>
14 </tile>
15 <tile id="63">
16 <properties>
17 <property name="runSound" value="water"/>
18 </properties>
19 </tile>
20 <tile id="64">
21 <properties>
22 <property name="solid" type="bool" value="true"/>
23 </properties>
24 </tile>
25 <tile id="65">
26 <properties>
27 <property name="solid" type="bool" value="true"/>
28 </properties>
29 </tile>
30 <tile id="66">
31 <properties>
32 <property name="runSound" value="land"/>
33 </properties>
34 </tile>
35 <tile id="67">
36 <properties>
37 <property name="runSound" value="land"/>
38 </properties>
39 </tile>
40 <tile id="68">
41 <properties>
42 <property name="solid" type="bool" value="true"/>
43 </properties>
44 </tile>
45 <tile id="69">
46 <properties>
47 <property name="runSound" value="water"/>
48 </properties>
49 </tile>
50 <tile id="70">
51 <properties>
52 <property name="runSound" value="water"/>
53 </properties>
54 </tile>
55 <tile id="71">
56 <properties>
57 <property name="runSound" value="water"/>
58 </properties>
59 </tile>
60 <tile id="72">
61 <properties>
62 <property name="runSound" value="water"/>
63 </properties>
64 </tile>
65 <tile id="73">
66 <properties>
67 <property name="runSound" value="grass"/>
68 </properties>
69 </tile>
70 <tile id="74">
71 <properties>
72 <property name="solid" type="bool" value="true"/>
73 </properties>
74 </tile>
75 <tile id="75">
76 <properties>
77 <property name="solid" type="bool" value="true"/>
78 </properties>
79 </tile>
80 <tile id="76">
81 <properties>
82 <property name="runSound" value="grass"/>
83 </properties>
84 </tile>
85 <tile id="77">
86 <properties>
87 <property name="runSound" value="water"/>
88 </properties>
89 </tile>
90 <tile id="78">
91 <properties>
92 <property name="runSound" value="land"/>
93 </properties>
94 </tile>
95 <tile id="79">
96 <properties>
97 <property name="runSound" value="land"/>
98 </properties>
99 </tile>
100 <tile id="80">
101 <properties>
102 <property name="runSound" value="grass"/>
103 </properties>
104 </tile>
105 <tile id="81">
106 <properties>
107 <property name="runSound" value="land"/>
108 </properties>
109 </tile>
110 <tile id="82">
111 <properties>
112 <property name="runSound" value="land"/>
113 </properties>
114 </tile>
115 <tile id="83">
116 <properties>
117 <property name="runSound" value="land"/>
118 </properties>
119 </tile>
120 <tile id="84">
121 <properties>
122 <property name="runSound" value="grass"/>
123 </properties>
124 </tile>
125 <tile id="85">
126 <properties>
127 <property name="runSound" value="grass"/>
128 </properties>
129 </tile>
130 <tile id="86">
131 <properties>
132 <property name="runSound" value="water"/>
133 </properties>
134 </tile>
135 <tile id="87">
136 <properties>
137 <property name="runSound" value="water"/>
138 </properties>
139 </tile>
140 <tile id="88">
141 <properties>
142 <property name="runSound" value="water"/>
143 </properties>
144 </tile>
145 <tile id="89">
146 <properties>
147 <property name="runSound" value="water"/>
148 </properties>
149 </tile>
150 <tile id="90">
151 <properties>
152 <property name="runSound" value="grass"/>
153 </properties>
154 </tile>
155 <tile id="91">
156 <properties>
157 <property name="runSound" value="grass"/>
158 </properties>
159 </tile>
160 <tile id="92">
161 <properties>
162 <property name="solid" type="bool" value="true"/>
163 </properties>
164 </tile>
165 <tile id="93">
166 <properties>
167 <property name="solid" type="bool" value="true"/>
168 </properties>
169 </tile>
170 <tile id="94">
171 <properties>
172 <property name="runSound" value="grass"/>
173 </properties>
174 </tile>
175 <tile id="95">
176 <properties>
177 <property name="runSound" value="land"/>
178 </properties>
179 </tile>
180 <tile id="96">
181 <properties>
182 <property name="runSound" value="land"/>
183 </properties>
184 </tile>
185 <tile id="97">
186 <properties>
187 <property name="runSound" value="land"/>
188 </properties>
189 </tile>
190 <tile id="98">
191 <properties>
192 <property name="runSound" value="land"/>
193 </properties>
194 </tile>
195 <tile id="99">
196 <properties>
197 <property name="runSound" value="land"/>
198 </properties>
199 </tile>
200 <tile id="100">
201 <properties>
202 <property name="runSound" value="land"/>
203 </properties>
204 </tile>
205 <tile id="101">
206 <properties>
207 <property name="runSound" value="land"/>
208 </properties>
209 </tile>
210 <tile id="102">
211 <properties>
212 <property name="runSound" value="grass"/>
213 </properties>
214 </tile>
215 <tile id="103">
216 <properties>
217 <property name="runSound" value="grass"/>
218 </properties>
219 </tile>
220 <tile id="104">
221 <properties>
222 <property name="runSound" value="grass"/>
223 </properties>
224 </tile>
225 <tile id="105">
226 <properties>
227 <property name="solid" type="bool" value="true"/>
228 </properties>
229 </tile>
230 <tile id="106">
231 <properties>
232 <property name="runSound" value="water"/>
233 </properties>
234 </tile>
235 <tile id="107">
236 <properties>
237 <property name="solid" type="bool" value="true"/>
238 </properties>
239 </tile>
240 <tile id="108">
241 <properties>
242 <property name="solid" type="bool" value="true"/>
243 </properties>
244 </tile>
245 <tile id="109">
246 <properties>
247 <property name="runSound" value="land"/>
248 </properties>
249 </tile>
250 <tile id="110">
251 <properties>
252 <property name="solid" type="bool" value="true"/>
253 </properties>
254 </tile>
255 <tile id="111">
256 <properties>
257 <property name="runSound" value="land"/>
258 </properties>
259 </tile>
260 <tile id="112">
261 <properties>
262 <property name="runSound" value="land"/>
263 </properties>
264 </tile>
265 <tile id="113">
266 <properties>
267 <property name="runSound" value="land"/>
268 </properties>
269 </tile>
270 <tile id="114">
271 <properties>
272 <property name="runSound" value="land"/>
273 </properties>
274 </tile>
275 <tile id="115">
276 <properties>
277 <property name="runSound" value="grass"/>
278 </properties>
279 </tile>
280 <tile id="116">
281 <properties>
282 <property name="runSound" value="grass"/>
283 </properties>
284 </tile>
285 <tile id="117">
286 <properties>
287 <property name="runSound" value="water"/>
288 </properties>
289 </tile>
290 <tile id="118">
291 <properties>
292 <property name="solid" type="bool" value="true"/>
293 </properties>
294 </tile>
295 <tile id="119">
296 <properties>
297 <property name="solid" type="bool" value="true"/>
298 </properties>
299 </tile>
300 <tile id="120">
301 <properties>
302 <property name="solid" type="bool" value="true"/>
303 </properties>
304 </tile>
305 <tile id="121">
306 <properties>
307 <property name="runSound" value="water"/>
308 </properties>
309 </tile>
310 <tile id="122">
311 <properties>
312 <property name="runSound" value="water"/>
313 </properties>
314 </tile>
315 <tile id="123">
316 <properties>
317 <property name="runSound" value="grass"/>
318 </properties>
319 </tile>
320 <tile id="124">
321 <properties>
322 <property name="runSound" value="grass"/>
323 </properties>
324 </tile>
325 <tile id="125">
326 <properties>
327 <property name="runSound" value="land"/>
328 </properties>
329 </tile>
330 <tile id="126">
331 <properties>
332 <property name="runSound" value="grass"/>
333 </properties>
334 </tile>
335 <tile id="127">
336 <properties>
337 <property name="runSound" value="grass"/>
338 </properties>
339 </tile>
340 <tile id="128">
341 <properties>
342 <property name="runSound" value="water"/>
343 </properties>
344 </tile>
345 <tile id="129">
346 <properties>
347 <property name="solid" type="bool" value="true"/>
348 </properties>
349 </tile>
350 <tile id="130">
351 <properties>
352 <property name="runSound" value="water"/>
353 </properties>
354 </tile>
355 <tile id="131">
356 <properties>
357 <property name="runSound" value="grass"/>
358 </properties>
359 </tile>
360 <tile id="132">
361 <properties>
362 <property name="runSound" value="grass"/>
363 </properties>
364 </tile>
365 <tile id="133">
366 <properties>
367 <property name="runSound" value="grass"/>
368 </properties>
369 </tile>
370 <tile id="134">
371 <properties>
372 <property name="runSound" value="water"/>
373 </properties>
374 </tile>
375 <tile id="135">
376 <properties>
377 <property name="runSound" value="grass"/>
378 </properties>
379 </tile>
380 <tile id="136">
381 <properties>
382 <property name="runSound" value="grass"/>
383 </properties>
384 </tile>
385 <tile id="137">
386 <properties>
387 <property name="runSound" value="land"/>
388 </properties>
389 </tile>
390 <tile id="138">
391 <properties>
392 <property name="runSound" value="land"/>
393 </properties>
394 </tile>
395 <tile id="139">
396 <properties>
397 <property name="runSound" value="water"/>
398 </properties>
399 </tile>
400 <tile id="140">
401 <properties>
402 <property name="runSound" value="land"/>
403 </properties>
404 </tile>
405 <tile id="141">
406 <properties>
407 <property name="runSound" value="land"/>
408 </properties>
409 </tile>
410 <tile id="142">
411 <properties>
412 <property name="runSound" value="land"/>
413 </properties>
414 </tile>
415 <tile id="143">
416 <properties>
417 <property name="runSound" value="water"/>
418 </properties>
419 </tile>
420 <tile id="144">
421 <properties>
422 <property name="runSound" value="water"/>
423 </properties>
424 </tile>
425 <tile id="145">
426 <properties>
427 <property name="runSound" value="water"/>
428 </properties>
429 </tile>
430 <tile id="146">
431 <properties>
432 <property name="runSound" value="water"/>
433 </properties>
434 </tile>
435 <tile id="147">
436 <properties>
437 <property name="runSound" value="water"/>
438 </properties>
439 </tile>
440 <tile id="148">
441 <properties>
442 <property name="runSound" value="grass"/>
443 </properties>
444 </tile>
445 <tile id="149">
446 <properties>
447 <property name="runSound" value="grass"/>
448 </properties>
449 </tile>
450 <tile id="150">
451 <properties>
452 <property name="runSound" value="grass"/>
453 </properties>
454 </tile>
455 <tile id="151">
456 <properties>
457 <property name="runSound" value="grass"/>
458 </properties>
459 </tile>
460 <tile id="152">
461 <properties>
462 <property name="runSound" value="grass"/>
463 </properties>
464 </tile>
465 <tile id="153">
466 <properties>
467 <property name="runSound" value="grass"/>
468 </properties>
469 </tile>
470 <tile id="154">
471 <properties>
472 <property name="runSound" value="grass"/>
473 </properties>
474 </tile>
475 <tile id="155">
476 <properties>
477 <property name="solid" type="bool" value="true"/>
478 </properties>
479 </tile>
480 <tile id="156">
481 <properties>
482 <property name="solid" type="bool" value="true"/>
483 </properties>
484 </tile>
485 <tile id="157">
486 <properties>
487 <property name="runSound" value="water"/>
488 </properties>
489 </tile>
490 <tile id="158">
491 <properties>
492 <property name="solid" type="bool" value="true"/>
493 </properties>
494 </tile>
495 <tile id="159">
496 <properties>
497 <property name="solid" type="bool" value="true"/>
498 </properties>
499 </tile>
500 <tile id="160">
501 <properties>
502 <property name="runSound" value="water"/>
503 </properties>
504 </tile>
505 <tile id="161">
506 <properties>
507 <property name="runSound" value="water"/>
508 </properties>
509 </tile>
510 <tile id="162">
511 <properties>
512 <property name="solid" type="bool" value="true"/>
513 </properties>
514 </tile>
515 <tile id="163">
516 <properties>
517 <property name="solid" type="bool" value="true"/>
518 </properties>
519 </tile>
520 <tile id="164">
521 <properties>
522 <property name="solid" type="bool" value="true"/>
523 </properties>
524 </tile>
525 <tile id="165">
526 <properties>
527 <property name="solid" type="bool" value="true"/>
528 </properties>
529 </tile>
530 <tile id="166">
531 <properties>
532 <property name="solid" type="bool" value="true"/>
533 </properties>
534 </tile>
535 <tile id="167">
536 <properties>
537 <property name="solid" type="bool" value="true"/>
538 </properties>
539 </tile>
540 <tile id="168">
541 <properties>
542 <property name="runSound" value="water"/>
543 </properties>
544 </tile>
545 <tile id="169">
546 <properties>
547 <property name="solid" type="bool" value="true"/>
548 </properties>
549 </tile>
550 <tile id="170">
551 <properties>
552 <property name="solid" type="bool" value="true"/>
553 </properties>
554 </tile>
555 <tile id="171">
556 <properties>
557 <property name="solid" type="bool" value="true"/>
558 </properties>
559 </tile>
560 <tile id="172">
561 <properties>
562 <property name="solid" type="bool" value="true"/>
563 </properties>
564 </tile>
565 <tile id="173">
566 <properties>
567 <property name="runSound" value="grass"/>
568 </properties>
569 </tile>
570 </tileset>
571 <layer id="1" name="Layer 1" width="64" height="64">
572 <data encoding="csv">
57362,62,62,62,62,62,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,64,65,66,67,68,2147483716,2147483715,69,70,63,63,63,63,63,63,63,63,63,
57462,62,62,62,62,62,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,70,71,72,2147483720,2147483719,65,66,73,63,63,63,63,63,63,63,63,
57562,62,62,62,62,62,62,63,63,63,63,63,63,63,74,75,76,77,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,64,65,66,78,79,80,70,70,63,63,63,63,63,63,63,63,63,63,
57662,62,62,62,62,62,62,63,63,63,63,63,63,63,81,81,81,81,63,63,63,63,62,62,62,62,62,81,81,62,62,62,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,70,82,83,84,64,65,66,73,63,63,63,63,63,63,63,63,
57774,75,76,77,62,62,62,81,81,81,81,81,81,81,63,63,63,63,63,63,62,62,62,75,76,85,86,75,76,77,81,62,62,62,62,62,62,87,87,87,63,63,64,65,66,73,64,65,66,88,89,90,70,70,63,65,66,73,64,65,66,73,63,63,
57874,75,76,77,62,62,62,2147483739,2147483740,93,94,81,81,81,63,63,63,63,62,62,62,75,76,95,86,75,76,95,86,75,76,77,74,75,76,77,64,65,66,73,87,87,87,87,87,87,63,63,70,70,70,70,64,65,66,73,70,70,87,87,87,87,63,63,
57981,81,81,81,62,62,96,93,94,97,98,93,94,99,63,63,63,63,63,75,76,77,92,91,100,91,91,100,2147483740,81,74,75,76,40,86,75,76,73,64,65,66,73,63,63,63,63,64,65,66,73,70,70,70,70,64,65,66,73,63,63,63,63,63,63,
58062,62,62,62,96,93,94,97,98,93,94,99,2147483749,63,63,63,63,63,63,81,92,91,101,102,98,93,94,99,2147483749,2147483740,103,104,105,106,87,87,87,107,87,108,109,65,66,63,63,63,63,2147483718,2147483757,2147483756,2147483735,70,70,70,70,70,64,65,66,73,63,63,63,63,
58162,62,62,62,63,62,1073741915,1073741915,1073741934,111,102,63,63,63,63,63,63,63,91,100,101,102,102,112,113,114,115,102,3221225573,3221225564,116,1073741941,1073741942,119,69,65,66,73,87,120,121,122,63,63,63,63,63,2147483770,2147483769,2147483768,2147483771,70,70,70,70,119,69,70,70,63,63,63,63,63,
58262,62,62,63,63,75,76,77,1073741916,1073741915,1073741925,102,63,63,63,63,63,63,63,102,112,113,102,102,102,111,102,3221225573,3221225564,116,1073741941,1073741942,124,125,87,87,87,87,87,87,64,65,66,73,63,63,63,70,70,70,70,70,70,70,70,70,40,65,66,73,63,63,63,63,
58362,62,62,63,63,62,81,103,104,81,1073741916,63,63,63,63,63,63,63,102,126,114,115,102,102,102,102,3221225573,63,63,81,117,63,63,87,87,87,87,87,87,87,87,87,87,63,63,63,63,63,63,70,70,70,70,70,70,70,106,70,70,63,63,63,63,63,
58462,62,62,62,63,63,63,81,81,81,81,81,81,63,63,63,63,63,63,102,102,102,102,102,63,3221225573,3221225564,63,63,63,63,63,63,63,63,87,87,87,87,87,87,119,69,87,63,63,63,63,63,63,2147483775,2147483776,2147483775,118,129,70,130,127,127,63,63,63,63,63,
58562,62,62,62,62,63,63,63,63,81,81,75,76,81,63,63,63,63,102,114,115,102,102,63,63,63,63,63,63,63,63,63,63,63,63,63,63,87,2147483779,127,132,118,87,63,63,63,63,63,63,63,2147483781,134,2147483783,117,2147483776,63,63,63,63,63,63,63,63,63,
58662,62,62,62,62,63,63,63,63,81,81,81,74,75,76,77,98,93,94,99,102,102,102,102,63,63,63,63,63,63,63,63,63,63,63,63,63,132,2147483765,136,137,117,132,132,63,63,63,63,63,75,76,77,103,104,133,75,63,63,63,63,63,63,63,63,
58762,62,74,75,76,77,63,63,81,81,74,75,76,85,86,75,76,102,102,102,114,115,102,63,63,63,63,63,63,63,63,63,63,63,63,63,63,81,81,103,104,81,74,75,76,77,63,63,63,134,134,136,137,134,74,75,76,63,63,63,63,63,63,63,
58862,62,81,81,81,81,63,63,63,63,104,1073741941,3221225589,103,104,81,81,1073741915,1073741925,138,102,102,102,93,98,93,94,99,102,63,63,63,74,75,76,77,63,63,63,81,81,81,81,81,63,63,63,63,63,75,76,77,2147483785,2147483784,134,134,63,63,63,63,63,63,63,63,
58962,62,62,62,62,63,63,63,63,63,1073741941,1073741942,3221225590,3221225589,74,75,76,77,1073741916,1073741925,102,102,98,93,94,139,98,93,94,99,63,63,81,81,81,81,63,63,81,81,81,103,104,81,63,63,63,63,63,63,134,134,134,134,74,75,76,63,63,63,63,63,63,63,
59062,62,62,62,62,63,63,63,64,65,66,73,140,3221225590,1073741952,3221225589,135,103,104,1073741916,102,141,142,102,102,138,2147483791,2147483792,2147483792,93,94,99,102,102,63,63,74,75,76,77,81,81,81,75,74,75,76,77,63,75,76,77,2147483748,91,2147483748,2147483739,2147483740,63,63,63,63,63,63,63,
59162,62,64,65,66,73,64,65,66,73,140,140,140,140,140,3221225590,1073741952,1073741952,1073741952,63,63,102,102,2147483750,2147483791,2147483792,2147483793,2147483794,147,93,147,93,94,99,63,63,63,81,81,103,104,81,74,75,76,81,81,81,63,63,102,102,102,102,102,102,2147483749,63,74,75,76,77,63,63,
59264,65,66,73,64,65,66,73,140,140,140,140,140,63,63,140,140,63,63,63,63,2147483792,144,2147483792,2147483793,147,147,63,63,65,66,73,63,63,63,63,63,63,63,81,81,81,81,81,63,63,63,63,98,93,94,99,111,102,126,102,63,63,81,81,81,81,63,63,
59366,73,140,119,69,140,2147483766,2147483776,2147483776,118,124,125,140,65,66,63,63,63,63,63,63,147,147,63,63,147,64,65,66,73,147,63,63,63,63,63,63,63,66,1073741952,3221225589,135,74,75,76,77,63,63,63,63,102,102,114,115,98,93,94,99,63,63,63,63,63,63,
594148,65,66,73,2147483766,2147483776,2147483765,103,104,117,118,1073741964,140,63,63,63,63,63,63,63,63,63,63,63,63,63,147,147,147,147,63,63,63,63,63,63,64,65,66,73,3221225590,3221225604,3221225589,116,81,63,63,63,98,93,94,99,138,102,102,102,98,93,94,99,63,63,63,63,
595149,150,118,2147483766,2147483765,81,1073741941,3221225600,3221225589,81,117,63,63,140,65,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,87,106,87,124,125,3221225590,1073741952,3221225599,3221225604,63,63,63,63,102,102,102,102,102,141,142,102,98,93,94,99,63,63,
596151,152,117,2147483765,81,1073741941,1073741942,2147483788,3221225590,136,137,75,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,87,87,119,69,87,87,87,87,106,87,63,63,63,63,75,76,102,1073741915,1073741915,1073741925,102,102,126,102,3221225573,63,63,63,63,
597151,152,81,81,81,140,140,63,63,81,74,75,76,77,63,63,63,63,74,75,76,77,63,63,63,63,63,63,63,63,63,65,66,73,64,65,66,73,87,87,87,87,87,130,119,69,87,63,63,63,63,75,76,77,1073741916,3221225563,3221225572,3221225563,3221225563,75,63,63,63,63,
59863,63,63,63,63,63,63,63,63,81,81,81,74,75,76,77,63,63,81,81,81,81,63,63,63,63,63,63,63,63,63,87,40,65,66,73,78,79,80,87,87,87,87,87,87,63,63,63,63,63,63,63,63,134,136,137,134,133,116,134,74,75,63,63,
59963,63,63,63,63,63,63,63,63,81,81,81,81,81,81,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,130,106,87,87,87,82,83,84,87,87,87,87,63,63,63,63,63,63,63,63,63,63,63,134,134,116,134,74,75,76,77,63,63,
60063,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,81,81,63,63,118,130,87,87,87,88,89,90,106,87,65,66,63,63,63,63,63,63,63,63,134,74,75,76,77,136,137,134,134,74,75,63,63,
60163,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,64,65,66,73,64,65,66,73,74,75,76,77,81,117,118,124,125,87,87,87,87,108,109,87,87,63,63,63,74,75,76,77,74,75,76,77,134,133,134,134,134,133,63,63,63,63,
60263,63,74,63,63,63,63,63,63,63,63,63,63,63,63,63,64,65,66,73,40,65,66,73,2147483735,75,76,77,74,75,76,77,117,127,118,87,87,87,123,120,121,63,63,63,63,63,81,81,81,81,63,134,134,136,137,134,1073741977,1073741952,63,63,1073741887,63,63,63,
60363,63,74,75,76,77,63,63,63,63,63,63,63,63,63,63,63,87,3221225618,3221225618,106,3221225618,3221225618,2147483766,2147483775,2147483765,81,103,104,81,81,81,133,81,117,118,87,87,87,87,87,87,63,63,63,63,63,63,63,63,63,63,134,134,1073741977,1073741952,1073741955,1073741911,63,63,63,63,63,63,
60463,63,81,81,81,81,63,63,63,63,63,63,63,65,66,73,3221225618,3221225618,3221225618,119,69,3221225618,2147483766,2147483765,74,75,76,77,81,81,103,104,81,103,104,104,63,63,63,127,2147483765,63,63,63,63,63,63,63,63,63,63,63,1073741952,1073741956,1073741955,1073741911,64,65,66,73,63,63,63,63,
60563,63,63,63,63,63,63,63,63,63,63,63,3221225618,3221225618,64,65,66,73,124,125,3221225618,87,3221225590,3221225589,136,137,81,103,104,81,81,137,81,136,137,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,64,65,66,73,2147483773,2147483772,87,87,87,63,63,63,63,63,
606154,154,154,154,63,63,63,63,98,93,94,99,1073741968,3221225616,3221225617,3221225618,3221225618,3221225618,3221225618,3221225618,3221225618,3221225618,3221225618,3221225590,3221225589,2147483785,2147483784,136,137,81,81,81,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,87,87,87,87,87,64,65,66,73,63,63,63,63,
607154,154,154,154,63,102,98,93,94,139,98,93,94,99,3221225615,3221225617,3221225618,3221225618,1073741970,1073741970,1073741970,1073741970,1073741970,1073741970,3221225590,136,137,63,63,81,81,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,62,62,62,75,66,73,87,87,87,87,63,63,63,63,63,63,
608154,154,154,154,98,93,94,99,111,112,113,102,102,102,102,3221225615,3221225617,70,1073741970,1073741970,1073741970,1073741970,1073741970,1073741970,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,62,62,62,62,62,66,87,87,87,64,65,66,73,63,63,63,63,
609154,154,154,154,63,102,102,114,115,102,102,102,63,63,63,63,63,3221225617,1073741970,1073741970,1073741970,1073741970,64,65,66,73,63,63,63,63,74,75,76,77,63,63,63,63,63,63,63,62,62,62,62,62,62,62,62,62,64,65,66,73,87,87,87,87,63,63,63,63,63,63,
610154,154,154,154,63,63,63,102,102,3221225573,1073741915,1073741915,63,63,63,63,63,63,63,2147483757,2147483756,2147483735,1073741970,1073741970,1073741969,93,94,99,63,63,81,81,81,81,63,63,74,75,76,77,74,75,76,77,62,75,76,62,64,65,66,73,87,87,87,108,109,63,63,63,63,63,63,63,
611154,154,154,154,63,63,63,1073741915,1073741915,3221225564,133,63,63,63,63,63,63,63,63,2147483769,2147483768,2147483771,1073741970,1073741969,1073741967,102,63,63,63,63,63,63,63,63,63,63,81,81,81,75,76,77,74,75,76,85,86,75,76,153,128,131,87,87,123,120,121,63,63,63,63,63,63,63,
612154,154,154,154,63,63,63,133,1073741941,63,63,63,63,63,63,63,63,63,63,2147483735,2147483735,2147483735,1073741969,1073741967,98,93,94,99,102,63,63,63,63,63,63,63,63,63,63,75,62,103,104,81,81,92,100,91,91,91,2147483740,153,128,131,87,87,87,63,63,63,63,63,63,63,
613154,154,154,154,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,1073741968,1073741968,1073741968,1073741967,138,102,115,98,93,94,99,102,102,102,102,74,75,76,77,74,75,76,77,81,92,91,101,98,93,94,99,2147483749,91,2147483740,153,2147483801,63,63,63,74,75,76,77,63,63,
614154,154,154,154,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,1073741925,138,3221225573,1073741915,75,74,75,76,77,74,75,76,77,74,75,76,77,136,137,92,101,112,113,102,102,102,112,113,102,2147483749,91,91,91,63,63,81,81,81,81,63,63,
615154,154,74,75,76,77,63,63,63,70,70,70,70,70,63,63,63,63,63,63,63,63,76,1073741916,1073741915,3221225564,74,75,76,77,74,75,76,77,81,1073741941,1073741952,3221225599,3221225589,81,103,104,1073741916,1073741925,102,102,102,102,102,102,102,102,102,102,102,63,63,63,134,134,63,63,63,63,
616154,154,154,154,63,63,63,63,70,70,70,70,70,63,63,63,63,63,63,63,74,75,76,77,81,2147483785,2147483784,1073741941,3221225599,1073741952,3221225599,3221225589,103,104,1073741941,1073741942,70,70,3221225590,1073741952,3221225625,81,81,1073741916,1073741925,102,102,102,102,102,102,102,102,102,63,63,63,75,76,77,63,63,63,63,
61763,63,63,63,154,154,63,63,63,70,70,63,63,63,63,63,63,63,63,63,63,103,104,2147483785,2147483784,81,1073741941,1073741942,70,70,70,3221225590,1073741952,3221225599,1073741942,70,70,70,70,2147483766,2147483801,81,81,63,63,102,98,93,94,99,102,102,102,102,74,75,76,155,134,63,63,63,63,63,
61863,63,63,63,63,63,63,63,70,70,2147483717,2147483767,70,63,63,63,64,65,66,73,3221225599,3221225599,3221225589,103,104,81,117,118,70,106,70,70,70,108,109,70,70,63,63,2147483765,81,63,63,63,63,63,63,63,63,63,63,102,98,93,94,99,134,63,63,63,63,63,63,63,
61963,63,63,63,63,63,64,65,66,73,70,63,63,63,64,65,66,73,64,65,66,73,3221225590,3221225589,136,137,81,63,63,130,124,125,123,120,121,122,63,63,63,63,63,63,63,63,63,63,74,75,76,63,63,1073741915,3221225563,3221225564,76,75,76,75,63,63,63,63,63,63,
62063,63,63,63,63,63,63,70,64,65,66,73,70,63,63,70,70,130,70,70,70,70,2147483766,2147483801,81,81,81,75,63,63,63,70,70,124,125,70,63,63,63,63,63,63,63,63,63,63,63,63,63,75,76,85,86,75,76,77,134,134,63,63,63,63,63,63,
62163,63,63,63,63,70,70,70,70,70,70,63,63,63,70,63,63,70,70,70,2147483766,127,2147483765,103,104,81,81,63,63,63,63,63,63,70,70,63,63,63,63,63,63,63,63,63,63,63,63,63,63,134,1073741952,1073741952,3221225589,103,104,1073741941,1073741952,1073741951,63,63,63,63,63,63,
62274,75,76,77,63,63,63,70,70,70,70,70,70,63,63,63,63,63,63,127,2147483765,81,136,137,103,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,64,65,66,73,64,65,66,73,3221225590,1073741952,1073741952,1073741942,64,65,66,73,63,63,63,63,
62381,81,81,81,63,63,64,65,66,73,64,65,66,73,63,63,63,63,81,63,63,81,103,63,63,81,63,63,63,63,63,63,63,63,63,63,63,63,74,75,76,77,134,75,76,70,64,65,66,130,130,130,63,70,70,2147483766,63,63,63,63,63,63,63,63,
62463,63,63,63,64,65,66,73,70,70,124,125,70,63,63,63,63,75,76,77,81,63,63,81,74,75,76,77,63,63,63,63,64,65,66,73,74,75,76,77,74,75,76,77,127,127,127,118,124,125,130,63,63,63,63,63,63,63,63,63,63,63,63,63,
62563,63,63,63,63,70,70,70,70,70,70,70,70,70,63,63,63,85,86,81,74,75,76,77,103,104,74,75,76,77,64,65,66,73,2147483766,75,76,134,134,134,134,134,74,75,76,77,135,117,118,124,125,63,63,63,63,63,63,63,63,63,63,63,63,63,
62663,63,63,63,81,70,156,157,70,124,125,70,70,63,63,63,1073741951,1073741941,1073741951,1073741951,1073741951,1073741951,1073741951,1073741951,1073741941,1073741951,1073741951,3221225589,64,65,66,73,130,2147483766,2147483765,134,74,75,76,77,74,75,76,77,134,103,104,134,117,118,70,63,63,63,63,63,63,63,63,70,70,70,70,70,
62763,63,63,63,63,158,159,160,161,70,64,65,66,73,63,63,63,70,162,163,164,165,166,167,168,169,64,65,66,73,70,70,2147483766,2147483765,74,75,76,77,74,75,76,77,134,134,136,137,134,1073741941,1073741951,1073741951,127,134,134,63,63,63,70,70,70,70,70,70,70,70,
62863,63,63,63,81,81,117,128,118,2147483718,70,70,64,65,63,73,70,70,130,70,170,171,172,173,70,70,70,70,63,125,2147483766,127,2147483765,136,137,1073741941,3221225589,134,136,137,134,134,103,137,134,134,1073741941,1073741942,64,65,66,73,134,63,63,63,64,65,66,73,64,65,66,73,
62963,63,63,63,63,63,81,81,117,2147483775,128,118,70,70,63,65,66,73,70,70,70,70,70,70,70,70,70,70,63,2147483766,2147483765,103,104,103,104,1073741942,3221225590,134,74,75,76,77,134,63,63,134,70,70,156,157,70,63,63,63,64,65,66,73,64,65,66,73,70,70,
63074,75,76,77,63,63,63,81,81,174,135,117,2147483775,118,63,70,70,70,70,70,70,70,70,70,70,70,63,63,63,2147483765,103,104,74,75,76,70,70,75,76,77,74,75,76,63,63,63,63,70,159,160,70,63,63,63,70,70,130,124,125,70,70,70,70,70,
63181,81,81,81,63,63,81,81,81,81,81,81,81,63,63,70,70,70,70,2147483766,127,127,63,63,63,63,63,63,63,134,134,75,76,77,74,75,76,77,134,134,134,134,134,63,63,63,63,70,70,63,63,63,63,70,124,125,70,70,70,70,70,70,64,65,
63263,63,63,63,63,63,63,63,63,81,81,63,63,63,63,63,63,128,127,2147483765,134,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,70,70,70,70,70,124,125,70,70,70,70,70,70,
63363,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,103,104,103,104,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,70,70,70,70,124,125,70,70,70,70,70,70,70,
63463,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,134,134,63,63,63,63,63,63,63,63,63,74,75,76,77,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,70,70,70,70,70,162,163,164,165,166,167,168,169,
63563,63,63,63,63,63,74,75,76,77,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,81,81,81,81,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,70,70,70,124,125,70,70,170,171,172,173,119,69,
63663,63,63,63,63,63,81,81,81,81,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,70,70,70,70,70,70,70,70,124,125,70,70,70
637</data>
638 </layer>
639 <objectgroup id="2" name="Object Layer 1">
640 <object id="1" name="fromLeft" type="warp" x="16" y="364.667">
641 <point/>
642 </object>
643 </objectgroup>
644 <layer id="1" name="Layer 0" width="64" height="64">
645 <data encoding="csv">
6461,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,5,6,7,7,8,9,3,4,1,2,3,4,1,2,3,4,
6473,4,1,2,3,4,1,2,3,4,1,2,3,4,10,11,12,13,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,14,7,7,15,13,1,2,3,4,1,2,3,4,1,2,
6481,2,3,4,1,2,3,4,1,2,3,4,1,2,3,14,8,9,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,5,6,7,7,8,9,3,4,1,2,3,4,1,2,3,4,
6493,4,1,2,3,4,1,2,3,4,1,2,3,4,1,16,17,18,1,2,3,4,5,11,12,13,5,11,12,13,1,2,3,4,1,2,3,4,1,2,3,4,10,11,12,13,1,2,3,14,7,7,19,13,1,2,3,4,10,11,12,13,1,2,
65010,11,12,13,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,5,11,20,21,22,23,3,24,25,26,12,13,5,11,12,27,28,11,12,27,1,2,3,14,8,9,3,4,5,6,7,7,25,26,12,13,1,2,3,14,8,9,3,4,
6513,14,8,9,3,4,10,11,12,13,10,11,12,13,1,2,3,4,5,11,20,21,7,7,19,13,5,29,7,7,25,26,20,21,22,9,3,14,25,26,12,13,1,16,17,18,5,11,20,21,7,7,7,7,25,26,12,13,1,16,17,18,1,2,
6521,16,17,18,1,2,3,24,25,26,20,21,22,9,3,4,1,2,3,24,7,7,7,7,25,26,20,21,7,7,7,7,7,7,19,27,28,6,7,7,22,23,3,4,1,2,3,14,7,7,7,7,7,7,7,7,8,9,3,4,1,2,3,4,
6533,4,1,2,3,4,10,29,7,7,30,31,32,4,1,2,3,4,5,29,7,7,7,7,7,7,7,7,7,7,7,7,7,7,25,26,20,33,7,34,19,13,1,2,3,4,5,6,7,2147483682,7,7,7,7,7,7,35,13,1,2,3,4,1,2,
6541,2,3,4,10,11,20,21,7,7,19,13,1,2,3,4,1,2,3,14,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,36,25,26,12,13,1,2,3,14,7,7,7,7,7,7,7,7,25,26,12,13,1,2,3,4,
6553,4,1,2,3,24,7,7,7,7,22,9,3,4,1,2,3,4,28,29,7,7,30,31,37,38,30,31,37,38,30,31,37,38,7,7,7,7,7,7,7,7,22,23,3,4,1,39,37,38,7,7,7,7,7,7,40,7,8,9,3,4,1,2,
6561,2,3,4,1,39,37,38,7,7,19,13,1,2,3,4,1,2,3,14,7,7,19,13,1,39,32,4,1,39,32,4,1,39,37,38,7,7,7,7,7,7,19,13,1,2,3,13,1,39,37,38,7,7,7,7,30,31,17,4,1,2,3,4,
6573,4,1,2,3,4,1,39,37,38,22,9,3,4,1,2,3,4,28,29,7,7,8,9,3,4,1,2,3,4,1,2,3,4,1,39,37,38,7,7,7,7,22,9,3,4,1,2,3,4,5,6,7,7,7,41,32,4,1,2,3,4,1,2,
6581,2,3,4,1,2,3,4,10,42,35,13,10,11,12,13,28,11,20,21,7,7,19,13,1,2,3,4,1,2,3,4,1,2,3,4,10,6,7,7,7,7,19,13,1,2,3,4,5,11,20,21,7,7,43,44,1,2,3,4,1,2,3,4,
6593,4,1,11,12,13,1,2,3,45,25,26,20,21,22,9,3,14,7,7,7,7,22,9,3,4,1,2,3,4,1,2,3,4,1,2,3,14,7,7,7,7,25,26,12,13,1,2,3,14,7,7,7,7,8,9,3,4,1,2,3,4,1,2,
6601,2,3,14,8,9,3,4,1,16,37,38,7,7,19,13,28,29,7,7,7,7,19,13,28,11,12,27,1,2,3,4,10,11,12,13,1,39,37,38,7,7,7,7,25,9,3,4,1,39,37,38,7,7,19,13,1,2,3,4,1,2,3,4,
6613,4,1,16,17,18,1,2,3,4,10,29,7,7,25,26,20,21,7,7,7,7,25,26,20,21,46,26,12,27,1,2,3,14,8,9,3,4,10,6,7,7,30,31,3,4,1,2,3,4,1,6,7,7,25,26,12,13,1,2,3,4,1,2,
6621,2,3,4,1,2,3,4,28,11,20,21,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,22,23,3,4,1,16,17,18,10,11,20,14,7,7,19,13,10,11,12,13,1,2,3,14,7,7,7,7,22,23,3,4,1,2,3,4,
6633,4,10,11,12,13,10,11,20,21,7,7,7,7,7,7,7,7,30,31,37,38,7,7,7,7,30,31,3,4,1,2,3,4,1,2,3,14,7,7,7,7,22,9,3,14,8,9,3,4,5,6,7,7,30,31,32,4,10,11,12,13,1,2,
6641,2,3,14,25,26,20,21,7,7,7,7,30,31,37,38,30,31,17,4,28,29,7,7,7,7,19,13,28,11,12,13,1,2,3,4,1,39,37,38,7,7,19,13,1,16,17,18,1,2,3,14,7,7,19,13,1,2,3,14,8,9,3,4,
66512,13,10,29,7,7,7,7,7,7,7,7,19,13,1,16,17,4,1,2,3,14,30,31,37,38,8,9,3,14,8,9,3,4,1,2,3,4,10,29,7,7,25,26,12,44,1,2,3,4,10,6,7,7,25,26,12,13,1,16,17,18,1,2,
66625,26,20,21,7,7,7,7,7,7,7,7,8,9,3,4,1,2,3,4,1,16,17,4,1,16,17,4,1,16,17,18,1,2,3,4,10,11,20,21,7,7,7,7,22,23,3,4,1,2,3,14,7,7,7,7,25,26,12,13,1,2,3,4,
6677,7,7,7,7,7,7,7,7,7,30,31,17,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,14,40,7,7,7,7,7,19,44,1,2,3,4,1,39,37,38,7,7,7,7,22,23,3,4,1,2,
6687,7,7,7,7,7,7,7,7,7,19,13,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,28,29,7,7,7,7,7,40,8,9,3,4,1,2,3,4,10,6,7,7,7,7,19,13,1,2,3,4,
66937,38,30,31,37,38,30,31,37,38,25,26,12,27,1,2,3,4,10,11,12,13,1,2,3,4,1,2,3,4,28,11,12,27,28,11,20,21,7,7,7,7,7,7,19,44,1,2,3,4,1,2,3,14,7,7,7,7,8,9,3,4,1,2,
6701,16,17,4,1,16,17,4,10,29,7,7,25,26,12,27,1,2,3,14,8,9,3,4,1,2,3,4,1,2,3,14,25,26,20,21,7,7,7,7,30,31,37,38,8,9,3,4,1,2,3,4,1,16,37,38,7,7,19,13,1,2,3,4,
6713,4,1,2,3,4,1,2,3,14,30,31,37,38,22,23,3,4,1,16,17,18,1,2,3,4,1,2,3,4,28,29,40,7,7,7,7,7,7,7,19,13,1,16,32,4,1,2,3,4,1,2,3,4,5,6,7,7,25,26,12,13,1,2,
6721,2,3,4,1,2,3,4,1,16,17,4,1,16,17,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,14,7,7,7,7,7,7,7,40,25,26,12,13,1,2,3,4,1,2,3,4,10,11,20,21,7,7,7,7,22,9,3,4,
6733,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,10,11,12,27,28,11,12,27,28,11,12,27,28,29,7,7,7,7,7,7,7,7,7,7,8,9,3,4,10,11,12,13,5,11,47,33,7,7,7,7,30,31,32,4,1,2,
6741,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,10,11,20,21,25,26,20,21,25,9,3,14,25,26,20,21,7,7,7,7,7,7,7,34,30,31,3,4,1,2,3,14,8,9,3,14,7,7,7,7,30,31,32,4,1,2,3,4,
6753,4,10,11,12,13,1,2,3,4,1,2,3,4,1,2,3,14,7,7,40,7,7,7,43,27,28,29,7,7,7,7,7,7,7,41,37,38,7,36,19,44,1,2,3,4,1,16,17,18,1,16,37,38,7,7,15,13,1,2,3,4,1,2,
6761,2,3,14,8,9,3,4,1,2,3,4,10,11,12,27,10,29,7,7,7,7,7,7,25,26,20,21,7,7,7,7,7,7,43,44,1,16,37,38,8,9,3,4,1,2,3,4,1,2,3,4,5,6,7,7,25,26,12,4,1,2,3,4,
6773,4,1,16,17,18,1,2,3,4,1,2,3,14,25,26,20,21,7,7,7,7,7,7,7,7,7,7,7,7,7,41,37,38,8,9,3,4,1,16,17,18,1,2,3,4,1,2,3,4,1,11,47,21,7,7,7,7,22,2,3,4,1,2,
6781,2,3,4,1,2,3,4,10,11,12,13,10,29,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,43,44,1,16,32,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,14,7,7,7,7,30,31,32,4,1,2,3,4,
6793,4,1,2,3,4,10,11,20,21,25,26,20,21,7,7,7,7,7,7,7,7,7,41,37,38,30,41,37,38,8,9,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,16,37,38,7,7,19,13,1,2,3,4,1,2,
6801,2,3,4,10,11,20,21,7,7,7,7,30,41,37,38,7,7,7,7,7,7,43,44,1,16,32,4,1,16,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,5,6,7,7,25,26,12,13,1,2,3,4,
6813,4,1,2,3,14,7,7,7,7,30,31,32,4,1,16,37,38,7,7,7,7,46,48,12,13,1,2,3,4,10,11,12,13,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,5,11,47,33,7,7,7,7,22,23,3,4,1,2,
6821,2,3,4,1,16,37,38,7,7,19,13,1,2,3,4,1,16,37,38,7,7,7,7,22,9,3,4,1,2,3,14,8,9,3,4,10,11,12,13,1,11,12,13,10,11,12,13,10,11,47,33,7,7,7,7,30,31,32,4,1,2,3,4,
6833,4,1,2,3,4,10,29,7,7,8,9,3,13,1,2,3,4,10,29,2147483682,7,7,7,19,13,1,2,3,4,1,16,17,18,1,2,3,14,8,9,3,14,46,48,20,21,8,9,3,14,7,7,7,7,7,34,19,13,1,2,3,4,1,2,
6841,2,3,4,1,2,3,14,30,31,32,13,1,2,3,4,1,2,3,14,2147483684,7,7,7,25,26,12,13,1,2,3,4,1,2,3,4,1,16,17,18,10,29,7,7,7,7,19,13,10,29,7,7,7,7,7,36,25,23,3,4,1,2,3,4,
6853,4,1,2,3,4,1,16,32,4,1,2,3,13,1,2,3,4,1,39,37,38,7,7,7,7,22,9,3,4,1,2,3,4,10,11,12,13,10,11,20,21,7,7,7,7,25,48,20,21,7,7,7,7,30,31,32,4,10,11,12,13,1,2,
6861,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,16,37,38,7,7,19,13,10,11,12,13,10,11,20,21,46,48,20,21,7,7,7,7,7,7,7,7,7,7,7,7,7,7,19,13,1,2,3,14,8,9,3,4,
6873,4,10,11,12,13,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,10,29,7,7,46,48,20,21,46,48,20,21,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,9,3,4,1,16,17,18,1,2,
6881,2,3,14,8,9,3,4,1,2,3,4,1,2,3,4,1,2,3,4,10,11,20,21,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,30,31,32,4,10,2,3,13,1,2,3,4,
6893,4,1,16,17,18,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,14,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,30,31,37,38,30,31,37,38,7,7,19,13,10,2,3,4,1,2,3,4,1,2,
6901,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,10,11,12,13,10,29,7,7,7,7,7,7,7,40,7,7,7,7,7,7,30,31,37,38,30,31,32,4,1,16,32,4,1,16,37,38,22,9,3,4,1,2,3,4,1,2,3,4,
6913,4,1,2,3,4,10,11,12,13,1,2,3,4,10,11,20,33,25,26,20,33,7,7,7,7,30,31,37,38,7,7,7,34,30,31,32,4,1,39,32,4,1,2,3,4,1,2,3,4,10,29,19,13,10,11,12,13,1,2,3,4,1,2,
6921,2,3,4,1,2,3,14,25,26,12,13,10,2,3,14,7,7,7,7,7,7,7,7,7,7,35,13,1,39,37,38,7,36,19,13,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,49,50,48,20,21,8,9,3,4,1,2,3,4,
6933,4,1,2,3,4,1,16,37,38,8,9,3,4,1,16,37,38,7,7,7,7,7,7,7,7,22,23,3,4,1,39,37,38,8,9,3,4,1,2,3,4,1,2,3,4,1,2,3,4,10,29,7,7,7,7,19,44,1,2,3,4,1,2,
69410,11,12,13,1,2,3,4,10,29,35,13,51,2,3,4,1,16,37,38,7,7,7,7,30,31,32,4,1,2,3,4,1,39,32,4,1,2,3,4,1,2,3,4,10,11,12,13,1,2,3,21,7,7,7,7,8,9,3,4,1,2,3,4,
6953,14,8,9,3,4,10,11,20,52,50,26,12,44,1,2,3,4,1,16,37,38,30,31,32,13,1,2,3,4,1,2,3,4,1,2,3,4,10,11,12,13,1,2,3,14,46,48,12,13,1,16,37,38,30,41,17,4,1,2,3,4,1,2,
6961,16,17,18,10,11,20,21,7,7,7,7,22,9,3,4,1,2,3,4,1,16,32,4,1,2,3,4,1,2,3,4,10,11,12,13,1,2,3,14,22,9,3,4,10,29,7,7,22,9,3,4,1,16,17,4,1,2,3,4,1,2,3,4,
6973,4,1,2,3,24,30,41,37,38,30,41,17,4,1,2,3,13,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,21,22,9,3,4,1,16,17,4,10,11,20,21,7,7,19,13,1,2,3,4,1,2,3,4,1,2,3,4,1,2,
6981,2,3,4,1,16,53,4,1,16,53,4,1,2,3,4,1,2,3,13,1,2,3,4,1,2,3,4,1,2,3,4,1,16,17,4,10,11,12,13,10,11,20,21,7,7,7,7,8,9,3,4,1,2,3,4,1,2,3,4,1,2,3,4,
6993,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,10,11,20,21,22,9,3,14,30,31,37,38,7,7,19,44,1,2,3,4,1,2,3,4,1,2,3,4,1,2,
7001,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,14,30,31,17,18,1,16,17,4,1,16,37,38,46,48,12,13,1,2,3,4,10,11,12,13,10,11,12,13,
7013,4,1,2,3,4,1,2,3,4,1,2,3,4,10,11,12,13,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,13,10,29,19,13,1,2,3,4,1,2,3,4,10,29,54,55,22,9,3,4,10,11,20,21,25,48,20,21,22,9,
70210,11,12,13,1,2,3,4,1,2,3,4,1,2,3,14,8,9,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,14,8,9,3,4,10,11,12,13,1,2,3,14,30,41,17,44,1,2,3,14,7,7,7,41,56,38,35,13,
7033,14,8,9,3,4,1,2,3,4,1,2,3,4,10,39,17,18,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,16,17,4,1,2,3,14,22,9,3,4,1,16,3,4,1,2,3,4,5,29,7,7,43,44,5,6,25,26,
7041,16,17,18,1,2,3,4,1,2,3,4,1,2,3,4,5,2,3,4,1,2,3,4,1,2,3,4,1,2,17,4,1,2,3,4,1,2,3,4,1,16,17,4,10,2,3,13,1,2,3,4,1,2,3,14,30,31,53,57,58,59,56,38,
7053,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,10,29,35,44,12,13,10,11,10,6,
7061,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,10,11,12,13,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,49,50,48,60,26,20,61,20,52,
7073,4,1,2,3,4,10,11,12,13,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,14,8,9,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,16,37,38,7,7,7,7,30,41,
7081,2,3,4,1,2,3,14,8,9,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,16,17,18,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,27,1,16,37,38,7,41,17,18,
70912,27,28,11,12,27,28,16,17,18,28,11,12,27,28,11,12,27,28,11,12,27,28,11,12,27,28,11,12,27,28,11,12,27,28,11,12,27,28,11,12,27,28,11,12,27,28,11,12,27,28,11,12,27,10,11,12,27,10,29,43,44,28,11
710</data>
711 </layer>
712</map>
diff --git a/res/maps/map2_tiles.png b/res/maps/map2_tiles.png new file mode 100644 index 0000000..1e6c09f --- /dev/null +++ b/res/maps/map2_tiles.png
Binary files differ
diff --git a/res/scripts/map1_off_right.lua b/res/scripts/map1_off_right.lua new file mode 100644 index 0000000..026c32e --- /dev/null +++ b/res/scripts/map1_off_right.lua
@@ -0,0 +1,9 @@
1function map1_off_right()
2 -- Because this script gets triggered within the CharacterSystem's tick method,
3 -- if we immediately cleared out the entities from the old map, we might end up
4 -- returning there and processing stale data. This yield here ensures that we
5 -- are no longer in the CharacterSystem, because processing gets picked back up
6 -- in the ScriptSystem.
7 coroutine.yield()
8 loadMap("../res/maps/map2.tmx", "fromLeft")
9end
diff --git a/src/animation_system.cpp b/src/animation_system.cpp index cf34066..997b7f7 100644 --- a/src/animation_system.cpp +++ b/src/animation_system.cpp
@@ -6,7 +6,7 @@
6#include "vector.h" 6#include "vector.h"
7#include "util.h" 7#include "util.h"
8 8
9void AnimationSystem::initSprite(int spriteId, std::string_view filename, Renderer& renderer) { 9void AnimationSystem::initSprite(int spriteId, std::string_view filename) {
10 std::ifstream datafile(filename.data()); 10 std::ifstream datafile(filename.data());
11 if (!datafile.is_open()) { 11 if (!datafile.is_open()) {
12 throw std::invalid_argument(std::string("Could not find sprite datafile: ") + std::string(filename)); 12 throw std::invalid_argument(std::string("Could not find sprite datafile: ") + std::string(filename));
@@ -18,9 +18,7 @@ void AnimationSystem::initSprite(int spriteId, std::string_view filename, Render
18 char ch; 18 char ch;
19 std::string line; 19 std::string line;
20 20
21 std::string imagename; 21 datafile >> sprite.spritesheet;
22 datafile >> imagename;
23 sprite.textureId = renderer.loadImageFromFile(imagename);
24 22
25 std::string framefilename; 23 std::string framefilename;
26 datafile >> framefilename; 24 datafile >> framefilename;
diff --git a/src/animation_system.h b/src/animation_system.h index 2e13784..a116673 100644 --- a/src/animation_system.h +++ b/src/animation_system.h
@@ -7,7 +7,6 @@
7#include "timer.h" 7#include "timer.h"
8 8
9class Game; 9class Game;
10class Renderer;
11 10
12class AnimationSystem : public System { 11class AnimationSystem : public System {
13public: 12public:
@@ -18,7 +17,7 @@ public:
18 17
19 void tick(double dt) override; 18 void tick(double dt) override;
20 19
21 void initSprite(int spriteId, std::string_view filename, Renderer& renderer); 20 void initSprite(int spriteId, std::string_view filename);
22 21
23 void setSpriteDirection(int spriteId, Direction dir); 22 void setSpriteDirection(int spriteId, Direction dir);
24 23
diff --git a/src/camera_system.cpp b/src/camera_system.cpp index 4709d01..991d096 100644 --- a/src/camera_system.cpp +++ b/src/camera_system.cpp
@@ -4,7 +4,7 @@
4#include "map.h" 4#include "map.h"
5 5
6void CameraSystem::tick(double dt) { 6void CameraSystem::tick(double dt) {
7 if (!locked_) { 7 if (!locked_ && followingSprite_ != -1) {
8 const Sprite& follow = game_.getSprite(followingSprite_); 8 const Sprite& follow = game_.getSprite(followingSprite_);
9 const Map& map = game_.getMap(); 9 const Map& map = game_.getMap();
10 vec2i mapBounds = map.getMapSize() * map.getTileSize(); 10 vec2i mapBounds = map.getMapSize() * map.getTileSize();
@@ -25,3 +25,7 @@ void CameraSystem::tick(double dt) {
25 } 25 }
26 } 26 }
27} 27}
28
29void CameraSystem::clearSpriteCache() {
30 followingSprite_ = -1;
31}
diff --git a/src/camera_system.h b/src/camera_system.h index 3eb8374..77d813f 100644 --- a/src/camera_system.h +++ b/src/camera_system.h
@@ -26,12 +26,14 @@ public:
26 26
27 void tick(double dt) override; 27 void tick(double dt) override;
28 28
29 void clearSpriteCache() override;
30
29private: 31private:
30 Game& game_; 32 Game& game_;
31 33
32 vec2i pos_; 34 vec2i pos_;
33 vec2i fov_ { CANVAS_WIDTH, CANVAS_HEIGHT }; 35 vec2i fov_ { CANVAS_WIDTH, CANVAS_HEIGHT };
34 int followingSprite_; 36 int followingSprite_ = -1;
35 bool locked_ = true; 37 bool locked_ = true;
36}; 38};
37 39
diff --git a/src/game.cpp b/src/game.cpp index 447b62a..861e8ee 100644 --- a/src/game.cpp +++ b/src/game.cpp
@@ -1,4 +1,8 @@
1#include "game.h" 1#include "game.h"
2#include "transform_system.h"
3#include "animation_system.h"
4#include "character_system.h"
5#include "camera_system.h"
2 6
3int Game::emplaceSprite(std::string alias) { 7int Game::emplaceSprite(std::string alias) {
4 int id = sprites_.size(); 8 int id = sprites_.size();
@@ -7,3 +11,59 @@ int Game::emplaceSprite(std::string alias) {
7 spritesByAlias_[alias] = id; 11 spritesByAlias_[alias] = id;
8 return id; 12 return id;
9} 13}
14
15void Game::clearSprites() {
16 sprites_.clear();
17 spriteIds_.clear();
18 spritesByAlias_.clear();
19
20 for (std::unique_ptr<System>& system : systems_) {
21 system->clearSpriteCache();
22 }
23}
24
25void Game::loadMap(std::string filename, std::string warpPoint) {
26 clearSprites();
27
28 map_ = std::make_unique<Map>(filename);
29
30 int lucasSprite = emplaceSprite("lucas");
31 getSystem<TransformSystem>().initSprite(lucasSprite, map_->getWarpPoint(warpPoint));
32 getSystem<TransformSystem>().setUpCollision(lucasSprite, {-8, -8}, {12, 8}, true);
33 getSystem<AnimationSystem>().initSprite(lucasSprite, "../res/sprites/lucas_anim.txt");
34 getSprite(lucasSprite).controllable = true;
35 getSystem<CharacterSystem>().initSprite(lucasSprite);
36
37 int kumaSprite = emplaceSprite("kuma");
38 getSystem<TransformSystem>().initSprite(kumaSprite, {32, 32});
39 getSystem<AnimationSystem>().initSprite(kumaSprite, "../res/sprites/kuma_anim.txt");
40 getSystem<CharacterSystem>().addSpriteToParty(lucasSprite, kumaSprite);
41
42 int dusterSprite = emplaceSprite("duster");
43 getSystem<TransformSystem>().initSprite(dusterSprite, {32, 32});
44 getSystem<AnimationSystem>().initSprite(dusterSprite, "../res/sprites/duster_anim.txt");
45 getSystem<CharacterSystem>().addSpriteToParty(lucasSprite, dusterSprite);
46
47 int boneySprite = emplaceSprite("boney");
48 getSystem<TransformSystem>().initSprite(boneySprite, {32, 32});
49 getSystem<AnimationSystem>().initSprite(boneySprite, "../res/sprites/boney_anim.txt");
50 getSystem<CharacterSystem>().addSpriteToParty(lucasSprite, boneySprite);
51
52 for (const Prototype& p : map_->getPrototypes()) {
53 int spriteId = emplaceSprite(p.name);
54 getSystem<TransformSystem>().initSprite(spriteId, p.pos);
55 getSystem<TransformSystem>().setUpCollision(spriteId, p.collisionOffset, p.collisionSize, true);
56 getSystem<AnimationSystem>().initSprite(spriteId, p.animationFilename);
57 getSprite(spriteId).interactionScript = p.interactionScript;
58 }
59
60 for (const Trigger& t : map_->getTriggers()) {
61 int spriteId = emplaceSprite(t.name);
62 getSystem<TransformSystem>().initSprite(spriteId, t.pos);
63 getSystem<TransformSystem>().setUpCollision(spriteId, {0, 0}, t.size, false);
64 getSprite(spriteId).walkthroughScript = t.script;
65 }
66
67 getSystem<CameraSystem>().setFollowingSprite(lucasSprite);
68 getSystem<CameraSystem>().unlockCamera();
69}
diff --git a/src/game.h b/src/game.h index 87e23d3..8ea7576 100644 --- a/src/game.h +++ b/src/game.h
@@ -73,7 +73,7 @@ public:
73 }); 73 });
74 } 74 }
75 75
76 void setMap(std::unique_ptr<Map> map) { map_ = std::move(map); } 76 void loadMap(std::string filename, std::string warpPoint);
77 77
78 const Map& getMap() const { return *map_; } 78 const Map& getMap() const { return *map_; }
79 79
@@ -81,6 +81,8 @@ public:
81 81
82private: 82private:
83 83
84 void clearSprites();
85
84 Mixer mixer_; 86 Mixer mixer_;
85 bool shouldQuit_ = false; 87 bool shouldQuit_ = false;
86 88
diff --git a/src/main.cpp b/src/main.cpp index a350c8d..5f28408 100644 --- a/src/main.cpp +++ b/src/main.cpp
@@ -22,48 +22,7 @@ void loop(Renderer& renderer) {
22 game.emplaceSystem<MessageSystem>(); 22 game.emplaceSystem<MessageSystem>();
23 game.emplaceSystem<ScriptSystem>(); 23 game.emplaceSystem<ScriptSystem>();
24 24
25 auto map = std::make_unique<Map>("../res/maps/map1.tmx", renderer); 25 game.loadMap("../res/maps/map1.tmx", "spawn");
26 game.setMap(std::move(map));
27
28 int lucasSprite = game.emplaceSprite("lucas");
29 game.getSystem<TransformSystem>().initSprite(lucasSprite, game.getMap().getWarpPoint("spawn"));
30 game.getSystem<TransformSystem>().setUpCollision(lucasSprite, {-8, -8}, {12, 8}, true);
31 game.getSystem<AnimationSystem>().initSprite(lucasSprite, "../res/sprites/lucas_anim.txt", renderer);
32 game.getSprite(lucasSprite).controllable = true;
33 game.getSystem<CharacterSystem>().initSprite(lucasSprite);
34
35 int kumaSprite = game.emplaceSprite("kuma");
36 game.getSystem<TransformSystem>().initSprite(kumaSprite, {32, 32});
37 game.getSystem<AnimationSystem>().initSprite(kumaSprite, "../res/sprites/kuma_anim.txt", renderer);
38 game.getSystem<CharacterSystem>().addSpriteToParty(lucasSprite, kumaSprite);
39
40 int dusterSprite = game.emplaceSprite("duster");
41 game.getSystem<TransformSystem>().initSprite(dusterSprite, {32, 32});
42 game.getSystem<AnimationSystem>().initSprite(dusterSprite, "../res/sprites/duster_anim.txt", renderer);
43 game.getSystem<CharacterSystem>().addSpriteToParty(lucasSprite, dusterSprite);
44
45 int boneySprite = game.emplaceSprite("boney");
46 game.getSystem<TransformSystem>().initSprite(boneySprite, {32, 32});
47 game.getSystem<AnimationSystem>().initSprite(boneySprite, "../res/sprites/boney_anim.txt", renderer);
48 game.getSystem<CharacterSystem>().addSpriteToParty(lucasSprite, boneySprite);
49
50 for (const Prototype& p : game.getMap().getPrototypes()) {
51 int spriteId = game.emplaceSprite(p.name);
52 game.getSystem<TransformSystem>().initSprite(spriteId, p.pos);
53 game.getSystem<TransformSystem>().setUpCollision(spriteId, p.collisionOffset, p.collisionSize, true);
54 game.getSystem<AnimationSystem>().initSprite(spriteId, p.animationFilename, renderer);
55 game.getSprite(spriteId).interactionScript = p.interactionScript;
56 }
57
58 for (const Trigger& t : game.getMap().getTriggers()) {
59 int spriteId = game.emplaceSprite(t.name);
60 game.getSystem<TransformSystem>().initSprite(spriteId, t.pos);
61 game.getSystem<TransformSystem>().setUpCollision(spriteId, {0, 0}, t.size, false);
62 game.getSprite(spriteId).walkthroughScript = t.script;
63 }
64
65 game.getSystem<CameraSystem>().setFollowingSprite(lucasSprite);
66 game.getSystem<CameraSystem>().unlockCamera();
67 26
68 renderer.render(game); 27 renderer.render(game);
69 28
diff --git a/src/map.cpp b/src/map.cpp index b6f6755..99711c6 100644 --- a/src/map.cpp +++ b/src/map.cpp
@@ -4,9 +4,8 @@
4#include <tmxlite/Property.hpp> 4#include <tmxlite/Property.hpp>
5#include <tmxlite/TileLayer.hpp> 5#include <tmxlite/TileLayer.hpp>
6#include <tmxlite/Tileset.hpp> 6#include <tmxlite/Tileset.hpp>
7#include "renderer.h"
8 7
9Map::Map(std::string_view filename, Renderer& renderer) { 8Map::Map(std::string_view filename) : filename_(filename) {
10 tmx::Map mapfile; 9 tmx::Map mapfile;
11 if (!mapfile.load(filename.data())) { 10 if (!mapfile.load(filename.data())) {
12 throw std::invalid_argument("Could not find map file: " + std::string(filename)); 11 throw std::invalid_argument("Could not find map file: " + std::string(filename));
@@ -24,7 +23,7 @@ Map::Map(std::string_view filename, Renderer& renderer) {
24 // There should only be one tileset. 23 // There should only be one tileset.
25 const tmx::Tileset& tileset = mapfile.getTilesets()[0]; 24 const tmx::Tileset& tileset = mapfile.getTilesets()[0];
26 firstGID = tileset.getFirstGID(); 25 firstGID = tileset.getFirstGID();
27 tilesetTextureId_ = renderer.loadImageFromFile(tileset.getImagePath()); 26 tilesetFilename_ = tileset.getImagePath();
28 tilesetColumns_ = tileset.getColumnCount(); 27 tilesetColumns_ = tileset.getColumnCount();
29 28
30 for (const auto& layer : mapfile.getLayers()) { 29 for (const auto& layer : mapfile.getLayers()) {
diff --git a/src/map.h b/src/map.h index 4c5d6d4..adf9b80 100644 --- a/src/map.h +++ b/src/map.h
@@ -5,12 +5,9 @@
5#include <string> 5#include <string>
6#include <string_view> 6#include <string_view>
7#include <vector> 7#include <vector>
8#include "renderer.h"
9#include "vector.h" 8#include "vector.h"
10#include "step_type.h" 9#include "step_type.h"
11 10
12class Renderer;
13
14struct Tile { 11struct Tile {
15 unsigned int id = 0; 12 unsigned int id = 0;
16 bool flipHorizontal = false; 13 bool flipHorizontal = false;
@@ -38,7 +35,9 @@ struct Trigger {
38class Map { 35class Map {
39public: 36public:
40 37
41 Map(std::string_view filename, Renderer& renderer); 38 explicit Map(std::string_view filename);
39
40 const std::string& getName() const { return filename_; }
42 41
43 const vec2i& getMapSize() const { return mapSize_; } 42 const vec2i& getMapSize() const { return mapSize_; }
44 43
@@ -46,7 +45,7 @@ public:
46 45
47 const std::vector<std::vector<Tile>>& getLayers() const { return layers_; } 46 const std::vector<std::vector<Tile>>& getLayers() const { return layers_; }
48 47
49 int getTilesetTextureId() const { return tilesetTextureId_; } 48 const std::string& getTilesetFilename() const { return tilesetFilename_; }
50 49
51 int getTilesetColumns() const { return tilesetColumns_; } 50 int getTilesetColumns() const { return tilesetColumns_; }
52 51
@@ -62,10 +61,11 @@ public:
62 61
63private: 62private:
64 63
64 std::string filename_;
65 vec2i mapSize_; 65 vec2i mapSize_;
66 vec2i tileSize_; 66 vec2i tileSize_;
67 std::vector<std::vector<Tile>> layers_; 67 std::vector<std::vector<Tile>> layers_;
68 int tilesetTextureId_; 68 std::string tilesetFilename_;
69 int tilesetColumns_; 69 int tilesetColumns_;
70 std::vector<Prototype> prototypes_; 70 std::vector<Prototype> prototypes_;
71 std::map<std::string, vec2i> warpPoints_; 71 std::map<std::string, vec2i> warpPoints_;
diff --git a/src/renderer.cpp b/src/renderer.cpp index 87bbbcd..e9db413 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp
@@ -35,6 +35,16 @@ Renderer::Renderer() {
35} 35}
36 36
37texture_ptr Renderer::renderMapLayer(const Map& map, int layer) { 37texture_ptr Renderer::renderMapLayer(const Map& map, int layer) {
38 if (cachedTilesetName_ != map.getTilesetFilename()) {
39 surface_ptr pfs(IMG_Load(map.getTilesetFilename().c_str()));
40 if (!pfs) {
41 throw img_error();
42 }
43
44 tilesetTex_ = texture_ptr(SDL_CreateTextureFromSurface(ren_.get(), pfs.get()));
45 cachedTilesetName_ = map.getTilesetFilename();
46 }
47
38 vec2i mapBounds = map.getMapSize() * map.getTileSize(); 48 vec2i mapBounds = map.getMapSize() * map.getTileSize();
39 49
40 texture_ptr canvas( 50 texture_ptr canvas(
@@ -77,7 +87,7 @@ texture_ptr Renderer::renderMapLayer(const Map& map, int layer) {
77 } else if (tile.flipVertical) { 87 } else if (tile.flipVertical) {
78 flip = SDL_FLIP_VERTICAL; 88 flip = SDL_FLIP_VERTICAL;
79 } 89 }
80 SDL_RenderCopyEx(ren_.get(), textures_[map.getTilesetTextureId()].get(), &srcRect, &destRect, 0, nullptr, flip); 90 SDL_RenderCopyEx(ren_.get(), tilesetTex_.get(), &srcRect, &destRect, 0, nullptr, flip);
81 } 91 }
82 } 92 }
83 93
@@ -85,10 +95,9 @@ texture_ptr Renderer::renderMapLayer(const Map& map, int layer) {
85} 95}
86 96
87void Renderer::render(Game& game) { 97void Renderer::render(Game& game) {
88 if (!renLay1_) { 98 if (cachedMapName_ != game.getMap().getName()) {
99 cachedMapName_ = game.getMap().getName();
89 renLay1_ = renderMapLayer(game.getMap(), 0); 100 renLay1_ = renderMapLayer(game.getMap(), 0);
90 }
91 if (!renLay0_) {
92 renLay0_ = renderMapLayer(game.getMap(), 1); 101 renLay0_ = renderMapLayer(game.getMap(), 1);
93 } 102 }
94 103
@@ -118,7 +127,7 @@ void Renderer::render(Game& game) {
118 const SpriteFrame& frame = sprite.frames.at(sprite.animations.at(sprite.animationId).at(sprite.animationFrame)); 127 const SpriteFrame& frame = sprite.frames.at(sprite.animations.at(sprite.animationId).at(sprite.animationFrame));
119 const SDL_Rect& src = frame.srcRect; 128 const SDL_Rect& src = frame.srcRect;
120 SDL_Rect dest { sprite.loc.x() - frame.center.x(), sprite.loc.y() - frame.center.y(), frame.size.w(), frame.size.h() }; 129 SDL_Rect dest { sprite.loc.x() - frame.center.x(), sprite.loc.y() - frame.center.y(), frame.size.w(), frame.size.h() };
121 SDL_RenderCopy(ren_.get(), textures_.at(sprite.textureId).get(), &src, &dest); 130 SDL_RenderCopy(ren_.get(), textures_.at(loadImageFromFile(sprite.spritesheet)).get(), &src, &dest);
122 } 131 }
123 } 132 }
124 133
diff --git a/src/renderer.h b/src/renderer.h index 2d7f93b..6d512c2 100644 --- a/src/renderer.h +++ b/src/renderer.h
@@ -136,6 +136,9 @@ private:
136 // Map rendering 136 // Map rendering
137 texture_ptr renderMapLayer(const Map& map, int layer); 137 texture_ptr renderMapLayer(const Map& map, int layer);
138 138
139 std::string cachedMapName_;
140 std::string cachedTilesetName_;
141 texture_ptr tilesetTex_;
139 texture_ptr renLay0_; 142 texture_ptr renLay0_;
140 texture_ptr renLay1_; 143 texture_ptr renLay1_;
141 144
diff --git a/src/script_system.cpp b/src/script_system.cpp index e2b117a..6e38905 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp
@@ -50,6 +50,12 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) {
50 return game_.getSpriteByAlias(alias); 50 return game_.getSpriteByAlias(alias);
51 }); 51 });
52 52
53 engine_.set_function(
54 "loadMap",
55 [&] (std::string filename, std::string warpPoint) {
56 game_.loadMap(filename, warpPoint);
57 });
58
53 engine_.script_file("../res/scripts/common.lua"); 59 engine_.script_file("../res/scripts/common.lua");
54} 60}
55 61
diff --git a/src/sprite.h b/src/sprite.h index 4a65763..283fb65 100644 --- a/src/sprite.h +++ b/src/sprite.h
@@ -42,7 +42,7 @@ public:
42 42
43 // Animation 43 // Animation
44 bool isAnimated = false; 44 bool isAnimated = false;
45 int textureId; 45 std::string spritesheet;
46 Direction dir = Direction::down; 46 Direction dir = Direction::down;
47 std::string animationName = "still"; 47 std::string animationName = "still";
48 int animationId = 0; 48 int animationId = 0;
diff --git a/src/system.h b/src/system.h index 218dc60..93b903e 100644 --- a/src/system.h +++ b/src/system.h
@@ -15,6 +15,8 @@ class System {
15public: 15public:
16 16
17 virtual void tick(double dt) {} 17 virtual void tick(double dt) {}
18
19 virtual void clearSpriteCache() {}
18}; 20};
19 21
20#endif /* end of include guard: SYSTEM_H_6B40E1B9 */ 22#endif /* end of include guard: SYSTEM_H_6B40E1B9 */
diff --git a/src/transform_system.cpp b/src/transform_system.cpp index 2ec133e..8a09c20 100644 --- a/src/transform_system.cpp +++ b/src/transform_system.cpp
@@ -209,3 +209,11 @@ void TransformSystem::removeCollidable(int spriteId) {
209 upCollidables_.erase({ colDR.y(), spriteId }); 209 upCollidables_.erase({ colDR.y(), spriteId });
210 downCollidables_.erase({ colUL.y(), spriteId }); 210 downCollidables_.erase({ colUL.y(), spriteId });
211} 211}
212
213void TransformSystem::clearSpriteCache() {
214 spritesByY_.clear();
215 leftCollidables_.clear();
216 rightCollidables_.clear();
217 upCollidables_.clear();
218 downCollidables_.clear();
219}
diff --git a/src/transform_system.h b/src/transform_system.h index 10e33db..46b6877 100644 --- a/src/transform_system.h +++ b/src/transform_system.h
@@ -43,6 +43,8 @@ public:
43 43
44 CollisionResult checkCollision(int spriteId, vec2i newLoc, Direction dir); 44 CollisionResult checkCollision(int spriteId, vec2i newLoc, Direction dir);
45 45
46 void clearSpriteCache() override;
47
46private: 48private:
47 49
48 Game& game_; 50 Game& game_;