forked from pkmncoraldev/polishedcoral
-
Notifications
You must be signed in to change notification settings - Fork 0
/
map.asm
2190 lines (1928 loc) · 32.7 KB
/
map.asm
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
; Functions dealing with rendering and interacting with maps.
CheckTriggers:: ; 211b
; Checks wCurrentMapTriggerPointer. If it's empty, returns -1 in a. Otherwise, returns the active trigger ID in a.
push hl
ld hl, wCurrentMapTriggerPointer
ld a, [hli]
ld h, [hl]
ld l, a
or h
ld a, [hl]
jr nz, .triggerexists
ld a, -1
.triggerexists
pop hl
ret
; 212a
GetCurrentMapTrigger:: ; 212a
; Grabs the wram map trigger pointer for the current map and loads it into wCurrentMapTriggerPointer.
; If there are no triggers, both bytes of wCurrentMapTriggerPointer are wiped clean.
; Copy the current map group and number into bc. This is needed for GetMapTrigger.
ld a, [wMapGroup]
ld b, a
ld a, [wMapNumber]
ld c, a
; Blank out wCurrentMapTriggerPointer; this is the default scenario.
xor a
ld [wCurrentMapTriggerPointer], a
ld [wCurrentMapTriggerPointer + 1], a
call GetMapTrigger
ret c ; The map is not in the trigger table
; Load the trigger table pointer from de into wCurrentMapTriggerPointer
ld a, e
ld [wCurrentMapTriggerPointer], a
ld a, d
ld [wCurrentMapTriggerPointer + 1], a
xor a
ret
; 2147
GetMapTrigger::
; Searches the trigger table for the map group and number loaded in bc, and returns the wram pointer in de.
; If the map is not in the trigger table, returns carry.
anonbankpush MapTriggers
.Function:
ld hl, MapTriggers
ld de, 4
jr .handleLoop
.loop
pop hl
add hl, de
.handleLoop
push hl
ld a, [hli] ; map group, or terminator
cp -1
jr z, .end ; the current map is not in the trigger table
cp b
jr nz, .loop ; map group did not match
ld a, [hli] ; map number
cp c
jr nz, .loop ; map number did not match
ld a, [hli]
ld d, [hl]
ld e, a
jr .done
.end
scf
.done
pop hl
ret
LoadMapPart:: ; 217a
farjp _LoadMapPart
ReturnToMapFromSubmenu::
ld a, MAPSETUP_SUBMENU
ld [hMapEntryMethod], a
farcall RunMapSetupScript
xor a
ld [hMapEntryMethod], a
ret
CheckWarpTile::
call GetDestinationWarpNumber
ret nc
push bc
farcall CheckDirectionalWarp
pop bc
ret nc
call CopyWarpData
scf
ret
WarpCheck::
call GetDestinationWarpNumber
ret nc
jp CopyWarpData
GetDestinationWarpNumber:: ; 2252
farcall CheckWarpCollision
ret nc
ld a, [hROMBank]
push af
call SwitchToMapScriptHeaderBank
call .GetDestinationWarpNumber
pop de
ld a, d
rst Bankswitch
ret
; 2266
.GetDestinationWarpNumber: ; 2266
ld a, [wPlayerStandingMapY]
sub $4
ld e, a
ld a, [wPlayerStandingMapX]
sub $4
ld d, a
ld a, [wCurrMapWarpCount]
and a
ret z
ld c, a
ld hl, wCurrMapWarpHeaderPointer
ld a, [hli]
ld h, [hl]
ld l, a
.loop
push hl
ld a, [hli]
cp e
jr nz, .next
ld a, [hli]
cp d
jr nz, .next
jr .found_warp
.next
pop hl
ld a, 5
add l
ld l, a
jr nc, .okay
inc h
.okay
dec c
jr nz, .loop
xor a
ret
.found_warp
pop hl
inc hl
inc hl
ld a, [wCurrMapWarpCount]
inc a
sub c
ld c, a
scf
ret
CopyWarpData:: ; 22a7
ld a, [hROMBank]
push af
call SwitchToMapScriptHeaderBank
call .CopyWarpData
pop af
rst Bankswitch
scf
ret
; 22b4
.CopyWarpData: ; 22b4
push bc
ld hl, wCurrMapWarpHeaderPointer
ld a, [hli]
ld h, [hl]
ld l, a
ld a, c
dec a
ld bc, 5 ; warp size
rst AddNTimes
ld bc, 2 ; warp number
add hl, bc
ld a, [hli]
cp $ff
jr nz, .skip
ld hl, wBackupWarpNumber
ld a, [hli]
.skip
pop bc
ld [wNextWarp], a
ld a, [hli]
ld [wNextMapGroup], a
ld a, [hli]
ld [wNextMapNumber], a
ld a, c
ld [wPrevWarp], a
ld a, [wMapGroup]
ld [wPrevMapGroup], a
ld a, [wMapNumber]
ld [wPrevMapNumber], a
scf
ret
; 22ee
CheckBikeMap::
cp TUNNEL
ret z
CheckOutdoorMap:: ; 22ee
cp ROUTE
ret z
cp TOWN
ret z
cp FOREST
ret
; 22f4
CheckIndoorMap:: ; 22f4
cp CAVE
ret z
cp DUNGEON
ret z
cp GATE
ret z
cp INDOOR
ret
LoadMapAttributes::
ld a, [wTileset]
ld [wOldTileset], a
call CopyMapHeaders
call SwitchToMapScriptHeaderBank
xor a ; FALSE
jr ReadMapScripts
; 2317
LoadMapAttributes_Continue::
ld a, -1
ld [wOldTileset], a
call CopyMapHeaders
call SwitchToMapScriptHeaderBank
ld a, TRUE
; fallthrough
ReadMapScripts:: ; 234f
push af
ld hl, wMapScriptHeaderPointer
ld a, [hli]
ld h, [hl]
ld l, a
call ReadMapTriggers
call ReadMapCallbacks
call ReadWarps
call ReadCoordEvents
call ReadSignposts
pop af
and a
ret nz
; fallthrough
ReadObjectEvents:: ; 241f
push hl
call ClearObjectStructs
pop de
ld hl, wMap1Object
ld a, [de]
inc de
ld [wCurrentMapPersonEventCount], a
ld a, e
ld [wCurrentMapPersonEventHeaderPointer], a
ld a, d
ld [wCurrentMapPersonEventHeaderPointer + 1], a
ld a, [wCurrentMapPersonEventCount]
call CopyMapObjectHeaders
; get NUM_OBJECTS - 1 - [wCurrentMapPersonEventCount]
ld a, [wCurrentMapPersonEventCount]
ld c, a
ld a, NUM_OBJECTS - 1
sub c
jr z, .skip
jr c, .skip
inc hl
; Fill the remaining sprite IDs and y coords with 0 and -1, respectively.
ld bc, OBJECT_LENGTH
.loop
ld [hl], 0
inc hl
ld [hl], -1
dec hl
add hl, bc
dec a
jr nz, .loop
.skip
ld h, d
ld l, e
ret
; 2457
CopySecondMapHeader:: ; 235c
ld de, wMapHeader
ld c, 10 ; size of the second map header
.loop
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .loop
ret
; 2368
CopyMapHeaders:: ; 2326
call PartiallyCopyMapHeader
call SwitchToMapBank
call GetSecondaryMapHeaderPointer
call CopySecondMapHeader
; fallthrough
GetMapConnections:: ; 2368
ld a, $ff
ld [wNorthConnectedMapGroup], a
ld [wSouthConnectedMapGroup], a
ld [wWestConnectedMapGroup], a
ld [wEastConnectedMapGroup], a
ld a, [wMapConnections]
ld b, a
bit NORTH_F, b
jr z, .no_north
ld de, wNorthMapConnection
call GetMapConnection
.no_north
bit SOUTH_F, b
jr z, .no_south
ld de, wSouthMapConnection
call GetMapConnection
.no_south
bit WEST_F, b
jr z, .no_west
ld de, wWestMapConnection
call GetMapConnection
.no_west
bit EAST_F, b
ret z
ld de, wEastMapConnection
; fallthrough
GetMapConnection:: ; 23a3
; Load map connection struct at hl into de.
ld c, wSouthMapConnection - wNorthMapConnection
.loop
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .loop
ret
; 23ac
ReadMapTriggers:: ; 23ac
ld a, [hli] ; trigger count
ld c, a
ld [wCurrMapTriggerCount], a ; current map trigger count
ld a, l
ld [wCurrMapTriggerHeaderPointer], a ; map trigger pointer
ld a, h
ld [wCurrMapTriggerHeaderPointer + 1], a
ld a, c
and a
ret z
ld bc, 2 ; size of a map trigger header entry
rst AddNTimes
ret
; 23c3
ReadMapCallbacks:: ; 23c3
ld a, [hli]
ld c, a
ld [wCurrMapCallbackCount], a
ld a, l
ld [wCurrMapCallbackHeaderPointer], a
ld a, h
ld [wCurrMapCallbackHeaderPointer + 1], a
ld a, c
and a
ret z
ld bc, 3
rst AddNTimes
ret
; 23da
ReadWarps:: ; 23da
ld a, [hli]
ld c, a
ld [wCurrMapWarpCount], a
ld a, l
ld [wCurrMapWarpHeaderPointer], a
ld a, h
ld [wCurrMapWarpHeaderPointer + 1], a
ld a, c
and a
ret z
ld bc, 5
rst AddNTimes
ret
; 23f1
ReadCoordEvents:: ; 23f1
ld a, [hli]
ld c, a
ld [wCurrentMapXYTriggerCount], a
ld a, l
ld [wCurrentMapXYTriggerHeaderPointer], a
ld a, h
ld [wCurrentMapXYTriggerHeaderPointer + 1], a
ld a, c
and a
ret z
ld bc, 5
rst AddNTimes
ret
; 2408
ReadSignposts:: ; 2408
ld a, [hli]
ld c, a
ld [wCurrentMapSignpostCount], a
ld a, l
ld [wCurrentMapSignpostHeaderPointer], a
ld a, h
ld [wCurrentMapSignpostHeaderPointer + 1], a
ld a, c
and a
ret z
ld bc, 5
rst AddNTimes
ret
; 241f
CopyMapObjectHeaders:: ; 2457
and a
ret z
ld c, a
.loop
push bc
push hl
ld a, $ff
ld [hli], a
ld b, MAPOBJECT_FLAG_HI - MAPOBJECT_SPRITE + 1 ; size of person_event
.loop2
ld a, [de]
inc de
ld [hli], a
dec b
jr nz, .loop2
pop hl
ld bc, OBJECT_LENGTH
add hl, bc
pop bc
dec c
jr nz, .loop
ret
; 2471
ClearObjectStructs:: ; 2471
ld hl, wObject1Struct
ld bc, OBJECT_STRUCT_LENGTH * (NUM_OBJECT_STRUCTS - 1)
xor a
jp ByteFill
; 248a
RestoreFacingAfterWarp:: ; 248a
call SwitchToMapScriptHeaderBank
ld hl, wMapScriptHeaderPointer
ld a, [hli]
ld h, [hl]
ld l, a
; get to the warp coords
ld a, [hli] ; get map trigger count
ld bc, 2 ; size of an entry in the map trigger table
rst AddNTimes
ld a, [hli] ; get callback count
ld bc, 3 ; size of an entry in the callback table
rst AddNTimes
inc hl ; skip warp count
ld a, [wWarpNumber]
dec a
ld bc, 5 ; size of an entry in the warps table
rst AddNTimes
ld a, [hli]
ld [wYCoord], a
ld a, [hli]
ld [wXCoord], a
ld a, [hli]
cp -1
jr nz, .skip
ld a, [wPrevWarp]
ld [wBackupWarpNumber], a
ld a, [wPrevMapGroup]
ld [wBackupMapGroup], a
ld a, [wPrevMapNumber]
ld [wBackupMapNumber], a
.skip
farjp GetCoordOfUpperLeftCorner
; 24ba
LoadBlockData:: ; 24cd
ld a, [hVBlank]
push af
ld a, 2
ld [hVBlank], a
ld hl, wOverworldMap
ld bc, wOverworldMapEnd - wOverworldMap
xor a
call ByteFill
call ChangeMap
call FillMapConnections
ld a, MAPCALLBACK_TILES
call RunMapCallback
pop af
ld [hVBlank], a
ret
ChangeMap:: ; 24e4
ld a, [wMapBlockDataBank]
ld b, a
ld a, [wMapBlockDataPointer]
ld l, a
ld a, [wMapBlockDataPointer+1]
ld h, a
ld a, [wMapWidth]
ld d, a
ld a, [wMapHeight]
ld e, a
call RunFunctionInWRA6
.Function:
push de
call FarDecompressAtB_D000
pop de
ld a, d
ld [hConnectedMapWidth], a
add $6
ld [hConnectionStripLength], a
ld hl, wOverworldMap
ld c, a
ld b, 0
add hl, bc
add hl, bc
add hl, bc
ld c, 3
add hl, bc
ld b, e
ld de, wDecompressScratch
.row
push hl
ld a, [hConnectedMapWidth]
ld c, a
.col
ld a, [de]
inc de
ld [hli], a
dec c
jr nz, .col
pop hl
ld a, [hConnectionStripLength]
add l
ld l, a
jr nc, .okay
inc h
.okay
dec b
jr nz, .row
ret
; 2524
FillMapConnections:: ; 2524
; North
ld a, [wNorthConnectedMapGroup]
cp $ff
jr z, .South
ld b, a
ld a, [wNorthConnectedMapNumber]
ld c, a
call GetAnyMapBlockdataBankPointerAndDecompressConnectionMap
ld a, [wNorthConnectionStripPointer]
ld l, a
ld a, [wNorthConnectionStripPointer + 1]
ld h, a
ld a, [wNorthConnectionStripLocation]
ld e, a
ld a, [wNorthConnectionStripLocation + 1]
ld d, a
ld a, [wNorthConnectionStripLength]
ld [hConnectionStripLength], a
ld a, [wNorthConnectedMapWidth]
ld [hConnectedMapWidth], a
call FillNorthConnectionStrip
.South
ld a, [wSouthConnectedMapGroup]
cp $ff
jr z, .West
ld b, a
ld a, [wSouthConnectedMapNumber]
ld c, a
call GetAnyMapBlockdataBankPointerAndDecompressConnectionMap
ld a, [wSouthConnectionStripPointer]
ld l, a
ld a, [wSouthConnectionStripPointer + 1]
ld h, a
ld a, [wSouthConnectionStripLocation]
ld e, a
ld a, [wSouthConnectionStripLocation + 1]
ld d, a
ld a, [wSouthConnectionStripLength]
ld [hConnectionStripLength], a
ld a, [wSouthConnectedMapWidth]
ld [hConnectedMapWidth], a
call FillSouthConnectionStrip
.West
ld a, [wWestConnectedMapGroup]
cp $ff
jr z, .East
ld b, a
ld a, [wWestConnectedMapNumber]
ld c, a
call GetAnyMapBlockdataBankPointerAndDecompressConnectionMap
ld a, [wWestConnectionStripPointer]
ld l, a
ld a, [wWestConnectionStripPointer + 1]
ld h, a
ld a, [wWestConnectionStripLocation]
ld e, a
ld a, [wWestConnectionStripLocation + 1]
ld d, a
ld a, [wWestConnectionStripLength]
ld b, a
ld a, [wWestConnectedMapWidth]
ld [hConnectionStripLength], a
call FillWestConnectionStrip
.East
ld a, [wEastConnectedMapGroup]
cp $ff
ret z
ld b, a
ld a, [wEastConnectedMapNumber]
ld c, a
call GetAnyMapBlockdataBankPointerAndDecompressConnectionMap
ld a, [wEastConnectionStripPointer]
ld l, a
ld a, [wEastConnectionStripPointer + 1]
ld h, a
ld a, [wEastConnectionStripLocation]
ld e, a
ld a, [wEastConnectionStripLocation + 1]
ld d, a
ld a, [wEastConnectionStripLength]
ld b, a
ld a, [wEastConnectedMapWidth]
ld [hConnectionStripLength], a
; fallthrough
FillWestConnectionStrip::
FillEastConnectionStrip:: ; 25f6
ld a, [wMapWidth]
add 6
ld [hConnectedMapWidth], a
call RunFunctionInWRA6
.Function:
.loop
push de
push hl
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
pop hl
ld a, [hConnectionStripLength]
ld e, a
ld d, 0
add hl, de
pop de
ld a, [hConnectedMapWidth]
add e
ld e, a
jr nc, .okay
inc d
.okay
dec b
jr nz, .loop
ret
; 261b
FillNorthConnectionStrip::
FillSouthConnectionStrip:: ; 25d3
ld a, [wMapWidth]
add 6
ld [hMapWidthPlus6], a
call RunFunctionInWRA6
.Function:
ld c, 3
.y
push de
push hl
ld a, [hConnectionStripLength]
ld b, a
.x
ld a, [hli]
ld [de], a
inc de
dec b
jr nz, .x
pop hl
ld a, [hConnectedMapWidth]
ld e, a
ld d, 0
add hl, de
pop de
ld a, [hMapWidthPlus6]
add e
ld e, a
jr nc, .okay
inc d
.okay
dec c
jr nz, .y
ret
; 25f6
LoadMapStatus:: ; 261b
ld [wMapStatus], a
ret
; 261f
CallScript:: ; 261f
; Call a script at a:hl.
ld [wScriptBank], a
ld a, l
ld [wScriptPos], a
ld a, h
ld [wScriptPos + 1], a
ld a, PLAYEREVENT_MAPSCRIPT
ld [wScriptRunning], a
scf
ret
; 2631
CallMapScript:: ; 2631
; Call a script at hl in the current bank if there isn't already a script running
ld a, [wScriptRunning]
and a
ret nz
ld a, [wMapScriptHeaderBank]
jr CallScript
; 263b
RunMapCallback:: ; 263b
; Will run the first callback found in the map header with execution index equal to a.
ld b, a
ld a, [hROMBank]
push af
call SwitchToMapScriptHeaderBank
call .FindCallback
jr nc, .done
ld a, [wMapScriptHeaderBank]
ld b, a
ld d, h
ld e, l
call ExecuteCallbackScript
.done
pop af
rst Bankswitch
ret
; 2653
.FindCallback: ; 2653
ld a, [wCurrMapCallbackCount]
ld c, a
and a
ret z
ld hl, wCurrMapCallbackHeaderPointer
ld a, [hli]
ld h, [hl]
ld l, a
or h
ret z
ld de, 3
.loop
ld a, [hl]
cp b
jr z, .found
add hl, de
dec c
jr nz, .loop
xor a
ret
.found
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
scf
ret
; 2674
ExecuteCallbackScript:: ; 2674
; Do map callback de and return to script bank b.
farcall CallCallback
ld a, [wScriptMode]
push af
ld hl, wScriptFlags
ld a, [hl]
push af
set 1, [hl]
farcall EnableScriptMode
farcall ScriptEvents
pop af
ld [wScriptFlags], a
pop af
ld [wScriptMode], a
ret
; 269a
MapTextbox:: ; 269a
ld a, [hROMBank]
push af
ld a, b
rst Bankswitch
push hl
call SpeechTextBox
call SafeUpdateSprites
ld a, 1
ld [hOAMUpdate], a
call ApplyTilemap
pop hl
call PrintTextBoxText
xor a
ld [hOAMUpdate], a
pop af
rst Bankswitch
ret
; 26b7
Call_a_de:: ; 26b7
; Call a:de.
ld [hBuffer], a
ld a, [hROMBank]
push af
ld a, [hBuffer]
rst Bankswitch
call .de
pop af
rst Bankswitch
ret
.de
push de
ret
; 26c7
GetMovementData:: ; 26c7
; Initialize the movement data for person c at b:hl
ld a, [hROMBank]
push af
ld a, b
rst Bankswitch
ld a, c
call LoadMovementDataPointer
pop hl
ld a, h
rst Bankswitch
ret
; 26d4
GetScriptByte:: ; 0x26d4
; Return byte at wScriptBank:wScriptPos in a.
push hl
push bc
ld a, [hROMBank]
push af
ld a, [wScriptBank]
rst Bankswitch
ld hl, wScriptPos
ld c, [hl]
inc hl
ld b, [hl]
ld a, [bc]
inc bc
ld [hl], b
dec hl
ld [hl], c
ld b, a
pop af
rst Bankswitch
ld a, b
jp PopBCHL
; 0x26ef
ObjectEvent:: ; 0x26ef
jumptextfaceplayer ObjectEventText
; 0x26f2
ObjectEventText::
text_jump _ObjectEventText
db "@"
; 0x26f7
EndEvent::
end
CheckObjectMask:: ; 2707
ld a, [hMapObjectIndexBuffer]
ld e, a
ld d, $0
ld hl, wObjectMasks
add hl, de
ld a, [hl]
ret
; 2712
MaskObject:: ; 2712
ld a, [hMapObjectIndexBuffer]
ld e, a