diff --git a/.gitignore b/.gitignore index aac515a31..f450c83f7 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ *.elf *.gba *.sgm +*.sa1 +*.sg1 *.1bpp *.4bpp *.8bpp diff --git a/asm/battle_2.s b/asm/battle_2.s index 53b83c10e..dd3e6d38c 100644 --- a/asm/battle_2.s +++ b/asm/battle_2.s @@ -95,7 +95,7 @@ InitBattle: @ 80367D4 ands r0, r1 cmp r0, 0 beq _08036870 - ldr r0, =gUnknown_02038BCE + ldr r0, =gPartnerTrainerId ldrh r1, [r0] ldr r0, =0x00000c03 cmp r1, r0 @@ -410,7 +410,7 @@ sub_8036B44: @ 8036B44 movs r0, 0xC2 lsls r0, 1 adds r4, r5, r0 - bl sub_80E162C + bl IsEnigmaBerryValid cmp r0, 0x1 bne _08036BC0 movs r2, 0 @@ -513,7 +513,7 @@ berry_801017C: @ 8036C08 beq _08036C20 b _08036D4C _08036C20: - bl sub_80E162C + bl IsEnigmaBerryValid cmp r0, 0x1 bne _08036CDC movs r5, 0 @@ -1537,12 +1537,12 @@ _08037530: adds r0, 0x40 ldr r4, =gTrainerBattleOpponent_A ldrh r1, [r4] - bl sub_8162E20 + bl GetFrontierTrainerName adds r0, r6, 0 adds r0, 0x5C ldr r5, =gTrainerBattleOpponent_B ldrh r1, [r5] - bl sub_8162E20 + bl GetFrontierTrainerName ldrh r1, [r4] mov r0, sp bl sub_8165B88 @@ -5470,17 +5470,17 @@ sub_8039894: @ 8039894 adds r0, r2, 0 movs r2, 0 movs r3, 0x1 - bl sub_806ECEC + bl BattleAnimateFrontSprite _080398B0: pop {r0} bx r0 .pool thumb_func_end sub_8039894 - thumb_func_start nullsub_18 -nullsub_18: @ 80398B8 + thumb_func_start SpriteCallbackDummy_2 +SpriteCallbackDummy_2: @ 80398B8 bx lr - thumb_func_end nullsub_18 + thumb_func_end SpriteCallbackDummy_2 thumb_func_start sub_80398BC sub_80398BC: @ 80398BC @@ -5534,7 +5534,7 @@ sub_80398D0: @ 80398D0 ands r0, r1 mov r1, r12 strb r0, [r1] - ldr r0, =nullsub_18 + ldr r0, =SpriteCallbackDummy_2 str r0, [r3, 0x1C] ldr r0, =gUnknown_02022F88 str r2, [r0] @@ -5635,7 +5635,7 @@ _080399E4: cmp r4, r0 bne _08039A08 ldr r0, =gUnknown_08525F78 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r1, r6, r1 ldrb r1, [r1] lsls r1, 2 @@ -5708,13 +5708,13 @@ _08039A7C: lsls r0, 24 lsrs r0, 24 bl GetBankIdentity - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] lsls r0, 24 lsrs r0, 22 adds r1, 0x4 adds r1, r0 - ldr r2, =gUnknown_020244E4 + ldr r2, =gBattleMonForms movs r3, 0x2E ldrsh r0, [r4, r3] adds r0, r2 @@ -5734,7 +5734,7 @@ _08039AAE: subs r0, 0x1 cmp r0, 0 bge _08039AAE - ldr r0, =gUnknown_020244E4 + ldr r0, =gBattleMonForms movs r3, 0x2E ldrsh r1, [r4, r3] adds r1, r0 @@ -5815,7 +5815,7 @@ sub_8039B2C: @ 8039B2C strb r1, [r2] movs r1, 0 strh r1, [r0, 0x36] - ldr r1, =nullsub_18 + ldr r1, =SpriteCallbackDummy_2 str r1, [r0, 0x1C] bx lr .pool @@ -5845,7 +5845,7 @@ sub_8039B58: @ 8039B58 beq _08039B94 _08039B80: ldrh r0, [r4, 0x32] - bl sub_806F0D4 + bl HasTwoFramesAnimation lsls r0, 24 cmp r0, 0 beq _08039B94 @@ -5857,7 +5857,7 @@ _08039B94: adds r0, r4, 0 movs r2, 0x1 movs r3, 0x1 - bl sub_806ECEC + bl BattleAnimateFrontSprite _08039BA0: pop {r4} pop {r0} @@ -6212,7 +6212,7 @@ sub_8039E44: @ 8039E44 beq _08039E5C ldrh r1, [r2, 0x32] adds r0, r2, 0 - bl sub_806EEB4 + bl BattleAnimateBackSprite _08039E5C: pop {r0} bx r0 @@ -8082,7 +8082,7 @@ _0803AE0A: add r1, r10 ldr r2, [r1] movs r1, 0x2 - bl SetPokedexFlag + bl HandleSetPokedexFlag b _0803AEC0 .pool _0803AE60: @@ -8109,7 +8109,7 @@ _0803AE60: add r1, r10 ldr r2, [r1] movs r1, 0x2 - bl SetPokedexFlag + bl HandleSetPokedexFlag _0803AE96: movs r0, 0 bl dp01_build_cmdbuf_x04_4_4_4 @@ -8669,7 +8669,7 @@ _0803B334: adds r1, r7 ldr r2, [r1] movs r1, 0x2 - bl SetPokedexFlag + bl HandleSetPokedexFlag _0803B36C: ldrb r0, [r4] adds r0, 0x1 @@ -9615,7 +9615,7 @@ _0803BBB8: lsls r0, 24 lsrs r2, r0, 24 _0803BBC2: - ldr r1, =gUnknown_0202420F + ldr r1, =gStringBank ldr r3, =gActiveBank ldrb r0, [r3] strb r0, [r1] @@ -10556,7 +10556,7 @@ _0803C42E: b _0803C6C4 .pool _0803C440: - bl PlayerPartyAndPokemonStorageFull + bl IsPlayerPartyAndPokemonStorageFull lsls r0, 24 cmp r0, 0 bne _0803C44C @@ -14854,7 +14854,7 @@ _0803EC54: lsls r0, 24 lsrs r1, r0, 24 _0803EC5E: - ldr r0, =gUnknown_0202420F + ldr r0, =gStringBank strb r5, [r0] cmp r1, 0x25 bne _0803EC9C diff --git a/asm/battle_3.s b/asm/battle_3.s index b314b6b5b..f2e384c86 100644 --- a/asm/battle_3.s +++ b/asm/battle_3.s @@ -315,7 +315,7 @@ _0803FDC4: lsls r0, 24 lsrs r4, r0, 24 _0803FDCE: - ldr r2, =gUnknown_0202420F + ldr r2, =gStringBank ldr r1, =gActiveBank ldrb r0, [r1] strb r0, [r2] @@ -466,7 +466,7 @@ _0803FF1C: lsls r1, r7, 3 ldr r3, [sp, 0x14] _0803FF2E: - ldr r0, =gUnknown_0202420F + ldr r0, =gStringBank strb r7, [r0] movs r0, 0 mov r9, r0 @@ -8351,7 +8351,7 @@ _0804463C: _08044654: ldr r0, =gBattleScripting strb r7, [r0, 0x17] - ldr r0, =gUnknown_0202420F + ldr r0, =gStringBank strb r7, [r0] ldr r1, =gActiveBank ldr r0, =gBankAttacker @@ -8612,7 +8612,7 @@ _080448CE: _080448EA: ldr r0, =gBattleScripting strb r7, [r0, 0x17] - ldr r0, =gUnknown_0202420F + ldr r0, =gStringBank strb r7, [r0] ldr r1, =gActiveBank ldr r0, =gBankAttacker @@ -9682,7 +9682,7 @@ _080451D6: _080451DE: ldr r0, =gBattleScripting strb r7, [r0, 0x17] - ldr r0, =gUnknown_0202420F + ldr r0, =gStringBank strb r7, [r0] ldr r4, =gActiveBank ldr r0, =gBankAttacker @@ -10135,7 +10135,7 @@ _08045638: beq _080456B8 ldr r0, =gBattleScripting strb r7, [r0, 0x17] - ldr r0, =gUnknown_0202420F + ldr r0, =gStringBank strb r7, [r0] bl b_movescr_stack_push_cursor ldr r1, =gBattlescriptCurrInstr @@ -10150,7 +10150,7 @@ _08045674: _0804567A: ldr r0, =gBattleScripting strb r7, [r0, 0x17] - ldr r0, =gUnknown_0202420F + ldr r0, =gStringBank strb r7, [r0] ldr r4, =gActiveBank strb r7, [r4] @@ -10305,7 +10305,7 @@ _08045794: mov r1, sp ldrh r1, [r1, 0x14] strh r1, [r0] - ldr r0, =gUnknown_0202420F + ldr r0, =gStringBank strb r3, [r0] ldr r0, =gBattleScripting strb r3, [r0, 0x17] diff --git a/asm/battle_4.s b/asm/battle_4.s index 609a74566..8651b9724 100644 --- a/asm/battle_4.s +++ b/asm/battle_4.s @@ -1040,7 +1040,7 @@ _08046928: lsls r0, 24 lsrs r2, r0, 24 _08046944: - ldr r0, =gUnknown_0202420F + ldr r0, =gStringBank ldr r1, =gBankTarget ldrb r1, [r1] strb r1, [r0] @@ -1390,7 +1390,7 @@ _08046C48: lsls r0, 24 lsrs r6, r0, 24 _08046C50: - ldr r1, =gUnknown_0202420F + ldr r1, =gStringBank ldr r3, =gBankAttacker ldrb r0, [r3] strb r0, [r1] @@ -2982,7 +2982,7 @@ _0804795C: lsls r0, 24 lsrs r6, r0, 24 _08047976: - ldr r1, =gUnknown_0202420F + ldr r1, =gStringBank ldr r5, =gBankTarget ldrb r0, [r5] strb r0, [r1] @@ -3169,7 +3169,7 @@ _08047B0C: lsls r0, 24 lsrs r6, r0, 24 _08047B26: - ldr r1, =gUnknown_0202420F + ldr r1, =gStringBank ldr r5, =gBankTarget ldrb r0, [r5] strb r0, [r1] @@ -4230,7 +4230,7 @@ _08048478: adds r0, r2 ldrh r0, [r0, 0x2E] strh r0, [r4] - ldr r1, =gUnknown_0202420F + ldr r1, =gStringBank ldrb r0, [r3] strb r0, [r1] movs r0, 0x3F @@ -4295,7 +4295,7 @@ _08048510: adds r0, r2 ldrh r0, [r0, 0x2E] strh r0, [r4] - ldr r1, =gUnknown_0202420F + ldr r1, =gStringBank ldrb r0, [r3] strb r0, [r1] movs r0, 0x3F @@ -8717,7 +8717,7 @@ _0804ACE2: ands r0, r1 cmp r0, 0 beq _0804AD48 - ldr r0, =gUnknown_02038BCE + ldr r0, =gPartnerTrainerId ldrh r1, [r0] ldr r0, =0x00000c03 cmp r1, r0 @@ -12378,7 +12378,7 @@ atk4E_switchin_anim: @ 804CAE8 adds r1, r4 ldr r2, [r1] movs r1, 0x2 - bl SetPokedexFlag + bl HandleSetPokedexFlag _0804CB3E: ldr r2, =gAbsentBankFlags ldr r1, =gBitTable @@ -16226,7 +16226,7 @@ _0804ED10: lsls r0, 24 lsrs r6, r0, 24 _0804ED2A: - ldr r1, =gUnknown_0202420F + ldr r1, =gStringBank ldr r5, =gBankTarget ldrb r0, [r5] strb r0, [r1] @@ -17407,7 +17407,7 @@ _0804F73E: atk75_8026A58: @ 804F754 push {lr} sub sp, 0x4 - ldr r2, =gUnknown_020244B8 + ldr r2, =gBankInMenu ldr r1, =gBankAttacker ldrb r0, [r1] strb r0, [r2] @@ -21095,7 +21095,7 @@ _08051768: lsls r0, 24 lsrs r6, r0, 24 _08051782: - ldr r1, =gUnknown_0202420F + ldr r1, =gStringBank ldr r5, =gBankTarget ldrb r0, [r5] strb r0, [r1] @@ -29984,7 +29984,7 @@ _08056480: lsls r0, 16 lsrs r0, 16 movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 movs r4, 0xA cmp r0, 0 @@ -30385,7 +30385,7 @@ atkF1_setpoke_as_caught: @ 8056850 lsls r0, 16 lsrs r0, 16 movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _080568A8 @@ -30411,7 +30411,7 @@ _080568A8: lsrs r0, 16 movs r1, 0x3 adds r2, r4, 0 - bl SetPokedexFlag + bl HandleSetPokedexFlag ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] adds r0, 0x5 diff --git a/asm/battle_7.s b/asm/battle_7.s index b92d69947..fd8c3b4a5 100644 --- a/asm/battle_7.s +++ b/asm/battle_7.s @@ -991,7 +991,7 @@ move_anim_start_t3: @ 805D908 ands r0, r7 cmp r0, 0 beq _0805D950 - ldr r0, =gUnknown_020244E4 + ldr r0, =gBattleMonForms adds r0, r6, r0 movs r2, 0x7F adds r1, r7, 0 @@ -1371,7 +1371,7 @@ _0805DC58: lsls r2, r5, 3 ldr r1, =gMonFrontPicTable adds r2, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] lsrs r0, 22 adds r1, 0x4 @@ -1433,7 +1433,7 @@ _0805DCC6: adds r1, r4 adds r0, r6, 0 bl LZDecompressWram - ldr r0, =gUnknown_020244E4 + ldr r0, =gBattleMonForms add r0, r8 ldrb r1, [r0] lsls r1, 5 @@ -1543,7 +1543,7 @@ _0805DE00: lsls r0, r5, 3 ldr r1, =gMonBackPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] lsls r2, r7, 2 adds r1, 0x4 @@ -1558,7 +1558,7 @@ _0805DE2C: lsls r0, r5, 3 ldr r1, =gMonBackPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] lsls r2, r7, 2 adds r1, 0x4 @@ -1618,7 +1618,7 @@ _0805DE7E: adds r1, r4 adds r0, r6, 0 bl LZDecompressWram - ldr r0, =gUnknown_020244E4 + ldr r0, =gBattleMonForms add r0, r8 ldrb r1, [r0] lsls r1, 5 @@ -1684,7 +1684,7 @@ sub_805DF38: @ 805DF38 lsls r4, 3 ldr r2, =gTrainerFrontPicTable adds r2, r4, r2 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] lsrs r0, 22 adds r1, 0x4 @@ -1718,7 +1718,7 @@ sub_805DF84: @ 805DF84 lsls r5, 3 ldr r2, =gTrainerBackPicTable adds r2, r5, r2 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] lsrs r0, 22 adds r1, 0x4 @@ -1959,7 +1959,7 @@ _0805E1AE: load_gfxc_health_bar: @ 805E1B8 push {lr} ldr r0, =gUnknown_08C093F0 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] movs r2, 0xBA lsls r2, 1 @@ -2308,7 +2308,7 @@ sub_805E448: @ 805E448 adds r1, r6, 0 movs r2, 0x20 bl LoadPalette - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r1, r7, r1 ldr r0, [r4] ldr r0, [r0, 0x8] @@ -2364,7 +2364,7 @@ _0805E51C: lsls r0, r1, 3 ldr r1, =gMonBackPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] ldr r1, [r1, 0x4] ldr r3, [r2, 0x10] @@ -2434,7 +2434,7 @@ _0805E59C: lsls r0, r1, 3 ldr r1, =gMonBackPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] mov r3, r10 lsls r2, r3, 2 @@ -2472,7 +2472,7 @@ _0805E618: lsls r0, r1, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] mov r3, r10 lsls r2, r3, 2 @@ -2486,7 +2486,7 @@ _0805E618: mov r2, r8 bl HandleLoadSpecialPokePic_DontHandleDeoxys _0805E662: - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleSpritesGfx ldr r0, [r0] mov r2, r10 lsls r1, r2, 2 @@ -2554,7 +2554,7 @@ _0805E662: adds r1, r4 mov r0, r9 bl LZDecompressWram - ldr r0, =gUnknown_020244E4 + ldr r0, =gBattleMonForms ldr r1, [sp] adds r0, r1, r0 ldrb r1, [r0] @@ -2589,7 +2589,7 @@ _0805E70A: adds r0, r1 mov r2, r8 strh r2, [r0, 0x2] - ldr r0, =gUnknown_020244E4 + ldr r0, =gBattleMonForms adds r1, r7, r0 ldr r3, [sp] adds r0, r3, r0 @@ -2614,7 +2614,7 @@ _0805E74A: adds r0, r1 lsls r0, 2 adds r0, r2 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r1, r7, r1 ldrb r1, [r1] bl StartSpriteAnim @@ -2666,7 +2666,7 @@ _0805E814: beq _0805E83C ldr r0, =gUnknown_08C2CEE0 _0805E822: - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] lsls r4, 2 adds r1, 0x4 @@ -2677,7 +2677,7 @@ _0805E822: .pool _0805E83C: ldr r0, =gUnknown_08C2D120 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] lsls r4, 2 adds r1, 0x4 @@ -2688,7 +2688,7 @@ _0805E84E: movs r3, 0x1 lsls r6, r5, 4 ldr r7, =gUnknown_08C2CEBC - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleSpritesGfx ldr r0, [r0] adds r0, 0x4 adds r4, r0, r4 @@ -2772,7 +2772,7 @@ refresh_graphics_maybe: @ 805E8F4 lsls r0, 2 ldr r1, =gSprites adds r4, r0, r1 - ldr r0, =gUnknown_020244E4 + ldr r0, =gBattleMonForms adds r0, r6, r0 ldrb r1, [r0] adds r0, r4, 0 @@ -3586,7 +3586,7 @@ sub_805EF84: @ 805EF84 movs r3, 0 movs r2, 0 strh r2, [r0, 0x2] - ldr r0, =gUnknown_020244E4 + ldr r0, =gBattleMonForms adds r0, r4, r0 strb r3, [r0] cmp r1, 0 @@ -3608,7 +3608,7 @@ init_uns_table_pokemon_copy: @ 805EFBC mov r5, r8 push {r5-r7} movs r6, 0 - ldr r4, =gUnknown_020244D4 + ldr r4, =gBattleSpritesGfx str r6, [r4] movs r0, 0xC0 lsls r0, 1 @@ -3620,7 +3620,7 @@ init_uns_table_pokemon_copy: @ 805EFBC ldr r1, [r4] str r0, [r1] _0805EFE2: - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleSpritesGfx ldr r1, [r0] lsls r4, r6, 2 adds r2, r1, 0x4 @@ -3649,7 +3649,7 @@ _0805EFE2: mov r12, r8 adds r7, r4, 0 _0805F01A: - ldr r2, =gUnknown_020244D4 + ldr r2, =gBattleSpritesGfx ldr r1, [r2] lsls r4, r5, 3 add r4, r12 @@ -3672,7 +3672,7 @@ _0805F01A: lsrs r5, r0, 24 cmp r5, 0x3 bls _0805F01A - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r2, [r1] mov r5, r9 adds r0, r5, r6 @@ -3692,7 +3692,7 @@ _0805F01A: movs r0, 0x80 lsls r0, 5 bl AllocZeroed - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] movs r2, 0xBA lsls r2, 1 @@ -3711,7 +3711,7 @@ _0805F01A: thumb_func_start sub_805F094 sub_805F094: @ 805F094 push {r4-r6,lr} - ldr r6, =gUnknown_020244D4 + ldr r6, =gBattleSpritesGfx ldr r0, [r6] cmp r0, 0 beq _0805F106 diff --git a/asm/battle_anim_80FE840.s b/asm/battle_anim_80FE840.s index 9bcbbe0c5..fc2c36fc8 100644 --- a/asm/battle_anim_80FE840.s +++ b/asm/battle_anim_80FE840.s @@ -14561,7 +14561,7 @@ _08105CCC: lsls r0, 6 bl AllocZeroed adds r1, r0, 0 - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleSpritesGfx ldr r0, [r0] movs r2, 0xBE lsls r2, 1 @@ -14571,7 +14571,7 @@ _08105CCC: bl LZDecompressWram movs r4, 0 _08105D00: - ldr r5, =gUnknown_020244D4 + ldr r5, =gBattleSpritesGfx ldr r0, [r5] movs r1, 0xBE lsls r1, 1 @@ -49777,7 +49777,7 @@ sub_8117C44: @ 8117C44 movs r0, 0x80 lsls r0, 6 bl AllocZeroed - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] movs r2, 0xBE lsls r2, 1 @@ -49797,7 +49797,7 @@ sub_8117C70: @ 8117C70 adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - ldr r6, =gUnknown_020244D4 + ldr r6, =gBattleSpritesGfx ldr r0, [r6] movs r5, 0xBE lsls r5, 1 @@ -49866,7 +49866,7 @@ _08117CF6: adds r4, r0, 0 adds r4, 0x10 _08117CFC: - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleSpritesGfx ldr r1, [r0] ldr r0, =gBattleAnimArgs movs r2, 0x2 @@ -49944,7 +49944,7 @@ _08117D98: lsls r0, r4, 5 ldr r1, =gPlttBufferUnfaded adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r2, [r1] ldr r1, =gBattleAnimArgs movs r3, 0x2 @@ -50455,7 +50455,7 @@ battle_intro_launch: @ 81181D4 ands r0, r1 cmp r0, 0 beq _08118208 - ldr r0, =gUnknown_02038BCE + ldr r0, =gPartnerTrainerId ldrh r1, [r0] ldr r0, =0x00000c03 cmp r1, r0 @@ -52081,12 +52081,12 @@ sub_8118FBC: @ 8118FBC bl GetBankByPlayerAI lsls r0, 24 lsrs r0, 24 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r2, [r1] lsls r4, 2 adds r2, 0x4 adds r2, r4 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r0, r1 ldrb r1, [r0] lsls r1, 11 @@ -52189,7 +52189,7 @@ sub_8119094: @ 8119094 lsls r0, 24 mov r9, r0 ldr r4, =0x040000d4 - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleSpritesGfx ldr r0, [r0] lsrs r2, 22 adds r0, 0x4 diff --git a/asm/battle_controller_linkopponent.s b/asm/battle_controller_linkopponent.s index e07ec2dbb..d28823a8b 100644 --- a/asm/battle_controller_linkopponent.s +++ b/asm/battle_controller_linkopponent.s @@ -1230,7 +1230,7 @@ sub_8064DD0: @ 8064DD0 ldr r0, =SpriteCallbackDummy cmp r1, r0 beq _08064E1A - ldr r0, =nullsub_18 + ldr r0, =SpriteCallbackDummy_2 cmp r1, r0 bne _08064E2A _08064E1A: @@ -3655,7 +3655,7 @@ sub_80662F8: @ 80662F8 adds r0, r1 lsls r0, 2 adds r0, r5 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r2, r1 ldrb r1, [r2] bl StartSpriteAnim @@ -3850,7 +3850,7 @@ sub_8066494: @ 8066494 adds r0, r1 lsls r0, 2 adds r0, r5 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r6, r1 ldrb r1, [r6] bl StartSpriteAnim @@ -4193,13 +4193,13 @@ _08066892: cmp r0, 0 beq _080668BC _080668AA: - ldr r0, =gTrainerPicIndices + ldr r0, =gUnknown_0831F578 adds r0, 0x4F ldrb r0, [r0] b _0806694C .pool _080668BC: - ldr r0, =gTrainerPicIndices + ldr r0, =gUnknown_0831F578 adds r0, 0x4E ldrb r0, [r0] b _0806694C @@ -4243,13 +4243,13 @@ _080668FE: cmp r0, 0 beq _08066924 _08066916: - ldr r0, =gTrainerPicIndices + ldr r0, =gUnknown_0831F578 adds r0, 0x51 ldrb r0, [r0] b _0806694C .pool _08066924: - ldr r0, =gTrainerPicIndices + ldr r0, =gUnknown_0831F578 adds r0, 0x50 ldrb r0, [r0] b _0806694C @@ -4280,7 +4280,7 @@ _0806694C: lsls r1, 24 lsrs r1, 24 mov r0, r8 - bl template_build_for_pokemon_or_trainer + bl sub_806A12C ldr r6, =gUnknown_0202499C mov r9, r7 ldr r1, =gUnknown_083054E0 @@ -4409,7 +4409,7 @@ _08066A76: lsls r1, 24 lsrs r1, 24 mov r0, r8 - bl template_build_for_pokemon_or_trainer + bl sub_806A12C ldr r0, =gUnknown_0202499C ldr r2, =gUnknown_083054E0 mov r3, r8 diff --git a/asm/battle_controller_linkpartner.s b/asm/battle_controller_linkpartner.s index dbe8052b9..881228279 100644 --- a/asm/battle_controller_linkpartner.s +++ b/asm/battle_controller_linkpartner.s @@ -3237,7 +3237,7 @@ sub_814CB0C: @ 814CB0C adds r0, r1 lsls r0, 2 adds r0, r5 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r2, r1 ldrb r1, [r2] bl StartSpriteAnim @@ -3419,7 +3419,7 @@ sub_814CC98: @ 814CC98 adds r0, r1 lsls r0, 2 adds r0, r5 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r6, r1 ldrb r1, [r6] bl StartSpriteAnim @@ -3703,7 +3703,7 @@ _0814D002: lsls r1, 24 lsrs r1, 24 adds r0, r4, 0 - bl template_build_for_pokemon_or_trainer + bl sub_806A12C ldr r6, =gUnknown_0202499C mov r8, r7 ldr r0, =gUnknown_08305D2C diff --git a/asm/battle_controller_opponent.s b/asm/battle_controller_opponent.s index 9e2512227..639ef0ce6 100644 --- a/asm/battle_controller_opponent.s +++ b/asm/battle_controller_opponent.s @@ -1324,7 +1324,7 @@ bx_803AEDC: @ 805FC80 ldr r0, =SpriteCallbackDummy cmp r1, r0 beq _0805FCCA - ldr r0, =nullsub_18 + ldr r0, =SpriteCallbackDummy_2 cmp r1, r0 bne _0805FCDA _0805FCCA: @@ -3811,7 +3811,7 @@ sub_8061224: @ 8061224 adds r0, r1 lsls r0, 2 adds r0, r5 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r2, r1 ldrb r1, [r2] bl StartSpriteAnim @@ -4012,7 +4012,7 @@ sub_80613DC: @ 80613DC adds r0, r1 lsls r0, 2 adds r0, r5 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r6, r1 ldrb r1, [r6] bl StartSpriteAnim @@ -4336,7 +4336,7 @@ _080617CA: lsls r1, 24 lsrs r1, 24 mov r0, r8 - bl template_build_for_pokemon_or_trainer + bl sub_806A12C ldr r6, =gUnknown_0202499C mov r9, r7 ldr r1, =gUnknown_083054E0 @@ -4562,7 +4562,7 @@ _080619DE: lsls r1, 24 lsrs r1, 24 mov r0, r8 - bl template_build_for_pokemon_or_trainer + bl sub_806A12C ldr r0, =gUnknown_0202499C ldr r2, =gUnknown_083054E0 mov r3, r8 diff --git a/asm/battle_controller_player.s b/asm/battle_controller_player.s index 5854d5e47..0e9318dc9 100644 --- a/asm/battle_controller_player.s +++ b/asm/battle_controller_player.s @@ -4127,7 +4127,7 @@ sub_80598E0: @ 80598E0 ands r0, r1 cmp r0, 0 bne _08059906 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r1, [r0] movs r0, 0x1 bl dp01_build_cmdbuf_x23_aa_0 @@ -7067,7 +7067,7 @@ sub_805B258: @ 805B258 adds r0, r1 lsls r0, 2 adds r0, r5 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r6, r1 ldrb r1, [r6] bl StartSpriteAnim @@ -7364,7 +7364,7 @@ _0805B5E0: ands r0, r1 cmp r0, 0 beq _0805B618 - ldr r0, =gUnknown_02038BCE + ldr r0, =gPartnerTrainerId ldrh r1, [r0] ldr r0, =0x00000c03 cmp r1, r0 @@ -7413,7 +7413,7 @@ _0805B656: bne _0805B664 b _0805B794 _0805B664: - ldr r0, =gUnknown_02038BCE + ldr r0, =gPartnerTrainerId ldrh r1, [r0] ldr r0, =0x00000c03 cmp r1, r0 @@ -7549,7 +7549,7 @@ _0805B794: lsls r1, 24 lsrs r1, 24 adds r0, r4, 0 - bl template_build_for_pokemon_or_trainer + bl sub_806A12C ldr r6, =gUnknown_0202499C mov r8, r9 lsls r4, r7, 16 @@ -7731,7 +7731,7 @@ _0805B926: lsls r1, 24 lsrs r1, 24 adds r0, r4, 0 - bl template_build_for_pokemon_or_trainer + bl sub_806A12C ldr r0, =gUnknown_0202499C ldr r1, =gUnknown_08305D2C lsls r4, 2 @@ -8748,7 +8748,7 @@ sub_805C248: @ 805C248 adds r0, r1 ldr r1, =sub_80598A4 str r1, [r0] - ldr r1, =gUnknown_020244B8 + ldr r1, =gBankInMenu ldrb r0, [r2] strb r0, [r1] movs r3, 0 @@ -8896,7 +8896,7 @@ _0805C330: adds r0, r1 ldr r1, =sub_80597CC str r1, [r0] - ldr r1, =gUnknown_020244B8 + ldr r1, =gBankInMenu ldrb r0, [r4] strb r0, [r1] _0805C3BC: diff --git a/asm/battle_controller_player_partner.s b/asm/battle_controller_player_partner.s index 481096ffb..6b5a14f95 100644 --- a/asm/battle_controller_player_partner.s +++ b/asm/battle_controller_player_partner.s @@ -3812,7 +3812,7 @@ sub_81BCF58: @ 81BCF58 adds r0, r1 lsls r0, 2 adds r0, r5 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r2, r1 ldrb r1, [r2] bl StartSpriteAnim @@ -3994,7 +3994,7 @@ sub_81BD0E4: @ 81BD0E4 adds r0, r1 lsls r0, 2 adds r0, r5 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r6, r1 ldrb r1, [r6] bl StartSpriteAnim @@ -4174,7 +4174,7 @@ sub_81BD37C: @ 81BD37C mov r7, r9 mov r6, r8 push {r6,r7} - ldr r2, =gUnknown_02038BCE + ldr r2, =gPartnerTrainerId ldrh r1, [r2] ldr r0, =0x00000c03 cmp r1, r0 @@ -4205,7 +4205,7 @@ _081BD3BE: lsls r1, 15 adds r0, r1 lsrs r7, r0, 16 - ldr r0, =gUnknown_02038BCE + ldr r0, =gPartnerTrainerId ldrh r1, [r0] ldr r0, =0x00000c03 cmp r1, r0 @@ -4220,7 +4220,7 @@ _081BD3BE: lsls r1, 24 lsrs r1, 24 adds r0, r4, 0 - bl template_build_for_pokemon_or_trainer + bl sub_806A12C ldr r6, =gUnknown_0202499C mov r8, r9 lsls r4, r7, 16 @@ -5823,7 +5823,7 @@ sub_81BE10C: @ 81BE10C bl AllocSpritePalette lsls r0, 24 lsrs r4, r0, 24 - ldr r2, =gUnknown_02038BCE + ldr r2, =gPartnerTrainerId ldrh r1, [r2] ldr r0, =0x00000c03 cmp r1, r0 diff --git a/asm/battle_controller_recorded_opponent.s b/asm/battle_controller_recorded_opponent.s index 2b0eed22e..dc7fe7de5 100644 --- a/asm/battle_controller_recorded_opponent.s +++ b/asm/battle_controller_recorded_opponent.s @@ -1211,7 +1211,7 @@ sub_8186F14: @ 8186F14 ldr r0, =SpriteCallbackDummy cmp r1, r0 beq _08186F5E - ldr r0, =nullsub_18 + ldr r0, =SpriteCallbackDummy_2 cmp r1, r0 bne _08186F6E _08186F5E: @@ -3636,7 +3636,7 @@ sub_818843C: @ 818843C adds r0, r1 lsls r0, 2 adds r0, r5 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r2, r1 ldrb r1, [r2] bl StartSpriteAnim @@ -3831,7 +3831,7 @@ sub_81885D8: @ 81885D8 adds r0, r1 lsls r0, 2 adds r0, r5 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r6, r1 ldrb r1, [r6] bl StartSpriteAnim @@ -4093,7 +4093,7 @@ _0818892C: lsls r1, 24 lsrs r1, 24 mov r0, r8 - bl template_build_for_pokemon_or_trainer + bl sub_806A12C ldr r6, =gUnknown_0202499C mov r9, r7 ldr r1, =gUnknown_083054E0 diff --git a/asm/battle_controller_recorded_player.s b/asm/battle_controller_recorded_player.s index 7f2b918a4..b2769671c 100644 --- a/asm/battle_controller_recorded_player.s +++ b/asm/battle_controller_recorded_player.s @@ -3613,7 +3613,7 @@ sub_818B8E0: @ 818B8E0 adds r0, r1 lsls r0, 2 adds r0, r5 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r2, r1 ldrb r1, [r2] bl StartSpriteAnim @@ -3795,7 +3795,7 @@ sub_818BA6C: @ 818BA6C adds r0, r1 lsls r0, 2 adds r0, r5 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r6, r1 ldrb r1, [r6] bl StartSpriteAnim @@ -4189,7 +4189,7 @@ _0818BEDC: lsls r1, 24 lsrs r1, 24 adds r0, r4, 0 - bl template_build_for_pokemon_or_trainer + bl sub_806A12C ldr r6, =gUnknown_0202499C mov r8, r9 lsls r4, r7, 16 diff --git a/asm/battle_controller_safari.s b/asm/battle_controller_safari.s index 3de3c2608..1aff72176 100644 --- a/asm/battle_controller_safari.s +++ b/asm/battle_controller_safari.s @@ -396,7 +396,7 @@ sub_8159698: @ 8159698 ands r0, r1 cmp r0, 0 bne _081596BE - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r1, [r0] movs r0, 0x1 bl dp01_build_cmdbuf_x23_aa_0 @@ -578,7 +578,7 @@ sub_8159800: @ 8159800 lsls r1, 24 lsrs r1, 24 adds r0, r6, 0 - bl template_build_for_pokemon_or_trainer + bl sub_806A12C ldr r0, =gUnknown_0202499C ldr r2, =gUnknown_08305D2C ldr r1, [r4] @@ -923,7 +923,7 @@ sub_8159B14: @ 8159B14 adds r0, r1 ldr r1, =sub_8159660 str r1, [r0] - ldr r1, =gUnknown_020244B8 + ldr r1, =gBankInMenu ldrb r0, [r2] strb r0, [r1] add sp, 0x4 diff --git a/asm/battle_controller_wally.s b/asm/battle_controller_wally.s index c00988ed2..ddb97f927 100644 --- a/asm/battle_controller_wally.s +++ b/asm/battle_controller_wally.s @@ -308,7 +308,7 @@ sub_8168610: @ 8168610 ands r0, r1 cmp r0, 0 bne _08168636 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r1, [r0] movs r0, 0x1 bl dp01_build_cmdbuf_x23_aa_0 @@ -3037,7 +3037,7 @@ sub_8169EC8: @ 8169EC8 lsls r1, 24 lsrs r1, 24 movs r0, 0x6 - bl template_build_for_pokemon_or_trainer + bl sub_806A12C ldr r0, =gUnknown_0202499C ldr r1, =gUnknown_08305D2C ldrb r1, [r1, 0x18] @@ -3122,7 +3122,7 @@ dp01t_07_6_: @ 8169F94 lsls r1, 24 lsrs r1, 24 movs r0, 0x6 - bl template_build_for_pokemon_or_trainer + bl sub_806A12C ldr r0, =gUnknown_0202499C ldr r1, =gUnknown_08305D2C ldrb r1, [r1, 0x18] @@ -3803,7 +3803,7 @@ sub_816A57C: @ 816A57C adds r0, r1 ldr r1, =sub_81685D4 str r1, [r0] - ldr r1, =gUnknown_020244B8 + ldr r1, =gBankInMenu ldrb r0, [r2] strb r0, [r1] add sp, 0x4 @@ -4504,7 +4504,7 @@ sub_816AA80: @ 816AA80 adds r0, r1 lsls r0, 2 adds r0, r5 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r6, r1 ldrb r1, [r6] bl StartSpriteAnim diff --git a/asm/battle_message.s b/asm/battle_message.s index c224df9f9..dec210b25 100644 --- a/asm/battle_message.s +++ b/asm/battle_message.s @@ -42,7 +42,7 @@ BufferStringBattle: @ 814E0C4 ldr r1, [r4] ldrb r1, [r1, 0x9] strb r1, [r0] - ldr r1, =gUnknown_0202420F + ldr r1, =gStringBank ldr r2, [r4] ldrb r0, [r2, 0xA] strb r0, [r1] @@ -1602,7 +1602,7 @@ _0814EF98: ldrb r0, [r0] cmp r0, 0 beq _0814EFE0 - ldr r2, =gUnknown_0202420F + ldr r2, =gStringBank ldrb r1, [r2] movs r0, 0x1 ands r0, r1 @@ -1611,7 +1611,7 @@ _0814EF98: b _0814F05C .pool _0814EFE0: - ldr r2, =gUnknown_0202420F + ldr r2, =gStringBank ldrb r1, [r2] movs r0, 0x1 ands r0, r1 @@ -1640,7 +1640,7 @@ _0814F014: subs r0, r1 lsls r0, 2 adds r0, r2 - ldr r1, =gUnknown_0202420F + ldr r1, =gStringBank ldrb r2, [r1] ldrh r0, [r0, 0x18] cmp r0, r2 @@ -2237,11 +2237,11 @@ _0814F584: b _0814F5C0 .pool _0814F594: - ldr r0, =gUnknown_02038BCE + ldr r0, =gPartnerTrainerId _0814F596: ldrh r0, [r0] _0814F598: - bl sub_8162BD8 + bl GetFrontierOpponentClass _0814F59C: lsls r0, 24 lsrs r0, 24 @@ -2254,12 +2254,12 @@ _0814F5A2: b _0814F5C0 .pool _0814F5B4: - ldr r0, =gUnknown_02038BCE + ldr r0, =gPartnerTrainerId _0814F5B6: ldrh r1, [r0] _0814F5B8: mov r0, sp - bl sub_8162E20 + bl GetFrontierTrainerName _0814F5BE: mov r4, sp _0814F5C0: @@ -2513,7 +2513,7 @@ _0814F7A4: b _0814F8DE .pool _0814F7BC: - ldr r1, =gUnknown_085CBE00 + ldr r1, =gStatNamesTable adds r0, r5, r7 ldrb r0, [r0, 0x1] lsls r0, 2 @@ -2606,7 +2606,7 @@ _0814F858: subs r0, r1 lsls r0, 2 adds r0, r2 - ldr r1, =gUnknown_0202420F + ldr r1, =gStringBank ldrb r2, [r1] ldrh r0, [r0, 0x18] cmp r0, r2 diff --git a/asm/battle_setup.s b/asm/battle_setup.s index 5d7353055..608d7843c 100644 --- a/asm/battle_setup.s +++ b/asm/battle_setup.s @@ -75,7 +75,7 @@ task_add_01_battle_start: @ 80B065C adds r1, r2 strh r4, [r1, 0xA] adds r0, r5, 0 - bl PlayNewMapMusic__default_for_battle + bl PlayMapChosenOrBattleBGM pop {r4,r5} pop {r0} bx r0 @@ -1359,7 +1359,7 @@ sub_80B1158: @ 80B1158 movs r3, 0 bl sub_80F9244 bl ResetTasks - bl sub_806E64C + bl PlayBattleBGM ldr r0, =sub_80B11A8 bl SetMainCallback2 movs r0, 0 @@ -1678,7 +1678,7 @@ battle_80801F0: @ 80B13F8 ldrb r1, [r2, 0x5] ldrb r2, [r2, 0x4] bl GetFieldObjectIdByLocalIdAndMap - ldr r1, =gUnknown_03005DF0 + ldr r1, =gSelectedMapObject strb r0, [r1] _080B141A: pop {r0} @@ -1880,10 +1880,10 @@ SingleTrainerWantsBattle: @ 80B162C push {r4,lr} lsls r0, 24 lsrs r0, 24 - ldr r2, =gUnknown_03005DF0 + ldr r2, =gSelectedMapObject strb r0, [r2] ldr r4, =gScriptLastTalked - ldr r3, =gUnknown_02037350 + ldr r3, =gMapObjects lsls r2, r0, 3 adds r2, r0 lsls r2, 2 @@ -1908,10 +1908,10 @@ TwoTrainersWantBattle: @ 80B1670 push {r4,lr} lsls r0, 24 lsrs r0, 24 - ldr r2, =gUnknown_03005DF0 + ldr r2, =gSelectedMapObject strb r0, [r2] ldr r4, =gScriptLastTalked - ldr r3, =gUnknown_02037350 + ldr r3, =gMapObjects lsls r2, r0, 3 adds r2, r0 lsls r2, 2 @@ -1960,12 +1960,12 @@ GetTrainerFlagFromScriptPointer: @ 80B16B8 thumb_func_start sub_80B16D8 sub_80B16D8: @ 80B16D8 push {r4,lr} - ldr r0, =gUnknown_03005DF0 + ldr r0, =gSelectedMapObject ldrb r0, [r0] lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 ldrb r0, [r4, 0x18] lsls r0, 28 @@ -1998,7 +1998,7 @@ check_trainer_flag: @ 80B1718 lsls r0, 24 cmp r0, 0 beq _080B1734 - ldr r0, =gUnknown_03005DF0 + ldr r0, =gSelectedMapObject ldrb r0, [r0] bl GetBattlePyramidTrainerFlag b _080B1752 @@ -2013,7 +2013,7 @@ _080B1734: bl FlagGet b _080B1752 _080B174A: - ldr r0, =gUnknown_03005DF0 + ldr r0, =gSelectedMapObject ldrb r0, [r0] bl GetTrainerHillTrainerFlag _080B1752: @@ -2341,7 +2341,7 @@ sub_80B1A14: @ 80B1A14 b _080B1AD8 .pool _080B1A44: - ldr r3, =gUnknown_02037350 + ldr r3, =gMapObjects ldr r2, =gUnknown_03006090 ldr r0, =gUnknown_02038BFC ldrb r1, [r0] @@ -2381,7 +2381,7 @@ _080B1A7C: b _080B1AD8 .pool _080B1AAC: - ldr r3, =gUnknown_02037350 + ldr r3, =gMapObjects ldr r2, =gUnknown_03006090 ldr r0, =gUnknown_02038BFC ldrb r1, [r0] diff --git a/asm/berry.s b/asm/berry.s deleted file mode 100644 index 54c4333d5..000000000 --- a/asm/berry.s +++ /dev/null @@ -1,1120 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_80E15B8 -sub_80E15B8: @ 80E15B8 - push {lr} - sub sp, 0x4 - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r0, =0x000031f8 - adds r1, r0 - ldr r2, =0x0100001a - mov r0, sp - bl CpuSet - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E15B8 - - thumb_func_start sub_80E15E4 -sub_80E15E4: @ 80E15E4 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x000031f8 - adds r3, r0, r1 - movs r2, 0 -_080E15F2: - adds r0, r3, r2 - adds r1, r4, r2 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0x33 - bls _080E15F2 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E15E4 - - thumb_func_start sub_80E1610 -sub_80E1610: @ 80E1610 - push {lr} - adds r3, r0, 0 - movs r2, 0 - movs r1, 0 -_080E1618: - adds r0, r3, r1 - ldrb r0, [r0] - adds r2, r0 - adds r1, 0x1 - cmp r1, 0x2F - bls _080E1618 - adds r0, r2, 0 - pop {r1} - bx r1 - thumb_func_end sub_80E1610 - - thumb_func_start sub_80E162C -sub_80E162C: @ 80E162C - push {r4,lr} - ldr r4, =gSaveBlock1Ptr - ldr r1, [r4] - ldr r2, =0x0000320c - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080E1674 - ldr r2, =0x00003202 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080E1674 - ldr r2, =0x000031f8 - adds r0, r1, r2 - bl sub_80E1610 - ldr r1, [r4] - ldr r2, =0x00003228 - adds r1, r2 - ldr r1, [r1] - cmp r0, r1 - bne _080E1674 - movs r0, 0x1 - b _080E1676 - .pool -_080E1674: - movs r0, 0 -_080E1676: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80E162C - - thumb_func_start GetBerryInfo -@ struct berry_info *GetBerryInfo(u8 berryType) -GetBerryInfo: @ 80E167C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x2B - bne _080E16A0 - bl sub_80E162C - cmp r0, 0 - beq _080E16A0 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x000031f8 - b _080E16B4 - .pool -_080E16A0: - subs r0, r4, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2A - bls _080E16AC - movs r4, 0x1 -_080E16AC: - lsls r0, r4, 3 - subs r0, r4 - lsls r0, 2 - ldr r1, =gBerries - 0x1c @ 1-based array -_080E16B4: - adds r0, r1 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end GetBerryInfo - - thumb_func_start GetBerryTreeInfo -@ struct BerryTreeInfo *GetBerryTreeInfo(u8 berryTreeId) -GetBerryTreeInfo: @ 80E16C0 - lsls r0, 24 - ldr r1, =gSaveBlock1Ptr - lsrs r0, 21 - ldr r2, =0x0000169c - adds r0, r2 - ldr r1, [r1] - adds r1, r0 - adds r0, r1, 0 - bx lr - .pool - thumb_func_end GetBerryTreeInfo - - thumb_func_start FieldObjectInteractionWaterBerryTree -@ bool8 FieldObjectInteractionWaterBerryTree() -FieldObjectInteractionWaterBerryTree: @ 80E16DC - push {lr} - ldr r0, =gUnknown_03005DF0 - ldrb r0, [r0] - bl FieldObjectGetBerryTreeId - lsls r0, 24 - lsrs r0, 24 - bl GetBerryTreeInfo - adds r2, r0, 0 - ldrb r0, [r2, 0x1] - lsls r0, 25 - lsrs r0, 25 - cmp r0, 0x2 - beq _080E1718 - cmp r0, 0x2 - bgt _080E1708 - cmp r0, 0x1 - beq _080E1712 - b _080E172E - .pool -_080E1708: - cmp r0, 0x3 - beq _080E171E - cmp r0, 0x4 - beq _080E1724 - b _080E172E -_080E1712: - ldrb r0, [r2, 0x5] - movs r1, 0x10 - b _080E1728 -_080E1718: - ldrb r0, [r2, 0x5] - movs r1, 0x20 - b _080E1728 -_080E171E: - ldrb r0, [r2, 0x5] - movs r1, 0x40 - b _080E1728 -_080E1724: - ldrb r0, [r2, 0x5] - movs r1, 0x80 -_080E1728: - orrs r0, r1 - strb r0, [r2, 0x5] - b _080E1732 -_080E172E: - movs r0, 0 - b _080E1734 -_080E1732: - movs r0, 0x1 -_080E1734: - pop {r1} - bx r1 - thumb_func_end FieldObjectInteractionWaterBerryTree - - thumb_func_start IsPlayerFacingPlantedBerryTree -@ bool8 IsPlayerFacingPlantedBerryTree() -IsPlayerFacingPlantedBerryTree: @ 80E1738 - push {lr} - bl GetFieldObjectScriptPointerForComparison - ldr r1, =gUnknown_082742F9 - cmp r0, r1 - bne _080E1768 - ldr r0, =gUnknown_03005DF0 - ldrb r0, [r0] - bl FieldObjectGetBerryTreeId - lsls r0, 24 - lsrs r0, 24 - bl GetStageByBerryTreeId - lsls r0, 24 - cmp r0, 0 - bne _080E1768 - movs r0, 0x1 - b _080E176A - .pool -_080E1768: - movs r0, 0 -_080E176A: - pop {r1} - bx r1 - thumb_func_end IsPlayerFacingPlantedBerryTree - - thumb_func_start WaterBerryTree -@ bool8 WaterBerryTree() -WaterBerryTree: @ 80E1770 - push {lr} - bl GetFieldObjectScriptPointerForComparison - ldr r1, =gUnknown_082742F9 - cmp r0, r1 - bne _080E178C - bl FieldObjectInteractionWaterBerryTree - lsls r0, 24 - lsrs r0, 24 - b _080E178E - .pool -_080E178C: - movs r0, 0 -_080E178E: - pop {r1} - bx r1 - thumb_func_end WaterBerryTree - - thumb_func_start ClearBerryTrees -@ void ClearBerryTrees() -ClearBerryTrees: @ 80E1794 - push {r4-r6,lr} - movs r2, 0 - ldr r6, =gSaveBlock1Ptr - ldr r5, =0x0000169c - ldr r0, =gUnknown_0858ABD0 - ldr r3, [r0] - ldr r4, [r0, 0x4] -_080E17A2: - ldr r0, [r6] - lsls r1, r2, 3 - adds r0, r1 - adds r0, r5 - str r3, [r0] - str r4, [r0, 0x4] - adds r2, 0x1 - cmp r2, 0x7F - ble _080E17A2 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end ClearBerryTrees - - thumb_func_start BerryTreeGrow -@ bool8 BerryTreeGrow(struct BerryTreeInfo *berryTree) -BerryTreeGrow: @ 80E17C8 - push {r4,lr} - adds r4, r0, 0 - ldrb r1, [r4, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080E17DA -_080E17D6: - movs r0, 0 - b _080E1866 -_080E17DA: - lsls r0, r1, 25 - lsrs r0, 25 - cmp r0, 0x5 - bhi _080E1864 - lsls r0, 2 - ldr r1, =_080E17F0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080E17F0: - .4byte _080E17D6 - .4byte _080E1810 - .4byte _080E1810 - .4byte _080E1810 - .4byte _080E1808 - .4byte _080E1828 -_080E1808: - adds r0, r4, 0 - bl CalcBerryYield - strb r0, [r4, 0x4] -_080E1810: - ldrb r2, [r4, 0x1] - lsls r1, r2, 25 - lsrs r1, 25 - adds r1, 0x1 - movs r0, 0x7F - ands r1, r0 - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, 0x1] - b _080E1864 -_080E1828: - ldrb r0, [r4, 0x5] - movs r1, 0x11 - negs r1, r1 - ands r1, r0 - movs r0, 0x21 - negs r0, r0 - ands r1, r0 - subs r0, 0x20 - ands r1, r0 - movs r0, 0x7F - ands r1, r0 - movs r0, 0 - strb r0, [r4, 0x4] - ldrb r2, [r4, 0x1] - subs r0, 0x80 - ands r0, r2 - movs r2, 0x2 - orrs r0, r2 - strb r0, [r4, 0x1] - adds r1, 0x1 - movs r0, 0xF - ands r1, r0 - strb r1, [r4, 0x5] - cmp r1, 0xA - bne _080E1864 - ldr r0, =gUnknown_0858ABD0 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [r4] - str r1, [r4, 0x4] -_080E1864: - movs r0, 0x1 -_080E1866: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end BerryTreeGrow - - thumb_func_start BerryTreeTimeUpdate -@ void BerryTreeTimeUpdate(s32 deltaSeconds) -BerryTreeTimeUpdate: @ 80E1870 - push {r4-r7,lr} - adds r6, r0, 0 - movs r2, 0 -_080E1876: - ldr r1, =gSaveBlock1Ptr - lsls r0, r2, 3 - ldr r3, =0x0000169c - adds r0, r3 - ldr r1, [r1] - adds r4, r1, r0 - ldrb r0, [r4] - adds r7, r2, 0x1 - cmp r0, 0 - beq _080E1910 - ldrb r1, [r4, 0x1] - movs r0, 0x7F - ands r0, r1 - cmp r0, 0 - beq _080E1910 - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080E1910 - ldrb r0, [r4] - bl GetStageDurationByBerryType - lsls r0, 16 - lsrs r0, 16 - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 3 - subs r1, r0 - cmp r6, r1 - blt _080E18CC - ldr r0, =gUnknown_0858ABD0 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [r4] - str r1, [r4, 0x4] - b _080E1910 - .pool -_080E18CC: - adds r5, r6, 0 - cmp r5, 0 - beq _080E1910 - ldrh r1, [r4, 0x2] - cmp r1, r5 - ble _080E18DC - subs r0, r1, r5 - b _080E190E -_080E18DC: - subs r5, r1 - ldrb r0, [r4] - bl GetStageDurationByBerryType - strh r0, [r4, 0x2] - adds r0, r4, 0 - bl BerryTreeGrow - cmp r0, 0 - beq _080E1910 - ldrb r1, [r4, 0x1] - movs r0, 0x7F - ands r0, r1 - cmp r0, 0x5 - bne _080E1900 - ldrh r0, [r4, 0x2] - lsls r0, 2 - strh r0, [r4, 0x2] -_080E1900: - cmp r5, 0 - beq _080E1910 - ldrh r0, [r4, 0x2] - adds r1, r0, 0 - cmp r0, r5 - ble _080E18DC - subs r0, r5 -_080E190E: - strh r0, [r4, 0x2] -_080E1910: - adds r2, r7, 0 - cmp r2, 0x7F - ble _080E1876 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end BerryTreeTimeUpdate - - thumb_func_start PlantBerryTree -@ void PlantBerryTree(u8 berryTreeId, u8 berryType, u8 stage, u8 a4) -PlantBerryTree: @ 80E191C - push {r4-r7,lr} - adds r4, r1, 0 - adds r5, r2, 0 - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r3, 24 - lsrs r7, r3, 24 - bl GetBerryTreeInfo - adds r6, r0, 0 - ldr r0, =gUnknown_0858ABD0 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [r6] - str r1, [r6, 0x4] - strb r4, [r6] - adds r0, r4, 0 - bl GetStageDurationByBerryType - strh r0, [r6, 0x2] - movs r1, 0x7F - ands r1, r5 - ldrb r2, [r6, 0x1] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r6, 0x1] - cmp r5, 0x5 - bne _080E196E - adds r0, r6, 0 - bl CalcBerryYield - strb r0, [r6, 0x4] - ldrh r0, [r6, 0x2] - lsls r0, 2 - strh r0, [r6, 0x2] -_080E196E: - cmp r7, 0 - bne _080E197A - ldrb r0, [r6, 0x1] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r6, 0x1] -_080E197A: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end PlantBerryTree - - thumb_func_start RemoveBerryTree -@ void RemoveBerryTree(u8 berryTreeId) -RemoveBerryTree: @ 80E1984 - lsls r0, 24 - ldr r1, =gSaveBlock1Ptr - ldr r2, [r1] - lsrs r0, 21 - adds r2, r0 - ldr r0, =0x0000169c - adds r2, r0 - ldr r0, =gUnknown_0858ABD0 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [r2] - str r1, [r2, 0x4] - bx lr - .pool - thumb_func_end RemoveBerryTree - - thumb_func_start GetBerryTypeByBerryTreeId -@ u8 GetBerryTypeByBerryTreeId(u8 berryTreeId) -GetBerryTypeByBerryTreeId: @ 80E19AC - lsls r0, 24 - ldr r1, =gSaveBlock1Ptr - ldr r1, [r1] - lsrs r0, 21 - adds r1, r0 - ldr r0, =0x0000169c - adds r1, r0 - ldrb r0, [r1] - bx lr - .pool - thumb_func_end GetBerryTypeByBerryTreeId - - thumb_func_start GetStageByBerryTreeId -@ u8 GetStageByBerryTreeId(u8 berryTreeId) -GetStageByBerryTreeId: @ 80E19C8 - lsls r0, 24 - ldr r1, =gSaveBlock1Ptr - ldr r1, [r1] - lsrs r0, 21 - adds r1, r0 - ldr r0, =0x0000169d - adds r1, r0 - ldrb r0, [r1] - lsls r0, 25 - lsrs r0, 25 - bx lr - .pool - thumb_func_end GetStageByBerryTreeId - - thumb_func_start ItemIdToBerryType -@ u8 ItemIdToBerryType(u16 itemId) -ItemIdToBerryType: @ 80E19E8 - push {lr} - lsls r0, 16 - lsrs r1, r0, 16 - ldr r2, =0xff7b0000 - adds r0, r2 - lsrs r0, 16 - cmp r0, 0x2A - bhi _080E1A08 - adds r0, r1, 0 - adds r0, 0x7C - lsls r0, 24 - lsrs r0, 24 - b _080E1A0A - .pool -_080E1A08: - movs r0, 0x1 -_080E1A0A: - pop {r1} - bx r1 - thumb_func_end ItemIdToBerryType - - thumb_func_start BerryTypeToItemId -@ u16 BerryTypeToItemId(u16 berryType) -BerryTypeToItemId: @ 80E1A10 - push {lr} - lsls r0, 16 - lsrs r1, r0, 16 - ldr r2, =0xffff0000 - adds r0, r2 - lsrs r0, 16 - cmp r0, 0x2A - bhi _080E1A30 - adds r0, r1, 0 - adds r0, 0x84 - lsls r0, 16 - lsrs r0, 16 - b _080E1A32 - .pool -_080E1A30: - movs r0, 0x85 -_080E1A32: - pop {r1} - bx r1 - thumb_func_end BerryTypeToItemId - - thumb_func_start GetBerryNameByBerryType -@ void GetBerryNameByBerryType(u8 berryType, u8 *dest) -GetBerryNameByBerryType: @ 80E1A38 - push {r4,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - bl GetBerryInfo - adds r1, r0, 0 - adds r0, r4, 0 - movs r2, 0x6 - bl memcpy - movs r0, 0xFF - strb r0, [r4, 0x6] - pop {r4} - pop {r0} - bx r0 - thumb_func_end GetBerryNameByBerryType - - thumb_func_start GetBerryCountStringByBerryType -@ void GetBerryCountStringByBerryType(u8 berryType, u8 *dest, u32 berryCount) -GetBerryCountStringByBerryType: @ 80E1A58 - push {r4,r5,lr} - adds r4, r1, 0 - adds r5, r2, 0 - lsls r0, 24 - lsrs r0, 24 - bl GetBerryInfo - adds r1, r0, 0 - adds r0, r4, 0 - adds r2, r5, 0 - bl GetBerryCountString - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end GetBerryCountStringByBerryType - - thumb_func_start ResetBerryTreeSparkleFlag -@ void ResetBerryTreeSparkleFlag(u8 berryTreeId) -ResetBerryTreeSparkleFlag: @ 80E1A78 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetBerryTreeInfo - ldrb r2, [r0, 0x1] - movs r1, 0x7F - ands r1, r2 - strb r1, [r0, 0x1] - pop {r0} - bx r0 - thumb_func_end ResetBerryTreeSparkleFlag - - thumb_func_start BerryTreeGetNumStagesWatered -@ u8 BerryTreeGetNumStagesWatered(struct BerryTreeInfo *berryTree) -BerryTreeGetNumStagesWatered: @ 80E1A90 - push {lr} - ldrb r2, [r0, 0x5] - movs r0, 0x10 - ands r0, r2 - lsls r0, 24 - lsrs r0, 24 - negs r0, r0 - lsrs r1, r0, 31 - movs r0, 0x20 - ands r0, r2 - cmp r0, 0 - beq _080E1AAA - adds r1, 0x1 -_080E1AAA: - movs r0, 0x40 - ands r0, r2 - cmp r0, 0 - beq _080E1AB8 - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 -_080E1AB8: - movs r0, 0x80 - ands r0, r2 - cmp r0, 0 - beq _080E1AC6 - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 -_080E1AC6: - adds r0, r1, 0 - pop {r1} - bx r1 - thumb_func_end BerryTreeGetNumStagesWatered - - thumb_func_start GetNumStagesWateredByBerryTreeId -@ u8 GetNumStagesWateredByBerryTreeId(u8 berryTreeId) -GetNumStagesWateredByBerryTreeId: @ 80E1ACC - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetBerryTreeInfo - bl BerryTreeGetNumStagesWatered - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end GetNumStagesWateredByBerryTreeId - - thumb_func_start CalcBerryYieldInternal -@ u8 CalcBerryYieldInternal(u16 max, u16 min, u8 numStagesWatered) -CalcBerryYieldInternal: @ 80E1AE4 - push {r4-r6,lr} - lsls r0, 16 - lsrs r0, 16 - lsls r1, 16 - lsrs r6, r1, 16 - lsls r2, 24 - lsrs r2, 24 - cmp r2, 0 - bne _080E1AFA - lsls r0, r6, 24 - b _080E1B2E -_080E1AFA: - subs r1, r0, r6 - subs r0, r2, 0x1 - adds r5, r1, 0 - muls r5, r0 - adds r4, r1, 0 - muls r4, r2 - bl Random - lsls r0, 16 - lsrs r0, 16 - subs r4, r5 - adds r4, 0x1 - adds r1, r4, 0 - bl __umodsi3 - adds r5, r0 - movs r0, 0x3 - ands r0, r5 - cmp r0, 0x1 - bls _080E1B28 - lsrs r0, r5, 2 - adds r0, 0x1 - b _080E1B2A -_080E1B28: - lsrs r0, r5, 2 -_080E1B2A: - adds r0, r6 - lsls r0, 24 -_080E1B2E: - lsrs r0, 24 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end CalcBerryYieldInternal - - thumb_func_start CalcBerryYield -@ u8 CalcBerryYield(struct BerryTreeInfo *berryTree) -CalcBerryYield: @ 80E1B38 - push {r4-r6,lr} - adds r4, r0, 0 - ldrb r0, [r4] - bl GetBerryInfo - ldrb r6, [r0, 0xB] - ldrb r5, [r0, 0xA] - adds r0, r4, 0 - bl BerryTreeGetNumStagesWatered - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r5, 0 - adds r1, r6, 0 - bl CalcBerryYieldInternal - lsls r0, 24 - lsrs r0, 24 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end CalcBerryYield - - thumb_func_start GetBerryCountByBerryTreeId -@ u8 GetBerryCountByBerryTreeId(u8 berryTreeId) -GetBerryCountByBerryTreeId: @ 80E1B64 - lsls r0, 24 - ldr r1, =gSaveBlock1Ptr - ldr r1, [r1] - lsrs r0, 21 - adds r1, r0 - movs r0, 0xB5 - lsls r0, 5 - adds r1, r0 - ldrb r0, [r1] - bx lr - .pool - thumb_func_end GetBerryCountByBerryTreeId - - thumb_func_start GetStageDurationByBerryType -@ u16 GetStageDurationByBerryType(u8 berryType) -GetStageDurationByBerryType: @ 80E1B7C - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetBerryInfo - ldrb r1, [r0, 0x14] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 18 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end GetStageDurationByBerryType - - thumb_func_start FieldObjectInteractionGetBerryTreeData -@ void FieldObjectInteractionGetBerryTreeData() -FieldObjectInteractionGetBerryTreeData: @ 80E1B94 - push {r4-r6,lr} - ldr r0, =gUnknown_03005DF0 - ldrb r0, [r0] - bl FieldObjectGetBerryTreeId - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r5, 0 - bl GetBerryTypeByBerryTreeId - lsls r0, 24 - lsrs r6, r0, 24 - adds r0, r5, 0 - bl ResetBerryTreeSparkleFlag - ldr r0, =gScriptLastTalked - ldrb r0, [r0] - ldr r1, =gSaveBlock1Ptr - ldr r2, [r1] - ldrb r1, [r2, 0x5] - ldrb r2, [r2, 0x4] - bl sub_8092E9C - lsls r0, 24 - cmp r0, 0 - beq _080E1BE0 - ldr r1, =gSpecialVar_0x8004 - movs r0, 0xFF - strh r0, [r1] - b _080E1BEE - .pool -_080E1BE0: - ldr r4, =gSpecialVar_0x8004 - adds r0, r5, 0 - bl GetStageByBerryTreeId - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4] -_080E1BEE: - ldr r4, =gSpecialVar_0x8005 - adds r0, r5, 0 - bl GetNumStagesWateredByBerryTreeId - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4] - ldr r4, =gSpecialVar_0x8006 - adds r0, r5, 0 - bl GetBerryCountByBerryTreeId - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4] - ldr r1, =gStringVar1 - ldrh r2, [r4] - adds r0, r6, 0 - bl GetBerryCountStringByBerryType - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end FieldObjectInteractionGetBerryTreeData - - thumb_func_start FieldObjectInteractionGetBerryName -@ void FieldObjectInteractionGetBerryName() -FieldObjectInteractionGetBerryName: @ 80E1C2C - push {lr} - ldr r0, =gUnknown_03005DF0 - ldrb r0, [r0] - bl FieldObjectGetBerryTreeId - lsls r0, 24 - lsrs r0, 24 - bl GetBerryTypeByBerryTreeId - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gStringVar1 - bl GetBerryNameByBerryType - pop {r0} - bx r0 - .pool - thumb_func_end FieldObjectInteractionGetBerryName - - thumb_func_start FieldObjectInteractionGetBerryCountString -@ void FieldObjectInteractionGetBerryCountString() -FieldObjectInteractionGetBerryCountString: @ 80E1C54 - push {r4,r5,lr} - ldr r0, =gUnknown_03005DF0 - ldrb r0, [r0] - bl FieldObjectGetBerryTreeId - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl GetBerryTypeByBerryTreeId - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r4, 0 - bl GetBerryCountByBerryTreeId - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - ldr r1, =gStringVar1 - adds r0, r5, 0 - bl GetBerryCountStringByBerryType - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end FieldObjectInteractionGetBerryCountString - - thumb_func_start ChooseBerry -@ void ChooseBerry() -ChooseBerry: @ 80E1C94 - push {lr} - ldr r0, =CB2_ChooseBerry - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end ChooseBerry - - thumb_func_start FieldObjectInteractionPlantBerryTree -@ void FieldObjectInteractionPlantBerryTree() -FieldObjectInteractionPlantBerryTree: @ 80E1CA4 - push {r4,lr} - ldr r0, =gUnknown_0203CE7C - ldrh r0, [r0] - bl ItemIdToBerryType - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_03005DF0 - ldrb r0, [r0] - bl FieldObjectGetBerryTreeId - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - movs r2, 0x1 - movs r3, 0x1 - bl PlantBerryTree - bl FieldObjectInteractionGetBerryTreeData - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end FieldObjectInteractionPlantBerryTree - - thumb_func_start FieldObjectInteractionPickBerryTree -@ void FieldObjectInteractionPickBerryTree() -FieldObjectInteractionPickBerryTree: @ 80E1CDC - push {r4-r6,lr} - ldr r0, =gUnknown_03005DF0 - ldrb r0, [r0] - bl FieldObjectGetBerryTreeId - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r5, 0 - bl GetBerryTypeByBerryTreeId - lsls r0, 24 - lsrs r0, 24 - ldr r6, =gSpecialVar_0x8004 - bl BerryTypeToItemId - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r5, 0 - bl GetBerryCountByBerryTreeId - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl AddBagItem - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end FieldObjectInteractionPickBerryTree - - thumb_func_start FieldObjectInteractionRemoveBerryTree -@ void FieldObjectInteractionRemoveBerryTree() -FieldObjectInteractionRemoveBerryTree: @ 80E1D28 - push {lr} - ldr r0, =gUnknown_03005DF0 - ldrb r0, [r0] - bl FieldObjectGetBerryTreeId - lsls r0, 24 - lsrs r0, 24 - bl RemoveBerryTree - ldr r0, =gScriptLastTalked - ldrb r0, [r0] - ldr r1, =gSaveBlock1Ptr - ldr r2, [r1] - ldrb r1, [r2, 0x5] - ldrb r2, [r2, 0x4] - bl sub_8092EF0 - pop {r0} - bx r0 - .pool - thumb_func_end FieldObjectInteractionRemoveBerryTree - - thumb_func_start PlayerHasBerries -@ bool8 PlayerHasBerries() -PlayerHasBerries: @ 80E1D5C - push {lr} - movs r0, 0x4 - bl IsBagPocketNonEmpty - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end PlayerHasBerries - - thumb_func_start ResetBerryTreeSparkleFlags -@ void ResetBerryTreeSparkleFlags() -ResetBerryTreeSparkleFlags: @ 80E1D6C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl GetCameraCoords - mov r0, sp - ldrh r2, [r0] - ldrh r1, [r4] - adds r1, 0x3 - adds r3, r2, 0 - adds r3, 0xE - lsls r1, 16 - movs r5, 0x80 - lsls r5, 12 - adds r0, r1, r5 - lsrs r0, 16 - mov r10, r0 - mov r5, sp - lsls r2, 16 - asrs r2, 16 - mov r9, r2 - ldr r4, =gUnknown_02037350 - lsls r3, 16 - asrs r3, 16 - mov r8, r3 - asrs r7, r1, 16 - movs r6, 0xF -_080E1DB0: - ldrb r0, [r4] - lsls r0, 31 - cmp r0, 0 - beq _080E1DEC - ldrb r0, [r4, 0x6] - cmp r0, 0xC - bne _080E1DEC - ldrh r0, [r4, 0x10] - strh r0, [r5] - ldrh r0, [r4, 0x12] - mov r1, sp - strh r0, [r1, 0x2] - movs r2, 0 - ldrsh r1, [r5, r2] - cmp r9, r1 - bgt _080E1DEC - cmp r1, r8 - bgt _080E1DEC - lsls r0, 16 - asrs r1, r0, 16 - cmp r7, r1 - bgt _080E1DEC - mov r2, r10 - lsls r0, r2, 16 - asrs r0, 16 - cmp r1, r0 - bgt _080E1DEC - ldrb r0, [r4, 0x1D] - bl ResetBerryTreeSparkleFlag -_080E1DEC: - adds r4, 0x24 - subs r6, 0x1 - cmp r6, 0 - bge _080E1DB0 - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end ResetBerryTreeSparkleFlags - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/berry_blender.s b/asm/berry_blender.s index 0929da338..73ff40796 100644 --- a/asm/berry_blender.s +++ b/asm/berry_blender.s @@ -1190,7 +1190,7 @@ _080801F8: movs r5, 0xAC lsls r5, 1 adds r0, r5 - ldr r1, =gUnknown_0203CE7C + ldr r1, =gScriptItemId ldrh r1, [r1] bl sub_807FE14 ldr r0, =gUnknown_020228C4 @@ -2043,7 +2043,7 @@ _080808F8: _08080950: bl sub_800B4C0 bl sub_8080588 - ldr r4, =gUnknown_0203CE7C + ldr r4, =gScriptItemId ldrh r1, [r4] movs r0, 0 bl sub_8082FDC @@ -7619,7 +7619,7 @@ _080837EA: movs r1, 0x6 bl CreateTask bl sub_80EECEC - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] movs r1, 0x1 bl RemoveBagItem diff --git a/asm/berry_tag_screen.s b/asm/berry_tag_screen.s index 04d04bb31..b21a249bd 100644 --- a/asm/berry_tag_screen.s +++ b/asm/berry_tag_screen.s @@ -12,7 +12,7 @@ sub_8177C14: @ 8177C14 ldr r0, =0x0000180c bl AllocZeroed str r0, [r4] - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] bl ItemIdToBerryType ldr r1, [r4] diff --git a/asm/bike.s b/asm/bike.s index bcb5177be..22d52c0fa 100644 --- a/asm/bike.s +++ b/asm/bike.s @@ -131,7 +131,7 @@ sub_8119238: @ 8119238 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 ldrb r1, [r4, 0x1E] adds r0, r5, 0 @@ -166,7 +166,7 @@ sub_8119280: @ 8119280 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 ldrb r1, [r4, 0x1E] adds r0, r5, 0 @@ -525,7 +525,7 @@ CheckMovementInputAcroBikeStandingWheelie: @ 8119540 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r1, r0, r1 movs r0, 0 strb r0, [r5, 0x2] @@ -613,7 +613,7 @@ CheckMovementInputAcroBikeBunnyHop: @ 81195E0 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r7, r0, r1 movs r0, 0x2 mov r1, r8 @@ -698,7 +698,7 @@ CheckMovementInputAcroBikeMovingWheelie: @ 8119688 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r7, r0, r1 movs r0, 0x2 mov r9, r0 @@ -802,7 +802,7 @@ CheckMovementInputAcroBikeUnknownMode5: @ 8119764 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 ldrb r2, [r0, 0x1] movs r1, 0x3 @@ -868,7 +868,7 @@ sub_81197F4: @ 81197F4 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r5, r0, r1 ldrb r1, [r5, 0x1E] adds r0, r4, 0 @@ -898,7 +898,7 @@ sub_8119830: @ 8119830 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 ldrb r1, [r4, 0x1E] adds r0, r5, 0 @@ -966,7 +966,7 @@ sub_81198C0: @ 81198C0 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r5, r0, r1 ldrb r1, [r5, 0x1E] adds r0, r4, 0 @@ -995,7 +995,7 @@ sub_81198FC: @ 81198FC lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r5, r0, r1 ldrb r1, [r5, 0x1E] adds r0, r4, 0 @@ -1024,7 +1024,7 @@ sub_8119938: @ 8119938 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r5, r0, r1 ldrb r1, [r5, 0x1E] adds r0, r4, 0 @@ -1053,7 +1053,7 @@ sub_8119974: @ 8119974 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r5, r0, r1 ldrb r1, [r5, 0x1E] adds r0, r4, 0 @@ -1082,7 +1082,7 @@ sub_81199B0: @ 81199B0 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r5, r0, r1 ldrb r1, [r5, 0x1E] adds r0, r4, 0 @@ -1161,7 +1161,7 @@ _08119A58: lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 movs r0, 0x22 bl PlaySE @@ -1203,7 +1203,7 @@ sub_8119AA4: @ 8119AA4 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r5, r0, r1 ldrb r1, [r5, 0x1E] adds r0, r4, 0 @@ -1272,7 +1272,7 @@ sub_8119B34: @ 8119B34 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r5, r0, r1 ldrb r1, [r5, 0x1E] adds r0, r4, 0 @@ -1341,7 +1341,7 @@ sub_8119BC4: @ 8119BC4 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r5, r0, r1 ldrb r1, [r5, 0x1E] adds r0, r4, 0 @@ -1686,7 +1686,7 @@ sub_8119E38: @ 8119E38 lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 ldrh r1, [r4, 0x10] add r0, sp, 0x4 @@ -1965,7 +1965,7 @@ player_should_look_direction_be_enforced_upon_movement: @ 811A044 lsls r0, 24 cmp r0, 0 beq _0811A078 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r0, =gUnknown_02037590 ldrb r1, [r0, 0x5] lsls r0, r1, 3 diff --git a/asm/cable_club.s b/asm/cable_club.s index 21713e0be..76d1dca06 100644 --- a/asm/cable_club.s +++ b/asm/cable_club.s @@ -1855,13 +1855,13 @@ _080B3354: cmp r0, 0 beq _080B3370 ldr r0, =0x000001dd - bl PlayNewMapMusic__default_for_battle + bl PlayMapChosenOrBattleBGM b _080B3378 .pool _080B3370: movs r0, 0xEE lsls r0, 1 - bl PlayNewMapMusic__default_for_battle + bl PlayMapChosenOrBattleBGM _080B3378: ldr r0, =gSpecialVar_0x8004 ldrh r0, [r0] @@ -2025,13 +2025,13 @@ _080B34DE: cmp r0, 0 beq _080B34FC ldr r0, =0x000001dd - bl PlayNewMapMusic__default_for_battle + bl PlayMapChosenOrBattleBGM b _080B3504 .pool _080B34FC: movs r0, 0xEE lsls r0, 1 - bl PlayNewMapMusic__default_for_battle + bl PlayMapChosenOrBattleBGM _080B3504: ldr r1, =gLinkPlayers ldr r0, =0x00002211 diff --git a/asm/contest.s b/asm/contest.s index 11f9a0ac8..76effb4e7 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -547,7 +547,7 @@ _080D7B4E: strb r5, [r0] bl sub_80D7988 bl init_uns_table_pokemon_copy - ldr r4, =gUnknown_020244D4 + ldr r4, =gBattleSpritesGfx ldr r0, [r4] ldr r0, [r0] bl Free @@ -581,7 +581,7 @@ _080D7B4E: lsls r1, 9 adds r0, r1 strb r5, [r0] - bl sub_806E414 + bl ClearBattleMonForms bl sub_80D787C b _080D7BF6 .pool @@ -2494,7 +2494,7 @@ _080D8DC4: mov r4, r8 lsls r4, 2 mov r10, r4 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms movs r2, 0 adds r0, r1, 0x3 _080D8DD0: @@ -6741,7 +6741,7 @@ sub_80DB174: @ 80DB174 lsls r0, r5, 3 ldr r1, =gMonBackPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] ldr r1, [r1, 0x4] adds r2, r5, 0 @@ -6753,7 +6753,7 @@ _080DB1B8: lsls r0, r5, 3 ldr r1, =gMonBackPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] ldr r1, [r1, 0x4] adds r2, r5, 0 @@ -13607,7 +13607,7 @@ sub_80DE864: @ 80DE864 movs r2, 0x14 bl memset bl sub_80A3934 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms movs r2, 0 adds r0, r1, 0x3 _080DE8A8: diff --git a/asm/contest_link_80F57C4.s b/asm/contest_link_80F57C4.s index 8d4413c2b..bf7a88eb8 100644 --- a/asm/contest_link_80F57C4.s +++ b/asm/contest_link_80F57C4.s @@ -1364,7 +1364,7 @@ _080F6454: mov r9, r4 ldr r4, =gMonFrontPicTable mov r12, r4 - ldr r4, =gUnknown_020244D4 + ldr r4, =gBattleSpritesGfx mov r8, r4 cmp r0, 0 beq _080F648C @@ -1638,7 +1638,7 @@ _080F66DA: lsls r0, 16 lsrs r0, 16 movs r1, 0x2 - bl pokedex_flag_operation + bl GetSetPokedexFlag adds r5, 0x40 subs r4, 0x1 cmp r4, 0 diff --git a/asm/contest_painting.s b/asm/contest_painting.s index e3ecfd619..62359497c 100644 --- a/asm/contest_painting.s +++ b/asm/contest_painting.s @@ -581,7 +581,7 @@ sub_81302E8: @ 81302E8 lsls r0, r5, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r4, =gUnknown_020244D4 + ldr r4, =gBattleSpritesGfx ldr r1, [r4] ldr r1, [r1, 0x8] ldr r2, [r6] @@ -600,7 +600,7 @@ _08130348: lsls r0, r5, 3 ldr r1, =gMonBackPicTable adds r0, r1 - ldr r4, =gUnknown_020244D4 + ldr r4, =gBattleSpritesGfx ldr r1, [r4] ldr r1, [r1, 0x4] ldr r2, [r6] diff --git a/asm/credits.s b/asm/credits.s index be5e9e5c4..0a568a3ae 100644 --- a/asm/credits.s +++ b/asm/credits.s @@ -3688,7 +3688,7 @@ sub_8177388: @ 8177388 _081773B4: adds r0, r4, 0 movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _081773D4 diff --git a/asm/easy_chat.s b/asm/easy_chat.s index d123b23f2..565d9fcc6 100644 --- a/asm/easy_chat.s +++ b/asm/easy_chat.s @@ -10177,7 +10177,7 @@ _0811F146: lsls r0, 16 lsrs r0, 16 movs r1, 0 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _0811F166 @@ -11016,7 +11016,7 @@ _0811F7D8: lsls r0, 16 lsrs r0, 16 movs r1, 0 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 lsrs r0, 24 b _0811F82C @@ -11030,7 +11030,7 @@ _0811F7EE: lsls r0, 16 lsrs r0, 16 movs r1, 0 - bl pokedex_flag_operation + bl GetSetPokedexFlag _0811F808: movs r0, 0x1 b _0811F82C diff --git a/asm/egg_hatch.s b/asm/egg_hatch.s index 52a659663..d646dbb73 100644 --- a/asm/egg_hatch.s +++ b/asm/egg_hatch.s @@ -218,10 +218,10 @@ sub_80714B8: @ 80714B8 lsrs r4, 16 adds r0, r4, 0 movs r1, 0x2 - bl pokedex_flag_operation + bl GetSetPokedexFlag adds r0, r4, 0 movs r1, 0x3 - bl pokedex_flag_operation + bl GetSetPokedexFlag ldr r1, =gStringVar1 adds r0, r5, 0 bl pokemon_get_nick @@ -399,7 +399,7 @@ _08071688: lsls r0, r4, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r2, [r1] mov r6, r8 lsls r1, r6, 1 @@ -937,7 +937,7 @@ _08071BBC: adds r1, r7, 0 movs r2, 0 movs r3, 0x1 - bl sub_806ED40 + bl DoMonFrontSpriteAnimation ldr r1, [r5] b _08071DC8 .pool diff --git a/asm/evolution_scene.s b/asm/evolution_scene.s index 01b495c09..b8710acd4 100644 --- a/asm/evolution_scene.s +++ b/asm/evolution_scene.s @@ -235,7 +235,7 @@ evolution_cutscene: @ 813DA8C lsls r0, r5, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r2, =gUnknown_020244D4 + ldr r2, =gBattleSpritesGfx ldr r1, [r2] ldr r1, [r1, 0x8] adds r2, r5, 0 @@ -272,7 +272,7 @@ evolution_cutscene: @ 813DA8C adds r6, r7, 0 adds r6, 0x1C adds r0, r1, r6 - ldr r2, =nullsub_18 + ldr r2, =SpriteCallbackDummy_2 str r2, [r0] adds r1, r7 ldrb r2, [r1, 0x5] @@ -291,7 +291,7 @@ evolution_cutscene: @ 813DA8C lsls r0, r1, 3 ldr r2, =gMonFrontPicTable adds r0, r2 - ldr r2, =gUnknown_020244D4 + ldr r2, =gBattleSpritesGfx ldr r1, [r2] ldr r1, [r1, 0x10] mov r2, r10 @@ -325,7 +325,7 @@ evolution_cutscene: @ 813DA8C adds r1, r3 lsls r1, 2 adds r6, r1, r6 - ldr r2, =nullsub_18 + ldr r2, =SpriteCallbackDummy_2 str r2, [r6] adds r1, r7 ldrb r0, [r1, 0x5] @@ -492,7 +492,7 @@ sub_813DD7C: @ 813DD7C lsls r0, r5, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] ldr r1, [r1, 0x10] adds r2, r5, 0 @@ -528,7 +528,7 @@ sub_813DD7C: @ 813DD7C adds r0, r3, 0 adds r0, 0x1C adds r0, r1, r0 - ldr r2, =nullsub_18 + ldr r2, =SpriteCallbackDummy_2 str r2, [r0] adds r1, r3 ldrb r2, [r1, 0x5] @@ -697,7 +697,7 @@ _0813E0A8: lsls r0, r6, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] ldr r1, [r1, 0x10] adds r2, r6, 0 @@ -736,7 +736,7 @@ _0813E0F0: adds r0, r3, 0 adds r0, 0x1C adds r0, r1, r0 - ldr r2, =nullsub_18 + ldr r2, =SpriteCallbackDummy_2 str r2, [r0] adds r1, r3 ldrb r2, [r1, 0x5] @@ -867,7 +867,7 @@ sub_813E1D4: @ 813E1D4 lsls r0, r5, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] ldr r1, [r1, 0x8] adds r2, r5, 0 @@ -903,7 +903,7 @@ sub_813E1D4: @ 813E1D4 adds r0, r3, 0 adds r0, 0x1C adds r0, r1, r0 - ldr r2, =nullsub_18 + ldr r2, =SpriteCallbackDummy_2 str r2, [r0] adds r1, r3 ldrb r2, [r1, 0x5] @@ -1142,13 +1142,13 @@ _0813E4A0: lsls r0, 16 lsrs r0, 16 movs r1, 0x2 - bl pokedex_flag_operation + bl GetSetPokedexFlag ldrh r0, [r4, 0xC] bl SpeciesToNationalPokedexNum lsls r0, 16 lsrs r0, 16 movs r1, 0x3 - bl pokedex_flag_operation + bl GetSetPokedexFlag mov r0, r9 movs r1, 0xB bl GetMonData @@ -1647,19 +1647,19 @@ _0813E99E: ldrh r1, [r4, 0xA] ldrh r2, [r4, 0xC] mov r0, r9 - bl sub_806D778 + bl EvolutionRenameMon ldrh r0, [r4, 0xC] bl SpeciesToNationalPokedexNum lsls r0, 16 lsrs r0, 16 movs r1, 0x2 - bl pokedex_flag_operation + bl GetSetPokedexFlag ldrh r0, [r4, 0xC] bl SpeciesToNationalPokedexNum lsls r0, 16 lsrs r0, 16 movs r1, 0x3 - bl pokedex_flag_operation + bl GetSetPokedexFlag movs r0, 0xE bl IncrementGameStat b _0813F1A4 @@ -2831,19 +2831,19 @@ _0813F4F2: ldrh r1, [r4, 0xA] ldrh r2, [r4, 0xC] mov r0, r9 - bl sub_806D778 + bl EvolutionRenameMon ldrh r0, [r4, 0xC] bl SpeciesToNationalPokedexNum lsls r0, 16 lsrs r0, 16 movs r1, 0x2 - bl pokedex_flag_operation + bl GetSetPokedexFlag ldrh r0, [r4, 0xC] bl SpeciesToNationalPokedexNum lsls r0, 16 lsrs r0, 16 movs r1, 0x3 - bl pokedex_flag_operation + bl GetSetPokedexFlag movs r0, 0xE bl IncrementGameStat b _0813FCC4 @@ -4182,7 +4182,7 @@ sub_81401E0: @ 81401E0 adds r0, r2 movs r2, 0 movs r3, 0 - bl sub_806ED40 + bl DoMonFrontSpriteAnimation pop {r0} bx r0 .pool diff --git a/asm/field_control_avatar.s b/asm/field_control_avatar.s index f3321f27a..0e83f4b80 100644 --- a/asm/field_control_avatar.s +++ b/asm/field_control_avatar.s @@ -187,7 +187,7 @@ sub_809C014: @ 809C014 ldr r0, =gScriptLastTalked movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_03005DF0 + ldr r0, =gSelectedMapObject strb r1, [r0] bl player_get_direction_lower_nybble lsls r0, 24 @@ -552,7 +552,7 @@ _0809C30E: lsrs r3, r0, 24 cmp r3, 0x10 beq _0809C32E - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects lsls r2, r3, 3 adds r0, r2, r3 lsls r0, 2 @@ -580,7 +580,7 @@ _0809C34C: adds r4, 0x1 cmp r4, 0x3 ble _0809C340 - ldr r0, =gUnknown_03005DF0 + ldr r0, =gSelectedMapObject strb r3, [r0] ldr r1, =gScriptLastTalked adds r0, r2, r3 @@ -615,7 +615,7 @@ TryGetMapObjectScript: @ 809C384 lsrs r4, r0, 24 cmp r4, 0x10 beq _0809C3B4 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects lsls r2, r4, 3 adds r0, r2, r4 lsls r0, 2 @@ -652,7 +652,7 @@ _0809C3B4: lsrs r4, r0, 24 cmp r4, 0x10 beq _0809C400 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects lsls r2, r4, 3 adds r0, r2, r4 lsls r0, 2 @@ -666,7 +666,7 @@ _0809C400: b _0809C44E .pool _0809C40C: - ldr r0, =gUnknown_03005DF0 + ldr r0, =gSelectedMapObject strb r4, [r0] ldr r1, =gScriptLastTalked adds r0, r2, r4 diff --git a/asm/field_effect.s b/asm/field_effect.s index c2f98a3e3..c40098993 100644 --- a/asm/field_effect.s +++ b/asm/field_effect.s @@ -2032,7 +2032,7 @@ mapldr_08084390: @ 80B6AA4 ldr r0, =c3_080843F8 movs r1, 0 bl CreateTask - ldr r4, =gUnknown_02037350 + ldr r4, =gMapObjects ldr r3, =gUnknown_02037590 ldrb r1, [r3, 0x5] lsls r0, r1, 3 @@ -2168,7 +2168,7 @@ sub_80B6BCC: @ 80B6BCC lsls r5, r0, 3 adds r5, r0 lsls r5, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects mov r8, r0 add r5, r8 ldrb r0, [r6, 0x4] @@ -2282,7 +2282,7 @@ sub_80B6C90: @ 80B6C90 movs r0, 0x1 strh r0, [r5, 0xA] strh r1, [r5, 0xC] - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldrb r0, [r6, 0x5] lsls r1, r0, 3 adds r1, r0 @@ -2314,7 +2314,7 @@ sub_80B6D04: @ 80B6D04 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r6, r0, r1 ldrb r1, [r2, 0x4] lsls r0, r1, 4 @@ -2556,7 +2556,7 @@ sub_80B6EE0: @ 80B6EE0 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 adds r0, r4, 0 bl FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive @@ -2833,7 +2833,7 @@ sub_80B7114: @ 80B7114 lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 movs r0, 0x4 bl GetFaceDirectionAnimId @@ -3068,7 +3068,7 @@ sub_80B72F4: @ 80B72F4 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 adds r0, r4, 0 bl FieldObjectClearAnimIfSpecialAnimFinished @@ -3143,7 +3143,7 @@ _080B7396: lsls r1, r0, 3 adds r1, r0 lsls r1, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r1, r0 ldr r2, [r2] adds r0, r4, 0 @@ -3392,7 +3392,7 @@ dive_3_unknown: @ 80B7580 lsls r0, 24 cmp r0, 0 bne _080B75C4 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r0, =gUnknown_02037590 ldrb r1, [r0, 0x5] lsls r0, r1, 3 @@ -3451,7 +3451,7 @@ _080B7604: lsls r1, r0, 3 adds r1, r0 lsls r1, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r1, r0 ldrb r0, [r5, 0x4] lsls r2, r0, 4 @@ -3781,7 +3781,7 @@ _080B78A4: lsls r1, r0, 3 adds r1, r0 lsls r1, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r1, r0 ldrb r0, [r5, 0x4] lsls r2, r0, 4 @@ -4030,7 +4030,7 @@ _080B7AA0: lsls r1, r0, 3 adds r1, r0 lsls r1, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r1, r0 ldrb r0, [r5, 0x4] lsls r2, r0, 4 @@ -4364,7 +4364,7 @@ _080B7D60: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r5, r0, r1 adds r0, r5, 0 bl FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive @@ -4465,7 +4465,7 @@ mapldr_080859D4: @ 80B7E48 ldr r1, =gUnknown_03005DAC movs r0, 0 str r0, [r1] - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r0, =gUnknown_02037590 ldrb r1, [r0, 0x5] lsls r0, r1, 3 @@ -4542,7 +4542,7 @@ sub_80B7EE8: @ 80B7EE8 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r6, r0, r1 ldrh r1, [r5, 0xA] movs r2, 0xA @@ -4700,7 +4700,7 @@ sub_80B8034: @ 80B8034 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r5, r0, r1 ldrh r1, [r4, 0xA] movs r2, 0xA @@ -4770,7 +4770,7 @@ sub_80B80C4: @ 80B80C4 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r3, r0, r1 ldrb r1, [r2, 0x4] lsls r0, r1, 4 @@ -4910,7 +4910,7 @@ mapldr_08085D88: @ 80B8200 ldr r1, =gUnknown_03005DAC movs r0, 0 str r0, [r1] - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r0, =gUnknown_02037590 ldrb r1, [r0, 0x5] lsls r0, r1, 3 @@ -4983,7 +4983,7 @@ sub_80B8280: @ 80B8280 adds r0, r1 negs r0, r0 strh r0, [r2, 0x26] - ldr r3, =gUnknown_02037350 + ldr r3, =gMapObjects ldrb r0, [r5, 0x5] lsls r1, r0, 3 adds r1, r0 @@ -5032,7 +5032,7 @@ sub_80B830C: @ 80B830C lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r6, r0, r1 ldrb r1, [r2, 0x4] lsls r0, r1, 4 @@ -5161,7 +5161,7 @@ sub_80B8410: @ 80B8410 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r5, r0, r1 ldrh r0, [r4, 0xA] subs r0, 0x1 @@ -6348,7 +6348,7 @@ sub_80B8DB4: @ 80B8DB4 adds r0, r6, 0 mov r1, r8 bl PlayerGetDestCoords - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldrb r1, [r5, 0x5] lsls r0, r1, 3 adds r0, r1 @@ -6379,7 +6379,7 @@ sub_80B8E14: @ 80B8E14 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 adds r0, r4, 0 bl FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive @@ -6415,7 +6415,7 @@ sub_80B8E60: @ 80B8E60 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl FieldObjectCheckIfSpecialAnimFinishedOrInactive lsls r0, 24 @@ -6454,7 +6454,7 @@ sub_80B8EA8: @ 80B8EA8 lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 movs r0, 0x3 bl GetPlayerAvatarGraphicsIdByStateId @@ -6503,7 +6503,7 @@ sub_80B8F24: @ 80B8F24 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 adds r0, r4, 0 bl FieldObjectClearAnimIfSpecialAnimFinished @@ -6834,7 +6834,7 @@ sub_80B9204: @ 80B9204 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 adds r0, r4, 0 bl FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive @@ -6875,7 +6875,7 @@ sub_80B925C: @ 80B925C lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl FieldObjectClearAnimIfSpecialAnimFinished lsls r0, 24 @@ -6911,7 +6911,7 @@ sub_80B92A0: @ 80B92A0 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r5, r0, r1 ldrh r1, [r4, 0x26] movs r0, 0x8 @@ -6960,7 +6960,7 @@ sub_80B92F8: @ 80B92F8 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 movs r1, 0x2 bl FieldObjectSetSpecialAnim @@ -6980,7 +6980,7 @@ sub_80B933C: @ 80B933C lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r2, r0, r1 ldrh r1, [r4, 0xC] movs r3, 0xC @@ -7028,7 +7028,7 @@ sub_80B9390: @ 80B9390 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 movs r0, 0x3 bl GetPlayerAvatarGraphicsIdByStateId @@ -7092,7 +7092,7 @@ sub_80B9418: @ 80B9418 lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 adds r0, r4, 0 bl FieldObjectClearAnimIfSpecialAnimActive @@ -7587,7 +7587,7 @@ sub_80B9804: @ 80B9804 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 adds r0, r4, 0 bl FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive @@ -7678,7 +7678,7 @@ _080B98D0: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 ldrb r0, [r0, 0x4] lsls r4, r0, 4 @@ -7765,7 +7765,7 @@ sub_80B9978: @ 80B9978 lsls r5, r0, 3 adds r5, r0 lsls r5, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r5, r0 ldrb r0, [r5, 0x4] lsls r4, r0, 4 @@ -7815,7 +7815,7 @@ sub_80B99F0: @ 80B99F0 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl FieldObjectClearAnimIfSpecialAnimFinished lsls r0, 24 @@ -7877,7 +7877,7 @@ sub_80B9A60: @ 80B9A60 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 movs r7, 0 ldrh r1, [r5, 0x26] @@ -8119,7 +8119,7 @@ sub_80B9C54: @ 80B9C54 asrs r0, 16 cmp r0, 0x78 ble _080B9CC2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects movs r1, 0x4 ldrsh r0, [r7, r1] lsls r1, r0, 3 @@ -8357,7 +8357,7 @@ sub_80B9E28: @ 80B9E28 lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 movs r0, 0x10 ldrsh r5, [r4, r0] @@ -8507,7 +8507,7 @@ _080B9F7C: lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 ldrh r0, [r5, 0x4] strh r0, [r6, 0x20] diff --git a/asm/field_effect_helpers.s b/asm/field_effect_helpers.s index fc2a8682a..69c67672c 100644 --- a/asm/field_effect_helpers.s +++ b/asm/field_effect_helpers.s @@ -248,7 +248,7 @@ objc_reflection_maybe: @ 81540A8 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r7, r0, r1 ldrb r1, [r7, 0x4] lsls r0, r1, 4 @@ -581,7 +581,7 @@ oei_shadow: @ 8154340 bl GetFieldObjectIdByLocalIdAndMap lsls r0, 24 lsrs r0, 24 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects lsls r1, r0, 3 adds r1, r0 lsls r1, 2 @@ -673,7 +673,7 @@ _08154412: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 ldrb r0, [r4, 0x4] lsls r1, r0, 4 @@ -909,7 +909,7 @@ _08154604: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r2, r0, r1 ldr r0, [r2, 0x10] ldr r1, [r5, 0x30] @@ -1248,7 +1248,7 @@ _081548B4: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r2, r0, r1 ldr r0, [r2, 0x10] ldr r1, [r5, 0x30] @@ -1346,7 +1346,7 @@ sub_815496C: @ 815496C lsls r1, r0, 3 adds r1, r0 lsls r1, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r5, r1, r0 ldr r0, =gFieldEffectObjectTemplatePointers ldr r0, [r0, 0x78] @@ -1432,7 +1432,7 @@ sub_8154A10: @ 8154A10 lsls r0, 24 cmp r0, 0 bne _08154A4E - ldr r5, =gUnknown_02037350 + ldr r5, =gMapObjects mov r0, sp ldrb r1, [r0] lsls r0, r1, 3 @@ -1787,7 +1787,7 @@ sub_8154CEC: @ 8154CEC lsls r1, r0, 3 adds r1, r0 lsls r1, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r5, r1, r0 ldr r0, =gFieldEffectObjectTemplatePointers ldr r0, [r0, 0x34] @@ -1881,7 +1881,7 @@ _08154DC0: b _08154E0A _08154DCA: ldr r3, =gSprites - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects mov r0, sp ldrb r1, [r0] lsls r0, r1, 3 @@ -2040,7 +2040,7 @@ sub_8154EFC: @ 8154EFC lsls r1, r0, 3 adds r1, r0 lsls r1, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r6, r1, r0 ldr r0, =gFieldEffectObjectTemplatePointers ldr r0, [r0, 0x34] @@ -2127,7 +2127,7 @@ sub_8154FB4: @ 8154FB4 lsls r0, 24 cmp r0, 0 bne _08154FEE - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects mov r0, sp ldrb r1, [r0] lsls r0, r1, 3 @@ -2248,7 +2248,7 @@ sub_81550B4: @ 81550B4 lsls r1, r0, 3 adds r1, r0 lsls r1, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r5, r1, r0 ldr r0, =gFieldEffectObjectTemplatePointers ldr r0, [r0, 0x7C] @@ -2332,7 +2332,7 @@ sub_8155158: @ 8155158 lsls r0, 24 cmp r0, 0 bne _08155192 - ldr r5, =gUnknown_02037350 + ldr r5, =gMapObjects mov r0, sp ldrb r1, [r0] lsls r0, r1, 3 @@ -2765,7 +2765,7 @@ sub_81554AC: @ 81554AC movs r2, 0x32 ldrsh r1, [r4, r2] bl CurrentMapDrawMetatileAt - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r0, =gUnknown_02037590 ldrb r1, [r0, 0x5] lsls r0, r1, 3 @@ -2972,7 +2972,7 @@ sub_8155658: @ 8155658 lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 ldrb r0, [r4, 0x4] lsls r5, r0, 4 @@ -3325,7 +3325,7 @@ sub_8155900: @ 8155900 lsls r1, r0, 3 adds r1, r0 lsls r1, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r6, r1, r0 ldr r0, =gFieldEffectObjectTemplatePointers ldr r0, [r0, 0x74] @@ -3419,7 +3419,7 @@ sub_81559BC: @ 81559BC lsls r0, 24 cmp r0, 0 bne _081559F6 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects mov r0, sp ldrb r1, [r0] lsls r0, r1, 3 @@ -3474,7 +3474,7 @@ _08155A46: strh r6, [r4, 0x20] strh r5, [r4, 0x22] ldr r3, =gSprites - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects mov r0, sp ldrb r1, [r0] lsls r0, r1, 3 @@ -3793,7 +3793,7 @@ sub_8155C88: @ 8155C88 adds r0, r5, 0 bl FieldEffectStop _08155CB8: - ldr r4, =gUnknown_02037350 + ldr r4, =gMapObjects mov r0, sp ldrb r1, [r0] lsls r0, r1, 3 @@ -4514,7 +4514,7 @@ _08156212: lsls r0, r7, 3 adds r0, r7 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 ldrb r0, [r4] lsls r0, 31 diff --git a/asm/field_map_obj.s b/asm/field_map_obj.s index 468f859d8..223e29ad7 100644 --- a/asm/field_map_obj.s +++ b/asm/field_map_obj.s @@ -28,7 +28,7 @@ npc_clear_ids_and_state: @ 808D3F0 npcs_clear_ids_and_state: @ 808D410 push {r4,r5,lr} movs r4, 0 - ldr r5, =gUnknown_02037350 + ldr r5, =gMapObjects _0808D416: lsls r0, r4, 3 adds r0, r4 @@ -138,7 +138,7 @@ sub_808D450: @ 808D450 sub_808D4F4: @ 808D4F4 push {lr} movs r1, 0 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldrb r0, [r2] b _0808D518 .pool @@ -218,7 +218,7 @@ _0808D56C: GetFieldObjectIdByXY: @ 808D574 push {r4-r6,lr} movs r3, 0 - ldr r5, =gUnknown_02037350 + ldr r5, =gMapObjects lsls r0, 16 asrs r4, r0, 16 lsls r1, 16 @@ -265,7 +265,7 @@ GetFieldObjectIdByLocalIdAndMapInternal: @ 808D5B8 lsls r2, 24 lsrs r2, 24 movs r1, 0 - ldr r6, =gUnknown_02037350 + ldr r6, =gMapObjects _0808D5CA: lsls r0, r1, 3 adds r0, r1 @@ -307,7 +307,7 @@ GetFieldObjectIdByLocalId: @ 808D608 lsls r0, 24 lsrs r3, r0, 24 movs r2, 0 - ldr r4, =gUnknown_02037350 + ldr r4, =gMapObjects _0808D612: lsls r0, r2, 3 adds r0, r2 @@ -365,7 +365,7 @@ _0808D66E: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 adds r0, r4, 0 bl npc_clear_ids_and_state @@ -582,7 +582,7 @@ GetAvailableFieldObjectSlot: @ 808D810 lsls r2, 24 lsrs r4, r2, 24 movs r2, 0 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects ldrb r0, [r1] lsls r0, 31 adds r7, r1, 0 @@ -627,7 +627,7 @@ _0808D868: _0808D870: mov r0, r12 strb r2, [r0] - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects _0808D876: lsls r0, r2, 3 adds r0, r2 @@ -701,7 +701,7 @@ RemoveFieldObjectByLocalIdAndMap: @ 808D8C4 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl RemoveFieldObject _0808D902: @@ -760,7 +760,7 @@ _0808D95C: lsls r0, r4, 3 adds r0, r4 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl RemoveFieldObject _0808D972: @@ -812,7 +812,7 @@ _0808D9C8: lsls r4, r0, 3 adds r0, r4, r0 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r6, r0, r1 ldrb r0, [r6, 0x5] bl GetFieldObjectGraphicsInfo @@ -867,7 +867,7 @@ _0808DA24: mov r8, r0 cmp r0, 0x40 bne _0808DA64 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects mov r2, r9 adds r1, r4, r2 lsls r1, 2 @@ -1051,7 +1051,7 @@ SpawnFieldObject: @ 808DB40 .pool _0808DBBC: ldr r4, =gSprites - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects lsls r0, r2, 3 adds r0, r2 lsls r0, 2 @@ -1704,7 +1704,7 @@ _0808E0AA: lsls r0, r3, 3 adds r0, r3 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r2, r0, r1 ldr r0, [r2] ldr r1, =0x00010001 @@ -1804,7 +1804,7 @@ sub_808E16C: @ 808E16C lsrs r5, 16 bl ClearPlayerAvatarInfo movs r6, 0 - ldr r7, =gUnknown_02037350 + ldr r7, =gMapObjects lsls r4, 16 lsls r5, 16 _0808E186: @@ -1872,7 +1872,7 @@ _0808E1EC: lsls r0, r1, 3 add r0, r9 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r6, r0, r1 movs r0, 0 str r0, [sp, 0x20] @@ -2097,7 +2097,7 @@ SetPlayerAvatarFieldObjectIdAndObjectId: @ 808E3C4 ldr r5, =gUnknown_02037590 strb r0, [r5, 0x5] strb r1, [r5, 0x4] - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects lsls r4, r0, 3 adds r4, r0 lsls r4, 2 @@ -2270,7 +2270,7 @@ sub_808E504: @ 808E504 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 adds r1, r4, 0 bl FieldObjectSetGraphicsId @@ -2346,7 +2346,7 @@ FieldObjectTurnByLocalIdAndMap: @ 808E594 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 adds r1, r4, 0 bl FieldObjectTurn @@ -2367,7 +2367,7 @@ sub_808E5D4: @ 808E5D4 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 bl FieldObjectTurn pop {r0} @@ -2528,7 +2528,7 @@ npc_by_local_id_and_map_set_field_1_bit_x20: @ 808E6F8 lsls r0, 24 cmp r0, 0 bne _0808E73A - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects mov r0, sp ldrb r0, [r0] lsls r1, r0, 3 @@ -2583,7 +2583,7 @@ sub_808E75C: @ 808E75C lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 ldrb r1, [r0] movs r2, 0x4 @@ -2617,7 +2617,7 @@ sub_808E78C: @ 808E78C lsls r2, r0, 3 adds r2, r0 lsls r2, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r2, r0 ldrb r1, [r2, 0x4] lsls r0, r1, 4 @@ -2659,7 +2659,7 @@ sub_808E7E4: @ 808E7E4 lsls r1, r0, 3 adds r1, r0 lsls r1, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r1, r0 ldrb r2, [r1, 0x3] movs r0, 0x5 @@ -2697,7 +2697,7 @@ sub_808E82C: @ 808E82C lsls r0, 24 cmp r0, 0 bne _0808E870 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects mov r0, sp ldrb r1, [r0] lsls r0, r1, 3 @@ -3176,7 +3176,7 @@ sub_808EBA8: @ 808EBA8 lsls r0, r3, 3 adds r0, r3 lsls r0, 2 - ldr r3, =gUnknown_02037350 + ldr r3, =gMapObjects adds r0, r3 movs r3, 0xE0 lsls r3, 11 @@ -3217,7 +3217,7 @@ UpdateFieldObjectCoordsForCameraUpdate: @ 808EC10 cmp r0, 0 beq _0808EC68 movs r3, 0 - ldr r5, =gUnknown_02037350 + ldr r5, =gMapObjects movs r0, 0x4 ldrsh r4, [r2, r0] movs r0, 0x8 @@ -3275,7 +3275,7 @@ GetFieldObjectIdByXYZ: @ 808EC78 lsls r2, 24 lsrs r5, r2, 24 movs r4, 0 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects mov r8, r0 _0808EC90: lsls r0, r4, 3 @@ -3795,7 +3795,7 @@ GetFieldObjectScriptPointerByFieldObjectId: @ 808F01C push {lr} lsls r0, 24 lsrs r0, 24 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects lsls r2, r0, 3 adds r2, r0 lsls r2, 2 @@ -3831,7 +3831,7 @@ GetFieldObjectFlagIdByFieldObjectId: @ 808F058 push {lr} lsls r0, 24 lsrs r0, 24 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects lsls r2, r0, 3 adds r2, r0 lsls r2, 2 @@ -3862,7 +3862,7 @@ sub_808F080: @ 808F080 lsls r0, 24 cmp r0, 0 bne _0808F0B4 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects mov r0, sp ldrb r1, [r0] lsls r0, r1, 3 @@ -3884,7 +3884,7 @@ _0808F0B6: sub_808F0BC: @ 808F0BC lsls r0, 24 lsrs r0, 24 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects lsls r1, r0, 3 adds r1, r0 lsls r1, 2 @@ -3909,7 +3909,7 @@ sub_808F0D4: @ 808F0D4 lsls r0, 24 cmp r0, 0 bne _0808F108 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects mov r0, sp ldrb r1, [r0] lsls r0, r1, 3 @@ -3932,7 +3932,7 @@ _0808F10A: FieldObjectGetBerryTreeId: @ 808F110 lsls r0, 24 lsrs r0, 24 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects lsls r1, r0, 3 adds r1, r0 lsls r1, 2 @@ -4141,7 +4141,7 @@ sub_808F254: @ 808F254 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl sub_808F208 _0808F282: @@ -4179,7 +4179,7 @@ _0808F2B6: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 ldr r1, =gUnknown_082766A2 bl sub_808F228 @@ -4191,7 +4191,7 @@ _0808F2D4: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 ldr r1, =gUnknown_082766A6 bl sub_808F228 @@ -4319,7 +4319,7 @@ FieldObjectCB_NoMovement1: @ 808F3E0 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =FieldObjectCB2_NoMovement1 bl FieldObjectStep @@ -4343,7 +4343,7 @@ FieldObjectCB_GoRandomDirections: @ 808F408 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =FieldObjectCB2_GoRandomDirections bl FieldObjectStep @@ -5082,7 +5082,7 @@ FieldObjectCB_LookRandomDirections: @ 808F944 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =FieldObjectCB2_LookRandomDirections bl FieldObjectStep @@ -5256,7 +5256,7 @@ FieldObjectCB_RandomlyGoNorthOrSouth: @ 808FA84 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =FieldObjectCB2_RandomlyGoNorthOrSouth bl FieldObjectStep @@ -5469,7 +5469,7 @@ FieldObjectCB_RandomlyGoEastOrWest: @ 808FC08 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =FieldObjectCB2_RandomlyGoEastOrWest bl FieldObjectStep @@ -5679,7 +5679,7 @@ FieldObjectCB_FaceFixedDirection: @ 808FD8C lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =FieldObjectCB2_FaceFixedDirection bl FieldObjectStep @@ -5773,7 +5773,7 @@ FieldObjectCB_BerryTree: @ 808FE2C lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r5, r0, r1 ldrh r1, [r4, 0x3C] movs r0, 0x1 @@ -6071,7 +6071,7 @@ FieldObjectCB_RandomlyLookNorthOrSouth: @ 8090050 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =FieldObjectCB2_RandomlyLookNorthOrSouth bl FieldObjectStep @@ -6239,7 +6239,7 @@ FieldObjectCB_RandomlyLookEastOrWest: @ 8090190 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =FieldObjectCB2_RandomlyLookEastOrWest bl FieldObjectStep @@ -6407,7 +6407,7 @@ FieldObjectCB_RandomlyLookNorthOrWest: @ 80902D0 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =FieldObjectCB2_RandomlyLookNorthOrWest bl FieldObjectStep @@ -6575,7 +6575,7 @@ FieldObjectCB_RandomlyLookNorthOrEast: @ 8090410 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8090434 bl FieldObjectStep @@ -6743,7 +6743,7 @@ FieldObjectCB_RandomlyLookSouthOrWest: @ 8090550 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8090574 bl FieldObjectStep @@ -6911,7 +6911,7 @@ FieldObjectCB_RandomlyLookSouthOrEast: @ 8090690 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_80906B4 bl FieldObjectStep @@ -7079,7 +7079,7 @@ FieldObjectCB_RandomlyLookNorthOrSouthOrWest: @ 80907D0 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_80907F4 bl FieldObjectStep @@ -7247,7 +7247,7 @@ FieldObjectCB_RandomlyLookNorthOrSouthOrEast: @ 8090910 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8090934 bl FieldObjectStep @@ -7415,7 +7415,7 @@ FieldObjectCB_RandomlyLookNorthOrEastOrWest: @ 8090A50 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8090A74 bl FieldObjectStep @@ -7583,7 +7583,7 @@ FieldObjectCB_RandomlyLookSouthOrEastOrWest: @ 8090B90 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8090BB4 bl FieldObjectStep @@ -7751,7 +7751,7 @@ FieldObjectCB_LookAroundCounterclockwise: @ 8090CD0 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8090CF4 bl FieldObjectStep @@ -7891,7 +7891,7 @@ FieldObjectCB_LookAroundClockwise: @ 8090DD4 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8090DF8 bl FieldObjectStep @@ -8030,7 +8030,7 @@ FieldObjectCB_AlternatelyGoInOppositeDirections: @ 8090ED8 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8090EFC bl FieldObjectStep @@ -8348,7 +8348,7 @@ FieldObjectCB_GoInDirectionSequence1: @ 8091138 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_809115C bl FieldObjectStep @@ -8421,7 +8421,7 @@ FieldObjectCB_GoInDirectionSequence2: @ 80911C4 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_80911E8 bl FieldObjectStep @@ -8494,7 +8494,7 @@ FieldObjectCB_GoInDirectionSequence3: @ 8091250 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8091274 bl FieldObjectStep @@ -8567,7 +8567,7 @@ FieldObjectCB_GoInDirectionSequence4: @ 80912DC lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8091300 bl FieldObjectStep @@ -8640,7 +8640,7 @@ FieldObjectCB_GoInDirectionSequence5: @ 8091368 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_809138C bl FieldObjectStep @@ -8714,7 +8714,7 @@ FieldObjectCB_GoInDirectionSequence6: @ 80913F4 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8091418 bl FieldObjectStep @@ -8787,7 +8787,7 @@ FieldObjectCB_GoInDirectionSequence7: @ 8091480 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_80914A4 bl FieldObjectStep @@ -8860,7 +8860,7 @@ FieldObjectCB_GoInDirectionSequence8: @ 809150C lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8091530 bl FieldObjectStep @@ -8933,7 +8933,7 @@ FieldObjectCB_GoInDirectionSequence9: @ 8091598 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_80915BC bl FieldObjectStep @@ -9006,7 +9006,7 @@ FieldObjectCB_GoInDirectionSequence10: @ 8091624 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8091648 bl FieldObjectStep @@ -9079,7 +9079,7 @@ FieldObjectCB_GoInDirectionSequence11: @ 80916B0 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_80916D4 bl FieldObjectStep @@ -9152,7 +9152,7 @@ FieldObjectCB_GoInDirectionSequence12: @ 809173C lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8091760 bl FieldObjectStep @@ -9225,7 +9225,7 @@ FieldObjectCB_GoInDirectionSequence13: @ 80917C8 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_80917EC bl FieldObjectStep @@ -9298,7 +9298,7 @@ FieldObjectCB_GoInDirectionSequence14: @ 8091854 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8091878 bl FieldObjectStep @@ -9371,7 +9371,7 @@ FieldObjectCB_GoInDirectionSequence15: @ 80918E0 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8091904 bl FieldObjectStep @@ -9444,7 +9444,7 @@ FieldObjectCB_GoInDirectionSequence16: @ 809196C lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8091990 bl FieldObjectStep @@ -9517,7 +9517,7 @@ FieldObjectCB_GoInDirectionSequence17: @ 80919F8 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8091A1C bl FieldObjectStep @@ -9590,7 +9590,7 @@ FieldObjectCB_GoInDirectionSequence18: @ 8091A84 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8091AA8 bl FieldObjectStep @@ -9663,7 +9663,7 @@ FieldObjectCB_GoInDirectionSequence19: @ 8091B10 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8091B34 bl FieldObjectStep @@ -9736,7 +9736,7 @@ FieldObjectCB_GoInDirectionSequence20: @ 8091B9C lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8091BC0 bl FieldObjectStep @@ -9809,7 +9809,7 @@ FieldObjectCB_GoInDirectionSequence21: @ 8091C28 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8091C4C bl FieldObjectStep @@ -9882,7 +9882,7 @@ FieldObjectCB_GoInDirectionSequence22: @ 8091CB4 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8091CD8 bl FieldObjectStep @@ -9955,7 +9955,7 @@ FieldObjectCB_GoInDirectionSequence23: @ 8091D40 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8091D64 bl FieldObjectStep @@ -10028,7 +10028,7 @@ FieldObjectCB_GoInDirectionSequence24: @ 8091DCC lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8091DF0 bl FieldObjectStep @@ -10101,7 +10101,7 @@ FieldObjectCB_CopyPlayer1: @ 8091E58 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8091E7C bl FieldObjectStep @@ -10155,7 +10155,7 @@ sub_8091EC0: @ 8091EC0 push {r4-r7,lr} adds r6, r0, 0 adds r7, r1, 0 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r3, =gUnknown_02037590 ldrb r1, [r3, 0x5] lsls r0, r1, 3 @@ -10878,7 +10878,7 @@ FieldObjectCB_CopyPlayer2: @ 8092494 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_80924B8 bl FieldObjectStep @@ -10910,7 +10910,7 @@ mss_08062EA4: @ 80924D8 push {r4-r7,lr} adds r6, r0, 0 adds r7, r1, 0 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r3, =gUnknown_02037590 ldrb r1, [r3, 0x5] lsls r0, r1, 3 @@ -10962,7 +10962,7 @@ FieldObjectCB_TreeDisguise: @ 809253C lsls r1, r0, 3 adds r1, r0 lsls r1, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r1, r0 adds r6, r4, 0 adds r6, 0x21 @@ -10996,7 +10996,7 @@ _08092584: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 ldr r2, =sub_80925AC adds r1, r5, 0 @@ -11025,7 +11025,7 @@ FieldObjectCB_MountainDisguise: @ 80925B8 lsls r1, r0, 3 adds r1, r0 lsls r1, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r1, r0 adds r6, r4, 0 adds r6, 0x21 @@ -11059,7 +11059,7 @@ _08092600: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 ldr r2, =sub_80925AC adds r1, r5, 0 @@ -11077,7 +11077,7 @@ FieldObjectCB_Hidden1: @ 8092628 adds r3, r0, 0 movs r1, 0x3C ldrsh r0, [r3, r1] - ldr r4, =gUnknown_02037350 + ldr r4, =gMapObjects cmp r0, 0 bne _08092668 movs r0, 0x2E @@ -11175,7 +11175,7 @@ FieldObjectCB_WalkInPlace1: @ 80926D4 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_80926F8 bl FieldObjectStep @@ -11234,7 +11234,7 @@ FieldObjectCB_WalkInPlace4: @ 8092744 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8092768 bl FieldObjectStep @@ -11293,7 +11293,7 @@ FieldObjectCB_WalkInPlace2: @ 80927B4 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_80927D8 bl FieldObjectStep @@ -11353,7 +11353,7 @@ FieldObjectCB_WalkInPlace3: @ 8092824 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_8092848 bl FieldObjectStep @@ -11412,7 +11412,7 @@ FieldObjectCB_Hidden2: @ 8092894 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =sub_80928B8 bl FieldObjectStep @@ -12234,7 +12234,7 @@ _08092E2E: lsls r0, r4, 3 adds r0, r4 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r2, r0, r1 ldrb r0, [r2] lsls r0, 31 @@ -12304,7 +12304,7 @@ sub_8092E9C: @ 8092E9C cmp r0, 0 bne _08092EE8 ldr r3, =gSprites - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects mov r0, sp ldrb r1, [r0] lsls r0, r1, 3 @@ -12348,7 +12348,7 @@ sub_8092EF0: @ 8092EF0 cmp r0, 0 bne _08092F2E ldr r3, =gSprites - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects mov r0, sp ldrb r1, [r0] lsls r0, r1, 3 @@ -16972,7 +16972,7 @@ sub_8094F38: @ 8094F38 ldrsh r0, [r5, r1] movs r2, 0x12 ldrsh r1, [r5, r2] - ldr r4, =gUnknown_02037350 + ldr r4, =gMapObjects mov r2, sp ldrb r2, [r2] lsls r3, r2, 3 @@ -17018,7 +17018,7 @@ sub_8094F94: @ 8094F94 ldrsh r0, [r5, r1] movs r2, 0x12 ldrsh r1, [r5, r2] - ldr r4, =gUnknown_02037350 + ldr r4, =gMapObjects mov r2, sp ldrb r2, [r2] lsls r3, r2, 3 diff --git a/asm/field_player_avatar.s b/asm/field_player_avatar.s index 6947746ef..1698c054e 100644 --- a/asm/field_player_avatar.s +++ b/asm/field_player_avatar.s @@ -15,7 +15,7 @@ FieldObjectCB_NoMovement2: @ 808A998 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldr r2, =FieldObjectCB2_NoMovement2 bl FieldObjectStep @@ -48,7 +48,7 @@ player_step: @ 808A9C0 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r5, r0, r1 adds r0, r5, 0 bl sub_808C280 @@ -240,7 +240,7 @@ GetForcedMovementByMetatileBehavior: @ 808AB38 ands r0, r1 cmp r0, 0 bne _0808AB8A - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldrb r1, [r3, 0x5] lsls r0, r1, 3 adds r0, r1 @@ -290,7 +290,7 @@ ForcedMovement_None: @ 808AB94 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 ldrb r2, [r0, 0x1] movs r1, 0x3 @@ -386,7 +386,7 @@ DoForcedMovementInCurrentDirection: @ 808AC58 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 ldrb r2, [r0, 0x1] movs r3, 0x4 @@ -528,7 +528,7 @@ ForcedMovement_Slide: @ 808AD60 lsls r2, r3, 3 adds r2, r3 lsls r2, 2 - ldr r3, =gUnknown_02037350 + ldr r3, =gMapObjects adds r2, r3 ldrb r3, [r2, 0x1] movs r4, 0x4 @@ -623,7 +623,7 @@ ForcedMovement_MuddySlope: @ 808AE10 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 ldrb r1, [r4, 0x18] movs r0, 0xF0 @@ -809,7 +809,7 @@ _0808AF68: lsls r0, 24 cmp r0, 0 beq _0808AFB0 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldrb r1, [r4, 0x5] lsls r0, r1, 3 adds r0, r1 @@ -848,7 +848,7 @@ CheckForPlayerAvatarCollision: @ 808AFBC lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 ldrh r1, [r4, 0x10] add r0, sp, 0x4 @@ -899,7 +899,7 @@ sub_808B028: @ 808B028 lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 ldrh r1, [r4, 0x10] add r0, sp, 0x4 @@ -1187,7 +1187,7 @@ sub_808B238: @ 808B238 lsrs r6, r0, 24 cmp r6, 0x10 beq _0808B2D8 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects lsls r1, r6, 3 adds r1, r6 lsls r1, 2 @@ -1290,7 +1290,7 @@ IsPlayerCollidingWithFarawayIslandMew: @ 808B324 lsls r1, r2, 3 adds r1, r2 lsls r1, 2 - ldr r5, =gUnknown_02037350 + ldr r5, =gMapObjects adds r3, r1, r5 ldrh r2, [r3, 0x10] mov r1, sp @@ -1401,7 +1401,7 @@ _0808B3F4: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 ldr r1, [r2] bl _call_via_r1 @@ -1621,7 +1621,7 @@ _0808B5B6: thumb_func_start player_is_anim_in_certain_ranges player_is_anim_in_certain_ranges: @ 808B5BC push {lr} - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r0, =gUnknown_02037590 ldrb r1, [r0, 0x5] lsls r0, r1, 3 @@ -1696,7 +1696,7 @@ PlayerIsAnimActive: @ 808B63C lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive lsls r0, 24 @@ -1715,7 +1715,7 @@ PlayerCheckIfAnimFinishedOrInactive: @ 808B660 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl FieldObjectCheckIfSpecialAnimFinishedOrInactive lsls r0, 24 @@ -1727,7 +1727,7 @@ PlayerCheckIfAnimFinishedOrInactive: @ 808B660 thumb_func_start player_set_x22 player_set_x22: @ 808B684 - ldr r3, =gUnknown_02037350 + ldr r3, =gMapObjects ldr r1, =gUnknown_02037590 ldrb r2, [r1, 0x5] lsls r1, r2, 3 @@ -1742,7 +1742,7 @@ player_set_x22: @ 808B684 thumb_func_start player_get_x22 player_get_x22: @ 808B6A0 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r0, =gUnknown_02037590 ldrb r1, [r0, 0x5] lsls r0, r1, 3 @@ -1766,7 +1766,7 @@ sub_808B6BC: @ 808B6BC lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r0, r2 bl FieldObjectForceSetSpecialAnim pop {r0} @@ -1793,7 +1793,7 @@ player_npc_set_state_and_x22_etc: @ 808B6E4 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 adds r1, r5, 0 bl FieldObjectSetSpecialAnim @@ -2013,7 +2013,7 @@ _0808B872: lsls r0, 24 cmp r0, 0 beq _0808B89A - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldrb r1, [r4, 0x5] lsls r0, r1, 3 adds r0, r1 @@ -2219,7 +2219,7 @@ PlayCollisionSoundIfNotFacingWarp: @ 808B9EC sub sp, 0x4 lsls r0, 24 lsrs r4, r0, 24 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r0, =gUnknown_02037590 ldrb r1, [r0, 0x5] lsls r0, r1, 3 @@ -2275,7 +2275,7 @@ GetXYCoordsOneStepInFrontOfPlayer: @ 808BA68 push {r4,r5,lr} adds r4, r0, 0 adds r5, r1, 0 - ldr r3, =gUnknown_02037350 + ldr r3, =gMapObjects ldr r2, =gUnknown_02037590 ldrb r1, [r2, 0x5] lsls r0, r1, 3 @@ -2307,7 +2307,7 @@ GetXYCoordsOneStepInFrontOfPlayer: @ 808BA68 @ void PlayerGetDestCoords(u16 *x, u16 *y) PlayerGetDestCoords: @ 808BAAC push {r4,r5,lr} - ldr r5, =gUnknown_02037350 + ldr r5, =gMapObjects ldr r4, =gUnknown_02037590 ldrb r3, [r4, 0x5] lsls r2, r3, 3 @@ -2339,7 +2339,7 @@ plaer_get_pos_including_state_based_drift: @ 808BADC lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r3, r0, r1 ldrb r1, [r3] movs r0, 0xC0 @@ -2465,7 +2465,7 @@ _0808BC30: thumb_func_start player_get_direction_lower_nybble @ u8 player_get_direction_lower_nybble() player_get_direction_lower_nybble: @ 808BC38 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r0, =gUnknown_02037590 ldrb r1, [r0, 0x5] lsls r0, r1, 3 @@ -2482,7 +2482,7 @@ player_get_direction_lower_nybble: @ 808BC38 thumb_func_start player_get_direction_upper_nybble @ u8 player_get_direction_upper_nybble() player_get_direction_upper_nybble: @ 808BC58 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r0, =gUnknown_02037590 ldrb r1, [r0, 0x5] lsls r0, r1, 3 @@ -2498,7 +2498,7 @@ player_get_direction_upper_nybble: @ 808BC58 thumb_func_start PlayerGetZCoord @ u8 PlayerGetZCoord() PlayerGetZCoord: @ 808BC74 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r0, =gUnknown_02037590 ldrb r1, [r0, 0x5] lsls r0, r1, 3 @@ -2521,7 +2521,7 @@ sub_808BC90: @ 808BC90 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 lsls r3, 16 asrs r3, 16 @@ -2578,7 +2578,7 @@ sub_808BCF4: @ 808BCF4 lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 adds r0, r4, 0 bl npc_clear_strange_bits @@ -2809,7 +2809,7 @@ IsPlayerFacingSurfableFishableWater: @ 808BE74 lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 ldrh r1, [r4, 0x10] mov r0, sp @@ -3060,7 +3060,7 @@ InitPlayerAvatar: @ 808BFE0 lsls r4, r5, 3 adds r4, r5 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 ldrb r0, [r4, 0x2] movs r1, 0x1 @@ -3097,7 +3097,7 @@ sub_808C0A8: @ 808C0A8 push {r4-r6,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r6, =gUnknown_02037350 + ldr r6, =gMapObjects ldr r5, =gUnknown_02037590 ldrb r0, [r5, 0x5] lsls r1, r0, 3 @@ -3152,7 +3152,7 @@ sub_808C114: @ 808C114 lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 movs r0, 0x5 bl GetPlayerAvatarGraphicsIdByStateId @@ -3186,7 +3186,7 @@ sub_808C15C: @ 808C15C lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 movs r0, 0x6 bl GetPlayerAvatarGraphicsIdByStateId @@ -3227,7 +3227,7 @@ sub_808C1B4: @ 808C1B4 lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 movs r0, 0x2 bl GetPlayerAvatarGraphicsIdByStateId @@ -3276,7 +3276,7 @@ sub_808C228: @ 808C228 lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 movs r0, 0x7 bl GetPlayerAvatarGraphicsIdByStateId @@ -3414,7 +3414,7 @@ taskFF_bump_boulder: @ 808C34C lsrs r0, 24 ldr r6, =gUnknown_08497530 ldr r2, =gTasks - ldr r5, =gUnknown_02037350 + ldr r5, =gMapObjects lsls r1, r0, 2 adds r1, r0 lsls r1, 3 @@ -3625,7 +3625,7 @@ _0808C50A: lsls r1, r0, 3 adds r1, r0 lsls r1, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r1, r0 ldr r2, [r2] adds r0, r4, 0 @@ -3726,7 +3726,7 @@ _0808C5E2: lsls r1, r0, 3 adds r1, r0 lsls r1, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r1, r0 ldr r2, [r2] adds r0, r4, 0 @@ -3936,7 +3936,7 @@ taskFF_0805D1D4: @ 808C7A8 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r5, r0, r1 adds r0, r5, 0 bl FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive @@ -3983,7 +3983,7 @@ sub_808C814: @ 808C814 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 adds r0, r4, 0 bl FieldObjectClearAnimIfSpecialAnimFinished @@ -4127,7 +4127,7 @@ fish1: @ 808C918 ldrh r1, [r6] adds r1, r0 strh r1, [r5, 0x22] - ldr r3, =gUnknown_02037350 + ldr r3, =gMapObjects ldr r2, =gUnknown_02037590 ldrb r1, [r2, 0x5] lsls r0, r1, 3 @@ -4579,7 +4579,7 @@ _0808CCBC: lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects mov r8, r0 add r4, r8 ldrh r1, [r5, 0x24] @@ -4792,7 +4792,7 @@ fishE: @ 808CE8C lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects mov r8, r0 add r4, r8 ldrh r1, [r6, 0x24] @@ -4984,7 +4984,7 @@ _0808D03A: ands r0, r1 cmp r0, 0 beq _0808D05E - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldrb r1, [r3, 0x5] lsls r0, r1, 3 adds r0, r1 @@ -5037,7 +5037,7 @@ sub_808D094: @ 808D094 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 ldrb r1, [r4, 0x4] lsls r0, r1, 4 @@ -5217,7 +5217,7 @@ sub_808D1FC: @ 808D1FC lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 ldrb r1, [r4, 0x4] lsls r0, r1, 4 diff --git a/asm/fldeff_80F9BCC.s b/asm/fldeff_80F9BCC.s index dffc7c780..f783547e1 100644 --- a/asm/fldeff_80F9BCC.s +++ b/asm/fldeff_80F9BCC.s @@ -1722,7 +1722,7 @@ _080FA9CA: sub_80FA9D0: @ 80FA9D0 push {r4,lr} sub sp, 0x4 - ldr r3, =gUnknown_02037350 + ldr r3, =gMapObjects ldr r2, =gUnknown_02037590 ldrb r1, [r2, 0x5] lsls r0, r1, 3 @@ -2312,7 +2312,7 @@ sub_80FAEF0: @ 80FAEF0 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 adds r0, r4, 0 bl FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive @@ -2362,7 +2362,7 @@ sub_80FAF64: @ 80FAF64 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r5, r0, r1 adds r0, r5, 0 bl FieldObjectClearAnimIfSpecialAnimFinished diff --git a/asm/fldeff_emotion.s b/asm/fldeff_emotion.s index 845f5618f..f8b66da0d 100644 --- a/asm/fldeff_emotion.s +++ b/asm/fldeff_emotion.s @@ -167,7 +167,7 @@ _080B4756: bl FieldEffectStop b _080B47B2 _080B4764: - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects mov r0, sp ldrb r1, [r0] lsls r0, r1, 3 @@ -274,7 +274,7 @@ sub_80B4808: @ 80B4808 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 ldrb r0, [r0, 0x18] lsls r0, 28 @@ -301,7 +301,7 @@ _080B4870: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 ldrb r0, [r0, 0x18] lsls r0, 28 diff --git a/asm/hall_of_fame.s b/asm/hall_of_fame.s index d787a1ad8..9227c1795 100644 --- a/asm/hall_of_fame.s +++ b/asm/hall_of_fame.s @@ -3214,14 +3214,14 @@ _08175176: adds r0, r2, 0 movs r2, 0x1 movs r3, 0x3 - bl sub_806ED40 + bl DoMonFrontSpriteAnimation b _0817519C _08175190: lsrs r1, 16 adds r0, r2, 0 movs r2, 0 movs r3, 0x3 - bl sub_806ED40 + bl DoMonFrontSpriteAnimation _0817519C: pop {r4} pop {r0} diff --git a/asm/item_use.s b/asm/item_use.s index f693f7411..a2488b6df 100644 --- a/asm/item_use.s +++ b/asm/item_use.s @@ -11,7 +11,7 @@ SetUpItemUseCallback: @ 80FD060 push {r4,r5,lr} lsls r0, 24 lsrs r5, r0, 24 - ldr r1, =gUnknown_0203CE7C + ldr r1, =gScriptItemId ldrh r0, [r1] cmp r0, 0xAF bne _080FD084 @@ -260,7 +260,7 @@ sub_80FD254: @ 80FD254 push {lr} sub sp, 0x24 mov r1, sp - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] strh r0, [r1, 0x20] ldr r1, =bag_menu_mail_related @@ -381,7 +381,7 @@ ItemUseOnFieldCB_Bike: @ 80FD358 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] bl ItemId_GetSecondaryId lsls r0, 24 @@ -515,7 +515,7 @@ ItemUseOnFieldCB_Rod: @ 80FD468 adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] bl ItemId_GetSecondaryId lsls r0, 24 @@ -1306,7 +1306,7 @@ sub_80FDA24: @ 80FDA24 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r4, =gUnknown_02037350 + ldr r4, =gMapObjects adds r0, r4 bl FieldObjectClearAnimIfSpecialAnimFinished movs r0, 0xFF @@ -1356,7 +1356,7 @@ sub_80FDA94: @ 80FDA94 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl FieldObjectCheckIfSpecialAnimFinishedOrInactive lsls r0, 24 @@ -1395,7 +1395,7 @@ sub_80FDADC: @ 80FDADC lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl FieldObjectCheckIfSpecialAnimFinishedOrInactive lsls r0, 24 @@ -1642,7 +1642,7 @@ sub_80FDD10: @ 80FDD10 b _080FDD68 .pool _080FDD58: - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] bl ItemId_GetFieldFunc adds r1, r0, 0 @@ -1661,7 +1661,7 @@ sub_80FDD74: @ 80FDD74 adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] movs r1, 0x1 bl RemoveBagItem @@ -1692,7 +1692,7 @@ ItemUseOutOfBattle_WailmerPail: @ 80FDDA4 b _080FDDD8 .pool _080FDDC8: - bl WaterBerryTree + bl TryToWaterBerryTree lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -1759,7 +1759,7 @@ sub_80FDE2C: @ 80FDE2C lsrs r2, r0, 24 cmp r2, 0x10 beq _080FDE68 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects lsls r1, r2, 3 adds r1, r2 lsls r1, 2 @@ -1886,7 +1886,7 @@ ItemUseOutOfBattle_TMHM: @ 80FDF48 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r1, [r0] movs r0, 0xA9 lsls r0, 1 @@ -1945,7 +1945,7 @@ task08_0809AD8C: @ 80FDFBC cmp r0, 0 beq _080FE000 ldr r4, =gStringVar1 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] bl ItemIdToBattleMoveId lsls r0, 16 @@ -2002,7 +2002,7 @@ sub_80FE03C: @ 80FE03C thumb_func_start sub_80FE058 sub_80FE058: @ 80FE058 push {r4,lr} - ldr r4, =gUnknown_0203CE7C + ldr r4, =gScriptItemId ldrh r0, [r4] movs r1, 0x1 bl RemoveBagItem @@ -2125,7 +2125,7 @@ sub_80FE164: @ 80FE164 cmp r0, 0 bne _080FE1C2 ldr r4, =0x00004021 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] bl ItemId_GetHoldEffectParam adds r1, r0, 0 @@ -2205,7 +2205,7 @@ ItemUseOutOfBattle_BlackWhiteFlute: @ 80FE234 push {r4,r5,lr} lsls r0, 24 lsrs r5, r0, 24 - ldr r4, =gUnknown_0203CE7C + ldr r4, =gScriptItemId ldrh r0, [r4] ldr r1, =gStringVar2 bl CopyItemName @@ -2357,11 +2357,11 @@ ItemUseInBattle_PokeBall: @ 80FE394 lsls r0, 24 lsrs r4, r0, 24 adds r5, r4, 0 - bl PlayerPartyAndPokemonStorageFull + bl IsPlayerPartyAndPokemonStorageFull lsls r0, 24 cmp r0, 0 bne _080FE3D0 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] movs r1, 0x1 bl RemoveBagItem @@ -2450,7 +2450,7 @@ sub_80FE440: @ 80FE440 ble _080FE4AC movs r0, 0x1 bl PlaySE - ldr r4, =gUnknown_0203CE7C + ldr r4, =gScriptItemId ldrh r0, [r4] movs r1, 0x1 bl RemoveBagItem @@ -2487,7 +2487,7 @@ ItemUseInBattle_StatIncrease: @ 80FE4B8 lsls r0, 24 lsrs r4, r0, 24 ldr r1, =gBattlePartyID - ldr r0, =gUnknown_020244B8 + ldr r0, =gBankInMenu ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -2496,7 +2496,7 @@ ItemUseInBattle_StatIncrease: @ 80FE4B8 muls r0, r2 ldr r1, =gPlayerParty adds r0, r1 - ldr r1, =gUnknown_0203CE7C + ldr r1, =gScriptItemId ldrh r1, [r1] lsls r2, 24 lsrs r2, 24 @@ -2664,7 +2664,7 @@ ItemUseOutOfBattle_EnigmaBerry: @ 80FE650 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] bl GetItemEffectType lsls r0, 24 @@ -2785,7 +2785,7 @@ ItemUseInBattle_EnigmaBerry: @ 80FE77C push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] bl GetItemEffectType lsls r0, 24 diff --git a/asm/lilycove_lady.s b/asm/lilycove_lady.s index debcc3fbe..fca8cb29b 100644 --- a/asm/lilycove_lady.s +++ b/asm/lilycove_lady.s @@ -566,7 +566,7 @@ _0818DE36: thumb_func_start sub_818DE44 sub_818DE44: @ 818DE44 push {lr} - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] bl sub_818DD84 lsls r0, 24 @@ -1323,7 +1323,7 @@ sub_818E47C: @ 818E47C thumb_func_start sub_818E490 sub_818E490: @ 818E490 push {lr} - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] movs r1, 0x1 bl RemoveBagItem @@ -1341,7 +1341,7 @@ sub_818E4A4: @ 818E4A4 ldr r1, =0x00003b58 adds r0, r1 str r0, [r2] - ldr r1, =gUnknown_0203CE7C + ldr r1, =gScriptItemId ldrh r1, [r1] strh r1, [r0, 0x28] movs r3, 0 diff --git a/asm/link.s b/asm/link.s index 690c8cf8f..9ee94412d 100644 --- a/asm/link.s +++ b/asm/link.s @@ -1232,7 +1232,7 @@ _08009E8C: _08009EA8: ldr r0, =gUnknown_03003110 strh r2, [r0] - ldr r1, =gUnknown_0203CE7C + ldr r1, =gScriptItemId ldrh r1, [r1] b _08009F04 .pool @@ -21076,7 +21076,7 @@ sub_8014210: @ 8014210 str r0, [r1, 0x8] ldr r0, =gBattleTypeFlags str r6, [r0] - bl sub_806E64C + bl PlayBattleBGM pop {r4-r6} pop {r0} bx r0 @@ -31367,7 +31367,7 @@ sub_8019AD8: @ 8019AD8 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 adds r0, r4, 0 bl FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive @@ -31413,7 +31413,7 @@ sub_8019B3C: @ 8019B3C lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 adds r0, r4, 0 bl FieldObjectClearAnimIfSpecialAnimFinished @@ -45605,7 +45605,7 @@ _08020D74: sub_8020D8C: @ 8020D8C push {r4,lr} sub sp, 0xC - ldr r1, =gUnknown_0203CE7C + ldr r1, =gScriptItemId ldrh r0, [r1] subs r0, 0x85 lsls r0, 16 @@ -45626,7 +45626,7 @@ _08020DB0: ldrb r0, [r2, 0x8] lsls r0, 5 adds r0, r2, r0 - ldr r1, =gUnknown_0203CE7C + ldr r1, =gScriptItemId ldrh r1, [r1] subs r1, 0x85 adds r0, 0xA4 diff --git a/asm/load_save.s b/asm/load_save.s index 08170b446..2b4be8e67 100644 --- a/asm/load_save.s +++ b/asm/load_save.s @@ -244,7 +244,7 @@ save_serialize_npcs: @ 8076E1C movs r5, 0xA3 lsls r5, 4 mov r8, r5 - ldr r4, =gUnknown_02037350 + ldr r4, =gMapObjects movs r3, 0 movs r2, 0xF _08076E32: @@ -282,7 +282,7 @@ save_deserialize_npcs: @ 8076E64 movs r5, 0xA3 lsls r5, 4 mov r8, r5 - ldr r4, =gUnknown_02037350 + ldr r4, =gMapObjects movs r3, 0 movs r2, 0xF _08076E7A: diff --git a/asm/main_menu.s b/asm/main_menu.s index d7c482ac5..ed04ba6f3 100644 --- a/asm/main_menu.s +++ b/asm/main_menu.s @@ -3940,7 +3940,7 @@ AddBirchSpeechObjects: @ 803192C strb r1, [r2] strh r0, [r5, 0x1A] movs r0, 0x3C - bl TrainerClassToTrainerPic + bl sub_806EFF0 lsls r0, 24 lsrs r0, 24 ldr r4, =0x0201c000 @@ -3970,7 +3970,7 @@ AddBirchSpeechObjects: @ 803192C strb r1, [r2, 0x5] strh r0, [r5, 0x1C] movs r0, 0x3F - bl TrainerClassToTrainerPic + bl sub_806EFF0 lsls r0, 24 lsrs r0, 24 ldr r1, =0x0201c000 diff --git a/asm/map_obj_8097404.s b/asm/map_obj_8097404.s index 404ae3675..50284a013 100644 --- a/asm/map_obj_8097404.s +++ b/asm/map_obj_8097404.s @@ -87,7 +87,7 @@ _0809748E: player_bitmagic: @ 8097494 push {r4,r5,lr} movs r4, 0 - ldr r5, =gUnknown_02037350 + ldr r5, =gMapObjects _0809749A: lsls r0, r4, 3 adds r0, r4 @@ -121,7 +121,7 @@ sub_80974D0: @ 80974D0 lsls r0, 24 lsrs r5, r0, 24 movs r4, 0 - ldr r6, =gUnknown_02037350 + ldr r6, =gMapObjects _080974DA: cmp r4, r5 beq _080974FC @@ -209,7 +209,7 @@ _0809756C: sub_809757C: @ 809757C push {r4,r5,lr} movs r4, 0 - ldr r5, =gUnknown_02037350 + ldr r5, =gMapObjects _08097582: lsls r0, r4, 3 adds r0, r4 @@ -1757,7 +1757,7 @@ sub_8098074: @ 8098074 lsls r1, 24 lsrs r5, r1, 24 movs r4, 0 - ldr r7, =gUnknown_02037350 + ldr r7, =gMapObjects _08098082: cmp r4, r6 beq _080980A8 diff --git a/asm/map_obj_lock.s b/asm/map_obj_lock.s index 7547f23c0..6530c268b 100644 --- a/asm/map_obj_lock.s +++ b/asm/map_obj_lock.s @@ -97,8 +97,8 @@ _0809842A: ldrsh r0, [r5, r1] cmp r0, 0 bne _08098452 - ldr r2, =gUnknown_02037350 - ldr r0, =gUnknown_03005DF0 + ldr r2, =gMapObjects + ldr r0, =gSelectedMapObject ldrb r1, [r0] lsls r0, r1, 3 adds r0, r1 @@ -152,7 +152,7 @@ _0809849A: thumb_func_start sub_80984A0 sub_80984A0: @ 80984A0 push {r4,r5,lr} - ldr r4, =gUnknown_03005DF0 + ldr r4, =gSelectedMapObject ldrb r0, [r4] bl sub_80974D0 ldr r0, =sub_8098400 @@ -160,7 +160,7 @@ sub_80984A0: @ 80984A0 bl CreateTask lsls r0, 24 lsrs r5, r0, 24 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldrb r1, [r4] lsls r0, r1, 3 adds r0, r1 @@ -199,7 +199,7 @@ sub_80984F4: @ 80984F4 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl FieldObjectClearAnimIfSpecialAnimFinished bl sub_80D338C @@ -212,8 +212,8 @@ sub_80984F4: @ 80984F4 thumb_func_start sub_8098524 sub_8098524: @ 8098524 push {r4,lr} - ldr r4, =gUnknown_02037350 - ldr r0, =gUnknown_03005DF0 + ldr r4, =gMapObjects + ldr r0, =gSelectedMapObject ldrb r1, [r0] lsls r0, r1, 3 adds r0, r1 @@ -249,12 +249,12 @@ _08098542: thumb_func_start sub_8098574 sub_8098574: @ 8098574 push {lr} - ldr r0, =gUnknown_03005DF0 + ldr r0, =gSelectedMapObject ldrb r1, [r0] lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 ldr r1, =gScriptFacing ldrb r1, [r1] @@ -267,12 +267,12 @@ sub_8098574: @ 8098574 thumb_func_start sub_809859C sub_809859C: @ 809859C push {lr} - ldr r0, =gUnknown_03005DF0 + ldr r0, =gSelectedMapObject ldrb r1, [r0] lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl FieldObjectClearAnimIfSpecialAnimActive pop {r0} @@ -307,7 +307,7 @@ _080985E8: ldrsh r0, [r5, r1] cmp r0, 0 bne _0809860C - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects lsls r1, r7, 3 adds r1, r7 lsls r1, 2 @@ -374,7 +374,7 @@ sub_8098630: @ 8098630 mov r1, r9 adds r6, r0, r1 strh r4, [r6, 0xC] - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects mov r8, r2 lsls r0, r4, 3 adds r0, r4 @@ -429,7 +429,7 @@ _080986E0: lsls r0, 3 adds r5, r0, r1 strh r4, [r5, 0xC] - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects lsls r0, r4, 3 adds r0, r4 lsls r0, 2 diff --git a/asm/mystery_event_script.s b/asm/mystery_event_script.s index d85d17897..d481c2a3b 100644 --- a/asm/mystery_event_script.s +++ b/asm/mystery_event_script.s @@ -432,7 +432,7 @@ sub_8153AE8: @ 8153AE8 mov r6, r8 push {r6,r7} adds r7, r0, 0 - bl sub_80E162C + bl IsEnigmaBerryValid mov r8, r0 adds r0, r7, 0 bl ScriptReadWord @@ -450,7 +450,7 @@ sub_8153AE8: @ 8153AE8 movs r2, 0x7 bl StringCopyN adds r0, r4, 0 - bl sub_80E15E4 + bl SetEnigmaBerry ldr r4, =gStringVar2 ldr r1, [r6] adds r1, r5 @@ -481,7 +481,7 @@ _08153B74: bl StringExpandPlaceholders movs r0, 0x2 str r0, [r7, 0x6C] - bl sub_80E162C + bl IsEnigmaBerryValid cmp r0, 0x1 bne _08153B9C ldr r0, =0x0000402d @@ -669,7 +669,7 @@ sub_8153CC8: @ 8153CC8 cmp r4, r0 bne _08153D18 ldr r0, =gStringVar1 - ldr r1, =gText_Egg + ldr r1, =gText_EggNickname movs r2, 0xB bl StringCopyN b _08153D22 @@ -711,10 +711,10 @@ _08153D4C: lsrs r4, 16 adds r0, r4, 0 movs r1, 0x2 - bl pokedex_flag_operation + bl GetSetPokedexFlag adds r0, r4, 0 movs r1, 0x3 - bl pokedex_flag_operation + bl GetSetPokedexFlag _08153D86: adds r0, r7, 0 movs r1, 0xC diff --git a/asm/pokeblock_feed.s b/asm/pokeblock_feed.s index 8f63be452..bd348ec34 100644 --- a/asm/pokeblock_feed.s +++ b/asm/pokeblock_feed.s @@ -322,7 +322,7 @@ _08179E48: lsls r0, r5, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] ldr r1, [r1, 0x8] adds r2, r5, 0 @@ -380,7 +380,7 @@ _08179EEC: b _08179F5E .pool _08179F00: - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrb r0, [r0] bl sub_8179FEC ldr r0, =gUnknown_0203BD1C @@ -692,7 +692,7 @@ sub_817A1C4: @ 817A1C4 ldr r0, =gPlayerParty adds r5, r0 ldr r1, =gSaveBlock1Ptr - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] lsls r0, 3 ldr r2, =0x00000848 @@ -889,7 +889,7 @@ sub_817A358: @ 817A358 movs r1, 0x1 strb r1, [r0] adds r0, r4, 0 - bl sub_806E840 + bl IsPokeSpriteNotFlipped lsls r0, 24 cmp r0, 0 bne _0817A402 diff --git a/asm/pokedex.s b/asm/pokedex.s index 0eba63518..fdaacde2c 100644 --- a/asm/pokedex.s +++ b/asm/pokedex.s @@ -2450,7 +2450,7 @@ _080BC976: strh r0, [r1] ldrh r0, [r5, 0x4] movs r1, 0 - bl pokedex_flag_operation + bl GetSetPokedexFlag mov r3, r8 ldr r2, [r3] adds r2, r4 @@ -2465,7 +2465,7 @@ _080BC976: strb r0, [r2, 0x2] ldrh r0, [r5, 0x4] movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag mov r1, r8 ldr r3, [r1] adds r3, r4 @@ -2520,7 +2520,7 @@ _080BCA1A: strh r0, [r6, 0x4] ldrh r0, [r6, 0x4] movs r1, 0 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 adds r7, r4, 0 cmp r0, 0 @@ -2541,7 +2541,7 @@ _080BCA36: strh r0, [r1] ldrh r0, [r6, 0x4] movs r1, 0 - bl pokedex_flag_operation + bl GetSetPokedexFlag mov r1, r8 ldr r2, [r1] adds r2, r4 @@ -2558,7 +2558,7 @@ _080BCA36: strb r0, [r2, 0x2] ldrh r0, [r6, 0x4] movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag mov r2, r8 ldr r3, [r2] adds r3, r4 @@ -2625,7 +2625,7 @@ _080BCADA: bhi _080BCB58 ldrh r0, [r5, 0x4] movs r1, 0 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _080BCB58 @@ -2646,7 +2646,7 @@ _080BCADA: strb r0, [r2, 0x2] ldrh r0, [r5, 0x4] movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag mov r1, r8 ldr r3, [r1] adds r1, r3, r6 @@ -2701,7 +2701,7 @@ _080BCB82: bhi _080BCBE2 ldrh r0, [r5, 0x4] movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _080BCBE2 @@ -2768,7 +2768,7 @@ _080BCC16: bhi _080BCC7E ldrh r0, [r5, 0x4] movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _080BCC7E @@ -2833,7 +2833,7 @@ _080BCCAA: bhi _080BCD0A ldrh r0, [r5, 0x4] movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _080BCD0A @@ -2900,7 +2900,7 @@ _080BCD3E: bhi _080BCDA6 ldrh r0, [r5, 0x4] movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _080BCDA6 @@ -9408,9 +9408,9 @@ _080C065C: .pool thumb_func_end GetPokedexHeightWeight - thumb_func_start pokedex_flag_operation -@ u8 pokedex_flag_operation(u16 nationalPokedexNum, u8 op) -pokedex_flag_operation: @ 80C0664 + thumb_func_start GetSetPokedexFlag +@ u8 GetSetPokedexFlag(u16 nationalPokedexNum, u8 op) +GetSetPokedexFlag: @ 80C0664 push {r4-r7,lr} lsls r0, 16 lsls r1, 24 @@ -9595,7 +9595,7 @@ _080C07E8: pop {r1} bx r1 .pool - thumb_func_end pokedex_flag_operation + thumb_func_end GetSetPokedexFlag thumb_func_start pokedex_count pokedex_count: @ 80C07F4 @@ -9625,7 +9625,7 @@ _080C081A: lsrs r0, 16 movs r1, 0x1 _080C0822: - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _080C0832 @@ -9675,7 +9675,7 @@ _080C086C: lsrs r0, 16 movs r1, 0x1 _080C087C: - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _080C088C @@ -9719,7 +9719,7 @@ _080C08BC: lsrs r0, 16 movs r1, 0x1 _080C08C4: - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _080C08D4 @@ -9750,7 +9750,7 @@ _080C08E8: lsls r0, 16 lsrs r0, 16 movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 bne _080C0908 @@ -9777,7 +9777,7 @@ _080C091C: lsrs r4, r0, 16 adds r0, r4, 0 movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 bne _080C0934 @@ -9804,7 +9804,7 @@ _080C0948: lsrs r4, r0, 16 adds r0, r4, 0 movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _080C0996 @@ -9818,7 +9818,7 @@ _080C0964: lsrs r4, r0, 16 adds r0, r4, 0 movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _080C0996 @@ -9833,7 +9833,7 @@ _080C0982: lsrs r4, r0, 16 adds r0, r4, 0 movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 bne _080C09A0 diff --git a/asm/pokemon_1.s b/asm/pokemon_1.s index 45a863c67..ed97cd672 100644 --- a/asm/pokemon_1.s +++ b/asm/pokemon_1.s @@ -7,235 +7,6 @@ - - thumb_func_start sub_8068338 -sub_8068338: @ 8068338 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x58 - adds r7, r0, 0 - adds r6, r1, 0 - lsls r2, 24 - lsrs r2, 24 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000ca9 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _08068374 - lsls r0, r1, 30 - lsrs r0, 30 - bl sub_8165C90 - lsls r0, 24 - lsrs r3, r0, 24 - b _0806837C - .pool -_08068374: - movs r3, 0x32 - cmp r2, 0 - bne _0806837C - ldrb r3, [r6, 0xC] -_0806837C: - ldrh r1, [r6] - movs r2, 0x1 - str r2, [sp] - ldr r0, [r6, 0x1C] - str r0, [sp, 0x4] - str r2, [sp, 0x8] - ldr r0, [r6, 0x14] - str r0, [sp, 0xC] - adds r0, r7, 0 - adds r2, r3, 0 - movs r3, 0 - bl CreateMon - movs r5, 0 - movs r0, 0xD - adds r0, r6 - mov r10, r0 - adds r1, r6, 0x2 - str r1, [sp, 0x38] - adds r0, r6, 0 - adds r0, 0x2B - str r0, [sp, 0x34] - adds r1, 0x1E - str r1, [sp, 0x54] - add r0, sp, 0x30 - mov r9, r0 - subs r1, 0x12 - str r1, [sp, 0x3C] - adds r0, r6, 0 - adds r0, 0xF - str r0, [sp, 0x40] - adds r1, 0x2 - str r1, [sp, 0x44] - adds r0, 0x2 - str r0, [sp, 0x48] - adds r1, 0x2 - str r1, [sp, 0x4C] - adds r0, 0x2 - str r0, [sp, 0x50] - movs r1, 0x31 - add r1, sp - mov r8, r1 - adds r4, r6, 0x4 -_080683D2: - ldrh r1, [r4] - lsls r2, r5, 24 - lsrs r2, 24 - adds r0, r7, 0 - bl SetMonMoveSlot - adds r4, 0x2 - adds r5, 0x1 - cmp r5, 0x3 - ble _080683D2 - adds r0, r7, 0 - movs r1, 0x15 - mov r2, r10 - bl SetMonData - adds r0, r7, 0 - movs r1, 0xC - ldr r2, [sp, 0x38] - bl SetMonData - adds r0, r7, 0 - movs r1, 0x20 - ldr r2, [sp, 0x34] - bl SetMonData - add r0, sp, 0x10 - ldr r1, [sp, 0x54] - bl StringCopy - add r0, sp, 0x10 - ldrb r0, [r0] - cmp r0, 0xFC - bne _0806842A - add r0, sp, 0x10 - ldrb r0, [r0, 0x1] - cmp r0, 0x15 - bne _0806842A - movs r0, 0x1 - mov r1, r9 - strb r0, [r1] - add r0, sp, 0x10 - bl StripExtCtrlCodes - b _08068430 -_0806842A: - movs r0, 0x2 - mov r1, r9 - strb r0, [r1] -_08068430: - adds r0, r7, 0 - movs r1, 0x3 - mov r2, r9 - bl SetMonData - adds r0, r7, 0 - movs r1, 0x2 - add r2, sp, 0x10 - bl SetMonData - adds r0, r7, 0 - movs r1, 0x1A - ldr r2, [sp, 0x3C] - bl SetMonData - adds r0, r7, 0 - movs r1, 0x1B - ldr r2, [sp, 0x40] - bl SetMonData - adds r0, r7, 0 - movs r1, 0x1C - ldr r2, [sp, 0x44] - bl SetMonData - adds r0, r7, 0 - movs r1, 0x1D - ldr r2, [sp, 0x48] - bl SetMonData - adds r0, r7, 0 - movs r1, 0x1E - ldr r2, [sp, 0x4C] - bl SetMonData - adds r0, r7, 0 - movs r1, 0x1F - ldr r2, [sp, 0x50] - bl SetMonData - ldrb r0, [r6, 0x1B] - lsrs r0, 7 - mov r1, r8 - strb r0, [r1] - adds r0, r7, 0 - movs r1, 0x2E - mov r2, r8 - bl SetMonData - ldrb r0, [r6, 0x18] - lsls r0, 27 - lsrs r0, 27 - mov r1, r8 - strb r0, [r1] - adds r0, r7, 0 - movs r1, 0x27 - mov r2, r8 - bl SetMonData - ldrh r0, [r6, 0x18] - lsls r0, 22 - lsrs r0, 27 - mov r1, r8 - strb r0, [r1] - adds r0, r7, 0 - movs r1, 0x28 - mov r2, r8 - bl SetMonData - ldrb r0, [r6, 0x19] - lsls r0, 25 - lsrs r0, 27 - mov r1, r8 - strb r0, [r1] - adds r0, r7, 0 - movs r1, 0x29 - mov r2, r8 - bl SetMonData - ldr r0, [r6, 0x18] - lsls r0, 12 - lsrs r0, 27 - mov r1, r8 - strb r0, [r1] - adds r0, r7, 0 - movs r1, 0x2A - mov r2, r8 - bl SetMonData - ldrh r0, [r6, 0x1A] - lsls r0, 23 - lsrs r0, 27 - mov r1, r8 - strb r0, [r1] - adds r0, r7, 0 - movs r1, 0x2B - mov r2, r8 - bl SetMonData - ldrb r0, [r6, 0x1B] - lsls r0, 26 - lsrs r0, 27 - mov r1, r8 - strb r0, [r1] - adds r0, r7, 0 - movs r1, 0x2C - mov r2, r8 - bl SetMonData - adds r0, r7, 0 - bl MonRestorePP - adds r0, r7, 0 - bl CalculateMonStats - add sp, 0x58 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8068338 - thumb_func_start sub_8068528 sub_8068528: @ 8068528 push {r4-r7,lr} @@ -284,7 +55,7 @@ sub_8068528: @ 8068528 subs r0, 0x1 lsls r0, 24 lsrs r0, 24 - bl sub_8165C90 + bl BattleFrontierGetOpponentLvl adds r2, r0, 0 lsls r2, 24 lsrs r2, 24 @@ -823,8 +594,8 @@ _08068A02: .pool thumb_func_end sub_80688F8 - thumb_func_start get_pokemon_data_3 -get_pokemon_data_3: @ 8068A10 + thumb_func_start GetDeoxysStat +GetDeoxysStat: @ 8068A10 push {r4-r6,lr} adds r5, r0, 0 adds r6, r1, 0 @@ -895,7 +666,7 @@ _08068A9A: pop {r1} bx r1 .pool - thumb_func_end get_pokemon_data_3 + thumb_func_end GetDeoxysStat thumb_func_start sub_8068AA4 sub_8068AA4: @ 8068AA4 @@ -1012,7 +783,7 @@ _08068B78: lsls r2, 1 adds r2, r0 ldrh r0, [r2] - bl TrainerClassToTrainerPic + bl sub_806EFF0 lsls r0, 16 lsrs r0, 16 pop {r1} @@ -1056,7 +827,7 @@ _08068BE0: ldrb r0, [r1, 0x13] lsls r0, 3 orrs r2, r0 - ldr r1, =gTrainerClassNameIndices + ldr r1, =gTrainerClassToNameIndex ldr r0, =gUnknown_08329D54 lsls r2, 1 adds r2, r0 diff --git a/asm/pokemon_2.s b/asm/pokemon_2.s index 02531d81e..17856f6d3 100644 --- a/asm/pokemon_2.s +++ b/asm/pokemon_2.s @@ -5,3642 +5,6 @@ .text - thumb_func_start CountAliveMonsInBattle -CountAliveMonsInBattle: @ 8069DEC - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - movs r6, 0 - cmp r0, 0x1 - beq _08069E40 - cmp r0, 0x1 - bgt _08069E04 - cmp r0, 0 - beq _08069E0A - b _08069EC2 -_08069E04: - cmp r1, 0x2 - beq _08069E88 - b _08069EC2 -_08069E0A: - movs r5, 0 - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r4, =gAbsentBankFlags - ldr r2, =gBitTable -_08069E14: - cmp r5, r3 - beq _08069E28 - ldrb r0, [r4] - ldr r1, [r2] - ands r0, r1 - cmp r0, 0 - bne _08069E28 - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_08069E28: - adds r2, 0x4 - adds r5, 0x1 - cmp r5, 0x3 - ble _08069E14 - b _08069EC2 - .pool -_08069E40: - movs r5, 0 -_08069E42: - lsls r0, r5, 24 - lsrs r0, 24 - bl GetBankSide - adds r4, r0, 0 - ldr r0, =gBankAttacker - ldrb r0, [r0] - bl GetBankSide - lsls r4, 24 - lsls r0, 24 - cmp r4, r0 - bne _08069E74 - ldr r0, =gAbsentBankFlags - ldrb r1, [r0] - ldr r2, =gBitTable - lsls r0, r5, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - bne _08069E74 - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_08069E74: - adds r5, 0x1 - cmp r5, 0x3 - ble _08069E42 - b _08069EC2 - .pool -_08069E88: - movs r5, 0 -_08069E8A: - lsls r0, r5, 24 - lsrs r0, 24 - bl GetBankSide - adds r4, r0, 0 - ldr r0, =gBankTarget - ldrb r0, [r0] - bl GetBankSide - lsls r4, 24 - lsls r0, 24 - cmp r4, r0 - bne _08069EBC - ldr r0, =gAbsentBankFlags - ldrb r1, [r0] - ldr r2, =gBitTable - lsls r0, r5, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - bne _08069EBC - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_08069EBC: - adds r5, 0x1 - cmp r5, 0x3 - ble _08069E8A -_08069EC2: - adds r0, r6, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end CountAliveMonsInBattle - - thumb_func_start ShouldGetStatBadgeBoost -ShouldGetStatBadgeBoost: @ 8069ED8 - push {r4,r5,lr} - lsls r0, 16 - lsrs r5, r0, 16 - lsls r1, 24 - lsrs r2, r1, 24 - ldr r4, =gBattleTypeFlags - ldr r0, [r4] - ldr r1, =0x023f0902 - ands r0, r1 - cmp r0, 0 - bne _08069F1C - adds r0, r2, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _08069F1C - ldr r0, [r4] - movs r1, 0x8 - ands r0, r1 - cmp r0, 0 - beq _08069F10 - ldr r0, =gTrainerBattleOpponent_A - ldrh r1, [r0] - movs r0, 0x80 - lsls r0, 3 - cmp r1, r0 - beq _08069F1C -_08069F10: - adds r0, r5, 0 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - bne _08069F2C -_08069F1C: - movs r0, 0 - b _08069F2E - .pool -_08069F2C: - movs r0, 0x1 -_08069F2E: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end ShouldGetStatBadgeBoost - - thumb_func_start sub_8069F34 -sub_8069F34: @ 8069F34 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - bl GetBankIdentity - movs r1, 0x1 - movs r6, 0x1 - adds r4, r6, 0 - ands r4, r0 - eors r4, r1 - adds r5, r4, 0 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - ands r0, r6 - cmp r0, 0 - bne _08069F5C - adds r0, r4, 0 - b _08069FA6 - .pool -_08069F5C: - movs r0, 0 - bl CountAliveMonsInBattle - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _08069F80 - bl Random - adds r1, r6, 0 - ands r1, r0 - cmp r1, 0 - bne _08069F7C - movs r0, 0x2 - eors r0, r4 - b _08069FA6 -_08069F7C: - adds r0, r4, 0 - b _08069FA6 -_08069F80: - ldr r0, =gAbsentBankFlags - ldrb r1, [r0] - ldr r2, =gBitTable - lsls r0, r4, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - bne _08069FA0 - adds r0, r4, 0 - b _08069FA6 - .pool -_08069FA0: - movs r0, 0x2 - eors r5, r0 - adds r0, r5, 0 -_08069FA6: - bl GetBankByPlayerAI - lsls r0, 24 - lsrs r0, 24 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8069F34 - - thumb_func_start GetMonGender -GetMonGender: @ 8069FB4 - push {lr} - bl GetBoxMonGender - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end GetMonGender - - thumb_func_start GetBoxMonGender -GetBoxMonGender: @ 8069FC4 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0xB - movs r2, 0 - bl GetBoxMonData - lsls r0, 16 - lsrs r5, r0, 16 - adds r0, r4, 0 - movs r1, 0 - movs r2, 0 - bl GetBoxMonData - adds r2, r0, 0 - ldr r1, =gBaseStats - lsls r0, r5, 3 - subs r0, r5 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x10] - cmp r0, 0 - beq _0806A01A - cmp r0, 0 - blt _08069FFC - cmp r0, 0xFF - bgt _08069FFC - cmp r0, 0xFE - bge _0806A01A -_08069FFC: - ldr r1, =gBaseStats - lsls r0, r5, 3 - subs r0, r5 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x10] - movs r0, 0xFF - ands r0, r2 - cmp r1, r0 - bhi _0806A018 - movs r0, 0 - b _0806A01A - .pool -_0806A018: - movs r0, 0xFE -_0806A01A: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end GetBoxMonGender - - thumb_func_start GetGenderFromSpeciesAndPersonality -GetGenderFromSpeciesAndPersonality: @ 806A020 - push {lr} - adds r3, r1, 0 - lsls r0, 16 - lsrs r2, r0, 16 - ldr r1, =gBaseStats - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x10] - cmp r0, 0 - beq _0806A062 - cmp r0, 0 - blt _0806A044 - cmp r0, 0xFF - bgt _0806A044 - cmp r0, 0xFE - bge _0806A062 -_0806A044: - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x10] - movs r0, 0xFF - ands r0, r3 - cmp r1, r0 - bhi _0806A060 - movs r0, 0 - b _0806A062 - .pool -_0806A060: - movs r0, 0xFE -_0806A062: - pop {r1} - bx r1 - thumb_func_end GetGenderFromSpeciesAndPersonality - - thumb_func_start sub_806A068 -sub_806A068: @ 806A068 - push {r4-r7,lr} - lsls r0, 16 - lsrs r5, r0, 16 - lsls r1, 24 - lsrs r4, r1, 24 - ldr r0, =gUnknown_020244D4 - ldr r2, [r0] - cmp r2, 0 - beq _0806A09C - ldr r0, =gUnknown_0202499C - lsls r1, r4, 1 - adds r1, r4 - lsls r1, 3 - adds r1, r2, r1 - adds r2, r0, 0 - adds r1, 0x14 - ldm r1!, {r3,r6,r7} - stm r2!, {r3,r6,r7} - ldm r1!, {r3,r6,r7} - stm r2!, {r3,r6,r7} - adds r3, r0, 0 - b _0806A0DA - .pool -_0806A09C: - ldr r1, =gUnknown_020249B4 - ldr r0, [r1] - cmp r0, 0 - beq _0806A0B4 - ldr r3, =gUnknown_0202499C - ldr r2, [r0, 0xC] - b _0806A0C8 - .pool -_0806A0B4: - ldr r0, [r1, 0x4] - cmp r0, 0 - beq _0806A0C4 - ldr r3, =gUnknown_0202499C - ldr r2, [r0, 0xC] - b _0806A0C8 - .pool -_0806A0C4: - ldr r3, =gUnknown_0202499C - ldr r2, =gUnknown_08329D98 -_0806A0C8: - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 3 - adds r1, r3, 0 - adds r0, r2 - ldm r0!, {r2,r6,r7} - stm r1!, {r2,r6,r7} - ldm r0!, {r2,r6,r7} - stm r1!, {r2,r6,r7} -_0806A0DA: - adds r2, r3, 0 - strh r5, [r2, 0x2] - cmp r4, 0 - beq _0806A0E6 - cmp r4, 0x2 - bne _0806A0F8 -_0806A0E6: - ldr r0, =gUnknown_082FF70C - str r0, [r2, 0x8] - b _0806A122 - .pool -_0806A0F8: - movs r0, 0xFA - lsls r0, 1 - cmp r5, r0 - bls _0806A118 - ldr r0, =gUnknown_08309AAC - ldr r3, =0xfffffe0c - adds r1, r5, r3 - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - str r0, [r2, 0x8] - b _0806A122 - .pool -_0806A118: - ldr r0, =gUnknown_08309AAC - lsls r1, r5, 2 - adds r1, r0 - ldr r0, [r1] - str r0, [r3, 0x8] -_0806A122: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_806A068 - - thumb_func_start template_build_for_pokemon_or_trainer -template_build_for_pokemon_or_trainer: @ 806A12C - push {r4-r6,lr} - lsls r0, 16 - lsrs r4, r0, 16 - lsls r1, 24 - lsrs r3, r1, 24 - ldr r0, =gUnknown_0202499C - strh r4, [r0, 0x2] - adds r5, r0, 0 - cmp r3, 0 - beq _0806A144 - cmp r3, 0x2 - bne _0806A170 -_0806A144: - ldr r2, =gUnknown_08329DF8 - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 3 - adds r1, r5, 0 - adds r0, r2 - ldm r0!, {r2,r3,r6} - stm r1!, {r2,r3,r6} - ldm r0!, {r2,r3,r6} - stm r1!, {r2,r3,r6} - ldr r1, =gUnknown_08305D0C - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - b _0806A1B0 - .pool -_0806A170: - ldr r0, =gUnknown_020244D4 - ldr r1, [r0] - cmp r1, 0 - beq _0806A194 - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 3 - adds r0, r1, r0 - adds r1, r5, 0 - adds r0, 0x14 - ldm r0!, {r2,r3,r6} - stm r1!, {r2,r3,r6} - ldm r0!, {r2,r3,r6} - stm r1!, {r2,r3,r6} - b _0806A1A8 - .pool -_0806A194: - ldr r0, =gUnknown_08329D98 - lsls r1, r3, 1 - adds r1, r3 - lsls r1, 3 - adds r2, r5, 0 - adds r1, r0 - ldm r1!, {r0,r3,r6} - stm r2!, {r0,r3,r6} - ldm r1!, {r0,r3,r6} - stm r2!, {r0,r3,r6} -_0806A1A8: - ldr r0, =gUnknown_0830536C - lsls r1, r4, 2 - adds r1, r0 - ldr r0, [r1] -_0806A1B0: - str r0, [r5, 0x8] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end template_build_for_pokemon_or_trainer - - thumb_func_start sub_806A1C0 -sub_806A1C0: @ 806A1C0 - push {r4-r6,lr} - lsls r0, 16 - lsrs r5, r0, 16 - lsls r1, 24 - lsrs r4, r1, 24 - ldr r0, =gUnknown_020244D4 - ldr r2, [r0] - cmp r2, 0 - beq _0806A1F4 - ldr r0, =gUnknown_0202499C - lsls r1, r4, 1 - adds r1, r4 - lsls r1, 3 - adds r1, r2, r1 - adds r2, r0, 0 - adds r1, 0x14 - ldm r1!, {r3,r4,r6} - stm r2!, {r3,r4,r6} - ldm r1!, {r3,r4,r6} - stm r2!, {r3,r4,r6} - adds r3, r0, 0 - b _0806A20A - .pool -_0806A1F4: - ldr r3, =gUnknown_0202499C - ldr r2, =gUnknown_08329D98 - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 3 - adds r1, r3, 0 - adds r0, r2 - ldm r0!, {r2,r4,r6} - stm r1!, {r2,r4,r6} - ldm r0!, {r2,r4,r6} - stm r1!, {r2,r4,r6} -_0806A20A: - strh r5, [r3, 0x2] - ldr r0, =gUnknown_0830536C - lsls r1, r5, 2 - adds r1, r0 - ldr r0, [r1] - str r0, [r3, 0x8] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_806A1C0 - - thumb_func_start EncryptBoxMon -@ void EncryptBoxMon(pokemon *mon) -EncryptBoxMon: @ 806A228 - push {r4,lr} - adds r3, r0, 0 - movs r4, 0 - adds r2, r3, 0 - adds r2, 0x20 -_0806A232: - ldr r0, [r2] - ldr r1, [r3] - eors r0, r1 - str r0, [r2] - ldr r1, [r3, 0x4] - eors r0, r1 - stm r2!, {r0} - adds r4, 0x1 - cmp r4, 0xB - bls _0806A232 - pop {r4} - pop {r0} - bx r0 - thumb_func_end EncryptBoxMon - - thumb_func_start DecryptBoxMon -@ void DecryptBoxMon(pokemon *mon) -DecryptBoxMon: @ 806A24C - push {r4,lr} - adds r3, r0, 0 - movs r4, 0 - adds r2, r3, 0 - adds r2, 0x20 -_0806A256: - ldr r0, [r2] - ldr r1, [r3, 0x4] - eors r0, r1 - str r0, [r2] - ldr r1, [r3] - eors r0, r1 - stm r2!, {r0} - adds r4, 0x1 - cmp r4, 0xB - bls _0806A256 - pop {r4} - pop {r0} - bx r0 - thumb_func_end DecryptBoxMon - - thumb_func_start GetSubstruct -@ int GetSubstruct(pokemon *mon, int a2, u8 a3) -GetSubstruct: @ 806A270 - push {r4-r6,lr} - adds r5, r0, 0 - adds r0, r1, 0 - lsls r2, 24 - lsrs r4, r2, 24 - movs r6, 0 - movs r1, 0x18 - bl __umodsi3 - cmp r0, 0x17 - bls _0806A288 - b _0806A510 -_0806A288: - lsls r0, 2 - ldr r1, =_0806A298 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0806A298: - .4byte _0806A2F8 - .4byte _0806A31C - .4byte _0806A338 - .4byte _0806A34E - .4byte _0806A364 - .4byte _0806A380 - .4byte _0806A396 - .4byte _0806A3AC - .4byte _0806A3BC - .4byte _0806A3DA - .4byte _0806A3F2 - .4byte _0806A402 - .4byte _0806A416 - .4byte _0806A428 - .4byte _0806A43A - .4byte _0806A44C - .4byte _0806A45E - .4byte _0806A470 - .4byte _0806A482 - .4byte _0806A498 - .4byte _0806A4AC - .4byte _0806A4BA - .4byte _0806A4CC - .4byte _0806A4E0 -_0806A2F8: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - bne _0806A302 - b _0806A508 -_0806A302: - cmp r4, 0x1 - bgt _0806A30E -_0806A306: - cmp r4, 0 - bne _0806A30C - b _0806A50E -_0806A30C: - b _0806A510 -_0806A30E: - cmp r4, 0x2 - bne _0806A314 - b _0806A502 -_0806A314: - cmp r4, 0x3 - beq _0806A31A - b _0806A510 -_0806A31A: - b _0806A4FC -_0806A31C: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - bne _0806A326 - b _0806A508 -_0806A326: - cmp r4, 0x1 - ble _0806A306 -_0806A32A: - cmp r4, 0x2 - bne _0806A330 - b _0806A4FC -_0806A330: - cmp r4, 0x3 - beq _0806A336 - b _0806A510 -_0806A336: - b _0806A502 -_0806A338: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - bne _0806A342 - b _0806A502 -_0806A342: - cmp r4, 0x1 - ble _0806A306 - cmp r4, 0x2 - bne _0806A34C - b _0806A508 -_0806A34C: - b _0806A314 -_0806A34E: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - bne _0806A358 - b _0806A4FC -_0806A358: - cmp r4, 0x1 - ble _0806A306 - cmp r4, 0x2 - bne _0806A362 - b _0806A508 -_0806A362: - b _0806A330 -_0806A364: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - bne _0806A36E - b _0806A502 -_0806A36E: - cmp r4, 0x1 - ble _0806A306 -_0806A372: - cmp r4, 0x2 - bne _0806A378 - b _0806A4FC -_0806A378: - cmp r4, 0x3 - beq _0806A37E - b _0806A510 -_0806A37E: - b _0806A508 -_0806A380: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - bne _0806A38A - b _0806A4FC -_0806A38A: - cmp r4, 0x1 - ble _0806A306 - cmp r4, 0x2 - bne _0806A394 - b _0806A502 -_0806A394: - b _0806A378 -_0806A396: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - bne _0806A3A0 - b _0806A50E -_0806A3A0: - cmp r4, 0x1 - bgt _0806A30E -_0806A3A4: - cmp r4, 0 - bne _0806A3AA - b _0806A508 -_0806A3AA: - b _0806A510 -_0806A3AC: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - bne _0806A3B6 - b _0806A50E -_0806A3B6: - cmp r4, 0x1 - ble _0806A3A4 - b _0806A32A -_0806A3BC: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - bne _0806A3C6 - b _0806A50E -_0806A3C6: - cmp r4, 0x1 - bgt _0806A3D2 -_0806A3CA: - cmp r4, 0 - bne _0806A3D0 - b _0806A502 -_0806A3D0: - b _0806A510 -_0806A3D2: - cmp r4, 0x2 - bne _0806A3D8 - b _0806A508 -_0806A3D8: - b _0806A314 -_0806A3DA: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - bne _0806A3E4 - b _0806A50E -_0806A3E4: - cmp r4, 0x1 - bgt _0806A3EA - b _0806A4EC -_0806A3EA: - cmp r4, 0x2 - bne _0806A3F0 - b _0806A508 -_0806A3F0: - b _0806A330 -_0806A3F2: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - bne _0806A3FC - b _0806A50E -_0806A3FC: - cmp r4, 0x1 - ble _0806A3CA - b _0806A372 -_0806A402: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - bne _0806A40C - b _0806A50E -_0806A40C: - cmp r4, 0x1 - ble _0806A4EC - cmp r4, 0x2 - beq _0806A502 - b _0806A378 -_0806A416: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - beq _0806A502 - cmp r4, 0x1 - ble _0806A3A4 - cmp r4, 0x2 - beq _0806A50E - b _0806A314 -_0806A428: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - beq _0806A4FC - cmp r4, 0x1 - ble _0806A3A4 - cmp r4, 0x2 - beq _0806A50E - b _0806A330 -_0806A43A: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - beq _0806A508 - cmp r4, 0x1 - ble _0806A3CA - cmp r4, 0x2 - beq _0806A50E - b _0806A314 -_0806A44C: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - beq _0806A508 - cmp r4, 0x1 - ble _0806A4EC - cmp r4, 0x2 - beq _0806A50E - b _0806A330 -_0806A45E: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - beq _0806A4FC - cmp r4, 0x1 - ble _0806A3CA - cmp r4, 0x2 - beq _0806A50E - b _0806A378 -_0806A470: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - beq _0806A502 - cmp r4, 0x1 - ble _0806A4EC - cmp r4, 0x2 - beq _0806A50E - b _0806A378 -_0806A482: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - beq _0806A502 - cmp r4, 0x1 - ble _0806A3A4 -_0806A48E: - cmp r4, 0x2 - beq _0806A4FC -_0806A492: - cmp r4, 0x3 - bne _0806A510 - b _0806A50E -_0806A498: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - beq _0806A4FC - cmp r4, 0x1 - bgt _0806A4A6 - b _0806A3A4 -_0806A4A6: - cmp r4, 0x2 - beq _0806A502 - b _0806A492 -_0806A4AC: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - beq _0806A508 - cmp r4, 0x1 - ble _0806A3CA - b _0806A48E -_0806A4BA: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - beq _0806A508 - cmp r4, 0x1 - ble _0806A4EC - cmp r4, 0x2 - beq _0806A502 - b _0806A492 -_0806A4CC: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - beq _0806A4FC - cmp r4, 0x1 - bgt _0806A4DA - b _0806A3CA -_0806A4DA: - cmp r4, 0x2 - beq _0806A508 - b _0806A492 -_0806A4E0: - adds r0, r5, 0 - adds r0, 0x20 - cmp r4, 0x1 - beq _0806A502 - cmp r4, 0x1 - bgt _0806A4F2 -_0806A4EC: - cmp r4, 0 - beq _0806A4FC - b _0806A510 -_0806A4F2: - cmp r4, 0x2 - beq _0806A508 - cmp r4, 0x3 - beq _0806A50E - b _0806A510 -_0806A4FC: - adds r6, r5, 0 - adds r6, 0x44 - b _0806A510 -_0806A502: - adds r6, r5, 0 - adds r6, 0x38 - b _0806A510 -_0806A508: - adds r6, r5, 0 - adds r6, 0x2C - b _0806A510 -_0806A50E: - adds r6, r0, 0 -_0806A510: - adds r0, r6, 0 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end GetSubstruct - - thumb_func_start GetMonData -@ int GetMonData(pokemon *mon, enum pokemon_data_request req, void *data) -GetMonData: @ 806A518 - push {r4,lr} - adds r4, r0, 0 - adds r3, r1, 0 - adds r0, r3, 0 - subs r0, 0x37 - cmp r0, 0x21 - bls _0806A528 - b _0806A666 -_0806A528: - lsls r0, 2 - ldr r1, =_0806A538 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0806A538: - .4byte _0806A5C0 - .4byte _0806A5C4 - .4byte _0806A5CC - .4byte _0806A5D4 - .4byte _0806A5DC - .4byte _0806A5EE - .4byte _0806A600 - .4byte _0806A612 - .4byte _0806A624 - .4byte _0806A65E - .4byte _0806A666 - .4byte _0806A666 - .4byte _0806A666 - .4byte _0806A666 - .4byte _0806A666 - .4byte _0806A666 - .4byte _0806A666 - .4byte _0806A666 - .4byte _0806A666 - .4byte _0806A666 - .4byte _0806A666 - .4byte _0806A666 - .4byte _0806A666 - .4byte _0806A666 - .4byte _0806A666 - .4byte _0806A666 - .4byte _0806A666 - .4byte _0806A666 - .4byte _0806A666 - .4byte _0806A636 - .4byte _0806A63E - .4byte _0806A646 - .4byte _0806A64E - .4byte _0806A656 -_0806A5C0: - ldr r0, [r4, 0x50] - b _0806A66E -_0806A5C4: - adds r0, r4, 0 - adds r0, 0x54 - ldrb r0, [r0] - b _0806A66E -_0806A5CC: - adds r0, r4, 0 - adds r0, 0x56 - ldrh r0, [r0] - b _0806A66E -_0806A5D4: - adds r0, r4, 0 - adds r0, 0x58 - ldrh r0, [r0] - b _0806A66E -_0806A5DC: - adds r0, r4, 0 - movs r1, 0x1 - bl get_pokemon_data_3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _0806A66E - b _0806A636 -_0806A5EE: - adds r0, r4, 0 - movs r1, 0x2 - bl get_pokemon_data_3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _0806A66E - b _0806A63E -_0806A600: - adds r0, r4, 0 - movs r1, 0x3 - bl get_pokemon_data_3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _0806A66E - b _0806A646 -_0806A612: - adds r0, r4, 0 - movs r1, 0x4 - bl get_pokemon_data_3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _0806A66E - b _0806A64E -_0806A624: - adds r0, r4, 0 - movs r1, 0x5 - bl get_pokemon_data_3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _0806A66E - b _0806A656 -_0806A636: - adds r0, r4, 0 - adds r0, 0x5A - ldrh r0, [r0] - b _0806A66E -_0806A63E: - adds r0, r4, 0 - adds r0, 0x5C - ldrh r0, [r0] - b _0806A66E -_0806A646: - adds r0, r4, 0 - adds r0, 0x5E - ldrh r0, [r0] - b _0806A66E -_0806A64E: - adds r0, r4, 0 - adds r0, 0x60 - ldrh r0, [r0] - b _0806A66E -_0806A656: - adds r0, r4, 0 - adds r0, 0x62 - ldrh r0, [r0] - b _0806A66E -_0806A65E: - adds r0, r4, 0 - adds r0, 0x55 - ldrb r0, [r0] - b _0806A66E -_0806A666: - adds r0, r4, 0 - adds r1, r3, 0 - bl GetBoxMonData -_0806A66E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end GetMonData - - thumb_func_start GetBoxMonData -@ int GetBoxMonData(pokemon *mon, enum pokemon_data_request req, void *data) -GetBoxMonData: @ 806A674 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - mov r8, r0 - str r1, [sp] - adds r6, r2, 0 - movs r4, 0 - mov r9, r4 - mov r10, r4 - movs r7, 0 - movs r5, 0 - cmp r1, 0xA - ble _0806A6F2 - ldr r1, [r0] - movs r2, 0 - bl GetSubstruct - mov r9, r0 - mov r0, r8 - ldr r1, [r0] - movs r2, 0x1 - bl GetSubstruct - mov r10, r0 - mov r2, r8 - ldr r1, [r2] - mov r0, r8 - movs r2, 0x2 - bl GetSubstruct - adds r7, r0, 0 - mov r0, r8 - ldr r1, [r0] - movs r2, 0x3 - bl GetSubstruct - adds r5, r0, 0 - mov r0, r8 - bl DecryptBoxMon - mov r0, r8 - bl CalculateBoxMonChecksum - lsls r0, 16 - lsrs r0, 16 - mov r1, r8 - ldrh r1, [r1, 0x1C] - cmp r0, r1 - beq _0806A6F2 - mov r2, r8 - ldrb r0, [r2, 0x13] - movs r1, 0x1 - orrs r0, r1 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2, 0x13] - ldrb r0, [r5, 0x7] - movs r1, 0x40 - orrs r0, r1 - strb r0, [r5, 0x7] -_0806A6F2: - ldr r0, [sp] - cmp r0, 0x53 - bls _0806A6FA - b _0806AC8C -_0806A6FA: - lsls r0, 2 - ldr r1, =_0806A708 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0806A708: - .4byte _0806A858 - .4byte _0806A85E - .4byte _0806A864 - .4byte _0806A918 - .4byte _0806A91E - .4byte _0806A924 - .4byte _0806A92A - .4byte _0806A930 - .4byte _0806A94C - .4byte _0806A952 - .4byte _0806A958 - .4byte _0806A95E - .4byte _0806A976 - .4byte _0806A98E - .4byte _0806A98E - .4byte _0806A98E - .4byte _0806A98E - .4byte _0806A99A - .4byte _0806A99A - .4byte _0806A99A - .4byte _0806A99A - .4byte _0806A982 - .4byte _0806A9BC - .4byte _0806A9C0 - .4byte _0806A9C4 - .4byte _0806A97C - .4byte _0806A9A4 - .4byte _0806A9A8 - .4byte _0806A9AC - .4byte _0806A9B0 - .4byte _0806A9B4 - .4byte _0806A9B8 - .4byte _0806A988 - .4byte _0806A9C8 - .4byte _0806A9D4 - .4byte _0806A9D8 - .4byte _0806A9DC - .4byte _0806A9E4 - .4byte _0806A9EC - .4byte _0806A9F6 - .4byte _0806A9FE - .4byte _0806AA06 - .4byte _0806AA0E - .4byte _0806AA16 - .4byte _0806AA1E - .4byte _0806AA26 - .4byte _0806AA2A - .4byte _0806A9CC - .4byte _0806A9D0 - .4byte _0806A9F0 - .4byte _0806AA30 - .4byte _0806AA38 - .4byte _0806AA40 - .4byte _0806AA48 - .4byte _0806AA50 - .4byte _0806AC8C - .4byte _0806AC8C - .4byte _0806AC8C - .4byte _0806AC8C - .4byte _0806AC8C - .4byte _0806AC8C - .4byte _0806AC8C - .4byte _0806AC8C - .4byte _0806AC8C - .4byte _0806AC8C - .4byte _0806AAB6 - .4byte _0806AADC - .4byte _0806AA58 - .4byte _0806AA5E - .4byte _0806AA62 - .4byte _0806AA66 - .4byte _0806AA6A - .4byte _0806AA72 - .4byte _0806AA7A - .4byte _0806AA82 - .4byte _0806AA8A - .4byte _0806AA90 - .4byte _0806AA98 - .4byte _0806AAA0 - .4byte _0806AAA8 - .4byte _0806AAB0 - .4byte _0806AB16 - .4byte _0806AB70 - .4byte _0806ABF2 -_0806A858: - mov r1, r8 - ldr r4, [r1] - b _0806AC8C -_0806A85E: - mov r2, r8 - ldr r4, [r2, 0x4] - b _0806AC8C -_0806A864: - mov r0, r8 - ldrb r1, [r0, 0x13] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0806A89C - movs r4, 0 - ldr r0, =gUnknown_085CCB90 - ldrb r1, [r0] - adds r2, r0, 0 - cmp r1, 0xFF - beq _0806A944 - adds r3, r2, 0 -_0806A87E: - adds r0, r6, r4 - adds r1, r4, r3 - ldrb r1, [r1] - strb r1, [r0] - adds r4, 0x1 - cmp r4, 0x9 - bhi _0806A944 - adds r0, r4, r2 - ldrb r0, [r0] - cmp r0, 0xFF - bne _0806A87E - b _0806A944 - .pool -_0806A89C: - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0806A8BC - ldr r1, =gText_Egg - adds r0, r6, 0 - bl StringCopy - adds r0, r6, 0 - bl StringLength - lsls r0, 16 - lsrs r4, r0, 16 - b _0806AC8C - .pool -_0806A8BC: - mov r1, r8 - ldrb r0, [r1, 0x12] - cmp r0, 0x1 - bne _0806A902 - movs r0, 0xFC - strb r0, [r6] - movs r0, 0x15 - strb r0, [r6, 0x1] - movs r4, 0x2 - movs r3, 0 - ldrb r0, [r1, 0x8] - cmp r0, 0xFF - beq _0806A8F0 - mov r2, r8 - adds r2, 0x8 -_0806A8DA: - adds r1, r6, r4 - ldrb r0, [r2] - strb r0, [r1] - adds r4, 0x1 - adds r2, 0x1 - adds r3, 0x1 - cmp r3, 0x4 - bgt _0806A8F0 - ldrb r0, [r2] - cmp r0, 0xFF - bne _0806A8DA -_0806A8F0: - adds r1, r6, r4 - movs r0, 0xFC - strb r0, [r1] - adds r4, 0x1 - adds r1, r6, r4 - movs r0, 0x16 - strb r0, [r1] - adds r4, 0x1 - b _0806A944 -_0806A902: - movs r4, 0 - mov r2, r8 - adds r2, 0x8 -_0806A908: - adds r0, r6, r4 - adds r1, r2, r4 - ldrb r1, [r1] - strb r1, [r0] - adds r4, 0x1 - cmp r4, 0x9 - bls _0806A908 - b _0806A944 -_0806A918: - mov r2, r8 - ldrb r4, [r2, 0x12] - b _0806AC8C -_0806A91E: - mov r6, r8 - ldrb r0, [r6, 0x13] - b _0806AA92 -_0806A924: - mov r1, r8 - ldrb r0, [r1, 0x13] - b _0806AA9A -_0806A92A: - mov r2, r8 - ldrb r0, [r2, 0x13] - b _0806AAA2 -_0806A930: - movs r4, 0 - mov r2, r8 - adds r2, 0x14 -_0806A936: - adds r0, r6, r4 - adds r1, r2, r4 - ldrb r1, [r1] - strb r1, [r0] - adds r4, 0x1 - cmp r4, 0x6 - bls _0806A936 -_0806A944: - adds r1, r6, r4 - movs r0, 0xFF - strb r0, [r1] - b _0806AC8C -_0806A94C: - mov r6, r8 - ldrb r4, [r6, 0x1B] - b _0806AC8C -_0806A952: - mov r0, r8 - ldrh r4, [r0, 0x1C] - b _0806AC8C -_0806A958: - mov r1, r8 - ldrh r4, [r1, 0x1E] - b _0806AC8C -_0806A95E: - mov r2, r8 - ldrb r1, [r2, 0x13] - movs r0, 0x1 - ands r0, r1 - movs r4, 0xCE - lsls r4, 1 - cmp r0, 0 - beq _0806A970 - b _0806AC8C -_0806A970: - mov r6, r9 - ldrh r4, [r6] - b _0806AC8C -_0806A976: - mov r0, r9 - ldrh r4, [r0, 0x2] - b _0806AC8C -_0806A97C: - mov r1, r9 - ldr r4, [r1, 0x4] - b _0806AC8C -_0806A982: - mov r2, r9 - ldrb r4, [r2, 0x8] - b _0806AC8C -_0806A988: - mov r6, r9 - ldrb r4, [r6, 0x9] - b _0806AC8C -_0806A98E: - ldr r0, [sp] - subs r0, 0xD - lsls r0, 1 - add r0, r10 - ldrh r4, [r0] - b _0806AC8C -_0806A99A: - ldr r0, [sp] - add r0, r10 - subs r0, 0x9 - ldrb r4, [r0] - b _0806AC8C -_0806A9A4: - ldrb r4, [r7] - b _0806AC8C -_0806A9A8: - ldrb r4, [r7, 0x1] - b _0806AC8C -_0806A9AC: - ldrb r4, [r7, 0x2] - b _0806AC8C -_0806A9B0: - ldrb r4, [r7, 0x3] - b _0806AC8C -_0806A9B4: - ldrb r4, [r7, 0x4] - b _0806AC8C -_0806A9B8: - ldrb r4, [r7, 0x5] - b _0806AC8C -_0806A9BC: - ldrb r4, [r7, 0x6] - b _0806AC8C -_0806A9C0: - ldrb r4, [r7, 0x7] - b _0806AC8C -_0806A9C4: - ldrb r4, [r7, 0x8] - b _0806AC8C -_0806A9C8: - ldrb r4, [r7, 0x9] - b _0806AC8C -_0806A9CC: - ldrb r4, [r7, 0xA] - b _0806AC8C -_0806A9D0: - ldrb r4, [r7, 0xB] - b _0806AC8C -_0806A9D4: - ldrb r4, [r5] - b _0806AC8C -_0806A9D8: - ldrb r4, [r5, 0x1] - b _0806AC8C -_0806A9DC: - ldrb r0, [r5, 0x2] - lsls r0, 25 - lsrs r4, r0, 25 - b _0806AC8C -_0806A9E4: - ldrh r0, [r5, 0x2] - lsls r0, 21 - lsrs r4, r0, 28 - b _0806AC8C -_0806A9EC: - ldrb r0, [r5, 0x3] - b _0806AAAA -_0806A9F0: - ldrb r0, [r5, 0x3] - lsrs r4, r0, 7 - b _0806AC8C -_0806A9F6: - ldrb r0, [r5, 0x4] - lsls r0, 27 - lsrs r4, r0, 27 - b _0806AC8C -_0806A9FE: - ldrh r0, [r5, 0x4] - lsls r0, 22 - lsrs r4, r0, 27 - b _0806AC8C -_0806AA06: - ldrb r0, [r5, 0x5] - lsls r0, 25 - lsrs r4, r0, 27 - b _0806AC8C -_0806AA0E: - ldr r0, [r5, 0x4] - lsls r0, 12 - lsrs r4, r0, 27 - b _0806AC8C -_0806AA16: - ldrh r0, [r5, 0x6] - lsls r0, 23 - lsrs r4, r0, 27 - b _0806AC8C -_0806AA1E: - ldrb r0, [r5, 0x7] - lsls r0, 26 - lsrs r4, r0, 27 - b _0806AC8C -_0806AA26: - ldrb r0, [r5, 0x7] - b _0806AA84 -_0806AA2A: - ldrb r0, [r5, 0x7] - lsrs r4, r0, 7 - b _0806AC8C -_0806AA30: - ldrb r0, [r5, 0x8] - lsls r0, 29 - lsrs r4, r0, 29 - b _0806AC8C -_0806AA38: - ldrb r0, [r5, 0x8] - lsls r0, 26 - lsrs r4, r0, 29 - b _0806AC8C -_0806AA40: - ldrh r0, [r5, 0x8] - lsls r0, 23 - lsrs r4, r0, 29 - b _0806AC8C -_0806AA48: - ldrb r0, [r5, 0x9] - lsls r0, 28 - lsrs r4, r0, 29 - b _0806AC8C -_0806AA50: - ldrb r0, [r5, 0x9] - lsls r0, 25 - lsrs r4, r0, 29 - b _0806AC8C -_0806AA58: - ldrb r0, [r5, 0x9] - lsrs r4, r0, 7 - b _0806AC8C -_0806AA5E: - ldrb r0, [r5, 0xA] - b _0806AA92 -_0806AA62: - ldrb r0, [r5, 0xA] - b _0806AA9A -_0806AA66: - ldrb r0, [r5, 0xA] - b _0806AAA2 -_0806AA6A: - ldrb r0, [r5, 0xA] - lsls r0, 28 - lsrs r4, r0, 31 - b _0806AC8C -_0806AA72: - ldrb r0, [r5, 0xA] - lsls r0, 27 - lsrs r4, r0, 31 - b _0806AC8C -_0806AA7A: - ldrb r0, [r5, 0xA] - lsls r0, 26 - lsrs r4, r0, 31 - b _0806AC8C -_0806AA82: - ldrb r0, [r5, 0xA] -_0806AA84: - lsls r0, 25 - lsrs r4, r0, 31 - b _0806AC8C -_0806AA8A: - ldrb r0, [r5, 0xA] - lsrs r4, r0, 7 - b _0806AC8C -_0806AA90: - ldrb r0, [r5, 0xB] -_0806AA92: - lsls r0, 31 - lsrs r4, r0, 31 - b _0806AC8C -_0806AA98: - ldrb r0, [r5, 0xB] -_0806AA9A: - lsls r0, 30 - lsrs r4, r0, 31 - b _0806AC8C -_0806AAA0: - ldrb r0, [r5, 0xB] -_0806AAA2: - lsls r0, 29 - lsrs r4, r0, 31 - b _0806AC8C -_0806AAA8: - ldrb r0, [r5, 0xB] -_0806AAAA: - lsls r0, 25 - lsrs r4, r0, 28 - b _0806AC8C -_0806AAB0: - ldrb r0, [r5, 0xB] - lsrs r4, r0, 7 - b _0806AC8C -_0806AAB6: - mov r0, r9 - ldrh r4, [r0] - cmp r4, 0 - bne _0806AAC0 - b _0806AC8C -_0806AAC0: - ldrb r0, [r5, 0x7] - lsls r0, 25 - cmp r0, 0 - blt _0806AAD6 - mov r2, r8 - ldrb r1, [r2, 0x13] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0806AAD6 - b _0806AC8C -_0806AAD6: - movs r4, 0xCE - lsls r4, 1 - b _0806AC8C -_0806AADC: - ldrb r0, [r5, 0x4] - lsls r0, 27 - lsrs r4, r0, 27 - ldrh r1, [r5, 0x4] - movs r0, 0xF8 - lsls r0, 2 - ands r0, r1 - orrs r4, r0 - ldrb r0, [r5, 0x5] - lsls r0, 25 - lsrs r0, 27 - lsls r0, 10 - orrs r4, r0 - ldr r0, [r5, 0x4] - movs r1, 0xF8 - lsls r1, 12 - ands r0, r1 - orrs r4, r0 - ldrh r0, [r5, 0x6] - lsls r0, 23 - lsrs r0, 27 - lsls r0, 20 - orrs r4, r0 - ldrb r0, [r5, 0x7] - lsls r0, 26 - lsrs r0, 27 - lsls r0, 25 - orrs r4, r0 - b _0806AC8C -_0806AB16: - mov r1, r9 - ldrh r0, [r1] - cmp r0, 0 - bne _0806AB20 - b _0806AC8C -_0806AB20: - ldrb r0, [r5, 0x7] - lsls r0, 25 - cmp r0, 0 - bge _0806AB2A - b _0806AC8C -_0806AB2A: - ldrh r0, [r6] - ldr r1, =0x00000163 - cmp r0, r1 - bne _0806AB34 - b _0806AC8C -_0806AB34: - mov r2, r10 - ldrh r5, [r2] - adds r7, r1, 0 - adds r2, r6, 0 - ldr r1, =gBitTable -_0806AB3E: - ldrh r3, [r2] - cmp r5, r3 - beq _0806AB58 - mov r6, r10 - ldrh r0, [r6, 0x2] - cmp r0, r3 - beq _0806AB58 - ldrh r0, [r6, 0x4] - cmp r0, r3 - beq _0806AB58 - ldrh r0, [r6, 0x6] - cmp r0, r3 - bne _0806AB5C -_0806AB58: - ldr r0, [r1] - orrs r4, r0 -_0806AB5C: - adds r2, 0x2 - adds r1, 0x4 - ldrh r0, [r2] - cmp r0, r7 - bne _0806AB3E - b _0806AC8C - .pool -_0806AB70: - movs r4, 0 - mov r1, r9 - ldrh r0, [r1] - cmp r0, 0 - bne _0806AB7C - b _0806AC8C -_0806AB7C: - ldrb r0, [r5, 0x7] - lsls r0, 25 - cmp r0, 0 - bge _0806AB86 - b _0806AC8C -_0806AB86: - ldrb r0, [r5, 0x8] - lsls r1, r0, 29 - lsrs r4, r1, 29 - lsls r0, 26 - lsrs r0, 29 - adds r4, r0 - ldrh r0, [r5, 0x8] - lsls r0, 23 - lsrs r0, 29 - adds r4, r0 - ldrb r1, [r5, 0x9] - lsls r0, r1, 28 - lsrs r0, 29 - adds r4, r0 - lsls r0, r1, 25 - lsrs r0, 29 - adds r4, r0 - lsrs r1, 7 - adds r4, r1 - ldrb r1, [r5, 0xA] - lsls r0, r1, 31 - lsrs r0, 31 - adds r4, r0 - lsls r0, r1, 30 - lsrs r0, 31 - adds r4, r0 - lsls r0, r1, 29 - lsrs r0, 31 - adds r4, r0 - lsls r0, r1, 28 - lsrs r0, 31 - adds r4, r0 - lsls r0, r1, 27 - lsrs r0, 31 - adds r4, r0 - lsls r0, r1, 26 - lsrs r0, 31 - adds r4, r0 - lsls r0, r1, 25 - lsrs r0, 31 - adds r4, r0 - lsrs r1, 7 - adds r4, r1 - ldrb r1, [r5, 0xB] - lsls r0, r1, 31 - lsrs r0, 31 - adds r4, r0 - lsls r0, r1, 30 - lsrs r0, 31 - adds r4, r0 - lsls r1, 29 - lsrs r1, 31 - adds r4, r1 - b _0806AC8C -_0806ABF2: - movs r4, 0 - mov r2, r9 - ldrh r0, [r2] - cmp r0, 0 - beq _0806AC8C - ldrb r0, [r5, 0x7] - lsls r0, 25 - cmp r0, 0 - blt _0806AC8C - ldrb r2, [r5, 0x9] - lsrs r4, r2, 7 - ldrb r1, [r5, 0x8] - lsls r0, r1, 29 - lsrs r0, 28 - orrs r4, r0 - lsls r1, 26 - lsrs r1, 29 - lsls r1, 4 - orrs r4, r1 - ldrh r0, [r5, 0x8] - lsls r0, 23 - lsrs r0, 29 - lsls r0, 7 - orrs r4, r0 - lsls r0, r2, 28 - lsrs r0, 29 - lsls r0, 10 - orrs r4, r0 - lsls r2, 25 - lsrs r2, 29 - lsls r2, 13 - orrs r4, r2 - ldrb r1, [r5, 0xA] - lsls r0, r1, 31 - lsrs r0, 31 - lsls r0, 16 - orrs r4, r0 - lsls r0, r1, 30 - lsrs r0, 31 - lsls r0, 17 - orrs r4, r0 - lsls r0, r1, 29 - lsrs r0, 31 - lsls r0, 18 - orrs r4, r0 - lsls r0, r1, 28 - lsrs r0, 31 - lsls r0, 19 - orrs r4, r0 - lsls r0, r1, 27 - lsrs r0, 31 - lsls r0, 20 - orrs r4, r0 - lsls r0, r1, 26 - lsrs r0, 31 - lsls r0, 21 - orrs r4, r0 - lsls r0, r1, 25 - lsrs r0, 31 - lsls r0, 22 - orrs r4, r0 - lsrs r1, 7 - lsls r1, 23 - orrs r4, r1 - ldrb r1, [r5, 0xB] - lsls r0, r1, 31 - lsrs r0, 31 - lsls r0, 24 - orrs r4, r0 - lsls r0, r1, 30 - lsrs r0, 31 - lsls r0, 25 - orrs r4, r0 - lsls r1, 29 - lsrs r1, 31 - lsls r1, 26 - orrs r4, r1 -_0806AC8C: - ldr r6, [sp] - cmp r6, 0xA - ble _0806AC98 - mov r0, r8 - bl EncryptBoxMon -_0806AC98: - adds r0, r4, 0 - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end GetBoxMonData - - thumb_func_start SetMonData -@ int SetMonData(pokemon *mon, enum pokemon_data_request req, void *data) -SetMonData: @ 806ACAC - push {lr} - adds r3, r0, 0 - adds r0, r1, 0 - subs r0, 0x37 - cmp r0, 0xA - bhi _0806AD90 - lsls r0, 2 - ldr r1, =_0806ACC8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0806ACC8: - .4byte _0806ACF4 - .4byte _0806AD0C - .4byte _0806AD16 - .4byte _0806AD26 - .4byte _0806AD36 - .4byte _0806AD46 - .4byte _0806AD56 - .4byte _0806AD66 - .4byte _0806AD76 - .4byte _0806AD86 - .4byte _0806AD96 -_0806ACF4: - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - adds r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - adds r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - adds r1, r0 - str r1, [r3, 0x50] - b _0806AD96 -_0806AD0C: - ldrb r1, [r2] - adds r0, r3, 0 - adds r0, 0x54 - strb r1, [r0] - b _0806AD96 -_0806AD16: - ldrb r0, [r2] - ldrb r1, [r2, 0x1] - lsls r1, 8 - adds r0, r1 - adds r1, r3, 0 - adds r1, 0x56 - strh r0, [r1] - b _0806AD96 -_0806AD26: - ldrb r0, [r2] - ldrb r1, [r2, 0x1] - lsls r1, 8 - adds r0, r1 - adds r1, r3, 0 - adds r1, 0x58 - strh r0, [r1] - b _0806AD96 -_0806AD36: - ldrb r0, [r2] - ldrb r1, [r2, 0x1] - lsls r1, 8 - adds r0, r1 - adds r1, r3, 0 - adds r1, 0x5A - strh r0, [r1] - b _0806AD96 -_0806AD46: - ldrb r0, [r2] - ldrb r1, [r2, 0x1] - lsls r1, 8 - adds r0, r1 - adds r1, r3, 0 - adds r1, 0x5C - strh r0, [r1] - b _0806AD96 -_0806AD56: - ldrb r0, [r2] - ldrb r1, [r2, 0x1] - lsls r1, 8 - adds r0, r1 - adds r1, r3, 0 - adds r1, 0x5E - strh r0, [r1] - b _0806AD96 -_0806AD66: - ldrb r0, [r2] - ldrb r1, [r2, 0x1] - lsls r1, 8 - adds r0, r1 - adds r1, r3, 0 - adds r1, 0x60 - strh r0, [r1] - b _0806AD96 -_0806AD76: - ldrb r0, [r2] - ldrb r1, [r2, 0x1] - lsls r1, 8 - adds r0, r1 - adds r1, r3, 0 - adds r1, 0x62 - strh r0, [r1] - b _0806AD96 -_0806AD86: - ldrb r1, [r2] - adds r0, r3, 0 - adds r0, 0x55 - strb r1, [r0] - b _0806AD96 -_0806AD90: - adds r0, r3, 0 - bl SetBoxMonData -_0806AD96: - pop {r0} - bx r0 - thumb_func_end SetMonData - - thumb_func_start SetBoxMonData -@ int SetBoxMonData(pokemon *mon, enum pokemon_data_request req, void *data) -SetBoxMonData: @ 806AD9C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - adds r7, r0, 0 - mov r10, r1 - adds r4, r2, 0 - movs r0, 0 - mov r8, r0 - mov r9, r0 - movs r6, 0 - movs r5, 0 - cmp r1, 0xA - ble _0806AE1C - ldr r1, [r7] - adds r0, r7, 0 - movs r2, 0 - bl GetSubstruct - mov r8, r0 - ldr r1, [r7] - adds r0, r7, 0 - movs r2, 0x1 - bl GetSubstruct - mov r9, r0 - ldr r1, [r7] - adds r0, r7, 0 - movs r2, 0x2 - bl GetSubstruct - adds r6, r0, 0 - ldr r1, [r7] - adds r0, r7, 0 - movs r2, 0x3 - bl GetSubstruct - adds r5, r0, 0 - adds r0, r7, 0 - bl DecryptBoxMon - adds r0, r7, 0 - bl CalculateBoxMonChecksum - lsls r0, 16 - lsrs r0, 16 - ldrh r1, [r7, 0x1C] - cmp r0, r1 - beq _0806AE1C - ldrb r0, [r7, 0x13] - movs r1, 0x1 - orrs r0, r1 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r7, 0x13] - ldrb r0, [r5, 0x7] - movs r1, 0x40 - orrs r0, r1 - strb r0, [r5, 0x7] - adds r0, r7, 0 - bl EncryptBoxMon - b _0806B3EC -_0806AE1C: - mov r0, r10 - cmp r0, 0x50 - bls _0806AE24 - b _0806B3D8 -_0806AE24: - lsls r0, 2 - ldr r1, =_0806AE34 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0806AE34: - .4byte _0806AF78 - .4byte _0806AF90 - .4byte _0806AFA8 - .4byte _0806AFBE - .4byte _0806AFC4 - .4byte _0806AFD4 - .4byte _0806AFE6 - .4byte _0806AFF8 - .4byte _0806B00E - .4byte _0806B014 - .4byte _0806B020 - .4byte _0806B02C - .4byte _0806B04C - .4byte _0806B084 - .4byte _0806B084 - .4byte _0806B084 - .4byte _0806B084 - .4byte _0806B098 - .4byte _0806B098 - .4byte _0806B098 - .4byte _0806B098 - .4byte _0806B074 - .4byte _0806B0C8 - .4byte _0806B0CE - .4byte _0806B0D4 - .4byte _0806B05A - .4byte _0806B0A4 - .4byte _0806B0AA - .4byte _0806B0B0 - .4byte _0806B0B6 - .4byte _0806B0BC - .4byte _0806B0C2 - .4byte _0806B07C - .4byte _0806B0DA - .4byte _0806B0EC - .4byte _0806B0F2 - .4byte _0806B0F8 - .4byte _0806B10C - .4byte _0806B124 - .4byte _0806B14A - .4byte _0806B15E - .4byte _0806B178 - .4byte _0806B18E - .4byte _0806B1A8 - .4byte _0806B1C0 - .4byte _0806B1D4 - .4byte _0806B204 - .4byte _0806B0E0 - .4byte _0806B0E6 - .4byte _0806B13A - .4byte _0806B214 - .4byte _0806B222 - .4byte _0806B238 - .4byte _0806B250 - .4byte _0806B260 - .4byte _0806B3D8 - .4byte _0806B3D8 - .4byte _0806B3D8 - .4byte _0806B3D8 - .4byte _0806B3D8 - .4byte _0806B3D8 - .4byte _0806B3D8 - .4byte _0806B3D8 - .4byte _0806B3D8 - .4byte _0806B3D8 - .4byte _0806B3D8 - .4byte _0806B35E - .4byte _0806B276 - .4byte _0806B286 - .4byte _0806B294 - .4byte _0806B2A4 - .4byte _0806B2B4 - .4byte _0806B2C4 - .4byte _0806B2D4 - .4byte _0806B2E4 - .4byte _0806B2FA - .4byte _0806B30A - .4byte _0806B318 - .4byte _0806B328 - .4byte _0806B338 - .4byte _0806B34E -_0806AF78: - ldrb r1, [r4] - ldrb r0, [r4, 0x1] - lsls r0, 8 - adds r1, r0 - ldrb r0, [r4, 0x2] - lsls r0, 16 - adds r1, r0 - ldrb r0, [r4, 0x3] - lsls r0, 24 - adds r1, r0 - str r1, [r7] - b _0806B3D8 -_0806AF90: - ldrb r1, [r4] - ldrb r0, [r4, 0x1] - lsls r0, 8 - adds r1, r0 - ldrb r0, [r4, 0x2] - lsls r0, 16 - adds r1, r0 - ldrb r0, [r4, 0x3] - lsls r0, 24 - adds r1, r0 - str r1, [r7, 0x4] - b _0806B3D8 -_0806AFA8: - movs r2, 0 - adds r3, r7, 0 - adds r3, 0x8 -_0806AFAE: - adds r0, r3, r2 - adds r1, r4, r2 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0x9 - ble _0806AFAE - b _0806B3D8 -_0806AFBE: - ldrb r0, [r4] - strb r0, [r7, 0x12] - b _0806B3D8 -_0806AFC4: - ldrb r0, [r4] - movs r1, 0x1 - ands r1, r0 - ldrb r2, [r7, 0x13] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - b _0806B1F2 -_0806AFD4: - ldrb r0, [r4] - movs r1, 0x1 - ands r1, r0 - lsls r1, 1 - ldrb r2, [r7, 0x13] - movs r0, 0x3 - negs r0, r0 - ands r0, r2 - b _0806B1F2 -_0806AFE6: - ldrb r0, [r4] - movs r1, 0x1 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r7, 0x13] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - b _0806B1F2 -_0806AFF8: - movs r2, 0 - adds r3, r7, 0 - adds r3, 0x14 -_0806AFFE: - adds r0, r3, r2 - adds r1, r4, r2 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0x6 - ble _0806AFFE - b _0806B3D8 -_0806B00E: - ldrb r0, [r4] - strb r0, [r7, 0x1B] - b _0806B3D8 -_0806B014: - ldrb r1, [r4] - ldrb r0, [r4, 0x1] - lsls r0, 8 - adds r1, r0 - strh r1, [r7, 0x1C] - b _0806B3D8 -_0806B020: - ldrb r1, [r4] - ldrb r0, [r4, 0x1] - lsls r0, 8 - adds r1, r0 - strh r1, [r7, 0x1E] - b _0806B3D8 -_0806B02C: - ldrb r1, [r4] - ldrb r0, [r4, 0x1] - lsls r0, 8 - adds r1, r0 - mov r0, r8 - strh r1, [r0] - lsls r1, 16 - cmp r1, 0 - beq _0806B044 - ldrb r0, [r7, 0x13] - movs r1, 0x2 - b _0806B1F2 -_0806B044: - ldrb r1, [r7, 0x13] - movs r0, 0x3 - negs r0, r0 - b _0806B1FE -_0806B04C: - ldrb r1, [r4] - ldrb r0, [r4, 0x1] - lsls r0, 8 - adds r1, r0 - mov r0, r8 - strh r1, [r0, 0x2] - b _0806B3D8 -_0806B05A: - ldrb r1, [r4] - ldrb r0, [r4, 0x1] - lsls r0, 8 - adds r1, r0 - ldrb r0, [r4, 0x2] - lsls r0, 16 - adds r1, r0 - ldrb r0, [r4, 0x3] - lsls r0, 24 - adds r1, r0 - mov r0, r8 - str r1, [r0, 0x4] - b _0806B3D8 -_0806B074: - ldrb r0, [r4] - mov r1, r8 - strb r0, [r1, 0x8] - b _0806B3D8 -_0806B07C: - ldrb r0, [r4] - mov r1, r8 - strb r0, [r1, 0x9] - b _0806B3D8 -_0806B084: - mov r2, r10 - subs r2, 0xD - lsls r2, 1 - add r2, r9 - ldrb r1, [r4] - ldrb r0, [r4, 0x1] - lsls r0, 8 - adds r1, r0 - strh r1, [r2] - b _0806B3D8 -_0806B098: - mov r0, r9 - add r0, r10 - subs r0, 0x9 - ldrb r1, [r4] - strb r1, [r0] - b _0806B3D8 -_0806B0A4: - ldrb r0, [r4] - strb r0, [r6] - b _0806B3D8 -_0806B0AA: - ldrb r0, [r4] - strb r0, [r6, 0x1] - b _0806B3D8 -_0806B0B0: - ldrb r0, [r4] - strb r0, [r6, 0x2] - b _0806B3D8 -_0806B0B6: - ldrb r0, [r4] - strb r0, [r6, 0x3] - b _0806B3D8 -_0806B0BC: - ldrb r0, [r4] - strb r0, [r6, 0x4] - b _0806B3D8 -_0806B0C2: - ldrb r0, [r4] - strb r0, [r6, 0x5] - b _0806B3D8 -_0806B0C8: - ldrb r0, [r4] - strb r0, [r6, 0x6] - b _0806B3D8 -_0806B0CE: - ldrb r0, [r4] - strb r0, [r6, 0x7] - b _0806B3D8 -_0806B0D4: - ldrb r0, [r4] - strb r0, [r6, 0x8] - b _0806B3D8 -_0806B0DA: - ldrb r0, [r4] - strb r0, [r6, 0x9] - b _0806B3D8 -_0806B0E0: - ldrb r0, [r4] - strb r0, [r6, 0xA] - b _0806B3D8 -_0806B0E6: - ldrb r0, [r4] - strb r0, [r6, 0xB] - b _0806B3D8 -_0806B0EC: - ldrb r0, [r4] - strb r0, [r5] - b _0806B3D8 -_0806B0F2: - ldrb r0, [r4] - strb r0, [r5, 0x1] - b _0806B3D8 -_0806B0F8: - ldrb r1, [r4] - movs r0, 0x7F - ands r1, r0 - ldrb r2, [r5, 0x2] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0x2] - b _0806B3D8 -_0806B10C: - ldrb r1, [r4] - movs r0, 0xF - ands r1, r0 - lsls r1, 7 - ldrh r2, [r5, 0x2] - ldr r0, =0xfffff87f - ands r0, r2 - orrs r0, r1 - strh r0, [r5, 0x2] - b _0806B3D8 - .pool -_0806B124: - ldrb r1, [r4] - movs r0, 0xF - ands r1, r0 - lsls r1, 3 - ldrb r2, [r5, 0x3] - movs r0, 0x79 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0x3] - b _0806B3D8 -_0806B13A: - ldrb r0, [r4] - lsls r0, 7 - ldrb r2, [r5, 0x3] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r5, 0x3] - b _0806B3D8 -_0806B14A: - ldrb r1, [r4] - movs r0, 0x1F - ands r1, r0 - ldrb r2, [r5, 0x4] - movs r0, 0x20 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0x4] - b _0806B3D8 -_0806B15E: - ldrb r1, [r4] - movs r0, 0x1F - ands r1, r0 - lsls r1, 5 - ldrh r2, [r5, 0x4] - ldr r0, =0xfffffc1f - ands r0, r2 - orrs r0, r1 - strh r0, [r5, 0x4] - b _0806B3D8 - .pool -_0806B178: - ldrb r1, [r4] - movs r0, 0x1F - ands r1, r0 - lsls r1, 2 - ldrb r2, [r5, 0x5] - movs r0, 0x7D - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0x5] - b _0806B3D8 -_0806B18E: - ldrb r2, [r4] - movs r0, 0x1F - ands r2, r0 - lsls r2, 15 - ldr r0, [r5, 0x4] - ldr r1, =0xfff07fff - ands r0, r1 - orrs r0, r2 - str r0, [r5, 0x4] - b _0806B3D8 - .pool -_0806B1A8: - ldrb r1, [r4] - movs r0, 0x1F - ands r1, r0 - lsls r1, 4 - ldrh r2, [r5, 0x6] - ldr r0, =0xfffffe0f - ands r0, r2 - orrs r0, r1 - strh r0, [r5, 0x6] - b _0806B3D8 - .pool -_0806B1C0: - ldrb r1, [r4] - movs r0, 0x1F - ands r1, r0 - lsls r1, 1 - ldrb r2, [r5, 0x7] - movs r0, 0x3F - negs r0, r0 - ands r0, r2 - orrs r0, r1 - b _0806B3D6 -_0806B1D4: - ldrb r1, [r4] - movs r0, 0x1 - ands r1, r0 - lsls r1, 6 - ldrb r2, [r5, 0x7] - movs r0, 0x41 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0x7] - lsls r0, 25 - cmp r0, 0 - bge _0806B1F8 - ldrb r0, [r7, 0x13] - movs r1, 0x4 -_0806B1F2: - orrs r0, r1 - strb r0, [r7, 0x13] - b _0806B3D8 -_0806B1F8: - ldrb r1, [r7, 0x13] - movs r0, 0x5 - negs r0, r0 -_0806B1FE: - ands r0, r1 - strb r0, [r7, 0x13] - b _0806B3D8 -_0806B204: - ldrb r0, [r4] - lsls r0, 7 - ldrb r2, [r5, 0x7] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r5, 0x7] - b _0806B3D8 -_0806B214: - ldrb r1, [r4] - movs r0, 0x7 - ands r1, r0 - ldrb r2, [r5, 0x8] - movs r0, 0x8 - negs r0, r0 - b _0806B230 -_0806B222: - ldrb r1, [r4] - movs r0, 0x7 - ands r1, r0 - lsls r1, 3 - ldrb r2, [r5, 0x8] - movs r0, 0x39 - negs r0, r0 -_0806B230: - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0x8] - b _0806B3D8 -_0806B238: - ldrb r1, [r4] - movs r0, 0x7 - ands r1, r0 - lsls r1, 6 - ldrh r2, [r5, 0x8] - ldr r0, =0xfffffe3f - ands r0, r2 - orrs r0, r1 - strh r0, [r5, 0x8] - b _0806B3D8 - .pool -_0806B250: - ldrb r1, [r4] - movs r0, 0x7 - ands r1, r0 - lsls r1, 1 - ldrb r2, [r5, 0x9] - movs r0, 0xF - negs r0, r0 - b _0806B26E -_0806B260: - ldrb r1, [r4] - movs r0, 0x7 - ands r1, r0 - lsls r1, 4 - ldrb r2, [r5, 0x9] - movs r0, 0x71 - negs r0, r0 -_0806B26E: - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0x9] - b _0806B3D8 -_0806B276: - ldrb r0, [r4] - lsls r0, 7 - ldrb r2, [r5, 0x9] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r5, 0x9] - b _0806B3D8 -_0806B286: - ldrb r1, [r4] - movs r0, 0x1 - ands r1, r0 - ldrb r2, [r5, 0xA] - movs r0, 0x2 - negs r0, r0 - b _0806B2F2 -_0806B294: - ldrb r1, [r4] - movs r0, 0x1 - ands r1, r0 - lsls r1, 1 - ldrb r2, [r5, 0xA] - movs r0, 0x3 - negs r0, r0 - b _0806B2F2 -_0806B2A4: - ldrb r1, [r4] - movs r0, 0x1 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r5, 0xA] - movs r0, 0x5 - negs r0, r0 - b _0806B2F2 -_0806B2B4: - ldrb r1, [r4] - movs r0, 0x1 - ands r1, r0 - lsls r1, 3 - ldrb r2, [r5, 0xA] - movs r0, 0x9 - negs r0, r0 - b _0806B2F2 -_0806B2C4: - ldrb r1, [r4] - movs r0, 0x1 - ands r1, r0 - lsls r1, 4 - ldrb r2, [r5, 0xA] - movs r0, 0x11 - negs r0, r0 - b _0806B2F2 -_0806B2D4: - ldrb r1, [r4] - movs r0, 0x1 - ands r1, r0 - lsls r1, 5 - ldrb r2, [r5, 0xA] - movs r0, 0x21 - negs r0, r0 - b _0806B2F2 -_0806B2E4: - ldrb r1, [r4] - movs r0, 0x1 - ands r1, r0 - lsls r1, 6 - ldrb r2, [r5, 0xA] - movs r0, 0x41 - negs r0, r0 -_0806B2F2: - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0xA] - b _0806B3D8 -_0806B2FA: - ldrb r0, [r4] - lsls r0, 7 - ldrb r2, [r5, 0xA] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r5, 0xA] - b _0806B3D8 -_0806B30A: - ldrb r1, [r4] - movs r0, 0x1 - ands r1, r0 - ldrb r2, [r5, 0xB] - movs r0, 0x2 - negs r0, r0 - b _0806B346 -_0806B318: - ldrb r1, [r4] - movs r0, 0x1 - ands r1, r0 - lsls r1, 1 - ldrb r2, [r5, 0xB] - movs r0, 0x3 - negs r0, r0 - b _0806B346 -_0806B328: - ldrb r1, [r4] - movs r0, 0x1 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r5, 0xB] - movs r0, 0x5 - negs r0, r0 - b _0806B346 -_0806B338: - ldrb r1, [r4] - movs r0, 0xF - ands r1, r0 - lsls r1, 3 - ldrb r2, [r5, 0xB] - movs r0, 0x79 - negs r0, r0 -_0806B346: - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0xB] - b _0806B3D8 -_0806B34E: - ldrb r0, [r4] - lsls r0, 7 - ldrb r2, [r5, 0xB] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r5, 0xB] - b _0806B3D8 -_0806B35E: - ldrb r3, [r4] - ldrb r0, [r4, 0x1] - lsls r0, 8 - orrs r3, r0 - ldrb r0, [r4, 0x2] - lsls r0, 16 - orrs r3, r0 - ldrb r0, [r4, 0x3] - lsls r0, 24 - orrs r3, r0 - movs r4, 0x1F - adds r1, r3, 0 - ands r1, r4 - ldrb r2, [r5, 0x4] - movs r0, 0x20 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0x4] - lsrs r1, r3, 5 - ands r1, r4 - lsls r1, 5 - ldrh r2, [r5, 0x4] - ldr r0, =0xfffffc1f - ands r0, r2 - orrs r0, r1 - strh r0, [r5, 0x4] - lsrs r1, r3, 10 - ands r1, r4 - lsls r1, 2 - ldrb r2, [r5, 0x5] - movs r0, 0x7D - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0x5] - lsrs r1, r3, 15 - ands r1, r4 - lsls r1, 15 - ldr r0, [r5, 0x4] - ldr r2, =0xfff07fff - ands r0, r2 - orrs r0, r1 - str r0, [r5, 0x4] - lsrs r1, r3, 20 - ands r1, r4 - lsls r1, 4 - ldrh r2, [r5, 0x6] - ldr r0, =0xfffffe0f - ands r0, r2 - orrs r0, r1 - strh r0, [r5, 0x6] - lsrs r3, 25 - ands r3, r4 - lsls r3, 1 - ldrb r1, [r5, 0x7] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - orrs r0, r3 -_0806B3D6: - strb r0, [r5, 0x7] -_0806B3D8: - mov r0, r10 - cmp r0, 0xA - ble _0806B3EC - adds r0, r7, 0 - bl CalculateBoxMonChecksum - strh r0, [r7, 0x1C] - adds r0, r7, 0 - bl EncryptBoxMon -_0806B3EC: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end SetBoxMonData - - thumb_func_start CopyMon -@ void *CopyMon(void *dest, void *src, unsigned int size) -CopyMon: @ 806B408 - push {lr} - bl memcpy - pop {r0} - bx r0 - thumb_func_end CopyMon - - thumb_func_start GiveMonToPlayer -@ int GiveMonToPlayer(pokemon *mon) -GiveMonToPlayer: @ 806B414 - push {r4-r6,lr} - adds r6, r0, 0 - ldr r4, =gSaveBlock2Ptr - ldr r2, [r4] - movs r1, 0x7 - bl SetMonData - ldr r2, [r4] - adds r2, 0x8 - adds r0, r6, 0 - movs r1, 0x31 - bl SetMonData - ldr r2, [r4] - adds r2, 0xA - adds r0, r6, 0 - movs r1, 0x1 - bl SetMonData - movs r5, 0 - b _0806B446 - .pool -_0806B444: - adds r5, 0x1 -_0806B446: - cmp r5, 0x5 - bgt _0806B480 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0xB - movs r2, 0 - bl GetMonData - cmp r0, 0 - bne _0806B444 - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0x64 - bl CopyMon - ldr r1, =gPlayerPartyCount - adds r0, r5, 0x1 - strb r0, [r1] - movs r0, 0 - b _0806B48A - .pool -_0806B480: - adds r0, r6, 0 - bl SendMonToPC - lsls r0, 24 - lsrs r0, 24 -_0806B48A: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end GiveMonToPlayer - - thumb_func_start SendMonToPC -@ int SendMonToPC(pokemon *mon) -SendMonToPC: @ 806B490 - push {r4-r7,lr} - mov r7, r8 - push {r7} - mov r8, r0 - ldr r0, =0x00004036 - bl VarGet - lsls r0, 24 - lsrs r0, 24 - bl set_unknown_box_id - bl get_preferred_box - lsls r0, 24 - lsrs r5, r0, 24 -_0806B4AE: - movs r6, 0 - lsls r7, r5, 24 -_0806B4B2: - lsls r1, r6, 24 - lsrs r1, 24 - lsrs r0, r7, 24 - bl get_pokemon_by_box_and_pos - adds r4, r0, 0 - movs r1, 0xB - movs r2, 0 - bl GetBoxMonData - cmp r0, 0 - bne _0806B514 - mov r0, r8 - bl MonRestorePP - adds r0, r4, 0 - mov r1, r8 - movs r2, 0x50 - bl CopyMon - ldr r0, =gSpecialVar_0x8012 - strh r5, [r0] - ldr r0, =gSpecialVar_0x8013 - strh r6, [r0] - bl get_unknown_box_id - lsls r0, 16 - lsrs r0, 16 - cmp r0, r5 - beq _0806B4F4 - ldr r0, =0x000008d7 - bl FlagReset -_0806B4F4: - lsls r1, r5, 16 - ldr r0, =0x00004036 - lsrs r1, 16 - bl VarSet - movs r0, 0x1 - b _0806B530 - .pool -_0806B514: - adds r6, 0x1 - cmp r6, 0x1D - ble _0806B4B2 - adds r5, 0x1 - cmp r5, 0xE - bne _0806B522 - movs r5, 0 -_0806B522: - bl get_preferred_box - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - bne _0806B4AE - movs r0, 0x2 -_0806B530: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end SendMonToPC - - thumb_func_start CalculatePlayerPartyCount -@ u8 CalculatePlayerPartyCount() -CalculatePlayerPartyCount: @ 806B53C - push {r4,lr} - ldr r0, =gPlayerPartyCount - movs r1, 0 - strb r1, [r0] - b _0806B554 - .pool -_0806B54C: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - adds r0, r4, 0 -_0806B554: - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0x5 - bhi _0806B572 - adds r1, r0, 0 - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - movs r2, 0 - bl GetMonData - cmp r0, 0 - bne _0806B54C -_0806B572: - ldrb r0, [r4] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end CalculatePlayerPartyCount - - thumb_func_start CalculateEnemyPartyCount -@ u8 CalculateEnemyPartyCount() -CalculateEnemyPartyCount: @ 806B580 - push {r4,lr} - ldr r0, =gUnknown_020244EA - movs r1, 0 - strb r1, [r0] - b _0806B598 - .pool -_0806B590: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - adds r0, r4, 0 -_0806B598: - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0x5 - bhi _0806B5B6 - adds r1, r0, 0 - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - movs r2, 0 - bl GetMonData - cmp r0, 0 - bne _0806B590 -_0806B5B6: - ldrb r0, [r4] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end CalculateEnemyPartyCount - - thumb_func_start GetMonsStateToDoubles -GetMonsStateToDoubles: @ 806B5C4 - push {r4-r6,lr} - movs r6, 0 - bl CalculatePlayerPartyCount - ldr r1, =gPlayerPartyCount - ldrb r0, [r1] - cmp r0, 0x1 - beq _0806B628 - movs r5, 0 - ldrb r1, [r1] - cmp r6, r1 - bge _0806B620 -_0806B5DC: - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x41 - movs r2, 0 - bl GetMonData - movs r1, 0xCE - lsls r1, 1 - cmp r0, r1 - beq _0806B616 - adds r0, r4, 0 - movs r1, 0x39 - movs r2, 0 - bl GetMonData - cmp r0, 0 - beq _0806B616 - adds r0, r4, 0 - movs r1, 0x41 - movs r2, 0 - bl GetMonData - cmp r0, 0 - beq _0806B616 - adds r6, 0x1 -_0806B616: - adds r5, 0x1 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r5, r0 - blt _0806B5DC -_0806B620: - movs r0, 0 - cmp r6, 0x1 - bgt _0806B628 - movs r0, 0x2 -_0806B628: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end GetMonsStateToDoubles - - thumb_func_start GetMonsStateToDoubles_2 -@ u8 GetMonsStateToDoubles_2() -GetMonsStateToDoubles_2: @ 806B638 - push {r4-r6,lr} - movs r6, 0 - movs r5, 0 -_0806B63E: - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x41 - movs r2, 0 - bl GetMonData - adds r1, r0, 0 - movs r0, 0xCE - lsls r0, 1 - cmp r1, r0 - beq _0806B670 - cmp r1, 0 - beq _0806B670 - adds r0, r4, 0 - movs r1, 0x39 - movs r2, 0 - bl GetMonData - cmp r0, 0 - beq _0806B670 - adds r6, 0x1 -_0806B670: - adds r5, 0x1 - cmp r5, 0x5 - ble _0806B63E - cmp r6, 0x1 - bne _0806B684 - movs r0, 0x1 - b _0806B68C - .pool -_0806B684: - movs r0, 0 - cmp r6, 0x1 - bgt _0806B68C - movs r0, 0x2 -_0806B68C: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end GetMonsStateToDoubles_2 - - thumb_func_start GetAbilityBySpecies -@ int GetAbilityBySpecies(u16 a1, int a2) -GetAbilityBySpecies: @ 806B694 - push {lr} - lsls r0, 16 - lsrs r3, r0, 16 - lsls r1, 24 - cmp r1, 0 - beq _0806B6B8 - ldr r2, =gLastUsedAbility - ldr r1, =gBaseStats - lsls r0, r3, 3 - subs r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x17] - b _0806B6C6 - .pool -_0806B6B8: - ldr r2, =gLastUsedAbility - ldr r1, =gBaseStats - lsls r0, r3, 3 - subs r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x16] -_0806B6C6: - strb r0, [r2] - ldrb r0, [r2] - pop {r1} - bx r1 - .pool - thumb_func_end GetAbilityBySpecies - - thumb_func_start GetMonAbility -@ u8 GetMonAbility(pokemon *mon) -GetMonAbility: @ 806B6D8 - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0xB - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r5, 0 - movs r1, 0x2E - movs r2, 0 - bl GetMonData - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl GetAbilityBySpecies - lsls r0, 24 - lsrs r0, 24 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end GetMonAbility - - thumb_func_start CreateSecretBaseEnemyParty -CreateSecretBaseEnemyParty: @ 806B70C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - adds r5, r0, 0 - bl ZeroEnemyPartyMons - ldr r4, =gBattleResources - ldr r0, [r4] - ldr r0, [r0] - adds r1, r5, 0 - movs r2, 0xA0 - bl memcpy - movs r0, 0 - mov r9, r0 -_0806B730: - ldr r1, =gBattleResources - ldr r3, [r1] - ldr r2, [r3] - mov r4, r9 - lsls r7, r4, 1 - adds r0, r2, 0 - adds r0, 0x7C - adds r1, r0, r7 - ldrh r0, [r1] - adds r4, 0x1 - str r4, [sp, 0x10] - cmp r0, 0 - beq _0806B80A - movs r0, 0x64 - mov r6, r9 - muls r6, r0 - ldr r4, =gEnemyParty - mov r8, r4 - adds r5, r6, r4 - ldrh r1, [r1] - adds r0, r2, 0 - adds r0, 0x94 - add r0, r9 - ldrb r2, [r0] - movs r0, 0x1 - str r0, [sp] - ldr r0, [r3] - mov r3, r9 - lsls r4, r3, 2 - adds r0, 0x34 - adds r0, r4 - ldr r0, [r0] - str r0, [sp, 0x4] - movs r0, 0x2 - str r0, [sp, 0x8] - movs r0, 0 - str r0, [sp, 0xC] - adds r0, r5, 0 - movs r3, 0xF - bl CreateMon - ldr r1, =gBattleResources - ldr r0, [r1] - adds r1, r7, 0 - adds r1, 0x88 - ldr r2, [r0] - adds r2, r1 - adds r0, r5, 0 - movs r1, 0xC - bl SetMonData - movs r5, 0 - mov r10, r4 - mov r7, r9 - adds r7, 0x9A - mov r4, r8 -_0806B7A0: - adds r1, r5, 0 - adds r1, 0x1A - ldr r2, =gBattleResources - ldr r0, [r2] - ldr r2, [r0] - adds r2, r7 - adds r0, r6, r4 - bl SetMonData - adds r5, 0x1 - cmp r5, 0x5 - ble _0806B7A0 - movs r5, 0 - movs r3, 0x64 - mov r0, r9 - muls r0, r3 - ldr r1, =gEnemyParty - adds r7, r0, r1 - mov r4, r10 - lsls r0, r4, 1 - adds r6, r0, 0 - adds r6, 0x4C - adds r4, r0, 0 -_0806B7CE: - adds r1, r5, 0 - adds r1, 0xD - ldr r2, =gBattleResources - ldr r0, [r2] - ldr r2, [r0] - adds r2, r6 - adds r0, r7, 0 - bl SetMonData - adds r1, r5, 0 - adds r1, 0x11 - ldr r3, =gBattleResources - ldr r0, [r3] - ldr r0, [r0] - adds r0, 0x4C - adds r0, r4 - ldrh r0, [r0] - lsls r2, r0, 1 - adds r2, r0 - lsls r2, 2 - ldr r0, =gBattleMoves + 0x4 @ PP offset - adds r2, r0 - adds r0, r7, 0 - bl SetMonData - adds r6, 0x2 - adds r4, 0x2 - adds r5, 0x1 - cmp r5, 0x3 - ble _0806B7CE -_0806B80A: - ldr r4, [sp, 0x10] - mov r9, r4 - cmp r4, 0x5 - ble _0806B730 - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end CreateSecretBaseEnemyParty - - thumb_func_start GetSecretBaseTrainerPicIndex -GetSecretBaseTrainerPicIndex: @ 806B830 - push {r4,r5,lr} - ldr r5, =gSecretBaseTrainerClasses - ldr r0, =gBattleResources - ldr r0, [r0] - ldr r4, [r0] - ldrb r0, [r4, 0x9] - movs r1, 0x5 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - ldrb r2, [r4, 0x1] - lsls r2, 27 - lsrs r2, 31 - lsls r1, r2, 2 - adds r1, r2 - adds r0, r1 - adds r0, r5 - ldrb r0, [r0] - ldr r1, =gTrainerPicIndices - adds r0, r1 - ldrb r0, [r0] - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end GetSecretBaseTrainerPicIndex - - thumb_func_start GetSecretBaseTrainerNameIndex -GetSecretBaseTrainerNameIndex: @ 806B870 - push {r4,r5,lr} - ldr r5, =gSecretBaseTrainerClasses - ldr r0, =gBattleResources - ldr r0, [r0] - ldr r4, [r0] - ldrb r0, [r4, 0x9] - movs r1, 0x5 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - ldrb r2, [r4, 0x1] - lsls r2, 27 - lsrs r2, 31 - lsls r1, r2, 2 - adds r1, r2 - adds r0, r1 - adds r0, r5 - ldrb r0, [r0] - ldr r1, =gTrainerClassNameIndices - adds r0, r1 - ldrb r0, [r0] - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end GetSecretBaseTrainerNameIndex - - thumb_func_start PlayerPartyAndPokemonStorageFull -PlayerPartyAndPokemonStorageFull: @ 806B8B0 - push {r4,lr} - movs r4, 0 -_0806B8B4: - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - movs r2, 0 - bl GetMonData - cmp r0, 0 - bne _0806B8D0 - movs r0, 0 - b _0806B8DE - .pool -_0806B8D0: - adds r4, 0x1 - cmp r4, 0x5 - ble _0806B8B4 - bl PokemonStorageFull - lsls r0, 24 - lsrs r0, 24 -_0806B8DE: - pop {r4} - pop {r1} - bx r1 - thumb_func_end PlayerPartyAndPokemonStorageFull - - thumb_func_start PokemonStorageFull -PokemonStorageFull: @ 806B8E4 - push {r4-r6,lr} - movs r6, 0 -_0806B8E8: - movs r4, 0 - lsls r5, r6, 24 -_0806B8EC: - lsls r1, r4, 24 - lsrs r1, 24 - lsrs r0, r5, 24 - movs r2, 0xB - bl GetBoxMonDataFromAnyBox - cmp r0, 0 - bne _0806B900 - movs r0, 0 - b _0806B90E -_0806B900: - adds r4, 0x1 - cmp r4, 0x1D - ble _0806B8EC - adds r6, 0x1 - cmp r6, 0xD - ble _0806B8E8 - movs r0, 0x1 -_0806B90E: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end PokemonStorageFull - - thumb_func_start GetSpeciesName -@ void GetSpeciesName(u8 *dest, u16 speciesId) -GetSpeciesName: @ 806B914 - push {r4-r7,lr} - adds r6, r0, 0 - lsls r1, 16 - lsrs r5, r1, 16 - movs r1, 0 - movs r0, 0xCE - lsls r0, 1 - mov r12, r0 - ldr r7, =gSpeciesNames - movs r0, 0xB - muls r0, r5 - adds r3, r0, r7 - adds r2, r6, 0 - b _0806B93A - .pool -_0806B934: - adds r3, 0x1 - adds r2, 0x1 - adds r1, 0x1 -_0806B93A: - adds r4, r6, r1 - cmp r1, 0xA - bgt _0806B954 - cmp r5, r12 - bls _0806B94A - adds r0, r1, r7 - ldrb r0, [r0] - b _0806B94C -_0806B94A: - ldrb r0, [r3] -_0806B94C: - strb r0, [r2] - ldrb r0, [r4] - cmp r0, 0xFF - bne _0806B934 -_0806B954: - movs r0, 0xFF - strb r0, [r4] - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end GetSpeciesName - - thumb_func_start CalculatePPWithBonus -@ u16 CalculatePPWithBonus(u16 moveId, s32 ppUpCounts, u8 monMoveIndex) -CalculatePPWithBonus: @ 806B960 - push {r4,lr} - lsls r0, 16 - lsrs r0, 16 - lsls r2, 24 - lsrs r2, 24 - ldr r4, =gBattleMoves - lsls r3, r0, 1 - adds r3, r0 - lsls r3, 2 - adds r3, r4 - ldrb r4, [r3, 0x4] - ldr r0, =gUnknown_08329D22 - adds r0, r2, r0 - ldrb r3, [r0] - ands r3, r1 - lsls r2, 1 - asrs r3, r2 - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 2 - muls r0, r4 - movs r1, 0x64 - bl __divsi3 - adds r4, r0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end CalculatePPWithBonus - - thumb_func_start RemoveMonPPBonus -RemoveMonPPBonus: @ 806B9A8 - push {r4,r5,lr} - sub sp, 0x4 - adds r5, r0, 0 - lsls r4, r1, 24 - lsrs r4, 24 - movs r1, 0x15 - movs r2, 0 - bl GetMonData - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - strb r0, [r1] - ldr r1, =gUnknown_08329D26 - adds r4, r1 - ldrb r1, [r4] - ands r1, r0 - mov r0, sp - strb r1, [r0] - adds r0, r5, 0 - movs r1, 0x15 - mov r2, sp - bl SetMonData - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end RemoveMonPPBonus - - thumb_func_start RemoveBattleMonPPBonus -RemoveBattleMonPPBonus: @ 806B9E4 - lsls r1, 24 - lsrs r1, 24 - adds r0, 0x3B - ldr r2, =gUnknown_08329D26 - adds r1, r2 - ldrb r2, [r0] - ldrb r1, [r1] - ands r1, r2 - strb r1, [r0] - bx lr - .pool - thumb_func_end RemoveBattleMonPPBonus - thumb_func_start CopyPlayerPartyMonToBattleData CopyPlayerPartyMonToBattleData: @ 806B9FC push {r4-r7,lr} diff --git a/asm/pokemon_3.s b/asm/pokemon_3.s index 15d24d795..4301dccfd 100644 --- a/asm/pokemon_3.s +++ b/asm/pokemon_3.s @@ -5,4603 +5,7 @@ .text - thumb_func_start HealStatusConditions -@ bool8 HealStatusConditions(struct pokemon *a1, int a2, u32 healMask, u8 a4) -HealStatusConditions: @ 806CD6C - push {r4-r6,lr} - sub sp, 0x4 - adds r5, r0, 0 - adds r4, r2, 0 - lsls r3, 24 - lsrs r6, r3, 24 - movs r1, 0x37 - movs r2, 0 - bl GetMonData - adds r1, r0, 0 - str r1, [sp] - ands r0, r4 - cmp r0, 0 - beq _0806CDD0 - mvns r4, r4 - ands r1, r4 - str r1, [sp] - adds r0, r5, 0 - movs r1, 0x37 - mov r2, sp - bl SetMonData - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0806CDBE - cmp r6, 0x4 - beq _0806CDBE - ldr r0, =gBattleMons - movs r1, 0x58 - muls r1, r6 - adds r0, 0x4C - adds r1, r0 - ldr r0, [r1] - ands r0, r4 - str r0, [r1] -_0806CDBE: - movs r0, 0 - b _0806CDD2 - .pool -_0806CDD0: - movs r0, 0x1 -_0806CDD2: - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end HealStatusConditions - thumb_func_start GetItemEffectParamOffset -GetItemEffectParamOffset: @ 806CDDC - push {r4-r7,lr} - lsls r0, 16 - lsrs r3, r0, 16 - lsls r1, 24 - lsrs r4, r1, 24 - lsls r2, 24 - lsrs r5, r2, 24 - movs r7, 0x6 - ldr r1, =gItemEffectTable - adds r0, r3, 0 - subs r0, 0xD - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - bne _0806CE08 - cmp r3, 0xAF - beq _0806CE0C -_0806CE00: - movs r0, 0 - b _0806CF1C - .pool -_0806CE08: - cmp r3, 0xAF - bne _0806CE1A -_0806CE0C: - ldr r0, =gActiveBank - ldrb r1, [r0] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - ldr r1, =gEnigmaBerries + 8 - adds r0, r1 -_0806CE1A: - mov r12, r0 - movs r2, 0 -_0806CE1E: - cmp r2, 0x4 - beq _0806CE3E - cmp r2, 0x4 - ble _0806CE34 - cmp r2, 0x5 - beq _0806CEC8 - b _0806CF12 - .pool -_0806CE34: - cmp r2, 0 - blt _0806CF12 - cmp r2, r4 - bne _0806CF12 - b _0806CE00 -_0806CE3E: - mov r0, r12 - ldrb r3, [r0, 0x4] - movs r0, 0x20 - ands r0, r3 - cmp r0, 0 - beq _0806CE4E - movs r0, 0xDF - ands r3, r0 -_0806CE4E: - movs r6, 0 - cmp r3, 0 - beq _0806CF12 -_0806CE54: - movs r0, 0x1 - ands r0, r3 - cmp r0, 0 - beq _0806CEB4 - cmp r6, 0x7 - bhi _0806CEB4 - lsls r0, r6, 2 - ldr r1, =_0806CE70 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0806CE70: - .4byte _0806CE9C - .4byte _0806CE9C - .4byte _0806CE90 - .4byte _0806CE9C - .4byte _0806CEB4 - .4byte _0806CEB4 - .4byte _0806CEB4 - .4byte _0806CEB0 -_0806CE90: - movs r0, 0x10 - ands r0, r3 - cmp r0, 0 - beq _0806CE9C - movs r0, 0xEF - ands r3, r0 -_0806CE9C: - cmp r2, r4 - bne _0806CEA8 - adds r0, r3, 0 - ands r0, r5 - cmp r0, 0 - bne _0806CF1A -_0806CEA8: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - b _0806CEB4 -_0806CEB0: - cmp r2, r4 - beq _0806CE00 -_0806CEB4: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - lsrs r3, 1 - cmp r2, r4 - bne _0806CEC2 - lsrs r5, 1 -_0806CEC2: - cmp r3, 0 - bne _0806CE54 - b _0806CF12 -_0806CEC8: - mov r0, r12 - ldrb r3, [r0, 0x5] - movs r6, 0 -_0806CECE: - cmp r3, 0 - beq _0806CF12 - movs r0, 0x1 - ands r0, r3 - cmp r0, 0 - beq _0806CF02 - cmp r6, 0 - blt _0806CF02 - cmp r6, 0x6 - ble _0806CEE8 - cmp r6, 0x7 - beq _0806CEFC - b _0806CF02 -_0806CEE8: - cmp r2, r4 - bne _0806CEF4 - adds r0, r3, 0 - ands r0, r5 - cmp r0, 0 - bne _0806CF1A -_0806CEF4: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - b _0806CF02 -_0806CEFC: - cmp r2, r4 - bne _0806CF02 - b _0806CE00 -_0806CF02: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - lsrs r3, 1 - cmp r2, r4 - bne _0806CECE - lsrs r5, 1 - b _0806CECE -_0806CF12: - adds r2, 0x1 - cmp r2, 0x5 - bgt _0806CF1A - b _0806CE1E -_0806CF1A: - adds r0, r7, 0 -_0806CF1C: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end GetItemEffectParamOffset - - thumb_func_start sub_806CF24 -sub_806CF24: @ 806CF24 - push {lr} - ldr r2, =gBankTarget - ldr r1, =gUnknown_020244B8 - ldrb r1, [r1] - strb r1, [r2] - ldr r3, =gBattleTextBuff1 - ldr r2, =gUnknown_085CBE00 - ldr r1, =gUnknown_08329EC8 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r2 - ldr r1, [r0] - adds r0, r3, 0 - bl StringCopy - ldr r0, =gBattleTextBuff2 - ldr r1, =gUnknown_085CB38A - bl StringCopy - ldr r0, =gUnknown_085CB3AA - bl StrCpyDecodeToDisplayedStringBattle - pop {r0} - bx r0 - .pool - thumb_func_end sub_806CF24 - - thumb_func_start sub_806CF78 -sub_806CF78: @ 806CF78 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xAF - bne _0806CFCC - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0806CFB8 - ldr r2, =gUnknown_020244B8 - ldrb r1, [r2] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - ldr r1, =gEnigmaBerries + 8 - adds r7, r0, r1 - b _0806CFD8 - .pool -_0806CFB8: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003214 - adds r7, r0, r1 - b _0806CFD6 - .pool -_0806CFCC: - ldr r1, =gItemEffectTable - subs r0, 0xD - lsls r0, 2 - adds r0, r1 - ldr r7, [r0] -_0806CFD6: - ldr r2, =gUnknown_020244B8 -_0806CFD8: - ldr r1, =gUnknown_0202420F - ldrb r0, [r2] - strb r0, [r1] - movs r5, 0 - ldr r0, =gBankAttacker - mov r8, r0 - movs r6, 0 -_0806CFE6: - adds r4, r7, r5 - ldrb r1, [r4] - movs r0, 0xF - ands r0, r1 - cmp r0, 0 - beq _0806CFF8 - adds r0, r6, 0 - bl sub_806CF24 -_0806CFF8: - ldrb r1, [r4] - movs r0, 0xF0 - ands r0, r1 - cmp r0, 0 - beq _0806D02E - cmp r5, 0 - beq _0806D020 - adds r0, r6, 0x1 - bl sub_806CF24 - b _0806D02E - .pool -_0806D020: - ldr r0, =gUnknown_020244B8 - ldrb r0, [r0] - mov r1, r8 - strb r0, [r1] - ldr r0, =gUnknown_085CA459 - bl StrCpyDecodeToDisplayedStringBattle -_0806D02E: - adds r6, 0x2 - adds r5, 0x1 - cmp r5, 0x2 - ble _0806CFE6 - ldrb r1, [r7, 0x3] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0806D04E - ldr r1, =gBankAttacker - ldr r0, =gUnknown_020244B8 - ldrb r0, [r0] - strb r0, [r1] - ldr r0, =gUnknown_085CA424 - bl StrCpyDecodeToDisplayedStringBattle -_0806D04E: - ldr r0, =gDisplayedStringBattle - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_806CF78 - - thumb_func_start GetNature -@ u8 GetNature(pokemon *mon) -GetNature: @ 806D070 - push {lr} - movs r1, 0 - movs r2, 0 - bl GetMonData - movs r1, 0x19 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end GetNature - - thumb_func_start GetNatureFromPersonality -@ u8 GetNatureFromPersonality(u32 personality) -GetNatureFromPersonality: @ 806D088 - push {lr} - movs r1, 0x19 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end GetNatureFromPersonality - - thumb_func_start GetEvolutionTargetSpecies -GetEvolutionTargetSpecies: @ 806D098 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - mov r8, r0 - lsls r1, 24 - lsrs r5, r1, 24 - lsls r2, 16 - lsrs r2, 16 - mov r9, r2 - movs r0, 0 - mov r10, r0 - mov r0, r8 - movs r1, 0xB - movs r2, 0 - bl GetMonData - lsls r0, 16 - lsrs r7, r0, 16 - mov r0, r8 - movs r1, 0xC - movs r2, 0 - bl GetMonData - mov r1, sp - strh r0, [r1] - mov r0, r8 - movs r1, 0 - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - mov r0, r8 - movs r1, 0x17 - movs r2, 0 - bl GetMonData - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0xC] - lsrs r4, 16 - str r4, [sp, 0x10] - mov r0, sp - ldrh r0, [r0] - cmp r0, 0xAF - bne _0806D10C - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003226 - adds r0, r1 - ldrb r0, [r0] - b _0806D114 - .pool -_0806D10C: - bl ItemId_GetHoldEffect - lsls r0, 24 - lsrs r0, 24 -_0806D114: - cmp r0, 0x26 - bne _0806D120 - cmp r5, 0x3 - beq _0806D120 - movs r0, 0 - b _0806D3B0 -_0806D120: - cmp r5, 0x1 - bne _0806D126 - b _0806D340 -_0806D126: - cmp r5, 0x1 - bgt _0806D130 - cmp r5, 0 - beq _0806D144 - b _0806D3AE -_0806D130: - cmp r5, 0x3 - ble _0806D136 - b _0806D3AE -_0806D136: - movs r2, 0 - str r2, [sp, 0x4] - ldr r3, =gEvolutionTable - lsls r6, r7, 2 - b _0806D38E - .pool -_0806D144: - mov r0, r8 - movs r1, 0x38 - movs r2, 0 - bl GetMonData - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - mov r0, r8 - movs r1, 0x20 - movs r2, 0 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x8] - movs r0, 0 - str r0, [sp, 0x4] - lsls r6, r7, 2 -_0806D16A: - ldr r1, =gEvolutionTable - ldr r0, [sp, 0x4] - lsls r2, r0, 3 - adds r0, r6, r7 - lsls r0, 3 - adds r0, r2, r0 - adds r0, r1 - ldrh r0, [r0] - subs r0, 0x1 - adds r3, r1, 0 - adds r4, r2, 0 - cmp r0, 0xE - bls _0806D186 - b _0806D332 -_0806D186: - lsls r0, 2 - ldr r1, =_0806D198 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0806D198: - .4byte _0806D1D4 - .4byte _0806D1E6 - .4byte _0806D208 - .4byte _0806D238 - .4byte _0806D332 - .4byte _0806D332 - .4byte _0806D332 - .4byte _0806D248 - .4byte _0806D272 - .4byte _0806D29C - .4byte _0806D2CA - .4byte _0806D2EA - .4byte _0806D30E - .4byte _0806D332 - .4byte _0806D31E -_0806D1D4: - ldr r1, [sp, 0x8] - cmp r1, 0xDB - bhi _0806D1DC - b _0806D332 -_0806D1DC: - adds r0, r6, r7 - lsls r0, 3 - adds r0, r4, r0 - adds r0, r3 - b _0806D228 -_0806D1E6: - bl RtcCalcLocalTime - ldr r0, =gLocalTime - ldrb r0, [r0, 0x2] - subs r0, 0xC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xB - bls _0806D1FA - b _0806D332 -_0806D1FA: - ldr r2, [sp, 0x8] - cmp r2, 0xDB - bhi _0806D202 - b _0806D332 -_0806D202: - b _0806D21E - .pool -_0806D208: - bl RtcCalcLocalTime - ldr r0, =gLocalTime - ldrb r0, [r0, 0x2] - cmp r0, 0xB - bls _0806D216 - b _0806D332 -_0806D216: - ldr r0, [sp, 0x8] - cmp r0, 0xDB - bhi _0806D21E - b _0806D332 -_0806D21E: - ldr r1, =gEvolutionTable - adds r0, r6, r7 - lsls r0, 3 - adds r0, r4, r0 - adds r0, r1 -_0806D228: - ldrh r0, [r0, 0x4] - mov r10, r0 - b _0806D332 - .pool -_0806D238: - adds r0, r6, r7 - lsls r0, 3 - adds r0, r4, r0 - adds r1, r0, r3 - ldrh r0, [r1, 0x2] - cmp r0, r9 - bhi _0806D332 - b _0806D32E -_0806D248: - adds r0, r6, r7 - lsls r0, 3 - adds r0, r4, r0 - adds r5, r0, r3 - ldrh r0, [r5, 0x2] - cmp r0, r9 - bhi _0806D332 - mov r0, r8 - movs r1, 0x3B - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - mov r0, r8 - movs r1, 0x3C - movs r2, 0 - bl GetMonData - cmp r4, r0 - bls _0806D332 - b _0806D2C4 -_0806D272: - adds r0, r6, r7 - lsls r0, 3 - adds r0, r4, r0 - adds r5, r0, r3 - ldrh r0, [r5, 0x2] - cmp r0, r9 - bhi _0806D332 - mov r0, r8 - movs r1, 0x3B - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - mov r0, r8 - movs r1, 0x3C - movs r2, 0 - bl GetMonData - cmp r4, r0 - bne _0806D332 - b _0806D2C4 -_0806D29C: - adds r0, r6, r7 - lsls r0, 3 - adds r0, r4, r0 - adds r5, r0, r3 - ldrh r0, [r5, 0x2] - cmp r0, r9 - bhi _0806D332 - mov r0, r8 - movs r1, 0x3B - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - mov r0, r8 - movs r1, 0x3C - movs r2, 0 - bl GetMonData - cmp r4, r0 - bcs _0806D332 -_0806D2C4: - ldrh r5, [r5, 0x4] - mov r10, r5 - b _0806D332 -_0806D2CA: - adds r0, r6, r7 - lsls r0, 3 - adds r0, r4, r0 - adds r4, r0, r3 - ldrh r0, [r4, 0x2] - cmp r0, r9 - bhi _0806D332 - ldr r0, [sp, 0x10] - movs r1, 0xA - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x4 - bhi _0806D332 - b _0806D308 -_0806D2EA: - adds r0, r6, r7 - lsls r0, 3 - adds r0, r4, r0 - adds r4, r0, r3 - ldrh r0, [r4, 0x2] - cmp r0, r9 - bhi _0806D332 - ldr r0, [sp, 0x10] - movs r1, 0xA - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x4 - bls _0806D332 -_0806D308: - ldrh r4, [r4, 0x4] - mov r10, r4 - b _0806D332 -_0806D30E: - adds r0, r6, r7 - lsls r0, 3 - adds r0, r4, r0 - adds r1, r0, r3 - ldrh r0, [r1, 0x2] - cmp r0, r9 - bhi _0806D332 - b _0806D32E -_0806D31E: - adds r0, r6, r7 - lsls r0, 3 - adds r0, r4, r0 - adds r1, r0, r3 - ldrh r0, [r1, 0x2] - ldr r2, [sp, 0xC] - cmp r0, r2 - bhi _0806D332 -_0806D32E: - ldrh r1, [r1, 0x4] - mov r10, r1 -_0806D332: - ldr r0, [sp, 0x4] - adds r0, 0x1 - str r0, [sp, 0x4] - cmp r0, 0x4 - bgt _0806D33E - b _0806D16A -_0806D33E: - b _0806D3AE -_0806D340: - lsls r6, r7, 2 - ldr r1, =gEvolutionTable - adds r0, r6, r7 - lsls r0, 3 - adds r4, r0, r1 - mov r5, sp - movs r1, 0x4 - str r1, [sp, 0x4] -_0806D350: - ldrh r0, [r4] - cmp r0, 0x5 - beq _0806D370 - cmp r0, 0x6 - bne _0806D374 - ldrh r0, [r4, 0x2] - ldrh r1, [r5] - cmp r0, r1 - bne _0806D374 - movs r0, 0 - strh r0, [r5] - mov r0, r8 - movs r1, 0xC - mov r2, sp - bl SetMonData -_0806D370: - ldrh r2, [r4, 0x4] - mov r10, r2 -_0806D374: - adds r4, 0x8 - ldr r0, [sp, 0x4] - subs r0, 0x1 - str r0, [sp, 0x4] - cmp r0, 0 - bge _0806D350 - b _0806D3AE - .pool -_0806D388: - ldrh r1, [r1, 0x4] - mov r10, r1 - b _0806D3AE -_0806D38E: - adds r0, r6, r7 - ldr r1, [sp, 0x4] - adds r0, r1 - lsls r0, 3 - adds r1, r0, r3 - ldrh r0, [r1] - cmp r0, 0x7 - bne _0806D3A4 - ldrh r0, [r1, 0x2] - cmp r0, r9 - beq _0806D388 -_0806D3A4: - ldr r2, [sp, 0x4] - adds r2, 0x1 - str r2, [sp, 0x4] - cmp r2, 0x4 - ble _0806D38E -_0806D3AE: - mov r0, r10 -_0806D3B0: - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end GetEvolutionTargetSpecies - - thumb_func_start HoennPokedexNumToSpecies -HoennPokedexNumToSpecies: @ 806D3C0 - push {r4,lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0 - beq _0806D404 - movs r1, 0 - ldr r3, =gSpeciesToHoennPokedexNum - ldrh r0, [r3] - cmp r0, r2 - beq _0806D3EC - movs r4, 0xCD - lsls r4, 1 -_0806D3D8: - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, r4 - bhi _0806D3EC - lsls r0, r1, 1 - adds r0, r3 - ldrh r0, [r0] - cmp r0, r2 - bne _0806D3D8 -_0806D3EC: - ldr r0, =0x0000019b - cmp r1, r0 - beq _0806D404 - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r0, 16 - b _0806D406 - .pool -_0806D404: - movs r0, 0 -_0806D406: - pop {r4} - pop {r1} - bx r1 - thumb_func_end HoennPokedexNumToSpecies - - thumb_func_start NationalPokedexNumToSpecies -NationalPokedexNumToSpecies: @ 806D40C - push {r4,lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0 - beq _0806D450 - movs r1, 0 - ldr r3, =gSpeciesToNationalPokedexNum - ldrh r0, [r3] - cmp r0, r2 - beq _0806D438 - movs r4, 0xCD - lsls r4, 1 -_0806D424: - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, r4 - bhi _0806D438 - lsls r0, r1, 1 - adds r0, r3 - ldrh r0, [r0] - cmp r0, r2 - bne _0806D424 -_0806D438: - ldr r0, =0x0000019b - cmp r1, r0 - beq _0806D450 - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r0, 16 - b _0806D452 - .pool -_0806D450: - movs r0, 0 -_0806D452: - pop {r4} - pop {r1} - bx r1 - thumb_func_end NationalPokedexNumToSpecies - - thumb_func_start NationalToHoennOrder -NationalToHoennOrder: @ 806D458 - push {r4,lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0 - beq _0806D49C - movs r1, 0 - ldr r3, =gHoennToNationalOrder - ldrh r0, [r3] - cmp r0, r2 - beq _0806D484 - movs r4, 0xCD - lsls r4, 1 -_0806D470: - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, r4 - bhi _0806D484 - lsls r0, r1, 1 - adds r0, r3 - ldrh r0, [r0] - cmp r0, r2 - bne _0806D470 -_0806D484: - ldr r0, =0x0000019b - cmp r1, r0 - beq _0806D49C - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r0, 16 - b _0806D49E - .pool -_0806D49C: - movs r0, 0 -_0806D49E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end NationalToHoennOrder - - thumb_func_start SpeciesToNationalPokedexNum -SpeciesToNationalPokedexNum: @ 806D4A4 - push {lr} - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0 - beq _0806D4C0 - ldr r0, =gSpeciesToNationalPokedexNum - subs r1, 0x1 - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - b _0806D4C2 - .pool -_0806D4C0: - movs r0, 0 -_0806D4C2: - pop {r1} - bx r1 - thumb_func_end SpeciesToNationalPokedexNum - - thumb_func_start SpeciesToHoennPokedexNum -SpeciesToHoennPokedexNum: @ 806D4C8 - push {lr} - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0 - beq _0806D4E4 - ldr r0, =gSpeciesToHoennPokedexNum - subs r1, 0x1 - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - b _0806D4E6 - .pool -_0806D4E4: - movs r0, 0 -_0806D4E6: - pop {r1} - bx r1 - thumb_func_end SpeciesToHoennPokedexNum - - thumb_func_start HoennToNationalOrder -HoennToNationalOrder: @ 806D4EC - push {lr} - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0 - beq _0806D508 - ldr r0, =gHoennToNationalOrder - subs r1, 0x1 - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - b _0806D50A - .pool -_0806D508: - movs r0, 0 -_0806D50A: - pop {r1} - bx r1 - thumb_func_end HoennToNationalOrder - - thumb_func_start SpeciesToCryId -SpeciesToCryId: @ 806D510 - push {lr} - lsls r0, 16 - lsrs r0, 16 - adds r1, r0, 0 - cmp r0, 0xFA - bls _0806D53E - ldr r0, =0x00000113 - cmp r1, r0 - bls _0806D53C - ldr r0, =gSpeciesIdToCryId - ldr r2, =0xfffffeec - adds r1, r2 - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - b _0806D53E - .pool -_0806D53C: - movs r0, 0xC8 -_0806D53E: - pop {r1} - bx r1 - thumb_func_end SpeciesToCryId - - thumb_func_start sub_806D544 -sub_806D544: @ 806D544 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - adds r6, r1, 0 - mov r10, r2 - lsls r0, 16 - movs r1, 0x9A - lsls r1, 17 - cmp r0, r1 - bne _0806D652 - ldr r0, =gUnknown_020244D4 - ldr r1, [r0] - ldr r0, [r1, 0x4] - cmp r10, r0 - beq _0806D652 - ldr r0, [r1, 0xC] - cmp r10, r0 - beq _0806D652 - movs r5, 0 -_0806D570: - lsls r3, r5, 3 - adds r3, r5 - lsls r3, 2 - ldr r0, =gSpindaSpotGraphics - adds r4, r3, r0 - ldrb r1, [r4] - adds r1, 0xF8 - movs r2, 0xF - adds r0, r6, 0 - ands r0, r2 - adds r1, r0 - lsls r1, 24 - lsrs r1, 24 - mov r12, r1 - ldrb r1, [r4, 0x1] - adds r1, 0xF8 - movs r0, 0xF0 - ands r0, r6 - lsrs r0, 4 - adds r1, r0 - lsls r1, 24 - lsrs r1, 24 - movs r2, 0 - lsrs r6, 8 - str r6, [sp, 0x4] - adds r5, 0x1 - str r5, [sp] - mov r9, r3 -_0806D5A8: - lsls r0, r2, 1 - add r0, r9 - ldr r3, =gSpindaSpotGraphics + 0x2 - adds r0, r3 - ldrh r3, [r0] - mov r4, r12 - adds r0, r4, 0 - adds r0, 0x10 - adds r7, r1, 0x1 - adds r2, 0x1 - mov r8, r2 - cmp r4, r0 - bge _0806D640 - lsrs r0, r1, 3 - lsls r6, r0, 8 - movs r0, 0x7 - ands r1, r0 - lsls r5, r1, 2 -_0806D5CC: - adds r0, r4, 0 - cmp r4, 0 - bge _0806D5D4 - adds r0, r4, 0x7 -_0806D5D4: - asrs r0, 3 - lsls r2, r0, 5 - add r2, r10 - lsls r0, 3 - subs r0, r4, r0 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - adds r2, r0 - adds r2, r6 - adds r2, r5 - movs r1, 0x1 - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _0806D634 - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - beq _0806D620 - ldrb r1, [r2] - movs r0, 0xF0 - ands r0, r1 - subs r0, 0x10 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x20 - bhi _0806D634 - adds r0, r1, 0 - adds r0, 0x40 - b _0806D632 - .pool -_0806D620: - ldrb r1, [r2] - movs r0, 0xF - ands r0, r1 - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bhi _0806D634 - adds r0, r1, 0x4 -_0806D632: - strb r0, [r2] -_0806D634: - asrs r3, 1 - adds r4, 0x1 - mov r0, r12 - adds r0, 0x10 - cmp r4, r0 - blt _0806D5CC -_0806D640: - lsls r0, r7, 24 - lsrs r1, r0, 24 - mov r2, r8 - cmp r2, 0xF - ble _0806D5A8 - ldr r6, [sp, 0x4] - ldr r5, [sp] - cmp r5, 0x3 - ble _0806D570 -_0806D652: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_806D544 - - thumb_func_start DrawSpindaSpots -@ void DrawSpindaSpots(u16 species, u32 personality, u8 *pixels, u8 isFrontPic) -DrawSpindaSpots: @ 806D664 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - adds r5, r1, 0 - str r2, [sp] - lsls r0, 16 - lsls r3, 24 - lsrs r3, 24 - movs r1, 0x9A - lsls r1, 17 - cmp r0, r1 - bne _0806D766 - cmp r3, 0 - beq _0806D766 - movs r6, 0 -_0806D688: - lsls r3, r6, 3 - adds r3, r6 - lsls r3, 2 - ldr r0, =gSpindaSpotGraphics - adds r4, r3, r0 - ldrb r1, [r4] - adds r1, 0xF8 - movs r2, 0xF - adds r0, r5, 0 - ands r0, r2 - adds r1, r0 - lsls r1, 24 - lsrs r1, 24 - mov r12, r1 - ldrb r1, [r4, 0x1] - adds r1, 0xF8 - movs r0, 0xF0 - ands r0, r5 - lsrs r0, 4 - adds r1, r0 - lsls r1, 24 - lsrs r1, 24 - movs r2, 0 - lsrs r5, 8 - str r5, [sp, 0x4] - adds r6, 0x1 - mov r10, r6 - mov r9, r3 -_0806D6C0: - lsls r0, r2, 1 - add r0, r9 - ldr r3, =gSpindaSpotGraphics + 0x2 - adds r0, r3 - ldrh r3, [r0] - mov r4, r12 - adds r0, r4, 0 - adds r0, 0x10 - adds r7, r1, 0x1 - adds r2, 0x1 - mov r8, r2 - cmp r4, r0 - bge _0806D754 - lsrs r0, r1, 3 - lsls r6, r0, 8 - movs r0, 0x7 - ands r1, r0 - lsls r5, r1, 2 -_0806D6E4: - adds r0, r4, 0 - cmp r4, 0 - bge _0806D6EC - adds r0, r4, 0x7 -_0806D6EC: - asrs r0, 3 - lsls r2, r0, 5 - ldr r1, [sp] - adds r2, r1, r2 - lsls r0, 3 - subs r0, r4, r0 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - adds r2, r0 - adds r2, r6 - adds r2, r5 - movs r1, 0x1 - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _0806D748 - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - beq _0806D734 - ldrb r1, [r2] - movs r0, 0xF0 - ands r0, r1 - subs r0, 0x10 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x20 - bhi _0806D748 - adds r0, r1, 0 - adds r0, 0x40 - b _0806D746 - .pool -_0806D734: - ldrb r1, [r2] - movs r0, 0xF - ands r0, r1 - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bhi _0806D748 - adds r0, r1, 0x4 -_0806D746: - strb r0, [r2] -_0806D748: - asrs r3, 1 - adds r4, 0x1 - mov r0, r12 - adds r0, 0x10 - cmp r4, r0 - blt _0806D6E4 -_0806D754: - lsls r0, r7, 24 - lsrs r1, r0, 24 - mov r2, r8 - cmp r2, 0xF - ble _0806D6C0 - ldr r5, [sp, 0x4] - mov r6, r10 - cmp r6, 0x3 - ble _0806D688 -_0806D766: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end DrawSpindaSpots - - thumb_func_start sub_806D778 -sub_806D778: @ 806D778 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - adds r5, r0, 0 - lsls r1, 16 - lsrs r7, r1, 16 - lsls r2, 16 - lsrs r2, 16 - mov r8, r2 - ldr r0, =gStringVar1 - mov r9, r0 - adds r0, r5, 0 - movs r1, 0x2 - mov r2, r9 - bl GetMonData - mov r4, sp - adds r0, r5, 0 - movs r1, 0x3 - mov r2, sp - bl GetMonData - strb r0, [r4] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _0806D7D4 - movs r6, 0xB - adds r0, r7, 0 - muls r0, r6 - ldr r4, =gSpeciesNames - adds r0, r4 - mov r1, r9 - bl StringCompare - cmp r0, 0 - bne _0806D7D4 - mov r2, r8 - muls r2, r6 - adds r2, r4 - adds r0, r5, 0 - movs r1, 0x2 - bl SetMonData -_0806D7D4: - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_806D778 - - thumb_func_start sub_806D7EC -sub_806D7EC: @ 806D7EC - push {r4,r5,lr} - movs r5, 0 - ldr r4, =gLinkPlayers - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - ldrh r0, [r1, 0x18] - cmp r0, 0x2 - bgt _0806D818 - cmp r0, 0x1 - bge _0806D820 - cmp r0, 0 - beq _0806D81C - b _0806D822 - .pool -_0806D818: - cmp r0, 0x3 - bne _0806D822 -_0806D81C: - movs r5, 0 - b _0806D822 -_0806D820: - movs r5, 0x1 -_0806D822: - adds r0, r5, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_806D7EC - - thumb_func_start sub_806D82C -sub_806D82C: @ 806D82C - push {lr} - lsls r0, 24 - lsrs r0, 24 - movs r3, 0 - ldr r2, =gLinkPlayers - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r2 - ldrh r0, [r1, 0x18] - cmp r0, 0x2 - bgt _0806D854 - cmp r0, 0x1 - bge _0806D85C - cmp r0, 0 - beq _0806D858 - b _0806D85E - .pool -_0806D854: - cmp r0, 0x3 - bne _0806D85E -_0806D858: - movs r3, 0 - b _0806D85E -_0806D85C: - movs r3, 0x1 -_0806D85E: - adds r0, r3, 0 - pop {r1} - bx r1 - thumb_func_end sub_806D82C - - thumb_func_start sub_806D864 -sub_806D864: @ 806D864 - push {lr} - lsls r0, 16 - lsrs r3, r0, 16 - movs r2, 0 - ldr r1, =gLinkPlayers - b _0806D87C - .pool -_0806D874: - adds r1, 0x1C - adds r2, 0x1 - cmp r2, 0x3 - bgt _0806D882 -_0806D87C: - ldrh r0, [r1, 0x18] - cmp r0, r3 - bne _0806D874 -_0806D882: - adds r0, r2, 0 - pop {r1} - bx r1 - thumb_func_end sub_806D864 - - thumb_func_start GetTrainerEncounterMusicId -@ u8 GetTrainerEncounterMusicId(u16 trainerOpponentId) -GetTrainerEncounterMusicId: @ 806D888 - push {r4,r5,lr} - lsls r0, 16 - lsrs r4, r0, 16 - adds r5, r4, 0 - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - beq _0806D8A2 - adds r0, r4, 0 - bl sub_81A9F3C - b _0806D8CA -_0806D8A2: - bl sub_81D5C18 - lsls r0, 24 - cmp r0, 0 - bne _0806D8C4 - ldr r1, =gTrainers - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldrb r1, [r0, 0x2] - movs r0, 0x7F - ands r0, r1 - b _0806D8CE - .pool -_0806D8C4: - adds r0, r5, 0 - bl sub_81D63C8 -_0806D8CA: - lsls r0, 24 - lsrs r0, 24 -_0806D8CE: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end GetTrainerEncounterMusicId - - thumb_func_start nature_stat_mod -nature_stat_mod: @ 806D8D4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 16 - lsrs r3, r1, 16 - lsls r2, 24 - lsrs r5, r2, 24 - movs r0, 0xFF - lsls r0, 24 - adds r2, r0 - lsrs r2, 24 - cmp r2, 0x4 - bls _0806D8F2 - adds r0, r3, 0 - b _0806D92E -_0806D8F2: - ldr r0, =gNatureStatTable - lsls r1, r4, 2 - adds r1, r4 - subs r1, 0x1 - adds r1, r5, r1 - adds r1, r0 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0806D918 - cmp r1, 0x1 - bne _0806D92C - movs r0, 0x6E - b _0806D91A - .pool -_0806D918: - movs r0, 0x5A -_0806D91A: - muls r0, r3 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x64 - bl __udivsi3 - lsls r0, 16 - lsrs r0, 16 - b _0806D92E -_0806D92C: - adds r0, r3, 0 -_0806D92E: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end nature_stat_mod - - thumb_func_start AdjustFriendship -AdjustFriendship: @ 806D934 - push {r4-r7,lr} - sub sp, 0x4 - adds r7, r0, 0 - lsls r1, 24 - lsrs r5, r1, 24 - bl sub_806F104 - lsls r0, 24 - cmp r0, 0 - beq _0806D94A - b _0806DAC2 -_0806D94A: - adds r0, r7, 0 - movs r1, 0x41 - movs r2, 0 - bl GetMonData - lsls r0, 16 - lsrs r6, r0, 16 - adds r0, r7, 0 - movs r1, 0xC - movs r2, 0 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xAF - bne _0806D9A0 - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0806D98C - ldr r0, =gEnigmaBerries - ldrb r4, [r0, 0x7] - b _0806D9A8 - .pool -_0806D98C: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003226 - adds r0, r1 - ldrb r4, [r0] - b _0806D9A8 - .pool -_0806D9A0: - bl ItemId_GetHoldEffect - lsls r0, 24 - lsrs r4, r0, 24 -_0806D9A8: - cmp r6, 0 - bne _0806D9AE - b _0806DAC2 -_0806D9AE: - movs r0, 0xCE - lsls r0, 1 - cmp r6, r0 - bne _0806D9B8 - b _0806DAC2 -_0806D9B8: - movs r6, 0 - adds r0, r7, 0 - movs r1, 0x20 - movs r2, 0 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - mov r1, sp - strh r0, [r1] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x63 - ble _0806D9D6 - movs r6, 0x1 -_0806D9D6: - cmp r0, 0xC7 - ble _0806D9E0 - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_0806D9E0: - cmp r5, 0x5 - bne _0806D9F0 - bl Random - movs r1, 0x1 - ands r1, r0 - cmp r1, 0 - bne _0806DAC2 -_0806D9F0: - cmp r5, 0x3 - bne _0806DA20 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x8 - ands r0, r1 - cmp r0, 0 - beq _0806DAC2 - ldr r2, =gTrainers - ldr r0, =gTrainerBattleOpponent_A - ldrh r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldrb r1, [r0, 0x1] - adds r0, r1, 0 - subs r0, 0x1F - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _0806DA20 - cmp r1, 0x26 - bne _0806DAC2 -_0806DA20: - ldr r1, =gUnknown_08329ECE - lsls r0, r5, 1 - adds r0, r5 - adds r0, r6, r0 - adds r0, r1 - ldrb r2, [r0] - movs r1, 0 - ldrsb r1, [r0, r1] - cmp r1, 0 - ble _0806DA46 - cmp r4, 0x1B - bne _0806DA46 - movs r0, 0x96 - muls r0, r1 - movs r1, 0x64 - bl __divsi3 - lsls r0, 24 - lsrs r2, r0, 24 -_0806DA46: - lsls r2, 24 - asrs r2, 24 - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - adds r0, r2 - mov r1, sp - strh r0, [r1] - cmp r2, 0 - ble _0806DA98 - adds r0, r7, 0 - movs r1, 0x26 - movs r2, 0 - bl GetMonData - cmp r0, 0xB - bne _0806DA74 - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - adds r0, 0x1 - mov r1, sp - strh r0, [r1] -_0806DA74: - adds r0, r7, 0 - movs r1, 0x23 - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - bl sav1_map_get_name - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bne _0806DA98 - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - adds r0, 0x1 - mov r1, sp - strh r0, [r1] -_0806DA98: - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bge _0806DAA8 - movs r1, 0 - mov r0, sp - strh r1, [r0] -_0806DAA8: - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0xFF - ble _0806DAB8 - movs r1, 0xFF - mov r0, sp - strh r1, [r0] -_0806DAB8: - adds r0, r7, 0 - movs r1, 0x20 - mov r2, sp - bl SetMonData -_0806DAC2: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end AdjustFriendship - - thumb_func_start MonGainEVs -MonGainEVs: @ 806DADC - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - mov r8, r0 - lsls r1, 16 - lsrs r5, r1, 16 - movs r4, 0 - movs r7, 0 - movs r6, 0 -_0806DAF0: - adds r1, r6, 0 - adds r1, 0x1A - mov r0, r8 - movs r2, 0 - bl GetMonData - mov r2, sp - adds r1, r2, r6 - strb r0, [r1] - ldrb r0, [r1] - adds r0, r7, r0 - lsls r0, 16 - lsrs r7, r0, 16 - adds r6, 0x1 - cmp r6, 0x5 - ble _0806DAF0 - movs r6, 0 - b _0806DC72 -_0806DB14: - mov r0, r8 - movs r1, 0 - bl CheckPartyHasHadPokerus - lsls r0, 24 - movs r2, 0x1 - cmp r0, 0 - beq _0806DB26 - movs r2, 0x2 -_0806DB26: - cmp r6, 0x5 - bhi _0806DBC8 - lsls r0, r6, 2 - ldr r1, =_0806DB38 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0806DB38: - .4byte _0806DB50 - .4byte _0806DB64 - .4byte _0806DB78 - .4byte _0806DB8C - .4byte _0806DBA0 - .4byte _0806DBB4 -_0806DB50: - ldr r0, =gBaseStats - lsls r1, r5, 3 - subs r1, r5 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0xA] - lsls r0, 30 - b _0806DBC2 - .pool -_0806DB64: - ldr r0, =gBaseStats - lsls r1, r5, 3 - subs r1, r5 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0xA] - b _0806DBC0 - .pool -_0806DB78: - ldr r0, =gBaseStats - lsls r1, r5, 3 - subs r1, r5 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0xA] - lsls r0, 26 - b _0806DBC2 - .pool -_0806DB8C: - ldr r0, =gBaseStats - lsls r1, r5, 3 - subs r1, r5 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0xA] - lsrs r0, 6 - b _0806DBC4 - .pool -_0806DBA0: - ldr r0, =gBaseStats - lsls r1, r5, 3 - subs r1, r5 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0xB] - lsls r0, 30 - b _0806DBC2 - .pool -_0806DBB4: - ldr r0, =gBaseStats - lsls r1, r5, 3 - subs r1, r5 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0xB] -_0806DBC0: - lsls r0, 28 -_0806DBC2: - lsrs r0, 30 -_0806DBC4: - adds r4, r0, 0 - muls r4, r2 -_0806DBC8: - mov r0, r8 - movs r1, 0xC - movs r2, 0 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xAF - bne _0806DC14 - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0806DC00 - ldr r0, =gEnigmaBerries - ldrb r0, [r0, 0x7] - b _0806DC1C - .pool -_0806DC00: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x00003226 - adds r0, r2 - ldrb r0, [r0] - b _0806DC1C - .pool -_0806DC14: - bl ItemId_GetHoldEffect - lsls r0, 24 - lsrs r0, 24 -_0806DC1C: - cmp r0, 0x18 - bne _0806DC24 - lsls r0, r4, 17 - lsrs r4, r0, 16 -_0806DC24: - lsls r0, r4, 16 - asrs r2, r0, 16 - adds r1, r7, r2 - movs r0, 0xFF - lsls r0, 1 - cmp r1, r0 - ble _0806DC3C - adds r0, r2, r0 - adds r1, r7, r4 - subs r0, r1 - lsls r0, 16 - lsrs r4, r0, 16 -_0806DC3C: - mov r0, sp - adds r2, r0, r6 - ldrb r3, [r2] - lsls r0, r4, 16 - asrs r1, r0, 16 - adds r0, r3, r1 - cmp r0, 0xFF - ble _0806DC58 - adds r0, r1, 0 - adds r0, 0xFF - adds r1, r3, r4 - subs r0, r1 - lsls r0, 16 - lsrs r4, r0, 16 -_0806DC58: - adds r0, r3, r4 - strb r0, [r2] - adds r0, r7, r4 - lsls r0, 16 - lsrs r7, r0, 16 - adds r1, r6, 0 - adds r1, 0x1A - mov r0, r8 - bl SetMonData - adds r6, 0x1 - cmp r6, 0x5 - bgt _0806DC7A -_0806DC72: - ldr r0, =0x000001fd - cmp r7, r0 - bhi _0806DC7A - b _0806DB14 -_0806DC7A: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end MonGainEVs - - thumb_func_start GetMonEVCount -GetMonEVCount: @ 806DC8C - push {r4-r6,lr} - adds r6, r0, 0 - movs r5, 0 - movs r4, 0 -_0806DC94: - adds r1, r4, 0 - adds r1, 0x1A - adds r0, r6, 0 - movs r2, 0 - bl GetMonData - adds r0, r5, r0 - lsls r0, 16 - lsrs r5, r0, 16 - adds r4, 0x1 - cmp r4, 0x5 - ble _0806DC94 - adds r0, r5, 0 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end GetMonEVCount - - thumb_func_start RandomlyGivePartyPokerus -RandomlyGivePartyPokerus: @ 806DCB4 - push {r4-r6,lr} - sub sp, 0x4 - adds r6, r0, 0 - bl Random - lsls r0, 16 - lsrs r5, r0, 16 - movs r0, 0x80 - lsls r0, 7 - cmp r5, r0 - beq _0806DCDA - movs r0, 0x80 - lsls r0, 8 - cmp r5, r0 - beq _0806DCDA - movs r0, 0xC0 - lsls r0, 8 - cmp r5, r0 - bne _0806DD70 -_0806DCDA: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x6 - bl __umodsi3 - lsls r0, 16 - lsrs r5, r0, 16 - movs r0, 0x64 - muls r0, r5 - adds r4, r6, r0 - adds r0, r4, 0 - movs r1, 0xB - movs r2, 0 - bl GetMonData - cmp r0, 0 - beq _0806DCDA - adds r0, r4, 0 - movs r1, 0x2D - movs r2, 0 - bl GetMonData - cmp r0, 0 - bne _0806DCDA - ldr r1, =gBitTable - lsls r0, r5, 2 - adds r0, r1 - ldrb r1, [r0] - adds r0, r6, 0 - bl CheckPartyHasHadPokerus - lsls r0, 24 - cmp r0, 0 - bne _0806DD70 - movs r4, 0x7 -_0806DD24: - bl Random - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - strb r0, [r1] - adds r2, r0, 0 - adds r1, r2, 0 - ands r1, r4 - cmp r1, 0 - beq _0806DD24 - movs r0, 0xF0 - ands r0, r2 - cmp r0, 0 - beq _0806DD46 - mov r0, sp - strb r1, [r0] -_0806DD46: - mov r0, sp - ldrb r0, [r0] - lsls r1, r0, 4 - orrs r0, r1 - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - strb r0, [r1] - movs r1, 0xF3 - ands r1, r0 - mov r0, sp - strb r1, [r0] - adds r1, 0x1 - strb r1, [r0] - movs r0, 0x64 - muls r0, r5 - adds r0, r6, r0 - movs r1, 0x22 - mov r2, sp - bl SetMonData -_0806DD70: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RandomlyGivePartyPokerus - - thumb_func_start CheckPartyPokerus -CheckPartyPokerus: @ 806DD7C - push {r4-r7,lr} - sub sp, 0x4 - adds r7, r0, 0 - lsls r1, 24 - lsrs r4, r1, 24 - movs r3, 0 - movs r6, 0x1 - movs r5, 0 - cmp r4, 0 - beq _0806DDC4 -_0806DD90: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0806DDB8 - movs r0, 0x64 - muls r0, r3 - adds r0, r7, r0 - movs r1, 0x22 - movs r2, 0 - str r3, [sp] - bl GetMonData - movs r1, 0xF - ands r1, r0 - ldr r3, [sp] - cmp r1, 0 - beq _0806DDB8 - orrs r5, r6 - lsls r0, r5, 24 - lsrs r5, r0, 24 -_0806DDB8: - adds r3, 0x1 - lsls r6, 1 - lsrs r4, 1 - cmp r4, 0 - bne _0806DD90 - b _0806DDD8 -_0806DDC4: - adds r0, r7, 0 - movs r1, 0x22 - movs r2, 0 - bl GetMonData - movs r1, 0xF - ands r1, r0 - cmp r1, 0 - beq _0806DDD8 - movs r5, 0x1 -_0806DDD8: - adds r0, r5, 0 - add sp, 0x4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end CheckPartyPokerus - - thumb_func_start CheckPartyHasHadPokerus -CheckPartyHasHadPokerus: @ 806DDE4 - push {r4-r7,lr} - sub sp, 0x4 - adds r7, r0, 0 - lsls r1, 24 - lsrs r4, r1, 24 - movs r3, 0 - movs r6, 0x1 - movs r5, 0 - cmp r4, 0 - beq _0806DE28 -_0806DDF8: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0806DE1C - movs r0, 0x64 - muls r0, r3 - adds r0, r7, r0 - movs r1, 0x22 - movs r2, 0 - str r3, [sp] - bl GetMonData - ldr r3, [sp] - cmp r0, 0 - beq _0806DE1C - orrs r5, r6 - lsls r0, r5, 24 - lsrs r5, r0, 24 -_0806DE1C: - adds r3, 0x1 - lsls r6, 1 - lsrs r4, 1 - cmp r4, 0 - bne _0806DDF8 - b _0806DE38 -_0806DE28: - adds r0, r7, 0 - movs r1, 0x22 - movs r2, 0 - bl GetMonData - cmp r0, 0 - beq _0806DE38 - movs r5, 0x1 -_0806DE38: - adds r0, r5, 0 - add sp, 0x4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end CheckPartyHasHadPokerus - - thumb_func_start UpdatePartyPokerusTime -UpdatePartyPokerusTime: @ 806DE44 - push {r4-r7,lr} - sub sp, 0x4 - lsls r0, 16 - lsrs r7, r0, 16 - movs r6, 0 - mov r5, sp -_0806DE50: - movs r0, 0x64 - adds r1, r6, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0xB - movs r2, 0 - bl GetMonData - cmp r0, 0 - beq _0806DEB2 - adds r0, r4, 0 - movs r1, 0x22 - movs r2, 0 - bl GetMonData - lsls r0, 24 - lsrs r0, 24 - strb r0, [r5] - movs r1, 0xF - adds r2, r0, 0 - ands r1, r2 - cmp r1, 0 - beq _0806DEB2 - cmp r1, r7 - bcc _0806DE8A - cmp r7, 0x4 - bls _0806DE94 -_0806DE8A: - movs r0, 0xF0 - ands r0, r2 - b _0806DE96 - .pool -_0806DE94: - subs r0, r2, r7 -_0806DE96: - strb r0, [r5] - ldrb r0, [r5] - cmp r0, 0 - bne _0806DEA2 - movs r0, 0x10 - strb r0, [r5] -_0806DEA2: - movs r0, 0x64 - muls r0, r6 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x22 - mov r2, sp - bl SetMonData -_0806DEB2: - adds r6, 0x1 - cmp r6, 0x5 - ble _0806DE50 - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end UpdatePartyPokerusTime - - thumb_func_start PartySpreadPokerus -PartySpreadPokerus: @ 806DEC4 - push {r4-r7,lr} - sub sp, 0x4 - adds r7, r0, 0 - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl __umodsi3 - lsls r0, 16 - cmp r0, 0 - bne _0806DF6A - movs r5, 0 -_0806DEE0: - movs r0, 0x64 - adds r6, r5, 0 - muls r6, r0 - adds r4, r7, r6 - adds r0, r4, 0 - movs r1, 0xB - movs r2, 0 - bl GetMonData - cmp r0, 0 - beq _0806DF64 - adds r0, r4, 0 - movs r1, 0x22 - movs r2, 0 - bl GetMonData - lsls r0, 24 - lsrs r1, r0, 24 - mov r0, sp - strb r1, [r0] - cmp r1, 0 - beq _0806DF64 - movs r0, 0xF - ands r0, r1 - cmp r0, 0 - beq _0806DF64 - cmp r5, 0 - beq _0806DF3A - adds r0, r6, 0 - subs r0, 0x64 - adds r4, r7, r0 - adds r0, r4, 0 - movs r1, 0x22 - movs r2, 0 - bl GetMonData - movs r1, 0xF0 - ands r1, r0 - cmp r1, 0 - bne _0806DF3A - adds r0, r4, 0 - movs r1, 0x22 - mov r2, sp - bl SetMonData -_0806DF3A: - cmp r5, 0x5 - beq _0806DF64 - movs r0, 0x64 - muls r0, r5 - adds r0, 0x64 - adds r4, r7, r0 - adds r0, r4, 0 - movs r1, 0x22 - movs r2, 0 - bl GetMonData - movs r1, 0xF0 - ands r1, r0 - cmp r1, 0 - bne _0806DF64 - adds r0, r4, 0 - movs r1, 0x22 - mov r2, sp - bl SetMonData - adds r5, 0x1 -_0806DF64: - adds r5, 0x1 - cmp r5, 0x5 - ble _0806DEE0 -_0806DF6A: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end PartySpreadPokerus - - thumb_func_start TryIncrementMonLevel -TryIncrementMonLevel: @ 806DF74 - push {r4-r6,lr} - sub sp, 0x8 - adds r5, r0, 0 - movs r1, 0xB - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r5, 0 - movs r1, 0x38 - movs r2, 0 - bl GetMonData - adds r0, 0x1 - mov r1, sp - strb r0, [r1] - adds r0, r5, 0 - movs r1, 0x19 - movs r2, 0 - bl GetMonData - str r0, [sp, 0x4] - ldr r6, =gExperienceTables - ldr r2, =gBaseStats - lsls r1, r4, 3 - subs r1, r4 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1, 0x13] - movs r1, 0xCA - lsls r1, 1 - adds r4, r2, 0 - muls r4, r1 - movs r2, 0xC8 - lsls r2, 1 - adds r1, r6, r2 - adds r1, r4, r1 - ldr r1, [r1] - cmp r0, r1 - bls _0806DFD4 - str r1, [sp, 0x4] - add r2, sp, 0x4 - adds r0, r5, 0 - movs r1, 0x19 - bl SetMonData -_0806DFD4: - mov r0, sp - ldrb r0, [r0] - cmp r0, 0x64 - bhi _0806DFEA - lsls r0, 2 - adds r0, r4 - adds r0, r6 - ldr r1, [sp, 0x4] - ldr r0, [r0] - cmp r1, r0 - bcs _0806DFF8 -_0806DFEA: - movs r0, 0 - b _0806E004 - .pool -_0806DFF8: - adds r0, r5, 0 - movs r1, 0x38 - mov r2, sp - bl SetMonData - movs r0, 0x1 -_0806E004: - add sp, 0x8 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end TryIncrementMonLevel - - thumb_func_start CanMonLearnTMHM -CanMonLearnTMHM: @ 806E00C - push {r4,r5,lr} - lsls r1, 24 - lsrs r4, r1, 24 - adds r5, r4, 0 - movs r1, 0x41 - movs r2, 0 - bl GetMonData - lsls r0, 16 - lsrs r1, r0, 16 - adds r3, r1, 0 - movs r0, 0xCE - lsls r0, 1 - cmp r1, r0 - bne _0806E02E - movs r0, 0 - b _0806E05A -_0806E02E: - cmp r4, 0x1F - bls _0806E04C - adds r0, r4, 0 - subs r0, 0x20 - movs r2, 0x1 - lsls r2, r0 - ldr r0, =gTMHMLearnsets - lsls r1, 3 - adds r0, 0x4 - adds r1, r0 - ldr r0, [r1] - ands r0, r2 - b _0806E05A - .pool -_0806E04C: - movs r1, 0x1 - lsls r1, r5 - ldr r2, =gTMHMLearnsets - lsls r0, r3, 3 - adds r0, r2 - ldr r0, [r0] - ands r0, r1 -_0806E05A: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end CanMonLearnTMHM - - thumb_func_start CanSpeciesLearnTMHM -CanSpeciesLearnTMHM: @ 806E064 - push {r4,lr} - lsls r0, 16 - lsrs r3, r0, 16 - adds r4, r3, 0 - lsls r1, 24 - lsrs r1, 24 - adds r2, r1, 0 - movs r0, 0xCE - lsls r0, 1 - cmp r3, r0 - bne _0806E07E - movs r0, 0 - b _0806E0AA -_0806E07E: - cmp r1, 0x1F - bls _0806E09C - adds r0, r1, 0 - subs r0, 0x20 - movs r2, 0x1 - lsls r2, r0 - ldr r0, =gTMHMLearnsets - lsls r1, r3, 3 - adds r0, 0x4 - adds r1, r0 - ldr r0, [r1] - ands r0, r2 - b _0806E0AA - .pool -_0806E09C: - movs r1, 0x1 - lsls r1, r2 - ldr r2, =gTMHMLearnsets - lsls r0, r4, 3 - adds r0, r2 - ldr r0, [r0] - ands r0, r1 -_0806E0AA: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end CanSpeciesLearnTMHM - - thumb_func_start GetMoveRelearnerMoves -GetMoveRelearnerMoves: @ 806E0B4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - adds r6, r0, 0 - str r1, [sp, 0x8] - movs r0, 0 - mov r10, r0 - adds r0, r6, 0 - movs r1, 0xB - movs r2, 0 - bl GetMonData - lsls r0, 16 - lsrs r7, r0, 16 - adds r0, r6, 0 - movs r1, 0x38 - movs r2, 0 - bl GetMonData - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0xC] - movs r5, 0 - mov r4, sp -_0806E0EA: - adds r1, r5, 0 - adds r1, 0xD - adds r0, r6, 0 - movs r2, 0 - bl GetMonData - strh r0, [r4] - adds r4, 0x2 - adds r5, 0x1 - cmp r5, 0x3 - ble _0806E0EA - movs r5, 0 - ldr r6, =gLevelUpLearnsets - lsls r1, r7, 2 - adds r2, r1, r6 - ldr r3, [r2] - ldrh r0, [r3] - ldr r4, =0x0000ffff - str r1, [sp, 0x14] - cmp r0, r4 - beq _0806E1E4 - mov r9, r2 - str r3, [sp, 0x10] -_0806E118: - lsls r2, r5, 1 - ldr r1, [sp, 0x10] - adds r0, r2, r1 - ldrh r3, [r0] - movs r0, 0xFE - lsls r0, 8 - ands r0, r3 - ldr r4, [sp, 0xC] - lsls r1, r4, 9 - adds r7, r2, 0 - adds r5, 0x1 - mov r12, r5 - cmp r0, r1 - bgt _0806E1CE - movs r4, 0 - mov r0, sp - ldrh r1, [r0] - ldr r0, =0x000001ff - ands r0, r3 - cmp r1, r0 - beq _0806E168 - ldr r0, [sp, 0x14] - ldr r1, =gLevelUpLearnsets - adds r6, r0, r1 - ldr r2, =0x000001ff - mov r8, r2 - mov r3, sp - adds r5, r7, 0 -_0806E150: - adds r3, 0x2 - adds r4, 0x1 - cmp r4, 0x3 - bgt _0806E168 - ldr r0, [r6] - adds r0, r5, r0 - ldrh r1, [r0] - ldrh r2, [r3] - mov r0, r8 - ands r0, r1 - cmp r2, r0 - bne _0806E150 -_0806E168: - cmp r4, 0x4 - bne _0806E1CE - movs r4, 0 - cmp r4, r10 - bge _0806E1AC - mov r1, r9 - ldr r0, [r1] - adds r0, r7, r0 - ldrh r1, [r0] - ldr r0, [sp, 0x8] - ldrh r2, [r0] - ldr r0, =0x000001ff - ands r0, r1 - cmp r2, r0 - beq _0806E1AC - ldr r1, [sp, 0x14] - ldr r2, =gLevelUpLearnsets - adds r6, r1, r2 - ldr r0, =0x000001ff - mov r8, r0 - ldr r3, [sp, 0x8] - adds r5, r7, 0 -_0806E194: - adds r3, 0x2 - adds r4, 0x1 - cmp r4, r10 - bge _0806E1AC - ldr r0, [r6] - adds r0, r5, r0 - ldrh r1, [r0] - ldrh r2, [r3] - mov r0, r8 - ands r0, r1 - cmp r2, r0 - bne _0806E194 -_0806E1AC: - cmp r4, r10 - bne _0806E1CE - mov r0, r10 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - lsls r2, r4, 1 - ldr r1, [sp, 0x8] - adds r2, r1 - mov r4, r9 - ldr r0, [r4] - adds r0, r7, r0 - ldrh r1, [r0] - ldr r0, =0x000001ff - ands r0, r1 - strh r0, [r2] -_0806E1CE: - mov r5, r12 - cmp r5, 0x13 - bgt _0806E1E4 - mov r1, r9 - ldr r0, [r1] - lsls r1, r5, 1 - adds r1, r0 - ldrh r0, [r1] - ldr r2, =0x0000ffff - cmp r0, r2 - bne _0806E118 -_0806E1E4: - mov r0, r10 - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end GetMoveRelearnerMoves - - thumb_func_start GetLevelUpMovesBySpecies -GetLevelUpMovesBySpecies: @ 806E204 - push {r4-r7,lr} - adds r6, r1, 0 - lsls r0, 16 - movs r5, 0 - movs r4, 0 - ldr r1, =gLevelUpLearnsets - lsrs r0, 14 - adds r0, r1 - ldr r2, [r0] - ldrh r0, [r2] - ldr r1, =0x0000ffff - cmp r0, r1 - beq _0806E248 - ldr r0, =0x000001ff - mov r12, r0 - adds r7, r1, 0 - adds r3, r2, 0 -_0806E226: - adds r1, r5, 0 - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 1 - adds r1, r6 - ldrh r2, [r3] - mov r0, r12 - ands r0, r2 - strh r0, [r1] - adds r3, 0x2 - adds r4, 0x1 - cmp r4, 0x13 - bgt _0806E248 - ldrh r0, [r3] - cmp r0, r7 - bne _0806E226 -_0806E248: - adds r0, r5, 0 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end GetLevelUpMovesBySpecies - - thumb_func_start GetNumberOfRelearnableMoves -GetNumberOfRelearnableMoves: @ 806E25C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x3C - adds r6, r0, 0 - movs r0, 0 - mov r10, r0 - adds r0, r6, 0 - movs r1, 0x41 - movs r2, 0 - bl GetMonData - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r6, 0 - movs r1, 0x38 - movs r2, 0 - bl GetMonData - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x30] - movs r0, 0xCE - lsls r0, 1 - cmp r4, r0 - bne _0806E298 - movs r0, 0 - b _0806E3A2 -_0806E298: - movs r5, 0 - lsls r4, 2 - str r4, [sp, 0x38] - mov r4, sp -_0806E2A0: - adds r1, r5, 0 - adds r1, 0xD - adds r0, r6, 0 - movs r2, 0 - bl GetMonData - strh r0, [r4] - adds r4, 0x2 - adds r5, 0x1 - cmp r5, 0x3 - ble _0806E2A0 - movs r5, 0 - ldr r3, =gLevelUpLearnsets - ldr r2, [sp, 0x38] - adds r1, r2, r3 - ldr r0, [r1] - ldrh r0, [r0] - ldr r2, =0x0000ffff - cmp r0, r2 - beq _0806E3A0 - mov r9, r1 - mov r4, sp - adds r4, 0x8 - str r4, [sp, 0x34] -_0806E2D0: - mov r1, r9 - ldr r0, [r1] - lsls r2, r5, 1 - adds r0, r2, r0 - ldrh r3, [r0] - movs r0, 0xFE - lsls r0, 8 - ands r0, r3 - ldr r4, [sp, 0x30] - lsls r1, r4, 9 - adds r7, r2, 0 - adds r5, 0x1 - mov r12, r5 - cmp r0, r1 - bgt _0806E38A - movs r4, 0 - mov r0, sp - ldrh r1, [r0] - ldr r0, =0x000001ff - ands r0, r3 - cmp r1, r0 - beq _0806E322 - ldr r0, [sp, 0x38] - ldr r1, =gLevelUpLearnsets - adds r6, r0, r1 - ldr r2, =0x000001ff - mov r8, r2 - mov r3, sp - adds r5, r7, 0 -_0806E30A: - adds r3, 0x2 - adds r4, 0x1 - cmp r4, 0x3 - bgt _0806E322 - ldr r0, [r6] - adds r0, r5, r0 - ldrh r1, [r0] - ldrh r2, [r3] - mov r0, r8 - ands r0, r1 - cmp r2, r0 - bne _0806E30A -_0806E322: - cmp r4, 0x4 - bne _0806E38A - movs r4, 0 - cmp r4, r10 - bge _0806E368 - mov r1, r9 - ldr r0, [r1] - adds r0, r7, r0 - ldrh r1, [r0] - ldr r0, [sp, 0x34] - ldrh r2, [r0] - ldr r0, =0x000001ff - ands r0, r1 - add r1, sp, 0x8 - cmp r2, r0 - beq _0806E368 - ldr r2, [sp, 0x38] - ldr r0, =gLevelUpLearnsets - adds r6, r2, r0 - ldr r2, =0x000001ff - mov r8, r2 - adds r3, r1, 0 - adds r5, r7, 0 -_0806E350: - adds r3, 0x2 - adds r4, 0x1 - cmp r4, r10 - bge _0806E368 - ldr r0, [r6] - adds r0, r5, r0 - ldrh r1, [r0] - ldrh r2, [r3] - mov r0, r8 - ands r0, r1 - cmp r2, r0 - bne _0806E350 -_0806E368: - cmp r4, r10 - bne _0806E38A - mov r0, r10 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - lsls r2, r4, 1 - ldr r4, [sp, 0x34] - adds r2, r4, r2 - mov r1, r9 - ldr r0, [r1] - adds r0, r7, r0 - ldrh r1, [r0] - ldr r0, =0x000001ff - ands r0, r1 - strh r0, [r2] -_0806E38A: - mov r5, r12 - cmp r5, 0x13 - bgt _0806E3A0 - mov r2, r9 - ldr r0, [r2] - lsls r1, r5, 1 - adds r1, r0 - ldrh r0, [r1] - ldr r4, =0x0000ffff - cmp r0, r4 - bne _0806E2D0 -_0806E3A0: - mov r0, r10 -_0806E3A2: - add sp, 0x3C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end GetNumberOfRelearnableMoves - - thumb_func_start SpeciesToPokedexNum -SpeciesToPokedexNum: @ 806E3C0 - push {r4,lr} - lsls r0, 16 - lsrs r4, r0, 16 - bl IsNationalPokedexEnabled - cmp r0, 0 - beq _0806E3DA - adds r0, r4, 0 - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - b _0806E3F2 -_0806E3DA: - adds r0, r4, 0 - bl SpeciesToHoennPokedexNum - adds r4, r0, 0 - cmp r4, 0xCA - bls _0806E3F0 - ldr r0, =0x0000ffff - b _0806E3F2 - .pool -_0806E3F0: - adds r0, r4, 0 -_0806E3F2: - pop {r4} - pop {r1} - bx r1 - thumb_func_end SpeciesToPokedexNum - - thumb_func_start sub_806E3F8 -sub_806E3F8: @ 806E3F8 - push {lr} - lsls r0, 16 - lsrs r0, 16 - bl SpeciesToHoennPokedexNum - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xCA - bhi _0806E40E - movs r0, 0x1 - b _0806E410 -_0806E40E: - movs r0, 0 -_0806E410: - pop {r1} - bx r1 - thumb_func_end sub_806E3F8 - - thumb_func_start sub_806E414 -sub_806E414: @ 806E414 - push {lr} - ldr r1, =gUnknown_020244E4 - movs r2, 0 - adds r0, r1, 0x3 -_0806E41C: - strb r2, [r0] - subs r0, 0x1 - cmp r0, r1 - bge _0806E41C - pop {r0} - bx r0 - .pool - thumb_func_end sub_806E414 - - thumb_func_start song_id_for_battle -song_id_for_battle: @ 806E42C - push {lr} - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - movs r0, 0x80 - lsls r0, 5 - ands r0, r1 - cmp r0, 0 - beq _0806E448 - movs r0, 0xF0 - lsls r0, 1 - b _0806E646 - .pool -_0806E448: - movs r0, 0x80 - lsls r0, 7 - ands r0, r1 - cmp r0, 0 - beq _0806E45C - ldr r0, =0x000001df - b _0806E646 - .pool -_0806E45C: - ldr r0, =0x02000002 - ands r0, r1 - cmp r0, 0 - beq _0806E466 - b _0806E63C -_0806E466: - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - bne _0806E470 - b _0806E642 -_0806E470: - ldr r0, =0x003f0100 - ands r0, r1 - cmp r0, 0 - beq _0806E494 - ldr r0, =gTrainerBattleOpponent_A - ldrh r0, [r0] - bl sub_8162BD8 - lsls r0, 24 - lsrs r0, 24 - b _0806E4B2 - .pool -_0806E494: - movs r0, 0x80 - lsls r0, 19 - ands r1, r0 - cmp r1, 0 - beq _0806E4A2 - movs r0, 0xA - b _0806E4B2 -_0806E4A2: - ldr r2, =gTrainers - ldr r0, =gTrainerBattleOpponent_A - ldrh r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldrb r0, [r0, 0x1] -_0806E4B2: - subs r0, 0x3 - cmp r0, 0x3D - bls _0806E4BA - b _0806E63C -_0806E4BA: - lsls r0, 2 - ldr r1, =_0806E4D0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0806E4D0: - .4byte _0806E5D0 - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E5D0 - .4byte _0806E63C - .4byte _0806E5D0 - .4byte _0806E63C - .4byte _0806E5C8 - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E62C - .4byte _0806E5D8 - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E5E0 - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E5D0 - .4byte _0806E5E6 - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E5C8 - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E63C - .4byte _0806E632 - .4byte _0806E632 - .4byte _0806E632 - .4byte _0806E632 - .4byte _0806E632 - .4byte _0806E632 - .4byte _0806E632 -_0806E5C8: - ldr r0, =0x000001e3 - b _0806E646 - .pool -_0806E5D0: - ldr r0, =0x000001db - b _0806E646 - .pool -_0806E5D8: - ldr r0, =0x000001dd - b _0806E646 - .pool -_0806E5E0: - movs r0, 0xEF - lsls r0, 1 - b _0806E646 -_0806E5E6: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - ldr r1, =0x003f0100 - ands r0, r1 - cmp r0, 0 - beq _0806E604 -_0806E5F2: - ldr r0, =0x000001e1 - b _0806E646 - .pool -_0806E604: - ldr r0, =gTrainerBattleOpponent_A - ldrh r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - ldr r1, =gTrainers + 0x4 @ name offset - adds r0, r1 - ldr r1, =gUnknown_085CCB98 - bl StringCompare - cmp r0, 0 - beq _0806E63C - b _0806E5F2 - .pool -_0806E62C: - movs r0, 0xF1 - lsls r0, 1 - b _0806E646 -_0806E632: - ldr r0, =0x000001d7 - b _0806E646 - .pool -_0806E63C: - movs r0, 0xEE - lsls r0, 1 - b _0806E646 -_0806E642: - movs r0, 0xED - lsls r0, 1 -_0806E646: - pop {r1} - bx r1 - thumb_func_end song_id_for_battle - - thumb_func_start sub_806E64C -sub_806E64C: @ 806E64C - push {lr} - bl ResetMapMusic - bl m4aMPlayAllStop - bl song_id_for_battle - lsls r0, 16 - lsrs r0, 16 - bl PlayBGM - pop {r0} - bx r0 - thumb_func_end sub_806E64C - - thumb_func_start PlayNewMapMusic__default_for_battle -PlayNewMapMusic__default_for_battle: @ 806E668 - push {r4,lr} - lsls r0, 16 - lsrs r4, r0, 16 - bl ResetMapMusic - bl m4aMPlayAllStop - cmp r4, 0 - beq _0806E682 - adds r0, r4, 0 - bl PlayNewMapMusic - b _0806E68E -_0806E682: - bl song_id_for_battle - lsls r0, 16 - lsrs r0, 16 - bl PlayNewMapMusic -_0806E68E: - pop {r4} - pop {r0} - bx r0 - thumb_func_end PlayNewMapMusic__default_for_battle - - thumb_func_start sub_806E694 -sub_806E694: @ 806E694 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - bl ResetMapMusic - bl m4aMPlayAllStop - ldr r0, =sub_806E6CC - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0x8] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_806E694 - - thumb_func_start sub_806E6CC -sub_806E6CC: @ 806E6CC - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r1, r0, r1 - movs r2, 0x8 - ldrsh r0, [r1, r2] - cmp r0, 0 - beq _0806E6F0 - ldrh r0, [r1, 0x8] - bl PlayNewMapMusic - b _0806E6FC - .pool -_0806E6F0: - bl song_id_for_battle - lsls r0, 16 - lsrs r0, 16 - bl PlayNewMapMusic -_0806E6FC: - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_806E6CC - - thumb_func_start pokemon_get_pal -pokemon_get_pal: @ 806E708 - push {r4-r6,lr} - adds r5, r0, 0 - movs r1, 0x41 - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r5, 0 - movs r1, 0x1 - movs r2, 0 - bl GetMonData - adds r6, r0, 0 - adds r0, r5, 0 - movs r1, 0 - movs r2, 0 - bl GetMonData - adds r2, r0, 0 - adds r0, r4, 0 - adds r1, r6, 0 - bl species_and_otid_get_pal - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end pokemon_get_pal - - thumb_func_start species_and_otid_get_pal -species_and_otid_get_pal: @ 806E740 - push {r4,r5,lr} - adds r3, r2, 0 - lsls r0, 16 - lsrs r4, r0, 16 - adds r5, r4, 0 - movs r0, 0xCE - lsls r0, 1 - cmp r4, r0 - bls _0806E75C - ldr r0, =gMonPaletteTable - ldr r0, [r0] - b _0806E788 - .pool -_0806E75C: - lsrs r0, r1, 16 - ldr r2, =0x0000ffff - ands r1, r2 - eors r0, r1 - lsrs r1, r3, 16 - eors r0, r1 - ands r3, r2 - eors r0, r3 - cmp r0, 0x7 - bls _0806E780 - ldr r0, =gMonPaletteTable - lsls r1, r4, 3 - b _0806E784 - .pool -_0806E780: - ldr r0, =gMonShinyPaletteTable - lsls r1, r5, 3 -_0806E784: - adds r1, r0 - ldr r0, [r1] -_0806E788: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end species_and_otid_get_pal - - thumb_func_start sub_806E794 -sub_806E794: @ 806E794 - push {r4-r6,lr} - adds r5, r0, 0 - movs r1, 0x41 - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r5, 0 - movs r1, 0x1 - movs r2, 0 - bl GetMonData - adds r6, r0, 0 - adds r0, r5, 0 - movs r1, 0 - movs r2, 0 - bl GetMonData - adds r2, r0, 0 - adds r0, r4, 0 - adds r1, r6, 0 - bl sub_806E7CC - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_806E794 - - thumb_func_start sub_806E7CC -sub_806E7CC: @ 806E7CC - push {r4,lr} - lsls r0, 16 - lsrs r4, r0, 16 - lsrs r0, r1, 16 - ldr r3, =0x0000ffff - ands r1, r3 - eors r0, r1 - lsrs r1, r2, 16 - eors r0, r1 - ands r2, r3 - eors r0, r2 - cmp r0, 0x7 - bls _0806E7F4 - lsls r0, r4, 3 - ldr r1, =gMonPaletteTable - b _0806E7F8 - .pool -_0806E7F4: - lsls r0, r4, 3 - ldr r1, =gMonShinyPaletteTable -_0806E7F8: - adds r0, r1 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_806E7CC - - thumb_func_start IsHMMove2 -IsHMMove2: @ 806E804 - push {r4,lr} - lsls r0, 16 - lsrs r3, r0, 16 - ldr r2, =gHMMoves - ldrh r0, [r2] - ldr r1, =0x0000ffff - cmp r0, r1 - beq _0806E836 - adds r4, r1, 0 - adds r1, r2, 0 -_0806E818: - ldrh r0, [r2] - adds r1, 0x2 - adds r2, 0x2 - cmp r0, r3 - bne _0806E830 - movs r0, 0x1 - b _0806E838 - .pool -_0806E830: - ldrh r0, [r1] - cmp r0, r4 - bne _0806E818 -_0806E836: - movs r0, 0 -_0806E838: - pop {r4} - pop {r1} - bx r1 - thumb_func_end IsHMMove2 - - thumb_func_start sub_806E840 -sub_806E840: @ 806E840 - lsls r0, 16 - lsrs r0, 16 - ldr r2, =gBaseStats - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r0, [r1, 0x19] - lsrs r0, 7 - bx lr - .pool - thumb_func_end sub_806E840 - - thumb_func_start GetMonFlavourRelation -GetMonFlavourRelation: @ 806E858 - push {r4,lr} - lsls r4, r1, 24 - lsrs r4, 24 - bl GetNature - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gPokeblockFlavorCompatibilityTable - lsls r1, r0, 2 - adds r1, r0 - adds r1, r4 - adds r1, r2 - movs r0, 0 - ldrsb r0, [r1, r0] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end GetMonFlavourRelation - - thumb_func_start GetFlavourRelationByPersonality -GetFlavourRelationByPersonality: @ 806E880 - push {r4,lr} - lsls r4, r1, 24 - lsrs r4, 24 - bl GetNatureFromPersonality - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gPokeblockFlavorCompatibilityTable - lsls r1, r0, 2 - adds r1, r0 - adds r1, r4 - adds r1, r2 - movs r0, 0 - ldrsb r0, [r1, r0] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end GetFlavourRelationByPersonality - - thumb_func_start IsTradedMon -IsTradedMon: @ 806E8A8 - push {r4,lr} - sub sp, 0x8 - adds r4, r0, 0 - movs r1, 0x7 - mov r2, sp - bl GetMonData - adds r0, r4, 0 - movs r1, 0x1 - movs r2, 0 - bl GetMonData - mov r1, sp - bl IsOtherTrainer - lsls r0, 24 - lsrs r0, 24 - add sp, 0x8 - pop {r4} - pop {r1} - bx r1 - thumb_func_end IsTradedMon - - thumb_func_start IsOtherTrainer -IsOtherTrainer: @ 806E8D4 - push {r4,r5,lr} - adds r5, r1, 0 - ldr r1, =gSaveBlock2Ptr - ldr r3, [r1] - ldrb r2, [r3, 0xA] - ldrb r1, [r3, 0xB] - lsls r1, 8 - orrs r2, r1 - ldrb r1, [r3, 0xC] - lsls r1, 16 - orrs r2, r1 - ldrb r1, [r3, 0xD] - lsls r1, 24 - orrs r2, r1 - cmp r0, r2 - bne _0806E91C - movs r4, 0 - ldrb r0, [r5] - cmp r0, 0xFF - beq _0806E912 - adds r2, r5, 0 -_0806E8FE: - adds r1, r3, r4 - ldrb r0, [r2] - ldrb r1, [r1] - cmp r0, r1 - bne _0806E91C - adds r2, 0x1 - adds r4, 0x1 - ldrb r0, [r2] - cmp r0, 0xFF - bne _0806E8FE -_0806E912: - movs r0, 0 - b _0806E91E - .pool -_0806E91C: - movs r0, 0x1 -_0806E91E: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end IsOtherTrainer - - thumb_func_start MonRestorePP -MonRestorePP: @ 806E924 - push {lr} - bl BoxMonRestorePP - pop {r0} - bx r0 - thumb_func_end MonRestorePP - - thumb_func_start BoxMonRestorePP -BoxMonRestorePP: @ 806E930 - push {r4-r6,lr} - sub sp, 0x4 - adds r5, r0, 0 - movs r6, 0 -_0806E938: - adds r4, r6, 0 - adds r4, 0xD - adds r0, r5, 0 - adds r1, r4, 0 - movs r2, 0 - bl GetBoxMonData - cmp r0, 0 - beq _0806E984 - adds r0, r5, 0 - adds r1, r4, 0 - movs r2, 0 - bl GetBoxMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r5, 0 - movs r1, 0x15 - movs r2, 0 - bl GetBoxMonData - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - lsls r2, r6, 24 - lsrs r2, 24 - adds r0, r4, 0 - bl CalculatePPWithBonus - mov r1, sp - strb r0, [r1] - adds r1, r6, 0 - adds r1, 0x11 - adds r0, r5, 0 - mov r2, sp - bl SetBoxMonData -_0806E984: - adds r6, 0x1 - cmp r6, 0x3 - ble _0806E938 - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end BoxMonRestorePP - - thumb_func_start sub_806E994 -sub_806E994: @ 806E994 - push {r4,r5,lr} - ldr r2, =gLastUsedAbility - ldr r5, =gBattleStruct - ldr r1, [r5] - adds r0, r1, 0 - adds r0, 0xB0 - ldrb r0, [r0] - strb r0, [r2] - ldr r4, =gBattleTextBuff1 - movs r0, 0xFD - strb r0, [r4] - movs r0, 0x4 - strb r0, [r4, 0x1] - adds r1, 0x49 - ldrb r0, [r1] - strb r0, [r4, 0x2] - movs r0, 0xFF - strb r0, [r4, 0x4] - ldrb r0, [r1] - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0806E9E8 - ldr r1, =gBattlePartyID - ldr r0, [r5] - adds r0, 0x49 - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrb r0, [r0] - bl pokemon_order_func - b _0806E9F6 - .pool -_0806E9E8: - ldr r1, =gBattlePartyID - ldr r0, [r5] - adds r0, 0x49 - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] -_0806E9F6: - strb r0, [r4, 0x3] - ldr r4, =gBattleTextBuff2 - movs r0, 0xFD - strb r0, [r4] - movs r0, 0x4 - strb r0, [r4, 0x1] - ldr r1, =gUnknown_020244B8 - ldrb r0, [r1] - strb r0, [r4, 0x2] - ldr r2, =gBattlePartyID - ldrb r0, [r1] - lsls r0, 1 - adds r0, r2 - ldrb r0, [r0] - bl pokemon_order_func - strb r0, [r4, 0x3] - movs r0, 0xFF - strb r0, [r4, 0x4] - ldr r0, =gUnknown_085CB2A1 - ldr r1, =gStringVar4 - bl StrCpyDecodeBattle - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_806E994 - - thumb_func_start GetWildMonTableIdInAlteringCave -GetWildMonTableIdInAlteringCave: @ 806EA40 - push {lr} - lsls r0, 16 - lsrs r3, r0, 16 - movs r1, 0 - ldr r2, =gUnknown_08329EFC -_0806EA4A: - ldrh r0, [r2] - cmp r0, r3 - bne _0806EA58 - adds r0, r1, 0 - b _0806EA62 - .pool -_0806EA58: - adds r2, 0x4 - adds r1, 0x1 - cmp r1, 0x8 - ble _0806EA4A - movs r0, 0 -_0806EA62: - pop {r1} - bx r1 - thumb_func_end GetWildMonTableIdInAlteringCave - - thumb_func_start SetWildMonHeldItem -SetWildMonHeldItem: @ 806EA68 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - ldr r1, =0x00302008 - ands r0, r1 - cmp r0, 0 - beq _0806EA7C - b _0806EB90 -_0806EA7C: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x64 - bl __umodsi3 - lsls r0, 16 - lsrs r6, r0, 16 - ldr r0, =gEnemyParty - movs r1, 0xB - movs r2, 0 - bl GetMonData - lsls r0, 16 - lsrs r4, r0, 16 - movs r0, 0x2D - mov r8, r0 - movs r7, 0x5F - ldr r5, =gPlayerParty - adds r0, r5, 0 - movs r1, 0x6 - movs r2, 0 - bl GetMonData - cmp r0, 0 - bne _0806EAC6 - adds r0, r5, 0 - bl GetMonAbility - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xE - bne _0806EAC6 - movs r2, 0x14 - mov r8, r2 - movs r7, 0x50 -_0806EAC6: - ldr r0, =gMapHeader - ldrh r1, [r0, 0x12] - movs r0, 0xD2 - lsls r0, 1 - cmp r1, r0 - bne _0806EB2C - adds r0, r4, 0 - bl GetWildMonTableIdInAlteringCave - adds r2, r0, 0 - cmp r2, 0 - beq _0806EB04 - cmp r6, r7 - bcc _0806EB90 - ldr r0, =gEnemyParty - lsls r2, 2 - ldr r1, =gAlteringCaveWildMonHeldItems - b _0806EB6C - .pool -_0806EB04: - cmp r6, r8 - bcc _0806EB90 - cmp r6, r7 - bcs _0806EB18 - ldr r0, =gEnemyParty - lsls r2, r4, 3 - b _0806EB66 - .pool -_0806EB18: - ldr r0, =gEnemyParty - lsls r2, r4, 3 - subs r2, r4 - lsls r2, 2 - ldr r1, =gBaseStats + 0xe @ item 2 offset - b _0806EB6C - .pool -_0806EB2C: - ldr r0, =gBaseStats - mov r12, r0 - lsls r0, r4, 3 - subs r1, r0, r4 - lsls r5, r1, 2 - mov r2, r12 - adds r1, r5, r2 - ldrh r3, [r1, 0xC] - adds r2, r0, 0 - ldrh r1, [r1, 0xE] - cmp r3, r1 - bne _0806EB5C - cmp r3, 0 - beq _0806EB5C - ldr r0, =gEnemyParty - mov r2, r12 - adds r2, 0xC - adds r2, r5, r2 - b _0806EB6E - .pool -_0806EB5C: - cmp r6, r8 - bcc _0806EB90 - cmp r6, r7 - bcs _0806EB80 - ldr r0, =gEnemyParty -_0806EB66: - subs r2, r4 - lsls r2, 2 - ldr r1, =gBaseStats + 0xc @ item 1 offset -_0806EB6C: - adds r2, r1 -_0806EB6E: - movs r1, 0xC - bl SetMonData - b _0806EB90 - .pool -_0806EB80: - ldr r0, =gEnemyParty - subs r2, r4 - lsls r2, 2 - ldr r1, =gBaseStats + 0xe @ item 2 offset - adds r2, r1 - movs r1, 0xC - bl SetMonData -_0806EB90: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end SetWildMonHeldItem - - thumb_func_start IsMonShiny -IsMonShiny: @ 806EBA4 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x1 - movs r2, 0 - bl GetMonData - adds r5, r0, 0 - adds r0, r4, 0 - movs r1, 0 - movs r2, 0 - bl GetMonData - adds r1, r0, 0 - adds r0, r5, 0 - bl IsShinyOtIdPersonality - lsls r0, 24 - lsrs r0, 24 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end IsMonShiny - - thumb_func_start IsShinyOtIdPersonality -IsShinyOtIdPersonality: @ 806EBD0 - push {r4,lr} - movs r4, 0 - lsrs r2, r0, 16 - ldr r3, =0x0000ffff - ands r0, r3 - eors r2, r0 - lsrs r0, r1, 16 - eors r2, r0 - ands r1, r3 - eors r2, r1 - cmp r2, 0x7 - bhi _0806EBEA - movs r4, 0x1 -_0806EBEA: - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end IsShinyOtIdPersonality - - thumb_func_start sub_806EBF8 -sub_806EBF8: @ 806EBF8 - push {r4,lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 15 - ands r0, r1 - cmp r0, 0 - beq _0806EC3C - ldr r2, =gUnknown_02038BCE - ldrh r1, [r2] - ldr r0, =0x00000c03 - cmp r1, r0 - bne _0806EC28 - ldr r0, =gTrainers + TRAINER_STEVEN * 0x28 + 0x4 @ Steven's name - b _0806EC64 - .pool -_0806EC28: - ldr r4, =gStringVar1 - ldrh r1, [r2] - adds r0, r4, 0 - bl sub_8162E20 - adds r0, r4, 0 - b _0806EC64 - .pool -_0806EC3C: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gLinkPlayers - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - ldrh r1, [r1, 0x18] - movs r0, 0x2 - eors r0, r1 - bl sub_806D864 - adds r1, r0, 0 - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r4, 0x8 - adds r0, r4 -_0806EC64: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_806EBF8 - - thumb_func_start sub_806EC70 -sub_806EC70: @ 806EC70 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r2, r0, r1 - ldrh r0, [r2, 0xE] - subs r0, 0x1 - strh r0, [r2, 0xE] - lsls r0, 16 - cmp r0, 0 - bne _0806ECA0 - ldrh r0, [r2, 0x8] - ldrh r1, [r2, 0xA] - lsls r1, 16 - orrs r0, r1 - ldrb r1, [r2, 0xC] - bl sub_817F544 - adds r0, r4, 0 - bl DestroyTask -_0806ECA0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_806EC70 - - thumb_func_start sub_806ECAC -sub_806ECAC: @ 806ECAC - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r2, r0, r1 - ldrh r0, [r2, 0xE] - subs r0, 0x1 - strh r0, [r2, 0xE] - lsls r0, 16 - cmp r0, 0 - bne _0806ECE2 - ldrh r0, [r2, 0x8] - ldrh r1, [r2, 0xA] - lsls r1, 16 - orrs r0, r1 - ldrb r1, [r2, 0xC] - bl sub_817F578 - movs r0, 0xFF - bl sub_81C488C - adds r0, r4, 0 - bl DestroyTask -_0806ECE2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_806ECAC - - thumb_func_start sub_806ECEC -sub_806ECEC: @ 806ECEC - push {r4,r5,lr} - adds r5, r0, 0 - lsls r1, 16 - lsrs r4, r1, 16 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =gHitMarker - ldr r0, [r0] - movs r1, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0806ED30 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - ldr r1, =0x02000002 - ands r0, r1 - cmp r0, 0 - bne _0806ED30 - movs r0, 0x80 - orrs r3, r0 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_806ED40 - b _0806ED38 - .pool -_0806ED30: - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_806ED40 -_0806ED38: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_806ECEC - - thumb_func_start sub_806ED40 -sub_806ED40: @ 806ED40 - push {r4-r6,lr} - adds r5, r0, 0 - lsls r1, 16 - lsrs r4, r1, 16 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x7F - ands r0, r3 - cmp r0, 0 - beq _0806ED60 - cmp r0, 0x1 - beq _0806ED64 - movs r1, 0 - b _0806ED66 -_0806ED60: - movs r1, 0xE7 - b _0806ED66 -_0806ED64: - movs r1, 0x19 -_0806ED66: - movs r0, 0x80 - ands r0, r3 - cmp r0, 0 - beq _0806ED84 - cmp r2, 0 - bne _0806ED7C - lsls r1, 24 - asrs r1, 24 - adds r0, r4, 0 - bl PlayCry1 -_0806ED7C: - ldr r0, =SpriteCallbackDummy - b _0806EDFA - .pool -_0806ED84: - cmp r2, 0 - bne _0806EDA6 - lsls r1, 24 - asrs r1, 24 - adds r0, r4, 0 - bl PlayCry1 - adds r0, r4, 0 - bl sub_806F0D4 - lsls r0, 24 - cmp r0, 0 - beq _0806EDA6 - adds r0, r5, 0 - movs r1, 0x1 - bl StartSpriteAnim -_0806EDA6: - ldr r0, =gUnknown_08329B87 - subs r4, 0x1 - adds r6, r4, r0 - ldrb r0, [r6] - cmp r0, 0 - beq _0806EDEC - ldr r0, =sub_806EC70 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r5, [r1, 0x8] - lsrs r0, r5, 16 - strh r0, [r1, 0xA] - ldr r0, =gUnknown_083299EC - adds r0, r4, r0 - ldrb r0, [r0] - strh r0, [r1, 0xC] - ldrb r0, [r6] - strh r0, [r1, 0xE] - b _0806EDF8 - .pool -_0806EDEC: - ldr r0, =gUnknown_083299EC - adds r0, r4, r0 - ldrb r1, [r0] - adds r0, r5, 0 - bl sub_817F544 -_0806EDF8: - ldr r0, =nullsub_18 -_0806EDFA: - str r0, [r5, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_806ED40 - - thumb_func_start sub_806EE0C -sub_806EE0C: @ 806EE0C - push {r4-r6,lr} - adds r5, r0, 0 - lsls r1, 16 - lsrs r4, r1, 16 - lsls r2, 24 - cmp r2, 0 - bne _0806EE2E - adds r0, r4, 0 - bl sub_806F0D4 - lsls r0, 24 - cmp r0, 0 - beq _0806EE2E - adds r0, r5, 0 - movs r1, 0x1 - bl StartSpriteAnim -_0806EE2E: - ldr r0, =gUnknown_08329B87 - subs r4, 0x1 - adds r6, r4, r0 - ldrb r0, [r6] - cmp r0, 0 - beq _0806EE80 - ldr r0, =sub_806ECAC - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gTasks - lsls r2, r0, 2 - adds r2, r0 - lsls r2, 3 - adds r2, r1 - strh r5, [r2, 0x8] - lsrs r1, r5, 16 - strh r1, [r2, 0xA] - ldr r1, =gUnknown_083299EC - adds r1, r4, r1 - ldrb r1, [r1] - strh r1, [r2, 0xC] - ldrb r1, [r6] - strh r1, [r2, 0xE] - bl sub_81C488C - adds r0, r5, 0 - bl sub_817F60C - b _0806EE8C - .pool -_0806EE80: - ldr r0, =gUnknown_083299EC - adds r0, r4, r0 - ldrb r1, [r0] - adds r0, r5, 0 - bl sub_817F578 -_0806EE8C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_806EE0C - - thumb_func_start sub_806EE98 -sub_806EE98: @ 806EE98 - push {lr} - ldr r0, =sub_806ECAC - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _0806EEAC - bl DestroyTask -_0806EEAC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_806EE98 - - thumb_func_start sub_806EEB4 -sub_806EEB4: @ 806EEB4 - push {r4,lr} - adds r4, r0, 0 - lsls r1, 16 - lsrs r2, r1, 16 - ldr r0, =gHitMarker - ldr r0, [r0] - movs r1, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0806EEE8 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - ldr r1, =0x02000002 - ands r0, r1 - cmp r0, 0 - bne _0806EEE8 - ldr r0, =SpriteCallbackDummy - b _0806EEFC - .pool -_0806EEE8: - adds r0, r2, 0 - bl sub_817F474 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_817F594 - ldr r0, =nullsub_18 -_0806EEFC: - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_806EEB4 - - thumb_func_start sub_806EF08 -sub_806EF08: @ 806EF08 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r5, 0 - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gLinkPlayers - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r2 - ldrh r0, [r1, 0x18] - cmp r0, 0x1 - beq _0806EF4C - cmp r0, 0x1 - bgt _0806EF38 - cmp r0, 0 - beq _0806EF42 - b _0806EF56 - .pool -_0806EF38: - cmp r0, 0x2 - beq _0806EF42 - cmp r0, 0x3 - beq _0806EF4C - b _0806EF56 -_0806EF42: - movs r5, 0x3 - cmp r4, 0 - beq _0806EF56 - movs r5, 0x1 - b _0806EF56 -_0806EF4C: - negs r0, r4 - orrs r0, r4 - asrs r5, r0, 31 - movs r0, 0x2 - ands r5, r0 -_0806EF56: - movs r2, 0 - ldr r4, =gLinkPlayers - ldrh r0, [r4, 0x18] - adds r1, r5, 0 - cmp r0, r1 - beq _0806EF74 - adds r3, r1, 0 - adds r1, r4, 0 -_0806EF66: - adds r1, 0x1C - adds r2, 0x1 - cmp r2, 0x3 - bgt _0806EF74 - ldrh r0, [r1, 0x18] - cmp r0, r3 - bne _0806EF66 -_0806EF74: - lsls r0, r2, 24 - lsrs r0, 24 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_806EF08 - - thumb_func_start sub_806EF84 -sub_806EF84: @ 806EF84 - push {r4,lr} - lsls r0, 24 - lsrs r3, r0, 24 - lsls r1, 24 - lsrs r1, 24 - movs r4, 0 - ldr r2, =gLinkPlayers - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x18] - cmp r0, 0x1 - beq _0806EFC4 - cmp r0, 0x1 - bgt _0806EFB0 - cmp r0, 0 - beq _0806EFBA - b _0806EFCE - .pool -_0806EFB0: - cmp r0, 0x2 - beq _0806EFBA - cmp r0, 0x3 - beq _0806EFC4 - b _0806EFCE -_0806EFBA: - movs r4, 0x3 - cmp r3, 0 - beq _0806EFCE - movs r4, 0x1 - b _0806EFCE -_0806EFC4: - negs r0, r3 - orrs r0, r3 - asrs r4, r0, 31 - movs r0, 0x2 - ands r4, r0 -_0806EFCE: - movs r3, 0 - ldrh r0, [r2, 0x18] - adds r1, r4, 0 - cmp r0, r1 - beq _0806EFE6 -_0806EFD8: - adds r2, 0x1C - adds r3, 0x1 - cmp r3, 0x3 - bgt _0806EFE6 - ldrh r0, [r2, 0x18] - cmp r0, r1 - bne _0806EFD8 -_0806EFE6: - lsls r0, r3, 24 - lsrs r0, 24 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_806EF84 - - thumb_func_start TrainerClassToTrainerPic -@ u8 TrainerClassToTrainerPic(u16 trainerClassId) -TrainerClassToTrainerPic: @ 806EFF0 - lsls r0, 16 - lsrs r0, 16 - ldr r1, =gTrainerPicIndices - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end TrainerClassToTrainerPic - - thumb_func_start sub_806F000 -sub_806F000: @ 806F000 - push {lr} - lsls r0, 24 - cmp r0, 0 - bne _0806F00C - movs r0, 0x3C - b _0806F00E -_0806F00C: - movs r0, 0x3F -_0806F00E: - bl TrainerClassToTrainerPic - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end sub_806F000 - - thumb_func_start SetPokedexFlag -@ void SetPokedexFlag(u16 nationalPokedexNum, u8 op, u32 personality) -SetPokedexFlag: @ 806F01C - push {r4-r7,lr} - adds r7, r2, 0 - lsls r0, 16 - lsrs r4, r0, 16 - adds r6, r4, 0 - lsls r1, 24 - lsrs r5, r1, 24 - movs r0, 0x2 - eors r0, r5 - negs r1, r0 - orrs r1, r0 - lsrs r1, 31 - adds r0, r4, 0 - bl pokedex_flag_operation - lsls r0, 24 - cmp r0, 0 - bne _0806F072 - adds r0, r4, 0 - adds r1, r5, 0 - bl pokedex_flag_operation - adds r0, r4, 0 - bl NationalPokedexNumToSpecies - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xC9 - bne _0806F05C - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - str r7, [r0, 0x1C] -_0806F05C: - adds r0, r6, 0 - bl NationalPokedexNumToSpecies - lsls r0, 16 - movs r1, 0x9A - lsls r1, 17 - cmp r0, r1 - bne _0806F072 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - str r7, [r0, 0x20] -_0806F072: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end SetPokedexFlag - - thumb_func_start sub_806F07C -sub_806F07C: @ 806F07C - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - ldr r0, =0x00000356 - cmp r2, r0 - bls _0806F08A - movs r2, 0 -_0806F08A: - ldr r1, =gTrainers - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r1 - ldrb r1, [r0, 0x1] - movs r0, 0xD - muls r0, r1 - ldr r1, =gTrainerClassNames - adds r0, r1 - pop {r1} - bx r1 - .pool - thumb_func_end sub_806F07C - - thumb_func_start sub_806F0B0 -sub_806F0B0: @ 806F0B0 - push {lr} - lsls r0, 16 - lsrs r1, r0, 16 - ldr r0, =0x00000356 - cmp r1, r0 - bls _0806F0BE - movs r1, 0 -_0806F0BE: - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - ldr r1, =gTrainers + 0x4 @ name offset - adds r0, r1 - pop {r1} - bx r1 - .pool - thumb_func_end sub_806F0B0 - - thumb_func_start sub_806F0D4 -sub_806F0D4: @ 806F0D4 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - movs r1, 0 - ldr r0, =0x00000181 - cmp r2, r0 - beq _0806F0F8 - adds r0, 0x19 - cmp r2, r0 - beq _0806F0F8 - subs r0, 0x66 - cmp r2, r0 - beq _0806F0F8 - movs r1, 0xC9 - eors r1, r2 - negs r0, r1 - orrs r0, r1 - lsrs r1, r0, 31 -_0806F0F8: - adds r0, r1, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_806F0D4 - - thumb_func_start sub_806F104 -sub_806F104: @ 806F104 - push {lr} - ldr r2, =gMain - ldr r1, =0x00000439 - adds r0, r2, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0806F122 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - ldr r1, =0x003f0100 - ands r0, r1 - cmp r0, 0 - bne _0806F144 -_0806F122: - ldr r1, =0x00000439 - adds r0, r2, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _0806F158 - bl InBattlePike - lsls r0, 24 - cmp r0, 0 - bne _0806F144 - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - beq _0806F158 -_0806F144: - movs r0, 0x1 - b _0806F15A - .pool -_0806F158: - movs r0, 0 -_0806F15A: - pop {r1} - bx r1 - thumb_func_end sub_806F104 thumb_func_start sub_806F160 sub_806F160: @ 806F160 diff --git a/asm/pokemon_animation.s b/asm/pokemon_animation.s index 1b0119424..a29ecb729 100644 --- a/asm/pokemon_animation.s +++ b/asm/pokemon_animation.s @@ -89,8 +89,8 @@ _0817F528: .pool thumb_func_end sub_817F498 - thumb_func_start sub_817F544 -sub_817F544: @ 817F544 + thumb_func_start LaunchAnimationTaskForFrontSprite +LaunchAnimationTaskForFrontSprite: @ 817F544 push {r4,r5,lr} adds r5, r0, 0 lsls r4, r1, 24 @@ -113,7 +113,7 @@ sub_817F544: @ 817F544 pop {r0} bx r0 .pool - thumb_func_end sub_817F544 + thumb_func_end LaunchAnimationTaskForFrontSprite thumb_func_start sub_817F578 sub_817F578: @ 817F578 @@ -130,8 +130,8 @@ sub_817F578: @ 817F578 .pool thumb_func_end sub_817F578 - thumb_func_start sub_817F594 -sub_817F594: @ 817F594 + thumb_func_start LaunchAnimationTaskForBackSprite +LaunchAnimationTaskForBackSprite: @ 817F594 push {r4-r6,lr} adds r5, r0, 0 lsls r6, r1, 24 @@ -178,7 +178,7 @@ sub_817F594: @ 817F594 pop {r0} bx r0 .pool - thumb_func_end sub_817F594 + thumb_func_end LaunchAnimationTaskForBackSprite thumb_func_start sub_817F60C sub_817F60C: @ 817F60C diff --git a/asm/pokemon_item_effect.s b/asm/pokemon_item_effect.s index 2002343eb..137f7a5c0 100644 --- a/asm/pokemon_item_effect.s +++ b/asm/pokemon_item_effect.s @@ -77,7 +77,7 @@ ExecuteTableBasedItemEffect: @ 806BD28 cmp r0, 0 beq _0806BDA8 ldr r2, =gEnigmaBerries - ldr r0, =gUnknown_020244B8 + ldr r0, =gBankInMenu ldrb r1, [r0] lsls r0, r1, 3 subs r0, r1 @@ -100,8 +100,8 @@ _0806BDBC: lsrs r0, 24 _0806BDC4: str r0, [sp, 0x34] - ldr r1, =gUnknown_0202420F - ldr r0, =gUnknown_020244B8 + ldr r1, =gStringBank + ldr r0, =gBankInMenu ldrb r2, [r0] strb r2, [r1] ldr r0, =gMain diff --git a/asm/porthole.s b/asm/porthole.s index 0efe88773..e5986b47e 100644 --- a/asm/porthole.s +++ b/asm/porthole.s @@ -231,7 +231,7 @@ _080FB75E: sub_80FB768: @ 80FB768 push {lr} bl sub_80FB6EC - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r0, =gUnknown_02037590 ldrb r1, [r0, 0x5] lsls r0, r1, 3 diff --git a/asm/recorded_battle.s b/asm/recorded_battle.s index 5a4a811e6..53824dfea 100644 --- a/asm/recorded_battle.s +++ b/asm/recorded_battle.s @@ -883,7 +883,7 @@ _081854E2: ldr r2, =0x000004f6 adds r0, r7, r2 strh r1, [r0] - ldr r3, =gUnknown_02038BCE + ldr r3, =gPartnerTrainerId ldrh r1, [r3] movs r4, 0x9F lsls r4, 3 @@ -1196,7 +1196,7 @@ _081857B6: b _08185856 .pool _081857E4: - ldr r3, =gUnknown_02038BCE + ldr r3, =gPartnerTrainerId ldrh r3, [r3] adds r0, r1, r3 lsls r0, 16 @@ -1207,7 +1207,7 @@ _081857E4: ldr r4, =0x00000504 adds r3, r7, r4 mov r10, r9 - ldr r5, =gUnknown_02038BCE + ldr r5, =gPartnerTrainerId mov r12, r5 ldr r0, =0xfffffed4 mov r8, r0 @@ -1231,7 +1231,7 @@ _08185804: ble _08185804 mov r0, r9 ldr r1, [r0] - ldr r2, =gUnknown_02038BCE + ldr r2, =gPartnerTrainerId ldrh r0, [r2] ldr r3, =0xfffffed4 adds r0, r3 @@ -1246,7 +1246,7 @@ _08185804: strb r1, [r0] mov r0, r9 ldr r1, [r0] - ldr r4, =gUnknown_02038BCE + ldr r4, =gPartnerTrainerId ldrh r0, [r4] adds r0, r3 muls r0, r2 @@ -1374,7 +1374,7 @@ _08185936: b _081859AC .pool _0818597C: - ldr r3, =gUnknown_02038BCE + ldr r3, =gPartnerTrainerId ldrh r0, [r3] cmp r0, r1 bls _081859C0 @@ -1395,7 +1395,7 @@ _0818597C: adds r1, r7, r5 strb r0, [r1] ldr r2, [r4] - ldr r0, =gUnknown_02038BCE + ldr r0, =gPartnerTrainerId ldrh r1, [r0] adds r1, r3 _081859AC: @@ -1546,7 +1546,7 @@ sub_8185AB0: @ 8185AB0 strh r1, [r0] ldr r0, =gTrainerBattleOpponent_B strh r1, [r0] - ldr r0, =gUnknown_02038BCE + ldr r0, =gPartnerTrainerId strh r1, [r0] bl sub_8185EFC ldr r0, =gUnknown_0203C7B0 @@ -1725,7 +1725,7 @@ _08185C2A: adds r0, r7, r3 ldrh r0, [r0] strh r0, [r1] - ldr r1, =gUnknown_02038BCE + ldr r1, =gPartnerTrainerId adds r2, 0x4 adds r0, r7, r2 ldrh r0, [r0] @@ -1905,7 +1905,7 @@ sub_8185E24: @ 8185E24 ldr r0, =gUnknown_0203C7B0 str r5, [r0] movs r0, 0 - bl PlayNewMapMusic__default_for_battle + bl PlayMapChosenOrBattleBGM ldr r0, =sub_8185E8C bl SetMainCallback2 _08185E6E: diff --git a/asm/reshow_battle_screen.s b/asm/reshow_battle_screen.s index 10fd6c6ce..f83a11ff1 100644 --- a/asm/reshow_battle_screen.s +++ b/asm/reshow_battle_screen.s @@ -265,7 +265,7 @@ _080A94F8: bl sub_805EE54 _080A955C: ldr r1, =gUnknown_020244AC - ldr r0, =gUnknown_020244B8 + ldr r0, =gBankInMenu ldrb r0, [r0] adds r0, r1 ldrb r0, [r0] @@ -587,7 +587,7 @@ _080A9786: adds r0, r1 lsls r0, 2 adds r0, r5 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r1, r7, r1 ldrb r1, [r1] bl StartSpriteAnim @@ -616,7 +616,7 @@ _080A986C: lsls r1, 24 lsrs r1, 24 adds r0, r4, 0 - bl template_build_for_pokemon_or_trainer + bl sub_806A12C ldr r6, =gUnknown_0202499C ldr r1, =gUnknown_08305D2C ldr r0, [r5] @@ -654,7 +654,7 @@ _080A98D0: lsls r1, 24 lsrs r1, 24 movs r0, 0x6 - bl template_build_for_pokemon_or_trainer + bl sub_806A12C ldr r5, =gUnknown_0202499C ldr r0, =gUnknown_08305D2C ldrb r0, [r0, 0x18] @@ -804,7 +804,7 @@ _080A998C: adds r0, r1 lsls r0, 2 adds r0, r5 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r1, r7, r1 ldrb r1, [r1] bl StartSpriteAnim diff --git a/asm/rom3.s b/asm/rom3.s index ac74e0735..e2f268f43 100644 --- a/asm/rom3.s +++ b/asm/rom3.s @@ -76,7 +76,7 @@ _080326B8: movs r5, 0 str r5, [r0] bl sub_80A3934 - bl sub_806E414 + bl ClearBattleMonForms movs r0, 0xF bl BattleAI_HandleItemUseBeforeAISetup ldr r0, =gBattleTypeFlags @@ -2619,7 +2619,7 @@ dp01_build_cmdbuf_x10_TODO: @ 8033BE4 adds r0, 0xB1 ldrb r0, [r0] strb r0, [r3, 0x9] - ldr r0, =gUnknown_0202420F + ldr r0, =gStringBank ldrb r0, [r0] strb r0, [r3, 0xA] ldr r3, =gBattleMoves diff --git a/asm/rom4.s b/asm/rom4.s index 9acdbec0a..9e4e9f108 100644 --- a/asm/rom4.s +++ b/asm/rom4.s @@ -4395,7 +4395,7 @@ sub_8086A68: @ 8086A68 thumb_func_start sub_8086A80 sub_8086A80: @ 8086A80 push {lr} - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r3, =gUnknown_02037590 ldrb r1, [r3, 0x5] lsls r0, r1, 3 @@ -6030,7 +6030,7 @@ sub_80876F0: @ 80876F0 lsls r5, r6, 3 adds r5, r6 lsls r5, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r5, r0 adds r0, r4, 0 bl sub_80876C4 @@ -6128,7 +6128,7 @@ sub_80877DC: @ 80877DC lsls r1, r0, 3 adds r1, r0 lsls r1, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r1, r0 strb r2, [r1, 0x19] _080877FE: @@ -6148,7 +6148,7 @@ sub_808780C: @ 808780C lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 ldrb r0, [r4, 0x4] cmp r0, 0x40 @@ -6183,7 +6183,7 @@ sub_8087858: @ 8087858 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 ldrb r0, [r0, 0x4] bx lr @@ -6200,7 +6200,7 @@ sub_8087878: @ 8087878 lsls r0, r3, 3 adds r0, r3 lsls r0, 2 - ldr r3, =gUnknown_02037350 + ldr r3, =gMapObjects adds r0, r3 ldrh r3, [r0, 0x10] strh r3, [r1] @@ -6220,7 +6220,7 @@ sub_80878A0: @ 80878A0 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 ldrb r0, [r0, 0x19] bx lr @@ -6237,7 +6237,7 @@ sub_80878C0: @ 80878C0 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 ldrb r0, [r0, 0xB] lsls r0, 28 @@ -6256,7 +6256,7 @@ sub_80878E4: @ 80878E4 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 adds r0, 0x21 movs r1, 0 @@ -6292,7 +6292,7 @@ _0808792E: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r1, r0, r1 movs r6, 0x10 ldrsh r0, [r1, r6] @@ -6332,7 +6332,7 @@ sub_808796C: @ 808796C lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r6, r0, r1 ldrb r0, [r5] cmp r0, 0 @@ -6584,7 +6584,7 @@ npc_080587EC: @ 8087B40 mov r12, r2 lsls r3, 16 movs r4, 0 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects mov r9, r0 lsrs r2, r3, 16 mov r10, r2 @@ -6660,7 +6660,7 @@ sub_8087BCC: @ 8087BCC lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 ldrb r0, [r2] cmp r0, 0 @@ -6748,7 +6748,7 @@ sub_8087C8C: @ 8087C8C lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r6, r0, r1 ldrh r0, [r6, 0xC] strh r0, [r5, 0x20] diff --git a/asm/rom6.s b/asm/rom6.s index 7fd6d7797..c5e0265a0 100644 --- a/asm/rom6.s +++ b/asm/rom6.s @@ -23,7 +23,7 @@ npc_before_player_of_type: @ 8135424 bl GetFieldObjectIdByXYZ lsls r0, 24 lsrs r0, 24 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects lsls r1, r0, 3 adds r1, r0 lsls r1, 2 @@ -75,7 +75,7 @@ task08_080C9820: @ 813549C lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 adds r0, r4, 0 bl FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive @@ -132,7 +132,7 @@ sub_813552C: @ 813552C lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl FieldObjectCheckIfSpecialAnimFinishedOrInactive lsls r0, 24 @@ -196,7 +196,7 @@ _081355B8: lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 bl GetPlayerAvatarGraphicsIdByCurrentState adds r1, r0, 0 @@ -2140,7 +2140,7 @@ _081366D0: ldr r2, =0x0000ffff adds r1, r2, 0 strh r1, [r0] - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId mov r1, r9 strh r1, [r0] adds r0, r7, 0 @@ -2150,7 +2150,7 @@ _081366D0: _081366F8: movs r0, 0x5 bl PlaySE - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId strh r4, [r0] adds r0, r7, 0 bl sub_8136938 @@ -2541,7 +2541,7 @@ sub_8136A50: @ 8136A50 sub_8136A74: @ 8136A74 push {lr} ldr r2, =gSaveBlock1Ptr - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r1, [r0] lsls r1, 3 ldr r0, =0x00000848 @@ -2586,7 +2586,7 @@ sub_8136AB4: @ 8136AB4 ldr r3, =gPokeblockNames ldr r1, =gSaveBlock1Ptr ldr r2, [r1] - ldr r1, =gUnknown_0203CE7C + ldr r1, =gScriptItemId ldrh r1, [r1] lsls r1, 3 adds r2, r1 @@ -2689,7 +2689,7 @@ sub_8136BC0: @ 8136BC0 ands r0, r1 cmp r0, 0 beq _08136C36 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrb r0, [r0] bl sub_8136F68 movs r0, 0x5 @@ -2772,7 +2772,7 @@ sub_8136C8C: @ 8136C8C lsls r0, 24 lsrs r0, 24 ldr r5, =gSaveBlock1Ptr - ldr r7, =gUnknown_0203CE7C + ldr r7, =gScriptItemId ldrh r2, [r7] lsls r2, 3 ldr r6, =0x00000848 @@ -2836,7 +2836,7 @@ sub_8136D2C: @ 8136D2C adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - ldr r5, =gUnknown_0203CE7C + ldr r5, =gScriptItemId ldrb r0, [r5] bl SafariZoneActivatePokeblockFeeder ldr r0, =gStringVar1 @@ -2877,7 +2877,7 @@ sub_8136D90: @ 8136D90 lsrs r4, 24 ldr r6, =gSpecialVar_0x8004 ldr r0, =gSaveBlock1Ptr - ldr r5, =gUnknown_0203CE7C + ldr r5, =gScriptItemId ldrh r1, [r5] lsls r1, 3 ldr r2, =0x00000848 @@ -4566,7 +4566,7 @@ _08137B7C: lsls r0, 16 lsrs r0, 16 movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 bne _08137BEA @@ -4576,7 +4576,7 @@ _08137B7C: lsls r0, 16 lsrs r0, 16 movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 bne _08137BEA @@ -4590,7 +4590,7 @@ _08137BB8: lsls r0, 16 lsrs r0, 16 movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _08137C04 @@ -4600,7 +4600,7 @@ _08137BB8: lsls r0, 16 lsrs r0, 16 movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _08137C04 @@ -5673,7 +5673,7 @@ _08138454: lsrs r2, r0, 24 cmp r2, 0x10 beq _081384E6 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects lsls r0, r2, 3 adds r0, r2 lsls r0, 2 @@ -7257,7 +7257,7 @@ SpawnScriptFieldObject: @ 8139158 bl SpawnSpecialFieldObjectParametrized lsls r0, 24 lsrs r0, 24 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects lsls r1, r0, 3 adds r1, r0 lsls r1, 2 @@ -11184,7 +11184,7 @@ sub_813B21C: @ 813B21C lsls r0, 24 cmp r0, 0 bne _0813B258 - bl get_preferred_box + bl StorageGetCurrentBox adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -11215,7 +11215,7 @@ sub_813B260: @ 813B260 lsls r0, 24 lsrs r0, 24 bl set_unknown_box_id - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r4, r0, 24 _0813B278: @@ -11226,7 +11226,7 @@ _0813B27E: lsls r1, r5, 24 lsrs r1, 24 lsrs r0, r6, 24 - bl get_pokemon_by_box_and_pos + bl GetBoxedMonPtr movs r1, 0xB movs r2, 0 bl GetBoxMonData @@ -11257,7 +11257,7 @@ _0813B2C0: bne _0813B2CE movs r4, 0 _0813B2CE: - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 cmp r4, r0 diff --git a/asm/rom_8034C54.s b/asm/rom_8034C54.s index 2690b0f98..8b0c99138 100644 --- a/asm/rom_8034C54.s +++ b/asm/rom_8034C54.s @@ -2524,7 +2524,7 @@ _08036208: ands r1, r0 cmp r1, 0 beq _08036224 - ldr r0, =gUnknown_02038BCE + ldr r0, =gPartnerTrainerId ldrh r1, [r0] ldr r0, =0x00000c03 cmp r1, r0 diff --git a/asm/rom_8072304.s b/asm/rom_8072304.s index a43e8afd6..4b93d3a0e 100644 --- a/asm/rom_8072304.s +++ b/asm/rom_8072304.s @@ -1317,7 +1317,7 @@ _08072D86: movs r2, 0x1 movs r3, 0x3 bl ConvertIntToDecimalStringN - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleSpritesGfx ldr r0, [r0] movs r1, 0xBA lsls r1, 1 @@ -1333,7 +1333,7 @@ _08072D86: lsls r0, 2 adds r5, r0, r1 _08072DB8: - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleSpritesGfx ldr r0, [r0] movs r1, 0xBA lsls r1, 1 @@ -1536,7 +1536,7 @@ _08072F52: ldr r1, =gText_Slash bl StringCopy _08072F82: - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleSpritesGfx ldr r0, [r0] movs r1, 0xBA lsls r1, 1 @@ -1556,7 +1556,7 @@ _08072F82: _08072FA6: cmp r4, 0x2 bhi _08072FF0 - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleSpritesGfx ldr r0, [r0] movs r2, 0xBA lsls r2, 1 @@ -1579,7 +1579,7 @@ _08072FA6: b _0807301A .pool _08072FF0: - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleSpritesGfx ldr r0, [r0] movs r1, 0xBA lsls r1, 1 @@ -1609,7 +1609,7 @@ _08073024: mov r3, r8 cmp r3, 0 bne _08073084 - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleSpritesGfx ldr r0, [r0] movs r1, 0xBA lsls r1, 1 @@ -1702,7 +1702,7 @@ sub_80730D4: @ 80730D4 lsls r0, 24 lsrs r0, 24 bl GetBankIdentity - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r2, [r1] movs r3, 0xBA lsls r3, 1 @@ -1877,7 +1877,7 @@ _08073236: strb r0, [r1, 0x5] movs r0, 0xBA strb r0, [r1, 0x8] - ldr r5, =gUnknown_020244D4 + ldr r5, =gBattleSpritesGfx ldr r0, [r5] movs r2, 0xBA lsls r2, 1 @@ -3922,7 +3922,7 @@ sub_8074310: @ 8074310 lsls r0, 16 lsrs r0, 16 movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _080743E6 @@ -8234,7 +8234,7 @@ _080766BA: adds r0, r2, 0 movs r2, 0x1 movs r3, 0 - bl sub_806ED40 + bl DoMonFrontSpriteAnimation b _08076708 .pool _080766FC: @@ -8242,7 +8242,7 @@ _080766FC: adds r0, r2, 0 movs r2, 0 movs r3, 0 - bl sub_806ED40 + bl DoMonFrontSpriteAnimation _08076708: adds r0, r4, 0 bl DestroySpriteAndFreeResources diff --git a/asm/rom_80A5C6C.s b/asm/rom_80A5C6C.s index 22e91ecdc..ea75d4e2b 100644 --- a/asm/rom_80A5C6C.s +++ b/asm/rom_80A5C6C.s @@ -263,7 +263,7 @@ _080A5E90: cmp r5, r0 bne _080A5EB0 ldr r0, =gUnknown_08525F8C - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r1, r4, r1 ldrb r1, [r1] adds r1, r0 @@ -353,7 +353,7 @@ _080A5F58: cmp r5, r0 bne _080A5F7C ldr r0, =gUnknown_08525F78 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r1, r4, r1 ldrb r1, [r1] lsls r1, 2 @@ -407,7 +407,7 @@ sub_80A5FA0: @ 80A5FA0 cmp r4, r0 bne _080A5FE8 ldr r0, =gUnknown_08525F88 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms adds r1, r6, r1 ldrb r1, [r1] adds r1, r0 @@ -4541,7 +4541,7 @@ sub_80A7F18: @ 80A7F18 movs r4, 0 ldr r1, =gBankSpriteIds ldr r7, =0x00000181 - ldr r0, =gUnknown_020244E4 + ldr r0, =gBattleMonForms adds r6, r5, r0 _080A7F38: adds r0, r4, r1 @@ -5155,7 +5155,7 @@ sub_80A8394: @ 80A8394 bl AllocSpritePalette lsls r0, 24 lsrs r5, r0, 24 - ldr r4, =gUnknown_020244D4 + ldr r4, =gBattleSpritesGfx ldr r0, [r4] cmp r0, 0 beq _080A8412 @@ -5213,7 +5213,7 @@ _080A845E: lsls r0, r6, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] movs r3, 0xBE lsls r3, 1 @@ -5226,7 +5226,7 @@ _080A8488: lsls r0, r6, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] movs r2, 0xBE lsls r2, 1 @@ -5276,7 +5276,7 @@ _080A84F6: lsls r0, r6, 3 ldr r1, =gMonBackPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] movs r2, 0xBE lsls r2, 1 @@ -5294,7 +5294,7 @@ _080A8524: lsls r0, r6, 3 ldr r1, =gMonBackPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] movs r3, 0xBE lsls r3, 1 @@ -5305,7 +5305,7 @@ _080A8524: mov r3, r8 bl LoadSpecialPokePic_2 _080A8540: - ldr r5, =gUnknown_020244D4 + ldr r5, =gBattleSpritesGfx ldr r0, [r5] movs r4, 0xBE lsls r4, 1 @@ -5658,7 +5658,7 @@ _080A882E: cmp r7, r0 bne _080A8850 _080A8834: - ldr r0, =gUnknown_020244E4 + ldr r0, =gBattleMonForms add r0, r8 ldrb r0, [r0] lsls r0, 2 diff --git a/asm/rom_80AEFFC.s b/asm/rom_80AEFFC.s index 566947ba3..23926a93e 100644 --- a/asm/rom_80AEFFC.s +++ b/asm/rom_80AEFFC.s @@ -599,7 +599,7 @@ _080AF4A4: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 movs r1, 0x8 bl FieldObjectSetSpecialAnim @@ -630,7 +630,7 @@ _080AF4DC: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl FieldObjectClearAnimIfSpecialAnimFinished movs r0, 0x3 @@ -719,7 +719,7 @@ _080AF5A2: lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 bl player_get_direction_lower_nybble lsls r0, 24 @@ -1370,7 +1370,7 @@ _080AFB26: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r4, =gUnknown_02037350 + ldr r4, =gMapObjects adds r0, r4 bl FieldObjectClearAnimIfSpecialAnimActive movs r0, 0xFF @@ -1414,7 +1414,7 @@ _080AFB6C: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl FieldObjectClearAnimIfSpecialAnimFinished movs r0, 0 diff --git a/asm/rom_80C6FA0.s b/asm/rom_80C6FA0.s index b26962078..7b0fb83b2 100644 --- a/asm/rom_80C6FA0.s +++ b/asm/rom_80C6FA0.s @@ -1763,7 +1763,7 @@ _080C7DA8: bl CreateTask ldr r1, [r4] strb r0, [r1, 0x4] - bl get_preferred_box + bl StorageGetCurrentBox ldr r1, =gUnknown_02039D10 strb r0, [r1] ldr r0, =c2_Box @@ -2102,7 +2102,7 @@ _080C80EC: bl sub_80CA704 b _080C8198 _080C80F2: - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 bl sub_80CC32C @@ -2252,7 +2252,7 @@ _080C8230: ldrb r0, [r0] cmp r0, 0x2 bne _080C825C - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] cmp r0, 0 beq _080C825C @@ -2459,7 +2459,7 @@ _080C8440: _080C844C: movs r0, 0x5 bl PlaySE - bl get_preferred_box + bl StorageGetCurrentBox ldr r4, =gUnknown_02039D08 ldr r1, [r4] lsls r0, 24 @@ -2483,7 +2483,7 @@ _080C846E: _080C8484: movs r0, 0x5 bl PlaySE - bl get_preferred_box + bl StorageGetCurrentBox ldr r4, =gUnknown_02039D08 ldr r1, [r4] lsls r0, 24 @@ -4859,7 +4859,7 @@ _080C99FE: movs r1, 0xA movs r3, 0x3 bl sub_80C77E8 - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 bl sub_80C78D4 @@ -4888,7 +4888,7 @@ _080C9A2C: cmp r0, 0xC9 beq _080C9A6C adds r4, r0, 0 - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 cmp r4, r0 @@ -5421,7 +5421,7 @@ _080C9F04: .pool _080C9F1C: bl sub_80C9FC8 - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 bl sav3_get_box_name @@ -5458,7 +5458,7 @@ _080C9F56: sub_80C9F6C: @ 80C9F6C push {lr} sub sp, 0x4 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r1, [r0] mov r0, sp strh r1, [r0] @@ -6895,7 +6895,7 @@ _080CABDA: sub_80CABE0: @ 80CABE0 push {r4,lr} ldr r4, =gUnknown_02039D10 - bl get_preferred_box + bl StorageGetCurrentBox ldrb r1, [r4] lsls r0, 24 lsrs r0, 24 @@ -6904,7 +6904,7 @@ sub_80CABE0: @ 80CABE0 ldr r0, =0x000008d7 bl FlagReset ldr r4, =0x00004036 - bl get_preferred_box + bl StorageGetCurrentBox adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -10143,7 +10143,7 @@ sub_80CC644: @ 80CC644 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r1, r0, 24 movs r2, 0 @@ -10180,7 +10180,7 @@ sub_80CC680: @ 80CC680 adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 adds r1, r4, 0 @@ -10244,7 +10244,7 @@ _080CC718: lsls r0, 24 cmp r0, 0 bne _080CC794 - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 movs r1, 0 @@ -11229,7 +11229,7 @@ _080CCF96: thumb_func_start sub_80CCF9C sub_80CCF9C: @ 80CCF9C push {lr} - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 bl sub_80D20F8 @@ -12975,7 +12975,7 @@ _080CDDFE: b _080CDE2A .pool _080CDE20: - bl get_preferred_box + bl StorageGetCurrentBox ldr r1, [r4] ldr r2, =0x00000d91 adds r1, r2 @@ -13141,7 +13141,7 @@ _080CDF68: ldrb r0, [r0] cmp r0, 0 bne _080CDF8E - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 ldr r4, =gUnknown_02039D79 @@ -13182,7 +13182,7 @@ sub_80CDFAC: @ 80CDFAC b _080CDFF8 .pool _080CDFDC: - bl get_preferred_box + bl StorageGetCurrentBox adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -13417,7 +13417,7 @@ _080CE1DC: ldrb r0, [r5] bl sub_80CBB68 _080CE1F6: - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 cmp r6, r0 @@ -13539,7 +13539,7 @@ _080CE2F0: b _080CE30C .pool _080CE304: - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r2, r0, 24 _080CE30C: @@ -13687,7 +13687,7 @@ _080CE418: b _080CE488 .pool _080CE464: - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 ldr r1, =gUnknown_02039D79 @@ -13697,7 +13697,7 @@ _080CE464: ldr r3, =0x00002108 adds r2, r3 bl sub_80D2054 - bl get_preferred_box + bl StorageGetCurrentBox ldr r1, [r4] ldr r2, =0x00002170 adds r1, r2 @@ -14140,11 +14140,11 @@ _080CE838: b _080CE8CA .pool _080CE894: - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 movs r1, 0 - bl get_pokemon_by_box_and_pos + bl GetBoxedMonPtr ldr r3, =gUnknown_02039D08 ldr r2, [r3] ldr r4, =0x0000218c @@ -14527,12 +14527,12 @@ _080CEBB0: bl sub_80CEC00 b _080CEBD0 _080CEBBA: - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 ldr r1, =gUnknown_02039D79 ldrb r1, [r1] - bl get_pokemon_by_box_and_pos + bl GetBoxedMonPtr movs r1, 0x1 bl sub_80CEC00 _080CEBD0: @@ -14847,7 +14847,7 @@ _080CEE94: _080CEEC0: ldr r2, =0x00000cf9 adds r0, r1, r2 - ldr r1, =gText_Egg + ldr r1, =gText_EggNickname movs r2, 0 movs r3, 0x8 bl StringCopyPadded @@ -15491,7 +15491,7 @@ _080CF428: adds r1, r0 movs r0, 0x2 strb r0, [r1] - bl get_preferred_box + bl StorageGetCurrentBox ldr r1, =gUnknown_02039D7B strb r0, [r1] movs r0, 0x17 @@ -18075,7 +18075,7 @@ _080D0902: _080D0914: adds r0, 0x1 strb r0, [r2, 0xB] - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 mov r10, r0 @@ -18111,7 +18111,7 @@ _080D093C: _080D095A: mov r0, r10 adds r1, r5, 0 - bl get_pokemon_by_box_and_pos + bl GetBoxedMonPtr adds r1, r0, 0 ldr r2, =gUnknown_02039D80 ldr r0, [r2] @@ -18161,7 +18161,7 @@ sub_80D09A4: @ 80D09A4 ldrb r0, [r0, 0xB] adds r1, r0 mov r9, r1 - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 mov r8, r0 @@ -18305,7 +18305,7 @@ sub_80D0AAC: @ 80D0AAC ldrb r0, [r0, 0xB] adds r1, r0 str r1, [sp] - bl get_preferred_box + bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 str r0, [sp, 0x4] @@ -20559,15 +20559,15 @@ nullsub_98: @ 80D1D08 bx lr thumb_func_end nullsub_98 - thumb_func_start get_preferred_box -@ char get_preferred_box() -get_preferred_box: @ 80D1D0C + thumb_func_start StorageGetCurrentBox +@ char StorageGetCurrentBox() +StorageGetCurrentBox: @ 80D1D0C ldr r0, =gPokemonStoragePtr ldr r0, [r0] ldrb r0, [r0] bx lr .pool - thumb_func_end get_preferred_box + thumb_func_end StorageGetCurrentBox thumb_func_start sub_80D1D18 sub_80D1D18: @ 80D1D18 @@ -21050,9 +21050,9 @@ _080D2088: .pool thumb_func_end sub_80D2054 - thumb_func_start get_pokemon_by_box_and_pos -@ pokemon *get_pokemon_by_box_and_pos(u8 box_id, u8 pos) -get_pokemon_by_box_and_pos: @ 80D2094 + thumb_func_start GetBoxedMonPtr +@ pokemon *GetBoxedMonPtr(u8 box_id, u8 pos) +GetBoxedMonPtr: @ 80D2094 push {r4,lr} lsls r0, 24 lsrs r3, r0, 24 @@ -21083,7 +21083,7 @@ _080D20CA: pop {r4} pop {r1} bx r1 - thumb_func_end get_pokemon_by_box_and_pos + thumb_func_end GetBoxedMonPtr thumb_func_start sav3_get_box_name sav3_get_box_name: @ 80D20D0 @@ -23955,7 +23955,7 @@ _080D3630: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl npc_sync_anim_pause_bits _080D3646: @@ -24023,7 +24023,7 @@ sub_80D36A4: @ 80D36A4 lsls r0, r2, 3 adds r0, r2 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 adds r0, r4, 0 bl FieldObjectIsSpecialAnimActive @@ -27175,7 +27175,7 @@ sub_80D5070: @ 80D5070 adds r4, r0, 0 cmp r4, 0x2A bne _080D5082 - bl sub_80E162C + bl IsEnigmaBerryValid _080D5082: ldr r5, =gBerryPicTable lsls r4, 3 diff --git a/asm/rom_815A0D4.s b/asm/rom_815A0D4.s index a32315506..373c5d074 100644 --- a/asm/rom_815A0D4.s +++ b/asm/rom_815A0D4.s @@ -3024,12 +3024,12 @@ _0815B8E0: lsls r0, 24 lsrs r1, r0, 24 _0815B8EA: - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleSpritesGfx ldr r2, [r0] lsls r0, r1, 2 adds r2, 0x4 adds r2, r0 - ldr r1, =gUnknown_020244E4 + ldr r1, =gBattleMonForms ldr r0, =gAnimationBankAttacker ldrb r0, [r0] adds r0, r1 diff --git a/asm/rom_8161F74.s b/asm/rom_8161F74.s index 339476c45..75bfc07bb 100644 --- a/asm/rom_8161F74.s +++ b/asm/rom_8161F74.s @@ -391,7 +391,7 @@ _081622B2: adds r4, r1, r0 mov r0, r10 str r2, [sp, 0x38] - bl sub_8165C90 + bl BattleFrontierGetOpponentLvl ldrb r1, [r4] lsls r0, 24 lsrs r0, 24 @@ -1340,7 +1340,7 @@ sub_8162AA0: @ 8162AA0 lsls r0, 1 cmp r4, r0 bne _08162AD0 - ldr r1, =gTrainerPicIndices + ldr r1, =gUnknown_0831F578 ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldr r2, =0x00000bed @@ -1362,7 +1362,7 @@ _08162AE4: ldr r0, =0x0000012b cmp r4, r0 bhi _08162B08 - ldr r2, =gTrainerPicIndices + ldr r2, =gUnknown_0831F578 ldr r0, =gUnknown_0203BC88 ldr r1, [r0] movs r0, 0x34 @@ -1383,7 +1383,7 @@ _08162B08: ands r0, r1 cmp r0, 0 beq _08162B38 - ldr r4, =gTrainerPicIndices + ldr r4, =gUnknown_0831F578 bl sub_818649C lsls r0, 24 lsrs r0, 24 @@ -1391,7 +1391,7 @@ _08162B08: b _08162BC8 .pool _08162B38: - ldr r3, =gTrainerPicIndices + ldr r3, =gUnknown_0831F578 ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldr r1, =0xfffffed4 @@ -1413,7 +1413,7 @@ _08162B64: ands r0, r1 cmp r0, 0 bne _08162BB0 - ldr r4, =gTrainerPicIndices + ldr r4, =gUnknown_0831F578 ldr r3, =gUnknown_08610970 ldr r0, =gSaveBlock2Ptr ldr r1, [r0] @@ -1436,7 +1436,7 @@ _08162B64: b _08162BC8 .pool _08162BB0: - ldr r5, =gTrainerPicIndices + ldr r5, =gUnknown_0831F578 ldr r4, =gUnknown_08610970 bl sub_81864A8 lsls r0, 24 @@ -1456,8 +1456,8 @@ _08162BCA: .pool thumb_func_end sub_8162AA0 - thumb_func_start sub_8162BD8 -sub_8162BD8: @ 8162BD8 + thumb_func_start GetFrontierOpponentClass +GetFrontierOpponentClass: @ 8162BD8 push {r4,r5,lr} lsls r0, 16 lsrs r4, r0, 16 @@ -1467,7 +1467,7 @@ sub_8162BD8: @ 8162BD8 lsls r0, 1 cmp r4, r0 bne _08162C08 - ldr r1, =gTrainerClassNameIndices + ldr r1, =gTrainerClassToNameIndex ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldr r2, =0x00000bed @@ -1499,7 +1499,7 @@ _08162C38: ldr r0, =0x0000012b cmp r4, r0 bhi _08162C60 - ldr r2, =gTrainerClassNameIndices + ldr r2, =gTrainerClassToNameIndex ldr r0, =gUnknown_0203BC88 ldr r1, [r0] movs r0, 0x34 @@ -1521,7 +1521,7 @@ _08162C60: ands r0, r1 cmp r0, 0 beq _08162C90 - ldr r4, =gTrainerClassNameIndices + ldr r4, =gTrainerClassToNameIndex bl sub_818649C lsls r0, 24 lsrs r0, 24 @@ -1530,7 +1530,7 @@ _08162C60: b _08162D1E .pool _08162C90: - ldr r3, =gTrainerClassNameIndices + ldr r3, =gTrainerClassToNameIndex ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldr r1, =0xfffffed4 @@ -1553,7 +1553,7 @@ _08162CBC: ands r0, r1 cmp r0, 0 beq _08162CF4 - ldr r5, =gTrainerClassNameIndices + ldr r5, =gTrainerClassToNameIndex ldr r4, =gUnknown_08610970 bl sub_81864A8 lsls r0, 24 @@ -1568,7 +1568,7 @@ _08162CBC: b _08162D1E .pool _08162CF4: - ldr r4, =gTrainerClassNameIndices + ldr r4, =gTrainerClassToNameIndex ldr r3, =gUnknown_08610970 ldr r0, =gSaveBlock2Ptr ldr r1, [r0] @@ -1594,7 +1594,7 @@ _08162D1E: pop {r1} bx r1 .pool - thumb_func_end sub_8162BD8 + thumb_func_end GetFrontierOpponentClass thumb_func_start sub_8162D34 sub_8162D34: @ 8162D34 @@ -1697,8 +1697,8 @@ _08162E0C: .pool thumb_func_end sub_8162D34 - thumb_func_start sub_8162E20 -sub_8162E20: @ 8162E20 + thumb_func_start GetFrontierTrainerName +GetFrontierTrainerName: @ 8162E20 push {r4-r6,lr} adds r6, r0, 0 lsls r1, 16 @@ -1846,7 +1846,7 @@ _08162F62: pop {r4-r6} pop {r0} bx r0 - thumb_func_end sub_8162E20 + thumb_func_end GetFrontierTrainerName thumb_func_start sub_8162F68 sub_8162F68: @ 8162F68 @@ -3275,7 +3275,7 @@ _08163B56: _08163B64: movs r0, 0x2 bl sub_816306C - ldr r1, =gUnknown_02038BCE + ldr r1, =gPartnerTrainerId ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldr r2, =0x00000cd6 @@ -3302,7 +3302,7 @@ _08163BA6: movs r1, 0x1 bl CreateTask movs r0, 0 - bl PlayNewMapMusic__default_for_battle + bl PlayMapChosenOrBattleBGM movs r0, 0 b _08163E10 .pool @@ -3334,7 +3334,7 @@ _08163BC4: movs r1, 0x1 bl CreateTask movs r0, 0 - bl PlayNewMapMusic__default_for_battle + bl PlayMapChosenOrBattleBGM movs r0, 0xC b _08163E10 .pool @@ -3369,7 +3369,7 @@ _08163C18: movs r1, 0x1 bl CreateTask movs r0, 0 - bl PlayNewMapMusic__default_for_battle + bl PlayMapChosenOrBattleBGM movs r0, 0xD b _08163E10 .pool @@ -3438,7 +3438,7 @@ _08163D12: movs r1, 0x1 bl CreateTask movs r0, 0 - bl PlayNewMapMusic__default_for_battle + bl PlayMapChosenOrBattleBGM movs r0, 0x4 b _08163E10 .pool @@ -3467,7 +3467,7 @@ _08163D5E: movs r1, 0x1 bl CreateTask movs r0, 0 - bl PlayNewMapMusic__default_for_battle + bl PlayMapChosenOrBattleBGM movs r0, 0x5 b _08163E10 .pool @@ -3490,7 +3490,7 @@ _08163D8E: movs r1, 0x1 bl CreateTask movs r0, 0 - bl PlayNewMapMusic__default_for_battle + bl PlayMapChosenOrBattleBGM movs r0, 0x6 b _08163E10 .pool @@ -3513,7 +3513,7 @@ _08163DC8: movs r1, 0x1 bl CreateTask movs r0, 0 - bl PlayNewMapMusic__default_for_battle + bl PlayMapChosenOrBattleBGM movs r0, 0xA b _08163E10 .pool @@ -3528,7 +3528,7 @@ _08163E00: movs r1, 0x1 bl CreateTask movs r0, 0 - bl PlayNewMapMusic__default_for_battle + bl PlayMapChosenOrBattleBGM movs r0, 0x7 _08163E10: bl sub_80B100C @@ -3553,13 +3553,13 @@ _08163E2C: strb r0, [r4] ldr r0, =gUnknown_08224167 bl TrainerBattleConfigure - ldr r0, =gUnknown_02038BCE + ldr r0, =gPartnerTrainerId strh r5, [r0] ldr r0, =sub_8163A8C movs r1, 0x1 bl CreateTask movs r0, 0 - bl PlayNewMapMusic__default_for_battle + bl PlayMapChosenOrBattleBGM movs r0, 0x12 bl sub_8145EF4 _08163E68: @@ -3979,7 +3979,7 @@ _081641E6: lsls r0, r1, 24 lsrs r0, 24 str r2, [sp, 0x18] - bl sub_8165C90 + bl BattleFrontierGetOpponentLvl ldrb r1, [r4] lsls r0, 24 lsrs r0, 24 @@ -4464,7 +4464,7 @@ _081645B8: lsls r0, r1, 24 lsrs r0, 24 str r3, [sp, 0x48] - bl sub_8165C90 + bl BattleFrontierGetOpponentLvl ldrb r1, [r4] lsls r0, 24 lsrs r0, 24 @@ -4782,7 +4782,7 @@ _081648D6: _081648E2: ldr r0, =gStringVar1 adds r1, r7, 0 - bl sub_8162E20 + bl GetFrontierTrainerName b _08164AC2 .pool _081648F4: @@ -4841,7 +4841,7 @@ _08164910: ldr r0, =gStringVar3 mov r3, r10 lsrs r1, r3, 16 - bl sub_8162E20 + bl GetFrontierTrainerName b _08164AC2 .pool _08164984: @@ -4867,7 +4867,7 @@ _081649A8: b _08164AC2 .pool _081649BC: - ldr r0, =gUnknown_02038BCE + ldr r0, =gPartnerTrainerId strh r7, [r0] ldr r0, =0x0000012b cmp r7, r0 @@ -4944,7 +4944,7 @@ _08164A60: bl sub_8162548 lsls r0, 16 lsrs r3, r0, 16 - ldr r0, =gUnknown_02038BCE + ldr r0, =gPartnerTrainerId ldrh r0, [r0] cmp r0, r3 beq _08164A60 @@ -5340,7 +5340,7 @@ sub_8164E04: @ 8164E04 ldr r5, =gTrainerBattleOpponent_A ldrh r1, [r5] mov r0, sp - bl sub_8162E20 + bl GetFrontierTrainerName mov r0, sp bl StripExtCtrlCodes ldr r4, =gSaveBlock2Ptr @@ -5845,7 +5845,7 @@ _08165206: thumb_func_start sub_8165244 sub_8165244: @ 8165244 - ldr r1, =gTrainerPicIndices + ldr r1, =gUnknown_0831F578 ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldr r2, =0x00000bed @@ -5859,7 +5859,7 @@ sub_8165244: @ 8165244 thumb_func_start sub_8165264 sub_8165264: @ 8165264 - ldr r1, =gTrainerClassNameIndices + ldr r1, =gTrainerClassToNameIndex ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldr r2, =0x00000bed @@ -7104,7 +7104,7 @@ sub_8165C40: @ 8165C40 ldrb r0, [r2] lsls r0, 30 lsrs r0, 30 - bl sub_8165C90 + bl BattleFrontierGetOpponentLvl b _08165C88 .pool _08165C84: @@ -7116,8 +7116,8 @@ _08165C88: bx r1 thumb_func_end sub_8165C40 - thumb_func_start sub_8165C90 -sub_8165C90: @ 8165C90 + thumb_func_start BattleFrontierGetOpponentLvl +BattleFrontierGetOpponentLvl: @ 8165C90 push {lr} lsls r0, 24 lsrs r0, 24 @@ -7138,7 +7138,7 @@ _08165CA2: _08165CB0: pop {r1} bx r1 - thumb_func_end sub_8165C90 + thumb_func_end BattleFrontierGetOpponentLvl thumb_func_start sub_8165CB4 sub_8165CB4: @ 8165CB4 @@ -8813,7 +8813,7 @@ _08166BB6: lsls r0, 24 cmp r0, 0 bne _08166BDA - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrb r0, [r0] bl sub_8136F68 ldr r0, =sub_8166BEC diff --git a/asm/rom_817C95C.s b/asm/rom_817C95C.s index 68963869a..a08d34cad 100644 --- a/asm/rom_817C95C.s +++ b/asm/rom_817C95C.s @@ -4959,8 +4959,8 @@ sub_817F3F0: @ 817F3F0 bx r0 thumb_func_end sub_817F3F0 - thumb_func_start sub_817F474 -sub_817F474: @ 817F474 + thumb_func_start GetSpeciesBackAnimId +GetSpeciesBackAnimId: @ 817F474 push {lr} lsls r0, 16 lsrs r0, 16 @@ -4979,6 +4979,6 @@ _0817F48C: _0817F492: pop {r1} bx r1 - thumb_func_end sub_817F474 + thumb_func_end GetSpeciesBackAnimId .align 2, 0 @ Don't pad with nop. diff --git a/asm/rom_818CFC8.s b/asm/rom_818CFC8.s index cd738c640..8bb1971c4 100644 --- a/asm/rom_818CFC8.s +++ b/asm/rom_818CFC8.s @@ -1263,13 +1263,13 @@ sub_818D97C: @ 818D97C bne _0818D9A2 cmp r0, 0 beq _0818D99C - ldr r0, =gTrainerPicIndices + ldr r0, =gUnknown_0831F578 adds r0, 0x3F ldrb r0, [r0] b _0818D9A2 .pool _0818D99C: - ldr r0, =gTrainerPicIndices + ldr r0, =gUnknown_0831F578 adds r0, 0x3C ldrb r0, [r0] _0818D9A2: diff --git a/asm/rom_818E9AC.s b/asm/rom_818E9AC.s index a6e2c5a24..58a942aa0 100644 --- a/asm/rom_818E9AC.s +++ b/asm/rom_818E9AC.s @@ -7171,7 +7171,7 @@ _0819270A: ldr r4, [sp, 0x24] cmp r4, r0 bne _08192784 - ldr r0, =gTrainerClassNameIndices + ldr r0, =gTrainerClassToNameIndex adds r0, 0x3C ldrb r5, [r0] b _081927A2 @@ -7186,7 +7186,7 @@ _08192784: .pool _08192798: ldr r0, [sp, 0x24] - bl sub_8162BD8 + bl GetFrontierOpponentClass _0819279E: lsls r0, 24 lsrs r5, r0, 24 @@ -14292,7 +14292,7 @@ sub_81963F0: @ 81963F0 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl FieldObjectClearAnimIfSpecialAnimFinished bl sub_80D338C @@ -15869,7 +15869,7 @@ _0819702E: lsls r0, 16 lsrs r0, 16 movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _08197050 @@ -15882,7 +15882,7 @@ _08197050: lsls r0, 16 lsrs r0, 16 movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _0819706C @@ -40744,7 +40744,7 @@ sub_81A3DD0: @ 81A3DD0 lsls r0, 16 lsrs r0, 16 movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _081A3ED6 @@ -41123,7 +41123,7 @@ _081A4112: lsls r0, 16 lsrs r0, 16 movs r1, 0x1 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 cmp r0, 0 beq _081A412A @@ -41472,14 +41472,14 @@ _081A4450: ldr r0, =gStringVar1 ldr r1, =gTrainerBattleOpponent_A ldrh r1, [r1] - bl sub_8162E20 + bl GetFrontierTrainerName b _081A446E .pool _081A4464: ldr r0, =gStringVar2 ldr r1, =gTrainerBattleOpponent_A ldrh r1, [r1] - bl sub_8162E20 + bl GetFrontierTrainerName _081A446E: pop {r0} bx r0 @@ -44244,7 +44244,7 @@ sub_81A5BE0: @ 81A5BE0 ldr r0, =gStringVar1 ldr r1, =gTrainerBattleOpponent_A ldrh r1, [r1] - bl sub_8162E20 + bl GetFrontierTrainerName pop {r0} bx r0 .pool @@ -49829,7 +49829,7 @@ _081A896E: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl FieldObjectClearAnimIfSpecialAnimFinished bl sub_80D338C @@ -50127,7 +50127,7 @@ _081A8BB4: bne _081A8BDC b _081A8D32 _081A8BDC: - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects lsls r1, r2, 3 adds r1, r2 lsls r1, 2 @@ -51130,8 +51130,8 @@ sub_81A9424: @ 81A9424 lsls r1, 4 adds r1, r0 mov r8, r1 - ldr r2, =gUnknown_02037350 - ldr r0, =gUnknown_03005DF0 + ldr r2, =gMapObjects + ldr r0, =gSelectedMapObject ldrb r1, [r0] lsls r0, r1, 3 adds r0, r1 @@ -51178,8 +51178,8 @@ _081A9488: mov r9, r0 _081A94AE: ldr r3, =gUnknown_08613ED8 - ldr r2, =gUnknown_02037350 - ldr r0, =gUnknown_03005DF0 + ldr r2, =gMapObjects + ldr r0, =gSelectedMapObject ldrb r1, [r0] lsls r0, r1, 3 adds r0, r1 @@ -51790,7 +51790,7 @@ sub_81A9998: @ 81A9998 mov r8, r0 ldr r1, =0x0000028e mov r12, r1 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects mov r9, r0 _081A99CC: movs r2, 0 @@ -51803,7 +51803,7 @@ _081A99CE: cmp r0, r12 bne _081A9A8A adds r2, 0x7 - ldr r0, =gUnknown_03005DF0 + ldr r0, =gSelectedMapObject ldrb r1, [r0] lsls r0, r1, 3 adds r0, r1 @@ -51931,7 +51931,7 @@ GetBattlePyramidTrainerFlag: @ 81A9AC4 ldr r1, =0x00000e2a adds r2, r1 ldr r4, =gBitTable - ldr r3, =gUnknown_02037350 + ldr r3, =gMapObjects lsls r1, r0, 3 adds r1, r0 lsls r1, 2 @@ -51964,7 +51964,7 @@ sub_81A9B04: @ 81A9B04 beq _081A9B2E movs r0, 0x1 bl sub_80B47E0 - ldr r1, =gUnknown_03005DF0 + ldr r1, =gSelectedMapObject strb r0, [r1] ldr r0, =gTrainerBattleOpponent_B ldrh r0, [r0] @@ -51985,9 +51985,9 @@ sub_81A9B44: @ 81A9B44 lsls r0, 16 lsrs r5, r0, 16 movs r3, 0 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects mov r12, r0 - ldr r6, =gUnknown_03005DF0 + ldr r6, =gSelectedMapObject ldr r1, =gSaveBlock1Ptr mov r10, r1 ldr r7, =gSaveBlock2Ptr @@ -52450,13 +52450,13 @@ sub_81A9F1C: @ 81A9F1C .pool thumb_func_end sub_81A9F1C - thumb_func_start sub_81A9F3C -sub_81A9F3C: @ 81A9F3C + thumb_func_start GetTrainerEncounterMusicIdInBattlePyramind +GetTrainerEncounterMusicIdInBattlePyramind: @ 81A9F3C push {r4,lr} lsls r0, 16 lsrs r0, 16 movs r4, 0 - ldr r3, =gTrainerClassNameIndices + ldr r3, =gTrainerClassToNameIndex ldr r1, =gUnknown_0203BC88 ldr r2, [r1] movs r1, 0x34 @@ -52483,7 +52483,7 @@ _081A9F7A: pop {r4} pop {r1} bx r1 - thumb_func_end sub_81A9F3C + thumb_func_end GetTrainerEncounterMusicIdInBattlePyramind thumb_func_start sub_81A9F80 sub_81A9F80: @ 81A9F80 @@ -56182,7 +56182,7 @@ _081ABE32: _081ABE40: movs r0, 0x5 bl PlaySE - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId mov r1, r10 strh r1, [r0] ldr r0, =gTasks + 0x8 @@ -56216,7 +56216,7 @@ _081ABE68: lsrs r0, 24 adds r1, r4, 0 bl BagGetItemIdByPocketPosition - ldr r1, =gUnknown_0203CE7C + ldr r1, =gScriptItemId strh r0, [r1] ldr r1, =gUnknown_08614054 ldrb r0, [r5, 0x4] @@ -57126,7 +57126,7 @@ _081AC668: .4byte _081AC70C .4byte _081AC690 _081AC690: - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] bl ItemId_GetBattleUsage lsls r0, 24 @@ -57171,7 +57171,7 @@ _081AC6E8: b _081ACA10 .pool _081AC70C: - ldr r4, =gUnknown_0203CE7C + ldr r4, =gScriptItemId ldrh r0, [r4] bl itemid_is_unique lsls r0, 24 @@ -57206,7 +57206,7 @@ _081AC748: b _081ACA10 .pool _081AC76C: - ldr r4, =gUnknown_0203CE7C + ldr r4, =gScriptItemId ldrh r0, [r4] bl itemid_is_unique lsls r0, 24 @@ -57241,7 +57241,7 @@ _081AC7A8: b _081ACA10 .pool _081AC7CC: - ldr r4, =gUnknown_0203CE7C + ldr r4, =gScriptItemId ldrh r0, [r4] bl itemid_is_unique lsls r0, 24 @@ -57289,7 +57289,7 @@ _081AC840: ldrb r0, [r0, 0x5] cmp r0, 0x4 beq _081AC856 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] bl sub_8122148 lsls r0, 24 @@ -57359,7 +57359,7 @@ _081AC8D4: ldr r1, =gUnknown_0861402C movs r2, 0x4 bl memcpy - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] bl itemid_is_mail lsls r0, 24 @@ -57397,7 +57397,7 @@ _081AC92C: ldr r0, [r0] ldr r1, =0x00000496 adds r0, r1 - ldr r2, =gUnknown_0203CE7C + ldr r2, =gScriptItemId ldrh r0, [r0] ldrh r1, [r2] cmp r0, r1 @@ -57473,7 +57473,7 @@ _081ACA12: bne _081ACA50 movs r0, 0x1 bl ClearWindowTilemap - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] bl PrintTMHMMoveData movs r0, 0x3 @@ -57485,7 +57485,7 @@ _081ACA12: b _081ACA86 .pool _081ACA50: - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] ldr r1, =gStringVar1 bl CopyItemName @@ -57986,7 +57986,7 @@ ItemMenu_UseOutOfBattle: @ 81ACE7C push {r4,r5,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r5, =gUnknown_0203CE7C + ldr r5, =gScriptItemId ldrh r0, [r5] bl ItemId_GetFieldFunc cmp r0, 0 @@ -58016,7 +58016,7 @@ _081ACEB8: ldrb r0, [r0, 0x5] cmp r0, 0x3 beq _081ACEE8 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] bl ItemId_GetFieldFunc adds r1, r0, 0 @@ -58056,7 +58056,7 @@ ItemMenu_Toss: @ 81ACEF4 b _081ACF6A .pool _081ACF24: - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] ldr r1, =gStringVar1 bl CopyItemName @@ -58106,7 +58106,7 @@ BagMenuConfirmToss: @ 81ACF88 lsls r4, 3 ldr r0, =gTasks + 0x8 adds r4, r0 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] ldr r1, =gStringVar1 bl CopyItemName @@ -58243,7 +58243,7 @@ BagMenuActuallyToss: @ 81AD0CC lsls r4, 3 ldr r5, =gTasks + 0x8 adds r6, r4, r5 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] ldr r1, =gStringVar1 bl CopyItemName @@ -58313,7 +58313,7 @@ Task_ActuallyToss: @ 81AD150 beq _081AD1CE movs r0, 0x5 bl PlaySE - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] ldrh r1, [r5, 0x10] bl RemoveBagItem @@ -58370,7 +58370,7 @@ ItemMenu_Register: @ 81AD1EC ldr r0, [r0] ldr r2, =0x00000496 adds r1, r0, r2 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r2, [r0] ldrh r0, [r1] cmp r0, r2 @@ -58413,7 +58413,7 @@ ItemMenu_Give: @ 81AD278 lsrs r4, r0, 24 adds r6, r4, 0 bl bag_menu_remove_some_window - ldr r5, =gUnknown_0203CE7C + ldr r5, =gScriptItemId ldrh r0, [r5] bl itemid_80BF6D8_mail_related lsls r0, 24 @@ -58477,7 +58477,7 @@ bag_menu_print_cant_be_held_msg: @ 81AD30C adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] ldr r1, =gStringVar1 bl CopyItemName @@ -58568,7 +58568,7 @@ ItemMenu_UseInBattle: @ 81AD3DC push {r4,r5,lr} lsls r0, 24 lsrs r5, r0, 24 - ldr r4, =gUnknown_0203CE7C + ldr r4, =gScriptItemId ldrh r0, [r4] bl ItemId_GetBattleFunc cmp r0, 0 @@ -58602,7 +58602,7 @@ item_menu_type_2: @ 81AD41C push {r4,r5,lr} lsls r0, 24 lsrs r5, r0, 24 - ldr r4, =gUnknown_0203CE7C + ldr r4, =gScriptItemId ldrh r0, [r4] bl itemid_80BF6D8_mail_related lsls r0, 24 @@ -58663,7 +58663,7 @@ item_menu_type_b: @ 81AD4B4 push {r4,r5,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r5, =gUnknown_0203CE7C + ldr r5, =gScriptItemId ldrh r0, [r5] bl itemid_is_mail lsls r0, 24 @@ -58752,7 +58752,7 @@ _081AD550: bl player_bitmagic bl sub_808B864 bl sub_808BCF4 - ldr r2, =gUnknown_0203CE7C + ldr r2, =gScriptItemId ldr r0, [r4] adds r0, r5 ldrh r1, [r0] @@ -58799,7 +58799,7 @@ display_sell_item_ask_str: @ 81AD5DC lsls r0, 3 ldr r1, =gTasks + 0x8 adds r4, r0, r1 - ldr r6, =gUnknown_0203CE7C + ldr r6, =gScriptItemId ldrh r0, [r6] bl itemid_get_market_price lsls r0, 16 @@ -58862,7 +58862,7 @@ sub_81AD680: @ 81AD680 ldr r0, =gTasks + 0x8 adds r4, r0 ldr r6, =gStringVar1 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] bl itemid_get_market_price lsls r0, 16 @@ -58945,7 +58945,7 @@ sub_81AD730: @ 81AD730 adds r5, r0, 0 lsls r5, 24 lsrs r5, 24 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] bl itemid_get_market_price lsls r0, 16 @@ -58997,7 +58997,7 @@ sub_81AD794: @ 81AD794 ldrb r4, [r0] movs r2, 0x10 ldrsh r5, [r6, r2] - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] bl itemid_get_market_price lsls r0, 16 @@ -59062,7 +59062,7 @@ sub_81AD84C: @ 81AD84C lsls r4, 3 ldr r0, =gTasks + 0x8 adds r4, r0 - ldr r6, =gUnknown_0203CE7C + ldr r6, =gScriptItemId ldrh r0, [r6] ldr r1, =gStringVar2 bl CopyItemName @@ -59123,7 +59123,7 @@ sub_81AD8C8: @ 81AD8C8 adds r5, r0 movs r0, 0x5F bl PlaySE - ldr r2, =gUnknown_0203CE7C + ldr r2, =gScriptItemId mov r8, r2 ldrh r0, [r2] mov r3, r10 @@ -59242,7 +59242,7 @@ display_deposit_item_ask_str: @ 81AD9EC b _081ADA5E .pool _081ADA18: - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] ldr r1, =gStringVar1 bl CopyItemName @@ -59367,7 +59367,7 @@ sub_81ADB14: @ 81ADB14 movs r0, 0x1 movs r1, 0 bl FillWindowPixelBuffer - ldr r4, =gUnknown_0203CE7C + ldr r4, =gScriptItemId ldrh r0, [r4] bl itemid_is_unique lsls r0, 24 @@ -59691,7 +59691,7 @@ _081ADDEC: ldrb r0, [r4] movs r1, 0x2 bl bag_menu_print_cursor_ - ldr r1, =gUnknown_0203CE7C + ldr r1, =gScriptItemId movs r0, 0x4 strh r0, [r1] adds r0, r5, 0 @@ -59727,7 +59727,7 @@ unknown_ItemMenu_Show: @ 81ADE38 lsls r4, 24 lsrs r4, 24 ldr r1, =gSpecialVar_0x8005 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] strh r0, [r1] ldr r1, =gScriptResult @@ -59761,7 +59761,7 @@ unknown_ItemMenu_Give2: @ 81ADE8C adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] movs r1, 0x1 bl RemoveBagItem @@ -65475,7 +65475,7 @@ sub_81B0BFC: @ 81B0BFC muls r1, r0 ldr r0, =gPlayerParty adds r6, r1, r0 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r4, [r0] ldr r0, =gUnknown_0203CEC8 ldrb r0, [r0, 0xB] @@ -72001,7 +72001,7 @@ c2_8123744: @ 81B41F0 mov r7, r8 push {r7} sub sp, 0xC - ldr r6, =gUnknown_0203CE7C + ldr r6, =gScriptItemId ldrh r0, [r6] cmp r0, 0 bne _081B4224 @@ -72107,7 +72107,7 @@ sub_81B42D0: @ 81B42D0 ands r0, r1 cmp r0, 0 bne _081B432C - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r4, [r0] ldr r0, =gUnknown_0203CEC8 mov r8, r0 @@ -72231,7 +72231,7 @@ _081B43FC: beq _081B44DE b _081B44EC _081B4402: - ldr r5, =gUnknown_0203CE7C + ldr r5, =gScriptItemId ldrh r0, [r5] movs r1, 0x1 bl RemoveBagItem @@ -72474,7 +72474,7 @@ sub_81B4624: @ 81B4624 muls r0, r1 ldr r1, =gPlayerParty adds r0, r1 - ldr r1, =gUnknown_0203CE7C + ldr r1, =gScriptItemId ldrh r1, [r1] movs r2, 0 movs r3, 0 @@ -72482,7 +72482,7 @@ sub_81B4624: @ 81B4624 b _081B467C .pool _081B4670: - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] ldrh r1, [r1] movs r2, 0 @@ -75621,7 +75621,7 @@ _081B61BC: movs r7, 0 movs r6, 0 _081B61C0: - ldr r4, =gUnknown_0203CE7C + ldr r4, =gScriptItemId ldrh r0, [r4] bl GetItemEffectType lsls r0, 24 @@ -76049,7 +76049,7 @@ ItemUseCB_Medicine: @ 81B6588 muls r1, r0 ldr r0, =gPlayerParty adds r5, r1, r0 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r6, [r0] adds r0, r5, 0 adds r1, r6, 0 @@ -76294,7 +76294,7 @@ sub_81B67C8: @ 81B67C8 muls r1, r0 ldr r0, =gPlayerParty adds r5, r1, r0 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r6, [r0] adds r0, r6, 0 bl GetItemEffectType @@ -76653,7 +76653,7 @@ dp05_ether: @ 81B6AFC push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] cmp r0, 0xAF bne _081B6B20 @@ -76762,7 +76762,7 @@ ether_effect_related: @ 81B6BEC lsrs r6, r0, 24 movs r4, 0 ldr r7, =gUnknown_0203CED6 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r5, [r0] movs r0, 0xE negs r0, r0 @@ -76991,7 +76991,7 @@ sub_81B6DC4: @ 81B6DC4 movs r0, 0xE adds r0, r7 mov r8, r0 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r4, [r0] ldr r1, =gStringVar1 adds r0, r5, 0 @@ -77080,7 +77080,7 @@ sub_81B6EB4: @ 81B6EB4 adds r5, r1, r0 adds r6, r2, 0 adds r6, 0xE - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r4, [r0] movs r1, 0x2 ldrsh r0, [r6, r1] @@ -77671,7 +77671,7 @@ dp05_rare_candy: @ 81B7404 movs r1, 0x86 lsls r1, 2 adds r4, r6, r1 - ldr r2, =gUnknown_0203CE7C + ldr r2, =gScriptItemId mov r8, r2 adds r0, r5, 0 movs r1, 0x38 @@ -77729,7 +77729,7 @@ _081B74B4: ldrb r0, [r0, 0x9] adds r1, r5, 0 bl sub_81B754C - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] movs r1, 0x1 bl RemoveBagItem @@ -78346,7 +78346,7 @@ sub_81B7A28: @ 81B7A28 lsls r0, 16 lsrs r7, r0, 16 ldrb r0, [r6, 0x9] - ldr r1, =gUnknown_0203CE7C + ldr r1, =gScriptItemId ldrh r1, [r1] movs r2, 0 bl ExecuteTableBasedItemEffect__ @@ -78498,7 +78498,7 @@ _081B7BC8: ldr r1, =gUnknown_0203CEE8 movs r0, 0x1 strb r0, [r1] - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] movs r1, 0x1 bl RemoveBagItem @@ -78574,7 +78574,7 @@ sub_81B7C74: @ 81B7C74 ldr r0, [r1] str r0, [r2] ldrb r0, [r1, 0x9] - ldr r4, =gUnknown_0203CE7C + ldr r4, =gScriptItemId ldrh r1, [r4] movs r2, 0 bl ExecuteTableBasedItemEffect__ @@ -78947,7 +78947,7 @@ _081B7F72: movs r3, 0 bl sub_81B0038 ldr r1, =gUnknown_0203CEC8 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] strh r0, [r1, 0xC] add sp, 0xC @@ -80272,7 +80272,7 @@ sub_81B8A7C: @ 81B8A7C bne _081B8AC4 _081B8AA2: ldr r4, =gStringVar1 - bl sub_806EBF8 + bl GetTrainerPartnerName adds r1, r0, 0 adds r0, r4, 0 bl StringCopy @@ -80378,7 +80378,7 @@ _081B8BA8: movs r0, 0x1 strb r0, [r1] ldr r1, =gBattlePartyID - ldr r0, =gUnknown_020244B8 + ldr r0, =gBankInMenu ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -80410,7 +80410,7 @@ _081B8BFC: b _081B8C42 .pool _081B8C20: - ldr r0, =gUnknown_020244B8 + ldr r0, =gBankInMenu ldrb r0, [r0] ldr r1, =gBattlePartyID lsls r0, 1 @@ -82460,7 +82460,7 @@ sub_81B9CF0: @ 81B9CF0 ldr r0, =gStringVar1 ldr r1, =gTrainerBattleOpponent_A ldrh r1, [r1] - bl sub_8162E20 + bl GetFrontierTrainerName pop {r0} bx r0 .pool diff --git a/asm/rom_81BE66C.s b/asm/rom_81BE66C.s index 2320fccb8..7cc5eef13 100644 --- a/asm/rom_81BE66C.s +++ b/asm/rom_81BE66C.s @@ -225,7 +225,7 @@ sub_81BE808: @ 81BE808 lsls r2, r0, 3 adds r2, r0 lsls r2, 2 - ldr r4, =gUnknown_02037350 + ldr r4, =gMapObjects adds r2, r4 ldr r3, =gSprites ldrb r1, [r2, 0x4] @@ -2290,7 +2290,7 @@ _081BF9EE: strb r1, [r0] movs r0, 0xFF bl sub_81C488C - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleSpritesGfx ldr r0, [r0] cmp r0, 0 bne _081BFA12 @@ -3447,7 +3447,7 @@ sub_81C0484: @ 81C0484 movs r2, 0x80 lsls r2, 1 bl m4aMPlayVolumeControl - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleSpritesGfx ldr r0, [r0] cmp r0, 0 bne _081C04E2 @@ -10970,7 +10970,7 @@ _081C4620: lsls r0, r2, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] ldr r1, [r1, 0x8] b _081C46D6 @@ -10980,12 +10980,12 @@ _081C4668: lsls r0, r2, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] b _081C46B0 .pool _081C4680: - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleSpritesGfx ldr r3, [r0] adds r4, r0, 0 cmp r3, 0 @@ -11162,7 +11162,7 @@ sub_81C47B4: @ 81C47B4 ands r0, r1 strb r0, [r7, 0x5] ldrh r0, [r6, 0x2] - bl sub_806E840 + bl IsPokeSpriteNotFlipped lsls r0, 24 cmp r0, 0 bne _081C4828 @@ -11210,7 +11210,7 @@ sub_81C4844: @ 81C4844 cmp r0, 0x1 beq _081C487E ldrh r0, [r4, 0x2E] - bl sub_806E840 + bl IsPokeSpriteNotFlipped lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x30] @@ -11218,7 +11218,7 @@ sub_81C4844: @ 81C4844 ldrh r1, [r4, 0x2E] ldrb r2, [r5, 0x4] adds r0, r4, 0 - bl sub_806EE0C + bl PokemonSummaryDoMonAnimation _081C487E: pop {r4,r5} pop {r0} @@ -13574,7 +13574,7 @@ _081C5C5C: _081C5C88: movs r0, 0x5 bl PlaySE - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId strh r4, [r0] adds r0, r5, 0 bl sub_81C5B14 @@ -13583,7 +13583,7 @@ _081C5C88: _081C5CA0: movs r0, 0x5 bl PlaySE - ldr r2, =gUnknown_0203CE7C + ldr r2, =gScriptItemId mov r12, r2 ldr r0, =gSaveBlock2Ptr ldr r2, [r0] @@ -13670,7 +13670,7 @@ sub_81C5D20: @ 81C5D20 b _081C5DD8 .pool _081C5D74: - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] bl ItemId_GetBattleUsage lsls r0, 24 @@ -13711,7 +13711,7 @@ _081C5DCE: _081C5DD8: strb r0, [r1] _081C5DDA: - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] ldr r1, =gStringVar1 bl CopyItemName @@ -14184,7 +14184,7 @@ sub_81C61E0: @ 81C61E0 push {r4,r5,lr} lsls r0, 24 lsrs r5, r0, 24 - ldr r4, =gUnknown_0203CE7C + ldr r4, =gScriptItemId ldrh r0, [r4] bl ItemId_GetPocket lsls r0, 24 @@ -14304,7 +14304,7 @@ sub_81C62C4: @ 81C62C4 b _081C6334 .pool _081C62F4: - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] ldr r1, =gStringVar1 bl CopyItemName @@ -14351,7 +14351,7 @@ sub_81C6350: @ 81C6350 lsls r4, 3 ldr r0, =gTasks + 0x8 adds r4, r0 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] ldr r1, =gStringVar1 bl CopyItemName @@ -14566,7 +14566,7 @@ sub_81C654C: @ 81C654C lsls r4, 3 ldr r5, =gTasks + 0x8 adds r6, r4, r5 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] ldr r1, =gStringVar1 bl CopyItemName @@ -14624,7 +14624,7 @@ sub_81C65CC: @ 81C65CC beq _081C662E movs r0, 0x5 bl PlaySE - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] ldrh r1, [r4, 0x10] bl RemovePyramidBagItem @@ -14660,7 +14660,7 @@ sub_81C6648: @ 81C6648 lsrs r4, r0, 24 adds r6, r4, 0 bl sub_81C61A8 - ldr r5, =gUnknown_0203CE7C + ldr r5, =gScriptItemId ldrh r0, [r5] bl itemid_is_mail lsls r0, 24 @@ -14702,7 +14702,7 @@ sub_81C66AC: @ 81C66AC adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - ldr r0, =gUnknown_0203CE7C + ldr r0, =gScriptItemId ldrh r0, [r0] ldr r1, =gStringVar1 bl CopyItemName @@ -14774,7 +14774,7 @@ sub_81C674C: @ 81C674C lsls r0, 24 lsrs r4, r0, 24 adds r6, r4, 0 - ldr r5, =gUnknown_0203CE7C + ldr r5, =gScriptItemId ldrh r0, [r5] bl itemid_80BF6D8_mail_related lsls r0, 24 @@ -14809,7 +14809,7 @@ sub_81C679C: @ 81C679C push {r4,r5,lr} lsls r0, 24 lsrs r5, r0, 24 - ldr r4, =gUnknown_0203CE7C + ldr r4, =gScriptItemId ldrh r0, [r4] bl ItemId_GetBattleFunc cmp r0, 0 @@ -23949,7 +23949,7 @@ _081CAF34: adds r0, r5, 0 bl sub_81D1BD0 adds r4, r0, 0 - ldr r0, =gTrainerPicIndices + ldr r0, =gUnknown_0831F578 adds r0, r4, r0 ldrb r0, [r0] b _081CAF6C @@ -28902,7 +28902,7 @@ sub_81CD624: @ 81CD624 bl sub_81D2C68 cmp r0, 0 beq _081CD690 - ldr r1, =gText_Egg + ldr r1, =gText_EggNickname adds r0, r5, 0 movs r2, 0 movs r3, 0xC @@ -28946,7 +28946,7 @@ _081CD690: _081CD6E0: mov r0, r8 mov r1, r9 - bl get_pokemon_by_box_and_pos + bl GetBoxedMonPtr adds r4, r0, 0 bl GetBoxMonGender lsls r0, 24 @@ -33128,7 +33128,7 @@ sub_81CF8E4: @ 81CF8E4 _081CF924: ldrb r0, [r2] ldrb r1, [r2, 0x1] - bl get_pokemon_by_box_and_pos + bl GetBoxedMonPtr adds r4, r0, 0 bl GetBoxMonGender lsls r0, 24 @@ -34505,7 +34505,7 @@ sub_81D035C: @ 81D035C _081D03A4: ldrb r0, [r7] ldrb r1, [r7, 0x1] - bl get_pokemon_by_box_and_pos + bl GetBoxedMonPtr adds r4, r0, 0 bl GetBoxMonGender lsls r0, 24 @@ -34992,7 +34992,7 @@ sub_81D06E4: @ 81D06E4 _081D0730: ldrb r0, [r1] ldrb r1, [r1, 0x1] - bl get_pokemon_by_box_and_pos + bl GetBoxedMonPtr adds r4, r0, 0 bl GetBoxMonGender strb r0, [r6] @@ -35049,7 +35049,7 @@ sub_81D0760: @ 81D0760 _081D07AC: ldrb r0, [r1] ldrb r1, [r1, 0x1] - bl get_pokemon_by_box_and_pos + bl GetBoxedMonPtr adds r4, r0, 0 movs r1, 0xB bl GetBoxMonData @@ -39944,7 +39944,7 @@ sub_81D2CD0: @ 81D2CD0 bl sub_81D2C68 cmp r0, 0 beq _081D2D20 - ldr r1, =gText_Egg + ldr r1, =gText_EggNickname adds r0, r5, 0 movs r2, 0 movs r3, 0xC @@ -39990,7 +39990,7 @@ _081D2D70: lsrs r0, 24 lsls r1, r6, 24 lsrs r1, 24 - bl get_pokemon_by_box_and_pos + bl GetBoxedMonPtr adds r4, r0, 0 bl GetBoxMonGender lsls r0, 24 @@ -42692,7 +42692,7 @@ sub_81D427C: @ 81D427C lsls r1, r0, 3 adds r1, r0 lsls r1, 2 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects adds r5, r1, r2 ldr r4, =gUnknown_030012F8 ldr r3, =gUnknown_02037590 @@ -42730,7 +42730,7 @@ _081D42CA: mov r8, r0 cmp r0, 0x3 bls _081D42CA - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r0, =gUnknown_02037590 ldrb r1, [r0, 0x5] lsls r0, r1, 3 @@ -42786,7 +42786,7 @@ _081D4356: _081D4360: movs r4, 0 mov r8, r4 - ldr r6, =gUnknown_02037350 + ldr r6, =gMapObjects mov r10, r6 _081D4368: ldr r3, =gUnknown_02037590 @@ -42804,7 +42804,7 @@ _081D4368: ldrsh r2, [r4, r6] movs r6, 0 ldrsh r0, [r0, r6] - ldr r6, =gUnknown_02037350 + ldr r6, =gMapObjects mov r9, r6 mov r12, r3 adds r7, r1, 0 @@ -42952,7 +42952,7 @@ _081D449E: ldrsh r1, [r4, r3] movs r3, 0 ldrsh r0, [r0, r3] - ldr r3, =gUnknown_02037350 + ldr r3, =gMapObjects mov r9, r3 mov r12, r2 cmp r1, r0 @@ -43210,7 +43210,7 @@ _081D46D0: ldrsh r0, [r0, r3] cmp r0, 0 bne _081D476E - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r0, =gUnknown_02037590 ldrb r1, [r0, 0x5] lsls r0, r1, 3 @@ -43235,7 +43235,7 @@ _081D46D0: beq _081D470C b _081D447C _081D470C: - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r0, =gUnknown_02037590 ldrb r1, [r0, 0x5] lsls r0, r1, 3 @@ -43289,7 +43289,7 @@ _081D476E: ldrsh r0, [r0, r2] cmp r0, 0 bne _081D480C - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r0, =gUnknown_02037590 ldrb r1, [r0, 0x5] lsls r0, r1, 3 @@ -43314,7 +43314,7 @@ _081D476E: beq _081D47AA b _081D45AA _081D47AA: - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects ldr r0, =gUnknown_02037590 ldrb r1, [r0, 0x5] lsls r0, r1, 3 @@ -43385,7 +43385,7 @@ sub_81D4834: @ 81D4834 lsls r0, 16 lsls r1, 16 lsrs r4, r1, 16 - ldr r3, =gUnknown_02037350 + ldr r3, =gMapObjects ldr r1, =gUnknown_02037590 ldrb r2, [r1, 0x5] lsls r1, r2, 3 @@ -43436,7 +43436,7 @@ sub_81D4890: @ 81D4890 lsls r1, r0, 3 adds r1, r0 lsls r1, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r1, r0 movs r1, 0 ldr r3, =gUnknown_030012FC @@ -43684,7 +43684,7 @@ sub_81D4A90: @ 81D4A90 lsls r1, r0, 3 adds r1, r0 lsls r1, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r5, r1, r0 ldrb r1, [r5, 0x1] movs r0, 0x21 @@ -44939,7 +44939,7 @@ sub_81D5530: @ 81D5530 lsls r1, 24 adds r0, r1 lsrs r0, 24 - ldr r2, =gTrainerClassNameIndices + ldr r2, =gTrainerClassToNameIndex ldr r1, =gUnknown_0203CF58 ldr r1, [r1] adds r1, 0x16 @@ -45006,7 +45006,7 @@ sub_81D5588: @ 81D5588 adds r3, r0 ldrb r4, [r3, 0x1B] bl sub_81D5710 - ldr r0, =gTrainerPicIndices + ldr r0, =gUnknown_0831F578 adds r4, r0 ldrb r0, [r4] pop {r4} @@ -46426,7 +46426,7 @@ GetTrainerHillTrainerFlag: @ 81D619C bl sub_81D5520 lsls r0, 24 lsrs r0, 23 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects lsls r1, r4, 3 adds r1, r4 lsls r1, 2 @@ -46715,7 +46715,7 @@ sub_81D63C8: @ 81D63C8 ldrb r4, [r3, 0x1B] bl sub_81D5710 movs r2, 0 - ldr r0, =gTrainerClassNameIndices + ldr r0, =gTrainerClassToNameIndex adds r4, r0 ldrb r3, [r4] ldr r1, =gUnknown_0862A3B4 diff --git a/asm/scrcmd.s b/asm/scrcmd.s index 2cef4b0b0..0598c2310 100644 --- a/asm/scrcmd.s +++ b/asm/scrcmd.s @@ -2987,8 +2987,8 @@ sA9_unknown: @ 809A974 thumb_func_start s5A_face_player s5A_face_player: @ 809A9A4 push {r4,lr} - ldr r2, =gUnknown_02037350 - ldr r0, =gUnknown_03005DF0 + ldr r2, =gMapObjects + ldr r0, =gSelectedMapObject ldrb r1, [r0] lsls r0, r1, 3 adds r0, r1 @@ -3163,8 +3163,8 @@ sub_809AAEC: @ 809AAEC movs r0, 0 b _0809AB3A _0809AAFC: - ldr r2, =gUnknown_02037350 - ldr r0, =gUnknown_03005DF0 + ldr r2, =gMapObjects + ldr r0, =gSelectedMapObject ldrb r1, [r0] lsls r0, r1, 3 adds r0, r1 @@ -3208,7 +3208,7 @@ s6B_release: @ 809AB44 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl FieldObjectClearAnimIfSpecialAnimFinished bl sub_80D338C @@ -3223,8 +3223,8 @@ s6B_release: @ 809AB44 s6C_release_2: @ 809AB7C push {r4,lr} bl textbox_close - ldr r4, =gUnknown_02037350 - ldr r0, =gUnknown_03005DF0 + ldr r4, =gMapObjects + ldr r0, =gSelectedMapObject ldrb r1, [r0] lsls r0, r1, 3 adds r0, r1 @@ -5379,7 +5379,7 @@ sub_809BBDC: @ 809BBDC sub_809BBE8: @ 809BBE8 push {lr} bl sub_80B47BC - ldr r1, =gUnknown_03005DF0 + ldr r1, =gSelectedMapObject strb r0, [r1] movs r0, 0 pop {r1} @@ -5397,8 +5397,8 @@ sub_809BBFC: @ 809BBFC movs r0, 0 b _0809BC30 _0809BC0C: - ldr r2, =gUnknown_02037350 - ldr r0, =gUnknown_03005DF0 + ldr r2, =gMapObjects + ldr r0, =gSelectedMapObject ldrb r1, [r0] lsls r0, r1, 3 adds r0, r1 @@ -5630,7 +5630,7 @@ sub_809BDD0: @ 809BDD0 lsls r4, 2 adds r4, r1 ldr r4, [r4] - bl sub_806F07C + bl GetTrainerClassNameFromId adds r1, r0, 0 adds r0, r4, 0 bl StringCopy @@ -5658,7 +5658,7 @@ sub_809BE0C: @ 809BE0C lsls r4, 2 adds r4, r1 ldr r4, [r4] - bl sub_806F0B0 + bl GetTrainerNameFromId adds r1, r0, 0 adds r0, r4, 0 bl StringCopy diff --git a/asm/script_pokemon_util_80F87D8.s b/asm/script_pokemon_util_80F87D8.s index c0bcb5a6e..e26194298 100644 --- a/asm/script_pokemon_util_80F87D8.s +++ b/asm/script_pokemon_util_80F87D8.s @@ -508,7 +508,7 @@ _080F8BBA: bl GetFieldObjectIdByLocalIdAndMap lsls r0, 24 lsrs r0, 24 - ldr r2, =gUnknown_02037350 + ldr r2, =gMapObjects lsls r1, r0, 3 adds r1, r0 lsls r1, 2 @@ -710,7 +710,7 @@ _080F8D44: lsls r0, r6, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] ldr r1, [r1, 0x8] adds r2, r6, 0 @@ -722,7 +722,7 @@ _080F8DC4: lsls r0, r6, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] ldr r1, [r1, 0x8] adds r2, r6, 0 @@ -776,7 +776,7 @@ _080F8DD8: adds r1, r6, 0 movs r2, 0 movs r3, 0 - bl sub_806ED40 + bl DoMonFrontSpriteAnimation b _080F8E6C .pool _080F8E58: @@ -788,7 +788,7 @@ _080F8E58: adds r1, r6, 0 movs r2, 0 movs r3, 0 - bl sub_806ED40 + bl DoMonFrontSpriteAnimation _080F8E6C: ldr r1, =gTasks lsls r0, r7, 2 @@ -1320,10 +1320,10 @@ sub_80F9244: @ 80F9244 blt _080F92B8 adds r0, r5, 0 movs r1, 0x2 - bl pokedex_flag_operation + bl GetSetPokedexFlag adds r0, r5, 0 movs r1, 0x3 - bl pokedex_flag_operation + bl GetSetPokedexFlag _080F92B8: adds r0, r4, 0 add sp, 0x78 diff --git a/asm/secret_base.s b/asm/secret_base.s index 84a6c0813..2188e634d 100644 --- a/asm/secret_base.s +++ b/asm/secret_base.s @@ -756,7 +756,7 @@ sub_80E90C8: @ 80E90C8 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 movs r1, 0x2 bl FieldObjectTurn diff --git a/asm/shop.s b/asm/shop.s index 8a0524792..9e03399fc 100644 --- a/asm/shop.s +++ b/asm/shop.s @@ -1633,7 +1633,7 @@ _080E07AA: lsrs r0, 24 mov r1, r12 strh r0, [r1] - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects lsls r0, r6, 3 adds r0, r6 lsls r0, 2 @@ -1730,7 +1730,7 @@ BuyMenuDrawFieldObjects: @ 80E08F0 movs r7, 0 ldr r0, =gUnknown_02039F70 mov r8, r0 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects mov r10, r1 ldr r2, =gSprites mov r9, r2 diff --git a/asm/trade.s b/asm/trade.s index 6a46acb8c..3f9323971 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -288,7 +288,7 @@ sub_80773AC: @ 80773AC ldr r0, =gMain movs r1, 0 str r1, [r0] - ldr r0, =gUnknown_020244EA + ldr r0, =gEnemyPartyCount strb r1, [r0] pop {r0} bx r0 @@ -600,7 +600,7 @@ _080776A8: adds r0, 0x36 strb r1, [r0] ldr r0, [r2] - ldr r1, =gUnknown_020244EA + ldr r1, =gEnemyPartyCount ldrb r1, [r1] adds r0, 0x37 strb r1, [r0] @@ -1211,7 +1211,7 @@ _08077C6C: adds r0, 0x36 strb r1, [r0] ldr r0, [r4] - ldr r1, =gUnknown_020244EA + ldr r1, =gEnemyPartyCount ldrb r1, [r1] adds r0, 0x37 strb r1, [r0] @@ -7128,7 +7128,7 @@ _0807AD58: lsls r0, r5, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] ldr r1, [r1, 0x8] adds r2, r5, 0 @@ -7141,7 +7141,7 @@ _0807AD94: lsls r0, r5, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r2, [r1] lsls r4, r6, 1 adds r1, r4, 0x1 @@ -7885,11 +7885,11 @@ sub_807B464: @ 807B464 lsrs r4, 16 adds r0, r4, 0 movs r1, 0x2 - bl pokedex_flag_operation + bl GetSetPokedexFlag adds r0, r4, 0 movs r1, 0x3 adds r2, r5, 0 - bl SetPokedexFlag + bl HandleSetPokedexFlag _0807B4B8: pop {r4,r5} pop {r0} @@ -9588,7 +9588,7 @@ _0807C66C: ldr r0, [r5] adds r0, 0xF0 ldrh r0, [r0] - bl sub_806E840 + bl IsPokeSpriteNotFlipped lsls r0, 24 cmp r0, 0 bne _0807C6E4 @@ -10369,7 +10369,7 @@ _0807CCEE: lsls r0, r2, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] ldr r1, [r1, 0x10] ldr r3, [r3, 0x6C] @@ -11662,7 +11662,7 @@ _0807DA74: ldr r0, [r5] adds r0, 0xF0 ldrh r0, [r0] - bl sub_806E840 + bl IsPokeSpriteNotFlipped lsls r0, 24 cmp r0, 0 bne _0807DAEC @@ -12474,7 +12474,7 @@ _0807E13A: lsls r0, r2, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleSpritesGfx ldr r1, [r1] ldr r1, [r1, 0x10] ldr r3, [r3, 0x6C] diff --git a/asm/trainer_card.s b/asm/trainer_card.s index 202c4f75e..ec0b58653 100644 --- a/asm/trainer_card.s +++ b/asm/trainer_card.s @@ -4754,7 +4754,7 @@ sub_80C4FF0: @ 80C4FF0 ldr r1, =0x00000583 adds r0, r1 ldrb r0, [r0] - bl TrainerClassToTrainerPic + bl sub_806EFF0 lsls r0, 16 lsrs r0, 16 ldr r4, =gUnknown_0856FB18 @@ -4795,7 +4795,7 @@ _080C5060: adds r0, r1 adds r0, r2 ldrb r0, [r0] - bl TrainerClassToTrainerPic + bl sub_806EFF0 lsls r0, 16 lsrs r0, 16 ldr r4, =gUnknown_0856FB18 diff --git a/asm/trainer_see.s b/asm/trainer_see.s index cd9715a5c..d725b9f15 100644 --- a/asm/trainer_see.s +++ b/asm/trainer_see.s @@ -15,7 +15,7 @@ CheckForTrainersWantingBattle: @ 80B3BE8 ldr r0, =gUnknown_02038BFC strb r1, [r0] movs r4, 0 - ldr r6, =gUnknown_02037350 + ldr r6, =gMapObjects _080B3BF8: lsls r0, r4, 3 adds r0, r4 @@ -180,7 +180,7 @@ _080B3D56: lsls r4, r5, 3 adds r0, r4, r5 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 bl CheckIfTrainerCanApproachPlayer lsls r0, 24 @@ -227,7 +227,7 @@ _080B3D8A: mov r1, r8 adds r0, r1, r5 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r0, r1 subs r1, r6, 0x1 lsls r1, 24 @@ -691,7 +691,7 @@ c3_8081EDC: @ 80B4118 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r5, r0, r1 ldrb r0, [r5] lsls r0, 31 @@ -887,7 +887,7 @@ _080B427A: lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 adds r0, r4, 0 bl FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive @@ -906,7 +906,7 @@ _080B42D2: lsls r4, r0, 3 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02037350 + ldr r0, =gMapObjects adds r4, r0 ldrb r0, [r5, 0x18] lsls r0, 28 @@ -941,7 +941,7 @@ sub_80B4318: @ 80B4318 lsls r0, r1, 3 adds r0, r1 lsls r0, 2 - ldr r1, =gUnknown_02037350 + ldr r1, =gMapObjects adds r4, r0, r1 adds r0, r4, 0 bl FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive diff --git a/asm/tv.s b/asm/tv.s index 12f1852ff..2ebdfc0a1 100644 --- a/asm/tv.s +++ b/asm/tv.s @@ -6988,7 +6988,7 @@ _080EFA62: lsls r0, 16 lsrs r0, 16 movs r1, 0 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 asrs r0, 24 cmp r0, 0x1 @@ -7570,7 +7570,7 @@ sub_80EFEC4: @ 80EFEC4 ldrb r0, [r0] ldr r1, =gSpecialVar_0x8013 ldrb r1, [r1] - bl get_pokemon_by_box_and_pos + bl GetBoxedMonPtr adds r6, r0, 0 ldr r2, =gStringVar3 movs r1, 0x2 @@ -9041,7 +9041,7 @@ sub_80F0B24: @ 80F0B24 lsls r0, 16 lsrs r0, 16 movs r1, 0 - bl pokedex_flag_operation + bl GetSetPokedexFlag lsls r0, 24 asrs r2, r0, 24 cmp r2, 0 diff --git a/data/battle_message.s b/data/battle_message.s index 34a2ad3c8..93a921b5e 100644 --- a/data/battle_message.s +++ b/data/battle_message.s @@ -249,7 +249,7 @@ gUnknown_085CA459:: @ 85CA459 .string "{STRING 19} transformed!$" .string "{STRING 16}’s {STRING 25}\ntook the attack!$" -gUnknown_085CB2A1:: @ 85CB2A1 +BattleText_PreventedSwitch:: @ 85CB2A1 .string "{STRING 0}’s {STRING 23}\nprevents switching!\p$" .string "{STRING 16}’s {STRING 25}\nprevented {STRING 19}’s\l{STRING 0} from working!$" @@ -548,7 +548,7 @@ gUnknown_085CBDBD:: @ 85CBDBD gUnknown_085CBDBF:: @ 85CBDBF .incbin "baserom.gba", 0x5cbdbf, 0x41 -gUnknown_085CBE00:: @ 85CBE00 +gStatNamesTable:: @ 85CBE00 .incbin "baserom.gba", 0x5cbe00, 0x6c gUnknown_085CBE6C:: @ 85CBE6C @@ -679,10 +679,10 @@ gUnknown_085CCB88:: @ 85CCB88 gUnknown_085CCB8C:: @ 85CCB8C .incbin "baserom.gba", 0x5ccb8c, 0x4 -gUnknown_085CCB90:: @ 85CCB90 +gBadEggNickname:: @ 85CCB90 .incbin "baserom.gba", 0x5ccb90, 0x8 -gUnknown_085CCB98:: @ 85CCB98 +BattleText_Wally:: @ 85CCB98 .incbin "baserom.gba", 0x5ccb98, 0x6 gUnknown_085CCB9E:: @ 85CCB9E diff --git a/data/data2c.s b/data/data2c.s index 94d9c30e8..26f237c1c 100644 --- a/data/data2c.s +++ b/data/data2c.s @@ -53,10 +53,10 @@ @ 832937C .include "data/level_up_learnset_pointers.inc" -gUnknown_083299EC:: @ 83299EC +gMonFrontAnimIdsTable:: @ 83299EC .incbin "baserom.gba", 0x3299ec, 0x19b -gUnknown_08329B87:: @ 8329B87 +gMonAnimationDelayTable:: @ 8329B87 .incbin "baserom.gba", 0x329b87, 0x19b gUnknown_08329D22:: @ 8329D22 @@ -101,11 +101,8 @@ gUnknown_08329ECE:: @ 8329ECE gHMMoves:: @ 8329EEA .incbin "baserom.gba", 0x329eea, 0x12 -gUnknown_08329EFC:: @ 8329EFC - .incbin "baserom.gba", 0x329efc, 0x2 - -gAlteringCaveWildMonHeldItems:: @ 8329EFE - .incbin "baserom.gba", 0x329efe, 0x2a +gAlteringCaveWildMonHeldItems:: @ 8329EFC + .incbin "baserom.gba", 0x329efc, 0x2c gUnknown_08329F28:: @ 8329F28 .incbin "baserom.gba", 0x329f28, 0x18 diff --git a/data/data3.s b/data/data3.s index efb03a954..7af7a70e8 100644 --- a/data/data3.s +++ b/data/data3.s @@ -2894,423 +2894,3 @@ gUnknown_08589AD8:: @ 8589AD8 gUnknown_08589ADE:: @ 8589ADE .incbin "baserom.gba", 0x589ade, 0x6 - -@ 8589AE4 - .include "data/text/berry_descriptions.inc" - -@ 858A670 - .include "data/berries.inc" - -gUnknown_0858AB24:: @ 858AB24 - .incbin "baserom.gba", 0x58ab24, 0xac - -gUnknown_0858ABD0:: @ 858ABD0 - .incbin "baserom.gba", 0x58abd0, 0xb90 - -gUnknown_0858B760:: @ 858B760 - .incbin "baserom.gba", 0x58b760, 0x390 - -gUnknown_0858BAF0:: @ 858BAF0 - .incbin "baserom.gba", 0x58baf0, 0x78 - -gUnknown_0858BB68:: @ 858BB68 - .incbin "baserom.gba", 0x58bb68, 0x8 - -gUnknown_0858BB70:: @ 858BB70 - .incbin "baserom.gba", 0x58bb70, 0x10 - -gUnknown_0858BB80:: @ 858BB80 - .incbin "baserom.gba", 0x58bb80, 0x1c - -gUnknown_0858BB9C:: @ 858BB9C - .incbin "baserom.gba", 0x58bb9c, 0x10 - -gUnknown_0858BBAC:: @ 858BBAC - .incbin "baserom.gba", 0x58bbac, 0x10 - -gUnknown_0858BBBC:: @ 858BBBC - .incbin "baserom.gba", 0x58bbbc, 0x10 - -gUnknown_0858BBCC:: @ 858BBCC - .incbin "baserom.gba", 0x58bbcc, 0x14 - -gUnknown_0858BBE0:: @ 858BBE0 - .incbin "baserom.gba", 0x58bbe0, 0xc - -gUnknown_0858BBEC:: @ 858BBEC - .incbin "baserom.gba", 0x58bbec, 0x18c - -gUnknown_0858BD78:: @ 858BD78 - .incbin "baserom.gba", 0x58bd78, 0x40 - -gUnknown_0858BDB8:: @ 858BDB8 - .incbin "baserom.gba", 0x58bdb8, 0x10 - -gUnknown_0858BDC8:: @ 858BDC8 - .incbin "baserom.gba", 0x58bdc8, 0x38 - -gUnknown_0858BE00:: @ 858BE00 - .incbin "baserom.gba", 0x58be00, 0x10 - -gUnknown_0858BE10:: @ 858BE10 - .incbin "baserom.gba", 0x58be10, 0x30 - -gUnknown_0858BE40:: @ 858BE40 - .incbin "baserom.gba", 0x58be40, 0x60 - -gUnknown_0858BEA0:: @ 858BEA0 - .incbin "baserom.gba", 0x58bea0, 0x3 - -gUnknown_0858BEA3:: @ 858BEA3 - .incbin "baserom.gba", 0x58bea3, 0x18 - -gUnknown_0858BEBB:: @ 858BEBB - .incbin "baserom.gba", 0x58bebb, 0x3 - -gUnknown_0858BEBE:: @ 858BEBE - .incbin "baserom.gba", 0x58bebe, 0x3 - -gUnknown_0858BEC1:: @ 858BEC1 - .incbin "baserom.gba", 0x58bec1, 0x3 - -gUnknown_0858BEC4:: @ 858BEC4 - .incbin "baserom.gba", 0x58bec4, 0x10 - -gUnknown_0858BED4:: @ 858BED4 - .incbin "baserom.gba", 0x58bed4, 0x8 - -gUnknown_0858BEDC:: @ 858BEDC - .incbin "baserom.gba", 0x58bedc, 0x8 - -gUnknown_0858BEE4:: @ 858BEE4 - .incbin "baserom.gba", 0x58bee4, 0x4 - -gUnknown_0858BEE8:: @ 858BEE8 - .incbin "baserom.gba", 0x58bee8, 0x10 - -gUnknown_0858BEF8:: @ 858BEF8 - .incbin "baserom.gba", 0x58bef8, 0x6 - -gUnknown_0858BEFE:: @ 858BEFE - .incbin "baserom.gba", 0x58befe, 0x6 - -gUnknown_0858BF04:: @ 858BF04 - .incbin "baserom.gba", 0x58bf04, 0x14 - -gUnknown_0858BF18:: @ 858BF18 - .incbin "baserom.gba", 0x58bf18, 0x10 - -gUnknown_0858BF28:: @ 858BF28 - .incbin "baserom.gba", 0x58bf28, 0xc - -gUnknown_0858BF34:: @ 858BF34 - .incbin "baserom.gba", 0x58bf34, 0xa - -gUnknown_0858BF3E:: @ 858BF3E - .incbin "baserom.gba", 0x58bf3e, 0xa - -gUnknown_0858BF48:: @ 858BF48 - .incbin "baserom.gba", 0x58bf48, 0x8 - -gUnknown_0858BF50:: @ 858BF50 - .incbin "baserom.gba", 0x58bf50, 0x8 - -gUnknown_0858BF58:: @ 858BF58 - .incbin "baserom.gba", 0x58bf58, 0x14 - -gUnknown_0858BF6C:: @ 858BF6C - .incbin "baserom.gba", 0x58bf6c, 0x8 - -gUnknown_0858BF74:: @ 858BF74 - .incbin "baserom.gba", 0x58bf74, 0x14 - -gUnknown_0858BF88:: @ 858BF88 - .incbin "baserom.gba", 0x58bf88, 0x4 - -gUnknown_0858BF8C:: @ 858BF8C - .incbin "baserom.gba", 0x58bf8c, 0xc - -gUnknown_0858BF98:: @ 858BF98 - .incbin "baserom.gba", 0x58bf98, 0xc - -gUnknown_0858BFA4:: @ 858BFA4 - .incbin "baserom.gba", 0x58bfa4, 0x34 - -gUnknown_0858BFD8:: @ 858BFD8 - .incbin "baserom.gba", 0x58bfd8, 0x78 - -gUnknown_0858C050:: @ 858C050 - .incbin "baserom.gba", 0x58c050, 0x8 - -gUnknown_0858C058:: @ 858C058 - .incbin "baserom.gba", 0x58c058, 0x18 - -gUnknown_0858C070:: @ 858C070 - .incbin "baserom.gba", 0x58c070, 0x8 - -gUnknown_0858C078:: @ 858C078 - .incbin "baserom.gba", 0x58c078, 0x48 - -gUnknown_0858C0C0:: @ 858C0C0 - .incbin "baserom.gba", 0x58c0c0, 0x18 - -gUnknown_0858C0D8:: @ 858C0D8 - .incbin "baserom.gba", 0x58c0d8, 0x18 - -gUnknown_0858C0F0:: @ 858C0F0 - .incbin "baserom.gba", 0x58c0f0, 0x18 - -gUnknown_0858C108:: @ 858C108 - .incbin "baserom.gba", 0x58c108, 0x18 - -gUnknown_0858C120:: @ 858C120 - .incbin "baserom.gba", 0x58c120, 0x18 - -gUnknown_0858C138:: @ 858C138 - .incbin "baserom.gba", 0x58c138, 0x18 - -gUnknown_0858C150:: @ 858C150 - .incbin "baserom.gba", 0x58c150, 0x18 - -gUnknown_0858C168:: @ 858C168 - .incbin "baserom.gba", 0x58c168, 0x18 - -gUnknown_0858C180:: @ 858C180 - .incbin "baserom.gba", 0x58c180, 0x18 - -gUnknown_0858C198:: @ 858C198 - .incbin "baserom.gba", 0x58c198, 0x30 - -gUnknown_0858C1C8:: @ 858C1C8 - .incbin "baserom.gba", 0x58c1c8, 0x68 - -gUnknown_0858C230:: @ 858C230 - .incbin "baserom.gba", 0x58c230, 0x5c - -gUnknown_0858C28C:: @ 858C28C - .incbin "baserom.gba", 0x58c28c, 0x18 - -gUnknown_0858C2A4:: @ 858C2A4 - .incbin "baserom.gba", 0x58c2a4, 0x8 - -gUnknown_0858C2AC:: @ 858C2AC - .incbin "baserom.gba", 0x58c2ac, 0x8 - -@ 858C2B4 - .include "data/contest_moves.inc" - -@ 858CDCC - .include "data/contest_effects.inc" - -@ A lookup table with a 1 for each combo starter ID and a 0 for ID 0, -@ which means "not a combo starter move". -gComboStarterLookupTable:: @ 858CE8C - .byte 0 - .rept 62 - .byte 1 - .endr - - .align 2 -@ 858CECC - .include "data/contest_effect_function_table.inc" - -gUnknown_0858CF8C:: @ 858CF8C - .incbin "baserom.gba", 0x58cf8c, 0x2 - -gUnknown_0858CF8E:: @ 858CF8E - .incbin "baserom.gba", 0x58cf8e, 0x6 - -gUnknown_0858CF94:: @ 858CF94 - .incbin "baserom.gba", 0x58cf94, 0x24 - -gUnknown_0858CFB8:: @ 858CFB8 - .incbin "baserom.gba", 0x58cfb8, 0x6 - -gUnknown_0858CFBE:: @ 858CFBE - .incbin "baserom.gba", 0x58cfbe, 0xe - -gUnknown_0858CFCC:: @ 858CFCC - .incbin "baserom.gba", 0x58cfcc, 0x1c - -gUnknown_0858CFE8:: @ 858CFE8 - .incbin "baserom.gba", 0x58cfe8, 0x60 - -gUnknown_0858D048:: @ 858D048 - .incbin "baserom.gba", 0x58d048, 0x10 - -gUnknown_0858D058:: @ 858D058 - .incbin "baserom.gba", 0x58d058, 0x8 - -gUnknown_0858D060:: @ 858D060 - .incbin "baserom.gba", 0x58d060, 0xc - -gUnknown_0858D06C:: @ 858D06C - .incbin "baserom.gba", 0x58d06c, 0x10 - -gUnknown_0858D07C:: @ 858D07C - .incbin "baserom.gba", 0x58d07c, 0x18 - -gUnknown_0858D094:: @ 858D094 - .incbin "baserom.gba", 0x58d094, 0x3c - -gUnknown_0858D0D0:: @ 858D0D0 - .incbin "baserom.gba", 0x58d0d0, 0xe - -gUnknown_0858D0DE:: @ 858D0DE - .incbin "baserom.gba", 0x58d0de, 0xe - -gUnknown_0858D0EC:: @ 858D0EC - .incbin "baserom.gba", 0x58d0ec, 0x1c - -gUnknown_0858D108:: @ 858D108 - .incbin "baserom.gba", 0x58d108, 0x14 - -gUnknown_0858D11C:: @ 858D11C - .incbin "baserom.gba", 0x58d11c, 0x14 - -gUnknown_0858D130:: @ 858D130 - .incbin "baserom.gba", 0x58d130, 0x14 - -gUnknown_0858D144:: @ 858D144 - .incbin "baserom.gba", 0x58d144, 0xc - -gUnknown_0858D150:: @ 858D150 - .incbin "baserom.gba", 0x58d150, 0x20 - -gUnknown_0858D170:: @ 858D170 - .incbin "baserom.gba", 0x58d170, 0x18 - -gUnknown_0858D188:: @ 858D188 - .incbin "baserom.gba", 0x58d188, 0x14 - -gUnknown_0858D19C:: @ 858D19C - .incbin "baserom.gba", 0x58d19c, 0x4 - -gUnknown_0858D1A0:: @ 858D1A0 - .incbin "baserom.gba", 0x58d1a0, 0x30 - -gUnknown_0858D1D0:: @ 858D1D0 - .incbin "baserom.gba", 0x58d1d0, 0x34 - -gUnknown_0858D204:: @ 858D204 - .incbin "baserom.gba", 0x58d204, 0x24 - -gUnknown_0858D228:: @ 858D228 - .incbin "baserom.gba", 0x58d228, 0x18 - -gUnknown_0858D240:: @ 858D240 - .incbin "baserom.gba", 0x58d240, 0x3c - -gUnknown_0858D27C:: @ 858D27C - .incbin "baserom.gba", 0x58d27c, 0x84 - -gUnknown_0858D300:: @ 858D300 - .incbin "baserom.gba", 0x58d300, 0x20 - -gUnknown_0858D320:: @ 858D320 - .incbin "baserom.gba", 0x58d320, 0x18 - -gUnknown_0858D338:: @ 858D338 - .incbin "baserom.gba", 0x58d338, 0x4c - -gUnknown_0858D384:: @ 858D384 - .incbin "baserom.gba", 0x58d384, 0x10 - -gUnknown_0858D394:: @ 858D394 - .incbin "baserom.gba", 0x58d394, 0x1c - -gUnknown_0858D3B0:: @ 858D3B0 - .incbin "baserom.gba", 0x58d3b0, 0x8 - -gUnknown_0858D3B8:: @ 858D3B8 - .incbin "baserom.gba", 0x58d3b8, 0xc - -gUnknown_0858D3C4:: @ 858D3C4 - .incbin "baserom.gba", 0x58d3c4, 0x2c - -gUnknown_0858D3F0:: @ 858D3F0 - .incbin "baserom.gba", 0x58d3f0, 0x1c - -gUnknown_0858D40C:: @ 858D40C - .incbin "baserom.gba", 0x58d40c, 0xc - -gUnknown_0858D418:: @ 858D418 - .incbin "baserom.gba", 0x58d418, 0x10 - -gUnknown_0858D428:: @ 858D428 - .incbin "baserom.gba", 0x58d428, 0x34 - -gUnknown_0858D45C:: @ 858D45C - .incbin "baserom.gba", 0x58d45c, 0x38 - -gUnknown_0858D494:: @ 858D494 - .incbin "baserom.gba", 0x58d494, 0x4 - -gUnknown_0858D498:: @ 858D498 - .incbin "baserom.gba", 0x58d498, 0x1c - -gUnknown_0858D4B4:: @ 858D4B4 - .incbin "baserom.gba", 0x58d4b4, 0x30 - -gUnknown_0858D4E4:: @ 858D4E4 - .incbin "baserom.gba", 0x58d4e4, 0x40 - -gUnknown_0858D524:: @ 858D524 - .incbin "baserom.gba", 0x58d524, 0x4c - -gUnknown_0858D570:: @ 858D570 - .incbin "baserom.gba", 0x58d570, 0x24 - -gUnknown_0858D594:: @ 858D594 - .incbin "baserom.gba", 0x58d594, 0xac - -gUnknown_0858D640:: @ 858D640 - .incbin "baserom.gba", 0x58d640, 0x2c - -gUnknown_0858D66C:: @ 858D66C - .incbin "baserom.gba", 0x58d66c, 0x24 - -gUnknown_0858D690:: @ 858D690 - .incbin "baserom.gba", 0x58d690, 0x20 - -gUnknown_0858D6B0:: @ 858D6B0 - .incbin "baserom.gba", 0x58d6b0, 0x20 - -gUnknown_0858D6D0:: @ 858D6D0 - .incbin "baserom.gba", 0x58d6d0, 0x128 - -gUnknown_0858D7F8:: @ 858D7F8 - .incbin "baserom.gba", 0x58d7f8, 0x18 - -gUnknown_0858D810:: @ 858D810 - .incbin "baserom.gba", 0x58d810, 0x40 - -gUnknown_0858D850:: @ 858D850 - .incbin "baserom.gba", 0x58d850, 0x10 - -gUnknown_0858D860:: @ 858D860 - .incbin "baserom.gba", 0x58d860, 0x18 - -gUnknown_0858D878:: @ 858D878 - .incbin "baserom.gba", 0x58d878, 0x8 - -gUnknown_0858D880:: @ 858D880 - .incbin "baserom.gba", 0x58d880, 0x8 - -gUnknown_0858D888:: @ 858D888 - .incbin "baserom.gba", 0x58d888, 0x10 - -gUnknown_0858D898:: @ 858D898 - .incbin "baserom.gba", 0x58d898, 0x30 - -gUnknown_0858D8C8:: @ 858D8C8 - .incbin "baserom.gba", 0x58d8c8, 0x18 - -gUnknown_0858D8E0:: @ 858D8E0 - .incbin "baserom.gba", 0x58d8e0, 0x8 - -gUnknown_0858D8E8:: @ 858D8E8 - .incbin "baserom.gba", 0x58d8e8, 0x4 - -gUnknown_0858D8EC:: @ 858D8EC - .incbin "baserom.gba", 0x58d8ec, 0x4 diff --git a/data/data3_a1.s b/data/data3_a1.s new file mode 100644 index 000000000..20eb6d6a6 --- /dev/null +++ b/data/data3_a1.s @@ -0,0 +1,423 @@ +@ the third big chunk of data + + .include "asm/macros.inc" + .include "constants/constants.inc" + + .section .rodata + +gUnknown_0858AB24:: @ 858AB24 + .incbin "baserom.gba", 0x58ab24, 0xac + +gBlankBerryTree:: @ 858ABD0 + .4byte 0x0, 0x0 + +gUnknown_0858ABD8:: @ 858ABD8 + .incbin "baserom.gba", 0x58abd8, 0xb88 + +gUnknown_0858B760:: @ 858B760 + .incbin "baserom.gba", 0x58b760, 0x390 + +gUnknown_0858BAF0:: @ 858BAF0 + .incbin "baserom.gba", 0x58baf0, 0x78 + +gUnknown_0858BB68:: @ 858BB68 + .incbin "baserom.gba", 0x58bb68, 0x8 + +gUnknown_0858BB70:: @ 858BB70 + .incbin "baserom.gba", 0x58bb70, 0x10 + +gUnknown_0858BB80:: @ 858BB80 + .incbin "baserom.gba", 0x58bb80, 0x1c + +gUnknown_0858BB9C:: @ 858BB9C + .incbin "baserom.gba", 0x58bb9c, 0x10 + +gUnknown_0858BBAC:: @ 858BBAC + .incbin "baserom.gba", 0x58bbac, 0x10 + +gUnknown_0858BBBC:: @ 858BBBC + .incbin "baserom.gba", 0x58bbbc, 0x10 + +gUnknown_0858BBCC:: @ 858BBCC + .incbin "baserom.gba", 0x58bbcc, 0x14 + +gUnknown_0858BBE0:: @ 858BBE0 + .incbin "baserom.gba", 0x58bbe0, 0xc + +gUnknown_0858BBEC:: @ 858BBEC + .incbin "baserom.gba", 0x58bbec, 0x18c + +gUnknown_0858BD78:: @ 858BD78 + .incbin "baserom.gba", 0x58bd78, 0x40 + +gUnknown_0858BDB8:: @ 858BDB8 + .incbin "baserom.gba", 0x58bdb8, 0x10 + +gUnknown_0858BDC8:: @ 858BDC8 + .incbin "baserom.gba", 0x58bdc8, 0x38 + +gUnknown_0858BE00:: @ 858BE00 + .incbin "baserom.gba", 0x58be00, 0x10 + +gUnknown_0858BE10:: @ 858BE10 + .incbin "baserom.gba", 0x58be10, 0x30 + +gUnknown_0858BE40:: @ 858BE40 + .incbin "baserom.gba", 0x58be40, 0x60 + +gUnknown_0858BEA0:: @ 858BEA0 + .incbin "baserom.gba", 0x58bea0, 0x3 + +gUnknown_0858BEA3:: @ 858BEA3 + .incbin "baserom.gba", 0x58bea3, 0x18 + +gUnknown_0858BEBB:: @ 858BEBB + .incbin "baserom.gba", 0x58bebb, 0x3 + +gUnknown_0858BEBE:: @ 858BEBE + .incbin "baserom.gba", 0x58bebe, 0x3 + +gUnknown_0858BEC1:: @ 858BEC1 + .incbin "baserom.gba", 0x58bec1, 0x3 + +gUnknown_0858BEC4:: @ 858BEC4 + .incbin "baserom.gba", 0x58bec4, 0x10 + +gUnknown_0858BED4:: @ 858BED4 + .incbin "baserom.gba", 0x58bed4, 0x8 + +gUnknown_0858BEDC:: @ 858BEDC + .incbin "baserom.gba", 0x58bedc, 0x8 + +gUnknown_0858BEE4:: @ 858BEE4 + .incbin "baserom.gba", 0x58bee4, 0x4 + +gUnknown_0858BEE8:: @ 858BEE8 + .incbin "baserom.gba", 0x58bee8, 0x10 + +gUnknown_0858BEF8:: @ 858BEF8 + .incbin "baserom.gba", 0x58bef8, 0x6 + +gUnknown_0858BEFE:: @ 858BEFE + .incbin "baserom.gba", 0x58befe, 0x6 + +gUnknown_0858BF04:: @ 858BF04 + .incbin "baserom.gba", 0x58bf04, 0x14 + +gUnknown_0858BF18:: @ 858BF18 + .incbin "baserom.gba", 0x58bf18, 0x10 + +gUnknown_0858BF28:: @ 858BF28 + .incbin "baserom.gba", 0x58bf28, 0xc + +gUnknown_0858BF34:: @ 858BF34 + .incbin "baserom.gba", 0x58bf34, 0xa + +gUnknown_0858BF3E:: @ 858BF3E + .incbin "baserom.gba", 0x58bf3e, 0xa + +gUnknown_0858BF48:: @ 858BF48 + .incbin "baserom.gba", 0x58bf48, 0x8 + +gUnknown_0858BF50:: @ 858BF50 + .incbin "baserom.gba", 0x58bf50, 0x8 + +gUnknown_0858BF58:: @ 858BF58 + .incbin "baserom.gba", 0x58bf58, 0x14 + +gUnknown_0858BF6C:: @ 858BF6C + .incbin "baserom.gba", 0x58bf6c, 0x8 + +gUnknown_0858BF74:: @ 858BF74 + .incbin "baserom.gba", 0x58bf74, 0x14 + +gUnknown_0858BF88:: @ 858BF88 + .incbin "baserom.gba", 0x58bf88, 0x4 + +gUnknown_0858BF8C:: @ 858BF8C + .incbin "baserom.gba", 0x58bf8c, 0xc + +gUnknown_0858BF98:: @ 858BF98 + .incbin "baserom.gba", 0x58bf98, 0xc + +gUnknown_0858BFA4:: @ 858BFA4 + .incbin "baserom.gba", 0x58bfa4, 0x34 + +gUnknown_0858BFD8:: @ 858BFD8 + .incbin "baserom.gba", 0x58bfd8, 0x78 + +gUnknown_0858C050:: @ 858C050 + .incbin "baserom.gba", 0x58c050, 0x8 + +gUnknown_0858C058:: @ 858C058 + .incbin "baserom.gba", 0x58c058, 0x18 + +gUnknown_0858C070:: @ 858C070 + .incbin "baserom.gba", 0x58c070, 0x8 + +gUnknown_0858C078:: @ 858C078 + .incbin "baserom.gba", 0x58c078, 0x48 + +gUnknown_0858C0C0:: @ 858C0C0 + .incbin "baserom.gba", 0x58c0c0, 0x18 + +gUnknown_0858C0D8:: @ 858C0D8 + .incbin "baserom.gba", 0x58c0d8, 0x18 + +gUnknown_0858C0F0:: @ 858C0F0 + .incbin "baserom.gba", 0x58c0f0, 0x18 + +gUnknown_0858C108:: @ 858C108 + .incbin "baserom.gba", 0x58c108, 0x18 + +gUnknown_0858C120:: @ 858C120 + .incbin "baserom.gba", 0x58c120, 0x18 + +gUnknown_0858C138:: @ 858C138 + .incbin "baserom.gba", 0x58c138, 0x18 + +gUnknown_0858C150:: @ 858C150 + .incbin "baserom.gba", 0x58c150, 0x18 + +gUnknown_0858C168:: @ 858C168 + .incbin "baserom.gba", 0x58c168, 0x18 + +gUnknown_0858C180:: @ 858C180 + .incbin "baserom.gba", 0x58c180, 0x18 + +gUnknown_0858C198:: @ 858C198 + .incbin "baserom.gba", 0x58c198, 0x30 + +gUnknown_0858C1C8:: @ 858C1C8 + .incbin "baserom.gba", 0x58c1c8, 0x68 + +gUnknown_0858C230:: @ 858C230 + .incbin "baserom.gba", 0x58c230, 0x5c + +gUnknown_0858C28C:: @ 858C28C + .incbin "baserom.gba", 0x58c28c, 0x18 + +gUnknown_0858C2A4:: @ 858C2A4 + .incbin "baserom.gba", 0x58c2a4, 0x8 + +gUnknown_0858C2AC:: @ 858C2AC + .incbin "baserom.gba", 0x58c2ac, 0x8 + +@ 858C2B4 + .include "data/contest_moves.inc" + +@ 858CDCC + .include "data/contest_effects.inc" + +@ A lookup table with a 1 for each combo starter ID and a 0 for ID 0, +@ which means "not a combo starter move". +gComboStarterLookupTable:: @ 858CE8C + .byte 0 + .rept 62 + .byte 1 + .endr + + .align 2 +@ 858CECC + .include "data/contest_effect_function_table.inc" + +gUnknown_0858CF8C:: @ 858CF8C + .incbin "baserom.gba", 0x58cf8c, 0x2 + +gUnknown_0858CF8E:: @ 858CF8E + .incbin "baserom.gba", 0x58cf8e, 0x6 + +gUnknown_0858CF94:: @ 858CF94 + .incbin "baserom.gba", 0x58cf94, 0x24 + +gUnknown_0858CFB8:: @ 858CFB8 + .incbin "baserom.gba", 0x58cfb8, 0x6 + +gUnknown_0858CFBE:: @ 858CFBE + .incbin "baserom.gba", 0x58cfbe, 0xe + +gUnknown_0858CFCC:: @ 858CFCC + .incbin "baserom.gba", 0x58cfcc, 0x1c + +gUnknown_0858CFE8:: @ 858CFE8 + .incbin "baserom.gba", 0x58cfe8, 0x60 + +gUnknown_0858D048:: @ 858D048 + .incbin "baserom.gba", 0x58d048, 0x10 + +gUnknown_0858D058:: @ 858D058 + .incbin "baserom.gba", 0x58d058, 0x8 + +gUnknown_0858D060:: @ 858D060 + .incbin "baserom.gba", 0x58d060, 0xc + +gUnknown_0858D06C:: @ 858D06C + .incbin "baserom.gba", 0x58d06c, 0x10 + +gUnknown_0858D07C:: @ 858D07C + .incbin "baserom.gba", 0x58d07c, 0x18 + +gUnknown_0858D094:: @ 858D094 + .incbin "baserom.gba", 0x58d094, 0x3c + +gUnknown_0858D0D0:: @ 858D0D0 + .incbin "baserom.gba", 0x58d0d0, 0xe + +gUnknown_0858D0DE:: @ 858D0DE + .incbin "baserom.gba", 0x58d0de, 0xe + +gUnknown_0858D0EC:: @ 858D0EC + .incbin "baserom.gba", 0x58d0ec, 0x1c + +gUnknown_0858D108:: @ 858D108 + .incbin "baserom.gba", 0x58d108, 0x14 + +gUnknown_0858D11C:: @ 858D11C + .incbin "baserom.gba", 0x58d11c, 0x14 + +gUnknown_0858D130:: @ 858D130 + .incbin "baserom.gba", 0x58d130, 0x14 + +gUnknown_0858D144:: @ 858D144 + .incbin "baserom.gba", 0x58d144, 0xc + +gUnknown_0858D150:: @ 858D150 + .incbin "baserom.gba", 0x58d150, 0x20 + +gUnknown_0858D170:: @ 858D170 + .incbin "baserom.gba", 0x58d170, 0x18 + +gUnknown_0858D188:: @ 858D188 + .incbin "baserom.gba", 0x58d188, 0x14 + +gUnknown_0858D19C:: @ 858D19C + .incbin "baserom.gba", 0x58d19c, 0x4 + +gUnknown_0858D1A0:: @ 858D1A0 + .incbin "baserom.gba", 0x58d1a0, 0x30 + +gUnknown_0858D1D0:: @ 858D1D0 + .incbin "baserom.gba", 0x58d1d0, 0x34 + +gUnknown_0858D204:: @ 858D204 + .incbin "baserom.gba", 0x58d204, 0x24 + +gUnknown_0858D228:: @ 858D228 + .incbin "baserom.gba", 0x58d228, 0x18 + +gUnknown_0858D240:: @ 858D240 + .incbin "baserom.gba", 0x58d240, 0x3c + +gUnknown_0858D27C:: @ 858D27C + .incbin "baserom.gba", 0x58d27c, 0x84 + +gUnknown_0858D300:: @ 858D300 + .incbin "baserom.gba", 0x58d300, 0x20 + +gUnknown_0858D320:: @ 858D320 + .incbin "baserom.gba", 0x58d320, 0x18 + +gUnknown_0858D338:: @ 858D338 + .incbin "baserom.gba", 0x58d338, 0x4c + +gUnknown_0858D384:: @ 858D384 + .incbin "baserom.gba", 0x58d384, 0x10 + +gUnknown_0858D394:: @ 858D394 + .incbin "baserom.gba", 0x58d394, 0x1c + +gUnknown_0858D3B0:: @ 858D3B0 + .incbin "baserom.gba", 0x58d3b0, 0x8 + +gUnknown_0858D3B8:: @ 858D3B8 + .incbin "baserom.gba", 0x58d3b8, 0xc + +gUnknown_0858D3C4:: @ 858D3C4 + .incbin "baserom.gba", 0x58d3c4, 0x2c + +gUnknown_0858D3F0:: @ 858D3F0 + .incbin "baserom.gba", 0x58d3f0, 0x1c + +gUnknown_0858D40C:: @ 858D40C + .incbin "baserom.gba", 0x58d40c, 0xc + +gUnknown_0858D418:: @ 858D418 + .incbin "baserom.gba", 0x58d418, 0x10 + +gUnknown_0858D428:: @ 858D428 + .incbin "baserom.gba", 0x58d428, 0x34 + +gUnknown_0858D45C:: @ 858D45C + .incbin "baserom.gba", 0x58d45c, 0x38 + +gUnknown_0858D494:: @ 858D494 + .incbin "baserom.gba", 0x58d494, 0x4 + +gUnknown_0858D498:: @ 858D498 + .incbin "baserom.gba", 0x58d498, 0x1c + +gUnknown_0858D4B4:: @ 858D4B4 + .incbin "baserom.gba", 0x58d4b4, 0x30 + +gUnknown_0858D4E4:: @ 858D4E4 + .incbin "baserom.gba", 0x58d4e4, 0x40 + +gUnknown_0858D524:: @ 858D524 + .incbin "baserom.gba", 0x58d524, 0x4c + +gUnknown_0858D570:: @ 858D570 + .incbin "baserom.gba", 0x58d570, 0x24 + +gUnknown_0858D594:: @ 858D594 + .incbin "baserom.gba", 0x58d594, 0xac + +gUnknown_0858D640:: @ 858D640 + .incbin "baserom.gba", 0x58d640, 0x2c + +gUnknown_0858D66C:: @ 858D66C + .incbin "baserom.gba", 0x58d66c, 0x24 + +gUnknown_0858D690:: @ 858D690 + .incbin "baserom.gba", 0x58d690, 0x20 + +gUnknown_0858D6B0:: @ 858D6B0 + .incbin "baserom.gba", 0x58d6b0, 0x20 + +gUnknown_0858D6D0:: @ 858D6D0 + .incbin "baserom.gba", 0x58d6d0, 0x128 + +gUnknown_0858D7F8:: @ 858D7F8 + .incbin "baserom.gba", 0x58d7f8, 0x18 + +gUnknown_0858D810:: @ 858D810 + .incbin "baserom.gba", 0x58d810, 0x40 + +gUnknown_0858D850:: @ 858D850 + .incbin "baserom.gba", 0x58d850, 0x10 + +gUnknown_0858D860:: @ 858D860 + .incbin "baserom.gba", 0x58d860, 0x18 + +gUnknown_0858D878:: @ 858D878 + .incbin "baserom.gba", 0x58d878, 0x8 + +gUnknown_0858D880:: @ 858D880 + .incbin "baserom.gba", 0x58d880, 0x8 + +gUnknown_0858D888:: @ 858D888 + .incbin "baserom.gba", 0x58d888, 0x10 + +gUnknown_0858D898:: @ 858D898 + .incbin "baserom.gba", 0x58d898, 0x30 + +gUnknown_0858D8C8:: @ 858D8C8 + .incbin "baserom.gba", 0x58d8c8, 0x18 + +gUnknown_0858D8E0:: @ 858D8E0 + .incbin "baserom.gba", 0x58d8e0, 0x8 + +gUnknown_0858D8E8:: @ 858D8E8 + .incbin "baserom.gba", 0x58d8e8, 0x4 + +gUnknown_0858D8EC:: @ 858D8EC + .incbin "baserom.gba", 0x58d8ec, 0x4 diff --git a/data/event_scripts.s b/data/event_scripts.s index cef599407..f058d75db 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -198,7 +198,7 @@ gUnknown_08273D1F:: @ 8273D1F gUnknown_082742E6:: @ 82742E6 .incbin "baserom.gba", 0x2742e6, 0x13 -gUnknown_082742F9:: @ 82742F9 +BerryTreeScript:: @ 82742F9 .incbin "baserom.gba", 0x2742f9, 0x189 gUnknown_08274482:: @ 8274482 diff --git a/data/strings.s b/data/strings.s index 7ab4e7540..c8a1b7683 100644 --- a/data/strings.s +++ b/data/strings.s @@ -45,7 +45,7 @@ gExpandedPlaceholder_Brendan:: @ 85E8258 gExpandedPlaceholder_May:: @ 85E8260 .string "MAY$" -gText_Egg:: @ 85E8264 +gText_EggNickname:: @ 85E8264 .string "EGG$" gText_Pokemon:: @ 85E8268 diff --git a/data/trainer_class_name_indices.inc b/data/trainer_class_name_indices.inc index ece8c6b48..4335bafe0 100644 --- a/data/trainer_class_name_indices.inc +++ b/data/trainer_class_name_indices.inc @@ -1,4 +1,4 @@ -gTrainerClassNameIndices:: @ 831F5CA +gTrainerClassToNameIndex:: @ 831F5CA .byte TRAINER_CLASS_NAME_HIKER .byte TRAINER_CLASS_NAME_TEAM_AQUA .byte TRAINER_CLASS_NAME_PKMN_BREEDER diff --git a/data/trainer_pic_indices.inc b/data/trainer_pic_indices.inc index 77ab090e9..22fb9aaa2 100644 --- a/data/trainer_pic_indices.inc +++ b/data/trainer_pic_indices.inc @@ -1,5 +1,5 @@ .align 2 -gTrainerPicIndices:: @ 831F578 +gUnknown_0831F578:: @ 831F578 .byte TRAINER_PIC_HIKER .byte TRAINER_PIC_AQUA_GRUNT_M .byte TRAINER_PIC_POKEMON_BREEDER_F diff --git a/include/battle.h b/include/battle.h index 1db546de3..51f9298cc 100644 --- a/include/battle.h +++ b/include/battle.h @@ -32,8 +32,14 @@ #define BATTLE_TYPE_KYORGE 0x20000000 #define BATTLE_TYPE_RAYQUAZA 0x40000000 +#define STEVEN_PARTNER_ID 0xC03 +#define SECRET_BASE_OPPONENT 0x400 + #define BATTLE_TYPE_FRONTIER (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_x100000 | BATTLE_TYPE_PYRAMID) +#define SIDE_PLAYER 0x0 +#define SIDE_OPPONENT 0x1 + #define BATTLE_WON 0x1 #define BATTLE_LOST 0x2 #define BATTLE_DREW 0x3 @@ -187,8 +193,7 @@ struct Trainer { /*0x00*/ u8 partyFlags; /*0x01*/ u8 trainerClass; - /*0x02*/ u8 encounterMusic:7; - /*0x02*/ u8 gender:1; + /*0x02*/ u8 encounterMusic_gender; // last bit is gender /*0x03*/ u8 trainerPic; /*0x04*/ u8 trainerName[12]; /*0x10*/ u16 items[4]; @@ -200,6 +205,8 @@ struct Trainer extern const struct Trainer gTrainers[]; +#define TRAINER_ENCOUNTER_MUSIC(trainer)((gTrainers[trainer].encounterMusic_gender & 0x7F)) + struct UnknownFlags { u32 flags[4]; @@ -282,7 +289,7 @@ struct BattleScriptsStack struct BattleResources { - void* secretBaseOpponent; + struct SecretBaseRecord* secretBase; struct UnknownFlags *flags; struct BattleScriptsStack* battleScriptsStack; void* battleCallbackStack; @@ -336,7 +343,105 @@ struct BattleStruct u8 wildVictorySong; u8 dynamicMoveType; u8 wrappedBy[4]; - u8 field_18[0x63]; // TODO: expand + u8 field_18; + u8 field_19; + u8 field_1A; + u8 field_1B; + u8 field_1C; + u8 field_1D; + u8 field_1E; + u8 field_1F; + u8 field_20; + u8 field_21; + u8 field_22; + u8 field_23; + u8 field_24; + u8 field_25; + u8 field_26; + u8 field_27; + u8 field_28; + u8 field_29; + u8 field_2A; + u8 field_2B; + u8 field_2C; + u8 field_2D; + u8 field_2E; + u8 field_2F; + u8 field_30; + u8 field_31; + u8 field_32; + u8 field_33; + u8 field_34; + u8 field_35; + u8 field_36; + u8 field_37; + u8 field_38; + u8 field_39; + u8 field_3A; + u8 field_3B; + u8 field_3C; + u8 field_3D; + u8 field_3E; + u8 field_3F; + u8 field_40; + u8 field_41; + u8 field_42; + u8 field_43; + u8 field_44; + u8 field_45; + u8 field_46; + u8 field_47; + u8 field_48; + u8 field_49; + u8 field_4A; + u8 field_4B; + u8 field_4C; + u8 field_4D; + u8 field_4E; + u8 field_4F; + u8 field_50; + u8 field_51; + u8 field_52; + u8 field_53; + u8 field_54; + u8 field_55; + u8 field_56; + u8 field_57; + u8 field_58; + u8 field_59; + u8 field_5A; + u8 field_5B; + u8 field_5C; + u8 field_5D; + u8 field_5E; + u8 field_5F; + u8 field_60; + u8 field_61; + u8 field_62; + u8 field_63; + u8 field_64; + u8 field_65; + u8 field_66; + u8 field_67; + u8 field_68; + u8 field_69; + u8 field_6A; + u8 field_6B; + u8 field_6C; + u8 field_6D; + u8 field_6E; + u8 field_6F; + u8 field_70; + u8 field_71; + u8 field_72; + u8 field_73; + u8 field_74; + u8 field_75; + u8 field_76; + u8 field_77; + u8 field_78; + u8 field_79; + u8 field_7A; u8 field_7B; u8 field_7C; u8 field_7D; @@ -412,4 +517,15 @@ struct BattleScripting extern struct BattleScripting gBattleScripting; -#endif +#include "sprite.h" + +struct BattleSpritesGfx +{ + void* firstDecompressed; // ptr to the decompressed sprite of the first pokemon + void* sprites[4]; + struct SpriteTemplate templates[4]; +}; + +extern struct BattleSpritesGfx* gBattleSpritesGfx; + +#endif // GUARD_BATTLE_H diff --git a/include/battle_message.h b/include/battle_message.h index 3e37a1ccd..ca310ae6f 100644 --- a/include/battle_message.h +++ b/include/battle_message.h @@ -20,4 +20,9 @@ void BufferStringBattle(u16 stringID); u32 StrCpyDecodeToDisplayedStringBattle(const u8* src); u32 StrCpyDecodeBattle(const u8* src, u8* dst); +extern u8 gBattleTextBuff1[]; +extern u8 gBattleTextBuff2[]; +extern u8 gBattleTextBuff3[]; +extern u8 gDisplayedStringBattle[]; + #endif // GUARD_BATTLE_MESSAGE_H diff --git a/include/berry.h b/include/berry.h index f0acbe0ad..7c2636411 100644 --- a/include/berry.h +++ b/include/berry.h @@ -37,12 +37,14 @@ u8 CalcBerryYieldInternal(u16 max, u16 min, u8 water); u8 CalcBerryYield(struct BerryTree *tree); u8 GetBerryCountByBerryTreeId(u8 id); u16 GetStageDurationByBerryType(u8); +void Bag_ChooseBerry(void); void FieldObjectInteractionGetBerryTreeData(void); -void sub_80B4EE4(void); void FieldObjectInteractionPlantBerryTree(void); void FieldObjectInteractionPickBerryTree(void); void FieldObjectInteractionRemoveBerryTree(void); u8 PlayerHasBerries(void); void ResetBerryTreeSparkleFlags(void); +extern const struct Berry gBerries[]; + #endif // GUARD_BERRY_H diff --git a/include/fieldmap.h b/include/fieldmap.h new file mode 100644 index 000000000..f3b5a7668 --- /dev/null +++ b/include/fieldmap.h @@ -0,0 +1,6 @@ +#ifndef GUARD_FIELDMAP_H +#define GUARD_FIELDMAP_H + +void GetCameraCoords(u16*, u16*); + +#endif // GUARD_FIELDMAP_H diff --git a/include/flags.h b/include/flags.h index 56e87b895..19ec01b56 100644 --- a/include/flags.h +++ b/include/flags.h @@ -2,8 +2,8 @@ #define GUARD_FLAGS_H #define TRAINER_FLAG_START 0x500 -#define TRAINERS_FLAG_NO 0x360 -#define CODE_FLAGS (TRAINER_FLAG_START + TRAINERS_FLAG_NO) +#define TRAINERS_FLAG_NO 0x356 +#define CODE_FLAGS (TRAINER_FLAG_START + TRAINERS_FLAG_NO + 0xA) // SYSTEM FLAGS @@ -84,6 +84,8 @@ #define SYS_CTRL_OBJ_DELETE CODE_FLAGS + 0x61 #define SYS_RESET_RTC_ENABLE CODE_FLAGS + 0x62 +#define SYS_STORAGE_UNKNOWN_FLAG CODE_FLAGS + 0x77 + #define SYS_MYSTERY_GIFT_ENABLE CODE_FLAGS + 0x7B // SPECIAL FLAGS (unknown purpose) diff --git a/include/global.berry.h b/include/global.berry.h index 6695a9f4b..4b9ca644c 100644 --- a/include/global.berry.h +++ b/include/global.berry.h @@ -42,14 +42,14 @@ struct Berry2 struct EnigmaBerry { struct Berry2 berry; - u8 pic[(6 * 6) * TILE_SIZE_4BPP]; - u16 palette[16]; - u8 description1[45]; - u8 description2[45]; u8 itemEffect[18]; u8 holdEffect; u8 holdEffectParam; u32 checksum; + u8 pic[(6 * 6) * TILE_SIZE_4BPP]; + u16 palette[16]; + u8 description1[45]; + u8 description2[45]; }; struct BattleEnigmaBerry diff --git a/include/global.h b/include/global.h index 32c13d86c..e694a5974 100644 --- a/include/global.h +++ b/include/global.h @@ -184,7 +184,8 @@ struct SaveBlock2 // All below could be a one giant struct /*0x64C*/ u8 field_64C[1629]; - /*0xCA9*/ u8 frontierChosenLvl; + /*0xCA9*/ u8 frontierChosenLvl : 2; + /*0xCA9*/ u8 field_CA9_a : 6; /*0xCAA*/ u8 field_CAA[368]; /*0xE1A*/ u16 battlePyramidFloor; // possibly? /*0xE1C*/ u8 field_E1C[16]; @@ -649,8 +650,10 @@ struct DaycareData u8 stepCounter; }; -#define FLAGS_NUMBER 300 -#define VARS_NUMBER 256 +#define MAP_OBJECTS_COUNT 16 +#define BERRY_TREES_COUNT 128 +#define FLAGS_COUNT 300 +#define VARS_COUNT 256 struct SaveBlock1 { @@ -683,12 +686,12 @@ struct SaveBlock1 /*0x9C2*/ u8 field_9C2[6]; /*0x9C8*/ u16 trainerRematchStepCounter; /*0x9CA*/ u8 trainerRematches[100]; - /*0xA30*/ struct MapObject mapObjects[16]; + /*0xA30*/ struct MapObject mapObjects[MAP_OBJECTS_COUNT]; /*0xC70*/ struct MapObjectTemplate mapObjectTemplates[64]; - /*0x1270*/ u8 flags[FLAGS_NUMBER]; - /*0x139C*/ u16 vars[VARS_NUMBER]; + /*0x1270*/ u8 flags[FLAGS_COUNT]; + /*0x139C*/ u16 vars[VARS_COUNT]; /*0x159C*/ u32 gameStats[NUM_GAME_STATS]; - /*0x169C*/ struct BerryTree berryTrees[128]; + /*0x169C*/ struct BerryTree berryTrees[BERRY_TREES_COUNT]; /*0x1A9C*/ struct SecretBaseRecord secretBases[20]; /*0x271C*/ u8 playerRoomDecor[12]; /*0x2728*/ u8 playerRoomDecorPos[12]; @@ -731,6 +734,7 @@ struct SaveBlock1 /*0x31A8*/ u8 giftRibbons[52]; /*0x31DC*/ struct Roamer roamer; /*0x31F8*/ struct EnigmaBerry enigmaBerry; + /*0x322C*/ u8 field_322C[1276]; /*0x3728*/ struct RamScript ramScript; /*0x3B14*/ struct RecordMixingGift recordMixingGift; /*0x3B24*/ u8 seen2[52]; diff --git a/include/link.h b/include/link.h new file mode 100644 index 000000000..5db3ff3d2 --- /dev/null +++ b/include/link.h @@ -0,0 +1,194 @@ +#ifndef GUARD_LINK_H +#define GUARD_LINK_H + +#define MAX_LINK_PLAYERS 4 +#define CMD_LENGTH 8 +#define QUEUE_CAPACITY 50 +#define BLOCK_BUFFER_SIZE 0x100 + +#define LINK_STAT_LOCAL_ID 0x00000003 +#define LINK_STAT_PLAYER_COUNT 0x0000001C +#define LINK_STAT_PLAYER_COUNT_SHIFT 2 +#define LINK_STAT_MASTER 0x00000020 +#define LINK_STAT_MASTER_SHIFT 5 +#define LINK_STAT_CONN_ESTABLISHED 0x00000040 +#define LINK_STAT_CONN_ESTABLISHED_SHIFT 6 +#define LINK_STAT_RECEIVED_NOTHING 0x00000100 +#define LINK_STAT_RECEIVED_NOTHING_SHIFT 8 +#define LINK_STAT_ERRORS 0x0007F000 + +#define EXTRACT_PLAYER_COUNT(status) \ +(((status) & LINK_STAT_PLAYER_COUNT) >> LINK_STAT_PLAYER_COUNT_SHIFT) +#define EXTRACT_MASTER(status) \ +(((status) >> LINK_STAT_MASTER_SHIFT) & 1) +#define EXTRACT_CONN_ESTABLISHED(status) \ +(((status) >> LINK_STAT_CONN_ESTABLISHED_SHIFT) & 1) +#define EXTRACT_RECEIVED_NOTHING(status) \ +(((status) >> LINK_STAT_RECEIVED_NOTHING_SHIFT) & 1) + +#define MASTER_HANDSHAKE 0x8FFF +#define SLAVE_HANDSHAKE 0xB9A0 + +enum +{ + LINK_STATE_START0, + LINK_STATE_START1, + LINK_STATE_HANDSHAKE, + LINK_STATE_INIT_TIMER, + LINK_STATE_CONN_ESTABLISHED, +}; + +enum +{ + EXCHANGE_NOT_STARTED, + EXCHANGE_COMPLETE, + EXCHANGE_TIMED_OUT, + EXCHANGE_IN_PROGRESS, +}; + +enum +{ + QUEUE_FULL_NONE, + QUEUE_FULL_SEND, + QUEUE_FULL_RECV, +}; + +enum +{ + LAG_NONE, + LAG_MASTER, + LAG_SLAVE, +}; + +struct LinkPlayer +{ + /* 0x00 */ u16 version; + /* 0x02 */ u16 lp_field_2; + /* 0x04 */ u32 trainerId; + /* 0x08 */ u8 name[11]; + /* 0x13 */ u8 gender; + /* 0x14 */ u32 linkType; + /* 0x18 */ u16 lp_field_18; + /* 0x1A */ u16 language; +}; + +struct LinkPlayerBlock +{ + u8 magic1[16]; + struct LinkPlayer linkPlayer; + u8 magic2[16]; +}; + +// circular queues + +struct SendQueue +{ + u16 data[CMD_LENGTH][QUEUE_CAPACITY]; + u8 pos; + u8 count; +}; + +struct RecvQueue +{ + u16 data[MAX_LINK_PLAYERS][CMD_LENGTH][QUEUE_CAPACITY]; + u8 pos; + u8 count; +}; + +struct Link +{ + u8 isMaster; // 0: slave, 8: master + u8 state; + u8 localId; // local multi-player ID + u8 playerCount; + u16 tempRecvBuffer[4]; + bool8 receivedNothing; + s8 serialIntrCounter; + bool8 handshakeAsMaster; + u8 link_field_F; + + // error conditions + bool8 hardwareError; // hardware reported an error + bool8 badChecksum; // checksum didn't match between devices + u8 queueFull; // send or recv queue out of space + u8 lag; // connection is lagging + + u16 checksum; + + u8 sendCmdIndex; + u8 recvCmdIndex; + + struct SendQueue sendQueue; + struct RecvQueue recvQueue; +}; + +struct BlockRequest +{ + void * address; + u32 size; +}; + +extern const struct BlockRequest sBlockRequestLookupTable[5]; + +extern struct Link gLink; +extern u16 gRecvCmds[CMD_LENGTH][MAX_LINK_PLAYERS]; +extern u8 gBlockSendBuffer[BLOCK_BUFFER_SIZE]; +extern u16 gLinkType; +extern u32 gLinkStatus; +extern u16 gBlockRecvBuffer[MAX_LINK_PLAYERS][BLOCK_BUFFER_SIZE / 2]; +extern u16 gSendCmd[CMD_LENGTH]; +extern u8 gShouldAdvanceLinkState; +extern struct LinkPlayer gLinkPlayers[]; +extern u16 word_3002910[]; +extern bool8 gReceivedRemoteLinkPlayers; + +void Task_DestroySelf(u8); +void sub_8007270(u8); +void OpenLink(void); +void CloseLink(void); +u16 LinkMain2(u16 *); +void sub_8007B14(void); +bool32 sub_8007B24(void); +void ClearLinkCallback(void); +void ClearLinkCallback_2(void); +u8 GetLinkPlayerCount(void); +void OpenLinkTimed(void); +u8 GetLinkPlayerDataExchangeStatusTimed(void); +bool8 IsLinkPlayerDataExchangeComplete(void); +u32 GetLinkPlayerTrainerId(u8); +void ResetLinkPlayers(void); +void sub_8007E24(void); +void sub_8007E4C(void); +u8 GetMultiplayerId(void); +u8 bitmask_all_link_players_but_self(void); +bool8 SendBlock(u8, void *, u16); +bool8 sub_8007E9C(u8); +bool8 sub_8007ECC(void); +u8 GetBlockReceivedStatus(void); +void ResetBlockReceivedFlags(void); +void ResetBlockReceivedFlag(u8); +void sub_8007F4C(void); +void SetLinkDebugValues(u32, u32); +u8 sub_8008198(void); +void sub_80081C8(u8); +u8 sub_800820C(void); +u8 sub_8008218(void); +void sub_800826C(void); +void sub_80082EC(void); +u8 GetLinkPlayerCount_2(void); +bool8 IsLinkMaster(void); +void sub_800832C(void); +void sub_8008480(void); +void sub_80084A4(void); +void CB2_LinkError(void); +u8 GetSioMultiSI(void); +bool8 IsLinkConnectionEstablished(void); +void SetSuppressLinkErrorMessage(bool8); +bool8 HasLinkErrorOccurred(void); +void ResetSerial(void); +u32 LinkMain1(u8 *, u16 *, u16[CMD_LENGTH][MAX_LINK_PLAYERS]); +void LinkVSync(void); +void Timer3Intr(void); +void SerialCB(void); + +#endif // GUARD_LINK_H diff --git a/include/m4a.h b/include/m4a.h index 949403885..b6c8f9072 100644 --- a/include/m4a.h +++ b/include/m4a.h @@ -9,6 +9,7 @@ void m4aSoundInit(void); void m4aSoundMain(void); void m4aSongNumStart(u16); void m4aSongNumStop(u16 n); +void m4aMPlayAllStop(void); void m4aMPlayContinue(struct MusicPlayerInfo *mplayInfo); void m4aMPlayFadeOut(struct MusicPlayerInfo *mplayInfo, u16 speed); void m4aMPlayFadeOutTemporarily(struct MusicPlayerInfo *mplayInfo, u16 speed); diff --git a/include/pokedex.h b/include/pokedex.h new file mode 100644 index 000000000..15f819a2a --- /dev/null +++ b/include/pokedex.h @@ -0,0 +1,20 @@ +#ifndef GUARD_POKEDEX_H +#define GUARD_POKEDEX_H + +void ResetPokedex(void); +const u8 *GetPokemonCategory(u16); +u16 GetPokedexHeightWeight(u16 dexNum, u8 data); +u16 GetNationalPokedexCount(u8); +u16 GetHoennPokedexCount(u8); + +enum +{ + FLAG_GET_SEEN, + FLAG_GET_CAUGHT, + FLAG_SET_SEEN, + FLAG_SET_CAUGHT +}; + +u8 GetSetPokedexFlag(u16 nationalNum, u8 caseId); + +#endif // GUARD_POKEDEX_H diff --git a/include/pokemon.h b/include/pokemon.h index a335e0154..fefe2bd28 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -81,20 +81,28 @@ #define MON_DATA_GIFT_RIBBON_6 77 #define MON_DATA_GIFT_RIBBON_7 78 #define MON_DATA_FATEFUL_ENCOUNTER 79 -#define MON_DATA_KNOWN_MOVES 80 -#define MON_DATA_RIBBON_COUNT 81 -#define MON_DATA_RIBBONS 82 -#define MON_DATA_83 83 +#define MON_DATA_OBEDIENCE 80 +#define MON_DATA_KNOWN_MOVES 81 +#define MON_DATA_RIBBON_COUNT 82 +#define MON_DATA_RIBBONS 83 #define MON_DATA_ATK2 84 #define MON_DATA_DEF2 85 #define MON_DATA_SPD2 86 #define MON_DATA_SPATK2 87 -#define MON_DATA_SPDEF2 88 +#define MON_DATA_SPDEF2 88 #define OT_ID_RANDOM_NO_SHINY 2 #define OT_ID_PRESET 1 #define OT_ID_PLAYER_ID 0 +#define MON_GIVEN_TO_PARTY 0x0 +#define MON_GIVEN_TO_PC 0x1 +#define MON_CANT_GIVE 0x2 + +#define PLAYER_HAS_TWO_USABLE_MONS 0x0 +#define PLAYER_HAS_ONE_MON 0x1 +#define PLAYER_HAS_ONE_USABLE_MON 0x2 + #define MON_MALE 0x00 #define MON_FEMALE 0xFE #define MON_GENDERLESS 0xFF @@ -240,7 +248,8 @@ struct PokemonSubstruct3 /* 0x0B */ u32 giftRibbon5:1; /* 0x0B */ u32 giftRibbon6:1; /* 0x0B */ u32 giftRibbon7:1; - /* 0x0B */ u32 fatefulEncounter:5; // unused in Ruby/Sapphire, but the high bit must be set for Mew/Deoxys to obey in FR/LG/Emerald + /* 0x0B */ u32 fatefulEncounter:4; + /* 0x0B */ u32 obedient:1; }; union PokemonSubstruct @@ -279,7 +288,7 @@ struct Pokemon struct BoxPokemon box; u32 status; u8 level; - u8 pokerus; + u8 mail; u16 hp; u16 maxHP; u16 attack; @@ -374,6 +383,16 @@ enum STAT_STAGE_EVASION, // 7 }; +enum +{ + STAT_HP, // 0 + STAT_ATK, // 1 + STAT_DEF, // 2 + STAT_SPD, // 3 + STAT_SPATK, // 4 + STAT_SPDEF, // 5 +}; + struct BaseStats { /* 0x00 */ u8 baseHP; @@ -420,6 +439,12 @@ struct BattleMove u8 flags; }; +struct SpindaSpot +{ + u8 x, y; + u16 image[16]; +}; + struct __attribute__((packed)) LevelUpMove { u16 move:9; @@ -483,9 +508,15 @@ extern struct Pokemon gPlayerParty[PARTY_SIZE]; extern u8 gEnemyPartyCount; extern struct Pokemon gEnemyParty[PARTY_SIZE]; extern const struct BaseStats gBaseStats[]; +extern const u8 *const gItemEffectTable[]; extern const struct EvolutionData gEvolutionTable[]; extern struct PokemonStorage* gPokemonStoragePtr; extern const u32 gExperienceTables[][MAX_MON_LEVEL + 1]; +extern const u16 *const gLevelUpLearnsets[]; + +#define BATTLE_ALIVE_EXCEPT_ACTIVE 0 +#define BATTLE_ALIVE_ATK_SIDE 1 +#define BATTLE_ALIVE_DEF_SIDE 2 void ZeroBoxMonData(struct BoxPokemon *boxMon); void ZeroMonData(struct Pokemon *mon); @@ -540,8 +571,8 @@ u8 GetMonAbility(struct Pokemon *mon); void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord); u8 GetSecretBaseTrainerPicIndex(void); u8 GetSecretBaseTrainerNameIndex(void); -u8 PlayerPartyAndPokemonStorageFull(void); -u8 PokemonStorageFull(void); +bool8 IsPlayerPartyAndPokemonStorageFull(void); +bool8 IsPokemonStorageFull(void); void GetSpeciesName(u8 *name, u16 species); u8 CalculatePPWithBonus(u16 move, u8 ppBonuses, u8 moveIndex); void RemoveMonPPBonus(struct Pokemon *mon, u8 moveIndex); @@ -551,4 +582,36 @@ void CopyPlayerPartyMonToBattleData(u8 battleIndex, u8 partyIndex); u8 GetNature(struct Pokemon *mon); u8 GetNatureFromPersonality(u32 personality); +u16 nature_stat_mod(u8 nature, u16 n, u8 statIndex); + +void MonRestorePP(struct Pokemon *); +void BoxMonRestorePP(struct BoxPokemon *); + +u16 NationalPokedexNumToSpecies(u16 nationalNum); +u16 NationalToHoennOrder(u16); +u16 SpeciesToNationalPokedexNum(u16); +u16 HoennToNationalOrder(u16); +u16 SpeciesToCryId(u16 species); +void DrawSpindaSpots(u16, u32, u8 *, u8); +void AdjustFriendship(struct Pokemon *, u8); +u8 CheckPartyHasHadPokerus(struct Pokemon *, u8); +void UpdatePartyPokerusTime(u16); +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 struct CompressedSpritePalette *sub_80409C8(u16, u32, u32); +bool8 IsOtherTrainer(u32, u8 *); +void SetWildMonHeldItem(void); +u16 GetMonEVCount(struct Pokemon *); + +const struct CompressedSpritePalette *sub_806E794(struct Pokemon *mon); +const struct CompressedSpritePalette *sub_806E7CC(u16 species, u32 otId , u32 personality); +bool32 IsHMMove2(u16 move); +bool8 IsPokeSpriteNotFlipped(u16 species); +bool8 IsMonShiny(struct Pokemon *mon); +bool8 IsShinyOtIdPersonality(u32 otId, u32 personality); + #endif // GUARD_POKEMON_H diff --git a/include/pokemon_animation.h b/include/pokemon_animation.h new file mode 100644 index 000000000..42fc10809 --- /dev/null +++ b/include/pokemon_animation.h @@ -0,0 +1,7 @@ +#ifndef GUARD_POKEMON_ANIMATION_H +#define GUARD_POKEMON_ANIMATION_H + +void LaunchAnimationTaskForFrontSprite(struct Sprite* sprite, u8 frontAnimId); +void LaunchAnimationTaskForBackSprite(struct Sprite* sprite, u8 backAnimId); + +#endif // GUARD_POKEMON_ANIMATION_H diff --git a/include/species.h b/include/species.h index 5cce48ad6..9ab0565cb 100644 --- a/include/species.h +++ b/include/species.h @@ -1,4 +1,8 @@ -enum { +#ifndef GUARD_SPECIES_H +#define GUARD_SPECIES_H + +enum +{ SPECIES_NONE, // 0x000 SPECIES_BULBASAUR, // 0x001 SPECIES_IVYSAUR, // 0x002 @@ -442,4 +446,8 @@ enum { SPECIES_UNOWN_Z, SPECIES_UNOWN_EMARK, SPECIES_UNOWN_QMARK, -}; \ No newline at end of file +}; + +#define NUM_SPECIES SPECIES_EGG + +#endif // GUARD_SPECIES_H diff --git a/include/text.h b/include/text.h index f52336d84..73e6e5437 100644 --- a/include/text.h +++ b/include/text.h @@ -74,6 +74,7 @@ #define EOS 0xFF // end of string #define EXT_CTRL_CODE_JPN 0x15 +#define EXT_CTRL_CODE_ENG 0x16 #define NUM_TEXT_PRINTERS 32 diff --git a/include/trainer_classes.h b/include/trainer_classes.h new file mode 100644 index 000000000..3f13dfc37 --- /dev/null +++ b/include/trainer_classes.h @@ -0,0 +1,53 @@ +#ifndef GUARD_TRAINER_CLASSES_H +#define GUARD_TRAINER_CLASSES_H + +enum +{ + CLASS_PKMN_TRAINER0, //0 + CLASS_PKMN_TRAINER1, //1 + CLASS_HIKER, //2 + CLASS_TEAM_AQUA, //3 + CLASS_PKMN_BREEDER, //4 + CLASS_COOLTRAINER, //5 + CLASS_BIRDKEEPER, //6 + CLASS_COLLECTOR, //7 + CLASS_SWIMMER_MALE, //8 + CLASS_TEAM_MAGMA, //9 + CLASS_EXPERT, // 0xA + CLASS_AQUA_ADMIN, // 0xB + CLASS_BLACK_BELT, // 0xC + CLASS_AQUA_LEADER, // 0xD + CLASS_HEX_MANIAC, // 0xE + CLASS_AROMA_LADY, // 0xF + CLASS_RUIN_MANIAC, // 0x10 + CLASS_INTERVIEWER, // 0x11 + CLASS_TUBER_FEMALE, // 0x12 + CLASS_TUBER_MALE, // 0x13 + CLASS_LADY, // 0x14 + CLASS_BEAUTY, // 0x15 + CLASS_RICH_BOY, // 0x16 + CLASS_POKEMANIAC, // 0x17 + CLASS_GUITARIST, // 0x18 + CLASS_KINDLER, // 0x19 + CLASS_CAMPER, // 0x1A + CLASS_PICKNICKER, // 0x1B + CLASS_BUG_MANIAC, // 0x1C + CLASS_PSYCHIC, // 0x1D + CLASS_GENTLEMAN, // 0x1E + CLASS_ELITE_FOUR, // 0x1F + CLASS_LEADER, // 0x20 + CLASS_CHAMPION = 0x26, + CLASS_MAGMA_ADMIN = 0x31, + CLASS_PKMN_TRAINER_RIVAL = 0x32, + CLASS_MAGMA_LEADER = 0x35, + CLASS_SALON_MAIDEN = 0x3A, + CLASS_DOME_ACE, // 0x3B + CLASS_PALACE_MAVEN, // 0x3C + CLASS_ARENA_TYCOON, // 0x3D + CLASS_FACTORY_HEAD, // 0x3E + CLASS_PIKE_QUEEN, // 0x3F + CLASS_PYRAMID_KING, // 0x40 + CLASS_PKMN_TRAINER2, // 0x41 +}; + +#endif // GUARD_TRAINER_CLASSES_H diff --git a/include/trainer_ids.h b/include/trainer_ids.h new file mode 100644 index 000000000..65c80187f --- /dev/null +++ b/include/trainer_ids.h @@ -0,0 +1,7 @@ +#ifndef GUARD_TRAINER_IDS_H +#define GUARD_TRAINER_IDS_H + +#define NO_OF_TRAINERS 854 +#define TRAINER_ID_STEVEN 804 + +#endif // GUARD_TRAINER_IDS_H diff --git a/include/vars.h b/include/vars.h index 8a779dccf..5da960640 100644 --- a/include/vars.h +++ b/include/vars.h @@ -28,6 +28,7 @@ #define VAR_DAYS 0x4040 #define VAR_DEPT_STORE_FLOOR 0x4043 +#define VAR_STORAGE_UNKNOWN 0x4036 #define VAR_POKELOT_PRIZE 0x4045 #define VAR_NATIONAL_DEX 0x4046 #define VAR_SEEDOT_SIZE_RECORD 0x4047 diff --git a/ld_script.txt b/ld_script.txt index ba20f2ad6..940616eeb 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -73,6 +73,7 @@ SECTIONS { src/pokemon_2.o(.text); asm/pokemon_2.o(.text); asm/pokemon_item_effect.o(.text); + src/pokemon_3.o(.text); asm/pokemon_3.o(.text); src/trig.o(.text); src/rng.o(.text); @@ -135,7 +136,7 @@ SECTIONS { asm/item.o(.text); asm/contest.o(.text); asm/shop.o(.text); - asm/berry.o(.text); + src/berry.o(.text); asm/script_menu.o(.text); asm/naming_screen.o(.text); src/money.o(.text); @@ -305,6 +306,8 @@ SECTIONS { src/trig.o(.rodata); src/util.o(.rodata); data/data3.o(.rodata); + src/berry.o(.rodata); + data/data3_a1.o(.rodata); src/pokemon_size_record.o(.rodata) data/data3b.o(.rodata); src/battle_ai.o(.rodata); diff --git a/src/berry.c b/src/berry.c new file mode 100644 index 000000000..b6eaa14a0 --- /dev/null +++ b/src/berry.c @@ -0,0 +1,1208 @@ +#include "global.h" +#include "berry.h" +#include "main.h" +#include "item.h" +#include "items.h" +#include "text.h" +#include "rng.h" +#include "event_data.h" +#include "fieldmap.h" + +extern u8 FieldObjectGetBerryTreeId(u8 mapObjectId); +extern void sub_8092EF0(u8 mapId, u8 mapNumber, u8 mapGroup); +extern void CB2_ChooseBerry(void); +extern const u8* GetFieldObjectScriptPointerForComparison(void); +extern bool8 sub_8092E9C(u8, u8, u8); + +extern u16 gScriptItemId; + +extern const u8 BerryTreeScript[]; +extern const struct BerryTree gBlankBerryTree; + +#define BERRY_NAME_LENGTH 6 + +#define FIRST_BERRY ITEM_CHERI_BERRY +#define LAST_BERRY ITEM_ENIGMA_BERRY + + +static const u8 sBerryDescriptionPart1_Cheri[] = _("Blooms with delicate pretty flowers."); +static const u8 sBerryDescriptionPart2_Cheri[] = _("The bright red BERRY is very spicy."); +static const u8 sBerryDescriptionPart1_Chesto[] = _("The BERRY’s thick skin and fruit are"); +static const u8 sBerryDescriptionPart2_Chesto[] = _("very tough. It is dry-tasting all over."); +static const u8 sBerryDescriptionPart1_Pecha[] = _("Very sweet and delicious."); +static const u8 sBerryDescriptionPart2_Pecha[] = _("Also very tender - handle with care."); +static const u8 sBerryDescriptionPart1_Rawst[] = _("If the leaves grow long and curly,"); +static const u8 sBerryDescriptionPart2_Rawst[] = _("the BERRY seems to grow very bitter."); +static const u8 sBerryDescriptionPart1_Aspear[] = _("The hard BERRY is dense with a rich"); +static const u8 sBerryDescriptionPart2_Aspear[] = _("juice. It is quite sour."); +static const u8 sBerryDescriptionPart1_Leppa[] = _("Grows slower than CHERI and others."); +static const u8 sBerryDescriptionPart2_Leppa[] = _("The smaller the BERRY, the tastier."); +static const u8 sBerryDescriptionPart1_Oran[] = _("A peculiar BERRY with a mix of flavors."); +static const u8 sBerryDescriptionPart2_Oran[] = _("BERRIES grow in half a day."); +static const u8 sBerryDescriptionPart1_Persim[] = _("Loves sunlight. The BERRY’s color"); +static const u8 sBerryDescriptionPart2_Persim[] = _("grows vivid when exposed to the sun."); +static const u8 sBerryDescriptionPart1_Lum[] = _("Slow to grow. If raised with loving"); +static const u8 sBerryDescriptionPart2_Lum[] = _("care, it may grow two BERRIES."); +static const u8 sBerryDescriptionPart1_Sitrus[] = _("Closely related to ORAN. The large"); +static const u8 sBerryDescriptionPart2_Sitrus[] = _("BERRY has a well-rounded flavor."); +static const u8 sBerryDescriptionPart1_Figy[] = _("The BERRY, which looks chewed up,"); +static const u8 sBerryDescriptionPart2_Figy[] = _("brims with spicy substances."); +static const u8 sBerryDescriptionPart1_Wiki[] = _("The BERRY is said to have grown lumpy"); +static const u8 sBerryDescriptionPart2_Wiki[] = _("to help POKéMON grip it."); +static const u8 sBerryDescriptionPart1_Mago[] = _("The BERRY turns curvy as it grows."); +static const u8 sBerryDescriptionPart2_Mago[] = _("The curvier, the sweeter and tastier."); +static const u8 sBerryDescriptionPart1_Aguav[] = _("The flower is dainty. It is rare in its"); +static const u8 sBerryDescriptionPart2_Aguav[] = _("ability to grow without light."); +static const u8 sBerryDescriptionPart1_Iapapa[] = _("The BERRY is very big and sour."); +static const u8 sBerryDescriptionPart2_Iapapa[] = _("It takes at least a day to grow."); +static const u8 sBerryDescriptionPart1_Razz[] = _("The red BERRY tastes slightly spicy."); +static const u8 sBerryDescriptionPart2_Razz[] = _("It grows quickly in just four hours."); +static const u8 sBerryDescriptionPart1_Bluk[] = _("The BERRY is blue on the outside, but"); +static const u8 sBerryDescriptionPart2_Bluk[] = _("it blackens the mouth when eaten."); +static const u8 sBerryDescriptionPart1_Nanab[] = _("This BERRY was the seventh"); +static const u8 sBerryDescriptionPart2_Nanab[] = _("discovered in the world. It is sweet."); +static const u8 sBerryDescriptionPart1_Wepear[] = _("The flower is small and white. It has a"); +static const u8 sBerryDescriptionPart2_Wepear[] = _("delicate balance of bitter and sour."); +static const u8 sBerryDescriptionPart1_Pinap[] = _("Weak against wind and cold."); +static const u8 sBerryDescriptionPart2_Pinap[] = _("The fruit is spicy and the skin, sour."); +static const u8 sBerryDescriptionPart1_Pomeg[] = _("However much it is watered,"); +static const u8 sBerryDescriptionPart2_Pomeg[] = _("it only grows up to six BERRIES."); +static const u8 sBerryDescriptionPart1_Kelpsy[] = _("A rare variety shaped like a root."); +static const u8 sBerryDescriptionPart2_Kelpsy[] = _("Grows a very large flower."); +static const u8 sBerryDescriptionPart1_Qualot[] = _("Loves water. Grows strong even in"); +static const u8 sBerryDescriptionPart2_Qualot[] = _("locations with constant rainfall."); +static const u8 sBerryDescriptionPart1_Hondew[] = _("A BERRY that is very valuable and"); +static const u8 sBerryDescriptionPart2_Hondew[] = _("rarely seen. It is very delicious."); +static const u8 sBerryDescriptionPart1_Grepa[] = _("Despite its tenderness and round"); +static const u8 sBerryDescriptionPart2_Grepa[] = _("shape, the BERRY is unimaginably sour."); +static const u8 sBerryDescriptionPart1_Tamato[] = _("The BERRY is lip-bendingly spicy."); +static const u8 sBerryDescriptionPart2_Tamato[] = _("It takes time to grow."); +static const u8 sBerryDescriptionPart1_Cornn[] = _("A BERRY from an ancient era. May not"); +static const u8 sBerryDescriptionPart2_Cornn[] = _("grow unless planted in quantity."); +static const u8 sBerryDescriptionPart1_Magost[] = _("A BERRY that is widely said to have"); +static const u8 sBerryDescriptionPart2_Magost[] = _("a finely balanced flavor."); +static const u8 sBerryDescriptionPart1_Rabuta[] = _("A rare variety that is overgrown with"); +static const u8 sBerryDescriptionPart2_Rabuta[] = _("hair. It is quite bitter."); +static const u8 sBerryDescriptionPart1_Nomel[] = _("Quite sour. Just one bite makes it"); +static const u8 sBerryDescriptionPart2_Nomel[] = _("impossible to taste for three days."); +static const u8 sBerryDescriptionPart1_Spelon[] = _("The vividly red BERRY is very spicy."); +static const u8 sBerryDescriptionPart2_Spelon[] = _("Its warts secrete a spicy substance."); +static const u8 sBerryDescriptionPart1_Pamtre[] = _("Drifts on the sea from somewhere."); +static const u8 sBerryDescriptionPart2_Pamtre[] = _("It is thought to grow elsewhere."); +static const u8 sBerryDescriptionPart1_Watmel[] = _("A huge BERRY, with some over 20"); +static const u8 sBerryDescriptionPart2_Watmel[] = _("inches discovered. Exceedingly sweet."); +static const u8 sBerryDescriptionPart1_Durin[] = _("Bitter to even look at. It is so"); +static const u8 sBerryDescriptionPart2_Durin[] = _("bitter, no one has ever eaten it as is."); +static const u8 sBerryDescriptionPart1_Belue[] = _("It is glossy and looks delicious, but"); +static const u8 sBerryDescriptionPart2_Belue[] = _("it is awfully sour. Takes time to grow."); +static const u8 sBerryDescriptionPart1_Liechi[] = _("A mysterious BERRY. It is rumored to"); +static const u8 sBerryDescriptionPart2_Liechi[] = _("contain the power of the sea."); +static const u8 sBerryDescriptionPart1_Ganlon[] = _("A mysterious BERRY. It is rumored to"); +static const u8 sBerryDescriptionPart2_Ganlon[] = _("contain the power of the land."); +static const u8 sBerryDescriptionPart1_Salac[] = _("A mysterious BERRY. It is rumored to"); +static const u8 sBerryDescriptionPart2_Salac[] = _("contain the power of the sky."); +static const u8 sBerryDescriptionPart1_Petaya[] = _("A mysterious BERRY. It is rumored to"); +static const u8 sBerryDescriptionPart2_Petaya[] = _("contain the power of all living things."); +static const u8 sBerryDescriptionPart1_Apicot[] = _("A very mystifying BERRY. No telling"); +static const u8 sBerryDescriptionPart2_Apicot[] = _("what may happen or how it can be used."); +static const u8 sBerryDescriptionPart1_Lansat[] = _("Said to be a legendary BERRY."); +static const u8 sBerryDescriptionPart2_Lansat[] = _("Holding it supposedly brings joy."); +static const u8 sBerryDescriptionPart1_Starf[] = _("So strong, it was abandoned at the"); +static const u8 sBerryDescriptionPart2_Starf[] = _("world’s edge. Considered a mirage."); +static const u8 sBerryDescriptionPart1_Enigma[] = _("A completely enigmatic BERRY."); +static const u8 sBerryDescriptionPart2_Enigma[] = _("Appears to have the power of stars."); + +const struct Berry gBerries[] = +{ + { + .name = _("CHERI"), + .firmness = BERRY_FIRMNESS_SOFT, + .size = 20, + .maxYield = 3, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Cheri, + .description2 = sBerryDescriptionPart2_Cheri, + .stageDuration = 3, + .spicy = 10, + .dry = 0, + .sweet = 0, + .bitter = 0, + .sour = 0, + .smoothness = 25, + }, + { + .name = _("CHESTO"), + .firmness = BERRY_FIRMNESS_SUPER_HARD, + .size = 80, + .maxYield = 3, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Chesto, + .description2 = sBerryDescriptionPart2_Chesto, + .stageDuration = 3, + .spicy = 0, + .dry = 10, + .sweet = 0, + .bitter = 0, + .sour = 0, + .smoothness = 25, + }, + { + .name = _("PECHA"), + .firmness = BERRY_FIRMNESS_VERY_SOFT, + .size = 40, + .maxYield = 3, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Pecha, + .description2 = sBerryDescriptionPart2_Pecha, + .stageDuration = 3, + .spicy = 0, + .dry = 0, + .sweet = 10, + .bitter = 0, + .sour = 0, + .smoothness = 25, + }, + { + .name = _("RAWST"), + .firmness = BERRY_FIRMNESS_HARD, + .size = 32, + .maxYield = 3, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Rawst, + .description2 = sBerryDescriptionPart2_Rawst, + .stageDuration = 3, + .spicy = 0, + .dry = 0, + .sweet = 0, + .bitter = 10, + .sour = 0, + .smoothness = 25, + }, + { + .name = _("ASPEAR"), + .firmness = BERRY_FIRMNESS_SUPER_HARD, + .size = 50, + .maxYield = 3, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Aspear, + .description2 = sBerryDescriptionPart2_Aspear, + .stageDuration = 3, + .spicy = 0, + .dry = 0, + .sweet = 0, + .bitter = 0, + .sour = 10, + .smoothness = 25, + }, + { + .name = _("LEPPA"), + .firmness = BERRY_FIRMNESS_VERY_HARD, + .size = 28, + .maxYield = 3, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Leppa, + .description2 = sBerryDescriptionPart2_Leppa, + .stageDuration = 4, + .spicy = 10, + .dry = 0, + .sweet = 10, + .bitter = 10, + .sour = 10, + .smoothness = 20, + }, + { + .name = _("ORAN"), + .firmness = BERRY_FIRMNESS_SUPER_HARD, + .size = 35, + .maxYield = 3, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Oran, + .description2 = sBerryDescriptionPart2_Oran, + .stageDuration = 3, + .spicy = 10, + .dry = 10, + .sweet = 10, + .bitter = 10, + .sour = 10, + .smoothness = 20, + }, + { + .name = _("PERSIM"), + .firmness = BERRY_FIRMNESS_HARD, + .size = 47, + .maxYield = 3, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Persim, + .description2 = sBerryDescriptionPart2_Persim, + .stageDuration = 3, + .spicy = 10, + .dry = 10, + .sweet = 10, + .bitter = 10, + .sour = 10, + .smoothness = 20, + }, + { + .name = _("LUM"), + .firmness = BERRY_FIRMNESS_SUPER_HARD, + .size = 34, + .maxYield = 2, + .minYield = 1, + .description1 = sBerryDescriptionPart1_Lum, + .description2 = sBerryDescriptionPart2_Lum, + .stageDuration = 12, + .spicy = 10, + .dry = 10, + .sweet = 10, + .bitter = 10, + .sour = 10, + .smoothness = 20, + }, + { + .name = _("SITRUS"), + .firmness = BERRY_FIRMNESS_VERY_HARD, + .size = 95, + .maxYield = 3, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Sitrus, + .description2 = sBerryDescriptionPart2_Sitrus, + .stageDuration = 6, + .spicy = 10, + .dry = 10, + .sweet = 10, + .bitter = 10, + .sour = 10, + .smoothness = 20, + }, + { + .name = _("FIGY"), + .firmness = BERRY_FIRMNESS_SOFT, + .size = 100, + .maxYield = 3, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Figy, + .description2 = sBerryDescriptionPart2_Figy, + .stageDuration = 6, + .spicy = 10, + .dry = 0, + .sweet = 0, + .bitter = 0, + .sour = 0, + .smoothness = 25, + }, + { + .name = _("WIKI"), + .firmness = BERRY_FIRMNESS_HARD, + .size = 115, + .maxYield = 3, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Wiki, + .description2 = sBerryDescriptionPart2_Wiki, + .stageDuration = 6, + .spicy = 0, + .dry = 10, + .sweet = 0, + .bitter = 0, + .sour = 0, + .smoothness = 25, + }, + { + .name = _("MAGO"), + .firmness = BERRY_FIRMNESS_HARD, + .size = 126, + .maxYield = 3, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Mago, + .description2 = sBerryDescriptionPart2_Mago, + .stageDuration = 6, + .spicy = 0, + .dry = 0, + .sweet = 10, + .bitter = 0, + .sour = 0, + .smoothness = 25, + }, + { + .name = _("AGUAV"), + .firmness = BERRY_FIRMNESS_SUPER_HARD, + .size = 64, + .maxYield = 3, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Aguav, + .description2 = sBerryDescriptionPart2_Aguav, + .stageDuration = 6, + .spicy = 0, + .dry = 0, + .sweet = 0, + .bitter = 10, + .sour = 0, + .smoothness = 25, + }, + { + .name = _("IAPAPA"), + .firmness = BERRY_FIRMNESS_SOFT, + .size = 223, + .maxYield = 3, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Iapapa, + .description2 = sBerryDescriptionPart2_Iapapa, + .stageDuration = 6, + .spicy = 0, + .dry = 0, + .sweet = 0, + .bitter = 0, + .sour = 10, + .smoothness = 25, + }, + { + .name = _("RAZZ"), + .firmness = BERRY_FIRMNESS_VERY_HARD, + .size = 120, + .maxYield = 6, + .minYield = 3, + .description1 = sBerryDescriptionPart1_Razz, + .description2 = sBerryDescriptionPart2_Razz, + .stageDuration = 1, + .spicy = 10, + .dry = 10, + .sweet = 0, + .bitter = 0, + .sour = 0, + .smoothness = 20, + }, + { + .name = _("BLUK"), + .firmness = BERRY_FIRMNESS_SOFT, + .size = 108, + .maxYield = 6, + .minYield = 3, + .description1 = sBerryDescriptionPart1_Bluk, + .description2 = sBerryDescriptionPart2_Bluk, + .stageDuration = 1, + .spicy = 0, + .dry = 10, + .sweet = 10, + .bitter = 0, + .sour = 0, + .smoothness = 20, + }, + { + .name = _("NANAB"), + .firmness = BERRY_FIRMNESS_VERY_HARD, + .size = 77, + .maxYield = 6, + .minYield = 3, + .description1 = sBerryDescriptionPart1_Nanab, + .description2 = sBerryDescriptionPart2_Nanab, + .stageDuration = 1, + .spicy = 0, + .dry = 0, + .sweet = 10, + .bitter = 10, + .sour = 0, + .smoothness = 20, + }, + { + .name = _("WEPEAR"), + .firmness = BERRY_FIRMNESS_SUPER_HARD, + .size = 74, + .maxYield = 6, + .minYield = 3, + .description1 = sBerryDescriptionPart1_Wepear, + .description2 = sBerryDescriptionPart2_Wepear, + .stageDuration = 1, + .spicy = 0, + .dry = 0, + .sweet = 0, + .bitter = 10, + .sour = 10, + .smoothness = 20, + }, + { + .name = _("PINAP"), + .firmness = BERRY_FIRMNESS_HARD, + .size = 80, + .maxYield = 6, + .minYield = 3, + .description1 = sBerryDescriptionPart1_Pinap, + .description2 = sBerryDescriptionPart2_Pinap, + .stageDuration = 1, + .spicy = 10, + .dry = 0, + .sweet = 0, + .bitter = 0, + .sour = 10, + .smoothness = 20, + }, + { + .name = _("POMEG"), + .firmness = BERRY_FIRMNESS_VERY_HARD, + .size = 135, + .maxYield = 6, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Pomeg, + .description2 = sBerryDescriptionPart2_Pomeg, + .stageDuration = 3, + .spicy = 10, + .dry = 0, + .sweet = 10, + .bitter = 10, + .sour = 0, + .smoothness = 20, + }, + { + .name = _("KELPSY"), + .firmness = BERRY_FIRMNESS_HARD, + .size = 150, + .maxYield = 6, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Kelpsy, + .description2 = sBerryDescriptionPart2_Kelpsy, + .stageDuration = 3, + .spicy = 0, + .dry = 10, + .sweet = 0, + .bitter = 10, + .sour = 10, + .smoothness = 20, + }, + { + .name = _("QUALOT"), + .firmness = BERRY_FIRMNESS_HARD, + .size = 110, + .maxYield = 6, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Qualot, + .description2 = sBerryDescriptionPart2_Qualot, + .stageDuration = 3, + .spicy = 10, + .dry = 0, + .sweet = 10, + .bitter = 0, + .sour = 10, + .smoothness = 20, + }, + { + .name = _("HONDEW"), + .firmness = BERRY_FIRMNESS_HARD, + .size = 162, + .maxYield = 6, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Hondew, + .description2 = sBerryDescriptionPart2_Hondew, + .stageDuration = 3, + .spicy = 10, + .dry = 10, + .sweet = 0, + .bitter = 10, + .sour = 0, + .smoothness = 20, + }, + { + .name = _("GREPA"), + .firmness = BERRY_FIRMNESS_SOFT, + .size = 149, + .maxYield = 6, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Grepa, + .description2 = sBerryDescriptionPart2_Grepa, + .stageDuration = 3, + .spicy = 0, + .dry = 10, + .sweet = 10, + .bitter = 0, + .sour = 10, + .smoothness = 20, + }, + { + .name = _("TAMATO"), + .firmness = BERRY_FIRMNESS_SOFT, + .size = 200, + .maxYield = 4, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Tamato, + .description2 = sBerryDescriptionPart2_Tamato, + .stageDuration = 6, + .spicy = 20, + .dry = 10, + .sweet = 0, + .bitter = 0, + .sour = 0, + .smoothness = 30, + }, + { + .name = _("CORNN"), + .firmness = BERRY_FIRMNESS_HARD, + .size = 75, + .maxYield = 4, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Cornn, + .description2 = sBerryDescriptionPart2_Cornn, + .stageDuration = 6, + .spicy = 0, + .dry = 20, + .sweet = 10, + .bitter = 0, + .sour = 0, + .smoothness = 30, + }, + { + .name = _("MAGOST"), + .firmness = BERRY_FIRMNESS_HARD, + .size = 140, + .maxYield = 4, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Magost, + .description2 = sBerryDescriptionPart2_Magost, + .stageDuration = 6, + .spicy = 0, + .dry = 0, + .sweet = 20, + .bitter = 10, + .sour = 0, + .smoothness = 30, + }, + { + .name = _("RABUTA"), + .firmness = BERRY_FIRMNESS_SOFT, + .size = 226, + .maxYield = 4, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Rabuta, + .description2 = sBerryDescriptionPart2_Rabuta, + .stageDuration = 6, + .spicy = 0, + .dry = 0, + .sweet = 0, + .bitter = 20, + .sour = 10, + .smoothness = 30, + }, + { + .name = _("NOMEL"), + .firmness = BERRY_FIRMNESS_SUPER_HARD, + .size = 285, + .maxYield = 4, + .minYield = 2, + .description1 = sBerryDescriptionPart1_Nomel, + .description2 = sBerryDescriptionPart2_Nomel, + .stageDuration = 6, + .spicy = 10, + .dry = 0, + .sweet = 0, + .bitter = 0, + .sour = 20, + .smoothness = 30, + }, + { + .name = _("SPELON"), + .firmness = BERRY_FIRMNESS_SOFT, + .size = 133, + .maxYield = 2, + .minYield = 1, + .description1 = sBerryDescriptionPart1_Spelon, + .description2 = sBerryDescriptionPart2_Spelon, + .stageDuration = 18, + .spicy = 40, + .dry = 10, + .sweet = 0, + .bitter = 0, + .sour = 0, + .smoothness = 70, + }, + { + .name = _("PAMTRE"), + .firmness = BERRY_FIRMNESS_VERY_SOFT, + .size = 244, + .maxYield = 2, + .minYield = 1, + .description1 = sBerryDescriptionPart1_Pamtre, + .description2 = sBerryDescriptionPart2_Pamtre, + .stageDuration = 18, + .spicy = 0, + .dry = 40, + .sweet = 10, + .bitter = 0, + .sour = 0, + .smoothness = 70, + }, + { + .name = _("WATMEL"), + .firmness = BERRY_FIRMNESS_SOFT, + .size = 250, + .maxYield = 2, + .minYield = 1, + .description1 = sBerryDescriptionPart1_Watmel, + .description2 = sBerryDescriptionPart2_Watmel, + .stageDuration = 18, + .spicy = 0, + .dry = 0, + .sweet = 40, + .bitter = 10, + .sour = 0, + .smoothness = 70, + }, + { + .name = _("DURIN"), + .firmness = BERRY_FIRMNESS_HARD, + .size = 280, + .maxYield = 2, + .minYield = 1, + .description1 = sBerryDescriptionPart1_Durin, + .description2 = sBerryDescriptionPart2_Durin, + .stageDuration = 18, + .spicy = 0, + .dry = 0, + .sweet = 0, + .bitter = 40, + .sour = 10, + .smoothness = 70, + }, + { + .name = _("BELUE"), + .firmness = BERRY_FIRMNESS_VERY_SOFT, + .size = 300, + .maxYield = 2, + .minYield = 1, + .description1 = sBerryDescriptionPart1_Belue, + .description2 = sBerryDescriptionPart2_Belue, + .stageDuration = 18, + .spicy = 10, + .dry = 0, + .sweet = 0, + .bitter = 0, + .sour = 40, + .smoothness = 70, + }, + { + .name = _("LIECHI"), + .firmness = BERRY_FIRMNESS_VERY_HARD, + .size = 111, + .maxYield = 2, + .minYield = 1, + .description1 = sBerryDescriptionPart1_Liechi, + .description2 = sBerryDescriptionPart2_Liechi, + .stageDuration = 24, + .spicy = 40, + .dry = 0, + .sweet = 40, + .bitter = 0, + .sour = 10, + .smoothness = 80, + }, + { + .name = _("GANLON"), + .firmness = BERRY_FIRMNESS_VERY_HARD, + .size = 33, + .maxYield = 2, + .minYield = 1, + .description1 = sBerryDescriptionPart1_Ganlon, + .description2 = sBerryDescriptionPart2_Ganlon, + .stageDuration = 24, + .spicy = 0, + .dry = 40, + .sweet = 0, + .bitter = 40, + .sour = 0, + .smoothness = 80, + }, + { + .name = _("SALAC"), + .firmness = BERRY_FIRMNESS_VERY_HARD, + .size = 95, + .maxYield = 2, + .minYield = 1, + .description1 = sBerryDescriptionPart1_Salac, + .description2 = sBerryDescriptionPart2_Salac, + .stageDuration = 24, + .spicy = 0, + .dry = 0, + .sweet = 40, + .bitter = 0, + .sour = 40, + .smoothness = 80, + }, + { + .name = _("PETAYA"), + .firmness = BERRY_FIRMNESS_VERY_HARD, + .size = 237, + .maxYield = 2, + .minYield = 1, + .description1 = sBerryDescriptionPart1_Petaya, + .description2 = sBerryDescriptionPart2_Petaya, + .stageDuration = 24, + .spicy = 40, + .dry = 0, + .sweet = 0, + .bitter = 40, + .sour = 0, + .smoothness = 80, + }, + { + .name = _("APICOT"), + .firmness = BERRY_FIRMNESS_HARD, + .size = 75, + .maxYield = 2, + .minYield = 1, + .description1 = sBerryDescriptionPart1_Apicot, + .description2 = sBerryDescriptionPart2_Apicot, + .stageDuration = 24, + .spicy = 0, + .dry = 40, + .sweet = 0, + .bitter = 0, + .sour = 40, + .smoothness = 80, + }, + { + .name = _("LANSAT"), + .firmness = BERRY_FIRMNESS_SOFT, + .size = 97, + .maxYield = 2, + .minYield = 1, + .description1 = sBerryDescriptionPart1_Lansat, + .description2 = sBerryDescriptionPart2_Lansat, + .stageDuration = 24, + .spicy = 10, + .dry = 10, + .sweet = 10, + .bitter = 10, + .sour = 10, + .smoothness = 30, + }, + { + .name = _("STARF"), + .firmness = BERRY_FIRMNESS_SUPER_HARD, + .size = 153, + .maxYield = 2, + .minYield = 1, + .description1 = sBerryDescriptionPart1_Starf, + .description2 = sBerryDescriptionPart2_Starf, + .stageDuration = 24, + .spicy = 10, + .dry = 10, + .sweet = 10, + .bitter = 10, + .sour = 10, + .smoothness = 30, + }, + { + .name = _("ENIGMA"), + .firmness = BERRY_FIRMNESS_UNKNOWN, + .size = 0, + .maxYield = 2, + .minYield = 1, + .description1 = sBerryDescriptionPart1_Enigma, + .description2 = sBerryDescriptionPart2_Enigma, + .stageDuration = 24, + .spicy = 40, + .dry = 40, + .sweet = 40, + .bitter = 40, + .sour = 40, + .smoothness = 40, + }, +}; + +// unused +void ClearEnigmaBerries(void) +{ + CpuFill16(0, &gSaveBlock1Ptr->enigmaBerry, sizeof(gSaveBlock1Ptr->enigmaBerry)); +} + +void SetEnigmaBerry(u8 *src) +{ + u32 i; + u8 *dest = (u8*)&gSaveBlock1Ptr->enigmaBerry; + + for (i = 0; i < sizeof(gSaveBlock1Ptr->enigmaBerry); i++) + dest[i] = src[i]; +} + +u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry) +{ + u32 i; + u32 checksum; + u8 *dest; + + dest = (u8*)enigmaBerry; + checksum = 0; + for (i = 0; i < sizeof(gSaveBlock1Ptr->enigmaBerry) - sizeof(gSaveBlock1Ptr->enigmaBerry.checksum); i++) + { + checksum += dest[i]; + } + + return checksum; +} + +bool32 IsEnigmaBerryValid(void) +{ + if (!gSaveBlock1Ptr->enigmaBerry.berry.stageDuration) + return FALSE; + if (!gSaveBlock1Ptr->enigmaBerry.berry.maxYield) + return FALSE; + if (GetEnigmaBerryChecksum(&gSaveBlock1Ptr->enigmaBerry) != gSaveBlock1Ptr->enigmaBerry.checksum) + return FALSE; + return TRUE; +} + +const struct Berry *GetBerryInfo(u8 berry) +{ + if (berry == 0x2B && IsEnigmaBerryValid()) + return (struct Berry*)(&gSaveBlock1Ptr->enigmaBerry.berry); + else + { + if (berry == 0 || berry > 0x2B) + berry = 1; + return &gBerries[berry - 1]; + } +} + +struct BerryTree *GetBerryTreeInfo(u8 id) +{ + return &gSaveBlock1Ptr->berryTrees[id]; +} + +bool32 FieldObjectInteractionWaterBerryTree(void) +{ + struct BerryTree *tree = GetBerryTreeInfo(FieldObjectGetBerryTreeId(gSelectedMapObject)); + + switch (tree->stage) + { + case 1: + tree->watered1 = TRUE; + break; + case 2: + tree->watered2 = TRUE; + break; + case 3: + tree->watered3 = TRUE; + break; + case 4: + tree->watered4 = TRUE; + break; + default: + return FALSE; + } + return TRUE; +} + +bool8 IsPlayerFacingPlantedBerryTree(void) +{ + if (GetFieldObjectScriptPointerForComparison() == BerryTreeScript + && GetStageByBerryTreeId(FieldObjectGetBerryTreeId(gSelectedMapObject)) == 0) + return TRUE; + else + return FALSE; +} + +bool8 TryToWaterBerryTree(void) +{ + if (GetFieldObjectScriptPointerForComparison() != BerryTreeScript) + return FALSE; + else + return FieldObjectInteractionWaterBerryTree(); +} + +void ClearBerryTrees(void) +{ + int i; + + for (i = 0; i < BERRY_TREES_COUNT; i++) + gSaveBlock1Ptr->berryTrees[i] = gBlankBerryTree; +} + +bool32 BerryTreeGrow(struct BerryTree *tree) +{ + if (tree->growthSparkle) + return FALSE; + switch (tree->stage) + { + case 0: + return FALSE; + case 4: + tree->berryYield = CalcBerryYield(tree); + case 1: + case 2: + case 3: + tree->stage++; + break; + case 5: + tree->watered1 = 0; + tree->watered2 = 0; + tree->watered3 = 0; + tree->watered4 = 0; + tree->berryYield = 0; + tree->stage = 2; + if (++tree->regrowthCount == 10) + *tree = gBlankBerryTree; + break; + } + return TRUE; +} + +void BerryTreeTimeUpdate(s32 minutes) +{ + int i; + struct BerryTree *tree; + + for (i = 0; i < BERRY_TREES_COUNT; i++) + { + tree = &gSaveBlock1Ptr->berryTrees[i]; + + if (tree->berry && tree->stage && !tree->growthSparkle) + { + if (minutes >= GetStageDurationByBerryType(tree->berry) * 71) + { + *tree = gBlankBerryTree; + } + else + { + s32 time = minutes; + + while (time != 0) + { + if (tree->minutesUntilNextStage > time) + { + tree->minutesUntilNextStage -= time; + break; + } + time -= tree->minutesUntilNextStage; + tree->minutesUntilNextStage = GetStageDurationByBerryType(tree->berry); + if (!BerryTreeGrow(tree)) + break; + if (tree->stage == 5) + tree->minutesUntilNextStage *= 4; + } + } + } + } +} + +void PlantBerryTree(u8 id, u8 berry, u8 stage, bool8 sparkle) +{ + struct BerryTree *tree = GetBerryTreeInfo(id); + + *tree = gBlankBerryTree; + tree->berry = berry; + tree->minutesUntilNextStage = GetStageDurationByBerryType(berry); + tree->stage = stage; + if (stage == 5) + { + tree->berryYield = CalcBerryYield(tree); + tree->minutesUntilNextStage *= 4; + } + if (!sparkle) + { + tree->growthSparkle = TRUE; + } +} + +void RemoveBerryTree(u8 id) +{ + gSaveBlock1Ptr->berryTrees[id] = gBlankBerryTree; +} + +u8 GetBerryTypeByBerryTreeId(u8 id) +{ + return gSaveBlock1Ptr->berryTrees[id].berry; +} + +u8 GetStageByBerryTreeId(u8 id) +{ + return gSaveBlock1Ptr->berryTrees[id].stage; +} + +u8 ItemIdToBerryType(u16 item) +{ + u16 berry = item - FIRST_BERRY; + + if (berry > LAST_BERRY - FIRST_BERRY) + return 1; + else + return item - FIRST_BERRY + 1; +} + +u16 BerryTypeToItemId(u16 berry) +{ + u16 item = berry - 1; + + if (item > LAST_BERRY - FIRST_BERRY) + return FIRST_BERRY; + else + return berry + FIRST_BERRY - 1; +} + +void GetBerryNameByBerryType(u8 berry, u8 *string) +{ + memcpy(string, GetBerryInfo(berry)->name, BERRY_NAME_LENGTH); + string[BERRY_NAME_LENGTH] = EOS; +} + +void GetBerryCountStringByBerryType(u8 berry, u8* dest, u32 berryCount) +{ + GetBerryCountString(dest, GetBerryInfo(berry)->name, berryCount); +} + +void ResetBerryTreeSparkleFlag(u8 id) +{ + GetBerryTreeInfo(id)->growthSparkle = 0; +} + +u8 BerryTreeGetNumStagesWatered(struct BerryTree *tree) +{ + u8 count = 0; + + if (tree->watered1) + count++; + if (tree->watered2) + count++; + if (tree->watered3) + count++; + if (tree->watered4) + count++; + return count; +} + +u8 GetNumStagesWateredByBerryTreeId(u8 id) +{ + return BerryTreeGetNumStagesWatered(GetBerryTreeInfo(id)); +} + +u8 CalcBerryYieldInternal(u16 max, u16 min, u8 water) +{ + u32 randMin; + u32 randMax; + u32 rand; + u32 extraYield; + + if (water == 0) + return min; + else + { + randMin = (max - min) * (water - 1); + randMax = (max - min) * (water); + rand = randMin + Random() % (randMax - randMin + 1); + + if ((rand & 3) > 1) + extraYield = rand / 4 + 1; + else + extraYield = rand / 4; + return extraYield + min; + } +} + +u8 CalcBerryYield(struct BerryTree *tree) +{ + const struct Berry *berry = GetBerryInfo(tree->berry); + u8 min = berry->minYield; + u8 max = berry->maxYield; + + return CalcBerryYieldInternal(max, min, BerryTreeGetNumStagesWatered(tree)); +} + +u8 GetBerryCountByBerryTreeId(u8 id) +{ + return gSaveBlock1Ptr->berryTrees[id].berryYield; +} + +u16 GetStageDurationByBerryType(u8 berry) +{ + return GetBerryInfo(berry)->stageDuration * 60; +} + +void FieldObjectInteractionGetBerryTreeData(void) +{ + u8 id; + u8 berry; + u8 unk; + u8 group; + u8 num; + + id = FieldObjectGetBerryTreeId(gSelectedMapObject); + berry = GetBerryTypeByBerryTreeId(id); + ResetBerryTreeSparkleFlag(id); + unk = gScriptLastTalked; + num = gSaveBlock1Ptr->location.mapNum; + group = gSaveBlock1Ptr->location.mapGroup; + if (sub_8092E9C(unk, num, group)) + gSpecialVar_0x8004 = 0xFF; + else + gSpecialVar_0x8004 = GetStageByBerryTreeId(id); + gSpecialVar_0x8005 = GetNumStagesWateredByBerryTreeId(id); + gSpecialVar_0x8006 = GetBerryCountByBerryTreeId(id); + GetBerryCountStringByBerryType(berry, gStringVar1, gSpecialVar_0x8006); +} + +void FieldObjectInteractionGetBerryName(void) +{ + u8 berryType = GetBerryTypeByBerryTreeId(FieldObjectGetBerryTreeId(gSelectedMapObject)); + GetBerryNameByBerryType(berryType, gStringVar1); +} + +void FieldObjectInteractionGetBerryCountString(void) +{ + u8 treeId = FieldObjectGetBerryTreeId(gSelectedMapObject); + u8 berry = GetBerryTypeByBerryTreeId(treeId); + u8 count = GetBerryCountByBerryTreeId(treeId); + GetBerryCountStringByBerryType(berry, gStringVar1, count); +} + +void Bag_ChooseBerry(void) +{ + SetMainCallback2(CB2_ChooseBerry); +} + +void FieldObjectInteractionPlantBerryTree(void) +{ + u8 berry = ItemIdToBerryType(gScriptItemId); + + PlantBerryTree(FieldObjectGetBerryTreeId(gSelectedMapObject), berry, 1, TRUE); + FieldObjectInteractionGetBerryTreeData(); +} + +void FieldObjectInteractionPickBerryTree(void) +{ + u8 id = FieldObjectGetBerryTreeId(gSelectedMapObject); + u8 berry = GetBerryTypeByBerryTreeId(id); + + gSpecialVar_0x8004 = AddBagItem(BerryTypeToItemId(berry), GetBerryCountByBerryTreeId(id)); +} + +void FieldObjectInteractionRemoveBerryTree(void) +{ + RemoveBerryTree(FieldObjectGetBerryTreeId(gSelectedMapObject)); + sub_8092EF0(gScriptLastTalked, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); +} + +u8 PlayerHasBerries(void) +{ + return IsBagPocketNonEmpty(BAG_BERRIES); +} + +void ResetBerryTreeSparkleFlags(void) +{ + s16 cam_left; + s16 cam_top; + s16 left; + s16 top; + s16 right; + s16 bottom; + int i; + + GetCameraCoords(&cam_left, &cam_top); + left = cam_left; + top = cam_top + 3; + right = cam_left + 14; + bottom = top + 8; + for (i = 0; i < MAP_OBJECTS_COUNT; i++) + { + if (gMapObjects[i].active && gMapObjects[i].animPattern == 12) + { + cam_left = gMapObjects[i].coords2.x; + cam_top = gMapObjects[i].coords2.y; + if (left <= cam_left && cam_left <= right && top <= cam_top && cam_top <= bottom) + ResetBerryTreeSparkleFlag(gMapObjects[i].trainerRange_berryTreeId); + } + } +} diff --git a/src/decompress.c b/src/decompress.c index befdbaba2..2863ff1f5 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -3,14 +3,13 @@ #include "species.h" #include "text.h" #include "malloc.h" +#include "pokemon.h" EWRAM_DATA ALIGNED(4) u8 gDecompressionBuffer[0x4000] = {0}; extern const struct CompressedSpriteSheet gMonFrontPicTable[]; extern const struct CompressedSpriteSheet gMonBackPicTable[]; -extern void DrawSpindaSpots(u16 species, u32 personality, void* dest, bool8 isFrontPic); - static void DuplicateDeoxysTiles(void *pointer, s32 species); void LZDecompressWram(const void *src, void *dest) diff --git a/src/item.c b/src/item.c index 4ad70e11f..c85e2fe1f 100644 --- a/src/item.c +++ b/src/item.c @@ -1,5 +1,6 @@ #include "global.h" #include "item.h" +#include "items.h" #include "string_util.h" #include "text.h" #include "event_data.h" @@ -86,10 +87,10 @@ void CopyItemName(u16 itemId, u8 *string) void CopyItemNameHandlePlural(u16 itemId, u8 *string, u32 quantity) { - if (itemId == 4) + if (itemId == ITEM_POKE_BALL) { if (quantity < 2) - StringCopy(string, ItemId_GetItem(4)->name); + StringCopy(string, ItemId_GetItem(ITEM_POKE_BALL)->name); else StringCopy(string, gOtherText_PokeBalls); } diff --git a/src/pokemon_1.c b/src/pokemon_1.c index e28c56252..fe7809826 100644 --- a/src/pokemon_1.c +++ b/src/pokemon_1.c @@ -296,7 +296,73 @@ void sub_806819C(struct Pokemon *mon, struct UnknownPokemonStruct *src) StripExtCtrlCodes(nickname); } else + { language = GAME_LANGUAGE; + } + + SetMonData(mon, MON_DATA_LANGUAGE, &language); + SetMonData(mon, MON_DATA_NICKNAME, nickname); + SetMonData(mon, MON_DATA_HP_EV, &src->hpEV); + SetMonData(mon, MON_DATA_ATK_EV, &src->attackEV); + SetMonData(mon, MON_DATA_DEF_EV, &src->defenseEV); + SetMonData(mon, MON_DATA_SPD_EV, &src->speedEV); + SetMonData(mon, MON_DATA_SPATK_EV, &src->spAttackEV); + SetMonData(mon, MON_DATA_SPDEF_EV, &src->spDefenseEV); + value = src->altAbility; + SetMonData(mon, MON_DATA_ALT_ABILITY, &value); + value = src->hpIV; + SetMonData(mon, MON_DATA_HP_IV, &value); + value = src->attackIV; + SetMonData(mon, MON_DATA_ATK_IV, &value); + value = src->defenseIV; + SetMonData(mon, MON_DATA_DEF_IV, &value); + value = src->speedIV; + SetMonData(mon, MON_DATA_SPD_IV, &value); + value = src->spAttackIV; + SetMonData(mon, MON_DATA_SPATK_IV, &value); + value = src->spDefenseIV; + SetMonData(mon, MON_DATA_SPDEF_IV, &value); + MonRestorePP(mon); + CalculateMonStats(mon); +} + +u8 BattleFrontierGetOpponentLvl(u8); + +void sub_8068338(struct Pokemon *mon, struct UnknownPokemonStruct *src, bool8 lvl50) +{ + s32 i; + u8 nickname[30]; + u8 level; + u8 language; + u8 value; + + if (gSaveBlock2Ptr->frontierChosenLvl != 0) + level = BattleFrontierGetOpponentLvl(gSaveBlock2Ptr->frontierChosenLvl); + else if (lvl50) + level = 50; + else + level = src->level; + + CreateMon(mon, src->species, level, 0, 1, src->personality, 1, src->otId); + + for (i = 0; i < 4; i++) + SetMonMoveSlot(mon, src->moves[i], i); + + SetMonData(mon, MON_DATA_PP_BONUSES, &src->ppBonuses); + SetMonData(mon, MON_DATA_HELD_ITEM, &src->heldItem); + SetMonData(mon, MON_DATA_FRIENDSHIP, &src->friendship); + + StringCopy(nickname, src->nickname); + + if (nickname[0] == EXT_CTRL_CODE_BEGIN && nickname[1] == EXT_CTRL_CODE_JPN) + { + language = LANGUAGE_JAPANESE; + StripExtCtrlCodes(nickname); + } + else + { + language = GAME_LANGUAGE; + } SetMonData(mon, MON_DATA_LANGUAGE, &language); SetMonData(mon, MON_DATA_NICKNAME, nickname); diff --git a/src/pokemon_2.c b/src/pokemon_2.c index d50853383..9549a6dcd 100644 --- a/src/pokemon_2.c +++ b/src/pokemon_2.c @@ -1,4 +1,1372 @@ #include "global.h" #include "pokemon.h" +#include "battle.h" +#include "event_data.h" +#include "rng.h" +#include "sprite.h" +#include "species.h" +#include "text.h" +#include "string_util.h" + +struct Unknown_020249B4 +{ + u8 unk0[0xC]; + struct SpriteTemplate* templates; +}; + +extern u8 gAbsentBankFlags; +extern u8 gActiveBank; +extern u8 gBankAttacker; +extern u8 gBankTarget; +extern u8 gLastUsedAbility; +extern u16 gTrainerBattleOpponent_A; +extern u32 gBattleTypeFlags; +extern struct SpriteTemplate gUnknown_0202499C; +extern struct Unknown_020249B4* gUnknown_020249B4[2]; + +extern const u32 gBitTable[]; +extern const struct SpriteTemplate gUnknown_08329D98[]; +extern const struct SpriteTemplate gUnknown_08329DF8[]; +extern const union AnimCmd* gUnknown_082FF70C[]; +extern const union AnimCmd* const * const gUnknown_08309AAC[]; +extern const union AnimCmd* const * const gUnknown_08305D0C[]; +extern const union AnimCmd* const * const gUnknown_0830536C[]; +extern const u8 gBadEggNickname[]; +extern const u8 gEggNickname[]; + +extern u8 GetBankSide(u8 bank); +extern u8 GetBankByPlayerAI(u8 bank); +extern u8 GetBankIdentity(u8 bank); + +u8 CountAliveMonsInBattle(u8 caseId) +{ + s32 i; + u8 retVal = 0; + + switch (caseId) + { + case BATTLE_ALIVE_EXCEPT_ACTIVE: + for (i = 0; i < 4; i++) + { + if (i != gActiveBank && !(gAbsentBankFlags & gBitTable[i])) + retVal++; + } + break; + case BATTLE_ALIVE_ATK_SIDE: + for (i = 0; i < 4; i++) + { + if (GetBankSide(i) == GetBankSide(gBankAttacker) && !(gAbsentBankFlags & gBitTable[i])) + retVal++; + } + break; + case BATTLE_ALIVE_DEF_SIDE: + for (i = 0; i < 4; i++) + { + if (GetBankSide(i) == GetBankSide(gBankTarget) && !(gAbsentBankFlags & gBitTable[i])) + retVal++; + } + break; + } + + return retVal; +} + +bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 bank) +{ + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_x2000000 | BATTLE_TYPE_FRONTIER)) + return FALSE; + if (GetBankSide(bank) != SIDE_PLAYER) + return FALSE; + if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gTrainerBattleOpponent_A == SECRET_BASE_OPPONENT) + return FALSE; + if (FlagGet(badgeFlag)) + return TRUE; + return FALSE; +} + +u8 sub_8069F34(u8 bank) +{ + u8 status = GetBankIdentity(bank) & 1; + + status ^= 1; + if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) + return GetBankByPlayerAI(status); + if (CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_ACTIVE) > 1) + { + u8 val; + + if ((Random() & 1) == 0) + val = status ^ 2; + else + val = status; + return GetBankByPlayerAI(val); + } + else + { + if ((gAbsentBankFlags & gBitTable[status])) + return GetBankByPlayerAI(status ^ 2); + else + return GetBankByPlayerAI(status); + } +} + +u8 GetMonGender(struct Pokemon *mon) +{ + return GetBoxMonGender(&mon->box); +} + +u8 GetBoxMonGender(struct BoxPokemon *boxMon) +{ + u16 species = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); + u32 personality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); + + switch (gBaseStats[species].genderRatio) + { + case MON_MALE: + case MON_FEMALE: + case MON_GENDERLESS: + return gBaseStats[species].genderRatio; + } + + if (gBaseStats[species].genderRatio > (personality & 0xFF)) + return MON_FEMALE; + else + return MON_MALE; +} + +u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality) +{ + switch (gBaseStats[species].genderRatio) + { + case MON_MALE: + case MON_FEMALE: + case MON_GENDERLESS: + return gBaseStats[species].genderRatio; + } + + if (gBaseStats[species].genderRatio > (personality & 0xFF)) + return MON_FEMALE; + else + return MON_MALE; +} + +void sub_806A068(u16 species, u8 bankIdentity) +{ + if (gBattleSpritesGfx != NULL) + gUnknown_0202499C = gBattleSpritesGfx->templates[bankIdentity]; + else if (gUnknown_020249B4[0]) + gUnknown_0202499C = gUnknown_020249B4[0]->templates[bankIdentity]; + else if (gUnknown_020249B4[1]) + gUnknown_0202499C = gUnknown_020249B4[1]->templates[bankIdentity]; + else + gUnknown_0202499C = gUnknown_08329D98[bankIdentity]; + + gUnknown_0202499C.paletteTag = species; + if (bankIdentity == 0 || bankIdentity == 2) + gUnknown_0202499C.anims = gUnknown_082FF70C; + else if (species > 500) + gUnknown_0202499C.anims = gUnknown_08309AAC[species - 500]; + else + gUnknown_0202499C.anims = gUnknown_08309AAC[species]; +} + +void sub_806A12C(u16 trainerSpriteId, u8 bankIdentity) +{ + gUnknown_0202499C.paletteTag = trainerSpriteId; + if (bankIdentity == 0 || bankIdentity == 2) + { + gUnknown_0202499C = gUnknown_08329DF8[trainerSpriteId]; + gUnknown_0202499C.anims = gUnknown_08305D0C[trainerSpriteId]; + } + else + { + if (gBattleSpritesGfx != NULL) + gUnknown_0202499C = gBattleSpritesGfx->templates[bankIdentity]; + else + gUnknown_0202499C = gUnknown_08329D98[bankIdentity]; + gUnknown_0202499C.anims = gUnknown_0830536C[trainerSpriteId]; + } +} + +void sub_806A1C0(u16 arg0, u8 bankIdentity) +{ + if (gBattleSpritesGfx != NULL) + gUnknown_0202499C = gBattleSpritesGfx->templates[bankIdentity]; + else + gUnknown_0202499C = gUnknown_08329D98[bankIdentity]; + gUnknown_0202499C.paletteTag = arg0; + gUnknown_0202499C.anims = gUnknown_0830536C[arg0]; +} + +void EncryptBoxMon(struct BoxPokemon *boxMon) +{ + u32 i; + for (i = 0; i < 12; i++) + { + boxMon->secure.raw[i] ^= boxMon->personality; + boxMon->secure.raw[i] ^= boxMon->otId; + } +} + +void DecryptBoxMon(struct BoxPokemon *boxMon) +{ + u32 i; + for (i = 0; i < 12; i++) + { + boxMon->secure.raw[i] ^= boxMon->otId; + boxMon->secure.raw[i] ^= boxMon->personality; + } +} + +#define SUBSTRUCT_CASE(n, v1, v2, v3, v4) \ +case n: \ + { \ + union PokemonSubstruct *substructs0 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs1 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs2 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs3 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs4 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs5 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs6 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs7 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs8 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs9 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs10 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs11 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs12 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs13 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs14 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs15 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs16 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs17 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs18 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs19 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs20 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs21 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs22 = boxMon->secure.substructs; \ + union PokemonSubstruct *substructs23 = boxMon->secure.substructs; \ + \ + switch (substructType) \ + { \ + case 0: \ + substruct = &substructs ## n [v1]; \ + break; \ + case 1: \ + substruct = &substructs ## n [v2]; \ + break; \ + case 2: \ + substruct = &substructs ## n [v3]; \ + break; \ + case 3: \ + substruct = &substructs ## n [v4]; \ + break; \ + } \ + break; \ + } \ +union PokemonSubstruct *GetSubstruct(struct BoxPokemon *boxMon, u32 personality, u8 substructType) +{ + union PokemonSubstruct *substruct = NULL; + + switch (personality % 24) + { + SUBSTRUCT_CASE( 0,0,1,2,3) + SUBSTRUCT_CASE( 1,0,1,3,2) + SUBSTRUCT_CASE( 2,0,2,1,3) + SUBSTRUCT_CASE( 3,0,3,1,2) + SUBSTRUCT_CASE( 4,0,2,3,1) + SUBSTRUCT_CASE( 5,0,3,2,1) + SUBSTRUCT_CASE( 6,1,0,2,3) + SUBSTRUCT_CASE( 7,1,0,3,2) + SUBSTRUCT_CASE( 8,2,0,1,3) + SUBSTRUCT_CASE( 9,3,0,1,2) + SUBSTRUCT_CASE(10,2,0,3,1) + SUBSTRUCT_CASE(11,3,0,2,1) + SUBSTRUCT_CASE(12,1,2,0,3) + SUBSTRUCT_CASE(13,1,3,0,2) + SUBSTRUCT_CASE(14,2,1,0,3) + SUBSTRUCT_CASE(15,3,1,0,2) + SUBSTRUCT_CASE(16,2,3,0,1) + SUBSTRUCT_CASE(17,3,2,0,1) + SUBSTRUCT_CASE(18,1,2,3,0) + SUBSTRUCT_CASE(19,1,3,2,0) + SUBSTRUCT_CASE(20,2,1,3,0) + SUBSTRUCT_CASE(21,3,1,2,0) + SUBSTRUCT_CASE(22,2,3,1,0) + SUBSTRUCT_CASE(23,3,2,1,0) + } + + return substruct; +} + +extern u16 GetDeoxysStat(struct Pokemon *mon, s32 statId); + +u32 GetMonData(struct Pokemon *mon, s32 field, u8* data) +{ + u32 ret; + + switch (field) + { + case MON_DATA_STATUS: + ret = mon->status; + break; + case MON_DATA_LEVEL: + ret = mon->level; + break; + case MON_DATA_HP: + ret = mon->hp; + break; + case MON_DATA_MAX_HP: + ret = mon->maxHP; + break; + case MON_DATA_ATK: + ret = GetDeoxysStat(mon, STAT_ATK); + if (!ret) + ret = mon->attack; + break; + case MON_DATA_DEF: + ret = GetDeoxysStat(mon, STAT_DEF); + if (!ret) + ret = mon->defense; + break; + case MON_DATA_SPD: + ret = GetDeoxysStat(mon, STAT_SPD); + if (!ret) + ret = mon->speed; + break; + case MON_DATA_SPATK: + ret = GetDeoxysStat(mon, STAT_SPATK); + if (!ret) + ret = mon->spAttack; + break; + case MON_DATA_SPDEF: + ret = GetDeoxysStat(mon, STAT_SPDEF); + if (!ret) + ret = mon->spDefense; + break; + case MON_DATA_ATK2: + ret = mon->attack; + break; + case MON_DATA_DEF2: + ret = mon->defense; + break; + case MON_DATA_SPD2: + ret = mon->speed; + break; + case MON_DATA_SPATK2: + ret = mon->spAttack; + break; + case MON_DATA_SPDEF2: + ret = mon->spDefense; + break; + case MON_DATA_MAIL: + ret = mon->mail; + break; + default: + ret = GetBoxMonData(&mon->box, field, data); + break; + } + return ret; +} + +u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data) +{ + s32 i; + u32 retVal = 0; + struct PokemonSubstruct0 *substruct0 = NULL; + struct PokemonSubstruct1 *substruct1 = NULL; + struct PokemonSubstruct2 *substruct2 = NULL; + struct PokemonSubstruct3 *substruct3 = NULL; + + if (field > MON_DATA_10) + { + substruct0 = &(GetSubstruct(boxMon, boxMon->personality, 0)->type0); + substruct1 = &(GetSubstruct(boxMon, boxMon->personality, 1)->type1); + substruct2 = &(GetSubstruct(boxMon, boxMon->personality, 2)->type2); + substruct3 = &(GetSubstruct(boxMon, boxMon->personality, 3)->type3); + + DecryptBoxMon(boxMon); + + if (CalculateBoxMonChecksum(boxMon) != boxMon->checksum) + { + boxMon->isBadEgg = 1; + boxMon->isEgg = 1; + substruct3->isEgg = 1; + } + } + + switch (field) + { + case MON_DATA_PERSONALITY: + retVal = boxMon->personality; + break; + case MON_DATA_OT_ID: + retVal = boxMon->otId; + break; + case MON_DATA_NICKNAME: + { + if (boxMon->isBadEgg) + { + for (retVal = 0; + retVal < POKEMON_NAME_LENGTH && gBadEggNickname[retVal] != EOS; + data[retVal] = gBadEggNickname[retVal], retVal++) {} + + data[retVal] = EOS; + } + else if (boxMon->isEgg) + { + StringCopy(data, gEggNickname); + retVal = StringLength(data); + } + else if (boxMon->language == LANGUAGE_JAPANESE) + { + data[0] = EXT_CTRL_CODE_BEGIN; + data[1] = EXT_CTRL_CODE_JPN; + + for (retVal = 2, i = 0; + i < 5 && boxMon->nickname[i] != EOS; + data[retVal] = boxMon->nickname[i], retVal++, i++) {} + + data[retVal++] = EXT_CTRL_CODE_BEGIN; + data[retVal++] = EXT_CTRL_CODE_ENG; + data[retVal] = EOS; + } + else + { + for (retVal = 0; + retVal < POKEMON_NAME_LENGTH; + data[retVal] = boxMon->nickname[retVal], retVal++){} + + data[retVal] = EOS; + } + break; + } + case MON_DATA_LANGUAGE: + retVal = boxMon->language; + break; + case MON_DATA_SANITY_BIT1: + retVal = boxMon->isBadEgg; + break; + case MON_DATA_SANITY_BIT2: + retVal = boxMon->hasSpecies; + break; + case MON_DATA_SANITY_BIT3: + retVal = boxMon->isEgg; + break; + case MON_DATA_OT_NAME: + { + retVal = 0; + + while (retVal < OT_NAME_LENGTH) + { + data[retVal] = boxMon->otName[retVal]; + retVal++; + } + + data[retVal] = EOS; + break; + } + case MON_DATA_MARKINGS: + retVal = boxMon->markings; + break; + case MON_DATA_CHECKSUM: + retVal = boxMon->checksum; + break; + case MON_DATA_10: + retVal = boxMon->unknown; + break; + case MON_DATA_SPECIES: + retVal = boxMon->isBadEgg ? SPECIES_EGG : substruct0->species; + break; + case MON_DATA_HELD_ITEM: + retVal = substruct0->heldItem; + break; + case MON_DATA_EXP: + retVal = substruct0->experience; + break; + case MON_DATA_PP_BONUSES: + retVal = substruct0->ppBonuses; + break; + case MON_DATA_FRIENDSHIP: + retVal = substruct0->friendship; + break; + case MON_DATA_MOVE1: + case MON_DATA_MOVE2: + case MON_DATA_MOVE3: + case MON_DATA_MOVE4: + retVal = substruct1->moves[field - MON_DATA_MOVE1]; + break; + case MON_DATA_PP1: + case MON_DATA_PP2: + case MON_DATA_PP3: + case MON_DATA_PP4: + retVal = substruct1->pp[field - MON_DATA_PP1]; + break; + case MON_DATA_HP_EV: + retVal = substruct2->hpEV; + break; + case MON_DATA_ATK_EV: + retVal = substruct2->attackEV; + break; + case MON_DATA_DEF_EV: + retVal = substruct2->defenseEV; + break; + case MON_DATA_SPD_EV: + retVal = substruct2->speedEV; + break; + case MON_DATA_SPATK_EV: + retVal = substruct2->spAttackEV; + break; + case MON_DATA_SPDEF_EV: + retVal = substruct2->spDefenseEV; + break; + case MON_DATA_COOL: + retVal = substruct2->cool; + break; + case MON_DATA_BEAUTY: + retVal = substruct2->beauty; + break; + case MON_DATA_CUTE: + retVal = substruct2->cute; + break; + case MON_DATA_SMART: + retVal = substruct2->smart; + break; + case MON_DATA_TOUGH: + retVal = substruct2->tough; + break; + case MON_DATA_SHEEN: + retVal = substruct2->sheen; + break; + case MON_DATA_POKERUS: + retVal = substruct3->pokerus; + break; + case MON_DATA_MET_LOCATION: + retVal = substruct3->metLocation; + break; + case MON_DATA_MET_LEVEL: + retVal = substruct3->metLevel; + break; + case MON_DATA_MET_GAME: + retVal = substruct3->metGame; + break; + case MON_DATA_POKEBALL: + retVal = substruct3->pokeball; + break; + case MON_DATA_OT_GENDER: + retVal = substruct3->otGender; + break; + case MON_DATA_HP_IV: + retVal = substruct3->hpIV; + break; + case MON_DATA_ATK_IV: + retVal = substruct3->attackIV; + break; + case MON_DATA_DEF_IV: + retVal = substruct3->defenseIV; + break; + case MON_DATA_SPD_IV: + retVal = substruct3->speedIV; + break; + case MON_DATA_SPATK_IV: + retVal = substruct3->spAttackIV; + break; + case MON_DATA_SPDEF_IV: + retVal = substruct3->spDefenseIV; + break; + case MON_DATA_IS_EGG: + retVal = substruct3->isEgg; + break; + case MON_DATA_ALT_ABILITY: + retVal = substruct3->altAbility; + break; + case MON_DATA_COOL_RIBBON: + retVal = substruct3->coolRibbon; + break; + case MON_DATA_BEAUTY_RIBBON: + retVal = substruct3->beautyRibbon; + break; + case MON_DATA_CUTE_RIBBON: + retVal = substruct3->cuteRibbon; + break; + case MON_DATA_SMART_RIBBON: + retVal = substruct3->smartRibbon; + break; + case MON_DATA_TOUGH_RIBBON: + retVal = substruct3->toughRibbon; + break; + case MON_DATA_CHAMPION_RIBBON: + retVal = substruct3->championRibbon; + break; + case MON_DATA_WINNING_RIBBON: + retVal = substruct3->winningRibbon; + break; + case MON_DATA_VICTORY_RIBBON: + retVal = substruct3->victoryRibbon; + break; + case MON_DATA_ARTIST_RIBBON: + retVal = substruct3->artistRibbon; + break; + case MON_DATA_EFFORT_RIBBON: + retVal = substruct3->effortRibbon; + break; + case MON_DATA_GIFT_RIBBON_1: + retVal = substruct3->giftRibbon1; + break; + case MON_DATA_GIFT_RIBBON_2: + retVal = substruct3->giftRibbon2; + break; + case MON_DATA_GIFT_RIBBON_3: + retVal = substruct3->giftRibbon3; + break; + case MON_DATA_GIFT_RIBBON_4: + retVal = substruct3->giftRibbon4; + break; + case MON_DATA_GIFT_RIBBON_5: + retVal = substruct3->giftRibbon5; + break; + case MON_DATA_GIFT_RIBBON_6: + retVal = substruct3->giftRibbon6; + break; + case MON_DATA_GIFT_RIBBON_7: + retVal = substruct3->giftRibbon7; + break; + case MON_DATA_FATEFUL_ENCOUNTER: + retVal = substruct3->fatefulEncounter; + break; + case MON_DATA_OBEDIENCE: + retVal = substruct3->obedient; + break; + case MON_DATA_SPECIES2: + retVal = substruct0->species; + if (substruct0->species && (substruct3->isEgg || boxMon->isBadEgg)) + retVal = SPECIES_EGG; + break; + case MON_DATA_IVS: + retVal = substruct3->hpIV | (substruct3->attackIV << 5) | (substruct3->defenseIV << 10) | (substruct3->speedIV << 15) | (substruct3->spAttackIV << 20) | (substruct3->spDefenseIV << 25); + break; + case MON_DATA_KNOWN_MOVES: + if (substruct0->species && !substruct3->isEgg) + { + u16 *moves = (u16 *)data; + s32 i = 0; + + while (moves[i] != 355) + { + u16 move = moves[i]; + if (substruct1->moves[0] == move + || substruct1->moves[1] == move + || substruct1->moves[2] == move + || substruct1->moves[3] == move) + retVal |= gBitTable[i]; + i++; + } + } + break; + case MON_DATA_RIBBON_COUNT: + retVal = 0; + if (substruct0->species && !substruct3->isEgg) + { + retVal += substruct3->coolRibbon; + retVal += substruct3->beautyRibbon; + retVal += substruct3->cuteRibbon; + retVal += substruct3->smartRibbon; + retVal += substruct3->toughRibbon; + retVal += substruct3->championRibbon; + retVal += substruct3->winningRibbon; + retVal += substruct3->victoryRibbon; + retVal += substruct3->artistRibbon; + retVal += substruct3->effortRibbon; + retVal += substruct3->giftRibbon1; + retVal += substruct3->giftRibbon2; + retVal += substruct3->giftRibbon3; + retVal += substruct3->giftRibbon4; + retVal += substruct3->giftRibbon5; + retVal += substruct3->giftRibbon6; + retVal += substruct3->giftRibbon7; + } + break; + case MON_DATA_RIBBONS: + retVal = 0; + if (substruct0->species && !substruct3->isEgg) + { + retVal = substruct3->championRibbon + | (substruct3->coolRibbon << 1) + | (substruct3->beautyRibbon << 4) + | (substruct3->cuteRibbon << 7) + | (substruct3->smartRibbon << 10) + | (substruct3->toughRibbon << 13) + | (substruct3->winningRibbon << 16) + | (substruct3->victoryRibbon << 17) + | (substruct3->artistRibbon << 18) + | (substruct3->effortRibbon << 19) + | (substruct3->giftRibbon1 << 20) + | (substruct3->giftRibbon2 << 21) + | (substruct3->giftRibbon3 << 22) + | (substruct3->giftRibbon4 << 23) + | (substruct3->giftRibbon5 << 24) + | (substruct3->giftRibbon6 << 25) + | (substruct3->giftRibbon7 << 26); + } + break; + default: + break; + } + + if (field > MON_DATA_10) + EncryptBoxMon(boxMon); + + return retVal; +} + +#define SET8(lhs) (lhs) = *data +#define SET16(lhs) (lhs) = data[0] + (data[1] << 8) +#define SET32(lhs) (lhs) = data[0] + (data[1] << 8) + (data[2] << 16) + (data[3] << 24) + +void SetMonData(struct Pokemon *mon, s32 field, const void *dataArg) +{ + const u8* data = dataArg; + switch (field) + { + case MON_DATA_STATUS: + SET32(mon->status); + break; + case MON_DATA_LEVEL: + SET8(mon->level); + break; + case MON_DATA_HP: + SET16(mon->hp); + break; + case MON_DATA_MAX_HP: + SET16(mon->maxHP); + break; + case MON_DATA_ATK: + SET16(mon->attack); + break; + case MON_DATA_DEF: + SET16(mon->defense); + break; + case MON_DATA_SPD: + SET16(mon->speed); + break; + case MON_DATA_SPATK: + SET16(mon->spAttack); + break; + case MON_DATA_SPDEF: + SET16(mon->spDefense); + break; + case MON_DATA_MAIL: + SET8(mon->mail); + break; + case MON_DATA_SPECIES2: + break; + default: + SetBoxMonData(&mon->box, field, data); + break; + } +} + +void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg) +{ + const u8* data = dataArg; + + struct PokemonSubstruct0 *substruct0 = NULL; + struct PokemonSubstruct1 *substruct1 = NULL; + struct PokemonSubstruct2 *substruct2 = NULL; + struct PokemonSubstruct3 *substruct3 = NULL; + + if (field > MON_DATA_10) + { + substruct0 = &(GetSubstruct(boxMon, boxMon->personality, 0)->type0); + substruct1 = &(GetSubstruct(boxMon, boxMon->personality, 1)->type1); + substruct2 = &(GetSubstruct(boxMon, boxMon->personality, 2)->type2); + substruct3 = &(GetSubstruct(boxMon, boxMon->personality, 3)->type3); + + DecryptBoxMon(boxMon); + + if (CalculateBoxMonChecksum(boxMon) != boxMon->checksum) + { + boxMon->isBadEgg = 1; + boxMon->isEgg = 1; + substruct3->isEgg = 1; + EncryptBoxMon(boxMon); + return; + } + } + + switch (field) + { + case MON_DATA_PERSONALITY: + SET32(boxMon->personality); + break; + case MON_DATA_OT_ID: + SET32(boxMon->otId); + break; + case MON_DATA_NICKNAME: + { + s32 i; + for (i = 0; i < POKEMON_NAME_LENGTH; i++) + boxMon->nickname[i] = data[i]; + break; + } + case MON_DATA_LANGUAGE: + SET8(boxMon->language); + break; + case MON_DATA_SANITY_BIT1: + SET8(boxMon->isBadEgg); + break; + case MON_DATA_SANITY_BIT2: + SET8(boxMon->hasSpecies); + break; + case MON_DATA_SANITY_BIT3: + SET8(boxMon->isEgg); + break; + case MON_DATA_OT_NAME: + { + s32 i; + for (i = 0; i < OT_NAME_LENGTH; i++) + boxMon->otName[i] = data[i]; + break; + } + case MON_DATA_MARKINGS: + SET8(boxMon->markings); + break; + case MON_DATA_CHECKSUM: + SET16(boxMon->checksum); + break; + case MON_DATA_10: + SET16(boxMon->unknown); + break; + case MON_DATA_SPECIES: + { + SET16(substruct0->species); + if (substruct0->species) + boxMon->hasSpecies = 1; + else + boxMon->hasSpecies = 0; + break; + } + case MON_DATA_HELD_ITEM: + SET16(substruct0->heldItem); + break; + case MON_DATA_EXP: + SET32(substruct0->experience); + break; + case MON_DATA_PP_BONUSES: + SET8(substruct0->ppBonuses); + break; + case MON_DATA_FRIENDSHIP: + SET8(substruct0->friendship); + break; + case MON_DATA_MOVE1: + case MON_DATA_MOVE2: + case MON_DATA_MOVE3: + case MON_DATA_MOVE4: + SET16(substruct1->moves[field - MON_DATA_MOVE1]); + break; + case MON_DATA_PP1: + case MON_DATA_PP2: + case MON_DATA_PP3: + case MON_DATA_PP4: + SET8(substruct1->pp[field - MON_DATA_PP1]); + break; + case MON_DATA_HP_EV: + SET8(substruct2->hpEV); + break; + case MON_DATA_ATK_EV: + SET8(substruct2->attackEV); + break; + case MON_DATA_DEF_EV: + SET8(substruct2->defenseEV); + break; + case MON_DATA_SPD_EV: + SET8(substruct2->speedEV); + break; + case MON_DATA_SPATK_EV: + SET8(substruct2->spAttackEV); + break; + case MON_DATA_SPDEF_EV: + SET8(substruct2->spDefenseEV); + break; + case MON_DATA_COOL: + SET8(substruct2->cool); + break; + case MON_DATA_BEAUTY: + SET8(substruct2->beauty); + break; + case MON_DATA_CUTE: + SET8(substruct2->cute); + break; + case MON_DATA_SMART: + SET8(substruct2->smart); + break; + case MON_DATA_TOUGH: + SET8(substruct2->tough); + break; + case MON_DATA_SHEEN: + SET8(substruct2->sheen); + break; + case MON_DATA_POKERUS: + SET8(substruct3->pokerus); + break; + case MON_DATA_MET_LOCATION: + SET8(substruct3->metLocation); + break; + case MON_DATA_MET_LEVEL: + { + u8 metLevel = *data; + substruct3->metLevel = metLevel; + break; + } + case MON_DATA_MET_GAME: + SET8(substruct3->metGame); + break; + case MON_DATA_POKEBALL: + { + u8 pokeball = *data; + substruct3->pokeball = pokeball; + break; + } + case MON_DATA_OT_GENDER: + SET8(substruct3->otGender); + break; + case MON_DATA_HP_IV: + SET8(substruct3->hpIV); + break; + case MON_DATA_ATK_IV: + SET8(substruct3->attackIV); + break; + case MON_DATA_DEF_IV: + SET8(substruct3->defenseIV); + break; + case MON_DATA_SPD_IV: + SET8(substruct3->speedIV); + break; + case MON_DATA_SPATK_IV: + SET8(substruct3->spAttackIV); + break; + case MON_DATA_SPDEF_IV: + SET8(substruct3->spDefenseIV); + break; + case MON_DATA_IS_EGG: + SET8(substruct3->isEgg); + if (substruct3->isEgg) + boxMon->isEgg = 1; + else + boxMon->isEgg = 0; + break; + case MON_DATA_ALT_ABILITY: + SET8(substruct3->altAbility); + break; + case MON_DATA_COOL_RIBBON: + SET8(substruct3->coolRibbon); + break; + case MON_DATA_BEAUTY_RIBBON: + SET8(substruct3->beautyRibbon); + break; + case MON_DATA_CUTE_RIBBON: + SET8(substruct3->cuteRibbon); + break; + case MON_DATA_SMART_RIBBON: + SET8(substruct3->smartRibbon); + break; + case MON_DATA_TOUGH_RIBBON: + SET8(substruct3->toughRibbon); + break; + case MON_DATA_CHAMPION_RIBBON: + SET8(substruct3->championRibbon); + break; + case MON_DATA_WINNING_RIBBON: + SET8(substruct3->winningRibbon); + break; + case MON_DATA_VICTORY_RIBBON: + SET8(substruct3->victoryRibbon); + break; + case MON_DATA_ARTIST_RIBBON: + SET8(substruct3->artistRibbon); + break; + case MON_DATA_EFFORT_RIBBON: + SET8(substruct3->effortRibbon); + break; + case MON_DATA_GIFT_RIBBON_1: + SET8(substruct3->giftRibbon1); + break; + case MON_DATA_GIFT_RIBBON_2: + SET8(substruct3->giftRibbon2); + break; + case MON_DATA_GIFT_RIBBON_3: + SET8(substruct3->giftRibbon3); + break; + case MON_DATA_GIFT_RIBBON_4: + SET8(substruct3->giftRibbon4); + break; + case MON_DATA_GIFT_RIBBON_5: + SET8(substruct3->giftRibbon5); + break; + case MON_DATA_GIFT_RIBBON_6: + SET8(substruct3->giftRibbon6); + break; + case MON_DATA_GIFT_RIBBON_7: + SET8(substruct3->giftRibbon7); + break; + case MON_DATA_FATEFUL_ENCOUNTER: + SET8(substruct3->fatefulEncounter); + break; + case MON_DATA_OBEDIENCE: + SET8(substruct3->obedient); + break; + case MON_DATA_IVS: + { + u32 ivs = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); + substruct3->hpIV = ivs & 0x1F; + substruct3->attackIV = (ivs >> 5) & 0x1F; + substruct3->defenseIV = (ivs >> 10) & 0x1F; + substruct3->speedIV = (ivs >> 15) & 0x1F; + substruct3->spAttackIV = (ivs >> 20) & 0x1F; + substruct3->spDefenseIV = (ivs >> 25) & 0x1F; + break; + } + default: + break; + } + + if (field > MON_DATA_10) + { + boxMon->checksum = CalculateBoxMonChecksum(boxMon); + EncryptBoxMon(boxMon); + } +} + +void CopyMon(void *dest, void *src, size_t size) +{ + memcpy(dest, src, size); +} + +u8 GiveMonToPlayer(struct Pokemon *mon) +{ + s32 i; + + SetMonData(mon, MON_DATA_OT_NAME, gSaveBlock2Ptr->playerName); + SetMonData(mon, MON_DATA_OT_GENDER, &gSaveBlock2Ptr->playerGender); + SetMonData(mon, MON_DATA_OT_ID, gSaveBlock2Ptr->playerTrainerId); + + i = 0; + + while (i < 6 && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) != SPECIES_NONE) + i++; + + if (i >= 6) + return SendMonToPC(mon); + + CopyMon(&gPlayerParty[i], mon, sizeof(*mon)); + gPlayerPartyCount = i + 1; + return MON_GIVEN_TO_PARTY; +} + +extern u16 get_unknown_box_id(void); +extern u8 StorageGetCurrentBox(void); +extern void set_unknown_box_id(u8); +extern struct BoxPokemon* GetBoxedMonPtr(u8 boxNumber, u8 boxPosition); + +u8 SendMonToPC(struct Pokemon* mon) +{ + s32 boxNo, boxPos; + + set_unknown_box_id(VarGet(VAR_STORAGE_UNKNOWN)); + + boxNo = StorageGetCurrentBox(); + + do + { + for (boxPos = 0; boxPos < 30; boxPos++) + { + struct BoxPokemon* checkingMon = GetBoxedMonPtr(boxNo, boxPos); + if (GetBoxMonData(checkingMon, MON_DATA_SPECIES, NULL) == SPECIES_NONE) + { + MonRestorePP(mon); + CopyMon(checkingMon, &mon->box, sizeof(mon->box)); + gSpecialVar_0x8012 = boxNo; + gSpecialVar_0x8013 = boxPos; + if (get_unknown_box_id() != boxNo) + FlagReset(SYS_STORAGE_UNKNOWN_FLAG); + VarSet(VAR_STORAGE_UNKNOWN, boxNo); + return MON_GIVEN_TO_PC; + } + } + + boxNo++; + if (boxNo == 14) + boxNo = 0; + } while (boxNo != StorageGetCurrentBox()); + + return MON_CANT_GIVE; +} + +u8 CalculatePlayerPartyCount(void) +{ + gPlayerPartyCount = 0; + + while (gPlayerPartyCount < 6 + && GetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_SPECIES, NULL) != SPECIES_NONE) + { + gPlayerPartyCount++; + } + + return gPlayerPartyCount; +} + +u8 CalculateEnemyPartyCount(void) +{ + gEnemyPartyCount = 0; + + while (gEnemyPartyCount < 6 + && GetMonData(&gEnemyParty[gEnemyPartyCount], MON_DATA_SPECIES, NULL) != SPECIES_NONE) + { + gEnemyPartyCount++; + } + + return gEnemyPartyCount; +} + +u8 GetMonsStateToDoubles(void) +{ + s32 aliveCount = 0; + s32 i; + CalculatePlayerPartyCount(); + + if (gPlayerPartyCount == 1) + return gPlayerPartyCount; // PLAYER_HAS_ONE_MON + + for (i = 0; i < gPlayerPartyCount; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != SPECIES_EGG + && GetMonData(&gPlayerParty[i], MON_DATA_HP, NULL) != 0 + && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != SPECIES_NONE) + aliveCount++; + } + + return (aliveCount > 1) ? PLAYER_HAS_TWO_USABLE_MONS : PLAYER_HAS_ONE_USABLE_MON; +} + +u8 GetMonsStateToDoubles_2(void) +{ + s32 aliveCount = 0; + s32 i; + + for (i = 0; i < 6; i++) + { + u32 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL); + if (species != SPECIES_EGG && species != SPECIES_NONE + && GetMonData(&gPlayerParty[i], MON_DATA_HP, NULL) != 0) + aliveCount++; + } + + if (aliveCount == 1) + return PLAYER_HAS_ONE_MON; // may have more than one, but only one is alive + + return (aliveCount > 1) ? PLAYER_HAS_TWO_USABLE_MONS : PLAYER_HAS_ONE_USABLE_MON; +} + +u8 GetAbilityBySpecies(u16 species, bool8 altAbility) +{ + if (altAbility) + gLastUsedAbility = gBaseStats[species].ability2; + else + gLastUsedAbility = gBaseStats[species].ability1; + + return gLastUsedAbility; +} + +u8 GetMonAbility(struct Pokemon *mon) +{ + u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL); + u8 altAbility = GetMonData(mon, MON_DATA_ALT_ABILITY, NULL); + return GetAbilityBySpecies(species, altAbility); +} + +extern const struct BattleMove gBattleMoves[]; + +void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord) +{ + s32 i, j; + + ZeroEnemyPartyMons(); + *gBattleResources->secretBase = *secretBaseRecord; + + for (i = 0; i < PARTY_SIZE; i++) + { + if (gBattleResources->secretBase->partySpecies[i]) + { + CreateMon(&gEnemyParty[i], + gBattleResources->secretBase->partySpecies[i], + gBattleResources->secretBase->partyLevels[i], + 15, + 1, + gBattleResources->secretBase->partyPersonality[i], + 2, + 0); + + SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBattleResources->secretBase->partyHeldItems[i]); + + for (j = 0; j < 6; j++) + SetMonData(&gEnemyParty[i], MON_DATA_HP_EV + j, &gBattleResources->secretBase->partyEVs[i]); + + for (j = 0; j < 4; j++) + { + SetMonData(&gEnemyParty[i], MON_DATA_MOVE1 + j, &gBattleResources->secretBase->partyMoves[i * 4 + j]); + SetMonData(&gEnemyParty[i], MON_DATA_PP1 + j, &gBattleMoves[gBattleResources->secretBase->partyMoves[i * 4 + j]].pp); + } + } + } +} + +extern const u8 gUnknown_0831F578[]; +extern const u8 gTrainerClassToNameIndex[]; +extern const u8 gSecretBaseTrainerClasses[][5]; + +u8 GetSecretBaseTrainerPicIndex(void) +{ + u8 trainerClass = gSecretBaseTrainerClasses[gBattleResources->secretBase->gender][gBattleResources->secretBase->trainerId[0] % 5]; + return gUnknown_0831F578[trainerClass]; +} + +u8 GetSecretBaseTrainerNameIndex(void) +{ + u8 trainerClass = gSecretBaseTrainerClasses[gBattleResources->secretBase->gender][gBattleResources->secretBase->trainerId[0] % 5]; + return gTrainerClassToNameIndex[trainerClass]; +} + +bool8 IsPlayerPartyAndPokemonStorageFull(void) +{ + s32 i; + + for (i = 0; i < 6; i++) + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) == SPECIES_NONE) + return FALSE; + + return IsPokemonStorageFull(); +} + +extern u32 GetBoxMonDataFromAnyBox(u8 boxNo, u8 boxPos, s32 field); + +bool8 IsPokemonStorageFull(void) +{ + s32 i, j; + + for (i = 0; i < 14; i++) + for (j = 0; j < 30; j++) + if (GetBoxMonDataFromAnyBox(i, j, MON_DATA_SPECIES) == SPECIES_NONE) + return FALSE; + + return TRUE; +} + +extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1]; + +void GetSpeciesName(u8 *name, u16 species) +{ + s32 i; + + for (i = 0; i <= POKEMON_NAME_LENGTH; i++) + { + if (species > NUM_SPECIES) + name[i] = gSpeciesNames[0][i]; + else + name[i] = gSpeciesNames[species][i]; + + if (name[i] == EOS) + break; + } + + name[i] = EOS; +} + +extern const u8 gUnknown_08329D22[]; +extern const u8 gUnknown_08329D26[]; + +u8 CalculatePPWithBonus(u16 move, u8 ppBonuses, u8 moveIndex) +{ + u8 basePP = gBattleMoves[move].pp; + return basePP + ((basePP * 20 * ((gUnknown_08329D22[moveIndex] & ppBonuses) >> (2 * moveIndex))) / 100); +} + +void RemoveMonPPBonus(struct Pokemon *mon, u8 moveIndex) +{ + u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES, NULL); + ppBonuses &= gUnknown_08329D26[moveIndex]; + SetMonData(mon, MON_DATA_PP_BONUSES, &ppBonuses); +} + +void RemoveBattleMonPPBonus(struct BattlePokemon *mon, u8 moveIndex) +{ + mon->ppBonuses &= gUnknown_08329D26[moveIndex]; +} + +void sub_803FA70(u8 bank); +void sub_805EF84(u8 bank, bool8); + +extern struct BattlePokemon gBattleMons[4]; + +/* + +void CopyPlayerPartyMonToBattleData(u8 bank, u8 partyIndex) +{ + s32 i; + u8 nickname[POKEMON_NAME_LENGTH * 2]; + + gBattleMons[bank].species = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPECIES, NULL); + gBattleMons[bank].item = GetMonData(&gPlayerParty[partyIndex], MON_DATA_HELD_ITEM, NULL); + + for (i = 0; i < 4; i++) + { + gBattleMons[bank].moves[i] = GetMonData(&gPlayerParty[partyIndex], MON_DATA_MOVE1 + i, NULL); + gBattleMons[bank].pp[i] = GetMonData(&gPlayerParty[partyIndex], MON_DATA_PP1 + i, NULL); + } + + gBattleMons[bank].ppBonuses = GetMonData(&gPlayerParty[partyIndex], MON_DATA_PP_BONUSES, NULL); + gBattleMons[bank].friendship = GetMonData(&gPlayerParty[partyIndex], MON_DATA_FRIENDSHIP, NULL); + gBattleMons[bank].experience = GetMonData(&gPlayerParty[partyIndex], MON_DATA_EXP, NULL); + gBattleMons[bank].hpIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_HP_IV, NULL); + gBattleMons[bank].attackIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_ATK_IV, NULL); + gBattleMons[bank].defenseIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_DEF_IV, NULL); + gBattleMons[bank].speedIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPD_IV, NULL); + gBattleMons[bank].spAttackIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPATK_IV, NULL); + gBattleMons[bank].spDefenseIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPDEF_IV, NULL); + gBattleMons[bank].personality = GetMonData(&gPlayerParty[partyIndex], MON_DATA_PERSONALITY, NULL); + gBattleMons[bank].status1 = GetMonData(&gPlayerParty[partyIndex], MON_DATA_STATUS, NULL); + gBattleMons[bank].level = GetMonData(&gPlayerParty[partyIndex], MON_DATA_LEVEL, NULL); + gBattleMons[bank].hp = GetMonData(&gPlayerParty[partyIndex], MON_DATA_HP, NULL); + gBattleMons[bank].maxHP = GetMonData(&gPlayerParty[partyIndex], MON_DATA_MAX_HP, NULL); + gBattleMons[bank].attack = GetMonData(&gPlayerParty[partyIndex], MON_DATA_ATK, NULL); + gBattleMons[bank].defense = GetMonData(&gPlayerParty[partyIndex], MON_DATA_DEF, NULL); + gBattleMons[bank].speed = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPD, NULL); + gBattleMons[bank].spAttack = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPATK, NULL); + gBattleMons[bank].spDefense = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPDEF, NULL); + gBattleMons[bank].isEgg = GetMonData(&gPlayerParty[partyIndex], MON_DATA_IS_EGG, NULL); + gBattleMons[bank].altAbility = GetMonData(&gPlayerParty[partyIndex], MON_DATA_ALT_ABILITY, NULL); + gBattleMons[bank].otId = GetMonData(&gPlayerParty[partyIndex], MON_DATA_OT_ID, NULL); + gBattleMons[bank].type1 = gBaseStats[gBattleMons[bank].species].type1; + gBattleMons[bank].type2 = gBaseStats[gBattleMons[bank].species].type2; + gBattleMons[bank].ability = GetAbilityBySpecies(gBattleMons[bank].species, gBattleMons[bank].altAbility); + GetMonData(&gPlayerParty[partyIndex], MON_DATA_NICKNAME, nickname); + StringCopy10(gBattleMons[bank].nickname, nickname); + GetMonData(&gPlayerParty[partyIndex], MON_DATA_OT_NAME, gBattleMons[bank].otName); + // ewram memes from Ruby return + #ifdef NONMATCHING + gBattleStruct->hpOnSwitchout[GetBankSide(bank)] = gBattleMons[bank].hp; + #else + { + u32 side = GetBankSide(bank); + *(u16*)((void*)(gBattleStruct) + side) = gBattleMons[bank].hp; + } + #endif // NONMATCHING + + for (i = 0; i < 8; i++) + gBattleMons[bank].statStages[i] = 6; + + gBattleMons[bank].status2 = 0; + sub_803FA70(bank); + sub_805EF84(bank, FALSE); +} +*/ diff --git a/src/pokemon_3.c b/src/pokemon_3.c new file mode 100644 index 000000000..2d1dfb8b7 --- /dev/null +++ b/src/pokemon_3.c @@ -0,0 +1,1753 @@ +#include "global.h" +#include "pokemon.h" +#include "main.h" +#include "items.h" +#include "string_util.h" +#include "battle_message.h" +#include "rtc.h" +#include "item.h" +#include "battle.h" +#include "species.h" +#include "link.h" +#include "hold_effects.h" +#include "rng.h" +#include "trainer_classes.h" +#include "trainer_ids.h" +#include "songs.h" +#include "sound.h" +#include "m4a.h" +#include "task.h" +#include "sprite.h" +#include "text.h" +#include "abilities.h" +#include "pokemon_animation.h" +#include "pokedex.h" + +extern struct BattlePokemon gBattleMons[4]; +extern struct BattleEnigmaBerry gEnigmaBerries[4]; +extern u8 gActiveBank; +extern u8 gBankInMenu; +extern u8 gBankTarget; +extern u8 gBankAttacker; +extern u8 gStringBank; +extern u16 gTrainerBattleOpponent_A; +extern u32 gBattleTypeFlags; +extern u8 gBattleMonForms[4]; +extern u16 gBattlePartyID[4]; +extern u8 gLastUsedAbility; +extern u16 gPartnerTrainerId; +extern u32 gHitMarker; + +extern const u16 gSpeciesToHoennPokedexNum[]; +extern const u16 gSpeciesToNationalPokedexNum[]; +extern const u16 gHoennToNationalOrder[]; +extern const u16 gSpeciesIdToCryId[]; +extern const struct SpindaSpot gSpindaSpotGraphics[]; +extern const u8* const gStatNamesTable[]; +extern const u8 gSpeciesNames[][11]; +extern const u8 gUnknown_08329EC8[]; +extern const u8 gUnknown_085CB38A[]; +extern const u8 gUnknown_085CB3AA[]; +extern const u8 gUnknown_085CA459[]; +extern const u8 gUnknown_085CA424[]; +extern const s8 gNatureStatTable[][5]; +extern const s8 gUnknown_08329ECE[][3]; +extern const u32 gBitTable[]; +extern const u32 gTMHMLearnsets[][2]; +extern const u8 BattleText_Wally[]; +extern const u8 BattleText_PreventedSwitch[]; +extern const struct CompressedSpritePalette gMonPaletteTable[]; +extern const struct CompressedSpritePalette gMonShinyPaletteTable[]; +extern const u16 gHMMoves[]; +extern const s8 gPokeblockFlavorCompatibilityTable[]; +extern const u8 gMonAnimationDelayTable[]; +extern const u8 gMonFrontAnimIdsTable[]; + +extern bool8 InBattlePyramid(void); +extern bool8 InBattlePike(void); +extern bool8 sub_81D5C18(void); +extern bool8 sub_806F104(void); +extern bool32 IsNationalPokedexEnabled(void); +extern u8 GetTrainerEncounterMusicIdInBattlePyramind(u16 trainerOpponentId); +extern u8 sub_81D63C8(u16 trainerOpponentId); +extern u8 sav1_map_get_name(void); +extern u8 GetFrontierOpponentClass(u16 trainerId); +extern u8 pokemon_order_func(u8 bankPartyId); +extern void GetFrontierTrainerName(u8* dest, u16 trainerId); +extern void sub_81C488C(u8); +extern void sub_817F578(struct Sprite*, u8 frontAnimId); +extern u8 GetSpeciesBackAnimId(u16 species); + +static void sub_806E6CC(u8 taskId); + +bool8 HealStatusConditions(struct Pokemon *mon, u32 battlePartyId, u32 healMask, u8 battleBank) +{ + u32 status = GetMonData(mon, MON_DATA_STATUS, 0); + + if (status & healMask) + { + status &= ~healMask; + SetMonData(mon, MON_DATA_STATUS, (u8 *)&status); + if (gMain.inBattle && battleBank != 4) + gBattleMons[battleBank].status1 &= ~healMask; + return FALSE; + } + else + { + return TRUE; + } +} + +u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit) +{ + const u8 *temp; + const u8 *itemEffect; + u8 offset; + int i; + u8 j; + u8 val; + + offset = 6; + + temp = gItemEffectTable[itemId - 13]; + + if (!temp && itemId != ITEM_ENIGMA_BERRY) + return 0; + + if (itemId == ITEM_ENIGMA_BERRY) + { + temp = gEnigmaBerries[gActiveBank].itemEffect; + } + + itemEffect = temp; + + for (i = 0; i < 6; i++) + { + switch (i) + { + case 0: + case 1: + case 2: + case 3: + if (i == effectByte) + return 0; + break; + case 4: + val = itemEffect[4]; + if (val & 0x20) + val &= 0xDF; + j = 0; + while (val) + { + if (val & 1) + { + switch (j) + { + case 2: + if (val & 0x10) + val &= 0xEF; + case 0: + if (i == effectByte && (val & effectBit)) + return offset; + offset++; + break; + case 1: + if (i == effectByte && (val & effectBit)) + return offset; + offset++; + break; + case 3: + if (i == effectByte && (val & effectBit)) + return offset; + offset++; + break; + case 7: + if (i == effectByte) + return 0; + break; + } + } + j++; + val >>= 1; + if (i == effectByte) + effectBit >>= 1; + } + break; + case 5: + val = itemEffect[5]; + j = 0; + while (val) + { + if (val & 1) + { + switch (j) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + if (i == effectByte && (val & effectBit)) + return offset; + offset++; + break; + case 7: + if (i == effectByte) + return 0; + break; + } + } + j++; + val >>= 1; + if (i == effectByte) + effectBit >>= 1; + } + break; + } + } + + return offset; +} + +void sub_806CF24(s32 stat) +{ + gBankTarget = gBankInMenu; + StringCopy(gBattleTextBuff1, gStatNamesTable[gUnknown_08329EC8[stat]]); + StringCopy(gBattleTextBuff2, gUnknown_085CB38A); + StrCpyDecodeToDisplayedStringBattle(gUnknown_085CB3AA); +} + +u8 *sub_806CF78(u16 itemId) +{ + int i; + const u8 *itemEffect; + + if (itemId == ITEM_ENIGMA_BERRY) + { + if (gMain.inBattle) + itemEffect = gEnigmaBerries[gBankInMenu].itemEffect; + else + itemEffect = gSaveBlock1Ptr->enigmaBerry.itemEffect; + } + else + { + itemEffect = gItemEffectTable[itemId - 13]; + } + + gStringBank = gBankInMenu; + + for (i = 0; i < 3; i++) + { + if (itemEffect[i] & 0xF) + sub_806CF24(i * 2); + if (itemEffect[i] & 0xF0) + { + if (i) + { + sub_806CF24(i * 2 + 1); + } + else + { + gBankAttacker = gBankInMenu; + StrCpyDecodeToDisplayedStringBattle(gUnknown_085CA459); + } + } + } + + if (itemEffect[3] & 0x80) + { + gBankAttacker = gBankInMenu; + StrCpyDecodeToDisplayedStringBattle(gUnknown_085CA424); + } + + return gDisplayedStringBattle; +} + +u8 GetNature(struct Pokemon *mon) +{ + return GetMonData(mon, MON_DATA_PERSONALITY, 0) % 25; +} + +u8 GetNatureFromPersonality(u32 personality) +{ + return personality % 25; +} + +u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem) +{ + int i; + u16 targetSpecies = 0; + u16 species = GetMonData(mon, MON_DATA_SPECIES, 0); + u16 heldItem = GetMonData(mon, MON_DATA_HELD_ITEM, 0); + u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, 0); + u8 level; + u16 friendship; + u8 beauty = GetMonData(mon, MON_DATA_BEAUTY, 0); + u16 upperPersonality = personality >> 16; + u8 holdEffect; + + if (heldItem == ITEM_ENIGMA_BERRY) + holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; + else + holdEffect = ItemId_GetHoldEffect(heldItem); + + if (holdEffect == 38 && type != 3) + return 0; + + switch (type) + { + case 0: + level = GetMonData(mon, MON_DATA_LEVEL, 0); + friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, 0); + + for (i = 0; i < 5; i++) + { + switch (gEvolutionTable[species].evolutions[i].method) + { + case EVO_FRIENDSHIP: + if (friendship >= 220) + targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + break; + case EVO_FRIENDSHIP_DAY: + RtcCalcLocalTime(); + if (gLocalTime.hours >= 12 && gLocalTime.hours < 24 && friendship >= 220) + targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + break; + case EVO_FRIENDSHIP_NIGHT: + RtcCalcLocalTime(); + if (gLocalTime.hours >= 0 && gLocalTime.hours < 12 && friendship >= 220) + targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + break; + case EVO_LEVEL: + if (gEvolutionTable[species].evolutions[i].param <= level) + targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + break; + case EVO_LEVEL_ATK_GT_DEF: + if (gEvolutionTable[species].evolutions[i].param <= level) + if (GetMonData(mon, MON_DATA_ATK, 0) > GetMonData(mon, MON_DATA_DEF, 0)) + targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + break; + case EVO_LEVEL_ATK_EQ_DEF: + if (gEvolutionTable[species].evolutions[i].param <= level) + if (GetMonData(mon, MON_DATA_ATK, 0) == GetMonData(mon, MON_DATA_DEF, 0)) + targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + break; + case EVO_LEVEL_ATK_LT_DEF: + if (gEvolutionTable[species].evolutions[i].param <= level) + if (GetMonData(mon, MON_DATA_ATK, 0) < GetMonData(mon, MON_DATA_DEF, 0)) + targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + break; + case EVO_LEVEL_SILCOON: + if (gEvolutionTable[species].evolutions[i].param <= level && (upperPersonality % 10) <= 4) + targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + break; + case EVO_LEVEL_CASCOON: + if (gEvolutionTable[species].evolutions[i].param <= level && (upperPersonality % 10) > 4) + targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + break; + case EVO_LEVEL_NINJASK: + if (gEvolutionTable[species].evolutions[i].param <= level) + targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + break; + case EVO_BEAUTY: + if (gEvolutionTable[species].evolutions[i].param <= beauty) + targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + break; + } + } + break; + case 1: + for (i = 0; i < 5; i++) + { + switch (gEvolutionTable[species].evolutions[i].method) + { + case EVO_TRADE: + targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + break; + case EVO_TRADE_ITEM: + if (gEvolutionTable[species].evolutions[i].param == heldItem) + { + heldItem = 0; + SetMonData(mon, MON_DATA_HELD_ITEM, (u8 *)&heldItem); + targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + } + break; + } + } + break; + case 2: + case 3: + for (i = 0; i < 5; i++) + { + if (gEvolutionTable[species].evolutions[i].method == EVO_ITEM + && gEvolutionTable[species].evolutions[i].param == evolutionItem) + { + targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + break; + } + } + break; + } + + return targetSpecies; +} + +u16 HoennPokedexNumToSpecies(u16 hoennNum) +{ + u16 species; + + if (!hoennNum) + return 0; + + species = 0; + + while (species < 411 && gSpeciesToHoennPokedexNum[species] != hoennNum) + species++; + + if (species == 411) + return 0; + + return species + 1; +} + +u16 NationalPokedexNumToSpecies(u16 nationalNum) +{ + u16 species; + + if (!nationalNum) + return 0; + + species = 0; + + while (species < 411 && gSpeciesToNationalPokedexNum[species] != nationalNum) + species++; + + if (species == 411) + return 0; + + return species + 1; +} + +u16 NationalToHoennOrder(u16 nationalNum) +{ + u16 hoennNum; + + if (!nationalNum) + return 0; + + hoennNum = 0; + + while (hoennNum < 411 && gHoennToNationalOrder[hoennNum] != nationalNum) + hoennNum++; + + if (hoennNum == 411) + return 0; + + return hoennNum + 1; +} + +u16 SpeciesToNationalPokedexNum(u16 species) +{ + if (!species) + return 0; + + return gSpeciesToNationalPokedexNum[species - 1]; +} + +u16 SpeciesToHoennPokedexNum(u16 species) +{ + if (!species) + return 0; + + return gSpeciesToHoennPokedexNum[species - 1]; +} + +u16 HoennToNationalOrder(u16 hoennNum) +{ + if (!hoennNum) + return 0; + + return gHoennToNationalOrder[hoennNum - 1]; +} + +u16 SpeciesToCryId(u16 species) +{ + if (species <= 250) + return species; + + if (species < 276) + return 200; + + return gSpeciesIdToCryId[species - 276]; +} + +void sub_806D544(u16 species, u32 personality, u8 *dest) +{ + if (species == SPECIES_SPINDA + && dest != gBattleSpritesGfx->sprites[0] + && dest != gBattleSpritesGfx->sprites[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; + } + } +} + +void DrawSpindaSpots(u16 species, u32 personality, u8 *dest, u8 a4) +{ + 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; + } + } +} + +void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies) +{ + u8 language; + GetMonData(mon, MON_DATA_NICKNAME, gStringVar1); + language = GetMonData(mon, MON_DATA_LANGUAGE, &language); + if (language == GAME_LANGUAGE && !StringCompare(gSpeciesNames[oldSpecies], gStringVar1)) + SetMonData(mon, MON_DATA_NICKNAME, gSpeciesNames[newSpecies]); +} + +bool8 sub_806D7EC(void) +{ + bool8 retVal = FALSE; + switch (gLinkPlayers[GetMultiplayerId()].lp_field_18) + { + case 0: + case 3: + retVal = FALSE; + break; + case 1: + case 2: + retVal = TRUE; + break; + } + return retVal; +} + +bool8 sub_806D82C(u8 id) +{ + bool8 retVal = FALSE; + switch (gLinkPlayers[id].lp_field_18) + { + case 0: + case 3: + retVal = FALSE; + break; + case 1: + case 2: + retVal = TRUE; + break; + } + return retVal; +} + +s32 sub_806D864(u16 a1) +{ + s32 id; + for (id = 0; id < MAX_LINK_PLAYERS; id++) + if (gLinkPlayers[id].lp_field_18 == a1) + break; + return id; +} + +u8 GetTrainerEncounterMusicId(u16 trainerOpponentId) +{ + if (InBattlePyramid()) + return GetTrainerEncounterMusicIdInBattlePyramind(trainerOpponentId); + if (sub_81D5C18()) + return sub_81D63C8(trainerOpponentId); + return TRAINER_ENCOUNTER_MUSIC(trainerOpponentId); +} + +u16 nature_stat_mod(u8 nature, u16 n, u8 statIndex) +{ + if (statIndex < 1 || statIndex > 5) + { + // should just be "return n", but it wouldn't match without this + u16 retVal = n; + retVal++; + retVal--; + return retVal; + } + + switch (gNatureStatTable[nature][statIndex - 1]) + { + case 1: + return (u16)(n * 110) / 100; + case -1: + return (u16)(n * 90) / 100; + } + + return n; +} + +void AdjustFriendship(struct Pokemon *mon, u8 event) +{ + u16 species, heldItem; + u8 holdEffect; + + if (sub_806F104()) + return; + + species = GetMonData(mon, MON_DATA_SPECIES2, 0); + heldItem = GetMonData(mon, MON_DATA_HELD_ITEM, 0); + + if (heldItem == ITEM_ENIGMA_BERRY) + { + if (gMain.inBattle) + holdEffect = gEnigmaBerries[0].holdEffect; + else + holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; + } + else + { + holdEffect = ItemId_GetHoldEffect(heldItem); + } + + if (species && species != SPECIES_EGG) + { + u8 friendshipLevel = 0; + s16 friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, 0); + if (friendship > 99) + friendshipLevel++; + if (friendship > 199) + friendshipLevel++; + if ((event != 5 || !(Random() & 1)) + && (event != 3 + || ((gBattleTypeFlags & BATTLE_TYPE_TRAINER) + && (gTrainers[gTrainerBattleOpponent_A].trainerClass == CLASS_ELITE_FOUR + || gTrainers[gTrainerBattleOpponent_A].trainerClass == CLASS_LEADER + || gTrainers[gTrainerBattleOpponent_A].trainerClass == CLASS_CHAMPION)))) + { + s8 mod = gUnknown_08329ECE[event][friendshipLevel]; + if (mod > 0 && holdEffect == HOLD_EFFECT_HAPPINESS_UP) + mod = (150 * mod) / 100; + friendship += mod; + if (mod > 0) + { + if (GetMonData(mon, MON_DATA_POKEBALL, 0) == ITEM_LUXURY_BALL) + friendship++; + if (GetMonData(mon, MON_DATA_MET_LOCATION, 0) == sav1_map_get_name()) + friendship++; + } + if (friendship < 0) + friendship = 0; + if (friendship > 255) + friendship = 255; + SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship); + } + } +} + +void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies) +{ + u8 evs[NUM_STATS]; + u16 evIncrease = 0; + u16 totalEVs = 0; + u16 heldItem; + u8 holdEffect; + int i; + + for (i = 0; i < NUM_STATS; i++) + { + evs[i] = GetMonData(mon, MON_DATA_HP_EV + i, 0); + totalEVs += evs[i]; + } + + for (i = 0; i < NUM_STATS; i++) + { + u8 hasHadPokerus; + int multiplier; + + if (totalEVs >= MAX_TOTAL_EVS) + break; + + hasHadPokerus = CheckPartyHasHadPokerus(mon, 0); + + if (hasHadPokerus) + multiplier = 2; + else + multiplier = 1; + + switch (i) + { + case 0: + evIncrease = gBaseStats[defeatedSpecies].evYield_HP * multiplier; + break; + case 1: + evIncrease = gBaseStats[defeatedSpecies].evYield_Attack * multiplier; + break; + case 2: + evIncrease = gBaseStats[defeatedSpecies].evYield_Defense * multiplier; + break; + case 3: + evIncrease = gBaseStats[defeatedSpecies].evYield_Speed * multiplier; + break; + case 4: + evIncrease = gBaseStats[defeatedSpecies].evYield_SpAttack * multiplier; + break; + case 5: + evIncrease = gBaseStats[defeatedSpecies].evYield_SpDefense * multiplier; + break; + } + + heldItem = GetMonData(mon, MON_DATA_HELD_ITEM, 0); + + if (heldItem == ITEM_ENIGMA_BERRY) + { + if (gMain.inBattle) + holdEffect = gEnigmaBerries[0].holdEffect; + else + holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; + } + else + { + holdEffect = ItemId_GetHoldEffect(heldItem); + } + + if (holdEffect == HOLD_EFFECT_MACHO_BRACE) + evIncrease *= 2; + + if (totalEVs + (s16)evIncrease > MAX_TOTAL_EVS) + evIncrease = ((s16)evIncrease + MAX_TOTAL_EVS) - (totalEVs + evIncrease); + + if (evs[i] + (s16)evIncrease > 255) + { + int val1 = (s16)evIncrease + 255; + int val2 = evs[i] + evIncrease; + evIncrease = val1 - val2; + } + + evs[i] += evIncrease; + totalEVs += evIncrease; + SetMonData(mon, MON_DATA_HP_EV + i, &evs[i]); + } +} + +u16 GetMonEVCount(struct Pokemon *mon) +{ + int i; + u16 count = 0; + + for (i = 0; i < NUM_STATS; i++) + count += GetMonData(mon, MON_DATA_HP_EV + i, 0); + + return count; +} + +void RandomlyGivePartyPokerus(struct Pokemon *party) +{ + u16 rnd = Random(); + if (rnd == 0x4000 || rnd == 0x8000 || rnd == 0xC000) + { + struct Pokemon *mon; + + do + { + do + { + rnd = Random() % PARTY_SIZE; + mon = &party[rnd]; + } + while (!GetMonData(mon, MON_DATA_SPECIES, 0)); + } + while (GetMonData(mon, MON_DATA_IS_EGG, 0)); + + if (!(CheckPartyHasHadPokerus(party, gBitTable[rnd]))) + { + u8 rnd2; + + do + { + rnd2 = Random(); + } + while ((rnd2 & 0x7) == 0); + + if (rnd2 & 0xF0) + rnd2 &= 0x7; + + rnd2 |= (rnd2 << 4); + rnd2 &= 0xF3; + rnd2++; + + SetMonData(&party[rnd], MON_DATA_POKERUS, &rnd2); + } + } +} + +u8 CheckPartyPokerus(struct Pokemon *party, u8 selection) +{ + u8 retVal; + + int partyIndex = 0; + unsigned curBit = 1; + retVal = 0; + + if (selection) + { + do + { + if ((selection & 1) && (GetMonData(&party[partyIndex], MON_DATA_POKERUS, 0) & 0xF)) + retVal |= curBit; + partyIndex++; + curBit <<= 1; + selection >>= 1; + } + while (selection); + } + else if (GetMonData(&party[0], MON_DATA_POKERUS, 0) & 0xF) + { + retVal = 1; + } + + return retVal; +} + +u8 CheckPartyHasHadPokerus(struct Pokemon *party, u8 selection) +{ + u8 retVal; + + int partyIndex = 0; + unsigned curBit = 1; + retVal = 0; + + if (selection) + { + do + { + if ((selection & 1) && GetMonData(&party[partyIndex], MON_DATA_POKERUS, 0)) + retVal |= curBit; + partyIndex++; + curBit <<= 1; + selection >>= 1; + } + while (selection); + } + else if (GetMonData(&party[0], MON_DATA_POKERUS, 0)) + { + retVal = 1; + } + + return retVal; +} + +void UpdatePartyPokerusTime(u16 days) +{ + int i; + for (i = 0; i < PARTY_SIZE; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, 0)) + { + u8 pokerus = GetMonData(&gPlayerParty[i], MON_DATA_POKERUS, 0); + if (pokerus & 0xF) + { + if ((pokerus & 0xF) < days || days > 4) + pokerus &= 0xF0; + else + pokerus -= days; + + if (pokerus == 0) + pokerus = 0x10; + + SetMonData(&gPlayerParty[i], MON_DATA_POKERUS, &pokerus); + } + } + } +} + +void PartySpreadPokerus(struct Pokemon *party) +{ + if ((Random() % 3) == 0) + { + int i; + for (i = 0; i < PARTY_SIZE; i++) + { + if (GetMonData(&party[i], MON_DATA_SPECIES, 0)) + { + u8 pokerus = GetMonData(&party[i], MON_DATA_POKERUS, 0); + u8 curPokerus = pokerus; + if (pokerus) + { + if (pokerus & 0xF) + { + // spread to adjacent party members + if (i != 0 && !(GetMonData(&party[i - 1], MON_DATA_POKERUS, 0) & 0xF0)) + SetMonData(&party[i - 1], MON_DATA_POKERUS, &curPokerus); + if (i != (PARTY_SIZE - 1) && !(GetMonData(&party[i + 1], MON_DATA_POKERUS, 0) & 0xF0)) + { + SetMonData(&party[i + 1], MON_DATA_POKERUS, &curPokerus); + i++; + } + } + } + } + } + } +} + +bool8 TryIncrementMonLevel(struct Pokemon *mon) +{ + u16 species = GetMonData(mon, MON_DATA_SPECIES, 0); + u8 nextLevel = GetMonData(mon, MON_DATA_LEVEL, 0) + 1; + u32 expPoints = GetMonData(mon, MON_DATA_EXP, 0); + if (expPoints > gExperienceTables[gBaseStats[species].growthRate][MAX_MON_LEVEL]) + { + expPoints = gExperienceTables[gBaseStats[species].growthRate][MAX_MON_LEVEL]; + SetMonData(mon, MON_DATA_EXP, &expPoints); + } + if (nextLevel > MAX_MON_LEVEL || expPoints < gExperienceTables[gBaseStats[species].growthRate][nextLevel]) + { + return FALSE; + } + else + { + SetMonData(mon, MON_DATA_LEVEL, &nextLevel); + return TRUE; + } +} + +u32 CanMonLearnTMHM(struct Pokemon *mon, u8 tm) +{ + u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0); + if (species == SPECIES_EGG) + { + return 0; + } + else if (tm < 32) + { + u32 mask = 1 << tm; + return gTMHMLearnsets[species][0] & mask; + } + else + { + u32 mask = 1 << (tm - 32); + return gTMHMLearnsets[species][1] & mask; + } +} + +u32 CanSpeciesLearnTMHM(u16 species, u8 tm) +{ + if (species == SPECIES_EGG) + { + return 0; + } + else if (tm < 32) + { + u32 mask = 1 << tm; + return gTMHMLearnsets[species][0] & mask; + } + else + { + u32 mask = 1 << (tm - 32); + return gTMHMLearnsets[species][1] & mask; + } +} + +u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves) +{ + u16 learnedMoves[4]; + u8 numMoves = 0; + u16 species = GetMonData(mon, MON_DATA_SPECIES, 0); + u8 level = GetMonData(mon, MON_DATA_LEVEL, 0); + int i, j, k; + + for (i = 0; i < 4; i++) + learnedMoves[i] = GetMonData(mon, MON_DATA_MOVE1 + i, 0); + + for (i = 0; i < 20; i++) + { + u16 moveLevel; + + if (gLevelUpLearnsets[species][i] == 0xFFFF) + break; + + moveLevel = gLevelUpLearnsets[species][i] & 0xFE00; + + if (moveLevel <= (level << 9)) + { + for (j = 0; j < 4 && learnedMoves[j] != (gLevelUpLearnsets[species][i] & 0x1FF); j++) + ; + + if (j == 4) + { + for (k = 0; k < numMoves && moves[k] != (gLevelUpLearnsets[species][i] & 0x1FF); k++) + ; + + if (k == numMoves) + moves[numMoves++] = gLevelUpLearnsets[species][i] & 0x1FF; + } + } + } + + return numMoves; +} + +u8 GetLevelUpMovesBySpecies(u16 species, u16 *moves) +{ + u8 numMoves = 0; + int i; + + for (i = 0; i < 20 && gLevelUpLearnsets[species][i] != 0xFFFF; i++) + moves[numMoves++] = gLevelUpLearnsets[species][i] & 0x1FF; + + return numMoves; +} + +u8 GetNumberOfRelearnableMoves(struct Pokemon *mon) +{ + u16 learnedMoves[4]; + u16 moves[20]; + u8 numMoves = 0; + u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0); + u8 level = GetMonData(mon, MON_DATA_LEVEL, 0); + int i, j, k; + + if (species == SPECIES_EGG) + return 0; + + for (i = 0; i < 4; i++) + learnedMoves[i] = GetMonData(mon, MON_DATA_MOVE1 + i, 0); + + for (i = 0; i < 20; i++) + { + u16 moveLevel; + + if (gLevelUpLearnsets[species][i] == 0xFFFF) + break; + + moveLevel = gLevelUpLearnsets[species][i] & 0xFE00; + + if (moveLevel <= (level << 9)) + { + for (j = 0; j < 4 && learnedMoves[j] != (gLevelUpLearnsets[species][i] & 0x1FF); j++) + ; + + if (j == 4) + { + for (k = 0; k < numMoves && moves[k] != (gLevelUpLearnsets[species][i] & 0x1FF); k++) + ; + + if (k == numMoves) + moves[numMoves++] = gLevelUpLearnsets[species][i] & 0x1FF; + } + } + } + + return numMoves; +} + +u16 SpeciesToPokedexNum(u16 species) +{ + if (IsNationalPokedexEnabled()) + { + return SpeciesToNationalPokedexNum(species); + } + else + { + species = SpeciesToHoennPokedexNum(species); + if (species <= 202) + return species; + return 0xFFFF; + } +} + +bool32 sub_806E3F8(u16 species) +{ + if (SpeciesToHoennPokedexNum(species) > 202) + return FALSE; + else + return TRUE; +} + +void ClearBattleMonForms(void) +{ + int i; + for (i = 0; i < 4; i++) + gBattleMonForms[i] = 0; +} + +u16 GetBattleBGM(void) +{ + if (gBattleTypeFlags & BATTLE_TYPE_KYOGRE_GROUDON) + return 0x1E0; + if (gBattleTypeFlags & BATTLE_TYPE_REGI) + return 0x1DF; + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + return 0x1DC; + if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) + { + u8 trainerClass; + if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER) + trainerClass = GetFrontierOpponentClass(gTrainerBattleOpponent_A); + else if (gBattleTypeFlags & BATTLE_TYPE_x4000000) + trainerClass = CLASS_EXPERT; + else + trainerClass = gTrainers[gTrainerBattleOpponent_A].trainerClass; + switch (trainerClass) + { + case CLASS_AQUA_LEADER: + case CLASS_MAGMA_LEADER: + return 0x1E3; + case CLASS_TEAM_AQUA: + case CLASS_TEAM_MAGMA: + case CLASS_AQUA_ADMIN: + case CLASS_MAGMA_ADMIN: + return 0x1DB; + case CLASS_LEADER: + return 0x1DD; + case CLASS_CHAMPION: + return 0x1DE; + case CLASS_PKMN_TRAINER_RIVAL: + if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER) + return 0x1E1; + if (!StringCompare(gTrainers[gTrainerBattleOpponent_A].trainerName, BattleText_Wally)) + return 0x1DC; + return 0x1E1; + case CLASS_ELITE_FOUR: + return 0x1E2; + case CLASS_SALON_MAIDEN: + case CLASS_DOME_ACE: + case CLASS_PALACE_MAVEN: + case CLASS_ARENA_TYCOON: + case CLASS_FACTORY_HEAD: + case CLASS_PIKE_QUEEN: + case CLASS_PYRAMID_KING: + return 0x1D7; + default: + return 0x1DC; + } + } + return 0x1DA; +} + +void PlayBattleBGM(void) +{ + ResetMapMusic(); + m4aMPlayAllStop(); + PlayBGM(GetBattleBGM()); +} + +void PlayMapChosenOrBattleBGM(u16 songId) +{ + ResetMapMusic(); + m4aMPlayAllStop(); + if (songId) + PlayNewMapMusic(songId); + else + PlayNewMapMusic(GetBattleBGM()); +} + +void sub_806E694(u16 songId) +{ + u8 taskId; + + ResetMapMusic(); + m4aMPlayAllStop(); + + taskId = CreateTask(sub_806E6CC, 0); + gTasks[taskId].data[0] = songId; +} + +static void sub_806E6CC(u8 taskId) +{ + if (gTasks[taskId].data[0]) + PlayNewMapMusic(gTasks[taskId].data[0]); + else + PlayNewMapMusic(GetBattleBGM()); + DestroyTask(taskId); +} + +const u8 *pokemon_get_pal(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); +} + +// Extracts the upper 16 bits of a 32-bit number +#define HIHALF(n) (((n) & 0xFFFF0000) >> 16) + +// 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) +{ + u32 shinyValue; + + if (species > SPECIES_EGG) + return gMonPaletteTable[0].data; + + shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality); + if (shinyValue < 8) + return gMonShinyPaletteTable[species].data; + else + return gMonPaletteTable[species].data; +} + +const struct CompressedSpritePalette *sub_806E794(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 sub_806E7CC(species, otId, personality); +} + +const struct CompressedSpritePalette *sub_806E7CC(u16 species, u32 otId , u32 personality) +{ + u32 shinyValue; + + shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality); + if (shinyValue < 8) + return &gMonShinyPaletteTable[species]; + else + return &gMonPaletteTable[species]; +} + +bool32 IsHMMove2(u16 move) +{ + int i = 0; + while (gHMMoves[i] != 0xFFFF) + { + if (gHMMoves[i++] == move) + return TRUE; + } + return FALSE; +} + +bool8 IsPokeSpriteNotFlipped(u16 species) +{ + return gBaseStats[species].noFlip; +} + +s8 GetMonFlavourRelation(struct Pokemon *mon, u8 a2) +{ + u8 nature = GetNature(mon); + return gPokeblockFlavorCompatibilityTable[nature * 5 + a2]; +} + +s8 GetFlavourRelationByPersonality(u32 personality, u8 a2) +{ + u8 nature = GetNatureFromPersonality(personality); + return gPokeblockFlavorCompatibilityTable[nature * 5 + a2]; +} + +bool8 IsTradedMon(struct Pokemon *mon) +{ + u8 otName[8]; + u32 otId; + GetMonData(mon, MON_DATA_OT_NAME, otName); + otId = GetMonData(mon, MON_DATA_OT_ID, 0); + return IsOtherTrainer(otId, otName); +} + +bool8 IsOtherTrainer(u32 otId, u8 *otName) +{ + if (otId == + (gSaveBlock2Ptr->playerTrainerId[0] + | (gSaveBlock2Ptr->playerTrainerId[1] << 8) + | (gSaveBlock2Ptr->playerTrainerId[2] << 16) + | (gSaveBlock2Ptr->playerTrainerId[3] << 24))) + { + int i; + + for (i = 0; otName[i] != EOS; i++) + if (otName[i] != gSaveBlock2Ptr->playerName[i]) + return TRUE; + return FALSE; + } + + return TRUE; +} + +void MonRestorePP(struct Pokemon *mon) +{ + BoxMonRestorePP(&mon->box); +} + +void BoxMonRestorePP(struct BoxPokemon *boxMon) +{ + int i; + + for (i = 0; i < 4; i++) + { + if (GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, 0)) + { + u16 move = GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, 0); + u16 bonus = GetBoxMonData(boxMon, MON_DATA_PP_BONUSES, 0); + u8 pp = CalculatePPWithBonus(move, bonus, i); + SetBoxMonData(boxMon, MON_DATA_PP1 + i, &pp); + } + } +} + +void sub_806E994(void) +{ + gLastUsedAbility = gBattleStruct->field_B0; + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 4; + gBattleTextBuff1[2] = gBattleStruct->field_49; + gBattleTextBuff1[4] = EOS; + if (!GetBankSide(gBattleStruct->field_49)) + gBattleTextBuff1[3] = pokemon_order_func(gBattlePartyID[gBattleStruct->field_49]); + else + gBattleTextBuff1[3] = gBattlePartyID[gBattleStruct->field_49]; + gBattleTextBuff2[0] = 0xFD; + gBattleTextBuff2[1] = 4; + gBattleTextBuff2[2] = gBankInMenu; + gBattleTextBuff2[3] = pokemon_order_func(gBattlePartyID[gBankInMenu]); + gBattleTextBuff2[4] = EOS; + StrCpyDecodeBattle(BattleText_PreventedSwitch, gStringVar4); +} + +struct PokeItem +{ + u16 species; + u16 item; +}; + +extern const struct PokeItem gAlteringCaveWildMonHeldItems[9]; + +static s32 GetWildMonTableIdInAlteringCave(u16 species) +{ + s32 i; + for (i = 0; i < 9; i++) + if (gAlteringCaveWildMonHeldItems[i].species == species) + return i; + return 0; +} + +void SetWildMonHeldItem(void) +{ + if (!(gBattleTypeFlags & (BATTLE_TYPE_LEGENDARY | BATTLE_TYPE_TRAINER | BATTLE_TYPE_PYRAMID | BATTLE_TYPE_x100000))) + { + u16 rnd = Random() % 100; + u16 species = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, 0); + u16 var1 = 45; + u16 var2 = 95; + if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3, 0) + && GetMonAbility(&gPlayerParty[0]) == ABILITY_COMPOUND_EYES) + { + var1 = 20; + var2 = 80; + } + if (gMapHeader.mapDataId == 0x1A4) + { + s32 alteringCaveId = GetWildMonTableIdInAlteringCave(species); + if (alteringCaveId != 0) + { + if (rnd < var2) + return; + SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gAlteringCaveWildMonHeldItems[alteringCaveId].item); + } + else + { + if (rnd < var1) + return; + if (rnd < var2) + SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item1); + else + SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item2); + } + } + else + { + if (gBaseStats[species].item1 == gBaseStats[species].item2 && gBaseStats[species].item1 != 0) + { + SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item1); + } + else + { + if (rnd < var1) + return; + if (rnd < var2) + SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item1); + else + SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item2); + } + } + } +} + +bool8 IsMonShiny(struct Pokemon *mon) +{ + u32 otId = GetMonData(mon, MON_DATA_OT_ID, 0); + u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, 0); + return IsShinyOtIdPersonality(otId, personality); +} + +bool8 IsShinyOtIdPersonality(u32 otId, u32 personality) +{ + bool8 retVal = FALSE; + u32 shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality); + if (shinyValue < 8) + retVal = TRUE; + return retVal; +} + +const u8* GetTrainerPartnerName(void) +{ + if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) + { + if (gPartnerTrainerId == STEVEN_PARTNER_ID) + return gTrainers[TRAINER_ID_STEVEN].trainerName; + else + { + GetFrontierTrainerName(gStringVar1, gPartnerTrainerId); + return gStringVar1; + } + } + else + { + u8 id = GetMultiplayerId(); + return gLinkPlayers[sub_806D864(gLinkPlayers[id].lp_field_18 ^ 2)].name; + } +} + +#define READ_PTR_FROM_TASK(taskId, dataId) \ + (void*)( \ + ((u16)(gTasks[taskId].data[dataId]) | \ + ((u16)(gTasks[taskId].data[dataId + 1]) << 0x10))) + +#define STORE_PTR_IN_TASK(ptr, taskId, dataId) \ +{ \ + gTasks[taskId].data[dataId] = (u32)(ptr); \ + gTasks[taskId].data[dataId + 1] = (u32)(ptr) >> 0x10; \ +} + +static void Task_AnimateAfterDelay(u8 taskId) +{ + if (--gTasks[taskId].data[3] == 0) + { + LaunchAnimationTaskForFrontSprite(READ_PTR_FROM_TASK(taskId, 0), gTasks[taskId].data[2]); + DestroyTask(taskId); + } +} + +static void Task_PokemonSummaryAnimateAfterDelay(u8 taskId) +{ + if (--gTasks[taskId].data[3] == 0) + { + sub_817F578(READ_PTR_FROM_TASK(taskId, 0), gTasks[taskId].data[2]); + sub_81C488C(0xFF); + DestroyTask(taskId); + } +} + +void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3); + +void BattleAnimateFrontSprite(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3) +{ + if (gHitMarker & HITMARKER_NO_ANIMATIONS && !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))) + DoMonFrontSpriteAnimation(sprite, species, noCry, arg3 | 0x80); + else + DoMonFrontSpriteAnimation(sprite, species, noCry, arg3); +} + +bool8 HasTwoFramesAnimation(u16 species); + +extern void SpriteCallbackDummy_2(struct Sprite*); +extern void sub_817F60C(struct Sprite*); + +void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3) +{ + s8 pan; + switch (arg3 & 0x7F) + { + case 0: + pan = -25; + break; + case 1: + pan = 25; + break; + default: + pan = 0; + break; + } + if (arg3 & 0x80) + { + if (!noCry) + PlayCry1(species, pan); + sprite->callback = SpriteCallbackDummy; + } + else + { + if (!noCry) + { + PlayCry1(species, pan); + if (HasTwoFramesAnimation(species)) + StartSpriteAnim(sprite, 1); + } + if (gMonAnimationDelayTable[species - 1] != 0) + { + u8 taskId = CreateTask(Task_AnimateAfterDelay, 0); + STORE_PTR_IN_TASK(sprite, taskId, 0); + gTasks[taskId].data[2] = gMonFrontAnimIdsTable[species - 1]; + gTasks[taskId].data[3] = gMonAnimationDelayTable[species - 1]; + } + else + { + LaunchAnimationTaskForFrontSprite(sprite, gMonFrontAnimIdsTable[species - 1]); + } + sprite->callback = SpriteCallbackDummy_2; + } +} + +void PokemonSummaryDoMonAnimation(struct Sprite* sprite, u16 species, bool8 oneFrame) +{ + if (!oneFrame && HasTwoFramesAnimation(species)) + StartSpriteAnim(sprite, 1); + if (gMonAnimationDelayTable[species - 1] != 0) + { + u8 taskId = CreateTask(Task_PokemonSummaryAnimateAfterDelay, 0); + STORE_PTR_IN_TASK(sprite, taskId, 0); + gTasks[taskId].data[2] = gMonFrontAnimIdsTable[species - 1]; + gTasks[taskId].data[3] = gMonAnimationDelayTable[species - 1]; + sub_81C488C(taskId); + sub_817F60C(sprite); + } + else + { + sub_817F578(sprite, gMonFrontAnimIdsTable[species - 1]); + } +} + +void sub_806EE98(void) +{ + u8 delayTaskId = FindTaskIdByFunc(Task_PokemonSummaryAnimateAfterDelay); + if (delayTaskId != 0xFF) + DestroyTask(delayTaskId); +} + +void BattleAnimateBackSprite(struct Sprite* sprite, u16 species) +{ + if (gHitMarker & HITMARKER_NO_ANIMATIONS && !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))) + { + sprite->callback = SpriteCallbackDummy; + } + else + { + LaunchAnimationTaskForBackSprite(sprite, GetSpeciesBackAnimId(species)); + sprite->callback = SpriteCallbackDummy_2; + } +} + +u8 sub_806EF08(u8 arg0) +{ + s32 i; + s32 var = 0; + u8 multiplayerId = GetMultiplayerId(); + switch (gLinkPlayers[multiplayerId].lp_field_18) + { + case 0: + case 2: + var = (arg0 != 0) ? 1 : 3; + break; + case 1: + case 3: + var = (arg0 != 0) ? 2 : 0; + break; + } + for (i = 0; i < 4; i++) + { + if (gLinkPlayers[i].lp_field_18 == (s16)(var)) + break; + } + return i; +} + +u8 sub_806EF84(u8 arg0, u8 arg1) +{ + s32 i; + s32 var = 0; + switch (gLinkPlayers[arg1].lp_field_18) + { + case 0: + case 2: + var = (arg0 != 0) ? 1 : 3; + break; + case 1: + case 3: + var = (arg0 != 0) ? 2 : 0; + break; + } + for (i = 0; i < 4; i++) + { + if (gLinkPlayers[i].lp_field_18 == (s16)(var)) + break; + } + return i; +} + +extern const u8 gUnknown_0831F578[]; + +u16 sub_806EFF0(u16 arg0) +{ + return gUnknown_0831F578[arg0]; +} + +u16 sub_806F000(u8 playerGender) +{ + if (playerGender) + return sub_806EFF0(0x3F); + else + return sub_806EFF0(0x3C); +} + +extern const u8 gTrainerClassNames[][13]; + +void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality) +{ + u8 getFlagCaseId = (caseId == FLAG_SET_SEEN) ? FLAG_GET_SEEN : FLAG_GET_CAUGHT; + if (!GetSetPokedexFlag(nationalNum, getFlagCaseId)) // don't set if it's already set + { + GetSetPokedexFlag(nationalNum, caseId); + if (NationalPokedexNumToSpecies(nationalNum) == SPECIES_UNOWN) + gSaveBlock2Ptr->pokedex.unownPersonality = personality; + if (NationalPokedexNumToSpecies(nationalNum) == SPECIES_SPINDA) + gSaveBlock2Ptr->pokedex.spindaPersonality = personality; + } +} + +const u8* GetTrainerClassNameFromId(u16 trainerId) +{ + if (trainerId > NO_OF_TRAINERS) + trainerId = 0; + return gTrainerClassNames[gTrainers[trainerId].trainerClass]; +} + +const u8* GetTrainerNameFromId(u16 trainerId) +{ + if (trainerId > NO_OF_TRAINERS) + trainerId = 0; + return gTrainers[trainerId].trainerName; +} + +bool8 HasTwoFramesAnimation(u16 species) +{ + return (species != SPECIES_CASTFORM + && species != SPECIES_DEOXYS + && species != SPECIES_SPINDA + && species != SPECIES_UNOWN); +} + +bool8 sub_806F104(void) +{ + if (gMain.inBattle && gBattleTypeFlags & (BATTLE_TYPE_FRONTIER)) + return TRUE; + if (!gMain.inBattle && (InBattlePike() || InBattlePyramid())) + return TRUE; + return FALSE; +} + +/* + +extern const struct SpriteTemplate gUnknown_08329D98[]; + +struct Unknown_806F160_Struct +{ + u8 field_0; + u8 field_1; + u8 field_2; + u8 field_3; + u8 field_4; + u8 field_5; + u8 field_6; + u8 field_7; + u8 field_8; + u8 field_9; + u8 field_A; + u8 field_B; + struct SpriteTemplate* templates; +}; + +void sub_806F160(struct Unknown_806F160_Struct* structPtr) +{ + u16 i, j; + for (i = 0; i < structPtr->field_0; i++) + { + structPtr->templates[i] = gUnknown_08329D98[i]; + for (j = 0; j < structPtr->field_1) + { + // no clue what the pointer in the struct point to :/ + } + } +} */ + diff --git a/sym_common.txt b/sym_common.txt index c2a966f53..cf737c390 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -293,7 +293,7 @@ gUnknown_03005DE8: @ 3005DE8 gUnknown_03005DEC: @ 3005DEC .space 0x4 -gUnknown_03005DF0: @ 3005DF0 +gSelectedMapObject: @ 3005DF0 .space 0x4 gUnknown_03005DF4: @ 3005DF4 diff --git a/sym_ewram.txt b/sym_ewram.txt index eb107504f..5c48c224d 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -367,7 +367,7 @@ gUnknown_0202420D: @ 202420D gUnknown_0202420E: @ 202420E .space 0x1 -gUnknown_0202420F: @ 202420F +gStringBank: @ 202420F .space 0x1 gAbsentBankFlags: @ 2024210 @@ -511,7 +511,7 @@ gUnknown_020244B0: @ 20244B0 gUnknown_020244B4: @ 20244B4 .space 0x4 -gUnknown_020244B8: @ 20244B8 +gBankInMenu: @ 20244B8 .space 0x1 gDoingBattleAnim: @ 20244B9 @@ -526,7 +526,7 @@ gUnknown_020244CC: @ 20244CC gUnknown_020244D0: @ 20244D0 .space 0x4 -gUnknown_020244D4: @ 20244D4 +gBattleSpritesGfx: @ 20244D4 .space 0x4 gUnknown_020244D8: @ 20244D8 @@ -541,7 +541,7 @@ gBattleMovePower: @ 20244E0 gMoveToLearn: @ 20244E2 .space 0x2 -gUnknown_020244E4: @ 20244E4 +gBattleMonForms: @ 20244E4 .space 0x4 sLearningMoveTableID: @ 20244E8 @@ -550,7 +550,7 @@ sLearningMoveTableID: @ 20244E8 gPlayerPartyCount: @ 20244E9 .space 0x1 -gUnknown_020244EA: @ 20244EA +gEnemyPartyCount: @ 20244EA .space 0x2 gPlayerParty: @ 20244EC @@ -675,7 +675,7 @@ gUnknown_02037348: @ 2037348 gUnknown_0203734C: @ 203734C .space 0x4 -gUnknown_02037350: @ 2037350 +gMapObjects: @ 2037350 .space 0x240 gUnknown_02037590: @ 2037590 @@ -854,7 +854,7 @@ gTrainerBattleOpponent_A: @ 2038BCA gTrainerBattleOpponent_B: @ 2038BCC .space 0x2 -gUnknown_02038BCE: @ 2038BCE +gPartnerTrainerId: @ 2038BCE .space 0x2 gUnknown_02038BD0: @ 2038BD0 @@ -1882,7 +1882,7 @@ gUnknown_0203CE74: @ 203CE74 gUnknown_0203CE78: @ 203CE78 .space 0x4 -gUnknown_0203CE7C: @ 203CE7C +gScriptItemId: @ 203CE7C .space 0x4 gUnknown_0203CE80: @ 203CE80