forked from Stewmath/oracles-disasm
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathages.s
1453 lines (1165 loc) · 27.7 KB
/
ages.s
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
; Main file for Oracle of Ages, US version
.include "include/rominfo.s"
.include "include/emptyfill.s"
.include "include/constants.s"
.include "include/structs.s"
.include "include/wram.s"
.include "include/hram.s"
.include "include/macros.s"
.include "include/script_commands.s"
.include "include/simplescript_commands.s"
.include "include/movementscript_commands.s"
.include "objects/macros.s"
.include "include/gfxDataMacros.s"
.include "build/textDefines.s"
.BANK $00 SLOT 0
.ORG 0
.include "code/bank0.s"
.BANK $01 SLOT 1
.ORG 0
.include "code/bank1.s"
.BANK $02 SLOT 1
.ORG 0
.include "code/bank2.s"
.BANK $03 SLOT 1
.ORG 0
.include "code/bank3.s"
.include "code/ages/cutscenes/endgameCutscenes.s"
.include "code/ages/cutscenes/miscCutscenes.s"
.include "code/ages/garbage/bank03End.s"
.BANK $04 SLOT 1
.ORG 0
.include "code/bank4.s"
; These 2 includes must be in the same bank
.include "build/data/roomPacks.s"
.include "build/data/musicAssignments.s"
.include "build/data/roomLayoutGroupTable.s"
.include "build/data/tilesets.s"
.include "build/data/tilesetAssignments.s"
.include "code/animations.s"
.include "build/data/uniqueGfxHeaders.s"
.include "build/data/uniqueGfxHeaderPointers.s"
.include "build/data/animationGroups.s"
.include "build/data/animationGfxHeaders.s"
.include "build/data/animationData.s"
.include "code/ages/tileSubstitutions.s"
.include "build/data/singleTileChanges.s"
.include "code/ages/roomSpecificTileChanges.s"
;;
; Left-over garbage from Seasons (d8LavaRoomsFillTilesWithLava), can be used
; for other tiles, not just lava
func_04_6ba8:
ld d,>wRoomLayout
ldi a,(hl)
ld c,a
--
ldi a,(hl)
cp $ff
ret z
ld e,a
ld a,c
ld (de),a
jr --
;;
; Fills a square in wRoomLayout using the data at hl.
; Data format:
; - Top-left position (YX)
; - Height
; - Width
; - Tile value
fillRectInRoomLayout:
ldi a,(hl)
ld e,a
ldi a,(hl)
ld b,a
ldi a,(hl)
ld c,a
ldi a,(hl)
ld d,a
ld h,>wRoomLayout
--
ld a,d
ld l,e
push bc
-
ldi (hl),a
dec c
jr nz,-
ld a,e
add $10
ld e,a
pop bc
dec b
jr nz,--
ret
;;
; Like fillRect, but reads a series of bytes for the tile values instead of
; just one.
drawRectInRoomLayout:
ld a,(de)
inc de
ld h,>wRoomLayout
ld l,a
ldh (<hFF8B),a
ld a,(de)
inc de
ld c,a
ld a,(de)
inc de
ldh (<hFF8D),a
---
ldh a,(<hFF8D)
ld b,a
--
ld a,(de)
inc de
ldi (hl),a
dec b
jr nz,--
ldh a,(<hFF8B)
add $10
ldh (<hFF8B),a
ld l,a
dec c
jr nz,---
ret
.include "code/loadTilesToRam.s"
;;
; Called from loadTilesetData in bank 0.
;
loadTilesetData_body:
call getAdjustedRoomGroup
ld hl,roomTilesetsGroupTable
rst_addDoubleIndex
ldi a,(hl)
ld h,(hl)
ld l,a
ld a,(wActiveRoom)
rst_addAToHl
ld a,(hl)
ldh (<hFF8D),a
call @func_6d94
call func_6de7
ret nc
ldh a,(<hFF8D)
@func_6d94:
and $80
ldh (<hFF8B),a
ldh a,(<hFF8D)
and $7f
call multiplyABy8
ld hl,tilesetData
add hl,bc
ldi a,(hl)
ld e,a
ldi a,(hl)
ld (wTilesetFlags),a
bit TILESETFLAG_BIT_DUNGEON,a
jr z,+
ld a,e
and $0f
ld (wDungeonIndex),a
jr ++
+
ld a,$ff
ld (wDungeonIndex),a
++
ld a,e
swap a
and $07
ld (wActiveCollisions),a
ld b,$06
ld de,wTilesetUniqueGfx
@copyloop:
ldi a,(hl)
ld (de),a
inc e
dec b
jr nz,@copyloop
ld e,wTilesetUniqueGfx&$ff
ld a,(de)
ld b,a
ldh a,(<hFF8B)
or b
ld (de),a
ret
;;
; Returns the group to load the room layout from, accounting for bit 0 of the room flag
; which tells it to use the underwater group
;
; @param[out] a,b The corrected group number
getAdjustedRoomGroup:
ld a,(wActiveGroup)
ld b,a
cp $02
ret nc
call getThisRoomFlags
rrca
jr nc,+
set 1,b
+
ld a,b
ret
;;
; Modifies hFF8D to indicate changes to a room (ie. jabu flooding)?
func_6de7:
call @func_04_6e0d
ret c
call @checkJabuFlooded
ret c
ld a,(wActiveGroup)
or a
jr nz,@xor
ld a,(wLoadingRoomPack)
cp $7f
jr nz,@xor
ld a,(wAnimalCompanion)
sub SPECIALOBJECTID_RICKY
jr z,@xor
ld b,a
ldh a,(<hFF8D)
add b
ldh (<hFF8D),a
scf
ret
@xor:
xor a
ret
;;
@func_04_6e0d:
ld a,(wActiveGroup)
or a
ret nz
ld a,(wActiveRoom)
cp $38
jr nz,+
ld a,($c848)
and $01
ret z
ld hl,hFF8D
inc (hl)
inc (hl)
scf
ret
+
xor a
ret
;;
; @param[out] cflag Set if the current room is flooded in jabu-jabu?
@checkJabuFlooded:
ld a,(wDungeonIndex)
cp $07
jr nz,++
ld a,(wTilesetFlags)
and TILESETFLAG_SIDESCROLL
jr nz,++
ld a,$11
ld (wDungeonFirstLayout),a
callab bank1.findActiveRoomInDungeonLayoutWithPointlessBankSwitch
ld a,(wJabuWaterLevel)
and $07
ld hl,@data
rst_addAToHl
ld a,(wDungeonFloor)
ld bc,bitTable
add c
ld c,a
ld a,(bc)
and (hl)
ret z
ldh a,(<hFF8D)
inc a
ldh (<hFF8D),a
scf
ret
++
xor a
ret
@data:
.db $00 $01 $03
;;
; Ages only: For tiles 0x40-0x7f, in the past, replace blue palettes (6) with red palettes (0). This
; is done so that tilesets can reuse attribute data for both the past and present tilesets.
;
; This is annoying so it's disabled in the hack-base branch, which separates all tileset data
; anyway.
;
setPastCliffPalettesToRed:
ld a,(wActiveCollisions)
or a
jr nz,@done
ld a,(wTilesetFlags)
and TILESETFLAG_PAST
jr z,@done
ld a,(wActiveRoom)
cp <ROOM_AGES_138
ret z
; Replace all attributes that have palette "6" with palette "0"
ld a,:w3TileMappingData
ld ($ff00+R_SVBK),a
ld hl,w3TileMappingData + $204
ld d,$06
---
ld b,$04
--
ld a,(hl)
and $07
cp d
jr nz,+
ld a,(hl)
and $f8
ld (hl),a
+
inc hl
dec b
jr nz,--
ld a,$04
rst_addAToHl
ld a,h
cp $d4
jr c,---
@done:
xor a
ld ($ff00+R_SVBK),a
ret
;;
func_04_6e9b:
ld a,$02
ld ($ff00+R_SVBK),a
ld hl,wRoomLayout
ld de,$d000
ld b,$c0
call copyMemory
ld hl,wRoomCollisions
ld de,$d100
ld b,$c0
call copyMemory
ld hl,$df00
ld de,$d200
ld b,$c0
--
ld a,$03
ld ($ff00+R_SVBK),a
ldi a,(hl)
ld c,a
ld a,$02
ld ($ff00+R_SVBK),a
ld a,c
ld (de),a
inc de
dec b
jr nz,--
xor a
ld ($ff00+R_SVBK),a
ret
;;
func_04_6ed1:
ld a,$02
ld ($ff00+R_SVBK),a
ld hl,wRoomLayout
ld de,$d000
ld b,$c0
call copyMemoryReverse
ld hl,wRoomCollisions
ld de,$d100
ld b,$c0
call copyMemoryReverse
ld hl,$df00
ld de,$d200
ld b,$c0
--
ld a,$02
ld ($ff00+R_SVBK),a
ld a,(de)
inc de
ld c,a
ld a,$03
ld ($ff00+R_SVBK),a
ld a,c
ldi (hl),a
dec b
jr nz,--
xor a
ld ($ff00+R_SVBK),a
ret
;;
func_04_6f07:
ld hl,$d800
ld de,$dc00
ld bc,$0200
call @locFunc
ld hl,$dc00
ld de,$de00
ld bc,$0200
@locFunc:
ld a,$03
ld ($ff00+R_SVBK),a
ldi a,(hl)
ldh (<hFF8B),a
ld a,$06
ld ($ff00+R_SVBK),a
ldh a,(<hFF8B)
ld (de),a
inc de
dec bc
ld a,b
or c
jr nz,@locFunc
ret
;;
func_04_6f31:
ld hl,$dc00
ld de,$d800
ld bc,$0200
call @locFunc
ld hl,$de00
ld de,$dc00
ld bc,$0200
@locFunc:
ld a,$06
ld ($ff00+R_SVBK),a
ldi a,(hl)
ldh (<hFF8B),a
ld a,$03
ld ($ff00+R_SVBK),a
ldh a,(<hFF8B)
ld (de),a
inc de
dec bc
ld a,b
or c
jr nz,@locFunc
ret
; .ORGA $6f5b
.include "build/data/warpData.s"
.include "code/ages/garbage/bank04End.s"
.BANK $05 SLOT 1
.ORG 0
m_section_force "Bank_5" NAMESPACE bank5
.include "code/bank5.s"
.include "build/data/tileTypeMappings.s"
.include "build/data/cliffTilesTable.s"
.include "code/ages/garbage/bank05End.s"
.ends
.BANK $06 SLOT 1
.ORG 0
m_section_superfree "Bank_6" NAMESPACE bank6
.include "code/interactableTiles.s"
.include "code/specialObjectAnimationsAndDamage.s"
.include "code/breakableTiles.s"
.include "code/items/parentItemUsage.s"
.include "code/items/shieldParent.s"
.include "code/items/otherSwordsParent.s"
.include "code/items/switchHookParent.s"
.include "code/items/caneOfSomariaParent.s"
.include "code/items/swordParent.s"
.include "code/items/harpFluteParent.s"
.include "code/items/seedsParent.s"
.include "code/items/shovelParent.s"
.include "code/items/boomerangParent.s"
.include "code/items/bombsBraceletParent.s"
.include "code/items/featherParent.s"
.include "code/items/magnetGloveParent.s"
.include "code/items/parentItemCommon.s"
; Following table affects how an item can be used (ie. how it interacts with other items
; being used).
;
; Data format:
; b0: bits 4-7: Priority (higher value = higher precedence)
; Gets written to high nibble of Item.enabled
; bits 0-3: Determines what "parent item" slot to use when the button is pressed.
; 0: Item is unusable.
; 1: Uses w1ParentItem3 or 4.
; 2: Uses w1ParentItem3 or 4, but only one instance of the item may exist
; at once. (boomerang, seed satchel)
; 3: Uses w1ParentItem2. If an object is already there, it gets
; overwritten if this object's priority is high enough.
; (sword, cane, bombs, etc)
; 4: Same as 2, but the item can't be used if w1ParentItem2 is in use (Link
; is holding a sword or something)
; 5: Uses w1ParentItem5 (only if not already in use). (shield, flute, harp)
; 6-7: invalid
; b1: Byte to check input against when the item is first used
;
_itemUsageParameterTable:
.db $00 <wGameKeysPressed ; ITEMID_NONE
.db $05 <wGameKeysPressed ; ITEMID_SHIELD
.db $03 <wGameKeysJustPressed ; ITEMID_PUNCH
.db $23 <wGameKeysJustPressed ; ITEMID_BOMB
.db $03 <wGameKeysJustPressed ; ITEMID_CANE_OF_SOMARIA
.db $63 <wGameKeysJustPressed ; ITEMID_SWORD
.db $02 <wGameKeysJustPressed ; ITEMID_BOOMERANG
.db $00 <wGameKeysJustPressed ; ITEMID_ROD_OF_SEASONS
.db $00 <wGameKeysJustPressed ; ITEMID_MAGNET_GLOVES
.db $00 <wGameKeysJustPressed ; ITEMID_SWITCH_HOOK_HELPER
.db $73 <wGameKeysJustPressed ; ITEMID_SWITCH_HOOK
.db $00 <wGameKeysJustPressed ; ITEMID_SWITCH_HOOK_CHAIN
.db $73 <wGameKeysJustPressed ; ITEMID_BIGGORON_SWORD
.db $02 <wGameKeysJustPressed ; ITEMID_BOMBCHUS
.db $05 <wGameKeysJustPressed ; ITEMID_FLUTE
.db $43 <wGameKeysJustPressed ; ITEMID_SHOOTER
.db $00 <wGameKeysJustPressed ; ITEMID_10
.db $05 <wGameKeysJustPressed ; ITEMID_HARP
.db $00 <wGameKeysJustPressed ; ITEMID_12
.db $00 <wGameKeysJustPressed ; ITEMID_SLINGSHOT
.db $00 <wGameKeysJustPressed ; ITEMID_14
.db $13 <wGameKeysJustPressed ; ITEMID_SHOVEL
.db $13 <wGameKeysPressed ; ITEMID_BRACELET
.db $01 <wGameKeysJustPressed ; ITEMID_FEATHER
.db $00 <wGameKeysJustPressed ; ITEMID_18
.db $02 <wGameKeysJustPressed ; ITEMID_SEED_SATCHEL
.db $00 <wGameKeysJustPressed ; ITEMID_DUST
.db $00 <wGameKeysJustPressed ; ITEMID_1b
.db $00 <wGameKeysJustPressed ; ITEMID_1c
.db $00 <wGameKeysJustPressed ; ITEMID_MINECART_COLLISION
.db $00 <wGameKeysJustPressed ; ITEMID_FOOLS_ORE
.db $00 <wGameKeysJustPressed ; ITEMID_1f
; Data format:
; b0: bit 7: If set, the corresponding bit in wLinkUsingItem1 will be set.
; bits 4-6: Value for bits 0-2 of Item.var3f
; bits 0-3: Determines parent item's relatedObj2?
; A value of $6 refers to w1WeaponItem.
; b1: Animation to set Link to? (see constants/linkAnimations.s)
;
_linkItemAnimationTable:
.db $00 LINK_ANIM_MODE_NONE ; ITEMID_NONE
.db $00 LINK_ANIM_MODE_NONE ; ITEMID_SHIELD
.db $d6 LINK_ANIM_MODE_21 ; ITEMID_PUNCH
.db $30 LINK_ANIM_MODE_LIFT ; ITEMID_BOMB
.db $d6 LINK_ANIM_MODE_22 ; ITEMID_CANE_OF_SOMARIA
.db $e6 LINK_ANIM_MODE_22 ; ITEMID_SWORD
.db $b0 LINK_ANIM_MODE_21 ; ITEMID_BOOMERANG
.db $d6 LINK_ANIM_MODE_22 ; ITEMID_ROD_OF_SEASONS
.db $60 LINK_ANIM_MODE_NONE ; ITEMID_MAGNET_GLOVES
.db $80 LINK_ANIM_MODE_NONE ; ITEMID_SWITCH_HOOK_HELPER
.db $f6 LINK_ANIM_MODE_21 ; ITEMID_SWITCH_HOOK
.db $80 LINK_ANIM_MODE_NONE ; ITEMID_SWITCH_HOOK_CHAIN
.db $f6 LINK_ANIM_MODE_23 ; ITEMID_BIGGORON_SWORD
.db $30 LINK_ANIM_MODE_21 ; ITEMID_BOMBCHUS
.db $70 LINK_ANIM_MODE_FLUTE ; ITEMID_FLUTE
.db $c6 LINK_ANIM_MODE_21 ; ITEMID_SHOOTER
.db $80 LINK_ANIM_MODE_NONE ; ITEMID_10
.db $70 LINK_ANIM_MODE_HARP_2 ; ITEMID_HARP
.db $80 LINK_ANIM_MODE_NONE ; ITEMID_12
.db $c6 LINK_ANIM_MODE_21 ; ITEMID_SLINGSHOT
.db $80 LINK_ANIM_MODE_NONE ; ITEMID_14
.db $b0 LINK_ANIM_MODE_DIG_2 ; ITEMID_SHOVEL
.db $40 LINK_ANIM_MODE_LIFT_3 ; ITEMID_BRACELET
.db $80 LINK_ANIM_MODE_NONE ; ITEMID_FEATHER
.db $80 LINK_ANIM_MODE_NONE ; ITEMID_18
.db $a0 LINK_ANIM_MODE_21 ; ITEMID_SEED_SATCHEL
.db $80 LINK_ANIM_MODE_NONE ; ITEMID_DUST
.db $80 LINK_ANIM_MODE_NONE ; ITEMID_1b
.db $80 LINK_ANIM_MODE_NONE ; ITEMID_1c
.db $80 LINK_ANIM_MODE_NONE ; ITEMID_MINECART_COLLISION
.db $e6 LINK_ANIM_MODE_22 ; ITEMID_FOOLS_ORE
.db $80 LINK_ANIM_MODE_NONE ; ITEMID_1f
.include "object_code/common/specialObjects/minecart.s"
.include "object_code/common/specialObjects/raft.s"
.include "build/data/specialObjectAnimationData.s"
.include "code/ages/cutscenes/companionCutscenes.s"
.include "code/ages/cutscenes/linkCutscenes.s"
.include "build/data/signText.s"
.include "build/data/breakableTileCollisionTable.s"
;;
specialObjectLoadAnimationFrameToBuffer:
ld hl,w1Companion.visible
bit 7,(hl)
ret z
ld l,<w1Companion.var32
ld a,(hl)
call _getSpecialObjectGraphicsFrame
ret z
ld a,l
and $f0
ld l,a
ld de,w6SpecialObjectGfxBuffer|(:w6SpecialObjectGfxBuffer)
jp copy256BytesFromBank
.include "code/ages/garbage/bank06End.s"
.ends
.BANK $07 SLOT 1
.ORG 0
.include "code/fileManagement.s"
; This section can't be superfree, since it must be in the same bank as section
; "Bank_7_Data".
m_section_free "Enemy_Part_Collisions" namespace "bank7"
.include "code/collisionEffects.s"
.ends
m_section_superfree "Item_Code" namespace "itemCode"
.include "code/updateItems.s"
.include "build/data/itemConveyorTilesTable.s"
.include "build/data/itemPassableCliffTilesTable.s"
.include "build/data/itemPassableTilesTable.s"
.include "code/itemCodes.s"
.include "build/data/itemAttributes.s"
.include "data/itemAnimations.s"
.ends
; This section can't be superfree, since it must be in the same bank as section
; "Enemy_Part_Collisions".
m_section_free "Bank_7_Data" namespace "bank7"
.include "build/data/enemyActiveCollisions.s"
.include "build/data/partActiveCollisions.s"
.include "build/data/objectCollisionTable.s"
.include "code/ages/garbage/bank07End.s"
.ends
.BANK $08 SLOT 1
.ORG 0
m_section_force Interaction_Code_Bank08 NAMESPACE interactionBank08
.include "object_code/common/interactionCode/group1.s"
.include "object_code/ages/interactionCode/bank08.s"
.ends
.BANK $09 SLOT 1
.ORG 0
m_section_force Interaction_Code_Bank09 NAMESPACE interactionBank09
.include "object_code/common/interactionCode/group2.s"
.include "object_code/common/interactionCode/treasure.s"
.include "object_code/ages/interactionCode/bank09.s"
.ends
.BANK $0a SLOT 1
.ORG 0
m_section_force Interaction_Code_Bank0a NAMESPACE interactionBank0a
.include "object_code/common/interactionCode/group3.s"
.include "object_code/common/interactionCode/group5.s"
.include "object_code/ages/interactionCode/bank0a.s"
.ends
.BANK $0b SLOT 1
.ORG 0
m_section_force Interaction_Code_Bank0b NAMESPACE interactionBank0b
.include "object_code/common/interactionCode/group6.s"
.include "object_code/common/interactionCode/group7.s"
.include "object_code/common/interactionCode/group4.s"
.include "object_code/ages/interactionCode/bank0b.s"
.include "code/ages/garbage/bank0bEnd.s"
.ends
.BANK $0c SLOT 1
.ORG 0
.include "code/scripting.s"
.include "scripts/ages/scripts.s"
.BANK $0d SLOT 1
.ORG 0
m_section_free Enemy_Code_Bank0d NAMESPACE bank0d
.include "code/enemyCommon.s"
.include "object_code/common/enemyCode/group1.s"
.include "object_code/ages/enemyCode/bank0d.s"
.ends
m_section_superfree Enemy_Animations
.include "build/data/enemyAnimations.s"
.ends
.BANK $0e SLOT 1
.ORG 0
m_section_free Enemy_Code_Bank0e NAMESPACE bank0e
.include "code/enemyCommon.s"
.include "object_code/common/enemyCode/group2.s"
.include "build/data/orbMovementScript.s"
.include "code/objectMovementScript.s"
.include "object_code/ages/enemyCode/bank0e.s"
.include "build/data/movingSidescrollPlatform.s"
.include "code/ages/garbage/bank0eEnd.s"
.ends
.BANK $0f SLOT 1
.ORG 0
m_section_free Enemy_Code_Bank0f NAMESPACE bank0f
.include "code/enemyCommon.s"
.include "code/enemyBossCommon.s"
.include "object_code/ages/enemyCode/bank0f.s"
.ends
.BANK $10 SLOT 1
.ORG 0
m_section_free Enemy_Code_Bank10 NAMESPACE bank10
.include "code/enemyCommon.s"
.include "code/enemyBossCommon.s"
.include "object_code/common/enemyCode/group3.s"
.include "object_code/ages/enemyCode/bank10.s"
.ends
; Some blank space here ($6e1f-$6eff)
.ORGA $6f00
m_section_force Interaction_Code_Bank10 NAMESPACE interactionBank10
.include "object_code/common/interactionCode/group8.s"
.include "object_code/ages/interactionCode/bank10.s"
.ends
.BANK $11 SLOT 1
.ORG 0
.define PART_BANK $11
.export PART_BANK
m_section_force "Bank_11" NAMESPACE "partCode"
.include "code/partCommon.s"
.include "object_code/common/partCode.s"
.include "data/partCodeTable.s"
.include "object_code/ages/partCode.s"
.include "code/ages/garbage/bank11End.s"
.ends
.BANK $12 SLOT 1
.ORG 0
.include "code/objectLoading.s"
m_section_superfree "Room_Code" namespace "roomSpecificCode"
.include "code/ages/roomSpecificCode.s"
.ends
m_section_free "Objects_2" namespace "objectData"
.include "objects/ages/mainData.s"
.include "objects/ages/extraData3.s"
.ends
m_section_superfree "Underwater Surface Data"
.include "code/ages/underwaterSurface.s"
.ENDS
m_section_free "Objects_3" namespace "objectData"
.include "objects/ages/extraData4.s"
.ends
.BANK $13 SLOT 1
.ORG 0
.define BASE_OAM_DATA_BANK $13
.export BASE_OAM_DATA_BANK
.include "build/data/specialObjectOamData.s"
.include "data/itemOamData.s"
.include "build/data/enemyOamData.s"
.BANK $14 SLOT 1
.ORG 0
m_section_superfree "Terrain_Effects" NAMESPACE "terrainEffects"
.include "data/terrainEffects.s"
.ends
.include "build/data/interactionOamData.s"
.include "build/data/partOamData.s"
.BANK $15 SLOT 1
.ORG 0
.include "scripts/common/scriptHelper.s"
m_section_free "Object_Pointers" namespace "objectData"
;;
getObjectDataAddress:
ld a,(wActiveGroup)
ld hl,objectDataGroupTable
rst_addDoubleIndex
ldi a,(hl)
ld h,(hl)
ld l,a
ld a,(wActiveRoom)
ld e,a
ld d,$00
add hl,de
add hl,de
ldi a,(hl)
ld d,(hl)
ld e,a
ret
.include "objects/ages/pointers.s"
.ENDS
.include "scripts/ages/scriptHelper.s"
.BANK $16 SLOT 1
.ORG 0
.include "code/serialFunctions.s"
m_section_force Bank16 NAMESPACE bank16
;;
; @param d Interaction index (should be of type INTERACID_TREASURE)
interactionLoadTreasureData:
ld e,Interaction.subid
ld a,(de)
ld e,Interaction.var30
ld (de),a
ld hl,treasureObjectData
--
call multiplyABy4
add hl,bc
bit 7,(hl)
jr z,+
inc hl
ldi a,(hl)
ld h,(hl)
ld l,a
ld e,Interaction.var03
ld a,(de)
jr --
+
; var31 = spawn mode
ldi a,(hl)
ld b,a
swap a
and $07
ld e,Interaction.var31
ld (de),a
; var32 = collect mode
ld a,b
and $07
inc e
ld (de),a
; var33 = ?
ld a,b
and $08
inc e
ld (de),a
; var34 = parameter (value of 'c' for "giveTreasure")
ldi a,(hl)
inc e
ld (de),a
; var35 = low text ID
ldi a,(hl)
inc e