• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Graphic✓] Affine Animation Mirroring

I've been trying to get this one affine animation to work with my Following Pokémon project. However, as you can see by the following gif, there's one frame right as the animation is starting where the follower's sprite mirrors itself, and then jumps back to it's original spot:[PokeCommunity.com] Affine Animation Mirroring(slowed down for your convenience. Due to the poor quality of the gif maker that I used, sometimes you'll see the frame where the issue happens, sometimes you won't. I swear it's there, even if you get an unlucky series of loops)

Now, I have a rough idea of why this is happening. The east/right facing frames of the follower are mirrored versions of the west/left facing frames. When an affine animation starts, the data that is used for that mirroring must instead be applied to the affine animation, so the mirror is dropped. I tried to work around this by reapplying the mirror in the affine animation, like so:
Code:
static const union AffineAnimCmd Following_Pokemon_Shrink_Right[] =
{
    AFFINEANIMCMD_FRAME(-512, 0, 0, 1),
    AFFINEANIMCMD_FRAME(28, -28, 0, 9),
    AFFINEANIMCMD_END,
};
While this does reset the mirror, it doesn't do so until the second frame of the animation. I've tried setting the duration of that first affine_frame command to 0, but that ends up making the sprite glitch out in other ways, and still doesn't fix the problem. The code that actually calls this animation is this:
Code:
followerSprite->oam.affineMode = ST_OAM_AFFINE_NORMAL;
InitSpriteAffineAnim(followerSprite);
        
if (gObjectEvents[gSaveBlock2Ptr->follower.objId].facingDirection == DIR_EAST)
       StartSpriteAffineAnim(followerSprite, 2);
else
       StartSpriteAffineAnim(followerSprite, 0);
I've tried removing the if-statement, in case that was causing some super small slowdown, but that didn't change anything. I even tried hard-coding values into AffineAnimStateStartAnim and AffineAnimStateReset in gflib/sprite.c to force the xScale to be -512 at the start of the animation, but that made no difference either. I can't figure out what I need to do for the affine animation to immediately mirror the follower's sprite rather than letting that first frame be un-mirrored. Does anyone have any insights on this?
 
Last edited:
Back
Top