forked from snesrev/zelda3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sprite.cpp
4403 lines (4067 loc) · 145 KB
/
sprite.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "sprite.h"
#include "dungeon.h"
#include "hud.h"
#include "load_gfx.h"
#include "overworld.h"
#include "variables.h"
#include "tagalong.h"
#include "overlord.h"
#include "ancilla.h"
#include "player.h"
#include "misc.h"
#include "overlord.h"
#include "tile_detect.h"
#include "tables/generated_dungeon_sprites.h"
#include "sprite_main.h"
static const uint16 kOamGetBufferPos_Tab0[6] = {0x171, 0x201, 0x31, 0xc1, 0x141, 0x1d1};
static const uint16 kOamGetBufferPos_Tab1[48] = {
0x30, 0x50, 0x80, 0xb0, 0xe0, 0x110, 0x140, 0x170, 0x1d0, 0x1d4, 0x1dc, 0x1e0, 0x1e4, 0x1ec, 0x1f0, 0x1f8,
0, 4, 8, 0xc, 0x10, 0x14, 0x18, 0x1c, 0x30, 0x38, 0x50, 0x68, 0x80, 0x98, 0xb0, 0xc8,
0x120, 0x124, 0x128, 0x12c, 0x130, 0x134, 0x138, 0x13c, 0x140, 0x150, 0x160, 0x170, 0x180, 0x190, 0x1a0, 0x1b8,
};
static const uint8 kSprite2_ReturnIfRecoiling_Masks[6] = {3, 1, 0, 0, 0xc, 3};
static const int8 kSpriteHitbox_XLo[32] = {
2, 3, 0, -3, -6, 0, 2, -8, 0, -4, -8, 0, -8, -16, 2, 2,
2, 2, 2, -8, 2, 2, -16, -8, -12, 4, -4, -12, 5, -32, -2, 4,
};
static const int8 kSpriteHitbox_XHi[32] = {
0, 0, 0, -1, -1, 0, 0, -1, 0, -1, -1, 0, -1, -1, 0, 0,
0, 0, 0, -1, 0, 0, -1, -1, -1, 0, -1, -1, 0, -1, -1, 0,
};
static const uint8 kSpriteHitbox_XSize[32] = {
12, 1, 16, 20, 20, 8, 4, 32, 48, 24, 32, 32, 32, 48, 12, 12,
60, 124, 12, 32, 4, 12, 48, 32, 40, 8, 24, 24, 5, 80, 4, 8,
};
static const int8 kSpriteHitbox_YLo[32] = {
0, 3, 4, -4, -8, 2, 0, -16, 12, -4, -8, 0, -10, -16, 2, 2,
2, 2, -3, -12, 2, 10, 0, -12, 16, 4, -4, -12, 3, -16, -8, 10,
};
static const int8 kSpriteHitbox_YHi[32] = {
0, 0, 0, -1, -1, 0, 0, -1, 0, -1, -1, 0, -1, -1, 0, 0,
0, 0, -1, -1, 0, 0, 0, -1, 0, 0, -1, -1, 0, -1, -1, 0,
};
static const uint8 kSpriteHitbox_YSize[32] = {
14, 1, 16, 21, 24, 4, 8, 40, 20, 24, 40, 29, 36, 48, 60, 124,
12, 12, 17, 28, 4, 2, 28, 20, 10, 4, 24, 16, 5, 48, 8, 12,
};
static const uint8 kSpriteDamage_Tab2[4] = {6, 4, 0, 0};
static const uint8 kSpriteDamage_Tab3[4] = {4, 6, 0, 2};
static const uint8 kSprite_Func21_Sfx[9] = {0x1f, 0x1f, 0x1e, 0x1e, 0x1e, 0x1f, 0x1f, 0x1f, 0x1f};
static const int8 kSparkleGarnish_XY[4] = {-4, 12, 3, 8};
static const uint8 kSpriteStunned_Main_Func1_Masks[7] = {0x7f, 0xf, 3, 1, 0, 0, 0};
static const uint8 kSprite_Func7_Tab[4] = {8, 4, 2, 1};
static const int8 kSprite_Func5_X[54] = {
8, 8, 2, 14, 8, 8, -2, 10, 8, 8, 1, 14, 4, 4, 4, 4,
4, 4, -2, 10, 8, 8, -25, 40, 8, 8, 2, 14, 8, 8, -8, 23,
8, 8, -20, 36, 8, 8, -1, 16, 8, 8, -1, 16, 8, 8, -8, 24,
8, 8, -8, 24, 8, 3,
};
static const int8 kSprite_Func5_Y[54] = {
6, 20, 13, 13, 0, 8, 4, 4, 1, 14, 8, 8, 4, 4, 4, 4,
-2, 10, 4, 4, -25, 40, 8, 8, 3, 16, 10, 10, -8, 25, 8, 8,
-20, 36, 8, 8, -1, 16, 8, 8, 14, 3, 8, 8, -8, 24, 8, 8,
-8, 32, 8, 8, 12, 4,
};
static const uint8 kSprite_SimplifiedTileAttr[256] = {
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 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 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0, 0, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
};
static const int8 kSlopedTile[32] = {
7, 6, 5, 4, 3, 2, 1, 0,
0, 1, 2, 3, 4, 5, 6, 7,
0, 1, 2, 3, 4, 5, 6, 7,
7, 6, 5, 4, 3, 2, 1, 0,
};
static const uint8 kSprite_Func1_Tab[8] = {15, 15, 24, 15, 15, 19, 15, 15};
static const uint8 kSprite_Func1_Tab2[8] = {6, 6, 6, 12, 6, 6, 6, 15};
static const uint8 kSprite_Func14_Damage[12] = {1, 2, 3, 4, 2, 3, 4, 5, 1, 1, 2, 3};
static const uint8 kEnemyDamages[128] = {
0, 1, 32, 255, 252, 251, 0, 0, 0, 2, 64, 4, 0, 0, 0, 0,
0, 4, 64, 2, 3, 0, 0, 0, 0, 8, 64, 4, 0, 0, 0, 0,
0, 16, 64, 8, 0, 0, 0, 0, 0, 16, 64, 8, 0, 0, 0, 0,
0, 4, 64, 16, 0, 0, 0, 0, 0, 255, 64, 255, 252, 251, 0, 0,
0, 4, 64, 255, 252, 251, 32, 0, 0, 100, 24, 100, 0, 0, 0, 0,
0, 249, 250, 255, 100, 0, 0, 0, 0, 8, 64, 253, 4, 16, 0, 0,
0, 8, 64, 254, 4, 0, 0, 0, 0, 16, 64, 253, 0, 0, 0, 0,
0, 254, 64, 16, 0, 0, 0, 0, 0, 32, 64, 255, 0, 0, 0, 250,
};
static const uint8 kSpriteInit_Flags2[243] = {
1, 2, 1, 0x82, 0x81, 0x84, 0x84, 0x84, 2, 0xf, 2, 1, 0x20, 3, 4, 0x84,
1, 5, 4, 1, 0x80, 4, 0xa2, 0x83, 4, 2, 0x82, 0x62, 0x82, 0x80, 0x80, 0x85,
1, 0xa5, 3, 4, 4, 0x83, 2, 1, 0x82, 0xa2, 0xa2, 0xa3, 0xaa, 0xa3, 0xa4, 0x82,
0x82, 0x83, 0x82, 0x80, 0x82, 0x82, 0xa5, 0x80, 0xa4, 0x82, 0x81, 0x82, 0x82, 0x82, 0x81, 6,
8, 8, 8, 8, 6, 8, 8, 8, 6, 7, 7, 2, 2, 0x22, 1, 1,
0x20, 0x82, 7, 0x85, 0xf, 0x21, 5, 0x83, 2, 1, 1, 1, 1, 7, 7, 7,
7, 0, 0x85, 0x83, 3, 0xa4, 0, 0, 0, 0, 9, 4, 0xa0, 0, 1, 0,
0, 3, 0x8b, 0x86, 0xc2, 0x82, 0x81, 4, 0x82, 0x21, 6, 3, 1, 3, 3, 3,
0, 0, 4, 5, 5, 3, 1, 2, 0, 0, 0, 2, 7, 0, 1, 1,
0x87, 6, 0, 0x83, 2, 0x22, 0x22, 0x22, 0x22, 4, 3, 5, 1, 1, 4, 1,
2, 8, 8, 0x80, 0x21, 3, 3, 3, 2, 2, 8, 0x8f, 0xa1, 0x81, 0x80, 0x80,
0x80, 0x80, 0xa1, 0x80, 0x81, 0x81, 0x86, 0x81, 0x82, 0x82, 0x80, 0x80, 0x83, 6, 0, 0,
5, 4, 6, 5, 2, 0, 0, 5, 4, 4, 7, 0xb, 0xc, 0xc, 6, 6,
3, 0xa4, 4, 0x82, 0x81, 0x83, 0x10, 0x10, 0x81, 0x82, 0x82, 0x82, 0x83, 0x83, 0x83, 0x81,
0x82, 0x83, 0x83, 0x81, 0x82, 0x81, 0x82, 0xa0, 0xa1, 0xa3, 0xa1, 0xa1, 0xa1, 0x83, 0x85, 0x83,
0x83, 0x83, 0x83,
};
static const uint8 kSpriteInit_Health[243] = {
12, 6, 255, 3, 3, 3, 3, 3, 2, 12, 4, 255, 0, 3, 12, 2,
0, 20, 4, 4, 0, 255, 0, 2, 3, 8, 0, 0, 0, 0, 0, 0,
8, 3, 8, 2, 2, 0, 3, 255, 0, 3, 3, 3, 3, 3, 3, 3,
3, 0, 3, 0, 3, 3, 3, 0, 3, 0, 0, 0, 0, 3, 2, 255,
2, 6, 4, 8, 6, 8, 6, 4, 8, 8, 8, 4, 4, 2, 2, 2,
255, 8, 255, 48, 16, 8, 8, 255, 2, 0, 0, 255, 255, 255, 255, 255,
255, 255, 255, 255, 4, 4, 255, 255, 255, 255, 16, 3, 0, 2, 4, 1,
255, 4, 255, 0, 0, 0, 0, 255, 0, 0, 96, 255, 24, 255, 255, 255,
3, 4, 255, 16, 8, 8, 0, 255, 32, 32, 32, 32, 32, 8, 8, 4,
8, 64, 48, 255, 2, 255, 255, 255, 255, 16, 4, 2, 4, 4, 8, 8,
8, 16, 64, 64, 8, 4, 8, 4, 4, 8, 12, 16, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 48, 255,
255, 255, 255, 8, 0, 0, 0, 32, 0, 8, 5, 40, 40, 40, 90, 16,
24, 64, 0, 4, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,
};
const uint8 kSpriteInit_BumpDamage[243] = {
0x83, 0x83, 0x81, 2, 2, 2, 2, 2, 1, 0x13, 1, 1, 1, 1, 8, 1,
1, 8, 5, 3, 0x40, 4, 0, 2, 3, 0x85, 0, 1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x80, 0x80, 0x80, 0, 0, 0x80, 0x80, 0x90,
0x80, 0x91, 0x91, 0x91, 0x97, 0x91, 0x95, 0x95, 0x93, 0x97, 0x14, 0x91, 0x92, 0x81, 0x82, 0x82,
0x80, 0x85, 0x80, 0x80, 0x80, 4, 4, 0x80, 0x91, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0, 0x80, 0x80, 0x82, 0x8a, 0x80, 0x80, 0x80, 0x80, 0x92, 0x91, 0x80, 0x82, 0x81, 0x81,
0x80, 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x97, 0x80, 0x80, 0x80,
0x80, 0xc2, 0x80, 0x15, 0x15, 0x17, 6, 0, 0x80, 0, 0xc0, 0x13, 0x40, 0, 2, 6,
0x10, 0x14, 0, 0, 0x40, 0, 0, 0, 0, 0x13, 0x46, 0x11, 0x80, 0x80, 0, 0,
0, 0x10, 0, 0, 0, 0x16, 0x16, 0x16, 0x81, 0x87, 0x82, 0, 0x80, 0x80, 0, 0,
0, 0, 0x80, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0x80, 0, 0, 0, 0x17, 0, 0x12, 0, 0, 0, 0, 0, 0x10,
0x17, 0, 0x40, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0x80, 0, 0, 0,
0, 0, 0,
};
static const uint8 kSpriteInit_DeflBits[243] = {
0, 0, 0x44, 0x20, 0x20, 0x20, 0x20, 0x20, 0, 0x81, 0, 0, 0x48, 0, 0, 0,
0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0x48, 0x24, 0x80, 0, 0,
0, 0x20, 0, 0, 0, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x80,
0x80, 0, 0, 0, 0, 0, 0, 0x80, 0, 0x80, 0, 2, 0, 0, 0, 4,
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0x84, 0, 0x81, 5, 1, 0x40, 8, 0xa0, 0, 0, 0, 0, 0, 0x84, 0x84, 0x84,
0x84, 8, 0x80, 0x80, 0x80, 0, 0x80, 0x80, 0x80, 0x80, 0, 8, 0x80, 0, 0, 0,
0x40, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 4, 0, 0,
0, 0, 0x80, 4, 4, 0, 0, 0x48, 0, 0, 4, 0, 1, 1, 0, 0,
0x80, 0, 0, 0, 0x40, 8, 8, 8, 8, 0, 0, 0, 0x80, 0x80, 0, 0,
0, 4, 1, 5, 0, 0, 0, 0, 0, 0, 0, 4, 2, 0, 0x80, 0x80,
0x80, 0x80, 0x82, 0x80, 0, 0, 0x80, 0, 0, 0x80, 0x80, 0, 0, 1, 1, 0x40,
0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 4, 5, 5, 5, 0x80, 0x80,
0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0x82, 0x82, 8, 0x80, 0x20, 0x80,
0x80, 0x80, 0x20,
};
static const int8 kPlayerDamages[30] = {
2, 1, 1, 4, 4, 4, 0, 0, 0, 8, 4, 2, 8, 8, 8, 16,
8, 4, 32, 16, 8, 32, 24, 16, 24, 16, 8, 64, 48, 24,
};
static const uint8 kPlayerActionBoxRun_YHi[4] = {0xff, 0, 0, 0};
static const uint8 kPlayerActionBoxRun_YLo[4] = {(uint8)-8, 16, 8, 8};
static const uint8 kPlayerActionBoxRun_XHi[4] = {0, 0, 0xff, 0};
static const uint8 kPlayerActionBoxRun_XLo[4] = {0, 0, (uint8)-8, 8};
static const int8 kPlayer_SetupActionHitBox_Tab0[65] = {
0, 2, 0, 0, -8, 0, 2, 0, 2, 2, 1, 1, 0, 0, 0, 0,
0, 2, 4, 4, 0, 0, -4, -4, -6, 2, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, 2, 2, 4, 4, 2, 2, 2, 2, 0, 0, 0, 0,
0, 0, 0, 0, -4, -4, -10, 0, 2, 2, 0, 0, 0, 0, 0, 0,
0,
};
static const int8 kPlayer_SetupActionHitBox_Tab1[65] = {
15, 4, 8, 8, 8, 8, 12, 8, 4, 4, 6, 6, 0, 0, 0, 0,
0, 4, 16, 12, 8, 8, 12, 11, 12, 4, 6, 6, 0, 0, 0, 0,
0, 8, 8, 8, 10, 14, 15, 4, 4, 4, 6, 6, 0, 0, 0, 0,
0, 8, 8, 8, 10, 14, 15, 4, 4, 4, 6, 6, 0, 0, 0, 0,
0,
};
static const int8 kPlayer_SetupActionHitBox_Tab2[65] = {
0, 2, 0, 2, 4, 4, 4, 7, 2, 2, 1, 1, 0, 0, 0, 0,
0, 2, 0, 2, -4, -3, -8, 0, 0, 2, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, -2, 0, -4, 1, 2, 2, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, -2, 0, -4, 1, 2, 2, 1, 1, 0, 0, 0, 0,
0,
};
static const int8 kPlayer_SetupActionHitBox_Tab3[65] = {
15, 4, 8, 2, 12, 8, 12, 8, 4, 4, 6, 6, 0, 0, 0, 0,
0, 4, 8, 4, 12, 12, 12, 4, 8, 4, 6, 4, 0, 0, 0, 0,
0, 8, 8, 8, 8, 8, 12, 4, 4, 4, 6, 6, 0, 0, 0, 0,
0, 8, 8, 8, 8, 8, 12, 4, 4, 4, 6, 6, 0, 0, 0, 0,
0,
};
static const int8 kPlayer_SetupActionHitBox_Tab4[13] = {
1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1
};
static const uint8 kSprite_PrepAndDrawSingleLarge_Tab1[236] = {
200, 0, 107, 0, 0, 0, 0, 0, 0, 203, 0, 8, 10, 11, 0, 0,
13, 0, 0, 86, 0, 0, 15, 17, 0, 19, 0, 0, 0, 0, 20, 0,
21, 27, 0, 42, 42, 248, 0, 182, 0, 0, 0, 170, 0, 0, 28, 0,
0, 0, 0, 0, 0, 0, 0, 243, 243, 0, 187, 39, 0, 0, 66, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 63, 0, 0, 0, 64, 64,
68, 0, 0, 0, 0, 71, 70, 0, 0, 72, 74, 101, 101, 0, 0, 0,
0, 0, 143, 0, 0, 76, 78, 78, 78, 78, 0, 48, 36, 50, 56, 60,
129, 0, 82, 0, 0, 0, 0, 0, 0, 92, 0, 98, 94, 0, 0, 0,
101, 102, 0, 0, 0, 0, 110, 14, 0, 59, 66, 0, 0, 117, 120, 123,
0, 0, 207, 0, 132, 141, 141, 141, 141, 0, 148, 117, 160, 0, 0, 162,
166, 0, 0, 0, 177, 0, 181, 0, 189, 0, 0, 0, 105, 0, 0, 0,
0, 0, 92, 0, 214, 230, 0, 0, 0, 219, 218, 233, 0, 0, 190, 192,
106, 0, 249, 215, 0, 0, 0, 216, 0, 0, 222, 227, 0, 0, 0, 235,
0, 0, 0, 0, 0, 0, 244, 244, 29, 31, 31, 31, 32, 32, 32, 33,
34, 35, 35, 37, 40, 106, 246, 41, 0, 0, 205, 206,
};
static const uint8 kSprite_PrepAndDrawSingleLarge_Tab2[251] = {
0xa0, 0xa2, 0xa0, 0xa2, 0x80, 0x82, 0x80, 0x82, 0xea, 0xec, 0x84, 0x4e, 0x61, 0xbd, 0x8c, 0x20,
0x22, 0xc0, 0xc2, 0xe6, 0xe4, 0x82, 0xaa, 0x84, 0xac, 0x80, 0xa0, 0xca, 0xaf, 0x29, 0x39, 0xb,
0x6e, 0x60, 0x62, 0x63, 0x4c, 0xea, 0xec, 0x24, 0x6b, 0x24, 0x22, 0x24, 0x26, 0x20, 0x30, 0x21,
0x2a, 0x24, 0x86, 0x88, 0x8a, 0x8c, 0x8e, 0xa2, 0xa4, 0xa6, 0xa8, 0xaa, 0x84, 0x80, 0x82, 0x6e,
0x40, 0x42, 0xe6, 0xe8, 0x80, 0x82, 0xc8, 0x8d, 0xe3, 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, 2, 4, 4, 4, 4, 4, 4, 4, 4,
2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 2, 4, 4, 2, 4, 4,
4, 4, 2, 4, 4, 2, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2,
4, 4, 2, 2, 2, 4, 4, 2, 4, 4, 2, 2, 2, 4, 4, 2,
4, 4, 2, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4,
2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 2, 4, 4, 2, 4, 4,
4, 4, 2, 4, 4, 2, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2,
4, 4, 2, 2, 2, 4, 4, 2, 4, 4, 2, 2, 2, 4, 4, 2,
4, 4, 2, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4,
2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 2, 4, 4, 2, 4, 4,
4, 4, 2, 4, 4, 2, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2,
4, 4, 2, 2, 2, 4, 4, 2, 4, 4, 2, 2, 2, 4, 4, 2,
};
static const uint16 kOam_ResetRegionBases[6] = {0x30, 0x1d0, 0, 0x30, 0x120, 0x140};
static const uint8 kGarnish_OamMemSize[23] = {
0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
8, 4, 4, 4, 8, 16,
};
static HandlerFuncK *const kGarnish_Funcs[22] = {
&Garnish01_FireSnakeTail,
&Garnish02_MothulaBeamTrail,
&Garnish03_FallingTile,
&Garnish04_LaserTrail,
&Garnish_SimpleSparkle,
&Garnish06_ZoroTrail,
&Garnish07_BabasuFlash,
&Garnish08_KholdstareTrail,
&Garnish09_LightningTrail,
&Garnish0A_CannonSmoke,
&Garnish_WaterTrail,
&Garnish0C_TrinexxIceBreath,
NULL,
&Garnish0E_TrinexxFireBreath,
&Garnish0F_BlindLaserTrail,
&Garnish10_GanonBatFlame,
&Garnish11_WitheringGanonBatFlame,
&Garnish12_Sparkle,
&Garnish13_PyramidDebris,
&Garnish14_KakKidDashDust,
&Garnish15_ArrghusSplash,
&Garnish16_ThrownItemDebris,
};
static const uint8 kSpriteFall_Tab1[32] = {
13, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 3, 3, 3, 3,
3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
};
static const uint8 kSpriteFall_Tab2[32] = {
5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, 3,
3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
};
static const uint8 kSpriteFall_Tab3[16] = {0xff, 0x3f, 0x1f, 0xf, 0xf, 7, 3, 1, 0xff, 0x3f, 0x1f, 0xf, 7, 3, 1, 0};
static const int8 kSpriteFall_Tab4[4] = {0, 4, 8, 0};
static const DrawMultipleData kSpriteDrawFall0Data[12] = {
{0, 0, 0x0146, 2},
{0, 0, 0x0148, 2},
{0, 0, 0x014a, 2},
{4, 4, 0x014c, 0},
{4, 4, 0x00b7, 0},
{4, 4, 0x0080, 0},
{0, 0, 0x016c, 2},
{0, 0, 0x016e, 2},
{0, 0, 0x014e, 2},
{4, 4, 0x015c, 0},
{4, 4, 0x00b7, 0},
{4, 4, 0x0080, 0},
};
static const int8 kSpriteDrawFall1_X[56] = {
-4, 4, -4, 12, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0,
-4, 12, -4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0,
-4, 12, -4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0,
4, 0, 0, 0, 4, 0, 0, 0,
};
static const int8 kSpriteDrawFall1_Y[56] = {
-4, -4, 4, 12, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0,
-4, -4, 12, 4, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0,
-4, -4, 12, 4, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0,
4, 0, 0, 0, 4, 0, 0, 0,
};
static const uint8 kSpriteDrawFall1_Char[56] = {
0xae, 0xa8, 0xa6, 0xaf, 0xaa, 0, 0, 0, 0xac, 0, 0, 0, 0xbe, 0, 0, 0,
0xa8, 0xae, 0xaf, 0xa6, 0xaa, 0, 0, 0, 0xac, 0, 0, 0, 0xbe, 0, 0, 0,
0xa6, 0xaf, 0xae, 0xa8, 0xaa, 0, 0, 0, 0xac, 0, 0, 0, 0xbe, 0, 0, 0,
0xb6, 0, 0, 0, 0x80, 0, 0, 0,
};
static const uint8 kSpriteDrawFall1_Flags[56] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0x40, 0x40, 0x40, 0x40, 0x40, 0, 0, 0, 0x40, 0, 0, 0, 0x40, 0, 0, 0,
0x80, 0x80, 0x80, 0x80, 0x80, 0, 0, 0, 0x80, 0, 0, 0, 0x80, 0, 0, 0,
1, 0, 0, 0, 1, 0, 0, 0,
};
static const uint8 kSpriteDrawFall1_Ext[56] = {
0, 2, 2, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
2, 0, 0, 2, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
2, 0, 0, 2, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
static const int8 kSpriteDistress_X[4] = {-3, 2, 7, 11};
static const int8 kSpriteDistress_Y[4] = {-5, -7, -7, -5};
static const uint8 kPikitDropItems[4] = {0xdc, 0xe1, 0xd9, 0xe6};
static const uint8 kPrizeMasks[7] = { 1, 1, 1, 0, 1, 1, 1 };
static const uint8 kPrizeItems[56] = {
0xd8, 0xd8, 0xd8, 0xd8, 0xd9, 0xd8, 0xd8, 0xd9, 0xda, 0xd9, 0xda, 0xdb, 0xda, 0xd9, 0xda, 0xda,
0xe0, 0xdf, 0xdf, 0xda, 0xe0, 0xdf, 0xd8, 0xdf, 0xdc, 0xdc, 0xdc, 0xdd, 0xdc, 0xdc, 0xde, 0xdc,
0xe1, 0xd8, 0xe1, 0xe2, 0xe1, 0xd8, 0xe1, 0xe2, 0xdf, 0xd9, 0xd8, 0xe1, 0xdf, 0xdc, 0xd9, 0xd8,
0xd8, 0xe3, 0xe0, 0xdb, 0xde, 0xd8, 0xdb, 0xe2,
};
static const uint8 kPrizeZ[15] = {0, 0x24, 0x24, 0x24, 0x20, 0x20, 0x20, 0x24, 0x24, 0x24, 0x24, 0, 0x24, 0x20, 0x20};
static const int8 kPerishOverlay_X[32] = {
0, 0, 0, 8, 0, 8, 0, 8, 8, 8, 0, 8, 0, 8, 0, 8,
0, 8, 0, 8, 0, 8, 0, 8, -3, 11, -3, 11, -6, 14, -6, 14,
};
static const int8 kPerishOverlay_Y[32] = {
0, 0, 8, 8, 0, 0, 8, 8, 0, 0, 8, 8, 0, 0, 8, 8,
0, 0, 8, 8, 0, 0, 8, 8, -3, -3, 11, 11, -6, -6, 14, 14,
};
static const uint8 kPerishOverlay_Char[32] = {
0, 0xb9, 0, 0, 0xb4, 0xb5, 0xb5, 0xb4, 0xb9, 0, 0, 0, 0xb5, 0xb4, 0xb4, 0xb5,
0xa8, 0xa8, 0xb8, 0xb8, 0xa8, 0xa8, 0xb8, 0xb8, 0xa9, 0xa9, 0xa9, 0xa9, 0x9b, 0x9b, 0x9b, 0x9b,
};
static const uint8 kPerishOverlay_Flags[32] = {
4, 4, 4, 4, 4, 4, 0xc4, 0xc4, 0x44, 4, 4, 4, 0x44, 0x44, 0x84, 0x84,
4, 0x44, 4, 0x44, 4, 0x44, 4, 0x44, 0x44, 4, 0xc4, 0x84, 4, 0x44, 0x84, 0xc4,
};
static HandlerFuncK *const kSprite_ExecuteSingle[12] = {
&Sprite_inactiveSprite,
&SpriteModule_Fall1,
&SpriteModule_Poof,
&SpriteModule_Drown,
&SpriteModule_Explode,
&SpriteModule_Fall2,
&SpriteModule_Die,
&SpriteModule_Burn,
&SpriteModule_Initialize,
&SpriteActive_Main,
&SpriteModule_Carried,
&SpriteModule_Stunned,
};
// it's not my job to tell you what to think, my job is to think about what you tell me'
#define R0 WORD(g_ram[0])
#define R2 WORD(g_ram[2])
static const uint8 kSpawnSecretItems[22] = {
0xd9, 0x3e, 0x79, 0xd9, 0xdc, 0xd8, 0xda, 0xe4, 0xe1, 0xdc, 0xd8, 0xdf, 0xe0, 0xb, 0x42, 0xd3,
0x41, 0xd4, 0xd9, 0xe3, 0xd8, 0,
};
static const uint8 kSpawnSecretItem_SpawnFlag[22] = {
0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0,
};
static const uint8 kSpawnSecretItem_XLo[22] = {
4, 0, 4, 4, 0, 4, 4, 4, 4, 0, 4, 4, 4, 0, 0, 0,
0, 0, 4, 0, 4, 4,
};
static const uint8 kSpawnSecretItem_IgnoreProj[22] = {
1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
0, 0, 1, 1, 1, 1,
};
static const uint8 kSpawnSecretItem_ZVel[22] = {
16, 0, 0, 16, 0, 0, 16, 16, 16, 16, 0, 16, 10, 16, 0, 0,
0, 0, 16, 0, 0, 0,
};
static const uint8 kSprite_ReturnIfLifted_Dirs[4] = {4, 6, 0, 2};
static const uint8 kAbsorbable_Tab1[15] = {0, 1, 1, 1, 2, 2, 2, 0, 1, 1, 2, 2, 1, 2, 2};
static const uint8 kAbsorbable_Tab2[19] = {0, 0, 0, 0, 1, 2, 3, 0, 0, 4, 5, 0, 0, 0, 0, 2, 4, 6, 2};
static const int16 kNumberedAbsorbable_X[18] = { 0, 0, 8, 0, 0, 8, 0, 0, 8, 0, 0, 2, 0, 0, 2, 0, 0, 0, };
static const int16 kNumberedAbsorbable_Y[18] = { 0, 0, 8, 0, 0, 8, 0, 0, 8, 0, 8, 8, 0, 8, 8, 0, 8, 8, };
static const uint8 kNumberedAbsorbable_Char[18] = { 0x6e, 0x6e, 0x68, 0x6e, 0x6e, 0x78, 0x6e, 0x6e, 0x79, 0x63, 0x73, 0x69, 0x63, 0x73, 0x6a, 0x63, 0x73, 0x73, };
static const uint8 kNumberedAbsorbable_Ext[18] = { 2, 2, 0, 2, 2, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
static const uint8 kRupeesAbsorption[3] = {1, 5, 20};
const uint8 kAbsorptionSfx[15] = {0xb, 0xa, 0xa, 0xa, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0x2f, 0x2f, 0xb};
static const uint8 kBombsAbsorption[3] = {1, 4, 8};
const uint8 kAbsorbBigKey[2] = {0x40, 0x20};
static int AllocOverlord();
static int Overworld_AllocSprite(uint8 type);
uint16 Sprite_GetX(int k) {
return sprite_x_lo[k] | sprite_x_hi[k] << 8;
}
uint16 Sprite_GetY(int k) {
return sprite_y_lo[k] | sprite_y_hi[k] << 8;
}
void Sprite_SetX(int k, uint16 x) {
sprite_x_lo[k] = x;
sprite_x_hi[k] = x >> 8;
}
void Sprite_SetY(int k, uint16 y) {
sprite_y_lo[k] = y;
sprite_y_hi[k] = y >> 8;
}
void Sprite_ApproachTargetSpeed(int k, uint8 x, uint8 y) {
if (sprite_x_vel[k] - x)
sprite_x_vel[k] += sign8(sprite_x_vel[k] - x) ? 1 : -1;
if (sprite_y_vel[k] - y)
sprite_y_vel[k] += sign8(sprite_y_vel[k] - y) ? 1 : -1;
}
void SpriteAddXY(int k, int xv, int yv) {
Sprite_SetX(k, Sprite_GetX(k) + xv);
Sprite_SetY(k, Sprite_GetY(k) + yv);
}
void Sprite_MoveXYZ(int k) {
Sprite_MoveZ(k);
Sprite_MoveX(k);
Sprite_MoveY(k);
}
void Sprite_Invert_XY_Speeds(int k) {
sprite_x_vel[k] = -sprite_x_vel[k];
sprite_y_vel[k] = -sprite_y_vel[k];
}
int Sprite_SpawnSimpleSparkleGarnishEx(int k, uint16 x, uint16 y, int limit) {
int j = GarnishAllocLimit(limit);
if (j >= 0) {
garnish_type[j] = 5;
garnish_active = 5;
Garnish_SetX(j, Sprite_GetX(k) + x);
Garnish_SetY(j, Sprite_GetY(k) + y - sprite_z[k] + 16);
garnish_countdown[j] = 31;
garnish_sprite[j] = k;
garnish_floor[j] = sprite_floor[k];
}
g_ram[15] = j;
return j;
}
static int AllocOverlord() {
int i = 7;
while (i >= 0 && overlord_type[i] != 0)
i--;
return i;
}
static int Overworld_AllocSprite(uint8 type) {
int i = (type == 0x58) ? 4 :
(type == 0xd0) ? 5 :
(type == 0xeb || type == 0x53 || type == 0xf3) ? 14 : 13;
for (; i >= 0; i--) {
if (sprite_state[i] == 0 || sprite_type[i] == 0x41 && sprite_C[i] != 0)
break;
}
return i;
}
uint16 Garnish_GetX(int k) {
return garnish_x_lo[k] | garnish_x_hi[k] << 8;
}
uint16 Garnish_GetY(int k) {
return garnish_y_lo[k] | garnish_y_hi[k] << 8;
}
void Garnish_SparkleCommon(int k, uint8 shift) {
static const uint8 kGarnishSparkle_Char[4] = {0x83, 0xc7, 0x80, 0xb7};
uint8 t = garnish_countdown[k] >> shift;
Point16U pt;
if (Garnish_ReturnIfPrepFails(k, &pt))
return;
OamEnt *oam = GetOamCurPtr();
oam->x = pt.x;
oam->y = pt.y;
oam->charnum = kGarnishSparkle_Char[t];
int j = garnish_sprite[k];
oam->flags = (sprite_oam_flags[j] | sprite_obj_prio[j]) & 0xf0 | 4;
bytewise_extended_oam[oam - oam_buf] = 0;
}
void Garnish_DustCommon(int k, uint8 shift) {
static const uint8 kRunningManDust_Char[3] = {0xdf, 0xcf, 0xa9};
tmp_counter = garnish_countdown[k] >> shift;
Point16U pt;
if (Garnish_ReturnIfPrepFails(k, &pt))
return;
OamEnt *oam = GetOamCurPtr();
oam->x = pt.x;
oam->y = pt.y;
oam->charnum = kRunningManDust_Char[tmp_counter];
oam->flags = 0x24;
bytewise_extended_oam[oam - oam_buf] = 0;
}
void SpriteModule_Explode(int k) {
static const DrawMultipleData kSpriteExplode_Dmd[32] = {
{ 0, 0, 0x0060, 2},
{ 0, 0, 0x0060, 2},
{ 0, 0, 0x0060, 2},
{ 0, 0, 0x0060, 2},
{-5, -5, 0x0062, 2},
{ 5, -5, 0x4062, 2},
{-5, 5, 0x8062, 2},
{ 5, 5, 0xc062, 2},
{-8, -8, 0x0062, 2},
{ 8, -8, 0x4062, 2},
{-8, 8, 0x8062, 2},
{ 8, 8, 0xc062, 2},
{-8, -8, 0x0064, 2},
{ 8, -8, 0x4064, 2},
{-8, 8, 0x8064, 2},
{ 8, 8, 0xc064, 2},
{-8, -8, 0x0066, 2},
{ 8, -8, 0x4066, 2},
{-8, 8, 0x8066, 2},
{ 8, 8, 0xc066, 2},
{-8, -8, 0x0068, 2},
{ 8, -8, 0x0068, 2},
{-8, 8, 0x0068, 2},
{ 8, 8, 0x0068, 2},
{-8, -8, 0x006a, 2},
{ 8, -8, 0x406a, 2},
{-8, 8, 0x806a, 2},
{ 8, 8, 0xc06a, 2},
{-8, -8, 0x004e, 2},
{ 8, -8, 0x404e, 2},
{-8, 8, 0x804e, 2},
{ 8, 8, 0xc04e, 2},
};
if (sprite_A[k]) {
if (!sprite_delay_main[k]) {
sprite_state[k] = 0;
for (int j = 15; j >= 0; j--) {
if (sprite_state[j] == 4)
return;
}
load_chr_halfslot_even_odd = 1;
if (!Sprite_CheckIfScreenIsClear())
flag_block_link_menu = 0;
} else {
Sprite_DrawMultiple(k, &kSpriteExplode_Dmd[((sprite_delay_main[k] >> 2) ^ 7) * 4], 4, NULL);
}
return;
}
sprite_floor[k] = 2;
if (sprite_delay_main[k] == 32) {
sprite_state[k] = 0;
flag_is_link_immobilized = 0;
if (player_near_pit_state != 2 && Sprite_CheckIfScreenIsClear()) {
if (sprite_type[k] >= 0xd6) {
music_control = 0x13;
} else if (sprite_type[k] == 0x7a) {
PrepareDungeonExitFromBossFight();
} else {
SpriteExplode_SpawnEA(k);
return;
}
}
}
if (sprite_delay_main[k] >= 64 && (sprite_delay_main[k] >= 0x70 || !(sprite_delay_main[k] & 1)))
SpriteActive_Main(k);
uint8 type = sprite_type[k];
if (sprite_delay_main[k] >= 0xc0)
return;
if ((sprite_delay_main[k] & 3) == 0)
SpriteSfx_QueueSfx2WithPan(k, 0xc);
if (sprite_delay_main[k] & ((type == 0x92) ? 3 : 7))
return;
SpriteSpawnInfo info;
int j = Sprite_SpawnDynamically(k, 0x1c, &info);
if (j >= 0) {
static const int8 kSpriteExplode_RandomXY[16] = {0, 4, 8, 12, -4, -8, -12, 0, 0, 8, 16, 24, -24, -16, -8, 0};
load_chr_halfslot_even_odd = 11;
sprite_state[j] = 4;
sprite_flags2[j] = 3;
sprite_oam_flags[j] = 0xc;
int xoff = kSpriteExplode_RandomXY[(GetRandomNumber() & 7) | ((type == 0x92) ? 8 : 0)];
int yoff = kSpriteExplode_RandomXY[(GetRandomNumber() & 7) | ((type == 0x92) ? 8 : 0)];
Sprite_SetX(j, info.r0_x + xoff);
Sprite_SetY(j, info.r2_y + yoff - info.r4_z);
sprite_delay_main[j] = 31;
sprite_A[j] = 31;
}
// endif_1
}
void SpriteDeath_MainEx(int k, bool second_entry) {
if (!second_entry) {
uint8 type = sprite_type[k];
if (type == 0xec) {
ThrowableScenery_ScatterIntoDebris(k);
return;
}
if (type == 0x53 || type == 0x54 || type == 0x92 || type == 0x4a && sprite_C[k] >= 2) {
SpriteActive_Main(k);
return;
}
if (sprite_delay_main[k] == 0) {
Sprite_DoTheDeath(k);
return;
}
}
if (sign8(sprite_flags3[k])) {
SpriteActive_Main(k);
return;
}
if (!((frame_counter & 3) | submodule_index | flag_unk1))
sprite_delay_main[k]++;
SpriteDeath_DrawPoof(k);
if (sprite_type[k] != 0x40 && sprite_delay_main[k] < 10)
return;
oam_cur_ptr += 16;
oam_ext_cur_ptr += 4;
uint8 bak = sprite_flags2[k];
sprite_flags2[k] -= 4;
SpriteActive_Main(k);
sprite_flags2[k] = bak;
}
void SpriteModule_Burn(int k) {
static const uint8 kFlame_Gfx[32] = {
5, 4, 3, 1, 2, 0, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0,
1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0,
};
sprite_hit_timer[k] = 0;
int j = sprite_delay_main[k] - 1;
if (j == 0) {
Sprite_DoTheDeath(k);
return;
}
uint8 bak = sprite_graphics[k];
uint8 bak1 = sprite_oam_flags[k];
sprite_graphics[k] = kFlame_Gfx[j >> 3];
sprite_oam_flags[k] = 3;
Flame_Draw(k);
sprite_oam_flags[k] = bak1;
sprite_graphics[k] = bak;
oam_cur_ptr += 8;
oam_ext_cur_ptr += 2;
if (sprite_delay_main[k] >= 0x10) {
uint8 bak = sprite_flags2[k];
sprite_flags2[k] -= 2;
SpriteActive_Main(k);
sprite_flags2[k] = bak;
}
}
void Sprite_HitTimer31(int k) {
if (sprite_type[k] != 0x7a || is_in_dark_world)
return;
if (sprite_health[k] <= sprite_give_damage[k]) {
dialogue_message_index = 0x140;
Sprite_ShowMessageMinimal();
}
}
void SpriteStunned_MainEx(int k, bool second_entry) {
if (second_entry)
goto ThrownSprite_TileAndSpriteInteraction;
Sprite_DrawRippleIfInWater(k);
SpriteStunned_Main_Func1(k);
if (Sprite_ReturnIfPaused(k))
return;
if (sprite_F[k]) {
if (sign8(sprite_F[k]))
sprite_F[k] = 0;
sprite_x_vel[k] = sprite_y_vel[k] = 0;
}
if (sprite_delay_main[k] < 0x20)
Sprite_CheckDamageFromLink(k);
if (Sprite_ReturnIfRecoiling(k))
return;
Sprite_MoveXY(k);
if (!sprite_E[k]) {
Sprite_CheckTileCollision(k);
if (!sprite_state[k])
return;
ThrownSprite_TileAndSpriteInteraction:
if (sprite_wallcoll[k] & 0xf) {
Sprite_ApplyRicochet(k);
if (sprite_state[k] == 11)
SpriteSfx_QueueSfx2WithPan(k, 5);
}
}
Sprite_CheckTileProperty(k, 0x68);
if (kSpriteInit_Flags3[sprite_type[k]] & 0x10) {
sprite_flags3[k] |= 0x10;
if (sprite_tiletype == 32)
sprite_flags3[k] &= ~0x10;
}
Sprite_MoveZ(k);
sprite_z_vel[k] -= 2;
uint8 z = sprite_z[k] - 1;
if (z >= 0xf0) {
sprite_z[k] = 0;
if (sprite_type[k] == 0xe8 && sign8(sprite_z_vel[k] - 0xe8)) {
sprite_state[k] = 6;
sprite_delay_main[k] = 8;
sprite_flags2[k] = 3;
return;
}
ThrowableScenery_TransmuteIfValid(k);
uint8 a = sprite_tiletype;
if (sprite_tiletype == 32 && !(a = sprite_flags[k] >> 1, sprite_flags[k] & 1)) { // wtf
Sprite_Func8(k);
return;
}
if (a == 9) {
z = sprite_z_vel[k];
sprite_z_vel[k] = 0;
int j;
SpriteSpawnInfo info;
if (sign8(z - 0xf0) && (j = Sprite_SpawnDynamically(k, 0xec, &info)) >= 0) {
Sprite_SetSpawnedCoordinates(j, &info);
Sprite_Func22(j);
}
} else if (a == 8) {
if (sprite_type[k] == 0xd2 || (GetRandomNumber() & 1))
Sprite_SpawnLeapingFish(k);
Sprite_Func22(k);
return;
}
z = sprite_z_vel[k];
if (sign8(z)) {
z = (uint8)(-z) >> 1;
sprite_z_vel[k] = z < 9 ? 0 : z;
}
sprite_x_vel[k] = (int8)sprite_x_vel[k] >> 1;
if (sprite_x_vel[k] == 255)
sprite_x_vel[k] = 0;
sprite_y_vel[k] = (int8)sprite_y_vel[k] >> 1;
if (sprite_y_vel[k] == 255)
sprite_y_vel[k] = 0;
}
if (sprite_state[k] != 11 || sprite_unk5[k] != 0) {
if (Sprite_ReturnIfLifted(k))
return;
if (sprite_type[k] != 0x4a)
ThrownSprite_CheckDamageToSprites(k);
}
}
void Ancilla_SpawnFallingPrize(uint8 item) { // 85a51d
AncillaAdd_FallingPrize(0x29, item, 4);
}
bool Sprite_CheckDamageToAndFromLink(int k) { // 85ab93
Sprite_CheckDamageFromLink(k);
return Sprite_CheckDamageToLink(k);
}
uint8 Sprite_CheckTileCollision(int k) { // 85b88d
Sprite_CheckTileCollision2(k);
return sprite_wallcoll[k];
}
bool Sprite_TrackBodyToHead(int k) { // 85dca2
if (sprite_head_dir[k] != sprite_D[k]) {
if (frame_counter & 0x1f)
return false;
if (!((sprite_head_dir[k] ^ sprite_D[k]) & 2)) {
sprite_D[k] = (((k ^ frame_counter) >> 5 | 2) & 3) ^ (sprite_head_dir[k] & 2);
return false;
}
}
sprite_D[k] = sprite_head_dir[k];
return true;
}
void Sprite_DrawMultiple(int k, const DrawMultipleData *src, int n, PrepOamCoordsRet *info) { // 85df6c
PrepOamCoordsRet info_buf;
if (!info)
info = &info_buf;
if (Sprite_PrepOamCoordOrDoubleRet(k, info))
return;
word_7E0CFE = 0;
uint8 a = sprite_state[k];
if (a == 10)
a = sprite_unk4[k];
if (a == 11)
BYTE(word_7E0CFE) = sprite_unk5[k];
OamEnt *oam = GetOamCurPtr();
do {
uint16 x = src->x + info->x;
uint16 y = src->y + info->y;
oam->x = x;
oam->y = (uint16)(y + 0x10) < 0x100 ? y : 0xf0;
uint16 d = src->char_flags ^ WORD(info->r4);
if (word_7E0CFE >= 1)
d = d & ~0xE00 | 0x400;
WORD(oam->charnum) = d;
bytewise_extended_oam[oam - oam_buf] = (x >> 8 & 1) | src->ext;
} while (src++, oam++, --n);
}
void Sprite_DrawMultiplePlayerDeferred(int k, const DrawMultipleData *src, int n, PrepOamCoordsRet *info) { // 85df75
Oam_AllocateDeferToPlayer(k);
Sprite_DrawMultiple(k, src, n, info);
}
int Sprite_ShowSolicitedMessage(int k, uint16 msg) { // 85e1a7
static const uint8 kShowMessageFacing_Tab0[4] = {4, 6, 0, 2};
dialogue_message_index = msg;
if (!Sprite_CheckDamageToLink_same_layer(k) ||
Sprite_CheckIfLinkIsBusy() ||
!(filtered_joypad_L & 0x80) ||
sprite_delay_aux4[k] || link_auxiliary_state == 2)
return sprite_D[k];
uint8 dir = Sprite_DirectionToFaceLink(k, NULL);
if (link_direction_facing != kShowMessageFacing_Tab0[dir])
return sprite_D[k];
Sprite_ShowMessageUnconditional(dialogue_message_index);
sprite_delay_aux4[k] = 64;
return dir ^ 0x103;
}
int Sprite_ShowMessageOnContact(int k, uint16 msg) { // 85e1f0
dialogue_message_index = msg;
if (!Sprite_CheckDamageToLink_same_layer(k) || link_auxiliary_state == 2)
return sprite_D[k];
Sprite_ShowMessageUnconditional(dialogue_message_index);
return Sprite_DirectionToFaceLink(k, NULL) ^ 0x103;
}
void Sprite_ShowMessageUnconditional(uint16 msg) { // 85e219
dialogue_message_index = msg;
byte_7E0223 = 0;
messaging_module = 0;
submodule_index = 2;
saved_module_for_menu = main_module_index;
main_module_index = 14;
Sprite_NullifyHookshotDrag();
link_speed_setting = 0;
Link_CancelDash();
link_auxiliary_state = 0;
link_incapacitated_timer = 0;
if (link_player_handler_state == kPlayerState_RecoilWall)
link_player_handler_state = kPlayerState_Ground;
}
bool Sprite_TutorialGuard_ShowMessageOnContact(int k, uint16 msg) { // 85fa59
dialogue_message_index = msg;
uint8 bak2 = sprite_flags2[k];
uint8 bak4 = sprite_flags4[k];
sprite_flags2[k] = 0x80;
sprite_flags4[k] = 0x07;
bool rv = Sprite_CheckDamageToLink_same_layer(k);
sprite_flags2[k] = bak2;
sprite_flags4[k] = bak4;
if (!rv)
return rv;
Sprite_NullifyHookshotDrag();
link_is_running = 0;
link_speed_setting = 0;
if (!link_auxiliary_state)
Sprite_ShowMessageMinimal();
return rv;
}
void Sprite_ShowMessageMinimal() { // 85fa8e
byte_7E0223 = 0;
messaging_module = 0;