diff --git a/asm/battle_2.s b/asm/battle_2.s index 53b83c10e..b15b67cdd 100644 --- a/asm/battle_2.s +++ b/asm/battle_2.s @@ -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, =gBattleDecompressedSprites 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 @@ -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] @@ -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..d3046e74f 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 @@ -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] diff --git a/asm/battle_7.s b/asm/battle_7.s index b92d69947..e95a37bdc 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites ldr r0, [r6] cmp r0, 0 beq _0805F106 diff --git a/asm/battle_anim_80FE840.s b/asm/battle_anim_80FE840.s index 9bcbbe0c5..7dff7335a 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites ldr r2, [r1] ldr r1, =gBattleAnimArgs movs r3, 0x2 @@ -52081,12 +52081,12 @@ sub_8118FBC: @ 8118FBC bl GetBankByPlayerAI lsls r0, 24 lsrs r0, 24 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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..67270f2f4 100644 --- a/asm/battle_controller_linkopponent.s +++ b/asm/battle_controller_linkopponent.s @@ -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 diff --git a/asm/battle_controller_linkpartner.s b/asm/battle_controller_linkpartner.s index dbe8052b9..2d95b042c 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 diff --git a/asm/battle_controller_opponent.s b/asm/battle_controller_opponent.s index 9e2512227..8b140c88c 100644 --- a/asm/battle_controller_opponent.s +++ b/asm/battle_controller_opponent.s @@ -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 diff --git a/asm/battle_controller_player.s b/asm/battle_controller_player.s index 5854d5e47..4678c8e79 100644 --- a/asm/battle_controller_player.s +++ b/asm/battle_controller_player.s @@ -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 @@ -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..668d6fcda 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 diff --git a/asm/battle_controller_recorded_opponent.s b/asm/battle_controller_recorded_opponent.s index 2b0eed22e..9b9070416 100644 --- a/asm/battle_controller_recorded_opponent.s +++ b/asm/battle_controller_recorded_opponent.s @@ -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 diff --git a/asm/battle_controller_recorded_player.s b/asm/battle_controller_recorded_player.s index 7f2b918a4..f00feb3a6 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 diff --git a/asm/battle_controller_safari.s b/asm/battle_controller_safari.s index 3de3c2608..ced5242be 100644 --- a/asm/battle_controller_safari.s +++ b/asm/battle_controller_safari.s @@ -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..683c74c8d 100644 --- a/asm/battle_controller_wally.s +++ b/asm/battle_controller_wally.s @@ -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..d33dc3b48 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 @@ -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/contest.s b/asm/contest.s index e0ea14adb..133443bef 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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 39a8f5209..c23a956a6 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, =gBattleDecompressedSprites mov r8, r4 cmp r0, 0 beq _080F648C diff --git a/asm/contest_painting.s b/asm/contest_painting.s index d8dec9f2a..7bf3c75d9 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites ldr r1, [r4] ldr r1, [r1, 0x4] ldr r2, [r6] diff --git a/asm/egg_hatch.s b/asm/egg_hatch.s index 48f6ae7b3..829c749d5 100644 --- a/asm/egg_hatch.s +++ b/asm/egg_hatch.s @@ -399,7 +399,7 @@ _08071688: lsls r0, r4, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleDecompressedSprites ldr r2, [r1] mov r6, r8 lsls r1, r6, 1 diff --git a/asm/evolution_scene.s b/asm/evolution_scene.s index 01b495c09..3b7078e27 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, =gBattleDecompressedSprites ldr r1, [r2] ldr r1, [r1, 0x8] adds r2, r5, 0 @@ -291,7 +291,7 @@ evolution_cutscene: @ 813DA8C lsls r0, r1, 3 ldr r2, =gMonFrontPicTable adds r0, r2 - ldr r2, =gUnknown_020244D4 + ldr r2, =gBattleDecompressedSprites ldr r1, [r2] ldr r1, [r1, 0x10] mov r2, r10 @@ -492,7 +492,7 @@ sub_813DD7C: @ 813DD7C lsls r0, r5, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleDecompressedSprites ldr r1, [r1] ldr r1, [r1, 0x10] adds r2, r5, 0 @@ -697,7 +697,7 @@ _0813E0A8: lsls r0, r6, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleDecompressedSprites ldr r1, [r1] ldr r1, [r1, 0x10] adds r2, r6, 0 @@ -867,7 +867,7 @@ sub_813E1D4: @ 813E1D4 lsls r0, r5, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleDecompressedSprites ldr r1, [r1] ldr r1, [r1, 0x8] adds r2, r5, 0 @@ -1647,7 +1647,7 @@ _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 @@ -2831,7 +2831,7 @@ _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 diff --git a/asm/item_use.s b/asm/item_use.s index 3f97bb2d1..1be0d24f9 100644 --- a/asm/item_use.s +++ b/asm/item_use.s @@ -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 diff --git a/asm/pokeblock_feed.s b/asm/pokeblock_feed.s index 8f63be452..8e05da5e3 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, =gBattleDecompressedSprites ldr r1, [r1] ldr r1, [r1, 0x8] adds r2, r5, 0 diff --git a/asm/pokemon_2.s b/asm/pokemon_2.s index 7b587ad5c..b6eb5a7bc 100644 --- a/asm/pokemon_2.s +++ b/asm/pokemon_2.s @@ -335,7 +335,7 @@ sub_806A068: @ 806A068 lsrs r5, r0, 16 lsls r1, 24 lsrs r4, r1, 24 - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleDecompressedSprites ldr r2, [r0] cmp r2, 0 beq _0806A09C @@ -454,7 +454,7 @@ _0806A144: b _0806A1B0 .pool _0806A170: - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleDecompressedSprites ldr r1, [r0] cmp r1, 0 beq _0806A194 @@ -501,7 +501,7 @@ sub_806A1C0: @ 806A1C0 lsrs r5, r0, 16 lsls r1, 24 lsrs r4, r1, 24 - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleDecompressedSprites ldr r2, [r0] cmp r2, 0 beq _0806A1F4 diff --git a/asm/pokemon_3.s b/asm/pokemon_3.s index 15d24d795..bb1edc48d 100644 --- a/asm/pokemon_3.s +++ b/asm/pokemon_3.s @@ -5,2996 +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 @@ -3684,7 +695,7 @@ _0806E9F6: strb r0, [r4] movs r0, 0x4 strb r0, [r4, 0x1] - ldr r1, =gUnknown_020244B8 + ldr r1, =gBankInMenu ldrb r0, [r1] strb r0, [r4, 0x2] ldr r2, =gBattlePartyID 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/reshow_battle_screen.s b/asm/reshow_battle_screen.s index 10fd6c6ce..7c8d43040 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 @@ -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/rom_8072304.s b/asm/rom_8072304.s index 87c9f2567..547f06102 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites ldr r0, [r0] movs r1, 0xBA lsls r1, 1 @@ -1536,7 +1536,7 @@ _08072F52: ldr r1, =gUnknown_085E8D3E bl StringCopy _08072F82: - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites ldr r0, [r0] movs r2, 0xBA lsls r2, 1 @@ -1579,7 +1579,7 @@ _08072FA6: b _0807301A .pool _08072FF0: - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites ldr r0, [r5] movs r2, 0xBA lsls r2, 1 diff --git a/asm/rom_80A5C6C.s b/asm/rom_80A5C6C.s index 22e91ecdc..42387318f 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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_815A0D4.s b/asm/rom_815A0D4.s index e6441f17b..b114c38c7 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, =gBattleDecompressedSprites 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_818E9AC.s b/asm/rom_818E9AC.s index 89694f630..730bb2fee 100644 --- a/asm/rom_818E9AC.s +++ b/asm/rom_818E9AC.s @@ -52450,8 +52450,8 @@ 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 @@ -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 @@ -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 diff --git a/asm/rom_81BE66C.s b/asm/rom_81BE66C.s index d7a5aac86..8981c1b11 100644 --- a/asm/rom_81BE66C.s +++ b/asm/rom_81BE66C.s @@ -2290,7 +2290,7 @@ _081BF9EE: strb r1, [r0] movs r0, 0xFF bl sub_81C488C - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites ldr r1, [r1] b _081C46B0 .pool _081C4680: - ldr r0, =gUnknown_020244D4 + ldr r0, =gBattleDecompressedSprites ldr r3, [r0] adds r4, r0, 0 cmp r3, 0 diff --git a/asm/script_pokemon_util_80F87D8.s b/asm/script_pokemon_util_80F87D8.s index b8c618635..429128056 100644 --- a/asm/script_pokemon_util_80F87D8.s +++ b/asm/script_pokemon_util_80F87D8.s @@ -710,7 +710,7 @@ _080F8D44: lsls r0, r6, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites ldr r1, [r1] ldr r1, [r1, 0x8] adds r2, r6, 0 diff --git a/asm/trade.s b/asm/trade.s index bccb4b04a..624f4e1e9 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -7128,7 +7128,7 @@ _0807AD58: lsls r0, r5, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleDecompressedSprites 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, =gBattleDecompressedSprites ldr r2, [r1] lsls r4, r6, 1 adds r1, r4, 0x1 @@ -10369,7 +10369,7 @@ _0807CCEE: lsls r0, r2, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleDecompressedSprites ldr r1, [r1] ldr r1, [r1, 0x10] ldr r3, [r3, 0x6C] @@ -12474,7 +12474,7 @@ _0807E13A: lsls r0, r2, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gUnknown_020244D4 + ldr r1, =gBattleDecompressedSprites ldr r1, [r1] ldr r1, [r1, 0x10] ldr r3, [r3, 0x6C] diff --git a/data/battle_message.s b/data/battle_message.s index 34a2ad3c8..75bd65d23 100644 --- a/data/battle_message.s +++ b/data/battle_message.s @@ -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 diff --git a/include/battle.h b/include/battle.h index 1db546de3..81d3e2c82 100644 --- a/include/battle.h +++ b/include/battle.h @@ -187,8 +187,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 +199,8 @@ struct Trainer extern const struct Trainer gTrainers[]; +#define TRAINER_ENCOUNTER_MUSIC(trainer)((gTrainers[trainer].encounterMusic_gender & 0x7F)) + struct UnknownFlags { u32 flags[4]; @@ -412,4 +413,12 @@ struct BattleScripting extern struct BattleScripting gBattleScripting; -#endif +struct BattleDecompressedSprites +{ + void* firstDecompressed; // ptr to the decompressed sprite of the first pokemon + void* sprites[4]; +}; + +extern struct BattleDecompressedSprites* gBattleDecompressedSprites; + +#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/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/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/pokemon.h b/include/pokemon.h index a335e0154..cfee4261c 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -420,6 +420,12 @@ struct BattleMove u8 flags; }; +struct SpindaSpot +{ + u8 x, y; + u16 image[16]; +}; + struct __attribute__((packed)) LevelUpMove { u16 move:9; @@ -483,9 +489,11 @@ 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[]; void ZeroBoxMonData(struct BoxPokemon *boxMon); void ZeroMonData(struct Pokemon *mon); @@ -551,4 +559,28 @@ 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 *); + +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 *); + #endif // GUARD_POKEMON_H diff --git a/include/trainer_class.h b/include/trainer_class.h new file mode 100644 index 000000000..14fc69a24 --- /dev/null +++ b/include/trainer_class.h @@ -0,0 +1,53 @@ +#ifndef GUARD_TRAINER_CLASS_H +#define GUARD_TRAINER_CLASS_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_CLASS_H diff --git a/ld_script.txt b/ld_script.txt index 8ae46e18a..146a609be 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); diff --git a/src/pokemon_3.c b/src/pokemon_3.c new file mode 100644 index 000000000..78dca4967 --- /dev/null +++ b/src/pokemon_3.c @@ -0,0 +1,1113 @@ +#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_class.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 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 bool8 InBattlePyramid(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); + +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 != gBattleDecompressedSprites->sprites[0] + && dest != gBattleDecompressedSprites->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; +} diff --git a/sym_ewram.txt b/sym_ewram.txt index dda072481..b05bf725f 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 +gBattleDecompressedSprites: @ 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