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
|
This one is a simple upgrade.
## Contents
1. [Define the colors](#1-define-the-colors)
2. [Load the colors](#2-load-the-colors)
3. [Apply the colors to the badges](#3-apply-the-colors-to-the-badges)
4. [Redesign some badge graphics](#4-redesign-some-badge-graphics)
## 1. Define the colors
Create **gfx/trainer_card/badges.pal**:
```diff
+ RGB 31,31,31, 21,21,24, 13,13,16, 00,00,00 ; ZEPHYRBADGE
+ RGB 31,31,31, 31,12,12, 29,00,00, 00,00,00 ; HIVEBADGE
+ RGB 31,31,31, 29,29,29, 27,24,00, 00,00,00 ; PLAINBADGE
+ RGB 31,31,31, 23,22,26, 11,10,23, 00,00,00 ; FOGBADGE
+ RGB 31,31,31, 27,16,08, 12,07,04, 00,00,00 ; STORMBADGE
+ RGB 31,31,31, 23,26,29, 15,19,23, 00,00,00 ; MINERALBADGE
+ RGB 31,31,31, 19,27,30, 00,22,26, 00,00,00 ; GLACIERBADGE
+ RGB 31,31,31, 30,09,05, 05,05,06, 00,00,00 ; RISINGBADGE
```
## 2. Load the colors
Edit [engine/gfx/cgb_layouts.asm](../blob/master/engine/gfx/cgb_layouts.asm):
```diff
_CGB_TrainerCard:
...
- ld a, PREDEFPAL_CGB_BADGE
- call GetPredefPal
- call LoadHLPaletteIntoDE
+ ld hl, .BadgePalettes
+ ld bc, 8 palettes
+ ld a, BANK(wOBPals1)
+ call FarCopyWRAM
...
ret
+
+.BadgePalettes:
+INCLUDE "gfx/trainer_card/badges.pal"
```
## 3. Apply the colors to the badges
Edit [engine/menus/trainer_card.asm](../blob/master/engine/menus/trainer_card.asm):
```diff
TrainerCard_JohtoBadgesOAM:
; Template OAM data for each badge on the trainer card.
; Format:
; y, x, palette
; cycle 1: face tile, in1 tile, in2 tile, in3 tile
; cycle 2: face tile, in1 tile, in2 tile, in3 tile
dw wJohtoBadges
; Zephyrbadge
db $68, $18, 0
db $00, $20, $24, $20 | (1 << 7)
db $00, $20, $24, $20 | (1 << 7)
; Hivebadge
- db $68, $38, 0
+ db $68, $38, 1
...
; Plainbadge
- db $68, $58, 0
+ db $68, $58, 2
...
; Fogbadge
- db $68, $78, 0
+ db $68, $78, 3
...
; Mineralbadge
- db $80, $38, 0
+ db $80, $38, 5
...
; Stormbadge
- db $80, $18, 0
+ db $80, $18, 4
...
; Glacierbadge
- db $80, $58, 0
+ db $80, $58, 6
...
; Risingbadge
; X-flips on alternate cycles.
- db $80, $78, 0
+ db $80, $78, 7
...
```
## 4. Redesign some badge graphics
Edit [gfx/trainer_card/badges.png](../blob/master/gfx/trainer_card/badges.png):

This changes the Hive Badge, Plain Badge, Fog Badge, and Rising Badge to look better with their new color palettes.
That's it!

|