summaryrefslogtreecommitdiff
path: root/New-Custom-Menu-Border-Themes-(Basic).md
blob: d90b5d8236ffe729ff3bfcf1728f800307da660c (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
You ever felt bored with the same 20 themes? Look no further, we'll add new ones easily!*

First, let's look at how the game splits the base sprite into 8x8 chunks

![Base theme](https://i.imgur.com/PRMcJ4d.png)

The way the base window tileset works is that the corners are independent, with the rest of the edges repeated to fill the window dimension

Edges defined in yellow

![](https://i.imgur.com/iG5czo4.png)

Example of how edges can be repeated

![](https://i.imgur.com/N5r0ZYJ.png)

The center is always white despite the game simply filling it in code regardless. Potentially a leftover?

But regardless, with those specifications, when making textbox tiles (without editing tilemap, see end notes*);
-Avoid gradients on the tangent, unless you purposefully want it to repeat
-Have the center white
-Have it 16bit for palette in a 24 by 24 frame

With that, let's try to add a new border! Here's a test one

![](https://i.imgur.com/GrpsKzj.png)

Name it the number (in this case 21), and place it in [graphics/text_window](https://github.com/pret/pokeemerald/tree/master/graphics/text_window) with the others

Now for code, in [include/text_window.h](https://github.com/pret/pokeemerald/blob/master/include/text_window.h), edit the define count for the newly added theme

```diff code
-#define WINDOW_FRAMES_COUNT 20
+#define WINDOW_FRAMES_COUNT 21
```
See end note for limit*

In [src/text_window.c](https://github.com/pret/pokeemerald/blob/master/src/text_window.c), add the graphic constants for image, palette, and pair

```diff code
static const u8 sTextWindowFrame18_Gfx[] = INCBIN_U8("graphics/text_window/18.4bpp");
static const u8 sTextWindowFrame19_Gfx[] = INCBIN_U8("graphics/text_window/19.4bpp");
static const u8 sTextWindowFrame20_Gfx[] = INCBIN_U8("graphics/text_window/20.4bpp");
+static const u8 sTextWindowFrame21_Gfx[] = INCBIN_U8("graphics/text_window/21.4bpp");
```

```diff code
static const u16 sTextWindowFrame18_Pal[] = INCBIN_U16("graphics/text_window/18.gbapal");
static const u16 sTextWindowFrame19_Pal[] = INCBIN_U16("graphics/text_window/19.gbapal");
static const u16 sTextWindowFrame20_Pal[] = INCBIN_U16("graphics/text_window/20.gbapal");
+static const u8 sTextWindowFrame21_Pal[] = INCBIN_U8("graphics/text_window/21.gbapal");
```

```diff code
{sTextWindowFrame18_Gfx, sTextWindowFrame18_Pal},
{sTextWindowFrame19_Gfx, sTextWindowFrame19_Pal},
-{sTextWindowFrame20_Gfx, sTextWindowFrame20_Pal}
+{sTextWindowFrame20_Gfx, sTextWindowFrame20_Pal},
+{sTextWindowFrame21_Gfx, sTextWindowFrame21_Pal}
```

And you're done!
Test in game (the file menu makes it easy to access), and it should look like this

![](https://i.imgur.com/Dc51lgt.png)

Notes;
-The theoretical limit is 31 themes given this is a u8 with 3 bits reserved for other functions, so 11 at max can be added
-Tilemap editing can potentially allow more complex shapes, though that's far outside the scope of the tutorial