summaryrefslogtreecommitdiff
path: root/engine/color.asm
blob: 05c13b2b0786530a59be9f9f6f7cfa94a581aba4 (plain)
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
PALPACKET_LENGTH EQU $10
INCLUDE "predef/sgb.asm"

SHINY_ATK_BIT EQU 5
SHINY_DEF_VAL EQU 10
SHINY_SPD_VAL EQU 10
SHINY_SPC_VAL EQU 10

CheckShininess:
	ld l, c
	ld h, b
	ld a, [hl]
	and $20
	jr z, .asm_9070
	ld a, [hli]
	and $f
	cp $a
	jr nz, .asm_9070
	ld a, [hl]
	and $f0
	cp $a0
	jr nz, .asm_9070
	ld a, [hl]
	and $f
	cp $a
	jr nz, .asm_9070
	scf
	ret

.asm_9070
	and a
	ret

Unused_CheckShininess: ; 9072 (2:5072)
	ld a, [hl]
	cp $a0
	jr c, .asm_908c
	ld a, [hli]
	and $f
	cp $a
	jr c, .asm_908c
	ld a, [hl]
	cp $a0
	jr c, .asm_908c
	ld a, [hl]
	and $f
	cp $a
	jr c, .asm_908c
	scf
	ret

.asm_908c
	and a
	ret

Function908e:
	push de
	push bc
	ld hl, PalPacket_a155
	ld de, wcca9
	ld bc, $10
	call CopyBytes
	pop bc
	pop de
	ld a, c
	ld [wccac], a
	ld a, b
	ld [wccad], a
	ld a, e
	ld [wccae], a
	ld a, d
	ld [wccaf], a
	ld hl, wcca9
	call PushSGBPals_
	ld hl, BlkPacket_9ee5
	call PushSGBPals_
	ret

InitPartyMenuPalettes:
	call CheckCGB
	jr nz, .asm_90cc
	ld hl, BlkPacket_9fa5
	ld de, wccaa
	ld bc, $30
	jp CopyBytes

.asm_90cc
	ld hl, PalPacket_a0c5 + 1
	call Function9ab2
	call Function9b9c
	call Function9b1d
	ret

SGB_ApplyPartyMenuHPPals:
	ld hl, wcc9b
	ld a, [wcca9]
	ld e, a
	ld d, $0
	add hl, de
	ld e, l
	ld d, h
	ld a, [de]
	and a
	ld e, $5
	jr z, .asm_90f2
	dec a
	ld e, $a
	jr z, .asm_90f2
	ld e, $f
.asm_90f2
	push de
	ld hl, wccb3
	ld bc, $6
	ld a, [wcca9]
	call AddNTimes
	pop de
	ld [hl], e
	ret

Function9102:
	call CheckCGB
	ret z
	ld hl, .BGPal
	ld de, wTempBGPals
	ld bc, $8
	call CopyBytes
	ld hl, .OBPal
	ld de, wTempOBPals
	ld bc, $8
	call CopyBytes
	call Function9b28
	ld a, $1
	ldh [hCGBPalUpdate], a
	ret

.BGPal:
	RGB 31, 31, 31
	RGB 18, 23, 31
	RGB 15, 20, 31
	RGB 00, 00, 00

.OBPal:
	RGB 31, 31, 31
	RGB 31, 31, 12
	RGB 08, 16, 28
	RGB 00, 00, 00

Function9136:
	call CheckCGB
	ret nz
	ldh a, [hSGB]
	and a
	ret z
	ld hl, BlkPacket_9ee5
	jp PushSGBPals_

Function9144:
	call CheckCGB
	jr nz, .asm_9153
	ldh a, [hSGB]
	and a
	ret z
	ld hl, PalPacket_a095
	jp PushSGBPals_

.asm_9153
	ld de, wTempOBPals
	ld a, $3b
	call Function9ac7
	jp Function9ad2

Function915e:
	call CheckCGB
	jr nz, .asm_916d
	ldh a, [hSGB]
	and a
	ret z
	ld hl, PalPacket_a0a5
	jp PushSGBPals_

.asm_916d
	ld de, wTempOBPals
	ld a, $3c
	call Function9ac7
	jp Function9ad2

Function9178:
	call CheckCGB
	jr nz, .asm_91a9
	ldh a, [hSGB]
	and a
	ret z
	ld a, c
	push af
	ld hl, PalPacket_a155
	ld de, wcca9
	ld bc, $10
	call CopyBytes
	pop af
	call Function9be4
	ld a, [hli]
	ld [wccac], a
	ld a, [hli]
	ld [wccad], a
	ld a, [hli]
	ld [wccae], a
	ld a, [hl]
	ld [wccaf], a
	ld hl, wcca9
	jp PushSGBPals_

.asm_91a9
	ld de, wTempOBPals
	ld a, c
	call Function9be4
	call Function9adb
	ret

Function91b4:
	ldh a, [hCGB]
	and a
	jr nz, .asm_91bf
	ld hl, wc602
	jp PushSGBPals_

.asm_91bf
	ld a, [wc606]
	ld c, a
	ld a, [wc607]
	ld hl, wAttrmap
	ld de, $14
.asm_91cc
	and a
	jr z, .asm_91d3
	add hl, de
	dec a
	jr .asm_91cc

.asm_91d3
	ld b, $0
	add hl, bc
	lb bc, 6, 4
	ld a, [wc605]
	and $3
	call Function9af1
	call CopyTilemapAtOnce
	ret

