Merge pull request #104 from DizzyEggg/decompile_battle_7

Decompile battle 7
This commit is contained in:
Cameron Hall 2017-11-11 15:48:17 -06:00 committed by GitHub
commit 558bf2f7d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 1638 additions and 4125 deletions

File diff suppressed because it is too large Load Diff

View File

@ -586,8 +586,8 @@ _080A612E:
bx r1
thumb_func_end sub_80A60AC
thumb_func_start sub_80A6138
sub_80A6138: @ 80A6138
thumb_func_start GetBankSpriteDefault_Y
GetBankSpriteDefault_Y: @ 80A6138
push {lr}
lsls r0, 24
lsrs r0, 24
@ -597,10 +597,10 @@ sub_80A6138: @ 80A6138
lsrs r0, 24
pop {r1}
bx r1
thumb_func_end sub_80A6138
thumb_func_end GetBankSpriteDefault_Y
thumb_func_start sub_80A614C
sub_80A614C: @ 80A614C
thumb_func_start GetSubstituteSpriteDefault_Y
GetSubstituteSpriteDefault_Y: @ 80A614C
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
@ -633,7 +633,7 @@ _080A6180:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_80A614C
thumb_func_end GetSubstituteSpriteDefault_Y
thumb_func_start sub_80A6190
sub_80A6190: @ 80A6190
@ -5180,7 +5180,7 @@ _080A8412:
adds r0, r6, 0
ldr r1, [sp, 0x3C]
mov r2, r8
bl species_and_otid_get_pal
bl GetFrontSpritePalFromSpeciesAndPersonality
lsls r1, r5, 20
movs r2, 0x80
lsls r2, 17
@ -5243,7 +5243,7 @@ _080A84B0:
adds r0, r6, 0
ldr r1, [sp, 0x3C]
mov r2, r8
bl species_and_otid_get_pal
bl GetFrontSpritePalFromSpeciesAndPersonality
lsls r1, r5, 20
movs r3, 0x80
lsls r3, 17

View File

@ -855,8 +855,8 @@ _080AA352:
.pool
thumb_func_end sub_80AA18C
thumb_func_start move_anim_start_t2
move_anim_start_t2: @ 80AA364
thumb_func_start LaunchStatusAnimation
LaunchStatusAnimation: @ 80AA364
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
@ -885,7 +885,7 @@ move_anim_start_t2: @ 80AA364
pop {r0}
bx r0
.pool
thumb_func_end move_anim_start_t2
thumb_func_end LaunchStatusAnimation
thumb_func_start task0A_80788BC
task0A_80788BC: @ 80AA3B4

View File

@ -3006,7 +3006,7 @@ _0815B8A8:
lsls r2, 3
adds r2, r3
ldrb r2, [r2, 0x1C]
bl sub_805E448
bl HandleSpeciesGfxDataChange
ldrb r1, [r5]
mov r0, sp
bl sub_80A6BFC
@ -3310,7 +3310,7 @@ sub_815BB58: @ 815BB58
ldr r1, =gAnimBankTarget
ldrb r1, [r1]
movs r2, 0x1
bl sub_805E448
bl HandleSpeciesGfxDataChange
adds r0, r4, 0
bl DestroyAnimVisualTask
pop {r4}
@ -10129,7 +10129,7 @@ _0815F2AC:
ldr r4, =gAnimBankAttacker
ldrb r0, [r4]
movs r1, 0
bl refresh_graphics_maybe
bl LoadBattleMonGfxAndAnimate
bl IsContest
lsls r0, 24
cmp r0, 0

View File

@ -4825,7 +4825,7 @@ _08172CC8:
ldrb r1, [r5, 0x1E]
adds r0, r2, 0
adds r2, r6, 0
bl refresh_graphics_maybe
bl LoadBattleMonGfxAndAnimate
ldrh r0, [r5, 0x1C]
adds r0, 0x1
strh r0, [r5, 0x1C]
@ -5030,7 +5030,7 @@ _08172E4E:
movs r3, 0x1
bl RequestDma3Fill
ldrb r0, [r4]
bl sub_805E974
bl ClearBehindSubstituteBit
adds r0, r5, 0
bl DestroyAnimVisualTask
_08172E84:

View File

@ -6763,7 +6763,7 @@ _080DB1CC:
adds r0, r5, 0
adds r1, r7, 0
adds r2, r6, 0
bl species_and_otid_get_pal
bl GetFrontSpritePalFromSpeciesAndPersonality
movs r1, 0x90
lsls r1, 1
movs r2, 0x20

View File

@ -572,7 +572,7 @@ sub_81302E8: @ 81302E8
ldr r1, [r0, 0x4]
ldr r2, [r0]
adds r0, r5, 0
bl species_and_otid_get_pal
bl GetFrontSpritePalFromSpeciesAndPersonality
ldr r7, =gUnknown_030061C4
ldr r1, [r7]
bl LZDecompressVram

View File

@ -69004,7 +69004,7 @@ _0802CA32:
ldrh r0, [r7]
ldr r1, [r7, 0x4]
ldr r2, [r7, 0x8]
bl species_and_otid_get_pal
bl GetFrontSpritePalFromSpeciesAndPersonality
str r0, [sp, 0x20]
add r0, sp, 0x20
ldr r1, [r0, 0x4]

View File

@ -936,7 +936,7 @@ _08075B9E:
.pool
_08075BB4:
adds r0, r3, 0
bl sub_805F110
bl ShouldPlayNormalPokeCry
cmp r0, 0x1
bne _08075BCC
lsls r1, r5, 24
@ -976,7 +976,7 @@ _08075BF8:
cmp r0, 0
bne _08075CBA
adds r0, r3, 0
bl sub_805F110
bl ShouldPlayNormalPokeCry
cmp r0, 0x1
bne _08075C22
lsls r1, r5, 24
@ -1066,7 +1066,7 @@ _08075CBA:
b _08075D04
_08075CC0:
adds r0, r3, 0
bl sub_805F110
bl ShouldPlayNormalPokeCry
cmp r0, 0x1
bne _08075CD8
lsls r1, r5, 24

View File

@ -8824,7 +8824,7 @@ _080C0168:
adds r3, r5
ldrb r4, [r3, 0x5]
lsrs r4, 4
bl species_and_otid_get_pal
bl GetFrontSpritePalFromSpeciesAndPersonality
lsls r4, 4
movs r2, 0x80
lsls r2, 1

View File

@ -14656,7 +14656,7 @@ _080CEC86:
adds r1, r3
str r0, [r1]
adds r0, r6, 0
bl pokemon_get_pal
bl GetMonFrontSpritePal
ldr r1, [r4]
ldr r2, =0x00000cdc
adds r1, r2
@ -14759,7 +14759,7 @@ _080CED7E:
adds r1, r4
ldrh r0, [r1]
mov r1, r9
bl species_and_otid_get_pal
bl GetFrontSpritePalFromSpeciesAndPersonality
ldr r1, [r5]
ldr r3, =0x00000cdc
adds r2, r1, r3

View File

@ -1116,7 +1116,7 @@ sub_81C4778: @ 81C4778
bne _081C47AE
adds r0, r1, 0
adds r0, 0xC
bl sub_805F110
bl ShouldPlayNormalPokeCry
cmp r0, 0x1
bne _081C47A4
ldrh r0, [r4, 0x2]

View File

@ -13532,7 +13532,7 @@ _081CDBD0:
adds r0, r4, 0
mov r1, r8
adds r2, r5, 0
bl species_and_otid_get_pal
bl GetFrontSpritePalFromSpeciesAndPersonality
mov r2, r9
lsls r1, r2, 7
adds r1, r7, r1
@ -24408,7 +24408,7 @@ _081D30C4:
adds r0, r4, 0
adds r1, r6, 0
adds r2, r5, 0
bl species_and_otid_get_pal
bl GetFrontSpritePalFromSpeciesAndPersonality
mov r1, r9
bl LZ77UnCompWram
_081D311A:

View File

