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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
|
CheckSpecialModeColision: ; 0x10000
ld c, a
ld a, [wInSpecialMode] ;special mode in c
and a
ret z ;if mot in special mode, ret
ld a, c
ld [wSpecialModeCollisionID], a
ld a, [wSpecialMode]
cp SPECIAL_MODE_EVOLUTION ;branch based on mode
jp z, HandleEvoModeCollision ;call evo mode logic
cp SPECIAL_MODE_MAP_MOVE
jr nz, .CatchMode ;call catch mode logic
callba HandleMapModeCollision ;call map move logic
ret
.CatchMode
ld a, [wCurrentStage]
call CallInFollowingTable
HandleCatchEmCollisionCallTable: ; 0x10027
padded_dab HandleRedCatchEmCollision ; STAGE_RED_FIELD_TOP
padded_dab HandleRedCatchEmCollision ; STAGE_RED_FIELD_BOTTOM
padded_dab HandleRedCatchEmCollision
padded_dab HandleRedCatchEmCollision
padded_dab HandleBlueCatchEmCollision ; STAGE_BLUE_FIELD_TOP
padded_dab HandleBlueCatchEmCollision ; STAGE_BLUE_FIELD_BOTTOM
StartCatchEmMode: ; 0x1003f
ld a, [wInSpecialMode] ; current game mode?
and a
ret nz ; don't start catch 'em mode if we're already doing something like Map Move mode
ld a, $1
ld [wInSpecialMode], a ; set special mode flag
xor a
ld [wSpecialMode], a
ld [wSpecialModeState], a
ld a, [wCurrentStage]
sla a
ld c, a ;store twice current stage to use a pointer offset
ld b, $0
push bc
ld hl, WildMonOffsetsPointers
add hl, bc
ld a, [hli] ;hl = pointer to wild mon pointer table
ld h, [hl]
ld l, a
ld a, [wCurrentMap]
sla a
ld c, a
add hl, bc ;go to correct location in table
ld a, [hli]
ld c, a
ld a, [hl]
ld b, a ;bc = offset needed to reach correct wild table
pop de ;pop current stage offset
ld hl, WildMonPointers
add hl, de
ld a, [hli] ;fetch start od correct wilds table, place in hl
ld h, [hl]
ld l, a
add hl, bc
call GenRandom
and $f
call CheckForMew ;a = $10 if mew, else is less
ld c, a
ld b, $0
add hl, bc
ld a, [wRareMonsFlag] ; this gets set to $08 when the rare mons should be used.
sla a
ld c, a
add hl, bc
ld a, [hl] ; a contains mon id. overshoots by 1 if mew, causing mew to be loaded
dec a
ld [wCurrentCatchEmMon], a ;stores 1 less than ID
ld a, [wCurrentCatchEmMon] ;wow gamefreak
ld c, a
ld b, $0
ld hl, CatchemMonIds ; fetch the mon's catchem id
add hl, bc
ld c, [hl]
ld h, b
ld l, c
add hl, bc
add hl, bc ; multiply the catchem mod id by 3, add it to pointer to ???
ld bc, CatchSpriteFrameDurations ;mystery data, seems pokedex related too
add hl, bc
ld a, [hli]
ld [wCurrentCatchMonIdleFrame1Duration], a
ld [wLoopsUntilNextCatchSpriteAnimationChange], a
ld a, [hli]
ld [wCurrentCatchMonIdleFrame2Duration], a
ld a, [hli]
ld [wCurrentCatchMonHitFrameDuration], a ;load the 3 bytes into ????
ld hl, wBillboardTilesIlluminationStates
ld a, [wNumberOfCatchModeTilesFlipped]
ld c, a
and a
ld b, $18
jr z, .asm_100c7 ;if tiles flipped = 0, jump with b = 24 (2 seperate loops?)
.asm_100ba
ld a, $1
ld [hli], a ;load 1 then 0 into data from wNumberOfCatchModeTilesFlipped C times, where C is the contents of wNumberOfCatchModeTilesFlipped
xor a
ld [hli], a
dec b
dec c
jr nz, .asm_100ba
ld a, b ;load 24 - times looped into a, if 0: skip
and a
jr z, .asm_100ce
.asm_100c7 ;loop 0 then 1 into the rest of the data from wNumberOfCatchModeTilesFlipped
xor a
ld [hli], a
inc a
ld [hli], a
dec b
jr nz, .asm_100c7
.asm_100ce
ld a, [wCurrentCatchEmMon]
ld c, a
ld b, $0
sla c
rl b
ld hl, CatchEmTimerData ;contains how long each mon stays on screen, all are 2 minutes by default
add hl, bc
ld a, [hli]
ld c, a
ld a, [hl]
ld b, a ;bc = timer legnth. b = secons c = minutes
callba StartTimer
callba InitBallSaverForCatchEmMode
call Func_10696
call Func_3579
ld a, [wCurrentStage]
bit 0, a
jr z, .asm_1011d
ld a, BANK(StageRedFieldBottomBaseGameBoyColorGfx)
ld hl, StageRedFieldBottomBaseGameBoyColorGfx + $300
ld de, vTilesSH tile $2e
ld bc, $0020
call LoadOrCopyVRAMData
ld a, $0
ld hl, CatchBarTiles
deCoord 6, 8, vBGMap
ld bc, (CatchBarTilesEnd - CatchBarTiles)
call LoadOrCopyVRAMData
.asm_1011d
call SetPokemonSeenFlag
ld a, [wCurrentStage]
rst JumpTable ; calls JumpToFuncInTable
CallTable_10124: ; 0x10124
dw Func_10871 ; STAGE_RED_FIELD_TOP
dw Func_10871 ; STAGE_RED_FIELD_BOTTOM
dw DoNothing_1098a
dw DoNothing_1098a
dw Func_1098c ; STAGE_BLUE_FIELD_TOP
dw Func_1098c ; STAGE_BLUE_FIELD_BOTTOM
CheckForMew:
; Sets the encountered mon to Mew if the following conditions are met:
; 1. Random number in register a equals $f
; 2. The current map is Indigo Plateau (it does a roundabout way of checking this)
; 3. The right alley has been hit three times
; 4. The Mewtwo Bonus Stage completion counter equals 2.
push af
cp $f ; random number equals $f (1 in 16)
jr nz, .NotMew
ld a, c
cp (BlueStageIndigoPlateauWildMons - BlueStageWildMons) & $ff ; check if low-byte of map mons offset is Indigo Plateau
jr nz, .NotMew
ld a, b
cp (BlueStageIndigoPlateauWildMons - BlueStageWildMons) >> 8 ; check if high-byte of map mons offset is Indigo Plateau
jr nz, .NotMew
ld a, [wRareMonsFlag]
cp $8
jr nz, .NotMew
ld a, [wNumMewtwoBonusCompletions]
cp NUM_MEWTWO_COMPLETIONS_FOR_MEW
jr nz, .NotMew
pop af
xor a
ld [wNumMewtwoBonusCompletions], a
ld a, $10
ret
.NotMew
pop af
ret
ConcludeCatchEmMode: ; 0x10157
xor a
ld [wInSpecialMode], a
ld [wWildMonIsHittable], a
ld [wd5c6], a
ld [wNumberOfCatchModeTilesFlipped], a
ld [wNumMonHits], a
call ClearWildMonCollisionMask
callba StopTimer
ld a, [wCurrentStage]
rst JumpTable ; calls JumpToFuncInTable
CallTable_10178: ; 0x10178
dw Func_108f5 ; STAGE_RED_FIELD_TOP
dw Func_108f5 ; STAGE_RED_FIELD_BOTTOM
dw DoNothing_1098b
dw DoNothing_1098b
dw Func_109fc ; STAGE_BLUE_FIELD_TOP
dw Func_109fc ; STAGE_BLUE_FIELD_BOTTOM
Func_10184: ; 0x10184 called by what looks like the "hit voltorb and shellder" handllers and after all tiles are flipped, as well as some evo mode stuff
ld a, [wCurrentStage]
bit 0, a
ret z ;skip if stage has no flippers
ld a, [wCurrentCatchEmMon]
ld c, a
ld b, $0
sla c
rl b
add c
ld c, a
jr nc, .NoOverflow
inc b
.NoOverflow ;double current catch em mon
ld hl, MonBillboardPicPointers
add hl, bc
ld a, [hli]
ld [$ff8c], a ;load 3 byte billboard pointer into Hram
ld a, [hli]
ld [$ff8d], a
ld a, [hl]
ld [$ff8e], a
ld hl, MonBillboardPaletteMapPointers ;and the PAL pointers
add hl, bc
ld a, [hli]
ld [$ff8f], a
ld a, [hli]
ld [$ff90], a
ld a, [hli]
ld [$ff91], a
ld de, wc000
ld hl, wBillboardTilesIlluminationStates
ld c, $0
.Loop24Times
ld a, [hli]
cp [hl]
ld [hli], a ;load first byte into next and test it gainst the second byte, if it's the same skip
jr z, .NextLoop
ld b, a ;else store in b
call nz, Func_101d9
ld a, [hGameBoyColorFlag]
and a
jr z, .NextLoop ;skip if DMG
ld a, [wCurrentStage]
bit 0, a
ld a, b
call nz, Func_10230 ;if lower stage, run ???
.NextLoop
inc c
ld a, c
cp $18 ;run 24 times
jr nz, .Loop24Times
ret
Func_101d9: ; 0x101d9
push bc
push hl
push de
push af
ld a, $10
ld [de], a ;load 16 into de
inc de
ld a, $1
ld [de], a ;1 into de+1
inc de
ld b, $0
ld hl, Data_102a4 ;retrieve ???? c
add hl, bc
ld c, [hl]
sla c
rl b
sla c
rl b
sla c
rl b
sla c
rl b ;multiply ??? by 16
ld hl, vTilesSH tile $10 ;wut
add hl, bc ;add ???*16 to wut (8 2 bit pixels?)
ld a, l
ld [de], a
inc de
ld a, h
ld [de], a
inc de ;load result in to de
ld a, [$ff8c] ;loaded billboard pointer
ld l, a
ld a, [$ff8d]
ld h, a
add hl, bc ;add ???*16
pop af
and a
jr nz, .asm_10215 ;if a is 0, add $180 (384)
ld bc, $0180
add hl, bc
.asm_10215
ld a, l
ld [de], a
inc de
ld a, h
ld [de], a
inc de
ld a, [$ff8e]
ld [de], a
inc de ;load adjusted pointer into de, then 0
ld a, $0
ld [de], a
inc de
pop bc
push de
xor a
ld de, Func_11d2 ;queue graphics load from the adjusted pointer bank 0 using this func
call QueueGraphicsToLoadWithFunc
pop de
pop hl
pop bc
ret
Func_10230: ; 0x10230
push bc
push hl
push de
push af
ld a, $1
ld [de], a
inc de
ld [de], a
inc de ;load 1 into first 2 bytes from DE
ld b, $0
ld hl, Data_102a4
add hl, bc ;retrieve entry c from ???
ld c, [hl]
sla c
ld hl, PointerTable_10274 ;grab billboard BG position(?) pointer entry c, place in de
add hl, bc
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
inc de
srl c
ld a, [$ff8f];load PAL pointer
ld l, a
ld a, [$ff90]
ld h, a
add hl, bc ;add the value from Data_102a4
pop af
and a
ld a, [$ff91]
call ReadByteFromBank ;fetch pallete data
jr nz, .asm_10261 ;
ld a, $5
.asm_10261
ld [de], a ;if a's initial place is 0, make it 5 into de, else load the PAL bank
inc de
ld a, $0
ld [de], a ;then load 0
inc de
pop bc
push de
xor a
ld de, LoadTileListsBank1 ;load pal pointer as graphics?
call QueueGraphicsToLoadWithFunc
pop de
pop hl
pop bc
ret
PointerTable_10274: ; 0x10274 4x6 area? the billboard's position?
dw $9887
dw $9888
dw $9889
dw $988A
dw $988B
dw $988C
dw $98A7
dw $98A8
dw $98A9
dw $98AA
dw $98AB
dw $98AC
dw $98C7
dw $98C8
dw $98C9
dw $98CA
dw $98CB
dw $98CC
dw $98E7
dw $98E8
dw $98E9
dw $98EA
dw $98EB
dw $98EC
Data_102a4: ; 0x102a4
db $00, $07, $06, $01, $0E, $15, $14, $0F, $04, $0B, $0A, $05, $0C, $13, $12, $0D, $02, $09, $08, $03, $10, $17, $16, $11
Func_102bc: ; 0x102bc
ld a, [wCurrentCatchEmMon]
ld c, a
ld b, $0
sla c
rl b
add c
ld c, a
jr nc, .asm_102cb
inc b
.asm_102cb
ld hl, MonBillboardPalettePointers
add hl, bc
ld a, [hli]
ld [$ff8c], a
ld a, [hli]
ld [$ff8d], a
ld a, [hl]
ld [$ff8e], a
ld de, wc1b8
ld a, $10
ld [de], a
inc de
ld a, $8
ld [de], a
inc de
ld a, $30
ld [de], a
inc de
ld a, [$ff8c]
ld [de], a
inc de
ld a, [$ff8d]
ld [de], a
inc de
ld a, [$ff8e]
ld [de], a
inc de
ld a, $0
ld [de], a
xor a
ld bc, wc1b8
ld de, LoadPalettes
call QueueGraphicsToLoadWithFunc
ret
Func_10301: ; 0x10301
ld a, [wCurrentCatchEmMon]
ld c, a
ld b, $0
sla c
rl b
add c
ld c, a
jr nc, .asm_10310
inc b
.asm_10310
ld hl, MonAnimatedPalettePointers
add hl, bc
ld a, [hli]
ld [$ff8c], a
ld a, [hli]
ld [$ff8d], a
ld a, [hl]
ld [$ff8e], a
ld de, wc1b8
ld a, $10
ld [de], a
inc de
ld a, $4
ld [de], a
inc de
ld a, $58
ld [de], a
inc de
ld a, [$ff8c]
ld [de], a
inc de
ld a, [$ff8d]
ld [de], a
inc de
ld a, [$ff8e]
ld [de], a
inc de
ld a, $4
ld [de], a
inc de
ld a, $68
ld [de], a
inc de
ld a, [$ff8c]
ld l, a
ld a, [$ff8d]
ld h, a
ld bc, $0008
add hl, bc
ld a, l
ld [de], a
inc de
ld a, h
ld [de], a
inc de
ld a, [$ff8e]
ld [de], a
inc de
ld a, $0
ld [de], a
xor a
ld bc, wc1b8
ld de, LoadPalettes
call QueueGraphicsToLoadWithFunc
ret
Func_10362: ; 0x10362
ld a, [wCurrentCatchEmMon]
ld c, a
ld b, $0
sla c
rl b
add c
ld c, a
jr nc, .asm_10371
inc b
.asm_10371
ld hl, MonAnimatedPicPointers
add hl, bc
ld a, [hli]
ld [$ff8c], a
ld a, [hli]
ld [$ff8d], a
ld a, [hl]
ld [$ff8e], a
ld de, wc150
ld bc, $0000
.asm_10384
call Func_1038e
inc c
ld a, c
cp $d
jr nz, .asm_10384
ret
Func_1038e: ; 0x1038e
push bc
push de
ld a, c
sla a
add c
ld c, a
sla c
ld hl, Data_103c6
add hl, bc
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [$ff8c]
add [hl]
ld [de], a
inc hl
inc de
ld a, [$ff8d]
adc [hl]
ld [de], a
inc de
ld a, [$ff8e]
ld [de], a
inc de
ld a, $0
ld [de], a
inc de
pop bc
push de
xor a
ld de, Func_11d2
call QueueGraphicsToLoadWithFunc
pop de
pop bc
ret
Data_103c6: ; 0x103c6
; TODO: this might have pointers in it
db $40, $04, $00, $89, $00, $00
db $40, $04, $40, $89, $40, $00
db $40, $04, $80, $89, $80, $00
db $40, $04, $C0, $89, $C0, $00
db $40, $04, $00, $8A, $00, $01
db $40, $04, $40, $8A, $40, $01
db $20, $02, $80, $8A, $80, $01
db $20, $02, $A0, $81, $A0, $01
db $40, $04, $C0, $81, $C0, $01
db $40, $04, $00, $82, $00, $02
db $40, $04, $40, $82, $40, $02
db $40, $04, $80, $82, $80, $02
db $40, $04, $C0, $82, $C0, $02
Func_10414: ; 0x10414
ld a, BANK(Data_10420)
ld bc, Data_10420
ld de, Func_11b5
call QueueGraphicsToLoadWithFunc
ret
Data_10420:
db $18
db $06
dw $9887
db $80
db $06
dw $98a7
db $80
db $06
dw $98c7
db $80
db $06
dw $98e7
db $80
db $00
Func_10432: ; 0x10432
ld a, BANK(Data_1043e)
ld bc, Data_1043e
ld de, LoadTileLists
call QueueGraphicsToLoadWithFunc
ret
Data_1043e:
db $18
db $06
dw $9887
db $90, $91, $92, $93, $94, $95
db $06
dw $98a7
db $96, $97, $98, $99, $9a, $9b
db $06
dw $98c7
db $9c, $9d, $9e, $9f, $a0, $a1
db $06
dw $98e7
db $a2, $a3, $a4, $a5, $a6, $a7
db $00
LoadWildMonCollisionMask: ; 0x10464
ld a, [wCurrentCatchEmMon]
ld c, a
ld b, $0
sla c
rl b
add c
ld c, a
jr nc, .noCarry
inc b
.noCarry
ld hl, MonAnimatedCollisionMaskPointers
add hl, bc
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
ld a, [hl]
ld h, b
ld l, c
ld de, wMonAnimatedCollisionMask
ld bc, $0080
call FarCopyData
ret
ClearWildMonCollisionMask: ; 0x10488
xor a
ld hl, wMonAnimatedCollisionMask
ld b, $20
.asm_1048e
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
dec b
jr nz, .asm_1048e
ret
BallCaptureInit: ; 0x10496
xor a
ld [wd5c6], a
ld a, BANK(PikachuSaverGfx)
ld hl, PikachuSaverGfx + $c0
ld de, vTilesOB tile $7e
ld bc, $0020
call LoadVRAMData
ld a, BANK(BallCaptureSmokeGfx)
ld hl, BallCaptureSmokeGfx
ld de, vTilesSH tile $10
ld bc, $0180
call LoadVRAMData
call LoadShakeBallGfx
ld hl, BallCaptureAnimationData
ld de, wBallCaptureAnimation
call InitAnimation
ld a, $1
ld [wCapturingMon], a
xor a
ld [wBallXVelocity], a
ld [wBallXVelocity + 1], a
ld [wBallYVelocity], a
ld [wBallYVelocity + 1], a
xor a
ld [wPinballIsVisible], a
ld [wEnableBallGravityAndTilt], a
lb de, $00, $0b
call PlaySoundEffect
ret
LoadShakeBallGfx: ; 0x104e2
; Loads the graphics for the ball shaking after a pokemon is caught.
ld a, [wBallType]
cp GREAT_BALL
jr nc, .notPokeball
ld a, Bank(PinballPokeballShakeGfx)
ld hl, PinballPokeballShakeGfx
ld de, vTilesOB tile $38
ld bc, $0040
call LoadVRAMData
ret
.notPokeball
cp ULTRA_BALL
jr nc, .notGreatball
ld a, Bank(PinballGreatballShakeGfx)
ld hl, PinballGreatballShakeGfx
ld de, vTilesOB tile $38
ld bc, $0040
call LoadVRAMData
ret
.notGreatball
cp MASTER_BALL
jr nc, .notUltraBall
ld a, Bank(PinballUltraballShakeGfx)
ld hl, PinballUltraballShakeGfx
ld de, vTilesOB tile $38
ld bc, $0040
call LoadVRAMData
ret
.notUltraBall
ld a, Bank(PinballMasterballShakeGfx)
ld hl, PinballMasterballShakeGfx
ld de, vTilesOB tile $38
ld bc, $0040
call LoadVRAMData
ret
CapturePokemonAnimation: ; 0x1052d
ld a, [wBallCaptureAnimationFrame]
cp $c
jr nz, .asm_10541
ld a, [wBallCaptureAnimationFrameCounter]
cp $1
jr nz, .asm_10541
lb de, $00, $41
call PlaySoundEffect
.asm_10541
ld hl, BallCaptureAnimationData
ld de, wBallCaptureAnimation
call UpdateAnimation
ld a, [wBallCaptureAnimationIndex]
cp $1
jr nz, .asm_1055d
ld a, [wBallCaptureAnimationFrameCounter]
cp $1
jr nz, .asm_1055d
xor a
ld [wWildMonIsHittable], a
ret
.asm_1055d
ld a, [wBallCaptureAnimationIndex]
cp $15
ret nz
ld a, [wBallCaptureAnimationFrameCounter]
cp $1
ret nz
call MainLoopUntilTextIsClear
ld de, MUSIC_NOTHING
call PlaySong
rst AdvanceFrame
lb de, $23, $29
call PlaySoundEffect
call ShowJackpotText
call MainLoopUntilTextIsClear
ld a, [wNumPartyMons]
and a
call z, Func_10848
ld a, $50
ld [wBallXPos + 1], a
ld a, $40
ld [wBallYPos + 1], a
ld a, $80
ld [wBallXVelocity], a
xor a
ld [wBallXPos], a
ld [wBallYPos], a
ld [wCapturingMon], a
ld a, $1
ld [wPinballIsVisible], a
ld [wEnableBallGravityAndTilt], a
callba RestoreBallSaverAfterCatchEmMode
call ConcludeCatchEmMode
ld de, MUSIC_BLUE_FIELD ; This is either MUSIC_BLUE_FIELD or MUSIC_RED_FIELD, they just happen to be the same song id in their respective audio Banks.
call PlaySong
ld hl, wNumPokemonCaughtInBallBonus
call Increment_Max100
jr nc, .notMaxed
ld c, $a
call Modulo_C
callba z, IncrementBonusMultiplierFromFieldEvent ; increments bonus multiplier every 10 pokemon caught
.notMaxed
call SetPokemonOwnedFlag
ld a, [wPreviousNumPokeballs]
cp $3
ret z
inc a
ld [wNumPokeballs], a
ld a, $80
ld [wPokeballBlinkingCounter], a
ret
BallCaptureAnimationData: ; 0x105e4
; Each entry is [OAM id][duration]
db $05, $00
db $05, $01
db $05, $02
db $04, $03
db $06, $04
db $08, $05
db $07, $06
db $05, $07
db $04, $08
db $04, $09
db $04, $0A
db $04, $0B
db $24, $0A
db $09, $0C
db $09, $0A
db $09, $0C
db $27, $0A
db $09, $0C
db $09, $0A
db $09, $0C
db $24, $0A
db $01, $0A
db $00 ; terminator
Func_10611: ; 0x10611
and a ;if a NZ
ret z
dec a ;dec a
sla a
ld c, a
ld b, $0
ld hl, Data_1062a
add hl, bc ;load that graphics data and qeue it up
ld a, [hli]
ld c, a
ld a, [hl]
ld b, a
ld a, BANK(Data_1062a)
ld de, Func_11d2
call QueueGraphicsToLoadWithFunc
ret
Data_1062a:
dw Data_10630
dw Data_10638
dw Data_10640
Data_10630:
db $20
db $02
dw $8ae0
dw CatchTextGfx + $00
db BANK(CatchTextGfx)
db $00
Data_10638:
db $20
db $02
dw $8b00
dw CatchTextGfx + $20
db BANK(CatchTextGfx)
db $00
Data_10640:
db $20
db $02
dw $8b20
dw CatchTextGfx + $40
db BANK(CatchTextGfx)
db $00
Func_10648: ; 0x10648
call Func_10184
ld a, [wd54e]
dec a
ld [wd54e], a
jr nz, .asm_10677
ld a, $14
ld [wd54e], a
ld hl, wBillboardTilesIlluminationStates
ld b, $18
.asm_1065e
ld a, [wd54f]
and $1
ld [hli], a
xor $1
ld [hli], a
dec b
jr nz, .asm_1065e
ld a, [wd54f]
dec a
ld [wd54f], a
jr nz, .asm_10677
ld hl, wSpecialModeState
inc [hl]
.asm_10677
ret
ShowAnimatedWildMon: ; 0x10678
ld a, [wCurrentCatchEmMon]
ld c, a
ld b, $0
ld hl, MonAnimatedSpriteTypes
add hl, bc
ld a, [hl]
ld [wCurrentAnimatedMonSpriteType], a
ld [wCurrentAnimatedMonSpriteFrame], a
ld a, $1
ld [wWildMonIsHittable], a
xor a
ld [wBallHitWildMon], a
ld [wNumMonHits], a
ret
Func_10696: ; 0x10696
call FillBottomMessageBufferWithBlackTile
call EnableBottomText
ld hl, wScrollingText1
ld de, LetsGetPokemonText
call LoadScrollingText
ret
Func_106a6: ; 0x106a6
call FillBottomMessageBufferWithBlackTile
call EnableBottomText
ld hl, wScrollingText1
ld de, PokemonRanAwayText
call LoadScrollingText
ret
ShowCapturedPokemonText: ; 0x106b6
ld a, [wCurrentCatchEmMon]
ld c, a
ld b, $0
sla c
rl b
sla c
rl b
sla c
rl b
sla c
rl b ; bc was just multiplied by 16
ld hl, PokemonNames + 1
add hl, bc
ld de, YouGotAnText ; "You got an"
ld bc, Data_2a91
ld a, [hl]
; check if mon's name starts with a vowel, so it can print "an", instead of "a"
cp "A"
jr z, .asm_106f1
cp "I"
jr z, .asm_106f1
cp "U"
jr z, .asm_106f1
cp "E"
jr z, .asm_106f1
cp "O"
jr z, .asm_106f1
ld de, YouGotAText ; "You got a"
ld bc, Data_2a79
.asm_106f1
push hl
push bc
push de
call FillBottomMessageBufferWithBlackTile
call EnableBottomText
ld hl, wScrollingText1
pop de
call LoadScrollingText
ld hl, wScrollingText2
pop de
call LoadScrollingText
pop hl
ld de, wBottomMessageText + $20
ld b, $0 ; count the number of letters in mon's name in register b
.readLetter
ld a, [hli]
and a
jr z, .endOfName
ld [de], a
inc de
inc b
jr .readLetter
.endOfName
ld a, $20
ld [de], a
inc de
xor a
ld [de], a
ld a, [wScrollingText2ScrollStepsRemaining]
add b
ld [wScrollingText2ScrollStepsRemaining], a
ld a, $14
sub b
srl a
ld b, a
ld a, [wScrollingText2StopOffset]
add b
ld [wScrollingText2StopOffset], a
ret
PlayCatchemPokemonCry: ; 0x10732
ld a, [wCurrentCatchEmMon]
inc a
ld e, a
ld d, $0
call PlayCry
ret
AddCaughtPokemonToParty: ; 0x1073d
ld a, [wNumPartyMons]
ld c, a
ld b, $0
ld hl, wPartyMons
add hl, bc
ld a, [wCurrentCatchEmMon]
ld [hl], a
ld a, [wNumPartyMons]
inc a
ld [wNumPartyMons], a
ret
SetPokemonSeenFlag: ; 0x10753
ld a, [wSpecialMode]
and a
ld a, [wCurrentCatchEmMon]
jr z, .asm_10766
ld a, [wCurrentEvolutionMon]
cp $ff
jr nz, .asm_10766
ld a, [wCurrentCatchEmMon]
.asm_10766
ld c, a
ld b, $0
ld hl, wPokedexFlags
add hl, bc
set 0, [hl]
ld hl, wPokedexFlags
ld de, sPokedexFlags
ld bc, $0098
call SaveData
ret
SetPokemonOwnedFlag: ; 0x1077c
ld a, [wSpecialMode]
and a
ld a, [wCurrentCatchEmMon]
jr z, .asm_1078f
ld a, [wCurrentEvolutionMon]
cp $ff
jr nz, .asm_1078f
ld a, [wCurrentCatchEmMon]
.asm_1078f
ld c, a
ld b, $0
ld hl, wPokedexFlags
add hl, bc
set 1, [hl]
ld hl, wPokedexFlags
ld de, sPokedexFlags
ld bc, $0098
call SaveData
ret
ResetIndicatorStates: ; 0x107a5
xor a
ld hl, wIndicatorStates
ld b, $13
.loop
ld [hli], a
dec b
jr nz, .loop
ret
Func_107b0: ; 0x107b0
xor a
ld [wSlotIsOpen], a
ld [wIndicatorStates + 4], a
callba LoadSlotCaveCoverGraphics_RedField
ret
OpenSlotCave: ; 0x107c2
ld a, $1e
ld [wFramesUntilSlotCaveOpens], a
ret
SetLeftAndRightAlleyArrowIndicatorStates_RedField: ; 0x107c8
ld a, [wRightAlleyCount]
cp $3
jr z, .asm_107d1
set 7, a
.asm_107d1
ld [wIndicatorStates + 1], a
ld a, [wRightAlleyCount]
cp $2
jr c, .asm_107e0
ld a, $80
ld [wIndicatorStates + 3], a
.asm_107e0
ld a, [wLeftAlleyCount]
set 7, a
ld [wIndicatorStates], a
ret
Func_107e9: ; 0x107e9
ld a, [wLeftAlleyCount]
cp $3
ld a, $4
jr nz, .asm_107f4
ld a, $6
.asm_107f4
ld [wd7ad], a
ret
PlayLowTimeSfx: ; 0x107f8
ld a, [wTimerFrames]
and a
ret nz
ld a, [wTimerMinutes]
and a
ret nz
ld a, [wTimerSeconds]
cp 32
jr nz, .Not32Seconds
lb de, $07, $49
call PlaySoundEffect
ret
.Not32Seconds
cp 16
jr nz, .Not16Seconds
lb de, $0a, $4a
call PlaySoundEffect
ret
.Not16Seconds
cp 5
ret nz
lb de, $0d, $4b
call PlaySoundEffect
ret
ShowJackpotText: ; 0x10825
call RetrieveJackpot ;retreive somethign score related, put it on the stack
push bc ;store data on stack to bge read in by LoadScoreTextFromStack
push de
call AddBCDEToCurBufferValue
call FillBottomMessageBufferWithBlackTile
call EnableBottomText
ld hl, wStationaryText2
ld de, CatchModeJackpotScoreStationaryTextHeader
call LoadScoreTextFromStack
pop de
pop bc
ld hl, wStationaryText1
ld de, JackpotText
call LoadStationaryTextAndHeader
ret
Func_10848: ; 0x10848
ld bc, OneHundredMillionPoints
callba AddBigBCD6FromQueue
call FillBottomMessageBufferWithBlackTile
call EnableBottomText
ld hl, wScrollingText2
ld de, OneBillionText
call LoadScrollingText
ld hl, wScrollingText1
ld de, PokemonCaughtSpecialBonusText
call LoadScrollingText
call MainLoopUntilTextIsClear
ret
Func_10871: ; 0x10871
ld a, [wCurrentCatchEmMon]
ld c, a
ld b, $0
ld hl, CatchemMonIds
add hl, bc
ld a, [hl]
ld c, a
ld b, $0
ld l, c
ld h, b
sla l
rl h
sla l
rl h
sla l
rl h
sla l
rl h
add hl, bc
add hl, bc
add hl, bc
ld c, l
ld b, h
ld hl, CatchEmModeInitialIndicatorStates
add hl, bc
ld de, wIndicatorStates
ld b, $13 ; number of indicators
.loop
ld a, [hli]
ld [de], a
inc de
dec b
jr nz, .loop
xor a
ld [wRightAlleyCount], a
call Func_107b0
ld a, $4
ld [wd7ad], a
ld de, MUSIC_CATCH_EM_BLUE ; This is either MUSIC_CATCH_EM_BLUE or MUSIC_CATCH_EM_RED. They happen to have the same id in their respective audio Banks.
call PlaySong
ld a, [wCurrentStage]
bit 0, a
jr nz, .asm_108d3
callba LoadStageCollisionAttributes
callba LoadFieldStructureGraphics_RedField
ret
.asm_108d3
callba ClearAllRedIndicators
callba Func_10184
ld a, [hGameBoyColorFlag]
and a
callba nz, Func_102bc
ret
Func_108f5: ; 0x108f5
call ResetIndicatorStates
call OpenSlotCave
call SetLeftAndRightAlleyArrowIndicatorStates_RedField
call Func_107e9
ld a, [wCurrentStage]
bit 0, a
ret z
callba ClearAllRedIndicators
call Func_10432
callba LoadMapBillboardTileData
ld a, Bank(StageSharedBonusSlotGlowGfx)
ld hl, StageSharedBonusSlotGlowGfx
ld de, vTilesOB tile $1a
ld bc, $0160
call LoadVRAMData
ld a, BANK(StageSharedBonusSlotGlow2Gfx)
ld hl, StageSharedBonusSlotGlow2Gfx
ld de, vTilesOB tile $38
ld bc, $0020
call LoadVRAMData
ld hl, BlankSaverSpaceTileDataRedField
ld a, BANK(BlankSaverSpaceTileDataRedField)
call QueueGraphicsToLoad
ld a, [wPreviousNumPokeballs]
callba LoadPokeballsGraphics_RedField
ld hl, CaughtPokeballTileDataPointers
ld a, BANK(CaughtPokeballTileDataPointers)
call QueueGraphicsToLoad
ret
BlankSaverSpaceTileDataRedField:
db 3
dw BlankSaverSpaceTileDataRedField1
dw BlankSaverSpaceTileDataRedField2
dw BlankSaverSpaceTileDataRedField3
BlankSaverSpaceTileDataRedField1:
dw Func_11d2
db $20, $02
dw vTilesSH tile $2e
dw StageRedFieldBottomBaseGameBoyColorGfx + $2e0
db Bank(StageRedFieldBottomBaseGameBoyColorGfx)
db $00
BlankSaverSpaceTileDataRedField2:
dw Func_11d2
db $20, $02
dw vTilesSH tile $30
dw StageRedFieldBottomBaseGameBoyColorGfx + $300
db Bank(StageRedFieldBottomBaseGameBoyColorGfx)
db $00
BlankSaverSpaceTileDataRedField3:
dw Func_11d2
db $20, $02
dw vTilesSH tile $32
dw StageRedFieldBottomBaseGameBoyColorGfx + $320
db Bank(StageRedFieldBottomBaseGameBoyColorGfx)
db $00
CaughtPokeballTileDataPointers:
db 1
dw CaughtPokeballTileData
CaughtPokeballTileData:
dw Func_11d2
db $20, $02
dw vTilesSH tile $2e
dw CaughtPokeballGfx
db Bank(CaughtPokeballGfx)
db $00
DoNothing_1098a: ; 0x1098a
ret
DoNothing_1098b: ; 0x1098b
ret
Func_1098c: ; 0x1098c
ld a, [wCurrentCatchEmMon]
ld c, a
ld b, $0
ld hl, CatchemMonIds
add hl, bc
ld a, [hl]
ld c, a
ld b, $0
ld l, c
ld h, b
sla l
rl h
sla l
rl h
sla l
rl h
sla l
rl h
add hl, bc
add hl, bc
add hl, bc
ld c, l
ld b, h
ld hl, CatchEmModeInitialIndicatorStates
add hl, bc
ld de, wIndicatorStates
ld b, $13 ; number of indicators
.loop
ld a, [hli]
ld [de], a
inc de
dec b
jr nz, .loop
xor a
ld [wRightAlleyCount], a
callba CloseSlotCave
ld de, MUSIC_CATCH_EM_BLUE ; This is either MUSIC_CATCH_EM_BLUE or MUSIC_CATCH_EM_RED. They happen to have the same id in their respective audio
call PlaySong
ld a, [wCurrentStage]
bit 0, a
ret z
callba Func_1c2cb
ld [hFarCallTempA], a
ld a, $4
ld hl, Func_10184
call BankSwitch
ld a, [hGameBoyColorFlag]
and a
callba nz, Func_102bc
ret
Func_109fc: ; 0x109fc
call ResetIndicatorStates
call OpenSlotCave
callba SetLeftAndRightAlleyArrowIndicatorStates_BlueField
ld a, [wCurrentStage]
bit 0, a
ret z
callba Func_1c2cb
call Func_10432
callba LoadMapBillboardTileData
ld a, BANK(StageSharedBonusSlotGlowGfx)
ld hl, StageSharedBonusSlotGlowGfx
ld de, vTilesOB tile $1a
ld bc, $0160
call LoadVRAMData
ld a, BANK(StageSharedBonusSlotGlow2Gfx)
ld hl, StageSharedBonusSlotGlow2Gfx
ld de, vTilesOB tile $38
ld bc, $0020
call LoadVRAMData
ld hl, BlankSaverSpaceTileDataBlueField
ld a, BANK(BlankSaverSpaceTileDataBlueField)
call QueueGraphicsToLoad
ld a, [wPreviousNumPokeballs]
callba LoadPokeballsGraphics_RedField
ld hl, Data_10a88
ld a, BANK(Data_10a88)
call QueueGraphicsToLoad
ret
BlankSaverSpaceTileDataBlueField:
db 3
dw BlankSaverSpaceTileDataBlueField1
dw BlankSaverSpaceTileDataBlueField2
dw BlankSaverSpaceTileDataBlueField3
BlankSaverSpaceTileDataBlueField1:
dw Func_11d2
db $20, $02
dw vTilesSH tile $2e
dw StageBlueFieldBottomBaseGameBoyColorGfx + $2e0
db Bank(StageBlueFieldBottomBaseGameBoyColorGfx)
db $00
BlankSaverSpaceTileDataBlueField2:
dw Func_11d2
db $20, $02
dw vTilesSH tile $30
dw StageBlueFieldBottomBaseGameBoyColorGfx + $300
db Bank(StageBlueFieldBottomBaseGameBoyColorGfx)
db $00
BlankSaverSpaceTileDataBlueField3:
dw Func_11d2
db $20, $02
dw vTilesSH tile $32
dw StageBlueFieldBottomBaseGameBoyColorGfx + $320
db Bank(StageBlueFieldBottomBaseGameBoyColorGfx)
db $00
Data_10a88:
db 1
dw Data_10a8b
Data_10a8b:
dw Func_11d2
db $20, $02
dw vTilesSH tile $2e
dw CaughtPokeballGfx
db Bank(CaughtPokeballGfx)
db $00
|