ApplyMonOrTrainerPals: ; 91e5 (2:51e5)
	call CheckCGB
	ret z
	ld a, e
	and a
	jr z, .asm_91f5
	ld a, [wCurPartySpecies]
	call Function9be4
	jr .asm_91fb

.asm_91f5
	ld a, [wTrainerClass]
	call Function9bda
.asm_91fb
	ld de, wTempBGPals
	call Function9adb
	call Function9b1d
	call Function9b35
	call Function9b28
	ret

ApplyHPBarPals:
	ld a, [wWhichHPBar]
	and a
	jr z, .asm_921a
	cp $1
	jr z, .asm_921f
	cp $2
	jr z, .asm_9236
	ret

.asm_921a
	ld de, $c292
	jr .asm_9222

.asm_921f
	ld de, $c29a
.asm_9222
	ld l, c
	ld h, $0
	add hl, hl
	add hl, hl
	ld bc, $6d2d
	add hl, bc
	ld bc, $4
	call CopyBytes
	ld a, $1
	ldh [hCGBPalUpdate], a
	ret

.asm_9236
	ld e, c
	inc e
	hlcoord 11, 1, wAttrmap
	ld bc, 2 * SCREEN_WIDTH
	ld a, [wCurPartyMon]
.asm_9241
	and a
	jr z, .asm_9248
	add hl, bc
	dec a
	jr .asm_9241

.asm_9248
	lb bc, 2, 8
	ld a, e
	call Function9af1
	ret

LoadStatsScreenPals:
	call CheckCGB
	ret z
	ld hl, StatsScreenPals ; $54eb
	ld b, $0
	dec c
	add hl, bc
	add hl, bc
	ld a, [hli]
	ld [wTempBGPals], a
	ld [wTempBGPals + $10], a
	ld a, [hl]
	ld [wTempBGPals + 1], a
	ld [wTempBGPals + $11], a
	call Function9b28
	ld a, $1
	ldh [hCGBPalUpdate], a
	ret

LoadMailPalettes:
	ld l, e
	ld h, $0
	add hl, hl
	add hl, hl
	add hl, hl
	ld de, .MailPals
	add hl, de
	call CheckCGB
	jr nz, .asm_92ae
	push hl
	ld hl, PalPacket_a155
	ld de, wcca9
	ld bc, $10
	call CopyBytes
	pop hl
	inc hl
	inc hl
	ld a, [hli]
	ld [wccac], a
	ld a, [hli]
	ld [wccad], a
	ld a, [hli]
	ld [wccae], a
	ld a, [hli]
	ld [wccaf], a
	ld hl, wcca9
	call PushSGBPals_
	ld hl, BlkPacket_9ee5
	call PushSGBPals_
	ret

.asm_92ae
	ld de, wTempBGPals
	ld bc, $8
	call CopyBytes
	call Function9b28
	call Function9b1d
	call Function9b35
	ret

.MailPals:
	RGB 20, 31, 11
	RGB 31, 19, 00
	RGB 31, 10, 09
	RGB 00, 00, 00

	RGB 15, 20, 31
	RGB 30, 26, 00
	RGB 31, 12, 00
	RGB 00, 00, 00

	RGB 24, 17, 31
	RGB 30, 26, 00
	RGB 08, 11, 31
	RGB 00, 00, 00

	RGB 31, 25, 17
	RGB 31, 18, 04
	RGB 28, 12, 05
	RGB 00, 00, 00

	RGB 19, 26, 31
	RGB 31, 05, 08
	RGB 31, 09, 31
	RGB 00, 00, 00

	RGB 31, 19, 28
	RGB 31, 21, 00
	RGB 12, 22, 00
	RGB 00, 00, 00

	RGB 19, 17, 23
	RGB 30, 26, 00
	RGB 31, 12, 00
	RGB 00, 00, 00

	RGB 07, 26, 31
	RGB 26, 26, 27
	RGB 31, 11, 11
	RGB 00, 00, 00

	RGB 21, 31, 21
	RGB 30, 26, 00
	RGB 31, 12, 00
	RGB 00, 00, 00

	RGB 07, 26, 31
	RGB 31, 31, 00
	RGB 00, 21, 00
	RGB 00, 00, 00

INCLUDE "predef/cgb.asm"

Function9a94: ; 9a94 (2:5a94)
	ld hl, Palettes_9aaa
	ld de, wTempBGPals
	ld bc, $8
	call CopyBytes
	call Function9b28
	call Function9b1d
	call Function9b35
	ret

Palettes_9aaa:
	RGB 31, 31, 31
	RGB  9, 31, 31
	RGB 10, 12, 31
	RGB  0,  3, 19

Function9ab2: ; 9ab2 (2:5ab2)
	ld de, wTempBGPals
	ld c, $4
Function9ab7: ; 9ab7 (2:5ab7)
	push bc
	ld a, [hli]
	push hl
	call Function9ac7
	call Function9ad2
	pop hl
	inc hl
	pop bc
	dec c
	jr nz, Function9ab7
	ret

Function9ac7: ; 9ac7 (2:5ac7)
	ld l, a
	ld h, $0
	add hl, hl
	add hl, hl
	add hl, hl
	ld bc, Palettes_a265
	add hl, bc
	ret

Function9ad2: ; 9ad2 (2:5ad2)
	ld c, $8
.asm_9ad4
	ld a, [hli]
	ld [de], a
	inc de
	dec c
	jr nz, .asm_9ad4
	ret

Function9adb: ; 9adb (2:5adb)
	ld a, $ff
	ld [de], a
	inc de
	ld a, $7f
	ld [de], a
	inc de
	ld c, $4
