diff --git a/asm/crt0.s b/asm/crt0.s index d99ce9deb..9ed678968 100644 --- a/asm/crt0.s +++ b/asm/crt0.s @@ -68,8 +68,8 @@ GPIOPortReadEnable: @ 80000C8 .4byte gAbilityDescriptionPointers .4byte gItems .4byte gBattleMoves - .4byte sBallSpriteSheets - .4byte sBallSpritePalettes + .4byte gBallSpriteSheets + .4byte gBallSpritePalettes .4byte 0x000000a8, 0x00000864, 0x0000089b diff --git a/data/graphics.s b/data/graphics.s index 05e804578..06c4b9e18 100644 --- a/data/graphics.s +++ b/data/graphics.s @@ -16,10 +16,106 @@ gUnknown_08C00524:: @ 8C00524 .incbin "baserom.gba", 0xc00c10, 0xa34 gUnknown_08C01644:: @ 8C01644 - .incbin "baserom.gba", 0xc01644, 0xE0 + .incbin "baserom.gba", 0xc01644, 0xe0 gUnknown_08C01724:: @ 8C01724 - .incbin "baserom.gba", 0xc01724, 0xBDC + .incbin "baserom.gba", 0xc01724, 0x18 + + .align 2 +gInterfaceGfx_PokeBall:: + .incbin "graphics/interface/ball/poke.4bpp.lz" @ 0xBC + + .align 2 +gInterfacePal_PokeBall:: + .incbin "graphics/interface/ball/poke.gbapal.lz" + + .align 2 +gInterfaceGfx_GreatBall:: + .incbin "graphics/interface/ball/great.4bpp.lz" @ 0xBC + + .align 2 +gInterfacePal_GreatBall:: + .incbin "graphics/interface/ball/great.gbapal.lz" + + .align 2 +gInterfaceGfx_SafariBall:: + .incbin "graphics/interface/ball/safari.4bpp.lz" @ 0xBC + + .align 2 +gInterfacePal_SafariBall:: + .incbin "graphics/interface/ball/safari.gbapal.lz" + + .align 2 +gInterfaceGfx_UltraBall:: + .incbin "baserom.gba", 0xC019E0, 0xB4 + + .align 2 +gInterfacePal_UltraBall:: + .incbin "baserom.gba", 0xC01A94, 0x20 + + .align 2 +gInterfaceGfx_MasterBall:: + .incbin "graphics/interface/ball/master.4bpp.lz" @ 0xBC + + .align 2 +gInterfacePal_MasterBall:: + .incbin "graphics/interface/ball/master.gbapal.lz" + + .align 2 +gInterfaceGfx_NetBall:: + .incbin "graphics/interface/ball/net.4bpp.lz" @ 0xBC + + .align 2 +gInterfacePal_NetBall:: + .incbin "graphics/interface/ball/net.gbapal.lz" + + .align 2 +gInterfaceGfx_DiveBall:: + .incbin "graphics/interface/ball/dive.4bpp.lz" @ 0xBC + + .align 2 +gInterfacePal_DiveBall:: + .incbin "graphics/interface/ball/dive.gbapal.lz" + + .align 2 +gInterfaceGfx_NestBall:: + .incbin "graphics/interface/ball/nest.4bpp.lz" @ 0xBC + + .align 2 +gInterfacePal_NestBall:: + .incbin "graphics/interface/ball/nest.gbapal.lz" + + .align 2 +gInterfaceGfx_RepeatBall:: + .incbin "graphics/interface/ball/repeat.4bpp.lz" @ 0xBC + + .align 2 +gInterfacePal_RepeatBall:: + .incbin "graphics/interface/ball/repeat.gbapal.lz" + + .align 2 +gInterfaceGfx_TimerBall:: + .incbin "graphics/interface/ball/timer.4bpp.lz" @ 0xBC + + .align 2 +gInterfacePal_TimerBall:: + .incbin "graphics/interface/ball/timer.gbapal.lz" + + .align 2 +gInterfaceGfx_LuxuryBall:: + .incbin "graphics/interface/ball/luxury.4bpp.lz" @ 0xBC + + .align 2 +gInterfacePal_LuxuryBall:: + .incbin "graphics/interface/ball/luxury.gbapal.lz" + + .align 2 +gInterfaceGfx_PremierBall:: + .incbin "graphics/interface/ball/premier.4bpp.lz" @ 0xBC + + .align 2 +gInterfacePal_PremierBall:: + .incbin "graphics/interface/ball/premier.gbapal.lz" gOpenPokeballGfx:: @ 8C02300 .incbin "baserom.gba", 0xc02300, 0x7c diff --git a/data/pokeball.s b/data/pokeball.s deleted file mode 100644 index 16c77a362..000000000 --- a/data/pokeball.s +++ /dev/null @@ -1,14 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2, 0 - -sBallSpriteSheets:: @ 832C400 - .incbin "baserom.gba", 0x32c400, 0x60 - -sBallSpritePalettes:: @ 832C460 - .incbin "baserom.gba", 0x32c460, 0x128 - -gBallSpriteTemplates:: @ 832C588 - .incbin "baserom.gba", 0x32c588, 0x138 diff --git a/data/trade.s b/data/trade.s index 3150269b0..b392fbc24 100644 --- a/data/trade.s +++ b/data/trade.s @@ -3,6 +3,9 @@ .section .rodata .align 2, 0 + +gUnknown_0832C6A8:: @ 832C6A8 + .incbin "baserom.gba", 0x32C6A8, 0x18 gUnknown_0832C6C0:: @ 832C6C0 .incbin "baserom.gba", 0x32c6c0, 0x1fe diff --git a/graphics/interface/ball/dive.pal b/graphics/interface/ball/dive.pal new file mode 100644 index 000000000..1bd07d69d --- /dev/null +++ b/graphics/interface/ball/dive.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +255 255 255 +90 139 222 +115 164 230 +148 197 238 +180 230 255 +255 255 255 +148 148 148 +65 65 65 +24 24 24 +0 90 156 +24 106 172 +57 123 197 +255 255 255 +255 255 255 +255 255 255 +255 255 255 diff --git a/graphics/interface/ball/dive.png b/graphics/interface/ball/dive.png new file mode 100644 index 000000000..5be9b1ed6 Binary files /dev/null and b/graphics/interface/ball/dive.png differ diff --git a/graphics/interface/ball/great.pal b/graphics/interface/ball/great.pal new file mode 100644 index 000000000..f19aa5e4a --- /dev/null +++ b/graphics/interface/ball/great.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +255 255 255 +98 139 180 +123 156 222 +148 180 222 +180 205 230 +255 255 255 +148 148 148 +65 65 65 +24 24 24 +189 41 90 +222 65 115 +255 98 139 +255 255 255 +255 255 255 +255 255 255 +255 255 255 diff --git a/graphics/interface/ball/great.png b/graphics/interface/ball/great.png new file mode 100644 index 000000000..0c054d7d3 Binary files /dev/null and b/graphics/interface/ball/great.png differ diff --git a/graphics/interface/ball/luxury.pal b/graphics/interface/ball/luxury.pal new file mode 100644 index 000000000..a49399d01 --- /dev/null +++ b/graphics/interface/ball/luxury.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +255 255 255 +49 49 41 +90 90 82 +131 131 123 +180 172 164 +255 255 255 +148 148 148 +65 65 65 +24 24 24 +255 255 156 +255 222 106 +255 189 57 +255 156 8 +230 74 24 +180 74 24 +255 255 255 diff --git a/graphics/interface/ball/luxury.png b/graphics/interface/ball/luxury.png new file mode 100644 index 000000000..8056416b2 Binary files /dev/null and b/graphics/interface/ball/luxury.png differ diff --git a/graphics/interface/ball/master.pal b/graphics/interface/ball/master.pal new file mode 100644 index 000000000..72247849b --- /dev/null +++ b/graphics/interface/ball/master.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +255 255 255 +115 16 156 +139 41 172 +164 65 189 +189 90 205 +255 255 255 +148 148 148 +65 65 65 +24 24 24 +255 98 139 +255 148 172 +255 197 213 +255 255 255 +255 255 255 +255 255 255 +255 255 255 diff --git a/graphics/interface/ball/master.png b/graphics/interface/ball/master.png new file mode 100644 index 000000000..9787a8896 Binary files /dev/null and b/graphics/interface/ball/master.png differ diff --git a/graphics/interface/ball/nest.pal b/graphics/interface/ball/nest.pal new file mode 100644 index 000000000..4bee9fa12 --- /dev/null +++ b/graphics/interface/ball/nest.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +255 255 255 +0 98 0 +49 148 16 +98 197 32 +156 255 57 +255 255 255 +148 148 148 +65 65 65 +24 24 24 +255 123 98 +255 172 131 +255 222 172 +255 255 255 +255 255 255 +255 255 255 +255 255 255 diff --git a/graphics/interface/ball/nest.png b/graphics/interface/ball/nest.png new file mode 100644 index 000000000..a2fa81c1e Binary files /dev/null and b/graphics/interface/ball/nest.png differ diff --git a/graphics/interface/ball/net.pal b/graphics/interface/ball/net.pal new file mode 100644 index 000000000..dc5abb94d --- /dev/null +++ b/graphics/interface/ball/net.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +255 255 255 +0 156 106 +49 189 123 +98 222 148 +156 255 172 +255 255 255 +148 148 148 +65 65 65 +24 24 24 +205 205 255 +255 255 255 +255 255 255 +255 255 255 +255 255 255 +255 255 255 +255 255 255 diff --git a/graphics/interface/ball/net.png b/graphics/interface/ball/net.png new file mode 100644 index 000000000..6fef48101 Binary files /dev/null and b/graphics/interface/ball/net.png differ diff --git a/graphics/interface/ball/poke.pal b/graphics/interface/ball/poke.pal new file mode 100644 index 000000000..0e6b2fb5c --- /dev/null +++ b/graphics/interface/ball/poke.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +255 255 255 +131 0 0 +172 0 0 +213 41 41 +255 156 123 +255 255 255 +148 148 148 +65 65 65 +24 24 24 +255 255 255 +255 255 255 +255 255 255 +255 255 255 +255 255 255 +255 255 255 +255 255 255 diff --git a/graphics/interface/ball/poke.png b/graphics/interface/ball/poke.png new file mode 100644 index 000000000..1e4aba669 Binary files /dev/null and b/graphics/interface/ball/poke.png differ diff --git a/graphics/interface/ball/premier.pal b/graphics/interface/ball/premier.pal new file mode 100644 index 000000000..0e6b2fb5c --- /dev/null +++ b/graphics/interface/ball/premier.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +255 255 255 +131 0 0 +172 0 0 +213 41 41 +255 156 123 +255 255 255 +148 148 148 +65 65 65 +24 24 24 +255 255 255 +255 255 255 +255 255 255 +255 255 255 +255 255 255 +255 255 255 +255 255 255 diff --git a/graphics/interface/ball/premier.png b/graphics/interface/ball/premier.png new file mode 100644 index 000000000..f5aaadbaf Binary files /dev/null and b/graphics/interface/ball/premier.png differ diff --git a/graphics/interface/ball/repeat.pal b/graphics/interface/ball/repeat.pal new file mode 100644 index 000000000..c3689e13f --- /dev/null +++ b/graphics/interface/ball/repeat.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +255 255 255 +222 98 0 +230 131 32 +238 164 65 +255 197 98 +255 255 255 +148 148 148 +65 65 65 +24 24 24 +205 156 8 +255 255 8 +255 255 255 +255 255 255 +255 255 255 +255 255 255 +255 255 255 diff --git a/graphics/interface/ball/repeat.png b/graphics/interface/ball/repeat.png new file mode 100644 index 000000000..5abe789a2 Binary files /dev/null and b/graphics/interface/ball/repeat.png differ diff --git a/graphics/interface/ball/safari.pal b/graphics/interface/ball/safari.pal new file mode 100644 index 000000000..bbe4d76f3 --- /dev/null +++ b/graphics/interface/ball/safari.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +255 255 255 +148 172 16 +164 197 32 +180 222 49 +197 246 65 +255 255 255 +148 148 148 +65 65 65 +24 24 24 +205 106 41 +230 164 98 +255 222 156 +255 255 255 +255 255 255 +255 255 255 +255 255 255 diff --git a/graphics/interface/ball/safari.png b/graphics/interface/ball/safari.png new file mode 100644 index 000000000..0dd49aef9 Binary files /dev/null and b/graphics/interface/ball/safari.png differ diff --git a/graphics/interface/ball/timer.pal b/graphics/interface/ball/timer.pal new file mode 100644 index 000000000..e0c23569e --- /dev/null +++ b/graphics/interface/ball/timer.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +255 255 255 +172 0 0 +197 49 41 +222 98 82 +255 156 123 +255 255 255 +148 148 148 +65 65 65 +24 24 24 +180 180 180 +255 255 255 +255 255 255 +255 255 255 +255 255 255 +255 255 255 +0 0 0 diff --git a/graphics/interface/ball/timer.png b/graphics/interface/ball/timer.png new file mode 100644 index 000000000..2b63f6795 Binary files /dev/null and b/graphics/interface/ball/timer.png differ diff --git a/include/graphics.h b/include/graphics.h index 4c5a0952b..4a522a429 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -5,6 +5,32 @@ #ifndef GUARD_GRAPHICS_H #define GUARD_GRAPHICS_H +extern const u8 gInterfaceGfx_PokeBall[]; +extern const u8 gInterfacePal_PokeBall[]; +extern const u8 gInterfaceGfx_GreatBall[]; +extern const u8 gInterfacePal_GreatBall[]; +extern const u8 gInterfaceGfx_SafariBall[]; +extern const u8 gInterfacePal_SafariBall[]; +extern const u8 gInterfaceGfx_UltraBall[]; +extern const u8 gInterfacePal_UltraBall[]; +extern const u8 gInterfaceGfx_MasterBall[]; +extern const u8 gInterfacePal_MasterBall[]; +extern const u8 gInterfaceGfx_NetBall[]; +extern const u8 gInterfacePal_NetBall[]; +extern const u8 gInterfaceGfx_DiveBall[]; +extern const u8 gInterfacePal_DiveBall[]; +extern const u8 gInterfaceGfx_NestBall[]; +extern const u8 gInterfacePal_NestBall[]; +extern const u8 gInterfaceGfx_RepeatBall[]; +extern const u8 gInterfacePal_RepeatBall[]; +extern const u8 gInterfaceGfx_TimerBall[]; +extern const u8 gInterfacePal_TimerBall[]; +extern const u8 gInterfaceGfx_LuxuryBall[]; +extern const u8 gInterfacePal_LuxuryBall[]; +extern const u8 gInterfaceGfx_PremierBall[]; +extern const u8 gInterfacePal_PremierBall[]; +extern const u8 gOpenPokeballGfx[]; + extern const u8 gItemIcon_QuestionMark[]; extern const u8 gItemIconPalette_QuestionMark[]; extern const u8 gUnknown_08DB7AA0[]; diff --git a/include/pokeball.h b/include/pokeball.h index 57e305ffd..84178b5b2 100644 --- a/include/pokeball.h +++ b/include/pokeball.h @@ -22,9 +22,11 @@ enum #define POKEBALL_OPPONENT_SENDOUT 0xFE u8 DoPokeballSendOutAnimation(s16 pan, u8 kindOfThrow); -void LoadBallGfx(u8 ballId); -void FreeBallGfx(u8 ballId); +void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 bank, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 g, u32 h, u16 species); +u8 sub_807671C(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 g, u32 h); void sub_8076918(u8 bank); void DoHitAnimHealthboxEffect(u8 bank); +void LoadBallGfx(u8 ballId); +void FreeBallGfx(u8 ballId); #endif // GUARD_POKEBALL_H diff --git a/ld_script.txt b/ld_script.txt index 019a44ebe..cbbb28f7d 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -345,7 +345,7 @@ SECTIONS { src/egg_hatch.o(.rodata); src/battle_gfx_sfx_util.o(.rodata); src/battle_interface.o(.rodata); - data/pokeball.o(.rodata); + src/pokeball.o(.rodata); data/trade.o(.rodata); src/berry_blender.o(.rodata); src/new_game.o(.rodata); diff --git a/src/pokeball.c b/src/pokeball.c index a9172b7cf..728145791 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -13,6 +13,7 @@ #include "decompress.h" #include "species.h" #include "util.h" +#include "graphics.h" extern bool8 gDoingBattleAnim; extern u8 gActiveBank; @@ -22,38 +23,305 @@ extern u8 gBankSpriteIds[]; extern u8 gHealthBoxesIds[]; extern struct MusicPlayerInfo gMPlay_BGM; -extern const u32 gOpenPokeballGfx[]; - // this file's functions -void Task_DoPokeballSendOutAnim(u8 taskId); -void SpriteCB_PlayerMonSendOut_1(struct Sprite *sprite); -void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite); -void SpriteCB_OpponentMonSendOut(struct Sprite *sprite); -void sub_80756D4(struct Sprite *sprite); -void sub_80756E0(struct Sprite *sprite); -void sub_807574C(struct Sprite *sprite); -void sub_80757E4(struct Sprite *sprite); -void sub_8075838(struct Sprite *sprite); -void sub_8075930(struct Sprite *sprite); -void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite); -void SpriteCB_ReleaseMon2FromBall(struct Sprite *sprite); -void sub_8075970(struct Sprite *sprite); -void HandleBallAnimEnd(struct Sprite *sprite); -void sub_8075FB4(struct Sprite *sprite); -void sub_80760F8(struct Sprite *sprite); -void sub_8076524(struct Sprite *sprite); -void sub_80765E0(struct Sprite *sprite); -void sub_80767D4(struct Sprite *sprite); -void sub_807687C(struct Sprite *sprite); -void sub_80768F0(struct Sprite *sprite); -void sub_80769A8(struct Sprite *sprite); -void sub_80769CC(struct Sprite *sprite); -void SpriteCB_HitAnimHealthoxEffect(struct Sprite *sprite); -u16 GetBankPokeballItemId(u8 bank); +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_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 sub_8076524(struct Sprite *sprite); +static void sub_80765E0(struct Sprite *sprite); +static void sub_80767D4(struct Sprite *sprite); +static void sub_807687C(struct Sprite *sprite); +static void sub_80768F0(struct Sprite *sprite); +static void sub_80769A8(struct Sprite *sprite); +static void sub_80769CC(struct Sprite *sprite); +static void SpriteCB_HitAnimHealthoxEffect(struct Sprite *sprite); +static u16 GetBankPokeballItemId(u8 bank); -extern const struct CompressedSpriteSheet sBallSpriteSheets[]; -extern const struct CompressedSpritePalette sBallSpritePalettes[]; -extern const struct SpriteTemplate gBallSpriteTemplates[]; +// rom const data + +#define GFX_TAG_POKEBALL 55000 +#define GFX_TAG_GREATBALL 55001 +#define GFX_TAG_SAFARIBALL 55002 +#define GFX_TAG_ULTRABALL 55003 +#define GFX_TAG_MASTERBALL 55004 +#define GFX_TAG_NETBALL 55005 +#define GFX_TAG_DIVEBALL 55006 +#define GFX_TAG_NESTBALL 55007 +#define GFX_TAG_REPEATBALL 55008 +#define GFX_TAG_TIMERBALL 55009 +#define GFX_TAG_LUXURYBALL 55010 +#define GFX_TAG_PREMIERBALL 55011 + +const struct CompressedSpriteSheet gBallSpriteSheets[POKEBALL_COUNT] = +{ + {gInterfaceGfx_PokeBall, 384, GFX_TAG_POKEBALL}, + {gInterfaceGfx_GreatBall, 384, GFX_TAG_GREATBALL}, + {gInterfaceGfx_SafariBall, 384, GFX_TAG_SAFARIBALL}, + {gInterfaceGfx_UltraBall, 384, GFX_TAG_ULTRABALL}, + {gInterfaceGfx_MasterBall, 384, GFX_TAG_MASTERBALL}, + {gInterfaceGfx_NetBall, 384, GFX_TAG_NETBALL}, + {gInterfaceGfx_DiveBall, 384, GFX_TAG_DIVEBALL}, + {gInterfaceGfx_NestBall, 384, GFX_TAG_NESTBALL}, + {gInterfaceGfx_RepeatBall, 384, GFX_TAG_REPEATBALL}, + {gInterfaceGfx_TimerBall, 384, GFX_TAG_TIMERBALL}, + {gInterfaceGfx_LuxuryBall, 384, GFX_TAG_LUXURYBALL}, + {gInterfaceGfx_PremierBall, 384, GFX_TAG_PREMIERBALL}, +}; + +const struct CompressedSpritePalette gBallSpritePalettes[POKEBALL_COUNT] = +{ + {gInterfacePal_PokeBall, GFX_TAG_POKEBALL}, + {gInterfacePal_GreatBall, GFX_TAG_GREATBALL}, + {gInterfacePal_SafariBall, GFX_TAG_SAFARIBALL}, + {gInterfacePal_UltraBall, GFX_TAG_ULTRABALL}, + {gInterfacePal_MasterBall, GFX_TAG_MASTERBALL}, + {gInterfacePal_NetBall, GFX_TAG_NETBALL}, + {gInterfacePal_DiveBall, GFX_TAG_DIVEBALL}, + {gInterfacePal_NestBall, GFX_TAG_NESTBALL}, + {gInterfacePal_RepeatBall, GFX_TAG_REPEATBALL}, + {gInterfacePal_TimerBall, GFX_TAG_TIMERBALL}, + {gInterfacePal_LuxuryBall, GFX_TAG_LUXURYBALL}, + {gInterfacePal_PremierBall, GFX_TAG_PREMIERBALL}, +}; + +static const struct OamData sBallOamData = +{ + .y = 0, + .affineMode = 3, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 1, + .tileNum = 0, + .priority = 2, + .paletteNum = 0, + .affineParam = 0, +}; + +static const union AnimCmd sBallAnimSeq3[] = +{ + ANIMCMD_FRAME(0, 5), + ANIMCMD_JUMP(0), +}; + +static const union AnimCmd sBallAnimSeq5[] = +{ + ANIMCMD_FRAME(4, 1), + ANIMCMD_JUMP(0), +}; + +static const union AnimCmd sBallAnimSeq4[] = +{ + ANIMCMD_FRAME(8, 5), + ANIMCMD_JUMP(0), +}; + +static const union AnimCmd sBallAnimSeq6[] = +{ + ANIMCMD_FRAME(12, 1), + ANIMCMD_JUMP(0), +}; + +static const union AnimCmd sBallAnimSeq0[] = +{ + ANIMCMD_FRAME(0, 1), + ANIMCMD_END, +}; + +static const union AnimCmd sBallAnimSeq1[] = +{ + ANIMCMD_FRAME(4, 5), + ANIMCMD_FRAME(8, 5), + ANIMCMD_END, +}; + +static const union AnimCmd sBallAnimSeq2[] = +{ + ANIMCMD_FRAME(4, 5), + ANIMCMD_FRAME(0, 5), + ANIMCMD_END, +}; + +static const union AnimCmd *const sBallAnimSequences[] = +{ + sBallAnimSeq0, + sBallAnimSeq1, + sBallAnimSeq2, + + // unused? + sBallAnimSeq3, + sBallAnimSeq4, + sBallAnimSeq5, + sBallAnimSeq6, +}; + +static const union AffineAnimCmd sBallAffineAnimSeq0[] = +{ + AFFINEANIMCMD_FRAME(0, 0, 0, 1), + AFFINEANIMCMD_JUMP(0), +}; + +static const union AffineAnimCmd sBallAffineAnimSeq1[] = +{ + AFFINEANIMCMD_FRAME(0, 0, -3, 1), + AFFINEANIMCMD_JUMP(0), +}; + +static const union AffineAnimCmd sBallAffineAnimSeq2[] = +{ + AFFINEANIMCMD_FRAME(0, 0, 3, 1), + AFFINEANIMCMD_JUMP(0), +}; + +static const union AffineAnimCmd sBallAffineAnimSeq3[] = +{ + AFFINEANIMCMD_FRAME(256, 256, 0, 0), + AFFINEANIMCMD_END, +}; + +static const union AffineAnimCmd sBallAffineAnimSeq4[] = +{ + AFFINEANIMCMD_FRAME(0, 0, 25, 1), + AFFINEANIMCMD_JUMP(0), +}; + +static const union AffineAnimCmd *const sBallAffineAnimSequences[] = +{ + sBallAffineAnimSeq0, + sBallAffineAnimSeq1, + sBallAffineAnimSeq2, + sBallAffineAnimSeq3, + sBallAffineAnimSeq4, +}; + +const struct SpriteTemplate gBallSpriteTemplates[POKEBALL_COUNT] = +{ + { + .tileTag = GFX_TAG_POKEBALL, + .paletteTag = GFX_TAG_POKEBALL, + .oam = &sBallOamData, + .anims = sBallAnimSequences, + .images = NULL, + .affineAnims = sBallAffineAnimSequences, + .callback = SpriteCB_TestBallThrow, + }, + { + .tileTag = GFX_TAG_GREATBALL, + .paletteTag = GFX_TAG_GREATBALL, + .oam = &sBallOamData, + .anims = sBallAnimSequences, + .images = NULL, + .affineAnims = sBallAffineAnimSequences, + .callback = SpriteCB_TestBallThrow, + }, + { + .tileTag = GFX_TAG_SAFARIBALL, + .paletteTag = GFX_TAG_SAFARIBALL, + .oam = &sBallOamData, + .anims = sBallAnimSequences, + .images = NULL, + .affineAnims = sBallAffineAnimSequences, + .callback = SpriteCB_TestBallThrow, + }, + { + .tileTag = GFX_TAG_ULTRABALL, + .paletteTag = GFX_TAG_ULTRABALL, + .oam = &sBallOamData, + .anims = sBallAnimSequences, + .images = NULL, + .affineAnims = sBallAffineAnimSequences, + .callback = SpriteCB_TestBallThrow, + }, + { + .tileTag = GFX_TAG_MASTERBALL, + .paletteTag = GFX_TAG_MASTERBALL, + .oam = &sBallOamData, + .anims = sBallAnimSequences, + .images = NULL, + .affineAnims = sBallAffineAnimSequences, + .callback = SpriteCB_TestBallThrow, + }, + { + .tileTag = GFX_TAG_NETBALL, + .paletteTag = GFX_TAG_NETBALL, + .oam = &sBallOamData, + .anims = sBallAnimSequences, + .images = NULL, + .affineAnims = sBallAffineAnimSequences, + .callback = SpriteCB_TestBallThrow, + }, + { + .tileTag = GFX_TAG_DIVEBALL, + .paletteTag = GFX_TAG_DIVEBALL, + .oam = &sBallOamData, + .anims = sBallAnimSequences, + .images = NULL, + .affineAnims = sBallAffineAnimSequences, + .callback = SpriteCB_TestBallThrow, + }, + { + .tileTag = GFX_TAG_NESTBALL, + .paletteTag = GFX_TAG_NESTBALL, + .oam = &sBallOamData, + .anims = sBallAnimSequences, + .images = NULL, + .affineAnims = sBallAffineAnimSequences, + .callback = SpriteCB_TestBallThrow, + }, + { + .tileTag = GFX_TAG_REPEATBALL, + .paletteTag = GFX_TAG_REPEATBALL, + .oam = &sBallOamData, + .anims = sBallAnimSequences, + .images = NULL, + .affineAnims = sBallAffineAnimSequences, + .callback = SpriteCB_TestBallThrow, + }, + { + .tileTag = GFX_TAG_TIMERBALL, + .paletteTag = GFX_TAG_TIMERBALL, + .oam = &sBallOamData, + .anims = sBallAnimSequences, + .images = NULL, + .affineAnims = sBallAffineAnimSequences, + .callback = SpriteCB_TestBallThrow, + }, + { + .tileTag = GFX_TAG_LUXURYBALL, + .paletteTag = GFX_TAG_LUXURYBALL, + .oam = &sBallOamData, + .anims = sBallAnimSequences, + .images = NULL, + .affineAnims = sBallAffineAnimSequences, + .callback = SpriteCB_TestBallThrow, + }, + { + .tileTag = GFX_TAG_PREMIERBALL, + .paletteTag = GFX_TAG_PREMIERBALL, + .oam = &sBallOamData, + .anims = sBallAnimSequences, + .images = NULL, + .affineAnims = sBallAffineAnimSequences, + .callback = SpriteCB_TestBallThrow, + }, +}; #define tFrames data[0] #define tPan data[1] @@ -78,7 +346,7 @@ u8 DoPokeballSendOutAnimation(s16 pan, u8 kindOfThrow) #define sBank data[6] -void Task_DoPokeballSendOutAnim(u8 taskId) +static void Task_DoPokeballSendOutAnim(u8 taskId) { u16 throwCaseId; u8 bank; @@ -147,7 +415,7 @@ void Task_DoPokeballSendOutAnim(u8 taskId) PlaySE(SE_NAGERU); } -void SpriteCB_TestBallThrow(struct Sprite *sprite) +static void SpriteCB_TestBallThrow(struct Sprite *sprite) { if (AnimateBallThrow(sprite)) { @@ -179,12 +447,12 @@ void SpriteCB_TestBallThrow(struct Sprite *sprite) #undef tBank #undef tOpponentBank -void sub_80756D4(struct Sprite *sprite) +static void sub_80756D4(struct Sprite *sprite) { sprite->callback = sub_80756E0; } -void sub_80756E0(struct Sprite *sprite) +static void sub_80756E0(struct Sprite *sprite) { if (++sprite->data[5] == 10) { @@ -196,7 +464,7 @@ void sub_80756E0(struct Sprite *sprite) } } -void sub_807574C(struct Sprite *sprite) +static void sub_807574C(struct Sprite *sprite) { sprite->data[5]++; if (sprite->data[5] == 11) @@ -215,7 +483,7 @@ void sub_807574C(struct Sprite *sprite) } } -void sub_80757E4(struct Sprite *sprite) +static void sub_80757E4(struct Sprite *sprite) { if (sprite->animEnded) { @@ -232,7 +500,7 @@ void sub_80757E4(struct Sprite *sprite) } } -void sub_8075838(struct Sprite *sprite) +static void sub_8075838(struct Sprite *sprite) { bool8 r5 = FALSE; @@ -292,7 +560,7 @@ void sub_8075838(struct Sprite *sprite) } } -void sub_8075930(struct Sprite *sprite) +static void sub_8075930(struct Sprite *sprite) { sprite->data[3]++; if (sprite->data[3] == 31) @@ -305,7 +573,7 @@ void sub_8075930(struct Sprite *sprite) } } -void sub_8075970(struct Sprite *sprite) +static void sub_8075970(struct Sprite *sprite) { switch (sprite->data[3] & 0xFF) { @@ -386,7 +654,7 @@ void sub_8075970(struct Sprite *sprite) #define tCryTaskFrames data[10] #define tCryTaskState data[15] -void Task_PlayCryWhenReleasedFromBall(u8 taskId) +static void Task_PlayCryWhenReleasedFromBall(u8 taskId) { u8 wantedCry = gTasks[taskId].tCryTaskWantedCry; s8 pan = gTasks[taskId].tCryTaskPan; @@ -468,7 +736,7 @@ void Task_PlayCryWhenReleasedFromBall(u8 taskId) } } -void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) +static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) { u8 bank = sprite->sBank; u32 ballId; @@ -554,7 +822,7 @@ void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) #undef tCryTaskFrames #undef tCryTaskState -void sub_8075FB4(struct Sprite *sprite) +static void sub_8075FB4(struct Sprite *sprite) { sprite->animPaused = TRUE; sprite->callback = sub_80760F8; @@ -563,7 +831,7 @@ void sub_8075FB4(struct Sprite *sprite) sprite->data[5] = 0; } -void HandleBallAnimEnd(struct Sprite *sprite) +static void HandleBallAnimEnd(struct Sprite *sprite) { bool8 affineAnimEnded = FALSE; u8 bank = sprite->sBank; @@ -604,7 +872,7 @@ void HandleBallAnimEnd(struct Sprite *sprite) } } -void sub_80760F8(struct Sprite *sprite) +static void sub_80760F8(struct Sprite *sprite) { u8 bank = sprite->sBank; @@ -629,7 +897,7 @@ void sub_80760F8(struct Sprite *sprite) } } -void SpriteCB_PlayerMonSendOut_1(struct Sprite *sprite) +static void SpriteCB_PlayerMonSendOut_1(struct Sprite *sprite) { sprite->data[0] = 25; sprite->data[2] = GetBankPosition(sprite->sBank, 2); @@ -642,7 +910,7 @@ void SpriteCB_PlayerMonSendOut_1(struct Sprite *sprite) #define HIBYTE(x) (((x) >> 8) & 0xFF) -void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite) +static void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite) { u32 r6; u32 r7; @@ -698,7 +966,7 @@ void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite) } } -void SpriteCB_ReleaseMon2FromBall(struct Sprite *sprite) +static void SpriteCB_ReleaseMon2FromBall(struct Sprite *sprite) { if (sprite->data[0]++ > 24) { @@ -707,7 +975,7 @@ void SpriteCB_ReleaseMon2FromBall(struct Sprite *sprite) } } -void SpriteCB_OpponentMonSendOut(struct Sprite *sprite) +static void SpriteCB_OpponentMonSendOut(struct Sprite *sprite) { sprite->data[0]++; if (sprite->data[0] > 15) @@ -723,22 +991,22 @@ void SpriteCB_OpponentMonSendOut(struct Sprite *sprite) #undef sBank -u8 LaunchBallStarsTaskForPokeball(u8 x, u8 y, u8 kindOfStars, u8 d) +static u8 LaunchBallStarsTaskForPokeball(u8 x, u8 y, u8 kindOfStars, u8 d) { - return LaunchBallStarsTask(x, y, kindOfStars, d, 0); + return LaunchBallStarsTask(x, y, kindOfStars, d, BALL_POKE); } -u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 bank, u32 arg2) +static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 bank, u32 arg2) { - return LaunchBallFadeMonTask(unFadeLater, bank, arg2, 0); + return LaunchBallFadeMonTask(unFadeLater, bank, arg2, BALL_POKE); } void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 bank, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 g, u32 h, u16 species) { u8 spriteId; - LoadCompressedObjectPicUsingHeap(&sBallSpriteSheets[0]); - LoadCompressedObjectPaletteUsingHeap(&sBallSpritePalettes[0]); + LoadCompressedObjectPicUsingHeap(&gBallSpriteSheets[0]); + LoadCompressedObjectPaletteUsingHeap(&gBallSpritePalettes[0]); spriteId = CreateSprite(&gBallSpriteTemplates[0], x, y, subpriortiy); gSprites[spriteId].data[0] = monSpriteId; @@ -759,7 +1027,7 @@ void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 bank, u8 x, u8 y, u8 oa gSprites[monSpriteId].invisible = TRUE; } -void sub_8076524(struct Sprite *sprite) +static void sub_8076524(struct Sprite *sprite) { if (sprite->data[1] == 0) { @@ -789,7 +1057,7 @@ void sub_8076524(struct Sprite *sprite) } } -void sub_80765E0(struct Sprite *sprite) +static void sub_80765E0(struct Sprite *sprite) { bool8 r12 = FALSE; bool8 r6 = FALSE; @@ -839,8 +1107,8 @@ u8 sub_807671C(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 g, u32 { u8 spriteId; - LoadCompressedObjectPicUsingHeap(&sBallSpriteSheets[0]); - LoadCompressedObjectPaletteUsingHeap(&sBallSpritePalettes[0]); + LoadCompressedObjectPicUsingHeap(&gBallSpriteSheets[0]); + LoadCompressedObjectPaletteUsingHeap(&gBallSpritePalettes[0]); spriteId = CreateSprite(&gBallSpriteTemplates[0], x, y, subPriority); gSprites[spriteId].data[0] = a; gSprites[spriteId].data[1] = g; @@ -852,7 +1120,7 @@ u8 sub_807671C(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 g, u32 return spriteId; } -void sub_80767D4(struct Sprite *sprite) +static void sub_80767D4(struct Sprite *sprite) { if (sprite->data[1] == 0) { @@ -880,7 +1148,7 @@ void sub_80767D4(struct Sprite *sprite) } } -void sub_807687C(struct Sprite *sprite) +static void sub_807687C(struct Sprite *sprite) { u8 r1; @@ -902,7 +1170,7 @@ void sub_807687C(struct Sprite *sprite) } } -void sub_80768F0(struct Sprite *sprite) +static void sub_80768F0(struct Sprite *sprite) { if (sprite->animEnded) sprite->callback = SpriteCallbackDummy; @@ -934,7 +1202,7 @@ void sub_8076918(u8 bank) healthboxSprite->callback = sub_80769A8; } -void sub_80769A8(struct Sprite *sprite) +static void sub_80769A8(struct Sprite *sprite) { sprite->data[1]++; if (sprite->data[1] == 20) @@ -944,7 +1212,7 @@ void sub_80769A8(struct Sprite *sprite) } } -void sub_80769CC(struct Sprite *sprite) +static void sub_80769CC(struct Sprite *sprite) { sprite->pos2.x -= sprite->data[0]; sprite->pos2.y -= sprite->data[1]; @@ -962,7 +1230,7 @@ void DoHitAnimHealthboxEffect(u8 bank) gSprites[spriteId].callback = SpriteCB_HitAnimHealthoxEffect; } -void SpriteCB_HitAnimHealthoxEffect(struct Sprite *sprite) +static void SpriteCB_HitAnimHealthoxEffect(struct Sprite *sprite) { u8 r1 = sprite->data[1]; @@ -981,10 +1249,10 @@ void LoadBallGfx(u8 ballId) { u16 var; - if (GetSpriteTileStartByTag(sBallSpriteSheets[ballId].tag) == 0xFFFF) + if (GetSpriteTileStartByTag(gBallSpriteSheets[ballId].tag) == 0xFFFF) { - LoadCompressedObjectPicUsingHeap(&sBallSpriteSheets[ballId]); - LoadCompressedObjectPaletteUsingHeap(&sBallSpritePalettes[ballId]); + LoadCompressedObjectPicUsingHeap(&gBallSpriteSheets[ballId]); + LoadCompressedObjectPaletteUsingHeap(&gBallSpritePalettes[ballId]); } switch (ballId) { @@ -993,7 +1261,7 @@ void LoadBallGfx(u8 ballId) case BALL_PREMIER: break; default: - var = GetSpriteTileStartByTag(sBallSpriteSheets[ballId].tag); + var = GetSpriteTileStartByTag(gBallSpriteSheets[ballId].tag); LZDecompressVram(gOpenPokeballGfx, (void *)(VRAM + 0x10100 + var * 32)); break; } @@ -1001,11 +1269,11 @@ void LoadBallGfx(u8 ballId) void FreeBallGfx(u8 ballId) { - FreeSpriteTilesByTag(sBallSpriteSheets[ballId].tag); - FreeSpritePaletteByTag(sBallSpritePalettes[ballId].tag); + FreeSpriteTilesByTag(gBallSpriteSheets[ballId].tag); + FreeSpritePaletteByTag(gBallSpritePalettes[ballId].tag); } -u16 GetBankPokeballItemId(u8 bank) +static u16 GetBankPokeballItemId(u8 bank) { if (GetBankSide(bank) == SIDE_PLAYER) return GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_POKEBALL);