@ -1,44 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2, 0
gUnknown_0832C0D0:: @ 832C0D0
obj_tiles gUnknown_08C1F1C8, 0x1000, 0xd6ff
.align 2
gUnknown_0832C0D8:: @ 832C0D8
obj_tiles gUnknown_08C1F46C, 0x1000, 0xd701
.align 2
gUnknown_0832C0E0:: @ 832C0E0
obj_tiles gUnknown_08C1F5E8, 0x0800, 0xd6ff
.align 2
gUnknown_0832C0E8:: @ 832C0E8
obj_tiles gUnknown_08C1F5E8, 0x0800, 0xd700
.align 2
gUnknown_0832C0F0:: @ 832C0F0
obj_tiles gUnknown_08C1F76C, 0x0800, 0xd701
.align 2
gUnknown_0832C0F8:: @ 832C0F8
obj_tiles gUnknown_08C1F76C, 0x0800, 0xd702
.align 2
gUnknown_0832C100:: @ 832C100
obj_tiles gUnknown_08C1F8E8, 0x1000, 0xd70b
.align 2
gUnknown_0832C108:: @ 832C108
obj_tiles gUnknown_08C0237C, 0x0100, 0xd704
obj_tiles gUnknown_08C0237C, 0x0120, 0xd705
obj_tiles gUnknown_08C0237C, 0x0100, 0xd706
obj_tiles gUnknown_08C0237C, 0x0120, 0xd707
.align 2
gUnknown_0832C128:: @ 832C128
obj_pal gBattleInterface_BallStatusBarPal, 0xd6ff
obj_pal gBattleInterface_BallDisplayPal, 0xd704

View File

@ -149,13 +149,13 @@ gUnknown_08C2A6D4:: @ 8C2A6D4
gUnknown_08C2A6EC:: @ 8C2A6EC
.incbin "baserom.gba", 0xc2a6ec, 0x27d0
gUnknown_08C2CEBC:: @ 8C2CEBC
gSubstituteDollPal:: @ 8C2CEBC
.incbin "baserom.gba", 0xc2cebc, 0x24
gUnknown_08C2CEE0:: @ 8C2CEE0
gSubstituteDollGfx:: @ 8C2CEE0
.incbin "baserom.gba", 0xc2cee0, 0x240
gUnknown_08C2D120:: @ 8C2D120
gSubstituteDollTilemap:: @ 8C2D120
.incbin "baserom.gba", 0xc2d120, 0x600
gUnknown_08C2D720:: @ 8C2D720

View File

@ -52,7 +52,7 @@ gUnknown_0831C688:: @ 831C688
spr_template 0xd6eb, 0xd6eb, gUnknown_0831C630, gUnknown_0831C678, NULL, gDummySpriteAffineAnimTable, sub_80753B4
.align 2
gUnknown_0831C6A0:: @ 831C6A0
gSpriteSheet_EnemyShadow:: @ 831C6A0
obj_tiles gUnknown_08D8FBC0, 0x0080, 0xd759
.align 2
@ -60,5 +60,5 @@ gUnknown_0831C6A8:: @ 831C6A8
.byte 0x00, 0x40, 0x00, 0x40, 0x00, 0x0c, 0x00, 0x00
.align 2
gUnknown_0831C6B0:: @ 831C6B0
spr_template 0xd759, 0xd6ff, gUnknown_0831C6A8, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_805EE48
gSpriteTemplate_EnemyShadow:: @ 831C6B0
spr_template 0xd759, 0xd6ff, gUnknown_0831C6A8, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCB_SetInvisible

View File