.asm_9ae5
	ld a, [hli]
	ld [de], a
	inc de
	dec c
	jr nz, .asm_9ae5
	xor a
	ld [de], a
	inc de
	ld [de], a
	inc de
	ret

Function9af1: ; 9af1 (2:5af1)
	push bc
	push hl
.asm_9af3
	ld [hli], a
	dec c
	jr nz, .asm_9af3
	pop hl
	ld bc, $14
	add hl, bc
	pop bc
	dec b
	jr nz, Function9af1
	ret

Function9b01: ; 9b01 (2:5b01)
	push af
	push bc
	push de
	push hl
	ld hl, wTempBGPals
	ld c, $8
.asm_9b0a
	ld a, $ff
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	xor a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	dec c
	jr nz, .asm_9b0a
	pop hl
	pop de
	pop bc
	pop af
	ret

Function9b1d: ; 9b1d (2:5b1d)
	hlcoord 0, 0, wAttrmap
	ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
	xor a
	call ByteFill
	ret

Function9b28: ; 9b28 (2:5b28)
	ld hl, wTempBGPals
	ld de, wBGPals
	ld bc, $80
	call CopyBytes
	ret

Function9b35: ; 9b35 (2:5b35)
	ldh a, [rLCDC]
	bit 7, a
	jr z, .asm_9b52
	ldh a, [hBGMapMode]
	push af
	ld a, $2
	ldh [hBGMapMode], a
	call DelayFrame
	call DelayFrame
	call DelayFrame
	call DelayFrame
	pop af
	ldh [hBGMapMode], a
	ret

.asm_9b52
	hlcoord 0, 0, wAttrmap
	ld de, $9800
	ld b, $12
	ld a, $1
	ldh [rVBK], a
.asm_9b5e
	ld c, $14
.asm_9b60
	ld a, [hli]
	ld [de], a
	inc de
	dec c
	jr nz, .asm_9b60
	ld a, $c
	add e
	jr nc, .asm_9b6c
	inc d
.asm_9b6c
	ld e, a
	dec b
	jr nz, .asm_9b5e
	ld a, $0
	ldh [rVBK], a
	ret

Function9b75: ; 9b75 (2:5b75)
	ld hl, wcc9b
	ld a, [wcca9]
	ld e, a
	ld d, $0
	add hl, de
	ld e, l
	ld d, h
	ld a, [de]
	inc a
	ld e, a
	hlcoord 11, 2, wAttrmap
	ld bc, $28
	ld a, [wcca9]
.asm_9b8d
	and a
	jr z, .asm_9b94
	add hl, bc
	dec a
	jr .asm_9b8d

.asm_9b94
	lb bc, 2, 8
	ld a, e
	call Function9af1
	ret

Function9b9c: ; 9b9c (2:5b9c)
	ld hl, Palettes_bac6
	ld de, wTempOBPal0
	ld bc, $10
	call CopyBytes
	ret

Function9ba9: ; 9ba9 (2:5ba9)
	push de
	farcall Function3d8f5
	ld c, l
	ld b, h
	ld a, [wd0ee]
	call Function9bcb
	pop de
	ret

Function9bba: ; 9bba (2:5bba)
	push de
	farcall Function3d907
	ld c, l
	ld b, h
	ld a, [wTempEnemyMonSpecies]
	call Function9bd3
	pop de
	ret

Function9bcb: ; 9bcb (2:5bcb)
	and a
	jp nz, Function9c66
	ld hl, TrainerPalettes
	ret

Function9bd3: ; 9bd3 (2:5bd3)
	and a
	jp nz, Function9c66
	ld a, [wTrainerClass]
Function9bda: ; 9bda (2:5bda)
	ld l, a
	ld h, $0
	add hl, hl
	add hl, hl
	ld bc, TrainerPalettes
	add hl, bc
	ret

Function9be4: ; 9be4 (2:5be4)
	call Function9c5b
	ret

Function9be8:
	ret

Function9be9:
	call CheckCGB
	ret z
	ld hl, Palettes_9c09
	ld a, $90
	ldh [rOBPI], a
	ld c, $30
.asm_9bf6
	ld a, [hli]
	ldh [rOBPD], a
	dec c
	jr nz, .asm_9bf6
	ld hl, Palettes_9c09
	ld de, wTempOBPal2
	ld bc, $10
	call CopyBytes
	ret

Palettes_9c09:
	RGB 31, 31, 31
	RGB 25, 25, 25
	RGB 13, 13, 13
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 31, 31,  7
	RGB 31, 16,  1
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 31, 19, 24
	RGB 30, 10,  6
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 12, 25,  1
	RGB  5, 14,  0
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB  8, 12, 31
	RGB  1,  4, 31
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 24, 18,  7
	RGB 20, 15,  3
	RGB  0,  0,  0

Function9c39:
	call CheckCGB
	ret z
	ld a, $90
	ldh [rOBPI], a
	ld a, $1c
	call Function9ac7
	call Function9c52
	ld a, $21
	call Function9ac7
	call Function9c52
	ret

Function9c52: ; 9c52 (2:5c52)
	ld c, $8
.asm_9c54
	ld a, [hli]
	ldh [rOBPD], a
	dec c
	jr nz, .asm_9c54
	ret

Function9c5b: ; 9c5b (2:5c5b)
	ld l, a
	ld h, $0
	add hl, hl
	add hl, hl
	add hl, hl
	ld bc, PokemonPalettes
	add hl, bc
	ret

