From 729f4e10ed8a53155d992b8904926a10181acafa Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 1 Oct 2017 01:12:42 +0200 Subject: [PATCH] start decompiling battle2 --- asm/battle_1.s | 12 +- asm/battle_2.s | 3235 +-------------------- asm/battle_5.s | 6 +- asm/battle_7.s | 56 +- asm/battle_anim.s | 8 +- asm/battle_anim_80FE840.s | 152 +- asm/battle_anim_815A0D4.s | 26 +- asm/battle_anim_8170478.s | 8 +- asm/battle_controller_linkopponent.s | 4 +- asm/battle_controller_linkpartner.s | 4 +- asm/battle_controller_opponent.s | 6 +- asm/battle_controller_player.s | 28 +- asm/battle_controller_player_partner.s | 4 +- asm/battle_controller_recorded_opponent.s | 4 +- asm/battle_controller_recorded_player.s | 4 +- asm/battle_controller_safari.s | 10 +- asm/battle_controller_wally.s | 12 +- asm/battle_frontier_1.s | 74 +- asm/battle_frontier_2.s | 4 +- asm/battle_interface.s | 16 +- asm/battle_setup.s | 10 +- asm/battle_tower.s | 22 +- asm/battle_transition.s | 12 +- asm/berry_blender.s | 48 +- asm/cable_club.s | 34 +- asm/contest.s | 48 +- asm/contest_link_80F57C4.s | 60 +- asm/contest_link_80FC4F4.s | 40 +- asm/contest_link_81D9DE4.s | 10 +- asm/contest_painting.s | 6 +- asm/evolution_scene.s | 54 +- asm/field_screen.s | 2 +- asm/link.s | 298 +- asm/menu_helpers.s | 2 +- asm/mystery_event_menu.s | 8 +- asm/pokeblock_feed.s | 4 +- asm/pokemon_summary_screen.s | 10 +- asm/pokenav.s | 10 +- asm/record_mixing.s | 8 +- asm/recorded_battle.s | 10 +- asm/reshow_battle_screen.s | 10 +- asm/rom3.s | 26 +- asm/rom6.s | 14 +- asm/rom_80A5C6C.s | 12 +- asm/script_pokemon_util_80F87D8.s | 10 +- asm/trade.s | 66 +- asm/trainer_card.s | 20 +- asm/unknown_task.s | 6 +- include/battle.h | 51 +- include/battle_setup.h | 6 + include/flags.h | 2 + include/global.berry.h | 13 +- include/global.h | 9 +- include/link.h | 18 +- include/load_save.h | 1 + include/pokemon.h | 1 + include/recorded_battle.h | 5 + include/unknown_task.h | 12 +- ld_script.txt | 1 + src/battle_2.c | 1343 +++++++++ src/battle_script_commands.c | 3 +- src/egg_hatch.c | 6 +- src/pokemon_2.c | 12 +- src/pokemon_3.c | 4 +- sym_common.txt | 4 +- sym_ewram.txt | 25 +- 66 files changed, 2143 insertions(+), 3906 deletions(-) create mode 100644 include/battle_setup.h create mode 100644 src/battle_2.c diff --git a/asm/battle_1.s b/asm/battle_1.s index 636bafbea..168f16cca 100644 --- a/asm/battle_1.s +++ b/asm/battle_1.s @@ -1667,8 +1667,8 @@ _08035A8A: .pool thumb_func_end load_battle_oval_graphics - thumb_func_start sub_8035AA4 -sub_8035AA4: @ 8035AA4 + thumb_func_start LoadBattleTextboxAndBackground +LoadBattleTextboxAndBackground: @ 8035AA4 push {lr} ldr r0, =gUnknown_08C00000 movs r1, 0xC0 @@ -1690,7 +1690,7 @@ sub_8035AA4: @ 8035AA4 pop {r0} bx r0 .pool - thumb_func_end sub_8035AA4 + thumb_func_end LoadBattleTextboxAndBackground thumb_func_start sub_8035AE4 sub_8035AE4: @ 8035AE4 @@ -2457,8 +2457,8 @@ _08036138: .pool thumb_func_end task00_0800F6FC - thumb_func_start sub_8036154 -sub_8036154: @ 8036154 + thumb_func_start LoadBattleEntryBackground +LoadBattleEntryBackground: @ 8036154 push {r4,r5,lr} ldr r0, =gBattleTypeFlags ldr r1, [r0] @@ -2668,7 +2668,7 @@ _080363AC: pop {r0} bx r0 .pool - thumb_func_end sub_8036154 + thumb_func_end LoadBattleEntryBackground thumb_func_start sub_80363C4 sub_80363C4: @ 80363C4 diff --git a/asm/battle_2.s b/asm/battle_2.s index 996579313..0f4ec2bea 100644 --- a/asm/battle_2.s +++ b/asm/battle_2.s @@ -4,3157 +4,6 @@ .syntax unified .text - - - thumb_func_start sub_8036760 -sub_8036760: @ 8036760 - push {lr} - bl MoveSaveBlocks_ResetHeap - bl sub_8056F28 - bl dp11_init - bl init_uns_table_pokemon_copy - bl sub_8185F84 - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _080367CC - movs r0, 0x80 - lsls r0, 17 - ands r0, r1 - cmp r0, 0 - beq _08036798 - bl InitBattle - b _080367BA - .pool -_08036798: - movs r0, 0x80 - lsls r0, 15 - ands r1, r0 - cmp r1, 0 - bne _080367B4 - bl battle_wireless_setup_if_required_maybe - ldr r0, =sub_8037ADC - bl SetMainCallback2 - b _080367BA - .pool -_080367B4: - ldr r0, =intro_end - bl SetMainCallback2 -_080367BA: - ldr r1, =gBattleCommunication - movs r0, 0 - strb r0, [r1] - b _080367D0 - .pool -_080367CC: - bl InitBattle -_080367D0: - pop {r0} - bx r0 - thumb_func_end sub_8036760 - - thumb_func_start InitBattle -InitBattle: @ 80367D4 - push {r4,r5,lr} - sub sp, 0x4 - movs r0, 0 - bl SetHBlankCallback - movs r0, 0 - bl SetVBlankCallback - movs r0, 0 - str r0, [sp] - movs r1, 0xC0 - lsls r1, 19 - ldr r2, =0x05006000 - mov r0, sp - bl CpuSet - movs r0, 0x4C - movs r1, 0 - bl SetGpuReg - movs r0, 0x40 - movs r1, 0xF0 - bl SetGpuReg - ldr r1, =0x00005051 - movs r0, 0x44 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0 - bl SetGpuReg - movs r0, 0x4A - movs r1, 0 - bl SetGpuReg - ldr r0, =gUnknown_02022E24 - movs r2, 0xF0 - strh r2, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 15 - ands r0, r1 - cmp r0, 0 - beq _08036870 - ldr r0, =gPartnerTrainerId - ldrh r1, [r0] - ldr r0, =0x00000c03 - cmp r1, r0 - beq _08036870 - ldr r1, =gUnknown_02022E26 - movs r0, 0x9F - strh r0, [r1] - ldr r0, =gUnknown_02022E28 - strh r2, [r0] - ldr r1, =gUnknown_02022E2A - movs r0, 0x20 - strh r0, [r1] - b _080368BE - .pool -_08036870: - ldr r0, =gUnknown_02022E26 - ldr r2, =0x00005051 - adds r1, r2, 0 - strh r1, [r0] - bl dp12_8087EA4 - ldr r0, =gUnknown_02038C28 - movs r3, 0xF0 - movs r5, 0xF0 - lsls r5, 3 - adds r2, r0, r5 - movs r1, 0x4F -_08036888: - strh r3, [r0] - strh r3, [r2] - adds r2, 0x2 - adds r0, 0x2 - subs r1, 0x1 - cmp r1, 0 - bge _08036888 - movs r1, 0x50 - ldr r4, =gUnknown_0831AC70 - ldr r0, =gUnknown_02038C28 - ldr r3, =0x0000ff10 - movs r5, 0x82 - lsls r5, 4 - adds r2, r0, r5 - adds r0, 0xA0 -_080368A6: - strh r3, [r0] - strh r3, [r2] - adds r2, 0x2 - adds r0, 0x2 - adds r1, 0x1 - cmp r1, 0x9F - ble _080368A6 - ldr r0, [r4] - ldr r1, [r4, 0x4] - ldr r2, [r4, 0x8] - bl sub_80BA038 -_080368BE: - bl ResetPaletteFade - ldr r0, =gUnknown_02022E14 - movs r1, 0 - strh r1, [r0] - ldr r0, =gUnknown_02022E16 - strh r1, [r0] - ldr r0, =gBattle_BG1_X - strh r1, [r0] - ldr r0, =gBattle_BG1_Y - strh r1, [r0] - ldr r0, =gBattle_BG2_X - strh r1, [r0] - ldr r0, =gBattle_BG2_Y - strh r1, [r0] - ldr r0, =gBattle_BG3_X - strh r1, [r0] - ldr r0, =gUnknown_02022E22 - strh r1, [r0] - bl sub_80B0BD0 - ldr r2, =gBattleTerrain - strb r0, [r2] - ldr r4, =gBattleTypeFlags - ldr r0, [r4] - movs r1, 0x80 - lsls r1, 17 - ands r0, r1 - cmp r0, 0 - beq _080368FE - movs r0, 0x8 - strb r0, [r2] -_080368FE: - bl c2_berry_program_update_menu - bl sub_8035AA4 - bl ResetSpriteData - bl ResetTasks - bl sub_8036154 - bl FreeAllSpritePalettes - ldr r1, =gReservedSpritePaletteCount - movs r0, 0x4 - strb r0, [r1] - ldr r0, =VBlankCB_Battle - bl SetVBlankCallback - bl sub_803269C - ldr r2, [r4] - movs r1, 0xA0 - lsls r1, 1 - adds r0, r2, 0 - ands r0, r1 - cmp r0, r1 - beq _0803693E - ldr r1, =0x00400040 - adds r0, r2, 0 - ands r0, r1 - cmp r0, r1 - bne _08036994 -_0803693E: - ldr r0, =sub_8037458 - bl SetMainCallback2 - b _080369AE - .pool -_08036994: - movs r0, 0x40 - ands r2, r0 - cmp r2, 0 - beq _080369A8 - ldr r0, =sub_8037DF4 - bl SetMainCallback2 - b _080369AE - .pool -_080369A8: - ldr r0, =sub_8036FAC - bl SetMainCallback2 -_080369AE: - ldr r5, =gBattleTypeFlags - ldr r0, [r5] - ldr r1, =0x01000002 - ands r0, r1 - cmp r0, 0 - bne _080369E8 - ldr r4, =gEnemyParty - ldr r0, =gTrainerBattleOpponent_A - ldrh r1, [r0] - adds r0, r4, 0 - movs r2, 0x1 - bl CreateNPCTrainerParty - ldr r0, [r5] - movs r1, 0x80 - lsls r1, 8 - ands r0, r1 - cmp r0, 0 - beq _080369E4 - movs r1, 0x96 - lsls r1, 1 - adds r0, r4, r1 - ldr r1, =gTrainerBattleOpponent_B - ldrh r1, [r1] - movs r2, 0 - bl CreateNPCTrainerParty -_080369E4: - bl SetWildMonHeldItem -_080369E8: - ldr r1, =gMain - ldr r2, =0x00000439 - adds r1, r2 - ldrb r0, [r1] - movs r2, 0x2 - orrs r0, r2 - strb r0, [r1] - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldr r5, =0x00000ca9 - adds r1, r5 - ldrb r2, [r1] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r4, =gPlayerParty - movs r0, 0xFA - lsls r0, 1 - adds r5, r4, r0 -_08036A10: - adds r0, r4, 0 - movs r1, 0x3 - bl AdjustFriendship - adds r4, 0x64 - cmp r4, r5 - ble _08036A10 - movs r1, 0 - ldr r0, =gBattleCommunication - strb r1, [r0] - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end InitBattle - - thumb_func_start sub_8036A5C -sub_8036A5C: @ 8036A5C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r6, 0 - mov r9, r6 - movs r0, 0xCE - lsls r0, 1 - mov r10, r0 - mov r8, r6 -_08036A72: - movs r0, 0x64 - mov r4, r9 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - lsls r0, 16 - lsrs r5, r0, 16 - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - lsls r0, 16 - lsrs r7, r0, 16 - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - adds r1, r0, 0 - cmp r5, 0 - beq _08036AEE - cmp r5, r10 - beq _08036ABA - cmp r7, 0 - beq _08036ABA - cmp r1, 0 - bne _08036ABA - movs r0, 0x1 - mov r2, r8 - lsls r0, r2 - orrs r6, r0 - lsls r0, r6, 16 - lsrs r6, r0, 16 -_08036ABA: - cmp r5, 0 - beq _08036AEE - cmp r7, 0 - beq _08036AD6 - cmp r5, r10 - beq _08036ACA - cmp r1, 0 - beq _08036AD6 -_08036ACA: - movs r0, 0x2 - mov r1, r8 - lsls r0, r1 - orrs r6, r0 - lsls r0, r6, 16 - lsrs r6, r0, 16 -_08036AD6: - cmp r5, 0 - beq _08036AEE - cmp r5, r10 - beq _08036AEE - cmp r7, 0 - bne _08036AEE - movs r0, 0x3 - mov r2, r8 - lsls r0, r2 - orrs r6, r0 - lsls r0, r6, 16 - lsrs r6, r0, 16 -_08036AEE: - movs r0, 0x2 - add r8, r0 - movs r1, 0x1 - add r9, r1 - mov r2, r9 - cmp r2, 0x5 - ble _08036A72 - ldr r4, =gBattleStruct - ldr r0, [r4] - movs r1, 0xC1 - lsls r1, 1 - adds r0, r1 - strb r6, [r0] - ldr r0, [r4] - ldr r5, =0x00000183 - adds r0, r5 - lsrs r1, r6, 8 - strb r1, [r0] - ldr r0, =0x000008d2 - bl FlagGet - ldr r1, [r4] - adds r1, r5 - lsls r0, 7 - ldrb r2, [r1] - orrs r0, r2 - strb r0, [r1] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8036A5C - - thumb_func_start sub_8036B44 -sub_8036B44: @ 8036B44 - push {r4-r7,lr} - ldr r0, =gBattleStruct - ldr r5, [r0] - movs r0, 0xC2 - lsls r0, 1 - adds r4, r5, r0 - bl IsEnigmaBerryValid - cmp r0, 0x1 - bne _08036BC0 - movs r2, 0 - ldr r7, =gSaveBlock1Ptr - movs r1, 0xC6 - lsls r1, 1 - adds r5, r1 - adds r6, r7, 0 - ldr r3, =0x000031f8 -_08036B66: - adds r0, r4, r2 - ldr r1, [r6] - adds r1, r3 - adds r1, r2 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0x5 - ble _08036B66 - adds r1, r4, r2 - movs r0, 0xFF - strb r0, [r1] - movs r2, 0 - adds r3, r5, 0 - ldr r6, =gSaveBlock1Ptr - ldr r5, =0x00003214 -_08036B86: - adds r0, r3, r2 - ldr r1, [r6] - adds r1, r5 - adds r1, r2 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0x11 - ble _08036B86 - ldr r0, [r7] - ldr r1, =0x00003226 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r4, 0x7] - ldr r0, [r7] - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - b _08036C00 - .pool -_08036BC0: - movs r0, 0xAF - bl ItemIdToBerryType - lsls r0, 24 - lsrs r0, 24 - bl GetBerryInfo - adds r3, r0, 0 - movs r2, 0 - movs r0, 0xC6 - lsls r0, 1 - adds r5, r0 -_08036BD8: - adds r0, r4, r2 - adds r1, r3, r2 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0x5 - ble _08036BD8 - adds r1, r4, r2 - movs r0, 0xFF - strb r0, [r1] - adds r0, r5, 0 - movs r2, 0 - adds r1, r0, 0 - adds r1, 0x11 -_08036BF4: - strb r2, [r1] - subs r1, 0x1 - cmp r1, r0 - bge _08036BF4 - movs r0, 0 - strb r0, [r4, 0x7] -_08036C00: - strb r0, [r4, 0x1A] - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8036B44 - - thumb_func_start berry_801017C -berry_801017C: @ 8036C08 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08036C20 - b _08036D4C -_08036C20: - bl IsEnigmaBerryValid - cmp r0, 0x1 - bne _08036CDC - movs r5, 0 - ldr r3, =gEnigmaBerries - ldr r0, =gSaveBlock1Ptr - mov r8, r0 - adds r6, r3, 0 - mov r4, r8 - ldr r2, =0x000031f8 - adds r7, r3, 0 - adds r7, 0x38 -_08036C3A: - adds r1, r5, r6 - ldr r0, [r4] - adds r0, r2 - adds r0, r5 - ldrb r0, [r0] - strb r0, [r1] - adds r1, r5, r7 - ldr r0, [r4] - adds r0, r2 - adds r0, r5 - ldrb r0, [r0] - strb r0, [r1] - adds r5, 0x1 - cmp r5, 0x5 - ble _08036C3A - adds r1, r5, r3 - movs r0, 0xFF - strb r0, [r1] - adds r0, r3, 0 - adds r0, 0x38 - adds r0, r5, r0 - movs r1, 0x1 - negs r1, r1 - strb r1, [r0] - movs r5, 0 - adds r7, r3, 0 - adds r7, 0x8 - ldr r4, =gSaveBlock1Ptr - ldr r2, =0x00003214 - adds r6, r3, 0 - adds r6, 0x40 -_08036C78: - adds r1, r5, r7 - ldr r0, [r4] - adds r0, r2 - adds r0, r5 - ldrb r0, [r0] - strb r0, [r1] - adds r1, r5, r6 - ldr r0, [r4] - adds r0, r2 - adds r0, r5 - ldrb r0, [r0] - strb r0, [r1] - adds r5, 0x1 - cmp r5, 0x11 - ble _08036C78 - mov r1, r8 - ldr r0, [r1] - ldr r2, =0x00003226 - adds r0, r2 - ldrb r1, [r0] - strb r1, [r3, 0x7] - ldrb r0, [r0] - adds r1, r3, 0 - adds r1, 0x3F - strb r0, [r1] - mov r4, r8 - ldr r0, [r4] - ldr r1, =0x00003227 - adds r0, r1 - ldrb r1, [r0] - strb r1, [r3, 0x1A] - ldrb r1, [r0] - adds r0, r3, 0 - adds r0, 0x52 - strb r1, [r0] - b _08036EA0 - .pool -_08036CDC: - movs r0, 0xAF - bl ItemIdToBerryType - lsls r0, 24 - lsrs r0, 24 - bl GetBerryInfo - adds r6, r0, 0 - movs r5, 0 - ldr r4, =gEnigmaBerries - adds r7, r4, 0 - adds r7, 0x38 - adds r3, r4, 0 -_08036CF6: - adds r1, r5, r4 - adds r2, r6, r5 - ldrb r0, [r2] - strb r0, [r1] - adds r1, r5, r7 - ldrb r0, [r2] - strb r0, [r1] - adds r5, 0x1 - cmp r5, 0x5 - ble _08036CF6 - adds r1, r5, r3 - movs r0, 0xFF - strb r0, [r1] - adds r0, r3, 0 - adds r0, 0x38 - adds r0, r5, r0 - movs r1, 0x1 - negs r1, r1 - strb r1, [r0] - movs r5, 0 - adds r4, r3, 0 - adds r4, 0x8 - movs r1, 0 - adds r2, r3, 0 - adds r2, 0x40 -_08036D28: - adds r0, r5, r4 - strb r1, [r0] - adds r0, r5, r2 - strb r1, [r0] - adds r5, 0x1 - cmp r5, 0x11 - ble _08036D28 - movs r1, 0 - strb r1, [r3, 0x7] - adds r0, r3, 0 - adds r0, 0x3F - strb r1, [r0] - strb r1, [r3, 0x1A] - adds r0, 0x13 - strb r1, [r0] - b _08036EA0 - .pool -_08036D4C: - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08036DF0 - movs r0, 0x80 - lsls r0, 1 - ands r1, r0 - movs r2, 0x4 - mov r8, r2 - cmp r1, 0 - beq _08036D66 - movs r4, 0x2 - mov r8, r4 -_08036D66: - movs r5, 0 - cmp r5, r8 - blt _08036D6E - b _08036EA0 -_08036D6E: - ldr r0, =gLinkPlayers - mov r12, r0 - ldr r3, =gEnigmaBerries - adds r6, r3, 0 - movs r1, 0x8 - adds r1, r6 - mov r9, r1 -_08036D7C: - lsls r1, r5, 8 - ldr r0, =gUnknown_020223C8 - adds r7, r1, r0 - lsls r0, r5, 3 - subs r0, r5 - lsls r0, 2 - add r0, r12 - ldrb r3, [r0, 0x18] - movs r4, 0 - adds r5, 0x1 - mov r10, r5 - lsls r1, r3, 3 - subs r0, r1, r3 - adds r5, r1, 0 - lsls r0, 2 - adds r1, r0, r6 -_08036D9C: - adds r0, r7, r4 - ldrb r0, [r0] - strb r0, [r1] - adds r1, 0x1 - adds r4, 0x1 - cmp r4, 0x5 - ble _08036D9C - subs r0, r5, r3 - lsls r0, 2 - adds r1, r4, r0 - adds r1, r6 - movs r2, 0xFF - strb r2, [r1] - movs r4, 0 - mov r2, r9 - adds r1, r0, r2 - adds r2, r7, 0 - adds r2, 0x8 -_08036DC0: - adds r0, r2, r4 - ldrb r0, [r0] - strb r0, [r1] - adds r1, 0x1 - adds r4, 0x1 - cmp r4, 0x11 - ble _08036DC0 - subs r0, r5, r3 - lsls r0, 2 - adds r0, r6 - ldrb r1, [r7, 0x7] - strb r1, [r0, 0x7] - ldrb r1, [r7, 0x1A] - strb r1, [r0, 0x1A] - mov r5, r10 - cmp r5, r8 - blt _08036D7C - b _08036EA0 - .pool -_08036DF0: - movs r5, 0 - ldr r4, =gEnigmaBerries - mov r9, r4 -_08036DF6: - lsls r0, r5, 8 - ldr r1, =gUnknown_020223C8 - adds r7, r0, r1 - movs r4, 0 - adds r2, r5, 0x1 - mov r10, r2 - lsls r0, r5, 3 - mov r8, r0 - adds r1, r5, 0x2 - mov r12, r1 - subs r1, r0, r5 - mov r2, r12 - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - mov r2, r9 - adds r3, r0, r2 - lsls r1, 2 - adds r2, r1, r2 -_08036E1C: - adds r0, r7, r4 - ldrb r1, [r0] - strb r1, [r2] - ldrb r0, [r0] - strb r0, [r3] - adds r3, 0x1 - adds r2, 0x1 - adds r4, 0x1 - cmp r4, 0x5 - ble _08036E1C - mov r0, r8 - subs r3, r0, r5 - lsls r3, 2 - adds r1, r4, r3 - add r1, r9 - ldrb r0, [r1] - movs r2, 0xFF - orrs r0, r2 - strb r0, [r1] - mov r0, r12 - lsls r2, r0, 3 - subs r2, r0 - lsls r2, 2 - adds r1, r4, r2 - add r1, r9 - ldrb r0, [r1] - movs r4, 0xFF - orrs r0, r4 - strb r0, [r1] - movs r4, 0 - ldr r0, =gEnigmaBerries - adds r0, 0x8 - adds r2, r0 - adds r3, r0 - adds r6, r7, 0 - adds r6, 0x8 -_08036E64: - adds r0, r6, r4 - ldrb r1, [r0] - strb r1, [r3] - ldrb r0, [r0] - strb r0, [r2] - adds r2, 0x1 - adds r3, 0x1 - adds r4, 0x1 - cmp r4, 0x11 - ble _08036E64 - mov r0, r8 - subs r2, r0, r5 - lsls r2, 2 - add r2, r9 - ldrb r0, [r7, 0x7] - strb r0, [r2, 0x7] - mov r1, r12 - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - add r0, r9 - ldrb r1, [r7, 0x7] - strb r1, [r0, 0x7] - ldrb r1, [r7, 0x1A] - strb r1, [r2, 0x1A] - ldrb r1, [r7, 0x1A] - strb r1, [r0, 0x1A] - mov r5, r10 - cmp r5, 0x1 - ble _08036DF6 -_08036EA0: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end berry_801017C - - thumb_func_start sub_8036EB8 -sub_8036EB8: @ 8036EB8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r3, r1, 24 - movs r6, 0 - ldr r0, =gUnknown_020223C4 - ldrh r2, [r0] - movs r1, 0x80 - lsls r1, 1 - mov r12, r0 - cmp r2, r1 - bne _08036EFC - cmp r3, 0 - bne _08036EEC - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - movs r2, 0xC - b _08036EF2 - .pool -_08036EEC: - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - movs r2, 0x8 -_08036EF2: - orrs r1, r2 - str r1, [r0] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_08036EFC: - cmp r6, 0 - bne _08036FA0 - movs r2, 0 - cmp r2, r4 - bge _08036F20 - ldr r1, =gUnknown_020223C4 - mov r8, r1 - movs r5, 0x80 - lsls r5, 1 -_08036F0E: - adds r1, r5 - adds r2, 0x1 - cmp r2, r4 - bge _08036F20 - mov r7, r8 - ldrh r0, [r7] - ldrh r7, [r1] - cmp r0, r7 - beq _08036F0E -_08036F20: - cmp r2, r4 - bne _08036F48 - cmp r3, 0 - bne _08036F38 - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - movs r2, 0xC - b _08036F3E - .pool -_08036F38: - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - movs r2, 0x8 -_08036F3E: - orrs r1, r2 - str r1, [r0] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_08036F48: - cmp r6, 0 - bne _08036FA0 - movs r2, 0 - ldr r5, =gBattleTypeFlags - cmp r2, r4 - bge _08036F8A - mov r0, r12 - ldrh r1, [r0] - movs r0, 0xC0 - lsls r0, 2 - cmp r1, r0 - beq _08036F82 -_08036F60: - lsls r0, r2, 8 - add r0, r12 - ldrh r0, [r0] - movs r1, 0xC0 - lsls r1, 2 - cmp r0, r1 - bls _08036F72 - cmp r2, r3 - bne _08036F8A -_08036F72: - adds r2, 0x1 - cmp r2, r4 - bge _08036F8A - lsls r0, r2, 8 - add r0, r12 - ldrh r0, [r0] - cmp r0, r1 - bne _08036F60 -_08036F82: - cmp r2, r3 - beq _08036F60 - cmp r2, r3 - bge _08036F60 -_08036F8A: - cmp r2, r4 - bne _08036F98 - ldr r0, [r5] - movs r1, 0xC - b _08036F9C - .pool -_08036F98: - ldr r0, [r5] - movs r1, 0x8 -_08036F9C: - orrs r0, r1 - str r0, [r5] -_08036FA0: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8036EB8 - - thumb_func_start sub_8036FAC -sub_8036FAC: @ 8036FAC - push {r4-r6,lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl GetMultiplayerId - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gBattleScripting - adds r0, 0x25 - strb r6, [r0] - movs r0, 0x1 - adds r5, r6, 0 - eors r5, r0 - ldr r0, =gBattleCommunication - ldrb r0, [r0] - cmp r0, 0x12 - bls _08036FD8 - b _0803744C -_08036FD8: - lsls r0, 2 - ldr r1, =_08036FF0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08036FF0: - .4byte _0803703C - .4byte _08037080 - .4byte _08037144 - .4byte _080371D8 - .4byte _08037200 - .4byte _0803742C - .4byte _08037438 - .4byte _08037230 - .4byte _08037258 - .4byte _0803742C - .4byte _08037438 - .4byte _08037288 - .4byte _080372B0 - .4byte _0803742C - .4byte _08037438 - .4byte _08037318 - .4byte _08037378 - .4byte _080373A0 - .4byte _080373E0 -_0803703C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _08037068 - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - bl sub_805EF14 - ldr r1, =gBattleCommunication - movs r0, 0x1 - strb r0, [r1] -_08037068: - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - bne _08037072 - b _0803744C -_08037072: - bl sub_800E0E8 - b _0803744C - .pool -_08037080: - ldr r2, =gBattleTypeFlags - ldr r1, [r2] - movs r6, 0x2 - adds r0, r1, 0 - ands r0, r6 - cmp r0, 0 - beq _08037124 - ldr r0, =gUnknown_03003124 - ldrb r0, [r0] - cmp r0, 0 - bne _08037098 - b _0803744C -_08037098: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _080370EE - ldr r4, =gBattleStruct - ldr r0, [r4] - movs r5, 0xC0 - lsls r5, 1 - adds r0, r5 - movs r1, 0 - strb r1, [r0] - ldr r0, [r4] - ldr r2, =0x00000181 - adds r1, r0, r2 - movs r0, 0x3 - strb r0, [r1] - bl sub_8036A5C - bl sub_8036B44 - ldr r0, =gTrainerBattleOpponent_A - ldrh r1, [r0] - movs r0, 0xC0 - lsls r0, 4 - cmp r1, r0 - bne _080370D8 - ldr r0, =gLinkPlayers - movs r1, 0 - strh r1, [r0, 0x18] - movs r1, 0x1 - strh r1, [r0, 0x34] -_080370D8: - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, [r4] - adds r1, r5 - movs r2, 0x20 - bl link_0800A448 - ldr r0, =gBattleCommunication - strb r6, [r0] -_080370EE: - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - bne _080370F8 - b _0803744C -_080370F8: - movs r0, 0 - movs r1, 0 - bl sub_800DFB4 - b _0803744C - .pool -_08037124: - movs r0, 0x80 - lsls r0, 17 - ands r0, r1 - cmp r0, 0 - bne _08037134 - movs r0, 0x4 - orrs r1, r0 - str r1, [r2] -_08037134: - ldr r1, =gBattleCommunication - movs r0, 0xF - strb r0, [r1] - bl berry_801017C - b _0803744C - .pool -_08037144: - bl sub_800A550 - movs r1, 0x3 - ands r1, r0 - cmp r1, 0x3 - beq _08037152 - b _0803744C -_08037152: - bl sub_800A5B4 - movs r0, 0x2 - adds r1, r6, 0 - bl sub_8036EB8 - bl berry_801017C - ldr r0, =task00_0800F6FC - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gTasks - lsls r2, r0, 2 - adds r2, r0 - lsls r2, 3 - adds r2, r1 - movs r1, 0 - movs r0, 0x87 - lsls r0, 1 - strh r0, [r2, 0xA] - movs r0, 0x5A - strh r0, [r2, 0xC] - strh r1, [r2, 0x12] - ldr r0, =gBattleStruct - ldr r3, [r0] - movs r4, 0xC1 - lsls r4, 1 - adds r0, r3, r4 - ldrb r1, [r0] - adds r4, 0x1 - adds r0, r3, r4 - ldrb r0, [r0] - lsls r0, 8 - orrs r1, r0 - strh r1, [r2, 0xE] - ldr r1, =gUnknown_020223C4 - lsls r4, r5, 8 - adds r1, 0x2 - adds r4, r1 - ldrh r0, [r4] - strh r0, [r2, 0x10] - lsls r0, r6, 8 - adds r0, r1 - ldrh r0, [r0] - bl sub_8185F90 - ldrh r0, [r4] - bl sub_8185F90 - bl sub_8068AA4 - ldr r1, =gBattleCommunication - b _08037446 - .pool -_080371D8: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _080371E4 - b _0803744C -_080371E4: - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gPlayerParty - movs r2, 0xC8 - bl link_0800A448 - ldr r1, =gBattleCommunication - b _08037446 - .pool -_08037200: - bl sub_800A550 - movs r1, 0x3 - ands r1, r0 - cmp r1, 0x3 - beq _0803720E - b _0803744C -_0803720E: - bl sub_800A5B4 - ldr r0, =gEnemyParty - lsls r1, r5, 8 - ldr r2, =gUnknown_020223C4 - adds r1, r2 - movs r2, 0xC8 - bl memcpy - ldr r1, =gBattleCommunication - b _08037446 - .pool -_08037230: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _0803723C - b _0803744C -_0803723C: - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gPlayerParty + 200 - movs r2, 0xC8 - bl link_0800A448 - ldr r1, =gBattleCommunication - b _08037446 - .pool -_08037258: - bl sub_800A550 - movs r1, 0x3 - ands r1, r0 - cmp r1, 0x3 - beq _08037266 - b _0803744C -_08037266: - bl sub_800A5B4 - ldr r0, =gEnemyParty + 200 - lsls r1, r5, 8 - ldr r2, =gUnknown_020223C4 - adds r1, r2 - movs r2, 0xC8 - bl memcpy - ldr r1, =gBattleCommunication - b _08037446 - .pool -_08037288: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _08037294 - b _0803744C -_08037294: - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gPlayerParty + 400 - movs r2, 0xC8 - bl link_0800A448 - ldr r1, =gBattleCommunication - b _08037446 - .pool -_080372B0: - bl sub_800A550 - movs r1, 0x3 - ands r1, r0 - cmp r1, 0x3 - beq _080372BE - b _0803744C -_080372BE: - bl sub_800A5B4 - ldr r4, =gEnemyParty + 400 - lsls r1, r5, 8 - ldr r0, =gUnknown_020223C4 - adds r1, r0 - adds r0, r4, 0 - movs r2, 0xC8 - bl memcpy - ldr r1, =0xfffffe70 - adds r0, r4, r1 - bl shedinja_something - ldr r2, =0xfffffed4 - adds r0, r4, r2 - bl shedinja_something - adds r0, r4, 0 - subs r0, 0xC8 - bl shedinja_something - adds r0, r4, 0 - subs r0, 0x64 - bl shedinja_something - adds r0, r4, 0 - bl shedinja_something - adds r0, r4, 0 - adds r0, 0x64 - bl shedinja_something - ldr r1, =gBattleCommunication - b _08037446 - .pool -_08037318: - bl sub_8032768 - bl sub_8184E58 - ldr r2, =gBattleCommunication - movs r0, 0 - strb r0, [r2, 0x1] - strb r0, [r2, 0x2] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08037372 - movs r3, 0 - ldr r1, =gLinkPlayers - ldrb r0, [r1] - adds r5, r2, 0 - cmp r0, 0x3 - bne _08037356 - movs r4, 0xFF - adds r2, r1, 0 -_08037344: - adds r2, 0x1C - adds r3, 0x1 - cmp r3, 0x1 - bgt _08037356 - ldrh r1, [r2] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x3 - beq _08037344 -_08037356: - cmp r3, 0x2 - bne _0803736C - movs r0, 0x10 - strb r0, [r5] - b _0803744C - .pool -_0803736C: - movs r0, 0x12 - strb r0, [r5] - b _0803744C -_08037372: - movs r0, 0x12 - strb r0, [r2] - b _0803744C -_08037378: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0803744C - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203BD2C - movs r2, 0x4 - bl link_0800A448 - ldr r1, =gBattleCommunication - b _08037446 - .pool -_080373A0: - bl sub_800A550 - movs r1, 0x3 - ands r1, r0 - cmp r1, 0x3 - bne _0803744C - bl sub_800A5B4 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x4 - ands r0, r1 - cmp r0, 0 - bne _080373CA - ldr r0, =gUnknown_0203BD2C - lsls r1, r5, 8 - ldr r2, =gUnknown_020223C4 - adds r1, r2 - movs r2, 0x4 - bl memcpy -_080373CA: - ldr r1, =gBattleCommunication - b _08037446 - .pool -_080373E0: - ldr r0, =gUnknown_02024333 - adds r1, r0, 0x1 - bl battle_load_something - lsls r0, 24 - cmp r0, 0 - beq _0803744C - ldr r2, =gUnknown_03005D00 - ldr r1, =gMain - ldr r0, [r1] - str r0, [r2] - ldr r0, =sub_8039EF0 - str r0, [r1] - ldr r0, =BattleMainCB2 - bl SetMainCallback2 - ldr r2, =gBattleTypeFlags - ldr r1, [r2] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0803744C - movs r0, 0x20 - orrs r1, r0 - str r1, [r2] - b _0803744C - .pool -_0803742C: - ldr r0, =gBattleCommunication - ldrb r1, [r0] - adds r1, 0x1 - strb r1, [r0] - movs r1, 0x1 - strb r1, [r0, 0x1] -_08037438: - ldr r1, =gBattleCommunication - ldrb r0, [r1, 0x1] - subs r0, 0x1 - strb r0, [r1, 0x1] - lsls r0, 24 - cmp r0, 0 - bne _0803744C -_08037446: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_0803744C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8036FAC - - thumb_func_start sub_8037458 -sub_8037458: @ 8037458 - push {r4-r7,lr} - sub sp, 0x4 - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl GetMultiplayerId - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gBattleScripting - adds r0, 0x25 - strb r6, [r0] - movs r0, 0x1 - adds r7, r6, 0 - eors r7, r0 - ldr r0, =gBattleCommunication - ldrb r0, [r0] - cmp r0, 0x10 - bls _08037486 - b _080379D6 -_08037486: - lsls r0, 2 - ldr r1, =_0803749C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0803749C: - .4byte _080374E0 - .4byte _08037518 - .4byte _0803761C - .4byte _08037670 - .4byte _08037694 - .4byte _08037710 - .4byte _08037734 - .4byte _080377B0 - .4byte _080377CC - .4byte _080377FC - .4byte _08037818 - .4byte _08037848 - .4byte _08037864 - .4byte _08037908 - .4byte _0803793A - .4byte _0803795C - .4byte _080379A0 -_080374E0: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0803750C - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - bl sub_805EF14 - ldr r1, =gBattleCommunication - movs r0, 0x1 - strb r0, [r1] -_0803750C: - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _08037518 - bl sub_800E0E8 -_08037518: - ldr r2, =gBattleTypeFlags - ldr r1, [r2] - movs r3, 0x2 - adds r0, r1, 0 - ands r0, r3 - cmp r0, 0 - beq _080375FC - ldr r0, =gUnknown_03003124 - ldrb r0, [r0] - cmp r0, 0 - bne _08037530 - b _080379D6 -_08037530: - ldr r6, =gLinkPlayers - movs r0, 0 - strh r0, [r6, 0x18] - strh r3, [r6, 0x34] - adds r1, r6, 0 - adds r1, 0x50 - movs r0, 0x1 - strh r0, [r1] - adds r1, 0x1C - movs r0, 0x3 - strh r0, [r1] - adds r0, r6, 0 - adds r0, 0x40 - ldr r4, =gTrainerBattleOpponent_A - ldrh r1, [r4] - bl GetFrontierTrainerName - adds r0, r6, 0 - adds r0, 0x5C - ldr r5, =gTrainerBattleOpponent_B - ldrh r1, [r5] - bl GetFrontierTrainerName - ldrh r1, [r4] - mov r0, sp - bl sub_8165B88 - mov r0, sp - ldrb r0, [r0] - adds r1, r6, 0 - adds r1, 0x52 - strh r0, [r1] - ldrh r1, [r5] - mov r0, sp - bl sub_8165B88 - mov r0, sp - ldrb r1, [r0] - adds r0, r6, 0 - adds r0, 0x6E - strh r1, [r0] - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _080375C4 - ldr r4, =gBattleStruct - ldr r0, [r4] - movs r5, 0xC0 - lsls r5, 1 - adds r0, r5 - movs r1, 0 - strb r1, [r0] - ldr r0, [r4] - ldr r2, =0x00000181 - adds r1, r0, r2 - movs r0, 0x3 - strb r0, [r1] - bl sub_8036A5C - bl sub_8036B44 - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, [r4] - adds r1, r5 - movs r2, 0x20 - bl link_0800A448 - ldr r1, =gBattleCommunication - movs r0, 0x2 - strb r0, [r1] -_080375C4: - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - bne _080375CE - b _080379D6 -_080375CE: - movs r0, 0 - movs r1, 0 - bl sub_800DFB4 - b _080379D6 - .pool -_080375FC: - movs r0, 0x80 - lsls r0, 17 - ands r0, r1 - cmp r0, 0 - bne _0803760C - movs r0, 0x4 - orrs r1, r0 - str r1, [r2] -_0803760C: - ldr r1, =gBattleCommunication - movs r0, 0xD - strb r0, [r1] - bl berry_801017C - b _080379D6 - .pool -_0803761C: - bl sub_800A550 - movs r1, 0x3 - ands r1, r0 - cmp r1, 0x3 - beq _0803762A - b _080379D6 -_0803762A: - bl sub_800A5B4 - movs r0, 0x2 - adds r1, r6, 0 - bl sub_8036EB8 - bl berry_801017C - ldr r0, =task00_0800F6FC - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r2, 0 - movs r0, 0x87 - lsls r0, 1 - strh r0, [r1, 0xA] - movs r0, 0x5A - strh r0, [r1, 0xC] - strh r2, [r1, 0x12] - adds r0, 0xEB - strh r0, [r1, 0xE] - strh r0, [r1, 0x10] - b _08037986 - .pool -_08037670: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _0803767C - b _080379D6 -_0803767C: - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gPlayerParty -_08037686: - movs r2, 0xC8 - bl link_0800A448 - b _08037986 - .pool -_08037694: - bl sub_800A550 - movs r1, 0x3 - ands r1, r0 - cmp r1, 0x3 - beq _080376A2 - b _080379D6 -_080376A2: - bl sub_800A5B4 - ldr r0, =gLinkPlayers - lsls r1, r6, 3 - subs r1, r6 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r1, 0x18] - cmp r0, 0 - beq _080376E8 - ldr r4, =gPlayerParty - lsls r1, r7, 8 - ldr r5, =gUnknown_020223C4 - adds r1, r5 - adds r0, r4, 0 - movs r2, 0xC8 - bl memcpy - movs r0, 0x96 - lsls r0, 1 - adds r4, r0 - lsls r1, r6, 8 - adds r1, r5 - adds r0, r4, 0 - movs r2, 0xC8 - bl memcpy - b _08037986 - .pool -_080376E8: - ldr r4, =gPlayerParty - lsls r1, r6, 8 - ldr r5, =gUnknown_020223C4 - adds r1, r5 - adds r0, r4, 0 - movs r2, 0xC8 - bl memcpy - movs r1, 0x96 - lsls r1, 1 - adds r4, r1 - lsls r1, r7, 8 - adds r1, r5 - adds r0, r4, 0 - movs r2, 0xC8 - b _08037982 - .pool -_08037710: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _0803771C - b _080379D6 -_0803771C: - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gPlayerParty + 200 - movs r2, 0x64 - bl link_0800A448 - b _08037986 - .pool -_08037734: - bl sub_800A550 - movs r1, 0x3 - ands r1, r0 - cmp r1, 0x3 - beq _08037742 - b _080379D6 -_08037742: - bl sub_800A5B4 - ldr r0, =gLinkPlayers - lsls r1, r6, 3 - subs r1, r6 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r1, 0x18] - cmp r0, 0 - beq _08037788 - ldr r4, =gPlayerParty + 200 - lsls r1, r7, 8 - ldr r5, =gUnknown_020223C4 - adds r1, r5 - adds r0, r4, 0 - movs r2, 0x64 - bl memcpy - movs r2, 0x96 - lsls r2, 1 - adds r4, r2 - lsls r1, r6, 8 - adds r1, r5 - adds r0, r4, 0 - movs r2, 0x64 - bl memcpy - b _08037986 - .pool -_08037788: - ldr r4, =gPlayerParty + 200 - lsls r1, r6, 8 - ldr r5, =gUnknown_020223C4 - adds r1, r5 - adds r0, r4, 0 - movs r2, 0x64 - bl memcpy - movs r0, 0x96 - lsls r0, 1 - adds r4, r0 - lsls r1, r7, 8 - adds r1, r5 - adds r0, r4, 0 - movs r2, 0x64 - b _08037982 - .pool -_080377B0: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _080377BC - b _080379D6 -_080377BC: - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gEnemyParty - b _08037686 - .pool -_080377CC: - bl sub_800A550 - movs r1, 0x3 - ands r1, r0 - cmp r1, 0x3 - beq _080377DA - b _080379D6 -_080377DA: - bl sub_800A5B4 - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _080377EA - b _08037986 -_080377EA: - ldr r0, =gEnemyParty - ldr r1, =gUnknown_020223C4 - movs r2, 0xC8 - b _08037982 - .pool -_080377FC: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _08037808 - b _080379D6 -_08037808: - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gEnemyParty + 200 - b _08037686 - .pool -_08037818: - bl sub_800A550 - movs r1, 0x3 - ands r1, r0 - cmp r1, 0x3 - beq _08037826 - b _080379D6 -_08037826: - bl sub_800A5B4 - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _08037836 - b _08037986 -_08037836: - ldr r0, =gEnemyParty + 200 - ldr r1, =gUnknown_020223C4 - movs r2, 0xC8 - b _08037982 - .pool -_08037848: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _08037854 - b _080379D6 -_08037854: - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gEnemyParty + 400 - b _08037686 - .pool -_08037864: - bl sub_800A550 - movs r1, 0x3 - ands r1, r0 - cmp r1, 0x3 - beq _08037872 - b _080379D6 -_08037872: - bl sub_800A5B4 - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - beq _0803788A - ldr r0, =gEnemyParty + 400 - ldr r1, =gUnknown_020223C4 - movs r2, 0xC8 - bl memcpy -_0803788A: - ldr r4, =gPlayerParty - adds r0, r4, 0 - bl shedinja_something - adds r0, r4, 0 - adds r0, 0x64 - bl shedinja_something - adds r0, r4, 0 - adds r0, 0xC8 - bl shedinja_something - movs r1, 0x96 - lsls r1, 1 - adds r0, r4, r1 - bl shedinja_something - movs r2, 0xC8 - lsls r2, 1 - adds r0, r4, r2 - bl shedinja_something - movs r1, 0xFA - lsls r1, 1 - adds r0, r4, r1 - bl shedinja_something - ldr r4, =gEnemyParty - adds r0, r4, 0 - bl shedinja_something - adds r0, r4, 0 - adds r0, 0x64 - bl shedinja_something - adds r0, r4, 0 - adds r0, 0xC8 - bl shedinja_something - movs r2, 0x96 - lsls r2, 1 - adds r0, r4, r2 - bl shedinja_something - movs r1, 0xC8 - lsls r1, 1 - adds r0, r4, r1 - bl shedinja_something - movs r2, 0xFA - lsls r2, 1 - adds r0, r4, r2 - bl shedinja_something - b _08037986 - .pool -_08037908: - bl sub_8032768 - bl sub_8184E58 - ldr r2, =gBattleCommunication - movs r0, 0 - strb r0, [r2, 0x1] - strb r0, [r2, 0x2] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08037934 - movs r0, 0xE - strb r0, [r2] - b _080379D6 - .pool -_08037934: - movs r0, 0x10 - strb r0, [r2] - b _080379D6 -_0803793A: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _080379D6 - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203BD2C - movs r2, 0x4 - bl link_0800A448 - b _08037986 - .pool -_0803795C: - bl sub_800A550 - movs r1, 0x3 - ands r1, r0 - cmp r1, 0x3 - bne _080379D6 - bl sub_800A5B4 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x4 - ands r0, r1 - cmp r0, 0 - bne _08037986 - ldr r0, =gUnknown_0203BD2C - lsls r1, r7, 8 - ldr r2, =gUnknown_020223C4 - adds r1, r2 - movs r2, 0x4 -_08037982: - bl memcpy -_08037986: - ldr r1, =gBattleCommunication - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080379D6 - .pool -_080379A0: - ldr r0, =gUnknown_02024333 - adds r1, r0, 0x1 - bl battle_load_something - lsls r0, 24 - cmp r0, 0 - beq _080379D6 - bl sub_8166188 - ldr r2, =gUnknown_03005D00 - ldr r1, =gMain - ldr r0, [r1] - str r0, [r2] - ldr r0, =sub_8039EF0 - str r0, [r1] - ldr r0, =BattleMainCB2 - bl SetMainCallback2 - ldr r2, =gBattleTypeFlags - ldr r1, [r2] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080379D6 - movs r0, 0x20 - orrs r1, r0 - str r1, [r2] -_080379D6: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8037458 - - thumb_func_start sub_80379F8 -sub_80379F8: @ 80379F8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - movs r0, 0 - mov r8, r0 - ldr r6, =gUnknown_02022FF8 - mov r10, r6 -_08037A12: - ldr r1, [sp] - add r1, r8 - movs r0, 0x64 - adds r4, r1, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r1, r8 - lsls r5, r1, 5 - strh r0, [r6] - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - strh r0, [r6, 0x2] - movs r0, 0x4 - add r0, r10 - mov r9, r0 - adds r7, r5, r0 - adds r0, r4, 0 - movs r1, 0x2 - adds r2, r7, 0 - bl GetMonData - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - strb r0, [r6, 0xF] - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - strh r0, [r6, 0x10] - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - strh r0, [r6, 0x12] - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - mov r1, r10 - adds r1, 0x14 - adds r5, r1 - str r0, [r5] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [r6, 0x18] - adds r0, r4, 0 - bl GetMonGender - strb r0, [r6, 0x1C] - adds r0, r7, 0 - bl StripExtCtrlCodes - adds r0, r4, 0 - movs r1, 0x3 - bl GetMonData - cmp r0, 0x1 - beq _08037AA4 - adds r0, r7, 0 - movs r1, 0 - bl sub_81DB4DC -_08037AA4: - adds r6, 0x20 - movs r1, 0x1 - add r8, r1 - mov r0, r8 - cmp r0, 0x2 - ble _08037A12 - ldr r0, =gUnknown_02023058 - ldr r0, [r0] - mov r1, r9 - subs r1, 0x4 - movs r2, 0x60 - bl memcpy - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80379F8 - - thumb_func_start sub_8037ADC -sub_8037ADC: @ 8037ADC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - movs r0, 0x4 - mov r9, r0 - movs r4, 0xF - ldr r6, =gBattleTypeFlags - ldr r0, [r6] - movs r1, 0x80 - lsls r1, 1 - ands r0, r1 - cmp r0, 0 - beq _08037B02 - movs r1, 0x2 - mov r9, r1 - movs r4, 0x3 -_08037B02: - bl GetMultiplayerId - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gBattleScripting - adds r0, 0x25 - movs r2, 0 - mov r8, r2 - strb r7, [r0] - ldr r0, =gBattleStruct - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0xB4 - str r1, [sp] - adds r0, 0xAC - mov r10, r0 - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - ldr r5, =gBattleCommunication - ldrb r0, [r5] - cmp r0, 0x1 - beq _08037BA4 - cmp r0, 0x1 - bgt _08037B50 - cmp r0, 0 - beq _08037B5E - b _08037D0A - .pool -_08037B50: - cmp r0, 0x2 - bne _08037B56 - b _08037C64 -_08037B56: - cmp r0, 0x3 - bne _08037B5C - b _08037C9E -_08037B5C: - b _08037D0A -_08037B5E: - ldr r0, =gUnknown_03003124 - ldrb r0, [r0] - cmp r0, 0 - bne _08037B68 - b _08037D0A -_08037B68: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _08037B74 - b _08037D0A -_08037B74: - ldr r4, =gUnknown_02023058 - movs r0, 0x60 - bl Alloc - str r0, [r4] - movs r0, 0 - bl sub_80379F8 - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, [r4] - movs r2, 0x60 - bl link_0800A448 - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] - b _08037D0A - .pool -_08037BA4: - bl sub_800A550 - adds r1, r4, 0 - ands r1, r0 - cmp r1, r4 - beq _08037BB2 - b _08037D0A -_08037BB2: - bl sub_800A5B4 - movs r5, 0 - cmp r8, r9 - bge _08037C2E - lsls r0, r7, 3 - subs r0, r7 - lsls r6, r0, 2 - mov r8, r5 - ldr r4, =gUnknown_020223C4 -_08037BC6: - cmp r5, r7 - beq _08037C1E - mov r2, r9 - cmp r2, 0x4 - bne _08037C14 - ldr r2, =gLinkPlayers - mov r1, r8 - adds r0, r1, r2 - ldrh r1, [r0, 0x18] - movs r3, 0x1 - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - bne _08037BF8 - adds r0, r6, r2 - ldrh r1, [r0, 0x18] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _08037C04 - b _08037C1E - .pool -_08037BF8: - adds r0, r6, r2 - ldrh r1, [r0, 0x18] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _08037C1E -_08037C04: - ldr r0, =gUnknown_02022FF8 - adds r1, r4, 0 - movs r2, 0x60 - bl memcpy - b _08037C1E - .pool -_08037C14: - ldr r0, =gUnknown_02022FF8 - adds r1, r4, 0 - movs r2, 0x60 - bl memcpy -_08037C1E: - movs r2, 0x80 - lsls r2, 1 - adds r4, r2 - movs r0, 0x1C - add r8, r0 - adds r5, 0x1 - cmp r5, r9 - blt _08037BC6 -_08037C2E: - ldr r1, =gBattleCommunication - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r1, =gMain - ldr r0, [r1, 0x8] - ldr r2, [sp] - str r0, [r2] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - mov r2, r10 - str r0, [r2] - ldr r0, =sub_8037ADC - str r0, [r1, 0x8] - bl sub_81B9150 - b _08037D0A - .pool -_08037C64: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08037D0A - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08037D0A - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _08037C98 - bl sub_800ADF8 - b _08037D0A - .pool -_08037C98: - bl sub_800AC34 - b _08037D0A -_08037C9E: - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _08037CE4 - bl sub_8010500 - lsls r0, 24 - cmp r0, 0 - beq _08037D0A - mov r1, r10 - ldr r0, [r1] - str r0, [r6] - ldr r1, =gMain - ldr r2, [sp] - ldr r0, [r2] - str r0, [r1, 0x8] - ldr r0, =InitBattle - bl SetMainCallback2 - ldr r4, =gUnknown_02023058 - ldr r0, [r4] - bl Free - mov r0, r8 - str r0, [r4] - b _08037D0A - .pool -_08037CE4: - ldr r0, =gUnknown_03003124 - ldrb r5, [r0] - cmp r5, 0 - bne _08037D0A - mov r1, r10 - ldr r0, [r1] - str r0, [r6] - ldr r1, =gMain - ldr r2, [sp] - ldr r0, [r2] - str r0, [r1, 0x8] - ldr r0, =InitBattle - bl SetMainCallback2 - ldr r4, =gUnknown_02023058 - ldr r0, [r4] - bl Free - str r5, [r4] -_08037D0A: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8037ADC - - thumb_func_start intro_end -intro_end: @ 8037D2C - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r0, =gBattleStruct - ldr r0, [r0] - movs r1, 0xB4 - adds r1, r0 - mov r8, r1 - adds r7, r0, 0 - adds r7, 0xAC - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - ldr r5, =gBattleCommunication - ldrb r0, [r5] - cmp r0, 0 - beq _08037D64 - cmp r0, 0x1 - beq _08037DA4 - b _08037DD6 - .pool -_08037D64: - ldr r4, =gUnknown_02023058 - movs r0, 0x60 - bl Alloc - str r0, [r4] - movs r0, 0x3 - bl sub_80379F8 - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] - ldr r1, =gMain - ldr r0, [r1, 0x8] - mov r2, r8 - str r0, [r2] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - str r0, [r7] - ldr r0, =intro_end - str r0, [r1, 0x8] - bl sub_81B9150 - b _08037DD6 - .pool -_08037DA4: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0 - bne _08037DD6 - movs r0, 0x2 - strb r0, [r5] - ldr r1, =gBattleTypeFlags - ldr r0, [r7] - str r0, [r1] - ldr r1, =gMain - mov r2, r8 - ldr r0, [r2] - str r0, [r1, 0x8] - ldr r0, =InitBattle - bl SetMainCallback2 - ldr r4, =gUnknown_02023058 - ldr r0, [r4] - bl Free - str r6, [r4] -_08037DD6: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end intro_end - - thumb_func_start sub_8037DF4 -sub_8037DF4: @ 8037DF4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - bl GetMultiplayerId - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gBattleScripting - adds r0, 0x25 - strb r7, [r0] - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - ldr r0, =gBattleCommunication - ldrb r0, [r0] - cmp r0, 0xA - bls _08037E20 - b _080383F8 -_08037E20: - lsls r0, 2 - ldr r1, =_08037E38 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08037E38: - .4byte _08037E64 - .4byte _08037EA8 - .4byte _08037F50 - .4byte _08038026 - .4byte _0803804C - .4byte _08038140 - .4byte _08038164 - .4byte _080382CC - .4byte _0803832C - .4byte _0803836C - .4byte _080383BC -_08037E64: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _08037E90 - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - bl sub_805EF14 - ldr r1, =gBattleCommunication - movs r0, 0x1 - strb r0, [r1] -_08037E90: - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - bne _08037E9A - b _080383F8 -_08037E9A: - bl sub_800E0E8 - b _080383F8 - .pool -_08037EA8: - ldr r2, =gBattleTypeFlags - ldr r1, [r2] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08037F30 - ldr r0, =gUnknown_03003124 - ldrb r0, [r0] - cmp r0, 0 - bne _08037EBE - b _080383F8 -_08037EBE: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08037F02 - ldr r4, =gBattleStruct - ldr r0, [r4] - movs r5, 0xC0 - lsls r5, 1 - adds r0, r5 - movs r1, 0 - strb r1, [r0] - ldr r0, [r4] - ldr r2, =0x00000181 - adds r1, r0, r2 - movs r0, 0x3 - strb r0, [r1] - bl sub_8036A5C - bl sub_8036B44 - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, [r4] - adds r1, r5 - movs r2, 0x20 - bl link_0800A448 - ldr r1, =gBattleCommunication - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_08037F02: - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - bne _08037F0C - b _080383F8 -_08037F0C: - movs r0, 0 - movs r1, 0 - bl sub_800DFB4 - b _080383F8 - .pool -_08037F30: - movs r0, 0x80 - lsls r0, 17 - ands r0, r1 - cmp r0, 0 - bne _08037F40 - movs r0, 0x4 - orrs r1, r0 - str r1, [r2] -_08037F40: - ldr r1, =gBattleCommunication - movs r0, 0x7 - strb r0, [r1] - bl berry_801017C - b _080383F8 - .pool -_08037F50: - bl sub_800A550 - movs r1, 0xF - ands r1, r0 - cmp r1, 0xF - beq _08037F5E - b _080383F8 -_08037F5E: - bl sub_800A5B4 - movs r0, 0x4 - adds r1, r7, 0 - bl sub_8036EB8 - bl berry_801017C - bl sub_8068AA4 - ldr r0, =task00_0800F6FC - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r1 - movs r2, 0 - movs r1, 0x87 - lsls r1, 1 - strh r1, [r0, 0xA] - movs r1, 0x5A - strh r1, [r0, 0xC] - strh r2, [r0, 0x12] - strh r2, [r0, 0xE] - strh r2, [r0, 0x10] - ldr r1, =gUnknown_020223C4 - adds r4, r0, 0 - adds r5, r1, 0x2 - movs r7, 0x3F - movs r6, 0x3 -_08037FA4: - ldrh r0, [r5] - str r2, [sp] - bl sub_8185F90 - ldr r0, =gLinkPlayers - ldr r2, [sp] - adds r0, r2, r0 - ldrh r0, [r0, 0x18] - cmp r0, 0x1 - beq _08037FE6 - cmp r0, 0x1 - bgt _08037FD4 - cmp r0, 0 - beq _08037FDE - b _0803800C - .pool -_08037FD4: - cmp r0, 0x2 - beq _08037FEE - cmp r0, 0x3 - beq _08037FFE - b _0803800C -_08037FDE: - ldrh r0, [r5] - adds r1, r7, 0 - ands r1, r0 - b _08037FF6 -_08037FE6: - ldrh r0, [r5] - adds r1, r7, 0 - ands r1, r0 - b _08038006 -_08037FEE: - ldrh r0, [r5] - adds r1, r7, 0 - ands r1, r0 - lsls r1, 6 -_08037FF6: - ldrh r0, [r4, 0xE] - orrs r1, r0 - strh r1, [r4, 0xE] - b _0803800C -_08037FFE: - ldrh r0, [r5] - adds r1, r7, 0 - ands r1, r0 - lsls r1, 6 -_08038006: - ldrh r0, [r4, 0x10] - orrs r1, r0 - strh r1, [r4, 0x10] -_0803800C: - movs r0, 0x80 - lsls r0, 1 - adds r5, r0 - adds r2, 0x1C - subs r6, 0x1 - cmp r6, 0 - bge _08037FA4 - bl ZeroEnemyPartyMons - ldr r1, =gBattleCommunication - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_08038026: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _08038032 - b _080383F8 -_08038032: - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gPlayerParty - movs r2, 0xC8 - bl link_0800A448 - b _080383A6 - .pool -_0803804C: - bl sub_800A550 - movs r1, 0xF - ands r1, r0 - cmp r1, 0xF - beq _0803805A - b _080383F8 -_0803805A: - bl sub_800A5B4 - movs r6, 0 - lsls r0, r7, 3 - subs r0, r7 - lsls r0, 2 - mov r8, r0 - ldr r4, =gUnknown_020223C4 - movs r5, 0 -_0803806C: - cmp r6, r7 - bne _080380A0 - ldr r0, =gLinkPlayers - adds r0, r5, r0 - ldrh r0, [r0, 0x18] - cmp r0, 0x2 - bgt _0803808C - cmp r0, 0x1 - bge _08038098 - cmp r0, 0 - beq _08038090 - b _0803812A - .pool -_0803808C: - cmp r0, 0x3 - bne _0803812A -_08038090: - ldr r0, =gPlayerParty - b _08038110 - .pool -_08038098: - ldr r0, =gPlayerParty + 300 - b _08038110 - .pool -_080380A0: - ldr r2, =gLinkPlayers - adds r0, r5, r2 - ldrh r1, [r0, 0x18] - movs r3, 0x1 - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - bne _080380C4 - mov r1, r8 - adds r0, r1, r2 - ldrh r1, [r0, 0x18] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _080380D2 - b _080380F8 - .pool -_080380C4: - mov r1, r8 - adds r0, r1, r2 - ldrh r1, [r0, 0x18] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _080380F8 -_080380D2: - adds r0, r5, r2 - ldrh r0, [r0, 0x18] - cmp r0, 0x2 - bgt _080380E4 - cmp r0, 0x1 - bge _080380F0 - cmp r0, 0 - beq _080380E8 - b _0803812A -_080380E4: - cmp r0, 0x3 - bne _0803812A -_080380E8: - ldr r0, =gPlayerParty - b _08038110 - .pool -_080380F0: - ldr r0, =gPlayerParty + 300 - b _08038110 - .pool -_080380F8: - adds r0, r5, r2 - ldrh r0, [r0, 0x18] - cmp r0, 0x2 - bgt _0803810A - cmp r0, 0x1 - bge _08038120 - cmp r0, 0 - beq _0803810E - b _0803812A -_0803810A: - cmp r0, 0x3 - bne _0803812A -_0803810E: - ldr r0, =gEnemyParty -_08038110: - adds r1, r4, 0 - movs r2, 0xC8 - bl memcpy - b _0803812A - .pool -_08038120: - ldr r0, =gEnemyParty + 300 - adds r1, r4, 0 - movs r2, 0xC8 - bl memcpy -_0803812A: - movs r2, 0x80 - lsls r2, 1 - adds r4, r2 - adds r5, 0x1C - adds r6, 0x1 - cmp r6, 0x3 - ble _0803806C - b _080383A6 - .pool -_08038140: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _0803814C - b _080383F8 -_0803814C: - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gPlayerParty + 200 - movs r2, 0x64 - bl link_0800A448 - b _080383A6 - .pool -_08038164: - bl sub_800A550 - movs r1, 0xF - ands r1, r0 - cmp r1, 0xF - beq _08038172 - b _080383F8 -_08038172: - bl sub_800A5B4 - movs r6, 0 - lsls r0, r7, 3 - subs r0, r7 - lsls r0, 2 - mov r8, r0 - ldr r4, =gUnknown_020223C4 - movs r5, 0 -_08038184: - cmp r6, r7 - bne _080381B8 - ldr r0, =gLinkPlayers - adds r0, r5, r0 - ldrh r0, [r0, 0x18] - cmp r0, 0x2 - bgt _080381A4 - cmp r0, 0x1 - bge _080381B0 - cmp r0, 0 - beq _080381A8 - b _08038242 - .pool -_080381A4: - cmp r0, 0x3 - bne _08038242 -_080381A8: - ldr r0, =gPlayerParty + 200 - b _08038228 - .pool -_080381B0: - ldr r0, =gPlayerParty + 500 - b _08038228 - .pool -_080381B8: - ldr r2, =gLinkPlayers - adds r0, r5, r2 - ldrh r1, [r0, 0x18] - movs r3, 0x1 - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - bne _080381DC - mov r1, r8 - adds r0, r1, r2 - ldrh r1, [r0, 0x18] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _080381EA - b _08038210 - .pool -_080381DC: - mov r1, r8 - adds r0, r1, r2 - ldrh r1, [r0, 0x18] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _08038210 -_080381EA: - adds r0, r5, r2 - ldrh r0, [r0, 0x18] - cmp r0, 0x2 - bgt _080381FC - cmp r0, 0x1 - bge _08038208 - cmp r0, 0 - beq _08038200 - b _08038242 -_080381FC: - cmp r0, 0x3 - bne _08038242 -_08038200: - ldr r0, =gPlayerParty + 200 - b _08038228 - .pool -_08038208: - ldr r0, =gPlayerParty + 500 - b _08038228 - .pool -_08038210: - adds r0, r5, r2 - ldrh r0, [r0, 0x18] - cmp r0, 0x2 - bgt _08038222 - cmp r0, 0x1 - bge _08038238 - cmp r0, 0 - beq _08038226 - b _08038242 -_08038222: - cmp r0, 0x3 - bne _08038242 -_08038226: - ldr r0, =gEnemyParty + 200 -_08038228: - adds r1, r4, 0 - movs r2, 0x64 - bl memcpy - b _08038242 - .pool -_08038238: - ldr r0, =gEnemyParty + 500 - adds r1, r4, 0 - movs r2, 0x64 - bl memcpy -_08038242: - movs r2, 0x80 - lsls r2, 1 - adds r4, r2 - adds r5, 0x1C - adds r6, 0x1 - cmp r6, 0x3 - ble _08038184 - ldr r4, =gPlayerParty - adds r0, r4, 0 - bl shedinja_something - adds r0, r4, 0 - adds r0, 0x64 - bl shedinja_something - adds r0, r4, 0 - adds r0, 0xC8 - bl shedinja_something - movs r1, 0x96 - lsls r1, 1 - adds r0, r4, r1 - bl shedinja_something - movs r2, 0xC8 - lsls r2, 1 - adds r0, r4, r2 - bl shedinja_something - movs r1, 0xFA - lsls r1, 1 - adds r0, r4, r1 - bl shedinja_something - ldr r4, =gEnemyParty - adds r0, r4, 0 - bl shedinja_something - adds r0, r4, 0 - adds r0, 0x64 - bl shedinja_something - adds r0, r4, 0 - adds r0, 0xC8 - bl shedinja_something - movs r2, 0x96 - lsls r2, 1 - adds r0, r4, r2 - bl shedinja_something - movs r1, 0xC8 - lsls r1, 1 - adds r0, r4, r1 - bl shedinja_something - movs r2, 0xFA - lsls r2, 1 - adds r0, r4, r2 - bl shedinja_something - b _080383A6 - .pool -_080382CC: - bl sub_8032768 - bl sub_8184E58 - ldr r3, =gBattleCommunication - movs r0, 0 - strb r0, [r3, 0x1] - strb r0, [r3, 0x2] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08038326 - movs r6, 0 - ldr r0, =gLinkPlayers - ldrb r1, [r0] - adds r4, r3, 0 - adds r2, r0, 0 - cmp r1, 0x3 - bne _0803830A - movs r3, 0xFF -_080382F8: - adds r2, 0x1C - adds r6, 0x1 - cmp r6, 0x3 - bgt _0803830A - ldrh r1, [r2] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0x3 - beq _080382F8 -_0803830A: - cmp r6, 0x4 - bne _08038320 - movs r0, 0x8 - strb r0, [r4] - b _080383F8 - .pool -_08038320: - movs r0, 0xA - strb r0, [r4] - b _080383F8 -_08038326: - movs r0, 0xA - strb r0, [r3] - b _080383F8 -_0803832C: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _080383F8 - ldr r0, =gBattleStruct - ldr r4, [r0] - movs r0, 0xC0 - lsls r0, 1 - adds r4, r0 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - str r0, [r4] - ldr r0, =gUnknown_0203BD2C - ldr r0, [r0] - str r0, [r4, 0x4] - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - movs r2, 0x8 - bl link_0800A448 - b _080383A6 - .pool -_0803836C: - bl sub_800A550 - movs r1, 0xF - ands r1, r0 - cmp r1, 0xF - bne _080383F8 - bl sub_800A5B4 - movs r2, 0 - b _08038386 -_08038380: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 -_08038386: - cmp r2, 0x3 - bhi _080383A6 - ldr r4, =gUnknown_020223C4 - lsls r3, r2, 8 - adds r0, r3, r4 - ldrh r0, [r0] - movs r1, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08038380 - adds r1, r4, 0x4 - adds r1, r3, r1 - ldr r0, =gUnknown_0203BD2C - movs r2, 0x4 - bl memcpy -_080383A6: - ldr r1, =gBattleCommunication - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080383F8 - .pool -_080383BC: - ldr r0, =gUnknown_02024333 - adds r1, r0, 0x1 - bl battle_load_something - lsls r0, 24 - cmp r0, 0 - beq _080383F8 - ldr r2, =gUnknown_03005D00 - ldr r1, =gMain - ldr r0, [r1] - str r0, [r2] - ldr r0, =sub_8039EF0 - str r0, [r1] - ldr r0, =BattleMainCB2 - bl SetMainCallback2 - ldr r3, =gBattleTypeFlags - ldr r2, [r3] - movs r0, 0x2 - ands r0, r2 - cmp r0, 0 - beq _080383F8 - ldr r0, =gTrainerBattleOpponent_A - movs r4, 0x80 - lsls r4, 4 - adds r1, r4, 0 - strh r1, [r0] - movs r0, 0x20 - orrs r2, r0 - str r2, [r3] -_080383F8: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8037DF4 thumb_func_start BattleMainCB2 BattleMainCB2: @ 8038420 @@ -3209,7 +58,7 @@ _08038482: sub_803849C: @ 803849C push {lr} ldr r1, =gMain - ldr r0, =gUnknown_03005D00 + ldr r0, =gPreBattleCallback1 ldr r0, [r0] str r0, [r1] ldr r2, =gUnknown_02039B28 @@ -3351,7 +200,7 @@ _080385C8: asrs r0, 16 cmp r0, 0x14 bne _080385DC - ldr r0, =sub_8036760 + ldr r0, =CB2_InitBattle bl SetMainCallback2 _080385DC: pop {r4,r5} @@ -3917,11 +766,11 @@ VBlankCB_Battle: @ 8038A28 bne _08038A3A bl Random _08038A3A: - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X ldrh r1, [r0] movs r0, 0x10 bl SetGpuReg - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y ldrh r1, [r0] movs r0, 0x12 bl SetGpuReg @@ -3945,23 +794,23 @@ _08038A3A: ldrh r1, [r0] movs r0, 0x1C bl SetGpuReg - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y ldrh r1, [r0] movs r0, 0x1E bl SetGpuReg - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H ldrh r1, [r0] movs r0, 0x40 bl SetGpuReg - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V ldrh r1, [r0] movs r0, 0x44 bl SetGpuReg - ldr r0, =gUnknown_02022E28 + ldr r0, =gBattle_WIN1H ldrh r1, [r0] movs r0, 0x42 bl SetGpuReg - ldr r0, =gUnknown_02022E2A + ldr r0, =gBattle_WIN1V ldrh r1, [r0] movs r0, 0x46 bl SetGpuReg @@ -4330,10 +1179,10 @@ _08038DAC: movs r0, 0x4A movs r1, 0 bl SetGpuReg - ldr r1, =gUnknown_02022E24 + ldr r1, =gBattle_WIN0H movs r0, 0xF0 strh r0, [r1] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r4, [r0] bl dp12_8087EA4 ldr r0, =gUnknown_02038C28 @@ -4366,10 +1215,10 @@ _08038E1A: cmp r1, 0x9F ble _08038E1A bl ResetPaletteFade - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r4, 0 strh r4, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r4, [r0] ldr r0, =gBattle_BG1_X strh r4, [r0] @@ -4381,7 +1230,7 @@ _08038E1A: strh r4, [r0] ldr r0, =gBattle_BG3_X strh r4, [r0] - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y strh r4, [r0] bl c2_berry_program_update_menu ldr r0, =gUnknown_08C004E0 @@ -4391,7 +1240,7 @@ _08038E1A: bl sub_803570C bl ResetSpriteData bl ResetTasks - bl sub_8036154 + bl LoadBattleEntryBackground movs r0, 0x4A movs r1, 0x37 bl SetGpuReg @@ -4588,7 +1437,7 @@ _08039074: b _080390B0 .pool _08039090: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _08039172 @@ -4705,7 +1554,7 @@ _08039184: ldrb r0, [r0] cmp r0, 0 bne _080391A6 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0x1 beq _080391C6 @@ -4838,9 +1687,9 @@ sub_80392A8: @ 80392A8 add r0, sp, 0x4 bl CpuSet bl ResetPaletteFade - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X strh r4, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r4, [r0] ldr r0, =gBattle_BG1_X strh r4, [r0] @@ -4852,7 +1701,7 @@ sub_80392A8: @ 80392A8 strh r4, [r0] ldr r0, =gBattle_BG3_X strh r4, [r0] - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y strh r4, [r0] bl c2_berry_program_update_menu movs r1, 0x82 @@ -4960,7 +1809,7 @@ _08039414: ands r0, r1 cmp r0, 0 beq _08039434 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _08039434 @@ -5179,7 +2028,7 @@ _08039610: ldrb r0, [r0] cmp r0, 0 bne _08039634 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0x1 bne _08039634 @@ -5708,7 +2557,7 @@ _08039A7C: lsls r0, 24 lsrs r0, 24 bl GetBankIdentity - ldr r1, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r1, [r1] lsls r0, 24 lsrs r0, 22 @@ -6298,8 +3147,8 @@ sub_8039ECC: @ 8039ECC .pool thumb_func_end sub_8039ECC - thumb_func_start sub_8039EF0 -sub_8039EF0: @ 8039EF0 + thumb_func_start BattleMainCB1 +BattleMainCB1: @ 8039EF0 push {r4,r5,lr} ldr r0, =gBattleMainFunc ldr r0, [r0] @@ -6333,7 +3182,7 @@ _08039F2A: pop {r0} bx r0 .pool - thumb_func_end sub_8039EF0 + thumb_func_end BattleMainCB1 thumb_func_start sub_8039F40 sub_8039F40: @ 8039F40 @@ -13508,7 +10357,7 @@ _0803DF8C: ands r0, r5 cmp r0, 0 beq _0803DF9E - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0803DFEC @@ -13525,7 +10374,7 @@ _0803DF9E: negs r0, r0 ands r0, r1 strb r0, [r2] - ldr r0, =gUnknown_03005D00 + ldr r0, =gPreBattleCallback1 ldr r0, [r0] str r0, [r3] movs r0, 0x80 @@ -14455,10 +11304,10 @@ bs2_8016374: @ 803E868 adds r0, r1 ldrb r0, [r0] strb r0, [r3] - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r2, 0 strh r2, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r2, [r0] ldr r1, =gUnknown_020244AC ldrb r0, [r3] @@ -14521,10 +11370,10 @@ sub_803E90C: @ 803E90C ldrb r0, [r0] strb r0, [r2] strb r0, [r4] - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldrb r0, [r4] bl sub_8045868 @@ -15219,10 +12068,10 @@ sub_803EFA8: @ 803EFA8 adds r0, r1 ldrb r0, [r0] strb r0, [r2] - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r1, =gBattlescriptCurrInstr ldr r0, =gUnknown_082DBD58 @@ -15244,10 +12093,10 @@ bs5_8016AC0: @ 803EFF0 adds r0, r1 ldrb r0, [r0] strb r0, [r2] - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r1, =gNumSafariBalls ldrb r0, [r1] @@ -15277,10 +12126,10 @@ sub_803F050: @ 803F050 adds r0, r1 ldrb r0, [r0] strb r0, [r3] - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r6, =gBattleCommunication ldr r2, =gBattleBufferB @@ -15364,10 +12213,10 @@ sub_803F120: @ 803F120 adds r0, r1 ldrb r0, [r0] strb r0, [r2] - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r4, 0 strh r4, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r4, [r0] ldr r3, =gBattleStruct ldr r0, [r3] @@ -15473,10 +12322,10 @@ bs9_8016C9C: @ 803F22C adds r0, r1 ldrb r2, [r0] strb r2, [r3] - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r1, =gBattleTextBuff1 movs r0, 0xFD diff --git a/asm/battle_5.s b/asm/battle_5.s index bb5b406e5..3163631a9 100644 --- a/asm/battle_5.s +++ b/asm/battle_5.s @@ -6,8 +6,8 @@ .text - thumb_func_start sub_8056F28 -sub_8056F28: @ 8056F28 + thumb_func_start AllocateBattleResrouces +AllocateBattleResrouces: @ 8056F28 push {r4-r6,lr} ldr r5, =gBattleResources ldr r6, =gBattleTypeFlags @@ -102,7 +102,7 @@ _08056FFA: pop {r0} bx r0 .pool - thumb_func_end sub_8056F28 + thumb_func_end AllocateBattleResrouces thumb_func_start sub_8057028 sub_8057028: @ 8057028 diff --git a/asm/battle_7.s b/asm/battle_7.s index 011559819..82298fbf4 100644 --- a/asm/battle_7.s +++ b/asm/battle_7.s @@ -5,8 +5,8 @@ .text - thumb_func_start dp11_init -dp11_init: @ 805D118 + thumb_func_start AllocateBattleSpritesData +AllocateBattleSpritesData: @ 805D118 push {r4,lr} ldr r4, =gUnknown_020244D0 movs r0, 0x10 @@ -32,7 +32,7 @@ dp11_init: @ 805D118 pop {r0} bx r0 .pool - thumb_func_end dp11_init + thumb_func_end AllocateBattleSpritesData thumb_func_start dp11_free dp11_free: @ 805D158 @@ -1371,7 +1371,7 @@ _0805DC58: lsls r2, r5, 3 ldr r1, =gMonFrontPicTable adds r2, r1 - ldr r1, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r1, [r1] lsrs r0, 22 adds r1, 0x4 @@ -1543,7 +1543,7 @@ _0805DE00: lsls r0, r5, 3 ldr r1, =gMonBackPicTable adds r0, r1 - ldr r1, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r1, [r1] lsls r2, r7, 2 adds r1, 0x4 @@ -1684,7 +1684,7 @@ sub_805DF38: @ 805DF38 lsls r4, 3 ldr r2, =gTrainerFrontPicTable adds r2, r4, r2 - ldr r1, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r1, [r1] movs r2, 0xBA lsls r2, 1 @@ -1971,8 +1971,8 @@ load_gfxc_health_bar: @ 805E1B8 .pool thumb_func_end load_gfxc_health_bar - thumb_func_start battle_load_something -battle_load_something: @ 805E1D8 + thumb_func_start BattleInitAllSprites +BattleInitAllSprites: @ 805E1D8 push {r4-r6,lr} adds r5, r0, 0 adds r4, r1, 0 @@ -2136,7 +2136,7 @@ _0805E346: pop {r4-r6} pop {r1} bx r1 - thumb_func_end battle_load_something + thumb_func_end BattleInitAllSprites thumb_func_start sub_805E350 sub_805E350: @ 805E350 @@ -2364,7 +2364,7 @@ _0805E51C: lsls r0, r1, 3 ldr r1, =gMonBackPicTable adds r0, r1 - ldr r1, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r1, [r1] mov r3, r10 lsls r2, r3, 2 @@ -2486,7 +2486,7 @@ _0805E618: mov r2, r8 bl HandleLoadSpecialPokePic_DontHandleDeoxys _0805E662: - ldr r0, =gBattleSpritesGfx + ldr r0, =gMonSpritesGfxPtr ldr r0, [r0] mov r2, r10 lsls r1, r2, 2 @@ -2666,7 +2666,7 @@ _0805E814: beq _0805E83C ldr r0, =gUnknown_08C2CEE0 _0805E822: - ldr r1, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r1, [r1] lsls r4, 2 adds r1, 0x4 @@ -2677,7 +2677,7 @@ _0805E822: .pool _0805E83C: ldr r0, =gUnknown_08C2D120 - ldr r1, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r0, =gMonSpritesGfxPtr ldr r0, [r0] adds r0, 0x4 adds r4, r0, r4 @@ -3600,15 +3600,15 @@ _0805EFAC: .pool thumb_func_end sub_805EF84 - thumb_func_start init_uns_table_pokemon_copy -init_uns_table_pokemon_copy: @ 805EFBC + thumb_func_start AllocateMonSpritesGfx +AllocateMonSpritesGfx: @ 805EFBC push {r4-r7,lr} mov r7, r10 mov r6, r9 mov r5, r8 push {r5-r7} movs r6, 0 - ldr r4, =gBattleSpritesGfx + ldr r4, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r0, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r2, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r1, [r1] movs r2, 0xBA lsls r2, 1 @@ -3706,12 +3706,12 @@ _0805F01A: pop {r0} bx r0 .pool - thumb_func_end init_uns_table_pokemon_copy + thumb_func_end AllocateMonSpritesGfx thumb_func_start sub_805F094 sub_805F094: @ 805F094 push {r4-r6,lr} - ldr r6, =gBattleSpritesGfx + ldr r6, =gMonSpritesGfxPtr ldr r0, [r6] cmp r0, 0 beq _0805F106 diff --git a/asm/battle_anim.s b/asm/battle_anim.s index 9c0190214..b9ab95165 100644 --- a/asm/battle_anim.s +++ b/asm/battle_anim.s @@ -264,14 +264,14 @@ _080A3BAA: movs r2, 0x80 bl m4aMPlayVolumeControl _080A3BC2: - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r1, [r0] - ldr r0, =gUnknown_02022E28 + ldr r0, =gBattle_WIN1H strh r1, [r0] - ldr r0, =gUnknown_02022E2A + ldr r0, =gBattle_WIN1V strh r1, [r0] add sp, 0x4 pop {r3-r5} diff --git a/asm/battle_anim_80FE840.s b/asm/battle_anim_80FE840.s index 860f1a6cb..5cec1cbc5 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, =gBattleSpritesGfx + ldr r0, =gMonSpritesGfxPtr ldr r0, [r0] movs r2, 0xBE lsls r2, 1 @@ -14571,7 +14571,7 @@ _08105CCC: bl LZDecompressWram movs r4, 0 _08105D00: - ldr r5, =gBattleSpritesGfx + ldr r5, =gMonSpritesGfxPtr ldr r0, [r5] movs r1, 0xBE lsls r1, 1 @@ -14785,9 +14785,9 @@ sub_8105EB0: @ 8105EB0 movs r6, 0x98 _08105EC4: movs r5, 0 - ldr r1, =gUnknown_02022E24 + ldr r1, =gBattle_WIN0H strh r6, [r1] - ldr r4, =gUnknown_02022E26 + ldr r4, =gBattle_WIN0V movs r0, 0xA0 strh r0, [r4] ldrh r1, [r1] @@ -14845,7 +14845,7 @@ sub_8105F30: @ 8105F30 lsls r0, r2, 16 cmp r1, r0 blt _08105F70 - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H movs r1, 0 strh r1, [r0] ldr r0, =sub_8105F84 @@ -14853,7 +14853,7 @@ sub_8105F30: @ 8105F30 b _08105F78 .pool _08105F70: - ldr r1, =gUnknown_02022E24 + ldr r1, =gBattle_WIN0H lsls r0, r4, 8 orrs r2, r0 strh r2, [r1] @@ -14905,9 +14905,9 @@ sub_8105F84: @ 8105F84 _08105FD8: cmp r0, 0x4 ble _0810600C - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H strh r4, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r4, [r0] ldr r4, =0x00003f3f movs r0, 0x48 @@ -30154,7 +30154,7 @@ _0810DB50: strh r0, [r2] adds r7, r2, 0 _0810DB60: - ldr r3, =gUnknown_02022E22 + ldr r3, =gBattle_BG3_Y ldrh r2, [r4, 0x1C] lsls r0, r2, 16 asrs r0, 24 @@ -37347,7 +37347,7 @@ sub_811152C: @ 811152C movs r0, 0xC8 strh r0, [r5, 0xA] _0811154E: - ldr r4, =gUnknown_02022E22 + ldr r4, =gBattle_BG3_Y movs r1, 0xA ldrsh r0, [r5, r1] movs r1, 0xA @@ -37396,7 +37396,7 @@ sub_8111590: @ 8111590 ldrh r0, [r4, 0x8] adds r0, 0x1 strh r0, [r4, 0x8] - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y ldrh r0, [r0] strh r0, [r4, 0xC] _081115BC: @@ -37405,7 +37405,7 @@ _081115BC: movs r1, 0xFF ands r0, r1 strh r0, [r4, 0xA] - ldr r6, =gUnknown_02022E22 + ldr r6, =gBattle_BG3_Y movs r2, 0xA ldrsh r1, [r4, r2] movs r0, 0x4 @@ -39577,10 +39577,10 @@ sub_8112758: @ 8112758 push {r4-r7,lr} lsls r0, 24 lsrs r7, r0, 24 - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r1, [r0] ldr r1, =0x00003f3f movs r0, 0x48 @@ -39611,13 +39611,13 @@ _081127A0: _081127B8: movs r6, 0xC8 _081127BA: - ldr r1, =gUnknown_02022E24 + ldr r1, =gBattle_WIN0H lsls r3, r6, 16 asrs r2, r3, 16 lsls r0, r2, 8 orrs r0, r2 strh r0, [r1] - ldr r1, =gUnknown_02022E26 + ldr r1, =gBattle_WIN0V movs r5, 0x28 ldr r0, =0x00002828 strh r0, [r1] @@ -39798,12 +39798,12 @@ _08112938: ldr r0, _08112988 @=sub_8112994 str r0, [r4] _08112966: - ldr r1, _0811298C @=gUnknown_02022E24 + ldr r1, _0811298C @=gBattle_WIN0H mov r2, r9 lsls r0, r2, 8 orrs r7, r0 strh r7, [r1] - ldr r1, _08112990 @=gUnknown_02022E26 + ldr r1, _08112990 @=gBattle_WIN0V lsls r0, r6, 8 orrs r5, r0 strh r5, [r1] @@ -39819,9 +39819,9 @@ _08112966: _08112988: .4byte sub_8112994 _0811298C: - .4byte gUnknown_02022E24 + .4byte gBattle_WIN0H _08112990: - .4byte gUnknown_02022E26 + .4byte gBattle_WIN0V thumb_func_end sub_811280C thumb_func_start sub_8112994 @@ -39837,9 +39837,9 @@ sub_8112994: @ 8112994 lsrs r1, r0, 24 cmp r1, 0 bne _081129DA - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H strh r1, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r1, [r0] ldr r4, =0x00003f3f movs r0, 0x48 @@ -40042,10 +40042,10 @@ sub_8112B44: @ 8112B44 movs r0, 0x52 movs r1, 0 bl SetGpuReg - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r1, [r0] adds r0, r4, 0 bl move_anim_8072740 @@ -42202,13 +42202,13 @@ _08113CDC: ldr r1, =0x00003f3f movs r0, 0x48 bl SetGpuReg - ldr r2, =gUnknown_02022E24 + ldr r2, =gBattle_WIN0H ldrh r0, [r5, 0x24] lsls r0, 8 ldrh r1, [r5, 0x26] orrs r0, r1 strh r0, [r2] - ldr r1, =gUnknown_02022E26 + ldr r1, =gBattle_WIN0V movs r0, 0xA0 strh r0, [r1] ldr r0, =sub_8113D60 @@ -42331,7 +42331,7 @@ _08113E1C: blt _08113E3E strh r2, [r4, 0x24] _08113E3E: - ldr r3, =gUnknown_02022E24 + ldr r3, =gBattle_WIN0H ldrh r2, [r4, 0x24] lsls r0, r2, 8 ldrh r1, [r4, 0x26] @@ -42398,10 +42398,10 @@ _08113EBC: lsrs r0, 24 cmp r0, 0x1 bne _08113EF8 - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r1, [r0] ldr r4, =0x00003f3f movs r0, 0x48 @@ -42588,13 +42588,13 @@ _08114078: ldr r1, =0x00003f3f movs r0, 0x48 bl SetGpuReg - ldr r2, =gUnknown_02022E24 + ldr r2, =gBattle_WIN0H ldrh r0, [r5, 0x24] lsls r0, 8 ldrh r1, [r5, 0x26] orrs r0, r1 strh r0, [r2] - ldr r1, =gUnknown_02022E26 + ldr r1, =gBattle_WIN0V movs r0, 0xA0 strh r0, [r1] movs r0, 0 @@ -42686,7 +42686,7 @@ _08114150: movs r0, 0x1 strh r0, [r4, 0xA] _08114154: - ldr r2, =gUnknown_02022E24 + ldr r2, =gBattle_WIN0H ldrh r0, [r4, 0x24] lsls r0, 8 ldrh r1, [r4, 0x26] @@ -42782,10 +42782,10 @@ _08114204: b _08114232 .pool _08114210: - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r1, [r0] ldr r4, =0x00003f3f movs r0, 0x48 @@ -43157,9 +43157,9 @@ sub_81144F8: @ 81144F8 lsls r0, 24 lsrs r7, r0, 24 movs r6, 0 - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H strh r6, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r6, [r0] ldr r1, =0x00003f3f movs r0, 0x48 @@ -43485,9 +43485,9 @@ _081147B8: _08114824: cmp r0, 0x3 bne _08114886 - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H strh r5, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r5, [r0] ldr r4, =0x00003f3f movs r0, 0x48 @@ -45266,7 +45266,7 @@ _0811565A: ldr r2, =gBattle_BG3_X ldrh r0, [r4, 0xA] strh r0, [r2] - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y strh r1, [r0] ldrh r0, [r6, 0x4] strh r0, [r4, 0xE] @@ -45298,7 +45298,7 @@ sub_81156D0: @ 81156D0 ldr r0, =gBattle_BG3_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y strh r1, [r0] adds r0, r3, 0 bl DestroyTask @@ -45308,7 +45308,7 @@ _08115710: ldr r1, =gBattle_BG3_X ldrh r0, [r2, 0xA] strh r0, [r1] - ldr r1, =gUnknown_02022E22 + ldr r1, =gBattle_BG3_Y ldrh r0, [r2, 0xC] strh r0, [r1] _0811571C: @@ -46557,7 +46557,7 @@ _081160E2: b _081160F6 .pool _081160EC: - ldr r1, =gUnknown_02022E22 + ldr r1, =gBattle_BG3_Y b _081160F6 .pool _081160F4: @@ -46796,7 +46796,7 @@ sub_81162A4: @ 81162A4 ldr r4, =gBattle_BG3_X ldrh r1, [r3] strh r1, [r4] - ldr r4, =gUnknown_02022E22 + ldr r4, =gBattle_BG3_Y ldrh r1, [r3, 0x2] strh r1, [r4] ldr r1, =sub_81162F8 @@ -46839,7 +46839,7 @@ _08116330: ldrh r0, [r3, 0x8] _08116332: strh r0, [r6] - ldr r2, =gUnknown_02022E22 + ldr r2, =gBattle_BG3_Y ldrh r3, [r2] lsls r1, r5, 2 adds r0, r1, r5 @@ -47805,9 +47805,9 @@ sub_8116B14: @ 8116B14 lsrs r0, 24 mov r9, r0 movs r7, 0 - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H strh r7, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r7, [r0] ldr r1, =0x00003f3f movs r0, 0x48 @@ -48072,10 +48072,10 @@ sub_8116D64: @ 8116D64 bne _08116E86 movs r0, 0 bl sub_80A477C - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H mov r1, r8 strh r1, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r1, [r0] ldr r4, =0x00003f3f movs r0, 0x48 @@ -48256,10 +48256,10 @@ _08116F56: movs r0, 0 strh r0, [r1, 0xA] _08116F5C: - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r1, [r0] ldr r1, =0x00003f3f movs r0, 0x48 @@ -48746,10 +48746,10 @@ _081173AE: strh r0, [r5, 0x26] b _08117478 _081173B6: - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r1, [r0] ldr r4, =0x00003f3f movs r0, 0x48 @@ -49158,7 +49158,7 @@ sub_81176D8: @ 81176D8 ldrh r4, [r6] adds r0, r4 strh r0, [r6] - ldr r4, =gUnknown_02022E22 + ldr r4, =gBattle_BG3_Y lsls r0, r2, 16 asrs r0, 24 ldrh r7, [r4] @@ -49363,10 +49363,10 @@ _081178B6: movs r2, 0 mov r8, r2 _081178BA: - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r1, [r0] ldr r1, =0x00003f3f movs r0, 0x48 @@ -49676,9 +49676,9 @@ _08117B34: bne _08117C0C movs r0, 0 bl sub_80A477C - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H strh r4, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r4, [r0] ldr r4, =0x00003f3f movs r0, 0x48 @@ -49777,7 +49777,7 @@ sub_8117C44: @ 8117C44 movs r0, 0x80 lsls r0, 6 bl AllocZeroed - ldr r1, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r6, =gMonSpritesGfxPtr ldr r0, [r6] movs r5, 0xBE lsls r5, 1 @@ -49866,7 +49866,7 @@ _08117CF6: adds r4, r0, 0 adds r4, 0x10 _08117CFC: - ldr r0, =gBattleSpritesGfx + ldr r0, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r2, [r1] ldr r1, =gBattleAnimArgs movs r3, 0x2 @@ -50646,7 +50646,7 @@ _0811838C: bl SetGpuReg b _0811852A _0811839C: - ldr r1, =gUnknown_02022E26 + ldr r1, =gBattle_WIN0V ldrh r0, [r1] subs r0, 0xFF strh r0, [r1] @@ -50715,7 +50715,7 @@ _08118420: _0811842C: strh r0, [r2] _0811842E: - ldr r2, =gUnknown_02022E26 + ldr r2, =gBattle_WIN0V ldrh r1, [r2] movs r0, 0xFF lsls r0, 8 @@ -50988,7 +50988,7 @@ _08118662: b _0811881A .pool _08118678: - ldr r1, =gUnknown_02022E26 + ldr r1, =gBattle_WIN0V ldrh r0, [r1] subs r0, 0xFF strh r0, [r1] @@ -51065,7 +51065,7 @@ _08118708: movs r0, 0x4 strh r0, [r1, 0x12] _08118728: - ldr r2, =gUnknown_02022E26 + ldr r2, =gBattle_WIN0V ldrh r1, [r2] movs r0, 0xFF lsls r0, 8 @@ -51288,7 +51288,7 @@ _08118908: b _08118A96 .pool _0811891C: - ldr r1, =gUnknown_02022E26 + ldr r1, =gBattle_WIN0V ldrh r0, [r1] subs r0, 0xFF strh r0, [r1] @@ -51354,7 +51354,7 @@ _08118986: movs r0, 0x6 strh r0, [r2, 0x12] _081189A6: - ldr r2, =gUnknown_02022E26 + ldr r2, =gBattle_WIN0V ldrh r1, [r2] movs r0, 0xFF lsls r0, 8 @@ -51652,7 +51652,7 @@ _08118BA8: b _08118D5A .pool _08118C38: - ldr r1, =gUnknown_02022E26 + ldr r1, =gBattle_WIN0V ldrh r0, [r1] subs r0, 0xFF strh r0, [r1] @@ -51683,7 +51683,7 @@ _08118C50: b _08118D5A .pool _08118C7C: - ldr r2, =gUnknown_02022E26 + ldr r2, =gBattle_WIN0V ldrh r1, [r2] movs r0, 0xFF lsls r0, 8 @@ -51874,7 +51874,7 @@ _08118DD4: ldr r1, =0x00003f3f movs r0, 0x4A bl SetGpuReg - ldr r1, =gUnknown_02022E16 + ldr r1, =gBattle_BG0_Y ldr r2, =0x0000ffd0 adds r0, r2, 0 strh r0, [r1] @@ -51888,7 +51888,7 @@ _08118DD4: b _08118FB2 .pool _08118E4C: - ldr r2, =gUnknown_02022E26 + ldr r2, =gBattle_WIN0V ldrh r3, [r2] movs r1, 0x80 lsls r1, 1 @@ -51932,7 +51932,7 @@ _08118E7E: b _08118FB2 .pool _08118EA8: - ldr r3, =gUnknown_02022E26 + ldr r3, =gBattle_WIN0V ldrh r2, [r3] movs r0, 0xFF lsls r0, 8 @@ -51973,7 +51973,7 @@ _08118ED8: b _08118FB2 .pool _08118F00: - ldr r1, =gUnknown_02022E16 + ldr r1, =gBattle_BG0_Y ldrh r0, [r1] adds r3, r0, 0x2 strh r3, [r1] @@ -51981,7 +51981,7 @@ _08118F00: ldrh r0, [r1] adds r0, 0x2 strh r0, [r1] - ldr r5, =gUnknown_02022E26 + ldr r5, =gBattle_WIN0V ldrh r2, [r5] movs r0, 0xFF lsls r0, 8 @@ -52081,7 +52081,7 @@ sub_8118FBC: @ 8118FBC bl GetBankByIdentity lsls r0, 24 lsrs r0, 24 - ldr r1, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r2, [r1] lsls r4, 2 adds r2, 0x4 @@ -52189,7 +52189,7 @@ sub_8119094: @ 8119094 lsls r0, 24 mov r9, r0 ldr r4, =0x040000d4 - ldr r0, =gBattleSpritesGfx + ldr r0, =gMonSpritesGfxPtr ldr r0, [r0] lsrs r2, 22 adds r0, 0x4 diff --git a/asm/battle_anim_815A0D4.s b/asm/battle_anim_815A0D4.s index f219c6988..849655fe5 100755 --- a/asm/battle_anim_815A0D4.s +++ b/asm/battle_anim_815A0D4.s @@ -1077,10 +1077,10 @@ sub_815A934: @ 815A934 lsls r1, 8 movs r0, 0 bl SetGpuRegBits - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H movs r1, 0 strh r1, [r0] - ldr r4, =gUnknown_02022E26 + ldr r4, =gBattle_WIN0V strh r1, [r4] movs r0, 0x40 movs r1, 0 @@ -1416,18 +1416,18 @@ sub_815ABEC: @ 815ABEC ldr r1, =0x00001f3f movs r0, 0x48 bl SetGpuReg - ldr r1, =gUnknown_02022E28 + ldr r1, =gBattle_WIN1H ldr r2, =0x000098f0 adds r0, r2, 0 strh r0, [r1] - ldr r1, =gUnknown_02022E2A + ldr r1, =gBattle_WIN1V movs r0, 0xA0 strh r0, [r1] - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H ldrh r1, [r0] movs r0, 0x42 bl SetGpuReg - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V ldrh r1, [r0] movs r0, 0x46 bl SetGpuReg @@ -1437,10 +1437,10 @@ _0815AC40: ldr r1, =0x00001f3f movs r0, 0x48 bl SetGpuReg - ldr r1, =gUnknown_02022E28 + ldr r1, =gBattle_WIN1H movs r0, 0xF0 strh r0, [r1] - ldr r4, =gUnknown_02022E2A + ldr r4, =gBattle_WIN1V ldr r1, =0x000078a0 adds r0, r1, 0 strh r0, [r4] @@ -1471,10 +1471,10 @@ sub_815AC8C: @ 815AC8C ldr r1, =0x00003f3f movs r0, 0x48 bl SetGpuReg - ldr r0, =gUnknown_02022E28 + ldr r0, =gBattle_WIN1H movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E2A + ldr r0, =gBattle_WIN1V strh r1, [r0] bl IsContest lsls r0, 24 @@ -3024,7 +3024,7 @@ _0815B8E0: lsls r0, 24 lsrs r1, r0, 24 _0815B8EA: - ldr r0, =gBattleSpritesGfx + ldr r0, =gMonSpritesGfxPtr ldr r2, [r0] lsls r0, r1, 2 adds r2, 0x4 @@ -5397,10 +5397,10 @@ sub_815CC94: @ 815CC94 lsls r1, 8 movs r0, 0 bl SetGpuRegBits - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H movs r1, 0 strh r1, [r0] - ldr r4, =gUnknown_02022E26 + ldr r4, =gBattle_WIN0V strh r1, [r4] movs r0, 0x40 movs r1, 0 diff --git a/asm/battle_anim_8170478.s b/asm/battle_anim_8170478.s index 85f94c20e..cb6391cee 100644 --- a/asm/battle_anim_8170478.s +++ b/asm/battle_anim_8170478.s @@ -18,10 +18,10 @@ sub_8170478: @ 8170478 str r0, [sp, 0x10] ldr r0, =gAnimationBankAttacker ldrb r4, [r0] - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r1, [r0] ldr r1, =0x00003f3f movs r0, 0x48 @@ -317,9 +317,9 @@ _08170708: bne _08170814 movs r0, 0 bl sub_80A477C - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H strh r4, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r4, [r0] ldr r4, =0x00003f3f movs r0, 0x48 diff --git a/asm/battle_controller_linkopponent.s b/asm/battle_controller_linkopponent.s index 5a762a174..a7168623c 100644 --- a/asm/battle_controller_linkopponent.s +++ b/asm/battle_controller_linkopponent.s @@ -5031,10 +5031,10 @@ _08066FE4: thumb_func_start sub_8066FF4 sub_8066FF4: @ 8066FF4 push {r4,r5,lr} - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r5, =gActiveBank ldrb r4, [r5] diff --git a/asm/battle_controller_linkpartner.s b/asm/battle_controller_linkpartner.s index 3a1b21ed7..5b0ac0491 100644 --- a/asm/battle_controller_linkpartner.s +++ b/asm/battle_controller_linkpartner.s @@ -4340,10 +4340,10 @@ _0814D580: thumb_func_start sub_814D590 sub_814D590: @ 814D590 push {r4,r5,lr} - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r5, =gActiveBank ldrb r4, [r5] diff --git a/asm/battle_controller_opponent.s b/asm/battle_controller_opponent.s index 69d4776d4..f54896ca7 100644 --- a/asm/battle_controller_opponent.s +++ b/asm/battle_controller_opponent.s @@ -5171,10 +5171,10 @@ _08061F24: thumb_func_start sub_8061F34 sub_8061F34: @ 8061F34 push {r4,r5,lr} - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r5, =gActiveBank ldrb r4, [r5] @@ -6655,7 +6655,7 @@ sub_8062BB0: @ 8062BB0 negs r0, r0 ands r0, r1 strb r0, [r3] - ldr r0, =gUnknown_03005D00 + ldr r0, =gPreBattleCallback1 ldr r0, [r0] str r0, [r2] ldr r0, [r2, 0x8] diff --git a/asm/battle_controller_player.s b/asm/battle_controller_player.s index 5f7e1b954..b829296d8 100644 --- a/asm/battle_controller_player.s +++ b/asm/battle_controller_player.s @@ -1287,10 +1287,10 @@ _08057FD6: beq _08057FF8 movs r0, 0x5 bl PlaySE - ldr r1, =gUnknown_02022E14 + ldr r1, =gBattle_BG0_X movs r0, 0 strh r0, [r1] - ldr r1, =gUnknown_02022E16 + ldr r1, =gBattle_BG0_Y movs r2, 0xA0 lsls r2, 1 adds r0, r2, 0 @@ -2123,7 +2123,7 @@ sub_80586F8: @ 80586F8 ldrb r0, [r0] cmp r0, 0 bne _0805875C - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _08058798 @@ -2137,7 +2137,7 @@ sub_80586F8: @ 80586F8 negs r0, r0 ands r0, r1 strb r0, [r2] - ldr r0, =gUnknown_03005D00 + ldr r0, =gPreBattleCallback1 ldr r0, [r0] str r0, [r3] ldr r0, =sub_8038D64 @@ -2166,7 +2166,7 @@ _0805875C: negs r0, r0 ands r0, r1 strb r0, [r2] - ldr r0, =gUnknown_03005D00 + ldr r0, =gPreBattleCallback1 ldr r0, [r0] str r0, [r3] ldr r0, =sub_8038D64 @@ -2233,7 +2233,7 @@ _08058810: negs r0, r0 ands r0, r1 strb r0, [r3] - ldr r0, =gUnknown_03005D00 + ldr r0, =gPreBattleCallback1 ldr r0, [r0] str r0, [r2] ldr r0, [r2, 0x8] @@ -4711,10 +4711,10 @@ b_link_standby_message: @ 8059DC0 ands r0, r1 cmp r0, 0 beq _08059DE0 - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r0, =gText_LinkStandby movs r1, 0 @@ -8444,10 +8444,10 @@ _0805BF70: thumb_func_start sub_805BF80 sub_805BF80: @ 805BF80 push {r4,r5,lr} - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r5, =gActiveBank ldrb r4, [r5] @@ -8503,9 +8503,9 @@ sub_805C004: @ 805C004 lsrs r1, r0, 24 cmp r1, 0 bne _0805C02A - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X strh r1, [r0] - ldr r1, =gUnknown_02022E16 + ldr r1, =gBattle_BG0_Y movs r0, 0xA0 strh r0, [r1] ldr r1, =gBattleBankFunc @@ -8611,9 +8611,9 @@ sub_805C114: @ 805C114 lsrs r1, r0, 24 cmp r1, 0 bne _0805C13E - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X strh r1, [r0] - ldr r1, =gUnknown_02022E16 + ldr r1, =gBattle_BG0_Y movs r2, 0xA0 lsls r2, 1 adds r0, r2, 0 diff --git a/asm/battle_controller_player_partner.s b/asm/battle_controller_player_partner.s index 784eacab1..185b8d5ca 100644 --- a/asm/battle_controller_player_partner.s +++ b/asm/battle_controller_player_partner.s @@ -4952,10 +4952,10 @@ _081BDA3C: thumb_func_start sub_81BDA4C sub_81BDA4C: @ 81BDA4C push {r4,lr} - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r4, =gActiveBank ldrb r0, [r4] diff --git a/asm/battle_controller_recorded_opponent.s b/asm/battle_controller_recorded_opponent.s index 90928e7d4..5c420158a 100644 --- a/asm/battle_controller_recorded_opponent.s +++ b/asm/battle_controller_recorded_opponent.s @@ -4708,10 +4708,10 @@ _08188E80: thumb_func_start sub_8188E90 sub_8188E90: @ 8188E90 push {r4,lr} - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r4, =gActiveBank ldrb r0, [r4] diff --git a/asm/battle_controller_recorded_player.s b/asm/battle_controller_recorded_player.s index 534f34068..6ab274da2 100644 --- a/asm/battle_controller_recorded_player.s +++ b/asm/battle_controller_recorded_player.s @@ -4808,10 +4808,10 @@ _0818C42C: thumb_func_start sub_818C43C sub_818C43C: @ 818C43C push {r4,lr} - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r4, =gActiveBank ldrb r0, [r4] diff --git a/asm/battle_controller_safari.s b/asm/battle_controller_safari.s index cc149ea4f..dac3034a9 100644 --- a/asm/battle_controller_safari.s +++ b/asm/battle_controller_safari.s @@ -318,7 +318,7 @@ sub_81595E4: @ 81595E4 negs r0, r0 ands r0, r1 strb r0, [r3] - ldr r0, =gUnknown_03005D00 + ldr r0, =gPreBattleCallback1 ldr r0, [r0] str r0, [r2] ldr r0, [r2, 0x8] @@ -778,10 +778,10 @@ sub_81599D0: @ 81599D0 thumb_func_start dp01t_10_6_message dp01t_10_6_message: @ 81599DC push {r4,lr} - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r4, =gActiveBank ldrb r0, [r4] @@ -832,9 +832,9 @@ sub_8159A54: @ 8159A54 lsrs r1, r0, 24 cmp r1, 0 bne _08159A7A - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X strh r1, [r0] - ldr r1, =gUnknown_02022E16 + ldr r1, =gBattle_BG0_Y movs r0, 0xA0 strh r0, [r1] ldr r1, =gBattleBankFunc diff --git a/asm/battle_controller_wally.s b/asm/battle_controller_wally.s index eab717466..51193024f 100644 --- a/asm/battle_controller_wally.s +++ b/asm/battle_controller_wally.s @@ -3592,10 +3592,10 @@ _0816A3AC: thumb_func_start sub_816A3B8 sub_816A3B8: @ 816A3B8 push {r4,lr} - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r4, =gActiveBank ldrb r0, [r4] @@ -3646,9 +3646,9 @@ sub_816A430: @ 816A430 lsrs r1, r0, 24 cmp r1, 0 bne _0816A456 - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X strh r1, [r0] - ldr r1, =gUnknown_02022E16 + ldr r1, =gBattle_BG0_Y movs r0, 0xA0 strh r0, [r1] ldr r1, =gBattleBankFunc @@ -3749,9 +3749,9 @@ _0816A522: lsrs r1, r0, 24 cmp r1, 0 bne _0816A574 - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X strh r1, [r0] - ldr r1, =gUnknown_02022E16 + ldr r1, =gBattle_BG0_Y movs r2, 0xA0 lsls r2, 1 adds r0, r2, 0 diff --git a/asm/battle_frontier_1.s b/asm/battle_frontier_1.s index e870c8798..4c44855f9 100755 --- a/asm/battle_frontier_1.s +++ b/asm/battle_frontier_1.s @@ -3161,9 +3161,9 @@ _0819044E: ldr r0, =gUnknown_0860CEB4 bl InitWindows bl DeactivateAllTextPrinters - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X strh r4, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r4, [r0] ldr r0, =gBattle_BG1_X strh r4, [r0] @@ -3171,7 +3171,7 @@ _0819044E: strh r4, [r0] ldr r0, =gBattle_BG3_X strh r4, [r0] - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y strh r4, [r0] mov r2, r9 cmp r2, 0x2 @@ -4366,10 +4366,10 @@ _08190E98: ldrsh r2, [r0, r5] cmp r2, 0 beq _08190ED4 - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r0, =gBattle_BG1_X strh r1, [r0] @@ -4379,9 +4379,9 @@ _08190E98: b _08190EE6 .pool _08190ED4: - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X strh r2, [r0] - ldr r1, =gUnknown_02022E16 + ldr r1, =gBattle_BG0_Y movs r0, 0xA0 strh r0, [r1] ldr r0, =gBattle_BG1_X @@ -4765,10 +4765,10 @@ _08191234: ldrsh r2, [r0, r5] cmp r2, 0 beq _08191278 - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r0, =gBattle_BG1_X strh r1, [r0] @@ -4779,9 +4779,9 @@ _08191234: b _0819128C .pool _08191278: - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X strh r2, [r0] - ldr r1, =gUnknown_02022E16 + ldr r1, =gBattle_BG0_Y ldr r3, =0x0000ff60 adds r0, r3, 0 strh r0, [r1] @@ -5157,10 +5157,10 @@ _081915CC: ldrsh r2, [r0, r5] cmp r2, 0 beq _0819160C - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r2, =gBattle_BG1_X movs r6, 0x80 @@ -5172,12 +5172,12 @@ _081915CC: b _08191622 .pool _0819160C: - ldr r1, =gUnknown_02022E14 + ldr r1, =gBattle_BG0_X movs r3, 0x80 lsls r3, 1 adds r0, r3, 0 strh r0, [r1] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r2, [r0] ldr r0, =gBattle_BG1_X strh r2, [r0] @@ -5457,10 +5457,10 @@ _0819187C: ldrsh r2, [r0, r5] cmp r2, 0 beq _081918BC - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r2, =gBattle_BG1_X movs r6, 0x80 @@ -5472,12 +5472,12 @@ _0819187C: b _081918D2 .pool _081918BC: - ldr r1, =gUnknown_02022E14 + ldr r1, =gBattle_BG0_X movs r3, 0x80 lsls r3, 1 adds r0, r3, 0 strh r0, [r1] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r2, [r0] ldr r0, =gBattle_BG1_X strh r2, [r0] @@ -5744,10 +5744,10 @@ _08191B08: ldrsh r2, [r0, r5] cmp r2, 0 beq _08191B48 - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r2, =gBattle_BG1_X movs r6, 0xFF @@ -5759,12 +5759,12 @@ _08191B08: b _08191B5E .pool _08191B48: - ldr r1, =gUnknown_02022E14 + ldr r1, =gBattle_BG0_X movs r3, 0xFF lsls r3, 8 adds r0, r3, 0 strh r0, [r1] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r2, [r0] ldr r0, =gBattle_BG1_X strh r2, [r0] @@ -6011,10 +6011,10 @@ _08191D68: ldrsh r2, [r0, r5] cmp r2, 0 beq _08191DA8 - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r2, =gBattle_BG1_X movs r6, 0xFF @@ -6026,12 +6026,12 @@ _08191D68: b _08191DBE .pool _08191DA8: - ldr r1, =gUnknown_02022E14 + ldr r1, =gBattle_BG0_X movs r3, 0xFF lsls r3, 8 adds r0, r3, 0 strh r0, [r1] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r2, [r0] ldr r0, =gBattle_BG1_X strh r2, [r0] @@ -6306,7 +6306,7 @@ _08191FF8: asrs r0, 16 cmp r0, 0x29 beq _08192100 - ldr r1, =gUnknown_02022E16 + ldr r1, =gBattle_BG0_Y ldrh r0, [r1] subs r0, 0x4 strh r0, [r1] @@ -6331,7 +6331,7 @@ _08192038: asrs r0, 16 cmp r0, 0x29 beq _08192100 - ldr r1, =gUnknown_02022E16 + ldr r1, =gBattle_BG0_Y ldrh r0, [r1] adds r0, 0x4 strh r0, [r1] @@ -6356,7 +6356,7 @@ _08192078: asrs r0, 16 cmp r0, 0x41 beq _08192100 - ldr r1, =gUnknown_02022E14 + ldr r1, =gBattle_BG0_X ldrh r0, [r1] subs r0, 0x4 strh r0, [r1] @@ -6385,7 +6385,7 @@ _081920BC: asrs r0, 16 cmp r0, 0x41 beq _08192100 - ldr r1, =gUnknown_02022E14 + ldr r1, =gBattle_BG0_X ldrh r0, [r1] adds r0, 0x4 strh r0, [r1] @@ -10400,9 +10400,9 @@ _0819427C: ldr r0, =gUnknown_0860CE94 bl InitWindows bl DeactivateAllTextPrinters - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X strh r4, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r4, [r0] ldr r0, =gBattle_BG1_X strh r4, [r0] @@ -11358,11 +11358,11 @@ sub_8194B70: @ 8194B70 movs r1, 0x80 movs r2, 0x2 bl ChangeBgY - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X ldrh r1, [r0] movs r0, 0x10 bl SetGpuReg - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y ldrh r1, [r0] movs r0, 0x12 bl SetGpuReg @@ -11486,11 +11486,11 @@ _08194CD4: thumb_func_start sub_8194CE4 sub_8194CE4: @ 8194CE4 push {lr} - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X ldrh r1, [r0] movs r0, 0x10 bl SetGpuReg - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y ldrh r1, [r0] movs r0, 0x12 bl SetGpuReg diff --git a/asm/battle_frontier_2.s b/asm/battle_frontier_2.s index 36898e456..3d3fba02b 100755 --- a/asm/battle_frontier_2.s +++ b/asm/battle_frontier_2.s @@ -20533,10 +20533,10 @@ _081A52A4: lsls r1, 1 movs r2, 0x20 bl LoadCompressedPalette - ldr r1, =gUnknown_02022E24 + ldr r1, =gBattle_WIN0H movs r0, 0xFF strh r0, [r1] - ldr r1, =gUnknown_02022E26 + ldr r1, =gBattle_WIN0V movs r0, 0x70 strh r0, [r1] b _081A553E diff --git a/asm/battle_interface.s b/asm/battle_interface.s index 31ad9a330..8bc9553f7 100755 --- a/asm/battle_interface.s +++ b/asm/battle_interface.s @@ -1317,7 +1317,7 @@ _08072D86: movs r2, 0x1 movs r3, 0x3 bl ConvertIntToDecimalStringN - ldr r0, =gBattleSpritesGfx + ldr r0, =gMonSpritesGfxPtr ldr r0, [r0] movs r1, 0xBA lsls r1, 1 @@ -1333,7 +1333,7 @@ _08072D86: lsls r0, 2 adds r5, r0, r1 _08072DB8: - ldr r0, =gBattleSpritesGfx + ldr r0, =gMonSpritesGfxPtr ldr r0, [r0] movs r1, 0xBA lsls r1, 1 @@ -1536,7 +1536,7 @@ _08072F52: ldr r1, =gText_Slash bl StringCopy _08072F82: - ldr r0, =gBattleSpritesGfx + ldr r0, =gMonSpritesGfxPtr ldr r0, [r0] movs r1, 0xBA lsls r1, 1 @@ -1556,7 +1556,7 @@ _08072F82: _08072FA6: cmp r4, 0x2 bhi _08072FF0 - ldr r0, =gBattleSpritesGfx + ldr r0, =gMonSpritesGfxPtr ldr r0, [r0] movs r2, 0xBA lsls r2, 1 @@ -1579,7 +1579,7 @@ _08072FA6: b _0807301A .pool _08072FF0: - ldr r0, =gBattleSpritesGfx + ldr r0, =gMonSpritesGfxPtr ldr r0, [r0] movs r1, 0xBA lsls r1, 1 @@ -1609,7 +1609,7 @@ _08073024: mov r3, r8 cmp r3, 0 bne _08073084 - ldr r0, =gBattleSpritesGfx + ldr r0, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r5, =gMonSpritesGfxPtr ldr r0, [r5] movs r2, 0xBA lsls r2, 1 diff --git a/asm/battle_setup.s b/asm/battle_setup.s index c2c762e96..fcc0de95b 100644 --- a/asm/battle_setup.s +++ b/asm/battle_setup.s @@ -41,7 +41,7 @@ _080B062E: cmp r0, 0x1 bne _080B0652 bl overworld_free_bg_tilemaps - ldr r0, =sub_8036760 + ldr r0, =CB2_InitBattle bl SetMainCallback2 bl prev_quest_postbuffer_cursor_backup_reset bl overworld_poison_timer_set @@ -638,8 +638,8 @@ _080B0BC6: .pool thumb_func_end sub_80B0B6C - thumb_func_start sub_80B0BD0 -sub_80B0BD0: @ 80B0BD0 + thumb_func_start BattleSetup_GetTerrainId +BattleSetup_GetTerrainId: @ 80B0BD0 push {r4,r5,lr} sub sp, 0x4 mov r4, sp @@ -798,7 +798,7 @@ _080B0D1A: pop {r4,r5} pop {r1} bx r1 - thumb_func_end sub_80B0BD0 + thumb_func_end BattleSetup_GetTerrainId thumb_func_start sub_80B0D24 sub_80B0D24: @ 80B0D24 @@ -1387,7 +1387,7 @@ sub_80B11A8: @ 80B11A8 ldr r0, =sub_80B1204 str r0, [r1, 0x8] bl FreeAllWindowBuffers - ldr r0, =sub_8036760 + ldr r0, =CB2_InitBattle bl SetMainCallback2 bl prev_quest_postbuffer_cursor_backup_reset bl overworld_poison_timer_set diff --git a/asm/battle_tower.s b/asm/battle_tower.s index 0782b8609..eb91121ae 100755 --- a/asm/battle_tower.s +++ b/asm/battle_tower.s @@ -3194,7 +3194,7 @@ sub_8163A8C: @ 8163A8C ldr r0, =gMain ldr r1, =sub_81639AC str r1, [r0, 0x8] - ldr r0, =sub_8036760 + ldr r0, =CB2_InitBattle bl SetMainCallback2 adds r0, r4, 0 bl DestroyTask @@ -5125,21 +5125,21 @@ _08164C18: lsrs r0, 24 mov r1, sp movs r2, 0x4 - bl link_0800A448 + bl SendBlock ldr r1, =gScriptResult movs r0, 0x1 b _08164DB4 .pool _08164C3C: - bl sub_800A550 + bl GetBlockReceivedStatus movs r1, 0x3 ands r1, r0 cmp r1, 0x3 beq _08164C4A b _08164DB6 _08164C4A: - bl sub_800A5B4 - ldr r1, =gUnknown_020223C4 + bl ResetBlockReceivedFlags + ldr r1, =gBlockRecvBuffer movs r0, 0x80 lsls r0, 1 adds r2, r1, r0 @@ -5221,23 +5221,23 @@ _08164CE0: ldr r3, =0x00000cb4 adds r1, r3 movs r2, 0x28 - bl link_0800A448 + bl SendBlock ldr r1, =gScriptResult movs r0, 0x3 b _08164DB4 .pool _08164D14: - bl sub_800A550 + bl GetBlockReceivedStatus movs r1, 0x3 ands r1, r0 cmp r1, 0x3 bne _08164DB6 - bl sub_800A5B4 + bl ResetBlockReceivedFlags ldr r4, =gSaveBlock2Ptr ldr r0, [r4] ldr r5, =0x00000cb4 adds r0, r5 - ldr r1, =gUnknown_020223C4 + ldr r1, =gBlockRecvBuffer movs r2, 0x28 bl memcpy ldr r2, =gTrainerBattleOpponent_A @@ -5260,7 +5260,7 @@ _08164D14: ldrh r0, [r4] movs r1, 0x1 bl sub_8162614 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _08164DB0 @@ -5279,7 +5279,7 @@ _08164D98: b _08164DB4 .pool _08164DA8: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _08164DB6 diff --git a/asm/battle_transition.s b/asm/battle_transition.s index 6406a3f24..a6e44f087 100644 --- a/asm/battle_transition.s +++ b/asm/battle_transition.s @@ -9513,11 +9513,11 @@ sub_814ABE4: @ 814ABE4 strh r0, [r6, 0xC] cmp r0, 0 bne _0814AC24 - ldr r5, =gUnknown_02022E14 + ldr r5, =gBattle_BG0_X ldrh r1, [r5] movs r0, 0x12 bl SetGpuReg - ldr r4, =gUnknown_02022E16 + ldr r4, =gBattle_BG0_Y ldrh r1, [r4] movs r0, 0x10 bl SetGpuReg @@ -9562,9 +9562,9 @@ sub_814AC38: @ 814AC38 movs r1, 0xF0 movs r2, 0x20 bl LoadPalette - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X strh r5, [r0] - ldr r4, =gUnknown_02022E16 + ldr r4, =gBattle_BG0_Y strh r5, [r4] movs r0, 0x12 movs r1, 0 @@ -9781,10 +9781,10 @@ sub_814AE40: @ 814AE40 push {r4,r5,lr} sub sp, 0x8 adds r5, r0, 0 - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r4, =gUnknown_02022E16 + ldr r4, =gBattle_BG0_Y strh r1, [r4] movs r0, 0x12 movs r1, 0 diff --git a/asm/berry_blender.s b/asm/berry_blender.s index 0599fa153..277a49d2f 100644 --- a/asm/berry_blender.s +++ b/asm/berry_blender.s @@ -512,7 +512,7 @@ _0807FBBE: adds r4, 0x1 cmp r4, 0x3 ble _0807FBBE - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _0807FC14 @@ -1116,7 +1116,7 @@ _08080126: adds r5, 0x1 cmp r5, 0x3 ble _08080126 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0808016A @@ -1213,7 +1213,7 @@ _08080248: bne _08080254 b _08080546 _08080254: - bl sub_800A5B4 + bl ResetBlockReceivedFlags bl GetMultiplayerId lsls r0, 24 cmp r0, 0 @@ -1239,7 +1239,7 @@ _08080282: movs r0, 0x4 movs r1, 0x1 bl sub_8197DF8 - bl sub_800A550 + bl GetBlockReceivedStatus adds r4, r0, 0 bl sub_800A9D8 lsls r4, 24 @@ -1260,7 +1260,7 @@ _080802AC: adds r0, r4, r0 adds r0, r6 lsls r1, r5, 8 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r1, r2 movs r2, 0x10 bl memcpy @@ -1280,7 +1280,7 @@ _080802D4: lsrs r0, 24 cmp r5, r0 blt _080802AC - bl sub_800A5B4 + bl ResetBlockReceivedFlags b _080804F8 .pool _080802EC: @@ -1876,7 +1876,7 @@ sub_80807BC: @ 80807BC sub sp, 0x1C movs r0, 0 mov r10, r0 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _080807DE @@ -3330,7 +3330,7 @@ sub_80814B0: @ 80814B0 lsrs r1, 16 lsls r2, 16 lsrs r2, 16 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _080814E4 @@ -3633,7 +3633,7 @@ sub_8081744: @ 8081744 push {r4-r6,lr} movs r4, 0 movs r6, 0 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _0808175A @@ -4702,7 +4702,7 @@ _08081F7C: sub_8081F94: @ 8081F94 push {lr} adds r1, r0, 0 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _08081FB8 @@ -4810,7 +4810,7 @@ _08082078: adds r1, 0x4C movs r0, 0 strh r0, [r1] - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _080820B0 @@ -4848,7 +4848,7 @@ _080820E0: bne _080820EC b _0808249E _080820EC: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _0808218C @@ -4911,7 +4911,7 @@ _08082132: adds r1, r4 movs r0, 0 movs r2, 0x20 - bl link_0800A448 + bl SendBlock lsls r0, 24 cmp r0, 0 bne _08082172 @@ -4941,7 +4941,7 @@ _0808218C: strh r2, [r0] movs r0, 0 movs r2, 0x28 - bl link_0800A448 + bl SendBlock lsls r0, 24 cmp r0, 0 bne _080821BE @@ -4951,20 +4951,20 @@ _080821BE: b _0808245C .pool _080821C8: - bl sub_800A550 + bl GetBlockReceivedStatus lsls r0, 24 cmp r0, 0 bne _080821D4 b _0808249E _080821D4: - bl sub_800A5B4 + bl ResetBlockReceivedFlags ldr r5, =gUnknown_020322A4 ldr r1, [r5] adds r1, 0x63 ldrb r0, [r1] adds r0, 0x1 strb r0, [r1] - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _08082254 @@ -4972,7 +4972,7 @@ _080821D4: ldrb r0, [r0] cmp r0, 0 beq _08082254 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer ldr r3, [r5] ldrh r0, [r2, 0x4] adds r1, r3, 0 @@ -5016,7 +5016,7 @@ _08082220: b _0808249E .pool _08082254: - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer ldr r0, =gUnknown_020322A4 ldr r3, [r0] ldrh r0, [r2, 0x4] @@ -5748,7 +5748,7 @@ _080828BC: strb r0, [r1] b _080828DC _080828C6: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r4, [r0] cmp r4, 0 bne _080828DC @@ -5966,7 +5966,7 @@ _08082A92: thumb_func_start sub_8082AD4 sub_8082AD4: @ 8082AD4 push {r4-r7,lr} - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _08082AE0 @@ -6242,7 +6242,7 @@ sub_8082D18: @ 8082D18 sub_8082D28: @ 8082D28 push {r4,lr} movs r1, 0 - ldr r4, =gUnknown_03003124 + ldr r4, =gReceivedRemoteLinkPlayers ldrb r0, [r4] cmp r0, 0 beq _08082D3C @@ -7909,7 +7909,7 @@ _08083A80: cmp r5, r0 bcc _08083A80 _08083A9E: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _08083AB4 @@ -8514,7 +8514,7 @@ sub_8083F94: @ 8083F94 strb r0, [r7, 0xC] movs r0, 0xFF strb r0, [r7] - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _080840C4 diff --git a/asm/cable_club.s b/asm/cable_club.s index 80d9a0916..d5d3af151 100644 --- a/asm/cable_club.s +++ b/asm/cable_club.s @@ -1030,7 +1030,7 @@ sub_80B2C30: @ 80B2C30 bl sub_80B24F8 cmp r0, 0x1 beq _080B2C9C - bl sub_800A550 + bl GetBlockReceivedStatus adds r4, r0, 0 bl sub_800A9A8 lsls r4, 24 @@ -1047,7 +1047,7 @@ _080B2C5C: ldr r1, =gUnknown_02039B58 adds r0, r1 lsls r1, r4, 8 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r1, r2 lsls r2, r4, 3 subs r2, r4 @@ -1066,7 +1066,7 @@ _080B2C7E: bcc _080B2C5C movs r0, 0 bl sub_800B330 - bl sub_800A5B4 + bl ResetBlockReceivedFlags ldr r0, =gScriptResult adds r1, r5, 0 bl task_map_chg_seq_0807EC34 @@ -1082,7 +1082,7 @@ sub_80B2CB0: @ 80B2CB0 push {r4,r5,lr} lsls r0, 24 lsrs r5, r0, 24 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _080B2CDE @@ -1434,7 +1434,7 @@ _080B2FA8: bl DestroyTask b _080B2FC6 _080B2FB4: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _080B2FC6 @@ -1706,7 +1706,7 @@ sub_80B3220: @ 80B3220 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0x1 bne _080B3248 @@ -1836,7 +1836,7 @@ _080B3338: bl sub_800AC34 b _080B3346 _080B333E: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] _080B3342: cmp r0, 0 @@ -1872,7 +1872,7 @@ _080B3378: lsls r2, 4 adds r0, r2, 0 strh r0, [r1] - ldr r0, =sub_8036760 + ldr r0, =CB2_InitBattle bl SetMainCallback2 ldr r1, =gMain ldr r0, =sub_80B360C @@ -1948,13 +1948,13 @@ _080B3444: ldr r1, =gUnknown_020229CC movs r0, 0 movs r2, 0x1C - bl link_0800A448 + bl SendBlock movs r0, 0x3 strh r0, [r6] b _080B3532 .pool _080B3458: - bl sub_800A550 + bl GetBlockReceivedStatus adds r4, r0, 0 bl sub_800A9D8 lsls r4, 24 @@ -1967,7 +1967,7 @@ _080B3458: .pool _080B3474: lsls r1, r4, 8 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r0, r5, 0 adds r1, r2 ldm r1!, {r2,r3,r7} @@ -2045,7 +2045,7 @@ _080B3504: lsls r3, 4 adds r0, r3, 0 strh r0, [r1] - ldr r0, =sub_8036760 + ldr r0, =CB2_InitBattle bl SetMainCallback2 ldr r1, =gMain ldr r0, =sub_80B360C @@ -2128,7 +2128,7 @@ _080B35C8: b _080B35FE .pool _080B35E0: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _080B35FE @@ -2425,7 +2425,7 @@ _080B3864: b _080B3884 .pool _080B3870: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _080B3884 @@ -2657,7 +2657,7 @@ task00_08081A90: @ 80B3A30 adds r0, r4, 0 bl DestroyTask _080B3A62: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _080B3AA6 @@ -2691,7 +2691,7 @@ sub_80B3AAC: @ 80B3AAC push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _080B3AC4 @@ -2804,7 +2804,7 @@ _080B3B96: strh r0, [r5] b _080B3BB8 _080B3B9E: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0x1 bne _080B3BB8 diff --git a/asm/contest.s b/asm/contest.s index 023c6ebef..b469dd8eb 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -45,10 +45,10 @@ sub_80D7678: @ 80D7678 lsls r1, 7 movs r0, 0 bl SetGpuRegBits - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r0, =gBattle_BG1_X strh r1, [r0] @@ -60,15 +60,15 @@ sub_80D7678: @ 80D7678 strh r1, [r0] ldr r0, =gBattle_BG3_X strh r1, [r0] - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y strh r1, [r0] - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H strh r1, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r1, [r0] - ldr r0, =gUnknown_02022E28 + ldr r0, =gBattle_WIN1H strh r1, [r0] - ldr r0, =gUnknown_02022E2A + ldr r0, =gBattle_WIN1V strh r1, [r0] pop {r4} pop {r0} @@ -546,8 +546,8 @@ _080D7B4E: ldr r0, =gUnknown_02039F38 strb r5, [r0] bl sub_80D7988 - bl init_uns_table_pokemon_copy - ldr r4, =gBattleSpritesGfx + bl AllocateMonSpritesGfx + ldr r4, =gMonSpritesGfxPtr ldr r0, [r4] ldr r0, [r0] bl Free @@ -1316,11 +1316,11 @@ _080D8266: thumb_func_start vblank_cb_battle vblank_cb_battle: @ 80D827C push {lr} - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X ldrh r1, [r0] movs r0, 0x10 bl SetGpuReg - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y ldrh r1, [r0] movs r0, 0x12 bl SetGpuReg @@ -1344,23 +1344,23 @@ vblank_cb_battle: @ 80D827C ldrh r1, [r0] movs r0, 0x1C bl SetGpuReg - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y ldrh r1, [r0] movs r0, 0x1E bl SetGpuReg - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H ldrh r1, [r0] movs r0, 0x40 bl SetGpuReg - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V ldrh r1, [r0] movs r0, 0x44 bl SetGpuReg - ldr r0, =gUnknown_02022E28 + ldr r0, =gBattle_WIN1H ldrh r1, [r0] movs r0, 0x42 bl SetGpuReg - ldr r0, =gUnknown_02022E2A + ldr r0, =gBattle_WIN1V ldrh r1, [r0] movs r0, 0x46 bl SetGpuReg @@ -1387,7 +1387,7 @@ sub_80D833C: @ 80D833C ldrsh r1, [r4, r0] cmp r1, 0 bne _080D840C - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r0, =gBattle_BG2_Y strh r1, [r0] @@ -1517,7 +1517,7 @@ sub_80D8490: @ 80D8490 lsls r0, 24 lsrs r0, 24 mov r9, r0 - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y movs r1, 0xA0 strh r1, [r0] ldr r0, =gBattle_BG2_Y @@ -1770,7 +1770,7 @@ _080D86E4: adds r0, r4, 0 movs r1, 0 bl sub_80DEC30 - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y movs r1, 0 strh r1, [r0] ldr r0, =gBattle_BG2_Y @@ -2041,7 +2041,7 @@ sub_80D895C: @ 80D895C lsls r0, 24 lsrs r7, r0, 24 bl sub_80DB89C - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y movs r1, 0 strh r1, [r0] ldr r0, =gBattle_BG2_Y @@ -5322,7 +5322,7 @@ sub_80DA5E8: @ 80DA5E8 push {r4,r5,lr} lsls r0, 24 lsrs r5, r0, 24 - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y movs r1, 0 strh r1, [r0] ldr r0, =gBattle_BG2_Y @@ -6741,7 +6741,7 @@ sub_80DB174: @ 80DB174 lsls r0, r5, 3 ldr r1, =gMonBackPicTable adds r0, r1 - ldr r1, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r1, [r1] ldr r1, [r1, 0x4] adds r2, r5, 0 @@ -8516,7 +8516,7 @@ _080DBF62: thumb_func_start sub_80DBF68 sub_80DBF68: @ 80DBF68 push {lr} - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y movs r1, 0 strh r1, [r0] ldr r0, =gBattle_BG2_Y diff --git a/asm/contest_link_80F57C4.s b/asm/contest_link_80F57C4.s index 8e2e2c61c..8a1bf00f1 100644 --- a/asm/contest_link_80F57C4.s +++ b/asm/contest_link_80F57C4.s @@ -92,10 +92,10 @@ _080F57E0: lsls r1, 8 movs r0, 0 bl SetGpuRegBits - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r0, =gBattle_BG1_X strh r1, [r0] @@ -107,15 +107,15 @@ _080F57E0: strh r1, [r0] ldr r0, =gBattle_BG3_X strh r1, [r0] - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y strh r1, [r0] - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H strh r1, [r0] - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V strh r1, [r0] - ldr r0, =gUnknown_02022E28 + ldr r0, =gBattle_WIN1H strh r1, [r0] - ldr r0, =gUnknown_02022E2A + ldr r0, =gBattle_WIN1V strh r1, [r0] pop {r4} pop {r0} @@ -387,10 +387,10 @@ sub_80F5B00: @ 80F5B00 strb r0, [r1, 0x2] ldr r0, =sub_80F5C00 bl SetMainCallback2 - ldr r1, =gUnknown_02022E28 + ldr r1, =gBattle_WIN1H movs r0, 0xF0 strh r0, [r1] - ldr r1, =gUnknown_02022E2A + ldr r1, =gBattle_WIN1V ldr r2, =0x000080a0 adds r0, r2, 0 strh r0, [r1] @@ -441,11 +441,11 @@ sub_80F5C00: @ 80F5C00 thumb_func_start sub_80F5C24 sub_80F5C24: @ 80F5C24 push {lr} - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X ldrh r1, [r0] movs r0, 0x10 bl SetGpuReg - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y ldrh r1, [r0] movs r0, 0x12 bl SetGpuReg @@ -469,23 +469,23 @@ sub_80F5C24: @ 80F5C24 ldrh r1, [r0] movs r0, 0x1C bl SetGpuReg - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y ldrh r1, [r0] movs r0, 0x1E bl SetGpuReg - ldr r0, =gUnknown_02022E24 + ldr r0, =gBattle_WIN0H ldrh r1, [r0] movs r0, 0x40 bl SetGpuReg - ldr r0, =gUnknown_02022E26 + ldr r0, =gBattle_WIN0V ldrh r1, [r0] movs r0, 0x44 bl SetGpuReg - ldr r0, =gUnknown_02022E28 + ldr r0, =gBattle_WIN1H ldrh r1, [r0] movs r0, 0x42 bl SetGpuReg - ldr r0, =gUnknown_02022E2A + ldr r0, =gBattle_WIN1V ldrh r1, [r0] movs r0, 0x46 bl SetGpuReg @@ -702,7 +702,7 @@ sub_80F5ED8: @ 80F5ED8 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _080F5EFC @@ -1347,10 +1347,10 @@ _080F643C: .4byte _080F6638 .4byte _080F667C _080F6454: - ldr r1, =gUnknown_02022E24 + ldr r1, =gBattle_WIN0H movs r0, 0xF0 strh r0, [r1] - ldr r1, =gUnknown_02022E26 + ldr r1, =gBattle_WIN0V ldr r3, =0x00005050 adds r0, r3, 0 strh r0, [r1] @@ -1364,7 +1364,7 @@ _080F6454: mov r9, r4 ldr r4, =gMonFrontPicTable mov r12, r4 - ldr r4, =gBattleSpritesGfx + ldr r4, =gMonSpritesGfxPtr mov r8, r4 cmp r0, 0 beq _080F648C @@ -1494,7 +1494,7 @@ _080F65A4: strh r0, [r4, 0xC] _080F65BA: ldrb r2, [r4, 0xC] - ldr r3, =gUnknown_02022E26 + ldr r3, =gBattle_WIN0V movs r0, 0x50 subs r0, r2 lsls r0, 8 @@ -1556,7 +1556,7 @@ _080F6638: ldrb r0, [r0, 0x6] cmp r0, 0x2 bne _080F669C - ldr r3, =gUnknown_02022E26 + ldr r3, =gBattle_WIN0V ldrh r0, [r3] lsrs r2, r0, 8 adds r0, r2, 0x2 @@ -1706,7 +1706,7 @@ sub_80F677C: @ 80F677C push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _080F67AC @@ -1842,7 +1842,7 @@ sub_80F68B4: @ 80F68B4 ldrh r3, [r2] adds r0, r3, 0x2 strh r0, [r2] - ldr r4, =gUnknown_02022E22 + ldr r4, =gBattle_BG3_Y ldrh r5, [r4] adds r1, r5, 0x1 strh r1, [r4] @@ -2870,10 +2870,10 @@ _080F70BE: adds r5, 0x1 cmp r5, 0x2 ble _080F70BE - ldr r1, =gUnknown_02022E24 + ldr r1, =gBattle_WIN0H movs r0, 0xF0 strh r0, [r1] - ldr r2, =gUnknown_02022E26 + ldr r2, =gBattle_WIN0V ldrh r1, [r4, 0x22] adds r0, r1, 0 subs r0, 0x10 @@ -2910,8 +2910,8 @@ sub_80F7144: @ 80F7144 orrs r0, r1 mov r1, r12 strb r0, [r1] - ldr r7, =gUnknown_02022E24 - ldr r6, =gUnknown_02022E26 + ldr r7, =gBattle_WIN0H + ldr r6, =gBattle_WIN0V adds r5, r3, 0 movs r4, 0x4 adds r2, 0x2E @@ -4522,7 +4522,7 @@ sub_80F7DF4: @ 80F7DF4 bl AllocZeroed ldr r1, [r4] str r0, [r1, 0x1C] - bl init_uns_table_pokemon_copy + bl AllocateMonSpritesGfx pop {r4,r5} pop {r0} bx r0 @@ -5633,7 +5633,7 @@ sub_80F87B4: @ 80F87B4 push {lr} lsls r0, 24 lsrs r1, r0, 24 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _080F87D0 diff --git a/asm/contest_link_80FC4F4.s b/asm/contest_link_80FC4F4.s index 0d6116766..ad22946c5 100644 --- a/asm/contest_link_80FC4F4.s +++ b/asm/contest_link_80FC4F4.s @@ -21,7 +21,7 @@ sub_80FC4F4: @ 80FC4F4 lsrs r0, 24 adds r1, r5, 0 adds r2, r4, 0 - bl link_0800A448 + bl SendBlock lsls r0, 24 cmp r0, 0 bne _080FC528 @@ -45,7 +45,7 @@ sub_80FC530: @ 80FC530 lsls r4, 17 lsls r4, r5 lsrs r4, 24 - bl sub_800A550 + bl GetBlockReceivedStatus ands r4, r0 cmp r4, 0 beq _080FC552 @@ -64,7 +64,7 @@ _080FC554: thumb_func_start sub_80FC55C sub_80FC55C: @ 80FC55C push {r4,lr} - bl sub_800A550 + bl GetBlockReceivedStatus adds r4, r0, 0 bl sub_800A9D8 lsls r4, 24 @@ -74,7 +74,7 @@ sub_80FC55C: @ 80FC55C movs r0, 0 b _080FC57A _080FC574: - bl sub_800A5B4 + bl ResetBlockReceivedFlags movs r0, 0x1 _080FC57A: pop {r4} @@ -90,7 +90,7 @@ sub_80FC580: @ 80FC580 movs r1, 0 ldr r5, =gTasks ldr r6, =sub_80FC5C0 - ldr r4, =gUnknown_020223C4 + ldr r4, =gBlockRecvBuffer movs r3, 0xFF _080FC590: lsls r0, r1, 8 @@ -134,7 +134,7 @@ sub_80FC5DC: @ 80FC5DC push {r4-r7,lr} lsls r0, 24 lsrs r7, r0, 24 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _080FC650 @@ -324,7 +324,7 @@ _080FC770: ldr r0, =gUnknown_02039E00 adds r4, r0 lsls r1, r5, 8 - ldr r0, =gUnknown_020223C4 + ldr r0, =gBlockRecvBuffer adds r1, r0 adds r0, r4, 0 movs r2, 0x40 @@ -430,7 +430,7 @@ _080FC858: cmp r0, 0 beq _080FC880 ldr r0, =gRngValue - ldr r4, =gUnknown_020223C4 + ldr r4, =gBlockRecvBuffer adds r1, r4, 0 movs r2, 0x4 bl memcpy @@ -517,7 +517,7 @@ _080FC90C: ldrb r0, [r1] cmp r3, r0 bge _080FC93A - ldr r4, =gUnknown_020223C4 + ldr r4, =gBlockRecvBuffer adds r0, r7, 0x2 adds r2, r5, r0 movs r5, 0x80 @@ -690,7 +690,7 @@ _080FCA68: bge _080FCAA4 ldr r1, =gUnknown_02039F34 mov r8, r1 - ldr r4, =gUnknown_020223C4 + ldr r4, =gBlockRecvBuffer movs r3, 0 movs r7, 0x80 lsls r7, 1 @@ -784,7 +784,7 @@ _080FCB50: ldr r1, =gUnknown_02039F2B ldrb r1, [r1] lsls r1, 8 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r1, r2 movs r2, 0x8 b _080FCC50 @@ -827,7 +827,7 @@ _080FCBA4: ldr r1, =gUnknown_02039F2B ldrb r1, [r1] lsls r1, 8 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r1, r2 movs r2, 0x8 b _080FCC50 @@ -850,7 +850,7 @@ _080FCBE0: ldr r1, =gUnknown_02039F2B ldrb r1, [r1] lsls r1, 8 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r1, r2 movs r2, 0x8 b _080FCC50 @@ -885,7 +885,7 @@ _080FCC38: ldr r1, =gUnknown_02039F2B ldrb r1, [r1] lsls r1, 8 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r1, r2 movs r2, 0x4 _080FCC50: @@ -974,7 +974,7 @@ _080FCD10: ldr r1, =gUnknown_02039F2B ldrb r1, [r1] lsls r1, 8 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r1, r2 movs r2, 0x70 b _080FCE10 @@ -1021,7 +1021,7 @@ _080FCD6C: ldr r1, =gUnknown_02039F2B ldrb r1, [r1] lsls r1, 8 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r1, r2 movs r2, 0x14 b _080FCE10 @@ -1078,7 +1078,7 @@ _080FCE04: ldr r1, =gUnknown_02039F2B ldrb r1, [r1] lsls r1, 8 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r1, r2 movs r2, 0x4 _080FCE10: @@ -1169,7 +1169,7 @@ _080FCEC0: beq _080FCF2E mov r1, r8 mov r8, r9 - ldr r4, =gUnknown_020223C4 + ldr r4, =gBlockRecvBuffer adds r0, r7, 0 adds r0, 0xA adds r2, r5, r0 @@ -1278,7 +1278,7 @@ _080FCF9C: ldr r1, =gUnknown_02039F2B ldrb r1, [r1] lsls r1, 8 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r1, r2 movs r2, 0x8 bl memcpy @@ -1344,7 +1344,7 @@ _080FD02C: ldr r1, =gUnknown_02039F2B ldrb r1, [r1] lsls r1, 8 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r1, r2 movs r2, 0x4 bl memcpy diff --git a/asm/contest_link_81D9DE4.s b/asm/contest_link_81D9DE4.s index cec1c6e5d..3fd8f56f1 100755 --- a/asm/contest_link_81D9DE4.s +++ b/asm/contest_link_81D9DE4.s @@ -469,7 +469,7 @@ _081DA1EC: ldr r0, =gUnknown_02039E00 adds r4, r0 lsls r1, r5, 8 - ldr r0, =gUnknown_020223C4 + ldr r0, =gBlockRecvBuffer adds r1, r0 adds r0, r4, 0 movs r2, 0x40 @@ -554,7 +554,7 @@ _081DA2AC: cmp r0, 0 beq _081DA2D4 ldr r0, =gRngValue - ldr r4, =gUnknown_020223C4 + ldr r4, =gBlockRecvBuffer adds r1, r4, 0 movs r2, 0x4 bl memcpy @@ -641,7 +641,7 @@ _081DA35A: mov r0, r8 adds r0, 0xA adds r3, r5, r0 - ldr r4, =gUnknown_020223C4 + ldr r4, =gBlockRecvBuffer mov r2, sp movs r5, 0x80 lsls r5, 1 @@ -744,7 +744,7 @@ _081DA42A: mov r0, r8 adds r0, 0x2 adds r3, r5, r0 - ldr r4, =gUnknown_020223C4 + ldr r4, =gBlockRecvBuffer mov r2, sp movs r5, 0x80 lsls r5, 1 @@ -849,7 +849,7 @@ _081DA50C: lsls r0, r3, 6 ldr r5, =gUnknown_02039E00 adds r0, r5 - ldr r1, =gUnknown_020223C4 + ldr r1, =gBlockRecvBuffer movs r2, 0x4 subs r2, r3 lsls r2, 6 diff --git a/asm/contest_painting.s b/asm/contest_painting.s index 62359497c..03fa9b05a 100644 --- a/asm/contest_painting.s +++ b/asm/contest_painting.s @@ -110,7 +110,7 @@ _0812FE94: bl remove_some_task movs r0, 0 bl SetVBlankCallback - bl init_uns_table_pokemon_copy + bl AllocateMonSpritesGfx ldr r1, =gUnknown_030061C0 ldr r0, =gUnknown_02039F3C str r0, [r1] @@ -581,7 +581,7 @@ sub_81302E8: @ 81302E8 lsls r0, r5, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r4, =gBattleSpritesGfx + ldr r4, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r4, =gMonSpritesGfxPtr ldr r1, [r4] ldr r1, [r1, 0x4] ldr r2, [r6] diff --git a/asm/evolution_scene.s b/asm/evolution_scene.s index 5d0268173..0fa0c5eb3 100644 --- a/asm/evolution_scene.s +++ b/asm/evolution_scene.s @@ -165,10 +165,10 @@ evolution_cutscene: @ 813DA8C movs r1, 0 bl SetGpuReg bl ResetPaletteFade - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r2, 0 strh r2, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r2, [r0] ldr r0, =gBattle_BG1_X strh r2, [r0] @@ -183,14 +183,14 @@ evolution_cutscene: @ 813DA8C lsls r2, 1 adds r0, r2, 0 strh r0, [r1] - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y movs r1, 0 strh r1, [r0] ldr r1, =gBattleTerrain movs r0, 0x9 strb r0, [r1] bl c2_berry_program_update_menu - bl sub_8035AA4 + bl LoadBattleTextboxAndBackground bl ResetSpriteData bl remove_some_task bl ResetTasks @@ -202,7 +202,7 @@ evolution_cutscene: @ 813DA8C bl AllocZeroed ldr r1, =gUnknown_0203AB80 str r0, [r1] - bl init_uns_table_pokemon_copy + bl AllocateMonSpritesGfx adds r0, r4, 0 movs r1, 0x2 mov r2, sp @@ -235,7 +235,7 @@ evolution_cutscene: @ 813DA8C lsls r0, r5, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r2, =gBattleSpritesGfx + ldr r2, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r2, =gMonSpritesGfxPtr ldr r1, [r2] ldr r1, [r1, 0x10] mov r2, r10 @@ -460,9 +460,9 @@ sub_813DD7C: @ 813DD7C movs r1, 0 bl SetGpuReg bl ResetPaletteFade - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X strh r4, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r4, [r0] ldr r0, =gBattle_BG1_X strh r4, [r0] @@ -477,13 +477,13 @@ sub_813DD7C: @ 813DD7C lsls r2, 1 adds r0, r2, 0 strh r0, [r1] - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y strh r4, [r0] ldr r1, =gBattleTerrain movs r0, 0x9 strb r0, [r1] bl c2_berry_program_update_menu - bl sub_8035AA4 + bl LoadBattleTextboxAndBackground bl ResetSpriteData bl FreeAllSpritePalettes ldr r1, =gReservedSpritePaletteCount @@ -492,7 +492,7 @@ sub_813DD7C: @ 813DD7C lsls r0, r5, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r1, [r1] ldr r1, [r1, 0x10] adds r2, r5, 0 @@ -629,10 +629,10 @@ _0813DFE0: ldr r1, =gReservedSpritePaletteCount movs r0, 0x4 strb r0, [r1] - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r0, =gBattle_BG1_X strh r1, [r0] @@ -647,7 +647,7 @@ _0813DFE0: lsls r3, 1 adds r0, r3, 0 strh r0, [r2] - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y strh r1, [r0] b _0813E180 .pool @@ -697,7 +697,7 @@ _0813E0A8: lsls r0, r6, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r1, [r1] ldr r1, [r1, 0x8] adds r2, r5, 0 @@ -941,9 +941,9 @@ sub_813E1D4: @ 813E1D4 mov r1, sp ldrh r1, [r1, 0x14] strh r1, [r0, 0x1C] - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X strh r4, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r4, [r0] ldr r0, =gBattle_BG1_X strh r4, [r0] @@ -958,7 +958,7 @@ sub_813E1D4: @ 813E1D4 lsls r2, 1 adds r0, r2, 0 strh r0, [r1] - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y strh r4, [r0] ldr r2, =gTextFlags ldrb r0, [r2] @@ -3630,11 +3630,11 @@ nullsub_83: @ 813FCD8 thumb_func_start sub_813FCDC sub_813FCDC: @ 813FCDC push {lr} - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X ldrh r1, [r0] movs r0, 0x10 bl SetGpuReg - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y ldrh r1, [r0] movs r0, 0x12 bl SetGpuReg @@ -3658,7 +3658,7 @@ sub_813FCDC: @ 813FCDC ldrh r1, [r0] movs r0, 0x1C bl SetGpuReg - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y ldrh r1, [r0] movs r0, 0x1E bl SetGpuReg @@ -3674,11 +3674,11 @@ sub_813FCDC: @ 813FCDC thumb_func_start sub_813FD64 sub_813FD64: @ 813FD64 push {lr} - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X ldrh r1, [r0] movs r0, 0x10 bl SetGpuReg - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y ldrh r1, [r0] movs r0, 0x12 bl SetGpuReg @@ -3702,7 +3702,7 @@ sub_813FD64: @ 813FD64 ldrh r1, [r0] movs r0, 0x1C bl SetGpuReg - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y ldrh r1, [r0] movs r0, 0x1E bl SetGpuReg @@ -3871,7 +3871,7 @@ sub_813FEE8: @ 813FEE8 .pool _0813FF28: ldr r7, =gBattle_BG3_X - ldr r6, =gUnknown_02022E22 + ldr r6, =gBattle_BG3_Y _0813FF2C: lsls r4, r5, 2 adds r4, r5 diff --git a/asm/field_screen.s b/asm/field_screen.s index 0de68b86b..83fea2f44 100644 --- a/asm/field_screen.s +++ b/asm/field_screen.s @@ -9010,7 +9010,7 @@ _080AF9C8: strh r0, [r4] b _080AF9E8 _080AF9D0: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _080AF9E8 diff --git a/asm/link.s b/asm/link.s index d1c8d0542..038633758 100644 --- a/asm/link.s +++ b/asm/link.s @@ -402,7 +402,7 @@ sub_8009734: @ 8009734 strb r4, [r0] ldr r0, =gUnknown_030030F8 strb r4, [r0] - bl sub_800A5B4 + bl ResetBlockReceivedFlags bl sub_800A2E0 ldr r0, =gUnknown_03000D54 str r4, [r0] @@ -420,7 +420,7 @@ sub_8009734: @ 8009734 _080097A8: bl sub_800E700 _080097AC: - ldr r1, =gUnknown_03003124 + ldr r1, =gReceivedRemoteLinkPlayers movs r0, 0 strb r0, [r1] movs r1, 0 @@ -448,7 +448,7 @@ _080097BE: thumb_func_start sub_80097E8 sub_80097E8: @ 80097E8 push {r4,lr} - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers movs r4, 0 strb r4, [r0] ldr r0, =gLinkVSyncDisabled @@ -514,7 +514,7 @@ _08009868: lsrs r5, r0, 24 cmp r5, 0x3 bls _08009840 - bl sub_800A550 + bl GetBlockReceivedStatus lsls r0, 24 lsrs r7, r0, 24 cmp r7, 0xF @@ -532,7 +532,7 @@ _08009888: cmp r0, 0 beq _080098C4 lsls r0, r5, 8 - ldr r1, =gUnknown_020223C4 + ldr r1, =gBlockRecvBuffer adds r0, r1 lsls r4, r5, 1 adds r1, r4, r5 @@ -752,7 +752,7 @@ _08009A78: blt _08009A70 cmp r5, 0 bne _08009A94 - ldr r1, =gUnknown_03003124 + ldr r1, =gReceivedRemoteLinkPlayers ldrb r0, [r1] cmp r0, 0 bne _08009A94 @@ -952,7 +952,7 @@ _08009C14: .pool _08009C40: movs r2, 0 - ldr r1, =gUnknown_020223C4 + ldr r1, =gBlockRecvBuffer mov r9, r1 adds r7, r3, 0 ldr r3, =gUnknown_03003090 @@ -996,7 +996,7 @@ _08009C70: cmp r0, 0x1 bne _08009D16 lsls r1, r6, 8 - ldr r0, =gUnknown_020223C4 + ldr r0, =gBlockRecvBuffer adds r1, r0 mov r8, r1 lsls r0, r6, 3 @@ -1080,7 +1080,7 @@ _08009D3E: adds r2, r3 ldrh r2, [r2] movs r0, 0 - bl link_0800A448 + bl SendBlock b _08009D6E .pool _08009D64: @@ -1321,7 +1321,7 @@ _08009F6A: thumb_func_start sub_8009F70 sub_8009F70: @ 8009F70 push {lr} - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0x1 bne _08009F80 @@ -1526,7 +1526,7 @@ sub_800A0C8: @ 800A0C8 adds r5, r0, 0 adds r6, r1, 0 movs r7, 0 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r4, [r0] cmp r4, 0x1 beq _0800A0DA @@ -2008,8 +2008,8 @@ bitmask_all_link_players_but_self: @ 800A490 bx r1 thumb_func_end bitmask_all_link_players_but_self - thumb_func_start link_0800A448 -link_0800A448: @ 800A4AC + thumb_func_start SendBlock +SendBlock: @ 800A4AC push {lr} adds r3, r1, 0 lsls r2, 16 @@ -2030,7 +2030,7 @@ _0800A4CE: lsrs r0, 24 pop {r1} bx r1 - thumb_func_end link_0800A448 + thumb_func_end SendBlock thumb_func_start sub_800A4D8 sub_800A4D8: @ 800A4D8 @@ -2095,8 +2095,8 @@ _0800A546: .pool thumb_func_end sub_800A520 - thumb_func_start sub_800A550 -sub_800A550: @ 800A550 + thumb_func_start GetBlockReceivedStatus +GetBlockReceivedStatus: @ 800A550 push {lr} ldr r0, =gLinkVSyncDisabled ldrb r0, [r0] @@ -2122,7 +2122,7 @@ _0800A580: lsrs r0, 24 pop {r1} bx r1 - thumb_func_end sub_800A550 + thumb_func_end GetBlockReceivedStatus thumb_func_start sub_800A588 sub_800A588: @ 800A588 @@ -2148,8 +2148,8 @@ _0800A5AC: .pool thumb_func_end sub_800A588 - thumb_func_start sub_800A5B4 -sub_800A5B4: @ 800A5B4 + thumb_func_start ResetBlockReceivedFlags +ResetBlockReceivedFlags: @ 800A5B4 push {r4,lr} ldr r0, =gLinkVSyncDisabled ldrb r0, [r0] @@ -2179,7 +2179,7 @@ _0800A5E2: pop {r0} bx r0 .pool - thumb_func_end sub_800A5B4 + thumb_func_end ResetBlockReceivedFlags thumb_func_start sub_800A5EC sub_800A5EC: @ 800A5EC @@ -2573,7 +2573,7 @@ task00_link_test: @ 800A850 movs r2, 0x2 movs r3, 0x2 bl sub_800A6E8 - bl sub_800A550 + bl GetBlockReceivedStatus lsls r0, 24 lsrs r0, 24 movs r1, 0xF @@ -3813,7 +3813,7 @@ sub_800B3A4: @ 800B3A4 lsls r0, 24 lsrs r0, 24 lsls r2, r0, 8 - ldr r1, =gUnknown_020223C4 + ldr r1, =gBlockRecvBuffer adds r4, r2, r1 lsls r2, r0, 3 subs r2, r0 @@ -3907,7 +3907,7 @@ _0800B482: thumb_func_start sub_800B488 sub_800B488: @ 800B488 push {lr} - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0800B498 @@ -3923,7 +3923,7 @@ _0800B498: thumb_func_start sub_800B4A4 sub_800B4A4: @ 800B4A4 push {lr} - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r1, [r0] cmp r1, 0 bne _0800B4B2 @@ -3938,7 +3938,7 @@ _0800B4B2: thumb_func_start sub_800B4C0 sub_800B4C0: @ 800B4C0 push {lr} - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r1, [r0] cmp r1, 0 bne _0800B4CE @@ -11500,7 +11500,7 @@ _0800F18C: cmp r4, 0 bne _0800F1A8 bl sub_800EDD4 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers strb r4, [r0] b _0800F1D2 .pool @@ -11976,7 +11976,7 @@ _0800F514: bl sub_8011A64 _0800F58C: bl rfu_clearAllSlot - ldr r1, =gUnknown_03003124 + ldr r1, =gReceivedRemoteLinkPlayers movs r0, 0 strb r0, [r1] ldr r0, =gUnknown_03005000 @@ -12224,7 +12224,7 @@ _0800F786: thumb_func_start rfu_func_080F97B8 rfu_func_080F97B8: @ 800F794 push {lr} - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _0800F7C6 @@ -12430,7 +12430,7 @@ _0800F90E: ldrb r0, [r4, 0xC] cmp r0, 0 bne _0800F920 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _0800F920 @@ -12536,7 +12536,7 @@ _0800F9EA: orrs r0, r3 str r0, [r1] movs r4, 0 - ldr r0, =gUnknown_020223C4 + ldr r0, =gBlockRecvBuffer mov r9, r0 mov r12, r2 mov r1, r8 @@ -12599,7 +12599,7 @@ _0800FA5C: beq _0800FA7E b _0800FC08 _0800FA7E: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0800FA88 @@ -12610,7 +12610,7 @@ _0800FA88: beq _0800FA90 b _0800FC08 _0800FA90: - ldr r0, =gUnknown_020223C4 + ldr r0, =gBlockRecvBuffer bl sub_8010A70 b _0800FC08 .pool @@ -12662,7 +12662,7 @@ _0800FB10: ldrb r2, [r7, 0xC] cmp r2, 0 bne _0800FB78 - ldr r3, =gUnknown_03003124 + ldr r3, =gReceivedRemoteLinkPlayers ldrb r0, [r3] mov r6, r8 adds r6, 0x1 @@ -13410,7 +13410,7 @@ sub_801011C: @ 801011C push {lr} bl rfu_clearAllSlot bl sub_800C048 - ldr r1, =gUnknown_03003124 + ldr r1, =gReceivedRemoteLinkPlayers movs r0, 0 strb r0, [r1] ldr r2, =gUnknown_03005000 @@ -14374,14 +14374,14 @@ _080108B6: bne _080108C2 b _080109D2 _080108C2: - bl sub_800A5B4 + bl ResetBlockReceivedFlags bl sub_800B348 b _08010948 _080108CC: ldrb r0, [r5, 0xC] cmp r0, 0x1 bne _0801090C - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _080108E8 @@ -14471,7 +14471,7 @@ _0801096E: _08010984: adds r0, r6, 0 bl DestroyTask - ldr r1, =gUnknown_03003124 + ldr r1, =gReceivedRemoteLinkPlayers movs r0, 0x1 strb r0, [r1] ldr r0, =0x00000ce8 @@ -14702,7 +14702,7 @@ _08010B6A: b _08010C52 .pool _08010B78: - bl sub_800A550 + bl GetBlockReceivedStatus lsls r0, 24 lsrs r0, 24 asrs r0, r4 @@ -14715,7 +14715,7 @@ _08010B8C: adds r0, r4, 0 bl sub_800A5EC lsls r2, r4, 8 - ldr r0, =gUnknown_020223C4 + ldr r0, =gBlockRecvBuffer adds r2, r0 ldr r1, =gLinkPlayers lsls r0, r4, 3 @@ -14799,7 +14799,7 @@ _08010C20: ldr r1, =gUnknown_020228C4 movs r0, 0 movs r2, 0xA0 - bl link_0800A448 + bl SendBlock lsls r0, 24 cmp r0, 0 beq _08010CF0 @@ -14833,7 +14833,7 @@ _08010C94: lsls r0, 24 cmp r0, 0 beq _08010CF0 - bl sub_800A550 + bl GetBlockReceivedStatus movs r1, 0x1 ands r1, r0 cmp r1, 0 @@ -14841,7 +14841,7 @@ _08010C94: mov r0, sp movs r4, 0 strh r4, [r0] - ldr r1, =gUnknown_020223C4 + ldr r1, =gBlockRecvBuffer ldr r2, =0x0100007e bl CpuSet movs r0, 0 @@ -14924,7 +14924,7 @@ _08010D56: ldr r1, =gUnknown_020228C4 movs r0, 0 movs r2, 0x3C - bl link_0800A448 + bl SendBlock b _08010D7A .pool _08010D70: @@ -14938,17 +14938,17 @@ _08010D7A: strh r0, [r4, 0x8] b _08010DA6 _08010D82: - bl sub_800A550 + bl GetBlockReceivedStatus movs r4, 0x1 adds r1, r4, 0 ands r1, r0 cmp r1, 0 beq _08010DA6 - ldr r0, =gUnknown_020223C4 + ldr r0, =gBlockRecvBuffer bl sub_8010A14 movs r0, 0 bl sub_800A5EC - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers strb r4, [r0] adds r0, r5, 0 bl DestroyTask @@ -15701,7 +15701,7 @@ _0801136C: bics r3, r2 adds r2, r3, 0 strb r2, [r1] - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0x1 bne _080113B0 @@ -15912,7 +15912,7 @@ _08011544: movs r1, 0x5 movs r2, 0x5 bl nullsub_5 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0x1 bne _080115DE @@ -16397,7 +16397,7 @@ _08011958: ldrb r0, [r2, 0xC] cmp r0, 0x1 bne _08011996 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0x1 bne _080119B4 @@ -16423,7 +16423,7 @@ _08011996: ldrb r0, [r0] cmp r0, 0x2 beq _080119B4 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0x1 bne _080119B4 @@ -17502,7 +17502,7 @@ sub_801229C: @ 801229C push {r4-r7,lr} mov r7, r8 push {r7} - bl sub_800A550 + bl GetBlockReceivedStatus lsls r0, 24 lsrs r0, 24 movs r1, 0x1C @@ -18913,7 +18913,7 @@ _08012F14: strb r0, [r6, 0xC] b _08012F50 _08012F22: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _08012F50 @@ -19861,7 +19861,7 @@ _080137A6: b _08013A86 .pool _080137C4: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _0801387A @@ -20806,11 +20806,11 @@ _08013FDE: adds r1, r0 movs r0, 0 movs r2, 0x64 - bl link_0800A448 + bl SendBlock b _080140BC .pool _08013FFC: - bl sub_800A550 + bl GetBlockReceivedStatus lsls r0, 24 lsrs r0, 24 cmp r0, 0x3 @@ -20822,13 +20822,13 @@ _08013FFC: eors r1, r2 lsls r1, 24 lsrs r1, 16 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r1, r2 movs r2, 0x64 bl memcpy movs r0, 0x32 bl IncrementGameStat - bl sub_800A5B4 + bl ResetBlockReceivedFlags b _0801405A .pool _08014038: @@ -20843,7 +20843,7 @@ _08014038: movs r0, 0 adds r1, r4, 0 movs r2, 0xDC - bl link_0800A448 + bl SendBlock lsls r0, 24 cmp r0, 0 beq _080140BC @@ -20854,7 +20854,7 @@ _0801405A: b _080140BC .pool _08014070: - bl sub_800A550 + bl GetBlockReceivedStatus lsls r0, 24 lsrs r0, 24 cmp r0, 0x3 @@ -20866,12 +20866,12 @@ _08014070: eors r1, r0 lsls r1, 24 lsrs r1, 16 - ldr r0, =gUnknown_020223C4 + ldr r0, =gBlockRecvBuffer adds r1, r0 adds r0, r4, 0 movs r2, 0xD8 bl memcpy - bl sub_800A5B4 + bl ResetBlockReceivedFlags ldr r1, =gUnknown_02032298 strb r7, [r1] movs r0, 0x6 @@ -20925,7 +20925,7 @@ _08014114: strh r0, [r4, 0x8] b _0801419E _0801411C: - bl sub_800A550 + bl GetBlockReceivedStatus adds r4, r0, 0 bl sub_800A9D8 lsls r4, 24 @@ -20938,7 +20938,7 @@ _0801411C: .pool _08014138: lsls r1, r4, 8 - ldr r0, =gUnknown_020223C4 + ldr r0, =gBlockRecvBuffer adds r3, r1, r0 movs r0, 0x64 muls r0, r4 @@ -20965,7 +20965,7 @@ _08014152: eors r0, r1 lsls r0, 24 lsrs r0, 16 - ldr r1, =gUnknown_020223C4 + ldr r1, =gBlockRecvBuffer adds r3, r0, r1 adds r0, r3, 0 adds r0, 0x60 @@ -20976,7 +20976,7 @@ _08014152: _08014190: bl sub_801B940 _08014194: - bl sub_800A5B4 + bl ResetBlockReceivedFlags adds r0, r6, 0 bl DestroyTask _0801419E: @@ -21665,7 +21665,7 @@ _08014854: movs r0, 0x4 strh r0, [r7] bl sub_800E3A8 - bl sub_800A5B4 + bl ResetBlockReceivedFlags b _080149B2 .pool _080148B8: @@ -21723,7 +21723,7 @@ _08014934: movs r0, 0 adds r1, r2, 0 movs r2, 0xE - bl link_0800A448 + bl SendBlock lsls r0, 24 cmp r0, 0 beq _080149B2 @@ -21731,13 +21731,13 @@ _08014934: strh r0, [r7] b _080149B2 _0801494A: - bl sub_800A550 + bl GetBlockReceivedStatus lsls r0, 24 lsrs r0, 24 cmp r0, 0x3 bne _080149B2 - bl sub_800A5B4 - ldr r0, =gUnknown_020223C4 + bl ResetBlockReceivedFlags + ldr r0, =gBlockRecvBuffer movs r2, 0x80 lsls r2, 1 adds r1, r0, r2 @@ -21766,7 +21766,7 @@ _08014992: strh r0, [r7] b _080149B2 _0801499C: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _080149B2 @@ -22316,7 +22316,7 @@ _08014E8C: strb r0, [r5, 0xC] b _08014EF2 _08014E92: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _08014EF2 @@ -22636,7 +22636,7 @@ _08015180: b _080152A0 .pool _080151A4: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _080151C2 @@ -23002,7 +23002,7 @@ _080154E0: b _08015604 .pool _08015504: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _08015522 @@ -23714,7 +23714,7 @@ _08015BB8: movs r0, 0x40 strb r0, [r1] _08015BBE: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _08015BCA @@ -23750,7 +23750,7 @@ _08015C24: movs r0, 0x5 bl _08016876 _08015C2A: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _08015C36 @@ -23785,7 +23785,7 @@ _08015C54: bne _08015C78 bl _08016878 _08015C78: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _08015C94 @@ -23918,7 +23918,7 @@ _08015DA6: bl _08016876 .pool _08015DD0: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _08015DF4 @@ -24212,7 +24212,7 @@ _08016084: movs r0, 0x1E bl sub_8015664 _08016092: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0801609E @@ -24241,7 +24241,7 @@ _080160C6: movs r0, 0x2 bl _08016876 _080160DA: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _080160E4 @@ -24452,7 +24452,7 @@ _080162D4: movs r0, 0x24 b _08016876 _080162DC: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r4, [r0] cmp r4, 0 beq _080162E6 @@ -30478,7 +30478,7 @@ _08019406: strb r0, [r5, 0x8] b _08019922 _0801940C: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _0801942C @@ -30646,7 +30646,7 @@ _0801956A: strb r0, [r5, 0x8] b _08019922 _08019574: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _0801957E @@ -30981,7 +30981,7 @@ _080197EE: strb r0, [r5, 0x8] b _08019922 _080197F8: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _08019810 @@ -31050,7 +31050,7 @@ _08019884: b _08019922 .pool _080198A0: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _08019922 @@ -33417,7 +33417,7 @@ _0801AB1E: lsls r2, 4 adds r1, r2, 0 strh r1, [r0] - ldr r0, =sub_8036760 + ldr r0, =CB2_InitBattle bl SetMainCallback2 pop {r4-r7} pop {r0} @@ -33741,7 +33741,7 @@ _0801AE7A: ldr r1, =gUnknown_020228C4 movs r0, 0 movs r2, 0x20 - bl link_0800A448 + bl SendBlock ldr r1, =gMain movs r2, 0x87 lsls r2, 3 @@ -33749,14 +33749,14 @@ _0801AE7A: b _0801AF8A .pool _0801AE98: - bl sub_800A550 + bl GetBlockReceivedStatus lsls r0, 24 lsrs r0, 24 cmp r0, 0x3 beq _0801AEA6 b _0801AFAE _0801AEA6: - ldr r1, =gUnknown_020223C4 + ldr r1, =gBlockRecvBuffer ldrh r0, [r1] cmp r0, 0x51 bne _0801AEE0 @@ -33782,7 +33782,7 @@ _0801AEA6: .pool _0801AEE0: bl sub_800AC34 - ldr r4, =gUnknown_020223C4 + ldr r4, =gBlockRecvBuffer bl GetMultiplayerId lsls r0, 24 lsrs r0, 16 @@ -33805,7 +33805,7 @@ _0801AF0C: movs r1, 0x8 _0801AF16: strb r1, [r0] - bl sub_800A5B4 + bl ResetBlockReceivedFlags b _0801AFAE .pool _0801AF24: @@ -33842,7 +33842,7 @@ _0801AF58: b _0801AFAE .pool _0801AF7C: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0801AFAE @@ -39072,7 +39072,7 @@ sub_801D938: @ 801D938 adds r3, r0, 0 adds r0, r1, 0 lsls r3, 8 - ldr r1, =gUnknown_020223C4 + ldr r1, =gBlockRecvBuffer adds r3, r1 adds r1, r3, 0 bl memcpy @@ -39085,7 +39085,7 @@ sub_801D938: @ 801D938 sub_801D954: @ 801D954 push {r4,lr} adds r4, r0, 0 - bl sub_800A550 + bl GetBlockReceivedStatus lsls r0, 24 lsrs r0, 24 asrs r0, r4 @@ -39273,7 +39273,7 @@ _0801DA7C: movs r0, 0 mov r1, sp movs r2, 0x8 - bl link_0800A448 + bl SendBlock b _0801DB3E .pool _0801DAC8: @@ -39300,7 +39300,7 @@ _0801DAC8: lsls r2, r0, 16 lsrs r2, 16 movs r0, 0 - bl link_0800A448 + bl SendBlock ldrh r0, [r4, 0x10] adds r0, 0x1 strh r0, [r4, 0x10] @@ -39310,7 +39310,7 @@ _0801DB08: adds r1, r3 movs r0, 0 movs r2, 0xFC - bl link_0800A448 + bl SendBlock ldrh r0, [r4, 0x10] adds r0, 0x1 strh r0, [r4, 0x10] @@ -39942,7 +39942,7 @@ _0801DFE0: adds r1, r0 movs r0, 0 movs r2, 0x28 - bl link_0800A448 + bl SendBlock lsls r0, 24 cmp r0, 0 beq _0801E028 @@ -40416,7 +40416,7 @@ _0801E3D4: adds r1, r0 movs r0, 0 movs r2, 0x28 - bl link_0800A448 + bl SendBlock lsls r0, 24 cmp r0, 0 beq _0801E414 @@ -40432,14 +40432,14 @@ _0801E410: _0801E412: strh r0, [r1, 0x6] _0801E414: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0801E458 b _0801E42C .pool _0801E424: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0801E438 @@ -40556,7 +40556,7 @@ _0801E50C: adds r1, r0 movs r0, 0 movs r2, 0x28 - bl link_0800A448 + bl SendBlock lsls r0, 24 cmp r0, 0 beq _0801E5BC @@ -40564,7 +40564,7 @@ _0801E50C: b _0801E59A .pool _0801E540: - bl sub_800A550 + bl GetBlockReceivedStatus movs r1, 0x1 ands r1, r0 cmp r1, 0 @@ -40599,7 +40599,7 @@ _0801E584: adds r0, 0x1 strh r0, [r1, 0xA] _0801E590: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0801E5BC @@ -40683,7 +40683,7 @@ _0801E62E: adds r0, 0x1 strh r0, [r1, 0xA] _0801E638: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0801E662 @@ -40798,7 +40798,7 @@ _0801E724: adds r0, 0x1 strh r0, [r1, 0xA] _0801E730: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0801E75C @@ -40849,7 +40849,7 @@ _0801E784: .4byte _0801E802 .4byte _0801E820 _0801E798: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0801E7AC @@ -40883,7 +40883,7 @@ _0801E7C0: adds r1, r0 movs r0, 0 movs r2, 0x28 - bl link_0800A448 + bl SendBlock lsls r0, 24 cmp r0, 0 beq _0801E830 @@ -42276,7 +42276,7 @@ _0801F2E0: .4byte _0801F494 .4byte _0801F438 _0801F300: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0801F30A @@ -42304,7 +42304,7 @@ _0801F30E: b _0801F4C4 .pool _0801F33C: - bl sub_800A550 + bl GetBlockReceivedStatus lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x6] @@ -42365,7 +42365,7 @@ _0801F3A2: movs r1, 0x2 ldrsh r0, [r4, r1] lsls r0, 8 - ldr r1, =gUnknown_020223C4 + ldr r1, =gBlockRecvBuffer adds r0, r1 ldrb r0, [r0] subs r0, 0x1 @@ -42406,7 +42406,7 @@ _0801F3F6: movs r2, 0x2 ldrsh r1, [r4, r2] lsls r1, 8 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r1, r2 bl sub_801EFF8 cmp r0, 0 @@ -45486,7 +45486,7 @@ sub_8020C70: @ 8020C70 adds r4, r0, 0 movs r0, 0 mov r8, r0 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _08020C8E @@ -49731,7 +49731,7 @@ _08022F7A: movs r0, 0 adds r1, r4, 0 movs r2, 0x2 - bl link_0800A448 + bl SendBlock b _08023060 _08022FAA: bl sub_800A520 @@ -49742,7 +49742,7 @@ _08022FAA: strh r0, [r5, 0x10] b _08023060 _08022FBA: - bl sub_800A550 + bl GetBlockReceivedStatus ldr r2, =gUnknown_082F4448 ldrb r4, [r5, 0x9] subs r1, r4, 0x2 @@ -49755,7 +49755,7 @@ _08022FBA: movs r3, 0 cmp r3, r4 bcs _0802301E - ldr r7, =gUnknown_020223C4 + ldr r7, =gBlockRecvBuffer movs r6, 0 ldr r4, =gUnknown_0858AB24 _08022FDC: @@ -49796,7 +49796,7 @@ _08022FF6: _0802301E: movs r0, 0 strh r0, [r5, 0x10] - bl sub_800A5B4 + bl ResetBlockReceivedFlags movs r1, 0x18 ldrsh r0, [r5, r1] lsls r0, 8 @@ -51445,7 +51445,7 @@ _08023D12: movs r0, 0 adds r1, r4, 0 movs r2, 0x2 - bl link_0800A448 + bl SendBlock b _0802402E _08023D2A: bl sub_800A520 @@ -51456,7 +51456,7 @@ _08023D2A: _08023D36: b _08024004 _08023D38: - bl sub_800A550 + bl GetBlockReceivedStatus ldr r2, =gUnknown_082F4448 ldrb r3, [r7, 0x9] subs r1, r3, 0x2 @@ -51474,7 +51474,7 @@ _08023D50: adds r4, 0x42 cmp r8, r3 bcs _08023D7E - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer _08023D5E: mov r3, r8 lsls r1, r3, 5 @@ -51496,7 +51496,7 @@ _08023D7E: movs r0, 0 strh r0, [r7, 0x10] strh r0, [r4] - bl sub_800A5B4 + bl ResetBlockReceivedFlags ldrb r0, [r7, 0x8] cmp r0, 0 bne _08023D9C @@ -51788,7 +51788,7 @@ _08023FC4: movs r0, 0 ldr r1, [sp, 0xC] movs r2, 0x30 - bl link_0800A448 + bl SendBlock b _0802402E _08023FD0: bl sub_800A520 @@ -51797,7 +51797,7 @@ _08023FD0: beq _08024034 b _08024004 _08023FDC: - bl sub_800A550 + bl GetBlockReceivedStatus lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -51808,11 +51808,11 @@ _08023FDC: movs r1, 0 movs r2, 0x30 bl memset - ldr r1, =gUnknown_020223C4 + ldr r1, =gBlockRecvBuffer adds r0, r4, 0 movs r2, 0x30 bl memcpy - bl sub_800A5B4 + bl ResetBlockReceivedFlags _08024004: movs r0, 0 strh r0, [r7, 0x10] @@ -52207,7 +52207,7 @@ _08024306: strh r5, [r0] movs r0, 0 movs r2, 0x2 - bl link_0800A448 + bl SendBlock b _080243AC _08024328: bl sub_800A520 @@ -52217,7 +52217,7 @@ _08024328: strh r5, [r4, 0x10] b _080243AC _08024336: - bl sub_800A550 + bl GetBlockReceivedStatus ldr r2, =gUnknown_082F4448 ldrb r3, [r4, 0x9] subs r1, r3, 0x2 @@ -52234,7 +52234,7 @@ _08024336: cmp r5, r3 bcs _08024374 adds r1, r6, 0 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer _0802435C: lsls r0, r5, 8 adds r0, r2 @@ -52264,7 +52264,7 @@ _08024390: movs r2, 0 bl sub_8022BEC _0802439A: - bl sub_800A5B4 + bl ResetBlockReceivedFlags movs r1, 0 movs r0, 0 strh r0, [r7] @@ -52485,7 +52485,7 @@ _08024528: bl sub_800AC34 b _08024558 _08024538: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0802455E @@ -53023,7 +53023,7 @@ sub_802493C: @ 802493C ldr r1, =gUnknown_03000DB0 movs r0, 0 str r0, [r1] - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _08024A10 @@ -53382,7 +53382,7 @@ _08024C5A: lsls r0, 24 cmp r0, 0 beq _08024D40 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _08024D20 @@ -53989,7 +53989,7 @@ _0802516C: thumb_func_start sub_8025170 sub_8025170: @ 8025170 push {r4,lr} - bl sub_800A550 + bl GetBlockReceivedStatus adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -54001,7 +54001,7 @@ sub_8025170: @ 8025170 movs r0, 0 b _08025192 _0802518C: - bl sub_800A5B4 + bl ResetBlockReceivedFlags movs r0, 0x1 _08025192: pop {r4} @@ -54031,7 +54031,7 @@ _080251BA: adds r1, 0x4A movs r0, 0 movs r2, 0x3C - bl link_0800A448 + bl SendBlock lsls r0, 24 cmp r0, 0 beq _08025226 @@ -54115,7 +54115,7 @@ _08025252: adds r1, r2, r1 movs r0, 0 movs r2, 0x3C - bl link_0800A448 + bl SendBlock lsls r0, 24 cmp r0, 0 beq _08025316 @@ -54139,7 +54139,7 @@ _08025282: _0802528E: ldr r0, [r5] adds r0, 0x4A - ldr r1, =gUnknown_020223C4 + ldr r1, =gBlockRecvBuffer movs r2, 0x3C bl memcpy ldr r1, [r5] @@ -54265,7 +54265,7 @@ _0802539C: strb r0, [r1] movs r0, 0 movs r2, 0x1 - bl link_0800A448 + bl SendBlock lsls r0, 24 cmp r0, 0 beq _08025466 @@ -54302,7 +54302,7 @@ _080253DC: adds r3, r1, 0 movs r5, 0x86 lsls r5, 1 - ldr r4, =gUnknown_020223C4 + ldr r4, =gBlockRecvBuffer _080253FA: ldr r1, [r3] adds r1, r2, r1 @@ -54452,7 +54452,7 @@ _0802553C: strb r0, [r1] movs r0, 0 movs r2, 0x1 - bl link_0800A448 + bl SendBlock lsls r0, 24 cmp r0, 0 beq _0802563C @@ -54486,7 +54486,7 @@ _08025578: adds r3, r1, 0 movs r5, 0x86 lsls r5, 1 - ldr r4, =gUnknown_020223C4 + ldr r4, =gBlockRecvBuffer _08025596: ldr r1, [r3] adds r1, r2, r1 @@ -54617,7 +54617,7 @@ _08025688: strb r0, [r1, 0x10] b _080256A0 _08025692: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _080256A0 @@ -54829,7 +54829,7 @@ _0802585C: bl sub_802903C ldr r0, [r4] bl sub_8024A30 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _08025882 @@ -54946,7 +54946,7 @@ _0802593E: adds r1, r0 movs r0, 0 movs r2, 0x1 - bl link_0800A448 + bl SendBlock lsls r0, 24 cmp r0, 0 beq _080259E8 @@ -54976,7 +54976,7 @@ _0802597E: cmp r2, r0 bcs _080259C4 adds r3, r1, 0 - ldr r5, =gUnknown_020223C4 + ldr r5, =gBlockRecvBuffer ldr r4, =0x0000318c _0802599A: ldr r0, [r3] @@ -58643,7 +58643,7 @@ sub_8027660: @ 8027660 push {lr} lsls r0, 24 lsrs r2, r0, 24 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0802768C @@ -64818,7 +64818,7 @@ sub_802A9A8: @ 802A9A8 adds r6, r1, 0 lsls r0, 16 lsrs r7, r0, 16 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _0802AA3C @@ -67232,7 +67232,7 @@ _0802BD02: b _0802BD24 .pool _0802BD14: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0802BD24 @@ -73081,7 +73081,7 @@ sub_802EAB0: @ 802EAB0 lsls r1, 3 ldr r0, =gTasks + 0x8 adds r4, r1, r0 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _0802EB14 diff --git a/asm/menu_helpers.s b/asm/menu_helpers.s index acc3065ea..423f653d9 100644 --- a/asm/menu_helpers.s +++ b/asm/menu_helpers.s @@ -533,7 +533,7 @@ sub_81221AC: @ 81221AC bl is_c1_link_related_active cmp r0, 0x1 beq _081221BE - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0x1 bne _081221C8 diff --git a/asm/mystery_event_menu.s b/asm/mystery_event_menu.s index 49de57848..df8e443a1 100644 --- a/asm/mystery_event_menu.s +++ b/asm/mystery_event_menu.s @@ -337,7 +337,7 @@ _08178C54: lsls r0, 24 cmp r0, 0 beq _08178D00 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _08178C68 @@ -435,13 +435,13 @@ _08178D28: _08178D36: b _08178E34 _08178D38: - bl sub_800A550 + bl GetBlockReceivedStatus lsls r0, 24 cmp r0, 0 bne _08178D44 b _08178E58 _08178D44: - bl sub_800A5B4 + bl ResetBlockReceivedFlags ldr r1, =gMain movs r2, 0x87 lsls r2, 3 @@ -462,7 +462,7 @@ _08178D60: b _08178E3C .pool _08178D74: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r6, [r0] cmp r6, 0 bne _08178E58 diff --git a/asm/pokeblock_feed.s b/asm/pokeblock_feed.s index d82c5df07..bc402d91c 100644 --- a/asm/pokeblock_feed.s +++ b/asm/pokeblock_feed.s @@ -95,7 +95,7 @@ _08179C48: bl FreeAllSpritePalettes b _08179D32 _08179C4E: - bl init_uns_table_pokemon_copy + bl AllocateMonSpritesGfx ldr r1, =gMain movs r2, 0x87 lsls r2, 3 @@ -322,7 +322,7 @@ _08179E48: lsls r0, r5, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r1, [r1] ldr r1, [r1, 0x8] adds r2, r5, 0 diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index 2ad67ba5a..bcc52c172 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -127,7 +127,7 @@ _081BF9EE: strb r1, [r0] movs r0, 0xFF bl sub_81C488C - ldr r0, =gBattleSpritesGfx + ldr r0, =gMonSpritesGfxPtr ldr r0, [r0] cmp r0, 0 bne _081BFA12 @@ -1284,7 +1284,7 @@ sub_81C0484: @ 81C0484 movs r2, 0x80 lsls r2, 1 bl m4aMPlayVolumeControl - ldr r0, =gBattleSpritesGfx + ldr r0, =gMonSpritesGfxPtr ldr r0, [r0] cmp r0, 0 bne _081C04E2 @@ -8807,7 +8807,7 @@ _081C4620: lsls r0, r2, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r1, [r1] ldr r1, [r1, 0x8] b _081C46D6 @@ -8817,12 +8817,12 @@ _081C4668: lsls r0, r2, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r1, [r1] b _081C46B0 .pool _081C4680: - ldr r0, =gBattleSpritesGfx + ldr r0, =gMonSpritesGfxPtr ldr r3, [r0] adds r4, r0, 0 cmp r3, 0 diff --git a/asm/pokenav.s b/asm/pokenav.s index fa0aaa9d0..0c7a80742 100755 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -28252,7 +28252,7 @@ _081D4FB6: lsls r0, 24 cmp r0, 0 beq _081D500C - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _081D4FE6 @@ -28280,7 +28280,7 @@ _081D4FEC: strb r0, [r4] b _081D500C _081D4FF8: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _081D500C @@ -28673,13 +28673,13 @@ _081D5374: bl sub_80097E8 b _081D53C0 _081D537A: - bl sub_800A550 + bl GetBlockReceivedStatus lsls r0, 24 cmp r0, 0 bne _081D5386 b _081D548A _081D5386: - bl sub_800A5B4 + bl ResetBlockReceivedFlags movs r0, 0xF strb r0, [r4, 0x8] b _081D548A @@ -28694,7 +28694,7 @@ _081D5390: b _081D548A .pool _081D53A8: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _081D548A diff --git a/asm/record_mixing.s b/asm/record_mixing.s index a62022cc7..aacc5baa0 100644 --- a/asm/record_mixing.s +++ b/asm/record_mixing.s @@ -849,7 +849,7 @@ _080E745A: strh r0, [r5, 0x20] b _080E7566 _080E7464: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _080E746E @@ -1066,7 +1066,7 @@ sub_80E7630: @ 80E7630 ldr r1, =gTasks adds r0, r1 mov r10, r0 - bl sub_800A550 + bl GetBlockReceivedStatus lsls r0, 24 lsrs r0, 24 str r0, [sp, 0x4] @@ -1302,7 +1302,7 @@ sub_80E7810: @ 80E7810 sub_80E7820: @ 80E7820 lsls r0, 24 lsrs r0, 16 - ldr r1, =gUnknown_020223C4 + ldr r1, =gBlockRecvBuffer adds r0, r1 bx lr .pool @@ -2368,7 +2368,7 @@ _080E807C: bl sub_800AC34 b _080E80F2 _080E8090: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _080E810A diff --git a/asm/recorded_battle.s b/asm/recorded_battle.s index c84b518c3..48325cfed 100644 --- a/asm/recorded_battle.s +++ b/asm/recorded_battle.s @@ -95,7 +95,7 @@ sub_8184E58: @ 8184E58 ldrb r0, [r0] cmp r0, 0x1 bne _08184EA0 - ldr r1, =gUnknown_0203BD2C + ldr r1, =gRecordedBattleRngSeed ldr r0, =gRngValue ldr r0, [r0] str r0, [r1] @@ -112,7 +112,7 @@ _08184EA0: cmp r0, 0x2 bne _08184EAC ldr r0, =gRngValue - ldr r1, =gUnknown_0203BD2C + ldr r1, =gRecordedBattleRngSeed ldr r1, [r1] str r1, [r0] _08184EAC: @@ -779,7 +779,7 @@ _081853BA: movs r4, 0x9D lsls r4, 3 adds r1, r7, r4 - ldr r5, =gUnknown_0203BD2C + ldr r5, =gRecordedBattleRngSeed ldr r0, [r5] str r0, [r1] ldr r0, =gUnknown_0203C7B8 @@ -1576,7 +1576,7 @@ sub_8185B1C: @ 8185B1C ldr r0, =gMain ldr r1, =sub_8185AB0 str r1, [r0, 0x8] - ldr r0, =sub_8036760 + ldr r0, =CB2_InitBattle bl SetMainCallback2 adds r0, r4, 0 bl DestroyTask @@ -1701,7 +1701,7 @@ _08185C2A: adds r6, 0x1 cmp r6, 0x3 ble _08185BBE - ldr r1, =gUnknown_0203BD2C + ldr r1, =gRecordedBattleRngSeed movs r3, 0x9D lsls r3, 3 adds r0, r7, r3 diff --git a/asm/reshow_battle_screen.s b/asm/reshow_battle_screen.s index 42ba43ec0..8bc97b45a 100644 --- a/asm/reshow_battle_screen.s +++ b/asm/reshow_battle_screen.s @@ -98,10 +98,10 @@ _080A93B0: movs r0, 0x3 bl ShowBg bl ResetPaletteFade - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X movs r1, 0 strh r1, [r0] - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y strh r1, [r0] ldr r0, =gBattle_BG1_X strh r1, [r0] @@ -113,7 +113,7 @@ _080A93B0: strh r1, [r0] ldr r0, =gBattle_BG3_X strh r1, [r0] - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y strh r1, [r0] b _080A95D2 .pool @@ -128,7 +128,7 @@ _080A942C: b _080A95D2 .pool _080A9444: - bl sub_8035AA4 + bl LoadBattleTextboxAndBackground b _080A95D2 _080A944A: bl ResetSpriteData @@ -275,7 +275,7 @@ _080A955C: ldrb r0, [r0] cmp r0, 0 beq _080A95D2 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _080A95D2 diff --git a/asm/rom3.s b/asm/rom3.s index 9bd95c252..23d320474 100644 --- a/asm/rom3.s +++ b/asm/rom3.s @@ -5,8 +5,8 @@ .text - thumb_func_start battle_wireless_setup_if_required_maybe -battle_wireless_setup_if_required_maybe: @ 8032654 + thumb_func_start HandleLinkBattleSetup +HandleLinkBattleSetup: @ 8032654 push {lr} ldr r0, =gBattleTypeFlags ldr r0, [r0] @@ -20,7 +20,7 @@ battle_wireless_setup_if_required_maybe: @ 8032654 beq _0803266E bl sub_800B488 _0803266E: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0803267A @@ -34,10 +34,10 @@ _08032686: pop {r0} bx r0 .pool - thumb_func_end battle_wireless_setup_if_required_maybe + thumb_func_end HandleLinkBattleSetup - thumb_func_start sub_803269C -sub_803269C: @ 803269C + thumb_func_start SetUpBattleVarsAndBirchZigzagoon +SetUpBattleVarsAndBirchZigzagoon: @ 803269C push {r4-r7,lr} sub sp, 0x14 ldr r0, =gBattleMainFunc @@ -71,7 +71,7 @@ _080326B8: adds r1, r0, 0 cmp r1, 0x3 ble _080326B8 - bl battle_wireless_setup_if_required_maybe + bl HandleLinkBattleSetup ldr r0, =gBattleExecBuffer movs r5, 0 str r5, [r0] @@ -112,7 +112,7 @@ _08032728: pop {r0} bx r0 .pool - thumb_func_end sub_803269C + thumb_func_end SetUpBattleVarsAndBirchZigzagoon thumb_func_start sub_8032768 sub_8032768: @ 8032768 @@ -1790,7 +1790,7 @@ _080335A0: ldr r1, [r5] adds r1, r2 adds r2, r6, 0 - bl link_0800A448 + bl SendBlock ldrh r0, [r4, 0x1E] adds r0, 0x1 strh r0, [r4, 0x1E] @@ -1857,7 +1857,7 @@ sub_8033648: @ 8033648 mov r6, r9 mov r5, r8 push {r5-r7} - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _08033738 @@ -1869,12 +1869,12 @@ sub_8033648: @ 8033648 beq _08033738 bl sub_8011BD0 movs r4, 0 - ldr r0, =gUnknown_020223C4 + ldr r0, =gBlockRecvBuffer mov r10, r0 b _0803372C .pool _08033680: - bl sub_800A550 + bl GetBlockReceivedStatus lsls r0, 24 lsrs r0, 24 ldr r2, =gBitTable @@ -1891,7 +1891,7 @@ _08033680: lsls r0, r4, 8 mov r4, r10 adds r3, r0, r4 - ldr r1, =gUnknown_020223C8 + ldr r1, =gBlockRecvBuffer + 4 adds r0, r1 ldrh r6, [r0] ldr r7, =gTasks diff --git a/asm/rom6.s b/asm/rom6.s index cd1421b4f..44cdaea65 100644 --- a/asm/rom6.s +++ b/asm/rom6.s @@ -11564,7 +11564,7 @@ sub_813B534: @ 813B534 str r0, [r2] movs r0, 0 str r0, [r1] - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0813B552 @@ -11651,11 +11651,11 @@ _0813B5FE: lsrs r0, 24 ldr r1, =gSpecialVar_0x8004 movs r2, 0x2 - bl link_0800A448 + bl SendBlock b _0813B708 .pool _0813B614: - bl sub_800A550 + bl GetBlockReceivedStatus movs r1, 0x2 ands r1, r0 cmp r1, 0 @@ -11669,7 +11669,7 @@ _0813B622: b _0813B790 _0813B62E: ldr r5, =gSpecialVar_0x8005 - ldr r0, =gUnknown_020223C4 + ldr r0, =gBlockRecvBuffer movs r1, 0x80 lsls r1, 1 adds r0, r1 @@ -11738,11 +11738,11 @@ _0813B6C2: lsrs r0, 24 ldr r1, =gScriptResult movs r2, 0x2 - bl link_0800A448 + bl SendBlock b _0813B708 .pool _0813B6E4: - bl sub_800A550 + bl GetBlockReceivedStatus movs r1, 0x1 ands r1, r0 cmp r1, 0 @@ -11752,7 +11752,7 @@ _0813B6E4: cmp r0, 0 beq _0813B790 ldr r1, =gScriptResult - ldr r0, =gUnknown_020223C4 + ldr r0, =gBlockRecvBuffer ldrh r0, [r0] strh r0, [r1] movs r0, 0 diff --git a/asm/rom_80A5C6C.s b/asm/rom_80A5C6C.s index 267045179..6135f81e0 100644 --- a/asm/rom_80A5C6C.s +++ b/asm/rom_80A5C6C.s @@ -5155,7 +5155,7 @@ sub_80A8394: @ 80A8394 bl AllocSpritePalette lsls r0, 24 lsrs r5, r0, 24 - ldr r4, =gBattleSpritesGfx + ldr r4, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r1, [r1] movs r3, 0xBE lsls r3, 1 @@ -5305,7 +5305,7 @@ _080A8524: mov r3, r8 bl LoadSpecialPokePic_2 _080A8540: - ldr r5, =gBattleSpritesGfx + ldr r5, =gMonSpritesGfxPtr ldr r0, [r5] movs r4, 0xBE lsls r4, 1 diff --git a/asm/script_pokemon_util_80F87D8.s b/asm/script_pokemon_util_80F87D8.s index e26194298..e5f69eeac 100644 --- a/asm/script_pokemon_util_80F87D8.s +++ b/asm/script_pokemon_util_80F87D8.s @@ -670,7 +670,7 @@ sub_80F8D28: @ 80F8D28 beq _080F8D44 b _080F8E9C _080F8D44: - bl init_uns_table_pokemon_copy + bl AllocateMonSpritesGfx movs r0, 0xA mov r9, r0 movs r1, 0x3 @@ -710,7 +710,7 @@ _080F8D44: lsls r0, r6, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r1, [r1] ldr r1, [r1, 0x8] adds r2, r6, 0 @@ -1093,7 +1093,7 @@ sub_80F90DC: @ 80F90DC ands r0, r1 cmp r0, 0 beq _080F90FE - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _080F90FE @@ -1116,7 +1116,7 @@ sub_80F910C: @ 80F910C ands r0, r1 cmp r0, 0 beq _080F9126 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _080F9126 diff --git a/asm/trade.s b/asm/trade.s index 8712567c7..42ed85948 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -18,7 +18,7 @@ sub_8077170: @ 8077170 lsrs r2, 16 movs r0, 0 adds r1, r4, 0 - bl link_0800A448 + bl SendBlock lsls r0, 24 lsrs r0, 24 b _080771A2 @@ -83,7 +83,7 @@ _080771F8: thumb_func_start sub_8077200 sub_8077200: @ 8077200 push {lr} - bl sub_800A550 + bl GetBlockReceivedStatus lsls r0, 24 lsrs r0, 24 pop {r1} @@ -103,7 +103,7 @@ sub_8077210: @ 8077210 b _08077230 .pool _0807722C: - bl sub_800A5B4 + bl ResetBlockReceivedFlags _08077230: pop {r0} bx r0 @@ -397,7 +397,7 @@ _080774B2: bl sub_807A19C movs r0, 0 bl ShowBg - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r2, [r0] cmp r2, 0 bne _0807754C @@ -504,7 +504,7 @@ _080775D8: b _08077B22 .pool _080775E8: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0x1 beq _080775F2 @@ -1832,7 +1832,7 @@ sub_80781C8: @ 80781C8 b _08078244 .pool _08078220: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r4, [r0] cmp r4, 0 bne _08078244 @@ -2198,7 +2198,7 @@ _08078552: adds r1, r5, 0 eors r1, r2 lsls r1, 8 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r1, r2 movs r2, 0xC8 bl sub_8078438 @@ -2237,7 +2237,7 @@ _080785B6: adds r1, r5, 0 eors r1, r2 lsls r1, 8 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r1, r2 movs r2, 0xC8 bl sub_8078438 @@ -2276,7 +2276,7 @@ _0807861A: adds r1, r5, 0 eors r1, r2 lsls r1, 8 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r1, r2 movs r2, 0xC8 bl sub_8078438 @@ -2318,7 +2318,7 @@ _0807868A: adds r1, r5, 0 eors r1, r2 lsls r1, 8 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r1, r2 movs r2, 0xD8 bl sub_8078438 @@ -2360,7 +2360,7 @@ _080786F0: adds r1, r5, 0 eors r1, r2 lsls r1, 8 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer adds r1, r2 movs r2, 0xB bl sub_8078438 @@ -2467,7 +2467,7 @@ sub_80787E0: @ 80787E0 ands r0, r2 cmp r0, 0 beq _08078864 - ldr r0, =gUnknown_020223C4 + ldr r0, =gBlockRecvBuffer ldrh r1, [r0] ldr r0, =0x0000bbbb cmp r1, r0 @@ -2521,7 +2521,7 @@ _08078864: ands r0, r2 cmp r0, 0 beq _080788F6 - ldr r3, =gUnknown_020223C4 + ldr r3, =gBlockRecvBuffer movs r1, 0x80 lsls r1, 1 adds r0, r3, r1 @@ -2597,7 +2597,7 @@ sub_8078900: @ 8078900 ands r0, r5 cmp r0, 0 beq _080789E2 - ldr r2, =gUnknown_020223C4 + ldr r2, =gBlockRecvBuffer ldrh r1, [r2] ldr r0, =0x0000ddee cmp r1, r0 @@ -4052,7 +4052,7 @@ sub_80794CC: @ 80794CC b _0807953A .pool _08079518: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0807953A @@ -6279,7 +6279,7 @@ _0807A718: thumb_func_start sub_807A728 sub_807A728: @ 807A728 push {r4-r7,lr} - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _0807A7B4 @@ -7054,7 +7054,7 @@ _0807ACC4: thumb_func_start sub_807ACDC sub_807ACDC: @ 807ACDC push {lr} - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0807ACF0 @@ -7128,7 +7128,7 @@ _0807AD58: lsls r0, r5, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r2, [r1] lsls r4, r6, 1 adds r1, r4, 0x1 @@ -7254,7 +7254,7 @@ _0807AE78: .4byte _0807B0D4 .4byte _0807B0F0 _0807AEAC: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _0807AEC0 @@ -7270,7 +7270,7 @@ _0807AEC0: adds r0, r5, 0 bl AllocZeroed str r0, [r4] - bl init_uns_table_pokemon_copy + bl AllocateMonSpritesGfx bl ResetTasks bl ResetSpriteData bl FreeAllSpritePalettes @@ -7321,7 +7321,7 @@ _0807AEC0: b _0807B116 .pool _0807AF58: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r5, [r0] cmp r5, 0 bne _0807AF90 @@ -7401,7 +7401,7 @@ _0807B000: b _0807B116 _0807B006: bl sub_807AC64 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0x1 beq _0807B014 @@ -7729,7 +7729,7 @@ _0807B2D0: adds r0, r5, 0 bl AllocZeroed str r0, [r4] - bl init_uns_table_pokemon_copy + bl AllocateMonSpritesGfx bl ResetTasks bl ResetSpriteData bl FreeAllSpritePalettes @@ -7989,7 +7989,7 @@ _0807B566: _0807B57C: mov r0, r9 bl sub_807B464 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _0807B58E @@ -8029,7 +8029,7 @@ _0807B5D0: ldr r1, [r4] adds r1, 0x74 movs r2, 0x14 - bl link_0800A448 + bl SendBlock ldr r1, [r4] adds r1, 0x93 ldrb r0, [r1] @@ -10369,7 +10369,7 @@ _0807CCEE: lsls r0, r2, 3 ldr r1, =gMonFrontPicTable adds r0, r1 - ldr r1, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr 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, =gBattleSpritesGfx + ldr r1, =gMonSpritesGfxPtr ldr r1, [r1] ldr r1, [r1, 0x10] ldr r3, [r3, 0x6C] @@ -12877,7 +12877,7 @@ _0807E4C2: sub_807E4DC: @ 807E4DC push {r4-r6,lr} bl sub_807ACDC - bl sub_800A550 + bl GetBlockReceivedStatus lsls r0, 24 lsrs r5, r0, 24 movs r6, 0x1 @@ -12885,7 +12885,7 @@ sub_807E4DC: @ 807E4DC ands r0, r6 cmp r0, 0 beq _0807E51A - ldr r4, =gUnknown_020223C4 + ldr r4, =gBlockRecvBuffer ldrh r1, [r4] ldr r0, =0x0000dcba cmp r1, r0 @@ -12909,7 +12909,7 @@ _0807E51A: ands r0, r5 cmp r0, 0 beq _0807E542 - ldr r0, =gUnknown_020223C4 + ldr r0, =gBlockRecvBuffer movs r1, 0x80 lsls r1, 1 adds r0, r1 @@ -13600,7 +13600,7 @@ _0807EAEC: ldr r1, [r4] adds r1, 0x74 movs r2, 0x14 - bl link_0800A448 + bl SendBlock ldr r0, [r4] adds r0, 0x72 movs r1, 0x2 @@ -14090,7 +14090,7 @@ _0807EFF0: b _0807F03A .pool _0807F028: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r1, [r0] cmp r1, 0 bne _0807F03A diff --git a/asm/trainer_card.s b/asm/trainer_card.s index 7552d7ace..bee1f4f7f 100644 --- a/asm/trainer_card.s +++ b/asm/trainer_card.s @@ -191,7 +191,7 @@ _080C2836: ldrb r0, [r0] cmp r0, 0x1 bne _080C2852 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0x1 bne _080C2852 @@ -261,7 +261,7 @@ _080C28D8: b _080C2ACA .pool _080C28E4: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r5, [r0] cmp r5, 0 bne _080C290A @@ -301,7 +301,7 @@ _080C293C: bne _080C2946 b _080C2ACA _080C2946: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _080C2960 @@ -346,7 +346,7 @@ _080C299C: ands r0, r1 cmp r0, 0 beq _080C29F4 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _080C29DC @@ -358,7 +358,7 @@ _080C299C: cmp r0, 0x1 beq _080C2A14 _080C29C0: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _080C29DC @@ -382,7 +382,7 @@ _080C29F4: ands r0, r1 cmp r0, 0 beq _080C2ACA - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _080C2A20 @@ -430,7 +430,7 @@ _080C2A2C: b _080C2ACA .pool _080C2A68: - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 bne _080C2ACA @@ -1403,7 +1403,7 @@ sub_80C3278: @ 80C3278 movs r0, 0x40 movs r1, 0xF0 bl SetGpuReg - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _080C32E0 @@ -4267,7 +4267,7 @@ _080C4BF6: ldrb r0, [r1, 0x4] adds r0, 0x1 strb r0, [r1, 0x4] - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0 beq _080C4B20 @@ -4745,7 +4745,7 @@ sub_80C4FF0: @ 80C4FF0 bl InUnionRoom cmp r0, 0x1 bne _080C5060 - ldr r0, =gUnknown_03003124 + ldr r0, =gReceivedRemoteLinkPlayers ldrb r0, [r0] cmp r0, 0x1 bne _080C5060 diff --git a/asm/unknown_task.s b/asm/unknown_task.s index 99a614e37..f6b96287e 100644 --- a/asm/unknown_task.s +++ b/asm/unknown_task.s @@ -267,11 +267,11 @@ _080BA1D8: .4byte _080BA250 .4byte _080BA24C _080BA214: - ldr r0, =gUnknown_02022E14 + ldr r0, =gBattle_BG0_X b _080BA24E .pool _080BA21C: - ldr r0, =gUnknown_02022E16 + ldr r0, =gBattle_BG0_Y b _080BA24E .pool _080BA224: @@ -295,7 +295,7 @@ _080BA244: b _080BA24E .pool _080BA24C: - ldr r0, =gUnknown_02022E22 + ldr r0, =gBattle_BG3_Y _080BA24E: ldrh r6, [r0] _080BA250: diff --git a/include/battle.h b/include/battle.h index 67d3d873d..72168aa60 100644 --- a/include/battle.h +++ b/include/battle.h @@ -55,6 +55,8 @@ #define BATTLE_TYPE_KYORGE 0x20000000 #define BATTLE_TYPE_RAYQUAZA 0x40000000 +#define TRAINER_OPPONENT_C00 0xC00 +#define TRAINER_OPPONENT_800 0x800 #define STEVEN_PARTNER_ID 0xC03 #define SECRET_BASE_OPPONENT 0x400 @@ -215,14 +217,17 @@ #define BATTLE_TERRAIN_POND 5 #define BATTLE_TERRAIN_ROCK 6 #define BATTLE_TERRAIN_CAVE 7 +#define BATTLE_TERRAIN_INSIDE 8 // array entries for battle communication -#define MULTIUSE_STATE 0x0 -#define CURSOR_POSITION 0x1 -#define TASK_ID 0x1 // task Id and cursor position share the same field -#define MOVE_EFFECT_BYTE 0x3 -#define MULTISTRING_CHOOSER 0x5 -#define MSG_DISPLAY 0x7 +#define MULTIUSE_STATE 0x0 +#define CURSOR_POSITION 0x1 +#define TASK_ID 0x1 // task Id and cursor position share the same field +#define SPRITES_INIT_STATE1 0x1 // shares the Id as well +#define SPRITES_INIT_STATE2 0x2 +#define MOVE_EFFECT_BYTE 0x3 +#define MULTISTRING_CHOOSER 0x5 +#define MSG_DISPLAY 0x7 #define MOVE_TARGET_SELECTED 0x0 #define MOVE_TARGET_DEPENDS 0x1 @@ -633,15 +638,13 @@ struct BattleStruct u8 field_A5; u8 field_A6; u8 field_A7; - u16 hpOnSwitchout[4]; + u16 hpOnSwitchout[2]; + u32 savedBattleTypeFlags; u8 field_B0; u8 hpScale; u8 synchronizeMoveEffect; u8 field_B3; - u8 field_B4; - u8 field_B5; - u8 field_B6; - u8 field_B7; + void (*savedCallback)(void); u16 usedHeldItems[BATTLE_BANKS_COUNT]; u8 field_C0[8]; u16 choicedMove[BATTLE_BANKS_COUNT]; @@ -654,7 +657,11 @@ struct BattleStruct u8 field_DF; u8 mirrorMoveArrays[32]; u16 castformPalette[4][16]; - u8 field_180[32]; + u8 field_180; + u8 field_181; + u8 field_182; + u8 field_183; + struct BattleEnigmaBerry battleEnigmaBerry; u8 field_1A0; u8 field_1A1; u8 filler1A2; @@ -842,13 +849,24 @@ struct BattleScripting u8 atk6C_state; u8 learnMoveState; u8 field_20; + u8 field_21; + u8 field_22; + u8 field_23; + u8 field_24; + u8 multiplayerId; }; extern struct BattleScripting gBattleScripting; // functions +// battle_1 +void LoadBattleTextboxAndBackground(void); +void LoadBattleEntryBackground(void); +void task00_0800F6FC(u8 taskId); + // battle_2 +void CB2_InitBattle(void); void CancelMultiTurnMoves(u8 bank); void PressurePPLose(u8 bankAtk, u8 bankDef, u16 move); void PrepareStringBattle(u16 stringId, u8 bank); @@ -914,13 +932,18 @@ extern void (* const gBattleScriptingCommandsTable[])(void); extern const u8 gUnknown_0831C494[]; // battle_5 +void AllocateBattleResrouces(void); void AdjustFriendshipOnBattleFaint(u8 bank); void sub_80571DC(u8 bank, u8 arg1); u32 sub_805725C(u8 bank); // battle 7 +void AllocateBattleSpritesData(void); void BattleMusicStop(void); void sub_805E990(struct Pokemon* mon, u8 bank); +void AllocateMonSpritesGfx(void); +void sub_805EF14(void); +bool8 BattleInitAllSprites(u8 *state1, u8 *state2); // rom_80A5C6C u8 GetBankSide(u8 bank); @@ -931,13 +954,13 @@ u8 GetBankByIdentity(u8 bank); #include "sprite.h" -struct BattleSpritesGfx +struct MonSpritesGfx { void* firstDecompressed; // ptr to the decompressed sprite of the first pokemon void* sprites[4]; struct SpriteTemplate templates[4]; }; -extern struct BattleSpritesGfx* gBattleSpritesGfx; +extern struct MonSpritesGfx* gMonSpritesGfxPtr; #endif // GUARD_BATTLE_H diff --git a/include/battle_setup.h b/include/battle_setup.h new file mode 100644 index 000000000..80fb55da2 --- /dev/null +++ b/include/battle_setup.h @@ -0,0 +1,6 @@ +#ifndef GUARD_BATTLE_SETUP_H +#define GUARD_BATTLE_SETUP_H + +u8 BattleSetup_GetTerrainId(void); + +#endif // GUARD_BATTLE_SETUP_H diff --git a/include/flags.h b/include/flags.h index 19ec01b56..020fc59cb 100644 --- a/include/flags.h +++ b/include/flags.h @@ -84,6 +84,8 @@ #define SYS_CTRL_OBJ_DELETE CODE_FLAGS + 0x61 #define SYS_RESET_RTC_ENABLE CODE_FLAGS + 0x62 +#define SYS_FRONTIER_PASS CODE_FLAGS + 0x72 + #define SYS_STORAGE_UNKNOWN_FLAG CODE_FLAGS + 0x77 #define SYS_MYSTERY_GIFT_ENABLE CODE_FLAGS + 0x7B diff --git a/include/global.berry.h b/include/global.berry.h index a77da20ba..5c8a43a02 100644 --- a/include/global.berry.h +++ b/include/global.berry.h @@ -1,9 +1,12 @@ #ifndef GUARD_GLOBAL_BERRY_H #define GUARD_GLOBAL_BERRY_H +#define BERRY_NAME_COUNT 7 +#define BERRY_ITEM_EFFECT_COUNT 18 + struct Berry { - const u8 name[7]; + const u8 name[BERRY_NAME_COUNT]; u8 firmness; u16 size; u8 maxYield; @@ -23,7 +26,7 @@ struct Berry struct Berry2 { - u8 name[7]; + u8 name[BERRY_NAME_COUNT]; u8 firmness; u16 size; u8 maxYield; @@ -42,7 +45,7 @@ struct Berry2 struct EnigmaBerry { struct Berry2 berry; - u8 itemEffect[18]; + u8 itemEffect[BERRY_ITEM_EFFECT_COUNT]; u8 holdEffect; u8 holdEffectParam; u32 checksum; @@ -50,9 +53,9 @@ struct EnigmaBerry struct BattleEnigmaBerry { - /*0x00*/ u8 name[7]; + /*0x00*/ u8 name[BERRY_NAME_COUNT]; /*0x07*/ u8 holdEffect; - /*0x08*/ u8 itemEffect[18]; + /*0x08*/ u8 itemEffect[BERRY_ITEM_EFFECT_COUNT]; /*0x1A*/ u8 holdEffectParam; }; diff --git a/include/global.h b/include/global.h index 4014c6dde..e0c09d29a 100644 --- a/include/global.h +++ b/include/global.h @@ -198,8 +198,13 @@ struct SaveBlock2 // All below could be a one giant struct /*0x64C*/ u8 field_64C[1629]; - /*0xCA9*/ u8 frontierChosenLvl : 2; - /*0xCA9*/ u8 field_CA9_a : 6; + /*0xCA9*/ u8 frontierChosenLvl : 2; // 0x1, 0x2 -> 0x3 + /*0xCA9*/ u8 field_CA9_a : 1; // 0x4 + /*0xCA9*/ u8 field_CA9_b : 1; // 0x8 + /*0xCA9*/ u8 field_CA9_c : 1; // 0x10 + /*0xCA9*/ u8 field_CA9_d : 1; // 0x20 + /*0xCA9*/ u8 field_CA9_e : 1; // 0x40 + /*0xCA9*/ u8 field_CA9_f : 1; // 0x80 /*0xCAA*/ u8 field_CAA[368]; /*0xE1A*/ u16 battlePyramidFloor; // possibly? /*0xE1C*/ u8 field_E1C[16]; diff --git a/include/link.h b/include/link.h index 5db3ff3d2..b719371da 100644 --- a/include/link.h +++ b/include/link.h @@ -143,7 +143,6 @@ extern u16 word_3002910[]; extern bool8 gReceivedRemoteLinkPlayers; void Task_DestroySelf(u8); -void sub_8007270(u8); void OpenLink(void); void CloseLink(void); u16 LinkMain2(u16 *); @@ -162,24 +161,12 @@ 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); @@ -191,4 +178,9 @@ void LinkVSync(void); void Timer3Intr(void); void SerialCB(void); +void sub_800E0E8(void); +bool8 sub_800A520(void); +bool8 sub_8010500(void); +void sub_800DFB4(u8, u8); + #endif // GUARD_LINK_H diff --git a/include/load_save.h b/include/load_save.h index 20848e1a7..1f406bbad 100644 --- a/include/load_save.h +++ b/include/load_save.h @@ -19,5 +19,6 @@ void LoadSerializedGame(void); void LoadPlayerBag(void); void SavePlayerBag(void); void SetSaveBlocksPointers(u16); +void MoveSaveBlocks_ResetHeap(void); #endif // GUARD_LOAD_SAVE_H diff --git a/include/pokemon.h b/include/pokemon.h index 20e904f39..5ebb9afb1 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -632,6 +632,7 @@ void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality); s32 sub_806D864(u16 a1); bool16 sub_806D82C(u8 id); u16 MonTryLearningNewMove(struct Pokemon* mon, bool8); +void sub_8068AA4(void); // sets stats for deoxys #include "sprite.h" diff --git a/include/recorded_battle.h b/include/recorded_battle.h index d19a2b713..407d0caf7 100644 --- a/include/recorded_battle.h +++ b/include/recorded_battle.h @@ -1,6 +1,11 @@ #ifndef GUARD_RECORDED_BATTLE_H #define GUARD_RECORDED_BATTLE_H +extern u32 gRecordedBattleRngSeed; + +void sub_8185F84(void); +void sub_8184E58(void); void RecordedBattle_SetBankAction(u8 bank, u8 action); +void sub_8185F90(u16 arg0); #endif // GUARD_RECORDED_BATTLE_H diff --git a/include/unknown_task.h b/include/unknown_task.h index f59ca9ac3..7457451a8 100644 --- a/include/unknown_task.h +++ b/include/unknown_task.h @@ -2,10 +2,20 @@ #define GUARD_unknown_task_H // Exported type declarations +struct UnknownTaskStruct +{ + volatile void *dest; + u32 control; + u8 unk8; + u8 unk9; +}; + +extern struct UnknownTaskStruct gUnknown_0831AC70; // Exported RAM declarations // Exported ROM declarations void remove_some_task(void); +void sub_80BA038(struct UnknownTaskStruct arg0); -#endif //GUARD_unknown_task_H +#endif // GUARD_unknown_task_H diff --git a/ld_script.txt b/ld_script.txt index c2f8af595..ac335b17c 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -57,6 +57,7 @@ SECTIONS { asm/rom3.o(.text); src/decompress.o(.text); asm/battle_1.o(.text); + src/battle_2.o(.text); asm/battle_2.o(.text); src/battle_3.o(.text); src/battle_script_commands.o(.text); diff --git a/src/battle_2.c b/src/battle_2.c new file mode 100644 index 000000000..844827326 --- /dev/null +++ b/src/battle_2.c @@ -0,0 +1,1343 @@ +#include "global.h" +#include "battle.h" +#include "recorded_battle.h" +#include "main.h" +#include "load_save.h" +#include "gpu_regs.h" +#include "unknown_task.h" +#include "battle_setup.h" +#include "pokemon.h" +#include "palette.h" +#include "task.h" +#include "event_data.h" +#include "species.h" +#include "berry.h" +#include "text.h" +#include "items.h" +#include "hold_effects.h" +#include "link.h" +#include "bg.h" +#include "dma3.h" +#include "string_util.h" +#include "malloc.h" + +struct UnknownStruct6 +{ + u16 unk0[0xA0]; + u8 fillerA0[0x640]; + u16 unk780[0xA0]; +}; + +struct UnknownPokemonStruct2 +{ + /*0x00*/ u16 species; + /*0x02*/ u16 heldItem; + /*0x04*/ u8 nickname[POKEMON_NAME_LENGTH + 1]; + /*0x0F*/ u8 level; + /*0x10*/ u16 hp; + /*0x12*/ u16 maxhp; + /*0x14*/ u32 status; + /*0x18*/ u32 personality; + /*0x1C*/ u8 gender; + /*0x1D*/ u8 language; +}; + +extern u32 gBattleTypeFlags; +extern u8 gBattleCommunication[]; +extern u8 gBattleTerrain; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u16 gBattle_BG1_X; +extern u16 gBattle_BG1_Y; +extern u16 gBattle_BG2_X; +extern u16 gBattle_BG2_Y; +extern u16 gBattle_BG3_X; +extern u16 gBattle_BG3_Y; +extern u16 gPartnerTrainerId; +extern u16 gBattle_WIN0H; +extern u16 gBattle_WIN0V; +extern u16 gBattle_WIN1H; +extern u16 gBattle_WIN1V; +extern u16 gTrainerBattleOpponent_A; +extern u16 gTrainerBattleOpponent_B; +extern struct BattleEnigmaBerry gEnigmaBerries[BATTLE_BANKS_COUNT]; +extern void (*gPreBattleCallback1)(void); +extern struct UnknownPokemonStruct2 gUnknown_02022FF8[3]; // what is it used for? +extern struct UnknownPokemonStruct2* gUnknown_02023058; // what is it used for? + +extern struct UnknownStruct6 gUnknown_02038C28; // todo: identify & document + +extern void HandleLinkBattleSetup(void); // rom_3 +extern void SetUpBattleVarsAndBirchZigzagoon(void); // rom_3 +extern void sub_8032768(void); // rom_3 +extern void dp12_8087EA4(void); +extern void c2_berry_program_update_menu(void); +extern void GetFrontierTrainerName(u8* dst, u16 trainerId); // battle tower +extern void sub_8166188(void); // battle tower, sets link battle mons level but why? +extern void sub_8165B88(u8* dst, u16 trainerId); // battle tower, gets language +extern void sub_81DB4DC(u8* dst, u8 arg2); // +extern void sub_81B9150(void); +extern void sub_800ADF8(void); +extern void sub_800AC34(void); + +// this file's functions +static void CB2_InitBattleInternal(void); +static void CB2_PreInitMultiBattle(void); +static void CB2_PreInitIngamePlayerPartnerBattle(void); +static void CB2_HandleStartMultiPartnerBattle(void); +static void CB2_HandleStartMultiBattle(void); +static void CB2_HandleStartBattle(void); +void shedinja_something(struct Pokemon *mon); +void CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum, bool8 firstTrainer); +void BattleMainCB1(void); + +void CB2_InitBattle(void) +{ + MoveSaveBlocks_ResetHeap(); + AllocateBattleResrouces(); + AllocateBattleSpritesData(); + AllocateMonSpritesGfx(); + sub_8185F84(); + + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + { + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) + { + CB2_InitBattleInternal(); + } + else if (!(gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)) + { + HandleLinkBattleSetup(); + SetMainCallback2(CB2_PreInitMultiBattle); + } + else + { + SetMainCallback2(CB2_PreInitIngamePlayerPartnerBattle); + } + gBattleCommunication[MULTIUSE_STATE] = 0; + } + else + { + CB2_InitBattleInternal(); + } +} + +static void CB2_InitBattleInternal(void) +{ + s32 i; + + SetHBlankCallback(NULL); + SetVBlankCallback(NULL); + + CpuFill32(0, (void *)VRAM, VRAM_SIZE); + + SetGpuReg(REG_OFFSET_MOSAIC, 0); + SetGpuReg(REG_OFFSET_WIN0H, 240); + SetGpuReg(REG_OFFSET_WIN0V, 0x5051); + SetGpuReg(REG_OFFSET_WININ, 0); + SetGpuReg(REG_OFFSET_WINOUT, 0); + + gBattle_WIN0H = 240; + + if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != STEVEN_PARTNER_ID) + { + gBattle_WIN0V = 159; + gBattle_WIN1H = 240; + gBattle_WIN1V = 32; + } + else + { + gBattle_WIN0V = 0x5051; + dp12_8087EA4(); + + for (i = 0; i < 80; i++) + { + gUnknown_02038C28.unk0[i] = 0xF0; + gUnknown_02038C28.unk780[i] = 0xF0; + } + for (i = 80; i < 160; i++) + { + #ifndef NONMATCHING + asm(""::"r"(i)); // needed to match + #endif // NONMATCHING + + gUnknown_02038C28.unk0[i] = 0xFF10; + gUnknown_02038C28.unk780[i] = 0xFF10; + } + + sub_80BA038(gUnknown_0831AC70); + } + + ResetPaletteFade(); + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + gBattle_BG2_X = 0; + gBattle_BG2_Y = 0; + gBattle_BG3_X = 0; + gBattle_BG3_Y = 0; + + gBattleTerrain = BattleSetup_GetTerrainId(); + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) + gBattleTerrain = BATTLE_TERRAIN_INSIDE; + + c2_berry_program_update_menu(); + LoadBattleTextboxAndBackground(); + ResetSpriteData(); + ResetTasks(); + LoadBattleEntryBackground(); + FreeAllSpritePalettes(); + gReservedSpritePaletteCount = 4; + SetVBlankCallback(VBlankCB_Battle); + SetUpBattleVarsAndBirchZigzagoon(); + + if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER) + SetMainCallback2(CB2_HandleStartMultiPartnerBattle); + else if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) + SetMainCallback2(CB2_HandleStartMultiPartnerBattle); + else if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + SetMainCallback2(CB2_HandleStartMultiBattle); + else + SetMainCallback2(CB2_HandleStartBattle); + + if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED))) + { + CreateNPCTrainerParty(&gEnemyParty[0], gTrainerBattleOpponent_A, TRUE); + if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) + CreateNPCTrainerParty(&gEnemyParty[3], gTrainerBattleOpponent_B, FALSE); + SetWildMonHeldItem(); + } + + gMain.inBattle = TRUE; + gSaveBlock2Ptr->field_CA9_b = 0; + + for (i = 0; i < 6; i++) + AdjustFriendship(&gPlayerParty[i], 3); + + gBattleCommunication[MULTIUSE_STATE] = 0; +} + +static void sub_8036A5C(void) +{ + u16 r6 = 0; + u16 species = 0; + u16 hp = 0; + u32 status = 0; + s32 i; + + for (i = 0; i < 6; i++) + { + species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); + hp = GetMonData(&gPlayerParty[i], MON_DATA_HP); + status = GetMonData(&gPlayerParty[i], MON_DATA_STATUS); + + if (species == SPECIES_NONE) + continue; + if (species != SPECIES_EGG && hp != 0 && status == 0) + r6 |= 1 << i * 2; + + if (species == SPECIES_NONE) + continue; + if (hp != 0 && (species == SPECIES_EGG || status != 0)) + r6 |= 2 << i * 2; + + if (species == SPECIES_NONE) + continue; + if (species != SPECIES_EGG && hp == 0) + r6 |= 3 << i * 2; + } + + gBattleStruct->field_182 = r6; + *(&gBattleStruct->field_183) = r6 >> 8; + gBattleStruct->field_183 |= FlagGet(SYS_FRONTIER_PASS) << 7; +} + +static void SetPlayerBerryDataInBattleStruct(void) +{ + s32 i; + struct BattleStruct *battleStruct = gBattleStruct; + struct BattleEnigmaBerry *battleBerry = &battleStruct->battleEnigmaBerry; + + if (IsEnigmaBerryValid() == TRUE) + { + for (i = 0; i < BERRY_NAME_COUNT - 1; i++) + battleBerry->name[i] = gSaveBlock1Ptr->enigmaBerry.berry.name[i]; + battleBerry->name[i] = EOS; + + for (i = 0; i < BERRY_ITEM_EFFECT_COUNT; i++) + battleBerry->itemEffect[i] = gSaveBlock1Ptr->enigmaBerry.itemEffect[i]; + + battleBerry->holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; + battleBerry->holdEffectParam = gSaveBlock1Ptr->enigmaBerry.holdEffectParam; + } + else + { + const struct Berry* berryData = GetBerryInfo(ItemIdToBerryType(ITEM_ENIGMA_BERRY)); + + for (i = 0; i < BERRY_NAME_COUNT - 1; i++) + battleBerry->name[i] = berryData->name[i]; + battleBerry->name[i] = EOS; + + for (i = 0; i < BERRY_ITEM_EFFECT_COUNT; i++) + battleBerry->itemEffect[i] = 0; + + battleBerry->holdEffect = HOLD_EFFECT_NONE; + battleBerry->holdEffectParam = 0; + } +} + +static void SetAllPlayersBerryData(void) +{ + s32 i; + s32 j; + + if (!(gBattleTypeFlags & BATTLE_TYPE_LINK)) + { + if (IsEnigmaBerryValid() == TRUE) + { + for (i = 0; i < BERRY_NAME_COUNT - 1; i++) + { + gEnigmaBerries[0].name[i] = gSaveBlock1Ptr->enigmaBerry.berry.name[i]; + gEnigmaBerries[2].name[i] = gSaveBlock1Ptr->enigmaBerry.berry.name[i]; + } + gEnigmaBerries[0].name[i] = EOS; + gEnigmaBerries[2].name[i] = EOS; + + for (i = 0; i < BERRY_ITEM_EFFECT_COUNT; i++) + { + gEnigmaBerries[0].itemEffect[i] = gSaveBlock1Ptr->enigmaBerry.itemEffect[i]; + gEnigmaBerries[2].itemEffect[i] = gSaveBlock1Ptr->enigmaBerry.itemEffect[i]; + } + + gEnigmaBerries[0].holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; + gEnigmaBerries[2].holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; + gEnigmaBerries[0].holdEffectParam = gSaveBlock1Ptr->enigmaBerry.holdEffectParam; + gEnigmaBerries[2].holdEffectParam = gSaveBlock1Ptr->enigmaBerry.holdEffectParam; + } + else + { + const struct Berry* berryData = GetBerryInfo(ItemIdToBerryType(ITEM_ENIGMA_BERRY)); + + for (i = 0; i < BERRY_NAME_COUNT - 1; i++) + { + gEnigmaBerries[0].name[i] = berryData->name[i]; + gEnigmaBerries[2].name[i] = berryData->name[i]; + } + gEnigmaBerries[0].name[i] = EOS; + gEnigmaBerries[2].name[i] = EOS; + + for (i = 0; i < BERRY_ITEM_EFFECT_COUNT; i++) + { + gEnigmaBerries[0].itemEffect[i] = 0; + gEnigmaBerries[2].itemEffect[i] = 0; + } + + gEnigmaBerries[0].holdEffect = 0; + gEnigmaBerries[2].holdEffect = 0; + gEnigmaBerries[0].holdEffectParam = 0; + gEnigmaBerries[2].holdEffectParam = 0; + } + } + else + { + s32 numPlayers; + struct BattleEnigmaBerry *src; + u8 r4; + + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + { + if (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER) + numPlayers = 2; + else + numPlayers = 4; + + for (i = 0; i < numPlayers; i++) + { + src = (struct BattleEnigmaBerry *)(gBlockRecvBuffer[i] + 2); + r4 = gLinkPlayers[i].lp_field_18; + + for (j = 0; j < BERRY_NAME_COUNT - 1; j++) + gEnigmaBerries[r4].name[j] = src->name[j]; + gEnigmaBerries[r4].name[j] = EOS; + + for (j = 0; j < BERRY_ITEM_EFFECT_COUNT; j++) + gEnigmaBerries[r4].itemEffect[j] = src->itemEffect[j]; + + gEnigmaBerries[r4].holdEffect = src->holdEffect; + gEnigmaBerries[r4].holdEffectParam = src->holdEffectParam; + } + } + else + { + for (i = 0; i < 2; i++) + { + src = (struct BattleEnigmaBerry *)(gBlockRecvBuffer[i] + 2); + + for (j = 0; j < BERRY_NAME_COUNT - 1; j++) + { + gEnigmaBerries[i].name[j] = src->name[j]; + gEnigmaBerries[i + 2].name[j] = src->name[j]; + } + gEnigmaBerries[i].name[j] = EOS; + gEnigmaBerries[i + 2].name[j] = EOS; + + for (j = 0; j < BERRY_ITEM_EFFECT_COUNT; j++) + { + gEnigmaBerries[i].itemEffect[j] = src->itemEffect[j]; + gEnigmaBerries[i + 2].itemEffect[j] = src->itemEffect[j]; + } + + gEnigmaBerries[i].holdEffect = src->holdEffect; + gEnigmaBerries[i + 2].holdEffect = src->holdEffect; + gEnigmaBerries[i].holdEffectParam = src->holdEffectParam; + gEnigmaBerries[i + 2].holdEffectParam = src->holdEffectParam; + } + } + } +} + +static void sub_8036EB8(u8 arg0, u8 arg1) +{ + u8 var = 0; + + if (gBlockRecvBuffer[0][0] == 256) + { + if (arg1 == 0) + gBattleTypeFlags |= BATTLE_TYPE_WILD | BATTLE_TYPE_TRAINER; + else + gBattleTypeFlags |= BATTLE_TYPE_TRAINER; + var++; + } + + if (var == 0) + { + s32 i; + + for (i = 0; i < arg0; i++) + { + if (gBlockRecvBuffer[0][0] != gBlockRecvBuffer[i][0]) + break; + } + + if (i == arg0) + { + if (arg1 == 0) + gBattleTypeFlags |= BATTLE_TYPE_WILD | BATTLE_TYPE_TRAINER; + else + gBattleTypeFlags |= BATTLE_TYPE_TRAINER; + var++; + } + + if (var == 0) + { + for (i = 0; i < arg0; i++) + { + if (gBlockRecvBuffer[i][0] == 0x300) + { + if (i != arg1 && i < arg1) + break; + } + if (gBlockRecvBuffer[i][0] > 0x300 && i != arg1) + break; + } + + if (i == arg0) + gBattleTypeFlags |= BATTLE_TYPE_WILD | BATTLE_TYPE_TRAINER; + else + gBattleTypeFlags |= BATTLE_TYPE_TRAINER; + } + } +} + +static void CB2_HandleStartBattle(void) +{ + u8 playerMultiplayerId; + u8 enemyMultiplayerId; + + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + + playerMultiplayerId = GetMultiplayerId(); + gBattleScripting.multiplayerId = playerMultiplayerId; + enemyMultiplayerId = playerMultiplayerId ^ BIT_SIDE; + + switch (gBattleCommunication[MULTIUSE_STATE]) + { + case 0: + if (!IsDma3ManagerBusyWithBgCopy()) + { + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + sub_805EF14(); + gBattleCommunication[MULTIUSE_STATE] = 1; + } + if (gLinkVSyncDisabled) + sub_800E0E8(); + break; + case 1: + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + if (gReceivedRemoteLinkPlayers != 0) + { + if (sub_800A520()) + { + *(&gBattleStruct->field_180) = 0; + *(&gBattleStruct->field_181) = 3; + sub_8036A5C(); + SetPlayerBerryDataInBattleStruct(); + + if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00) + { + gLinkPlayers[0].lp_field_18 = 0; + gLinkPlayers[1].lp_field_18 = 1; + } + + SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->field_180, 32); + gBattleCommunication[MULTIUSE_STATE] = 2; + } + if (gLinkVSyncDisabled) + sub_800DFB4(0, 0); + } + } + else + { + if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) + gBattleTypeFlags |= BATTLE_TYPE_WILD; + gBattleCommunication[MULTIUSE_STATE] = 15; + SetAllPlayersBerryData(); + } + break; + case 2: + if ((GetBlockReceivedStatus() & 3) == 3) + { + u8 taskId; + + ResetBlockReceivedFlags(); + sub_8036EB8(2, playerMultiplayerId); + SetAllPlayersBerryData(); + taskId = CreateTask(task00_0800F6FC, 0); + gTasks[taskId].data[1] = 0x10E; + gTasks[taskId].data[2] = 0x5A; + gTasks[taskId].data[5] = 0; + gTasks[taskId].data[3] = gBattleStruct->field_182 | (gBattleStruct->field_183 << 8); + gTasks[taskId].data[4] = gBlockRecvBuffer[enemyMultiplayerId][1]; + sub_8185F90(gBlockRecvBuffer[playerMultiplayerId][1]); + sub_8185F90(gBlockRecvBuffer[enemyMultiplayerId][1]); + sub_8068AA4(); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 3: + if (sub_800A520()) + { + SendBlock(bitmask_all_link_players_but_self(), gPlayerParty, sizeof(struct Pokemon) * 2); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 4: + if ((GetBlockReceivedStatus() & 3) == 3) + { + ResetBlockReceivedFlags(); + memcpy(gEnemyParty, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon) * 2); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 7: + if (sub_800A520()) + { + SendBlock(bitmask_all_link_players_but_self(), gPlayerParty + 2, sizeof(struct Pokemon) * 2); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 8: + if ((GetBlockReceivedStatus() & 3) == 3) + { + ResetBlockReceivedFlags(); + memcpy(gEnemyParty + 2, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon) * 2); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 11: + if (sub_800A520()) + { + SendBlock(bitmask_all_link_players_but_self(), gPlayerParty + 4, sizeof(struct Pokemon) * 2); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 12: + if ((GetBlockReceivedStatus() & 3) == 3) + { + ResetBlockReceivedFlags(); + memcpy(gEnemyParty + 4, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon) * 2); + shedinja_something(&gEnemyParty[0]); + shedinja_something(&gEnemyParty[1]); + shedinja_something(&gEnemyParty[2]); + shedinja_something(&gEnemyParty[3]); + shedinja_something(&gEnemyParty[4]); + shedinja_something(&gEnemyParty[5]); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 15: + sub_8032768(); + sub_8184E58(); + gBattleCommunication[SPRITES_INIT_STATE1] = 0; + gBattleCommunication[SPRITES_INIT_STATE2] = 0; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + s32 i; + + for (i = 0; i < 2 && (gLinkPlayers[i].version & 0xFF) == 3; i++); + + if (i == 2) + gBattleCommunication[MULTIUSE_STATE] = 16; + else + gBattleCommunication[MULTIUSE_STATE] = 18; + } + else + { + gBattleCommunication[MULTIUSE_STATE] = 18; + } + break; + case 16: + if (sub_800A520()) + { + SendBlock(bitmask_all_link_players_but_self(), &gRecordedBattleRngSeed, sizeof(gRecordedBattleRngSeed)); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 17: + if ((GetBlockReceivedStatus() & 3) == 3) + { + ResetBlockReceivedFlags(); + if (!(gBattleTypeFlags & BATTLE_TYPE_WILD)) + memcpy(&gRecordedBattleRngSeed, gBlockRecvBuffer[enemyMultiplayerId], sizeof(gRecordedBattleRngSeed)); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 18: + if (BattleInitAllSprites(&gBattleCommunication[SPRITES_INIT_STATE1], &gBattleCommunication[SPRITES_INIT_STATE2])) + { + gPreBattleCallback1 = gMain.callback1; + gMain.callback1 = BattleMainCB1; + SetMainCallback2(BattleMainCB2); + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + gBattleTypeFlags |= BATTLE_TYPE_20; + } + } + break; + case 5: + case 9: + case 13: + gBattleCommunication[MULTIUSE_STATE]++; + gBattleCommunication[1] = 1; + case 6: + case 10: + case 14: + if (--gBattleCommunication[1] == 0) + gBattleCommunication[MULTIUSE_STATE]++; + break; + } +} + +static void CB2_HandleStartMultiPartnerBattle(void) +{ + u8 playerMultiplayerId; + u8 enemyMultiplayerId; + + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + + playerMultiplayerId = GetMultiplayerId(); + gBattleScripting.multiplayerId = playerMultiplayerId; + enemyMultiplayerId = playerMultiplayerId ^ BIT_SIDE; + + switch (gBattleCommunication[MULTIUSE_STATE]) + { + case 0: + if (!IsDma3ManagerBusyWithBgCopy()) + { + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + sub_805EF14(); + gBattleCommunication[MULTIUSE_STATE] = 1; + } + if (gLinkVSyncDisabled) + sub_800E0E8(); + // fall through + case 1: + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + if (gReceivedRemoteLinkPlayers != 0) + { + u8 language; + + gLinkPlayers[0].lp_field_18 = 0; + gLinkPlayers[1].lp_field_18 = 2; + gLinkPlayers[2].lp_field_18 = 1; + gLinkPlayers[3].lp_field_18 = 3; + GetFrontierTrainerName(gLinkPlayers[2].name, gTrainerBattleOpponent_A); + GetFrontierTrainerName(gLinkPlayers[3].name, gTrainerBattleOpponent_B); + sub_8165B88(&language, gTrainerBattleOpponent_A); + gLinkPlayers[2].language = language; + sub_8165B88(&language, gTrainerBattleOpponent_B); + gLinkPlayers[3].language = language; + + if (sub_800A520()) + { + *(&gBattleStruct->field_180) = 0; + *(&gBattleStruct->field_181) = 3; + sub_8036A5C(); + SetPlayerBerryDataInBattleStruct(); + SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->field_180, 32); + gBattleCommunication[MULTIUSE_STATE] = 2; + } + + if (gLinkVSyncDisabled) + sub_800DFB4(0, 0); + } + } + else + { + if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) + gBattleTypeFlags |= BATTLE_TYPE_WILD; + gBattleCommunication[MULTIUSE_STATE] = 13; + SetAllPlayersBerryData(); + } + break; + case 2: + if ((GetBlockReceivedStatus() & 3) == 3) + { + u8 taskId; + + ResetBlockReceivedFlags(); + sub_8036EB8(2, playerMultiplayerId); + SetAllPlayersBerryData(); + taskId = CreateTask(task00_0800F6FC, 0); + gTasks[taskId].data[1] = 0x10E; + gTasks[taskId].data[2] = 0x5A; + gTasks[taskId].data[5] = 0; + gTasks[taskId].data[3] = 0x145; + gTasks[taskId].data[4] = 0x145; + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 3: + if (sub_800A520()) + { + SendBlock(bitmask_all_link_players_but_self(), gPlayerParty, sizeof(struct Pokemon) * 2); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 4: + if ((GetBlockReceivedStatus() & 3) == 3) + { + ResetBlockReceivedFlags(); + if (gLinkPlayers[playerMultiplayerId].lp_field_18 != 0) + { + memcpy(gPlayerParty, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon) * 2); + memcpy(gPlayerParty + 3, gBlockRecvBuffer[playerMultiplayerId], sizeof(struct Pokemon) * 2); + } + else + { + memcpy(gPlayerParty, gBlockRecvBuffer[playerMultiplayerId], sizeof(struct Pokemon) * 2); + memcpy(gPlayerParty + 3, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon) * 2); + } + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 5: + if (sub_800A520()) + { + SendBlock(bitmask_all_link_players_but_self(), gPlayerParty + 2, sizeof(struct Pokemon)); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 6: + if ((GetBlockReceivedStatus() & 3) == 3) + { + ResetBlockReceivedFlags(); + if (gLinkPlayers[playerMultiplayerId].lp_field_18 != 0) + { + memcpy(gPlayerParty + 2, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon)); + memcpy(gPlayerParty + 5, gBlockRecvBuffer[playerMultiplayerId], sizeof(struct Pokemon)); + } + else + { + memcpy(gPlayerParty + 2, gBlockRecvBuffer[playerMultiplayerId], sizeof(struct Pokemon)); + memcpy(gPlayerParty + 5, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon)); + } + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 7: + if (sub_800A520()) + { + SendBlock(bitmask_all_link_players_but_self(), gEnemyParty, sizeof(struct Pokemon) * 2); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 8: + if ((GetBlockReceivedStatus() & 3) == 3) + { + ResetBlockReceivedFlags(); + if (GetMultiplayerId() != 0) + { + memcpy(gEnemyParty, gBlockRecvBuffer[0], sizeof(struct Pokemon) * 2); + } + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 9: + if (sub_800A520()) + { + SendBlock(bitmask_all_link_players_but_self(), gEnemyParty + 2, sizeof(struct Pokemon) * 2); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 10: + if ((GetBlockReceivedStatus() & 3) == 3) + { + ResetBlockReceivedFlags(); + if (GetMultiplayerId() != 0) + { + memcpy(gEnemyParty + 2, gBlockRecvBuffer[0], sizeof(struct Pokemon) * 2); + } + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 11: + if (sub_800A520()) + { + SendBlock(bitmask_all_link_players_but_self(), gEnemyParty + 4, sizeof(struct Pokemon) * 2); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 12: + if ((GetBlockReceivedStatus() & 3) == 3) + { + ResetBlockReceivedFlags(); + if (GetMultiplayerId() != 0) + memcpy(gEnemyParty + 4, gBlockRecvBuffer[0], sizeof(struct Pokemon) * 2); + shedinja_something(&gPlayerParty[0]); + shedinja_something(&gPlayerParty[1]); + shedinja_something(&gPlayerParty[2]); + shedinja_something(&gPlayerParty[3]); + shedinja_something(&gPlayerParty[4]); + shedinja_something(&gPlayerParty[5]); + shedinja_something(&gEnemyParty[0]); + shedinja_something(&gEnemyParty[1]); + shedinja_something(&gEnemyParty[2]); + shedinja_something(&gEnemyParty[3]); + shedinja_something(&gEnemyParty[4]); + shedinja_something(&gEnemyParty[5]); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 13: + sub_8032768(); + sub_8184E58(); + gBattleCommunication[SPRITES_INIT_STATE1] = 0; + gBattleCommunication[SPRITES_INIT_STATE2] = 0; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + gBattleCommunication[MULTIUSE_STATE] = 14; + } + else + { + gBattleCommunication[MULTIUSE_STATE] = 16; + } + break; + case 14: + if (sub_800A520()) + { + SendBlock(bitmask_all_link_players_but_self(), &gRecordedBattleRngSeed, sizeof(gRecordedBattleRngSeed)); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 15: + if ((GetBlockReceivedStatus() & 3) == 3) + { + ResetBlockReceivedFlags(); + if (!(gBattleTypeFlags & BATTLE_TYPE_WILD)) + memcpy(&gRecordedBattleRngSeed, gBlockRecvBuffer[enemyMultiplayerId], sizeof(gRecordedBattleRngSeed)); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 16: + if (BattleInitAllSprites(&gBattleCommunication[SPRITES_INIT_STATE1], &gBattleCommunication[SPRITES_INIT_STATE2])) + { + sub_8166188(); + gPreBattleCallback1 = gMain.callback1; + gMain.callback1 = BattleMainCB1; + SetMainCallback2(BattleMainCB2); + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + gBattleTypeFlags |= BATTLE_TYPE_20; + } + } + break; + } +} + +static void sub_80379F8(u8 arrayIdPlus) +{ + s32 i; + + for (i = 0; i < 3; i++) + { + gUnknown_02022FF8[i].species = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_SPECIES); + gUnknown_02022FF8[i].heldItem = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_HELD_ITEM); + GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_NICKNAME, gUnknown_02022FF8[i].nickname); + gUnknown_02022FF8[i].level = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_LEVEL); + gUnknown_02022FF8[i].hp = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_HP); + gUnknown_02022FF8[i].maxhp = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_MAX_HP); + gUnknown_02022FF8[i].status = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_STATUS); + gUnknown_02022FF8[i].personality = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_PERSONALITY); + gUnknown_02022FF8[i].gender = GetMonGender(&gPlayerParty[arrayIdPlus + i]); + StripExtCtrlCodes(gUnknown_02022FF8[i].nickname); + if (GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_LANGUAGE) != LANGUAGE_JAPANESE) + sub_81DB4DC(gUnknown_02022FF8[i].nickname, 0); + } + memcpy(gUnknown_02023058, gUnknown_02022FF8, sizeof(gUnknown_02022FF8)); +} + +static void CB2_PreInitMultiBattle(void) +{ + s32 i; + u8 playerMultiplierId; + s32 numPlayers = 4; + u8 r4 = 0xF; + u32* savedBattleTypeFlags; + void (**savedCallback)(void); + + if (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER) + { + numPlayers = 2; + r4 = 3; + } + + playerMultiplierId = GetMultiplayerId(); + gBattleScripting.multiplayerId = playerMultiplierId; + savedCallback = &gBattleStruct->savedCallback; + savedBattleTypeFlags = &gBattleStruct->savedBattleTypeFlags; + + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + + switch (gBattleCommunication[MULTIUSE_STATE]) + { + case 0: + if (gReceivedRemoteLinkPlayers != 0 && sub_800A520()) + { + gUnknown_02023058 = Alloc(sizeof(struct UnknownPokemonStruct2) * 3); + sub_80379F8(0); + SendBlock(bitmask_all_link_players_but_self(), gUnknown_02023058, sizeof(struct UnknownPokemonStruct2) * 3); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 1: + if ((GetBlockReceivedStatus() & r4) == r4) + { + ResetBlockReceivedFlags(); + for (i = 0; i < numPlayers; i++) + { + if (i == playerMultiplierId) + continue; + + if (numPlayers == 4) + { + if ((!(gLinkPlayers[i].lp_field_18 & 1) && !(gLinkPlayers[playerMultiplierId].lp_field_18 & 1)) + || (gLinkPlayers[i].lp_field_18 & 1 && gLinkPlayers[playerMultiplierId].lp_field_18 & 1)) + { + memcpy(gUnknown_02022FF8, gBlockRecvBuffer[i], sizeof(struct UnknownPokemonStruct2) * 3); + } + } + else + { + memcpy(gUnknown_02022FF8, gBlockRecvBuffer[i], sizeof(struct UnknownPokemonStruct2) * 3); + } + } + gBattleCommunication[MULTIUSE_STATE]++; + *savedCallback = gMain.savedCallback; + *savedBattleTypeFlags = gBattleTypeFlags; + gMain.savedCallback = CB2_PreInitMultiBattle; + sub_81B9150(); + } + break; + case 2: + if (sub_800A520() && !gPaletteFade.active) + { + gBattleCommunication[MULTIUSE_STATE]++; + if (gLinkVSyncDisabled) + sub_800ADF8(); + else + sub_800AC34(); + } + break; + case 3: + if (gLinkVSyncDisabled) + { + if (sub_8010500()) + { + gBattleTypeFlags = *savedBattleTypeFlags; + gMain.savedCallback = *savedCallback; + SetMainCallback2(CB2_InitBattleInternal); + Free(gUnknown_02023058); + gUnknown_02023058 = NULL; + } + } + else if (gReceivedRemoteLinkPlayers == 0) + { + gBattleTypeFlags = *savedBattleTypeFlags; + gMain.savedCallback = *savedCallback; + SetMainCallback2(CB2_InitBattleInternal); + Free(gUnknown_02023058); + gUnknown_02023058 = NULL; + } + break; + } +} + +static void CB2_PreInitIngamePlayerPartnerBattle(void) +{ + u32* savedBattleTypeFlags; + void (**savedCallback)(void); + + savedCallback = &gBattleStruct->savedCallback; + savedBattleTypeFlags = &gBattleStruct->savedBattleTypeFlags; + + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + + switch (gBattleCommunication[MULTIUSE_STATE]) + { + case 0: + gUnknown_02023058 = Alloc(sizeof(struct UnknownPokemonStruct2) * 3); + sub_80379F8(3); + gBattleCommunication[MULTIUSE_STATE]++; + *savedCallback = gMain.savedCallback; + *savedBattleTypeFlags = gBattleTypeFlags; + gMain.savedCallback = CB2_PreInitIngamePlayerPartnerBattle; + sub_81B9150(); + break; + case 1: + if (!gPaletteFade.active) + { + gBattleCommunication[MULTIUSE_STATE] = 2; + gBattleTypeFlags = *savedBattleTypeFlags; + gMain.savedCallback = *savedCallback; + SetMainCallback2(CB2_InitBattleInternal); + Free(gUnknown_02023058); + gUnknown_02023058 = NULL; + } + break; + } +} + +static void CB2_HandleStartMultiBattle(void) +{ + u8 playerMultiplayerId; + s32 id; + u8 var; + + playerMultiplayerId = GetMultiplayerId(); + gBattleScripting.multiplayerId = playerMultiplayerId; + + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + + switch (gBattleCommunication[MULTIUSE_STATE]) + { + case 0: + if (!IsDma3ManagerBusyWithBgCopy()) + { + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + sub_805EF14(); + gBattleCommunication[MULTIUSE_STATE] = 1; + } + if (gLinkVSyncDisabled) + sub_800E0E8(); + break; + case 1: + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + if (gReceivedRemoteLinkPlayers != 0) + { + if (sub_800A520()) + { + *(&gBattleStruct->field_180) = 0; + *(&gBattleStruct->field_181) = 3; + sub_8036A5C(); + SetPlayerBerryDataInBattleStruct(); + + SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->field_180, 32); + gBattleCommunication[MULTIUSE_STATE]++; + } + if (gLinkVSyncDisabled) + sub_800DFB4(0, 0); + } + } + else + { + if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) + gBattleTypeFlags |= BATTLE_TYPE_WILD; + gBattleCommunication[MULTIUSE_STATE] = 7; + SetAllPlayersBerryData(); + } + break; + case 2: + if ((GetBlockReceivedStatus() & 0xF) == 0xF) + { + ResetBlockReceivedFlags(); + sub_8036EB8(4, playerMultiplayerId); + SetAllPlayersBerryData(); + sub_8068AA4(); + var = CreateTask(task00_0800F6FC, 0); + gTasks[var].data[1] = 0x10E; + gTasks[var].data[2] = 0x5A; + gTasks[var].data[5] = 0; + gTasks[var].data[3] = 0; + gTasks[var].data[4] = 0; + + for (id = 0; id < MAX_LINK_PLAYERS; id++) + { + sub_8185F90(gBlockRecvBuffer[id][1]); + switch (gLinkPlayers[id].lp_field_18) + { + case 0: + gTasks[var].data[3] |= gBlockRecvBuffer[id][1] & 0x3F; + break; + case 1: + gTasks[var].data[4] |= gBlockRecvBuffer[id][1] & 0x3F; + break; + case 2: + gTasks[var].data[3] |= (gBlockRecvBuffer[id][1] & 0x3F) << 6; + break; + case 3: + gTasks[var].data[4] |= (gBlockRecvBuffer[id][1] & 0x3F) << 6; + break; + } + } + ZeroEnemyPartyMons(); + gBattleCommunication[MULTIUSE_STATE]++; + } + else + break; + // fall through + case 3: + if (sub_800A520()) + { + SendBlock(bitmask_all_link_players_but_self(), gPlayerParty, sizeof(struct Pokemon) * 2); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 4: + if ((GetBlockReceivedStatus() & 0xF) == 0xF) + { + ResetBlockReceivedFlags(); + for (id = 0; id < MAX_LINK_PLAYERS; id++) + { + if (id == playerMultiplayerId) + { + switch (gLinkPlayers[id].lp_field_18) + { + case 0: + case 3: + memcpy(gPlayerParty, gBlockRecvBuffer[id], sizeof(struct Pokemon) * 2); + break; + case 1: + case 2: + memcpy(gPlayerParty + 3, gBlockRecvBuffer[id], sizeof(struct Pokemon) * 2); + break; + } + } + else + { + if ((!(gLinkPlayers[id].lp_field_18 & 1) && !(gLinkPlayers[playerMultiplayerId].lp_field_18 & 1)) + || ((gLinkPlayers[id].lp_field_18 & 1) && (gLinkPlayers[playerMultiplayerId].lp_field_18 & 1))) + { + switch (gLinkPlayers[id].lp_field_18) + { + case 0: + case 3: + memcpy(gPlayerParty, gBlockRecvBuffer[id], sizeof(struct Pokemon) * 2); + break; + case 1: + case 2: + memcpy(gPlayerParty + 3, gBlockRecvBuffer[id], sizeof(struct Pokemon) * 2); + break; + } + } + else + { + switch (gLinkPlayers[id].lp_field_18) + { + case 0: + case 3: + memcpy(gEnemyParty, gBlockRecvBuffer[id], sizeof(struct Pokemon) * 2); + break; + case 1: + case 2: + memcpy(gEnemyParty + 3, gBlockRecvBuffer[id], sizeof(struct Pokemon) * 2); + break; + } + } + } + } + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 5: + if (sub_800A520()) + { + SendBlock(bitmask_all_link_players_but_self(), gPlayerParty + 2, sizeof(struct Pokemon)); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 6: + if ((GetBlockReceivedStatus() & 0xF) == 0xF) + { + ResetBlockReceivedFlags(); + for (id = 0; id < MAX_LINK_PLAYERS; id++) + { + if (id == playerMultiplayerId) + { + switch (gLinkPlayers[id].lp_field_18) + { + case 0: + case 3: + memcpy(gPlayerParty + 2, gBlockRecvBuffer[id], sizeof(struct Pokemon)); + break; + case 1: + case 2: + memcpy(gPlayerParty + 5, gBlockRecvBuffer[id], sizeof(struct Pokemon)); + break; + } + } + else + { + if ((!(gLinkPlayers[id].lp_field_18 & 1) && !(gLinkPlayers[playerMultiplayerId].lp_field_18 & 1)) + || ((gLinkPlayers[id].lp_field_18 & 1) && (gLinkPlayers[playerMultiplayerId].lp_field_18 & 1))) + { + switch (gLinkPlayers[id].lp_field_18) + { + case 0: + case 3: + memcpy(gPlayerParty + 2, gBlockRecvBuffer[id], sizeof(struct Pokemon)); + break; + case 1: + case 2: + memcpy(gPlayerParty + 5, gBlockRecvBuffer[id], sizeof(struct Pokemon)); + break; + } + } + else + { + switch (gLinkPlayers[id].lp_field_18) + { + case 0: + case 3: + memcpy(gEnemyParty + 2, gBlockRecvBuffer[id], sizeof(struct Pokemon)); + break; + case 1: + case 2: + memcpy(gEnemyParty + 5, gBlockRecvBuffer[id], sizeof(struct Pokemon)); + break; + } + } + } + } + shedinja_something(&gPlayerParty[0]); + shedinja_something(&gPlayerParty[1]); + shedinja_something(&gPlayerParty[2]); + shedinja_something(&gPlayerParty[3]); + shedinja_something(&gPlayerParty[4]); + shedinja_something(&gPlayerParty[5]); + + shedinja_something(&gEnemyParty[0]); + shedinja_something(&gEnemyParty[1]); + shedinja_something(&gEnemyParty[2]); + shedinja_something(&gEnemyParty[3]); + shedinja_something(&gEnemyParty[4]); + shedinja_something(&gEnemyParty[5]); + + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 7: + sub_8032768(); + sub_8184E58(); + gBattleCommunication[SPRITES_INIT_STATE1] = 0; + gBattleCommunication[SPRITES_INIT_STATE2] = 0; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + for (id = 0; id < 4 && (gLinkPlayers[id].version & 0xFF) == 3; id++); + + if (id == 4) + gBattleCommunication[MULTIUSE_STATE] = 8; + else + gBattleCommunication[MULTIUSE_STATE] = 10; + } + else + { + gBattleCommunication[MULTIUSE_STATE] = 10; + } + break; + case 8: + if (sub_800A520()) + { + u32* ptr = (u32*)(&gBattleStruct->field_180); + ptr[0] = gBattleTypeFlags; + ptr[1] = gRecordedBattleRngSeed; // UB: overwrites berry data + SendBlock(bitmask_all_link_players_but_self(), ptr, 8); + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 9: + if ((GetBlockReceivedStatus() & 0xF) == 0xF) + { + ResetBlockReceivedFlags(); + for (var = 0; var < 4; var++) + { + u32 blockValue = gBlockRecvBuffer[var][0]; + if (blockValue & 4) + { + memcpy(&gRecordedBattleRngSeed, &gBlockRecvBuffer[var][2], sizeof(gRecordedBattleRngSeed)); + break; + } + } + + gBattleCommunication[MULTIUSE_STATE]++; + } + break; + case 10: + if (BattleInitAllSprites(&gBattleCommunication[SPRITES_INIT_STATE1], &gBattleCommunication[SPRITES_INIT_STATE2])) + { + gPreBattleCallback1 = gMain.callback1; + gMain.callback1 = BattleMainCB1; + SetMainCallback2(BattleMainCB2); + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + gTrainerBattleOpponent_A = TRAINER_OPPONENT_800; + gBattleTypeFlags |= BATTLE_TYPE_20; + } + } + break; + } +} + diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index e0cb3e941..3b719b8ed 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -146,7 +146,6 @@ extern u8 sav1_map_get_light_level(void); extern u8 sub_813B21C(void); extern u16 get_unknown_box_id(void); extern void c2_berry_program_update_menu(void); -extern void sub_8035AA4(void); // BattleScripts extern const u8 BattleScript_MoveEnd[]; @@ -11218,7 +11217,7 @@ static void atkF2_display_dex_info(void) break; case 3: c2_berry_program_update_menu(); - sub_8035AA4(); + LoadBattleTextboxAndBackground(); gBattle_BG3_X = 0x100; gBattleCommunication[0]++; break; diff --git a/src/egg_hatch.c b/src/egg_hatch.c index 6d14e92f0..c5cee6357 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -64,7 +64,7 @@ extern void sub_806A068(u16, u8); extern void fade_screen(u8, u8); extern void overworld_free_bg_tilemaps(void); extern void sub_80AF168(void); -extern void init_uns_table_pokemon_copy(void); +extern void AllocateMonSpritesGfx(void); extern void sub_805F094(void); extern void remove_some_task(void); extern void reset_temp_tile_data_buffers(void); @@ -439,7 +439,7 @@ static u8 EggHatchCreateMonSprite(u8 a0, u8 switchID, u8 pokeID, u16* speciesLoc u16 species = GetMonData(mon, MON_DATA_SPECIES); u32 pid = GetMonData(mon, MON_DATA_PERSONALITY); HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species], - gBattleSpritesGfx->sprites[(a0 * 2) + 1], + gMonSpritesGfxPtr->sprites[(a0 * 2) + 1], species, pid); LoadCompressedObjectPalette(sub_806E794(mon)); *speciesLoc = species; @@ -488,7 +488,7 @@ static void CB2_EggHatch_0(void) SetGpuReg(REG_OFFSET_DISPCNT, 0); sEggHatchData = Alloc(sizeof(struct EggHatchData)); - init_uns_table_pokemon_copy(); + AllocateMonSpritesGfx(); sEggHatchData->eggPartyID = gSpecialVar_0x8004; sEggHatchData->eggShardVelocityID = 0; diff --git a/src/pokemon_2.c b/src/pokemon_2.c index c5c36c793..8a16954a7 100644 --- a/src/pokemon_2.c +++ b/src/pokemon_2.c @@ -152,8 +152,8 @@ u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality) void sub_806A068(u16 species, u8 bankIdentity) { - if (gBattleSpritesGfx != NULL) - gUnknown_0202499C = gBattleSpritesGfx->templates[bankIdentity]; + if (gMonSpritesGfxPtr != NULL) + gUnknown_0202499C = gMonSpritesGfxPtr->templates[bankIdentity]; else if (gUnknown_020249B4[0]) gUnknown_0202499C = gUnknown_020249B4[0]->templates[bankIdentity]; else if (gUnknown_020249B4[1]) @@ -180,8 +180,8 @@ void sub_806A12C(u16 trainerSpriteId, u8 bankIdentity) } else { - if (gBattleSpritesGfx != NULL) - gUnknown_0202499C = gBattleSpritesGfx->templates[bankIdentity]; + if (gMonSpritesGfxPtr != NULL) + gUnknown_0202499C = gMonSpritesGfxPtr->templates[bankIdentity]; else gUnknown_0202499C = gUnknown_08329D98[bankIdentity]; gUnknown_0202499C.anims = gUnknown_0830536C[trainerSpriteId]; @@ -190,8 +190,8 @@ void sub_806A12C(u16 trainerSpriteId, u8 bankIdentity) void sub_806A1C0(u16 arg0, u8 bankIdentity) { - if (gBattleSpritesGfx != NULL) - gUnknown_0202499C = gBattleSpritesGfx->templates[bankIdentity]; + if (gMonSpritesGfxPtr != NULL) + gUnknown_0202499C = gMonSpritesGfxPtr->templates[bankIdentity]; else gUnknown_0202499C = gUnknown_08329D98[bankIdentity]; gUnknown_0202499C.paletteTag = arg0; diff --git a/src/pokemon_3.c b/src/pokemon_3.c index d44c0cb2f..e4934306c 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -486,8 +486,8 @@ u16 SpeciesToCryId(u16 species) void sub_806D544(u16 species, u32 personality, u8 *dest) { if (species == SPECIES_SPINDA - && dest != gBattleSpritesGfx->sprites[0] - && dest != gBattleSpritesGfx->sprites[2]) + && dest != gMonSpritesGfxPtr->sprites[0] + && dest != gMonSpritesGfxPtr->sprites[2]) { int i; for (i = 0; i < 4; i++) diff --git a/sym_common.txt b/sym_common.txt index 834f23918..7ba414cab 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -117,7 +117,7 @@ gUnknown_03003110: @ 3003110 gUnknown_03003120: @ 3003120 .space 0x4 -gUnknown_03003124: @ 3003124 +gReceivedRemoteLinkPlayers: @ 3003124 .space 0xC gUnknown_03003130: @ 3003130 @@ -203,7 +203,7 @@ gUnknown_03005CDE: @ 3005CDE .include "rtc.o" -gUnknown_03005D00: @ 3005D00 +gPreBattleCallback1: @ 3005D00 .space 0x4 gBattleMainFunc: @ 3005D04 diff --git a/sym_ewram.txt b/sym_ewram.txt index e49b94160..ce3b4f250 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -31,11 +31,8 @@ gUnknown_020223BD: @ 20223BD gUnknown_020223C0: @ 20223C0 .space 0x4 -gUnknown_020223C4: @ 20223C4 - .space 0x4 - -gUnknown_020223C8: @ 20223C8 - .space 0x4FC +gBlockRecvBuffer: @ 20223C4 + .space 0x500 gUnknown_020228C4: @ 20228C4 gBlockSendBuffer .space 0x100 @@ -205,10 +202,10 @@ gUnknown_02022D10: @ 2022D10 gUnknown_02022E10: @ 2022E10 .space 0x4 -gUnknown_02022E14: @ 2022E14 +gBattle_BG0_X: @ 2022E14 .space 0x2 -gUnknown_02022E16: @ 2022E16 +gBattle_BG0_Y: @ 2022E16 .space 0x2 gBattle_BG1_X: @ 2022E18 @@ -226,19 +223,19 @@ gBattle_BG2_Y: @ 2022E1E gBattle_BG3_X: @ 2022E20 .space 0x2 -gUnknown_02022E22: @ 2022E22 +gBattle_BG3_Y: @ 2022E22 .space 0x2 -gUnknown_02022E24: @ 2022E24 +gBattle_WIN0H: @ 2022E24 .space 0x2 -gUnknown_02022E26: @ 2022E26 +gBattle_WIN0V: @ 2022E26 .space 0x2 -gUnknown_02022E28: @ 2022E28 +gBattle_WIN1H: @ 2022E28 .space 0x2 -gUnknown_02022E2A: @ 2022E2A +gBattle_WIN1V: @ 2022E2A .space 0x2 gDisplayedStringBattle: @ 2022E2C @@ -526,7 +523,7 @@ gUnknown_020244CC: @ 20244CC gUnknown_020244D0: @ 20244D0 .space 0x4 -gBattleSpritesGfx: @ 20244D4 +gMonSpritesGfxPtr: @ 20244D4 .space 0x4 gUnknown_020244D8: @ 20244D8 @@ -1671,7 +1668,7 @@ gUnknown_0203BD26: @ 203BD26 gUnknown_0203BD28: @ 203BD28 .space 0x4 -gUnknown_0203BD2C: @ 203BD2C +gRecordedBattleRngSeed: @ 203BD2C .space 0x4 gUnknown_0203BD30: @ 203BD30