-
Notifications
You must be signed in to change notification settings - Fork 817
/
cgb_layouts.asm
986 lines (912 loc) · 18.5 KB
/
cgb_layouts.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
; Replaces the functionality of sgb.asm to work with CGB hardware.
CheckCGB:
ldh a, [hCGB]
and a
ret
LoadSGBLayoutCGB:
ld a, b
cp SCGB_DEFAULT
jr nz, .not_default
ld a, [wDefaultSGBLayout]
.not_default
cp SCGB_PARTY_MENU_HP_BARS
jp z, CGB_ApplyPartyMenuHPPals
call ResetBGPals
ld l, a
ld h, 0
add hl, hl
ld de, CGBLayoutJumptable
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld de, .done
push de
jp hl
.done:
ret
CGBLayoutJumptable:
; entries correspond to SCGB_* constants (see constants/scgb_constants.asm)
table_width 2, CGBLayoutJumptable
dw _CGB_BattleGrayscale
dw _CGB_BattleColors
dw _CGB_PokegearPals
dw _CGB_StatsScreenHPPals
dw _CGB_Pokedex
dw _CGB_SlotMachine
dw _CGB_BetaTitleScreen
dw _CGB_GSIntro
dw _CGB_Diploma
dw _CGB_MapPals
dw _CGB_PartyMenu
dw _CGB_Evolution
dw _CGB_GSTitleScreen
dw _CGB_Unused0D
dw _CGB_MoveList
dw _CGB_BetaPikachuMinigame
dw _CGB_PokedexSearchOption
dw _CGB_BetaPoker
dw _CGB_Pokepic
dw _CGB_MagnetTrain
dw _CGB_PackPals
dw _CGB_TrainerCard
dw _CGB_PokedexUnownMode
dw _CGB_BillsPC
dw _CGB_UnownPuzzle
dw _CGB_GamefreakLogo
dw _CGB_PlayerOrMonFrontpicPals
dw _CGB_TradeTube
dw _CGB_TrainerOrMonFrontpicPals
dw _CGB_MysteryGift
dw _CGB_Unused1E
assert_table_length NUM_SCGB_LAYOUTS
_CGB_BattleGrayscale:
ld hl, PalPacket_BattleGrayscale + 1
ld de, wBGPals1
ld c, 4
call CopyPalettes
ld hl, PalPacket_BattleGrayscale + 1
ld de, wBGPals1 palette PAL_BATTLE_BG_EXP
ld c, 4
call CopyPalettes
ld hl, PalPacket_BattleGrayscale + 1
ld de, wOBPals1
ld c, 2
call CopyPalettes
jr _CGB_FinishBattleScreenLayout
_CGB_BattleColors:
ld de, wBGPals1
call GetBattlemonBackpicPalettePointer
push hl
call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_PLAYER
call GetEnemyFrontpicPalettePointer
push hl
call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_ENEMY
ld a, [wEnemyHPPal]
ld l, a
ld h, 0
add hl, hl
add hl, hl
ld bc, HPBarPals
add hl, bc
call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_ENEMY_HP
ld a, [wPlayerHPPal]
ld l, a
ld h, 0
add hl, hl
add hl, hl
ld bc, HPBarPals
add hl, bc
call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_PLAYER_HP
ld hl, ExpBarPalette
call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_EXP
ld de, wOBPals1
pop hl
call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_OB_ENEMY
pop hl
call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_OB_PLAYER
ld a, SCGB_BATTLE_COLORS
ld [wDefaultSGBLayout], a
call ApplyPals
_CGB_FinishBattleScreenLayout:
call InitPartyMenuBGPal7
hlcoord 0, 0, wAttrmap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, PAL_BATTLE_BG_ENEMY_HP
call ByteFill
hlcoord 0, 4, wAttrmap
lb bc, 8, 10
ld a, PAL_BATTLE_BG_PLAYER
call FillBoxCGB
hlcoord 10, 0, wAttrmap
lb bc, 7, 10
ld a, PAL_BATTLE_BG_ENEMY
call FillBoxCGB
hlcoord 0, 0, wAttrmap
lb bc, 4, 10
ld a, PAL_BATTLE_BG_ENEMY_HP
call FillBoxCGB
hlcoord 10, 7, wAttrmap
lb bc, 5, 10
ld a, PAL_BATTLE_BG_PLAYER_HP
call FillBoxCGB
hlcoord 10, 11, wAttrmap
lb bc, 1, 9
ld a, PAL_BATTLE_BG_EXP
call FillBoxCGB
hlcoord 0, 12, wAttrmap
ld bc, 6 * SCREEN_WIDTH
ld a, PAL_BATTLE_BG_TEXT
call ByteFill
ld hl, BattleObjectPals
ld de, wOBPals1 palette PAL_BATTLE_OB_GRAY
ld bc, 6 palettes
ld a, BANK(wOBPals1)
call FarCopyWRAM
call ApplyAttrmap
ret
InitPartyMenuBGPal7:
farcall Function100dc0
Mobile_InitPartyMenuBGPal7:
ld hl, PartyMenuBGPalette
jr nc, .not_mobile
ld hl, PartyMenuBGMobilePalette
.not_mobile
ld de, wBGPals1 palette 7
ld bc, 1 palettes
ld a, BANK(wBGPals1)
call FarCopyWRAM
ret
InitPartyMenuBGPal0:
farcall Function100dc0
ld hl, PartyMenuBGPalette
jr nc, .not_mobile
ld hl, PartyMenuBGMobilePalette
.not_mobile
ld de, wBGPals1 palette 0
ld bc, 1 palettes
ld a, BANK(wBGPals1)
call FarCopyWRAM
ret
_CGB_PokegearPals:
ld a, [wPlayerGender]
bit PLAYERGENDER_FEMALE_F, a
jr z, .male
ld hl, FemalePokegearPals
jr .got_pals
.male
ld hl, MalePokegearPals
.got_pals
ld de, wBGPals1
ld bc, 6 palettes
ld a, BANK(wBGPals1)
call FarCopyWRAM
call ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
_CGB_StatsScreenHPPals:
ld de, wBGPals1
ld a, [wCurHPPal]
ld l, a
ld h, 0
add hl, hl
add hl, hl
ld bc, HPBarPals
add hl, bc
call LoadPalette_White_Col1_Col2_Black ; hp palette
ld a, [wCurPartySpecies]
ld bc, wTempMonDVs
call GetPlayerOrMonPalettePointer
call LoadPalette_White_Col1_Col2_Black ; mon palette
ld hl, ExpBarPalette
call LoadPalette_White_Col1_Col2_Black ; exp palette
ld hl, StatsScreenPagePals
ld de, wBGPals1 palette 3
ld bc, 3 palettes ; pink, green, and blue page palettes
ld a, BANK(wBGPals1)
call FarCopyWRAM
call WipeAttrmap
hlcoord 0, 0, wAttrmap
lb bc, 8, SCREEN_WIDTH
ld a, $1 ; mon palette
call FillBoxCGB
hlcoord 10, 16, wAttrmap
ld bc, 10
ld a, $2 ; exp palette
call ByteFill
hlcoord 13, 5, wAttrmap
lb bc, 2, 2
ld a, $3 ; pink page palette
call FillBoxCGB
hlcoord 15, 5, wAttrmap
lb bc, 2, 2
ld a, $4 ; green page palette
call FillBoxCGB
hlcoord 17, 5, wAttrmap
lb bc, 2, 2
ld a, $5 ; blue page palette
call FillBoxCGB
call ApplyAttrmap
call ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
StatsScreenPagePals:
INCLUDE "gfx/stats/pages.pal"
StatsScreenPals:
INCLUDE "gfx/stats/stats.pal"
_CGB_Pokedex:
ld de, wBGPals1
ld a, PREDEFPAL_POKEDEX
call GetPredefPal
call LoadHLPaletteIntoDE ; dex interface palette
ld a, [wCurPartySpecies]
cp $ff
jr nz, .is_pokemon
ld hl, PokedexQuestionMarkPalette
call LoadHLPaletteIntoDE ; green question mark palette
jr .got_palette
.is_pokemon
call GetMonPalettePointer
call LoadPalette_White_Col1_Col2_Black ; mon palette
.got_palette
call WipeAttrmap
hlcoord 1, 1, wAttrmap
lb bc, 7, 7
ld a, $1 ; green question mark palette
call FillBoxCGB
call InitPartyMenuOBPals
ld hl, PokedexCursorPalette
ld de, wOBPals1 palette 7 ; green cursor palette
ld bc, 1 palettes
ld a, BANK(wOBPals1)
call FarCopyWRAM
call ApplyAttrmap
call ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
PokedexQuestionMarkPalette:
INCLUDE "gfx/pokedex/question_mark.pal"
PokedexCursorPalette:
INCLUDE "gfx/pokedex/cursor.pal"
_CGB_BillsPC:
ld de, wBGPals1
ld a, PREDEFPAL_POKEDEX
call GetPredefPal
call LoadHLPaletteIntoDE
ld a, [wCurPartySpecies]
cp $ff
jr nz, .GetMonPalette
ld hl, BillsPCOrangePalette
call LoadHLPaletteIntoDE
jr .GotPalette
.GetMonPalette:
ld bc, wTempMonDVs
call GetPlayerOrMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
.GotPalette:
call WipeAttrmap
hlcoord 1, 4, wAttrmap
lb bc, 7, 7
ld a, $1 ; mon palette
call FillBoxCGB
call InitPartyMenuOBPals
call ApplyAttrmap
call ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
_CGB_Unknown: ; unreferenced
ld hl, BillsPCOrangePalette
call LoadHLPaletteIntoDE
jr .GotPalette
.GetMonPalette: ; unreferenced
ld bc, wTempMonDVs
call GetPlayerOrMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
.GotPalette:
call WipeAttrmap
hlcoord 1, 1, wAttrmap
lb bc, 7, 7
ld a, $1 ; mon palette
call FillBoxCGB
call InitPartyMenuOBPals
call ApplyAttrmap
call ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
BillsPCOrangePalette:
INCLUDE "gfx/pc/orange.pal"
_CGB_PokedexUnownMode:
ld de, wBGPals1
ld a, PREDEFPAL_POKEDEX
call GetPredefPal
call LoadHLPaletteIntoDE
ld a, [wCurPartySpecies]
call GetMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
call WipeAttrmap
hlcoord 7, 5, wAttrmap
lb bc, 7, 7
ld a, $1 ; mon palette
call FillBoxCGB
call InitPartyMenuOBPals
call ApplyAttrmap
call ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
_CGB_SlotMachine:
ld hl, SlotMachinePals
ld de, wBGPals1
ld bc, 16 palettes
ld a, BANK(wBGPals1)
call FarCopyWRAM
call WipeAttrmap
hlcoord 0, 2, wAttrmap
lb bc, 10, 3
ld a, $2 ; "3" palette
call FillBoxCGB
hlcoord 17, 2, wAttrmap
lb bc, 10, 3
ld a, $2 ; "3" palette
call FillBoxCGB
hlcoord 0, 4, wAttrmap
lb bc, 6, 3
ld a, $3 ; "2" palette
call FillBoxCGB
hlcoord 17, 4, wAttrmap
lb bc, 6, 3
ld a, $3 ; "2" palette
call FillBoxCGB
hlcoord 0, 6, wAttrmap
lb bc, 2, 3
ld a, $4 ; "1" palette
call FillBoxCGB
hlcoord 17, 6, wAttrmap
lb bc, 2, 3
ld a, $4 ; "1" palette
call FillBoxCGB
hlcoord 4, 2, wAttrmap
lb bc, 2, 12
ld a, $1 ; Vileplume palette
call FillBoxCGB
hlcoord 3, 2, wAttrmap
lb bc, 10, 1
ld a, $1 ; lights palette
call FillBoxCGB
hlcoord 16, 2, wAttrmap
lb bc, 10, 1
ld a, $1 ; lights palette
call FillBoxCGB
hlcoord 0, 12, wAttrmap
ld bc, 6 * SCREEN_WIDTH
ld a, $7 ; text palette
call ByteFill
call ApplyAttrmap
call ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
_CGB_BetaTitleScreen:
ld hl, PalPacket_BetaTitleScreen + 1
call CopyFourPalettes
call WipeAttrmap
ld de, wOBPals1
ld a, PREDEFPAL_PACK
call GetPredefPal
call LoadHLPaletteIntoDE
hlcoord 0, 6, wAttrmap
lb bc, 12, SCREEN_WIDTH
ld a, $1
call FillBoxCGB
call ApplyAttrmap
call ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
_CGB_GSIntro:
ld b, 0
ld hl, .Jumptable
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
.Jumptable:
dw .ShellderLaprasScene
dw .JigglypuffPikachuScene
dw .StartersCharizardScene
.ShellderLaprasScene:
ld hl, .ShellderLaprasBGPalette
ld de, wBGPals1
call LoadHLPaletteIntoDE
ld hl, .ShellderLaprasOBPals
ld de, wOBPals1
ld bc, 2 palettes
ld a, BANK(wOBPals1)
call FarCopyWRAM
call WipeAttrmap
ret
.ShellderLaprasBGPalette:
INCLUDE "gfx/intro/gs_shellder_lapras_bg.pal"
.ShellderLaprasOBPals:
INCLUDE "gfx/intro/gs_shellder_lapras_ob.pal"
.JigglypuffPikachuScene:
ld de, wBGPals1
ld a, PREDEFPAL_GS_INTRO_JIGGLYPUFF_PIKACHU_BG
call GetPredefPal
call LoadHLPaletteIntoDE
ld de, wOBPals1
ld a, PREDEFPAL_GS_INTRO_JIGGLYPUFF_PIKACHU_OB
call GetPredefPal
call LoadHLPaletteIntoDE
call WipeAttrmap
ret
.StartersCharizardScene:
ld hl, PalPacket_Pack + 1
call CopyFourPalettes
ld de, wOBPals1
ld a, PREDEFPAL_GS_INTRO_STARTERS_TRANSITION
call GetPredefPal
call LoadHLPaletteIntoDE
call WipeAttrmap
ret
_CGB_BetaPoker:
ld hl, BetaPokerPals
ld de, wBGPals1
ld bc, 5 palettes
ld a, BANK(wBGPals1)
call FarCopyWRAM
call ApplyPals
call WipeAttrmap
call ApplyAttrmap
ret
_CGB_Diploma:
ld hl, DiplomaPalettes
ld de, wBGPals1
ld bc, 16 palettes
ld a, BANK(wBGPals1)
call FarCopyWRAM
ld hl, PalPacket_Diploma + 1
call CopyFourPalettes
call WipeAttrmap
call ApplyAttrmap
ret
_CGB_MapPals:
call LoadMapPals
ld a, SCGB_MAPPALS
ld [wDefaultSGBLayout], a
ret
_CGB_PartyMenu:
ld hl, PalPacket_PartyMenu + 1
call CopyFourPalettes
call InitPartyMenuBGPal0
call InitPartyMenuBGPal7
call InitPartyMenuOBPals
call ApplyAttrmap
ret
_CGB_Evolution:
ld de, wBGPals1
ld a, c
and a
jr z, .pokemon
ld a, PREDEFPAL_BLACKOUT
call GetPredefPal
call LoadHLPaletteIntoDE
jr .got_palette
.pokemon
ld hl, wPartyMon1DVs
ld bc, PARTYMON_STRUCT_LENGTH
ld a, [wCurPartyMon]
call AddNTimes
ld c, l
ld b, h
ld a, [wPlayerHPPal]
call GetPlayerOrMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld hl, BattleObjectPals
ld de, wOBPals1 palette PAL_BATTLE_OB_GRAY
ld bc, 6 palettes
ld a, BANK(wOBPals1)
call FarCopyWRAM
.got_palette
call WipeAttrmap
call ApplyAttrmap
call ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
_CGB_GSTitleScreen:
ld hl, UnusedGSTitleBGPals
ld de, wBGPals1
ld bc, 5 palettes
ld a, BANK(wBGPals1)
call FarCopyWRAM
ld hl, UnusedGSTitleOBPals
ld de, wOBPals1
ld bc, 2 palettes
ld a, BANK(wOBPals1)
call FarCopyWRAM
ld a, SCGB_DIPLOMA
ld [wDefaultSGBLayout], a
call ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
_CGB_Unused0D:
ld hl, PalPacket_Diploma + 1
call CopyFourPalettes
call WipeAttrmap
call ApplyAttrmap
ret
_CGB_UnownPuzzle:
ld hl, PalPacket_UnownPuzzle + 1
call CopyFourPalettes
ld de, wOBPals1
ld a, PREDEFPAL_UNOWN_PUZZLE
call GetPredefPal
call LoadHLPaletteIntoDE
ldh a, [rSVBK]
push af
ld a, BANK(wOBPals1)
ldh [rSVBK], a
ld hl, wOBPals1
ld a, LOW(palred 31 + palgreen 0 + palblue 0)
ld [hli], a
ld a, HIGH(palred 31 + palgreen 0 + palblue 0)
ld [hl], a
pop af
ldh [rSVBK], a
call WipeAttrmap
call ApplyAttrmap
ret
_CGB_TrainerCard:
ld de, wBGPals1
xor a ; CHRIS
call GetTrainerPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld a, FALKNER ; KRIS
call GetTrainerPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld a, BUGSY
call GetTrainerPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld a, WHITNEY
call GetTrainerPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld a, MORTY
call GetTrainerPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld a, CHUCK
call GetTrainerPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld a, JASMINE
call GetTrainerPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld a, PRYCE
call GetTrainerPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld a, PREDEFPAL_CGB_BADGE
call GetPredefPal
call LoadHLPaletteIntoDE
; fill screen with opposite-gender palette for the card border
hlcoord 0, 0, wAttrmap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, [wPlayerGender]
and a
ld a, $1 ; kris
jr z, .got_gender
ld a, $0 ; chris
.got_gender
call ByteFill
; fill trainer sprite area with same-gender palette
hlcoord 14, 1, wAttrmap
lb bc, 7, 5
ld a, [wPlayerGender]
and a
ld a, $0 ; chris
jr z, .got_gender2
ld a, $1 ; kris
.got_gender2
call FillBoxCGB
; top-right corner still uses the border's palette
hlcoord 18, 1, wAttrmap
ld [hl], $1
hlcoord 2, 11, wAttrmap
lb bc, 2, 4
ld a, $1 ; falkner
call FillBoxCGB
hlcoord 6, 11, wAttrmap
lb bc, 2, 4
ld a, $2 ; bugsy
call FillBoxCGB
hlcoord 10, 11, wAttrmap
lb bc, 2, 4
ld a, $3 ; whitney
call FillBoxCGB
hlcoord 14, 11, wAttrmap
lb bc, 2, 4
ld a, $4 ; morty
call FillBoxCGB
hlcoord 2, 14, wAttrmap
lb bc, 2, 4
ld a, $5 ; chuck
call FillBoxCGB
hlcoord 6, 14, wAttrmap
lb bc, 2, 4
ld a, $6 ; jasmine
call FillBoxCGB
hlcoord 10, 14, wAttrmap
lb bc, 2, 4
ld a, $7 ; pryce
call FillBoxCGB
; clair uses kris's palette
ld a, [wPlayerGender]
and a
push af
jr z, .got_gender3
hlcoord 14, 14, wAttrmap
lb bc, 2, 4
ld a, $1
call FillBoxCGB
.got_gender3
pop af
ld c, $0
jr nz, .got_gender4
inc c
.got_gender4
ld a, c
hlcoord 18, 1, wAttrmap
ld [hl], a
call ApplyAttrmap
call ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
_CGB_MoveList:
ld de, wBGPals1
ld a, PREDEFPAL_GOLDENROD
call GetPredefPal
call LoadHLPaletteIntoDE
ld a, [wPlayerHPPal]
ld l, a
ld h, 0
add hl, hl
add hl, hl
ld bc, HPBarPals
add hl, bc
call LoadPalette_White_Col1_Col2_Black
call WipeAttrmap
hlcoord 11, 1, wAttrmap
lb bc, 2, 9
ld a, $1
call FillBoxCGB
call ApplyAttrmap
call ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
_CGB_BetaPikachuMinigame:
ld hl, PalPacket_BetaPikachuMinigame + 1
call CopyFourPalettes
call WipeAttrmap
call ApplyAttrmap
call ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
_CGB_PokedexSearchOption:
ld de, wBGPals1
ld a, PREDEFPAL_POKEDEX
call GetPredefPal
call LoadHLPaletteIntoDE
call WipeAttrmap
call ApplyAttrmap
call ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
_CGB_PackPals:
; pack pals
ld a, [wBattleType]
cp BATTLETYPE_TUTORIAL
jr z, .tutorial_male
ld a, [wPlayerGender]
bit PLAYERGENDER_FEMALE_F, a
jr z, .tutorial_male
ld hl, .KrisPackPals
jr .got_gender
.tutorial_male
ld hl, .ChrisPackPals
.got_gender
ld de, wBGPals1
ld bc, 8 palettes ; 6 palettes?
ld a, BANK(wBGPals1)
call FarCopyWRAM
call WipeAttrmap
hlcoord 0, 0, wAttrmap
lb bc, 1, 10
ld a, $1
call FillBoxCGB
hlcoord 10, 0, wAttrmap
lb bc, 1, 10
ld a, $2
call FillBoxCGB
hlcoord 7, 2, wAttrmap
lb bc, 9, 1
ld a, $3
call FillBoxCGB
hlcoord 0, 7, wAttrmap
lb bc, 3, 5
ld a, $4
call FillBoxCGB
hlcoord 0, 3, wAttrmap
lb bc, 3, 5
ld a, $5
call FillBoxCGB
call ApplyAttrmap
call ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
.ChrisPackPals:
INCLUDE "gfx/pack/pack.pal"
.KrisPackPals:
INCLUDE "gfx/pack/pack_f.pal"
_CGB_Pokepic:
call _CGB_MapPals
ld de, SCREEN_WIDTH
hlcoord 0, 0, wAttrmap
ld a, [wMenuBorderTopCoord]
.loop
and a
jr z, .found_top
dec a
add hl, de
jr .loop
.found_top
ld a, [wMenuBorderLeftCoord]
ld e, a
ld d, 0
add hl, de
ld a, [wMenuBorderTopCoord]
ld b, a
ld a, [wMenuBorderBottomCoord]
inc a
sub b
ld b, a
ld a, [wMenuBorderLeftCoord]
ld c, a
ld a, [wMenuBorderRightCoord]
sub c
inc a
ld c, a
ld a, PAL_BG_GRAY
call FillBoxCGB
call ApplyAttrmap
ret
_CGB_MagnetTrain: ; unused
ld hl, PalPacket_MagnetTrain + 1
call CopyFourPalettes
call WipeAttrmap
hlcoord 0, 4, wAttrmap
lb bc, 10, SCREEN_WIDTH
ld a, PAL_BG_GREEN
call FillBoxCGB
hlcoord 0, 6, wAttrmap
lb bc, 6, SCREEN_WIDTH
ld a, PAL_BG_RED
call FillBoxCGB
call ApplyAttrmap
call ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
_CGB_GamefreakLogo:
ld de, wBGPals1
ld a, PREDEFPAL_GAMEFREAK_LOGO_BG
call GetPredefPal
call LoadHLPaletteIntoDE
ld hl, .GamefreakDittoPalette
ld de, wOBPals1
call LoadHLPaletteIntoDE
ld hl, .GamefreakDittoPalette
ld de, wOBPals1 palette 1
call LoadHLPaletteIntoDE
call WipeAttrmap
call ApplyAttrmap
call ApplyPals
ret
.GamefreakDittoPalette:
INCLUDE "gfx/splash/ditto.pal"
_CGB_PlayerOrMonFrontpicPals:
ld de, wBGPals1
ld a, [wCurPartySpecies]
ld bc, wTempMonDVs
call GetPlayerOrMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
call WipeAttrmap
call ApplyAttrmap
call ApplyPals
ret
_CGB_Unused1E:
ld de, wBGPals1
ld a, [wCurPartySpecies]
call GetMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
call WipeAttrmap
call ApplyAttrmap
ret
_CGB_TradeTube:
ld hl, PalPacket_TradeTube + 1
call CopyFourPalettes
ld hl, PartyMenuOBPals
ld de, wOBPals1
ld bc, 1 palettes
ld a, BANK(wOBPals1)
call FarCopyWRAM
ld de, wOBPals1 palette 7
ld a, PREDEFPAL_TRADE_TUBE
call GetPredefPal
call LoadHLPaletteIntoDE
call WipeAttrmap
ret
_CGB_TrainerOrMonFrontpicPals:
ld de, wBGPals1
ld a, [wCurPartySpecies]
ld bc, wTempMonDVs
call GetFrontpicPalettePointer
call LoadPalette_White_Col1_Col2_Black
call WipeAttrmap
call ApplyAttrmap
call ApplyPals
ret
_CGB_MysteryGift:
ld hl, .MysteryGiftPalettes
ld de, wBGPals1
ld bc, 2 palettes
ld a, BANK(wBGPals1)
call FarCopyWRAM
call ApplyPals
call WipeAttrmap
hlcoord 3, 7, wAttrmap
lb bc, 8, 14
ld a, $1
call FillBoxCGB
hlcoord 1, 5, wAttrmap
lb bc, 1, 18
ld a, $1
call FillBoxCGB
hlcoord 1, 16, wAttrmap
lb bc, 1, 18
ld a, $1
call FillBoxCGB
hlcoord 0, 0, wAttrmap
lb bc, 17, 2
ld a, $1
call FillBoxCGB
hlcoord 18, 5, wAttrmap
lb bc, 12, 1
ld a, $1
call FillBoxCGB
call ApplyAttrmap
ret
.MysteryGiftPalettes:
INCLUDE "gfx/mystery_gift/mystery_gift.pal"
GS_CGB_MysteryGift: ; unreferenced
ld hl, .MysteryGiftPalette
ld de, wBGPals1
ld bc, 1 palettes
ld a, BANK(wBGPals1)
call FarCopyWRAM
call ApplyPals
call WipeAttrmap
call ApplyAttrmap
ret
.MysteryGiftPalette:
INCLUDE "gfx/mystery_gift/gs_mystery_gift.pal"