From bee60f4c64e6cdf2bfa3777b59067ff63450e4e3 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sat, 24 Apr 2021 23:29:49 -0400 Subject: [PATCH] Document battler sprite affine anims, default pokeball throw --- include/data.h | 10 ++- src/battle_anim_effects_3.c | 8 +- src/battle_anim_mons.c | 4 +- src/battle_anim_throw.c | 5 +- src/contest.c | 4 +- src/data.c | 162 ++++++++++++++++++---------------- src/egg_hatch.c | 2 +- src/pokeball.c | 100 +++++++++++---------- src/pokemon.c | 4 +- src/trainer_pokemon_sprites.c | 2 +- 10 files changed, 158 insertions(+), 143 deletions(-) diff --git a/include/data.h b/include/data.h index 2f8c44746..f94f55a8f 100644 --- a/include/data.h +++ b/include/data.h @@ -5,6 +5,12 @@ #define SPECIES_SHINY_TAG 500 +enum { + BATTLER_AFFINE_NORMAL, + BATTLER_AFFINE_EMERGE, + BATTLER_AFFINE_RETURN, +}; + struct MonCoords { // This would use a bitfield, but some function @@ -87,9 +93,9 @@ extern const struct SpriteFrameImage gTrainerBackPicTable_Steven[]; extern const union AffineAnimCmd *const gAffineAnims_BattleSpritePlayerSide[]; extern const union AffineAnimCmd *const gAffineAnims_BattleSpriteOpponentSide[]; -extern const union AffineAnimCmd *const gUnknown_082FF6C0[]; +extern const union AffineAnimCmd *const gAffineAnims_BattleSpriteContest[]; -extern const union AnimCmd *const gUnknown_082FF70C[]; +extern const union AnimCmd *const gAnims_MonPic[]; extern const struct MonCoords gMonFrontPicCoords[]; extern const struct CompressedSpriteSheet gMonStillFrontPicTable[]; extern const struct MonCoords gMonBackPicCoords[]; diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index 800431c6a..5aaf45f19 100755 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -2319,11 +2319,11 @@ void AnimTask_TransformMon(u8 taskId) } if (IsSpeciesNotUnown(gContestResources->moveAnim->targetSpecies)) - gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gUnknown_082FF6C0; + gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gAffineAnims_BattleSpriteContest; else gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gAffineAnims_BattleSpriteOpponentSide; - StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[gBattleAnimAttacker]], 0); + StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[gBattleAnimAttacker]], BATTLER_AFFINE_NORMAL); } gTasks[taskId].data[0]++; @@ -4733,8 +4733,8 @@ void AnimTask_MonToSubstitute(u8 taskId) LoadBattleMonGfxAndAnimate(gBattleAnimAttacker, 0, spriteId); if (IsContest()) { - gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gUnknown_082FF6C0; - StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[gBattleAnimAttacker]], 0); + gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gAffineAnims_BattleSpriteContest; + StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[gBattleAnimAttacker]], BATTLER_AFFINE_NORMAL); } for (i = 0; i < NUM_TASK_DATA; i++) diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index 6fd8cd621..6dc0a0271 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -2078,8 +2078,8 @@ u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 if (IsContest()) { - gSprites[spriteId].affineAnims = gUnknown_082FF6C0; - StartSpriteAffineAnim(&gSprites[spriteId], 0); + gSprites[spriteId].affineAnims = gAffineAnims_BattleSpriteContest; + StartSpriteAffineAnim(&gSprites[spriteId], BATTLER_AFFINE_NORMAL); } return spriteId; } diff --git a/src/battle_anim_throw.c b/src/battle_anim_throw.c index f6a48cf69..83768b476 100755 --- a/src/battle_anim_throw.c +++ b/src/battle_anim_throw.c @@ -16,6 +16,7 @@ #include "task.h" #include "trig.h" #include "util.h" +#include "data.h" #include "constants/items.h" #include "constants/moves.h" #include "constants/songs.h" @@ -1471,7 +1472,7 @@ static void SpriteCB_Ball_Release_Step(struct Sprite *sprite) // Animate Pokémon emerging from Poké Ball gSprites[gBattlerSpriteIds[gBattleAnimTarget]].invisible = FALSE; - StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[gBattleAnimTarget]], 1); + StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[gBattleAnimTarget]], BATTLER_AFFINE_EMERGE); AnimateSprite(&gSprites[gBattlerSpriteIds[gBattleAnimTarget]]); gSprites[gBattlerSpriteIds[gBattleAnimTarget]].sOffsetY = 4096; } @@ -1485,7 +1486,7 @@ static void SpriteCB_Ball_Release_Wait(struct Sprite *sprite) if (gSprites[gBattlerSpriteIds[gBattleAnimTarget]].affineAnimEnded) { - StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[gBattleAnimTarget]], 0); + StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[gBattleAnimTarget]], BATTLER_AFFINE_NORMAL); released = TRUE; } else diff --git a/src/contest.c b/src/contest.c index 246fc1e50..0d2d66a66 100644 --- a/src/contest.c +++ b/src/contest.c @@ -3133,10 +3133,10 @@ static u8 CreateContestantSprite(u16 species, u32 otId, u32 personality, u32 ind gSprites[spriteId].data[0] = gSprites[spriteId].oam.paletteNum; gSprites[spriteId].data[2] = species; if (IsSpeciesNotUnown(species)) - gSprites[spriteId].affineAnims = gUnknown_082FF6C0; + gSprites[spriteId].affineAnims = gAffineAnims_BattleSpriteContest; else gSprites[spriteId].affineAnims = gAffineAnims_BattleSpriteOpponentSide; - StartSpriteAffineAnim(gSprites + spriteId, 0); + StartSpriteAffineAnim(&gSprites[spriteId], BATTLER_AFFINE_NORMAL); return spriteId; } diff --git a/src/data.c b/src/data.c index 30672f7c4..d300d4f63 100644 --- a/src/data.c +++ b/src/data.c @@ -124,172 +124,178 @@ static const union AnimCmd sAnim_GeneralFrame3[] = ANIMCMD_END, }; -static const union AffineAnimCmd gUnknown_082FF548[] = +// Many of these affine anims seem to go unused, and +// instead SetSpriteRotScale is used to manipulate +// the battler sprites directly (for instance, in AnimTask_SwitchOutShrinkMon). +// Those with explicit indexes are referenced elsewhere. + +static const union AffineAnimCmd sAffineAnim_Battler_Normal[] = { - AFFINEANIMCMD_FRAME(0x0100, 0x0100, 0x00, 0x00), + AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gUnknown_082FF558[] = +static const union AffineAnimCmd sAffineAnim_Battler_Flipped[] = { - AFFINEANIMCMD_FRAME(0xff00, 0x0100, 0x00, 0x00), + AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gUnknown_082FF568[] = +static const union AffineAnimCmd sAffineAnim_Battler_Emerge[] = { - AFFINEANIMCMD_FRAME(0x0028, 0x0028, 0x00, 0x00), - AFFINEANIMCMD_FRAME(0x0012, 0x0012, 0x00, 0x0c), + AFFINEANIMCMD_FRAME(0x28, 0x28, 0, 0), + AFFINEANIMCMD_FRAME(0x12, 0x12, 0, 12), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gUnknown_082FF580[] = +static const union AffineAnimCmd sAffineAnim_Battler_Return[] = { - AFFINEANIMCMD_FRAME(0xfffe, 0xfffe, 0x00, 0x12), - AFFINEANIMCMD_FRAME(0xfff0, 0xfff0, 0x00, 0x0f), + AFFINEANIMCMD_FRAME( -0x2, -0x2, 0, 18), + AFFINEANIMCMD_FRAME(-0x10, -0x10, 0, 15), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gUnknown_082FF598[] = +static const union AffineAnimCmd sAffineAnim_Battler_HorizontalSquishLoop[] = { - AFFINEANIMCMD_FRAME(0x00a0, 0x0100, 0x00, 0x00), - AFFINEANIMCMD_FRAME(0x0004, 0x0000, 0x00, 0x08), - AFFINEANIMCMD_FRAME(0xfffc, 0x0000, 0x00, 0x08), + AFFINEANIMCMD_FRAME(0xA0, 0x100, 0, 0), + AFFINEANIMCMD_FRAME( 0x4, 0x0, 0, 8), + AFFINEANIMCMD_FRAME(-0x4, 0x0, 0, 8), AFFINEANIMCMD_JUMP(1), }; -static const union AffineAnimCmd gUnknown_082FF5B8[] = +static const union AffineAnimCmd sAffineAnim_Battler_Grow[] = { - AFFINEANIMCMD_FRAME(0x0002, 0x0002, 0x00, 0x14), + AFFINEANIMCMD_FRAME(0x2, 0x2, 0, 20), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gUnknown_082FF5C8[] = +static const union AffineAnimCmd sAffineAnim_Battler_Shrink[] = { - AFFINEANIMCMD_FRAME(0xfffe, 0xfffe, 0x00, 0x14), + AFFINEANIMCMD_FRAME(-0x2, -0x2, 0, 20), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gUnknown_082FF5D8[] = +static const union AffineAnimCmd sAffineAnim_Battler_BigToSmall[] = { - AFFINEANIMCMD_FRAME(0x0100, 0x0100, 0x00, 0000), - AFFINEANIMCMD_FRAME(0xfff0, 0xfff0, 0x00, 0x09), + AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(-0x10, -0x10, 0, 9), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gUnknown_082FF5F0[] = +static const union AffineAnimCmd sAffineAnim_Battler_GrowLarge[] = { - AFFINEANIMCMD_FRAME(0x0004, 0x0004, 0x00, 0x3f), + AFFINEANIMCMD_FRAME(0x4, 0x4, 0, 63), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gUnknown_082FF600[] = +static const union AffineAnimCmd sAffineAnim_Battler_TipRight[] = { - AFFINEANIMCMD_FRAME(0x0000, 0x0000, 0xfd, 0x05), - AFFINEANIMCMD_FRAME(0x0000, 0x0000, 0x03, 0x05), + AFFINEANIMCMD_FRAME(0x0, 0x0, -3, 5), + AFFINEANIMCMD_FRAME(0x0, 0x0, 3, 5), AFFINEANIMCMD_END, }; const union AffineAnimCmd *const gAffineAnims_BattleSpritePlayerSide[] = { - gUnknown_082FF548, - gUnknown_082FF568, - gUnknown_082FF580, - gUnknown_082FF598, - gUnknown_082FF5B8, - gUnknown_082FF5C8, - gUnknown_082FF5F0, - gUnknown_082FF600, - gUnknown_082FF5D8, + [BATTLER_AFFINE_NORMAL] = sAffineAnim_Battler_Normal, + [BATTLER_AFFINE_EMERGE] = sAffineAnim_Battler_Emerge, + [BATTLER_AFFINE_RETURN] = sAffineAnim_Battler_Return, + sAffineAnim_Battler_HorizontalSquishLoop, + sAffineAnim_Battler_Grow, + sAffineAnim_Battler_Shrink, + sAffineAnim_Battler_GrowLarge, + sAffineAnim_Battler_TipRight, + sAffineAnim_Battler_BigToSmall, }; -static const union AffineAnimCmd gUnknown_082FF63C[] = +static const union AffineAnimCmd sAffineAnim_Battler_SpinShrink[] = { - AFFINEANIMCMD_FRAME(0xfffc, 0xfffc, 0x04, 0x3f), + AFFINEANIMCMD_FRAME(-0x4, -0x4, 4, 63), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gUnknown_082FF64C[] = +static const union AffineAnimCmd sAffineAnim_Battler_TipLeft[] = { - AFFINEANIMCMD_FRAME(0x0000, 0x0000, 0x03, 0x05), - AFFINEANIMCMD_FRAME(0x0000, 0x0000, 0xfd, 0x05), + AFFINEANIMCMD_FRAME(0x0, 0x0, 3, 5), + AFFINEANIMCMD_FRAME(0x0, 0x0, -3, 5), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gUnknown_082FF664[] = +static const union AffineAnimCmd sAffineAnim_Battler_RotateUpAndBack[] = { - AFFINEANIMCMD_FRAME(0x0000, 0x0000, 0xfb, 0x14), - AFFINEANIMCMD_FRAME(0x0000, 0x0000, 0x00, 0x14), - AFFINEANIMCMD_FRAME(0x0000, 0x0000, 0x05, 0x14), + AFFINEANIMCMD_FRAME(0x0, 0x0, -5, 20), + AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 20), + AFFINEANIMCMD_FRAME(0x0, 0x0, 5, 20), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gUnknown_082FF684[] = +static const union AffineAnimCmd sAffineAnim_Battler_Spin[] = { - AFFINEANIMCMD_FRAME(0x0000, 0x0000, 0x09, 0x6e), + AFFINEANIMCMD_FRAME(0x0, 0x0, 9, 110), AFFINEANIMCMD_END, }; const union AffineAnimCmd *const gAffineAnims_BattleSpriteOpponentSide[] = { - gUnknown_082FF548, - gUnknown_082FF568, - gUnknown_082FF580, - gUnknown_082FF598, - gUnknown_082FF5B8, - gUnknown_082FF5C8, - gUnknown_082FF63C, - gUnknown_082FF64C, - gUnknown_082FF664, - gUnknown_082FF5D8, - gUnknown_082FF684, + [BATTLER_AFFINE_NORMAL] = sAffineAnim_Battler_Normal, + [BATTLER_AFFINE_EMERGE] = sAffineAnim_Battler_Emerge, + [BATTLER_AFFINE_RETURN] = sAffineAnim_Battler_Return, + sAffineAnim_Battler_HorizontalSquishLoop, + sAffineAnim_Battler_Grow, + sAffineAnim_Battler_Shrink, + sAffineAnim_Battler_SpinShrink, + sAffineAnim_Battler_TipLeft, + sAffineAnim_Battler_RotateUpAndBack, + sAffineAnim_Battler_BigToSmall, + sAffineAnim_Battler_Spin, }; -const union AffineAnimCmd *const gUnknown_082FF6C0[] = +const union AffineAnimCmd *const gAffineAnims_BattleSpriteContest[] = { - gUnknown_082FF558, - gUnknown_082FF568, - gUnknown_082FF580, - gUnknown_082FF598, - gUnknown_082FF5B8, - gUnknown_082FF5C8, - gUnknown_082FF63C, - gUnknown_082FF64C, - gUnknown_082FF664, - gUnknown_082FF5D8, - gUnknown_082FF684, + [BATTLER_AFFINE_NORMAL] = sAffineAnim_Battler_Flipped, + [BATTLER_AFFINE_EMERGE] = sAffineAnim_Battler_Emerge, + [BATTLER_AFFINE_RETURN] = sAffineAnim_Battler_Return, + sAffineAnim_Battler_HorizontalSquishLoop, + sAffineAnim_Battler_Grow, + sAffineAnim_Battler_Shrink, + sAffineAnim_Battler_SpinShrink, + sAffineAnim_Battler_TipLeft, + sAffineAnim_Battler_RotateUpAndBack, + sAffineAnim_Battler_BigToSmall, + sAffineAnim_Battler_Spin, }; -static const union AnimCmd gUnknown_082FF6EC[] = + +static const union AnimCmd sAnim_MonPic_0[] = { ANIMCMD_FRAME(0, 0), ANIMCMD_END, }; -static const union AnimCmd gUnknown_082FF6F4[] = +static const union AnimCmd sAnim_MonPic_1[] = { ANIMCMD_FRAME(1, 0), ANIMCMD_END, }; -static const union AnimCmd gUnknown_082FF6FC[] = +static const union AnimCmd sAnim_MonPic_2[] = { ANIMCMD_FRAME(2, 0), ANIMCMD_END, }; -static const union AnimCmd gUnknown_082FF704[] = +static const union AnimCmd sAnim_MonPic_3[] = { ANIMCMD_FRAME(3, 0), ANIMCMD_END, }; -const union AnimCmd *const gUnknown_082FF70C[] = +const union AnimCmd *const gAnims_MonPic[] = { - gUnknown_082FF6EC, - gUnknown_082FF6F4, - gUnknown_082FF6FC, - gUnknown_082FF704, + sAnim_MonPic_0, + sAnim_MonPic_1, + sAnim_MonPic_2, + sAnim_MonPic_3, }; #define SPECIES_SPRITE(species, sprite) [SPECIES_##species] = {sprite, MON_PIC_SIZE, SPECIES_##species} diff --git a/src/egg_hatch.c b/src/egg_hatch.c index 0ae0e1323..f2d28e916 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -811,7 +811,7 @@ static void SpriteCB_Egg_5(struct Sprite* sprite) if (sprite->data[0] == 0) { gSprites[sEggHatchData->pokeSpriteID].invisible = FALSE; - StartSpriteAffineAnim(&gSprites[sEggHatchData->pokeSpriteID], 1); + StartSpriteAffineAnim(&gSprites[sEggHatchData->pokeSpriteID], BATTLER_AFFINE_EMERGE); } if (sprite->data[0] == 8) BeginNormalPaletteFade(PALETTES_ALL, -1, 0x10, 0, RGB_WHITEALPHA); diff --git a/src/pokeball.c b/src/pokeball.c index 77d2b119c..3671e6a35 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -12,28 +12,29 @@ #include "task.h" #include "trig.h" #include "util.h" +#include "data.h" #include "constants/songs.h" extern struct MusicPlayerInfo gMPlayInfo_BGM; // this file's functions static void Task_DoPokeballSendOutAnim(u8 taskId); -static void SpriteCB_TestBallThrow(struct Sprite *sprite); static void SpriteCB_PlayerMonSendOut_1(struct Sprite *sprite); static void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite); static void SpriteCB_OpponentMonSendOut(struct Sprite *sprite); -static void sub_80756D4(struct Sprite *sprite); -static void sub_80756E0(struct Sprite *sprite); -static void sub_807574C(struct Sprite *sprite); -static void sub_80757E4(struct Sprite *sprite); -static void sub_8075838(struct Sprite *sprite); -static void sub_8075930(struct Sprite *sprite); +static void SpriteCB_BallThrow(struct Sprite *sprite); +static void SpriteCB_BallThrow_ReachMon(struct Sprite *sprite); +static void SpriteCB_BallThrow_StartShrinkMon(struct Sprite *sprite); +static void SpriteCB_BallThrow_ShrinkMon(struct Sprite *sprite); +static void SpriteCB_BallThrow_Close(struct Sprite *sprite); +static void SpriteCB_BallThrow_FallToGround(struct Sprite *sprite); +static void SpriteCB_BallThrow_StartShakes(struct Sprite *sprite); +static void SpriteCB_BallThrow_Shake(struct Sprite *sprite); +static void SpriteCB_BallThrow_StartCaptureMon(struct Sprite *sprite); +static void SpriteCB_BallThrow_CaptureMon(struct Sprite *sprite); static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite); static void SpriteCB_ReleaseMon2FromBall(struct Sprite *sprite); -static void sub_8075970(struct Sprite *sprite); static void HandleBallAnimEnd(struct Sprite *sprite); -static void sub_8075FB4(struct Sprite *sprite); -static void sub_80760F8(struct Sprite *sprite); static void SpriteCB_PokeballReleaseMon(struct Sprite *sprite); static void SpriteCB_ReleasedMonFlyOut(struct Sprite *sprite); static void SpriteCB_TradePokeball(struct Sprite *sprite); @@ -213,7 +214,7 @@ const struct SpriteTemplate gBallSpriteTemplates[POKEBALL_COUNT] = .anims = sBallAnimSequences, .images = NULL, .affineAnims = sAffineAnim_BallRotate, - .callback = SpriteCB_TestBallThrow, + .callback = SpriteCB_BallThrow, }, { .tileTag = GFX_TAG_GREATBALL, @@ -222,7 +223,7 @@ const struct SpriteTemplate gBallSpriteTemplates[POKEBALL_COUNT] = .anims = sBallAnimSequences, .images = NULL, .affineAnims = sAffineAnim_BallRotate, - .callback = SpriteCB_TestBallThrow, + .callback = SpriteCB_BallThrow, }, { .tileTag = GFX_TAG_SAFARIBALL, @@ -231,7 +232,7 @@ const struct SpriteTemplate gBallSpriteTemplates[POKEBALL_COUNT] = .anims = sBallAnimSequences, .images = NULL, .affineAnims = sAffineAnim_BallRotate, - .callback = SpriteCB_TestBallThrow, + .callback = SpriteCB_BallThrow, }, { .tileTag = GFX_TAG_ULTRABALL, @@ -240,7 +241,7 @@ const struct SpriteTemplate gBallSpriteTemplates[POKEBALL_COUNT] = .anims = sBallAnimSequences, .images = NULL, .affineAnims = sAffineAnim_BallRotate, - .callback = SpriteCB_TestBallThrow, + .callback = SpriteCB_BallThrow, }, { .tileTag = GFX_TAG_MASTERBALL, @@ -249,7 +250,7 @@ const struct SpriteTemplate gBallSpriteTemplates[POKEBALL_COUNT] = .anims = sBallAnimSequences, .images = NULL, .affineAnims = sAffineAnim_BallRotate, - .callback = SpriteCB_TestBallThrow, + .callback = SpriteCB_BallThrow, }, { .tileTag = GFX_TAG_NETBALL, @@ -258,7 +259,7 @@ const struct SpriteTemplate gBallSpriteTemplates[POKEBALL_COUNT] = .anims = sBallAnimSequences, .images = NULL, .affineAnims = sAffineAnim_BallRotate, - .callback = SpriteCB_TestBallThrow, + .callback = SpriteCB_BallThrow, }, { .tileTag = GFX_TAG_DIVEBALL, @@ -267,7 +268,7 @@ const struct SpriteTemplate gBallSpriteTemplates[POKEBALL_COUNT] = .anims = sBallAnimSequences, .images = NULL, .affineAnims = sAffineAnim_BallRotate, - .callback = SpriteCB_TestBallThrow, + .callback = SpriteCB_BallThrow, }, { .tileTag = GFX_TAG_NESTBALL, @@ -276,7 +277,7 @@ const struct SpriteTemplate gBallSpriteTemplates[POKEBALL_COUNT] = .anims = sBallAnimSequences, .images = NULL, .affineAnims = sAffineAnim_BallRotate, - .callback = SpriteCB_TestBallThrow, + .callback = SpriteCB_BallThrow, }, { .tileTag = GFX_TAG_REPEATBALL, @@ -285,7 +286,7 @@ const struct SpriteTemplate gBallSpriteTemplates[POKEBALL_COUNT] = .anims = sBallAnimSequences, .images = NULL, .affineAnims = sAffineAnim_BallRotate, - .callback = SpriteCB_TestBallThrow, + .callback = SpriteCB_BallThrow, }, { .tileTag = GFX_TAG_TIMERBALL, @@ -294,7 +295,7 @@ const struct SpriteTemplate gBallSpriteTemplates[POKEBALL_COUNT] = .anims = sBallAnimSequences, .images = NULL, .affineAnims = sAffineAnim_BallRotate, - .callback = SpriteCB_TestBallThrow, + .callback = SpriteCB_BallThrow, }, { .tileTag = GFX_TAG_LUXURYBALL, @@ -303,7 +304,7 @@ const struct SpriteTemplate gBallSpriteTemplates[POKEBALL_COUNT] = .anims = sBallAnimSequences, .images = NULL, .affineAnims = sAffineAnim_BallRotate, - .callback = SpriteCB_TestBallThrow, + .callback = SpriteCB_BallThrow, }, { .tileTag = GFX_TAG_PREMIERBALL, @@ -312,7 +313,7 @@ const struct SpriteTemplate gBallSpriteTemplates[POKEBALL_COUNT] = .anims = sBallAnimSequences, .images = NULL, .affineAnims = sAffineAnim_BallRotate, - .callback = SpriteCB_TestBallThrow, + .callback = SpriteCB_BallThrow, }, }; @@ -408,7 +409,10 @@ static void Task_DoPokeballSendOutAnim(u8 taskId) PlaySE(SE_BALL_THROW); } -static void SpriteCB_TestBallThrow(struct Sprite *sprite) +// This sequence of functions is very similar to those that get run when +// a Pokéball gets thrown at a wild Pokémon, starting at SpriteCB_Ball_Arc. +// These do not seem to get run. +static void SpriteCB_BallThrow(struct Sprite *sprite) { if (TranslateAnimHorizontalArc(sprite)) { @@ -430,7 +434,7 @@ static void SpriteCB_TestBallThrow(struct Sprite *sprite) sprite->sBattler = opponentBattler; sprite->data[7] = noOfShakes; DestroyTask(taskId); - sprite->callback = sub_80756D4; + sprite->callback = SpriteCB_BallThrow_ReachMon; } } @@ -440,26 +444,24 @@ static void SpriteCB_TestBallThrow(struct Sprite *sprite) #undef tBattler #undef tOpponentBattler -static void sub_80756D4(struct Sprite *sprite) +static void SpriteCB_BallThrow_ReachMon(struct Sprite *sprite) { - sprite->callback = sub_80756E0; + sprite->callback = SpriteCB_BallThrow_StartShrinkMon; } -// Start something for battler -static void sub_80756E0(struct Sprite *sprite) +static void SpriteCB_BallThrow_StartShrinkMon(struct Sprite *sprite) { if (++sprite->data[5] == 10) { sprite->data[5] = 0; - sprite->callback = sub_807574C; - StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[sprite->sBattler]], 2); + sprite->callback = SpriteCB_BallThrow_ShrinkMon; + StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[sprite->sBattler]], BATTLER_AFFINE_RETURN); AnimateSprite(&gSprites[gBattlerSpriteIds[sprite->sBattler]]); gSprites[gBattlerSpriteIds[sprite->sBattler]].data[1] = 0; } } -// Shrink player -static void sub_807574C(struct Sprite *sprite) +static void SpriteCB_BallThrow_ShrinkMon(struct Sprite *sprite) { sprite->data[5]++; if (sprite->data[5] == 11) @@ -469,7 +471,7 @@ static void sub_807574C(struct Sprite *sprite) StartSpriteAnim(sprite, 2); gSprites[gBattlerSpriteIds[sprite->sBattler]].invisible = TRUE; sprite->data[5] = 0; - sprite->callback = sub_80757E4; + sprite->callback = SpriteCB_BallThrow_Close; } else { @@ -478,7 +480,7 @@ static void sub_807574C(struct Sprite *sprite) } } -static void sub_80757E4(struct Sprite *sprite) +static void SpriteCB_BallThrow_Close(struct Sprite *sprite) { if (sprite->animEnded) { @@ -490,12 +492,12 @@ static void sub_80757E4(struct Sprite *sprite) sprite->data[5] = 0; sprite->pos1.y += Cos(0, 32); sprite->pos2.y = -Cos(0, sprite->data[4]); - sprite->callback = sub_8075838; + sprite->callback = SpriteCB_BallThrow_FallToGround; } } } -static void sub_8075838(struct Sprite *sprite) +static void SpriteCB_BallThrow_FallToGround(struct Sprite *sprite) { bool8 r5 = FALSE; @@ -548,14 +550,14 @@ static void sub_8075838(struct Sprite *sprite) } else { - sprite->callback = sub_8075930; + sprite->callback = SpriteCB_BallThrow_StartShakes; sprite->data[4] = 1; sprite->data[5] = 0; } } } -static void sub_8075930(struct Sprite *sprite) +static void SpriteCB_BallThrow_StartShakes(struct Sprite *sprite) { sprite->data[3]++; if (sprite->data[3] == 31) @@ -563,12 +565,12 @@ static void sub_8075930(struct Sprite *sprite) sprite->data[3] = 0; sprite->affineAnimPaused = TRUE; StartSpriteAffineAnim(sprite, 1); - sprite->callback = sub_8075970; + sprite->callback = SpriteCB_BallThrow_Shake; PlaySE(SE_BALL); } } -static void sub_8075970(struct Sprite *sprite) +static void SpriteCB_BallThrow_Shake(struct Sprite *sprite) { switch (sprite->data[3] & 0xFF) { @@ -611,7 +613,7 @@ static void sub_8075970(struct Sprite *sprite) { if (sprite->data[7] == 4 && sprite->data[3] >> 8 == 3) { - sprite->callback = sub_8075FB4; + sprite->callback = SpriteCB_BallThrow_StartCaptureMon; sprite->affineAnimPaused = TRUE; } else @@ -796,7 +798,7 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) gTasks[taskId].tCryTaskState = 0; } - StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[sprite->sBattler]], 1); + StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[sprite->sBattler]], BATTLER_AFFINE_EMERGE); if (GetBattlerSide(sprite->sBattler) == B_SIDE_OPPONENT) gSprites[gBattlerSpriteIds[sprite->sBattler]].callback = SpriteCb_OpponentMonFromBall; @@ -817,10 +819,10 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) #undef tCryTaskFrames #undef tCryTaskState -static void sub_8075FB4(struct Sprite *sprite) +static void SpriteCB_BallThrow_StartCaptureMon(struct Sprite *sprite) { sprite->animPaused = TRUE; - sprite->callback = sub_80760F8; + sprite->callback = SpriteCB_BallThrow_CaptureMon; sprite->data[3] = 0; sprite->data[4] = 0; sprite->data[5] = 0; @@ -836,7 +838,7 @@ static void HandleBallAnimEnd(struct Sprite *sprite) sprite->invisible = TRUE; if (gSprites[gBattlerSpriteIds[battlerId]].affineAnimEnded) { - StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[battlerId]], 0); + StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[battlerId]], BATTLER_AFFINE_NORMAL); affineAnimEnded = TRUE; } else @@ -867,7 +869,7 @@ static void HandleBallAnimEnd(struct Sprite *sprite) } } -static void sub_80760F8(struct Sprite *sprite) +static void SpriteCB_BallThrow_CaptureMon(struct Sprite *sprite) { u8 battlerId = sprite->sBattler; @@ -1042,7 +1044,7 @@ static void SpriteCB_PokeballReleaseMon(struct Sprite *sprite) sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, battlerId, r4); sprite->callback = SpriteCB_ReleasedMonFlyOut; gSprites[r7].invisible = FALSE; - StartSpriteAffineAnim(&gSprites[r7], 1); + StartSpriteAffineAnim(&gSprites[r7], BATTLER_AFFINE_EMERGE); AnimateSprite(&gSprites[r7]); gSprites[r7].data[1] = 0x1000; sprite->data[7] = 0; @@ -1065,7 +1067,7 @@ static void SpriteCB_ReleasedMonFlyOut(struct Sprite *sprite) sprite->invisible = TRUE; if (gSprites[monSpriteId].affineAnimEnded) { - StartSpriteAffineAnim(&gSprites[monSpriteId], 0); + StartSpriteAffineAnim(&gSprites[monSpriteId], BATTLER_AFFINE_NORMAL); r12 = TRUE; } var1 = (sprite->data[5] - sprite->pos1.x) * sprite->data[7] / 128 + sprite->pos1.x; @@ -1139,7 +1141,7 @@ static void SpriteCB_TradePokeball(struct Sprite *sprite) // play the shrink anim properly due to being paused. Works together with the fix to `sub_817F77C`. gSprites[monSpriteId].affineAnimPaused = FALSE; #endif // BUGFIX - StartSpriteAffineAnim(&gSprites[monSpriteId], 2); + StartSpriteAffineAnim(&gSprites[monSpriteId], BATTLER_AFFINE_RETURN); AnimateSprite(&gSprites[monSpriteId]); gSprites[monSpriteId].data[1] = 0; } diff --git a/src/pokemon.c b/src/pokemon.c index 1d736be74..b4eb6f01a 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -3433,7 +3433,7 @@ void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition) gMultiuseSpriteTemplate.paletteTag = speciesTag; if (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_PLAYER_RIGHT) - gMultiuseSpriteTemplate.anims = gUnknown_082FF70C; + gMultiuseSpriteTemplate.anims = gAnims_MonPic; else if (speciesTag > SPECIES_SHINY_TAG) gMultiuseSpriteTemplate.anims = gMonFrontAnimsPtrTable[speciesTag - SPECIES_SHINY_TAG]; else @@ -6826,7 +6826,7 @@ static void sub_806F1FC(struct Unknown_806F160_Struct* structPtr) structPtr->frameImages[i * structPtr->field_0_0 + j].data = &structPtr->byteArrays[i][j * 0x800]; } structPtr->templates[i].images = &structPtr->frameImages[i * structPtr->field_0_0]; - structPtr->templates[i].anims = gUnknown_082FF70C; + structPtr->templates[i].anims = gAnims_MonPic; structPtr->templates[i].paletteTag = i; } } diff --git a/src/trainer_pokemon_sprites.c b/src/trainer_pokemon_sprites.c index aab4142db..477c11faf 100644 --- a/src/trainer_pokemon_sprites.c +++ b/src/trainer_pokemon_sprites.c @@ -137,7 +137,7 @@ static void LoadPicPaletteBySlot(u16 species, u32 otId, u32 personality, u8 pale static void AssignSpriteAnimsTable(bool8 isTrainer) { if (!isTrainer) - sCreatingSpriteTemplate.anims = gUnknown_082FF70C; + sCreatingSpriteTemplate.anims = gAnims_MonPic; else sCreatingSpriteTemplate.anims = gTrainerFrontAnimsPtrTable[0]; }