Function9c66: ; 9c66 (2:5c66)
	push bc
	call Function9c5b
	pop bc
	push hl
	call CheckShininess
	pop hl
	ret nc
	inc hl
	inc hl
	inc hl
	inc hl
	ret

PushSGBPals_: ; 9c76 (2:5c76)
	ld a, [wd8ba]
	push af
	set 7, a
	ld [wd8ba], a
	call Function9c87
	pop af
	ld [wd8ba], a
	ret

Function9c87: ; 9c87 (2:5c87)
	ld a, [hl]
	and $7
	ret z
	ld b, a
.asm_9c8c
	push bc
	xor a
	ldh [rJOYP], a
	ld a, $30
	ldh [rJOYP], a
	ld b, $10
.asm_9c96
	ld e, $8
	ld a, [hli]
	ld d, a
.asm_9c9a
	bit 0, d
	ld a, $10
	jr nz, .asm_9ca2
	ld a, $20
.asm_9ca2
	ldh [rJOYP], a
	ld a, $30
	ldh [rJOYP], a
	rr d
	dec e
	jr nz, .asm_9c9a
	dec b
	jr nz, .asm_9c96
	ld a, $20
	ldh [rJOYP], a
	ld a, $30
	ldh [rJOYP], a
	call Function9ed9
	pop bc
	dec b
	jr nz, .asm_9c8c
	ret

InitSGBBorder: ; 9cc0 (2:5cc0)
	call CheckCGB
	ret nz
	di
	ld a, [wd8ba]
	push af
	set 7, a
	ld [wd8ba], a
	xor a
	ldh [rJOYP], a
	ldh [hSGB], a
	call Function9da9
	jr nc, .asm_9cf7
	ld a, $1
	ldh [hSGB], a
	call Function9d4a
	call Function9e13
	call Function9ed9
	call Function9d9e
	call Function9d8b
	call Function9ed9
	call Function9d9e
	ld hl, PalPacket_a1d5
	call Function9c87
.asm_9cf7
	pop af
	ld [wd8ba], a
	ei
	ret

InitCGBPals:: ; 9cfd (2:5cfd)
	call CheckCGB
	ret z
	ld a, $1
	ldh [rVBK], a
	ld hl, $8000
	ld bc, $2000
	xor a
	call ByteFill
	ld a, $0
	ldh [rVBK], a
	ld a, $80
	ldh [rBGPI], a
	ld c, $20
.asm_9d19
	ld a, $ff
	ldh [rBGPD], a
	ld a, $7f
	ldh [rBGPD], a
	dec c
	jr nz, .asm_9d19
	ld a, $80
	ldh [rOBPI], a
	ld c, $20
.asm_9d2a
	ld a, $ff
	ldh [rOBPD], a
	ld a, $7f
	ldh [rOBPD], a
	dec c
	jr nz, .asm_9d2a
	ld hl, wTempBGPals
	call Function9d3e
	ld hl, wBGPals
Function9d3e: ; 9d3e (2:5d3e)
	ld c, $40
.asm_9d40
	ld a, $ff
	ld [hli], a
	ld a, $7f
	ld [hli], a
	dec c
	jr nz, .asm_9d40
	ret

Function9d4a: ; 9d4a (2:5d4a)
	ld hl, .Pointers
	ld c, $9
.asm_9d4f
	push bc
	ld a, [hli]
	push hl
	ld h, [hl]
	ld l, a
	call Function9c87
	pop hl
	inc hl
	pop bc
	dec c
	jr nz, .asm_9d4f
	ret

.Pointers:
	dw PalPacket_a1c5
	dw PalPacket_a1e5
	dw PalPacket_a1f5
	dw PalPacket_a205
	dw PalPacket_a215
	dw PalPacket_a225
	dw PalPacket_a235
	dw PalPacket_a245
	dw PalPacket_a255

Function9d70:
	di
	xor a
	ldh [rJOYP], a
	ld hl, PalPacket_a1c5
	call Function9c87
	call Function9d8b
	call Function9ed9
	call Function9d9e
	ld hl, PalPacket_a1d5
	call Function9c87
	ei
	ret

Function9d8b: ; 9d8b (2:5d8b)
	call Function9d97
	push de
	call Function9e83
	pop hl
	call Function9e37
	ret

Function9d97: ; 9d97 (2:5d97)
	ld hl, SGBBorder
	ld de, SGBBorderMap
	ret

Function9d9e: ; 9d9e (2:5d9e)
	ld hl, $8000
	ld bc, $2000
	xor a
	call ByteFill
	ret

Function9da9: ; 9da9 (2:5da9)
	ld hl, PalPacket_a195
	call Function9c87
	call Function9ed9
	ldh a, [rJOYP]
	and $3
	cp $3
	jr nz, .asm_9e05
	ld a, $20
	ldh [rJOYP], a
	ldh a, [rJOYP]
	ldh a, [rJOYP]
	call Function9ed9
	call Function9ed9
	ld a, $30
	ldh [rJOYP], a
	call Function9ed9
	call Function9ed9
	ld a, $10
	ldh [rJOYP], a
	ldh a, [rJOYP]
	ldh a, [rJOYP]
	ldh a, [rJOYP]
	ldh a, [rJOYP]
	ldh a, [rJOYP]
	ldh a, [rJOYP]
	call Function9ed9
	call Function9ed9
	ld a, $30
	ldh [rJOYP], a
	ldh a, [rJOYP]
	ldh a, [rJOYP]
	ldh a, [rJOYP]
	call Function9ed9
	call Function9ed9
	ldh a, [rJOYP]
	and $3
	cp $3
	jr nz, .asm_9e05
	call Function9e0a
	and a
	ret

