Skip to content

Spinda Second Frame Spot Addition

SonikkuA-DatH edited this page Nov 24, 2021 · 1 revision

Note: requires one to remove Spinda from the "HasTwoFrameAnimation" exclusion list in src/pokemon.c

For those that try to edit Spinda's graphics to use two frame anims like most other mons (or have a fakemon with it's own spot variances), you may have noticed that for the second frame, the spots disappear. This is because the spots are aligned to the first frame, so when the second frame is shown, the game shifts it up by 64 pixels, which has nothing since it's offscreen

So how do we address this? Simple

Head to src/pokemon.c, and duplicate the DRAW_SPINDA_SPOTS define, making a new name for the define

+#define DRAW_SPINDA_SPOTSB                                                      \
+{                                                                               \
+    int i;                                                                      \
+    for (i = 0; i < 4; i++)                                                     \
+    {                                                                           \
+        int j;                                                                  \
+        u8 x = gSpindaSpotGraphics[i].x + ((personality & 0x0F) - "**A**");           \
+        u8 y = gSpindaSpotGraphics[i].y + (((personality & 0xF0) >> 4) - "**B**");    \
+                                                                                \
+        for (j = 0; j < 16; j++)                                                \
+        {                                                                       \
+            int k;                                                              \
+            s32 row = gSpindaSpotGraphics[i].image[j];                          \
+                                                                                \
+            for (k = x; k < x + 16; k++)                                        \
+            {                                                                   \
+                u8 *val = dest + ((k / 8) * 32) +                               \
+                                 ((k % 8) / 2) +                                \
+                                 ((y >> 3) << 8) +                              \
+                                 ((y & 7) << 2);                                \
+                                                                                \
+                if (row & 1)                                                    \
+                {                                                               \
+                    if (k & 1)                                                  \
+                    {                                                           \
+                        if ((u8)((*val & 0xF0) - 0x10) <= 0x20)                 \
+                            *val += 0x40;                                       \
+                    }                                                           \
+                    else                                                        \
+                    {                                                           \
+                        if ((u8)((*val & 0xF) - 0x01) <= 0x02)                  \
+                            *val += 0x04;                                       \
+                    }                                                           \
+                }                                                               \
+                                                                                \
+                row >>= 1;                                                      \
+            }                                                                   \
+                                                                                \
+            y++;                                                                \
+        }                                                                       \
+                                                                                \
+        personality >>= 8;                                                      \
+    }                                                                           \
+}

Now A and B in the original function were 8 and 8 respectively. They represent the spot position based on the main sprite position Since the sceond frame is 64 pixels raised, the y value (B) should reflect that. However this also depends on what the second frame looks like Personally for me I did this

Where Spinda's head is the same vertical position for a 64 sprite boundary, but is 4 pixels more to the left. So my code looks like this for that snippet

+        u8 x = gSpindaSpotGraphics[i].x + ((personality & 0x0F) - 12);           \
+        u8 y = gSpindaSpotGraphics[i].y + (((personality & 0xF0) >> 4) + 56);    \

When you're satisfied, scroll down to void DrawSpindaSpots and add your newly made define

void DrawSpindaSpots(u16 species, u32 personality, u8 *dest, bool8 isFrontPic)
{
    if (species == SPECIES_SPINDA && isFrontPic)
        DRAW_SPINDA_SPOTS;
+       DRAW_SPINDA_SPOTSB;
}

And that's it. Here's how mine looks for spot placement

Remember to edit your anim tables!

Clone this wiki locally