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
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
|
Func_10000: ; 10000 (4:4000)
ld a, $0
ld [wTileMapFill], a
call EmptyScreen
call LoadSymbolsFont
lb de, $30, $7f
call SetupText
call Set_OBJ_8x8
xor a
ldh [hSCX], a
ldh [hSCY], a
ld a, [wLCDC]
bit LCDC_ENABLE_F, a
jr nz, .asm_10025
xor a
ldh [rSCX], a
ldh [rSCY], a
.asm_10025
call Func_1288c
call ZeroObjectPositions
ld a, $1
ld [wVBlankOAMCopyToggle], a
ret
; saves all pals to SRAM, then fills them with white.
; after flushing, it loads back the saved pals from SRAM.
FlashWhiteScreen: ; 10031 (4:4031)
ldh a, [hBankSRAM]
push af
ld a, BANK("SRAM1")
call BankswitchSRAM
call CopyPalsToSRAMBuffer
call DisableSRAM
call Func_10b28
call FlushAllPalettes
call EnableLCD
call DoFrameIfLCDEnabled
call LoadPalsFromSRAMBuffer
call FlushAllPalettes
pop af
call BankswitchSRAM
call DisableSRAM
ret
_PauseMenu_Status: ; 10059 (4:4059)
ld a, [wd291]
push af
call Func_10000
xor a
ld [wMedalScreenYOffeset], a
call LoadCollectedMedalTilemaps
lb de, 0, 0
lb bc, 20, 8
call DrawRegularTextBox
ld hl, StatusScreenLabels
call Func_111b3
ld bc, $101
call Func_1029a
ld bc, $c04
call Func_1024a
ld bc, $d06
call Func_101cd
call FlashWhiteScreen
ld a, $0b
call Func_12863
pop af
ld [wd291], a
ret
StatusScreenLabels: ; 10095 (4:4095)
db 7, 2
tx PlayerStatusNameText
db 7, 4
tx PlayerStatusAlbumText
db 7, 6
tx PlayerStatusPlayTimeText
db $ff
_PauseMenu_Diary: ; 100a2 (4:40a2)
ld a, [wd291]
push af
call Func_10000
lb de, 0, 0
lb bc, 20, 12
call DrawRegularTextBox
ld hl, Unknown_100f7
call Func_111b3
ld bc, $103
call Func_1029a
ld bc, $c08
call Func_1024a
ld bc, $d0a
call Func_101cd
lb bc, 16, 6
call Func_1027c
call FlashWhiteScreen
ldtx hl, PlayerDiarySaveQuestionText
call YesOrNoMenuWithText_SetCursorToYes
jr c, .asm_100ec
farcall BackupPlayerPosition
call SaveAndBackupData
ld a, SFX_56
call PlaySFX
ldtx hl, PlayerDiarySaveConfirmText
jr .asm_100ef
.asm_100ec
ldtx hl, PlayerDiarySaveCancelText
.asm_100ef
call PrintScrollableText_NoTextBoxLabel
pop af
ld [wd291], a
ret
Unknown_100f7: ; 100f7 (4:40f7)
db 5, 1
tx PlayerDiaryTitleText
db 7, 4
tx PlayerStatusNameText
db 7, 6
tx PlayerDiaryMedalsWonText
db 7, 8
tx PlayerStatusAlbumText
db 7, 10
tx PlayerStatusPlayTimeText
db $ff
LoadCollectedMedalTilemaps: ; 1010c (4:410c)
xor a
ld [wd291], a
lb de, 0, 8
ld a, [wMedalScreenYOffeset]
add e
ld e, a
lb bc, 20, 10
call DrawRegularTextBox
lb de, 6, 9
ld a, [wMedalScreenYOffeset]
add e
ld e, a
call AdjustCoordinatesForBGScroll
call InitTextPrinting
ldtx hl, PlayerStatusMedalsTitleText
call PrintTextNoDelay
ld hl, Unknown_1017f
ld a, EVENT_MEDAL_FLAGS
farcall GetEventValue
or a
jr z, .asm_1017e
ld c, NUM_MEDALS
.asm_10140
push bc
push hl
push af
bit 7, a
jr z, .asm_10157
ld b, [hl]
inc hl
ld a, [wMedalScreenYOffeset]
add [hl]
ld c, a
inc hl
ld a, [hli]
ld [wCurTilemap], a
farcall LoadTilemap_ToVRAM
.asm_10157
pop af
rlca
pop hl
ld bc, $3
add hl, bc
pop bc
dec c
jr nz, .asm_10140
ld a, $80
ld [wd4ca], a
xor a
ld [wd4cb], a
farcall LoadTilesetGfx
xor a
ld [wd4ca], a
ld a, $01
ld [wd4cb], a
ld a, $76
farcall SetBGPAndLoadedPal
.asm_1017e
ret
Unknown_1017f: ; 1017f (4:417f)
; x, y, tilemap
db 1, 10, TILEMAP_GRASS_MEDAL
db 6, 10, TILEMAP_SCIENCE_MEDAL
db 11, 10, TILEMAP_FIRE_MEDAL
db 16, 10, TILEMAP_WATER_MEDAL
db 1, 14, TILEMAP_LIGHTNING_MEDAL
db 6, 14, TILEMAP_PSYCHIC_MEDAL
db 11, 14, TILEMAP_ROCK_MEDAL
db 16, 14, TILEMAP_FIGHTING_MEDAL
Func_10197: ; 10197 (4:4197)
xor a
ld [wd291], a
ld hl, Unknown_1017f
ld a, [wd115]
ld c, a
add a
add c
ld c, a
ld b, $00
add hl, bc
ld b, [hl]
inc hl
ld a, [wMedalScreenYOffeset]
add [hl]
ld c, a
ld a, [wd116]
bit 4, a
jr z, .asm_101c3
xor a
ld e, c
ld d, b
lb bc, 3, 3
lb hl, 0, 0
call FillRectangle
ret
.asm_101c3
inc hl
ld a, [hl]
ld [wCurTilemap], a
farcall LoadTilemap_ToVRAM
ret
Func_101cd: ; 101cd (4:41cd)
ld a, [wPlayTimeCounter + 2]
ld [wPlayTimeHourMinutes], a
ld a, [wPlayTimeCounter + 3]
ld [wPlayTimeHourMinutes + 1], a
ld a, [wPlayTimeCounter + 4]
ld [wPlayTimeHourMinutes + 2], a
; fallthrough
Func_101df: ; 101df (4:41df)
push bc
ld a, [wPlayTimeHourMinutes + 1]
ld l, a
ld a, [wPlayTimeHourMinutes + 2]
ld h, a
call Func_10217
pop bc
push bc
call BCCoordToBGMap0Address
ld hl, wd4b4
ld b, $03
call SafeCopyDataHLtoDE
ld a, [wPlayTimeHourMinutes]
add 100
ld l, a
ld a, 0
adc 0
ld h, a
call Func_10217
pop bc
ld a, b
add $04
ld b, a
call BCCoordToBGMap0Address
ld hl, wd4b4 + 1
ld b, $02
call SafeCopyDataHLtoDE
ret
Func_10217: ; 10217 (4:4217)
ld de, wd4b4
ld bc, -100
call Func_1023b
ld bc, -10
call Func_1023b
ld a, l
add $20
ld [de], a
ld hl, wd4b4
ld c, $02
.asm_1022f
ld a, [hl]
cp $20
jr nz, .asm_1023a
ld [hl], $00
inc hl
dec c
jr nz, .asm_1022f
.asm_1023a
ret
Func_1023b: ; 1023b (4:423b)
ld a, $1f
.asm_1023d
inc a
add hl, bc
jr c, .asm_1023d
ld [de], a
inc de
ld a, l
sub c
ld l, a
ld a, h
sbc b
ld h, a
ret
Func_1024a: ; 1024a (4:424a)
push bc
call GetCardAlbumProgress
pop bc
; fallthrough
Func_1024f: ; 1024f (4:424f)
push bc
push de
push bc
ld l, d
ld h, $00
call Func_10217
pop bc
call BCCoordToBGMap0Address
ld hl, wd4b4
ld b, $03
call SafeCopyDataHLtoDE
pop de
ld l, e
ld h, $00
call Func_10217
pop bc
ld a, b
add $04
ld b, a
call BCCoordToBGMap0Address
ld hl, wd4b4
ld b, $03
call SafeCopyDataHLtoDE
ret
Func_1027c: ; 1027c (4:427c)
push bc
farcall TryGiveMedalPCPacks
ld a, EVENT_MEDAL_COUNT
farcall GetEventValue
ld l, a
ld h, $00
call Func_10217
pop bc
call BCCoordToBGMap0Address
ld hl, wd4b4 + 2
ld b, $01
call SafeCopyDataHLtoDE
ret
Func_1029a: ; 1029a (4:429a)
call DrawPlayerPortrait
ret
Medal_1029e: ; 1029e (4:429e)
sub $8
ld c, a
ld [wd115], a
ld a, [wd291]
push af
push bc
call PauseSong
ld a, MUSIC_STOP
call PlaySong
farcall SetMainSGBBorder
call DisableLCD
call Func_10000
ld a, -6
ld [wMedalScreenYOffeset], a
call LoadCollectedMedalTilemaps
pop bc
ld a, c
add a
ld c, a
ld b, $0
ld hl, MasterMedalNames
add hl, bc
ld a, [hli]
ld [wTxRam2], a
ld a, [hl]
ld [wTxRam2 + 1], a
call FlashWhiteScreen
ld a, MUSIC_MEDAL
call PlaySong
ld a, $ff
ld [wd116], a
.asm_102e2
call DoFrameIfLCDEnabled
ld a, [wd116]
inc a
ld [wd116], a
and $f
jr nz, .asm_102e2
call Func_10197
ld a, [wd116]
cp $e0
jr nz, .asm_102e2
ldtx hl, WonTheMedalText
call PrintScrollableText_NoTextBoxLabel
call WaitForSongToFinish
call ResumeSong
pop af
ld [wd291], a
ret
MasterMedalNames: ; 1030b (4:430b)
tx GrassClubMapNameText
tx ScienceClubMapNameText
tx FireClubMapNameText
tx WaterClubMapNameText
tx LightningClubMapNameText
tx PsychicClubMapNameText
tx RockClubMapNameText
tx FightingClubMapNameText
GiveBoosterPack: ; 1031b (4:431b)
ld c, a
ld a, [wd291]
push af
push bc
call DisableLCD
call Func_10000
xor a
ld [wTextBoxFrameType], a
pop bc
push bc
ld b, 0
ld hl, BoosterTypes
add hl, bc
ld a, [hl]
ld c, a
add a
add a
ld c, a
ld hl, BoosterScenesAndNameTexts
add hl, bc
ld a, [hli]
push hl
lb bc, 6, 0
call LoadBoosterGfx
pop hl
ld a, [hli]
ld [wTxRam3], a
xor a
ld [wTxRam3 + 1], a
ld a, [hli]
ld [wTxRam2], a
ld a, [hl]
ld [wTxRam2 + 1], a
call FlashWhiteScreen
call PauseSong
ld a, MUSIC_BOOSTER_PACK
call PlaySong
pop bc
ld a, c
farcall GenerateBoosterPack
ldtx hl, ReceivedBoosterPackText
ld a, [wAnotherBoosterPack]
cp TRUE
jr nz, .first_booster
ldtx hl, AndAnotherBoosterPackText
.first_booster
call PrintScrollableText_NoTextBoxLabel
call WaitForSongToFinish
call ResumeSong
ldtx hl, CheckedCardsInBoosterPackText
call PrintScrollableText_NoTextBoxLabel
call DisableLCD
call Func_1288c
call ZeroObjectPositions
ld a, $1
ld [wVBlankOAMCopyToggle], a
ld a, $4
ld [wTextBoxFrameType], a
farcall OpenBoosterPack
farcall WhiteOutDMGPals
call DoFrameIfLCDEnabled
pop af
ld [wd291], a
ret
BoosterTypes: ; 103a5 (4:43a5)
db BOOSTER_COLOSSEUM ; BOOSTER_COLOSSEUM_NEUTRAL
db BOOSTER_COLOSSEUM ; BOOSTER_COLOSSEUM_GRASS
db BOOSTER_COLOSSEUM ; BOOSTER_COLOSSEUM_FIRE
db BOOSTER_COLOSSEUM ; BOOSTER_COLOSSEUM_WATER
db BOOSTER_COLOSSEUM ; BOOSTER_COLOSSEUM_LIGHTNING
db BOOSTER_COLOSSEUM ; BOOSTER_COLOSSEUM_FIGHTING
db BOOSTER_COLOSSEUM ; BOOSTER_COLOSSEUM_TRAINER
db BOOSTER_EVOLUTION ; BOOSTER_EVOLUTION_NEUTRAL
db BOOSTER_EVOLUTION ; BOOSTER_EVOLUTION_GRASS
db BOOSTER_EVOLUTION ; BOOSTER_EVOLUTION_FIRE
db BOOSTER_EVOLUTION ; BOOSTER_EVOLUTION_WATER
db BOOSTER_EVOLUTION ; BOOSTER_EVOLUTION_FIGHTING
db BOOSTER_EVOLUTION ; BOOSTER_EVOLUTION_PSYCHIC
db BOOSTER_EVOLUTION ; BOOSTER_EVOLUTION_TRAINER
db BOOSTER_MYSTERY ; BOOSTER_MYSTERY_NEUTRAL
db BOOSTER_MYSTERY ; BOOSTER_MYSTERY_GRASS_COLORLESS
db BOOSTER_MYSTERY ; BOOSTER_MYSTERY_WATER_COLORLESS
db BOOSTER_MYSTERY ; BOOSTER_MYSTERY_LIGHTNING_COLORLESS
db BOOSTER_MYSTERY ; BOOSTER_MYSTERY_FIGHTING_COLORLESS
db BOOSTER_MYSTERY ; BOOSTER_MYSTERY_TRAINER_COLORLESS
db BOOSTER_LABORATORY ; BOOSTER_LABORATORY_NEUTRAL
db BOOSTER_LABORATORY ; BOOSTER_LABORATORY_GRASS
db BOOSTER_LABORATORY ; BOOSTER_LABORATORY_WATER
db BOOSTER_LABORATORY ; BOOSTER_LABORATORY_PSYCHIC
db BOOSTER_LABORATORY ; BOOSTER_LABORATORY_TRAINER
db BOOSTER_COLOSSEUM ; BOOSTER_ENERGY_LIGHTNING_FIRE
db BOOSTER_COLOSSEUM ; BOOSTER_ENERGY_WATER_FIGHTING
db BOOSTER_COLOSSEUM ; BOOSTER_ENERGY_GRASS_PSYCHIC
db BOOSTER_COLOSSEUM ; BOOSTER_ENERGY_RANDOM
BoosterScenesAndNameTexts: ; 103c2 (4:43c2)
db SCENE_COLOSSEUM_BOOSTER, SCENE_COLOSSEUM_BOOSTER
tx ColosseumBoosterText
db SCENE_EVOLUTION_BOOSTER, SCENE_EVOLUTION_BOOSTER
tx EvolutionBoosterText
db SCENE_MYSTERY_BOOSTER, SCENE_MYSTERY_BOOSTER
tx MysteryBoosterText
db SCENE_LABORATORY_BOOSTER, SCENE_LABORATORY_BOOSTER
tx LaboratoryBoosterText
_PauseMenu_Exit: ; 103d2 (4:43d2)
ret
Duel_Init: ; 103d3 (4:43d3)
ld a, [wd291]
push af
call DisableLCD
call Func_10000
ld a, $4
ld [wTextBoxFrameType], a
lb de, 0, 12
lb bc, 20, 6
call DrawRegularTextBox
ld a, [wNPCDuelDeckID]
add a
add a
ld c, a
ld b, $0
ld hl, OpponentTitlesAndDeckNames
add hl, bc
ld a, [hli]
ld [wTxRam2], a
ld a, [hli]
ld [wTxRam2 + 1], a
push hl
ld a, [wOpponentName]
ld [wTxRam2_b], a
ld a, [wOpponentName + 1]
ld [wTxRam2_b + 1], a
ld hl, OpponentTitleAndNameTextCoords
call Func_111b3 ; LoadDuelistName
pop hl
ld a, [hli]
ld [wTxRam2], a
ld c, a
ld a, [hli]
ld [wTxRam2 + 1], a
or c
jr z, .asm_10425
ld hl, OpponentDeckNameTextCoords
call Func_111b3 ; LoadDeckName
.asm_10425
lb bc, 7, 3
ld a, [wOpponentPortrait]
call Func_3e2a ; LoadDuelistPortrait
ld a, [wMatchStartTheme]
call PlaySong
call FlashWhiteScreen
call DoFrameIfLCDEnabled
lb bc, $2f, $1d ; cursor tile, tile behind cursor
lb de, 18, 17 ; x, y
call SetCursorParametersForTextBox
call WaitForButtonAorB
call WaitForSongToFinish
call Func_10ab4 ; fade out
pop af
ld [wd291], a
ret
OpponentTitleAndNameTextCoords: ; 10451 (4:4451)
db 1, 14
tx OpponentTitleAndNameText
db $ff
OpponentDeckNameTextCoords: ; 10456 (4:4456)
db 1, 16
tx OpponentDeckNameText
db $ff
OpponentTitlesAndDeckNames: ; 1045b (4:445b)
tx TechText
tx SamsPracticeDeckName
tx EmptyText
dw NULL
tx TechText
tx SamsPracticeDeckName
tx EmptyText
dw NULL
tx EmptyText
dw NULL
tx EmptyText
dw NULL
tx EmptyText
dw NULL
tx EmptyText
dw NULL
tx EmptyText
dw NULL
tx TechText
tx LightningAndFireDeckName
tx TechText
tx WaterAndFightingDeckName
tx TechText
tx GrassAndPsychicDeckName
tx GrandMasterText
tx LegendaryMoltresDeckName
tx GrandMasterText
tx LegendaryZapdosDeckName
tx GrandMasterText
tx LegendaryArticunoDeckName
tx GrandMasterText
tx LegendaryDragoniteDeckName
tx FightingClubMasterText
tx FirstStrikeDeckName
tx RockClubMasterText
tx RockCrusherDeckName
tx WaterClubMasterText
tx GoGoRainDanceDeckName
tx LightningClubMasterText
tx ZappingSelfdestructDeckName
tx GrassClubMasterText
tx FlowerPowerDeckName
tx PsychicClubMasterText
tx StrangePsyshockDeckName
tx ScienceClubMasterText
tx WondersofScienceDeckName
tx FireClubMasterText
tx FireChargeDeckName
tx EmptyText
tx ImRonaldDeckName
tx EmptyText
tx PowerfulRonaldDeckName
tx EmptyText
tx InvincibleRonaldDeckName
tx EmptyText
tx LegendaryRonaldDeckName
tx FightingClubMemberText
tx MusclesforBrainsDeckName
tx FightingClubMemberText
tx HeatedBattleDeckName
tx FightingClubMemberText
tx LovetoBattleDeckName
tx RockClubMemberText
tx ExcavationDeckName
tx RockClubMemberText
tx BlisteringPokemonDeckName
tx RockClubMemberText
tx HardPokemonDeckName
tx WaterClubMemberText
tx WaterfrontPokemonDeckName
tx WaterClubMemberText
tx LonelyFriendsDeckName
tx WaterClubMemberText
tx SoundoftheWavesDeckName
tx LightningClubMemberText
tx PikachuDeckName
tx LightningClubMemberText
tx BoomBoomSelfdestructDeckName
tx LightningClubMemberText
tx PowerGeneratorDeckName
tx GrassClubMemberText
tx EtceteraDeckName
tx GrassClubMemberText
tx FlowerGardenDeckName
tx GrassClubMemberText
tx KaleidoscopeDeckName
tx PsychicClubMemberText
tx GhostDeckName
tx PsychicClubMemberText
tx NapTimeDeckName
tx PsychicClubMemberText
tx StrangePowerDeckName
tx ScienceClubMemberText
tx FlyinPokemonDeckName
tx ScienceClubMemberText
tx LovelyNidoranDeckName
tx ScienceClubMemberText
tx PoisonDeckName
tx FireClubMemberText
tx AngerDeckName
tx FireClubMemberText
tx FlamethrowerDeckName
tx FireClubMemberText
tx ReshuffleDeckName
tx StrangeLifeformText
tx ImakuniDeckName
_PCMenu_Glossary: ; 1052f (4:452f)
ld a, [wd291]
push af
call Func_10000
lb de, $30, $ff
call SetupText
call FlashWhiteScreen
farcall OpenGlossaryScreen
pop af
ld [wd291], a
ret
_PauseMenu_Config: ; 10548 (4:4548)
ld a, [wd291]
push af
ld a, [wLineSeparation]
push af
xor a
ld [wConfigExitSettingsCursorPos], a
ld a, 1
ld [wLineSeparation], a
call Func_10000
lb de, 0, 3
lb bc, 20, 5
call DrawRegularTextBox
lb de, 0, 9
lb bc, 20, 5
call DrawRegularTextBox
ld hl, Unknown_105bc
call Func_111b3
call Func_105cd
ld a, 0
call ShowRighArrowCursor
ld a, 1
call ShowRighArrowCursor
xor a
ld [wCursorBlinkTimer], a
call FlashWhiteScreen
.asm_10588
call DoFrameIfLCDEnabled
ld a, [wConfigCursorYPos]
call Func_10649
ld hl, wCursorBlinkTimer
inc [hl]
call ConfigScreenHandleDPadInput
ldh a, [hKeysPressed]
and B_BUTTON | START
jr nz, .asm_105ab
ld a, [wConfigCursorYPos]
cp $02
jr nz, .asm_10588
ldh a, [hKeysPressed]
and A_BUTTON
jr z, .asm_10588
.asm_105ab
ld a, SFX_02
call PlaySFX
call Func_10606
pop af
ld [wLineSeparation], a
pop af
ld [wd291], a
ret
Unknown_105bc: ; 105bc (4:45bc)
db 1, 1
tx ConfigMenuTitleText
db 1, 4
tx ConfigMenuMessageSpeedText
db 1, 10
tx ConfigMenuDuelAnimationText
db 1, 16
tx ConfigMenuExitText
db $ff
Func_105cd: ; 105cd (4:45cd)
call EnableSRAM
ld c, $00
ld hl, Unknown_10644
.loop
ld a, [sTextSpeed]
cp [hl]
jr nc, .match
inc hl
inc c
ld a, c
cp $04
jr c, .loop
.match
ld a, c
ld [wConfigMessageSpeedCursorPos], a
ld a, [sSkipDelayAllowed]
and $01
rlca
ld c, a
ld a, [wAnimationsDisabled]
and $01
or c
ld c, a
ld b, $00
ld hl, Unknown_10602
add hl, bc
ld a, [hl]
ld [wConfigDuelAnimationCursorPos], a
call DisableSRAM
ret
; indexes into Unknown_1063c
; $00: show all
; $01: skip some
; $02: none
Unknown_10602: ; 10602 (4:4602)
db $00 ; skip delay allowed = false, animations disabled = false
db $00 ; skip delay allowed = false, animations disabled = true (unused)
db $01 ; skip delay allowed = true, animations disabled = false
db $02 ; skip delay allowed = true, animations disabled = true
Func_10606: ; 10606 (4:4606)
call EnableSRAM
ld a, [wConfigDuelAnimationCursorPos]
and $03
rlca
ld c, a
ld b, $00
ld hl, Unknown_1063c
add hl, bc
ld a, [hli]
ld [wAnimationsDisabled], a
ld [sAnimationsDisabled], a
ld a, [hl]
ld [sSkipDelayAllowed], a
call DisableSRAM
ld a, [wConfigMessageSpeedCursorPos]
ld c, a
ld b, $00
ld hl, Unknown_10644
add hl, bc
call EnableSRAM
ld a, [hl]
ld [sTextSpeed], a
ld [wTextSpeed], a
call DisableSRAM
ret
Unknown_1063c: ; 1063c (4:463c)
; animation disabled, skip delay allowed
db FALSE, FALSE ; show all
db FALSE, TRUE ; skip some
db TRUE, TRUE ; none
db FALSE, FALSE ; unused
; text printing delay
Unknown_10644: ; 10644 (4:4644)
; slow to fast
db 6, 4, 2, 1, 0
Func_10649: ; 10649 (4:4649)
push af
ld a, [wCursorBlinkTimer]
and $10
jr z, .asm_10654
pop af
jr HideRighArrowCursor
.asm_10654
pop af
jr ShowRighArrowCursor
ShowRighArrowCursor: ; 10657 (4:4657)
push bc
ld c, a
ld a, SYM_CURSOR_R
call Func_10669
pop bc
ret
HideRighArrowCursor: ; 10660 (4:4660)
push bc
ld c, a
ld a, SYM_SPACE
call Func_10669
pop bc
ret
Func_10669: ; 10669 (4:4669)
push af
sla c
ld b, $00
ld hl, ConfigScreenCursorPositions
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
ld a, [bc]
add a
ld c, a
ld b, $00
add hl, bc
ld a, [hli]
ld b, a
ld a, [hl]
ld c, a
pop af
call WriteByteToBGMap0
ret
ConfigScreenCursorPositions: ; 10688 (4:4688)
dw MessageSpeedCursorPositions
dw DuelAnimationsCursorPositions
dw ExitSettingsCursorPosition
MessageSpeedCursorPositions: ; 1068e (4:468e)
dw wConfigMessageSpeedCursorPos
db 5, 6
db 7, 6
db 9, 6
db 11, 6
db 13, 6
DuelAnimationsCursorPositions: ; 1069a (4:469a)
dw wConfigDuelAnimationCursorPos
db 1, 12
db 7, 12
db 15, 12
ExitSettingsCursorPosition: ; 106a2 (4:46a2)
dw wConfigExitSettingsCursorPos
db 1, 16
db 0
ConfigScreenHandleDPadInput: ; 106a7 (4:46a7)
ldh a, [hDPadHeld]
and D_PAD
ret z
farcall GetDirectionFromDPad
ld hl, ConfigScreenDPadHandlers
jp JumpToFunctionInTable
ConfigScreenDPadHandlers: ; 106b6 (4:46b6)
dw ConfigScreenDPadUp ; up
dw ConfigScreenDPadRight ; right
dw ConfigScreenDPadDown ; down
dw ConfigScreenDPadLeft ; left
ConfigScreenDPadUp: ; 106be (4:46be)
ld a, -1
jr ConfigScreenDPadDown.up_or_down
ConfigScreenDPadDown: ; 106c2 (4:46c2)
ld a, 1
.up_or_down
push af
ld a, [wConfigCursorYPos]
cp 2
jr z, .hide_cursor
call ShowRighArrowCursor
jr .skip
.hide_cursor
; hide "exit settings" cursor if leaving bottom row
call HideRighArrowCursor
.skip
ld a, [wConfigCursorYPos]
ld b, a
pop af
add b
cp 3
jr c, .valid
jr z, .wrap_min
; wrap max
ld a, 2 ; max
jr .valid
.wrap_min
xor a ; min
.valid
ld [wConfigCursorYPos], a
ld c, a
ld b, 0
ld hl, Unknown_106ff
add hl, bc
ld a, [hl]
ld [wCursorBlinkTimer], a
ld a, [wConfigCursorYPos]
call Func_10649
ld a, SFX_01
call PlaySFX
ret
Unknown_106ff: ; 106ff (4:46ff)
db $18 ; message speed, start hidden
db $18 ; duel animation, start hidden
db $8 ; exit settings, start visible
ConfigScreenDPadRight: ; 10702 (4:4702)
ld a, $01
jr ConfigScreenDPadLeft.left_or_right
ConfigScreenDPadLeft: ; 10706 (4:4706)
ld a, $ff
.left_or_right
push af
ld a, [wConfigCursorYPos]
call HideRighArrowCursor
pop af
call Func_1071e
ld a, [wConfigCursorYPos]
call ShowRighArrowCursor
xor a
ld [wCursorBlinkTimer], a
ret
Func_1071e: ; 1071e (4:471e)
push af
ld a, [wConfigCursorYPos]
ld c, a
add a
add c
ld c, a
ld b, $00
ld hl, Unknown_1074d
add hl, bc
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld c, [hl]
ld a, [de]
ld b, a
pop af
add b
cp c
jr c, .asm_10742
jr z, .asm_10742
cp $80
jr c, .asm_10741
ld a, c
jr .asm_10742
.asm_10741
xor a
.asm_10742
ld [de], a
ld a, c
or a
jr z, .asm_1074c
ld a, SFX_01
call PlaySFX
.asm_1074c
ret
Unknown_1074d: ; 1074d (4:474d)
; x pos variable, max x value
dwb wConfigMessageSpeedCursorPos, 4
dwb wConfigDuelAnimationCursorPos, 2
dwb wConfigExitSettingsCursorPos, 0
Func_10756: ; 10756 (4:4756)
push hl
push bc
xor a
ld [wPCPackSelection], a
ld hl, wPCPacks
ld c, NUM_PC_PACKS
.asm_10761
ld [hli], a
dec c
jr nz, .asm_10761
ld a, $1
call TryGivePCPack
pop bc
pop hl
ret
_PCMenu_ReadMail: ; 1076d (4:476d)
ld a, [wd291]
push af
call Func_10000
lb de, $30, $ff
call SetupText
lb de, 0, 0
lb bc, 20, 12
call DrawRegularTextBox
lb de, 0, 12
lb bc, 20, 6
call DrawRegularTextBox
ld hl, Unknown_107d2
call Func_111b3
call Func_10996
xor a
ld [wCursorBlinkTimer], a
call FlashWhiteScreen
.asm_1079c
call DoFrameIfLCDEnabled
ld a, [wPCPackSelection]
call Func_1097c
call Func_10a05
ld hl, wCursorBlinkTimer
inc [hl]
call PCMailHandleDPadInput
call PCMailHandleAInput
ldh a, [hKeysPressed]
and B_BUTTON
jr z, .asm_1079c
ld a, SFX_03
call PlaySFX
pop af
ld [wd291], a
ret
; unreferenced?
Unknown_107c2: ; 107c2 (4:47c2)
db $01, $00, $00, $4a, $21, $b5, $42, $e0
db $03, $4a, $29, $94, $52, $fF, $7f, $00
Unknown_107d2: ; 107d2 (4:47d2)
db 1, 0
tx Text0359
db 1, 14
tx Text035a
db 0, 20
tx Text035b
db $ff
PCMailHandleDPadInput: ; 107df (4:47df)
ldh a, [hDPadHeld]
and D_PAD
ret z
farcall GetDirectionFromDPad
ld [wPCLastDirectionPressed], a
ld a, [wPCPackSelection]
push af
call Func_10989
.asm_107f2
ld a, [wPCPackSelection]
add a
add a
ld c, a
ld a, [wPCLastDirectionPressed]
add c
ld c, a
ld b, $00
ld hl, PCMailTransitionTable
add hl, bc
ld a, [hl]
ld [wPCPackSelection], a
ld c, a
ld hl, wPCPacks
add hl, bc
ld a, [hl]
or a
jr z, .asm_107f2
pop af
ld c, a
ld a, [wPCPackSelection]
cp c
jr z, .asm_1081d
ld a, SFX_01
call PlaySFX
.asm_1081d
call Func_10985
xor a
ld [wCursorBlinkTimer], a
ret
PCMailTransitionTable: ; 10825 (4:4825)
; up, right, down, left
db $0c, $01, $03, $02 ; mail 1
db $0d, $02, $04, $00 ; mail 2
db $0e, $00, $05, $01 ; mail 3
db $00, $04, $06, $05 ; mail 4
db $01, $05, $07, $03 ; mail 5
db $02, $03, $08, $04 ; mail 6
db $03, $07, $09, $08 ; mail 7
db $04, $08, $0a, $06 ; mail 8
db $05, $06, $0b, $07 ; mail 9
db $06, $0a, $0c, $0b ; mail 10
db $07, $0b, $0d, $09 ; mail 11
db $08, $09, $0e, $0a ; mail 12
db $09, $0d, $00, $0e ; mail 13
db $0a, $0e, $01, $0c ; mail 14
db $0b, $0c, $02, $0d ; mail 15
PCMailHandleAInput: ; 10861 (4:4861)
ldh a, [hKeysPressed]
and A_BUTTON
ret z
ld a, SFX_02
call PlaySFX
call Func_10996
call Func_10985
ld a, [wPCPackSelection]
ld c, a
ld b, $00
ld hl, wPCPacks
add hl, bc
ld a, [hl]
ld [wSelectedPCPack], a
and $7f
ld [hl], a
or a
ret z
add a
add a
ld c, a
ld hl, PCMailTextPages
add hl, bc
ld a, [hli]
push hl
ld h, [hl]
ld l, a
ld a, [wPCPackSelection]
call Func_109ab
call PrintScrollableText_WithTextBoxLabel
call TryOpenPCMailBoosterPack
call Func_10000
lb de, $30, $ff
call SetupText
lb de, 0, 0
lb bc, 20, 12
call DrawRegularTextBox
ld hl, Unknown_107d2
call Func_111b3
call Func_10996
call Func_10985
call FlashWhiteScreen
pop hl
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
or h
jr z, .no_page_two
ld a, [wPCPackSelection]
call Func_109ab
call PrintScrollableText_WithTextBoxLabel
.no_page_two
lb de, 0, 12
lb bc, 20, 6
call DrawRegularTextBox
ld hl, Unknown_107d2
call Func_111b3
call DoFrameIfLCDEnabled
ret
PCMailTextPages: ; 108e0 (4:48e0)
; unused
dw NULL
dw NULL
; mail 1
tx Text0401
tx Text0402
; mail 2
tx Text0403
tx Text0404
; mail 3
tx Text0405
tx Text0406
; mail 4
tx Text0407
tx Text0408
; mail 5
tx Text0409
tx Text040a
; mail 6
tx Text040b
tx Text040c
; mail 7
tx Text040d
tx Text040e
; mail 8
tx Text040f
tx Text0410
; mail 9
tx Text0411
tx Text0412
; mail 10
tx Text0413
dw NULL
; mail 11
tx Text0414
dw NULL
; mail 12
tx Text0415
dw NULL
; mail 13
tx Text0416
dw NULL
; mail 14
tx Text0417
dw NULL
; mail 15
tx Text0418
dw NULL
TryOpenPCMailBoosterPack: ; 10920 (4:4920)
xor a
ld [wAnotherBoosterPack], a
ld a, [wSelectedPCPack]
bit 7, a
jr z, .booster_already_open
and $7f
add a
ld c, a
ld b, $00
ld hl, PCMailBoosterPacks
add hl, bc
ld a, [hli]
push hl
call GiveBoosterPack
ld a, $01
ld [wAnotherBoosterPack], a
pop hl
ld a, [hl]
or a
jr z, .done
call GiveBoosterPack
.done
call DisableLCD
ret
.booster_already_open
call Func_10000
lb de, $30, $ff
call SetupText
ldtx hl, Text0419
call PrintScrollableText_NoTextBoxLabel
jr .done
PCMailBoosterPacks: ; 1095c (4:495c)
db $00, $00 ; unused
db BOOSTER_COLOSSEUM_NEUTRAL, $00 ; mail 1
db BOOSTER_LABORATORY_PSYCHIC, $00 ; mail 2
db BOOSTER_EVOLUTION_GRASS, $00 ; mail 3
db BOOSTER_MYSTERY_LIGHTNING_COLORLESS, $00 ; mail 4
db BOOSTER_EVOLUTION_FIGHTING, $00 ; mail 5
db BOOSTER_COLOSSEUM_FIRE, $00 ; mail 6
db BOOSTER_LABORATORY_PSYCHIC, $00 ; mail 7
db BOOSTER_LABORATORY_PSYCHIC, $00 ; mail 8
db BOOSTER_MYSTERY_WATER_COLORLESS, $00 ; mail 9
db BOOSTER_COLOSSEUM_NEUTRAL, BOOSTER_EVOLUTION_NEUTRAL ; mail 10
db BOOSTER_MYSTERY_NEUTRAL, BOOSTER_LABORATORY_NEUTRAL ; mail 11
db BOOSTER_COLOSSEUM_TRAINER, $00 ; mail 12
db BOOSTER_EVOLUTION_TRAINER, $00 ; mail 13
db BOOSTER_MYSTERY_TRAINER_COLORLESS, $00 ; mail 14
db BOOSTER_LABORATORY_TRAINER, $00 ; mail 15
Func_1097c: ; 1097c (4:497c)
ld a, [wCursorBlinkTimer]
and $10
jr z, Func_10985
jr Func_10989
Func_10985: ; 10985 (4:4985)
ld a, SYM_CURSOR_R
jr Func_1098d
Func_10989: ; 10989 (4:4989)
ld a, SYM_SPACE
jr Func_1098d
Func_1098d: ; 1098d (4:498d)
push af
call Func_10a41
pop af
call WriteByteToBGMap0
ret
Func_10996: ; 10996 (4:4996)
ld e, $00
ld hl, wPCPacks
.asm_1099b
ld a, [hl]
or a
jr z, .asm_109a3
ld a, e
call Func_109d7
.asm_109a3
inc hl
inc e
ld a, e
cp $0f
jr c, .asm_1099b
ret
Func_109ab: ; 109ab (4:49ab)
push hl
add a
ld e, a
ld d, $00
ld hl, Unknown_109b9
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
pop hl
ret
Unknown_109b9: ; 109b9 (4:49b9)
tx Text035d
tx Text035e
tx Text035f
tx Text0360
tx Text0361
tx Text0362
tx Text0363
tx Text0364
tx Text0365
tx Text0366
tx Text0367
tx Text0368
tx Text0369
tx Text036a
tx Text036b
Func_109d7: ; 109d7 (4:49d7)
push hl
push bc
push de
push af
call Func_109ab
ld l, e
ld h, d
pop af
call Func_10a2f
ld e, c
ld d, b
call InitTextPrinting
call PrintTextNoDelay
pop de
pop bc
pop hl
ret
Func_109f0: ; 109f0 (4:49f0)
push hl
push bc
push de
call Func_10a2f
ld e, c
ld d, b
call InitTextPrinting
ldtx hl, Text035c
call PrintTextNoDelay
pop de
pop bc
pop hl
ret
Func_10a05: ; 10a05 (4:4a05)
ld e, $00
ld hl, wPCPacks
.asm_10a0a
ld a, [hl]
or a
jr z, .asm_10a27
bit 7, a
jr z, .asm_10a27
ld a, [wCursorBlinkTimer]
and $0c
jr z, .asm_10a23
cp $0c
jr nz, .asm_10a27
ld a, e
call Func_109f0
jr .asm_10a27
.asm_10a23
ld a, e
call Func_109d7
.asm_10a27
inc hl
inc e
ld a, e
cp $0f
jr c, .asm_10a0a
ret
Func_10a2f: ; 10a2f (4:4a2f)
ld c, a
ld a, [wPCPackSelection]
push af
ld a, c
ld [wPCPackSelection], a
call Func_10a41
inc b
pop af
ld [wPCPackSelection], a
ret
Func_10a41: ; 10a41 (4:4a41)
push hl
ld a, [wPCPackSelection]
add a
ld c, a
ld b, $00
ld hl, PCMailCoordinates
add hl, bc
ld a, [hli]
ld b, a
ld c, [hl]
pop hl
ret
PCMailCoordinates: ; 10a52 (4:4a52)
db 1, 2 ; mail 1
db 7, 2 ; mail 2
db 13, 2 ; mail 3
db 1, 4 ; mail 4
db 7, 4 ; mail 5
db 13, 4 ; mail 6
db 1, 6 ; mail 7
db 7, 6 ; mail 8
db 13, 6 ; mail 9
db 1, 8 ; mail 10
db 7, 8 ; mail 11
db 13, 8 ; mail 12
db 1, 10 ; mail 13
db 7, 10 ; mail 14
db 13, 10 ; mail 15
; gives the pc pack described in a
TryGivePCPack: ; 10a70 (4:4a70)
push hl
push bc
push de
ld b, a
ld c, NUM_PC_PACKS
ld hl, wPCPacks
.searchLoop1
ld a, [hli]
and $7f
cp b
jr z, .quit
dec c
jr nz, .searchLoop1
ld c, NUM_PC_PACKS
ld hl, wPCPacks
.findFreeSlotLoop
ld a, [hl]
and $7f
jr z, .foundFreeSlot
inc hl
dec c
jr nz, .findFreeSlotLoop
debug_nop
jr .quit
.foundFreeSlot
ld a, b
or PACK_OPENED ; mark pack as unopened
ld [hl], a
.quit
pop de
pop bc
pop hl
ret
; writes wd293 with byte depending on console
; every entry in the list is $00
Func_10a9b: ; 10a9b (4:4a9b)
push hl
ld a, [wConsole]
add LOW(.data_10ab1)
ld l, a
ld a, HIGH(.data_10ab1)
adc 0
ld h, a
ld a, [hl]
ld [wd293], a
xor a
ld [wd317], a
pop hl
ret
.data_10ab1
db $00 ; CONSOLE_DMG
db $00 ; CONSOLE_SGB
db $00 ; CONSOLE_CGB
Func_10ab4: ; 10ab4 (4:4ab4)
ld a, [wLCDC]
bit 7, a
jr z, .lcd_off
ld a, [wd293]
ld [wd294], a
ld [wd295], a
ld [wd296], a
ld de, PALRGB_WHITE
ld hl, wTempBackgroundPalettesCGB
ld bc, NUM_BACKGROUND_PALETTES palettes
call FillMemoryWithDE
call RestoreFirstColorInOBPals
call FadeScreenToTempPals
call DisableLCD
ret
.lcd_off
ld a, [wd293]
ld [wBGP], a
ld [wOBP0], a
ld [wOBP1], a
ld de, PALRGB_WHITE
ld hl, wBackgroundPalettesCGB
ld bc, NUM_BACKGROUND_PALETTES palettes
call FillMemoryWithDE
call FlushAllPalettes
ret
Func_10af9: ; 10af9 (4:4af9)
call BackupPalsAndSetWhite
call RestoreFirstColorInOBPals
call FlushAllPalettes
call EnableLCD
jp FadeScreenToTempPals
BackupPalsAndSetWhite: ; 10b08 (4:4b08)
ld a, [wBGP]
ld [wd294], a
ld a, [wOBP0]
ld [wd295], a
ld a, [wOBP1]
ld [wd296], a
ld hl, wBackgroundPalettesCGB
ld de, wTempBackgroundPalettesCGB
ld bc, NUM_BACKGROUND_PALETTES palettes + NUM_OBJECT_PALETTES palettes
call CopyDataHLtoDE_SaveRegisters
jr Func_10b28 ; can be fallthrough
; fills wBackgroundPalettesCGB with white pal
Func_10b28: ; 10b28 (4:4b28)
ld a, [wd293]
ld [wBGP], a
ld [wOBP0], a
ld [wOBP1], a
ld de, PALRGB_WHITE
ld hl, wBackgroundPalettesCGB
ld bc, NUM_BACKGROUND_PALETTES palettes
call FillMemoryWithDE
ret
; gets from backup OB pals the first color
; of each pal and writes them in wObjectPalettesCGB
RestoreFirstColorInOBPals: ; 10b41 (4:4b41)
ld hl, wTempObjectPalettesCGB
ld de, wObjectPalettesCGB
ld c, NUM_OBJECT_PALETTES
.loop_pals
push bc
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
ld bc, CGB_PAL_SIZE - 1
add hl, bc
ld a, c
add e
ld e, a
ld a, b
adc d
ld d, a
pop bc
dec c
jr nz, .loop_pals
ret
FadeScreenToTempPals: ; 10b5e (4:4b5e)
ld a, [wVBlankCounter]
push af
ld c, $10
.loop
push bc
ld a, c
and %11
cp 0
call z, Func_10b85
call FadeBGPalIntoTemp3
call FadeOBPalIntoTemp
call FlushAllPalettes
call DoFrameIfLCDEnabled
pop bc
dec c
dec c
jr nz, .loop
pop af
ld b, a
ld a, [wVBlankCounter]
sub b
ret
; does something with wBGP given wd294
; mixes them into a single value?
Func_10b85: ; 10b85 (4:4b85)
push bc
ld c, $03
ld hl, wBGP
ld de, wd294
.asm_10b8e
push bc
ld b, [hl]
ld a, [de]
ld c, a
call .Func_10b9e
ld [hl], a
pop bc
inc de
inc hl
dec c
jr nz, .asm_10b8e
pop bc
ret
.Func_10b9e
push bc
push de
ld e, 4
ld d, $00
.loop
call .Func_10bba
or d
rlca
rlca
ld d, a
rlc b
rlc b
rlc c
rlc c
dec e
jr nz, .loop
ld a, d
pop de
pop bc
ret
; calculates ((b & %11) << 2) | (c & %11)
; that is, %0000xxyy, where x and y are
; the 2 lower bits of b and c respectively
; and outputs the entry from a table given that value
.Func_10bba
push hl
push bc
ld a, %11
and b
add a
add a
ld b, a
ld a, %11
and c
or b
ld c, a
ld b, $00
ld hl, .data_10bd1
add hl, bc
ld a, [hl]
pop bc
pop hl
ret
.data_10bd1
db %00 ; b = %00 | c = %00
db %01 ; b = %00 | c = %01
db %01 ; b = %00 | c = %10
db %01 ; b = %00 | c = %11
db %00 ; b = %01 | c = %00
db %01 ; b = %01 | c = %01
db %10 ; b = %01 | c = %10
db %10 ; b = %01 | c = %11
db %01 ; b = %10 | c = %00
db %01 ; b = %10 | c = %01
db %10 ; b = %10 | c = %10
db %11 ; b = %10 | c = %11
db %10 ; b = %11 | c = %00
db %10 ; b = %11 | c = %01
db %10 ; b = %11 | c = %10
db %11 ; b = %11 | c = %11
FadeOBPalIntoTemp: ; 10be1 (4:4be1)
push bc
ld c, 4 palettes
ld hl, wObjectPalettesCGB
ld de, wTempObjectPalettesCGB
jr FadePalIntoAnother
FadeBGPalIntoTemp1: ; 10bec (4:4bec)
push bc
ld c, 2 palettes
ld hl, wBackgroundPalettesCGB
ld de, wTempBackgroundPalettesCGB
jr FadePalIntoAnother
FadeBGPalIntoTemp2: ; 10bf7 (4:4bf7)
push bc
ld c, 2 palettes
ld hl, wBackgroundPalettesCGB + 4 palettes
ld de, wTempBackgroundPalettesCGB + 4 palettes
jr FadePalIntoAnother
FadeBGPalIntoTemp3: ; 10c02 (4:4c02)
push bc
ld c, 4 palettes
ld hl, wBackgroundPalettesCGB
ld de, wTempBackgroundPalettesCGB
; fallthrough
; hl = input pal to modify
; de = pal to fade into
; c = number of colors to fade
FadePalIntoAnother: ; 10c0b (4:4c0b)
push bc
ld a, [de]
inc de
ld c, a
ld a, [de]
inc de
ld b, a
push de
push bc
ld c, [hl]
inc hl
ld b, [hl]
pop de
call .GetFadedColor
; overwrite with new color
ld [hld], a
ld [hl], c
inc hl
inc hl
pop de
pop bc
dec c
jr nz, FadePalIntoAnother
pop bc
ret
; fade pal bc to de
; output resulting pal in a and c
.GetFadedColor
push hl
ld a, c
cp e
jr nz, .unequal
ld a, b
cp d
jr z, .skip
.unequal
; red
ld a, e
and %11111
ld l, a
ld a, c
and %11111
call .FadeColor
ldh [hffb6], a
; green
ld a, e
and %11100000
ld l, a
ld a, d
and %11
or l
swap a
rrca
ld l, a
ld a, c
and %11100000
ld h, a
ld a, b
and %11
or h
swap a
rrca
call .FadeColor
rlca
swap a
ld h, a
and %11
ldh [hffb7], a
ld a, %11100000
and h
ld h, a
ldh a, [hffb6]
or h
ld h, a
; blue
ld a, d
and %1111100
rrca
rrca
ld l, a
ld a, b
and %1111100
rrca
rrca
call .FadeColor
rlca
rlca
ld b, a
ldh a, [hffb7]
or b
ld c, h
.skip
pop hl
ret
; compares color in a and in l
; if a is smaller/greater than l, then
; increase/decrease its value up to l
; up to a maximum of 4
; a = pal color (red, green or blue)
; l = pal color (red, green or blue)
.FadeColor
cp l
ret z ; same value
jr c, .incr_a
; decr a
dec a
cp l
ret z
dec a
cp l
ret z
dec a
cp l
ret z
dec a
ret
.incr_a
inc a
cp l
ret z
inc a
cp l
ret z
inc a
cp l
ret z
inc a
ret
Func_10c96: ; 10c96 (4:4c96)
ldh a, [hBankSRAM]
push af
push bc
ld a, BANK("SRAM1")
call BankswitchSRAM
call CopyPalsToSRAMBuffer
call Func_10ab4
pop bc
ld a, c
or a
jr nz, .asm_10cb0
call LoadPalsFromSRAMBuffer
call Func_10af9
.asm_10cb0
call EnableLCD
pop af
call BankswitchSRAM
call DisableSRAM
ret
; copies current BG and OP pals,
; wBackgroundPalettesCGB and wObjectPalettesCGB
; to sGfxBuffer2
CopyPalsToSRAMBuffer: ; 10cbb (4:4cbb)
ldh a, [hBankSRAM]
push af
cp BANK("SRAM1")
jr z, .ok
debug_nop
.ok
ld a, BANK("SRAM1")
call BankswitchSRAM
ld hl, sGfxBuffer2
ld a, [wBGP]
ld [hli], a
ld a, [wOBP0]
ld [hli], a
ld a, [wOBP1]
ld [hli], a
ld e, l
ld d, h
ld hl, wBackgroundPalettesCGB
ld bc, NUM_BACKGROUND_PALETTES palettes + NUM_OBJECT_PALETTES palettes
call CopyDataHLtoDE_SaveRegisters
pop af
call BankswitchSRAM
call DisableSRAM
ret
; loads BG and OP pals,
; wBackgroundPalettesCGB and wObjectPalettesCGB
; from sGfxBuffer2
LoadPalsFromSRAMBuffer: ; 10cea (4:4cea)
ldh a, [hBankSRAM]
push af
cp BANK("SRAM1")
jr z, .ok
debug_nop
.ok
ld a, BANK("SRAM1")
call BankswitchSRAM
ld hl, sGfxBuffer2
ld a, [hli]
ld [wBGP], a
ld a, [hli]
ld [wOBP0], a
ld a, [hli]
ld [wOBP1], a
ld de, wBackgroundPalettesCGB
ld bc, NUM_BACKGROUND_PALETTES palettes + NUM_OBJECT_PALETTES palettes
call CopyDataHLtoDE_SaveRegisters
pop af
call BankswitchSRAM
call DisableSRAM
ret
; backs up all palettes
; and writes 4 BG pals with white pal
Func_10d17: ; 10d17 (4:4d17)
ld a, [wBGP]
ld [wd294], a
ld a, [wOBP0]
ld [wd295], a
ld a, [wOBP1]
ld [wd296], a
ld hl, wBackgroundPalettesCGB
ld de, wTempBackgroundPalettesCGB
ld bc, NUM_BACKGROUND_PALETTES palettes + NUM_OBJECT_PALETTES palettes
call CopyDataHLtoDE_SaveRegisters
ld a, [wd293]
ld [wBGP], a
ld de, PALRGB_WHITE
ld hl, wBackgroundPalettesCGB
ld bc, 4 palettes
call FillMemoryWithDE
call FlushAllPalettes
ld a, $10
ld [wd317], a
ret
Func_10d50: ; 10d50 (4:4d50)
ld a, [wd293]
ld [wd294], a
ld a, [wOBP0]
ld [wd295], a
ld a, [wOBP1]
ld [wd296], a
ld de, PALRGB_WHITE
ld hl, wTempBackgroundPalettesCGB
ld bc, 4 palettes
call FillMemoryWithDE
ld a, $10
ld [wd317], a
ret
; does stuff according to bottom 2 bits from wd317:
; - if equal to %01, modify wBGP
; - if bottom bit not set, fade BG pals 0 and 1
; - if bottom bit is set, fade BG pals 4 and 5
; and Flush Palettes
; then decrements wd317
; does nothing if wd317 is 0
Func_10d74: ; 10d74 (4:4d74)
ld a, [wd317]
or a
ret z
and %11
ld c, a
cp $1
call z, Func_10b85
bit 0, c
call z, FadeBGPalIntoTemp1
bit 0, c
call nz, FadeBGPalIntoTemp2
bit 0, c
call nz, FlushAllPalettes
ld a, [wd317]
dec a
ld [wd317], a
ret
Unknown_10d98: ; 10d98 (4:4d98)
db 12, 0 ; start menu coords
db 8, 14 ; start menu text box dimensions
db 14, 2 ; text alignment for InitTextPrinting
tx PauseMenuOptionsText
db $ff
db 13, 2 ; cursor x, cursor y
db 2 ; y displacement between items
db 6 ; number of items
db SYM_CURSOR_R ; cursor tile number
db SYM_SPACE ; tile behind cursor
dw NULL ; function pointer if non-0
Unknown_10da9: ; 10da9 (4:4da9)
db 10, 0 ; start menu coords
db 10, 12 ; start menu text box dimensions
db 12, 2 ; text alignment for InitTextPrinting
tx Text0351
db $ff
db 11, 2 ; cursor x, cursor y
db 2 ; y displacement between items
db 5 ; number of items
db SYM_CURSOR_R ; cursor tile number
db SYM_SPACE ; tile behind cursor
dw NULL ; function pointer if non-0
Func_10dba: ; 10dba (4:4dba)
ld a, $1
farcall Func_c29b
ld a, [wd0ba]
ld hl, Unknown_10e17
farcall InitAndPrintPauseMenu
.asm_10dca
call DoFrameIfLCDEnabled
call HandleMenuInput
jr nc, .asm_10dca
ld a, e
ld [wd0ba], a
ldh a, [hCurMenuItem]
cp e
jr z, .asm_10ddd
ld a, $4
.asm_10ddd
ld [wd10e], a
push af
ld hl, Unknown_10df0
call JumpToFunctionInTable
farcall CloseTextBox
call DoFrameIfLCDEnabled
pop af
ret
Unknown_10df0: ; 10df0 (4:4df0)
dw Func_10dfb
dw Func_10dfb
dw Func_10dfb
dw Func_10dfb
dw Func_10dfa
Func_10dfa: ; 10dfa (4:4dfa)
ret
Func_10dfb: ; 10dfb (4:4dfb)
ld a, [wd10e]
add a
ld c, a
ld b, $00
ld hl, Unknown_10e0f
add hl, bc
ld a, [hli]
ld [wTxRam2], a
ld a, [hl]
ld [wTxRam2 + 1], a
ret
Unknown_10e0f: ; 10e0f (4:4e0f)
tx Text0355
tx Text0356
tx Text0357
tx Text0358
Unknown_10e17: ; 10e17 (4:4e17)
db 4, 0 ; start menu coords
db 16, 12 ; start menu text box dimensions
db 6, 2 ; text alignment for InitTextPrinting
tx Text0354
db $ff
db 5, 2 ; cursor x, cursor y
db 2 ; y displacement between items
db 5 ; number of items
db SYM_CURSOR_R ; cursor tile number
db SYM_SPACE ; tile behind cursor
dw NULL ; function pointer if non-0
; refresh the cursor's position based on the currently selected map
; and refresh the player's position based on the starting map
; but only if the player is not being animated across the overworld
OverworldMap_UpdatePlayerAndCursorSprites: ; 10e28 (4:4e28)
push hl
push bc
push de
ld a, [wOverworldMapCursorSprite]
ld [wWhichSprite], a
ld a, [wOverworldMapSelection]
ld d, 0
ld e, -12
call OverworldMap_SetSpritePosition
ld a, [wOverworldMapPlayerAnimationState]
or a
jr nz, .player_walking
ld a, [wPlayerSpriteIndex]
ld [wWhichSprite], a
ld a, [wOverworldMapStartingPosition]
ld d, 0
ld e, 0
call OverworldMap_SetSpritePosition
.player_walking
pop de
pop bc
pop hl
ret
; if no selection has been made yet, call OverworldMap_HandleKeyPress
; if the player is being animated across the screen, call OverworldMap_UpdatePlayerWalkingAnimation
; if the player has finished walking, call OverworldMap_LoadSelectedMap
OverworldMap_Update: ; 10e55 (4:4e55)
ld a, [wPlayerSpriteIndex]
ld [wWhichSprite], a
ld a, [wOverworldMapPlayerAnimationState]
or a
jr nz, .player_walking
call OverworldMap_HandleKeyPress
ret
.player_walking
cp 2
jr z, .player_finished_walking
call OverworldMap_UpdatePlayerWalkingAnimation
ret
.player_finished_walking
call OverworldMap_LoadSelectedMap
ret
; update the map selection if the DPad is pressed
; or finalize the selection if the A button is pressed
OverworldMap_HandleKeyPress: ; 10e71 (4:4e71)
ldh a, [hKeysPressed]
and D_PAD
jr z, .no_d_pad
farcall GetDirectionFromDPad
ld [wPlayerDirection], a
call OverworldMap_HandleDPad
jr .done
.no_d_pad
ldh a, [hKeysPressed]
and A_BUTTON
jr z, .done
ld a, SFX_02
call PlaySFX
call OverworldMap_UpdateCursorAnimation
call OverworldMap_BeginPlayerMovement
jr .done
.done
ret
; update wOverworldMapSelection based on the pressed direction in wPlayerDirection
OverworldMap_HandleDPad: ; 10e97 (4:4e97)
push hl
pop hl
ld a, [wOverworldMapSelection]
rlca
rlca
ld c, a
ld a, [wPlayerDirection]
add c
ld c, a
ld b, 0
ld hl, OverworldMap_CursorTransitions
add hl, bc
ld a, [hl]
or a
jr z, .no_transition
ld [wOverworldMapSelection], a
call OverworldMap_PrintMapName
ld a, SFX_01
call PlaySFX
.no_transition
pop bc
pop hl
ret
OverworldMap_CursorTransitions: ; 10ebc (4:4ebc)
; unused
db OWMAP_SCIENCE_CLUB ; NORTH
db OWMAP_SCIENCE_CLUB ; EAST
db OWMAP_SCIENCE_CLUB ; SOUTH
db OWMAP_SCIENCE_CLUB ; WEST
; OWMAP_MASON_LABORATORY
db OWMAP_LIGHTNING_CLUB ; NORTH
db OWMAP_FIGHTING_CLUB ; EAST
db $00 ; SOUTH
db $00 ; WEST
; OWMAP_ISHIHARAS_HOUSE
db $00 ; NORTH
db OWMAP_CHALLENGE_HALL ; EAST
db OWMAP_ROCK_CLUB ; SOUTH
db $00 ; WEST
; OWMAP_FIGHTING_CLUB
db OWMAP_LIGHTNING_CLUB ; NORTH
db OWMAP_WATER_CLUB ; EAST
db $00 ; SOUTH
db OWMAP_MASON_LABORATORY ; WEST
; OWMAP_ROCK_CLUB
db OWMAP_ISHIHARAS_HOUSE ; NORTH
db OWMAP_POKEMON_DOME ; EAST
db OWMAP_LIGHTNING_CLUB ; SOUTH
db $00 ; WEST
; OWMAP_WATER_CLUB
db OWMAP_GRASS_CLUB ; NORTH
db $00 ; EAST
db $00 ; SOUTH
db OWMAP_FIGHTING_CLUB ; WEST
; OWMAP_LIGHTNING_CLUB
db OWMAP_ROCK_CLUB ; NORTH
db OWMAP_POKEMON_DOME ; EAST
db OWMAP_FIGHTING_CLUB ; SOUTH
db OWMAP_MASON_LABORATORY ; WEST
; OWMAP_GRASS_CLUB
db OWMAP_SCIENCE_CLUB ; NORTH
db $00 ; EAST
db OWMAP_WATER_CLUB ; SOUTH
db OWMAP_PSYCHIC_CLUB ; WEST
; OWMAP_PSYCHIC_CLUB
db OWMAP_FIRE_CLUB ; NORTH
db OWMAP_SCIENCE_CLUB ; EAST
db OWMAP_GRASS_CLUB ; SOUTH
db OWMAP_POKEMON_DOME ; WEST
; OWMAP_SCIENCE_CLUB
db OWMAP_FIRE_CLUB ; NORTH
db $00 ; EAST
db OWMAP_GRASS_CLUB ; SOUTH
db OWMAP_PSYCHIC_CLUB ; WEST
; OWMAP_FIRE_CLUB
db $00 ; NORTH
db OWMAP_SCIENCE_CLUB ; EAST
db OWMAP_SCIENCE_CLUB ; SOUTH
db OWMAP_PSYCHIC_CLUB ; WEST
; OWMAP_CHALLENGE_HALL
db $00 ; NORTH
db OWMAP_PSYCHIC_CLUB ; EAST
db OWMAP_POKEMON_DOME ; SOUTH
db OWMAP_ISHIHARAS_HOUSE ; WEST
; OWMAP_POKEMON_DOME
db OWMAP_CHALLENGE_HALL ; NORTH
db OWMAP_PSYCHIC_CLUB ; EAST
db OWMAP_FIGHTING_CLUB ; SOUTH
db OWMAP_ROCK_CLUB ; WEST
; set the active sprite (player or cursor) at the appropriate map position
; input:
; a = OWMAP_* value
; d = x offset
; e = y offset
OverworldMap_SetSpritePosition: ; 10ef0 (4:4ef0)
call OverworldMap_GetMapPosition
ld c, SPRITE_ANIM_COORD_X
call GetSpriteAnimBufferProperty
ld a, d
ld [hli], a
ld a, e
ld [hl], a
ret
; input:
; a = OWMAP_* value
; d = x offset
; e = y offset
; output:
; d = x position
; e = y position
OverworldMap_GetMapPosition: ; 10efd (4:4efd)
push hl
push de
rlca
ld e, a
ld d, 0
ld hl, OverworldMap_MapPositions
add hl, de
pop de
ld a, [hli]
add $8
add d
ld d, a
ld a, [hl]
add $10
add e
ld e, a
pop hl
ret
OverworldMap_MapPositions: ; 10f14 (4:4f14)
db $00, $00 ; unused
db $0c, $68 ; OWMAP_MASON_LABORATORY
db $04, $18 ; OWMAP_ISHIHARAS_HOUSE
db $34, $68 ; OWMAP_FIGHTING_CLUB
db $14, $38 ; OWMAP_ROCK_CLUB
db $6c, $64 ; OWMAP_WATER_CLUB
db $24, $50 ; OWMAP_LIGHTNING_CLUB
db $7c, $40 ; OWMAP_GRASS_CLUB
db $5c, $2c ; OWMAP_PSYCHIC_CLUB
db $7c, $20 ; OWMAP_SCIENCE_CLUB
db $6c, $10 ; OWMAP_FIRE_CLUB
db $3c, $20 ; OWMAP_CHALLENGE_HALL
db $44, $44 ; OWMAP_POKEMON_DOME
OverworldMap_PrintMapName: ; 10f2e (4:4f2e)
push hl
push de
lb de, 1, 1
call InitTextPrinting
call OverworldMap_GetOWMapID
rlca
ld e, a
ld d, 0
ld hl, OverworldMapNames
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
call ProcessTextFromID
pop de
pop hl
ret
; returns [wOverworldMapSelection] in a
; or OWMAP_MYSTERY_HOUSE if [wOverworldMapSelection] == OWMAP_ISHIHARAS_HOUSE
; and EVENT_ISHIHARAS_HOUSE_MENTIONED == FALSE
OverworldMap_GetOWMapID: ; 10f4a (4:4f4a)
push bc
ld a, [wOverworldMapSelection]
cp OWMAP_ISHIHARAS_HOUSE
jr nz, .got_map
ld c, a
ld a, EVENT_ISHIHARAS_HOUSE_MENTIONED
farcall GetEventValue
or a
ld a, c
jr nz, .got_map
ld a, OWMAP_MYSTERY_HOUSE
.got_map
pop bc
ret
OverworldMap_LoadSelectedMap: ; 10f61 (4:4f61)
push hl
push bc
ld a, [wOverworldMapSelection]
rlca
rlca
ld c, a
ld b, 0
ld hl, OverworldMapIndexes
add hl, bc
ld a, [hli]
ld [wTempMap], a
ld a, [hli]
ld [wTempPlayerXCoord], a
ld a, [hli]
ld [wTempPlayerYCoord], a
ld a, NORTH
ld [wTempPlayerDirection], a
ld hl, wOverworldTransition
set 4, [hl]
pop bc
pop hl
ret
INCLUDE "data/overworld_indexes.asm"
OverworldMap_InitVolcanoSprite: ; 10fbc (4:4fbc)
ld a, SPRITE_OW_MAP_OAM
farcall CreateSpriteAndAnimBufferEntry
ld c, SPRITE_ANIM_COORD_X
call GetSpriteAnimBufferProperty
ld a, $80
ld [hli], a ; x
ld a, $10
ld [hl], a ; y
ld b, $34 ; non-cgb volcano smoke
ld a, [wConsole]
cp CONSOLE_CGB
jr nz, .not_cgb
ld b, $37 ; cgb volcano smoke
.not_cgb
ld a, b
farcall StartNewSpriteAnimation
ret
OverworldMap_InitCursorSprite: ; 10fde (4:4fde)
ld a, [wOverworldMapSelection]
ld [wOverworldMapStartingPosition], a
xor a
ld [wOverworldMapPlayerAnimationState], a
ld a, SPRITE_OW_MAP_OAM
call CreateSpriteAndAnimBufferEntry
ld a, [wWhichSprite]
ld [wOverworldMapCursorSprite], a
ld b, $35 ; non-cgb overworld map cursor
ld a, [wConsole]
cp CONSOLE_CGB
jr nz, .not_cgb
ld b, $38 ; cgb overworld map cursor
.not_cgb
ld a, b
ld [wOverworldMapCursorAnimation], a
call StartNewSpriteAnimation
ld a, EVENT_MASON_LAB_STATE
farcall GetEventValue
or a
jr nz, .visited_lab
ld c, SPRITE_ANIM_FLAGS
call GetSpriteAnimBufferProperty
set SPRITE_ANIM_FLAG_UNSKIPPABLE, [hl]
.visited_lab
ret
; play animation $36 (non-cgb) or $39 (cgb) to make the cursor blink faster
; after a selection is made
OverworldMap_UpdateCursorAnimation: ; 11016 (4:5016)
ld a, [wOverworldMapCursorSprite]
ld [wWhichSprite], a
ld a, [wOverworldMapCursorAnimation]
inc a
call StartNewSpriteAnimation
ret
; begin walking the player across the overworld
; from wOverworldMapStartingPosition to wOverworldMapSelection
OverworldMap_BeginPlayerMovement: ; 11024 (4:5024)
ld a, SFX_57
call PlaySFX
ld a, [wPlayerSpriteIndex]
ld [wWhichSprite], a
ld c, SPRITE_ANIM_FLAGS
call GetSpriteAnimBufferProperty
set SPRITE_ANIM_FLAG_SPEED, [hl]
; get pointer table for starting map
ld hl, OverworldMap_PlayerMovementPaths
ld a, [wOverworldMapStartingPosition]
dec a
add a
ld c, a
ld b, 0
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
; get path sequence for selected map
ld a, [wOverworldMapSelection]
dec a
add a
ld c, a
ld b, 0
add hl, bc
ld a, [hli]
ld [wOverworldMapPlayerMovementPtr], a
ld a, [hl]
ld [wOverworldMapPlayerMovementPtr + 1], a
ld a, 1
ld [wOverworldMapPlayerAnimationState], a
xor a
ld [wOverworldMapPlayerMovementCounter], a
ret
; update the player walking across the overworld
; either by advancing along the current path
; or determining the next direction to move along the path
OverworldMap_UpdatePlayerWalkingAnimation: ; 11060 (4:5060)
ld a, [wPlayerSpriteIndex]
ld [wWhichSprite], a
ld a, [wOverworldMapPlayerMovementCounter]
or a
jp nz, OverworldMap_ContinuePlayerWalkingAnimation
; get next x,y on the path
ld a, [wOverworldMapPlayerMovementPtr]
ld l, a
ld a, [wOverworldMapPlayerMovementPtr + 1]
ld h, a
ld a, [hli]
ld b, a
ld a, [hli]
ld c, a
and b
cp $ff
jr z, .player_finished_walking
ld a, c
or b
jr nz, .next_point
; point 0,0 means walk straight towards [wOverworldMapSelection]
ld a, [wOverworldMapStartingPosition]
ld e, a
ld a, [wOverworldMapSelection]
cp e
jr z, .player_finished_walking
lb de, 0, 0
call OverworldMap_GetMapPosition
ld b, d
ld c, e
.next_point
ld a, l
ld [wOverworldMapPlayerMovementPtr], a
ld a, h
ld [wOverworldMapPlayerMovementPtr + 1], a
call OverworldMap_InitNextPlayerVelocity
ret
.player_finished_walking
ld a, 2
ld [wOverworldMapPlayerAnimationState], a
ret
; input:
; b = target x position
; c = target y position
OverworldMap_InitNextPlayerVelocity: ; 110a6 (4:50a6)
push hl
push bc
ld c, SPRITE_ANIM_COORD_X
call GetSpriteAnimBufferProperty
pop bc
ld a, b
sub [hl] ; a = target x - current x
ld [wOverworldMapPlayerPathHorizontalMovement], a
ld a, 0
sbc 0
ld [wOverworldMapPlayerPathHorizontalMovement + 1], a
inc hl
ld a, c
sub [hl] ; a = target y - current y
ld [wOverworldMapPlayerPathVerticalMovement], a
ld a, 0
sbc 0
ld [wOverworldMapPlayerPathVerticalMovement + 1], a
ld a, [wOverworldMapPlayerPathHorizontalMovement]
ld b, a
ld a, [wOverworldMapPlayerPathHorizontalMovement + 1]
bit 7, a
jr z, .positive
; absolute value
ld a, [wOverworldMapPlayerPathHorizontalMovement]
cpl
inc a
ld b, a
.positive
ld a, [wOverworldMapPlayerPathVerticalMovement]
ld c, a
ld a, [wOverworldMapPlayerPathVerticalMovement + 1]
bit 7, a
jr z, .positive2
; absolute value
ld a, [wOverworldMapPlayerPathVerticalMovement]
cpl
inc a
ld c, a
.positive2
; if the absolute value of wOverworldMapPlayerPathVerticalMovement is larger than
; the absolute value of wOverworldMapPlayerPathHorizontalMovement, this is dominantly
; a north/south movement. otherswise, an east/west movement
ld a, b
cp c
jr c, .north_south
call OverworldMap_InitPlayerEastWestMovement
jr .done
.north_south
call OverworldMap_InitPlayerNorthSouthMovement
.done
xor a
ld [wOverworldMapPlayerHorizontalSubPixelPosition], a
ld [wOverworldMapPlayerVerticalSubPixelPosition], a
farcall UpdatePlayerSprite
pop hl
ret
; input:
; b = absolute value of horizontal movement distance
; c = absolute value of vertical movement distance
OverworldMap_InitPlayerEastWestMovement: ; 11102 (4:5102)
; use horizontal distance for counter
ld a, b
ld [wOverworldMapPlayerMovementCounter], a
; de = absolute horizontal distance, for later
ld e, a
ld d, 0
; overwrite wOverworldMapPlayerPathHorizontalMovement with either -1.0 or +1.0
; always move east/west by 1 pixel per frame
ld hl, wOverworldMapPlayerPathHorizontalMovement
xor a
ld [hli], a
bit 7, [hl]
jr z, .east
dec a
jr .west
.east
inc a
.west
ld [hl], a
; divide (total vertical distance * $100) by total horizontal distance
ld b, c ; vertical distance in high byte
ld c, 0
call DivideBCbyDE
ld a, [wOverworldMapPlayerPathVerticalMovement + 1]
bit 7, a
jr z, .positive
; restore negative sign
call OverworldMap_NegateBC
.positive
ld a, c
ld [wOverworldMapPlayerPathVerticalMovement], a
ld a, b
ld [wOverworldMapPlayerPathVerticalMovement + 1], a
; set player direction
ld hl, wOverworldMapPlayerPathHorizontalMovement + 1
ld a, EAST
bit 7, [hl]
jr z, .east2
ld a, WEST
.east2
ld [wPlayerDirection], a
ret
; input:
; b = absolute value of horizontal movement distance
; c = absolute value of vertical movement distance
OverworldMap_InitPlayerNorthSouthMovement: ; 1113e (4:513e)
; use vertical distance for counter
ld a, c
ld [wOverworldMapPlayerMovementCounter], a
; de = absolute vertical distance, for later
ld e, a
ld d, 0
; overwrite wOverworldMapPlayerPathVerticalMovement with either -1.0 or +1.0
; always move north/south by 1 pixel per frame
ld hl, wOverworldMapPlayerPathVerticalMovement
xor a
ld [hli], a
bit 7, [hl]
jr z, .south
dec a
jr .north
.south
inc a
.north
ld [hl], a
; divide (total horizontal distance * $100) by total vertical distance
; horizontal distance in high byte
ld c, 0
call DivideBCbyDE
ld a, [wOverworldMapPlayerPathHorizontalMovement + 1]
bit 7, a
jr z, .positive
; restore negative sign
call OverworldMap_NegateBC
.positive
ld a, c
ld [wOverworldMapPlayerPathHorizontalMovement], a
ld a, b
ld [wOverworldMapPlayerPathHorizontalMovement + 1], a
; set player direction
ld hl, wOverworldMapPlayerPathVerticalMovement + 1
ld a, SOUTH
bit 7, [hl]
jr z, .south2
ld a, NORTH
.south2
ld [wPlayerDirection], a
ret
; output:
; bc = bc * -1
OverworldMap_NegateBC: ; 11179 (4:5179)
ld a, c
cpl
add 1
ld c, a
ld a, b
cpl
adc 0
ld b, a
ret
; add the x/y speed to the current sprite position,
; accounting for sub-pixel position
; and decrement [wOverworldMapPlayerMovementCounter]
OverworldMap_ContinuePlayerWalkingAnimation: ; 11184 (4:5184)
ld a, [wOverworldMapPlayerHorizontalSubPixelPosition]
ld d, a
ld a, [wOverworldMapPlayerVerticalSubPixelPosition]
ld e, a
ld c, SPRITE_ANIM_COORD_X
call GetSpriteAnimBufferProperty
ld a, [wOverworldMapPlayerPathHorizontalMovement]
add d
ld d, a
ld a, [wOverworldMapPlayerPathHorizontalMovement + 1]
adc [hl] ; add carry from sub-pixel movement
ld [hl], a
inc hl
ld a, [wOverworldMapPlayerPathVerticalMovement]
add e
ld e, a
ld a, [wOverworldMapPlayerPathVerticalMovement + 1]
adc [hl] ; add carry from sub-pixel movement
ld [hl], a
ld a, d
ld [wOverworldMapPlayerHorizontalSubPixelPosition], a
ld a, e
ld [wOverworldMapPlayerVerticalSubPixelPosition], a
ld hl, wOverworldMapPlayerMovementCounter
dec [hl]
ret
; prints $ff-terminated list of text to text box
; given 2 bytes for text alignment and 2 bytes for text ID
Func_111b3: ; 111b3 (4:51b3)
ldh a, [hffb0]
push af
ld a, $02
ldh [hffb0], a
push hl
.loop_text_print_1
ld d, [hl]
inc hl
bit 7, d
jr nz, .next
inc hl
ld a, [hli]
push hl
ld h, [hl]
ld l, a
call PrintTextNoDelay
pop hl
inc hl
jr .loop_text_print_1
.next
pop hl
pop af
ldh [hffb0], a
.loop_text_print_2
ld d, [hl]
inc hl
bit 7, d
ret nz
ld e, [hl]
inc hl
call AdjustCoordinatesForBGScroll
call InitTextPrinting
ld a, [hli]
push hl
ld h, [hl]
ld l, a
call PrintTextNoDelay
pop hl
inc hl
jr .loop_text_print_2
InitAndPrintPauseMenu: ; 111e9 (4:51e9)
push hl
push bc
push de
push af
ld d, [hl]
inc hl
ld e, [hl]
inc hl
ld b, [hl]
inc hl
ld c, [hl]
inc hl
push hl
call AdjustCoordinatesForBGScroll
farcall Func_c3ca
call DrawRegularTextBox
call DoFrameIfLCDEnabled
pop hl
call Func_111b3
pop af
call InitializeMenuParameters
pop de
pop bc
pop hl
ret
; xors sb800
; this has the effect of invalidating the save data checksum
; which the game interprets as being having no save data
InvalidateSaveData: ; 1120f (4:520f)
push hl
ldh a, [hBankSRAM]
push af
ld a, BANK("SRAM2")
call BankswitchSRAM
ld a, $08
xor $ff
ld [sBackupGeneralSaveData + 0], a
ld a, $00
xor $ff
ld [sBackupGeneralSaveData + 1], a
pop af
call BankswitchSRAM
call DisableSRAM
call EnableSRAM
bank1call DiscardSavedDuelData
call DisableSRAM
pop hl
ret
; saves all data to SRAM, including
; General save data and Album/Deck data
; and backs up in SRAM2
SaveAndBackupData: ; 11238 (4:5238)
push de
ld de, sGeneralSaveData
call SaveGeneralSaveDataFromDE
ld de, sAlbumProgress
call UpdateAlbumProgress
call WriteBackupGeneralSaveData
call WriteBackupCardAndDeckSaveData
pop de
ret
_SaveGeneralSaveData: ; 1124d (4:524d)
push de
call GetReceivedLegendaryCards
ld de, sGeneralSaveData
call SaveGeneralSaveDataFromDE
ld de, sAlbumProgress
call UpdateAlbumProgress
pop de
ret
; de = pointer to general game data in SRAM
SaveGeneralSaveDataFromDE: ; 1125f (4:525f)
push hl
push bc
call EnableSRAM
push de
farcall TryGiveMedalPCPacks
ld [wMedalCount], a
farcall OverworldMap_GetOWMapID
ld [wCurOverworldMap], a
pop de
push de
call CopyGeneralSaveDataToSRAM
pop de
call DisableSRAM
pop bc
pop hl
ret
; writes in de total num of cards collected
; and in (de + 1) total num of cards to collect
; also updates wTotalNumCardsCollected and wTotalNumCardsToCollect
UpdateAlbumProgress: ; 1127f (4:527f)
push hl
push de
push de
call GetCardAlbumProgress
call EnableSRAM
pop hl
ld a, d
ld [wTotalNumCardsCollected], a
ld [hli], a
ld a, e
ld [wTotalNumCardsToCollect], a
ld [hl], a
call DisableSRAM
pop de
pop hl
ret
; save values that are listed in WRAMToSRAMMapper
; from WRAM to SRAM, and calculate its checksum
CopyGeneralSaveDataToSRAM: ; 11299 (4:5299)
push hl
push bc
push de
push de
ld hl, sGeneralSaveDataHeaderEnd - sGeneralSaveData
add hl, de
ld e, l
ld d, h
xor a
ld [wGeneralSaveDataByteCount + 0], a
ld [wGeneralSaveDataByteCount + 1], a
ld [wGeneralSaveDataCheckSum + 0], a
ld [wGeneralSaveDataCheckSum + 1], a
ld hl, WRAMToSRAMMapper
.loop_map
ld a, [hli]
ld [wTempPointer + 0], a
ld c, a
ld a, [hli]
ld [wTempPointer + 1], a
or c
jr z, .done_copy
ld a, [hli]
ld c, a ; number of bytes LO
ld a, [hli]
ld b, a ; number of bytes HI
ld a, [wGeneralSaveDataByteCount + 0]
add c
ld [wGeneralSaveDataByteCount + 0], a
ld a, [wGeneralSaveDataByteCount + 1]
adc b
ld [wGeneralSaveDataByteCount + 1], a
call .CopyBytesToSRAM
inc hl
inc hl
jr .loop_map
.done_copy
pop hl
ld a, $08
ld [hli], a
ld a, $00
ld [hli], a
ld a, [wGeneralSaveDataByteCount + 0]
ld [hli], a
ld a, [wGeneralSaveDataByteCount + 1]
ld [hli], a
ld a, [wGeneralSaveDataCheckSum + 0]
ld [hli], a
ld a, [wGeneralSaveDataCheckSum + 1]
ld [hli], a
pop de
pop bc
pop hl
ret
.CopyBytesToSRAM
push hl
ld a, [wTempPointer + 0]
ld l, a
ld a, [wTempPointer + 1]
ld h, a
.loop_bytes
push bc
ld a, [hli]
ld [de], a
inc de
ld c, a
ld a, [wGeneralSaveDataCheckSum + 0]
add c
ld [wGeneralSaveDataCheckSum + 0], a
ld a, [wGeneralSaveDataCheckSum + 1]
adc 0
ld [wGeneralSaveDataCheckSum + 1], a
pop bc
dec bc
ld a, c
or b
jr nz, .loop_bytes
ld a, l
ld [wTempPointer + 0], a
ld a, h
ld [wTempPointer + 1], a
pop hl
ret
; returns carry if no error
; is found in sBackupGeneralSaveData
ValidateBackupGeneralSaveData: ; 11320 (4:5320)
push de
ldh a, [hBankSRAM]
push af
ld a, BANK(sBackupGeneralSaveData)
call BankswitchSRAM
ld de, sBackupGeneralSaveData
call ValidateGeneralSaveDataFromDE
ld de, sAlbumProgress
call LoadAlbumProgressFromSRAM
pop af
call BankswitchSRAM
call DisableSRAM
pop de
ld a, [wNumSRAMValidationErrors]
cp 1
ret
; returns carry if no error
; is found in sGeneralSaveData
_ValidateGeneralSaveData: ; 11343 (4:5343)
push de
call EnableSRAM
ld de, sGeneralSaveData
call ValidateGeneralSaveDataFromDE
ld de, sAlbumProgress
call LoadAlbumProgressFromSRAM
call DisableSRAM
pop de
ld a, [wNumSRAMValidationErrors]
cp 1
ret
; validates the general game data saved in SRAM
; de = pointer to general game data in SRAM
ValidateGeneralSaveDataFromDE: ; 1135d (4:535d)
push hl
push bc
push de
xor a
ld [wNumSRAMValidationErrors], a
push de
push de
inc de
inc de
ld a, [de]
inc de
ld [wGeneralSaveDataByteCount + 0], a
ld a, [de]
inc de
ld [wGeneralSaveDataByteCount + 1], a
ld a, [de]
inc de
ld [wGeneralSaveDataCheckSum + 0], a
ld a, [de]
inc de
ld [wGeneralSaveDataCheckSum + 1], a
pop de
ld hl, sGeneralSaveDataHeaderEnd - sGeneralSaveData
add hl, de
ld e, l
ld d, h
ld hl, WRAMToSRAMMapper
.loop
ld a, [hli]
ld c, a
ld a, [hli]
or c
jr z, .exit_loop
ld a, [hli]
ld c, a ; number of bytes LO
ld a, [hli]
ld b, a ; number of bytes HI
ld a, [wGeneralSaveDataByteCount + 0]
sub c
ld [wGeneralSaveDataByteCount + 0], a
ld a, [wGeneralSaveDataByteCount + 1]
sbc b
ld [wGeneralSaveDataByteCount + 1], a
; loop all the bytes of this struct
.loop_bytes
push hl
push bc
ld a, [de]
push af
ld c, a
ld a, [wGeneralSaveDataCheckSum + 0]
sub c
ld [wGeneralSaveDataCheckSum + 0], a
ld a, [wGeneralSaveDataCheckSum + 1]
sbc 0
ld [wGeneralSaveDataCheckSum + 1], a
pop af
; check if it's within the specified values
cp [hl] ; min value
jr c, .error
inc hl
cp [hl] ; max value
jr z, .next_byte
jr c, .next_byte
.error
ld a, [wNumSRAMValidationErrors]
inc a
ld [wNumSRAMValidationErrors], a
.next_byte
inc de
pop bc
pop hl
dec bc
ld a, c
or b
jr nz, .loop_bytes
; next mapped struct
inc hl
inc hl
jr .loop
.exit_loop
pop hl
ld a, [hli]
sub $8
ld c, a
ld a, [hl]
sub 0
or c
ld hl, wGeneralSaveDataByteCount
or [hl]
inc hl
or [hl]
ld hl, wGeneralSaveDataCheckSum
or [hl]
inc hl
or [hl]
jr z, .no_header_error
ld hl, wNumSRAMValidationErrors
inc [hl]
.no_header_error
pop de
; copy play time minutes and hours
ld hl, (sPlayTimeCounter + 2) - sGeneralSaveData
add hl, de
ld a, [hli]
ld [wPlayTimeHourMinutes + 0], a
ld a, [hli]
ld [wPlayTimeHourMinutes + 1], a
ld a, [hli]
ld [wPlayTimeHourMinutes + 2], a
; copy medal count and current overworld map
ld hl, sGeneralSaveDataHeaderEnd - sGeneralSaveData
add hl, de
ld a, [hli]
ld [wMedalCount], a
ld a, [hl]
ld [wCurOverworldMap], a
pop bc
pop hl
ret
LoadAlbumProgressFromSRAM: ; 1140a (4:540a)
push de
ld a, [de]
ld [wTotalNumCardsCollected], a
inc de
ld a, [de]
ld [wTotalNumCardsToCollect], a
pop de
ret
; first copies data from backup SRAM to main SRAM
; then loads it to WRAM from main SRAM
LoadBackupSaveData: ; 11416 (4:5416)
push hl
push de
call EnableSRAM
bank1call DiscardSavedDuelData
call DisableSRAM
call LoadBackupGeneralSaveData
call LoadBackupCardAndDeckSaveData
ld de, sGeneralSaveData
call LoadGeneralSaveDataFromDE
pop de
pop hl
ret
_LoadGeneralSaveData: ; 11430 (4:5430)
push de
ld de, sGeneralSaveData
call LoadGeneralSaveDataFromDE
pop de
ret
; de = pointer to save data
LoadGeneralSaveDataFromDE: ; 11439 (4:5439)
push hl
push bc
call EnableSRAM
call .LoadData
call DisableSRAM
pop bc
pop hl
ret
.LoadData
push hl
push bc
push de
ld a, e
add sGeneralSaveDataHeaderEnd - sGeneralSaveData
ld [wTempPointer + 0], a
ld a, d
adc 0
ld [wTempPointer + 1], a
ld hl, WRAMToSRAMMapper
.asm_11459
ld a, [hli]
ld e, a
ld d, [hl]
or d
jr z, .done_copy
inc hl
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
; copy bc bytes from wTempPointer to de
push hl
ld a, [wTempPointer + 0]
ld l, a
ld a, [wTempPointer + 1]
ld h, a
.loop_copy
ld a, [hli]
ld [de], a
inc de
dec bc
ld a, c
or b
jr nz, .loop_copy
ld a, l
ld [wTempPointer + 0], a
ld a, h
ld [wTempPointer + 1], a
pop hl
inc hl
inc hl
jr .asm_11459
.done_copy
call EnableSRAM
ld a, [sAnimationsDisabled]
ld [wAnimationsDisabled], a
ld a, [sTextSpeed]
ld [wTextSpeed], a
call DisableSRAM
pop de
pop bc
pop hl
ret
wram_sram_map: MACRO
dw \1 ; WRAM address
dw \2 ; number of bytes
db \3 ; min allowed value
db \4 ; max allowed value
ENDM
; maps WRAM addresses to SRAM addresses in order
; to save and subsequently retreive them on game load
; also works as a test in order check whether
; the saved values is SRAM are legal, within the given value range
WRAMToSRAMMapper: ; 11498 (4:5498)
; pointer, number of bytes, unknown
wram_sram_map wMedalCount, 1, $00, $ff ; sMedalCount
wram_sram_map wCurOverworldMap, 1, $00, $ff ; sCurOverworldMap
wram_sram_map wPlayTimeCounter + 0, 1, $00, $ff ; sPlayTimeCounter
wram_sram_map wPlayTimeCounter + 1, 1, $00, $ff
wram_sram_map wPlayTimeCounter + 2, 1, $00, $ff
wram_sram_map wPlayTimeCounter + 3, 2, $00, $ff
wram_sram_map wOverworldMapSelection, 1, $00, $ff ; sOverworldMapSelection
wram_sram_map wTempMap, 1, $00, $ff ; sTempMap
wram_sram_map wTempPlayerXCoord, 1, $00, $ff ; sTempPlayerXCoord
wram_sram_map wTempPlayerYCoord, 1, $00, $ff ; sTempPlayerYCoord
wram_sram_map wTempPlayerDirection, 1, $00, $ff ; sTempPlayerDirection
wram_sram_map wd0c2, 1, $00, $ff ; sb814
wram_sram_map wDuelResult, 1, $00, $ff ; sDuelResult
wram_sram_map wNPCDuelist, 1, $00, $ff ; sNPCDuelist
wram_sram_map wChallengeHallNPC, 1, $00, $ff ; sChallengeHallNPC
wram_sram_map wd698, 4, $00, $ff ; sb818
wram_sram_map wOWMapEvents, NUM_MAP_EVENTS, $00, $ff ; sOWMapEvents
wram_sram_map .EmptySRAMSlot, 1, $00, $ff ; sb827
wram_sram_map wd0b8, 1, $00, $ff ; sb828
wram_sram_map wd0b9, 1, $00, $ff ; sb829
wram_sram_map wConfigCursorYPos, 1, $00, $ff ; sb82a
wram_sram_map wd0ba, 1, $00, $ff ; sb82b
wram_sram_map wPCPackSelection, 1, 0, 14 ; sPCPackSelection
wram_sram_map wPCPacks, NUM_PC_PACKS, $00, $ff ; sPCPacks
wram_sram_map wDefaultSong, 1, $00, $ff ; sDefaultSong
wram_sram_map wcad5, 1, $00, $ff ; sb83d
wram_sram_map wRonaldIsInMap, 1, $00, $ff ; sRonaldIsInMap
wram_sram_map wMastersBeatenList, 10, $00, $ff ; sMastersBeatenList
wram_sram_map wd0c5, 1, $00, $ff ; sb849
wram_sram_map wMultichoiceTextboxResult_ChooseDeckToDuelAgainst, 1, $00, $ff ; sMultichoiceTextboxResult_ChooseDeckToDuelAgainst
wram_sram_map wd10e, 1, $00, $ff ; sb84b
wram_sram_map .EmptySRAMSlot, 15, $00, $ff ; sb84c
wram_sram_map .EmptySRAMSlot, 16, $00, $ff ; sb85b
wram_sram_map .EmptySRAMSlot, 16, $00, $ff ; sb86b
wram_sram_map wEventVars, 64, $00, $ff ; sEventVars
dw NULL
; fills an empty SRAM slot with zero
.EmptySRAMSlot: ; 1156c (4:556c)
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
; save the game
; if c is 0, save the player at their current position
; otherwise, save the player in Mason's lab
_SaveGame: ; 1157c (4:557c)
ld a, c
or a
jr nz, .force_mason_lab
farcall BackupPlayerPosition
jr .save
.force_mason_lab
ld a, $2
ld [wTempPlayerXCoord], a
ld a, $4
ld [wTempPlayerYCoord], a
ld a, SOUTH
ld [wTempPlayerDirection], a
ld a, MASON_LABORATORY
ld [wTempMap], a
ld a, OWMAP_MASON_LABORATORY
ld [wOverworldMapSelection], a
.save
call SaveAndBackupData
ret
_AddCardToCollectionAndUpdateAlbumProgress: ; 115a3 (4:55a3)
ld [wCardToAddToCollection], a
push hl
push bc
push de
ldh a, [hBankSRAM]
push af
ld a, BANK(sAlbumProgress)
call BankswitchSRAM
ld a, [wCardToAddToCollection]
call AddCardToCollection
ld de, sAlbumProgress
call UpdateAlbumProgress
pop af
call BankswitchSRAM
call DisableSRAM ; unnecessary
; unintentional? runs the same write operation
; on the same address but on the current SRAM bank
ld a, [wCardToAddToCollection]
call AddCardToCollection
ld de, $b8fe
call UpdateAlbumProgress
pop de
pop bc
pop hl
ret
WriteBackupCardAndDeckSaveData: ; 115d4 (4:55d4)
ld bc, sCardAndDeckSaveDataEnd - sCardAndDeckSaveData
ld hl, sCardCollection
jr WriteDataToBackup
WriteBackupGeneralSaveData: ; 115dc (4:55dc)
ld bc, sGeneralSaveDataEnd - sGeneralSaveData
ld hl, sGeneralSaveData
; fallthrough
; bc = number of bytes to copy to backup
; hl = pointer in SRAM of data to backup
WriteDataToBackup: ; 115e2 (4:55e2)
ldh a, [hBankSRAM]
push af
.loop
xor a ; SRAM0
call BankswitchSRAM
ld a, [hl]
push af
ld a, BANK("SRAM2")
call BankswitchSRAM
pop af
ld [hli], a
dec bc
ld a, b
or c
jr nz, .loop
pop af
call BankswitchSRAM
call DisableSRAM
ret
LoadBackupCardAndDeckSaveData: ; 115ff (4:55ff)
ld bc, sCardAndDeckSaveDataEnd - sCardAndDeckSaveData
ld hl, sCardCollection
jr LoadDataFromBackup
LoadBackupGeneralSaveData: ; 11607 (4:5607)
ld bc, sGeneralSaveDataEnd - sGeneralSaveData
ld hl, sGeneralSaveData
; fallthrough
; bc = number of bytes to load from backup
; hl = pointer in SRAM of backup data
LoadDataFromBackup: ; 1160d (4:560d)
ldh a, [hBankSRAM]
push af
.loop
ld a, BANK("SRAM2")
call BankswitchSRAM
ld a, [hl]
push af
xor a
call BankswitchSRAM
pop af
ld [hli], a
dec bc
ld a, b
or c
jr nz, .loop
pop af
call BankswitchSRAM
call DisableSRAM
ret
INCLUDE "data/map_scripts.asm"
; loads a pointer into hl found on NPCHeaderPointers
GetNPCHeaderPointer: ; 1184a (4:584a)
rlca
add LOW(NPCHeaderPointers)
ld l, a
ld a, HIGH(NPCHeaderPointers)
adc 0
ld h, a
ld a, [hli]
ld h, [hl]
ld l, a
ret
LoadNPCSpriteData: ; 11857 (4:5857)
push hl
push bc
call GetNPCHeaderPointer
ld a, [hli]
ld [wTempNPC], a
ld a, [hli]
ld [wNPCSpriteID], a
ld a, [hli]
ld [wNPCAnim], a
ld a, [hli]
push af
ld a, [hli]
ld [wNPCAnimFlags], a
pop bc
ld a, [wConsole]
cp CONSOLE_CGB
jr nz, .not_cgb
ld a, b
ld [wNPCAnim], a
.not_cgb
pop bc
pop hl
ret
; Loads Name into wCurrentNPCNameTx and gets Script ptr into bc
GetNPCNameAndScript: ; 1187d (4:587d)
push hl
call GetNPCHeaderPointer
ld bc, NPC_DATA_SCRIPT_PTR
add hl, bc
ld c, [hl]
inc hl
ld b, [hl]
inc hl
ld a, [hli]
ld [wCurrentNPCNameTx], a
ld a, [hli]
ld [wCurrentNPCNameTx + 1], a
pop hl
ret
; Sets Dialog Box title to the name of the npc in 'a'
SetNPCDialogName: ; 11893 (4:5893)
push hl
push bc
call GetNPCHeaderPointer
ld bc, NPC_DATA_NAME_TEXT
add hl, bc
ld a, [hli]
ld [wCurrentNPCNameTx], a
ld a, [hli]
ld [wCurrentNPCNameTx + 1], a
pop bc
pop hl
ret
; set the opponent name and portrait for the NPC id in register a
SetNPCOpponentNameAndPortrait: ; 118a7 (4:58a7)
push hl
push bc
call GetNPCHeaderPointer
ld bc, NPC_DATA_NAME_TEXT
add hl, bc
ld a, [hli]
ld [wOpponentName], a
ld a, [hli]
ld [wOpponentName + 1], a
ld a, [hli]
ld [wOpponentPortrait], a
pop bc
pop hl
ret
; set the deck id and duel theme for the NPC id in register a
SetNPCDeckIDAndDuelTheme: ; 118bf (4:58bf)
push hl
push bc
call GetNPCHeaderPointer
ld bc, NPC_DATA_DECK_ID
add hl, bc
ld a, [hli]
ld [wNPCDuelDeckID], a
ld a, [hli]
ld [wDuelTheme], a
pop bc
pop hl
ret
; set the start theme for the NPC id in register a
SetNPCMatchStartTheme: ; 118d3 (4:58d3)
push hl
push bc
push af
call GetNPCHeaderPointer
ld bc, NPC_DATA_MATCH_START_ID
add hl, bc
ld a, [hli]
ld [wMatchStartTheme], a
pop af
cp NPC_RONALD1
jr nz, .not_ronald_final_duel
ld a, [wCurMap]
cp POKEMON_DOME
jr nz, .not_ronald_final_duel
ld a, MUSIC_MATCH_START_3
ld [wMatchStartTheme], a
.not_ronald_final_duel
pop bc
pop hl
ret
INCLUDE "data/npcs.asm"
_GetNPCDuelConfigurations: ; 11f4e (4:5f4e)
push hl
push bc
push de
ld a, [wNPCDuelDeckID]
ld e, a
ld bc, 9 ; size of struct - 1
ld hl, DeckIDDuelConfigurations
.loop_deck_ids
ld a, [hli]
cp -1 ; end of list?
jr z, .done
cp e
jr nz, .next_deck_id
ld a, [hli]
ld [wOpponentPortrait], a
ld a, [hli]
ld [wOpponentName], a
ld a, [hli]
ld [wOpponentName + 1], a
ld a, [hl]
ld [wNPCDuelPrizes], a
scf
jr .done
.next_deck_id
add hl, bc
jr .loop_deck_ids
.done
pop de
pop bc
pop hl
ret
_GetChallengeMachineDuelConfigurations: ; 11f7d (4:5f7d)
push bc
push de
ld a, [wNPCDuelDeckID]
ld e, a
ld bc, 9 ; size of struct - 1
ld hl, DeckIDDuelConfigurations
.loop_deck_ids
ld a, [hli]
cp -1 ; end of list?
jr z, .done
cp e
jr nz, .next_deck_id
push hl
ld a, [hli]
ld [wOpponentPortrait], a
ld a, [hli]
ld [wOpponentName], a
ld a, [hli]
ld [wOpponentName + 1], a
inc hl
ld a, [hli]
ld [wDuelTheme], a
pop hl
dec hl
scf
jr .done
.next_deck_id
add hl, bc
jr .loop_deck_ids
.done
pop de
pop bc
ret
DeckIDDuelConfigurations: ; 11fae (4:5fae)
db SAMS_PRACTICE_DECK_ID ; deck ID
db SAM_PIC ; NPC portrait
tx SamNPCName ; name text ID
db PRIZES_2 ; number of prize cards
db MUSIC_STOP ; theme
dw NULL ; rank
dw NULL ; element
db SAMS_NORMAL_DECK_ID ; deck ID
db SAM_PIC ; NPC portrait
tx SamNPCName ; name text ID
db PRIZES_2 ; number of prize cards
db MUSIC_STOP ; theme
dw NULL ; rank
dw NULL ; element
db LIGHTNING_AND_FIRE_DECK_ID ; deck ID
db AARON_PIC ; NPC portrait
tx AaronNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx TechText ; rank
dw NULL ; element
db WATER_AND_FIGHTING_DECK_ID ; deck ID
db AARON_PIC ; NPC portrait
tx AaronNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx TechText ; rank
dw NULL ; element
db GRASS_AND_PSYCHIC_DECK_ID ; deck ID
db AARON_PIC ; NPC portrait
tx AaronNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx TechText ; rank
dw NULL ; element
db LEGENDARY_MOLTRES_DECK_ID ; deck ID
db COURTNEY_PIC ; NPC portrait
tx CourtneyNPCName ; name text ID
db PRIZES_6 ; number of prize cards
db MUSIC_DUEL_THEME_3 ; theme
tx GrandMasterText ; rank
dw NULL ; element
db LEGENDARY_ZAPDOS_DECK_ID ; deck ID
db STEVE_PIC ; NPC portrait
tx SteveNPCName ; name text ID
db PRIZES_6 ; number of prize cards
db MUSIC_DUEL_THEME_3 ; theme
tx GrandMasterText ; rank
dw NULL ; element
db LEGENDARY_ARTICUNO_DECK_ID ; deck ID
db JACK_PIC ; NPC portrait
tx JackNPCName ; name text ID
db PRIZES_6 ; number of prize cards
db MUSIC_DUEL_THEME_3 ; theme
tx GrandMasterText ; rank
dw NULL ; element
db LEGENDARY_DRAGONITE_DECK_ID ; deck ID
db ROD_PIC ; NPC portrait
tx RodNPCName ; name text ID
db PRIZES_6 ; number of prize cards
db MUSIC_DUEL_THEME_3 ; theme
tx GrandMasterText ; rank
dw NULL ; element
db FIRST_STRIKE_DECK_ID ; deck ID
db MITCH_PIC ; NPC portrait
tx MitchNPCName ; name text ID
db PRIZES_6 ; number of prize cards
db MUSIC_DUEL_THEME_2 ; theme
tx ClubMasterText ; rank
tx ChallengeMachineFightingIconText ; element
db ROCK_CRUSHER_DECK_ID ; deck ID
db GENE_PIC ; NPC portrait
tx GeneNPCName ; name text ID
db PRIZES_6 ; number of prize cards
db MUSIC_DUEL_THEME_2 ; theme
tx ClubMasterText ; rank
tx ChallengeMachineFightingIconText ; element
db GO_GO_RAIN_DANCE_DECK_ID ; deck ID
db AMY_PIC ; NPC portrait
tx AmyNPCName ; name text ID
db PRIZES_6 ; number of prize cards
db MUSIC_DUEL_THEME_2 ; theme
tx ClubMasterText ; rank
tx ChallengeMachineWaterIconText ; element
db ZAPPING_SELFDESTRUCT_DECK_ID ; deck ID
db ISAAC_PIC ; NPC portrait
tx IsaacNPCName ; name text ID
db PRIZES_6 ; number of prize cards
db MUSIC_DUEL_THEME_2 ; theme
tx ClubMasterText ; rank
tx ChallengeMachineLightningIconText ; element
db FLOWER_POWER_DECK_ID ; deck ID
db NIKKI_PIC ; NPC portrait
tx NikkiNPCName ; name text ID
db PRIZES_6 ; number of prize cards
db MUSIC_DUEL_THEME_2 ; theme
tx ClubMasterText ; rank
tx ChallengeMachineGrassIconText ; element
db STRANGE_PSYSHOCK_DECK_ID ; deck ID
db MURRAY_PIC ; NPC portrait
tx MurrayNPCName ; name text ID
db PRIZES_6 ; number of prize cards
db MUSIC_DUEL_THEME_2 ; theme
tx ClubMasterText ; rank
tx ChallengeMachinePsychicIconText ; element
db WONDERS_OF_SCIENCE_DECK_ID ; deck ID
db RICK_PIC ; NPC portrait
tx RickNPCName ; name text ID
db PRIZES_6 ; number of prize cards
db MUSIC_DUEL_THEME_2 ; theme
tx ClubMasterText ; rank
tx ChallengeMachineGrassIconText ; element
db FIRE_CHARGE_DECK_ID ; deck ID
db KEN_PIC ; NPC portrait
tx KenNPCName ; name text ID
db PRIZES_6 ; number of prize cards
db MUSIC_DUEL_THEME_2 ; theme
tx ClubMasterText ; rank
tx ChallengeMachineFireIconText ; element
db IM_RONALD_DECK_ID ; deck ID
db RONALD_PIC ; NPC portrait
tx RonaldNPCName ; name text ID
db PRIZES_6 ; number of prize cards
db MUSIC_STOP ; theme
dw NULL ; rank
dw NULL ; element
db POWERFUL_RONALD_DECK_ID ; deck ID
db RONALD_PIC ; NPC portrait
tx RonaldNPCName ; name text ID
db PRIZES_6 ; number of prize cards
db MUSIC_STOP ; theme
dw NULL ; rank
dw NULL ; element
db INVINCIBLE_RONALD_DECK_ID ; deck ID
db RONALD_PIC ; NPC portrait
tx RonaldNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_STOP ; theme
dw NULL ; rank
dw NULL ; element
db LEGENDARY_RONALD_DECK_ID ; deck ID
db RONALD_PIC ; NPC portrait
tx RonaldNPCName ; name text ID
db PRIZES_6 ; number of prize cards
db MUSIC_STOP ; theme
dw NULL ; rank
dw NULL ; element
db MUSCLES_FOR_BRAINS_DECK_ID ; deck ID
db CHRIS_PIC ; NPC portrait
tx ChrisNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineFightingIconText ; element
db HEATED_BATTLE_DECK_ID ; deck ID
db MICHAEL_PIC ; NPC portrait
tx MichaelNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineFightingIconText ; element
db LOVE_TO_BATTLE_DECK_ID ; deck ID
db JESSICA_PIC ; NPC portrait
tx JessicaNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineFightingIconText ; element
db EXCAVATION_DECK_ID ; deck ID
db RYAN_PIC ; NPC portrait
tx RyanNPCName ; name text ID
db PRIZES_3 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineFightingIconText ; element
db BLISTERING_POKEMON_DECK_ID ; deck ID
db ANDREW_PIC ; NPC portrait
tx AndrewNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineFightingIconText ; element
db HARD_POKEMON_DECK_ID ; deck ID
db MATTHEW_PIC ; NPC portrait
tx MatthewNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineFightingIconText ; element
db WATERFRONT_POKEMON_DECK_ID ; deck ID
db SARA_PIC ; NPC portrait
tx SaraNPCName ; name text ID
db PRIZES_2 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineWaterIconText ; element
db LONELY_FRIENDS_DECK_ID ; deck ID
db AMANDA_PIC ; NPC portrait
tx AmandaNPCName ; name text ID
db PRIZES_3 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineWaterIconText ; element
db SOUND_OF_THE_WAVES_DECK_ID ; deck ID
db JOSHUA_PIC ; NPC portrait
tx JoshuaNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineWaterIconText ; element
db PIKACHU_DECK_ID ; deck ID
db JENNIFER_PIC ; NPC portrait
tx JenniferNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineLightningIconText ; element
db BOOM_BOOM_SELFDESTRUCT_DECK_ID ; deck ID
db NICHOLAS_PIC ; NPC portrait
tx NicholasNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineLightningIconText ; element
db POWER_GENERATOR_DECK_ID ; deck ID
db BRANDON_PIC ; NPC portrait
tx BrandonNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineLightningIconText ; element
db ETCETERA_DECK_ID ; deck ID
db BRITTANY_PIC ; NPC portrait
tx BrittanyNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineGrassIconText ; element
db FLOWER_GARDEN_DECK_ID ; deck ID
db KRISTIN_PIC ; NPC portrait
tx KristinNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineGrassIconText ; element
db KALEIDOSCOPE_DECK_ID ; deck ID
db HEATHER_PIC ; NPC portrait
tx HeatherNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineGrassIconText ; element
db GHOST_DECK_ID ; deck ID
db ROBERT_PIC ; NPC portrait
tx RobertNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachinePsychicIconText ; element
db NAP_TIME_DECK_ID ; deck ID
db DANIEL_PIC ; NPC portrait
tx DanielNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachinePsychicIconText ; element
db STRANGE_POWER_DECK_ID ; deck ID
db STEPHANIE_PIC ; NPC portrait
tx StephanieNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachinePsychicIconText ; element
db FLYIN_POKEMON_DECK_ID ; deck ID
db JOSEPH_PIC ; NPC portrait
tx JosephNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineGrassIconText ; element
db LOVELY_NIDORAN_DECK_ID ; deck ID
db DAVID_PIC ; NPC portrait
tx DavidNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineGrassIconText ; element
db POISON_DECK_ID ; deck ID
db ERIK_PIC ; NPC portrait
tx ErikNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineGrassIconText ; element
db ANGER_DECK_ID ; deck ID
db JOHN_PIC ; NPC portrait
tx JohnNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineFireIconText ; element
db FLAMETHROWER_DECK_ID ; deck ID
db ADAM_PIC ; NPC portrait
tx AdamNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineFireIconText ; element
db RESHUFFLE_DECK_ID ; deck ID
db JONATHAN_PIC ; NPC portrait
tx JonathanNPCName ; name text ID
db PRIZES_4 ; number of prize cards
db MUSIC_DUEL_THEME_1 ; theme
tx ClubMemberText ; rank
tx ChallengeMachineFireIconText ; element
db IMAKUNI_DECK_ID ; deck ID
db IMAKUNI_PIC ; NPC portrait
tx ImakuniNPCName ; name text ID
db PRIZES_6 ; number of prize cards
db MUSIC_IMAKUNI ; theme
tx StrangeLifeformText ; rank
dw NULL ; element
db -1 ; end
OverworldScriptTable: ; 1217b (4:617b)
dw ScriptCommand_EndScript
dw ScriptCommand_CloseAdvancedTextBox
dw ScriptCommand_PrintNPCText
dw ScriptCommand_PrintText
dw ScriptCommand_AskQuestionJump
dw ScriptCommand_StartDuel
dw ScriptCommand_PrintVariableNPCText
dw ScriptCommand_PrintVariableText
dw ScriptCommand_PrintTextQuitFully
dw ScriptCommand_UnloadActiveNPC
dw ScriptCommand_MoveActiveNPCByDirection
dw ScriptCommand_CloseTextBox
dw ScriptCommand_GiveBoosterPacks
dw ScriptCommand_JumpIfCardOwned
dw ScriptCommand_JumpIfCardInCollection
dw ScriptCommand_GiveCard
dw ScriptCommand_TakeCard
dw ScriptCommand_JumpIfAnyEnergyCardsInCollection
dw ScriptCommand_RemoveAllEnergyCardsFromCollection
dw ScriptCommand_JumpIfEnoughCardsOwned
dw ScriptCommand_JumpBasedOnFightingClubPupilStatus
dw ScriptCommand_SetActiveNPCDirection
dw ScriptCommand_PickNextMan1RequestedCard
dw ScriptCommand_LoadMan1RequestedCardIntoTxRamSlot
dw ScriptCommand_JumpIfMan1RequestedCardOwned
dw ScriptCommand_JumpIfMan1RequestedCardInCollection
dw ScriptCommand_RemoveMan1RequestedCardFromCollection
dw ScriptCommand_Jump
dw ScriptCommand_TryGiveMedalPCPacks
dw ScriptCommand_SetPlayerDirection
dw ScriptCommand_MovePlayer
dw ScriptCommand_ShowCardReceivedScreen
dw ScriptCommand_SetDialogNPC
dw ScriptCommand_SetNextNPCAndScript
dw ScriptCommand_SetSpriteAttributes
dw ScriptCommand_SetActiveNPCCoords
dw ScriptCommand_DoFrames
dw ScriptCommand_JumpIfActiveNPCCoordsMatch
dw ScriptCommand_JumpIfPlayerCoordsMatch
dw ScriptCommand_MoveActiveNPC
dw ScriptCommand_GiveOneOfEachTrainerBooster
dw ScriptCommand_JumpIfNPCLoaded
dw ScriptCommand_ShowMedalReceivedScreen
dw ScriptCommand_LoadCurrentMapNameIntoTxRamSlot
dw ScriptCommand_LoadChallengeHallNPCIntoTxRamSlot
dw ScriptCommand_StartChallengeHallDuel
dw ScriptCommand_PrintTextForChallengeCup
dw ScriptCommand_MoveChallengeHallNPC
dw ScriptCommand_UnloadChallengeHallNPC
dw ScriptCommand_SetChallengeHallNPCCoords
dw ScriptCommand_PickChallengeHallOpponent
dw ScriptCommand_OpenMenu
dw ScriptCommand_PickChallengeCupPrizeCard
dw ScriptCommand_QuitScriptFully
dw ScriptCommand_ReplaceMapBlocks
dw ScriptCommand_ChooseDeckToDuelAgainstMultichoice
dw ScriptCommand_OpenDeckMachine
dw ScriptCommand_ChooseStarterDeckMultichoice
dw ScriptCommand_EnterMap
dw ScriptCommand_MoveArbitraryNPC
dw ScriptCommand_PickLegendaryCard
dw ScriptCommand_FlashScreen
dw ScriptCommand_SaveGame
dw ScriptCommand_BattleCenter
dw ScriptCommand_GiftCenter
dw ScriptCommand_PlayCredits
dw ScriptCommand_TryGivePCPack
dw ScriptCommand_nop
dw ScriptCommand_GiveStarterDeck
dw ScriptCommand_WalkPlayerToMasonLaboratory
dw ScriptCommand_OverrideSong
dw ScriptCommand_SetDefaultSong
dw ScriptCommand_PlaySong
dw ScriptCommand_PlaySFX
dw ScriptCommand_PauseSong
dw ScriptCommand_ResumeSong
dw ScriptCommand_PlayDefaultSong
dw ScriptCommand_WaitForSongToFinish
dw ScriptCommand_RecordMasterWin
dw ScriptCommand_AskQuestionJumpDefaultYes
dw ScriptCommand_ShowSamNormalMultichoice
dw ScriptCommand_ShowSamRulesMultichoice
dw ScriptCommand_ChallengeMachine
dw ScriptCommand_EndScript
dw ScriptCommand_EndScript
dw ScriptCommand_EndScript
dw ScriptCommand_EndScript
dw ScriptCommand_EndScript
dw ScriptCommand_SetEventValue
dw ScriptCommand_JumpIfEventZero
dw ScriptCommand_JumpIfEventNonzero
dw ScriptCommand_JumpIfEventEqual
dw ScriptCommand_JumpIfEventNotEqual
dw ScriptCommand_JumpIfEventGreaterOrEqual
dw ScriptCommand_JumpIfEventLessThan
dw ScriptCommand_MaxOutEventValue
dw ScriptCommand_ZeroOutEventValue
dw ScriptCommand_JumpIfEventTrue
dw ScriptCommand_JumpIfEventFalse
dw ScriptCommand_IncrementEventValue
dw ScriptCommand_EndScript
dw ScriptCommand_EndScript
dw ScriptCommand_EndScript
dw ScriptCommand_EndScript
MultichoiceTextbox_ConfigTable_ChooseDeckToDuelAgainst: ; 1224b (4:624b)
db $04, $00 ; x, y to start drawing box
db $10, $08 ; width, height of box
db $06, $02 ; x, y coordinate to start printing next text
tx LightningAndFireDeckChoiceText ; text id to print next
db $06, $04 ; x, y coordinate to start printing next text
tx WaterAndFightingDeckChoiceText ; text id to print next
db $06, $06 ; x, y coordinate to start printing next text
tx GrassAndPsychicDeckChoiceText ; text id to print next
db $ff ; marker byte -- end text entries
db $05, $02 ; cursor starting x, y
db $02 ; number of tiles the cursor moves per toggle
db $03 ; cursor max index
db SYM_CURSOR_R ; cursor image
db SYM_SPACE ; tile behind cursor
dw NULL ; function pointer if non-0
MultichoiceTextbox_ConfigTable_ChooseDeckStarterDeck: ; 12264 (4:6264)
db $04, $00 ; x, y to start drawing box
db $10, $08 ; width, height of box
db $06, $02 ; x, y coordinate to start printing next text
tx CharmanderAndFriendsDeckChoiceText ; text id to print next
db $06, $04 ; x, y coordinate to start printing next text
tx SquirtleAndFriendsDeckChoiceText ; text id to print next
db $06, $06 ; x, y coordinate to start printing next text
tx BulbasaurAndFriendsDeckChoiceText ; text id to print next
db $ff ; marker byte -- end text entries
db $05, $02 ; cursor starting x, y
db $02 ; number of tiles the cursor moves per toggle
db $03 ; cursor max index
db SYM_CURSOR_R ; cursor image
db SYM_SPACE ; tile behind cursor
dw NULL ; function pointer if non-0
SamNormalMultichoice_ConfigurationTable: ; 1227d (4:627d)
db $0a, $00 ; x, y to start drawing box
db $0a, $0a ; width, height of box
db $0c, $02 ; x, y coordinate to start printing next text
tx Text03ff ; text id to print next
db $ff ; marker byte -- end text entries
db $0b, $02 ; cursor starting x, y
db $02 ; number of tiles the cursor moves per toggle
db $04 ; cursor max index
db SYM_CURSOR_R ; cursor image
db SYM_SPACE ; tile behind cursor
dw NULL ; function pointer if non-0
SamRulesMultichoice_ConfigurationTable: ; 1228e (4:628e)
db $06, $00 ; x, y to start drawing box
db $0e, $12 ; width, height of box
db $08, $02 ; x coordinate to start printing text
tx Text0400 ; text id to print next
db $ff ; marker byte -- end text entries
db $07, $02 ; cursor starting x, y
db $02 ; number of tiles the cursor moves per toggle
db $08 ; cursor max index
db SYM_CURSOR_R ; cursor image
db SYM_SPACE ; tile behind cursor
dw NULL ; function pointer if non-0
OverworldMap_PlayerMovementPaths: ; 1229f (4:629f)
dw OverworldMap_MasonLaboratoryPaths
dw OverworldMap_IshiharasHousePaths
dw OverworldMap_FightingClubPaths
dw OverworldMap_RockClubPaths
dw OverworldMap_WaterClubPaths
dw OverworldMap_LightningClubPaths
dw OverworldMap_GrassClubPaths
dw OverworldMap_PsychicClubPaths
dw OverworldMap_ScienceClubPaths
dw OverworldMap_FireClubPaths
dw OverworldMap_ChallengeHallPaths
dw OverworldMap_PokemonDomePaths
OverworldMap_MasonLaboratoryPaths: ; 122b7 (4:62b7)
dw OverworldMap_NoMovement
dw OverworldMap_MasonLaboratoryPathToIshiharasHouse
dw OverworldMap_StraightPath
dw OverworldMap_MasonLaboratoryPathToRockClub
dw OverworldMap_MasonLaboratoryPathToWaterClub
dw OverworldMap_MasonLaboratoryPathToLightningClub
dw OverworldMap_MasonLaboratoryPathToGrassClub
dw OverworldMap_MasonLaboratoryPathToPsychicClub
dw OverworldMap_MasonLaboratoryPathToScienceClub
dw OverworldMap_MasonLaboratoryPathToFireClub
dw OverworldMap_MasonLaboratoryPathToChallengeHall
dw OverworldMap_MasonLaboratoryPathToPokemonDome
OverworldMap_IshiharasHousePaths: ; 122cf (4:62cf)
dw OverworldMap_IshiharasHousePathToMasonLaboratory
dw OverworldMap_NoMovement
dw OverworldMap_IshiharasHousePathToFightingClub
dw OverworldMap_IshiharasHousePathToRockClub
dw OverworldMap_IshiharasHousePathToWaterClub
dw OverworldMap_IshiharasHousePathToLightningClub
dw OverworldMap_IshiharasHousePathToGrassClub
dw OverworldMap_IshiharasHousePathToPsychicClub
dw OverworldMap_IshiharasHousePathToScienceClub
dw OverworldMap_IshiharasHousePathToFireClub
dw OverworldMap_IshiharasHousePathToChallengeHall
dw OverworldMap_IshiharasHousePathToPokemonDome
OverworldMap_FightingClubPaths: ; 122e7 (4:62e7)
dw OverworldMap_StraightPath
dw OverworldMap_FightingClubPathToIshiharasHouse
dw OverworldMap_NoMovement
dw OverworldMap_FightingClubPathToRockClub
dw OverworldMap_FightingClubPathToWaterClub
dw OverworldMap_StraightPath
dw OverworldMap_StraightPath
dw OverworldMap_FightingClubPathToPsychicClub
dw OverworldMap_StraightPath
dw OverworldMap_FightingClubPathToFireClub
dw OverworldMap_FightingClubPathToChallengeHall
dw OverworldMap_StraightPath
OverworldMap_RockClubPaths: ; 122ff (4:62ff)
dw OverworldMap_RockClubPathToMasonLaboratory
dw OverworldMap_RockClubPathToIshiharasHouse
dw OverworldMap_RockClubPathToFightingClub
dw OverworldMap_NoMovement
dw OverworldMap_RockClubPathToWaterClub
dw OverworldMap_StraightPath
dw OverworldMap_RockClubPathToGrassClub
dw OverworldMap_StraightPath
dw OverworldMap_RockClubPathToScienceClub
dw OverworldMap_RockClubPathToFireClub
dw OverworldMap_StraightPath
dw OverworldMap_StraightPath
OverworldMap_WaterClubPaths: ; 12317 (4:6317)
dw OverworldMap_WaterClubPathToMasonLaboratory
dw OverworldMap_WaterClubPathToIshiharasHouse
dw OverworldMap_WaterClubPathToFightingClub
dw OverworldMap_WaterClubPathToRockClub
dw OverworldMap_NoMovement
dw OverworldMap_WaterClubPathToLightningClub
dw OverworldMap_WaterClubPathToGrassClub
dw OverworldMap_WaterClubPathToPsychicClub
dw OverworldMap_WaterClubPathToScienceClub
dw OverworldMap_WaterClubPathToFireClub
dw OverworldMap_WaterClubPathToChallengeHall
dw OverworldMap_WaterClubPathToPokemonDome
OverworldMap_LightningClubPaths: ; 1232f (4:632f)
dw OverworldMap_LightningClubPathToMasonLaboratory
dw OverworldMap_LightningClubPathToIshiharasHouse
dw OverworldMap_StraightPath
dw OverworldMap_StraightPath
dw OverworldMap_LightningClubPathToWaterClub
dw OverworldMap_NoMovement
dw OverworldMap_StraightPath
dw OverworldMap_LightningClubPathToPsychicClub
dw OverworldMap_LightningClubPathToScienceClub
dw OverworldMap_LightningClubPathToFireClub
dw OverworldMap_StraightPath
dw OverworldMap_StraightPath
OverworldMap_GrassClubPaths: ; 12347 (4:6347)
dw OverworldMap_GrassClubPathToMasonLaboratory
dw OverworldMap_GrassClubPathToIshiharasHouse
dw OverworldMap_StraightPath
dw OverworldMap_GrassClubPathToRockClub
dw OverworldMap_GrassClubPathToWaterClub
dw OverworldMap_StraightPath
dw OverworldMap_NoMovement
dw OverworldMap_StraightPath
dw OverworldMap_StraightPath
dw OverworldMap_StraightPath
dw OverworldMap_GrassClubPathToChallengeHall
dw OverworldMap_StraightPath
OverworldMap_PsychicClubPaths: ; 1235f (4:635f)
dw OverworldMap_PsychicClubPathToMasonLaboratory
dw OverworldMap_PsychicClubPathToIshiharasHouse
dw OverworldMap_PsychicClubPathToFightingClub
dw OverworldMap_StraightPath
dw OverworldMap_PsychicClubPathToWaterClub
dw OverworldMap_PsychicClubPathToLightningClub
dw OverworldMap_StraightPath
dw OverworldMap_NoMovement
dw OverworldMap_StraightPath
dw OverworldMap_StraightPath
dw OverworldMap_StraightPath
dw OverworldMap_StraightPath
OverworldMap_ScienceClubPaths: ; 12377 (4:6377)
dw OverworldMap_ScienceClubPathToMasonLaboratory
dw OverworldMap_ScienceClubPathToIshiharasHouse
dw OverworldMap_StraightPath
dw OverworldMap_ScienceClubPathToRockClub
dw OverworldMap_ScienceClubPathToWaterClub
dw OverworldMap_ScienceClubPathToLightningClub
dw OverworldMap_StraightPath
dw OverworldMap_StraightPath
dw OverworldMap_NoMovement
dw OverworldMap_StraightPath
dw OverworldMap_ScienceClubPathToChallengeHall
dw OverworldMap_StraightPath
OverworldMap_FireClubPaths: ; 1238f (4:638f)
dw OverworldMap_FireClubPathToMasonLaboratory
dw OverworldMap_FireClubPathToIshiharasHouse
dw OverworldMap_FireClubPathToFightingClub
dw OverworldMap_FireClubPathToRockClub
dw OverworldMap_FireClubPathToWaterClub
dw OverworldMap_FireClubPathToLightningClub
dw OverworldMap_StraightPath
dw OverworldMap_StraightPath
dw OverworldMap_StraightPath
dw OverworldMap_NoMovement
dw OverworldMap_FireClubPathToChallengeHall
dw OverworldMap_FireClubPathToPokemonDome
OverworldMap_ChallengeHallPaths: ; 123a7 (4:63a7)
dw OverworldMap_ChallengeHallPathToMasonLaboratory
dw OverworldMap_ChallengeHallPathToIshiharasHouse
dw OverworldMap_ChallengeHallPathToFightingClub
dw OverworldMap_StraightPath
dw OverworldMap_ChallengeHallPathToWaterClub
dw OverworldMap_StraightPath
dw OverworldMap_ChallengeHallPathToGrassClub
dw OverworldMap_StraightPath
dw OverworldMap_ChallengeHallPathToScienceClub
dw OverworldMap_ChallengeHallPathToFireClub
dw OverworldMap_NoMovement
dw OverworldMap_StraightPath
OverworldMap_PokemonDomePaths: ; 123bf (4:63bf)
dw OverworldMap_PokemonDomePathToMasonLaboratory
dw OverworldMap_PokemonDomePathToIshiharasHouse
dw OverworldMap_StraightPath
dw OverworldMap_StraightPath
dw OverworldMap_PokemonDomePathToWaterClub
dw OverworldMap_StraightPath
dw OverworldMap_StraightPath
dw OverworldMap_StraightPath
dw OverworldMap_StraightPath
dw OverworldMap_PokemonDomePathToFireClub
dw OverworldMap_StraightPath
dw OverworldMap_NoMovement
OverworldMap_IshiharasHousePathToRockClub: ; 123d7 (4:63d7)
OverworldMap_RockClubPathToIshiharasHouse: ; 123d7 (4:63d7)
db $2c, $28
db $00, $00
db $ff, $ff
OverworldMap_MasonLaboratoryPathToWaterClub: ; 123dd (4:63dd)
db $2c, $78
db $3c, $68
db $5c, $68
db $5c, $7c
db $74, $7c
db $00, $00
db $ff, $ff
OverworldMap_WaterClubPathToMasonLaboratory: ; 123eb (4:63eb)
db $74, $7c
db $5c, $7c
db $5c, $68
db $3c, $68
db $2c, $78
db $00, $00
db $ff, $ff
OverworldMap_IshiharasHousePathToFireClub: ; 123f9 (4:63f9)
db $2c, $28
db $3c, $40
db $5c, $30
db $00, $00
db $ff, $ff
OverworldMap_FireClubPathToIshiharasHouse: ; 12403 (4:6403)
db $5c, $30
db $3c, $40
db $2c, $28
db $00, $00
db $ff, $ff
OverworldMap_MasonLaboratoryPathToIshiharasHouse: ; 1240d (4:640d)
db $2c, $78
db $3c, $68
db $3c, $40
db $2c, $28
db $00, $00
db $ff, $ff
OverworldMap_IshiharasHousePathToMasonLaboratory: ; 12419 (4:6419)
db $2c, $28
db $3c, $40
db $3c, $68
db $2c, $78
db $00, $00
db $ff, $ff
OverworldMap_MasonLaboratoryPathToRockClub: ; 12425 (4:6425)
db $2c, $78
db $3c, $68
db $3c, $48
db $00, $00
db $ff, $ff
OverworldMap_RockClubPathToMasonLaboratory: ; 1242f (4:642f)
db $3c, $48
db $3c, $68
db $2c, $78
db $00, $00
db $ff, $ff
OverworldMap_MasonLaboratoryPathToLightningClub: ; 12439 (4:6439)
OverworldMap_LightningClubPathToMasonLaboratory: ; 12439 (4:6439)
db $2c, $78
db $00, $00
db $ff, $ff
OverworldMap_MasonLaboratoryPathToGrassClub: ; 1243f (4:643f)
db $2c, $78
db $3c, $68
db $5c, $68
db $00, $00
db $ff, $ff
OverworldMap_GrassClubPathToMasonLaboratory: ; 12449 (4:6449)
db $5c, $68
db $3c, $68
db $2c, $78
db $00, $00
db $ff, $ff
OverworldMap_MasonLaboratoryPathToPsychicClub: ; 12453 (4:6453)
db $2c, $78
db $3c, $68
db $5c, $68
db $5c, $48
db $00, $00
db $ff, $ff
OverworldMap_PsychicClubPathToMasonLaboratory: ; 1245f (4:645f)
db $5c, $48
db $5c, $68
db $3c, $68
db $2c, $78
db $00, $00
db $ff, $ff
OverworldMap_MasonLaboratoryPathToScienceClub: ; 1246b (4:646b)
db $2c, $78
db $3c, $68
db $5c, $68
db $00, $00
db $ff, $ff
OverworldMap_ScienceClubPathToMasonLaboratory: ; 12475 (4:6475)
db $5c, $68
db $3c, $68
db $2c, $78
db $00, $00
db $ff, $ff
OverworldMap_MasonLaboratoryPathToFireClub: ; 1247f (4:647f)
db $2c, $78
db $3c, $68
db $5c, $68
db $5c, $30
db $00, $00
db $ff, $ff
OverworldMap_FireClubPathToMasonLaboratory: ; 1248b (4:648b)
db $5c, $30
db $5c, $68
db $3c, $68
db $2c, $78
db $00, $00
db $ff, $ff
OverworldMap_MasonLaboratoryPathToChallengeHall: ; 12497 (4:6497)
db $2c, $78
db $3c, $68
db $3c, $40
db $00, $00
db $ff, $ff
OverworldMap_ChallengeHallPathToMasonLaboratory: ; 124a1 (4:64a1)
db $3c, $40
db $3c, $68
db $2c, $78
db $00, $00
db $ff, $ff
OverworldMap_MasonLaboratoryPathToPokemonDome: ; 124ab (4:64ab)
db $2c, $78
db $3c, $68
db $00, $00
db $ff, $ff
OverworldMap_PokemonDomePathToMasonLaboratory: ; 124b3 (4:64b3)
db $3c, $68
db $2c, $78
db $00, $00
db $ff, $ff
OverworldMap_IshiharasHousePathToFightingClub: ; 124bb (4:64bb)
OverworldMap_FightingClubPathToIshiharasHouse: ; 124bb (4:64bb)
db $2c, $28
db $00, $00
db $ff, $ff
OverworldMap_IshiharasHousePathToWaterClub: ; 124c1 (4:64c1)
db $2c, $28
db $3c, $48
db $3c, $68
db $5c, $68
db $5c, $7c
db $74, $7c
db $00, $00
db $ff, $ff
OverworldMap_WaterClubPathToIshiharasHouse: ; 124d1 (4:64d1)
db $74, $7c
db $5c, $7c
db $5c, $68
db $3c, $68
db $3c, $48
db $2c, $28
db $00, $00
db $ff, $ff
OverworldMap_IshiharasHousePathToLightningClub: ; 124e1 (4:64e1)
OverworldMap_LightningClubPathToIshiharasHouse: ; 124e1 (4:64e1)
db $2c, $28
db $00, $00
db $ff, $ff
OverworldMap_IshiharasHousePathToGrassClub: ; 124e7 (4:64e7)
db $2c, $28
db $3c, $40
db $5c, $48
db $00, $00
db $ff, $ff
OverworldMap_GrassClubPathToIshiharasHouse: ; 124f1 (4:64f1)
db $5c, $48
db $3c, $40
db $2c, $28
db $00, $00
db $ff, $ff
OverworldMap_IshiharasHousePathToPsychicClub: ; 124fb (4:64fb)
db $2c, $28
db $3c, $40
db $00, $00
db $ff, $ff
OverworldMap_PsychicClubPathToIshiharasHouse: ; 12503 (4:6503)
db $3c, $40
db $2c, $28
db $00, $00
db $ff, $ff
OverworldMap_IshiharasHousePathToScienceClub: ; 1250b (4:650b)
db $2c, $28
db $3c, $40
db $5c, $48
db $00, $00
db $ff, $ff
OverworldMap_ScienceClubPathToIshiharasHouse: ; 12515 (4:6515)
db $5c, $48
db $3c, $40
db $2c, $28
db $00, $00
db $ff, $ff
OverworldMap_IshiharasHousePathToChallengeHall: ; 1251f (4:651f)
db $2c, $28
db $3c, $40
db $00, $00
db $ff, $ff
OverworldMap_ChallengeHallPathToIshiharasHouse: ; 12527 (4:6527)
db $3c, $40
db $2c, $28
db $00, $00
db $ff, $ff
OverworldMap_IshiharasHousePathToPokemonDome: ; 1252f (4:652f)
db $2c, $28
db $3c, $48
db $00, $00
db $ff, $ff
OverworldMap_PokemonDomePathToIshiharasHouse: ; 12537 (4:6537)
db $3c, $48
db $2c, $28
db $00, $00
db $ff, $ff
OverworldMap_FightingClubPathToRockClub: ; 1253f (4:653f)
db $3c, $68
db $3c, $48
db $00, $00
db $ff, $ff
OverworldMap_RockClubPathToFightingClub: ; 12547 (4:6547)
db $3c, $48
db $3c, $68
db $00, $00
db $ff, $ff
OverworldMap_FightingClubPathToWaterClub: ; 1254f (4:654f)
db $3c, $68
db $5c, $68
db $5c, $7c
db $74, $7c
db $00, $00
db $ff, $ff
OverworldMap_WaterClubPathToFightingClub: ; 1255b (4:655b)
db $74, $7c
db $5c, $7c
db $5c, $68
db $3c, $68
db $00, $00
db $ff, $ff
OverworldMap_FightingClubPathToPsychicClub: ; 12567 (4:6567)
OverworldMap_PsychicClubPathToFightingClub: ; 12567 (4:6567)
db $5c, $68
db $00, $00
db $ff, $ff
OverworldMap_FightingClubPathToFireClub: ; 1256d (4:656d)
db $5c, $68
db $5c, $30
db $00, $00
db $ff, $ff
OverworldMap_FireClubPathToFightingClub: ; 12575 (4:6575)
db $5c, $30
db $5c, $68
db $00, $00
db $ff, $ff
OverworldMap_FightingClubPathToChallengeHall: ; 1257d (4:657d)
OverworldMap_ChallengeHallPathToFightingClub: ; 1257d (4:657d)
db $3c, $40
db $00, $00
db $ff, $ff
OverworldMap_RockClubPathToWaterClub: ; 12583 (4:6583)
db $3c, $48
db $3c, $68
db $5c, $68
db $5c, $7c
db $74, $7c
db $00, $00
db $ff, $ff
OverworldMap_WaterClubPathToRockClub: ; 12591 (4:6591)
db $74, $7c
db $5c, $7c
db $5c, $68
db $3c, $68
db $3c, $48
db $00, $00
db $ff, $ff
OverworldMap_RockClubPathToGrassClub: ; 1259f (4:659f)
OverworldMap_GrassClubPathToRockClub: ; 1259f (4:659f)
db $3c, $40
db $00, $00
db $ff, $ff
OverworldMap_RockClubPathToFireClub: ; 125a5 (4:65a5)
db $3c, $40
db $5c, $30
db $00, $00
db $ff, $ff
OverworldMap_FireClubPathToRockClub: ; 125ad (4:65ad)
db $5c, $30
db $3c, $40
db $00, $00
db $ff, $ff
OverworldMap_WaterClubPathToLightningClub: ; 125b5 (4:65b5)
db $74, $7c
db $5c, $7c
db $5c, $68
db $3c, $68
db $00, $00
db $ff, $ff
OverworldMap_LightningClubPathToWaterClub: ; 125c1 (4:65c1)
db $3c, $68
db $5c, $68
db $5c, $7c
db $74, $7c
db $00, $00
db $ff, $ff
OverworldMap_WaterClubPathToGrassClub: ; 125cd (4:65cd)
OverworldMap_WaterClubPathToPsychicClub: ; 125cd (4:65cd)
OverworldMap_WaterClubPathToScienceClub: ; 125cd (4:65cd)
db $74, $7c
db $5c, $7c
db $5c, $68
db $00, $00
db $ff, $ff
OverworldMap_GrassClubPathToWaterClub: ; 125d7 (4:65d7)
OverworldMap_PsychicClubPathToWaterClub: ; 125d7 (4:65d7)
OverworldMap_ScienceClubPathToWaterClub: ; 125d7 (4:65d7)
db $5c, $68
db $5c, $7c
db $74, $7c
db $00, $00
db $ff, $ff
OverworldMap_WaterClubPathToFireClub: ; 125e1 (4:65e1)
db $74, $7c
db $5c, $7c
db $5c, $30
db $00, $00
db $ff, $ff
OverworldMap_FireClubPathToWaterClub: ; 125eb (4:65eb)
db $5c, $30
db $5c, $7c
db $74, $7c
db $00, $00
db $ff, $ff
OverworldMap_WaterClubPathToChallengeHall: ; 125f5 (4:65f5)
db $74, $7c
db $5c, $7c
db $5c, $48
db $00, $00
db $ff, $ff
OverworldMap_ChallengeHallPathToWaterClub: ; 125ff (4:65ff)
db $5c, $48
db $5c, $7c
db $74, $7c
db $00, $00
db $ff, $ff
OverworldMap_WaterClubPathToPokemonDome: ; 12609 (4:6609)
db $74, $7c
db $5c, $7c
db $00, $00
db $ff, $ff
OverworldMap_PokemonDomePathToWaterClub: ; 12611 (4:6611)
db $5c, $7c
db $74, $7c
db $00, $00
db $ff, $ff
OverworldMap_LightningClubPathToPsychicClub: ; 12619 (4:6619)
OverworldMap_PsychicClubPathToLightningClub: ; 12619 (4:6619)
db $3c, $40
db $00, $00
db $ff, $ff
OverworldMap_LightningClubPathToScienceClub: ; 1261f (4:661f)
db $3c, $68
db $5c, $68
db $00, $00
db $ff, $ff
OverworldMap_ScienceClubPathToLightningClub: ; 12627 (4:6627)
db $5c, $68
db $3c, $68
db $00, $00
db $ff, $ff
OverworldMap_LightningClubPathToFireClub: ; 1262f (4:662f)
db $3c, $48
db $5c, $30
db $00, $00
db $ff, $ff
OverworldMap_FireClubPathToLightningClub: ; 12637 (4:6637)
db $5c, $30
db $3c, $48
db $00, $00
db $ff, $ff
OverworldMap_GrassClubPathToChallengeHall: ; 1263f (4:663f)
OverworldMap_ScienceClubPathToChallengeHall: ; 1263f (4:663f)
OverworldMap_ChallengeHallPathToGrassClub: ; 1263f (4:663f)
OverworldMap_ChallengeHallPathToScienceClub: ; 1263f (4:663f)
db $5c, $48
db $00, $00
db $ff, $ff
OverworldMap_FireClubPathToChallengeHall: ; 12645 (4:6645)
OverworldMap_FireClubPathToPokemonDome: ; 12645 (4:6645)
OverworldMap_ChallengeHallPathToFireClub: ; 12645 (4:6645)
OverworldMap_PokemonDomePathToFireClub: ; 12645 (4:6645)
db $5c, $30
db $00, $00
db $ff, $ff
OverworldMap_RockClubPathToScienceClub: ; 1264b (4:664b)
db $3c, $40
db $5c, $48
db $00, $00
db $ff, $ff
OverworldMap_ScienceClubPathToRockClub: ; 12653 (4:6653)
db $5c, $48
db $3c, $40
db $00, $00
db $ff, $ff
OverworldMap_StraightPath: ; 1265b (4:665b)
db $00, $00
db $ff, $ff
OverworldMap_NoMovement: ; 1265f (4:665f)
db $ff, $ff
; unreferenced debug menu
Func_12661: ; 12661 (4:6661)
xor a
ld [wDebugMenuSelection], a
ld [wDebugBoosterSelection], a
ld a, $03
ld [wDebugSGBBorder], a
.asm_1266d
call DisableLCD
ld a, $00
ld [wTileMapFill], a
call EmptyScreen
call LoadSymbolsFont
lb de, $30, $7f
call SetupText
call Func_3ca0
call Func_12871
ld a, $01
ld [wLineSeparation], a
ld a, [wDebugMenuSelection]
ld hl, Unknown_128f7
call InitAndPrintPauseMenu
call EnableLCD
.asm_12698
call DoFrameIfLCDEnabled
call HandleMenuInput
jr nc, .asm_12698
ldh a, [hCurMenuItem]
bit 7, a
jr nz, .asm_12698
ld [wDebugMenuSelection], a
xor a
ld [wLineSeparation], a
call Func_126b3
jr c, .asm_1266d
ret
Func_126b3: ; 126b3 (4:66b3)
ldh a, [hCurMenuItem]
ld hl, Unknown_126bb
jp JumpToFunctionInTable
Unknown_126bb: ; 126bb (4:66bb)
dw _GameLoop
dw DebugDuelMode
dw MainMenu_ContinueFromDiary
dw DebugCGBTest
dw DebugSGBFrame
dw DebugStandardBGCharacter
dw DebugLookAtSprite
dw DebugVEffect
dw DebugCreateBoosterPack
dw DebugCredits
dw DebugQuit
; usually, the game doesn't loop here at all, since as soon as a main menu option
; is selected, there is no need to come back to the menu.
; the only exception is after returning from Card Pop!
_GameLoop: ; 126d1 (4:66d1)
call ZeroObjectPositions
ld hl, wVBlankOAMCopyToggle
inc [hl]
farcall SetIntroSGBBorder
ld a, $ff
ld [wLastSelectedStartMenuItem], a
.main_menu_loop
ld a, PLAYER_TURN
ldh [hWhoseTurn], a
farcall Func_c1f8
farcall HandleTitleScreen
ld a, [wStartMenuChoice]
ld hl, MainMenuFunctionTable
call JumpToFunctionInTable
jr c, .main_menu_loop ; return to main menu
jr _GameLoop ; virtually restart game
; this is never reached
scf
ret
MainMenuFunctionTable: ; 126fc (4:66fc)
dw MainMenu_CardPop
dw MainMenu_ContinueFromDiary
dw MainMenu_NewGame
dw MainMenu_ContinueDuel
MainMenu_NewGame: ; 12704 (4:6704)
farcall Func_c1b1
call DisplayPlayerNamingScreen
farcall Func_1996e
call EnableSRAM
ld a, [sAnimationsDisabled]
ld [wAnimationsDisabled], a
ld a, [sTextSpeed]
ld [wTextSpeed], a
call DisableSRAM
ld a, MUSIC_STOP
call PlaySong
farcall SetMainSGBBorder
ld a, MUSIC_OVERWORLD
ld [wDefaultSong], a
call PlayDefaultSong
farcall DrawPlayerPortraitAndPrintNewGameText
ld a, GAME_EVENT_OVERWORLD
ld [wGameEvent], a
farcall $03, ExecuteGameEvent
or a
ret
MainMenu_ContinueFromDiary: ; 12741 (4:6741)
ld a, MUSIC_STOP
call PlaySong
call ValidateBackupGeneralSaveData
jr nc, MainMenu_NewGame
farcall Func_c1ed
farcall SetMainSGBBorder
call EnableSRAM
xor a
ld [sPlayerInChallengeMachine], a
call DisableSRAM
ld a, GAME_EVENT_OVERWORLD
ld [wGameEvent], a
farcall $03, ExecuteGameEvent
or a
ret
MainMenu_CardPop: ; 12768 (4:6768)
ld a, MUSIC_CARD_POP
call PlaySong
bank1call DoCardPop
farcall WhiteOutDMGPals
call DoFrameIfLCDEnabled
ld a, MUSIC_STOP
call PlaySong
scf
ret
MainMenu_ContinueDuel: ; 1277e (4:677e)
ld a, MUSIC_STOP
call PlaySong
farcall ClearEvents
farcall $04, LoadGeneralSaveData
farcall SetMainSGBBorder
ld a, GAME_EVENT_CONTINUE_DUEL
ld [wGameEvent], a
farcall $03, ExecuteGameEvent
or a
ret
DebugLookAtSprite: ; 1279a (4:679a)
farcall Func_80cd7
scf
ret
DebugVEffect: ; 127a0 (4:67a0)
farcall Func_80cd6
scf
ret
DebugCreateBoosterPack: ; 127a6 (4:67a6)
.go_back
ld a, [wDebugBoosterSelection]
ld hl, Unknown_12919
call InitAndPrintPauseMenu
.input_loop_1
call DoFrameIfLCDEnabled
call HandleMenuInput
jr nc, .input_loop_1
ldh a, [hCurMenuItem]
cp e
jr nz, .cancel
ld [wDebugBoosterSelection], a
add a
ld c, a
ld b, $00
ld hl, Unknown_127f1
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
xor a
call InitAndPrintPauseMenu
.input_loop_2
call DoFrameIfLCDEnabled
call HandleMenuInput
jr nc, .input_loop_2
ldh a, [hCurMenuItem]
cp e
jr nz, .go_back
ld a, [wDebugBoosterSelection]
ld c, a
ld b, $00
ld hl, Unknown_127fb
add hl, bc
ld a, [hl]
add e
farcall GenerateBoosterPack
farcall OpenBoosterPack
.cancel
scf
ret
Unknown_127f1: ; 127f1 (4:67f1)
dw Unknown_1292a
dw Unknown_1292a
dw Unknown_1293b
dw Unknown_1294c
dw Unknown_1295d
Unknown_127fb: ; 127fb (4:67fb)
db BOOSTER_COLOSSEUM_NEUTRAL
db BOOSTER_EVOLUTION_NEUTRAL
db BOOSTER_MYSTERY_NEUTRAL
db BOOSTER_LABORATORY_NEUTRAL
db BOOSTER_ENERGY_LIGHTNING_FIRE
DebugCredits: ; 12800 (4:6800)
farcall Credits_1d6ad
scf
ret
DebugCGBTest: ; 12806 (4:6806)
farcall Func_1c865
scf
ret
DebugSGBFrame: ; 1280c (4:680c)
call DisableLCD
ld a, [wDebugSGBBorder]
farcall SetSGBBorder
ld a, [wDebugSGBBorder]
inc a
cp $04
jr c, .asm_1281f
xor a
.asm_1281f
ld [wDebugSGBBorder], a
scf
ret
DebugDuelMode: ; 12824 (4:6824)
call EnableSRAM
ld a, [sDebugDuelMode]
and $01
ld [sDebugDuelMode], a
ld hl, Unknown_12908
call InitAndPrintPauseMenu
.input_loop
call DoFrameIfLCDEnabled
call HandleMenuInput
jr nc, .input_loop
ldh a, [hCurMenuItem]
cp e
jr nz, .input_loop
and $01
ld [sDebugDuelMode], a
call DisableSRAM
scf
ret
DebugStandardBGCharacter: ; 1284c (4:684c)
ld a, $80
ld de, $0
lb bc, 16, 16
lb hl, 1, 16
call FillRectangle
ld a, $ff
call Func_12863
scf
ret
DebugQuit: ; 12861 (4:6861)
or a
ret
Func_12863: ; 12863 (4:6863)
push bc
ld b, a
.asm_12865
push bc
call DoFrameIfLCDEnabled
pop bc
ldh a, [hKeysPressed]
and b
jr z, .asm_12865
pop bc
ret
Func_12871: ; 12871 (4:6871)
call ZeroObjectPositions
ld a, $01
ld [wVBlankOAMCopyToggle], a
call Set_OBJ_8x8
call Func_1288c
xor a
ldh [hSCX], a
ldh [hSCY], a
ldh [hWX], a
ldh [hWY], a
call Set_WD_off
ret
Func_1288c: ; 1288c (4:688c)
push hl
push bc
push de
ld a, %11100100
ld [wBGP], a
ld [wOBP0], a
ld [wOBP1], a
ld a, 4
ld [wTextBoxFrameType], a
bank1call SetDefaultPalettes
call FlushAllPalettes
pop de
pop bc
pop hl
ret
DisplayPlayerNamingScreen:: ; 128a9 (4:68a9)
; clear the name buffer.
ld hl, wNameBuffer ; c500: name buffer.
ld bc, NAME_BUFFER_LENGTH
ld a, TX_END
call FillMemoryWithA
; get player's name
; from the user into hl.
ld hl, wNameBuffer
farcall InputPlayerName
farcall WhiteOutDMGPals
call DoFrameIfLCDEnabled
call DisableLCD
ld hl, wNameBuffer
; get the first byte of the name buffer.
ld a, [hl]
or a
; check if anything typed.
jr nz, .no_name
ld hl, .default_name
.no_name
; set the default name.
ld de, sPlayerName
ld bc, NAME_BUFFER_LENGTH
call EnableSRAM
call CopyDataHLtoDE_SaveRegisters
; it seems for integrity checking.
call UpdateRNGSources
ld [sPlayerName+$e], a
call UpdateRNGSources
ld [sPlayerName+$f], a
call DisableSRAM
ret
.default_name
; "MARK": default player name.
textfw3 "M", "A", "R", "K"
db TX_END, TX_END, TX_END, TX_END
Unknown_128f7: ; 128f7 (4:68f7)
db 0, 0 ; start menu coords
db 16, 18 ; start menu text box dimensions
db 2, 2 ; text alignment for InitTextPrinting
tx Text037a
db $ff
db 1, 2 ; cursor x, cursor y
db 1 ; y displacement between items
db 11 ; number of items
db SYM_CURSOR_R ; cursor tile number
db SYM_SPACE ; tile behind cursor
dw NULL ; function pointer if non-0
Unknown_12908: ; 12908 (4:6908)
db 10, 0 ; start menu coords
db 10, 6 ; start menu text box dimensions
db 12, 2 ; text alignment for InitTextPrinting
tx Text037b
db $ff
db 11, 2 ; cursor x, cursor y
db 2 ; y displacement between items
db 2 ; number of items
db SYM_CURSOR_R ; cursor tile number
db SYM_SPACE ; tile behind cursor
dw NULL ; function pointer if non-0
Unknown_12919: ; 12919 (4:6919)
db 0, 0 ; start menu coords
db 12, 12 ; start menu text box dimensions
db 2, 2 ; text alignment for InitTextPrinting
tx Text037c
db $ff
db 1, 2 ; cursor x, cursor y
db 2 ; y displacement between items
db 5 ; number of items
db SYM_CURSOR_R ; cursor tile number
db SYM_SPACE ; tile behind cursor
dw NULL ; function pointer if non-0
Unknown_1292a: ; 1292a (4:692a)
db 12, 0 ; start menu coords
db 4, 16 ; start menu text box dimensions
db 14, 2 ; text alignment for InitTextPrinting
tx Text037d
db $ff
db 13, 2 ; cursor x, cursor y
db 2 ; y displacement between items
db 7 ; number of items
db SYM_CURSOR_R ; cursor tile number
db SYM_SPACE ; tile behind cursor
dw NULL ; function pointer if non-0
Unknown_1293b: ; 1293b (4:693b)
db 12, 0 ; start menu coords
db 4, 14 ; start menu text box dimensions
db 14, 2 ; text alignment for InitTextPrinting
tx Text037e
db $ff
db 13, 2 ; cursor x, cursor y
db 2 ; y displacement between items
db 6 ; number of items
db SYM_CURSOR_R ; cursor tile number
db SYM_SPACE ; tile behind cursor
dw NULL ; function pointer if non-0
Unknown_1294c: ; 1294c (4:694c)
db 12, 0 ; start menu coords
db 4, 12 ; start menu text box dimensions
db 14, 2 ; text alignment for InitTextPrinting
tx Text037f
db $ff
db 13, 2 ; cursor x, cursor y
db 2 ; y displacement between items
db 5 ; number of items
db SYM_CURSOR_R ; cursor tile number
db SYM_SPACE ; tile behind cursor
dw NULL ; function pointer if non-0
Unknown_1295d: ; 1295d (4:695d)
db 12, 0 ; start menu coords
db 4, 10 ; start menu text box dimensions
db 14, 2 ; text alignment for InitTextPrinting
tx Text0380
db $ff
db 13, 2 ; cursor x, cursor y
db 2 ; y displacement between items
db 4 ; number of items
db SYM_CURSOR_R ; cursor tile number
db SYM_SPACE ; tile behind cursor
dw NULL ; function pointer if non-0
; disables all sprite animations
; and clears memory related to sprites
Func_1296e: ; 1296e (4:696e)
push af
ld a, [wd5d7]
or a
jr z, .asm_12977
pop af
ret
.asm_12977
pop af
push bc
push hl
xor a
ld [wWhichSprite], a
call GetFirstSpriteAnimBufferProperty
lb bc, 0, SPRITE_ANIM_LENGTH
; disable all sprite animations
.loop_sprites
xor a
ld [hl], a ; set SPRITE_ANIM_ENABLED to 0
add hl, bc
ld a, [wWhichSprite]
inc a
ld [wWhichSprite], a
cp SPRITE_ANIM_BUFFER_CAPACITY
jr nz, .loop_sprites
call Func_12bf3
call ZeroObjectPositions
ld hl, wVBlankOAMCopyToggle
inc [hl]
pop hl
pop bc
ret
; creates a new entry in SpriteAnimBuffer, else loads the sprite if need be
CreateSpriteAndAnimBufferEntry: ; 1299f (4:699f)
push af
ld a, [wd5d7]
or a
jr z, .continue
pop af
ret
.continue
pop af
push bc
push hl
call Func_12c05
ld [wCurrSpriteTileID], a
xor a
ld [wWhichSprite], a
call GetFirstSpriteAnimBufferProperty
ld bc, SPRITE_ANIM_LENGTH
.findFirstEmptyAnimField
ld a, [hl]
or a
jr z, .foundEmptyAnimField
add hl, bc
ld a, [wWhichSprite]
inc a
ld [wWhichSprite], a
cp $10
jr nz, .findFirstEmptyAnimField
debug_nop
scf
jr .quit
.foundEmptyAnimField
ld a, $1
ld [hl], a
call FillNewSpriteAnimBufferEntry
or a
.quit
pop hl
pop bc
ret
FillNewSpriteAnimBufferEntry: ; 129d9 (4:69d9)
push hl
push bc
push hl
inc hl
ld c, SPRITE_ANIM_LENGTH - 1
xor a
.clearSpriteAnimBufferEntryLoop
ld [hli], a
dec c
jr nz, .clearSpriteAnimBufferEntryLoop
pop hl
ld bc, SPRITE_ANIM_ID - 1
add hl, bc
ld a, [wCurrSpriteTileID]
ld [hli], a
ld a, $ff
ld [hl], a
ld bc, SPRITE_ANIM_COUNTER - SPRITE_ANIM_ID
add hl, bc
ld a, $ff
ld [hl], a
pop bc
pop hl
ret
DisableCurSpriteAnim: ; 129fa (4:69fa)
ld a, [wWhichSprite]
; fallthrough
; sets SPRITE_ANIM_ENABLED to false
; of sprite in register a
DisableSpriteAnim: ; 129fd (4:69fd)
push af
ld a, [wd5d7]
or a
jr z, .disable
pop af
ret
.disable
pop af
push hl
push bc
ld c, SPRITE_ANIM_ENABLED
call GetSpriteAnimBufferProperty_SpriteInA
ld [hl], FALSE
pop bc
pop hl
ret
GetSpriteAnimCounter: ; 12a13 (4:6a13)
ld a, [wWhichSprite]
push hl
push bc
ld c, SPRITE_ANIM_COUNTER
call GetSpriteAnimBufferProperty_SpriteInA
ld a, [hl]
pop bc
pop hl
ret
_HandleAllSpriteAnimations: ; 12a21 (4:6a21)
push af
ld a, [wd5d7] ; skip animating this frame if enabled
or a
jr z, .continue
pop af
ret
.continue
pop af
push af
push bc
push de
push hl
call ZeroObjectPositions
xor a
ld [wWhichSprite], a
call GetFirstSpriteAnimBufferProperty
.spriteLoop
ld a, [hl]
or a
jr z, .nextSprite ; skip if SPRITE_ANIM_ENABLED is 0
call TryHandleSpriteAnimationFrame
call LoadSpriteDataForAnimationFrame
.nextSprite
ld bc, SPRITE_ANIM_LENGTH
add hl, bc
ld a, [wWhichSprite]
inc a
ld [wWhichSprite], a
cp SPRITE_ANIM_BUFFER_CAPACITY
jr nz, .spriteLoop
ld hl, wVBlankOAMCopyToggle
inc [hl]
pop hl
pop de
pop bc
pop af
ret
LoadSpriteDataForAnimationFrame: ; 12a5b (4:6a5b)
push hl
push bc
inc hl
ld a, [hli]
ld [wCurrSpriteAttributes], a
ld a, [hli]
ld [wCurrSpriteXPos], a
ld a, [hli]
ld [wCurrSpriteYPos], a
ld a, [hl]
ld [wCurrSpriteTileID], a
ld bc, SPRITE_ANIM_FLAGS - SPRITE_ANIM_TILE_ID
add hl, bc
ld a, [hl]
and 1 << SPRITE_ANIM_FLAG_UNSKIPPABLE
jr nz, .quit
ld bc, SPRITE_ANIM_FRAME_BANK - SPRITE_ANIM_FLAGS
add hl, bc
ld a, [hli]
ld [wd5d6], a
or a
jr z, .quit
ld a, [hli]
ld h, [hl]
ld l, a
call DrawSpriteAnimationFrame
.quit
pop bc
pop hl
ret
; decrements the given sprite's movement counter (2x if SPRITE_ANIM_FLAG_SPEED is set)
; moves to the next animation frame if necessary
TryHandleSpriteAnimationFrame: ; 12a8b (4:6a8b)
push hl
push bc
push de
push hl
ld d, 1
ld bc, SPRITE_ANIM_FLAGS
add hl, bc
bit SPRITE_ANIM_FLAG_SPEED, [hl]
jr z, .skipSpeedIncrease
inc d
.skipSpeedIncrease
pop hl
ld bc, SPRITE_ANIM_COUNTER
add hl, bc
ld a, [hl]
cp $ff
jr z, .exit
sub d
ld [hl], a
jr z, .doNextAnimationFrame
jr nc, .exit
.doNextAnimationFrame
ld bc, SPRITE_ANIM_ENABLED - SPRITE_ANIM_COUNTER
add hl, bc
call HandleAnimationFrame
.exit
pop de
pop bc
pop hl
ret
StartNewSpriteAnimation: ; 12ab5 (4:6ab5)
push hl
push af
ld c, SPRITE_ANIM_ID
call GetSpriteAnimBufferProperty
pop af
cp [hl]
pop hl
ret z
; fallthrough
StartSpriteAnimation: ; 12ac0 (4:6ac0)
push hl
call LoadSpriteAnimPointers
call HandleAnimationFrame
pop hl
ret
; a = sprite animation
; c = animation counter value
Func_12ac9: ; 12ac9 (4:6ac9)
push bc
ld b, a
ld a, c
or a
ld a, b
pop bc
jr z, StartSpriteAnimation
push hl
push bc
call LoadSpriteAnimPointers
ld a, $ff
call GetAnimFramePointerFromOffset
pop bc
ld a, c
call SetAnimationCounterAndLoop
pop hl
ret
; Given an animation ID, fills the current sprite's Animation Pointer and Frame Offset Pointer
; a - Animation ID for current sprite
LoadSpriteAnimPointers: ; 12ae2 (4:6ae2)
push bc
push af
call GetFirstSpriteAnimBufferProperty
pop af
push hl
ld bc, SPRITE_ANIM_ID
add hl, bc
ld [hli], a
push hl
ld l, 6 ; 4th entry in MapDataPointers
farcall GetMapDataPointer
farcall LoadGraphicsPointerFromHL
pop hl ; hl is animation bank
ld a, [wTempPointerBank]
ld [hli], a
ld a, [wTempPointer + 0]
ld [hli], a
ld c, a
ld a, [wTempPointer + 1]
ld [hli], a
ld b, a
; offset pointer = pointer + $3
ld a, $3
add c
ld [hli], a
ld a, $0
adc b
ld [hli], a
pop hl
pop bc
ret
; hl - beginning of current sprite_anim_buffer
; Handles a full animation frame using all values in animation structure
; (frame data offset, anim counter, X Mov, Y Mov)
HandleAnimationFrame: ; 12b13 (4:6b13)
push bc
push de
push hl
.tryHandlingFrame
push hl
ld bc, SPRITE_ANIM_BANK
add hl, bc
ld a, [hli]
ld [wTempPointerBank], a
inc hl
inc hl
ld a, [hl] ; SPRITE_ANIM_FRAME_OFFSET_POINTER
ld [wTempPointer + 0], a
add SPRITE_FRAME_OFFSET_SIZE ; advance FRAME_OFFSET_POINTER by 1 frame, 4 bytes
ld [hli], a
ld a, [hl]
ld [wTempPointer + 1], a
adc 0
ld [hl], a
ld de, wLoadedPalData
ld bc, SPRITE_FRAME_OFFSET_SIZE
call CopyBankedDataToDE
pop hl ; beginning of current sprite_anim_buffer
ld de, wLoadedPalData
ld a, [de]
call GetAnimFramePointerFromOffset
inc de
ld a, [de]
call SetAnimationCounterAndLoop
jr c, .tryHandlingFrame
inc de
ld bc, SPRITE_ANIM_COORD_X
add hl, bc
push hl
ld bc, SPRITE_ANIM_FLAGS - SPRITE_ANIM_COORD_X
add hl, bc
ld b, [hl]
pop hl
ld a, [de]
bit SPRITE_ANIM_FLAG_X_SUBTRACT, b
jr z, .addXOffset
cpl
inc a
.addXOffset
add [hl]
ld [hli], a
inc de
ld a, [de]
bit SPRITE_ANIM_FLAG_Y_SUBTRACT, b
jr z, .addYOffset
cpl
inc a
.addYOffset
add [hl]
ld [hl], a
pop hl
pop de
pop bc
ret
; Calls GetAnimationFramePointer after setting up wTempPointerBank
; and wVRAMTileOffset
; a - frame offset from Animation Data
; hl - beginning of Sprite Anim Buffer
GetAnimFramePointerFromOffset: ; 12b6a (4:6b6a)
ld [wVRAMTileOffset], a
push hl
push bc
push de
push hl
ld bc, SPRITE_ANIM_BANK
add hl, bc
ld a, [hli]
ld [wTempPointerBank], a
ld a, [hli]
ld [wTempPointer + 0], a
ld a, [hli]
ld [wTempPointer + 1], a
pop hl
call GetAnimationFramePointer ; calls with the original map data script pointer/bank
pop de
pop bc
pop hl
ret
; Sets the animation counter for the current sprite. If the value is zero, loop the animation
; a - new animation counter
SetAnimationCounterAndLoop: ; 12b89 (4:6b89)
push hl
push bc
ld bc, SPRITE_ANIM_COUNTER
add hl, bc
ld [hl], a
or a
jr nz, .exit
ld bc, SPRITE_ANIM_POINTER - SPRITE_ANIM_COUNTER
add hl, bc
ld a, [hli]
add $3 ; skip base bank/pointer at beginning of data structure
ld c, a
ld a, [hli]
adc 0
ld b, a
ld a, c
ld [hli], a
ld a, b
ld [hl], a
scf
.exit
pop bc
pop hl
ret
Func_12ba7: ; 12ba7 (4:6ba7)
push hl
push bc
push de
call EnableSRAM
ld hl, wSpriteAnimBuffer
ld de, sGeneralSaveDataEnd
ld bc, $100
call CopyDataHLtoDE
ld hl, wSpriteVRAMBuffer
ld bc, $40
call CopyDataHLtoDE
ld a, [wSpriteVRAMBufferSize]
ld [de], a
call DisableSRAM
pop de
pop bc
pop hl
ret
Func_12bcd: ; 12bcd (4:6bcd)
push hl
push bc
push de
call EnableSRAM
ld hl, sGeneralSaveDataEnd
ld de, wSpriteAnimBuffer
ld bc, $100
call CopyDataHLtoDE
ld de, wSpriteVRAMBuffer
ld bc, $40
call CopyDataHLtoDE
ld a, [hl]
ld [wSpriteVRAMBufferSize], a
call DisableSRAM
pop de
pop bc
pop hl
ret
; clears wSpriteVRAMBufferSize and wSpriteVRAMBuffer
Func_12bf3: ; 12bf3 (4:6bf3)
push hl
push bc
xor a
ld [wSpriteVRAMBufferSize], a
ld c, $40
ld hl, wSpriteVRAMBuffer
.asm_12bfe
ld [hli], a
dec c
jr nz, .asm_12bfe
pop bc
pop hl
ret
; gets some value based on the sprite in a and wSpriteVRAMBuffer
; loads the sprites data if it doesn't already exist
Func_12c05: ; 12c05 (4:6c05)
push hl
push bc
push de
ld b, a
ld d, $0
ld a, [wSpriteVRAMBufferSize]
ld c, a
ld hl, wSpriteVRAMBuffer
or a
jr z, .tryToAddSprite
.findSpriteMatchLoop
inc hl
ld a, [hl]
cp b
jr z, .foundSpriteMatch
inc hl
ld a, [hli]
add [hl] ; add tile size to tile offset
ld d, a
inc hl
dec c
jr nz, .findSpriteMatchLoop
.tryToAddSprite
ld a, [wSpriteVRAMBufferSize]
cp $10
jr nc, .quitFail
inc a
ld [wSpriteVRAMBufferSize], a ; increase number of entries by 1
inc hl
push hl
ld a, b
ld [hli], a ; store sprite index
call Func_12c4f
push af
ld a, d
ld [hli], a ; store tile offset
pop af
ld [hl], a ; store tile size
pop hl
.foundSpriteMatch
dec hl
inc [hl] ; mark this entry as valid
inc hl
inc hl
ld a, [hli]
add [hl]
cp $81
jr nc, .quitFail ; exceeds total tile size
ld a, d
or a
jr .quitSucceed
.quitFail
debug_nop
xor a
scf
.quitSucceed
pop de
pop bc
pop hl
ret
; input:
; a = sprite index within the data map
; d = tile offset in VRAM
; output:
; a = number of tiles in sprite
Func_12c4f: ; 12c4f (4:6c4f)
push af
xor a
ld [wd4cb], a
ld a, d
ld [wVRAMTileOffset], a
pop af
farcall Func_8025b
ret
Func_12c5e: ; 12c5e (4:6c5e)
push hl
push bc
push de
ld c, $10
ld de, $4
ld hl, wSpriteVRAMBuffer
.asm_12c69
ld a, [hl]
or a
jr z, .asm_12c77
push hl
push de
inc hl
ld a, [hli]
ld d, [hl]
call Func_12c4f
pop de
pop hl
.asm_12c77
add hl, de
dec c
jr nz, .asm_12c69
pop de
pop bc
pop hl
ret
; input:
; a = scene ID (SCENE_* constant)
; b = base X position of scene in tiles
; c = base Y position of scene in tiles
_LoadScene: ; 12c7f (4:6c7f)
push hl
push bc
push de
ld e, a
ld a, [wCurTilemap]
push af
ld a, [wd291]
push af
ld a, e
push bc
push af
ld a, b
add a
add a
add a
add $08
ld [wSceneBaseX], a
ld a, c
add a
add a
add a
add $10
ld [wSceneBaseY], a
pop af
add a
ld c, a
ld b, 0
ld hl, ScenePointers
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [hli]
ld [wSceneSGBPacketPtr], a
ld a, [hli]
ld [wSceneSGBPacketPtr + 1], a
ld a, [hli]
ld [wSceneSGBRoutinePtr], a
ld a, [hli]
ld [wSceneSGBRoutinePtr + 1], a
call LoadScene_LoadCompressedSGBPacket
ld a, %11100100
ld [wBGP], a
ld a, [wConsole]
cp CONSOLE_CGB
ld a, [hli]
jr nz, .not_cgb_1
ld a, [hl]
.not_cgb_1
inc hl
push af ; palette
xor a
ld [wd4ca], a
ld a, [hli]
ld [wd4cb], a ; palette offset
ld [wd291], a ; palette offset
pop af ; palette
farcall SetBGPAndLoadedPal ; load palette
ld a, [wConsole]
cp CONSOLE_CGB
ld a, [hli]
jr nz, .not_cgb_2
ld a, [hl]
.not_cgb_2
inc hl
ld [wCurTilemap], a
pop bc
push bc
farcall LoadTilemap_ToVRAM
pop bc ; base x,y
call LoadScene_LoadSGBPacket
ld a, [hli]
ld [wd4ca], a ; tile offset
ld a, [hli]
ld [wd4cb], a ; vram0 or vram1
farcall LoadTilesetGfx
.next_sprite
ld a, [hli]
or a
jr z, .done ; no sprite
ld [wSceneSprite], a
ld a, [wConsole]
cp CONSOLE_CGB
ld a, [hli]
jr nz, .not_cgb_3
ld a, [hl]
.not_cgb_3
inc hl
push af ; sprite palette
xor a
ld [wd4ca], a
ld a, [hli]
ld [wd4cb], a ; palette offset
pop af ; sprite palette
farcall LoadPaletteData
.next_animation
ld a, [hli]
or a
jr z, .next_sprite
dec hl
ld a, [wConsole]
cp CONSOLE_CGB
ld a, [hli]
jr nz, .not_cgb_4
ld a, [hl]
.not_cgb_4
inc hl
ld [wSceneSpriteAnimation], a
ld a, [wSceneSprite]
farcall CreateSpriteAndAnimBufferEntry
ld a, [wWhichSprite]
ld [wSceneSpriteIndex], a
push hl
ld c, SPRITE_ANIM_COORD_X
call GetSpriteAnimBufferProperty
ld e, l
ld d, h
pop hl
ld a, [wSceneBaseX]
add [hl]
ld [de], a
inc hl
inc de
ld a, [wSceneBaseY]
add [hl]
ld [de], a
inc hl
ld a, [wSceneSpriteAnimation]
cp $ff
jr z, .no_animation
farcall StartSpriteAnimation
.no_animation
jr .next_animation
.done
pop af
ld [wd291], a
pop af
ld [wCurTilemap], a
pop de
pop bc
pop hl
ret
ScenePointers: ; 12d6f (4:6d6f)
dw Scene_TitleScreen
dw Scene_ColosseumBooster
dw Scene_EvolutionBooster
dw Scene_MysteryBooster
dw Scene_LaboratoryBooster
dw Scene_CharizardIntro
dw Scene_ScytherIntro
dw Scene_AerodactylIntro
dw Scene_GradientBlackAndRed
dw Scene_GradientWhiteAndRed
dw Scene_GradientBlackAndGreen
dw Scene_GradientWhiteAndGreen
dw Scene_ColorWheel
dw Scene_ColorTest
dw Scene_GameBoyLinkConnecting
dw Scene_GameBoyLinkTransmitting
dw Scene_GameBoyLinkNotConnected
dw Scene_GameBoyPrinterTransmitting
dw Scene_GameBoyPrinterNotConnected
dw Scene_CardPop
dw Scene_CardPopError
dw Scene_JapaneseTitleScreen
dw Scene_Nintendo
dw Scene_Companies
dw Scene_JapaneseTitleScreen2
dw Scene_Copyright
dw Scene_JapaneseTitleScreen2
dw Scene_ColorPalette
; format:
; dw compressed sgb packet
; dw custom sgb packet loading routine
; db palette (non-cgb), palette (cgb), palette offset
; db tilemap (non-cgb), tilemap (cgb), vram tile offset, vram0 or vram1
; db sprite
;
; if sprite is non-zero:
; db palette (non-cgb), palette (cgb), palette offset
; db animation (non-cgb), animation (cgb), x offset, y offset
; dw 0-terminator
Scene_TitleScreen: ; 12da7 (4:6da7)
dw SGBData_TitleScreen
dw NULL
db PALETTE_25, PALETTE_25, $00
db TILEMAP_TITLE_SCREEN, TILEMAP_TITLE_SCREEN_CGB, $00, $00
db $00
Scene_JapaneseTitleScreen: ; 12db3 (4:6db3)
dw SGBData_TitleScreen
dw NULL
db PALETTE_25, PALETTE_25, $00
db TILEMAP_JAPANESE_TITLE_SCREEN, TILEMAP_JAPANESE_TITLE_SCREEN_CGB, $80, $00
db $00
Scene_ColosseumBooster: ; 12dbf (4:6dbf)
dw SGBData_ColosseumBooster
dw NULL
db PALETTE_108, PALETTE_101, $01
db TILEMAP_COLOSSEUM, TILEMAP_COLOSSEUM_CGB, $80, $00
db SPRITE_BOOSTER_PACK_OAM
db PALETTE_117, PALETTE_117, $00
db $ff, $bd, $00, $00
dw $00
Scene_EvolutionBooster: ; 12dd4 (4:6dd4)
dw SGBData_EvolutionBooster
dw NULL
db PALETTE_108, PALETTE_102, $01
db TILEMAP_EVOLUTION, TILEMAP_EVOLUTION_CGB, $80, $00
db SPRITE_BOOSTER_PACK_OAM
db PALETTE_117, PALETTE_117, $00
db $ff, $bd, $00, $00
dw $00
Scene_MysteryBooster: ; 12de9 (4:6de9)
dw SGBData_MysteryBooster
dw NULL
db PALETTE_108, PALETTE_103, $01
db TILEMAP_MYSTERY, TILEMAP_MYSTERY_CGB, $80, $00
db SPRITE_BOOSTER_PACK_OAM
db PALETTE_117, PALETTE_117, $00
db $ff, $bd, $00, $00
dw $00
Scene_LaboratoryBooster: ; 12dfe (4:6dfe)
dw SGBData_LaboratoryBooster
dw NULL
db PALETTE_108, PALETTE_104, $01
db TILEMAP_LABORATORY, TILEMAP_LABORATORY_CGB, $80, $00
db SPRITE_BOOSTER_PACK_OAM
db PALETTE_117, PALETTE_117, $00
db $ff, $bd, $00, $00
dw $00
Scene_CharizardIntro: ; 12e13 (4:6e13)
dw SGBData_CharizardIntro
dw NULL
db PALETTE_108, PALETTE_105, $01
db TILEMAP_CHARIZARD_INTRO, TILEMAP_CHARIZARD_INTRO_CGB, $80, $00
db $00
Scene_ScytherIntro: ; 12e1f (4:6e1f)
dw SGBData_ScytherIntro
dw NULL
db PALETTE_108, PALETTE_106, $01
db TILEMAP_SCYTHER_INTRO, TILEMAP_SCYTHER_INTRO_CGB, $80, $00
db $00
Scene_AerodactylIntro: ; 12e2b (4:6e2b)
dw SGBData_AerodactylIntro
dw NULL
db PALETTE_108, PALETTE_107, $01
db TILEMAP_AERODACTYL_INTRO, TILEMAP_AERODACTYL_INTRO_CGB, $80, $00
db $00
Scene_GradientBlackAndRed: ; 12e37 (4:6e37)
dw NULL
dw NULL
db PALETTE_94, PALETTE_94, $00
db TILEMAP_SOLID_TILES_1, TILEMAP_SOLID_TILES_1, $01, $00
db $00
Scene_GradientWhiteAndRed: ; 12e43 (4:6e43)
dw NULL
dw NULL
db PALETTE_95, PALETTE_95, $00
db TILEMAP_SOLID_TILES_1, TILEMAP_SOLID_TILES_1, $01, $00
db $00
Scene_GradientBlackAndGreen: ; 12e4f (4:6e4f)
dw NULL
dw NULL
db PALETTE_96, PALETTE_96, $00
db TILEMAP_SOLID_TILES_1, TILEMAP_SOLID_TILES_1, $01, $00
db $00
Scene_GradientWhiteAndGreen: ; 12e5b (4:6e5b)
dw NULL
dw NULL
db PALETTE_97, PALETTE_97, $00
db TILEMAP_SOLID_TILES_1, TILEMAP_SOLID_TILES_1, $01, $00
db $00
Scene_ColorWheel: ; 12e67 (4:6e67)
dw NULL
dw NULL
db PALETTE_98, PALETTE_98, $00
db TILEMAP_SOLID_TILES_2, TILEMAP_SOLID_TILES_2, $01, $00
db $00
Scene_ColorTest: ; 12e73 (4:6e73)
dw NULL
dw NULL
db PALETTE_99, PALETTE_99, $00
db TILEMAP_SOLID_TILES_3, TILEMAP_SOLID_TILES_3, $01, $00
db $00
Scene_ColorPalette: ; 12e7f (4:6e7f)
dw NULL
dw NULL
db PALETTE_110, PALETTE_110, $00
db TILEMAP_SOLID_TILES_4, TILEMAP_SOLID_TILES_4, $fc, $01
db $00
Scene_GameBoyLinkConnecting: ; 12e8b (4:6e8b)
dw SGBData_GameBoyLink
dw NULL
db PALETTE_111, PALETTE_111, $00
db TILEMAP_GAMEBOY_LINK_CONNECTING, TILEMAP_GAMEBOY_LINK_CONNECTING_CGB, $90, $00
db $00
Scene_GameBoyLinkTransmitting: ; 12e97 (4:6e97)
dw SGBData_GameBoyLink
dw NULL
db PALETTE_111, PALETTE_111, $00
db TILEMAP_GAMEBOY_LINK, TILEMAP_GAMEBOY_LINK_CGB, $90, $00
db SPRITE_DUEL_52
db PALETTE_114, PALETTE_114, $00
db $b3, $b0, $50, $50
dw $00
Scene_GameBoyLinkNotConnected: ; 12eac (4:6eac)
dw SGBData_GameBoyLink
dw NULL
db PALETTE_111, PALETTE_111, $00
db TILEMAP_GAMEBOY_LINK, TILEMAP_GAMEBOY_LINK_CGB, $90, $00
db SPRITE_DUEL_52
db PALETTE_114, PALETTE_114, $00
db $b4, $b1, $50, $50
dw $00
Scene_GameBoyPrinterTransmitting: ; 12ec1 (4:6ec1)
dw SGBData_GameBoyPrinter
dw LoadScene_SetGameBoyPrinterAttrBlk
db PALETTE_112, PALETTE_112, $00
db TILEMAP_GAMEBOY_PRINTER, TILEMAP_GAMEBOY_PRINTER_CGB, $90, $00
db SPRITE_DUEL_53
db PALETTE_115, PALETTE_115, $00
db $b7, $b5, $50, $30
dw $00
Scene_GameBoyPrinterNotConnected: ; 12ed6 (4:6ed6)
dw SGBData_GameBoyPrinter
dw LoadScene_SetGameBoyPrinterAttrBlk
db PALETTE_112, PALETTE_112, $00
db TILEMAP_GAMEBOY_PRINTER, TILEMAP_GAMEBOY_PRINTER_CGB, $90, $00
db SPRITE_DUEL_53
db PALETTE_115, PALETTE_115, $00
db $b8, $b6, $50, $30
dw $00
Scene_CardPop: ; 12eeb (4:6eeb)
dw SGBData_CardPop
dw LoadScene_SetCardPopAttrBlk
db PALETTE_113, PALETTE_113, $00
db TILEMAP_CARD_POP, TILEMAP_CARD_POP_CGB, $80, $00
db SPRITE_DUEL_54
db PALETTE_116, PALETTE_116, $00
db $bb, $b9, $50, $40
dw $00
Scene_CardPopError: ; 12f00 (4:6f00)
dw SGBData_CardPop
dw LoadScene_SetCardPopAttrBlk
db PALETTE_113, PALETTE_113, $00
db TILEMAP_CARD_POP, TILEMAP_CARD_POP_CGB, $80, $00
db SPRITE_DUEL_54
db PALETTE_116, PALETTE_116, $00
db $bc, $ba, $50, $40
dw $00
Scene_Nintendo: ; 12f15 (4:6f15)
dw NULL
dw NULL
db PALETTE_27, PALETTE_27, $00
db TILEMAP_NINTENDO, TILEMAP_NINTENDO, $00, $00
db $00
Scene_Companies: ; 12f21 (4:6f21)
dw NULL
dw NULL
db PALETTE_28, PALETTE_28, $00
db TILEMAP_COMPANIES, TILEMAP_COMPANIES, $00, $00
db $00
Scene_Copyright: ; 12f2d (4:6f2d)
dw NULL
dw NULL
db PALETTE_26, PALETTE_26, $00
db TILEMAP_COPYRIGHT, TILEMAP_COPYRIGHT_CGB, $00, $00
db $00
Scene_JapaneseTitleScreen2: ; 12f39 (4:6f39)
dw NULL
dw NULL
db PALETTE_109, PALETTE_100, $00
db TILEMAP_JAPANESE_TITLE_SCREEN_2, TILEMAP_JAPANESE_TITLE_SCREEN_2_CGB, $01, $00
db $00
LoadScene_LoadCompressedSGBPacket: ; 12f45 (4:6f45)
ld a, [wConsole]
cp CONSOLE_SGB
ret nz
push hl
ld hl, wSceneSGBPacketPtr
ld a, [hli]
ld h, [hl]
ld l, a
or h
jr z, .skip
farcall Func_703cb
.skip
pop hl
ret
LoadScene_LoadSGBPacket: ; 12f5b (4:6f5b)
ld a, [wConsole]
cp CONSOLE_SGB
ret nz
push hl
push bc
push de
ld hl, wSceneSGBPacketPtr
ld a, [hli]
or [hl]
jr z, .done
ld hl, wSceneSGBRoutinePtr + 1
ld a, [hld]
or [hl]
jr z, .use_default
ld a, [hli]
ld h, [hl]
ld l, a
call CallHL2
jr .done
.use_default
ld l, %001010 ; outside, border, inside palette numbers
ld a, [wBGMapWidth]
ld d, a
ld a, [wBGMapHeight]
ld e, a
farcall Func_70498
.done
pop de
pop bc
pop hl
ret
LoadScene_SetGameBoyPrinterAttrBlk: ; 12f8c (4:6f8c)
push hl
push bc
push de
ld hl, SGBPacket_GameBoyPrinter
call SendSGB
pop de
pop bc
pop hl
ret
SGBPacket_GameBoyPrinter: ; 12f99 (4:6f99)
sgb ATTR_BLK, 1
db 1 ; number of data sets
db ATTR_BLK_CTRL_OUTSIDE | ATTR_BLK_CTRL_LINE | ATTR_BLK_CTRL_INSIDE
db %101111 ; Color Palette Designation
db 11 ; x1
db 0 ; y1
db 16 ; x2
db 9 ; y2
ds 6 ; data set 2
ds 2 ; data set 3
LoadScene_SetCardPopAttrBlk: ; 12fa9 (4:6fa9)
push hl
push bc
push de
ld hl, SGBPacket_CardPop
call SendSGB
pop de
pop bc
pop hl
ret
SGBPacket_CardPop: ; 12fb6 (4:6fb6)
sgb ATTR_BLK, 1
db 1 ; number of data sets
db ATTR_BLK_CTRL_OUTSIDE | ATTR_BLK_CTRL_LINE | ATTR_BLK_CTRL_INSIDE
db %101111 ; Color Palette Designation
db 0 ; x1
db 0 ; y1
db 19 ; x2
db 4 ; y3
ds 6 ; data set 2
ds 2 ; data set 3
Func_12fc6: ; 12fc6 (4:6fc6)
ld a, [wd291]
push af
push de
push bc
ld de, wNamingScreenNamePosition
ld a, [wCurTilemap]
cp TILEMAP_PLAYER
jr z, .asm_12fd9
ld de, sTextSpeed
.asm_12fd9
ld a, e
ld [wd291], a
farcall LoadTilemap_ToVRAM
ld a, [wd61e]
add a
add a
ld c, a
ld b, $00
ld hl, Unknown_1301e
add hl, bc
ld a, [hli]
push hl
ld [wCurTileset], a
ld a, d
ld [wd4ca], a
xor a
ld [wd4cb], a
farcall LoadTilesetGfx
pop hl
xor a
ld [wd4ca], a
ld a, [wd291]
ld [wd4cb], a
ld a, [hli]
push hl
farcall SetBGPAndLoadedPal
pop hl
ld a, [hli]
ld h, [hl]
ld l, a
pop bc
farcall Func_7041d
pop de
pop af
ld [wd291], a
ret
Unknown_1301e: ; 1301e (4:701e)
db TILESET_PLAYER, PALETTE_119
dw SGBData_PlayerPortraitPals
db TILESET_PLAYER, PALETTE_119
dw SGBData_PlayerPortraitPals
db TILESET_RONALD, PALETTE_121
dw SGBData_RonaldPortraitPals
db TILESET_SAM, PALETTE_122
dw SGBData_SamPortraitPals
db TILESET_IMAKUNI, PALETTE_123
dw SGBData_ImakuniPortraitPals
db TILESET_NIKKI, PALETTE_124
dw SGBData_NikkiPortraitPals
db TILESET_RICK, PALETTE_125
dw SGBData_RickPortraitPals
db TILESET_KEN, PALETTE_126
dw SGBData_KenPortraitPals
db TILESET_AMY, PALETTE_127
dw SGBData_AmyPortraitPals
db TILESET_ISAAC, PALETTE_128
dw SGBData_IsaacPortraitPals
db TILESET_MITCH, PALETTE_129
dw SGBData_MitchPortraitPals
db TILESET_GENE, PALETTE_130
dw SGBData_GenePortraitPals
db TILESET_MURRAY, PALETTE_131
dw SGBData_MurrayPortraitPals
db TILESET_COURTNEY, PALETTE_132
dw SGBData_CourtneyPortraitPals
db TILESET_STEVE, PALETTE_133
dw SGBData_StevePortraitPals
db TILESET_JACK, PALETTE_134
dw SGBData_JackPortraitPals
db TILESET_ROD, PALETTE_135
dw SGBData_RodPortraitPals
db TILESET_JOSEPH, PALETTE_136
dw SGBData_JosephPortraitPals
db TILESET_DAVID, PALETTE_137
dw SGBData_DavidPortraitPals
db TILESET_ERIK, PALETTE_138
dw SGBData_ErikPortraitPals
db TILESET_JOHN, PALETTE_139
dw SGBData_JohnPortraitPals
db TILESET_ADAM, PALETTE_140
dw SGBData_AdamPortraitPals
db TILESET_JONATHAN, PALETTE_141
dw SGBData_JonathanPortraitPals
db TILESET_JOSHUA, PALETTE_142
dw SGBData_JoshuaPortraitPals
db TILESET_NICHOLAS, PALETTE_143
dw SGBData_NicholasPortraitPals
db TILESET_BRANDON, PALETTE_144
dw SGBData_BrandonPortraitPals
db TILESET_MATTHEW, PALETTE_145
dw SGBData_MatthewPortraitPals
db TILESET_RYAN, PALETTE_146
dw SGBData_RyanPortraitPals
db TILESET_ANDREW, PALETTE_147
dw SGBData_AndrewPortraitPals
db TILESET_CHRIS, PALETTE_148
dw SGBData_ChrisPortraitPals
db TILESET_MICHAEL, PALETTE_149
dw SGBData_MichaelPortraitPals
db TILESET_DANIEL, PALETTE_150
dw SGBData_DanielPortraitPals
db TILESET_ROBERT, PALETTE_151
dw SGBData_RobertPortraitPals
db TILESET_BRITTANY, PALETTE_152
dw SGBData_BrittanyPortraitPals
db TILESET_KRISTIN, PALETTE_153
dw SGBData_KristinPortraitPals
db TILESET_HEATHER, PALETTE_154
dw SGBData_HeatherPortraitPals
db TILESET_SARA, PALETTE_155
dw SGBData_SaraPortraitPals
db TILESET_AMANDA, PALETTE_156
dw SGBData_AmandaPortraitPals
db TILESET_JENNIFER, PALETTE_157
dw SGBData_JenniferPortraitPals
db TILESET_JESSICA, PALETTE_158
dw SGBData_JessicaPortraitPals
db TILESET_STEPHANIE, PALETTE_159
dw SGBData_StephaniePortraitPals
db TILESET_AARON, PALETTE_160
dw SGBData_AaronPortraitPals
db TILESET_PLAYER, PALETTE_120
dw SGBData_LinkOpponentPortraitPals
LoadBoosterGfx: ; 130ca (4:70ca)
push hl
push bc
push de
ld e, a
ld a, [wCurTilemap]
push af
push bc
ld a, e
call _LoadScene
call FlushAllPalettes
call SetBoosterLogoOAM
pop bc
pop af
ld [wCurTilemap], a
pop de
pop bc
pop hl
ret
SetBoosterLogoOAM: ; 130e6 (4:70e6)
ld a, [wConsole]
cp CONSOLE_CGB
ret nz
push hl
push bc
push de
push bc
xor a
ld [wd4cb], a
ld [wd4ca], a
ld a, SPRITE_BOOSTER_PACK_OAM
farcall Func_8025b
pop bc
call ZeroObjectPositions
ld hl, BoosterLogoOAM
ld c, [hl]
inc hl
.oam_loop
push bc
ldh a, [hSCX]
ld d, a
ldh a, [hSCY]
ld e, a
ld a, [wSceneBaseY]
sub e
add [hl]
ld e, a
inc hl
ld a, [wSceneBaseX]
sub d
add [hl]
ld d, a
inc hl
ld a, [wd61f]
add [hl]
ld c, a
inc hl
ld b, [hl]
inc hl
call SetOneObjectAttributes
pop bc
dec c
jr nz, .oam_loop
ld hl, wVBlankOAMCopyToggle
inc [hl]
pop de
pop bc
pop hl
ret
BoosterLogoOAM: ; 13132 (4:7132)
db $20
db $00, $00, $00, $00
db $00, $08, $01, $00
db $00, $10, $02, $00
db $00, $18, $03, $00
db $00, $20, $04, $00
db $00, $28, $05, $00
db $00, $30, $06, $00
db $00, $38, $07, $00
db $08, $00, $10, $00
db $08, $08, $11, $00
db $08, $10, $12, $00
db $08, $18, $13, $00
db $08, $20, $14, $00
db $08, $28, $15, $00
db $08, $30, $16, $00
db $08, $38, $17, $00
db $10, $00, $08, $00
db $10, $08, $09, $00
db $10, $10, $0a, $00
db $10, $18, $0b, $00
db $10, $20, $0c, $00
db $10, $28, $0d, $00
db $10, $30, $0e, $00
db $10, $38, $0f, $00
db $18, $00, $18, $00
db $18, $08, $19, $00
db $18, $10, $1a, $00
db $18, $18, $1b, $00
db $18, $20, $1c, $00
db $18, $28, $1d, $00
db $18, $30, $1e, $00
db $18, $38, $1f, $00
Func_131b3: ; 131b3 (4:71b3)
call ChallengeMachine_Initialize
call EnableSRAM
xor a
ld [sTotalChallengeMachineWins], a
ld [sTotalChallengeMachineWins + 1], a
ld [sPresentConsecutiveWins], a
ld [sPresentConsecutiveWins + 1], a
ld [sPresentConsecutiveWinsBackup], a
ld [sPresentConsecutiveWinsBackup + 1], a
ld [sPlayerInChallengeMachine], a
call DisableSRAM
ret
; if a challenge is already in progress, then resume
; otherwise, start a new 5 round challenge
ChallengeMachine_Start: ; 131d3 (4:71d3)
ld a, 0
ld [wLineSeparation], a
call Func_10a9b
call ChallengeMachine_Initialize
call EnableSRAM
ld a, [sPlayerInChallengeMachine]
call DisableSRAM
cp $ff
jr z, .resume_challenge
; new challenge
call ChallengeMachine_PickOpponentSequnce
call ChallengeMachine_DrawScoreScreen
call FlashWhiteScreen
ldtx hl, PlayTheChallengeMachineText
call YesOrNoMenuWithText_SetCursorToYes
jp c, .end_challenge
ldtx hl, LetUsChooseYourOpponentText
call PrintScrollableText_NoTextBoxLabel
call Func_10ab4
call EnableSRAM
xor a
ld [sPresentConsecutiveWinsBackup], a
ld [sPresentConsecutiveWinsBackup + 1], a
call DisableSRAM
call ChallengeMachine_DrawOpponentList
call FlashWhiteScreen
ldtx hl, YourOpponentsForThisGameText
call PrintScrollableText_NoTextBoxLabel
; begin challenge loop
.next_opponent
call ChallengeMachine_GetCurrentOpponent
call ChallengeMachine_AreYouReady
jr nc, .start_duel
ldtx hl, IfYouQuitTheDuelText
call PrintScrollableText_NoTextBoxLabel
ldtx hl, WouldYouLikeToQuitTheDuelText
call YesOrNoMenuWithText
jr c, .next_opponent
jp .quit
.start_duel
call EnableSRAM
ld a, $ff
ld [sPlayerInChallengeMachine], a
call DisableSRAM
call ChallengeMachine_Duel
.resume_challenge
call EnableSRAM
xor a
ld [sPlayerInChallengeMachine], a
bank1call DiscardSavedDuelData
call DisableSRAM
call ChallengeMachine_GetCurrentOpponent
call ChallengeMachine_RecordDuelResult
call ChallengeMachine_DrawOpponentList
call FlashWhiteScreen
ld a, [wDuelResult]
or a
jr nz, .lost
; won
call ChallengeMachine_DuelWon
call EnableSRAM
ld a, [sChallengeMachineOpponentNumber]
cp NUM_CHALLENGE_MACHINE_OPPONENTS - 1
jr z, .defeated_five_opponents
ld hl, sChallengeMachineOpponentNumber
inc [hl]
call DisableSRAM
jr .next_opponent
.defeated_five_opponents
ld hl, sTotalChallengeMachineWins
call ChallengeMachine_IncrementHLMax999
call Func_10ab4
call ChallengeMachine_CheckForNewRecord
call ChallengeMachine_DrawScoreScreen
call FlashWhiteScreen
call EnableSRAM
ld a, [sTotalChallengeMachineWins]
ld [wTxRam3], a
ld a, [sTotalChallengeMachineWins + 1]
ld [wTxRam3 + 1], a
call DisableSRAM
ldtx hl, SuccessfullyDefeated5OpponentsText
call PrintScrollableText_NoTextBoxLabel
jr .end_challenge
.lost
call ChallengeMachine_GetCurrentOpponent
call EnableSRAM
ld a, [sChallengeMachineOpponentNumber]
inc a
ld [wTxRam3], a
xor a
ld [wTxRam3 + 1], a
call DisableSRAM
call ChallengeMachine_GetOpponentNameAndDeck
ld a, [wOpponentName]
ld [wTxRam2], a
ld a, [wOpponentName + 1]
ld [wTxRam2 + 1], a
ldtx hl, LostToTheNthOpponentText
call PrintScrollableText_NoTextBoxLabel
.quit
call ChallengeMachine_PrintFinalConsecutiveWinStreak
call Func_10ab4
call ChallengeMachine_CheckForNewRecord
call ChallengeMachine_DrawScoreScreen
call FlashWhiteScreen
call EnableSRAM
; reset streak
xor a
ld [sPresentConsecutiveWins], a
ld [sPresentConsecutiveWins + 1], a
call DisableSRAM
.end_challenge ; end, win or lose
call ChallengeMachine_CheckForNewRecord ; redundant?
call EnableSRAM
ld a, [sPresentConsecutiveWins]
ld [sPresentConsecutiveWinsBackup], a
ld a, [sPresentConsecutiveWins + 1]
ld [sPresentConsecutiveWinsBackup + 1], a
call ChallengeMachine_ShowNewRecord
call DisableSRAM
ldtx hl, WeAwaitYourNextChallengeText
call PrintScrollableText_NoTextBoxLabel
ret
; update wChallengeMachineOpponent with the current
; opponent in the sChallengeMachineOpponents list
ChallengeMachine_GetCurrentOpponent: ; 1330b (4:730b)
call EnableSRAM
ld a, [sChallengeMachineOpponentNumber]
ld e, a
ld d, 0
ld hl, sChallengeMachineOpponents
add hl, de
ld a, [hl]
ld [wChallengeMachineOpponent], a
call DisableSRAM
ret
; play the appropriate match start theme
; then duel the current opponent
ChallengeMachine_Duel: ; 13320 (4:7320)
call ChallengeMachine_PrepareDuel
call EnableSRAM
ld a, [sChallengeMachineOpponentNumber]
ld e, a
call DisableSRAM
ld d, 0
ld hl, ChallengeMachine_SongIDs
add hl, de
ld a, [hl]
call PlaySong
call WaitForSongToFinish
xor a
ld [wd112], a
call SaveGeneralSaveData
bank1call StartDuel_VSAIOpp
ret
ChallengeMachine_SongIDs: ; 13345 (4:7345)
db MUSIC_MATCH_START_1
db MUSIC_MATCH_START_1
db MUSIC_MATCH_START_1
db MUSIC_MATCH_START_2
db MUSIC_MATCH_START_2
; get the current opponent's name, deck, and prize count
ChallengeMachine_PrepareDuel: ; 1334a (4:734a)
call ChallengeMachine_GetOpponentNameAndDeck
call EnableSRAM
ld a, [sChallengeMachineOpponentNumber]
ld e, a
call DisableSRAM
ld d, 0
ld hl, ChallengeMachine_Prizes
add hl, de
ld a, [hl]
ld [wNPCDuelPrizes], a
ret
ChallengeMachine_Prizes: ; 13362 (4:7362)
db PRIZES_4
db PRIZES_4
db PRIZES_4
db PRIZES_6
db PRIZES_6
; store the result of the last duel in the current
; position of the sChallengeMachineDuelResults list
ChallengeMachine_RecordDuelResult: ; 13367 (4:7367)
call EnableSRAM
ld a, [sChallengeMachineOpponentNumber]
ld e, a
ld d, 0
ld hl, sChallengeMachineDuelResults
add hl, de
ld a, [wDuelResult]
or a
jr nz, .lost
ld a, 1 ; won
ld [hl], a
call DisableSRAM
ld hl, sPresentConsecutiveWins
call ChallengeMachine_IncrementHLMax999
ret
.lost
ld a, 2 ; lost
ld [hl], a
call DisableSRAM
ret
; increment the value at hl
; without going above 999
ChallengeMachine_IncrementHLMax999: ; 1338e (4:738e)
call EnableSRAM
inc hl
ld a, [hld]
cp HIGH(999)
jr nz, .increment
ld a, [hl]
cp LOW(999)
jr z, .skip
.increment
ld a, [hl]
add 1
ld [hli], a
ld a, [hl]
adc 0
ld [hl], a
.skip
call DisableSRAM
ret
; update sMaximumConsecutiveWins if the player set a new record
ChallengeMachine_CheckForNewRecord: ; 133a8 (4:73a8)
call EnableSRAM
ld hl, sMaximumConsecutiveWins + 1
ld a, [sPresentConsecutiveWins + 1]
cp [hl]
jr nz, .high_bytes_different
; high bytes equal, check low bytes
dec hl
ld a, [sPresentConsecutiveWins]
cp [hl]
.high_bytes_different
jr c, .no_record
jr z, .no_record
; new record
ld hl, sMaximumConsecutiveWins
ld a, [sPresentConsecutiveWins]
ld [hli], a
ld a, [sPresentConsecutiveWins + 1]
ld [hl], a
ld hl, sPlayerName
ld de, sChallengeMachineRecordHolderName
ld bc, NAME_BUFFER_LENGTH
call CopyDataHLtoDE_SaveRegisters
; remember to show congrats message later
ld a, TRUE
ld [sConsecutiveWinRecordIncreased], a
.no_record
call DisableSRAM
ret
; print the next opponent's name and ask the
; player if they want to begin the next duel
ChallengeMachine_AreYouReady: ; 133dd (4:73dd)
call EnableSRAM
ld a, [sChallengeMachineOpponentNumber]
inc a
ld [wTxRam3], a
ld [wTxRam3_b], a
xor a
ld [wTxRam3 + 1], a
ld [wTxRam3_b + 1], a
ldtx hl, NthOpponentIsText
ld a, [sPresentConsecutiveWins + 1]
or a
jr nz, .streak
ld a, [sPresentConsecutiveWins]
cp 2
jr c, .no_streak
.streak
ldtx hl, XConsecutiveWinsNthOpponentIsText
ld a, [sPresentConsecutiveWins]
ld [wTxRam3], a
ld a, [sPresentConsecutiveWins + 1]
ld [wTxRam3 + 1], a
.no_streak
call DisableSRAM
push hl ; text id
call ChallengeMachine_GetOpponentNameAndDeck
ld a, [wOpponentName]
ld [wTxRam2], a
ld a, [wOpponentName + 1]
ld [wTxRam2 + 1], a
pop hl ; text id
call PrintScrollableText_NoTextBoxLabel
ldtx hl, WouldYouLikeToBeginTheDuelText
call YesOrNoMenuWithText_SetCursorToYes
ret
; print opponent win count
; play a jingle for beating 5 opponents
ChallengeMachine_DuelWon: ; 1342e (4:742e)
call EnableSRAM
ld a, [sChallengeMachineOpponentNumber]
inc a
ld [wTxRam3], a
xor a
ld [wTxRam3 + 1], a
ldtx hl, WonAgainstXOpponentsText
ld a, [sChallengeMachineOpponentNumber]
call DisableSRAM
cp NUM_CHALLENGE_MACHINE_OPPONENTS - 1
jr z, .beat_five_opponents
call PrintScrollableText_NoTextBoxLabel
ret
.beat_five_opponents
call PauseSong
ld a, MUSIC_MEDAL
call PlaySong
ldtx hl, Defeated5OpponentsText
call PrintScrollableText_NoTextBoxLabel
call WaitForSongToFinish
call ResumeSong
ret
; when a player's streak ends, print the final
; consecutive win count
ChallengeMachine_PrintFinalConsecutiveWinStreak: ; 13462 (4:7462)
call EnableSRAM
ld a, [sPresentConsecutiveWins]
ld [wTxRam3], a
ld a, [sPresentConsecutiveWins + 1]
ld [wTxRam3 + 1], a
or a
jr nz, .streak
ld a, [sPresentConsecutiveWins]
cp 2
jr c, .no_streak
.streak
ldtx hl, ConsecutiveWinsEndedAtText
call PrintScrollableText_NoTextBoxLabel
.no_streak
call DisableSRAM
ret
; if the player achieved a new record, play a jingle
; otherwise, do nothing
ChallengeMachine_ShowNewRecord: ; 13485 (4:7485)
call EnableSRAM
ld a, [sConsecutiveWinRecordIncreased]
or a
ret z ; no new record
ld a, [sMaximumConsecutiveWins]
ld [wTxRam3], a
ld a, [sMaximumConsecutiveWins + 1]
ld [wTxRam3 + 1], a
call DisableSRAM
call PauseSong
ld a, MUSIC_MEDAL
call PlaySong
ldtx hl, ConsecutiveWinRecordIncreasedText
call PrintScrollableText_NoTextBoxLabel
call WaitForSongToFinish
call ResumeSong
ret
ChallengeMachine_DrawScoreScreen: ; 134b1 (4:74b1)
call Func_10000
lb de, $30, $bf
call SetupText
lb de, 0, 0
lb bc, 20, 13
call DrawRegularTextBox
lb de, 0, 12
lb bc, 20, 6
call DrawRegularTextBox
call EnableSRAM
ld hl, sChallengeMachineRecordHolderName
ld de, wDefaultText
ld bc, NAME_BUFFER_LENGTH
call CopyDataHLtoDE
call DisableSRAM
xor a
ld [wTxRam2], a
ld [wTxRam2 + 1], a
ld hl, ChallengeMachine_PlayerScoreTexts
call Func_111b3
ld hl, ChallengeMachine_PlayerScoreValues
call ChallengeMachine_PrintScores
ret
ChallengeMachine_PlayerScoreTexts: ; 134f2 (4:74f2)
db 1, 0
tx ChallengeMachineText
db 1, 2
tx PlayersScoreText
db 2, 4
tx Defeated5OpponentsXTimesText
db 2, 6
tx PresentConsecutiveWinsText
db 1, 8
tx MaximumConsecutiveWinsText
db 17, 6
tx WinsText
db 16, 10
tx WinsText
db $ff
ChallengeMachine_PlayerScoreValues: ; 1350f (4:750f)
dw sTotalChallengeMachineWins
db 12, 4
dw sPresentConsecutiveWins
db 14, 6
dw sMaximumConsecutiveWins
db 13, 10
dw NULL
ChallengeMachine_DrawOpponentList: ; 1351d (4:751d)
call Func_10000
lb de, $30, $bf
call SetupText
lb de, 0, 0
lb bc, 20, 13
call DrawRegularTextBox
lb de, 0, 12
lb bc, 20, 6
call DrawRegularTextBox
ld hl, ChallengeMachine_OpponentNumberTexts
call Func_111b3
call ChallengeMachine_PrintOpponentInfo
call ChallengeMachine_PrintDuelResultIcons
ret
ChallengeMachine_OpponentNumberTexts: ; 13545 (4:7545)
db 1, 0
tx ChallengeMachineText
db 2, 2
tx ChallengeMachineOpponent1Text
db 2, 4
tx ChallengeMachineOpponent2Text
db 2, 6
tx ChallengeMachineOpponent3Text
db 2, 8
tx ChallengeMachineOpponent4Text
db 2, 10
tx ChallengeMachineOpponent5Text
db $ff
ChallengeMachine_PrintOpponentInfo: ; 1355e (4:755e)
ld hl, sChallengeMachineOpponents
ld bc, 2 ; beginning y-pos
ld e, NUM_CHALLENGE_MACHINE_OPPONENTS
.loop
push hl
push bc
push de
call EnableSRAM
ld a, [hl]
ld [wChallengeMachineOpponent], a
ld b, 14 ; x-pos
call ChallengeMachine_PrintOpponentName
ld b, 4 ; x-pos
call ChallengeMachine_PrintOpponentClubStatus
pop de
pop bc
pop hl
inc hl
; down two rows
inc c
inc c
dec e
jr nz, .loop
call DisableSRAM
ret
ChallengeMachine_PrintOpponentName: ; 13587 (4:7587)
push bc
call ChallengeMachine_GetOpponentNameAndDeck
ld de, 2 ; name
add hl, de
call ChallengeMachine_PrintText
pop bc
ret
ChallengeMachine_PrintText: ; 13594 (4:7594)
ld a, [hli]
ld h, [hl]
ld l, a
ld e, c
ld d, b
push de
call InitTextPrinting
call PrintTextNoDelay
pop de
ret
; print the opponent's rank and element
ChallengeMachine_PrintOpponentClubStatus: ; 135a2 (4:75a2)
push bc
call ChallengeMachine_GetOpponentNameAndDeck
push hl
ld de, 6 ; rank
add hl, de
call ChallengeMachine_PrintText
ld a, d
add $07
ld d, a
call InitTextPrinting
pop hl
ld bc, 8 ; element
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
or h
jr z, .no_element
call PrintTextNoDelay
.no_element
pop bc
ret
ChallengeMachine_GetOpponentNameAndDeck: ; 135c5 (4:75c5)
push de
ld a, [wChallengeMachineOpponent]
ld e, a
ld d, 0
ld hl, ChallengeMachine_OpponentDeckIDs
add hl, de
ld a, [hl]
ld [wNPCDuelDeckID], a
call _GetChallengeMachineDuelConfigurations
pop de
ret
ChallengeMachine_PrintDuelResultIcons: ; 135d9 (4:75d9)
ld hl, sChallengeMachineDuelResults
ld c, NUM_CHALLENGE_MACHINE_OPPONENTS
lb de, 1, 2
.print_loop
push hl
push bc
push de
call InitTextPrinting
call EnableSRAM
ld a, [hl]
add a
ld e, a
ld d, 0
ld hl, ChallengeMachine_DuelResultIcons
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
call PrintTextNoDelay
pop de
pop bc
pop hl
inc hl
; down two rows
inc e
inc e
dec c
jr nz, .print_loop
call DisableSRAM
ret
ChallengeMachine_DuelResultIcons: ; 13606 (4:7606)
tx ChallengeMachineNotDuelledIconText
tx ChallengeMachineDuelWonIconText
tx ChallengeMachineDuelLostIconText
; print all scores in the table pointed to by hl
ChallengeMachine_PrintScores: ; 1360c (4:760c)
.loop
call EnableSRAM
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
or e
jr z, .done
ld b, [hl]
inc hl
ld c, [hl]
inc hl
push hl
push bc
ld a, [de]
ld l, a
inc de
ld a, [de]
ld h, a
call Func_10217
pop bc
call BCCoordToBGMap0Address
ld hl, wd4b4
ld b, 3
call SafeCopyDataHLtoDE
pop hl
jr .loop
.done
call DisableSRAM
ret
; if this is the first time the challenge machine has ever
; been used on this cartridge, then clear all vars and
; set Dr. Mason as the record holder
ChallengeMachine_Initialize: ; 13637 (4:7637)
call EnableSRAM
ld a, [sChallengeMachineMagic]
cp $e3
jr nz, .init_vars
ld a, [sChallengeMachineMagic + 1]
cp $95
jr z, .done
.init_vars
ld hl, sChallengeMachineMagic
ld c, sChallengeMachineEnd - sChallengeMachineStart
ld a, $e3
ld [hli], a
ld a, $95
ld [hli], a
xor a
.clear_loop
ld [hli], a
dec c
jr nz, .clear_loop
ld hl, ChallengeMachine_DrMasonText
ld de, sChallengeMachineRecordHolderName
ld bc, NAME_BUFFER_LENGTH
call CopyDataHLtoDE_SaveRegisters
ld a, 1
ld [sMaximumConsecutiveWins], a
xor a
ld [sMaximumConsecutiveWins + 1], a
.done
ld a, [sPlayerInChallengeMachine]
call DisableSRAM
ret
ChallengeMachine_DrMasonText: ; 13674 (4:7674)
text "Dr. Mason", TX_END, TX_END, TX_END, TX_END, TX_END, TX_END
; pick the next opponent sequence and clear challenge vars
ChallengeMachine_PickOpponentSequnce: ; 13684 (4:7684)
call EnableSRAM
; pick first opponent
ld a, CLUB_MASTERS_START
call Random
ld [sChallengeMachineOpponents], a
.pick_second_opponent
ld a, CLUB_MASTERS_START
call Random
ld c, 1
call ChallengeMachine_CheckIfOpponentAlreadySelected
jr c, .pick_second_opponent
ld [sChallengeMachineOpponents + 1], a
.pick_third_opponent
ld a, CLUB_MASTERS_START
call Random
ld c, 2
call ChallengeMachine_CheckIfOpponentAlreadySelected
jr c, .pick_third_opponent
ld [sChallengeMachineOpponents + 2], a
; pick fourth opponent
ld a, GRAND_MASTERS_START - CLUB_MASTERS_START
call Random
add CLUB_MASTERS_START
ld [sChallengeMachineOpponents + 3], a
; pick fifth opponent
call UpdateRNGSources
ld hl, ChallengeMachine_FinalOpponentProbabilities
.next
sub [hl]
jr c, .got_opponent
inc hl
inc hl
jr .next
.got_opponent
inc hl
ld a, [hl]
ld [sChallengeMachineOpponents + 4], a
xor a
ld [sChallengeMachineOpponentNumber], a
ld [sConsecutiveWinRecordIncreased], a
ld hl, sChallengeMachineDuelResults
ld c, NUM_CHALLENGE_MACHINE_OPPONENTS
.clear_results
ld [hli], a
dec c
jr nz, .clear_results
ld a, [sPresentConsecutiveWinsBackup]
ld [sPresentConsecutiveWins], a
ld a, [sPresentConsecutiveWinsBackup + 1]
ld [sPresentConsecutiveWins + 1], a
call DisableSRAM
ret
ChallengeMachine_FinalOpponentProbabilities: ; 136e9 (4:76e9)
db 56, GRAND_MASTERS_START + 0 ; 56/256, courtney
db 56, GRAND_MASTERS_START + 1 ; 56/256, steve
db 56, GRAND_MASTERS_START + 2 ; 56/256, jack
db 56, GRAND_MASTERS_START + 3 ; 56/256, rod
db 8, GRAND_MASTERS_START + 4 ; 8/256, aaron
db 8, GRAND_MASTERS_START + 5 ; 8/256, aaron
db 8, GRAND_MASTERS_START + 6 ; 8/256, aaron
db 255, GRAND_MASTERS_START + 7 ; 8/256, imakuni (catch-all)
; return carry if the opponent in a is already among
; the first c opponents in sChallengeMachineOpponents
ChallengeMachine_CheckIfOpponentAlreadySelected: ; 136f9 (4:76f9)
ld hl, sChallengeMachineOpponents
.loop
cp [hl]
jr z, .found
inc hl
dec c
jr nz, .loop
; not found
or a
ret
.found
scf
ret
ChallengeMachine_OpponentDeckIDs: ; 13707 (4:7707)
.club_members
db MUSCLES_FOR_BRAINS_DECK_ID
db HEATED_BATTLE_DECK_ID
db LOVE_TO_BATTLE_DECK_ID
db EXCAVATION_DECK_ID
db BLISTERING_POKEMON_DECK_ID
db HARD_POKEMON_DECK_ID
db WATERFRONT_POKEMON_DECK_ID
db LONELY_FRIENDS_DECK_ID
db SOUND_OF_THE_WAVES_DECK_ID
db PIKACHU_DECK_ID
db BOOM_BOOM_SELFDESTRUCT_DECK_ID
db POWER_GENERATOR_DECK_ID
db ETCETERA_DECK_ID
db FLOWER_GARDEN_DECK_ID
db KALEIDOSCOPE_DECK_ID
db GHOST_DECK_ID
db NAP_TIME_DECK_ID
db STRANGE_POWER_DECK_ID
db FLYIN_POKEMON_DECK_ID
db LOVELY_NIDORAN_DECK_ID
db POISON_DECK_ID
db ANGER_DECK_ID
db FLAMETHROWER_DECK_ID
db RESHUFFLE_DECK_ID
.club_masters
db FIRST_STRIKE_DECK_ID
db ROCK_CRUSHER_DECK_ID
db GO_GO_RAIN_DANCE_DECK_ID
db ZAPPING_SELFDESTRUCT_DECK_ID
db FLOWER_POWER_DECK_ID
db STRANGE_PSYSHOCK_DECK_ID
db WONDERS_OF_SCIENCE_DECK_ID
db FIRE_CHARGE_DECK_ID
.grand_masters
db LEGENDARY_MOLTRES_DECK_ID
db LEGENDARY_ZAPDOS_DECK_ID
db LEGENDARY_ARTICUNO_DECK_ID
db LEGENDARY_DRAGONITE_DECK_ID
db LIGHTNING_AND_FIRE_DECK_ID
db WATER_AND_FIGHTING_DECK_ID
db GRASS_AND_PSYCHIC_DECK_ID
db IMAKUNI_DECK_ID
CLUB_MASTERS_START EQU ChallengeMachine_OpponentDeckIDs.club_masters - ChallengeMachine_OpponentDeckIDs.club_members
GRAND_MASTERS_START EQU ChallengeMachine_OpponentDeckIDs.grand_masters - ChallengeMachine_OpponentDeckIDs.club_members
INCLUDE "data/npc_map_data.asm"
INCLUDE "data/map_objects.asm"
|