From a392cca92811c27524f1d10cd69d2fc96ea69b74 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 22 Jan 2021 23:22:37 -0500 Subject: [PATCH] Misc battle documentation --- include/battle.h | 4 +- include/battle_anim.h | 2 +- include/battle_gfx_sfx_util.h | 1 - include/battle_main.h | 15 +- include/data.h | 16 +- include/pokemon.h | 4 +- src/battle_ai_script_commands.c | 60 +++---- src/battle_anim_effects_3.c | 6 +- src/battle_anim_mons.c | 35 ++-- src/battle_anim_utility_funcs.c | 6 +- src/battle_bg.c | 4 +- src/battle_gfx_sfx_util.c | 8 +- src/battle_intro.c | 129 ++++++------- src/battle_main.c | 164 ++++++++--------- src/battle_message.c | 2 +- src/contest.c | 2 +- src/data.c | 22 ++- src/evolution_scene.c | 4 +- src/pokeball.c | 142 ++++++++------- src/pokemon.c | 308 ++++++++++++++------------------ src/pokemon_animation.c | 2 +- src/pokemon_jump.c | 8 +- src/pokemon_summary_screen.c | 2 +- src/trainer_pokemon_sprites.c | 4 +- 24 files changed, 456 insertions(+), 494 deletions(-) diff --git a/include/battle.h b/include/battle.h index 5070ab3d6e..c0baaf313b 100644 --- a/include/battle.h +++ b/include/battle.h @@ -421,8 +421,8 @@ struct BattleStruct u16 castformPalette[MAX_BATTLERS_COUNT][16]; u8 field_180; // weird field, used in battle_main.c, once accessed as an array of u32 overwriting the field below u8 field_181; - u8 field_182; - u8 field_183; + u8 vsScreenHealthFlagsLo; + u8 vsScreenHealthFlagsHi; // Last bit is 'has frontier pass' struct BattleEnigmaBerry battleEnigmaBerry; u8 wishPerishSongState; u8 wishPerishSongBattlerId; diff --git a/include/battle_anim.h b/include/battle_anim.h index 096d533e25..65ff449d4c 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -148,7 +148,7 @@ void PrepareAffineAnimInTaskData(struct Task *task, u8 spriteId, const union Aff bool8 RunAffineAnimFromTaskData(struct Task *task); void AnimThrowProjectile(struct Sprite *sprite); void sub_80A6BFC(struct BattleAnimBgData *unk, u8 unused); -u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, u32 a10); +u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, bool32 ignoreDeoxysForm); void sub_80A749C(struct Sprite *sprite); void TradeMenuBouncePartySprites(struct Sprite *sprite); void DestroyAnimVisualTaskAndDisableBlend(u8 taskId); diff --git a/include/battle_gfx_sfx_util.h b/include/battle_gfx_sfx_util.h index 0a14e72c47..e3f549aa90 100644 --- a/include/battle_gfx_sfx_util.h +++ b/include/battle_gfx_sfx_util.h @@ -5,7 +5,6 @@ void AllocateBattleSpritesData(void); void FreeBattleSpritesData(void); u16 ChooseMoveAndTargetInBattlePalace(void); void SpriteCB_WaitForBattlerBallReleaseAnim(struct Sprite *sprite); -void sub_805D770(struct Sprite *sprite, bool8 arg1); void SpriteCB_TrainerSlideIn(struct Sprite *sprite); void InitAndLaunchChosenStatusAnimation(bool8 isStatus2, u32 status); bool8 TryHandleLaunchBattleTableAnimation(u8 activeBattlerId, u8 attacker, u8 target, u8 tableId, u16 argument); diff --git a/include/battle_main.h b/include/battle_main.h index 1060c4660c..78cf353dfc 100644 --- a/include/battle_main.h +++ b/include/battle_main.h @@ -49,19 +49,18 @@ void CB2_QuitRecordedBattle(void); void sub_8038528(struct Sprite* sprite); void sub_8038A04(void); // unused void VBlankCB_Battle(void); -void nullsub_17(struct Sprite *sprite); -void sub_8038B74(struct Sprite *sprite); +void SpriteCB_VsLetterDummy(struct Sprite *sprite); +void SpriteCB_VsLetterInit(struct Sprite *sprite); void CB2_InitEndLinkBattle(void); -u32 sub_80391E0(u8 arrayId, u8 caseId); -u32 sub_80397C4(u32 setId, u32 tableId); +u32 GetBattleBgTemplateData(u8 arrayId, u8 caseId); +u32 GetBattleWindowTemplatePixelWidth(u32 setId, u32 tableId); void SpriteCb_WildMon(struct Sprite *sprite); void SpriteCallbackDummy_2(struct Sprite *sprite); void SpriteCB_FaintOpponentMon(struct Sprite *sprite); void SpriteCb_ShowAsMoveTarget(struct Sprite *sprite); void SpriteCb_HideAsMoveTarget(struct Sprite *sprite); void SpriteCb_OpponentMonFromBall(struct Sprite *sprite); -void sub_8039BB4(struct Sprite *sprite); -void sub_80105DC(struct Sprite *sprite); +void SpriteCB_BattleSpriteStartSlideLeft(struct Sprite *sprite); void SpriteCB_FaintSlideAnim(struct Sprite *sprite); void DoBounceEffect(u8 battlerId, u8 b, s8 c, s8 d); void EndBounceEffect(u8 battlerId, bool8 b); @@ -86,8 +85,8 @@ void SpecialStatusesClear(void); extern struct UnknownPokemonStruct4 gMultiPartnerParty[MULTI_PARTY_SIZE]; extern const struct SpriteTemplate gUnknown_0831AC88; -extern const struct OamData gOamData_831ACA8; -extern const struct OamData gOamData_831ACB0; +extern const struct OamData gOamData_BattleSpriteOpponentSide; +extern const struct OamData gOamData_BattleSpritePlayerSide; extern const u8 gTypeEffectiveness[336]; extern const u8 gTypeNames[NUMBER_OF_MON_TYPES][TYPE_NAME_LENGTH + 1]; extern const struct TrainerMoney gTrainerMoneyTable[]; diff --git a/include/data.h b/include/data.h index 260c18152c..2f8c447463 100644 --- a/include/data.h +++ b/include/data.h @@ -69,13 +69,13 @@ struct Trainer #define TRAINER_ENCOUNTER_MUSIC(trainer)((gTrainers[trainer].encounterMusic_gender & 0x7F)) -extern const u16 gUnknown_082FF1D8[]; -extern const u32 gUnknown_082FF1F8[]; +extern const u16 gMinigameDigits_Pal[]; +extern const u32 gMinigameDigits_Gfx[]; -extern const struct SpriteFrameImage gUnknown_082FF3A8[]; -extern const struct SpriteFrameImage gUnknown_082FF3C8[]; -extern const struct SpriteFrameImage gUnknown_082FF3E8[]; -extern const struct SpriteFrameImage gUnknown_082FF408[]; +extern const struct SpriteFrameImage gBattlerPicTable_PlayerLeft[]; +extern const struct SpriteFrameImage gBattlerPicTable_OpponentLeft[]; +extern const struct SpriteFrameImage gBattlerPicTable_PlayerRight[]; +extern const struct SpriteFrameImage gBattlerPicTable_OpponentRight[]; extern const struct SpriteFrameImage gTrainerBackPicTable_Brendan[]; extern const struct SpriteFrameImage gTrainerBackPicTable_May[]; extern const struct SpriteFrameImage gTrainerBackPicTable_Red[]; @@ -85,8 +85,8 @@ extern const struct SpriteFrameImage gTrainerBackPicTable_RubySapphireMay[]; extern const struct SpriteFrameImage gTrainerBackPicTable_Wally[]; extern const struct SpriteFrameImage gTrainerBackPicTable_Steven[]; -extern const union AffineAnimCmd *const gUnknown_082FF618[]; -extern const union AffineAnimCmd *const gUnknown_082FF694[]; +extern const union AffineAnimCmd *const gAffineAnims_BattleSpritePlayerSide[]; +extern const union AffineAnimCmd *const gAffineAnims_BattleSpriteOpponentSide[]; extern const union AffineAnimCmd *const gUnknown_082FF6C0[]; extern const union AnimCmd *const gUnknown_082FF70C[]; diff --git a/include/pokemon.h b/include/pokemon.h index 0ff635a3fa..654af30314 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -266,7 +266,7 @@ extern const u8 gPPUpSetMask[]; extern const u8 gPPUpAddMask[]; extern const u8 gStatStageRatios[MAX_STAT_STAGE + 1][2]; extern const u16 gLinkPlayerFacilityClasses[]; -extern const struct SpriteTemplate gUnknown_08329D98[]; +extern const struct SpriteTemplate gBattlerSpriteTemplates[]; extern const s8 gNatureStatTable[][5]; void ZeroBoxMonData(struct BoxPokemon *boxMon); @@ -287,7 +287,7 @@ void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 m void CreateMonWithEVSpreadNatureOTID(struct Pokemon *mon, u16 species, u8 level, u8 nature, u8 fixedIV, u8 evSpread, u32 otId); void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerPokemon *dest); void CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId); -bool8 sub_80688F8(u8 caseId, u8 battlerId); +bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battlerId); void SetDeoxysStats(void); u16 GetUnionRoomTrainerPic(void); u16 GetUnionRoomTrainerClass(void); diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 10eb013fe4..8dc939919b 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -95,16 +95,16 @@ static void Cmd_if_equal_(void); static void Cmd_if_not_equal_(void); static void Cmd_if_user_goes(void); static void Cmd_if_user_doesnt_go(void); -static void Cmd_nullsub_2A(void); -static void Cmd_nullsub_2B(void); +static void Cmd_nop_2A(void); +static void Cmd_nop_2B(void); static void Cmd_count_usable_party_mons(void); static void Cmd_get_considered_move(void); static void Cmd_get_considered_move_effect(void); static void Cmd_get_ability(void); static void Cmd_get_highest_type_effectiveness(void); static void Cmd_if_type_effectiveness(void); -static void Cmd_nullsub_32(void); -static void Cmd_nullsub_33(void); +static void Cmd_nop_32(void); +static void Cmd_nop_33(void); static void Cmd_if_status_in_party(void); static void Cmd_if_status_not_in_party(void); static void Cmd_get_weather(void); @@ -135,12 +135,12 @@ static void Cmd_get_move_type_from_result(void); static void Cmd_get_move_power_from_result(void); static void Cmd_get_move_effect_from_result(void); static void Cmd_get_protect_count(void); -static void Cmd_nullsub_52(void); -static void Cmd_nullsub_53(void); -static void Cmd_nullsub_54(void); -static void Cmd_nullsub_55(void); -static void Cmd_nullsub_56(void); -static void Cmd_nullsub_57(void); +static void Cmd_nop_52(void); +static void Cmd_nop_53(void); +static void Cmd_nop_54(void); +static void Cmd_nop_55(void); +static void Cmd_nop_56(void); +static void Cmd_nop_57(void); static void Cmd_call(void); static void Cmd_goto(void); static void Cmd_end(void); @@ -204,16 +204,16 @@ static const BattleAICmdFunc sBattleAICmdTable[] = Cmd_if_not_equal_, // 0x27 Cmd_if_user_goes, // 0x28 Cmd_if_user_doesnt_go, // 0x29 - Cmd_nullsub_2A, // 0x2A - Cmd_nullsub_2B, // 0x2B + Cmd_nop_2A, // 0x2A + Cmd_nop_2B, // 0x2B Cmd_count_usable_party_mons, // 0x2C Cmd_get_considered_move, // 0x2D Cmd_get_considered_move_effect, // 0x2E Cmd_get_ability, // 0x2F Cmd_get_highest_type_effectiveness, // 0x30 Cmd_if_type_effectiveness, // 0x31 - Cmd_nullsub_32, // 0x32 - Cmd_nullsub_33, // 0x33 + Cmd_nop_32, // 0x32 + Cmd_nop_33, // 0x33 Cmd_if_status_in_party, // 0x34 Cmd_if_status_not_in_party, // 0x35 Cmd_get_weather, // 0x36 @@ -244,12 +244,12 @@ static const BattleAICmdFunc sBattleAICmdTable[] = Cmd_get_move_power_from_result, // 0x4F Cmd_get_move_effect_from_result, // 0x50 Cmd_get_protect_count, // 0x51 - Cmd_nullsub_52, // 0x52 - Cmd_nullsub_53, // 0x53 - Cmd_nullsub_54, // 0x54 - Cmd_nullsub_55, // 0x55 - Cmd_nullsub_56, // 0x56 - Cmd_nullsub_57, // 0x57 + Cmd_nop_52, // 0x52 + Cmd_nop_53, // 0x53 + Cmd_nop_54, // 0x54 + Cmd_nop_55, // 0x55 + Cmd_nop_56, // 0x56 + Cmd_nop_57, // 0x57 Cmd_call, // 0x58 Cmd_goto, // 0x59 Cmd_end, // 0x5A @@ -1278,11 +1278,11 @@ static void Cmd_if_user_doesnt_go(void) gAIScriptPtr += 6; } -static void Cmd_nullsub_2A(void) +static void Cmd_nop_2A(void) { } -static void Cmd_nullsub_2B(void) +static void Cmd_nop_2B(void) { } @@ -1539,11 +1539,11 @@ static void Cmd_if_type_effectiveness(void) gAIScriptPtr += 6; } -static void Cmd_nullsub_32(void) +static void Cmd_nop_32(void) { } -static void Cmd_nullsub_33(void) +static void Cmd_nop_33(void) { } @@ -2134,27 +2134,27 @@ static void Cmd_get_protect_count(void) gAIScriptPtr += 2; } -static void Cmd_nullsub_52(void) +static void Cmd_nop_52(void) { } -static void Cmd_nullsub_53(void) +static void Cmd_nop_53(void) { } -static void Cmd_nullsub_54(void) +static void Cmd_nop_54(void) { } -static void Cmd_nullsub_55(void) +static void Cmd_nop_55(void) { } -static void Cmd_nullsub_56(void) +static void Cmd_nop_56(void) { } -static void Cmd_nullsub_57(void) +static void Cmd_nop_57(void) { } diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index f73a2dee74..7be5fa31c6 100755 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -2321,7 +2321,7 @@ void AnimTask_TransformMon(u8 taskId) if (IsSpeciesNotUnown(gContestResources->moveAnim->targetSpecies)) gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gUnknown_082FF6C0; else - gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gUnknown_082FF694; + gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gAffineAnims_BattleSpriteOpponentSide; StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[gBattleAnimAttacker]], 0); } @@ -3248,7 +3248,7 @@ void AnimTask_RolePlaySilhouette(u8 taskId) coord1 = GetBattlerSpriteCoord(gBattleAnimAttacker, 0); coord2 = GetBattlerSpriteCoord(gBattleAnimAttacker, 1); - spriteId = sub_80A8394(species, isBackPic, 0, coord1 + xOffset, coord2, 5, personality, otId, gBattleAnimTarget, 1); + spriteId = CreateAdditionalMonSpriteForMoveAnim(species, isBackPic, 0, coord1 + xOffset, coord2, 5, personality, otId, gBattleAnimTarget, TRUE); gSprites[spriteId].oam.priority = priority; gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND; @@ -5066,7 +5066,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId) } } - spriteId2 = sub_80A8394(species, isBackPic, 0, x, GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y), subpriority, personality, otId, gBattleAnimAttacker, 0); + spriteId2 = CreateAdditionalMonSpriteForMoveAnim(species, isBackPic, 0, x, GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y), subpriority, personality, otId, gBattleAnimAttacker, FALSE); if (gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies != SPECIES_NONE) BlendPalette((gSprites[spriteId2].oam.paletteNum * 16) | 0x100, 16, 6, RGB_WHITE); diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index 3401c315ae..06ebf11057 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -79,11 +79,15 @@ static const u8 sCastformBackSpriteYCoords[] = 0, // HAIL }; -static const struct SpriteTemplate sUnknown_08525F90[] = +// Placeholders for pokemon sprites to be created for a move animation effect (e.g. Role Play / Snatch) +#define TAG_MOVE_EFFECT_MON_1 55125 +#define TAG_MOVE_EFFECT_MON_2 55126 + +static const struct SpriteTemplate sSpriteTemplate_MoveEffectMons[] = { { - .tileTag = 55125, - .paletteTag = 55125, + .tileTag = TAG_MOVE_EFFECT_MON_1, + .paletteTag = TAG_MOVE_EFFECT_MON_1, .oam = &gOamData_AffineNormal_ObjNormal_64x64, .anims = gDummySpriteAnimTable, .images = NULL, @@ -91,8 +95,8 @@ static const struct SpriteTemplate sUnknown_08525F90[] = .callback = SpriteCallbackDummy, }, { - .tileTag = 55126, - .paletteTag = 55126, + .tileTag = TAG_MOVE_EFFECT_MON_2, + .paletteTag = TAG_MOVE_EFFECT_MON_2, .oam = &gOamData_AffineNormal_ObjNormal_64x64, .anims = gDummySpriteAnimTable, .images = NULL, @@ -101,10 +105,10 @@ static const struct SpriteTemplate sUnknown_08525F90[] = } }; -static const struct SpriteSheet sUnknown_08525FC0[] = +static const struct SpriteSheet sSpriteSheet_MoveEffectMons[] = { - { gMiscBlank_Gfx, 0x800, 55125, }, - { gMiscBlank_Gfx, 0x800, 55126, }, + { gMiscBlank_Gfx, 0x800, TAG_MOVE_EFFECT_MON_1, }, + { gMiscBlank_Gfx, 0x800, TAG_MOVE_EFFECT_MON_2, }, }; u8 GetBattlerSpriteCoord(u8 battlerId, u8 coordType) @@ -2021,18 +2025,19 @@ u8 GetBattlerSpriteBGPriorityRank(u8 battlerId) return 1; } -u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, u32 a10) +// Create pokemon sprite to be used for a move animation effect (e.g. Role Play / Snatch) +u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, bool32 ignoreDeoxysForm) { u8 spriteId; - u16 sheet = LoadSpriteSheet(&sUnknown_08525FC0[a3]); - u16 palette = AllocSpritePalette(sUnknown_08525F90[a3].paletteTag); + u16 sheet = LoadSpriteSheet(&sSpriteSheet_MoveEffectMons[id]); + u16 palette = AllocSpritePalette(sSpriteTemplate_MoveEffectMons[id].paletteTag); if (gMonSpritesGfxPtr != NULL && gMonSpritesGfxPtr->buffer == NULL) gMonSpritesGfxPtr->buffer = AllocZeroed(0x2000); if (!isBackpic) { LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), (palette * 0x10) + 0x100, 0x20); - if (a10 == 1 || sub_80688F8(5, battlerId) == 1 || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != 0) + if (ignoreDeoxysForm == TRUE || ShouldIgnoreDeoxysForm(5, battlerId) == TRUE || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != 0) LoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species], gMonSpritesGfxPtr->buffer, species, @@ -2048,7 +2053,7 @@ u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority else { LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), (palette * 0x10) + 0x100, 0x20); - if (a10 == 1 || sub_80688F8(5, battlerId) == 1 || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != 0) + if (ignoreDeoxysForm == TRUE || ShouldIgnoreDeoxysForm(5, battlerId) == TRUE || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != 0) LoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[species], gMonSpritesGfxPtr->buffer, species, @@ -2066,9 +2071,9 @@ u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority FREE_AND_SET_NULL(gMonSpritesGfxPtr->buffer); if (!isBackpic) - spriteId = CreateSprite(&sUnknown_08525F90[a3], x, y + gMonFrontPicCoords[species].y_offset, subpriority); + spriteId = CreateSprite(&sSpriteTemplate_MoveEffectMons[id], x, y + gMonFrontPicCoords[species].y_offset, subpriority); else - spriteId = CreateSprite(&sUnknown_08525F90[a3], x, y + gMonBackPicCoords[species].y_offset, subpriority); + spriteId = CreateSprite(&sSpriteTemplate_MoveEffectMons[id], x, y + gMonBackPicCoords[species].y_offset, subpriority); if (IsContest()) { diff --git a/src/battle_anim_utility_funcs.c b/src/battle_anim_utility_funcs.c index 9790cf9eac..c1cd971455 100644 --- a/src/battle_anim_utility_funcs.c +++ b/src/battle_anim_utility_funcs.c @@ -40,10 +40,10 @@ static void AnimTask_WaitAndRestoreVisibility(u8); const u16 gUnknown_08597418 = RGB(31, 31, 31); -// These belong in battle_intro.c, but there putting them there causes 2 bytes of alignment padding +// These belong in battle_intro.c, but putting them there causes 2 bytes of alignment padding // between the two .rodata segments. Perhaps battle_intro.c actually belongs in this file, too. -const u8 gUnknown_0859741A[] = {REG_OFFSET_BG0CNT, REG_OFFSET_BG1CNT, REG_OFFSET_BG2CNT, REG_OFFSET_BG3CNT}; -const u8 gUnknown_0859741E[] = {REG_OFFSET_BG0CNT, REG_OFFSET_BG1CNT, REG_OFFSET_BG2CNT, REG_OFFSET_BG3CNT}; +const u8 gBattleAnimBgCntSet[] = {REG_OFFSET_BG0CNT, REG_OFFSET_BG1CNT, REG_OFFSET_BG2CNT, REG_OFFSET_BG3CNT}; +const u8 gBattleAnimBgCntGet[] = {REG_OFFSET_BG0CNT, REG_OFFSET_BG1CNT, REG_OFFSET_BG2CNT, REG_OFFSET_BG3CNT}; void AnimTask_BlendBattleAnimPal(u8 taskId) { diff --git a/src/battle_bg.c b/src/battle_bg.c index ad992f7b33..af0e374e20 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -100,7 +100,7 @@ static const struct SpriteTemplate sVsLetter_V_SpriteTemplate = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = sVsLetterAffineAnimTable, - .callback = nullsub_17 + .callback = SpriteCB_VsLetterDummy }; static const struct SpriteTemplate sVsLetter_S_SpriteTemplate = @@ -111,7 +111,7 @@ static const struct SpriteTemplate sVsLetter_S_SpriteTemplate = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = sVsLetterAffineAnimTable, - .callback = nullsub_17 + .callback = SpriteCB_VsLetterDummy }; static const struct CompressedSpriteSheet sVsLettersSpriteSheet = diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index b2be5e04f9..d9e1cdc2f2 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -357,9 +357,9 @@ void SpriteCB_WaitForBattlerBallReleaseAnim(struct Sprite *sprite) } } -void sub_805D770(struct Sprite *sprite, bool8 arg1) +static void UnusedDoBattleSpriteAffineAnim(struct Sprite *sprite, bool8 arg1) { - sprite->animPaused = 1; + sprite->animPaused = TRUE; sprite->callback = SpriteCallbackDummy; if (!arg1) @@ -629,7 +629,7 @@ void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId) otId = GetMonData(mon, MON_DATA_OT_ID); position = GetBattlerPosition(battlerId); - if (sub_80688F8(1, battlerId) == 1 || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE) + if (ShouldIgnoreDeoxysForm(1, battlerId) == TRUE || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE) { HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[species], gMonSpritesGfxPtr->sprites.ptr[position], @@ -1255,7 +1255,7 @@ void AllocateMonSpritesGfx(void) for (i = 0; i < MAX_BATTLERS_COUNT; i++) { gMonSpritesGfxPtr->sprites.ptr[i] = gMonSpritesGfxPtr->firstDecompressed + (i * 0x2000); - *(gMonSpritesGfxPtr->templates + i) = gUnknown_08329D98[i]; + *(gMonSpritesGfxPtr->templates + i) = gBattlerSpriteTemplates[i]; for (j = 0; j < 4; j++) { diff --git a/src/battle_intro.c b/src/battle_intro.c index 2d5e602d18..c76e5bc31d 100644 --- a/src/battle_intro.c +++ b/src/battle_intro.c @@ -13,8 +13,8 @@ static EWRAM_DATA u16 sBgCnt = 0; -extern const u8 gUnknown_0859741A[]; -extern const u8 gUnknown_0859741E[]; +extern const u8 gBattleAnimBgCntSet[]; +extern const u8 gBattleAnimBgCntGet[]; static void BattleIntroSlide1(u8); static void BattleIntroSlide2(u8); @@ -24,23 +24,23 @@ static void BattleIntroSlidePartner(u8); static const TaskFunc sBattleIntroSlideFuncs[] = { - BattleIntroSlide1, // BATTLE_TERRAIN_GRASS - BattleIntroSlide1, // BATTLE_TERRAIN_LONG_GRASS - BattleIntroSlide2, // BATTLE_TERRAIN_SAND - BattleIntroSlide2, // BATTLE_TERRAIN_UNDERWATER - BattleIntroSlide2, // BATTLE_TERRAIN_WATER - BattleIntroSlide1, // BATTLE_TERRAIN_POND - BattleIntroSlide1, // BATTLE_TERRAIN_MOUNTAIN - BattleIntroSlide1, // BATTLE_TERRAIN_CAVE - BattleIntroSlide3, // BATTLE_TERRAIN_BUILDING - BattleIntroSlide3, // BATTLE_TERRAIN_PLAIN + [BATTLE_TERRAIN_GRASS] = BattleIntroSlide1, + [BATTLE_TERRAIN_LONG_GRASS] = BattleIntroSlide1, + [BATTLE_TERRAIN_SAND] = BattleIntroSlide2, + [BATTLE_TERRAIN_UNDERWATER] = BattleIntroSlide2, + [BATTLE_TERRAIN_WATER] = BattleIntroSlide2, + [BATTLE_TERRAIN_POND] = BattleIntroSlide1, + [BATTLE_TERRAIN_MOUNTAIN] = BattleIntroSlide1, + [BATTLE_TERRAIN_CAVE] = BattleIntroSlide1, + [BATTLE_TERRAIN_BUILDING] = BattleIntroSlide3, + [BATTLE_TERRAIN_PLAIN] = BattleIntroSlide3, }; void SetAnimBgAttribute(u8 bgId, u8 attributeId, u8 value) { if (bgId < 4) { - sBgCnt = GetGpuReg(gUnknown_0859741A[bgId]); + sBgCnt = GetGpuReg(gBattleAnimBgCntSet[bgId]); switch (attributeId) { case BG_ANIM_SCREEN_SIZE: @@ -66,7 +66,7 @@ void SetAnimBgAttribute(u8 bgId, u8 attributeId, u8 value) break; } - SetGpuReg(gUnknown_0859741A[bgId], sBgCnt); + SetGpuReg(gBattleAnimBgCntSet[bgId], sBgCnt); } } @@ -76,7 +76,7 @@ int GetAnimBgAttribute(u8 bgId, u8 attributeId) if (bgId < 4) { - bgCnt = GetGpuReg(gUnknown_0859741E[bgId]); + bgCnt = GetGpuReg(gBattleAnimBgCntGet[bgId]); switch (attributeId) { case BG_ANIM_SCREEN_SIZE: @@ -99,6 +99,9 @@ int GetAnimBgAttribute(u8 bgId, u8 attributeId) return 0; } +#define tState data[0] +#define tTerrain data[1] + void HandleIntroSlide(u8 terrain) { u8 taskId; @@ -125,8 +128,8 @@ void HandleIntroSlide(u8 terrain) taskId = CreateTask(sBattleIntroSlideFuncs[terrain], 0); } - gTasks[taskId].data[0] = 0; - gTasks[taskId].data[1] = terrain; + gTasks[taskId].tState = 0; + gTasks[taskId].tTerrain = terrain; gTasks[taskId].data[2] = 0; gTasks[taskId].data[3] = 0; gTasks[taskId].data[4] = 0; @@ -134,7 +137,7 @@ void HandleIntroSlide(u8 terrain) gTasks[taskId].data[6] = 0; } -void sub_811828C(u8 taskId) +static void BattleIntroSlideEnd(u8 taskId) { DestroyTask(taskId); gBattle_BG1_X = 0; @@ -153,24 +156,24 @@ static void BattleIntroSlide1(u8 taskId) int i; gBattle_BG1_X += 6; - switch (gTasks[taskId].data[0]) + switch (gTasks[taskId].tState) { case 0: if (gBattleTypeFlags & BATTLE_TYPE_LINK) { gTasks[taskId].data[2] = 16; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } else { gTasks[taskId].data[2] = 1; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } break; case 1: if (--gTasks[taskId].data[2] == 0) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR); } break; @@ -178,7 +181,7 @@ static void BattleIntroSlide1(u8 taskId) gBattle_WIN0V -= 0xFF; if ((gBattle_WIN0V & 0xFF00) == 0x3000) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; gTasks[taskId].data[2] = 240; gTasks[taskId].data[3] = 32; gIntroSlideFlags &= ~1; @@ -191,7 +194,7 @@ static void BattleIntroSlide1(u8 taskId) } else { - if (gTasks[taskId].data[1] == 1) + if (gTasks[taskId].tTerrain == BATTLE_TERRAIN_LONG_GRASS) { if (gBattle_BG1_Y != 0xFFB0) gBattle_BG1_Y -= 2; @@ -219,7 +222,7 @@ static void BattleIntroSlide1(u8 taskId) if (!gTasks[taskId].data[2]) { gScanlineEffect.state = 3; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; CpuFill32(0, (void *)BG_SCREEN_ADDR(28), BG_SCREEN_SIZE); SetBgAttribute(1, BG_ATTR_CHARBASEINDEX, 0); SetBgAttribute(2, BG_ATTR_CHARBASEINDEX, 0); @@ -228,7 +231,7 @@ static void BattleIntroSlide1(u8 taskId) } break; case 4: - sub_811828C(taskId); + BattleIntroSlideEnd(taskId); break; } } @@ -237,18 +240,18 @@ static void BattleIntroSlide2(u8 taskId) { int i; - switch (gTasks[taskId].data[1]) + switch (gTasks[taskId].tTerrain) { - case 2: - case 4: + case BATTLE_TERRAIN_SAND: + case BATTLE_TERRAIN_WATER: gBattle_BG1_X += 8; break; - case 3: + case BATTLE_TERRAIN_UNDERWATER: gBattle_BG1_X += 6; break; } - if (gTasks[taskId].data[1] == 4) + if (gTasks[taskId].tTerrain == BATTLE_TERRAIN_WATER) { gBattle_BG1_Y = Cos2(gTasks[taskId].data[6]) / 512 - 8; if (gTasks[taskId].data[6] < 180) @@ -260,25 +263,25 @@ static void BattleIntroSlide2(u8 taskId) gTasks[taskId].data[6] = 0; } - switch (gTasks[taskId].data[0]) + switch (gTasks[taskId].tState) { case 0: gTasks[taskId].data[4] = 16; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { gTasks[taskId].data[2] = 16; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } else { gTasks[taskId].data[2] = 1; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } break; case 1: if (--gTasks[taskId].data[2] == 0) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR); } break; @@ -286,7 +289,7 @@ static void BattleIntroSlide2(u8 taskId) gBattle_WIN0V -= 0xFF; if ((gBattle_WIN0V & 0xFF00) == 0x3000) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; gTasks[taskId].data[2] = 240; gTasks[taskId].data[3] = 32; gTasks[taskId].data[5] = 1; @@ -328,7 +331,7 @@ static void BattleIntroSlide2(u8 taskId) if (!gTasks[taskId].data[2]) { gScanlineEffect.state = 3; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; CpuFill32(0, (void *)BG_SCREEN_ADDR(28), BG_SCREEN_SIZE); SetBgAttribute(1, BG_ATTR_CHARBASEINDEX, 0); SetBgAttribute(2, BG_ATTR_CHARBASEINDEX, 0); @@ -337,11 +340,11 @@ static void BattleIntroSlide2(u8 taskId) } break; case 4: - sub_811828C(taskId); + BattleIntroSlideEnd(taskId); break; } - if (gTasks[taskId].data[0] != 4) + if (gTasks[taskId].tState != 4) SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[4], 0)); } @@ -350,7 +353,7 @@ static void BattleIntroSlide3(u8 taskId) int i; gBattle_BG1_X += 8; - switch (gTasks[taskId].data[0]) + switch (gTasks[taskId].tState) { case 0: SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG3 | BLDCNT_TGT2_OBJ); @@ -360,18 +363,18 @@ static void BattleIntroSlide3(u8 taskId) if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) { gTasks[taskId].data[2] = 16; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } else { gTasks[taskId].data[2] = 1; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } break; case 1: if (--gTasks[taskId].data[2] == 0) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR); } break; @@ -379,7 +382,7 @@ static void BattleIntroSlide3(u8 taskId) gBattle_WIN0V -= 0xFF; if ((gBattle_WIN0V & 0xFF00) == 0x3000) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; gTasks[taskId].data[2] = 240; gTasks[taskId].data[3] = 32; gTasks[taskId].data[5] = 1; @@ -416,7 +419,7 @@ static void BattleIntroSlide3(u8 taskId) if (!gTasks[taskId].data[2]) { gScanlineEffect.state = 3; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; CpuFill32(0, (void *)BG_SCREEN_ADDR(28), BG_SCREEN_SIZE); SetBgAttribute(1, BG_ATTR_CHARBASEINDEX, 0); SetBgAttribute(2, BG_ATTR_CHARBASEINDEX, 0); @@ -425,11 +428,11 @@ static void BattleIntroSlide3(u8 taskId) } break; case 4: - sub_811828C(taskId); + BattleIntroSlideEnd(taskId); break; } - if (gTasks[taskId].data[0] != 4) + if (gTasks[taskId].tState != 4) SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[4], 0)); } @@ -437,7 +440,7 @@ static void BattleIntroSlideLink(u8 taskId) { int i; - if (gTasks[taskId].data[0] > 1 && !gTasks[taskId].data[4]) + if (gTasks[taskId].tState > 1 && !gTasks[taskId].data[4]) { u16 var0 = gBattle_BG1_X & 0x8000; if (var0 || gBattle_BG1_X < 80) @@ -453,20 +456,20 @@ static void BattleIntroSlideLink(u8 taskId) } } - switch (gTasks[taskId].data[0]) + switch (gTasks[taskId].tState) { case 0: gTasks[taskId].data[2] = 32; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; break; case 1: if (--gTasks[taskId].data[2] == 0) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; gSprites[gBattleStruct->linkBattleVsSpriteId_V].oam.objMode = ST_OAM_OBJ_WINDOW; - gSprites[gBattleStruct->linkBattleVsSpriteId_V].callback = sub_8038B74; + gSprites[gBattleStruct->linkBattleVsSpriteId_V].callback = SpriteCB_VsLetterInit; gSprites[gBattleStruct->linkBattleVsSpriteId_S].oam.objMode = ST_OAM_OBJ_WINDOW; - gSprites[gBattleStruct->linkBattleVsSpriteId_S].callback = sub_8038B74; + gSprites[gBattleStruct->linkBattleVsSpriteId_S].callback = SpriteCB_VsLetterInit; SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR); SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR | WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2); } @@ -475,7 +478,7 @@ static void BattleIntroSlideLink(u8 taskId) gBattle_WIN0V -= 0xFF; if ((gBattle_WIN0V & 0xFF00) == 0x3000) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; gTasks[taskId].data[2] = 240; gTasks[taskId].data[3] = 32; gIntroSlideFlags &= ~1; @@ -498,7 +501,7 @@ static void BattleIntroSlideLink(u8 taskId) if (!gTasks[taskId].data[2]) { gScanlineEffect.state = 3; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; SetBgAttribute(1, BG_ATTR_CHARBASEINDEX, 0); SetBgAttribute(2, BG_ATTR_CHARBASEINDEX, 0); SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_16COLOR | BGCNT_SCREENBASE(28) | BGCNT_TXT256x512); @@ -506,23 +509,23 @@ static void BattleIntroSlideLink(u8 taskId) } break; case 4: - sub_811828C(taskId); + BattleIntroSlideEnd(taskId); break; } } static void BattleIntroSlidePartner(u8 taskId) { - switch (gTasks[taskId].data[0]) + switch (gTasks[taskId].tState) { case 0: gTasks[taskId].data[2] = 1; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; break; case 1: if (--gTasks[taskId].data[2] == 0) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(2) | BGCNT_CHARBASE(2) | BGCNT_16COLOR | BGCNT_SCREENBASE(28) | BGCNT_TXT512x256); SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2) | BGCNT_CHARBASE(2) | BGCNT_16COLOR | BGCNT_SCREENBASE(30) | BGCNT_TXT512x256); SetGpuReg(REG_OFFSET_DISPCNT, GetGpuReg(REG_OFFSET_DISPCNT) | DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON | DISPCNT_WIN1_ON | DISPCNT_OBJWIN_ON); @@ -540,7 +543,7 @@ static void BattleIntroSlidePartner(u8 taskId) if ((gBattle_WIN0V & 0xFF00) == 0x2000) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; gTasks[taskId].data[2] = 240; gIntroSlideFlags &= ~1; } @@ -555,7 +558,7 @@ static void BattleIntroSlidePartner(u8 taskId) gBattle_BG1_X = gTasks[taskId].data[2]; gBattle_BG2_X = -gTasks[taskId].data[2]; if (!gTasks[taskId].data[2]) - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; break; case 4: gBattle_BG0_Y += 2; @@ -572,11 +575,11 @@ static void BattleIntroSlidePartner(u8 taskId) SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_16COLOR | BGCNT_SCREENBASE(28) | BGCNT_TXT256x512); SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_16COLOR | BGCNT_SCREENBASE(30) | BGCNT_TXT512x256); gScanlineEffect.state = 3; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } break; case 5: - sub_811828C(taskId); + BattleIntroSlideEnd(taskId); break; } } diff --git a/src/battle_main.c b/src/battle_main.c index b8ef2ba4cb..a415d894ff 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -93,7 +93,7 @@ static void sub_80398D0(struct Sprite *sprite); static void SpriteCB_AnimFaintOpponent(struct Sprite *sprite); static void SpriteCb_BlinkVisible(struct Sprite *sprite); static void SpriteCallbackDummy_3(struct Sprite *sprite); -static void oac_poke_ally_(struct Sprite *sprite); +static void SpriteCB_BattleSpriteSlideLeft(struct Sprite *sprite); static void TurnValuesCleanUp(bool8 var0); static void SpriteCB_BounceEffect(struct Sprite *sprite); static void BattleStartClearSetData(void); @@ -275,7 +275,7 @@ const struct SpriteTemplate gUnknown_0831AC88 = static const u8 sText_ShedinjaJpnName[] = _("ヌケニン"); // Nukenin -const struct OamData gOamData_831ACA8 = +const struct OamData gOamData_BattleSpriteOpponentSide = { .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, @@ -290,7 +290,7 @@ const struct OamData gOamData_831ACA8 = .affineParam = 0, }; -const struct OamData gOamData_831ACB0 = +const struct OamData gOamData_BattleSpritePlayerSide = { .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, @@ -306,10 +306,10 @@ const struct OamData gOamData_831ACB0 = }; // Unknown and unused data. Feel free to remove. -static const u16 gUnknown_0831ACB8[] = {0, 5, 0xfffe, 0}; -static const u16 *const gUnknown_0831ACC0 = gUnknown_0831ACB8; -static const u16 gUnknown_0831ACC4[] = {0xfff0, 0, 0x0400, 0, 0, 0, 0x3c00, 0, 0x7ffe, 1, 0, 0}; -static const u16 *const gUnknown_0831ACDC = gUnknown_0831ACC4; +static const u16 sUnused1[] = {0, 5, 0xfffe, 0}; +static const u16 *const sUnused1Ptr = sUnused1; +static const u16 sUnused2[] = {0xfff0, 0, 0x0400, 0, 0, 0, 0x3c00, 0, 0x7ffe, 1, 0, 0}; +static const u16 *const sUnused2Ptr = sUnused2; static const s8 gUnknown_0831ACE0[] ={-32, -16, -16, -32, -32, 0, 0, 0}; @@ -700,39 +700,45 @@ static void CB2_InitBattleInternal(void) gBattleCommunication[MULTIUSE_STATE] = 0; } -static void sub_8036A5C(void) -{ - u16 r6 = 0; - u16 species = 0; - u16 hp = 0; - u32 status = 0; - s32 i; - - for (i = 0; i < PARTY_SIZE; i++) - { - species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); - hp = GetMonData(&gPlayerParty[i], MON_DATA_HP); - status = GetMonData(&gPlayerParty[i], MON_DATA_STATUS); - - if (species == SPECIES_NONE) - continue; - if (species != SPECIES_EGG && hp != 0 && status == 0) - r6 |= 1 << i * 2; - - if (species == SPECIES_NONE) - continue; - if (hp != 0 && (species == SPECIES_EGG || status != 0)) - r6 |= 2 << i * 2; - - if (species == SPECIES_NONE) - continue; - if (species != SPECIES_EGG && hp == 0) - r6 |= 3 << i * 2; +#define BUFFER_PARTY_VS_SCREEN_STATUS(party, flags, i) \ + for ((i) = 0; (i) < PARTY_SIZE; (i)++) \ + { \ + u16 species = GetMonData(&(party)[(i)], MON_DATA_SPECIES2); \ + u16 hp = GetMonData(&(party)[(i)], MON_DATA_HP); \ + u32 status = GetMonData(&(party)[(i)], MON_DATA_STATUS); \ + \ + if (species == SPECIES_NONE) \ + continue; \ + \ + /* Is healthy mon? */ \ + if (species != SPECIES_EGG && hp != 0 && status == 0) \ + (flags) |= 1 << (i) * 2; \ + \ + if (species == SPECIES_NONE) /* Redundant */ \ + continue; \ + \ + /* Is Egg or statused? */ \ + if (hp != 0 && (species == SPECIES_EGG || status != 0)) \ + (flags) |= 2 << (i) * 2; \ + \ + if (species == SPECIES_NONE) /* Redundant */ \ + continue; \ + \ + /* Is fainted? */ \ + if (species != SPECIES_EGG && hp == 0) \ + (flags) |= 3 << (i) * 2; \ } - gBattleStruct->field_182 = r6; - *(&gBattleStruct->field_183) = r6 >> 8; - gBattleStruct->field_183 |= FlagGet(FLAG_SYS_FRONTIER_PASS) << 7; +// For Vs Screen at link battle start +static void BufferPartyVsScreenHealth_AtStart(void) +{ + u16 flags = 0; + s32 i; + + BUFFER_PARTY_VS_SCREEN_STATUS(gPlayerParty, flags, i); + gBattleStruct->vsScreenHealthFlagsLo = flags; + *(&gBattleStruct->vsScreenHealthFlagsHi) = flags >> 8; + gBattleStruct->vsScreenHealthFlagsHi |= FlagGet(FLAG_SYS_FRONTIER_PASS) << 7; } static void SetPlayerBerryDataInBattleStruct(void) @@ -969,7 +975,7 @@ static void CB2_HandleStartBattle(void) { *(&gBattleStruct->field_180) = 0; *(&gBattleStruct->field_181) = 3; - sub_8036A5C(); + BufferPartyVsScreenHealth_AtStart(); SetPlayerBerryDataInBattleStruct(); if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM) @@ -1005,7 +1011,7 @@ static void CB2_HandleStartBattle(void) gTasks[taskId].data[1] = 0x10E; gTasks[taskId].data[2] = 0x5A; gTasks[taskId].data[5] = 0; - gTasks[taskId].data[3] = gBattleStruct->field_182 | (gBattleStruct->field_183 << 8); + gTasks[taskId].data[3] = gBattleStruct->vsScreenHealthFlagsLo | (gBattleStruct->vsScreenHealthFlagsHi << 8); gTasks[taskId].data[4] = gBlockRecvBuffer[enemyMultiplayerId][1]; sub_8185F90(gBlockRecvBuffer[playerMultiplayerId][1]); sub_8185F90(gBlockRecvBuffer[enemyMultiplayerId][1]); @@ -1177,7 +1183,7 @@ static void CB2_HandleStartMultiPartnerBattle(void) { *(&gBattleStruct->field_180) = 0; *(&gBattleStruct->field_181) = 3; - sub_8036A5C(); + BufferPartyVsScreenHealth_AtStart(); SetPlayerBerryDataInBattleStruct(); SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->field_180, 32); gBattleCommunication[MULTIUSE_STATE] = 2; @@ -1564,7 +1570,7 @@ static void CB2_HandleStartMultiBattle(void) { *(&gBattleStruct->field_180) = 0; *(&gBattleStruct->field_181) = 3; - sub_8036A5C(); + BufferPartyVsScreenHealth_AtStart(); SetPlayerBerryDataInBattleStruct(); SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->field_180, 32); @@ -2064,12 +2070,12 @@ void VBlankCB_Battle(void) ScanlineEffect_InitHBlankDmaTransfer(); } -void nullsub_17(struct Sprite *sprite) +void SpriteCB_VsLetterDummy(struct Sprite *sprite) { } -static void sub_8038B04(struct Sprite *sprite) +static void SpriteCB_VsLetter(struct Sprite *sprite) { if (sprite->data[0] != 0) sprite->pos1.x = sprite->data[1] + ((sprite->data[2] & 0xFF00) >> 8); @@ -2087,48 +2093,19 @@ static void sub_8038B04(struct Sprite *sprite) } } -void sub_8038B74(struct Sprite *sprite) +void SpriteCB_VsLetterInit(struct Sprite *sprite) { StartSpriteAffineAnim(sprite, 1); - sprite->callback = sub_8038B04; + sprite->callback = SpriteCB_VsLetter; PlaySE(SE_MUGSHOT); } -#define BUFFER_PARTY_VS_SCREEN_STATUS(party, flags, i) \ - for ((i) = 0; (i) < PARTY_SIZE; (i)++) \ - { \ - u16 species = GetMonData(&(party)[(i)], MON_DATA_SPECIES2); \ - u16 hp = GetMonData(&(party)[(i)], MON_DATA_HP); \ - u32 status = GetMonData(&(party)[(i)], MON_DATA_STATUS); \ - \ - if (species == SPECIES_NONE) \ - continue; \ - \ - /* Is healthy mon? */ \ - if (species != SPECIES_EGG && hp != 0 && status == 0) \ - (flags) |= 1 << (i) * 2; \ - \ - if (species == SPECIES_NONE) /* Redundant */ \ - continue; \ - \ - /* Is Egg or statused? */ \ - if (hp != 0 && (species == SPECIES_EGG || status != 0)) \ - (flags) |= 2 << (i) * 2; \ - \ - if (species == SPECIES_NONE) /* Redundant */ \ - continue; \ - \ - /* Is fainted? */ \ - if (species != SPECIES_EGG && hp == 0) \ - (flags) |= 3 << (i) * 2; \ - } - -static void LoadPartyDataForLinkVsScreen(u8 taskId) +static void BufferPartyVsScreenHealth_AtEnd(u8 taskId) { struct Pokemon *party1 = NULL; struct Pokemon *party2 = NULL; u8 multiplayerId = gBattleScripting.multiplayerId; - u32 statusFlags; + u32 flags; s32 i; if (gBattleTypeFlags & BATTLE_TYPE_MULTI) @@ -2153,13 +2130,13 @@ static void LoadPartyDataForLinkVsScreen(u8 taskId) party2 = gEnemyParty; } - statusFlags = 0; - BUFFER_PARTY_VS_SCREEN_STATUS(party1, statusFlags, i); - gTasks[taskId].data[3] = statusFlags; + flags = 0; + BUFFER_PARTY_VS_SCREEN_STATUS(party1, flags, i); + gTasks[taskId].data[3] = flags; - statusFlags = 0; - BUFFER_PARTY_VS_SCREEN_STATUS(party2, statusFlags, i); - gTasks[taskId].data[4] = statusFlags; + flags = 0; + BUFFER_PARTY_VS_SCREEN_STATUS(party2, flags, i); + gTasks[taskId].data[4] = flags; } void CB2_InitEndLinkBattle(void) @@ -2232,7 +2209,7 @@ void CB2_InitEndLinkBattle(void) gTasks[taskId].data[1] = 0x10E; gTasks[taskId].data[2] = 0x5A; gTasks[taskId].data[5] = 1; - LoadPartyDataForLinkVsScreen(taskId); + BufferPartyVsScreenHealth_AtEnd(taskId); SetMainCallback2(CB2_EndLinkBattle); gBattleCommunication[MULTIUSE_STATE] = 0; @@ -2366,7 +2343,7 @@ static void EndLinkBattleInSteps(void) } } -u32 sub_80391E0(u8 arrayId, u8 caseId) +u32 GetBattleBgTemplateData(u8 arrayId, u8 caseId) { u32 ret = 0; @@ -2387,7 +2364,7 @@ u32 sub_80391E0(u8 arrayId, u8 caseId) case 4: ret = gBattleBgTemplates[arrayId].paletteMode; break; - case 5: + case 5: // Only this case is used ret = gBattleBgTemplates[arrayId].priority; break; case 6: @@ -2618,7 +2595,7 @@ static void TryCorrectShedinjaLanguage(struct Pokemon *mon) } } -u32 sub_80397C4(u32 setId, u32 tableId) +u32 GetBattleWindowTemplatePixelWidth(u32 setId, u32 tableId) { return gBattleWindowTemplates[setId][tableId].width * 8; } @@ -2670,7 +2647,8 @@ void SpriteCallbackDummy_2(struct Sprite *sprite) } -static void sub_80398BC(struct Sprite *sprite) // unused? +// Unused +static void sub_80398BC(struct Sprite *sprite) { sprite->data[3] = 6; sprite->data[4] = 1; @@ -2803,12 +2781,13 @@ void SpriteCb_OpponentMonFromBall(struct Sprite *sprite) } } -void sub_8039BB4(struct Sprite *sprite) +// This callback is frequently overwritten by SpriteCB_TrainerSlideIn +void SpriteCB_BattleSpriteStartSlideLeft(struct Sprite *sprite) { - sprite->callback = oac_poke_ally_; + sprite->callback = SpriteCB_BattleSpriteSlideLeft; } -static void oac_poke_ally_(struct Sprite *sprite) +static void SpriteCB_BattleSpriteSlideLeft(struct Sprite *sprite) { if (!(gIntroSlideFlags & 1)) { @@ -2821,7 +2800,8 @@ static void oac_poke_ally_(struct Sprite *sprite) } } -void sub_80105DC(struct Sprite *sprite) +// Unused +static void sub_80105DC(struct Sprite *sprite) { sprite->callback = SpriteCallbackDummy_3; } diff --git a/src/battle_message.c b/src/battle_message.c index 3f886c196f..3920f94cf5 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -3001,7 +3001,7 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId) if (printerTemplate.x == 0xFF) { - u32 width = sub_80397C4(gBattleScripting.windowsType, windowId); + u32 width = GetBattleWindowTemplatePixelWidth(gBattleScripting.windowsType, windowId); s32 alignX = GetStringCenterAlignXOffsetWithLetterSpacing(printerTemplate.fontId, printerTemplate.currentChar, width, printerTemplate.letterSpacing); printerTemplate.x = printerTemplate.currentX = alignX; } diff --git a/src/contest.c b/src/contest.c index e7c4204481..36c32683ae 100644 --- a/src/contest.c +++ b/src/contest.c @@ -3135,7 +3135,7 @@ static u8 CreateContestantSprite(u16 species, u32 otId, u32 personality, u32 ind if (IsSpeciesNotUnown(species)) gSprites[spriteId].affineAnims = gUnknown_082FF6C0; else - gSprites[spriteId].affineAnims = gUnknown_082FF694; + gSprites[spriteId].affineAnims = gAffineAnims_BattleSpriteOpponentSide; StartSpriteAffineAnim(gSprites + spriteId, 0); return spriteId; diff --git a/src/data.c b/src/data.c index 4861da18b5..6a4295440c 100644 --- a/src/data.c +++ b/src/data.c @@ -8,12 +8,11 @@ #include "constants/trainers.h" #include "constants/battle_ai.h" -const u16 gUnknown_082FF1D8[] = INCBIN_U16("graphics/link/minigame_digits.gbapal"); -const u32 gUnknown_082FF1F8[] = INCBIN_U32("graphics/link/minigame_digits.4bpp.lz"); -// unused -const u32 gUnknown_082FF2B8[] = INCBIN_U32("graphics/link/minigame_digits2.4bpp.lz"); +const u16 gMinigameDigits_Pal[] = INCBIN_U16("graphics/link/minigame_digits.gbapal"); +const u32 gMinigameDigits_Gfx[] = INCBIN_U32("graphics/link/minigame_digits.4bpp.lz"); +static const u32 sMinigameDigitsThin_Gfx[] = INCBIN_U32("graphics/link/minigame_digits2.4bpp.lz"); // Unused -const struct SpriteFrameImage gUnknown_082FF3A8[] = +const struct SpriteFrameImage gBattlerPicTable_PlayerLeft[] = { gHeap + 0x8000, 0x800, gHeap + 0x8800, 0x800, @@ -21,7 +20,7 @@ const struct SpriteFrameImage gUnknown_082FF3A8[] = gHeap + 0x9800, 0x800, }; -const struct SpriteFrameImage gUnknown_082FF3C8[] = +const struct SpriteFrameImage gBattlerPicTable_OpponentLeft[] = { gHeap + 0xA000, 0x800, gHeap + 0xA800, 0x800, @@ -29,7 +28,7 @@ const struct SpriteFrameImage gUnknown_082FF3C8[] = gHeap + 0xB800, 0x800, }; -const struct SpriteFrameImage gUnknown_082FF3E8[] = +const struct SpriteFrameImage gBattlerPicTable_PlayerRight[] = { gHeap + 0xC000, 0x800, gHeap + 0xC800, 0x800, @@ -37,7 +36,7 @@ const struct SpriteFrameImage gUnknown_082FF3E8[] = gHeap + 0xD800, 0x800, }; -const struct SpriteFrameImage gUnknown_082FF408[] = +const struct SpriteFrameImage gBattlerPicTable_OpponentRight[] = { gHeap + 0xE000, 0x800, gHeap + 0xE800, 0x800, @@ -189,7 +188,7 @@ static const union AffineAnimCmd gUnknown_082FF600[] = AFFINEANIMCMD_END, }; -const union AffineAnimCmd *const gUnknown_082FF618[] = +const union AffineAnimCmd *const gAffineAnims_BattleSpritePlayerSide[] = { gUnknown_082FF548, gUnknown_082FF568, @@ -229,7 +228,7 @@ static const union AffineAnimCmd gUnknown_082FF684[] = AFFINEANIMCMD_END, }; -const union AffineAnimCmd *const gUnknown_082FF694[] = +const union AffineAnimCmd *const gAffineAnims_BattleSpriteOpponentSide[] = { gUnknown_082FF548, gUnknown_082FF568, @@ -313,8 +312,7 @@ const union AnimCmd *const gUnknown_082FF70C[] = #include "data/pokemon_graphics/front_pic_anims.h" #include "data/pokemon_graphics/front_pic_table.h" -// unused -const u32 gUnknown830AF4C[] = +static const u32 sUnused[] = { 0x00000888, 0x00000888, 0x00000888, 0x00000888, 0x00000088, 0x00000888, 0x00000888, 0x00000886, diff --git a/src/evolution_scene.c b/src/evolution_scene.c index a8de8a555d..c8f9102612 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -1522,8 +1522,8 @@ static void sub_8140174(void) gBattle_BG1_X = 0; gBattle_BG1_Y = 0; gBattle_BG2_X = 0; - SetBgAttribute(1, BG_ATTR_PRIORITY, sub_80391E0(1, 5)); - SetBgAttribute(2, BG_ATTR_PRIORITY, sub_80391E0(2, 5)); + SetBgAttribute(1, BG_ATTR_PRIORITY, GetBattleBgTemplateData(1, 5)); + SetBgAttribute(2, BG_ATTR_PRIORITY, GetBattleBgTemplateData(2, 5)); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG3_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP); Free(sEvoMovingBgPtr); } diff --git a/src/pokeball.c b/src/pokeball.c index 7860b3ce06..503bae2d28 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -34,13 +34,13 @@ 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_PokeballReleaseMon(struct Sprite *sprite); +static void SpriteCB_ReleasedMonFlyOut(struct Sprite *sprite); +static void SpriteCB_TradePokeball(struct Sprite *sprite); +static void SpriteCB_TradePokeballSendOff(struct Sprite *sprite); +static void SpriteCB_TradePokeballEnd(struct Sprite *sprite); +static void SpriteCB_HealthboxSlideInDelayed(struct Sprite *sprite); +static void SpriteCB_HealthboxSlideIn(struct Sprite *sprite); static void SpriteCB_HitAnimHealthoxEffect(struct Sprite *sprite); static u16 GetBattlerPokeballItemId(u8 battlerId); @@ -61,34 +61,34 @@ static u16 GetBattlerPokeballItemId(u8 battlerId); 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}, + [BALL_POKE] = {gInterfaceGfx_PokeBall, 384, GFX_TAG_POKEBALL}, + [BALL_GREAT] = {gInterfaceGfx_GreatBall, 384, GFX_TAG_GREATBALL}, + [BALL_SAFARI] = {gInterfaceGfx_SafariBall, 384, GFX_TAG_SAFARIBALL}, + [BALL_ULTRA] = {gInterfaceGfx_UltraBall, 384, GFX_TAG_ULTRABALL}, + [BALL_MASTER] = {gInterfaceGfx_MasterBall, 384, GFX_TAG_MASTERBALL}, + [BALL_NET] = {gInterfaceGfx_NetBall, 384, GFX_TAG_NETBALL}, + [BALL_DIVE] = {gInterfaceGfx_DiveBall, 384, GFX_TAG_DIVEBALL}, + [BALL_NEST] = {gInterfaceGfx_NestBall, 384, GFX_TAG_NESTBALL}, + [BALL_REPEAT] = {gInterfaceGfx_RepeatBall, 384, GFX_TAG_REPEATBALL}, + [BALL_TIMER] = {gInterfaceGfx_TimerBall, 384, GFX_TAG_TIMERBALL}, + [BALL_LUXURY] = {gInterfaceGfx_LuxuryBall, 384, GFX_TAG_LUXURYBALL}, + [BALL_PREMIER] = {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}, + [BALL_POKE] = {gInterfacePal_PokeBall, GFX_TAG_POKEBALL}, + [BALL_GREAT] = {gInterfacePal_GreatBall, GFX_TAG_GREATBALL}, + [BALL_SAFARI] = {gInterfacePal_SafariBall, GFX_TAG_SAFARIBALL}, + [BALL_ULTRA] = {gInterfacePal_UltraBall, GFX_TAG_ULTRABALL}, + [BALL_MASTER] = {gInterfacePal_MasterBall, GFX_TAG_MASTERBALL}, + [BALL_NET] = {gInterfacePal_NetBall, GFX_TAG_NETBALL}, + [BALL_DIVE] = {gInterfacePal_DiveBall, GFX_TAG_DIVEBALL}, + [BALL_NEST] = {gInterfacePal_NestBall, GFX_TAG_NESTBALL}, + [BALL_REPEAT] = {gInterfacePal_RepeatBall, GFX_TAG_REPEATBALL}, + [BALL_TIMER] = {gInterfacePal_TimerBall, GFX_TAG_TIMERBALL}, + [BALL_LUXURY] = {gInterfacePal_LuxuryBall, GFX_TAG_LUXURYBALL}, + [BALL_PREMIER] = {gInterfacePal_PremierBall, GFX_TAG_PREMIERBALL}, }; static const struct OamData sBallOamData = @@ -996,6 +996,7 @@ static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 battlerId, u32 return LaunchBallFadeMonTask(unFadeLater, battlerId, arg2, BALL_POKE); } +// Pokeball in Birch intro, and when receiving via trade void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 battlerId, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 g, u32 h, u16 species) { u8 spriteId; @@ -1017,12 +1018,12 @@ void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 battlerId, u8 x, u8 y, gSprites[spriteId].data[3] = h; gSprites[spriteId].data[4] = h >> 0x10; gSprites[spriteId].oam.priority = oamPriority; - gSprites[spriteId].callback = sub_8076524; + gSprites[spriteId].callback = SpriteCB_PokeballReleaseMon; gSprites[monSpriteId].invisible = TRUE; } -static void sub_8076524(struct Sprite *sprite) +static void SpriteCB_PokeballReleaseMon(struct Sprite *sprite) { if (sprite->data[1] == 0) { @@ -1039,7 +1040,7 @@ static void sub_8076524(struct Sprite *sprite) StartSpriteAnim(sprite, 1); AnimateBallOpenParticlesForPokeball(sprite->pos1.x, sprite->pos1.y - 5, sprite->oam.priority, r5); sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, battlerId, r4); - sprite->callback = sub_80765E0; + sprite->callback = SpriteCB_ReleasedMonFlyOut; gSprites[r7].invisible = FALSE; StartSpriteAffineAnim(&gSprites[r7], 1); AnimateSprite(&gSprites[r7]); @@ -1052,7 +1053,7 @@ static void sub_8076524(struct Sprite *sprite) } } -static void sub_80765E0(struct Sprite *sprite) +static void SpriteCB_ReleasedMonFlyOut(struct Sprite *sprite) { bool8 r12 = FALSE; bool8 r6 = FALSE; @@ -1111,16 +1112,16 @@ u8 CreateTradePokeballSprite(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPrior gSprites[spriteId].data[3] = h; gSprites[spriteId].data[4] = h >> 16; gSprites[spriteId].oam.priority = oamPriority; - gSprites[spriteId].callback = sub_80767D4; + gSprites[spriteId].callback = SpriteCB_TradePokeball; return spriteId; } -static void sub_80767D4(struct Sprite *sprite) +static void SpriteCB_TradePokeball(struct Sprite *sprite) { if (sprite->data[1] == 0) { u8 r6; - u8 r7 = sprite->data[0]; + u8 monSpriteId = sprite->data[0]; u8 r8 = sprite->data[2]; u32 r5 = (u16)sprite->data[3] | ((u16)sprite->data[4] << 16); @@ -1132,15 +1133,15 @@ static void sub_80767D4(struct Sprite *sprite) StartSpriteAnim(sprite, 1); AnimateBallOpenParticlesForPokeball(sprite->pos1.x, sprite->pos1.y - 5, sprite->oam.priority, r6); sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, r8, r5); - sprite->callback = sub_807687C; + sprite->callback = SpriteCB_TradePokeballSendOff; #ifdef BUGFIX // FIX: If this is used on a sprite that has previously had an affine animation, it will not // play the shrink anim properly due to being paused. Works together with the fix to `sub_817F77C`. - gSprites[r7].affineAnimPaused = FALSE; + gSprites[monSpriteId].affineAnimPaused = FALSE; #endif // BUGFIX - StartSpriteAffineAnim(&gSprites[r7], 2); - AnimateSprite(&gSprites[r7]); - gSprites[r7].data[1] = 0; + StartSpriteAffineAnim(&gSprites[monSpriteId], 2); + AnimateSprite(&gSprites[monSpriteId]); + gSprites[monSpriteId].data[1] = 0; } else { @@ -1148,29 +1149,29 @@ static void sub_80767D4(struct Sprite *sprite) } } -static void sub_807687C(struct Sprite *sprite) +static void SpriteCB_TradePokeballSendOff(struct Sprite *sprite) { - u8 r1; + u8 monSpriteId; sprite->data[5]++; if (sprite->data[5] == 11) PlaySE(SE_BALL_TRADE); - r1 = sprite->data[0]; - if (gSprites[r1].affineAnimEnded) + monSpriteId = sprite->data[0]; + if (gSprites[monSpriteId].affineAnimEnded) { StartSpriteAnim(sprite, 2); - gSprites[r1].invisible = TRUE; + gSprites[monSpriteId].invisible = TRUE; sprite->data[5] = 0; - sprite->callback = sub_80768F0; + sprite->callback = SpriteCB_TradePokeballEnd; } else { - gSprites[r1].data[1] += 96; - gSprites[r1].pos2.y = -gSprites[r1].data[1] >> 8; + gSprites[monSpriteId].data[1] += 96; + gSprites[monSpriteId].pos2.y = -gSprites[monSpriteId].data[1] >> 8; } } -static void sub_80768F0(struct Sprite *sprite) +static void SpriteCB_TradePokeballEnd(struct Sprite *sprite) { if (sprite->animEnded) sprite->callback = SpriteCallbackDummy; @@ -1181,45 +1182,54 @@ static void Unref_DestroySpriteAndFreeResources(struct Sprite *sprite) DestroySpriteAndFreeResources(sprite); } +#define sSpeedX data[0] +#define sSpeedY data[1] + +#define sDelayTimer data[1] + void StartHealthboxSlideIn(u8 battlerId) { struct Sprite *healthboxSprite = &gSprites[gHealthboxSpriteIds[battlerId]]; - healthboxSprite->data[0] = 5; - healthboxSprite->data[1] = 0; + healthboxSprite->sSpeedX = 5; + healthboxSprite->sSpeedY = 0; healthboxSprite->pos2.x = 0x73; healthboxSprite->pos2.y = 0; - healthboxSprite->callback = sub_80769CC; + healthboxSprite->callback = SpriteCB_HealthboxSlideIn; if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) { - healthboxSprite->data[0] = -healthboxSprite->data[0]; - healthboxSprite->data[1] = -healthboxSprite->data[1]; + healthboxSprite->sSpeedX = -healthboxSprite->sSpeedX; + healthboxSprite->sSpeedY = -healthboxSprite->sSpeedY; healthboxSprite->pos2.x = -healthboxSprite->pos2.x; healthboxSprite->pos2.y = -healthboxSprite->pos2.y; } gSprites[healthboxSprite->data[5]].callback(&gSprites[healthboxSprite->data[5]]); if (GetBattlerPosition(battlerId) == B_POSITION_PLAYER_RIGHT) - healthboxSprite->callback = sub_80769A8; + healthboxSprite->callback = SpriteCB_HealthboxSlideInDelayed; } -static void sub_80769A8(struct Sprite *sprite) +static void SpriteCB_HealthboxSlideInDelayed(struct Sprite *sprite) { - sprite->data[1]++; - if (sprite->data[1] == 20) + sprite->sDelayTimer++; + if (sprite->sDelayTimer == 20) { - sprite->data[1] = 0; - sprite->callback = sub_80769CC; + sprite->sDelayTimer = 0; + sprite->callback = SpriteCB_HealthboxSlideIn; } } -static void sub_80769CC(struct Sprite *sprite) +static void SpriteCB_HealthboxSlideIn(struct Sprite *sprite) { - sprite->pos2.x -= sprite->data[0]; - sprite->pos2.y -= sprite->data[1]; + sprite->pos2.x -= sprite->sSpeedX; + sprite->pos2.y -= sprite->sSpeedY; if (sprite->pos2.x == 0 && sprite->pos2.y == 0) sprite->callback = SpriteCallbackDummy; } +#undef sSpeedX +#undef sSpeedY +#undef sDelayTimer + void DoHitAnimHealthboxEffect(u8 battlerId) { u8 spriteId; diff --git a/src/pokemon.c b/src/pokemon.c index 3a2e88aae2..064e206a45 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1350,32 +1350,32 @@ const struct SpindaSpot gSpindaSpotGraphics[] = const s8 gNatureStatTable[NUM_NATURES][NUM_NATURE_STATS] = { - // Atk Def Spd Sp.Atk Sp.Def - { 0, 0, 0, 0, 0}, // Hardy - { +1, -1, 0, 0, 0}, // Lonely - { +1, 0, -1, 0, 0}, // Brave - { +1, 0, 0, -1, 0}, // Adamant - { +1, 0, 0, 0, -1}, // Naughty - { -1, +1, 0, 0, 0}, // Bold - { 0, 0, 0, 0, 0}, // Docile - { 0, +1, -1, 0, 0}, // Relaxed - { 0, +1, 0, -1, 0}, // Impish - { 0, +1, 0, 0, -1}, // Lax - { -1, 0, +1, 0, 0}, // Timid - { 0, -1, +1, 0, 0}, // Hasty - { 0, 0, 0, 0, 0}, // Serious - { 0, 0, +1, -1, 0}, // Jolly - { 0, 0, +1, 0, -1}, // Naive - { -1, 0, 0, +1, 0}, // Modest - { 0, -1, 0, +1, 0}, // Mild - { 0, 0, -1, +1, 0}, // Quiet - { 0, 0, 0, 0, 0}, // Bashful - { 0, 0, 0, +1, -1}, // Rash - { -1, 0, 0, 0, +1}, // Calm - { 0, -1, 0, 0, +1}, // Gentle - { 0, 0, -1, 0, +1}, // Sassy - { 0, 0, 0, -1, +1}, // Careful - { 0, 0, 0, 0, 0}, // Quirky + // Atk Def Spd Sp.Atk Sp.Def + [NATURE_HARDY] = { 0, 0, 0, 0, 0}, + [NATURE_LONELY] = { +1, -1, 0, 0, 0}, + [NATURE_BRAVE] = { +1, 0, -1, 0, 0}, + [NATURE_ADAMANT] = { +1, 0, 0, -1, 0}, + [NATURE_NAUGHTY] = { +1, 0, 0, 0, -1}, + [NATURE_BOLD] = { -1, +1, 0, 0, 0}, + [NATURE_DOCILE] = { 0, 0, 0, 0, 0}, + [NATURE_RELAXED] = { 0, +1, -1, 0, 0}, + [NATURE_IMPISH] = { 0, +1, 0, -1, 0}, + [NATURE_LAX] = { 0, +1, 0, 0, -1}, + [NATURE_TIMID] = { -1, 0, +1, 0, 0}, + [NATURE_HASTY] = { 0, -1, +1, 0, 0}, + [NATURE_SERIOUS] = { 0, 0, 0, 0, 0}, + [NATURE_JOLLY] = { 0, 0, +1, -1, 0}, + [NATURE_NAIVE] = { 0, 0, +1, 0, -1}, + [NATURE_MODEST] = { -1, 0, 0, +1, 0}, + [NATURE_MILD] = { 0, -1, 0, +1, 0}, + [NATURE_QUIET] = { 0, 0, -1, +1, 0}, + [NATURE_BASHFUL] = { 0, 0, 0, 0, 0}, + [NATURE_RASH] = { 0, 0, 0, +1, -1}, + [NATURE_CALM] = { -1, 0, 0, 0, +1}, + [NATURE_GENTLE] = { 0, -1, 0, 0, +1}, + [NATURE_SASSY] = { 0, 0, -1, 0, +1}, + [NATURE_CAREFUL] = { 0, 0, 0, -1, +1}, + [NATURE_QUIRKY] = { 0, 0, 0, 0, 0}, }; #include "data/pokemon/tmhm_learnsets.h" @@ -1937,119 +1937,119 @@ static const u8 sHoldEffectToType[][2] = {HOLD_EFFECT_NORMAL_POWER, TYPE_NORMAL}, }; -const struct SpriteTemplate gUnknown_08329D98[MAX_BATTLERS_COUNT] = +const struct SpriteTemplate gBattlerSpriteTemplates[MAX_BATTLERS_COUNT] = { - { // B_POSITION_PLAYER_LEFT + [B_POSITION_PLAYER_LEFT] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, - .images = gUnknown_082FF3A8, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .images = gBattlerPicTable_PlayerLeft, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, - { // B_POSITION_OPPONENT_LEFT + [B_POSITION_OPPONENT_LEFT] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACA8, + .oam = &gOamData_BattleSpriteOpponentSide, .anims = NULL, - .images = gUnknown_082FF3C8, - .affineAnims = gUnknown_082FF694, + .images = gBattlerPicTable_OpponentLeft, + .affineAnims = gAffineAnims_BattleSpriteOpponentSide, .callback = SpriteCb_WildMon, }, - { // B_POSITION_PLAYER_RIGHT + [B_POSITION_PLAYER_RIGHT] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, - .images = gUnknown_082FF3E8, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .images = gBattlerPicTable_PlayerRight, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, - { // B_POSITION_OPPONENT_RIGHT + [B_POSITION_OPPONENT_RIGHT] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACA8, + .oam = &gOamData_BattleSpriteOpponentSide, .anims = NULL, - .images = gUnknown_082FF408, - .affineAnims = gUnknown_082FF694, + .images = gBattlerPicTable_OpponentRight, + .affineAnims = gAffineAnims_BattleSpriteOpponentSide, .callback = SpriteCb_WildMon }, }; -static const struct SpriteTemplate gSpriteTemplateTable_TrainerBackSprites[] = +static const struct SpriteTemplate sTrainerBackSpriteTemplates[] = { - { + [TRAINER_BACK_PIC_BRENDAN] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, .images = gTrainerBackPicTable_Brendan, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, - { + [TRAINER_BACK_PIC_MAY] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, .images = gTrainerBackPicTable_May, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, - { + [TRAINER_BACK_PIC_RED] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, .images = gTrainerBackPicTable_Red, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, - { + [TRAINER_BACK_PIC_LEAF] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, .images = gTrainerBackPicTable_Leaf, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, - { + [TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, .images = gTrainerBackPicTable_RubySapphireBrendan, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, - { + [TRAINER_BACK_PIC_RUBY_SAPPHIRE_MAY] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, .images = gTrainerBackPicTable_RubySapphireMay, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, - { + [TRAINER_BACK_PIC_WALLY] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, .images = gTrainerBackPicTable_Wally, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, - { + [TRAINER_BACK_PIC_STEVEN] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, .images = gTrainerBackPicTable_Steven, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, }; @@ -2623,14 +2623,15 @@ void CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u SetMonData(mon, MON_DATA_OBEDIENCE, &obedient); } -bool8 sub_80688F8(u8 caseId, u8 battlerId) +// If FALSE, should load this game's Deoxys form. If TRUE, should load normal Deoxys form +bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battlerId) { switch (caseId) { case 0: default: return FALSE; - case 1: + case 1: // Player's side in battle if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI)) return FALSE; if (!gMain.inBattle) @@ -2640,7 +2641,7 @@ bool8 sub_80688F8(u8 caseId, u8 battlerId) break; case 2: break; - case 3: + case 3: // Summary Screen if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI)) return FALSE; if (!gMain.inBattle) @@ -2650,7 +2651,7 @@ bool8 sub_80688F8(u8 caseId, u8 battlerId) return FALSE; case 4: break; - case 5: + case 5: // In move animation, e.g. in Role Play or Snatch if (gBattleTypeFlags & BATTLE_TYPE_LINK) { if (!gMain.inBattle) @@ -3454,7 +3455,7 @@ void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition) else if (gUnknown_020249B4[1]) gMultiuseSpriteTemplate = gUnknown_020249B4[1]->templates[battlerPosition]; else - gMultiuseSpriteTemplate = gUnknown_08329D98[battlerPosition]; + gMultiuseSpriteTemplate = gBattlerSpriteTemplates[battlerPosition]; gMultiuseSpriteTemplate.paletteTag = speciesTag; if (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_PLAYER_RIGHT) @@ -3470,7 +3471,7 @@ void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosit gMultiuseSpriteTemplate.paletteTag = trainerSpriteId; if (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_PLAYER_RIGHT) { - gMultiuseSpriteTemplate = gSpriteTemplateTable_TrainerBackSprites[trainerSpriteId]; + gMultiuseSpriteTemplate = sTrainerBackSpriteTemplates[trainerSpriteId]; gMultiuseSpriteTemplate.anims = gTrainerBackAnimsPtrTable[trainerSpriteId]; } else @@ -3478,7 +3479,7 @@ void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosit if (gMonSpritesGfxPtr != NULL) gMultiuseSpriteTemplate = gMonSpritesGfxPtr->templates[battlerPosition]; else - gMultiuseSpriteTemplate = gUnknown_08329D98[battlerPosition]; + gMultiuseSpriteTemplate = gBattlerSpriteTemplates[battlerPosition]; gMultiuseSpriteTemplate.anims = gTrainerFrontAnimsPtrTable[trainerSpriteId]; } } @@ -3488,7 +3489,7 @@ void SetMultiuseSpriteTemplateToTrainerFront(u16 arg0, u8 battlerPosition) if (gMonSpritesGfxPtr != NULL) gMultiuseSpriteTemplate = gMonSpritesGfxPtr->templates[battlerPosition]; else - gMultiuseSpriteTemplate = gUnknown_08329D98[battlerPosition]; + gMultiuseSpriteTemplate = gBattlerSpriteTemplates[battlerPosition]; gMultiuseSpriteTemplate.paletteTag = arg0; gMultiuseSpriteTemplate.anims = gTrainerFrontAnimsPtrTable[arg0]; @@ -5594,96 +5595,63 @@ u16 SpeciesToCryId(u16 species) return gSpeciesIdToCryId[species - (SPECIES_TREECKO - 1)]; } -void sub_806D544(u16 species, u32 personality, u8 *dest) +#define DRAW_SPINDA_SPOTS \ +{ \ + int i; \ + for (i = 0; i < 4; i++) \ + { \ + int j; \ + u8 x = gSpindaSpotGraphics[i].x + ((personality & 0x0F) - 8); \ + u8 y = gSpindaSpotGraphics[i].y + (((personality & 0xF0) >> 4) - 8); \ + \ + for (j = 0; j < 16; j++) \ + { \ + int k; \ + s32 row = gSpindaSpotGraphics[i].image[j]; \ + \ + for (k = x; k < x + 16; k++) \ + { \ + u8 *val = dest + ((k / 8) * 32) + \ + ((k % 8) / 2) + \ + ((y >> 3) << 8) + \ + ((y & 7) << 2); \ + \ + if (row & 1) \ + { \ + if (k & 1) \ + { \ + if ((u8)((*val & 0xF0) - 0x10) <= 0x20) \ + *val += 0x40; \ + } \ + else \ + { \ + if ((u8)((*val & 0xF) - 0x01) <= 0x02) \ + *val += 0x04; \ + } \ + } \ + \ + row >>= 1; \ + } \ + \ + y++; \ + } \ + \ + personality >>= 8; \ + } \ +} + +static void DrawSpindaSpotsUnused(u16 species, u32 personality, u8 *dest) { if (species == SPECIES_SPINDA && dest != gMonSpritesGfxPtr->sprites.ptr[0] && dest != gMonSpritesGfxPtr->sprites.ptr[2]) - { - int i; - for (i = 0; i < 4; i++) - { - int j; - u8 x = gSpindaSpotGraphics[i].x + ((personality & 0x0F) - 8); - u8 y = gSpindaSpotGraphics[i].y + (((personality & 0xF0) >> 4) - 8); - - for (j = 0; j < 16; j++) - { - int k; - s32 row = gSpindaSpotGraphics[i].image[j]; - - for (k = x; k < x + 16; k++) - { - u8 *val = dest + ((k / 8) * 32) + ((k % 8) / 2) + ((y >> 3) << 8) + ((y & 7) << 2); - - if (row & 1) - { - if (k & 1) - { - if ((u8)((*val & 0xF0) - 0x10) <= 0x20) - *val += 0x40; - } - else - { - if ((u8)((*val & 0xF) - 0x01) <= 0x02) - *val += 0x04; - } - } - - row >>= 1; - } - - y++; - } - - personality >>= 8; - } - } + DRAW_SPINDA_SPOTS; } -void DrawSpindaSpots(u16 species, u32 personality, u8 *dest, u8 a4) +void DrawSpindaSpots(u16 species, u32 personality, u8 *dest, bool8 isFrontPic) { - if (species == SPECIES_SPINDA && a4) - { - int i; - for (i = 0; i < 4; i++) - { - int j; - u8 x = gSpindaSpotGraphics[i].x + ((personality & 0x0F) - 8); - u8 y = gSpindaSpotGraphics[i].y + (((personality & 0xF0) >> 4) - 8); - - for (j = 0; j < 16; j++) - { - int k; - s32 row = gSpindaSpotGraphics[i].image[j]; - - for (k = x; k < x + 16; k++) - { - u8 *val = dest + ((k / 8) * 32) + ((k % 8) / 2) + ((y >> 3) << 8) + ((y & 7) << 2); - - if (row & 1) - { - if (k & 1) - { - if ((u8)((*val & 0xF0) - 0x10) <= 0x20) - *val += 0x40; - } - else - { - if ((u8)((*val & 0xF) - 0x01) <= 0x02) - *val += 0x04; - } - } - - row >>= 1; - } - - y++; - } - - personality >>= 8; - } - } + if (species == SPECIES_SPINDA && isFrontPic) + DRAW_SPINDA_SPOTS; } void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies) @@ -6824,7 +6792,7 @@ static void sub_806F160(struct Unknown_806F160_Struct* structPtr) u16 i, j; for (i = 0; i < structPtr->field_0_0; i++) { - structPtr->templates[i] = gUnknown_08329D98[i]; + structPtr->templates[i] = gBattlerSpriteTemplates[i]; for (j = 0; j < structPtr->field_1; j++) { structPtr->frameImages[i * structPtr->field_1 + j].data = &structPtr->byteArrays[i][j * 0x800]; diff --git a/src/pokemon_animation.c b/src/pokemon_animation.c index 9c8eaca9ad..da30963b55 100644 --- a/src/pokemon_animation.c +++ b/src/pokemon_animation.c @@ -1047,7 +1047,7 @@ static void sub_817F77C(struct Sprite *sprite) { // FIX: Reset these back to normal after they were changed so Poké Ball catch/release // animations without a screen transition in between don't break - sprite->affineAnims = gUnknown_082FF694; + sprite->affineAnims = gAffineAnims_BattleSpriteOpponentSide; } #endif // BUGFIX } diff --git a/src/pokemon_jump.c b/src/pokemon_jump.c index 914752eb4c..af40c2c188 100755 --- a/src/pokemon_jump.c +++ b/src/pokemon_jump.c @@ -3426,8 +3426,8 @@ static void sub_802DB8C(void) static const u8 gUnknown_082FE1DF[] = {2, 2, 0, 0, 1, 1, 1, 0, 0, 2, 0, 0, 0}; -static const struct CompressedSpriteSheet gUnknown_082FE1EC = {gUnknown_082FF1F8, 0, 0x320}; -static const struct SpritePalette gUnknown_082FE1F4 = {gUnknown_082FF1D8, 0x320}; +static const struct CompressedSpriteSheet sSpriteSheet_Digits = {gMinigameDigits_Gfx, 0, 0x320}; +static const struct SpritePalette sSpritePalette_Digits = {gMinigameDigits_Pal, 0x320}; static const u16 gUnknown_082FE1FC[] = {0x06, 0x08, 0x10, 0x08}; static const u16 gUnknown_082FE204[] = {0x06, 0x08, 0x0b, 0x06, 0x10, 0x08}; @@ -3513,8 +3513,8 @@ static void sub_802DD08(void) ptr->xDelta = 8; ptr->x = 108; ptr->y = 6; - ptr->spriteSheet = (void*) &gUnknown_082FE1EC; - ptr->spritePal = &gUnknown_082FE1F4; + ptr->spriteSheet = (void*) &sSpriteSheet_Digits; + ptr->spritePal = &sSpritePalette_Digits; DigitObjUtil_Init(2); DigitObjUtil_CreatePrinter(0, 0, ptr); diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index fce2a893c5..b3cc1e5161 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -3857,7 +3857,7 @@ static u8 LoadMonGfxAndSprite(struct Pokemon *mon, s16 *state) case 0: if (gMain.inBattle) { - if (sub_80688F8(3, sMonSummaryScreen->curMonIndex)) + if (ShouldIgnoreDeoxysForm(3, sMonSummaryScreen->curMonIndex)) HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[summary->species2], gMonSpritesGfxPtr->sprites.ptr[1], summary->species2, summary->pid); else HandleLoadSpecialPokePic_2(&gMonFrontPicTable[summary->species2], gMonSpritesGfxPtr->sprites.ptr[1], summary->species2, summary->pid); diff --git a/src/trainer_pokemon_sprites.c b/src/trainer_pokemon_sprites.c index c23047b01d..aab4142dbb 100644 --- a/src/trainer_pokemon_sprites.c +++ b/src/trainer_pokemon_sprites.c @@ -262,12 +262,12 @@ u16 CreatePicSprite2(u16 species, u32 otId, u32 personality, u8 flags, s16 x, s1 sCreatingSpriteTemplate.images = images; if (flags2 == 0x01) { - sCreatingSpriteTemplate.affineAnims = gUnknown_082FF694; + sCreatingSpriteTemplate.affineAnims = gAffineAnims_BattleSpriteOpponentSide; sCreatingSpriteTemplate.oam = &gUnknown_0860B06C; } else if (flags2 == 0x00) { - sCreatingSpriteTemplate.affineAnims = gUnknown_082FF618; + sCreatingSpriteTemplate.affineAnims = gAffineAnims_BattleSpritePlayerSide; sCreatingSpriteTemplate.oam = &gUnknown_0860B06C; } else