diff --git a/include/constants/pokedex.h b/include/constants/pokedex.h index 7b29cee24..8f40f9a7b 100644 --- a/include/constants/pokedex.h +++ b/include/constants/pokedex.h @@ -1136,4 +1136,4 @@ enum { #define HOENN_DEX_COUNT (HOENN_DEX_DEOXYS + 1) -#endif // GUARD_CONSTANTS_POKEDEX_H \ No newline at end of file +#endif // GUARD_CONSTANTS_POKEDEX_H diff --git a/src/pokemon.c b/src/pokemon.c index 28d103074..d501dbf8d 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6648,18 +6648,21 @@ u16 HoennToNationalOrder(u16 hoennNum) Spinda has 4 spots, each with an entry in gSpindaSpotGraphics. Each entry contains a base x and y coordinate for the spot and a 16x16 binary image. Each bit in the image determines whether that pixel should be considered part of the spot. + The position of each spot is randomized using the Spinda's personality. The entire 32 bit personality value is used, 4 bits for each coordinate of the 4 spots. If the personality value is 0x87654321, then 0x1 will be used for the 1st spot's x coord, 0x2 will be used for the 1st spot's y coord, 0x3 will be used for the 2nd spot's x coord, and so on. Each coordinate is calculated as (baseCoord + (given 4 bits of personality) - 8). In effect this means each spot can start at any position -8 to +7 off of its base coordinates (256 possibilities). + The macro then loops over the 16x16 spot image. For each bit in the spot's binary image, if the bit is set then it's part of the spot; try to draw it. A pixel is drawn on Spinda if the pixel on Spinda satisfies the following formula: ((u8)(colorIndex - 1) <= 2). The -1 excludes transparent pixels, as these are index 0. Therefore only colors 1, 2, or 3 on Spinda will allow a spot to be drawn. These color indexes are Spinda's light brown body colors. To create the spot it adds 4 to the color index, so Spinda's spots will be colors 5, 6, and 7. + The above is done two different ways in the macro: one with << 4, and one without. This is because Spinda's sprite is a 4 bits per pixel image, but the pointer to Spinda's pixels (destPixels) is an 8 bit pointer, so it addresses two pixels. Shifting by 4 accesses the 2nd