Support 2x2 Cities on the Region Map - Pawkkie/Team-Aquas-Asset-Repo GitHub Wiki

Melon, written for pokeemerald-expansion 1.8.1

By default, Pokémon Emerald doesn't support cities on the Fly Map that have a map section defined as a 2x2 square. Simply look at Jubilife City from Pokémon DPP as an example of what this guide will allow you to achieve.

First step, go in your graphics\pokenav\region_map folder and drop this new png file in, replacing the original one:

enter image description here

First of all, in src/region_map.c, add the following line above #define FLYDESTICON_RED_OUTLINE 6:

#define MAP_SPRITE_16X16 200

Next, find u8 tileBuffer[0x1c0]; in src/region_map.c and replace it with u8 tileBuffer[0x2c0]; to increase the buffer size where the png file is written into, since it was modified and made bigger.

After that we need to tell the game the new offets of the 2x2 icons. Simply add the following piece of code above sFlyDestIcon_Anim_RedOutline in src/region_map.c :

static const union AnimCmd sFlyDestIcon_Anim_16x16CanFly[] =
{
	ANIMCMD_FRAME(14, 5),
	ANIMCMD_END
};

static const union AnimCmd sFlyDestIcon_Anim_16x16CantFly[] =
{
	ANIMCMD_FRAME(18, 5),
	ANIMCMD_END
};

Then modify the sFlyDestIcon_Anims array to be the following:

static const union AnimCmd *const sFlyDestIcon_Anims[] =
{
	[SPRITE_SHAPE(8x8)] = sFlyDestIcon_Anim_8x8CanFly,
	[SPRITE_SHAPE(16x8)] = sFlyDestIcon_Anim_16x8CanFly,
	[SPRITE_SHAPE(8x16)] = sFlyDestIcon_Anim_8x16CanFly,
	[SPRITE_SHAPE(8x8) + 3] = sFlyDestIcon_Anim_8x8CantFly,
	[SPRITE_SHAPE(16x8) + 3] = sFlyDestIcon_Anim_16x8CantFly,
	[SPRITE_SHAPE(8x16) + 3] = sFlyDestIcon_Anim_8x16CantFly,
	[FLYDESTICON_RED_OUTLINE] = sFlyDestIcon_Anim_RedOutline,
	[MAP_SPRITE_16X16] = sFlyDestIcon_Anim_16x16CanFly,
	[MAP_SPRITE_16X16 + 3] = sFlyDestIcon_Anim_16x16CantFly,
};

Next, in the CreateFlyDestIcons void function, there is this piece of code inside:

if (width == 2)
	shape = SPRITE_SHAPE(16x8);
else if (height == 2)
	shape = SPRITE_SHAPE(8x16);
else
	shape = SPRITE_SHAPE(8x8);

Simply add a check above to see if width and height is 2. It should look like this:

if (width == 2 && height == 2)
	shape = MAP_SPRITE_16X16;
else if (width == 2)
	shape = SPRITE_SHAPE(16x8);
else if (height == 2)
	shape = SPRITE_SHAPE(8x16);
else
	shape = SPRITE_SHAPE(8x8);

This allows us to see if a city that has been registered as a section has a size of 2x2.

Then a bit further down, right above the gSprites[spriteId].oam.shape = shape; line, add this:

if (shape == MAP_SPRITE_16X16) {
	gSprites[spriteId].oam.size = SPRITE_SIZE(16x16);
}

This will set the drawing size of the sprite to 2x2 if the map section we're looking at is 2x2.

And there you go! With this you can freely have a 2x2 city on your region map, and the sprite will show up properly. It will be gray if you haven't visited the city, but will be pink if you have.