diff --git a/asm/battle_controller_safari.s b/asm/battle_controller_safari.s deleted file mode 100644 index 4093d433bd..0000000000 --- a/asm/battle_controller_safari.s +++ /dev/null @@ -1,1412 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start nullsub_114 -nullsub_114: @ 8159368 - bx lr - thumb_func_end nullsub_114 - - thumb_func_start SetBankFuncToSafariBufferRunCommand -SetBankFuncToSafariBufferRunCommand: @ 815936C - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =SafariBufferRunCommand - str r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToSafariBufferRunCommand - - thumb_func_start SafariBufferRunCommand -SafariBufferRunCommand: @ 8159388 - push {lr} - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldr r0, =gActiveBank - ldrb r3, [r0] - lsls r0, r3, 2 - adds r0, r1 - ldr r1, [r2] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _081593D4 - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _081593D0 - ldr r0, =gSafariBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _081593D4 - .pool -_081593D0: - bl SafariBufferExecCompleted -_081593D4: - pop {r0} - bx r0 - thumb_func_end SafariBufferRunCommand - - thumb_func_start bx_battle_menu_t6_2 -bx_battle_menu_t6_2: @ 81593D8 - push {r4,r5,lr} - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r2, 0x1 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _08159446 - movs r0, 0x5 - bl PlaySE - ldr r1, =gActionSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _08159424 - cmp r0, 0x1 - bgt _08159414 - cmp r0, 0 - beq _0815941E - b _08159440 - .pool -_08159414: - cmp r0, 0x2 - beq _0815942A - cmp r0, 0x3 - beq _08159436 - b _08159440 -_0815941E: - movs r0, 0x1 - movs r1, 0x5 - b _0815942E -_08159424: - movs r0, 0x1 - movs r1, 0x6 - b _0815942E -_0815942A: - movs r0, 0x1 - movs r1, 0x7 -_0815942E: - movs r2, 0 - bl EmitTwoReturnValues - b _08159440 -_08159436: - movs r0, 0x1 - movs r1, 0x8 - movs r2, 0 - bl EmitTwoReturnValues -_08159440: - bl SafariBufferExecCompleted - b _0815954E -_08159446: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _08159484 - ldr r5, =gActionSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _0815954E - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl ActionSelectionDestroyCursorAt - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x1 - b _081594F2 - .pool -_08159484: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _081594C0 - ldr r5, =gActionSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _0815954E - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl ActionSelectionDestroyCursorAt - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x1 - b _081594F2 - .pool -_081594C0: - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0815950C - ldr r5, =gActionSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0815954E - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl ActionSelectionDestroyCursorAt - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x2 -_081594F2: - eors r0, r2 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - movs r1, 0 - bl ActionSelectionCreateCursorAt - b _0815954E - .pool -_0815950C: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0815954E - ldr r5, =gActionSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _0815954E - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl ActionSelectionDestroyCursorAt - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x2 - eors r0, r2 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - movs r1, 0 - bl ActionSelectionCreateCursorAt -_0815954E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end bx_battle_menu_t6_2 - - thumb_func_start sub_815955C -sub_815955C: @ 815955C - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08159580 - bl SafariBufferExecCompleted -_08159580: - pop {r0} - bx r0 - .pool - thumb_func_end sub_815955C - - thumb_func_start bx_t6_button_a -bx_t6_button_a: @ 8159594 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _081595A6 - bl SafariBufferExecCompleted -_081595A6: - pop {r0} - bx r0 - thumb_func_end bx_t6_button_a - - thumb_func_start sub_81595AC -sub_81595AC: @ 81595AC - push {lr} - ldr r2, =gSprites - ldr r1, =gHealthBoxesIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _081595D0 - bl SafariBufferExecCompleted -_081595D0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81595AC - - thumb_func_start sub_81595E4 -sub_81595E4: @ 81595E4 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0815960E - ldr r2, =gMain - ldr r0, =0x00000439 - adds r3, r2, r0 - ldrb r1, [r3] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r3] - ldr r0, =gPreBattleCallback1 - ldr r0, [r0] - str r0, [r2] - ldr r0, [r2, 0x8] - bl SetMainCallback2 -_0815960E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81595E4 - - thumb_func_start bx_wait_t6 -bx_wait_t6: @ 8159624 - push {lr} - ldr r0, =gDoingBattleAnim - ldrb r0, [r0] - cmp r0, 0 - beq _0815964A - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0815964E -_0815964A: - bl SafariBufferExecCompleted -_0815964E: - pop {r0} - bx r0 - .pool - thumb_func_end bx_wait_t6 - - thumb_func_start sub_8159660 -sub_8159660: @ 8159660 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08159684 - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8159698 - str r1, [r0] - bl FreeAllWindowBuffers - bl sub_81358F4 -_08159684: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159660 - - thumb_func_start sub_8159698 -sub_8159698: @ 8159698 - push {lr} - ldr r0, =gMain - ldr r1, [r0, 0x4] - ldr r0, =BattleMainCB2 - cmp r1, r0 - bne _081596BE - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081596BE - ldr r0, =gScriptItemId - ldrh r1, [r0] - movs r0, 0x1 - bl EmitOneReturnValue - bl SafariBufferExecCompleted -_081596BE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159698 - - thumb_func_start sub_81596D4 -sub_81596D4: @ 81596D4 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _081596F6 - bl SafariBufferExecCompleted -_081596F6: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81596D4 - - thumb_func_start SafariBufferExecCompleted -SafariBufferExecCompleted: @ 8159704 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =SafariBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08159758 - bl GetMultiplayerId - mov r1, sp - strb r0, [r1] - movs r0, 0x2 - movs r1, 0x4 - mov r2, sp - bl PrepareBufferDataTransferLink - ldr r1, =gBattleBufferA - ldrb r0, [r4] - lsls r0, 9 - adds r0, r1 - movs r1, 0x38 - strb r1, [r0] - b _0815976A - .pool -_08159758: - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - ldr r0, [r2] - bics r0, r1 - str r0, [r2] -_0815976A: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end SafariBufferExecCompleted - - thumb_func_start bx_80364D0 -bx_80364D0: @ 815977C - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _0815979E - bl SafariBufferExecCompleted -_0815979E: - pop {r0} - bx r0 - .pool - thumb_func_end bx_80364D0 - - thumb_func_start sub_81597AC -sub_81597AC: @ 81597AC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597AC - - thumb_func_start sub_81597B8 -sub_81597B8: @ 81597B8 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597B8 - - thumb_func_start sub_81597C4 -sub_81597C4: @ 81597C4 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597C4 - - thumb_func_start sub_81597D0 -sub_81597D0: @ 81597D0 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597D0 - - thumb_func_start sub_81597DC -sub_81597DC: @ 81597DC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597DC - - thumb_func_start sub_81597E8 -sub_81597E8: @ 81597E8 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597E8 - - thumb_func_start sub_81597F4 -sub_81597F4: @ 81597F4 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597F4 - - thumb_func_start sub_8159800 -sub_8159800: @ 8159800 - push {r4-r6,lr} - ldr r4, =gSaveBlock2Ptr - ldr r0, [r4] - ldrb r0, [r0, 0x8] - ldr r5, =gActiveBank - ldrb r1, [r5] - bl DecompressTrainerBackPic - ldr r0, [r4] - ldrb r6, [r0, 0x8] - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl sub_806A12C - ldr r0, =gUnknown_0202499C - ldr r2, =gTrainerBackPicCoords - ldr r1, [r4] - ldrb r1, [r1, 0x8] - lsls r1, 2 - adds r1, r2 - ldrb r1, [r1] - movs r2, 0x8 - subs r2, r1 - lsls r2, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r2, r1 - asrs r2, 16 - movs r1, 0x50 - movs r3, 0x1E - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r3, [r5] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_815955C - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159800 - - thumb_func_start sub_81598E0 -sub_81598E0: @ 81598E0 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81598E0 - - thumb_func_start sub_81598EC -sub_81598EC: @ 81598EC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81598EC - - thumb_func_start sub_81598F8 -sub_81598F8: @ 81598F8 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81598F8 - - thumb_func_start sub_8159904 -sub_8159904: @ 8159904 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159904 - - thumb_func_start sub_8159910 -sub_8159910: @ 8159910 - push {r4,r5,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x8] - movs r0, 0x4 - strb r0, [r1, 0x8] - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldr r5, =gActiveBank - ldrb r4, [r5] - movs r0, 0x1 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r4, 0 - movs r3, 0x4 - bl DoSpecialBattleAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_wait_t6 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159910 - - thumb_func_start sub_8159964 -sub_8159964: @ 8159964 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r1, [r0] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x8] - strb r1, [r0, 0x8] - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r4, [r5] - movs r0, 0x1 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r4, 0 - movs r3, 0x4 - bl DoSpecialBattleAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_wait_t6 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159964 - - thumb_func_start sub_81599C4 -sub_81599C4: @ 81599C4 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81599C4 - - thumb_func_start sub_81599D0 -sub_81599D0: @ 81599D0 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81599D0 - - thumb_func_start dp01t_10_6_message -dp01t_10_6_message: @ 81599DC - push {r4,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - ldr r1, =gBattleBufferA + 2 - adds r0, r1 - ldrh r0, [r0] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl BattleHandleAddTextPrinter - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_t6_button_a - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_10_6_message - - thumb_func_start dp01t_11_6_message_for_player_only -dp01t_11_6_message_for_player_only: @ 8159A30 - push {lr} - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _08159A4C - bl dp01t_10_6_message - b _08159A50 - .pool -_08159A4C: - bl SafariBufferExecCompleted -_08159A50: - pop {r0} - bx r0 - thumb_func_end dp01t_11_6_message_for_player_only - - thumb_func_start sub_8159A54 -sub_8159A54: @ 8159A54 - push {lr} - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _08159A7A - ldr r0, =gBattle_BG0_X - strh r1, [r0] - ldr r1, =gBattle_BG0_Y - movs r0, 0xA0 - strh r0, [r1] - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_battle_menu_t6_2 - str r1, [r0] -_08159A7A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159A54 - - thumb_func_start sub_8159A94 -sub_8159A94: @ 8159A94 - push {r4,lr} - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8159A54 - str r1, [r0] - ldr r0, =gText_SafariZoneMenu - movs r1, 0x2 - bl BattleHandleAddTextPrinter - movs r4, 0 -_08159AAE: - lsls r0, r4, 24 - lsrs r0, 24 - bl ActionSelectionDestroyCursorAt - adds r4, 0x1 - cmp r4, 0x3 - ble _08159AAE - ldr r1, =gActionSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - movs r1, 0 - bl ActionSelectionCreateCursorAt - ldr r0, =gText_WhatWillPkmnDo2 - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0x1 - bl BattleHandleAddTextPrinter - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159A94 - - thumb_func_start sub_8159AFC -sub_8159AFC: @ 8159AFC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159AFC - - thumb_func_start sub_8159B08 -sub_8159B08: @ 8159B08 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159B08 - - thumb_func_start sub_8159B14 -sub_8159B14: @ 8159B14 - push {lr} - sub sp, 0x4 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8159660 - str r1, [r0] - ldr r1, =gBankInMenu - ldrb r0, [r2] - strb r0, [r1] - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159B14 - - thumb_func_start sub_8159B54 -sub_8159B54: @ 8159B54 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159B54 - - thumb_func_start sub_8159B60 -sub_8159B60: @ 8159B60 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159B60 - - thumb_func_start sub_8159B6C -sub_8159B6C: @ 8159B6C - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159B6C - - thumb_func_start sub_8159B78 -sub_8159B78: @ 8159B78 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159B78 - - thumb_func_start sub_8159B84 -sub_8159B84: @ 8159B84 - push {lr} - ldr r0, =gHealthBoxesIds - ldr r1, =gActiveBank - ldrb r1, [r1] - adds r0, r1, r0 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0xB - bl UpdateHealthboxAttribute - bl SafariBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159B84 - - thumb_func_start sub_8159BC0 -sub_8159BC0: @ 8159BC0 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159BC0 - - thumb_func_start sub_8159BCC -sub_8159BCC: @ 8159BCC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159BCC - - thumb_func_start sub_8159BD8 -sub_8159BD8: @ 8159BD8 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159BD8 - - thumb_func_start sub_8159BE4 -sub_8159BE4: @ 8159BE4 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159BE4 - - thumb_func_start sub_8159BF0 -sub_8159BF0: @ 8159BF0 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159BF0 - - thumb_func_start sub_8159BFC -sub_8159BFC: @ 8159BFC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159BFC - - thumb_func_start sub_8159C08 -sub_8159C08: @ 8159C08 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C08 - - thumb_func_start sub_8159C14 -sub_8159C14: @ 8159C14 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C14 - - thumb_func_start sub_8159C20 -sub_8159C20: @ 8159C20 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C20 - - thumb_func_start sub_8159C2C -sub_8159C2C: @ 8159C2C - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C2C - - thumb_func_start sub_8159C38 -sub_8159C38: @ 8159C38 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C38 - - thumb_func_start sub_8159C44 -sub_8159C44: @ 8159C44 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C44 - - thumb_func_start sub_8159C50 -sub_8159C50: @ 8159C50 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C50 - - thumb_func_start sub_8159C5C -sub_8159C5C: @ 8159C5C - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C5C - - thumb_func_start sub_8159C68 -sub_8159C68: @ 8159C68 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C68 - - thumb_func_start sub_8159C74 -sub_8159C74: @ 8159C74 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C74 - - thumb_func_start sub_8159C80 -sub_8159C80: @ 8159C80 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - movs r3, 0x3F - cmp r0, 0 - bne _08159C94 - movs r3, 0xC0 -_08159C94: - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - lsls r1, r3, 24 - asrs r1, 24 - bl PlaySE12WithPanning - bl SafariBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159C80 - - thumb_func_start dp01t_34_6_move_anim_start_t3 -dp01t_34_6_move_anim_start_t3: @ 8159CC4 - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _08159D00 - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _08159D14 - .pool -_08159D00: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_08159D14: - bl SafariBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end dp01t_34_6_move_anim_start_t3 - - thumb_func_start sub_8159D20 -sub_8159D20: @ 8159D20 - push {lr} - ldr r1, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - bl PlayCry1 - bl SafariBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159D20 - - thumb_func_start dp01t_2E_6_battle_intro -dp01t_2E_6_battle_intro: @ 8159D5C - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl HandleIntroSlide - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl SafariBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_2E_6_battle_intro - - thumb_func_start sub_8159D90 -sub_8159D90: @ 8159D90 - push {r4,r5,lr} - ldr r5, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r1, [r4] - adds r0, r1, r5 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0xA - bl UpdateHealthboxAttribute - ldrb r0, [r4] - bl sub_8076918 - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81595AC - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159D90 - - thumb_func_start sub_8159DEC -sub_8159DEC: @ 8159DEC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159DEC - - thumb_func_start sub_8159DF8 -sub_8159DF8: @ 8159DF8 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159DF8 - - thumb_func_start sub_8159E04 -sub_8159E04: @ 8159E04 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159E04 - - thumb_func_start sub_8159E10 -sub_8159E10: @ 8159E10 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159E10 - - thumb_func_start sub_8159E1C -sub_8159E1C: @ 8159E1C - push {r4-r6,lr} - sub sp, 0x4 - ldr r5, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r1, r2, 9 - adds r0, r5, 0x1 - adds r0, r1, r0 - ldrb r3, [r0] - adds r0, r5, 0x2 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, 0x3 - adds r1, r5 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - str r4, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - bl DoBattleAnimationFromTable - lsls r0, 24 - cmp r0, 0 - beq _08159E5C - bl SafariBufferExecCompleted - b _08159E68 - .pool -_08159E5C: - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_81596D4 - str r0, [r1] -_08159E68: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159E1C - - thumb_func_start sub_8159E78 -sub_8159E78: @ 8159E78 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159E78 - - thumb_func_start sub_8159E84 -sub_8159E84: @ 8159E84 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159E84 - - thumb_func_start sub_8159E90 -sub_8159E90: @ 8159E90 - push {r4,lr} - ldr r2, =gBattleOutcome - ldr r1, =gBattleBufferA - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - movs r0, 0x5 - bl FadeOutMapMusic - movs r0, 0x3 - bl BeginFastPaletteFade - bl SafariBufferExecCompleted - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x6 - ands r0, r1 - cmp r0, 0x2 - bne _08159ECC - ldr r0, =gBattleBankFunc - ldrb r1, [r4] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_81595E4 - str r0, [r1] -_08159ECC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159E90 - - thumb_func_start nullsub_115 -nullsub_115: @ 8159EEC - bx lr - thumb_func_end nullsub_115 - - - .align 2, 0 @ Don't pad with nop. diff --git a/data/battle_anim_815A0D4.s b/data/battle_anim_815A0D4.s index be8439db71..d89a83daf1 100644 --- a/data/battle_anim_815A0D4.s +++ b/data/battle_anim_815A0D4.s @@ -3,7 +3,168 @@ .section .rodata + .align 2 +gUnknown_085CE004:: @ 85CE004 + .2byte 0x0000, 0x0004, 0x0010, 0x0004 + .2byte 0x0020, 0x0004, 0x0030, 0x0004 + .2byte 0x0040, 0x0004, 0xffff, 0x0000 + .align 2 +gUnknown_085CE01C:: @ 85CE01C + .4byte gUnknown_085CE004 + + .align 2 +gUnknown_085CE020:: @ 85CE020 + spr_template 0x2799, 0x2799, gUnknown_08524A34, gUnknown_085CE01C, NULL, gDummySpriteAffineAnimTable, sub_80A77C8 + + .align 2 + spr_template 0x2720, 0x2720, gUnknown_08524934, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A0D4 + + .align 2 + spr_template 0x2721, 0x2721, gUnknown_08524904, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80A78AC + + .align 2 +gUnknown_085CE068:: @ 85CE068 + .2byte 0x0000, 0x0028, 0x0010, 0x0008 + .2byte 0x0020, 0x0028, 0xffff, 0x0000 + + .align 2 +gUnknown_085CE078:: @ 85CE078 + .4byte gUnknown_085CE068 + + .align 2 +gUnknown_085CE07C:: @ 85CE07C + spr_template 0x27ce, 0x27ce, gUnknown_08524914, gUnknown_085CE078, NULL, gDummySpriteAffineAnimTable, sub_80A77C8 + + .align 2 + spr_template 0x27cf, 0x27cf, gUnknown_08524A3C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A1B0 + + .align 2 + spr_template 0x27cd, 0x27cd, gUnknown_08524974, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A254 + + .align 2 +gUnknown_085CE0C4:: @ 85CE0C4 + .2byte 0x0180, 0x0180, 0x0000, 0x0000 + .2byte 0xffe0, 0x0018, 0x0500, 0x0000 + .2byte 0x0018, 0xffe0, 0x0500, 0x0000 + .2byte 0x7ffe, 0x0001, 0x0000, 0x0000 + + .align 2 +gUnknown_085CE0E4:: @ 85CE0E4 + .2byte 0x0030, 0x0030, 0x0000, 0x0000 + .2byte 0x0020, 0x0020, 0x0600, 0x0000 + .2byte 0x7fff, 0x0000, 0x0000, 0x0000 + + .align 2 +gUnknown_085CE0FC:: @ 85CE0FC + .4byte gUnknown_085CE0C4 + .4byte gUnknown_085CE0E4 + + .align 2 +gUnknown_085CE104:: @ 85CE104 + spr_template 0x27cb, 0x27cb, gUnknown_08524AFC, gDummySpriteAnimTable, NULL, gUnknown_085CE0FC, sub_815A2F0 + + .align 2 + spr_template 0x27a8, 0x27a8, gUnknown_0852490C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A6C4 + + .align 2 +gUnknown_085CE134:: @ 85CE134 + .2byte 0x0000, 0x0003, 0x0010, 0x0003 + .2byte 0x0020, 0x0003, 0x0030, 0x0003 + .2byte 0x0040, 0x0003, 0xffff, 0x0000 + + .align 2 +gUnknown_085CE14C:: @ 85CE14C + .4byte gUnknown_085CE134 + + .align 2 +gUnknown_085CE150:: @ 85CE150 + spr_template 0x272b, 0x272b, gUnknown_08524914, gUnknown_085CE14C, NULL, gDummySpriteAffineAnimTable, sub_815A7B0 + + .align 2 +gUnknown_085CE168:: @ 85CE168 + .2byte 0x0000, 0x0003, 0xffff, 0x0000 + + .align 2 +gUnknown_085CE170:: @ 85CE170 + .4byte gUnknown_085CE168 + + .align 2 +gUnknown_085CE174:: @ 85CE174 + .2byte 0xfff9, 0xfff9, 0x10fd, 0x0000 + .2byte 0x0007, 0x0007, 0x1003, 0x0000 + .2byte 0x7ffe, 0x0000, 0x0000, 0x0000 + + .align 2 +gUnknown_085CE18C:: @ 85CE18C + .4byte gUnknown_085CE174 + + .align 2 +gUnknown_085CE190:: @ 85CE190 + spr_template 0x27f4, 0x27f4, gUnknown_08524974, gUnknown_085CE170, NULL, gUnknown_085CE18C, sub_815A7EC + + .align 2 +gUnknown_085CE1A8:: @ 85CE1A8 + .2byte 0x0000, 0x0008, 0x0010, 0x0010, 0x0020, 0x0004, 0x0030, 0x0004, 0xffff, 0x0000 + + .align 2 +gUnknown_085CE1BC:: @ 85CE1BC + .4byte gUnknown_085CE1A8 + + .align 2 +gUnknown_085CE1C0:: @ 85CE1C0 + .2byte 0x0200, 0x0200, 0x0000, 0x0000 + .2byte 0xffe0, 0xffe0, 0x0800, 0x0000 + .2byte 0x7fff, 0x0000, 0x0000, 0x0000 + + .align 2 +gUnknown_085CE1D8:: @ 85CE1D8 + .4byte gUnknown_085CE1C0 + + .align 2 +gUnknown_085CE1DC:: @ 85CE1DC + spr_template 0x27d0, 0x27d0, gUnknown_085249D4, gUnknown_085CE1BC, NULL, gUnknown_085CE1D8, sub_815A8AC + + .align 2 +gUnknown_085CE1F4:: @ 85CE1F4 + .2byte 0x0000, 0x0180, 0x0000, 0x0000 + .2byte 0x0010, 0x0000, 0x1400, 0x0000 + .2byte 0x7fff, 0x0000, 0x0000, 0x0000 + + .align 2 +gUnknown_085CE20C:: @ 85CE20C + .2byte 0x0140, 0x0180, 0x0000, 0x0000 + .2byte 0xfff0, 0x0000, 0x1300, 0x0000 + .2byte 0x7fff, 0x0000, 0x0000, 0x0000 + + .align 2 +gUnknown_085CE224:: @ 85CE224 + .4byte gUnknown_085CE1F4 + .4byte gUnknown_085CE20C + + .align 2 +gUnknown_085CE22C:: @ 85CE22C + spr_template 0x27f3, 0x27f3, gUnknown_085249DC, gDummySpriteAnimTable, NULL, gUnknown_085CE224, sub_815A934 + + .align 2 + spr_template 0x2807, 0x2807, gUnknown_08524914, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815AAA4 + + .align 2 + spr_template 0x2807, 0x2807, gUnknown_08524914, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815ABD0 + + .align 2 +gUnknown_085CE274:: @ 85CE274 + .2byte 0x0000, 0x0002, 0x0008, 0x0002 + .2byte 0x0010, 0x0002, 0xfffe, 0x0000 + + .align 2 +gUnknown_085CE284:: @ 85CE284 + .4byte gUnknown_085CE274 + + .align 2 +gUnknown_085CE288:: @ 85CE288 + spr_template 0x27f5, 0x27f5, gUnknown_08524934, gUnknown_085CE284, NULL, gDummySpriteAffineAnimTable, sub_815ACD0 + gUnknown_085CE2A0:: @ 85CE2A0 .incbin "baserom.gba", 0x5ce2a0, 0xb0 diff --git a/data/battle_controller_safari.s b/data/battle_controller_safari.s deleted file mode 100644 index 39d1d0de31..0000000000 --- a/data/battle_controller_safari.s +++ /dev/null @@ -1,228 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gSafariBufferCommands:: @ 85CDF20 - .4byte sub_81597AC - .4byte sub_81597B8 - .4byte sub_81597C4 - .4byte sub_81597D0 - .4byte sub_81597DC - .4byte sub_81597E8 - .4byte sub_81597F4 - .4byte sub_8159800 - .4byte sub_81598E0 - .4byte sub_81598EC - .4byte sub_81598F8 - .4byte sub_8159904 - .4byte sub_8159910 - .4byte sub_8159964 - .4byte sub_81599C4 - .4byte sub_81599D0 - .4byte dp01t_10_6_message - .4byte dp01t_11_6_message_for_player_only - .4byte sub_8159A94 - .4byte sub_8159AFC - .4byte sub_8159B08 - .4byte sub_8159B14 - .4byte sub_8159B54 - .4byte sub_8159B60 - .4byte sub_8159B6C - .4byte sub_8159B78 - .4byte sub_8159B84 - .4byte sub_8159BC0 - .4byte sub_8159BCC - .4byte sub_8159BD8 - .4byte sub_8159BE4 - .4byte sub_8159BF0 - .4byte sub_8159BFC - .4byte sub_8159C08 - .4byte sub_8159C14 - .4byte sub_8159C20 - .4byte sub_8159C2C - .4byte sub_8159C38 - .4byte sub_8159C44 - .4byte sub_8159C50 - .4byte sub_8159C5C - .4byte sub_8159C68 - .4byte sub_8159C74 - .4byte sub_8159C80 - .4byte dp01t_34_6_move_anim_start_t3 - .4byte sub_8159D20 - .4byte dp01t_2E_6_battle_intro - .4byte sub_8159D90 - .4byte sub_8159DEC - .4byte sub_8159DF8 - .4byte sub_8159E04 - .4byte sub_8159E10 - .4byte sub_8159E1C - .4byte sub_8159E78 - .4byte sub_8159E84 - .4byte sub_8159E90 - .4byte nullsub_115 - - .align 2 -gUnknown_085CE004:: @ 85CE004 - .2byte 0x0000, 0x0004, 0x0010, 0x0004 - .2byte 0x0020, 0x0004, 0x0030, 0x0004 - .2byte 0x0040, 0x0004, 0xffff, 0x0000 - - .align 2 -gUnknown_085CE01C:: @ 85CE01C - .4byte gUnknown_085CE004 - - .align 2 -gUnknown_085CE020:: @ 85CE020 - spr_template 0x2799, 0x2799, gUnknown_08524A34, gUnknown_085CE01C, NULL, gDummySpriteAffineAnimTable, sub_80A77C8 - - .align 2 - spr_template 0x2720, 0x2720, gUnknown_08524934, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A0D4 - - .align 2 - spr_template 0x2721, 0x2721, gUnknown_08524904, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80A78AC - - .align 2 -gUnknown_085CE068:: @ 85CE068 - .2byte 0x0000, 0x0028, 0x0010, 0x0008 - .2byte 0x0020, 0x0028, 0xffff, 0x0000 - - .align 2 -gUnknown_085CE078:: @ 85CE078 - .4byte gUnknown_085CE068 - - .align 2 -gUnknown_085CE07C:: @ 85CE07C - spr_template 0x27ce, 0x27ce, gUnknown_08524914, gUnknown_085CE078, NULL, gDummySpriteAffineAnimTable, sub_80A77C8 - - .align 2 - spr_template 0x27cf, 0x27cf, gUnknown_08524A3C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A1B0 - - .align 2 - spr_template 0x27cd, 0x27cd, gUnknown_08524974, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A254 - - .align 2 -gUnknown_085CE0C4:: @ 85CE0C4 - .2byte 0x0180, 0x0180, 0x0000, 0x0000 - .2byte 0xffe0, 0x0018, 0x0500, 0x0000 - .2byte 0x0018, 0xffe0, 0x0500, 0x0000 - .2byte 0x7ffe, 0x0001, 0x0000, 0x0000 - - .align 2 -gUnknown_085CE0E4:: @ 85CE0E4 - .2byte 0x0030, 0x0030, 0x0000, 0x0000 - .2byte 0x0020, 0x0020, 0x0600, 0x0000 - .2byte 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085CE0FC:: @ 85CE0FC - .4byte gUnknown_085CE0C4 - .4byte gUnknown_085CE0E4 - - .align 2 -gUnknown_085CE104:: @ 85CE104 - spr_template 0x27cb, 0x27cb, gUnknown_08524AFC, gDummySpriteAnimTable, NULL, gUnknown_085CE0FC, sub_815A2F0 - - .align 2 - spr_template 0x27a8, 0x27a8, gUnknown_0852490C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A6C4 - - .align 2 -gUnknown_085CE134:: @ 85CE134 - .2byte 0x0000, 0x0003, 0x0010, 0x0003 - .2byte 0x0020, 0x0003, 0x0030, 0x0003 - .2byte 0x0040, 0x0003, 0xffff, 0x0000 - - .align 2 -gUnknown_085CE14C:: @ 85CE14C - .4byte gUnknown_085CE134 - - .align 2 -gUnknown_085CE150:: @ 85CE150 - spr_template 0x272b, 0x272b, gUnknown_08524914, gUnknown_085CE14C, NULL, gDummySpriteAffineAnimTable, sub_815A7B0 - - .align 2 -gUnknown_085CE168:: @ 85CE168 - .2byte 0x0000, 0x0003, 0xffff, 0x0000 - - .align 2 -gUnknown_085CE170:: @ 85CE170 - .4byte gUnknown_085CE168 - - .align 2 -gUnknown_085CE174:: @ 85CE174 - .2byte 0xfff9, 0xfff9, 0x10fd, 0x0000 - .2byte 0x0007, 0x0007, 0x1003, 0x0000 - .2byte 0x7ffe, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085CE18C:: @ 85CE18C - .4byte gUnknown_085CE174 - - .align 2 -gUnknown_085CE190:: @ 85CE190 - spr_template 0x27f4, 0x27f4, gUnknown_08524974, gUnknown_085CE170, NULL, gUnknown_085CE18C, sub_815A7EC - - .align 2 -gUnknown_085CE1A8:: @ 85CE1A8 - .2byte 0x0000, 0x0008, 0x0010, 0x0010, 0x0020, 0x0004, 0x0030, 0x0004, 0xffff, 0x0000 - - .align 2 -gUnknown_085CE1BC:: @ 85CE1BC - .4byte gUnknown_085CE1A8 - - .align 2 -gUnknown_085CE1C0:: @ 85CE1C0 - .2byte 0x0200, 0x0200, 0x0000, 0x0000 - .2byte 0xffe0, 0xffe0, 0x0800, 0x0000 - .2byte 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085CE1D8:: @ 85CE1D8 - .4byte gUnknown_085CE1C0 - - .align 2 -gUnknown_085CE1DC:: @ 85CE1DC - spr_template 0x27d0, 0x27d0, gUnknown_085249D4, gUnknown_085CE1BC, NULL, gUnknown_085CE1D8, sub_815A8AC - - .align 2 -gUnknown_085CE1F4:: @ 85CE1F4 - .2byte 0x0000, 0x0180, 0x0000, 0x0000 - .2byte 0x0010, 0x0000, 0x1400, 0x0000 - .2byte 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085CE20C:: @ 85CE20C - .2byte 0x0140, 0x0180, 0x0000, 0x0000 - .2byte 0xfff0, 0x0000, 0x1300, 0x0000 - .2byte 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085CE224:: @ 85CE224 - .4byte gUnknown_085CE1F4 - .4byte gUnknown_085CE20C - - .align 2 -gUnknown_085CE22C:: @ 85CE22C - spr_template 0x27f3, 0x27f3, gUnknown_085249DC, gDummySpriteAnimTable, NULL, gUnknown_085CE224, sub_815A934 - - .align 2 - spr_template 0x2807, 0x2807, gUnknown_08524914, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815AAA4 - - .align 2 - spr_template 0x2807, 0x2807, gUnknown_08524914, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815ABD0 - - .align 2 -gUnknown_085CE274:: @ 85CE274 - .2byte 0x0000, 0x0002, 0x0008, 0x0002 - .2byte 0x0010, 0x0002, 0xfffe, 0x0000 - - .align 2 -gUnknown_085CE284:: @ 85CE284 - .4byte gUnknown_085CE274 - - .align 2 -gUnknown_085CE288:: @ 85CE288 - spr_template 0x27f5, 0x27f5, gUnknown_08524934, gUnknown_085CE284, NULL, gDummySpriteAffineAnimTable, sub_815ACD0 - - diff --git a/include/battle.h b/include/battle.h index 6079d019e7..855ff464eb 100644 --- a/include/battle.h +++ b/include/battle.h @@ -780,7 +780,7 @@ extern struct BattleStruct* gBattleStruct; #define B_ANIM_SWITCH_OUT_MON 0x1 #define B_ANIM_SPECIAL_2 0x2 #define B_ANIM_BALL_THROW 0x3 -#define B_ANIM_SPECIAL_4 0x4 +#define B_ANIM_SAFARI_BALL_THROW 0x4 #define B_ANIM_SUBSTITUTE_TO_MON 0x5 #define B_ANIM_MON_TO_SUBSTITUTE 0x6 diff --git a/ld_script.txt b/ld_script.txt index 54ed8a7f88..dc379a4996 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -201,7 +201,7 @@ SECTIONS { asm/field_effect_helpers.o(.text); asm/contest_ai.o(.text); asm/battle_anim_sound_tasks.o(.text); - asm/battle_controller_safari.o(.text); + src/battle_controller_safari.o(.text); asm/fldeff_sweetscent.o(.text); asm/battle_anim_815A0D4.o(.text); asm/learn_move.o(.text); @@ -426,7 +426,7 @@ SECTIONS { data/save.o(.rodata); data/field_effect_helpers.o(.rodata); data/contest_ai.o(.rodata); - data/battle_controller_safari.o(.rodata); + src/battle_controller_safari.o(.rodata); data/battle_anim_815A0D4.o(.rodata); data/learn_move.o(.rodata); src/roamer.o(.rodata); diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index b41dbf0bc3..b9ce93a89a 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -154,7 +154,7 @@ static void MoveSelectionDisplayMoveNames(void); static void HandleMoveSwitchting(void); static void sub_8058FC0(void); static void sub_8059828(void); -static void sub_80598E0(void); +static void CompleteWhenChoseItem(void); static void sub_8059544(u8 taskId); static void Task_PrepareToGiveExpWithExpBar(u8 taskId); static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId); @@ -297,16 +297,16 @@ static void HandleInputChooseAction(void) switch (gActionSelectionCursor[gActiveBank]) { - case ACTION_USE_MOVE: + case 0: EmitTwoReturnValues(1, ACTION_USE_MOVE, 0); break; - case ACTION_USE_ITEM: + case 1: EmitTwoReturnValues(1, ACTION_USE_ITEM, 0); break; - case ACTION_SWITCH: + case 2: EmitTwoReturnValues(1, ACTION_SWITCH, 0); break; - case ACTION_RUN: + case 3: EmitTwoReturnValues(1, ACTION_RUN, 0); break; } @@ -1400,18 +1400,18 @@ static void sub_8059828(void) } } -static void sub_80598A4(void) +static void OpenBagAndChooseItem(void) { if (!gPaletteFade.active) { - gBattleBankFunc[gActiveBank] = sub_80598E0; + gBattleBankFunc[gActiveBank] = CompleteWhenChoseItem; nullsub_35(); FreeAllWindowBuffers(); sub_81AABB0(); } } -static void sub_80598E0(void) +static void CompleteWhenChoseItem(void) { if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { @@ -2685,7 +2685,7 @@ static void PlayerHandleChooseItem(void) s32 i; BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); - gBattleBankFunc[gActiveBank] = sub_80598A4; + gBattleBankFunc[gActiveBank] = OpenBagAndChooseItem; gBankInMenu = gActiveBank; for (i = 0; i < 3; i++) diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c new file mode 100644 index 0000000000..74210e6297 --- /dev/null +++ b/src/battle_controller_safari.c @@ -0,0 +1,723 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_message.h" +#include "battle_interface.h" +#include "battle_anim.h" +#include "pokemon.h" +#include "link.h" +#include "util.h" +#include "main.h" +#include "songs.h" +#include "sound.h" +#include "window.h" +#include "m4a.h" +#include "palette.h" +#include "task.h" +#include "text.h" +#include "bg.h" +#include "reshow_battle_screen.h" +#include "pokeball.h" + +extern u32 gBattleExecBuffer; +extern u8 gActiveBank; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gNoOfAllBanks; +extern bool8 gDoingBattleAnim; +extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); +extern void (*gPreBattleCallback1)(void); +extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; +extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200]; +extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; +extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern struct SpriteTemplate gUnknown_0202499C; +extern u16 gScriptItemId; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleOutcome; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u8 gBankInMenu; +extern u16 gUnknown_020243FC; + +extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; + +extern const u8 gText_SafariZoneMenu[]; +extern const u8 gText_WhatWillPkmnDo2[]; + +extern void sub_81358F4(void); + +// this file's functions +static void SafariHandleGetMonData(void); +static void SafariHandleGetRawMonData(void); +static void SafariHandleSetMonData(void); +static void SafariHandleSetRawMonData(void); +static void SafariHandleLoadMonSprite(void); +static void SafariHandleSwitchInAnim(void); +static void SafariHandleReturnMonToBall(void); +static void SafariHandleDrawTrainerPic(void); +static void SafariHandleTrainerSlide(void); +static void SafariHandleTrainerSlideBack(void); +static void SafariHandleFaintAnimation(void); +static void SafariHandlePaletteFade(void); +static void SafariHandleSuccessBallThrowAnim(void); +static void SafariHandleBallThrowAnim(void); +static void SafariHandlePause(void); +static void SafariHandleMoveAnimation(void); +static void SafariHandlePrintString(void); +static void SafariHandlePrintStringPlayerOnly(void); +static void SafariHandleChooseAction(void); +static void SafariHandleUnknownYesNoBox(void); +static void SafariHandleChooseMove(void); +static void SafariHandleChooseItem(void); +static void SafariHandleChoosePokemon(void); +static void SafariHandleCmd23(void); +static void SafariHandleHealthBarUpdate(void); +static void SafariHandleExpUpdate(void); +static void SafariHandleStatusIconUpdate(void); +static void SafariHandleStatusAnimation(void); +static void SafariHandleStatusXor(void); +static void SafariHandleDataTransfer(void); +static void SafariHandleDMA3Transfer(void); +static void SafariHandlePlayBGM(void); +static void SafariHandleCmd32(void); +static void SafariHandleTwoReturnValues(void); +static void SafariHandleChosenMonReturnValue(void); +static void SafariHandleOneReturnValue(void); +static void SafariHandleOneReturnValue_Duplicate(void); +static void SafariHandleCmd37(void); +static void SafariHandleCmd38(void); +static void SafariHandleCmd39(void); +static void SafariHandleCmd40(void); +static void SafariHandleHitAnimation(void); +static void SafariHandleCmd42(void); +static void SafariHandleEffectivenessSound(void); +static void SafariHandlePlayFanfareOrBGM(void); +static void SafariHandleFaintingCry(void); +static void SafariHandleIntroSlide(void); +static void SafariHandleIntroTrainerBallThrow(void); +static void SafariHandleDrawPartyStatusSummary(void); +static void SafariHandleCmd49(void); +static void SafariHandleCmd50(void); +static void SafariHandleSpriteInvisibility(void); +static void SafariHandleBattleAnimation(void); +static void SafariHandleLinkStandbyMsg(void); +static void SafariHandleResetActionMoveSelection(void); +static void SafariHandleCmd55(void); +static void nullsub_115(void); + +static void SafariBufferRunCommand(void); +static void SafariBufferExecCompleted(void); +static void CompleteWhenChosePokeblock(void); + +static void (*const gSafariBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +{ + SafariHandleGetMonData, + SafariHandleGetRawMonData, + SafariHandleSetMonData, + SafariHandleSetRawMonData, + SafariHandleLoadMonSprite, + SafariHandleSwitchInAnim, + SafariHandleReturnMonToBall, + SafariHandleDrawTrainerPic, + SafariHandleTrainerSlide, + SafariHandleTrainerSlideBack, + SafariHandleFaintAnimation, + SafariHandlePaletteFade, + SafariHandleSuccessBallThrowAnim, + SafariHandleBallThrowAnim, + SafariHandlePause, + SafariHandleMoveAnimation, + SafariHandlePrintString, + SafariHandlePrintStringPlayerOnly, + SafariHandleChooseAction, + SafariHandleUnknownYesNoBox, + SafariHandleChooseMove, + SafariHandleChooseItem, + SafariHandleChoosePokemon, + SafariHandleCmd23, + SafariHandleHealthBarUpdate, + SafariHandleExpUpdate, + SafariHandleStatusIconUpdate, + SafariHandleStatusAnimation, + SafariHandleStatusXor, + SafariHandleDataTransfer, + SafariHandleDMA3Transfer, + SafariHandlePlayBGM, + SafariHandleCmd32, + SafariHandleTwoReturnValues, + SafariHandleChosenMonReturnValue, + SafariHandleOneReturnValue, + SafariHandleOneReturnValue_Duplicate, + SafariHandleCmd37, + SafariHandleCmd38, + SafariHandleCmd39, + SafariHandleCmd40, + SafariHandleHitAnimation, + SafariHandleCmd42, + SafariHandleEffectivenessSound, + SafariHandlePlayFanfareOrBGM, + SafariHandleFaintingCry, + SafariHandleIntroSlide, + SafariHandleIntroTrainerBallThrow, + SafariHandleDrawPartyStatusSummary, + SafariHandleCmd49, + SafariHandleCmd50, + SafariHandleSpriteInvisibility, + SafariHandleBattleAnimation, + SafariHandleLinkStandbyMsg, + SafariHandleResetActionMoveSelection, + SafariHandleCmd55, + nullsub_115 +}; + +static void nullsub_114(void) +{ +} + +void SetBankFuncToSafariBufferRunCommand(void) +{ + gBattleBankFunc[gActiveBank] = SafariBufferRunCommand; +} + +static void SafariBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(gSafariBufferCommands)) + gSafariBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + SafariBufferExecCompleted(); + } +} + +static void HandleInputChooseAction(void) +{ + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + + switch (gActionSelectionCursor[gActiveBank]) + { + case 0: + EmitTwoReturnValues(1, ACTION_SAFARI_ZONE_BALL, 0); + break; + case 1: + EmitTwoReturnValues(1, ACTION_POKEBLOCK_CASE, 0); + break; + case 2: + EmitTwoReturnValues(1, ACTION_GO_NEAR, 0); + break; + case 3: + EmitTwoReturnValues(1, ACTION_SAFARI_ZONE_RUN, 0); + break; + } + SafariBufferExecCompleted(); + } + else if (gMain.newKeys & DPAD_LEFT) + { + if (gActionSelectionCursor[gActiveBank] & 1) + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 1; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } + else if (gMain.newKeys & DPAD_RIGHT) + { + if (!(gActionSelectionCursor[gActiveBank] & 1)) + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 1; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } + else if (gMain.newKeys & DPAD_UP) + { + if (gActionSelectionCursor[gActiveBank] & 2) + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 2; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } + else if (gMain.newKeys & DPAD_DOWN) + { + if (!(gActionSelectionCursor[gActiveBank] & 2)) + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 2; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } +} + +static void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + SafariBufferExecCompleted(); +} + +static void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + SafariBufferExecCompleted(); +} + +static void CompleteOnHealthboxSpriteCallbackDummy(void) +{ + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + SafariBufferExecCompleted(); +} + +static void sub_81595E4(void) +{ + if (!gPaletteFade.active) + { + gMain.inBattle = FALSE; + gMain.callback1 = gPreBattleCallback1; + SetMainCallback2(gMain.savedCallback); + } +} + +static void CompleteOnSpecialAnimDone(void) +{ + if (!gDoingBattleAnim || !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + SafariBufferExecCompleted(); +} + +static void OpenPokeblockCase(void) +{ + if (!gPaletteFade.active) + { + gBattleBankFunc[gActiveBank] = CompleteWhenChosePokeblock; + FreeAllWindowBuffers(); + sub_81358F4(); + } +} + +static void CompleteWhenChosePokeblock(void) +{ + if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) + { + EmitOneReturnValue(1, gScriptItemId); + SafariBufferExecCompleted(); + } +} + +static void CompleteOnFinishedBattleAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + SafariBufferExecCompleted(); +} + +static void SafariBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = SafariBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +static void CompleteOnFinishedStatusAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + SafariBufferExecCompleted(); +} + +static void SafariHandleGetMonData(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleGetRawMonData(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleSetMonData(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleSetRawMonData(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleLoadMonSprite(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleSwitchInAnim(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleReturnMonToBall(void) +{ + SafariBufferExecCompleted(); +} + +// todo: get rid of it once the struct is declared in a header +struct MonCoords +{ + // This would use a bitfield, but sub_8079F44 + // uses it as a u8 and casting won't match. + u8 coords; // u8 x:4, y:4; + u8 y_offset; +}; +extern const struct MonCoords gTrainerBackPicCoords[]; + +static void SafariHandleDrawTrainerPic(void) +{ + DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, gActiveBank); + sub_806A12C(gSaveBlock2Ptr->playerGender, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite( + &gUnknown_0202499C, + 80, + (8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80, + 30); + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +static void SafariHandleTrainerSlide(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleTrainerSlideBack(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleFaintAnimation(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandlePaletteFade(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleSuccessBallThrowAnim(void) +{ + gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; + gDoingBattleAnim = TRUE; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); + gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone; +} + +static void SafariHandleBallThrowAnim(void) +{ + u8 ballThrowCaseId = gBattleBufferA[gActiveBank][1]; + + gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; + gDoingBattleAnim = TRUE; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); + gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone; +} + +static void SafariHandlePause(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleMoveAnimation(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter; +} + +static void SafariHandlePrintStringPlayerOnly(void) +{ + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + SafariHandlePrintString(); + else + SafariBufferExecCompleted(); +} + +static void HandleChooseActionAfterDma3(void) +{ + if (!IsDma3ManagerBusyWithBgCopy()) + { + gBattle_BG0_X = 0; + gBattle_BG0_Y = 160; + gBattleBankFunc[gActiveBank] = HandleInputChooseAction; + } +} + +static void SafariHandleChooseAction(void) +{ + s32 i; + + gBattleBankFunc[gActiveBank] = HandleChooseActionAfterDma3; + BattleHandleAddTextPrinter(gText_SafariZoneMenu, 2); + + for (i = 0; i < 4; i++) + ActionSelectionDestroyCursorAt(i); + + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillPkmnDo2); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 1); +} + +static void SafariHandleUnknownYesNoBox(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleChooseMove(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleChooseItem(void) +{ + s32 i; + + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gBattleBankFunc[gActiveBank] = OpenPokeblockCase; + gBankInMenu = gActiveBank; +} + +static void SafariHandleChoosePokemon(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd23(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleHealthBarUpdate(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleExpUpdate(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleStatusIconUpdate(void) +{ + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_SAFARI_BALLS_TEXT); + SafariBufferExecCompleted(); +} + +static void SafariHandleStatusAnimation(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleStatusXor(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleDataTransfer(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleDMA3Transfer(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandlePlayBGM(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd32(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleTwoReturnValues(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleChosenMonReturnValue(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleOneReturnValue(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleOneReturnValue_Duplicate(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd37(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd38(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd39(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd40(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleHitAnimation(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd42(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleEffectivenessSound(void) +{ + s8 pan; + + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + pan = PAN_SIDE_PLAYER; + else + pan = PAN_SIDE_OPPONENT; + + PlaySE12WithPanning(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8), pan); + SafariBufferExecCompleted(); +} + +static void SafariHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + SafariBufferExecCompleted(); +} + +static void SafariHandleFaintingCry(void) +{ + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry1(species, 25); + SafariBufferExecCompleted(); +} + +static void SafariHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + SafariBufferExecCompleted(); +} + +static void SafariHandleIntroTrainerBallThrow(void) +{ + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_SAFARI_ALL_TEXT); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + gBattleBankFunc[gActiveBank] = CompleteOnHealthboxSpriteCallbackDummy; +} + +static void SafariHandleDrawPartyStatusSummary(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd49(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd50(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleSpriteInvisibility(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleBattleAnimation(void) +{ + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + SafariBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; +} + +static void SafariHandleLinkStandbyMsg(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleResetActionMoveSelection(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd55(void) +{ + gBattleOutcome = gBattleBufferA[gActiveBank][1]; + FadeOutMapMusic(5); + BeginFastPaletteFade(3); + SafariBufferExecCompleted(); + if ((gBattleTypeFlags & BATTLE_TYPE_LINK) && !(gBattleTypeFlags & BATTLE_TYPE_WILD)) + gBattleBankFunc[gActiveBank] = sub_81595E4; +} + +static void nullsub_115(void) +{ +}