.asm_9e05
	call Function9e0a
	scf
	ret

Function9e0a: ; 9e0a (2:5e0a)
	ld hl, PalPacket_a185
	call Function9c87
	jp Function9ed9

Function9e13: ; 9e13 (2:5e13)
	call DisableLCD
	ld a, $e4
	ldh [rBGP], a
	ld hl, Palettes_a265
	ld de, $8800
	ld bc, $1000
	call Function9eb1
	call Function9ec3
	ld a, $e3
	ldh [rLCDC], a
	ld hl, PalPacket_a175
	call Function9c87
	xor a
	ldh [rBGP], a
	ret

Function9e37: ; 9e37 (2:5e37)
	call DisableLCD
	ld a, $e4
	ldh [rBGP], a
	ld de, $8800
	ld bc, $140
	call Function9eb1
	ld b, $12
.asm_9e49
	push bc
	ld bc, $c
	call Function9eb1
	ld bc, $28
	call Function9eba
	ld bc, $c
	call Function9eb1
	pop bc
	dec b
	jr nz, .asm_9e49
	ld bc, $140
	call Function9eb1
	ld bc, $100
	call Function9eba
	ld bc, $80
	call Function9eb1
	call Function9ec3
	ld a, $e3
	ldh [rLCDC], a
	ld hl, PalPacket_a1b5
	call Function9c87
	xor a
	ldh [rBGP], a
	ret

Function9e83: ; 9e83 (2:5e83)
	call DisableLCD
	ld a, $e4
	ldh [rBGP], a
	ld de, $8800
	ld b, $80
.asm_9e8f
	push bc
	ld bc, $10
	call Function9eb1
	ld bc, $10
	call Function9eba
	pop bc
	dec b
	jr nz, .asm_9e8f
	call Function9ec3
	ld a, $e3
	ldh [rLCDC], a
	ld hl, PalPacket_a1a5
	call Function9c87
	xor a
	ldh [rBGP], a
	ret

Function9eb1: ; 9eb1 (2:5eb1)
	ld a, [hli]
	ld [de], a
	inc de
	dec bc
	ld a, c
	or b
	jr nz, Function9eb1
	ret

Function9eba: ; 9eba (2:5eba)
	xor a
	ld [de], a
	inc de
	dec bc
	ld a, c
	or b
	jr nz, Function9eba
	ret

Function9ec3: ; 9ec3 (2:5ec3)
	ld hl, $9800
	ld de, $c
	ld a, $80
	ld c, $d
.asm_9ecd
	ld b, $14
.asm_9ecf
	ld [hli], a
	inc a
	dec b
	jr nz, .asm_9ecf
	add hl, de
	dec c
	jr nz, .asm_9ecd
	ret

Function9ed9: ; 9ed9 (2:5ed9)
	ld de, 7000
.asm_9edc
	nop
	nop
	nop
	dec de
	ld a, d
	or e
	jr nz, .asm_9edc
	ret

BlkPacket_9ee5:	db $21, $01, $03, $00, $00, $00, $13, $11, $00, $00, $00, $00, $00, $00, $00, $00
BlkPacket_9ef5:	db $21, $01, $07, $05, $00, $0a, $13, $0d, $00, $00, $00, $00, $00, $00, $00, $00
BlkPacket_9f05:	db $22, $05, $07, $0a, $00, $0c, $13, $11, $03, $05, $01, $00, $0a, $03, $03, $00
BlkPacket_9f15:	db $0a, $08, $13, $0a, $03, $0a, $00, $04, $08, $0b, $03, $0f, $0b, $00, $13, $07
BlkPacket_9f25:	db $21, $01, $07, $05, $00, $00, $06, $06, $00, $00, $00, $00, $00, $00, $00, $00
BlkPacket_9f35:	db $21, $01, $06, $05, $0b, $01, $13, $02, $00, $00, $00, $00, $00, $00, $00, $00
BlkPacket_9f45:	db $21, $01, $07, $05, $00, $01, $07, $07, $00, $00, $00, $00, $00, $00, $00, $00
BlkPacket_9f55:	db $21, $01, $07, $05, $01, $04, $07, $0a, $00, $00, $00, $00, $00, $00, $00, $00
BlkPacket_9f65:	db $21, $01, $07, $05, $01, $01, $05, $05, $00, $00, $00, $00, $00, $00, $00, $00
BlkPacket_9f75:	db $21, $01, $07, $05, $07, $05, $0d, $0b, $00, $00, $00, $00, $00, $00, $00, $00
BlkPacket_9f85:	db $22, $05, $03, $05, $00, $00, $13, $0b, $03, $0a, $00, $04, $13, $09, $02, $0f
BlkPacket_9f95:	db $00, $06, $13, $07, $03, $00, $04, $04, $0f, $09, $03, $00, $00, $0c, $13, $11
BlkPacket_9fa5:	db $23, $07, $07, $10, $00, $00, $02, $0c, $02, $00, $0c, $01, $12, $02, $02, $00
BlkPacket_9fb5:	db $0c, $03, $12, $04, $02, $00, $0c, $05, $12, $06, $02, $00, $0c, $07, $12, $08
BlkPacket_9fc5:	db $02, $00, $0c, $09, $12, $0a, $02, $00, $0c, $0b, $12, $0c, $00, $00, $00, $00
BlkPacket_9fd5:	db $21, $02, $07, $30, $00, $00, $13, $06, $02, $04, $05, $06, $0e, $06, $00, $00
BlkPacket_9fe5:	db $21, $01, $07, $10, $00, $00, $13, $05, $00, $00, $00, $00, $00, $00, $00, $00
BlkPacket_9ff5:	db $21, $02, $07, $0a, $00, $04, $13, $0d, $03, $05, $00, $06, $13, $0b, $00, $00

