=====================================================
What Is This?
This is a feature, originally from pokeem, (see https://github.com/Slawter666/pokeemerald/tree/surfable/src), to have the surfing sprite dynamically change based on the first party pokemon or selected pokemon from the menu.
It has a few improved features:
-
One master structure for all species data, so worrying about matching indexes is no longer an issue
-
The palette is directly loaded from an address rather than using a tag. A tag is still needed for tracking the palette, but there is no need to add the palette to the NPC palette table. This means you only need one tag for all surf sprites, since only one will exist at the same time.
-
Switching Pokemon mid-surf will not change the surf blob
-
Selecting a Pokemon from the pokemenu loads the correct graphics
-
The overlay frames are hidden underneath map tiles (eg. treetops over water)
=====================================================
Important Notes:
-
This includes the dynamic overworld palette hack, as it removes the need to worry about matching palettes, and is generally just awesome. See https://github.com/Navenatox/DynamicOverworldPalettes for more details. The original source code has been modified to call some of these functions, so removing the file if you've already added this feature will not do. There is ample free-space in FR so I suggest just leaving it be unless you know what you are doing.
-
This feauture is currently missing a lot of necessary artwork. Any pokemon without art will default to the original surf blob. As art is added, either by the user or community, you can change this in src/surf_mons.h by changing the elements
.paletteTag
and.images
ofconst struct SpriteTemplate s[species]Overworld
-
Fire Red likes vertical images, and as such the sprites have to have all their frames lined up vertically, as opposed to the pokeem images that are layered horizontally. While annoying, changing the frame ordering isn't a big deal, and I hope this won't stand in the way of community art being shared.
=====================================================
How To Compile:
-
add
rom.gba
to the main directory -
open
scripts/make.py
and modifyOFFSET_TO_PUT
to wherever you'd like to insert this code, as well asSEARCH_FREE_SPACE
toTrue
if you'd like to search for free space from said offset.
3a. download devkitPro. see this tutorial for more information: https://www.pokecommunity.com/showpost.php?p=8825585&postcount=96
3b. download python 3.7.2 (make sure add to path
is checked), then type python scripts/make.py
into the terminal to compile the code and images.
test.gba
will be added to the folder, and the offsets will be located inoffsets.ini
=====================================================
Adding New Species:
if you want to add new species that can learn surf, follow these steps. I will use Popplio as an example
- make the sprite, 32 x 384 (12 frames of 32x32). Use the existing sprites as models.
2a. add the indexed image .png file to graphics/. Eg. popplio.png
2b. modify the palette of said image for the sprite's shiny colors, then place this image in graphics/shiny, eg. popplioShiny.png
. Only the palette will get inserted into the rom, so make sure it can be applied to the original image without messing up the appearance.
- add the following to surf_mons.h
extern const u32 popplioTiles[];
extern const u16 popplioPal[];
extern const u16 popplioShinyPal[];
const struct SpriteFrameImage gSurfingOverworldPicTable_Popplio[] = {
overworld_frame(&popplioTiles[0], 4, 4, 0),
overworld_frame(&popplioTiles[0], 4, 4, 1),
overworld_frame(&popplioTiles[0], 4, 4, 2),
overworld_frame(&popplioTiles[0], 4, 4, 3),
overworld_frame(&popplioTiles[0], 4, 4, 4),
overworld_frame(&popplioTiles[0], 4, 4, 5),
};
const struct SpriteFrameImage gSurfingOverlayPicTable_Popplio[] = {
overworld_frame(&popplioTiles[0], 4, 4, 6),
overworld_frame(&popplioTiles[0], 4, 4, 7),
overworld_frame(&popplioTiles[0], 4, 4, 8),
overworld_frame(&popplioTiles[0], 4, 4, 9),
overworld_frame(&popplioTiles[0], 4, 4, 10),
overworld_frame(&popplioTiles[0], 4, 4, 11),
};
sPopplioOverworld = surf_template(PAL_TAG_SURF_NEW, gSurfingOverworldPicTable_Popplio, UpdateSurfBlobFieldEffect)
sPopplioOverlay = surf_template(PAL_TAG_SURF_NEW, gSurfingOverworldPicTable_Popplio, UpdateSurfMonOverlay)
-
If you do not have any overlay frames, the sprite sheet only needs to be 32x192 (6 frames), and do not need to define the
OverlayPicTable
. Also, if you want unique palette tags,PAL_TAG_SURF_NEW
should bePAL_TAG_POPPLIO_SURF
or whatever you want to call it, instead. -
Finally, add the following to the
gSurfablePokemon
structure at the bottom of the page. Note that I changed the structures from the pokeemerald source so you shouldn't have to worry about matching indices, since there is one main structure that defines the surfable pokemon
{
.species = SPECIES_POPPLIO,
.palAddr = &popplioPal[0],
.shinyPalAddr = &popplioShinyPal[0], // or 0 if it doesn't exist
.overworldGfx = &sPopplioOverword,
.overlayGfx = &sPopplioOverlay, // or 0 if it doesn't exist
},