@ -6,6 +6,7 @@
#include "battle_script_commands.h"
#include "battle_2.h"
#include "battle_ai_switch_items.h"
#include "battle_gfx_sfx_util.h"
/*
Banks are a name given to what could be called a 'battlerId' or 'monControllerId'.
@ -670,7 +671,7 @@ struct BattleStruct
u8 fillerDC[0xDF-0xDC];
u8 field_DF;
u8 mirrorMoveArrays[32];
u16 castformPalette[4][16];
u16 castformPalette[BATTLE_BANKS_COUNT][16];
u8 field_180;
u8 field_181;
u8 field_182;
@ -807,6 +808,18 @@ extern struct BattleStruct* gBattleStruct;
#define B_ANIM_SUBSTITUTE_TO_MON 0x5
#define B_ANIM_MON_TO_SUBSTITUTE 0x6
// status animation table
#define B_ANIM_STATUS_PSN 0x0
#define B_ANIM_STATUS_CONFUSION 0x1
#define B_ANIM_STATUS_BRN 0x2
#define B_ANIM_STATUS_INFATUATION 0x3
#define B_ANIM_STATUS_SLP 0x4
#define B_ANIM_STATUS_PRZ 0x5
#define B_ANIM_STATUS_FRZ 0x6
#define B_ANIM_STATUS_CURSED 0x7
#define B_ANIM_STATUS_NIGHTMARE 0x8
#define B_ANIM_STATUS_WRAPPED 0x9
#define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8
#define GET_STAT_BUFF_VALUE(n)(((n >> 4) & 7)) // 0x10, 0x20, 0x40
#define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit
@ -864,43 +877,6 @@ void AdjustFriendshipOnBattleFaint(u8 bank);
void sub_80571DC(u8 bank, u8 arg1);
u32 sub_805725C(u8 bank);
// battle 7
void AllocateBattleSpritesData(void);
void FreeBattleSpritesData(void);
void AllocateMonSpritesGfx(void);
void FreeMonSpritesGfx(void);
void BattleMusicStop(void);
void sub_805E990(struct Pokemon *mon, u8 bank);
void sub_805EF14(void);
bool8 BattleInitAllSprites(u8 *state1, u8 *state2);
void sub_805E350(void);
bool8 BattleLoadAllHealthBoxesGfx(u8 state);
void LoadAndCreateEnemyShadowSprites(void);
void SetBankEnemyShadowSpriteCallback(u8 bank, u16 species);
void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 bank);
void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 bank);
void BattleLoadSubstituteSpriteGfx(u8 bank, bool8 arg1);
void nullsub_24(u16 arg0);
void nullsub_25(u8 arg0);
void ClearTemporarySpeciesSpriteData(u8 bank, bool8 dontClearSubstitute);
void sub_805D714(struct Sprite *sprite);
void DecompressTrainerBackPic(u16 backPicId, u8 bank);
void DecompressTrainerFrontPic(u16 frontPicId, u8 bank);
void FreeTrainerFrontPicPalette(u16 frontPicId);
void sub_805D7AC(struct Sprite *sprite);
bool8 IsMoveWithoutAnimation(u16 moveId, u8 animationTurn);
void sub_805EB9C(u8 arg0);
void sub_805E394(void);
void TrySetBehindSubstituteSpriteBit(u8 bank, u16 move);
void DoStatusAnimation(bool8 isStatus2, u32 status);
void DoSpecialBattleAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId);
bool8 DoBattleAnimationFromTable(u8 active, u8 atkBank, u8 defBank, u8 tableId, u16 argument);
void CopyBattleSpriteInvisibility(u8 bank);
u16 ChooseMoveAndTargetInBattlePalace(void);
void LoadBattleBarGfx(u8 arg0);
bool8 mplay_80342A4(u8 bank);
void sub_805EEE0(u8 bank);
enum
{
BACK_PIC_BRENDAN,
@ -921,7 +897,7 @@ u8 GetBankByIdentity(u8 bank);
struct BattleSpriteInfo
{
u16 invisible : 1; // 0x1
u16 flag_x2 : 1; // 0x2
u16 lowHpSong : 1; // 0x2
u16 behindSubstitute : 1; // 0x4
u16 flag_x8 : 1; // 0x8
u16 hpNumbersNoBars : 1; // 0x10
@ -930,7 +906,7 @@ struct BattleSpriteInfo
struct BattleAnimationInfo
{
u16 field; // to fill up later
u16 animArg; // to fill up later
u8 field_2;
u8 field_3;
u8 field_4;
@ -944,6 +920,12 @@ struct BattleAnimationInfo
u8 field_9_x20 : 1;
u8 field_9_x40 : 1;
u8 field_9_x80 : 1;
u8 field_A;
u8 field_B;
u8 field_C;
u8 field_D;
u8 field_E;
u8 field_F;
};
struct BattleHealthboxInfo
@ -966,7 +948,7 @@ struct BattleHealthboxInfo
u8 animationState;
u8 field_5;
u8 field_6;
u8 field_7;
u8 shadowSpriteId;
u8 field_8;
u8 field_9;
u8 field_A;
@ -1006,8 +988,11 @@ struct MonSpritesGfx
void* firstDecompressed; // ptr to the decompressed sprite of the first pokemon
void* sprites[4];
struct SpriteTemplate templates[4];
u8 field_74[0x100];
u8 *fontPixels;
struct SpriteFrameImage field_74[4][4];
u8 field_F4[0x80];
u8 *barFontGfx;
void *field_178;
void *field_17C;
};
extern struct BattleSpritesGfx* gMonSpritesGfx;

View File

@ -92,7 +92,11 @@ u8 sub_80A6D94(void);
u8 sub_80A8364(u8);
void StoreSpriteCallbackInData6(struct Sprite *sprite, void (*spriteCallback)(struct Sprite*));
void oamt_add_pos2_onto_pos1(struct Sprite *sprite);
u8 sub_80A6138(u8 bank);
u8 GetBankSpriteDefault_Y(u8 bank);
u8 sub_80A82E4(u8 bank);
u8 GetSubstituteSpriteDefault_Y(u8 bank);
// battle_anim_80A9C70.s
void LaunchStatusAnimation(u8 bank, u8 statusAnimId);
#endif // GUARD_BATTLE_ANIM_H

View File

@ -0,0 +1,50 @@
#ifndef GUARD_BATTLE_GFX_SFX_UTIL
#define GUARD_BATTLE_GFX_SFX_UTIL
void AllocateBattleSpritesData(void);
void FreeBattleSpritesData(void);
u16 ChooseMoveAndTargetInBattlePalace(void);
void sub_805D714(struct Sprite *sprite);
void sub_805D770(struct Sprite *sprite, bool8 arg1);
void sub_805D7AC(struct Sprite *sprite);
void InitAndLaunchChosenStatusAnimation(bool8 isStatus2, u32 status);
bool8 TryHandleLaunchBattleTableAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId, u16 argument);
void InitAndLaunchSpecialAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId);
bool8 IsMoveWithoutAnimation(u16 moveId, u8 animationTurn);
bool8 mplay_80342A4(u8 bank);
void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 bank);
void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 bank);
void nullsub_23(void);
void nullsub_24(u16 species);
void DecompressTrainerFrontPic(u16 frontPicId, u8 bank);
void DecompressTrainerBackPic(u16 backPicId, u8 bank);
void nullsub_25(u8 arg0);
void FreeTrainerFrontPicPalette(u16 frontPicId);
void sub_805DFFC(void);
bool8 BattleLoadAllHealthBoxesGfx(u8 state);
void LoadBattleBarGfx(u8 arg0);
bool8 BattleInitAllSprites(u8 *state1, u8 *bank);
void ClearSpritesHealthboxAnimData(void);
void CopyAllBattleSpritesInvisibilities(void);
void CopyBattleSpriteInvisibility(u8 bank);
void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform);
void BattleLoadSubstituteOrMonSpriteGfx(u8 bank, bool8 loadMonSprite);
void LoadBattleMonGfxAndAnimate(u8 bank, bool8 loadMonSprite, u8 spriteId);
void TrySetBehindSubstituteSpriteBit(u8 bank, u16 move);
void ClearBehindSubstituteBit(u8 bank);
void HandleLowHpMusicChange(struct Pokemon *mon, u8 bank);
void BattleStopLowHpSound(void);
u8 GetMonHPBarLevel(struct Pokemon *mon);
void sub_805EAE8(void);
void sub_805EB9C(u8 affineMode);
void LoadAndCreateEnemyShadowSprites(void);
void SpriteCB_SetInvisible(struct Sprite *sprite);
void SetBankEnemyShadowSpriteCallback(u8 bank, u16 species);
void EnemyShadowCallbackToSetInvisible(u8 bank);
void sub_805EF14(void);
void ClearTemporarySpeciesSpriteData(u8 bank, bool8 dontClearSubstitute);
void AllocateMonSpritesGfx(void);
void FreeMonSpritesGfx(void);
bool32 ShouldPlayNormalPokeCry(struct Pokemon *mon);
#endif // GUARD_BATTLE_GFX_SFX_UTIL

View File

@ -15,6 +15,15 @@ enum
EXP_BAR
};
enum
{
HP_BAR_EMPTY,
HP_BAR_RED,
HP_BAR_YELLOW,
HP_BAR_GREEN,
HP_BAR_FULL,
};
#define TAG_HEALTHBOX_PLAYER1_TILE 0xD6FF
#define TAG_HEALTHBOX_PLAYER2_TILE 0xD700
#define TAG_HEALTHBOX_OPPONENT1_TILE 0xD701

View File

@ -57,6 +57,6 @@ void HandleBattleWindow(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags);
bool8 UproarWakeUpCheck(u8 bank);
extern void (* const gBattleScriptingCommandsTable[])(void);
extern const u8 gUnknown_0831C494[];
extern const u8 gUnknown_0831C494[][4];
#endif // GUARD_BATTLE_SCRIPT_COMMANDS_H

View File

@ -20,6 +20,12 @@ struct ContestStruct_field_18
{
// unknown size
u16 field_0;
u16 field_2;
u16 field_4;
u16 field_6;
u32 field_8;
u32 field_C;
u32 field_10;
};
struct ContestResources

View File

@ -3,6 +3,8 @@
#include "sprite.h"
extern u8 gDecompressionBuffer[0x4000];
void LZDecompressWram(const void *src, void *dest);
void LZDecompressVram(const void *src, void *dest);

View File

@ -5,6 +5,12 @@
#define calloc(ct, sz) AllocZeroed((ct) * (sz))
#define free Free
#define FREE_AND_SET_NULL(ptr) \
{ \
free(ptr); \
ptr = NULL; \
}
extern u8 gHeap[];
void *Alloc(u32 size);
void *AllocZeroed(u32 size);

View File

@ -612,8 +612,8 @@ u32 CanMonLearnTMHM(struct Pokemon *, u8);
u32 CanSpeciesLearnTMHM(u16 species, u8 tm);
u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves);
void ClearBattleMonForms(void);
const u8 *pokemon_get_pal(struct Pokemon *mon);
const u8 *species_and_otid_get_pal(u16, u32, u32);
const u8 *GetMonFrontSpritePal(struct Pokemon *mon);
const u8 *GetFrontSpritePalFromSpeciesAndPersonality(u16, u32, u32);
const struct CompressedSpritePalette *sub_80409C8(u16, u32, u32);
bool8 IsOtherTrainer(u32, u8 *);
void SetWildMonHeldItem(void);

View File

@ -62,7 +62,7 @@ SECTIONS {
src/battle_script_commands.o(.text);
asm/battle_5.o(.text);
src/battle_controller_player.o(.text);
asm/battle_7.o(.text);
src/battle_gfx_sfx_util.o(.text);
src/battle_controller_opponent.o(.text);
src/battle_ai_switch_items.o(.text);
src/battle_controller_link_opponent.o(.text);
@ -344,7 +344,7 @@ SECTIONS {
src/util.o(.rodata);
data/daycare.o(.rodata);
src/egg_hatch.o(.rodata);
data/battle_7.o(.rodata);
src/battle_gfx_sfx_util.o(.rodata);
src/battle_interface.o(.rodata);
data/pokeball.o(.rodata);
data/trade.o(.rodata);

View File

@ -4767,7 +4767,7 @@ static void HandleEndTurn_BattleWon(void)
else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER
&& gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_x4000000 | BATTLE_TYPE_EREADER_TRAINER))
{
BattleMusicStop();
BattleStopLowHpSound();
gBattlescriptCurrInstr = BattleScript_FrontierTrainerBattleWon;
if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_3FE)
@ -4777,7 +4777,7 @@ static void HandleEndTurn_BattleWon(void)
}
else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && !(gBattleTypeFlags & BATTLE_TYPE_LINK))
{
BattleMusicStop();
BattleStopLowHpSound();
gBattlescriptCurrInstr = BattleScript_LocalTrainerBattleWon;
switch (gTrainers[gTrainerBattleOpponent_A].trainerClass)

View File

@ -449,7 +449,7 @@ static void sub_8064C58(void)
{
FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]);
DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]);
sub_805EEE0(gActiveBank);
EnemyShadowCallbackToSetInvisible(gActiveBank);
SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]);
LinkOpponentBufferExecCompleted();
}
@ -485,7 +485,7 @@ static void sub_8064D60(void)
if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy)
{
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
gBattleBankFunc[gActiveBank] = sub_8064DD0;
}
@ -1164,7 +1164,7 @@ static void LinkOpponentHandleLoadMonSprite(void)
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
sub_80A5C6C(gActiveBank, 2),
sub_80A6138(gActiveBank),
GetBankSpriteDefault_Y(gActiveBank),
sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240;
@ -1198,7 +1198,7 @@ static void sub_8066494(u8 bank, bool8 dontClearSubstituteBit)
gBankSpriteIds[bank] = CreateSprite(
&gUnknown_0202499C,
sub_80A5C6C(bank, 2),
sub_80A6138(bank),
GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank));
gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank];
@ -1227,7 +1227,7 @@ static void LinkOpponentHandleReturnMonToBall(void)
{
FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]);
DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]);
sub_805EEE0(gActiveBank);
EnemyShadowCallbackToSetInvisible(gActiveBank);
SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]);
LinkOpponentBufferExecCompleted();
}
@ -1239,7 +1239,7 @@ static void DoSwitchOutAnimation(void)
{
case 0:
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1;
break;
@ -1247,7 +1247,7 @@ static void DoSwitchOutAnimation(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_OPPONENT_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_OPPONENT_MON);
gBattleBankFunc[gActiveBank] = sub_8064C58;
}
break;
@ -1382,7 +1382,7 @@ static void LinkOpponentHandleFaintAnimation(void)
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0)
{
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++;
}
else
@ -1455,7 +1455,7 @@ static void LinkOpponentDoMoveAnimation(void)
&& !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8)
{
gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1;
break;
@ -1474,7 +1474,7 @@ static void LinkOpponentDoMoveAnimation(void)
sub_805EB9C(1);
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2)
{
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0;
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3;
@ -1483,7 +1483,7 @@ static void LinkOpponentDoMoveAnimation(void)
case 3:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
sub_805E394();
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
LinkOpponentBufferExecCompleted();
@ -1586,7 +1586,7 @@ static void LinkOpponentHandleStatusAnimation(void)
{
if (!mplay_80342A4(gActiveBank))
{
DoStatusAnimation(gBattleBufferA[gActiveBank][1],
InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBank][1],
gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24));
gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation;
}
@ -1698,7 +1698,7 @@ static void LinkOpponentHandlePlayFanfareOrBGM(void)
{
if (gBattleBufferA[gActiveBank][3])
{
BattleMusicStop();
BattleStopLowHpSound();
PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
}
else
@ -1850,7 +1850,7 @@ static void LinkOpponentHandleBattleAnimation(void)
u8 animationId = gBattleBufferA[gActiveBank][1];
u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8);
if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
LinkOpponentBufferExecCompleted();
else
gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation;

View File

@ -312,7 +312,7 @@ static void CompleteOnHealthbarDone(void)
}
else
{
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
LinkPartnerBufferExecCompleted();
}
}
@ -373,7 +373,7 @@ static void sub_814B4E0(void)
{
CopyBattleSpriteInvisibility(gActiveBank);
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
gBattleBankFunc[gActiveBank] = sub_814B554;
}
@ -399,7 +399,7 @@ static void sub_814B5A8(void)
FreeSpritePaletteByTag(0x27F9);
CreateTask(c3_0802FDF4, 10);
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 0);
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL);
sub_8076918(gActiveBank);
@ -1026,7 +1026,7 @@ static void SetLinkPartnerMonData(u8 monId)
break;
}
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
}
static void LinkPartnerHandleSetRawMonData(void)
@ -1050,7 +1050,7 @@ static void LinkPartnerHandleLoadMonSprite(void)
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
sub_80A5C6C(gActiveBank, 2),
sub_80A6138(gActiveBank),
GetBankSpriteDefault_Y(gActiveBank),
sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240;
gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank;
@ -1081,7 +1081,7 @@ static void sub_814CC98(u8 bank, bool8 dontClearSubstituteBit)
gBankSpriteIds[bank] = CreateSprite(
&gUnknown_0202499C,
sub_80A5C6C(bank, 2),
sub_80A6138(bank),
GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank));
gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank];
@ -1121,7 +1121,7 @@ static void DoSwitchOutAnimation(void)
{
case 0:
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1;
break;
@ -1129,7 +1129,7 @@ static void DoSwitchOutAnimation(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON);
gBattleBankFunc[gActiveBank] = sub_814B3DC;
}
break;
@ -1201,7 +1201,7 @@ static void LinkPartnerHandleFaintAnimation(void)
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0)
{
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++;
}
else
@ -1209,7 +1209,7 @@ static void LinkPartnerHandleFaintAnimation(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER);
gSprites[gBankSpriteIds[gActiveBank]].data1 = 0;
gSprites[gBankSpriteIds[gActiveBank]].data2 = 5;
@ -1277,7 +1277,7 @@ static void LinkPartnerDoMoveAnimation(void)
&& !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8)
{
gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1;
break;
@ -1296,7 +1296,7 @@ static void LinkPartnerDoMoveAnimation(void)
sub_805EB9C(1);
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2)
{
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0;
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3;
@ -1305,7 +1305,7 @@ static void LinkPartnerDoMoveAnimation(void)
case 3:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
sub_805E394();
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
LinkPartnerBufferExecCompleted();
@ -1408,7 +1408,7 @@ static void LinkPartnerHandleStatusAnimation(void)
{
if (!mplay_80342A4(gActiveBank))
{
DoStatusAnimation(gBattleBufferA[gActiveBank][1],
InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBank][1],
gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24));
gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation;
}
@ -1520,7 +1520,7 @@ static void LinkPartnerHandlePlayFanfareOrBGM(void)
{
if (gBattleBufferA[gActiveBank][3])
{
BattleMusicStop();
BattleStopLowHpSound();
PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
}
else
@ -1683,7 +1683,7 @@ static void LinkPartnerHandleBattleAnimation(void)
u8 animationId = gBattleBufferA[gActiveBank][1];
u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8);
if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
LinkPartnerBufferExecCompleted();
else
gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation;

View File

@ -437,7 +437,7 @@ static void sub_805FB08(void)
{
FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]);
DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]);
sub_805EEE0(gActiveBank);
EnemyShadowCallbackToSetInvisible(gActiveBank);
SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]);
OpponentBufferExecCompleted();
}
@ -473,7 +473,7 @@ static void sub_805FC10(void)
if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy)
{
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
gBattleBankFunc[gActiveBank] = sub_805FC80;
}
}
@ -1152,7 +1152,7 @@ static void OpponentHandleLoadMonSprite(void)
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
sub_80A5C6C(gActiveBank, 2),
sub_80A6138(gActiveBank),
GetBankSpriteDefault_Y(gActiveBank),
sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240;
@ -1187,7 +1187,7 @@ static void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit)
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C,
sub_80A5C6C(bank, 2),
sub_80A6138(bank),
GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank));
gSprites[gBankSpriteIds[bank]].data0 = bank;
@ -1217,7 +1217,7 @@ static void OpponentHandleReturnMonToBall(void)
{
FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]);
DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]);
sub_805EEE0(gActiveBank);
EnemyShadowCallbackToSetInvisible(gActiveBank);
SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]);
OpponentBufferExecCompleted();
}
@ -1229,7 +1229,7 @@ static void DoSwitchOutAnimation(void)
{
case 0:
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1;
break;
@ -1237,7 +1237,7 @@ static void DoSwitchOutAnimation(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_OPPONENT_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_OPPONENT_MON);
gBattleBankFunc[gActiveBank] = sub_805FB08;
}
break;
@ -1415,7 +1415,7 @@ static void OpponentHandleFaintAnimation(void)
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0)
{
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++;
}
else
@ -1487,7 +1487,7 @@ static void OpponentDoMoveAnimation(void)
&& !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8)
{
gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1;
break;
@ -1506,7 +1506,7 @@ static void OpponentDoMoveAnimation(void)
sub_805EB9C(1);
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2)
{
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0;
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3;
@ -1515,7 +1515,7 @@ static void OpponentDoMoveAnimation(void)
case 3:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
sub_805E394();
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
OpponentBufferExecCompleted();
@ -1731,7 +1731,7 @@ static void OpponentHandleStatusAnimation(void)
{
if (!mplay_80342A4(gActiveBank))
{
DoStatusAnimation(gBattleBufferA[gActiveBank][1],
InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBank][1],
gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24));
gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation;
}
@ -1843,7 +1843,7 @@ static void OpponentHandlePlayFanfareOrBGM(void)
{
if (gBattleBufferA[gActiveBank][3])
{
BattleMusicStop();
BattleStopLowHpSound();
PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
}
else
@ -2000,7 +2000,7 @@ static void OpponentHandleBattleAnimation(void)
u8 animationId = gBattleBufferA[gActiveBank][1];
u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8);
if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
OpponentBufferExecCompleted();
else
gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation;

View File

@ -1008,10 +1008,10 @@ static void sub_805896C(void)
FreeSpriteTilesByTag(0x27F9);
FreeSpritePaletteByTag(0x27F9);
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
if (IsDoubleBattle())
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], gActiveBank ^ BIT_MON);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], gActiveBank ^ BIT_MON);
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3;
gBattleBankFunc[gActiveBank] = sub_8058924;
@ -1107,7 +1107,7 @@ static void sub_8058EDC(void)
FreeSpritePaletteByTag(0x27F9);
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
gBattleBankFunc[gActiveBank] = sub_8058FC0;
}
@ -1119,7 +1119,7 @@ static void sub_8058FC0(void)
&& !IsCryPlayingOrClearCrySongs())
{
m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100);
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
PlayerBufferExecCompleted();
}
}
@ -1164,7 +1164,7 @@ static void CompleteOnHealthbarDone(void)
}
else
{
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
PlayerBufferExecCompleted();
}
}
@ -1305,7 +1305,7 @@ static void sub_8059544(u8 taskId)
if (IsDoubleBattle() == TRUE && monIndex == gBattlePartyID[bank ^ BIT_MON])
bank ^= BIT_MON;
DoSpecialBattleAnimation(bank, bank, bank, B_ANIM_LVL_UP);
InitAndLaunchSpecialAnimation(bank, bank, bank, B_ANIM_LVL_UP);
gTasks[taskId].func = sub_80595A4;
}
@ -2193,7 +2193,7 @@ static void SetPlayerMonData(u8 monId)
break;
}
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
}
static void PlayerHandleSetRawMonData(void)
@ -2238,7 +2238,7 @@ static void sub_805B258(u8 bank, bool8 dontClearSubstituteBit)
gBankSpriteIds[bank] = CreateSprite(
&gUnknown_0202499C,
sub_80A5C6C(bank, 2),
sub_80A6138(bank),
GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank));
gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank];
@ -2278,7 +2278,7 @@ static void DoSwitchOutAnimation(void)
{
case 0:
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1;
break;
@ -2286,7 +2286,7 @@ static void DoSwitchOutAnimation(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON);
gBattleBankFunc[gActiveBank] = sub_8059744;
}
break;
@ -2434,7 +2434,7 @@ static void PlayerHandleFaintAnimation(void)
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0)
{
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++;
}
else
@ -2442,7 +2442,7 @@ static void PlayerHandleFaintAnimation(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER);
gSprites[gBankSpriteIds[gActiveBank]].data1 = 0;
gSprites[gBankSpriteIds[gActiveBank]].data2 = 5;
@ -2462,7 +2462,7 @@ static void PlayerHandleSuccessBallThrowAnim(void)
{
gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS;
gDoingBattleAnim = TRUE;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_BALL_THROW);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_BALL_THROW);
gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone;
}
@ -2472,7 +2472,7 @@ static void PlayerHandleBallThrowAnim(void)
gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId;
gDoingBattleAnim = TRUE;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_BALL_THROW);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_BALL_THROW);
gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone;
}
@ -2525,7 +2525,7 @@ static void PlayerDoMoveAnimation(void)
&& !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8)
{
gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1;
break;
@ -2544,7 +2544,7 @@ static void PlayerDoMoveAnimation(void)
sub_805EB9C(1);
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2)
{
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0;
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3;
@ -2553,7 +2553,7 @@ static void PlayerDoMoveAnimation(void)
case 3:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
sub_805E394();
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
PlayerBufferExecCompleted();
@ -2709,7 +2709,7 @@ static void PlayerHandleChoosePokemon(void)
static void PlayerHandleCmd23(void)
{
BattleMusicStop();
BattleStopLowHpSound();
BeginNormalPaletteFade(-1, 2, 0, 16, 0);
PlayerBufferExecCompleted();
}
@ -2788,7 +2788,7 @@ static void PlayerHandleStatusAnimation(void)
{
if (!mplay_80342A4(gActiveBank))
{
DoStatusAnimation(gBattleBufferA[gActiveBank][1],
InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBank][1],
gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24));
gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation;
}
@ -2930,7 +2930,7 @@ static void PlayerHandlePlayFanfareOrBGM(void)
{
if (gBattleBufferA[gActiveBank][3])
{
BattleMusicStop();
BattleStopLowHpSound();
PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
}
else
@ -3088,7 +3088,7 @@ static void PlayerHandleBattleAnimation(void)
u8 animationId = gBattleBufferA[gActiveBank][1];
u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8);
if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
PlayerBufferExecCompleted();
else
gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation;

View File

@ -327,7 +327,7 @@ static void CompleteOnHealthbarDone(void)
}
else
{
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
PlayerPartnerBufferExecCompleted();
}
}
@ -469,7 +469,7 @@ static void sub_81BB628(u8 taskId)
if (IsDoubleBattle() == TRUE && monIndex == gBattlePartyID[bank ^ BIT_MON])
bank ^= BIT_MON;
DoSpecialBattleAnimation(bank, bank, bank, B_ANIM_LVL_UP);
InitAndLaunchSpecialAnimation(bank, bank, bank, B_ANIM_LVL_UP);
gTasks[taskId].func = sub_81BB688;
}
@ -560,7 +560,7 @@ static void sub_81BB92C(void)
{
CopyBattleSpriteInvisibility(gActiveBank);
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
gBattleBankFunc[gActiveBank] = sub_81BB9A0;
}
@ -586,7 +586,7 @@ static void sub_81BB9F4(void)
FreeSpritePaletteByTag(0x27F9);
CreateTask(c3_0802FDF4, 10);
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 0);
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL);
sub_8076918(gActiveBank);
@ -1213,7 +1213,7 @@ static void SetPlayerPartnerMonData(u8 monId)
break;
}
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
}
static void PlayerPartnerHandleSetRawMonData(void)
@ -1237,7 +1237,7 @@ static void PlayerPartnerHandleLoadMonSprite(void)
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
sub_80A5C6C(gActiveBank, 2),
sub_80A6138(gActiveBank),
GetBankSpriteDefault_Y(gActiveBank),
sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240;
gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank;
@ -1268,7 +1268,7 @@ static void sub_81BD0E4(u8 bank, bool8 dontClearSubstituteBit)
gBankSpriteIds[bank] = CreateSprite(
&gUnknown_0202499C,
sub_80A5C6C(bank, 2),
sub_80A6138(bank),
GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank));
gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank];
@ -1308,7 +1308,7 @@ static void DoSwitchOutAnimation(void)
{
case 0:
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1;
break;
@ -1316,7 +1316,7 @@ static void DoSwitchOutAnimation(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON);
gBattleBankFunc[gActiveBank] = sub_81BB828;
}
break;
@ -1395,7 +1395,7 @@ static void PlayerPartnerHandleFaintAnimation(void)
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0)
{
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++;
}
else
@ -1403,7 +1403,7 @@ static void PlayerPartnerHandleFaintAnimation(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER);
gSprites[gBankSpriteIds[gActiveBank]].data1 = 0;
gSprites[gBankSpriteIds[gActiveBank]].data2 = 5;
@ -1470,7 +1470,7 @@ static void PlayerPartnerDoMoveAnimation(void)
&& !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8)
{
gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1;
break;
@ -1489,7 +1489,7 @@ static void PlayerPartnerDoMoveAnimation(void)
sub_805EB9C(1);
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2)
{
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0;
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3;
@ -1498,7 +1498,7 @@ static void PlayerPartnerDoMoveAnimation(void)
case 3:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
sub_805E394();
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
PlayerPartnerBufferExecCompleted();
@ -1661,7 +1661,7 @@ static void PlayerPartnerHandleStatusAnimation(void)
{
if (!mplay_80342A4(gActiveBank))
{
DoStatusAnimation(gBattleBufferA[gActiveBank][1],
InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBank][1],
gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24));
gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation;
}
@ -1773,7 +1773,7 @@ static void PlayerPartnerHandlePlayFanfareOrBGM(void)
{
if (gBattleBufferA[gActiveBank][3])
{
BattleMusicStop();
BattleStopLowHpSound();
PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
}
else
@ -1929,7 +1929,7 @@ static void PlayerPartnerHandleBattleAnimation(void)
u8 animationId = gBattleBufferA[gActiveBank][1];
u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8);
if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
PlayerPartnerBufferExecCompleted();
else
gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation;

View File

@ -433,7 +433,7 @@ static void sub_8186D9C(void)
{
FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]);
DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]);
sub_805EEE0(gActiveBank);
EnemyShadowCallbackToSetInvisible(gActiveBank);
SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]);
RecordedOpponentBufferExecCompleted();
}
@ -469,7 +469,7 @@ static void sub_8186EA4(void)
if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy)
{
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
gBattleBankFunc[gActiveBank] = sub_8186F14;
}
@ -1149,7 +1149,7 @@ static void RecordedOpponentHandleLoadMonSprite(void)
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
sub_80A5C6C(gActiveBank, 2),
sub_80A6138(gActiveBank),
GetBankSpriteDefault_Y(gActiveBank),
sub_80A82E4(gActiveBank));
@ -1184,7 +1184,7 @@ static void sub_81885D8(u8 bank, bool8 dontClearSubstituteBit)
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C,
sub_80A5C6C(bank, 2),
sub_80A6138(bank),
GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank));
gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank];
@ -1213,7 +1213,7 @@ static void RecordedOpponentHandleReturnMonToBall(void)
{
FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]);
DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]);
sub_805EEE0(gActiveBank);
EnemyShadowCallbackToSetInvisible(gActiveBank);
SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]);
RecordedOpponentBufferExecCompleted();
}
@ -1225,7 +1225,7 @@ static void DoSwitchOutAnimation(void)
{
case 0:
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1;
break;
@ -1233,7 +1233,7 @@ static void DoSwitchOutAnimation(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_OPPONENT_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_OPPONENT_MON);
gBattleBankFunc[gActiveBank] = sub_8186D9C;
}
break;
@ -1314,7 +1314,7 @@ static void RecordedOpponentHandleFaintAnimation(void)
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0)
{
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++;
}
else
@ -1386,7 +1386,7 @@ static void RecordedOpponentDoMoveAnimation(void)
&& !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8)
{
gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1;
break;
@ -1405,7 +1405,7 @@ static void RecordedOpponentDoMoveAnimation(void)
sub_805EB9C(1);
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2)
{
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0;
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3;
@ -1414,7 +1414,7 @@ static void RecordedOpponentDoMoveAnimation(void)
case 3:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
sub_805E394();
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
RecordedOpponentBufferExecCompleted();
@ -1530,7 +1530,7 @@ static void RecordedOpponentHandleStatusAnimation(void)
{
if (!mplay_80342A4(gActiveBank))
{
DoStatusAnimation(gBattleBufferA[gActiveBank][1],
InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBank][1],
gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24));
gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation;
}
@ -1642,7 +1642,7 @@ static void RecordedOpponentHandlePlayFanfareOrBGM(void)
{
if (gBattleBufferA[gActiveBank][3])
{
BattleMusicStop();
BattleStopLowHpSound();
PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
}
else
@ -1794,7 +1794,7 @@ static void RecordedOpponentHandleBattleAnimation(void)
u8 animationId = gBattleBufferA[gActiveBank][1];
u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8);
if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
RecordedOpponentBufferExecCompleted();
else
gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation;

View File

@ -272,9 +272,9 @@ static void sub_8189AA0(void)
FreeSpriteTilesByTag(0x27F9);
FreeSpritePaletteByTag(0x27F9);
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
if (IsDoubleBattle())
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], gActiveBank ^ BIT_MON);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], gActiveBank ^ BIT_MON);
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3;
gBattleBankFunc[gActiveBank] = sub_8189A58;
@ -397,7 +397,7 @@ static void CompleteOnHealthbarDone(void)
}
else
{
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
RecordedPlayerBufferExecCompleted();
}
}
@ -458,7 +458,7 @@ static void sub_818A2B4(void)
{
CopyBattleSpriteInvisibility(gActiveBank);
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
gBattleBankFunc[gActiveBank] = sub_818A328;
}
@ -484,7 +484,7 @@ static void sub_818A37C(void)
FreeSpritePaletteByTag(0x27F9);
CreateTask(c3_0802FDF4, 10);
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 0);
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL);
sub_8076918(gActiveBank);
@ -1111,7 +1111,7 @@ static void SetRecordedPlayerMonData(u8 monId)
break;
}
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
}
static void RecordedPlayerHandleSetRawMonData(void)
@ -1135,7 +1135,7 @@ static void RecordedPlayerHandleLoadMonSprite(void)
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
sub_80A5C6C(gActiveBank, 2),
sub_80A6138(gActiveBank),
GetBankSpriteDefault_Y(gActiveBank),
sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240;
gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank;
@ -1166,7 +1166,7 @@ static void sub_818BA6C(u8 bank, bool8 dontClearSubstituteBit)
gBankSpriteIds[bank] = CreateSprite(
&gUnknown_0202499C,
sub_80A5C6C(bank, 2),
sub_80A6138(bank),
GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank));
gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank];
@ -1206,7 +1206,7 @@ static void DoSwitchOutAnimation(void)
{
case 0:
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1;
break;
@ -1214,7 +1214,7 @@ static void DoSwitchOutAnimation(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON);
gBattleBankFunc[gActiveBank] = sub_818A1B0;
}
break;
@ -1313,7 +1313,7 @@ static void RecordedPlayerHandleFaintAnimation(void)
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0)
{
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++;
}
else
@ -1321,7 +1321,7 @@ static void RecordedPlayerHandleFaintAnimation(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
PlaySE12WithPanning(SE_POKE_DEAD, -64);
gSprites[gBankSpriteIds[gActiveBank]].data1 = 0;
gSprites[gBankSpriteIds[gActiveBank]].data2 = 5;
@ -1388,7 +1388,7 @@ static void RecordedPlayerDoMoveAnimation(void)
&& !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8)
{
gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1;
break;
@ -1407,7 +1407,7 @@ static void RecordedPlayerDoMoveAnimation(void)
sub_805EB9C(1);
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2)
{
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0;
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3;
@ -1416,7 +1416,7 @@ static void RecordedPlayerDoMoveAnimation(void)
case 3:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
sub_805E394();
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
RecordedPlayerBufferExecCompleted();
@ -1549,7 +1549,7 @@ static void RecordedPlayerHandleStatusAnimation(void)
{
if (!mplay_80342A4(gActiveBank))
{
DoStatusAnimation(gBattleBufferA[gActiveBank][1],
InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBank][1],
gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24));
gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation;
}
@ -1661,7 +1661,7 @@ static void RecordedPlayerHandlePlayFanfareOrBGM(void)
{
if (gBattleBufferA[gActiveBank][3])
{
BattleMusicStop();
BattleStopLowHpSound();
PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
}
else
@ -1813,7 +1813,7 @@ static void RecordedPlayerHandleBattleAnimation(void)
u8 animationId = gBattleBufferA[gActiveBank][1];
u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8);
if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
RecordedPlayerBufferExecCompleted();
else
gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation;

View File

@ -413,7 +413,7 @@ static void SafariHandleSuccessBallThrowAnim(void)
{
gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS;
gDoingBattleAnim = TRUE;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW);
gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone;
}
@ -423,7 +423,7 @@ static void SafariHandleBallThrowAnim(void)
gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId;
gDoingBattleAnim = TRUE;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW);
gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone;
}
@ -624,7 +624,7 @@ static void SafariHandlePlayFanfareOrBGM(void)
{
if (gBattleBufferA[gActiveBank][3])
{
BattleMusicStop();
BattleStopLowHpSound();
PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
}
else
@ -683,7 +683,7 @@ static void SafariHandleBattleAnimation(void)
u8 animationId = gBattleBufferA[gActiveBank][1];
u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8);
if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
SafariBufferExecCompleted();
else
gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation;

View File

@ -369,7 +369,7 @@ static void sub_8168818(void)
FreeSpritePaletteByTag(0x27F9);
CreateTask(c3_0802FDF4, 10);
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
WallyBufferExecCompleted();
}
@ -387,7 +387,7 @@ static void CompleteOnHealthbarDone(void)
}
else
{
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
WallyBufferExecCompleted();
}
}
@ -1029,7 +1029,7 @@ static void SetWallyMonData(u8 monId)
break;
}
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
}
static void WallyHandleSetRawMonData(void)
@ -1051,7 +1051,7 @@ static void WallyHandleReturnMonToBall(void)
{
if (gBattleBufferA[gActiveBank][1] == 0)
{
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON);
gBattleBankFunc[gActiveBank] = sub_8168A20;
}
else
@ -1112,7 +1112,7 @@ static void WallyHandleSuccessBallThrowAnim(void)
{
gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS;
gDoingBattleAnim = TRUE;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW);
gBattleBankFunc[gActiveBank] = CompleteOnFinishedAnimation;
}
@ -1122,7 +1122,7 @@ static void WallyHandleBallThrowAnim(void)
gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId;
gDoingBattleAnim = TRUE;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW);
gBattleBankFunc[gActiveBank] = CompleteOnFinishedAnimation;
}
@ -1163,7 +1163,7 @@ static void WallyDoMoveAnimation(void)
case 0:
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
{
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1;
break;
@ -1182,7 +1182,7 @@ static void WallyDoMoveAnimation(void)
sub_805EB9C(1);
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
{
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3;
}
@ -1190,7 +1190,7 @@ static void WallyDoMoveAnimation(void)
case 3:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{
sub_805E394();
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
WallyBufferExecCompleted();
@ -1429,7 +1429,7 @@ static void WallyHandlePlayFanfareOrBGM(void)
{
if (gBattleBufferA[gActiveBank][3])
{
BattleMusicStop();
BattleStopLowHpSound();
PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
}
else
@ -1496,7 +1496,7 @@ static void sub_816AA80(u8 bank)
sub_806A068(species, GetBankIdentity(bank));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C,
sub_80A5C6C(bank, 2),
sub_80A6138(bank),
GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank));
gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank];
@ -1565,7 +1565,7 @@ static void WallyHandleBattleAnimation(void)
u8 animationId = gBattleBufferA[gActiveBank][1];
u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8);
if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
WallyBufferExecCompleted();
else
gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation;

View File

@ -119,7 +119,7 @@ static void sub_818D0C4(u16 species, u32 otId, u32 personality, u8 paletteSlot,
if (paletteTag == 0xFFFF)
{
gUnknown_0203CCEC.paletteTag |= 0xFFFF;
LoadCompressedPalette(species_and_otid_get_pal(species, otId, personality), 0x100 + paletteSlot * 0x10, 0x20);
LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality), 0x100 + paletteSlot * 0x10, 0x20);
}
else
{
@ -146,7 +146,7 @@ static void sub_818D180(u16 species, u32 otId, u32 personality, u8 paletteSlot,
{
if (!isTrainer)
{
LoadCompressedPalette(species_and_otid_get_pal(species, otId, personality), paletteSlot * 0x10, 0x20);
LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality), paletteSlot * 0x10, 0x20);
}
else
{

1299
src/battle_gfx_sfx_util.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1239,11 +1239,11 @@ void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent)
}
ConvertIntToDecimalStringN(text + 6, value, STR_CONV_MODE_RIGHT_ALIGN, 3);
RenderTextFont9(gMonSpritesGfxPtr->fontPixels, 9, text);
RenderTextFont9(gMonSpritesGfxPtr->barFontGfx, 9, text);
for (i = 0; i < 3; i++)
{
CpuCopy32(&gMonSpritesGfxPtr->fontPixels[i * 64 + 32],
CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[i * 64 + 32],
(void*)((OBJ_VRAM0) + 32 * (gSprites[healthboxSpriteId].oam.tileNum + var + i)),
0x20);
}
@ -1308,19 +1308,19 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8
txtPtr = ConvertIntToDecimalStringN(text + 6, value, STR_CONV_MODE_RIGHT_ALIGN, 3);
if (!maxOrCurrent)
StringCopy(txtPtr, gText_Slash);
RenderTextFont9(gMonSpritesGfxPtr->fontPixels, 9, text);
RenderTextFont9(gMonSpritesGfxPtr->barFontGfx, 9, text);
for (i = var; i < var + 3; i++)
{
if (i < 3)
{
CpuCopy32(&gMonSpritesGfxPtr->fontPixels[((i - var) * 64) + 32],
CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[((i - var) * 64) + 32],
(void*)((OBJ_VRAM0) + 32 * (1 + gSprites[r7].oam.tileNum + i)),
0x20);
}
else
{
CpuCopy32(&gMonSpritesGfxPtr->fontPixels[((i - var) * 64) + 32],
CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[((i - var) * 64) + 32],
(void*)((OBJ_VRAM0 + 0x20) + 32 * (i + gSprites[r7].oam.tileNum)),
0x20);
}
@ -1328,7 +1328,7 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8
if (maxOrCurrent == HP_CURRENT)
{
CpuCopy32(&gMonSpritesGfxPtr->fontPixels[224],
CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[224],
(void*)((OBJ_VRAM0) + ((gSprites[r7].oam.tileNum + 4) * 32)),
0x20);
CpuFill32(0, (void*)((OBJ_VRAM0) + (gSprites[r7].oam.tileNum * 32)), 0x20);
@ -1350,15 +1350,15 @@ static void sub_80730D4(u8 healthboxSpriteId, struct Pokemon *mon)
{
u8 text[20];
s32 j, var2;
u8 *fontPixels;
u8 *barFontGfx;
u8 i, var, nature, healthboxSpriteId_2;
memcpy(text, sUnknown_0832C3C4, sizeof(sUnknown_0832C3C4));
fontPixels = &gMonSpritesGfxPtr->fontPixels[0x520 + (GetBankIdentity(gSprites[healthboxSpriteId].data6) * 384)];
barFontGfx = &gMonSpritesGfxPtr->barFontGfx[0x520 + (GetBankIdentity(gSprites[healthboxSpriteId].data6) * 384)];
var = 5;
nature = GetNature(mon);
StringCopy(text + 6, gNatureNamePointers[nature]);
RenderTextFont9(fontPixels, 9, text);
RenderTextFont9(barFontGfx, 9, text);
for (j = 6, i = 0; i < var; i++, j++)
{
@ -1371,18 +1371,18 @@ static void sub_80730D4(u8 healthboxSpriteId, struct Pokemon *mon)
else
elementId = 43;
CpuCopy32(GetHealthboxElementGfxPtr(elementId), fontPixels + (i * 64), 0x20);
CpuCopy32(GetHealthboxElementGfxPtr(elementId), barFontGfx + (i * 64), 0x20);
}
for (j = 1; j < var + 1; j++)
{
var2 = (gSprites[healthboxSpriteId].oam.tileNum + (j - (j / 8 * 8)) + (j / 8 * 64)) * 32;
CpuCopy32(fontPixels, (void*)(OBJ_VRAM0) + (var2), 0x20);
fontPixels += 0x20;
CpuCopy32(barFontGfx, (void*)(OBJ_VRAM0) + (var2), 0x20);
barFontGfx += 0x20;
var2 = (8 + gSprites[healthboxSpriteId].oam.tileNum + (j - (j / 8 * 8)) + (j / 8 * 64)) * 32;
CpuCopy32(fontPixels, (void*)(OBJ_VRAM0) + (var2), 0x20);
fontPixels += 0x20;
CpuCopy32(barFontGfx, (void*)(OBJ_VRAM0) + (var2), 0x20);
barFontGfx += 0x20;
}
healthboxSpriteId_2 = gSprites[healthboxSpriteId].data5;
@ -1390,20 +1390,20 @@ static void sub_80730D4(u8 healthboxSpriteId, struct Pokemon *mon)
ConvertIntToDecimalStringN(text + 9, gBattleStruct->field_7B, STR_CONV_MODE_RIGHT_ALIGN, 2);
text[5] = CHAR_SPACE;
text[8] = CHAR_SLASH;
RenderTextFont9(gMonSpritesGfxPtr->fontPixels, 9, text);
RenderTextFont9(gMonSpritesGfxPtr->barFontGfx, 9, text);
j = healthboxSpriteId_2; // needed to match for some reason
for (j = 0; j < 5; j++)
{
if (j <= 1)
{
CpuCopy32(&gMonSpritesGfxPtr->fontPixels[0x40 * j + 0x20],
CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[0x40 * j + 0x20],
(void*)(OBJ_VRAM0) + (gSprites[healthboxSpriteId_2].oam.tileNum + 2 + j) * 32,
32);
}
else
{
CpuCopy32(&gMonSpritesGfxPtr->fontPixels[0x40 * j + 0x20],
CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[0x40 * j + 0x20],
(void*)(OBJ_VRAM0 + 0xC0) + (j + gSprites[healthboxSpriteId_2].oam.tileNum) * 32,
32);
}
@ -2545,19 +2545,19 @@ u8 GetHPBarLevel(s16 hp, s16 maxhp)
if (hp == maxhp)
{
result = 4;
result = HP_BAR_FULL;
}
else
{
u8 fraction = GetScaledHPFraction(hp, maxhp, 48);
if (fraction > 24)
result = 3;
result = HP_BAR_GREEN;
else if (fraction > 9)
result = 2;
result = HP_BAR_YELLOW;
else if (fraction > 0)
result = 1;
result = HP_BAR_RED;
else
result = 0;
result = HP_BAR_EMPTY;
}
return result;

View File

@ -1068,22 +1068,33 @@ static const u8 sBallCatchBonuses[] =
20, 15, 10, 15 // Ultra, Great, Poke, Safari
};
// could be a 2d array or a struct
const ALIGNED(4) u8 gUnknown_0831C494[] =
const ALIGNED(4) u8 gUnknown_0831C494[][4] =
{
0x3d, 0x44, 0x3d, 0x44, 0x14, 0x2d, 0x54, 0x5c,
0x46, 0x55, 0x20, 0x5c, 0x26, 0x45, 0x46, 0x55,
0x14, 0x5a, 0x46, 0x5c, 0x1e, 0x32, 0x20, 0x5a,
0x38, 0x4e, 0x38, 0x4e, 0x19, 0x28, 0x4b, 0x5a,
0x45, 0x4b, 0x1c, 0x53, 0x23, 0x2d, 0x1d, 0x23,
0x3e, 0x48, 0x1e, 0x32, 0x3a, 0x5f, 0x58, 0x5e,
0x22, 0x2d, 0x1d, 0x28, 0x23, 0x28, 0x23, 0x5f,
0x38, 0x4e, 0x38, 0x4e, 0x23, 0x50, 0x22, 0x5e,
0x2c, 0x5e, 0x22, 0x28, 0x38, 0x4e, 0x38, 0x4e,
0x1e, 0x58, 0x1e, 0x58, 0x1e, 0x2b, 0x1b, 0x21,
0x28, 0x5a, 0x19, 0x57, 0x12, 0x58, 0x5a, 0x5f,
0x58, 0x5e, 0x16, 0x2a, 0x2a, 0x5c, 0x2a, 0x2f,
0x38, 0x4e, 0x38, 0x4e
{0x3d, 0x44, 0x3d, 0x44},
{0x14, 0x2d, 0x54, 0x5c},
{0x46, 0x55, 0x20, 0x5c},
{0x26, 0x45, 0x46, 0x55},
{0x14, 0x5a, 0x46, 0x5c},
{0x1e, 0x32, 0x20, 0x5a},
{0x38, 0x4e, 0x38, 0x4e},
{0x19, 0x28, 0x4b, 0x5a},
{0x45, 0x4b, 0x1c, 0x53},
{0x23, 0x2d, 0x1d, 0x23},
{0x3e, 0x48, 0x1e, 0x32},
{0x3a, 0x5f, 0x58, 0x5e},
{0x22, 0x2d, 0x1d, 0x28},
{0x23, 0x28, 0x23, 0x5f},
{0x38, 0x4e, 0x38, 0x4e},
{0x23, 0x50, 0x22, 0x5e},
{0x2c, 0x5e, 0x22, 0x28},
{0x38, 0x4e, 0x38, 0x4e},
{0x1e, 0x58, 0x1e, 0x58},
{0x1e, 0x2b, 0x1b, 0x21},
{0x28, 0x5a, 0x19, 0x57},
{0x12, 0x58, 0x5a, 0x5f},
{0x58, 0x5e, 0x16, 0x2a},
{0x2a, 0x5c, 0x2a, 0x2f},
{0x38, 0x4e, 0x38, 0x4e}
};
static const u8 sUnknown_0831C4F8[] =
@ -3533,7 +3544,7 @@ static void atk23_getexp(void)
// music change in wild battle after fainting a poke
if (!(gBattleTypeFlags & BATTLE_TYPE_TRAINER) && gBattleMons[0].hp && !gBattleStruct->wildVictorySong)
{
BattleMusicStop();
BattleStopLowHpSound();
PlayBGM(0x161);
gBattleStruct->wildVictorySong++;
}
@ -3628,7 +3639,7 @@ static void atk23_getexp(void)
if (gBattleBufferB[gActiveBank][0] == CONTROLLER_TWORETURNVALUES && gBattleBufferB[gActiveBank][1] == RET_VALUE_LEVELLED_UP)
{
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlePartyID[gActiveBank] == gBattleStruct->expGetterId)
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gActiveBank, gBattleStruct->expGetterId)

View File

@ -1234,12 +1234,12 @@ static void sub_806E6CC(u8 taskId)
DestroyTask(taskId);
}
const u8 *pokemon_get_pal(struct Pokemon *mon)
const u8 *GetMonFrontSpritePal(struct Pokemon *mon)
{
u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0);
u32 otId = GetMonData(mon, MON_DATA_OT_ID, 0);
u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, 0);
return species_and_otid_get_pal(species, otId, personality);
return GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality);
}
// Extracts the upper 16 bits of a 32-bit number
@ -1248,7 +1248,7 @@ const u8 *pokemon_get_pal(struct Pokemon *mon)
// Extracts the lower 16 bits of a 32-bit number
#define LOHALF(n) ((n) & 0xFFFF)
const u8 *species_and_otid_get_pal(u16 species, u32 otId, u32 personality)
const u8 *GetFrontSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 personality)
{
u32 shinyValue;

View File

@ -37,8 +37,8 @@ extern const union AnimCmd * const * const gMonAnimationsSpriteAnimsPtrTable[];
extern void dp12_8087EA4(void);
extern void trs_config(void);
extern bool8 IsDoubleBattle(void);
extern u8 sub_80A614C(u8 bank);
extern u8 sub_80A6138(u8 bank);
extern u8 GetSubstituteSpriteDefault_Y(u8 bank);
extern u8 GetBankSpriteDefault_Y(u8 bank);
extern u8 sub_80A82E4(u8 bank);
extern void sub_806A068(u16 species, u8 bankIdentity);
extern void sub_806A12C(u16 backPicId, u8 bankIdentity);
@ -104,7 +104,7 @@ static void CB2_ReshowBattleScreenAfterMenu(void)
gReservedSpritePaletteCount = 4;
break;
case 5:
sub_805E350();
ClearSpritesHealthboxAnimData();
break;
case 6:
if (BattleLoadAllHealthBoxesGfx(gBattleScripting.reshowHelperState))
@ -217,7 +217,7 @@ static bool8 LoadBankSpriteGfx(u8 bank)
if (!gBattleSpritesDataPtr->bankData[bank].behindSubstitute)
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank);
else
BattleLoadSubstituteSpriteGfx(bank, FALSE);
BattleLoadSubstituteOrMonSpriteGfx(bank, FALSE);
}
else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI && bank == 0)
DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, bank);
@ -226,7 +226,7 @@ static bool8 LoadBankSpriteGfx(u8 bank)
else if (!gBattleSpritesDataPtr->bankData[bank].behindSubstitute)
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[bank]], bank);
else
BattleLoadSubstituteSpriteGfx(bank, FALSE);
BattleLoadSubstituteOrMonSpriteGfx(bank, FALSE);
gBattleScripting.reshowHelperState = 0;
}
@ -250,9 +250,9 @@ static void CreateBankSprite(u8 bank)
u8 posY;
if (gBattleSpritesDataPtr->bankData[bank].behindSubstitute)
posY = sub_80A614C(bank);
posY = GetSubstituteSpriteDefault_Y(bank);
else
posY = sub_80A6138(bank);
posY = GetBankSpriteDefault_Y(bank);
if (GetBankSide(bank) != SIDE_PLAYER)
{