PalPacket_a005:
	db $51
	RGB  8,  2,  0
	RGB  9,  2,  0
	RGB 10,  2,  0
	RGB 11,  2,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a015:
	db $51
	RGB 11,  1,  0
	RGB  4,  1,  0
	RGB  0,  1,  0
	RGB  0,  0,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a025:
	db $51
	RGB  1,  2,  0
	RGB  2,  2,  0
	RGB  3,  2,  0
	RGB  4,  2,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a035:
	db $51
	RGB 12,  2,  0
	RGB 12,  2,  0
	RGB 12,  2,  0
	RGB 12,  2,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a045:
	db $51
	RGB  0,  0,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a055:
	db $51
	RGB 22,  1,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a065:
	db $51
	RGB 23,  1,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a075:
	db $51
	RGB 24,  1,  0
	RGB 25,  1,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a085:
	db $51
	RGB 26,  1,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a095:
	db $51
	RGB 27,  1,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a0a5:
	db $51
	RGB 28,  1,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a0b5:
	db $51
	RGB 25,  1,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a0c5:
	db $51
	RGB 14,  1,  0
	RGB 15,  1,  0
	RGB 16,  1,  0
	RGB 17,  1,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a0d5:
	db $51
	RGB 26,  0,  0
	RGB 26,  0,  0
	RGB 26,  0,  0
	RGB 26,  0,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a0e5:
	db $51
	RGB 18,  1,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a0f5:
	db $51
	RGB 28,  1,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a105:
	db $51
	RGB 29,  1,  0
	RGB 30,  1,  0
	RGB 31,  1,  0
	RGB  0,  2,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a115:
	db $51
	RGB 19,  1,  0
	RGB 20,  1,  0
	RGB 27,  0,  0
	RGB 31,  0,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a125:
	db $51
	RGB 27,  0,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a135:
	db $51
	RGB 28,  0,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a145:
	db $51
	RGB 21,  1,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	RGB  0,  0,  0
	db $00, $00, $00, $00, $00, $00, $00

PalPacket_a155: db $01, $ff, $7f, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_a165: db $09, $ff, $7f, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_a175: db $59, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_a185: db $89, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_a195: db $89, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_a1a5: db $99, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_a1b5: db $a1, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00

PalPacket_a1c5: db $b9, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_a1d5: db $b9, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
PalPacket_a1e5: db $79, $5d, $08, $00, $0b, $8c, $d0, $f4, $60, $00, $00, $00, $00, $00, $00, $00
PalPacket_a1f5: db $79, $52, $08, $00, $0b, $a9, $e7, $9f, $01, $c0, $7e, $e8, $e8, $e8, $e8, $e0
PalPacket_a205: db $79, $47, $08, $00, $0b, $c4, $d0, $16, $a5, $cb, $c9, $05, $d0, $10, $a2, $28
PalPacket_a215: db $79, $3c, $08, $00, $0b, $f0, $12, $a5, $c9, $c9, $c8, $d0, $1c, $a5, $ca, $c9
PalPacket_a225: db $79, $31, $08, $00, $0b, $0c, $a5, $ca, $c9, $7e, $d0, $06, $a5, $cb, $c9, $7e
PalPacket_a235: db $79, $26, $08, $00, $0b, $39, $cd, $48, $0c, $d0, $34, $a5, $c9, $c9, $80, $d0
PalPacket_a245: db $79, $1b, $08, $00, $0b, $ea, $ea, $ea, $ea, $ea, $a9, $01, $cd, $4f, $0c, $d0
PalPacket_a255: db $79, $10, $08, $00, $0b, $4c, $20, $08, $ea, $ea, $ea, $ea, $ea, $60, $ea, $ea

IF DEF(GOLD)
Palettes_a265: INCLUDE "gfx/pals/gold_a265.pal"
ENDC
IF DEF(SILVER)
Palettes_a265: INCLUDE "gfx/pals/silver_a265.pal"
ENDC

IF DEF(GOLD)
SGBBorderMap: INCBIN "gfx/sgb_border/gold.map"
SGBBorderPalettes: INCLUDE "gfx/sgb_border/pals/gold.pal"
SGBBorder: INCBIN "gfx/sgb_border/gold.2bpp"
ENDC

IF DEF(SILVER)
SGBBorderMap: INCBIN "gfx/sgb_border/silver.map"
SGBBorderPalettes: INCLUDE "gfx/sgb_border/pals/silver.pal"
SGBBorder: INCBIN "gfx/sgb_border/silver.2bpp"
ENDC

Palettes_ad2d:
	RGB 30, 26, 15
	RGB 00, 23, 00

	RGB 30, 26, 15
	RGB 31, 21, 00

	RGB 30, 26, 15
	RGB 31, 00, 00

Palettes_ad39:
	RGB 30, 26, 15
	RGB 04, 17, 31

INCLUDE "gfx/pics/palette_pointers.asm"
INCLUDE "gfx/trainers/palette_pointers.asm"

Functionb649: ; b649 (2:7649)
	ld a, [wPermission]
	and $7
	ld e, a
	ld d, $0
	ld hl, Pointers_b6ce
	add hl, de
	add hl, de
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ld a, [wTimeOfDayPal]
	and $3
	add a
	add a
	add a
	ld e, a
	ld d, $0
	add hl, de
	ld e, l
	ld d, h
	ld hl, wTempBGPals
	ld b, $8
