0 New Custom Menu Border Themes (Basic)
SonikkuA-DatH edited this page 2021-12-14 10:50:06 -08:00

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

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

Example of how edges can be repeated

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

Name it the number (in this case 21), and place it in graphics/text_window with the others

Now for code, in include/text_window.h, edit the define count for the newly added theme

-#define WINDOW_FRAMES_COUNT 20
+#define WINDOW_FRAMES_COUNT 21

See end note for limit*

In src/text_window.c, add the graphic constants for image, palette, and pair

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");
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");
{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

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