.asm_b66c
	ld a, [de]
	push de
	push hl
	ld l, a
	ld h, $0
	add hl, hl
	add hl, hl
	add hl, hl
	ld de, $775e
	add hl, de
	ld e, l
	ld d, h
	pop hl
	ld c, $8
.asm_b67e
	ld a, [de]
	inc de
	ld [hli], a
	dec c
	jr nz, .asm_b67e
	pop de
	inc de
	dec b
	jr nz, .asm_b66c
	ld a, [wTimeOfDayPal]
	and $3
	ld bc, $40
	ld hl, MapObjectPals
	call AddNTimes
	ld de, wTempOBPal0
	ld bc, $40
	call CopyBytes
	ld a, [wPermission]
	cp $1
	jr z, .asm_b6aa
	cp $2
	ret nz
.asm_b6aa
	ld a, [wMapGroup]
	ld l, a
	ld h, $0
	add hl, hl
	add hl, hl
	add hl, hl
	ld de, RoofPals
	add hl, de
	ld a, [wTimeOfDayPal]
	and $3
	cp $2
	jr c, .asm_b6c4
	inc hl
	inc hl
	inc hl
	inc hl
.asm_b6c4
	ld de, wTempBGPal6 + 2
	ld bc, $4
	call CopyBytes
	ret

Pointers_b6ce:
	dw .OutdoorColors ; unused
	dw .OutdoorColors ; TOWN
	dw .OutdoorColors ; ROUTE
	dw .IndoorColors ; INDOOR
	dw .DungeonColors ; CAVE
	dw .Perm5Colors ; ENVIRONMENT_5
	dw .IndoorColors ; GATE
	dw .DungeonColors ; DUNGEON

; Valid indices: $00 - $29
.OutdoorColors:
	db $00, $01, $02, $28, $04, $05, $06, $07 ; morn
	db $08, $09, $0a, $28, $0c, $0d, $0e, $0f ; day
	db $10, $11, $12, $29, $14, $15, $16, $17 ; nite
	db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ; dark

.IndoorColors:
	db $20, $21, $22, $23, $24, $25, $26, $07 ; morn
	db $20, $21, $22, $23, $24, $25, $26, $07 ; day
	db $10, $11, $12, $13, $14, $15, $16, $07 ; nite
	db $18, $19, $1a, $1b, $1c, $1d, $1e, $07 ; dark

.DungeonColors:
	db $00, $01, $02, $03, $04, $05, $06, $07 ; morn
	db $08, $09, $0a, $0b, $0c, $0d, $0e, $0f ; day
	db $10, $11, $12, $13, $14, $15, $16, $17 ; nite
	db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ; dark

.Perm5Colors:
	db $00, $01, $02, $03, $04, $05, $06, $07 ; morn
	db $08, $09, $0a, $0b, $0c, $0d, $0e, $0f ; day
	db $10, $11, $12, $13, $14, $15, $16, $17 ; nite
	db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ; dark

TilesetBGPalette: ; b75e
INCLUDE "gfx/tilesets/bg.pal"

MapObjectPals:: ; b8ae
INCLUDE "gfx/tilesets/ob.pal"

RoofPals: ; b9ae
INCLUDE "gfx/tilesets/roof.pal"

Palettes_ba86:
	RGB 27, 31, 27
	RGB 21, 21, 21
	RGB 13, 13, 13
	RGB 00, 00, 00

	RGB 27, 31, 27
	RGB 31, 07, 06
	RGB 20, 02, 03
	RGB 00, 00, 00

	RGB 27, 31, 27
	RGB 10, 31, 09
	RGB 04, 14, 01
	RGB 00, 00, 00

	RGB 27, 31, 27
	RGB 08, 12, 31
	RGB 01, 04, 31
	RGB 00, 00, 00

	RGB 27, 31, 27
	RGB 31, 31, 07
	RGB 31, 16, 01
	RGB 00, 00, 00

	RGB 27, 31, 27
	RGB 22, 16, 08
	RGB 13, 07, 01
	RGB 00, 00, 00

	RGB 27, 31, 27
	RGB 15, 31, 31
	RGB 05, 17, 31
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 11, 11, 19
	RGB 07, 07, 12
	RGB 00, 00, 00

Palettes_bac6:
	RGB 27, 31, 27
	RGB 31, 19, 10
	RGB 31, 07, 04
	RGB 00, 00, 00

	RGB 27, 31, 27
	RGB 31, 19, 10
	RGB 10, 14, 20
	RGB 00, 00, 00

	RGB 27, 31, 27
	RGB 31, 19, 10
	RGB 31, 07, 04
	RGB 00, 00, 00

	RGB 27, 31, 27
	RGB 31, 19, 10
	RGB 31, 07, 04
	RGB 00, 00, 00

	RGB 27, 31, 27
	RGB 31, 19, 10
	RGB 31, 07, 04
	RGB 00, 00, 00

	RGB 27, 31, 27
	RGB 31, 19, 10
	RGB 31, 07, 04
	RGB 00, 00, 00

	RGB 27, 31, 27
	RGB 31, 19, 10
	RGB 31, 07, 04
	RGB 00, 00, 00

	RGB 27, 31, 27
	RGB 31, 19, 10
	RGB 31, 07, 04
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 21, 21, 21
	RGB 13, 13, 13
	RGB 07, 07, 07

	RGB 31, 31, 31
	RGB 31, 31, 07
	RGB 31, 16, 01
	RGB 07, 07, 07

	RGB 31, 31, 31
	RGB 31, 19, 24
	RGB 30, 10, 06
	RGB 07, 07, 07

	RGB 31, 31, 31
	RGB 12, 25, 01
	RGB 05, 14, 00
	RGB 07, 07, 07

	RGB 31, 31, 31
	RGB 08, 12, 31
	RGB 01, 04, 31
	RGB 07, 07, 07

	RGB 31, 31, 31
	RGB 24, 18, 07
	RGB 20, 15, 03
	RGB 07, 07, 07

Palettes_bb36:
IF DEF(GOLD)
	RGB 31, 31, 31
	RGB 18, 23, 31
	RGB 15, 20, 31
	RGB  0,  0,  0

	RGB 31, 21,  0
	RGB 12, 14, 12
	RGB 15, 20, 31
	RGB  0,  0, 17

	RGB 31, 31, 31
	RGB 31,  0,  0
	RGB 15, 20, 31
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 29, 25,  0
	RGB 15, 20, 31
	RGB 17, 10,  1

	RGB 31, 31, 31
	RGB 23, 26, 31
	RGB 18, 23, 31
	RGB  0,  0,  0
ENDC

IF DEF(SILVER)
	RGB 31, 31, 31
	RGB  0, 12, 15
	RGB  4,  8, 21
	RGB  0,  0,  0

	RGB 31, 21,  0
	RGB 15, 17, 15
	RGB  4,  8, 21
	RGB  0,  0, 17

	RGB 31, 31, 31
	RGB 31,  0,  0
	RGB  4,  8, 21
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 24, 23, 25
	RGB  4,  8, 21
	RGB  8,  8,  9

	RGB 31, 31, 31
	RGB  5, 10, 11
	RGB  0, 12, 15
	RGB  0,  0,  0
ENDC

Palettes_bb5e:
	RGB 31, 31, 31
	RGB 07, 06, 03
	RGB 07, 06, 03
	RGB 07, 06, 03

	RGB 31, 31, 31
	RGB 31, 31, 00
	RGB 26, 22, 00
	RGB 00, 00, 00

Palettes_bb6e:
	RGB 28, 31, 20
	RGB 21, 21, 21
	RGB 13, 13, 13
	RGB 00, 00, 00

	RGB 28, 31, 20
	RGB 00, 31, 00
	RGB 00, 00, 31
	RGB 00, 00, 00

	RGB 28, 31, 20
	RGB 00, 31, 00
	RGB 15, 07, 00
	RGB 00, 00, 00

	RGB 28, 31, 20
	RGB 31, 15, 00
	RGB 15, 07, 00
	RGB 00, 00, 00

	RGB 28, 31, 20
	RGB 00, 31, 00
	RGB 00, 00, 31
	RGB 31, 00, 00

	RGB 28, 31, 20
	RGB 00, 31, 00
	RGB 15, 07, 00
	RGB 31, 00, 00

Palettes_bb9e:
	RGB 31, 31, 31
	RGB 30, 22, 24
	RGB 18, 18, 18
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 10, 11, 31
	RGB 18, 18, 18
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 12, 31, 11
	RGB 18, 18, 18
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 29, 26, 05
	RGB 18, 18, 18
	RGB 00, 00, 00

Palettes_bbbe:
IF DEF(GOLD)
	RGB 31, 31, 31
	RGB 24, 25, 28
	RGB 24, 24, 09
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 30, 10, 06
	RGB 24, 24, 09
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 15, 31, 00
	RGB 24, 24, 09
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 31, 15, 31
	RGB 24, 24, 09
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 15, 21, 31
	RGB 24, 24, 09
	RGB 00, 00, 00

	RGB 31, 31, 11
	RGB 31, 31, 06
	RGB 24, 24, 09
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 16, 19, 29
	RGB 25, 22, 00
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 21, 21, 21
	RGB 13, 13, 13
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 30, 10, 06
	RGB 31, 00, 00
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 12, 25, 01
	RGB 05, 14, 00
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 12, 25, 01
	RGB 30, 10, 06
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 31, 31, 06
	RGB 20, 15, 03
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 31, 31, 06
	RGB 15, 21, 31
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 31, 31, 06
	RGB 20, 15, 03
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 31, 24, 21
	RGB 31, 13, 31
	RGB 00, 00, 00

	RGB 31, 31, 31
	RGB 31, 31, 31
	RGB 00, 00, 00
	RGB 00, 00, 00
ENDC

IF DEF(SILVER)
	RGB 31, 31, 31
	RGB 25, 26, 14
	RGB 20, 17, 31
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 30, 10,  6
	RGB 20, 17, 31
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 15, 31,  0
	RGB 20, 17, 31
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 31, 15, 31
	RGB 20, 17, 31
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 15, 21, 31
	RGB 20, 17, 31
	RGB  0,  0,  0

	RGB 31, 31, 11
	RGB 31, 31,  6
	RGB 20, 17, 31
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 16, 19, 29
	RGB 25, 22,  0
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 21, 21, 21
	RGB 13, 13, 13
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 30, 10,  6
	RGB 31,  0,  0
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 12, 25,  1
	RGB  5, 14,  0
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 12, 25,  1
	RGB 30, 10,  6
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 31, 31,  6
	RGB 20, 15,  3
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 31, 31,  6
	RGB 15, 21, 31
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 31, 31,  6
	RGB 20, 15,  3
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 31, 24, 21
	RGB 31, 13, 31
	RGB  0,  0,  0

	RGB 31, 31, 31
	RGB 31, 31, 31
	RGB  0,  0,  0
	RGB  0,  0,  0
ENDC