diff --git a/asm/battle_7.s b/asm/battle_7.s deleted file mode 100644 index 94cc1ba8e..000000000 --- a/asm/battle_7.s +++ /dev/null @@ -1,3815 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start AllocateBattleSpritesData -AllocateBattleSpritesData: @ 805D118 - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - movs r0, 0x10 - bl AllocZeroed - str r0, [r4] - movs r0, 0x10 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1] - movs r0, 0x30 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x4] - movs r0, 0x10 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x8] - movs r0, 0x50 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0xC] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end AllocateBattleSpritesData - - thumb_func_start FreeBattleSpritesData -FreeBattleSpritesData: @ 805D158 - push {r4,r5,lr} - ldr r5, =gBattleSpritesDataPtr - ldr r0, [r5] - cmp r0, 0 - beq _0805D192 - ldr r0, [r0, 0xC] - bl Free - ldr r0, [r5] - movs r4, 0 - str r4, [r0, 0xC] - ldr r0, [r0, 0x8] - bl Free - ldr r0, [r5] - str r4, [r0, 0x8] - ldr r0, [r0, 0x4] - bl Free - ldr r0, [r5] - str r4, [r0, 0x4] - ldr r0, [r0] - bl Free - ldr r0, [r5] - str r4, [r0] - bl Free - str r4, [r5] -_0805D192: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end FreeBattleSpritesData - - thumb_func_start ChooseMoveAndTargetInBattlePalace -ChooseMoveAndTargetInBattlePalace: @ 805D19C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r0, 0x1 - negs r0, r0 - mov r9, r0 - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r2, r0, 9 - ldr r1, =gBattleBufferA + 4 - adds r2, r1 - mov r10, r2 - movs r1, 0 - movs r2, 0xFF - bl CheckMoveLimitations - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x64 - bl __umodsi3 - lsls r0, 16 - lsrs r7, r0, 16 - ldr r0, =gBattleStruct - ldr r0, [r0] - adds r0, 0x92 - ldrb r1, [r0] - ldr r2, =gBitTable - ldrb r0, [r4] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - negs r0, r1 - orrs r0, r1 - asrs r4, r0, 31 - movs r0, 0x2 - ands r4, r0 - adds r6, r4, 0 - adds r5, r4, 0x2 - b _0805D20E - .pool -_0805D20C: - adds r4, 0x1 -_0805D20E: - cmp r4, r5 - bge _0805D234 - ldr r0, =gActiveBank - ldrb r1, [r0] - movs r0, 0x58 - muls r0, r1 - ldr r1, =gBattleMons + 0x48 - adds r0, r1 - ldr r0, [r0] - bl GetNatureFromPersonality - lsls r0, 24 - lsrs r0, 22 - adds r0, r4, r0 - ldr r2, =gUnknown_0831C494 - adds r0, r2 - ldrb r0, [r0] - cmp r0, r7 - ble _0805D20C -_0805D234: - subs r7, r4, r6 - cmp r4, r5 - bne _0805D23C - movs r7, 0x2 -_0805D23C: - movs r6, 0 - movs r4, 0 - mov r1, r10 - ldrh r0, [r1] - cmp r0, 0 - beq _0805D27C - mov r5, r10 -_0805D24A: - ldrh r0, [r5] - bl sub_805D4A8 - lsls r0, 24 - lsrs r0, 24 - cmp r7, r0 - bne _0805D26E - mov r0, r10 - adds r0, 0x8 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _0805D26E - ldr r0, =gBitTable - lsls r1, r4, 2 - adds r1, r0 - ldr r0, [r1] - orrs r6, r0 -_0805D26E: - adds r5, 0x2 - adds r4, 0x1 - cmp r4, 0x3 - bgt _0805D27C - ldrh r0, [r5] - cmp r0, 0 - bne _0805D24A -_0805D27C: - cmp r6, 0 - beq _0805D2AC - ldr r3, =gBattleStruct - ldr r1, [r3] - adds r1, 0x92 - ldrb r2, [r1] - movs r0, 0xF - ands r0, r2 - strb r0, [r1] - ldr r1, [r3] - adds r1, 0x92 - lsls r0, r6, 4 - ldrb r2, [r1] - orrs r0, r2 - strb r0, [r1] - lsls r0, r6, 24 - lsrs r0, 24 - bl BattleAI_SetupAIData - bl BattleAI_ChooseMoveOrAction - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_0805D2AC: - movs r0, 0x1 - negs r0, r0 - cmp r9, r0 - beq _0805D2B6 - b _0805D40C -_0805D2B6: - mov r2, r8 - cmp r2, 0xF - bne _0805D2BE - b _0805D3EA -_0805D2BE: - movs r5, 0 - movs r6, 0 - ldr r7, =gBitTable - mov r4, r10 -_0805D2C6: - ldrh r0, [r4] - bl sub_805D4A8 - lsls r0, 24 - cmp r0, 0 - bne _0805D2DE - ldr r0, [r7] - mov r1, r8 - ands r0, r1 - cmp r0, 0 - bne _0805D2DE - adds r5, 0x1 -_0805D2DE: - ldrh r0, [r4] - bl sub_805D4A8 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0805D2F8 - ldr r0, [r7] - mov r2, r8 - ands r0, r2 - cmp r0, 0 - bne _0805D2F8 - adds r5, 0x10 -_0805D2F8: - ldrh r0, [r4] - bl sub_805D4A8 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _0805D316 - ldr r0, [r7] - mov r1, r8 - ands r0, r1 - cmp r0, 0 - bne _0805D316 - movs r2, 0x80 - lsls r2, 1 - adds r5, r2 -_0805D316: - adds r7, 0x4 - adds r4, 0x2 - ldr r0, =gBitTable - adds r0, 0xC - cmp r7, r0 - ble _0805D2C6 - movs r1, 0xF - ands r1, r5 - cmp r1, 0x1 - ble _0805D32C - adds r6, 0x1 -_0805D32C: - movs r0, 0xF0 - ands r0, r5 - cmp r0, 0x1F - ble _0805D336 - adds r6, 0x1 -_0805D336: - ldr r2, =0x000001ff - cmp r0, r2 - ble _0805D33E - adds r6, 0x1 -_0805D33E: - cmp r6, 0x1 - bgt _0805D346 - cmp r6, 0 - bne _0805D388 -_0805D346: - ldr r5, =gBitTable -_0805D348: - bl Random - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - lsrs r4, r1, 16 - lsls r0, r4, 2 - adds r0, r5 - ldr r0, [r0] - mov r1, r8 - ands r0, r1 - cmp r0, 0 - bne _0805D366 - mov r9, r4 -_0805D366: - movs r0, 0x1 - negs r0, r0 - cmp r9, r0 - beq _0805D348 - b _0805D3D4 - .pool -_0805D388: - cmp r1, 0x1 - ble _0805D38E - movs r6, 0 -_0805D38E: - cmp r0, 0x1F - ble _0805D394 - movs r6, 0x1 -_0805D394: - cmp r0, r2 - ble _0805D39A - movs r6, 0x2 -_0805D39A: - bl Random - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - lsrs r4, r1, 16 - ldr r1, =gBitTable - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - mov r2, r8 - ands r0, r2 - cmp r0, 0 - bne _0805D3CC - lsls r0, r4, 1 - add r0, r10 - ldrh r0, [r0] - bl sub_805D4A8 - lsls r0, 24 - lsrs r0, 24 - cmp r6, r0 - bne _0805D3CC - mov r9, r4 -_0805D3CC: - movs r0, 0x1 - negs r0, r0 - cmp r9, r0 - beq _0805D39A -_0805D3D4: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x64 - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x31 - bls _0805D40C -_0805D3EA: - ldr r2, =gProtectStructs - ldr r0, =gActiveBank - ldrb r1, [r0] - lsls r1, 4 - adds r1, r2 - ldrb r0, [r1, 0x2] - movs r2, 0x10 - orrs r0, r2 - strb r0, [r1, 0x2] - movs r0, 0 - b _0805D496 - .pool -_0805D40C: - mov r1, r9 - lsls r0, r1, 1 - mov r2, r10 - adds r1, r2, r0 - ldrh r0, [r1] - cmp r0, 0xAE - bne _0805D434 - ldrb r0, [r2, 0x12] - movs r5, 0 - cmp r0, 0x7 - beq _0805D442 - ldrb r1, [r2, 0x13] - movs r0, 0x7 - eors r1, r0 - negs r0, r1 - orrs r0, r1 - asrs r5, r0, 31 - movs r0, 0x10 - ands r5, r0 - b _0805D442 -_0805D434: - ldr r2, =gBattleMoves - ldrh r1, [r1] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r5, [r0, 0x6] -_0805D442: - movs r0, 0x10 - ands r0, r5 - cmp r0, 0 - beq _0805D45C - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 8 - b _0805D48A - .pool -_0805D45C: - cmp r5, 0 - bne _0805D470 - bl sub_805D5F4 - lsls r0, 16 - lsrs r0, 16 - mov r2, r9 - orrs r2, r0 - mov r9, r2 - b _0805D490 -_0805D470: - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankIdentity - adds r1, r0, 0 - movs r2, 0x1 - movs r0, 0x1 - ands r0, r1 - eors r0, r2 - bl GetBankByIdentity - lsls r0, 24 - lsrs r0, 16 -_0805D48A: - mov r1, r9 - orrs r1, r0 - mov r9, r1 -_0805D490: - mov r2, r9 - lsls r0, r2, 16 - lsrs r0, 16 -_0805D496: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end ChooseMoveAndTargetInBattlePalace - - thumb_func_start sub_805D4A8 -sub_805D4A8: @ 805D4A8 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - ldr r1, =gBattleMoves - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x6] - adds r3, r1, 0 - cmp r0, 0x40 - bls _0805D4C2 - b _0805D5EE -_0805D4C2: - lsls r0, 2 - ldr r1, =_0805D4D4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0805D4D4: - .4byte _0805D5D8 - .4byte _0805D5E6 - .4byte _0805D5D8 - .4byte _0805D5EE - .4byte _0805D5D8 - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5D8 - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EA - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5D8 - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5EE - .4byte _0805D5E6 -_0805D5D8: - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r3 - ldrb r0, [r0, 0x1] - cmp r0, 0 - bne _0805D5EE -_0805D5E6: - movs r0, 0x2 - b _0805D5F0 -_0805D5EA: - movs r0, 0x1 - b _0805D5F0 -_0805D5EE: - movs r0, 0 -_0805D5F0: - pop {r1} - bx r1 - thumb_func_end sub_805D4A8 - - thumb_func_start sub_805D5F4 -sub_805D5F4: @ 805D5F4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0805D6FA - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0805D630 - movs r0, 0x1 - bl GetBankByIdentity - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r0, 0x3 - b _0805D63E - .pool -_0805D630: - movs r0, 0 - bl GetBankByIdentity - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r0, 0x2 -_0805D63E: - bl GetBankByIdentity - lsls r0, 24 - lsrs r7, r0, 24 - ldr r1, =gBattleMons - movs r2, 0x58 - mov r0, r8 - muls r0, r2 - adds r5, r0, r1 - adds r0, r7, 0 - muls r0, r2 - adds r6, r0, r1 - ldrh r0, [r5, 0x28] - ldrh r3, [r6, 0x28] - cmp r0, r3 - bne _0805D680 - bl Random - adds r3, r0, 0 - ldr r0, =gActiveBank - ldrb r1, [r0] - movs r2, 0x1 - movs r0, 0x1 - ands r0, r1 - eors r0, r2 - movs r1, 0x2 - ands r1, r3 - adds r0, r1 - b _0805D702 - .pool -_0805D680: - ldr r4, =gUnknown_0831C604 - ldr r0, =gActiveBank - mov r9, r0 - ldrb r0, [r0] - muls r0, r2 - adds r1, 0x48 - adds r0, r1 - ldr r0, [r0] - bl GetNatureFromPersonality - lsls r0, 24 - lsrs r0, 24 - adds r0, r4 - ldrb r4, [r0] - cmp r4, 0x1 - beq _0805D6CC - cmp r4, 0x1 - bgt _0805D6B4 - cmp r4, 0 - beq _0805D6BA - b _0805D6FA - .pool -_0805D6B4: - cmp r4, 0x2 - beq _0805D6DE - b _0805D6FA -_0805D6BA: - ldrh r0, [r5, 0x28] - ldrh r6, [r6, 0x28] - cmp r0, r6 - bls _0805D6C8 - mov r1, r8 - lsls r0, r1, 8 - b _0805D704 -_0805D6C8: - lsls r0, r7, 8 - b _0805D704 -_0805D6CC: - ldrh r0, [r5, 0x28] - ldrh r6, [r6, 0x28] - cmp r0, r6 - bcs _0805D6DA - mov r3, r8 - lsls r0, r3, 8 - b _0805D704 -_0805D6DA: - lsls r0, r7, 8 - b _0805D704 -_0805D6DE: - bl Random - adds r3, r0, 0 - mov r0, r9 - ldrb r1, [r0] - movs r2, 0x1 - movs r0, 0x1 - ands r0, r1 - eors r0, r2 - ands r4, r3 - adds r0, r4 - lsls r0, 24 - lsrs r0, 16 - b _0805D704 -_0805D6FA: - ldr r0, =gActiveBank - ldrb r1, [r0] - movs r0, 0x1 - eors r0, r1 -_0805D702: - lsls r0, 8 -_0805D704: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_805D5F4 - - thumb_func_start sub_805D714 -sub_805D714: @ 805D714 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x30] - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r2 - adds r0, r1, 0 - adds r0, 0x3F - ldrb r3, [r0] - lsls r0, r3, 26 - cmp r0, 0 - bge _0805D766 - adds r0, r1, 0 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - blt _0805D766 - adds r2, r1, 0 - adds r2, 0x2C - ldrb r1, [r2] - lsls r0, r1, 25 - cmp r0, 0 - bge _0805D75C - movs r0, 0x41 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - b _0805D766 - .pool -_0805D75C: - lsls r0, r3, 27 - cmp r0, 0 - bge _0805D766 - ldr r0, =SpriteCallbackDummy - str r0, [r4, 0x1C] -_0805D766: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805D714 - - thumb_func_start sub_805D770 -sub_805D770: @ 805D770 - push {r4,lr} - adds r4, r0, 0 - lsls r1, 24 - adds r3, r4, 0 - adds r3, 0x2C - ldrb r0, [r3] - movs r2, 0x40 - orrs r0, r2 - strb r0, [r3] - ldr r0, =SpriteCallbackDummy - str r0, [r4, 0x1C] - cmp r1, 0 - bne _0805D798 - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAffineAnim - b _0805D7A0 - .pool -_0805D798: - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAffineAnim -_0805D7A0: - adds r0, r4, 0 - bl AnimateSprite - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_805D770 - - thumb_func_start sub_805D7AC -sub_805D7AC: @ 805D7AC - push {lr} - adds r2, r0, 0 - ldr r0, =gUnknown_020243FC - ldrh r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0805D7E4 - ldrh r0, [r2, 0x2E] - ldrh r1, [r2, 0x24] - adds r0, r1 - strh r0, [r2, 0x24] - lsls r0, 16 - cmp r0, 0 - bne _0805D7E4 - movs r1, 0x26 - ldrsh r0, [r2, r1] - cmp r0, 0 - beq _0805D7E0 - ldr r0, =sub_805D7EC - b _0805D7E2 - .pool -_0805D7E0: - ldr r0, =SpriteCallbackDummy -_0805D7E2: - str r0, [r2, 0x1C] -_0805D7E4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_805D7AC - - thumb_func_start sub_805D7EC -sub_805D7EC: @ 805D7EC - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x26] - subs r0, 0x2 - strh r0, [r1, 0x26] - lsls r0, 16 - cmp r0, 0 - bne _0805D800 - ldr r0, =SpriteCallbackDummy - str r0, [r1, 0x1C] -_0805D800: - pop {r0} - bx r0 - .pool - thumb_func_end sub_805D7EC - - thumb_func_start DoStatusAnimation -DoStatusAnimation: @ 805D808 - push {r4-r6,lr} - adds r4, r1, 0 - lsls r0, 24 - ldr r6, =gBattleSpritesDataPtr - ldr r1, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r3, [r1, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r3 - ldrb r2, [r1] - movs r3, 0x10 - orrs r2, r3 - strb r2, [r1] - cmp r0, 0 - bne _0805D888 - cmp r4, 0x20 - bne _0805D844 - ldrb r0, [r5] - movs r1, 0x6 - bl move_anim_start_t2 - b _0805D902 - .pool -_0805D844: - cmp r4, 0x8 - beq _0805D850 - movs r0, 0x80 - ands r0, r4 - cmp r0, 0 - beq _0805D85A -_0805D850: - ldrb r0, [r5] - movs r1, 0 - bl move_anim_start_t2 - b _0805D902 -_0805D85A: - cmp r4, 0x10 - bne _0805D868 - ldrb r0, [r5] - movs r1, 0x2 - bl move_anim_start_t2 - b _0805D902 -_0805D868: - movs r0, 0x7 - ands r0, r4 - cmp r0, 0 - beq _0805D87A - ldrb r0, [r5] - movs r1, 0x4 - bl move_anim_start_t2 - b _0805D902 -_0805D87A: - cmp r4, 0x40 - bne _0805D8EA - ldrb r0, [r5] - movs r1, 0x5 - bl move_anim_start_t2 - b _0805D902 -_0805D888: - movs r0, 0xF0 - lsls r0, 12 - ands r0, r4 - cmp r0, 0 - beq _0805D89C - ldrb r0, [r5] - movs r1, 0x3 - bl move_anim_start_t2 - b _0805D902 -_0805D89C: - movs r0, 0x7 - ands r0, r4 - cmp r0, 0 - beq _0805D8AE - ldrb r0, [r5] - movs r1, 0x1 - bl move_anim_start_t2 - b _0805D902 -_0805D8AE: - movs r0, 0x80 - lsls r0, 21 - ands r0, r4 - cmp r0, 0 - beq _0805D8C2 - ldrb r0, [r5] - movs r1, 0x7 - bl move_anim_start_t2 - b _0805D902 -_0805D8C2: - movs r0, 0x80 - lsls r0, 20 - ands r0, r4 - cmp r0, 0 - beq _0805D8D6 - ldrb r0, [r5] - movs r1, 0x8 - bl move_anim_start_t2 - b _0805D902 -_0805D8D6: - movs r0, 0xE0 - lsls r0, 8 - ands r0, r4 - cmp r0, 0 - beq _0805D8EA - ldrb r0, [r5] - movs r1, 0x9 - bl move_anim_start_t2 - b _0805D902 -_0805D8EA: - ldr r0, [r6] - ldrb r2, [r5] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_0805D902: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end DoStatusAnimation - - thumb_func_start DoBattleAnimationFromTable -DoBattleAnimationFromTable: @ 805D908 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - ldr r4, [sp, 0x24] - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r10, r1 - lsls r2, 24 - lsrs r2, 24 - str r2, [sp] - lsls r3, 24 - lsrs r5, r3, 24 - lsls r4, 16 - lsrs r7, r4, 16 - cmp r5, 0 - bne _0805D950 - movs r0, 0x80 - ands r0, r7 - cmp r0, 0 - beq _0805D950 - ldr r0, =gBattleMonForms - adds r0, r6, r0 - movs r2, 0x7F - adds r1, r7, 0 - ands r1, r2 - strb r1, [r0] - movs r0, 0x1 - b _0805DA1E - .pool -_0805D950: - ldr r0, =gBattleSpritesDataPtr - mov r9, r0 - ldr r0, [r0] - ldr r0, [r0] - lsls r4, r6, 2 - adds r0, r4, r0 - ldrb r1, [r0] - movs r2, 0x4 - mov r8, r2 - mov r0, r8 - ands r0, r1 - cmp r0, 0 - beq _0805D9CC - adds r0, r5, 0 - bl sub_805DAA0 - lsls r0, 24 - cmp r0, 0 - bne _0805D980 - movs r0, 0x1 - b _0805DA1E - .pool -_0805D980: - mov r1, r9 - ldr r0, [r1] - ldr r0, [r0] - adds r0, r4, r0 - ldrb r1, [r0] - mov r0, r8 - ands r0, r1 - cmp r0, 0 - beq _0805D9CC - cmp r5, 0x2 - bne _0805D9CC - ldr r1, =gSprites - ldr r0, =gBankSpriteIds - adds r0, r6, r0 - ldrb r2, [r0] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _0805D9CC - adds r0, r6, 0 - movs r1, 0x1 - bl refresh_graphics_maybe - adds r0, r6, 0 - bl sub_805E974 - movs r0, 0x1 - b _0805DA1E - .pool -_0805D9CC: - ldr r0, =gAnimBankAttacker - mov r2, r10 - strb r2, [r0] - ldr r0, =gAnimBankTarget - mov r1, sp - ldrb r1, [r1] - strb r1, [r0] - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r0, [r0, 0x8] - strh r7, [r0] - ldr r0, =gUnknown_082C9320 - adds r1, r5, 0 - movs r2, 0 - bl LaunchBattleAnimation - ldr r0, =task0A_0803415C - movs r1, 0xA - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r6, [r1, 0x8] - ldr r0, [r4] - movs r2, 0x8 - ldrsh r1, [r1, r2] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x20 - orrs r1, r2 - strb r1, [r0] - movs r0, 0 -_0805DA1E: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end DoBattleAnimationFromTable - - thumb_func_start task0A_0803415C -task0A_0803415C: @ 805DA48 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _0805DA8A - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0x8 - ldrsh r0, [r0, r1] - ldr r2, [r2, 0x4] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1] - movs r0, 0x21 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - adds r0, r4, 0 - bl DestroyTask -_0805DA8A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task0A_0803415C - - thumb_func_start sub_805DAA0 -sub_805DAA0: @ 805DAA0 - push {lr} - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xD - bgt _0805DAB4 - cmp r0, 0xA - bge _0805DAB8 - cmp r0, 0x2 - beq _0805DAB8 - b _0805DABC -_0805DAB4: - cmp r0, 0x11 - bne _0805DABC -_0805DAB8: - movs r0, 0x1 - b _0805DABE -_0805DABC: - movs r0, 0 -_0805DABE: - pop {r1} - bx r1 - thumb_func_end sub_805DAA0 - - thumb_func_start DoSpecialBattleAnimation -DoSpecialBattleAnimation: @ 805DAC4 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =gAnimBankAttacker - strb r1, [r0] - ldr r0, =gAnimBankTarget - strb r2, [r0] - ldr r0, =gUnknown_082C937C - adds r1, r3, 0 - movs r2, 0 - bl LaunchBattleAnimation - ldr r0, =task0A_08034248 - movs r1, 0xA - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0x8] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - movs r2, 0x8 - ldrsh r1, [r1, r2] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x40 - orrs r1, r2 - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end DoSpecialBattleAnimation - - thumb_func_start task0A_08034248 -task0A_08034248: @ 805DB34 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _0805DB76 - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0x8 - ldrsh r0, [r0, r1] - ldr r2, [r2, 0x4] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1] - movs r0, 0x41 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - adds r0, r4, 0 - bl DestroyTask -_0805DB76: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task0A_08034248 - - thumb_func_start IsMoveWithoutAnimation -IsMoveWithoutAnimation: @ 805DB8C - movs r0, 0 - bx lr - thumb_func_end IsMoveWithoutAnimation - - thumb_func_start mplay_80342A4 -mplay_80342A4: @ 805DB90 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r5, 0 - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0805DBD8 - ldr r2, =gBattleSpritesDataPtr - ldr r0, [r2] - ldr r1, [r0, 0x4] - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x8] - adds r1, 0x1 - strb r1, [r0, 0x8] - ldr r2, [r2] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x8] - cmp r0, 0x1D - bls _0805DBDC - ldr r0, =gMPlay_SE1 - bl m4aMPlayStop - ldr r0, =gMPlay_SE2 - bl m4aMPlayStop -_0805DBD8: - cmp r5, 0 - beq _0805DBF0 -_0805DBDC: - movs r0, 0x1 - b _0805DC02 - .pool -_0805DBF0: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r0, r1 - strb r5, [r0, 0x8] - movs r0, 0 -_0805DC02: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end mplay_80342A4 - - thumb_func_start BattleLoadOpponentMonSpriteGfx -BattleLoadOpponentMonSpriteGfx: @ 805DC0C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - adds r4, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - movs r1, 0 - bl GetMonData - str r0, [sp] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0] - mov r2, r8 - lsls r1, r2, 2 - adds r2, r1, r0 - ldrh r0, [r2, 0x2] - cmp r0, 0 - bne _0805DC50 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r5, r0, 16 - ldr r6, [sp] - b _0805DC58 - .pool -_0805DC50: - ldrh r5, [r2, 0x2] - ldr r0, =gTransformedPersonalities - adds r0, r1, r0 - ldr r6, [r0] -_0805DC58: - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - mov r10, r0 - mov r0, r8 - bl GetBankIdentity - lsls r0, 24 - lsls r2, r5, 3 - ldr r1, =gMonFrontPicTable - adds r2, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - lsrs r0, 22 - adds r1, 0x4 - adds r1, r0 - ldr r1, [r1] - adds r0, r2, 0 - adds r2, r5, 0 - adds r3, r6, 0 - bl HandleLoadSpecialPokePic_DontHandleDeoxys - mov r3, r8 - lsls r2, r3, 4 - movs r0, 0x80 - lsls r0, 1 - adds r7, r2, r0 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0] - lsls r1, r3, 2 - adds r0, r1, r0 - ldrh r0, [r0, 0x2] - str r1, [sp, 0x4] - mov r9, r2 - cmp r0, 0 - bne _0805DCBC - adds r0, r4, 0 - bl pokemon_get_pal - b _0805DCC6 - .pool -_0805DCBC: - adds r0, r5, 0 - mov r1, r10 - ldr r2, [sp] - bl species_and_otid_get_pal -_0805DCC6: - adds r6, r0, 0 - ldr r4, =0x0201c000 - adds r0, r6, 0 - adds r1, r4, 0 - bl LZDecompressWram - adds r0, r4, 0 - adds r1, r7, 0 - movs r2, 0x20 - bl LoadPalette - mov r1, r9 - adds r1, 0x80 - adds r0, r4, 0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =0x00000181 - cmp r5, r0 - bne _0805DD1A - movs r7, 0x80 - lsls r7, 1 - add r7, r9 - ldr r5, =gBattleStruct - ldr r1, [r5] - movs r4, 0x80 - lsls r4, 1 - adds r1, r4 - adds r0, r6, 0 - bl LZDecompressWram - ldr r0, =gBattleMonForms - add r0, r8 - ldrb r1, [r0] - lsls r1, 5 - adds r1, r4 - ldr r0, [r5] - adds r0, r1 - adds r1, r7, 0 - movs r2, 0x20 - bl LoadPalette -_0805DD1A: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0] - ldr r1, [sp, 0x4] - adds r0, r1, r0 - ldrh r0, [r0, 0x2] - cmp r0, 0 - beq _0805DD46 - ldr r3, =0x00007fff - adds r0, r7, 0 - movs r1, 0x10 - movs r2, 0x6 - bl BlendPalette - lsls r1, r7, 1 - ldr r0, =gPlttBufferFaded - adds r0, r1, r0 - ldr r2, =gPlttBufferUnfaded - adds r1, r2 - ldr r2, =0x04000008 - bl CpuSet -_0805DD46: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end BattleLoadOpponentMonSpriteGfx - - thumb_func_start BattleLoadPlayerMonSpriteGfx -BattleLoadPlayerMonSpriteGfx: @ 805DD7C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - adds r6, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - movs r1, 0 - bl GetMonData - str r0, [sp] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0] - mov r2, r8 - lsls r1, r2, 2 - adds r2, r1, r0 - ldrh r0, [r2, 0x2] - cmp r0, 0 - bne _0805DDC0 - adds r0, r6, 0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r5, r0, 16 - ldr r4, [sp] - b _0805DDC8 - .pool -_0805DDC0: - ldrh r5, [r2, 0x2] - ldr r0, =gTransformedPersonalities - adds r0, r1, r0 - ldr r4, [r0] -_0805DDC8: - adds r0, r6, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x4] - mov r0, r8 - bl GetBankIdentity - lsls r0, 24 - lsrs r7, r0, 24 - movs r0, 0x1 - mov r1, r8 - bl sub_80688F8 - lsls r0, 24 - lsrs r0, 24 - mov r1, r8 - lsls r1, 2 - mov r10, r1 - cmp r0, 0x1 - beq _0805DE00 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0] - add r0, r10 - ldrh r0, [r0, 0x2] - cmp r0, 0 - beq _0805DE2C -_0805DE00: - lsls r0, r5, 3 - ldr r1, =gMonBackPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - lsls r2, r7, 2 - adds r1, 0x4 - adds r1, r2 - ldr r1, [r1] - adds r2, r5, 0 - adds r3, r4, 0 - bl HandleLoadSpecialPokePic_DontHandleDeoxys - b _0805DE46 - .pool -_0805DE2C: - lsls r0, r5, 3 - ldr r1, =gMonBackPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - lsls r2, r7, 2 - adds r1, 0x4 - adds r1, r2 - ldr r1, [r1] - adds r2, r5, 0 - adds r3, r4, 0 - bl HandleLoadSpecialPokePic -_0805DE46: - mov r2, r8 - lsls r1, r2, 4 - movs r0, 0x80 - lsls r0, 1 - adds r7, r1, r0 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0] - add r0, r10 - ldrh r0, [r0, 0x2] - mov r9, r1 - cmp r0, 0 - bne _0805DE74 - adds r0, r6, 0 - bl pokemon_get_pal - b _0805DE7E - .pool -_0805DE74: - adds r0, r5, 0 - ldr r1, [sp, 0x4] - ldr r2, [sp] - bl species_and_otid_get_pal -_0805DE7E: - adds r6, r0, 0 - ldr r4, =0x0201c000 - adds r0, r6, 0 - adds r1, r4, 0 - bl LZDecompressWram - adds r0, r4, 0 - adds r1, r7, 0 - movs r2, 0x20 - bl LoadPalette - mov r1, r9 - adds r1, 0x80 - adds r0, r4, 0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =0x00000181 - cmp r5, r0 - bne _0805DED2 - movs r7, 0x80 - lsls r7, 1 - add r7, r9 - ldr r5, =gBattleStruct - ldr r1, [r5] - movs r4, 0x80 - lsls r4, 1 - adds r1, r4 - adds r0, r6, 0 - bl LZDecompressWram - ldr r0, =gBattleMonForms - add r0, r8 - ldrb r1, [r0] - lsls r1, 5 - adds r1, r4 - ldr r0, [r5] - adds r0, r1 - adds r1, r7, 0 - movs r2, 0x20 - bl LoadPalette -_0805DED2: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0] - add r0, r10 - ldrh r0, [r0, 0x2] - cmp r0, 0 - beq _0805DEFC - ldr r3, =0x00007fff - adds r0, r7, 0 - movs r1, 0x10 - movs r2, 0x6 - bl BlendPalette - lsls r1, r7, 1 - ldr r0, =gPlttBufferFaded - adds r0, r1, r0 - ldr r2, =gPlttBufferUnfaded - adds r1, r2 - ldr r2, =0x04000008 - bl CpuSet -_0805DEFC: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end BattleLoadPlayerMonSpriteGfx - - thumb_func_start nullsub_23 -nullsub_23: @ 805DF30 - bx lr - thumb_func_end nullsub_23 - - thumb_func_start nullsub_24 -nullsub_24: @ 805DF34 - bx lr - thumb_func_end nullsub_24 - - thumb_func_start DecompressTrainerFrontPic -DecompressTrainerFrontPic: @ 805DF38 - push {r4,lr} - adds r4, r0, 0 - adds r0, r1, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r0, 24 - lsrs r0, 24 - bl GetBankIdentity - lsls r0, 24 - lsls r4, 3 - ldr r2, =gTrainerFrontPicTable - adds r2, r4, r2 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - lsrs r0, 22 - adds r1, 0x4 - adds r1, r0 - ldr r1, [r1] - adds r0, r2, 0 - movs r2, 0 - bl DecompressPicFromTable_2 - ldr r0, =gTrainerFrontPicPaletteTable - adds r4, r0 - adds r0, r4, 0 - bl LoadCompressedObjectPalette - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end DecompressTrainerFrontPic - - thumb_func_start DecompressTrainerBackPic -DecompressTrainerBackPic: @ 805DF84 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - lsls r5, 16 - lsrs r5, 16 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl GetBankIdentity - lsls r0, 24 - lsls r5, 3 - ldr r2, =gTrainerBackPicTable - adds r2, r5, r2 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - lsrs r0, 22 - adds r1, 0x4 - adds r1, r0 - ldr r1, [r1] - adds r0, r2, 0 - movs r2, 0 - bl DecompressPicFromTable_2 - ldr r0, =gTrainerBackPicPaletteTable - adds r5, r0 - ldr r0, [r5] - lsls r4, 20 - movs r1, 0x80 - lsls r1, 17 - adds r4, r1 - lsrs r4, 16 - adds r1, r4, 0 - movs r2, 0x20 - bl LoadCompressedPalette - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end DecompressTrainerBackPic - - thumb_func_start nullsub_25 -nullsub_25: @ 805DFE0 - bx lr - thumb_func_end nullsub_25 - - thumb_func_start FreeTrainerFrontPicPalette -FreeTrainerFrontPicPalette: @ 805DFE4 - push {lr} - lsls r0, 16 - ldr r1, =gTrainerFrontPicPaletteTable - lsrs r0, 13 - adds r0, r1 - ldrh r0, [r0, 0x4] - bl FreeSpritePaletteByTag - pop {r0} - bx r0 - .pool - thumb_func_end FreeTrainerFrontPicPalette - - thumb_func_start sub_805DFFC -sub_805DFFC: @ 805DFFC - push {r4-r7,lr} - ldr r4, =gUnknown_0832C128 - adds r0, r4, 0 - bl LoadSpritePalette - adds r4, 0x8 - adds r0, r4, 0 - bl LoadSpritePalette - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - bne _0805E034 - ldr r0, =gUnknown_0832C0D0 - bl LoadCompressedObjectPic - ldr r0, =gUnknown_0832C0D8 - bl LoadCompressedObjectPic - movs r5, 0x2 - b _0805E056 - .pool -_0805E034: - ldr r4, =gUnknown_0832C0E0 - adds r0, r4, 0 - bl LoadCompressedObjectPic - adds r4, 0x8 - adds r0, r4, 0 - bl LoadCompressedObjectPic - ldr r4, =gUnknown_0832C0F0 - adds r0, r4, 0 - bl LoadCompressedObjectPic - adds r4, 0x8 - adds r0, r4, 0 - bl LoadCompressedObjectPic - movs r5, 0x4 -_0805E056: - movs r4, 0 - cmp r4, r5 - bcs _0805E076 - ldr r7, =gBanksByIdentity - ldr r6, =gUnknown_0832C108 -_0805E060: - adds r0, r4, r7 - ldrb r0, [r0] - lsls r0, 3 - adds r0, r6 - bl LoadCompressedObjectPic - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _0805E060 -_0805E076: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805DFFC - - thumb_func_start BattleLoadAllHealthBoxesGfx -BattleLoadAllHealthBoxesGfx: @ 805E08C - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - movs r6, 0 - cmp r4, 0 - bne _0805E09C - b _0805E1AE -_0805E09C: - cmp r4, 0x1 - bne _0805E0B8 - ldr r4, =gUnknown_0832C128 - adds r0, r4, 0 - bl LoadSpritePalette - adds r4, 0x8 - adds r0, r4, 0 - bl LoadSpritePalette - b _0805E1AE - .pool -_0805E0B8: - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - bne _0805E120 - cmp r4, 0x2 - bne _0805E0F0 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0805E0E4 - ldr r0, =gUnknown_0832C100 - bl LoadCompressedObjectPic - b _0805E1AE - .pool -_0805E0E4: - ldr r0, =gUnknown_0832C0D0 - bl LoadCompressedObjectPic - b _0805E1AE - .pool -_0805E0F0: - cmp r4, 0x3 - bne _0805E100 - ldr r0, =gUnknown_0832C0D8 - bl LoadCompressedObjectPic - b _0805E1AE - .pool -_0805E100: - cmp r4, 0x4 - bne _0805E110 - ldr r0, =gBanksByIdentity - ldrb r0, [r0] - b _0805E198 - .pool -_0805E110: - cmp r4, 0x5 - bne _0805E1AC - ldr r0, =gBanksByIdentity - ldrb r0, [r0, 0x1] - b _0805E198 - .pool -_0805E120: - cmp r4, 0x2 - bne _0805E130 - ldr r0, =gUnknown_0832C0E0 - bl LoadCompressedObjectPic - b _0805E1AE - .pool -_0805E130: - cmp r4, 0x3 - bne _0805E140 - ldr r0, =gUnknown_0832C0E8 - bl LoadCompressedObjectPic - b _0805E1AE - .pool -_0805E140: - cmp r4, 0x4 - bne _0805E150 - ldr r0, =gUnknown_0832C0F0 - bl LoadCompressedObjectPic - b _0805E1AE - .pool -_0805E150: - cmp r4, 0x5 - bne _0805E160 - ldr r0, =gUnknown_0832C0F8 - bl LoadCompressedObjectPic - b _0805E1AE - .pool -_0805E160: - cmp r4, 0x6 - bne _0805E170 - ldr r0, =gBanksByIdentity - ldrb r0, [r0] - b _0805E198 - .pool -_0805E170: - cmp r4, 0x7 - bne _0805E180 - ldr r0, =gBanksByIdentity - ldrb r0, [r0, 0x1] - b _0805E198 - .pool -_0805E180: - cmp r4, 0x8 - bne _0805E190 - ldr r0, =gBanksByIdentity - ldrb r0, [r0, 0x2] - b _0805E198 - .pool -_0805E190: - cmp r5, 0x9 - bne _0805E1AC - ldr r0, =gBanksByIdentity - ldrb r0, [r0, 0x3] -_0805E198: - lsls r0, 3 - ldr r1, =gUnknown_0832C108 - adds r0, r1 - bl LoadCompressedObjectPic - b _0805E1AE - .pool -_0805E1AC: - movs r6, 0x1 -_0805E1AE: - adds r0, r6, 0 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end BattleLoadAllHealthBoxesGfx - - thumb_func_start LoadBattleBarGfx -LoadBattleBarGfx: @ 805E1B8 - push {lr} - ldr r0, =gUnknown_08C093F0 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - movs r2, 0xBA - lsls r2, 1 - adds r1, r2 - ldr r1, [r1] - bl LZDecompressWram - pop {r0} - bx r0 - .pool - thumb_func_end LoadBattleBarGfx - - thumb_func_start BattleInitAllSprites -BattleInitAllSprites: @ 805E1D8 - push {r4-r6,lr} - adds r5, r0, 0 - adds r4, r1, 0 - movs r6, 0 - ldrb r0, [r5] - cmp r0, 0x6 - bls _0805E1E8 - b _0805E346 -_0805E1E8: - lsls r0, 2 - ldr r1, =_0805E1F8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0805E1F8: - .4byte _0805E214 - .4byte _0805E21A - .4byte _0805E324 - .4byte _0805E230 - .4byte _0805E260 - .4byte _0805E29C - .4byte _0805E33C -_0805E214: - bl sub_805E378 - b _0805E324 -_0805E21A: - ldrb r0, [r4] - bl BattleLoadAllHealthBoxesGfx - lsls r0, 24 - cmp r0, 0 - beq _0805E228 - b _0805E320 -_0805E228: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0805E346 -_0805E230: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0805E24C - ldrb r0, [r4] - cmp r0, 0 - bne _0805E24C - bl CreateSafariPlayerHealthboxSprites - b _0805E252 - .pool -_0805E24C: - ldrb r0, [r4] - bl CreateBankHealthboxSprites -_0805E252: - ldr r2, =gHealthBoxesIds - ldrb r1, [r4] - adds r1, r2 - strb r0, [r1] - b _0805E30E - .pool -_0805E260: - ldrb r0, [r4] - bl SetBankHealthboxSpritePos - ldr r0, =gBanksByIdentity - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - cmp r0, 0x1 - bhi _0805E288 - ldr r0, =gHealthBoxesIds - adds r0, r1, r0 - ldrb r0, [r0] - movs r1, 0 - bl DummyBattleInterfaceFunc - b _0805E30E - .pool -_0805E288: - ldr r0, =gHealthBoxesIds - adds r0, r1, r0 - ldrb r0, [r0] - movs r1, 0x1 - bl DummyBattleInterfaceFunc - b _0805E30E - .pool -_0805E29C: - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0805E2E4 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0805E302 - ldr r0, =gHealthBoxesIds - ldrb r1, [r4] - 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, 0 - bl UpdateHealthboxAttribute - b _0805E302 - .pool -_0805E2E4: - ldr r0, =gHealthBoxesIds - ldrb r1, [r4] - 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, =gEnemyParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute -_0805E302: - ldr r1, =gHealthBoxesIds - ldrb r0, [r4] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible -_0805E30E: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - ldr r1, =gNoOfAllBanks - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r1] - cmp r0, r1 - bne _0805E346 -_0805E320: - movs r0, 0 - strb r0, [r4] -_0805E324: - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] - b _0805E346 - .pool -_0805E33C: - bl LoadAndCreateEnemyShadowSprites - bl sub_81B8C68 - movs r6, 0x1 -_0805E346: - adds r0, r6, 0 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end BattleInitAllSprites - - thumb_func_start sub_805E350 -sub_805E350: @ 805E350 - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r0, [r0, 0x4] - movs r1, 0 - movs r2, 0x30 - bl memset - ldr r0, [r4] - ldr r0, [r0, 0x8] - movs r1, 0 - movs r2, 0x10 - bl memset - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805E350 - - thumb_func_start sub_805E378 -sub_805E378: @ 805E378 - push {lr} - bl sub_805E350 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0] - movs r1, 0 - movs r2, 0x10 - bl memset - pop {r0} - bx r0 - .pool - thumb_func_end sub_805E378 - - thumb_func_start sub_805E394 -sub_805E394: @ 805E394 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - movs r4, 0 - ldr r5, =gNoOfAllBanks - ldrb r0, [r5] - cmp r4, r0 - bge _0805E3EA - ldr r0, =gSprites - mov r9, r0 - movs r0, 0x1 - mov r12, r0 - movs r0, 0x2 - negs r0, r0 - mov r8, r0 - ldr r7, =gBattleSpritesDataPtr - ldr r6, =gBankSpriteIds -_0805E3B8: - ldr r0, [r7] - ldr r0, [r0] - lsls r3, r4, 2 - adds r3, r0 - adds r0, r4, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r9 - adds r0, 0x3E - ldrb r1, [r0] - lsls r1, 29 - lsrs r1, 31 - mov r0, r12 - ands r1, r0 - ldrb r2, [r3] - mov r0, r8 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - adds r4, 0x1 - ldrb r0, [r5] - cmp r4, r0 - blt _0805E3B8 -_0805E3EA: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805E394 - - thumb_func_start CopyBattleSpriteInvisibility -CopyBattleSpriteInvisibility: @ 805E408 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gBattleSpritesDataPtr - ldr r1, [r1] - ldr r1, [r1] - lsls r3, r0, 2 - adds r3, r1 - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r1, [r0] - lsls r1, 29 - lsrs r1, 31 - ldrb r2, [r3] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bx lr - .pool - thumb_func_end CopyBattleSpriteInvisibility - - thumb_func_start sub_805E448 -sub_805E448: @ 805E448 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r7, r0, 24 - lsls r1, 24 - lsrs r1, 24 - str r1, [sp] - lsls r2, 24 - cmp r2, 0 - beq _0805E51C - ldr r0, =gBankSpriteIds - adds r5, r7, r0 - ldrb r1, [r5] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - mov r8, r1 - add r0, r8 - ldr r4, =gBattleSpritesDataPtr - ldr r1, [r4] - ldr r1, [r1, 0x8] - ldrb r1, [r1] - bl StartSpriteAnim - lsls r0, r7, 20 - movs r2, 0x80 - lsls r2, 17 - adds r0, r2 - lsrs r6, r0, 16 - ldr r2, =gBattleStruct - ldr r0, [r4] - ldr r0, [r0, 0x8] - ldrh r1, [r0] - lsls r1, 5 - movs r3, 0x80 - lsls r3, 1 - adds r1, r3 - ldr r0, [r2] - adds r0, r1 - adds r1, r6, 0 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gBattleMonForms - adds r1, r7, r1 - ldr r0, [r4] - ldr r0, [r0, 0x8] - ldrh r0, [r0] - strb r0, [r1] - ldr r0, [r4] - ldr r1, [r0] - lsls r0, r7, 2 - adds r0, r1 - ldrh r0, [r0, 0x2] - cmp r0, 0 - beq _0805E4DE - ldr r3, =0x00007fff - adds r0, r6, 0 - movs r1, 0x10 - movs r2, 0x6 - bl BlendPalette - lsls r1, r6, 1 - ldr r0, =gPlttBufferFaded - adds r0, r1, r0 - ldr r2, =gPlttBufferUnfaded - adds r1, r2 - ldr r2, =0x04000008 - bl CpuSet -_0805E4DE: - adds r0, r7, 0 - bl sub_80A6138 - ldrb r2, [r5] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r8 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x22] - b _0805E77A - .pool -_0805E51C: - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _0805E558 - movs r0, 0 - mov r10, r0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0x18] - ldrh r1, [r2, 0x2] - mov r8, r1 - ldr r3, [r2, 0x8] - mov r9, r3 - ldr r4, [r2, 0xC] - lsls r0, r1, 3 - ldr r1, =gMonBackPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - ldr r1, [r1, 0x4] - ldr r3, [r2, 0x10] - b _0805E5FA - .pool -_0805E558: - adds r0, r7, 0 - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - ldr r0, [sp] - bl GetBankSide - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0805E58C - ldr r1, =gBattlePartyID - ldr r2, [sp] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - b _0805E59C - .pool -_0805E58C: - ldr r1, =gBattlePartyID - ldr r3, [sp] - lsls r0, r3, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty -_0805E59C: - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - adds r0, r7, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0805E618 - ldr r0, =gBattlePartyID - lsls r4, r7, 1 - adds r4, r0 - ldrh r0, [r4] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - movs r1, 0 - bl GetMonData - mov r9, r0 - ldrh r0, [r4] - muls r0, r6 - adds r0, r5 - movs r1, 0x1 - bl GetMonData - adds r4, r0, 0 - mov r1, r8 - lsls r0, r1, 3 - ldr r1, =gMonBackPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - mov r3, r10 - lsls r2, r3, 2 - adds r1, 0x4 - adds r1, r2 - ldr r1, [r1] - ldr r3, =gTransformedPersonalities - lsls r2, r7, 2 - adds r2, r3 - ldr r3, [r2] -_0805E5FA: - mov r2, r8 - bl HandleLoadSpecialPokePic_DontHandleDeoxys - b _0805E662 - .pool -_0805E618: - ldr r0, =gBattlePartyID - lsls r4, r7, 1 - adds r4, r0 - ldrh r0, [r4] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gEnemyParty - adds r0, r5 - movs r1, 0 - bl GetMonData - mov r9, r0 - ldrh r0, [r4] - muls r0, r6 - adds r0, r5 - movs r1, 0x1 - bl GetMonData - adds r4, r0, 0 - mov r1, r8 - lsls r0, r1, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - mov r3, r10 - lsls r2, r3, 2 - adds r1, 0x4 - adds r1, r2 - ldr r1, [r1] - ldr r3, =gTransformedPersonalities - lsls r2, r7, 2 - adds r2, r3 - ldr r3, [r2] - mov r2, r8 - bl HandleLoadSpecialPokePic_DontHandleDeoxys -_0805E662: - ldr r0, =gMonSpritesGfxPtr - ldr r0, [r0] - mov r2, r10 - lsls r1, r2, 2 - adds r0, 0x4 - adds r0, r1 - ldr r2, [r0] - ldr r0, =gBankSpriteIds - adds r0, r7 - mov r10, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r3, =gSprites - adds r0, r3 - ldrh r0, [r0, 0x4] - lsls r0, 22 - lsrs r0, 17 - ldr r1, =0x06010000 - adds r0, r1 - ldr r1, =0x040000d4 - str r2, [r1] - str r0, [r1, 0x4] - ldr r0, =0x84000200 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - lsls r0, r7, 20 - movs r1, 0x80 - lsls r1, 17 - adds r0, r1 - lsrs r6, r0, 16 - mov r0, r8 - adds r1, r4, 0 - mov r2, r9 - bl species_and_otid_get_pal - mov r9, r0 - ldr r4, =0x0201c000 - adds r1, r4, 0 - bl LZDecompressWram - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =0x00000181 - cmp r8, r0 - bne _0805E70A - mov r2, r10 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r1, 0x8 - adds r0, r1 - ldr r1, =gMonAnimationsSpriteAnimsPtrTable - mov r3, r8 - lsls r2, r3, 2 - adds r1, r2 - ldr r1, [r1] - str r1, [r0] - ldr r5, =gBattleStruct - ldr r1, [r5] - movs r4, 0x80 - lsls r4, 1 - adds r1, r4 - mov r0, r9 - bl LZDecompressWram - ldr r0, =gBattleMonForms - ldr r1, [sp] - adds r0, r1, r0 - ldrb r1, [r0] - lsls r1, 5 - adds r1, r4 - ldr r0, [r5] - adds r0, r1 - adds r1, r6, 0 - movs r2, 0x20 - bl LoadPalette -_0805E70A: - ldr r3, =0x00007fff - adds r0, r6, 0 - movs r1, 0x10 - movs r2, 0x6 - bl BlendPalette - lsls r1, r6, 1 - ldr r0, =gPlttBufferFaded - adds r0, r1, r0 - ldr r2, =gPlttBufferUnfaded - adds r1, r2 - ldr r2, =0x04000008 - bl CpuSet - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _0805E74A - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r7, 2 - adds r0, r1 - mov r2, r8 - strh r2, [r0, 0x2] - ldr r0, =gBattleMonForms - adds r1, r7, r0 - ldr r3, [sp] - adds r0, r3, r0 - ldrb r0, [r0] - strb r0, [r1] -_0805E74A: - adds r0, r7, 0 - bl sub_80A6138 - mov r1, r10 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - ldr r2, =gSprites - adds r1, r2 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x22] - mov r3, r10 - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r1, =gBattleMonForms - adds r1, r7, r1 - ldrb r1, [r1] - bl StartSpriteAnim -_0805E77A: - 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_805E448 - - thumb_func_start BattleLoadSubstituteSpriteGfx -BattleLoadSubstituteSpriteGfx: @ 805E7DC - push {r4-r7,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - lsls r1, 24 - cmp r1, 0 - bne _0805E898 - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _0805E7F8 - movs r4, 0 - b _0805E802 -_0805E7F8: - adds r0, r4, 0 - bl GetBankIdentity - lsls r0, 24 - lsrs r4, r0, 24 -_0805E802: - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _0805E814 - ldr r0, =gUnknown_08C2D120 - b _0805E822 - .pool -_0805E814: - adds r0, r5, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - beq _0805E83C - ldr r0, =gUnknown_08C2CEE0 -_0805E822: - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - lsls r4, 2 - adds r1, 0x4 - adds r1, r4 - ldr r1, [r1] - bl LZDecompressVram - b _0805E84E - .pool -_0805E83C: - ldr r0, =gUnknown_08C2D120 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - lsls r4, 2 - adds r1, 0x4 - adds r1, r4 - ldr r1, [r1] - bl LZDecompressVram -_0805E84E: - movs r3, 0x1 - lsls r6, r5, 4 - ldr r7, =gUnknown_08C2CEBC - ldr r0, =gMonSpritesGfxPtr - ldr r0, [r0] - adds r0, 0x4 - adds r4, r0, r4 - ldr r2, =0x040000d4 - ldr r5, =0x84000200 -_0805E860: - ldr r0, [r4] - lsls r1, r3, 11 - adds r1, r0, r1 - str r0, [r2] - str r1, [r2, 0x4] - str r5, [r2, 0x8] - ldr r0, [r2, 0x8] - adds r3, 0x1 - cmp r3, 0x3 - ble _0805E860 - movs r0, 0x80 - lsls r0, 1 - adds r1, r6, r0 - adds r0, r7, 0 - movs r2, 0x20 - bl LoadCompressedPalette - b _0805E8E6 - .pool -_0805E898: - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _0805E8E6 - adds r0, r4, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - beq _0805E8D0 - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - adds r1, r4, 0 - bl BattleLoadOpponentMonSpriteGfx - b _0805E8E6 - .pool -_0805E8D0: - ldr r1, =gBattlePartyID - lsls r0, r5, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - adds r1, r5, 0 - bl BattleLoadPlayerMonSpriteGfx -_0805E8E6: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end BattleLoadSubstituteSpriteGfx - - thumb_func_start refresh_graphics_maybe -refresh_graphics_maybe: @ 805E8F4 - push {r4-r6,lr} - adds r5, r1, 0 - adds r4, r2, 0 - lsls r0, 24 - lsrs r6, r0, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - adds r1, r5, 0 - bl BattleLoadSubstituteSpriteGfx - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - ldr r1, =gSprites - adds r4, r0, r1 - ldr r0, =gBattleMonForms - adds r0, r6, r0 - ldrb r1, [r0] - adds r0, r4, 0 - bl StartSpriteAnim - cmp r5, 0 - bne _0805E938 - adds r0, r6, 0 - bl sub_80A614C - b _0805E93E - .pool -_0805E938: - adds r0, r6, 0 - bl sub_80A6138 -_0805E93E: - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x22] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end refresh_graphics_maybe - - thumb_func_start TrySetBehindSubstituteSpriteBit -TrySetBehindSubstituteSpriteBit: @ 805E94C - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r1, 16 - lsrs r1, 16 - cmp r1, 0xA4 - bne _0805E96C - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0] - lsls r1, r2, 2 - adds r1, r0 - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] -_0805E96C: - pop {r0} - bx r0 - .pool - thumb_func_end TrySetBehindSubstituteSpriteBit - - thumb_func_start sub_805E974 -sub_805E974: @ 805E974 - lsls r0, 24 - ldr r1, =gBattleSpritesDataPtr - ldr r1, [r1] - ldr r1, [r1] - lsrs r0, 22 - adds r0, r1 - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - bx lr - .pool - thumb_func_end sub_805E974 - - thumb_func_start sub_805E990 -sub_805E990: @ 805E990 - push {r4-r7,lr} - adds r5, r0, 0 - lsls r1, 24 - lsrs r6, r1, 24 - adds r7, r6, 0 - movs r1, 0x39 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r5, 0 - movs r1, 0x3A - bl GetMonData - adds r1, r0, 0 - lsls r4, 16 - asrs r4, 16 - lsls r1, 16 - asrs r1, 16 - adds r0, r4, 0 - bl GetHPBarLevel - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0805EA08 - ldr r7, =gBattleSpritesDataPtr - ldr r0, [r7] - ldr r2, [r0] - lsls r4, r6, 2 - adds r0, r4, r2 - ldrb r1, [r0] - movs r5, 0x2 - movs r3, 0x2 - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - bne _0805EA5A - adds r0, r6, 0 - eors r0, r5 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - bne _0805E9F6 - movs r0, 0x5A - bl PlaySE -_0805E9F6: - ldr r0, [r7] - ldr r1, [r0] - adds r1, r4, r1 - ldrb r0, [r1] - orrs r0, r5 - strb r0, [r1] - b _0805EA5A - .pool -_0805EA08: - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r0, [r0] - lsls r1, r6, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x3 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - bne _0805EA34 - movs r0, 0x5A - bl m4aSongNumStop - b _0805EA5A - .pool -_0805EA34: - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805EA5A - ldr r1, [r4] - movs r0, 0x2 - eors r7, r0 - ldr r1, [r1] - lsls r0, r7, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _0805EA5A - movs r0, 0x5A - bl m4aSongNumStop -_0805EA5A: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_805E990 - - thumb_func_start BattleMusicStop -BattleMusicStop: @ 805EA60 - push {r4-r6,lr} - movs r0, 0 - bl GetBankByIdentity - lsls r0, 24 - lsrs r4, r0, 24 - ldr r5, =gBattleSpritesDataPtr - ldr r0, [r5] - ldr r0, [r0] - lsls r1, r4, 2 - adds r1, r0 - ldrb r2, [r1] - movs r6, 0x3 - negs r6, r6 - adds r0, r6, 0 - ands r0, r2 - strb r0, [r1] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805EAA2 - ldr r2, [r5] - movs r0, 0x2 - adds r1, r4, 0 - eors r1, r0 - ldr r0, [r2] - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - adds r0, r6, 0 - ands r0, r2 - strb r0, [r1] -_0805EAA2: - movs r0, 0x5A - bl m4aSongNumStop - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end BattleMusicStop - - thumb_func_start sub_805EAB4 -sub_805EAB4: @ 805EAB4 - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0x39 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r5, 0 - movs r1, 0x3A - bl GetMonData - adds r1, r0, 0 - lsls r4, 16 - asrs r4, 16 - lsls r1, 16 - asrs r1, 16 - adds r0, r4, 0 - bl GetHPBarLevel - lsls r0, 24 - lsrs r0, 24 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_805EAB4 - - thumb_func_start sub_805EAE8 -sub_805EAE8: @ 805EAE8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0805EB7E - movs r0, 0 - bl GetBankByIdentity - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r0, 0x2 - bl GetBankByIdentity - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r5, =gBattlePartyID - mov r1, r8 - lsls r0, r1, 1 - adds r0, r5 - ldrb r0, [r0] - bl pokemon_order_func - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - mov r1, r9 - lsls r0, r1, 1 - adds r0, r5 - ldrb r0, [r0] - bl pokemon_order_func - lsls r0, 24 - lsrs r5, r0, 24 - movs r7, 0x64 - adds r0, r4, 0 - muls r0, r7 - ldr r6, =gPlayerParty - adds r4, r0, r6 - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - beq _0805EB5A - adds r0, r4, 0 - mov r1, r8 - bl sub_805E990 -_0805EB5A: - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805EB7E - adds r0, r5, 0 - muls r0, r7 - adds r4, r0, r6 - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - beq _0805EB7E - adds r0, r4, 0 - mov r1, r9 - bl sub_805E990 -_0805EB7E: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805EAE8 - - thumb_func_start sub_805EB9C -sub_805EB9C: @ 805EB9C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r5, 0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r5, r0 - bge _0805EC6C - movs r0, 0x3 - mov r10, r8 - mov r1, r10 - ands r1, r0 - mov r10, r1 - movs r6, 0 - movs r2, 0x3F - negs r2, r2 - mov r9, r2 -_0805EBC8: - lsls r0, r5, 24 - lsrs r0, 24 - bl IsBankSpritePresent - lsls r0, 24 - cmp r0, 0 - beq _0805EC60 - ldr r4, =gSprites - ldr r0, =gBankSpriteIds - adds r3, r5, r0 - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0, 0x1] - movs r7, 0x4 - negs r7, r7 - adds r2, r7, 0 - ands r1, r2 - mov r2, r10 - orrs r1, r2 - strb r1, [r0, 0x1] - mov r7, r8 - cmp r7, 0 - bne _0805EC3C - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r2, [r0, 0x4] - adds r2, r6, r2 - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r0, [r0, 0x3] - lsls r0, 26 - lsrs r0, 27 - strb r0, [r2, 0x6] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0, 0x3] - mov r2, r9 - ands r1, r2 - strb r1, [r0, 0x3] - b _0805EC60 - .pool -_0805EC3C: - ldrb r0, [r3] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r4 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x4] - adds r0, r6, r0 - ldrb r1, [r0, 0x6] - movs r0, 0x1F - ands r1, r0 - lsls r1, 1 - ldrb r0, [r2, 0x3] - mov r3, r9 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x3] -_0805EC60: - adds r6, 0xC - adds r5, 0x1 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r5, r0 - blt _0805EBC8 -_0805EC6C: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805EB9C - - thumb_func_start LoadAndCreateEnemyShadowSprites -LoadAndCreateEnemyShadowSprites: @ 805EC84 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r0, =gUnknown_0831C6A0 - bl LoadCompressedObjectPic - movs r0, 0x1 - bl GetBankByIdentity - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gUnknown_0831C6B0 - mov r8, r0 - adds r0, r5, 0 - movs r1, 0 - bl sub_80A5C6C - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - movs r1, 0x1 - bl sub_80A5C6C - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 8 - movs r0, 0xE8 - lsls r0, 13 - adds r2, r0 - asrs r2, 16 - mov r0, r8 - adds r1, r4, 0 - movs r3, 0xC8 - bl CreateSprite - ldr r6, =gBattleSpritesDataPtr - ldr r1, [r6] - ldr r2, [r1, 0x4] - lsls r1, r5, 1 - adds r1, r5 - lsls r1, 2 - adds r2, r1, r2 - strb r0, [r2, 0x7] - ldr r7, =gSprites - ldr r0, [r6] - ldr r0, [r0, 0x4] - adds r1, r0 - ldrb r1, [r1, 0x7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - strh r5, [r0, 0x2E] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805ED56 - movs r0, 0x3 - bl GetBankByIdentity - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r5, 0 - movs r1, 0 - bl sub_80A5C6C - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - movs r1, 0x1 - bl sub_80A5C6C - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 8 - movs r0, 0xE8 - lsls r0, 13 - adds r2, r0 - asrs r2, 16 - mov r0, r8 - adds r1, r4, 0 - movs r3, 0xC8 - bl CreateSprite - ldr r1, [r6] - ldr r2, [r1, 0x4] - lsls r1, r5, 1 - adds r1, r5 - lsls r1, 2 - adds r2, r1, r2 - strb r0, [r2, 0x7] - ldr r0, [r6] - ldr r0, [r0, 0x4] - adds r1, r0 - ldrb r1, [r1, 0x7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - strh r5, [r0, 0x2E] -_0805ED56: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end LoadAndCreateEnemyShadowSprites - - thumb_func_start sub_805ED70 -@ int sub_805ED70(obj *a1) -sub_805ED70: @ 805ED70 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r0, 0 - movs r0, 0 - mov r8, r0 - ldrh r0, [r5, 0x2E] - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gBankSpriteIds - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r7, r0, r1 - adds r6, r7, 0 - adds r6, 0x3E - ldrb r1, [r6] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0805EDAC - adds r0, r4, 0 - bl IsBankSpritePresent - lsls r0, 24 - cmp r0, 0 - bne _0805EDC0 -_0805EDAC: - ldr r0, =sub_805EE48 - str r0, [r5, 0x1C] - b _0805EE36 - .pool -_0805EDC0: - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _0805EDD2 - ldrb r1, [r6] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0805EDE4 -_0805EDD2: - movs r0, 0x1 - mov r8, r0 - ldr r2, =gBattleSpritesDataPtr - lsls r4, 2 - b _0805EE06 - .pool -_0805EDE4: - ldr r2, =gBattleSpritesDataPtr - ldr r0, [r2] - ldr r0, [r0] - lsls r1, r4, 2 - adds r3, r1, r0 - ldrh r0, [r3, 0x2] - adds r4, r1, 0 - cmp r0, 0 - beq _0805EE06 - ldr r0, =gEnemyMonElevation - ldrh r1, [r3, 0x2] - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0 - bne _0805EE06 - movs r0, 0x1 - mov r8, r0 -_0805EE06: - ldr r0, [r2] - ldr r0, [r0] - adds r0, r4, r0 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0805EE1A - movs r0, 0x1 - mov r8, r0 -_0805EE1A: - ldrh r0, [r7, 0x20] - strh r0, [r5, 0x20] - ldrh r0, [r7, 0x24] - strh r0, [r5, 0x24] - adds r2, r5, 0 - adds r2, 0x3E - mov r0, r8 - lsls r3, r0, 2 - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - orrs r0, r3 - strb r0, [r2] -_0805EE36: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805ED70 - - thumb_func_start sub_805EE48 -sub_805EE48: @ 805EE48 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - bx lr - thumb_func_end sub_805EE48 - - thumb_func_start SetBankEnemyShadowSpriteCallback -SetBankEnemyShadowSpriteCallback: @ 805EE54 - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r6, r4, 0 - lsls r1, 16 - lsrs r5, r1, 16 - adds r0, r4, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - beq _0805EED0 - ldr r0, =gBattleSpritesDataPtr - ldr r3, [r0] - ldr r1, [r3] - lsls r0, r4, 2 - adds r1, r0, r1 - ldrh r0, [r1, 0x2] - cmp r0, 0 - beq _0805EE7E - adds r5, r0, 0 -_0805EE7E: - ldr r0, =gEnemyMonElevation - adds r0, r5, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _0805EEB4 - ldr r2, =gSprites - ldr r1, [r3, 0x4] - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_805ED70 - b _0805EECE - .pool -_0805EEB4: - ldr r2, =gSprites - ldr r1, [r3, 0x4] - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_805EE48 -_0805EECE: - str r1, [r0] -_0805EED0: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end SetBankEnemyShadowSpriteCallback - - thumb_func_start sub_805EEE0 -sub_805EEE0: @ 805EEE0 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gSprites - ldr r1, =gBattleSpritesDataPtr - ldr r1, [r1] - ldr r3, [r1, 0x4] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - ldrb r1, [r1, 0x7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_805EE48 - str r1, [r0] - bx lr - .pool - thumb_func_end sub_805EEE0 - - thumb_func_start sub_805EF14 -sub_805EF14: @ 805EF14 - push {r4-r6,lr} - ldr r3, =0x06000240 - movs r0, 0 - movs r6, 0xF0 - lsls r6, 8 -_0805EF1E: - adds r5, r0, 0x1 - movs r4, 0xF -_0805EF22: - ldrh r1, [r3] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _0805EF32 - adds r0, r6, 0 - orrs r0, r1 - strh r0, [r3] -_0805EF32: - ldrh r1, [r3] - movs r2, 0xF0 - lsls r2, 4 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _0805EF46 - adds r0, r2, 0 - orrs r0, r1 - strh r0, [r3] -_0805EF46: - ldrh r1, [r3] - movs r2, 0xF0 - movs r0, 0xF0 - ands r0, r1 - cmp r0, 0 - bne _0805EF58 - adds r0, r1, 0 - orrs r0, r2 - strh r0, [r3] -_0805EF58: - ldrh r1, [r3] - movs r2, 0xF - movs r0, 0xF - ands r0, r1 - cmp r0, 0 - bne _0805EF6A - adds r0, r1, 0 - orrs r0, r2 - strh r0, [r3] -_0805EF6A: - adds r3, 0x2 - subs r4, 0x1 - cmp r4, 0 - bge _0805EF22 - adds r0, r5, 0 - cmp r0, 0x8 - ble _0805EF1E - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805EF14 - - thumb_func_start ClearTemporarySpeciesSpriteData -ClearTemporarySpeciesSpriteData: @ 805EF84 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r2, [r0] - lsls r0, r4, 2 - adds r0, r2 - movs r3, 0 - movs r2, 0 - strh r2, [r0, 0x2] - ldr r0, =gBattleMonForms - adds r0, r4, r0 - strb r3, [r0] - cmp r1, 0 - bne _0805EFAC - adds r0, r4, 0 - bl sub_805E974 -_0805EFAC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ClearTemporarySpeciesSpriteData - - 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, =gMonSpritesGfxPtr - str r6, [r4] - movs r0, 0xC0 - lsls r0, 1 - bl AllocZeroed - str r0, [r4] - movs r0, 0x80 - lsls r0, 8 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1] -_0805EFE2: - ldr r0, =gMonSpritesGfxPtr - ldr r1, [r0] - lsls r4, r6, 2 - adds r2, r1, 0x4 - adds r2, r4 - lsls r3, r6, 13 - ldr r0, [r1] - adds r0, r3 - str r0, [r2] - lsls r3, r6, 1 - adds r0, r3, r6 - lsls r0, 3 - adds r1, r0, r1 - ldr r2, =gUnknown_08329D98 - adds r1, 0x14 - adds r0, r2 - ldm r0!, {r2,r5,r7} - stm r1!, {r2,r5,r7} - ldm r0!, {r2,r5,r7} - stm r1!, {r2,r5,r7} - movs r5, 0 - mov r9, r3 - lsls r0, r6, 5 - mov r8, r0 - adds r1, r6, 0x1 - mov r10, r1 - mov r12, r8 - adds r7, r4, 0 -_0805F01A: - ldr r2, =gMonSpritesGfxPtr - ldr r1, [r2] - lsls r4, r5, 3 - add r4, r12 - adds r3, r1, 0 - adds r3, 0x74 - adds r3, r4 - adds r0, r1, 0x4 - adds r0, r7 - lsls r2, r5, 11 - ldr r0, [r0] - adds r0, r2 - str r0, [r3] - adds r1, r4 - adds r1, 0x78 - movs r0, 0x80 - lsls r0, 4 - strh r0, [r1] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _0805F01A - ldr r1, =gMonSpritesGfxPtr - ldr r2, [r1] - mov r5, r9 - adds r0, r5, r6 - lsls r0, 3 - adds r1, r2, 0 - adds r1, 0x20 - adds r1, r0 - mov r0, r8 - adds r0, 0x74 - adds r2, r0 - str r2, [r1] - mov r7, r10 - lsls r0, r7, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bls _0805EFE2 - movs r0, 0x80 - lsls r0, 5 - bl AllocZeroed - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - movs r2, 0xBA - lsls r2, 1 - adds r1, r2 - str 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 AllocateMonSpritesGfx - - thumb_func_start FreeMonSpritesGfx -FreeMonSpritesGfx: @ 805F094 - push {r4-r6,lr} - ldr r6, =gMonSpritesGfxPtr - ldr r0, [r6] - cmp r0, 0 - beq _0805F106 - movs r1, 0xBE - lsls r1, 1 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - beq _0805F0BA - bl Free - ldr r0, [r6] - movs r1, 0xBE - lsls r1, 1 - adds r0, r1 - movs r1, 0 - str r1, [r0] -_0805F0BA: - ldr r0, [r6] - movs r1, 0xBC - lsls r1, 1 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - beq _0805F0D8 - bl Free - ldr r0, [r6] - movs r1, 0xBC - lsls r1, 1 - adds r0, r1 - movs r1, 0 - str r1, [r0] -_0805F0D8: - ldr r0, [r6] - movs r5, 0xBA - lsls r5, 1 - adds r0, r5 - ldr r0, [r0] - bl Free - ldr r0, [r6] - adds r5, r0, r5 - movs r4, 0 - str r4, [r5] - ldr r0, [r0] - bl Free - ldr r0, [r6] - str r4, [r0] - str r4, [r0, 0x4] - str r4, [r0, 0x8] - str r4, [r0, 0xC] - str r4, [r0, 0x10] - bl Free - str r4, [r6] -_0805F106: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end FreeMonSpritesGfx - - thumb_func_start sub_805F110 -sub_805F110: @ 805F110 - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0x37 - bl GetMonData - ldr r1, =0x00000fff - ands r1, r0 - cmp r1, 0 - bne _0805F158 - adds r0, r5, 0 - movs r1, 0x39 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r5, 0 - movs r1, 0x3A - bl GetMonData - adds r1, r0, 0 - lsls r4, 16 - asrs r4, 16 - lsls r1, 16 - asrs r1, 16 - adds r0, r4, 0 - bl GetHPBarLevel - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - ble _0805F158 - movs r0, 0x1 - b _0805F15A - .pool -_0805F158: - movs r0, 0 -_0805F15A: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_805F110 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/battle_anim_80A5C6C.s b/asm/battle_anim_80A5C6C.s index 705146ce5..158da2a02 100644 --- a/asm/battle_anim_80A5C6C.s +++ b/asm/battle_anim_80A5C6C.s @@ -586,8 +586,8 @@ _080A612E: bx r1 thumb_func_end sub_80A60AC - thumb_func_start sub_80A6138 -sub_80A6138: @ 80A6138 + thumb_func_start GetBankSpriteDefault_Y +GetBankSpriteDefault_Y: @ 80A6138 push {lr} lsls r0, 24 lsrs r0, 24 @@ -597,10 +597,10 @@ sub_80A6138: @ 80A6138 lsrs r0, 24 pop {r1} bx r1 - thumb_func_end sub_80A6138 + thumb_func_end GetBankSpriteDefault_Y - thumb_func_start sub_80A614C -sub_80A614C: @ 80A614C + thumb_func_start GetSubstituteSpriteDefault_Y +GetSubstituteSpriteDefault_Y: @ 80A614C push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 @@ -633,7 +633,7 @@ _080A6180: pop {r4} pop {r1} bx r1 - thumb_func_end sub_80A614C + thumb_func_end GetSubstituteSpriteDefault_Y thumb_func_start sub_80A6190 sub_80A6190: @ 80A6190 @@ -5180,7 +5180,7 @@ _080A8412: adds r0, r6, 0 ldr r1, [sp, 0x3C] mov r2, r8 - bl species_and_otid_get_pal + bl GetFrontSpritePalFromSpeciesAndPersonality lsls r1, r5, 20 movs r2, 0x80 lsls r2, 17 @@ -5243,7 +5243,7 @@ _080A84B0: adds r0, r6, 0 ldr r1, [sp, 0x3C] mov r2, r8 - bl species_and_otid_get_pal + bl GetFrontSpritePalFromSpeciesAndPersonality lsls r1, r5, 20 movs r3, 0x80 lsls r3, 17 diff --git a/asm/battle_anim_80A9C70.s b/asm/battle_anim_80A9C70.s index 681802e12..d27852961 100644 --- a/asm/battle_anim_80A9C70.s +++ b/asm/battle_anim_80A9C70.s @@ -855,8 +855,8 @@ _080AA352: .pool thumb_func_end sub_80AA18C - thumb_func_start move_anim_start_t2 -move_anim_start_t2: @ 80AA364 + thumb_func_start LaunchStatusAnimation +LaunchStatusAnimation: @ 80AA364 push {r4,lr} adds r4, r0, 0 lsls r4, 24 @@ -885,7 +885,7 @@ move_anim_start_t2: @ 80AA364 pop {r0} bx r0 .pool - thumb_func_end move_anim_start_t2 + thumb_func_end LaunchStatusAnimation thumb_func_start task0A_80788BC task0A_80788BC: @ 80AA3B4 diff --git a/asm/battle_anim_815A0D4.s b/asm/battle_anim_815A0D4.s index 69835bf4e..d2a401f59 100755 --- a/asm/battle_anim_815A0D4.s +++ b/asm/battle_anim_815A0D4.s @@ -3006,7 +3006,7 @@ _0815B8A8: lsls r2, 3 adds r2, r3 ldrb r2, [r2, 0x1C] - bl sub_805E448 + bl HandleSpeciesGfxDataChange ldrb r1, [r5] mov r0, sp bl sub_80A6BFC @@ -3310,7 +3310,7 @@ sub_815BB58: @ 815BB58 ldr r1, =gAnimBankTarget ldrb r1, [r1] movs r2, 0x1 - bl sub_805E448 + bl HandleSpeciesGfxDataChange adds r0, r4, 0 bl DestroyAnimVisualTask pop {r4} @@ -10129,7 +10129,7 @@ _0815F2AC: ldr r4, =gAnimBankAttacker ldrb r0, [r4] movs r1, 0 - bl refresh_graphics_maybe + bl LoadBattleMonGfxAndAnimate bl IsContest lsls r0, 24 cmp r0, 0 diff --git a/asm/battle_anim_8170478.s b/asm/battle_anim_8170478.s index 8de82c629..a5e3b5f88 100644 --- a/asm/battle_anim_8170478.s +++ b/asm/battle_anim_8170478.s @@ -4825,7 +4825,7 @@ _08172CC8: ldrb r1, [r5, 0x1E] adds r0, r2, 0 adds r2, r6, 0 - bl refresh_graphics_maybe + bl LoadBattleMonGfxAndAnimate ldrh r0, [r5, 0x1C] adds r0, 0x1 strh r0, [r5, 0x1C] @@ -5030,7 +5030,7 @@ _08172E4E: movs r3, 0x1 bl RequestDma3Fill ldrb r0, [r4] - bl sub_805E974 + bl ClearBehindSubstituteBit adds r0, r5, 0 bl DestroyAnimVisualTask _08172E84: diff --git a/asm/berry_blender.s b/asm/berry_blender.s index 6d18ab7cb..69c561beb 100644 --- a/asm/berry_blender.s +++ b/asm/berry_blender.s @@ -127,7 +127,7 @@ _0807F824: b _0807F966 .pool _0807F854: - ldr r1, =gUnknown_083390F4 + ldr r1, =sBlenderCenterMap movs r2, 0x80 lsls r2, 3 movs r0, 0x2 @@ -135,7 +135,7 @@ _0807F854: bl CopyToBgTilemapBuffer movs r0, 0x2 bl CopyBgTilemapBufferToVram - ldr r0, =gUnknown_083390D4 + ldr r0, =sBlenderCenterPal movs r2, 0x80 lsls r2, 1 movs r1, 0 @@ -216,14 +216,14 @@ _0807F910: b _0807F966 .pool _0807F940: - ldr r0, =gUnknown_083394F4 + ldr r0, =sBlenderOuterPal movs r1, 0x80 movs r2, 0x20 bl LoadPalette b _0807F962 .pool _0807F950: - ldr r0, =gUnknown_08339AC0 + ldr r0, =sSpriteSheet_BlenderArrow bl LoadSpriteSheet ldr r0, =gUnknown_08339BD8 bl LoadSpriteSheet @@ -243,9 +243,9 @@ _0807F980: bl LoadSpriteSheet ldr r0, =gUnknown_08339C58 bl LoadSpriteSheet - ldr r0, =gUnknown_08339AD0 + ldr r0, =sSpritePal_BlenderArrow bl LoadSpritePalette - ldr r0, =gUnknown_08339AC8 + ldr r0, =sSpritePal_BlenderMisc bl LoadSpritePalette ldr r4, =gUnknown_020322A4 ldr r0, [r4] @@ -482,12 +482,12 @@ _0807FBAC: b _0807FCE2 _0807FBB8: movs r4, 0 - ldr r5, =gUnknown_083399C8 + ldr r5, =sBlenderSyncArrowsPos ldr r6, =gUnknown_020322A4 _0807FBBE: ldrb r1, [r5] ldrb r2, [r5, 0x1] - ldr r0, =gUnknown_08339AD8 + ldr r0, =sBlenderSyncArrow_SpriteTemplate movs r3, 0x1 bl CreateSprite ldr r1, [r6] @@ -553,7 +553,7 @@ _0807FC64: ldr r4, [r6] ldr r0, =0x000011b8 adds r4, r0 - ldr r5, =gUnknown_0833973A + ldr r5, =gText_BerryBlenderStart bl sav2_get_text_speed adds r2, r0, 0 lsls r2, 24 @@ -833,7 +833,7 @@ _0807FE7C: bne _0807FEC8 adds r0, r4, 0 adds r0, 0x1C - ldr r1, =gUnknown_083397D0 + ldr r1, =sBlenderOpponentsNames ldr r1, [r1, 0xC] bl StringCopy b _0807FED4 @@ -841,7 +841,7 @@ _0807FE7C: _0807FEC8: adds r0, r4, 0 adds r0, 0x1C - ldr r1, =gUnknown_083397D0 + ldr r1, =sBlenderOpponentsNames ldr r1, [r1] bl StringCopy _0807FED4: @@ -866,7 +866,7 @@ _0807FEE8: bl StringCopy adds r0, r6, 0 adds r0, 0x1C - ldr r4, =gUnknown_083397D0 + ldr r4, =sBlenderOpponentsNames ldr r1, [r4, 0x10] bl StringCopy adds r0, r6, 0 @@ -896,7 +896,7 @@ _0807FF3C: bl StringCopy adds r0, r5, 0 adds r0, 0x1C - ldr r4, =gUnknown_083397D0 + ldr r4, =sBlenderOpponentsNames ldr r1, [r4, 0x14] bl StringCopy adds r0, r5, 0 @@ -1086,12 +1086,12 @@ _0808010C: .pool _08080120: movs r5, 0 - ldr r4, =gUnknown_083399C8 + ldr r4, =sBlenderSyncArrowsPos ldr r6, =gUnknown_020322A4 _08080126: ldrb r1, [r4] ldrb r2, [r4, 0x1] - ldr r0, =gUnknown_08339AD8 + ldr r0, =sBlenderSyncArrow_SpriteTemplate movs r3, 0x1 bl CreateSprite ldr r1, [r6] @@ -1160,7 +1160,7 @@ _080801C8: ldr r0, [r4] ldr r3, =0x000011b8 adds r0, r3 - ldr r1, =gUnknown_0833981A + ldr r1, =sText_CommunicationStandby movs r2, 0 bl sub_808417C ldr r1, [r4] @@ -2121,12 +2121,12 @@ _080809F0: .pool _08080A04: movs r4, 0 - ldr r5, =gUnknown_083399C8 + ldr r5, =sBlenderSyncArrowsPos ldr r6, =gUnknown_020322A4 _08080A0A: ldrb r1, [r5] ldrb r2, [r5, 0x1] - ldr r0, =gUnknown_08339AD8 + ldr r0, =sBlenderSyncArrow_SpriteTemplate movs r3, 0x1 bl CreateSprite ldr r1, [r6] @@ -3095,7 +3095,7 @@ sub_8081288: @ 8081288 mov r8, r7 lsls r1, 24 ldr r0, =gUnknown_08339B40 - ldr r4, =gUnknown_083399C8 + ldr r4, =sBlenderSyncArrowsPos lsrs r1, 23 adds r2, r1, r4 ldrb r6, [r2] @@ -5062,7 +5062,7 @@ _080822B0: ldr r4, [r6] ldr r5, =0x000011b8 adds r4, r5 - ldr r5, =gUnknown_08339831 + ldr r5, =sText_WouldLikeToBlendAnotherBerry bl sav2_get_text_speed adds r2, r0, 0 lsls r2, 24 @@ -5263,7 +5263,7 @@ _0808246C: ldr r4, [r6] ldr r0, =0x000011b8 adds r4, r0 - ldr r5, =gUnknown_0833981A + ldr r5, =sText_CommunicationStandby bl sav2_get_text_speed adds r2, r0, 0 lsls r2, 24 @@ -5555,7 +5555,7 @@ _080826EC: adds r1, r0 adds r0, r4, 0 bl StringCopy - ldr r1, =gUnknown_083398DD + ldr r1, =sText_ApostropheSPokeblockCaseIsFull b _08082740 .pool _0808271C: @@ -5575,7 +5575,7 @@ _0808271C: adds r1, r0 adds r0, r4, 0 bl StringCopy - ldr r1, =gUnknown_083398B0 + ldr r1, =sText_HasNoBerriesToPut _08082740: adds r0, r4, 0 bl StringAppend @@ -5856,7 +5856,7 @@ _080829AA: adds r0, r1 strh r2, [r0] ldr r0, =gStringVar4 - ldr r1, =gUnknown_08339896 + ldr r1, =sText_YourPokeblockCaseIsFull bl StringCopy b _08082A92 .pool @@ -5872,7 +5872,7 @@ _080829D4: adds r0, r1 strh r2, [r0] ldr r0, =gStringVar4 - ldr r1, =gUnknown_08339858 + ldr r1, =sText_RunOutOfBerriesForBlending bl StringCopy b _08082A92 .pool @@ -7276,7 +7276,7 @@ _080834DE: b _08083854 .pool _08083518: - ldr r4, =gUnknown_083398F5 + ldr r4, =sText_BlendingResults movs r0, 0x1 adds r1, r4, 0 movs r2, 0xA8 @@ -7329,7 +7329,7 @@ _08083564: bl ConvertIntToDecimalStringN ldr r0, [r7] adds r0, 0x9F - ldr r1, =gUnknown_08339941 + ldr r1, =sText_Dot bl StringAppend ldr r0, [r7] adds r0, 0x9F @@ -7374,7 +7374,7 @@ _08083564: bl ConvertInternationalString ldr r0, [r7] adds r0, 0x9F - ldr r1, =gUnknown_08339914 + ldr r1, =sText_SpaceBerry bl StringAppend ldr r1, [r7] adds r1, 0x9F @@ -7397,7 +7397,7 @@ _08083564: cmp r6, r0 bcc _08083564 _0808361A: - ldr r1, =gUnknown_0833992E + ldr r1, =sText_MaximumSpeed movs r3, 0xFF mov r10, r3 str r3, [sp] @@ -7425,7 +7425,7 @@ _0808361A: bl ConvertIntToDecimalStringN ldr r0, [r6] adds r0, 0x9F - ldr r1, =gUnknown_08339941 + ldr r1, =sText_Dot bl StringAppend ldr r0, [r6] adds r0, 0x4E @@ -7445,7 +7445,7 @@ _0808361A: bl StringAppend ldr r0, [r6] adds r0, 0x9F - ldr r1, =gUnknown_0833993C + ldr r1, =sText_RPM bl StringAppend ldr r1, [r6] adds r1, 0x9F @@ -7463,7 +7463,7 @@ _0808361A: movs r0, 0x5 movs r3, 0x51 bl sub_80840D4 - ldr r1, =gUnknown_0833991B + ldr r1, =sText_Time mov r2, r10 str r2, [sp] mov r3, r9 @@ -7499,7 +7499,7 @@ _0808361A: bl ConvertIntToDecimalStringN ldr r0, [r6] adds r0, 0x9F - ldr r1, =gUnknown_08339921 + ldr r1, =sText_Min bl StringAppend adds r1, r4, 0 movs r2, 0x2 @@ -7507,7 +7507,7 @@ _0808361A: bl ConvertIntToDecimalStringN ldr r0, [r6] adds r0, 0x9F - ldr r1, =gUnknown_08339928 + ldr r1, =sText_Sec bl StringAppend ldr r1, [r6] adds r1, 0x9F @@ -7682,10 +7682,10 @@ sub_80838AC: @ 80838AC ldr r1, [r0] adds r0, r6, 0 bl StringCopy - ldr r1, =gUnknown_0833979D + ldr r1, =gText_WasMade adds r0, r6, 0 bl StringAppend - ldr r1, =gUnknown_08339943 + ldr r1, =sText_NewLine adds r0, r6, 0 bl StringAppend adds r0, r5, 0 @@ -7698,7 +7698,7 @@ sub_80838AC: @ 80838AC adds r5, r0, 0 lsls r5, 24 lsrs r5, 24 - ldr r1, =gUnknown_0833994F + ldr r1, =sText_TheLevelIs adds r0, r6, 0 bl StringAppend mov r0, sp @@ -7709,7 +7709,7 @@ sub_80838AC: @ 80838AC adds r0, r6, 0 mov r1, sp bl StringAppend - ldr r1, =gUnknown_0833995D + ldr r1, =sText_TheFeelIs adds r0, r6, 0 bl StringAppend mov r0, sp @@ -7720,10 +7720,10 @@ sub_80838AC: @ 80838AC adds r0, r6, 0 mov r1, sp bl StringAppend - ldr r1, =gUnknown_08339970 + ldr r1, =sText_Dot2 adds r0, r6, 0 bl StringAppend - ldr r1, =gUnknown_0833979B + ldr r1, =gText_NewParagraph adds r0, r6, 0 bl StringAppend add sp, 0xC @@ -8041,7 +8041,7 @@ _08083B9A: movs r2, 0x1 movs r3, 0xD bl SetWindowBorderStyle - ldr r4, =gUnknown_08339947 + ldr r4, =sText_Ranking movs r0, 0x1 adds r1, r4, 0 movs r2, 0xA8 @@ -8161,7 +8161,7 @@ _08083C84: bl ConvertIntToDecimalStringN ldr r0, [r7] adds r0, 0x9F - ldr r1, =gUnknown_08339941 + ldr r1, =sText_Dot bl StringAppend ldr r0, [r7] adds r0, 0x9F @@ -8395,7 +8395,7 @@ _08083E8A: movs r3, 0x3 bl ConvertIntToDecimalStringN adds r5, r0, 0 - ldr r1, =gUnknown_08339941 + ldr r1, =sText_Dot bl StringAppend adds r5, r0, 0 adds r0, r4, 0 @@ -8407,7 +8407,7 @@ _08083E8A: movs r3, 0x2 bl ConvertIntToDecimalStringN adds r5, r0, 0 - ldr r1, =gUnknown_0833993C + ldr r1, =sText_RPM bl StringAppend movs r0, 0x1 add r1, sp, 0xC diff --git a/asm/contest.s b/asm/contest.s index 9c0684663..4852a548f 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -6763,7 +6763,7 @@ _080DB1CC: adds r0, r5, 0 adds r1, r7, 0 adds r2, r6, 0 - bl species_and_otid_get_pal + bl GetFrontSpritePalFromSpeciesAndPersonality movs r1, 0x90 lsls r1, 1 movs r2, 0x20 diff --git a/asm/contest_painting.s b/asm/contest_painting.s index 2caf15194..98f001442 100644 --- a/asm/contest_painting.s +++ b/asm/contest_painting.s @@ -572,7 +572,7 @@ sub_81302E8: @ 81302E8 ldr r1, [r0, 0x4] ldr r2, [r0] adds r0, r5, 0 - bl species_and_otid_get_pal + bl GetFrontSpritePalFromSpeciesAndPersonality ldr r7, =gUnknown_030061C4 ldr r1, [r7] bl LZDecompressVram diff --git a/asm/link.s b/asm/link.s index 9b79ac96a..da4bfbfd1 100644 --- a/asm/link.s +++ b/asm/link.s @@ -69004,7 +69004,7 @@ _0802CA32: ldrh r0, [r7] ldr r1, [r7, 0x4] ldr r2, [r7, 0x8] - bl species_and_otid_get_pal + bl GetFrontSpritePalFromSpeciesAndPersonality str r0, [sp, 0x20] add r0, sp, 0x20 ldr r1, [r0, 0x4] diff --git a/asm/party_menu.s b/asm/party_menu.s index 3d2af7e7d..280b658d4 100755 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -4249,7 +4249,7 @@ _081B243E: adds r0, r4, 0 movs r1, 0 bl FillWindowPixelBuffer - ldr r5, =gText_Confirm + ldr r5, =gMenuText_Confirm movs r0, 0 adds r1, r5, 0 movs r2, 0x30 diff --git a/asm/pokeball.s b/asm/pokeball.s index 0afd27932..b4fc36d97 100755 --- a/asm/pokeball.s +++ b/asm/pokeball.s @@ -936,7 +936,7 @@ _08075B9E: .pool _08075BB4: adds r0, r3, 0 - bl sub_805F110 + bl ShouldPlayNormalPokeCry cmp r0, 0x1 bne _08075BCC lsls r1, r5, 24 @@ -976,7 +976,7 @@ _08075BF8: cmp r0, 0 bne _08075CBA adds r0, r3, 0 - bl sub_805F110 + bl ShouldPlayNormalPokeCry cmp r0, 0x1 bne _08075C22 lsls r1, r5, 24 @@ -1066,7 +1066,7 @@ _08075CBA: b _08075D04 _08075CC0: adds r0, r3, 0 - bl sub_805F110 + bl ShouldPlayNormalPokeCry cmp r0, 0x1 bne _08075CD8 lsls r1, r5, 24 diff --git a/asm/pokedex.s b/asm/pokedex.s index 3d69281c2..e9506881e 100644 --- a/asm/pokedex.s +++ b/asm/pokedex.s @@ -8824,7 +8824,7 @@ _080C0168: adds r3, r5 ldrb r4, [r3, 0x5] lsrs r4, 4 - bl species_and_otid_get_pal + bl GetFrontSpritePalFromSpeciesAndPersonality lsls r4, 4 movs r2, 0x80 lsls r2, 1 diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index d1f7bd161..a8365ba18 100755 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -14656,7 +14656,7 @@ _080CEC86: adds r1, r3 str r0, [r1] adds r0, r6, 0 - bl pokemon_get_pal + bl GetMonFrontSpritePal ldr r1, [r4] ldr r2, =0x00000cdc adds r1, r2 @@ -14759,7 +14759,7 @@ _080CED7E: adds r1, r4 ldrh r0, [r1] mov r1, r9 - bl species_and_otid_get_pal + bl GetFrontSpritePalFromSpeciesAndPersonality ldr r1, [r5] ldr r3, =0x00000cdc adds r2, r1, r3 diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index a89c54304..db11f6865 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -1116,7 +1116,7 @@ sub_81C4778: @ 81C4778 bne _081C47AE adds r0, r1, 0 adds r0, 0xC - bl sub_805F110 + bl ShouldPlayNormalPokeCry cmp r0, 0x1 bne _081C47A4 ldrh r0, [r4, 0x2] diff --git a/asm/pokenav.s b/asm/pokenav.s index 0c7a80742..ba6d4fca0 100755 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -13532,7 +13532,7 @@ _081CDBD0: adds r0, r4, 0 mov r1, r8 adds r2, r5, 0 - bl species_and_otid_get_pal + bl GetFrontSpritePalFromSpeciesAndPersonality mov r2, r9 lsls r1, r2, 7 adds r1, r7, r1 @@ -24408,7 +24408,7 @@ _081D30C4: adds r0, r4, 0 adds r1, r6, 0 adds r2, r5, 0 - bl species_and_otid_get_pal + bl GetFrontSpritePalFromSpeciesAndPersonality mov r1, r9 bl LZ77UnCompWram _081D311A: diff --git a/data/battle_7.s b/data/battle_7.s deleted file mode 100644 index ffd2e8daa..000000000 --- a/data/battle_7.s +++ /dev/null @@ -1,44 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2, 0 - -gUnknown_0832C0D0:: @ 832C0D0 - obj_tiles gUnknown_08C1F1C8, 0x1000, 0xd6ff - - .align 2 -gUnknown_0832C0D8:: @ 832C0D8 - obj_tiles gUnknown_08C1F46C, 0x1000, 0xd701 - - .align 2 -gUnknown_0832C0E0:: @ 832C0E0 - obj_tiles gUnknown_08C1F5E8, 0x0800, 0xd6ff - - .align 2 -gUnknown_0832C0E8:: @ 832C0E8 - obj_tiles gUnknown_08C1F5E8, 0x0800, 0xd700 - - .align 2 -gUnknown_0832C0F0:: @ 832C0F0 - obj_tiles gUnknown_08C1F76C, 0x0800, 0xd701 - - .align 2 -gUnknown_0832C0F8:: @ 832C0F8 - obj_tiles gUnknown_08C1F76C, 0x0800, 0xd702 - - .align 2 -gUnknown_0832C100:: @ 832C100 - obj_tiles gUnknown_08C1F8E8, 0x1000, 0xd70b - - .align 2 -gUnknown_0832C108:: @ 832C108 - obj_tiles gUnknown_08C0237C, 0x0100, 0xd704 - obj_tiles gUnknown_08C0237C, 0x0120, 0xd705 - obj_tiles gUnknown_08C0237C, 0x0100, 0xd706 - obj_tiles gUnknown_08C0237C, 0x0120, 0xd707 - - .align 2 -gUnknown_0832C128:: @ 832C128 - obj_pal gBattleInterface_BallStatusBarPal, 0xd6ff - obj_pal gBattleInterface_BallDisplayPal, 0xd704 diff --git a/data/berry_blender.s b/data/berry_blender.s deleted file mode 100644 index d3360d4d8..000000000 --- a/data/berry_blender.s +++ /dev/null @@ -1,167 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2, 0 - -gUnknown_083390D4:: @ 83390D4 - .incbin "baserom.gba", 0x3390d4, 0x20 - -gUnknown_083390F4:: @ 83390F4 - .incbin "baserom.gba", 0x3390f4, 0x400 - -gUnknown_083394F4:: @ 83394F4 - .incbin "baserom.gba", 0x3394f4, 0x246 - -gUnknown_0833973A:: @ 833973A - .incbin "baserom.gba", 0x33973a, 0x61 - -gUnknown_0833979B:: @ 833979B - .incbin "baserom.gba", 0x33979b, 0x2 - -gUnknown_0833979D:: @ 833979D - .incbin "baserom.gba", 0x33979d, 0x33 - -gUnknown_083397D0:: @ 83397D0 - .incbin "baserom.gba", 0x3397d0, 0x4a - -gUnknown_0833981A:: @ 833981A - .incbin "baserom.gba", 0x33981a, 0x17 - -gUnknown_08339831:: @ 8339831 - .incbin "baserom.gba", 0x339831, 0x27 - -gUnknown_08339858:: @ 8339858 - .incbin "baserom.gba", 0x339858, 0x3e - -gUnknown_08339896:: @ 8339896 - .incbin "baserom.gba", 0x339896, 0x1a - -gUnknown_083398B0:: @ 83398B0 - .incbin "baserom.gba", 0x3398b0, 0x2d - -gUnknown_083398DD:: @ 83398DD - .incbin "baserom.gba", 0x3398dd, 0x18 - -gUnknown_083398F5:: @ 83398F5 - .incbin "baserom.gba", 0x3398f5, 0x1f - -gUnknown_08339914:: @ 8339914 - .incbin "baserom.gba", 0x339914, 0x7 - -gUnknown_0833991B:: @ 833991B - .incbin "baserom.gba", 0x33991b, 0x6 - -gUnknown_08339921:: @ 8339921 - .incbin "baserom.gba", 0x339921, 0x7 - -gUnknown_08339928:: @ 8339928 - .incbin "baserom.gba", 0x339928, 0x6 - -gUnknown_0833992E:: @ 833992E - .incbin "baserom.gba", 0x33992e, 0xe - -gUnknown_0833993C:: @ 833993C - .incbin "baserom.gba", 0x33993c, 0x5 - -gUnknown_08339941:: @ 8339941 - .incbin "baserom.gba", 0x339941, 0x2 - -gUnknown_08339943:: @ 8339943 - .incbin "baserom.gba", 0x339943, 0x4 - -gUnknown_08339947:: @ 8339947 - .incbin "baserom.gba", 0x339947, 0x8 - -gUnknown_0833994F:: @ 833994F - .incbin "baserom.gba", 0x33994f, 0xe - -gUnknown_0833995D:: @ 833995D - .incbin "baserom.gba", 0x33995d, 0x13 - -gUnknown_08339970:: @ 8339970 - .incbin "baserom.gba", 0x339970, 0x4 - -gUnknown_08339974:: @ 8339974 - .incbin "baserom.gba", 0x339974, 0xc - -gUnknown_08339980:: @ 8339980 - .incbin "baserom.gba", 0x339980, 0x38 - -gUnknown_083399B8:: @ 83399B8 - .incbin "baserom.gba", 0x3399b8, 0x8 - -gUnknown_083399C0:: @ 83399C0 - .incbin "baserom.gba", 0x3399c0, 0x8 - -gUnknown_083399C8:: @ 83399C8 - .incbin "baserom.gba", 0x3399c8, 0x8 - -gUnknown_083399D0:: @ 83399D0 - .incbin "baserom.gba", 0x3399d0, 0xc - -gUnknown_083399DC:: @ 83399DC - .incbin "baserom.gba", 0x3399dc, 0x8 - -gUnknown_083399E4:: @ 83399E4 - .incbin "baserom.gba", 0x3399e4, 0x3 - -gUnknown_083399E7:: @ 83399E7 - .incbin "baserom.gba", 0x3399e7, 0x5 - -gUnknown_083399EC:: @ 83399EC - .incbin "baserom.gba", 0x3399ec, 0xd4 - -gUnknown_08339AC0:: @ 8339AC0 - .incbin "baserom.gba", 0x339ac0, 0x8 - -gUnknown_08339AC8:: @ 8339AC8 - .incbin "baserom.gba", 0x339ac8, 0x8 - -gUnknown_08339AD0:: @ 8339AD0 - .incbin "baserom.gba", 0x339ad0, 0x8 - -gUnknown_08339AD8:: @ 8339AD8 - .incbin "baserom.gba", 0x339ad8, 0x60 - -gUnknown_08339B38:: @ 8339B38 - .incbin "baserom.gba", 0x339b38, 0x8 - -gUnknown_08339B40:: @ 8339B40 - .incbin "baserom.gba", 0x339b40, 0x98 - -gUnknown_08339BD8:: @ 8339BD8 - .incbin "baserom.gba", 0x339bd8, 0x8 - -gUnknown_08339BE0:: @ 8339BE0 - .incbin "baserom.gba", 0x339be0, 0x44 - -gUnknown_08339C24:: @ 8339C24 - .incbin "baserom.gba", 0x339c24, 0x8 - -gUnknown_08339C2C:: @ 8339C2C - .incbin "baserom.gba", 0x339c2c, 0x2c - -gUnknown_08339C58:: @ 8339C58 - .incbin "baserom.gba", 0x339c58, 0x8 - -gUnknown_08339C60:: @ 8339C60 - .incbin "baserom.gba", 0x339c60, 0x18 - -gUnknown_08339C78:: @ 8339C78 - .incbin "baserom.gba", 0x339c78, 0x28 - -gUnknown_08339CA0:: @ 8339CA0 - .incbin "baserom.gba", 0x339ca0, 0x1e - -gUnknown_08339CBE:: @ 8339CBE - .incbin "baserom.gba", 0x339cbe, 0x5 - -gUnknown_08339CC3:: @ 8339CC3 - .incbin "baserom.gba", 0x339cc3, 0x5 - -gUnknown_08339CC8:: @ 8339CC8 - .incbin "baserom.gba", 0x339cc8, 0x4c - -gUnknown_08339D14:: @ 8339D14 - .incbin "baserom.gba", 0x339d14, 0x8 diff --git a/data/graphics.s b/data/graphics.s index c3bbdd494..87b983a80 100644 --- a/data/graphics.s +++ b/data/graphics.s @@ -149,13 +149,13 @@ gUnknown_08C2A6D4:: @ 8C2A6D4 gUnknown_08C2A6EC:: @ 8C2A6EC .incbin "baserom.gba", 0xc2a6ec, 0x27d0 -gUnknown_08C2CEBC:: @ 8C2CEBC +gSubstituteDollPal:: @ 8C2CEBC .incbin "baserom.gba", 0xc2cebc, 0x24 -gUnknown_08C2CEE0:: @ 8C2CEE0 +gSubstituteDollGfx:: @ 8C2CEE0 .incbin "baserom.gba", 0xc2cee0, 0x240 -gUnknown_08C2D120:: @ 8C2D120 +gSubstituteDollTilemap:: @ 8C2D120 .incbin "baserom.gba", 0xc2d120, 552 gUnknown_08C2D348:: @ 8C2D348 @@ -1221,8 +1221,44 @@ gUnknown_08DC9608:: @ 8DC9608 .incbin "baserom.gba", 0xdc9608, 0x20 gUnknown_08DC9628:: @ 8DC9628 - .incbin "baserom.gba", 0xdc9628, 0x2788 + .incbin "baserom.gba", 0xdc9628, 0x320 + +gBerryBlenderMiscPalette:: @ 8DCAB88 + .incbin "graphics/berry_blender/misc.gbapal" + +gBerryBlenderArrowPalette:: @ 8DC9948 + .incbin "graphics/berry_blender/arrow.gbapal" +gUnknown_8DC9988:: @ 8DC9988 + .incbin "baserom.gba", 0xdc9988, 0x200 + + .align 2 +gBerryBlenderMarubatsuTiles:: @ 8DC9B88 + .incbin "graphics/berry_blender/marubatsu.4bpp" + + .align 2 +gBerryBlenderParticlesTiles:: @ 8E90818 + .incbin "graphics/berry_blender/particles.4bpp" + + .space 0x120 + + .align 2 +gBerryBlenderCountdownNumbersTiles:: @ 8DC9F88 + .incbin "graphics/berry_blender/countdown_numbers.4bpp" + + .align 2 +gBerryBlenderStartTiles:: @ 8DCA588 + .incbin "graphics/berry_blender/start.4bpp" + + .space 0x200 + + .align 2 +gBerryBlenderArrowTiles:: @ 8DCAB88 + .incbin "graphics/berry_blender/arrow.4bpp" + +gUnknown_08DCB388:: @ 8DCB388 + .incbin "baserom.gba", 0xdcb388, 0xA28 + gUnknown_08DCBDB0:: @ 8DCBDB0 .incbin "baserom.gba", 0xdcbdb0, 0x20 diff --git a/data/item_menu.s b/data/item_menu.s index 762f10ca4..b160200e8 100644 --- a/data/item_menu.s +++ b/data/item_menu.s @@ -4,61 +4,100 @@ .section .rodata gUnknown_08613F90:: @ 8613F90 - .incbin "baserom.gba", 0x613f90, 0xc + .4byte 0x11F0, 0x1E1, 0x21DE +@ possibly a struct gUnknown_08613F9C:: @ 8613F9C - .incbin "baserom.gba", 0x613f9c, 0x18 + .4byte 0 + .4byte bag_menu_change_item_callback + .4byte sub_81AB520 + .4byte 0 + .4byte 0x80000 + .4byte 0x7003011 gUnknown_08613FB4:: @ 8613FB4 - .incbin "baserom.gba", 0x613fb4, 0x78 + .4byte gMenuText_Use, ItemMenu_UseOutOfBattle + .4byte gMenuText_Toss, ItemMenu_Toss + .4byte gMenuText_Register, ItemMenu_Register + .4byte gMenuText_Give, ItemMenu_Give + .4byte gText_Cancel2, ItemMenu_Cancel + .4byte gMenuText_Use, ItemMenu_UseInBattle + .4byte gMenuText_Check, ItemMenu_UseOutOfBattle + .4byte gMenuText_Walk, ItemMenu_UseOutOfBattle + .4byte gMenuText_Deselect, ItemMenu_Register + .4byte gMenuText_CheckTag, ItemMenu_CheckTag + .4byte gMenuText_Confirm, unknown_ItemMenu_Confirm + .4byte gMenuText_Show, unknown_ItemMenu_Show + .4byte gMenuText_Give2, unknown_ItemMenu_Give2 + .4byte gMenuText_Confirm, unknown_ItemMenu_Confirm2 + .4byte gText_EmptyString2, NULL gUnknown_0861402C:: @ 861402C - .incbin "baserom.gba", 0x61402c, 0x4 + .byte 0, 3, 1, 4 gUnknown_08614030:: @ 8614030 - .incbin "baserom.gba", 0x614030, 0x4 + .byte 0, 2, 14, 4 gUnknown_08614034:: @ 8614034 - .incbin "baserom.gba", 0x614034, 0x4 + .byte 3, 14, 1, 4 gUnknown_08614038:: @ 8614038 - .incbin "baserom.gba", 0x614038, 0x4 + .byte 0, 3, 14, 4 gUnknown_0861403C:: @ 861403C - .incbin "baserom.gba", 0x61403c, 0x6 + .byte 9, 14, 0, 3, 1, 4 gUnknown_08614042:: @ 8614042 - .incbin "baserom.gba", 0x614042, 0x2 + .byte 5, 4 gUnknown_08614044:: @ 8614044 - .incbin "baserom.gba", 0x614044, 0x2 + .byte 3, 4 gUnknown_08614046:: @ 8614046 - .incbin "baserom.gba", 0x614046, 0x1 + .byte 4 gUnknown_08614047:: @ 8614047 - .incbin "baserom.gba", 0x614047, 0x4 + .byte 10, 9, 14, 4 gUnknown_0861404B:: @ 861404B - .incbin "baserom.gba", 0x61404b, 0x2 + .byte 11, 4 gUnknown_0861404D:: @ 861404D - .incbin "baserom.gba", 0x61404d, 0x2 + .byte 12, 4 gUnknown_0861404F:: @ 861404F - .incbin "baserom.gba", 0x61404f, 0x5 + .byte 13, 4 + .align 2 gUnknown_08614054:: @ 8614054 - .incbin "baserom.gba", 0x614054, 0x30 + .4byte unknown_item_menu_type + .4byte unknown_item_menu_type + .4byte item_menu_type_2 + .4byte display_sell_item_ask_str + .4byte unknown_ItemMenu_Confirm + .4byte unknown_item_menu_type + .4byte display_deposit_item_ask_str + .4byte unknown_item_menu_type + .4byte unknown_item_menu_type + .4byte unknown_item_menu_type + .4byte NULL + .4byte item_menu_type_b + .align 2 gUnknown_08614084:: @ 8614084 - .incbin "baserom.gba", 0x614084, 0x8 + .4byte BagMenuActuallyToss + .4byte BagMenuCancelToss gUnknown_0861408C:: @ 861408C - .incbin "baserom.gba", 0x61408c, 0x8 + .4byte sub_81AD84C + .4byte sub_81AD6FC +@ probably a struct gUnknown_08614094:: @ 8614094 - .incbin "baserom.gba", 0x614094, 0x10 + .4byte 0x1101C00 + .4byte 0xFFFF1064 + .4byte 0x6FFFFF + .4byte 0x6F gUnknown_086140A4:: @ 86140A4 .incbin "baserom.gba", 0x6140a4, 0xc0 diff --git a/data/mauville_old_man.s b/data/mauville_old_man.s index 539cace62..c9e096f19 100644 --- a/data/mauville_old_man.s +++ b/data/mauville_old_man.s @@ -5,7 +5,7 @@ .align 2, 0 gUnknown_0859EFE4:: @ 859EFE4 - .incbin "baserom.gba", 0x59efe4, 0xc + .2byte 0x2811, 0x1029, 0x1018, 0xE0D, 0x1A1A, 0x1A1D gUnknown_0859EFF0:: @ 859EFF0 .incbin "baserom.gba", 0x59eff0, 0x20 diff --git a/data/save.s b/data/save.s index 29b750b3a..15e201baa 100644 --- a/data/save.s +++ b/data/save.s @@ -4,4 +4,17 @@ .section .rodata gSaveSectionOffsets:: @ 85CDC00 - .incbin "baserom.gba", 0x5cdc00, 0x38 + .2byte 0, 0xF2C + .2byte 0, 0xF80 + .2byte 0xF80, 0xF80 + .2byte 0x1F00, 0xF80 + .2byte 0x2E80, 0xF08 + .2byte 0, 0xF80 + .2byte 0xF80, 0xF80 + .2byte 0x1F00, 0xF80 + .2byte 0x2E80, 0xF80 + .2byte 0x3E00, 0xF80 + .2byte 0x4D80, 0xF80 + .2byte 0x5D00, 0xF80 + .2byte 0x6C80, 0xF80 + .2byte 0x7C00, 0x7D0 diff --git a/data/script_menu.s b/data/script_menu.s index 8cf395c04..cf4a5df01 100644 --- a/data/script_menu.s +++ b/data/script_menu.s @@ -4,26 +4,22 @@ .section .rodata gUnknown_0858ABD8:: @ 858ABD8 -@ replacing .incbin "baserom.gba", 0x0058abd8, 0x18 .4byte gUnknown_085EAD37, 0 .4byte gUnknown_085EAD41, 0 .4byte gText_Exit, 0 gUnknown_0858ABF0:: @ 58ABF0 -@ replacing .incbin "baserom.gba", 0x0058abf0, 0x18 .4byte gUnknown_085EAD67, 0 .4byte gUnknown_085EAD6D, 0 .4byte gText_Exit, 0 gUnknown_0858AC08:: @ 58AC08 -@ replacing .incbin "baserom.gba", 0x0058ac08, 0x20 .4byte gUnknown_085EAD72, 0 .4byte gUnknown_085EAD84, 0 .4byte gUnknown_085EAD96, 0 .4byte gText_Cancel2, 0 gUnknown_0858AC28:: @ 58AC28 -@ replacing .incbin "baserom.gba", 0x0058ac28, 0x30 .4byte gUnknown_085EADA4, 0 .4byte gUnknown_085EADB5, 0 .4byte gUnknown_085EADC4, 0 @@ -32,32 +28,27 @@ gUnknown_0858AC28:: @ 58AC28 .4byte gText_Exit, 0 gUnknown_0858AC58:: @ 58AC58 -@ replacing .incbin "baserom.gba", 0x0058ac58, 0x20 .4byte gUnknown_085EADF9, 0 .4byte gUnknown_085EAE04, 0 .4byte gUnknown_085EAE12, 0 .4byte gText_Exit, 0 gUnknown_0858AC78:: @ 58AC78 -@ replacing .incbin "baserom.gba", 0x0058ac78, 0x18 .4byte gUnknown_085EADF9, 0 .4byte gUnknown_085EAE04, 0 .4byte gText_Exit, 0 gUnknown_0858AC90:: @ 58AC90 -@ replacing .incbin "baserom.gba", 0x0058ac90, 0x20 - .4byte gUnknown_085E8CCB, 0 + .4byte gMenuText_Register, 0 .4byte gUnknown_085EAE12, 0 .4byte gUnknown_085EAE1B, 0 .4byte gText_Cancel2, 0 gUnknown_0858ACB0:: @ 58ACB0 -@ replacing .incbin "baserom.gba", 0x0058acb0, 0x10 .4byte gUnknown_085EAE27, 0 .4byte gUnknown_085EAE2C, 0 gUnknown_0858ACC0:: @ 58ACC0 -@ replacing .incbin "baserom.gba", 0x0058acc0, 0x30 .4byte gUnknown_085EAE31, 0 .4byte gUnknown_085EAE35, 0 .4byte gUnknown_085EAE39, 0 @@ -66,157 +57,131 @@ gUnknown_0858ACC0:: @ 58ACC0 .4byte gText_Exit, 0 gUnknown_0858ACF0:: @ 58ACF0 -@ replacing .incbin "baserom.gba", 0x0058acf0, 0x10 .4byte gUnknown_085EAD5F, 0 .4byte gText_Exit, 0 gUnknown_0858AD00:: @ 58AD00 -@ replacing .incbin "baserom.gba", 0x0058ad00, 0x10 .4byte gUnknown_085EAE53, 0 .4byte gUnknown_085EAE5A, 0 gUnknown_0858AD10:: @ 58AD10 -@ replacing .incbin "baserom.gba", 0x0058ad10, 0x18 .4byte gText_Yes, 0 .4byte gText_No, 0 .4byte gUnknown_085EAD6D, 0 gUnknown_0858AD28:: @ 58AD28 -@ replacing .incbin "baserom.gba", 0x0058ad28, 0x18 .4byte gUnknown_085EAEA2, 0 .4byte gUnknown_085EAEAC, 0 .4byte gText_Exit, 0 gUnknown_0858AD40:: @ 58AD40 -@ replacing .incbin "baserom.gba", 0x0058ad40, 0x18 .4byte gText_Lv50, 0 .4byte gText_OpenLevel, 0 .4byte gText_Exit, 0 gUnknown_0858AD58:: @ 58AD58 -@ replacing .incbin "baserom.gba", 0x0058ad58, 0x18 .4byte gUnknown_0827ECBC, 0 .4byte gUnknown_0827ECC3, 0 .4byte gUnknown_0827ECCD, 0 gUnknown_0858AD70:: @ 58AD70 -@ replacing .incbin "baserom.gba", 0x0058ad70, 0x18 .4byte gUnknown_0827ECD5, 0 .4byte gUnknown_0827ECDD, 0 .4byte gUnknown_0827ECE3, 0 gUnknown_0858AD88:: @ 58AD88 -@ replacing .incbin "baserom.gba", 0x0058ad88, 0x18 .4byte gUnknown_0827ECEB, 0 .4byte gUnknown_0827ECF2, 0 .4byte gUnknown_0827ECF8, 0 gUnknown_0858ADA0:: @ 58ADA0 -@ replacing .incbin "baserom.gba", 0x0058ada0, 0x18 .4byte gUnknown_0827ED00, 0 .4byte gUnknown_0827ED06, 0 .4byte gUnknown_0827ED10, 0 gUnknown_0858ADB8:: @ 58ADB8 -@ replacing .incbin "baserom.gba", 0x0058adb8, 0x18 .4byte gUnknown_0827ED18, 0 .4byte gUnknown_0827ED22, 0 .4byte gUnknown_0827ED2C, 0 gUnknown_0858ADD0:: @ 58ADD0 -@ replacing .incbin "baserom.gba", 0x0058add0, 0x18 .4byte gUnknown_0827ED36, 0 .4byte gUnknown_0827ED40, 0 .4byte gUnknown_0827ED46, 0 gUnknown_0858ADE8:: @ 58ADE8 -@ replacing .incbin "baserom.gba", 0x0058ade8, 0x18 .4byte gUnknown_0827ED4F, 0 .4byte gUnknown_0827ED59, 0 .4byte gUnknown_0827ED65, 0 gUnknown_0858AE00:: @ 58AE00 -@ replacing .incbin "baserom.gba", 0x0058ae00, 0x18 .4byte gUnknown_0827ED70, 0 .4byte gUnknown_0827ED74, 0 .4byte gUnknown_0827ED78, 0 gUnknown_0858AE18:: @ 58AE18 -@ replacing .incbin "baserom.gba", 0x0058ae18, 0x18 .4byte gUnknown_0827ED80, 0 .4byte gUnknown_0827ED95, 0 .4byte gUnknown_0827EDAA, 0 gUnknown_0858AE30:: @ 58AE30 -@ replacing .incbin "baserom.gba", 0x0058ae30, 0x18 .4byte gUnknown_0827EDB5, 0 .4byte gUnknown_0827EDBA, 0 .4byte gUnknown_0827EDC1, 0 gUnknown_0858AE48:: @ 58AE48 -@ replacing .incbin "baserom.gba", 0x0058ae48, 0x18 .4byte gUnknown_0827EDC9, 0 .4byte gUnknown_0827EDD5, 0 .4byte gUnknown_0827EDE4, 0 gUnknown_0858AE60:: @ 58AE60 -@ replacing .incbin "baserom.gba", 0x0058ae60, 0x18 .4byte gUnknown_0827EDF0, 0 .4byte gUnknown_0827EDF5, 0 .4byte gUnknown_0827EDF7, 0 gUnknown_0858AE78:: @ 58AE78 -@ replacing .incbin "baserom.gba", 0x0058ae78, 0x18 .4byte gUnknown_0827EDF9, 0 .4byte gUnknown_0827EDFB, 0 .4byte gUnknown_0827EDFD, 0 gUnknown_0858AE90:: @ 58AE90 -@ replacing .incbin "baserom.gba", 0x0058ae90, 0x18 .4byte gUnknown_0827EDFF, 0 .4byte gUnknown_0827EE01, 0 .4byte gUnknown_0827EE03, 0 gUnknown_0858AEA8:: @ 58AEA8 -@ replacing .incbin "baserom.gba", 0x0058aea8, 0x18 .4byte gUnknown_0827EE05, 0 .4byte gUnknown_0827EE07, 0 .4byte gUnknown_0827EE09, 0 gUnknown_0858AEC0:: @ 58AEC0 -@ replacing .incbin "baserom.gba", 0x0058aec0, 0x20 .4byte gUnknown_085EAEC3, 0 .4byte gUnknown_085EAED6, 0 .4byte gUnknown_085EAEE6, 0 .4byte gText_Exit, 0 gUnknown_0858AEE0:: @ 58AEE0 -@ replacing .incbin "baserom.gba", 0x0058aee0, 0x20 .4byte gUnknown_085EAEF6, 0 .4byte gUnknown_085EAF02, 0 .4byte gUnknown_085EAF0E, 0 .4byte gText_Exit, 0 gUnknown_0858AF00:: @ 58AF00 -@ replacing .incbin "baserom.gba", 0x0058af00, 0x20 .4byte gUnknown_085EAF1B, 0 .4byte gUnknown_085EAF24, 0 .4byte gUnknown_085EAF2F, 0 .4byte gText_Exit, 0 gUnknown_0858AF20:: @ 58AF20 -@ replacing .incbin "baserom.gba", 0x0058af20, 0x10 .4byte gUnknown_085EAF34, 0 .4byte gUnknown_085EAF3E, 0 gUnknown_0858AF30:: @ 58AF30 -@ replacing .incbin "baserom.gba", 0x0058af30, 0x18 .4byte gUnknown_085EAF4B, 0 .4byte gUnknown_085EAF58, 0 .4byte gText_Exit, 0 gUnknown_0858AF48:: @ 58AF48 -@ replacing .incbin "baserom.gba", 0x0058af48, 0x40 .4byte gUnknown_085EAF65, 0 .4byte gUnknown_085EAF70, 0 .4byte gUnknown_085EAF7D, 0 @@ -227,14 +192,12 @@ gUnknown_0858AF48:: @ 58AF48 .4byte gText_Cancel2, 0 gUnknown_0858AF88:: @ 58AF88 -@ replacing .incbin "baserom.gba", 0x0058af88, 0x20 .4byte gUnknown_085EAFB6, 0 .4byte gUnknown_085EAFCF, 0 .4byte gUnknown_085EAFE8, 0 .4byte gText_Exit, 0 gUnknown_0858AFA8:: @ 58AFA8 -@ replacing .incbin "baserom.gba", 0x0058afa8, 0x30 .4byte gUnknown_085EB089, 0 .4byte gUnknown_085EB09C, 0 .4byte gUnknown_085EB0AF, 0 @@ -243,40 +206,33 @@ gUnknown_0858AFA8:: @ 58AFA8 .4byte gText_Exit, 0 gUnknown_0858AFD8:: @ 58AFD8 -@ replacing .incbin "baserom.gba", 0x0058afd8, 0x18 .4byte gUnknown_085EB002, 0 .4byte gUnknown_085EB017, 0 .4byte gText_Exit, 0 gUnknown_0858AFF0:: @ 58AFF0 -@ replacing .incbin "baserom.gba", 0x0058aff0, 0x10 .4byte gUnknown_085EB02A, 0 .4byte gUnknown_085EB034, 0 gUnknown_0858B000:: @ 58B000 -@ replacing .incbin "baserom.gba", 0x0058b000, 0x18 - .4byte gUnknown_085EB79B, 0 - .4byte gUnknown_085EB06E, 0 + .4byte gText_LilycoveCity, 0 + .4byte gText_BattleFrontier, 0 .4byte gText_Exit, 0 gUnknown_0858B018:: @ 58B018 -@ replacing .incbin "baserom.gba", 0x0058b018, 0x18 - .4byte gUnknown_085EB7A9, 0 - .4byte gUnknown_085EB79B, 0 + .4byte gText_SlateportCity, 0 + .4byte gText_LilycoveCity, 0 .4byte gText_Exit, 0 gUnknown_0858B030:: @ 58B030 -@ replacing .incbin "baserom.gba", 0x0058b030, 0x10 .4byte gUnknown_085EB07E, 0 .4byte gUnknown_085EB084, 0 gUnknown_0858B040:: @ 58B040 -@ replacing .incbin "baserom.gba", 0x0058b040, 0x10 - .4byte gUnknown_085EB79B, 0 + .4byte gText_LilycoveCity, 0 .4byte gText_Exit, 0 gUnknown_0858B050:: @ 58B050 -@ replacing .incbin "baserom.gba", 0x0058b050, 0x30 .4byte gUnknown_085EB676, 0 .4byte gUnknown_085EB673, 0 .4byte gUnknown_085EB670, 0 @@ -285,91 +241,76 @@ gUnknown_0858B050:: @ 58B050 .4byte gText_Exit, 0 gUnknown_0858B080:: @ 58B080 -@ replacing .incbin "baserom.gba", 0x0058b080, 0x10 .4byte gUnknown_085EB040, 0 .4byte gText_Exit, 0 gUnknown_0858B090:: @ 58B090 -@ replacing .incbin "baserom.gba", 0x0058b090, 0x10 .4byte gUnknown_085EB04A, 0 .4byte gText_Exit, 0 gUnknown_0858B0A0:: @ 58B0A0 -@ replacing .incbin "baserom.gba", 0x0058b0a0, 0x18 .4byte gUnknown_085EB040, 0 .4byte gUnknown_085EB04A, 0 .4byte gText_Exit, 0 gUnknown_0858B0B8:: @ 58B0B8 -@ replacing .incbin "baserom.gba", 0x0058b0b8, 0x10 .4byte gUnknown_085EB057, 0 .4byte gText_Exit, 0 gUnknown_0858B0C8:: @ 58B0C8 -@ replacing .incbin "baserom.gba", 0x0058b0c8, 0x18 .4byte gUnknown_085EB040, 0 .4byte gUnknown_085EB057, 0 .4byte gText_Exit, 0 gUnknown_0858B0E0:: @ 58B0E0 -@ replacing .incbin "baserom.gba", 0x0058b0e0, 0x18 .4byte gUnknown_085EB04A, 0 .4byte gUnknown_085EB057, 0 .4byte gText_Exit, 0 gUnknown_0858B0F8:: @ 58B0F8 -@ replacing .incbin "baserom.gba", 0x0058b0f8, 0x20 .4byte gUnknown_085EB040, 0 .4byte gUnknown_085EB04A, 0 .4byte gUnknown_085EB057, 0 .4byte gText_Exit, 0 gUnknown_0858B118:: @ 58B118 -@ replacing .incbin "baserom.gba", 0x0058b118, 0x10 .4byte gUnknown_085EB062, 0 .4byte gText_Exit, 0 gUnknown_0858B128:: @ 58B128 -@ replacing .incbin "baserom.gba", 0x0058b128, 0x18 .4byte gUnknown_085EB040, 0 .4byte gUnknown_085EB062, 0 .4byte gText_Exit, 0 gUnknown_0858B140:: @ 58B140 -@ replacing .incbin "baserom.gba", 0x0058b140, 0x18 .4byte gUnknown_085EB04A, 0 .4byte gUnknown_085EB062, 0 .4byte gText_Exit, 0 gUnknown_0858B158:: @ 58B158 -@ replacing .incbin "baserom.gba", 0x0058b158, 0x20 .4byte gUnknown_085EB040, 0 .4byte gUnknown_085EB04A, 0 .4byte gUnknown_085EB062, 0 .4byte gText_Exit, 0 gUnknown_0858B178:: @ 58B178 -@ replacing .incbin "baserom.gba", 0x0058b178, 0x18 .4byte gUnknown_085EB057, 0 .4byte gUnknown_085EB062, 0 .4byte gText_Exit, 0 gUnknown_0858B190:: @ 58B190 -@ replacing .incbin "baserom.gba", 0x0058b190, 0x20 .4byte gUnknown_085EB040, 0 .4byte gUnknown_085EB057, 0 .4byte gUnknown_085EB062, 0 .4byte gText_Exit, 0 gUnknown_0858B1B0:: @ 58B1B0 -@ replacing .incbin "baserom.gba", 0x0058b1b0, 0x20 .4byte gUnknown_085EB04A, 0 .4byte gUnknown_085EB057, 0 .4byte gUnknown_085EB062, 0 .4byte gText_Exit, 0 gUnknown_0858B1D0:: @ 58B1D0 -@ replacing .incbin "baserom.gba", 0x0058b1d0, 0x28 .4byte gUnknown_085EB040, 0 .4byte gUnknown_085EB04A, 0 .4byte gUnknown_085EB057, 0 @@ -377,42 +318,36 @@ gUnknown_0858B1D0:: @ 58B1D0 .4byte gText_Exit, 0 gUnknown_0858B1F8:: @ 58B1F8 -@ replacing .incbin "baserom.gba", 0x0058b1f8, 0x30 - .4byte gUnknown_085EB1A0, 0 - .4byte gUnknown_085EB1A9, 0 - .4byte gUnknown_085EB1B6, 0 + .4byte gText_Opponent, 0 + .4byte gText_Tourney_Tree, 0 + .4byte gText_ReadyToStart, 0 .4byte gUnknown_085EB5BC, 0 .4byte gUnknown_085EB5C3, 0 .4byte gUnknown_085EB5C8, 0 gUnknown_0858B228:: @ 58B228 -@ replacing .incbin "baserom.gba", 0x0058b228, 0x28 - .4byte gUnknown_085EB1A0, 0 - .4byte gUnknown_085EB1A9, 0 - .4byte gUnknown_085EB1B6, 0 + .4byte gText_Opponent, 0 + .4byte gText_Tourney_Tree, 0 + .4byte gText_ReadyToStart, 0 .4byte gUnknown_085EB5C3, 0 .4byte gUnknown_085EB5C8, 0 gUnknown_0858B250:: @ 58B250 -@ replacing .incbin "baserom.gba", 0x0058b250, 0x10 .4byte gUnknown_085EB29A, 0 .4byte gUnknown_085EB2A3, 0 gUnknown_0858B260:: @ 58B260 -@ replacing .incbin "baserom.gba", 0x0058b260, 0x20 .4byte gUnknown_085EB372, 0 .4byte gUnknown_085EB37F, 0 .4byte gUnknown_085EB389, 0 .4byte gText_Exit, 0 gUnknown_0858B280:: @ 58B280 -@ replacing .incbin "baserom.gba", 0x0058b280, 0x18 .4byte gText_Yes, 0 .4byte gText_No, 0 .4byte gUnknown_085EAD6D, 0 gUnknown_0858B298:: @ 58B298 -@ replacing .incbin "baserom.gba", 0x0058b298, 0x28 .4byte gUnknown_085EAE6E, 0 .4byte gUnknown_085EAE7C, 0 .4byte gUnknown_085EAE8A, 0 @@ -420,14 +355,12 @@ gUnknown_0858B298:: @ 58B298 .4byte gText_Exit, 0 gUnknown_0858B2C0:: @ 58B2C0 -@ replacing .incbin "baserom.gba", 0x0058b2c0, 0x20 .4byte gUnknown_085EB372, 0 .4byte gUnknown_085EB37F, 0 .4byte gUnknown_085EB397, 0 .4byte gText_Exit, 0 gUnknown_0858B2E0:: @ 58B2E0 -@ replacing .incbin "baserom.gba", 0x0058b2e0, 0x28 .4byte gUnknown_085EB372, 0 .4byte gUnknown_085EB37F, 0 .4byte gUnknown_085EB389, 0 @@ -435,52 +368,44 @@ gUnknown_0858B2E0:: @ 58B2E0 .4byte gText_Exit, 0 gUnknown_0858B308:: @ 58B308 -@ replacing .incbin "baserom.gba", 0x0058b308, 0x18 .4byte gUnknown_085EB372, 0 .4byte gUnknown_085EB37F, 0 .4byte gText_Exit, 0 gUnknown_0858B320:: @ 58B320 -@ replacing .incbin "baserom.gba", 0x0058b320, 0x18 .4byte gUnknown_085EB3A4, 0 .4byte gUnknown_085EB3B1, 0 .4byte gText_Exit, 0 gUnknown_0858B338:: @ 58B338 -@ replacing .incbin "baserom.gba", 0x0058b338, 0x18 .4byte gUnknown_085EB3D4, 0 .4byte gUnknown_085EB3C6, 0 .4byte gText_Exit, 0 gUnknown_0858B350:: @ 58B350 -@ replacing .incbin "baserom.gba", 0x0058b350, 0x28 - .4byte gUnknown_085EB1C5, 0 - .4byte gUnknown_085EB1D1, 0 - .4byte gUnknown_085EB1DC, 0 - .4byte gUnknown_085EB1E7, 0 + .4byte gText_NormalRank, 0 + .4byte gText_SuperRank, 0 + .4byte gText_HyperRank, 0 + .4byte gText_MasterRank, 0 .4byte gText_Exit, 0 gUnknown_0858B378:: @ 58B378 -@ replacing .incbin "baserom.gba", 0x0058b378, 0x18 - .4byte gUnknown_085EB212, 0 - .4byte gUnknown_085EB21D, 0 + .4byte gText_BattleBag, 0 + .4byte gText_HeldItem, 0 .4byte gText_Exit, 0 gUnknown_0858B390:: @ 58B390 -@ replacing .incbin "baserom.gba", 0x0058b390, 0x20 - .4byte gUnknown_085EB227, 0 - .4byte gUnknown_085EB234, 0 - .4byte gUnknown_085EB241, 0 + .4byte gText_LinkContest, 0 + .4byte gText_AboutE_Mode, 0 + .4byte gText_AboutG_Mode, 0 .4byte gText_Cancel2, 0 gUnknown_0858B3B0:: @ 58B3B0 -@ replacing .incbin "baserom.gba", 0x0058b3b0, 0x18 - .4byte gUnknown_085EB24E, 0 - .4byte gUnknown_085EB255, 0 + .4byte gText_E_Mode, 0 + .4byte gText_G_Mode, 0 .4byte gText_Exit, 0 gUnknown_0858B3C8:: @ 58B3C8 -@ replacing .incbin "baserom.gba", 0x0058b3c8, 0x40 .4byte gText_MenuOptionPokedex, 0 .4byte gText_MenuOptionPokemon, 0 .4byte gText_MenuOptionBag, 0 @@ -491,50 +416,42 @@ gUnknown_0858B3C8:: @ 58B3C8 .4byte gText_MenuOptionExit, 0 gUnknown_0858B408:: @ 58B408 -@ replacing .incbin "baserom.gba", 0x0058b408, 0x20 .4byte gUnknown_085EB28A, 0 .4byte gUnknown_085EB290, 0 .4byte gUnknown_085EB295, 0 .4byte gText_Exit, 0 gUnknown_0858B428:: @ 58B428 -@ replacing .incbin "baserom.gba", 0x0058b428, 0x18 - .4byte gUnknown_085EB2AD, 0 - .4byte gUnknown_085EB2BD, 0 + .4byte gText_SouthernIsland, 0 + .4byte gText_BirthIsland, 0 .4byte gText_Exit, 0 gUnknown_0858B440:: @ 58B440 -@ replacing .incbin "baserom.gba", 0x0058b440, 0x18 - .4byte gUnknown_085EB2AD, 0 - .4byte gUnknown_085EB2CA, 0 + .4byte gText_SouthernIsland, 0 + .4byte gText_FarawayIsland, 0 .4byte gText_Exit, 0 gUnknown_0858B458:: @ 58B458 -@ replacing .incbin "baserom.gba", 0x0058b458, 0x18 - .4byte gUnknown_085EB2BD, 0 - .4byte gUnknown_085EB2CA, 0 + .4byte gText_BirthIsland, 0 + .4byte gText_FarawayIsland, 0 .4byte gText_Exit, 0 gUnknown_0858B470:: @ 58B470 -@ replacing .incbin "baserom.gba", 0x0058b470, 0x20 - .4byte gUnknown_085EB2AD, 0 - .4byte gUnknown_085EB2BD, 0 - .4byte gUnknown_085EB2CA, 0 + .4byte gText_SouthernIsland, 0 + .4byte gText_BirthIsland, 0 + .4byte gText_FarawayIsland, 0 .4byte gText_Exit, 0 gUnknown_0858B490:: @ 58B490 -@ replacing .incbin "baserom.gba", 0x0058b490, 0x18 .4byte gUnknown_085EB2E4, 0 .4byte gUnknown_085EB2F0, 0 .4byte gText_Exit, 0 gUnknown_0858B4A8:: @ 58B4A8 -@ replacing .incbin "baserom.gba", 0x0058b4a8, 0x10 .4byte gText_Yes, 0 .4byte gUnknown_085EB2FC, 0 gUnknown_0858B4B8:: @ 58B4B8 -@ replacing .incbin "baserom.gba", 0x0058b4b8, 0x30 .4byte gUnknown_085EB3DF, 0 .4byte gUnknown_085EB3EA, 0 .4byte gUnknown_085EB3F1, 0 @@ -543,14 +460,12 @@ gUnknown_0858B4B8:: @ 58B4B8 .4byte gText_Exit, 0 gUnknown_0858B4E8:: @ 58B4E8 -@ replacing .incbin "baserom.gba", 0x0058b4e8, 0x20 .4byte gUnknown_085EB415, 0 .4byte gUnknown_085EB41D, 0 .4byte gUnknown_085EB424, 0 .4byte gText_Exit, 0 gUnknown_0858B508:: @ 58B508 -@ replacing .incbin "baserom.gba", 0x0058b508, 0x28 .4byte gUnknown_085EB45C, 0 .4byte gUnknown_085EB469, 0 .4byte gUnknown_085EB475, 0 @@ -558,7 +473,6 @@ gUnknown_0858B508:: @ 58B508 .4byte gText_Exit, 0 gUnknown_0858B530:: @ 58B530 -@ replacing .incbin "baserom.gba", 0x0058b530, 0x28 .4byte gUnknown_085EB42F, 0 .4byte gUnknown_085EB43A, 0 .4byte gUnknown_085EB444, 0 @@ -566,14 +480,12 @@ gUnknown_0858B530:: @ 58B530 .4byte gText_Exit, 0 gUnknown_0858B558:: @ 58B558 -@ replacing .incbin "baserom.gba", 0x0058b558, 0x20 .4byte gUnknown_085EB48E, 0 .4byte gUnknown_085EB496, 0 .4byte gUnknown_085EB4A3, 0 .4byte gText_Exit, 0 gUnknown_0858B578:: @ 58B578 -@ replacing .incbin "baserom.gba", 0x0058b578, 0x30 .4byte gUnknown_085EB4AD, 0 .4byte gUnknown_085EB4B9, 0 .4byte gUnknown_085EB4C7, 0 @@ -582,7 +494,6 @@ gUnknown_0858B578:: @ 58B578 .4byte gText_Exit, 0 gUnknown_0858B5A8:: @ 58B5A8 -@ replacing .incbin "baserom.gba", 0x0058b5a8, 0x30 .4byte gUnknown_085EB4EB, 0 .4byte gUnknown_085EB4F9, 0 .4byte gUnknown_085EB508, 0 @@ -591,7 +502,6 @@ gUnknown_0858B5A8:: @ 58B5A8 .4byte gText_Exit, 0 gUnknown_0858B5D8:: @ 58B5D8 -@ replacing .incbin "baserom.gba", 0x0058b5d8, 0x28 .4byte gUnknown_085EB532, 0 .4byte gUnknown_085EB543, 0 .4byte gUnknown_085EB555, 0 @@ -599,57 +509,48 @@ gUnknown_0858B5D8:: @ 58B5D8 .4byte gText_Exit, 0 gUnknown_0858B600:: @ 58B600 -@ replacing .incbin "baserom.gba", 0x0058b600, 0x20 .4byte gUnknown_085EB56E, 0 .4byte gUnknown_085EB57E, 0 .4byte gUnknown_085EB589, 0 .4byte gText_Exit, 0 gUnknown_0858B620:: @ 58B620 -@ replacing .incbin "baserom.gba", 0x0058b620, 0x20 .4byte gUnknown_085EB5B6, 0 .4byte gUnknown_085EB5BC, 0 .4byte gUnknown_085EB5C3, 0 .4byte gUnknown_085EB5C8, 0 gUnknown_0858B640:: @ 58B640 -@ replacing .incbin "baserom.gba", 0x0058b640, 0x18 .4byte gUnknown_085EB5B6, 0 .4byte gUnknown_085EB5C3, 0 .4byte gUnknown_085EB5C8, 0 gUnknown_0858B658:: @ 58B658 -@ replacing .incbin "baserom.gba", 0x0058b658, 0x18 .4byte gUnknown_085EB5B6, 0 .4byte gUnknown_085EB5BC, 0 .4byte gUnknown_085EB5C8, 0 gUnknown_0858B670:: @ 58B670 -@ replacing .incbin "baserom.gba", 0x0058b670, 0x10 .4byte gUnknown_085EB5B6, 0 .4byte gUnknown_085EB5C8, 0 gUnknown_0858B680:: @ 58B680 -@ replacing .incbin "baserom.gba", 0x0058b680, 0x10 .4byte gUnknown_085EE14B, 0 .4byte gUnknown_085EE14F, 0 gUnknown_0858B690:: @ 58B690 -@ replacing .incbin "baserom.gba", 0x0058b690, 0x20 .4byte gUnknown_085EB2FF, 0 .4byte gUnknown_085EB310, 0 .4byte gUnknown_085EB317, 0 .4byte gUnknown_085EB31F, 0 gUnknown_0858B6B0:: @ 58B6B0 -@ replacing .incbin "baserom.gba", 0x0058b6b0, 0x20 - .4byte gUnknown_085EB7B8, 0 - .4byte gUnknown_085EB7C7, 0 - .4byte gUnknown_085EB7D0, 0 - .4byte gUnknown_085EB7DB, 0 + .4byte gText_CaveOfOrigin, 0 + .4byte gText_MtPyre, 0 + .4byte gText_SkyPillar, 0 + .4byte gText_DontRemember, 0 gUnknown_0858B6D0:: @ 58B6D0 -@ replacing .incbin "baserom.gba", 0x0058b6d0, 0x30 .4byte gUnknown_085EB4AD, 0 .4byte gUnknown_085EB4B9, 0 .4byte gUnknown_085EB4C7, 0 @@ -658,7 +559,6 @@ gUnknown_0858B6D0:: @ 58B6D0 .4byte gText_Exit, 0 gUnknown_0858B700:: @ 58B700 -@ replacing .incbin "baserom.gba", 0x0058b700, 0x30 .4byte gUnknown_085EB5A6, 0 .4byte gUnknown_085EB45C, 0 .4byte gUnknown_085EB469, 0 @@ -667,7 +567,6 @@ gUnknown_0858B700:: @ 58B700 .4byte gText_Exit, 0 gUnknown_0858B730:: @ 58B730 -@ replacing .incbin "baserom.gba", 0x0058b730, 0x28 .4byte gUnknown_085EB32D, 0 .4byte gUnknown_085EB33E, 0 .4byte gUnknown_085EB350, 0 @@ -675,12 +574,10 @@ gUnknown_0858B730:: @ 58B730 .4byte gText_Exit, 0 gUnknown_0858B758:: @ 58B758 -@ replacing .incbin "baserom.gba", 0x0058b758, 0x8 .4byte gText_Exit, 0 gUnknown_0858B760:: @ 858B760 -@ replacing .incbin "baserom.gba", 0x0058b760, 0x390 .4byte 0x0858abd8, 3 .4byte gUnknown_0858B758, 1 .4byte gUnknown_0858ABF0, 3 @@ -797,16 +694,55 @@ gUnknown_0858B760:: @ 858B760 .4byte gUnknown_0858B730, 5 gUnknown_0858BAF0:: @ 858BAF0 - .incbin "baserom.gba", 0x58baf0, 0x78 + .4byte gText_Cool + .4byte gText_Beauty + .4byte gText_Cute + .4byte gText_Smart + .4byte gText_Tough + .4byte gText_Normal + .4byte gText_Super + .4byte gText_Hyper + .4byte gText_Master + .4byte gText_Cool2 + .4byte gText_Beauty2 + .4byte gText_Cute2 + .4byte gText_Smart2 + .4byte gText_Tough2 + .4byte gText_Items + .4byte gText_Key_Items + .4byte gText_Poke_Balls + .4byte gText_TMs_Hms + .4byte gText_Berries2 + .4byte gText_Single2 + .4byte gText_Double2 + .4byte gText_Multi + .4byte gText_MultiLink + .4byte gText_BattleTower2 + .4byte gText_BattleDome + .4byte gText_BattleFactory + .4byte gText_BattlePalace + .4byte gText_BattleArena + .4byte gText_BattlePike + .4byte gText_BattlePyramid gUnknown_0858BB68:: @ 858BB68 - .incbin "baserom.gba", 0x58bb68, 0x8 + .byte 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F + .align 2 gUnknown_0858BB70:: @ 858BB70 - .incbin "baserom.gba", 0x58bb70, 0x10 + .4byte gText_SomeonesPC + .4byte gText_LanettesPC + .4byte gText_PlayersPC + .4byte gText_LogOff gUnknown_0858BB80:: @ 858BB80 - .incbin "baserom.gba", 0x58bb80, 0x1c + .4byte gText_SlateportCity + .4byte gText_BattleFrontier + .4byte gText_SouthernIsland + .4byte gText_NavelRock + .4byte gText_BirthIsland + .4byte gText_FarawayIsland + .4byte gText_Exit gUnknown_0858BB9C:: @ 858BB9C .incbin "baserom.gba", 0x58bb9c, 0x10 diff --git a/data/smokescreen.s b/data/smokescreen.s index 6f2478842..d92c972df 100644 --- a/data/smokescreen.s +++ b/data/smokescreen.s @@ -52,7 +52,7 @@ gUnknown_0831C688:: @ 831C688 spr_template 0xd6eb, 0xd6eb, gUnknown_0831C630, gUnknown_0831C678, NULL, gDummySpriteAffineAnimTable, sub_80753B4 .align 2 -gUnknown_0831C6A0:: @ 831C6A0 +gSpriteSheet_EnemyShadow:: @ 831C6A0 obj_tiles gUnknown_08D8FBC0, 0x0080, 0xd759 .align 2 @@ -60,5 +60,5 @@ gUnknown_0831C6A8:: @ 831C6A8 .byte 0x00, 0x40, 0x00, 0x40, 0x00, 0x0c, 0x00, 0x00 .align 2 -gUnknown_0831C6B0:: @ 831C6B0 - spr_template 0xd759, 0xd6ff, gUnknown_0831C6A8, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_805EE48 +gSpriteTemplate_EnemyShadow:: @ 831C6B0 + spr_template 0xd759, 0xd6ff, gUnknown_0831C6A8, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCB_SetInvisible diff --git a/data/strings.s b/data/strings.s index 2b88c6d03..42dcc2316 100644 --- a/data/strings.s +++ b/data/strings.s @@ -534,25 +534,25 @@ gUnknown_085E8CAC:: @ 85E8CAC gText_FlyToWhere:: @ 85E8CB4 .string "FLY to where?$" -gUnknown_085E8CC2:: @ 85E8CC2 +gMenuText_Use:: @ 85E8CC2 .string "USE$" -gUnknown_085E8CC6:: @ 85E8CC6 +gMenuText_Toss:: @ 85E8CC6 .string "TOSS$" -gUnknown_085E8CCB:: @ 85E8CCB +gMenuText_Register:: @ 85E8CCB .string "REGISTER$" -gUnknown_085E8CD4:: @ 85E8CD4 +gMenuText_Give:: @ 85E8CD4 .string "GIVE$" -gUnknown_085E8CD9:: @ 85E8CD9 +gMenuText_CheckTag:: @ 85E8CD9 .string "CHECK TAG$" -gText_Confirm:: @ 85E8CE3 +gMenuText_Confirm:: @ 85E8CE3 .string "CONFIRM$" -gUnknown_085E8CEB:: @ 85E8CEB +gMenuText_Walk:: @ 85E8CEB .string "WALK$" gText_Cancel:: @ 85E8CF0 @@ -561,7 +561,7 @@ gText_Cancel:: @ 85E8CF0 gText_Cancel2:: @ 85E8CF7 .string "CANCEL$" -gUnknown_085E8CFE:: @ 85E8CFE +gMenuText_Show:: @ 85E8CFE .string "SHOW$" gText_EmptyString2:: @ 85E8D03 @@ -582,13 +582,13 @@ gUnknown_085E8D15:: @ 85E8D15 gUnknown_085E8D1A:: @ 85E8D1A .string "STORE$" -gUnknown_085E8D20:: @ 85E8D20 +gMenuText_Check:: @ 85E8D20 .string "CHECK$" gText_None:: @ 85E8D26 .string "NONE$" -gUnknown_085E8D2B:: @ 85E8D2B +gMenuText_Deselect:: @ 85E8D2B .string "DESELECT$" gText_ThreeMarks:: @ 85E8D34 @@ -642,7 +642,7 @@ gText_GoBackPrevMenu:: @ 85E8D62 gText_WhatWouldYouLike:: @ 85E8D80 .string "What would you like to do?$" -gUnknown_085E8D9B:: @ 85E8D9B +gMenuText_Give2:: @ 85E8D9B .string "GIVE$" gText_xVar1:: @ 85E8DA0 @@ -1946,7 +1946,7 @@ gUnknown_085EB057:: @ 85EB057 gUnknown_085EB062:: @ 85EB062 .string "GREEN SHARD$" -gUnknown_085EB06E:: @ 85EB06E +gText_BattleFrontier:: @ 85EB06E .string "BATTLE FRONTIER$" gUnknown_085EB07E:: @ 85EB07E @@ -1985,46 +1985,46 @@ gText_Smart:: @ 85EB0F9 gText_Tough:: @ 85EB0FF .string "TOUGH$" -gUnknown_085EB105:: @ 85EB105 +gText_Normal:: @ 85EB105 .string "NORMAL$" -gUnknown_085EB10C:: @ 85EB10C +gText_Super:: @ 85EB10C .string "SUPER$" -gUnknown_085EB112:: @ 85EB112 +gText_Hyper:: @ 85EB112 .string "HYPER$" -gUnknown_085EB118:: @ 85EB118 +gText_Master:: @ 85EB118 .string "MASTER$" -gUnknown_085EB11F:: @ 85EB11F +gText_Cool2:: @ 85EB11F .string "COOL$" -gUnknown_085EB124:: @ 85EB124 +gText_Beauty2:: @ 85EB124 .string "BEAUTY$" -gUnknown_085EB12B:: @ 85EB12B +gText_Cute2:: @ 85EB12B .string "CUTE$" -gUnknown_085EB130:: @ 85EB130 +gText_Smart2:: @ 85EB130 .string "SMART$" -gUnknown_085EB136:: @ 85EB136 +gText_Tough2:: @ 85EB136 .string "TOUGH$" -gUnknown_085EB13C:: @ 85EB13C +gText_Items:: @ 85EB13C .string "ITEMS$" -gUnknown_085EB142:: @ 85EB142 +gText_Key_Items:: @ 85EB142 .string "KEY ITEMS$" -gUnknown_085EB14C:: @ 85EB14C +gText_Poke_Balls:: @ 85EB14C .string "POKé BALLS$" -gUnknown_085EB157:: @ 85EB157 +gText_TMs_Hms:: @ 85EB157 .string "TMs & HMs$" -gUnknown_085EB161:: @ 85EB161 +gText_Berries2:: @ 85EB161 .string "BERRIES$" gText_SomeonesPC:: @ 85EB169 @@ -2042,58 +2042,58 @@ gText_HallOfFame:: @ 85EB18B gText_LogOff:: @ 85EB198 .string "LOG OFF$" -gUnknown_085EB1A0:: @ 85EB1A0 +gText_Opponent:: @ 85EB1A0 .string "OPPONENT$" -gUnknown_085EB1A9:: @ 85EB1A9 +gText_Tourney_Tree:: @ 85EB1A9 .string "TOURNEY TREE$" -gUnknown_085EB1B6:: @ 85EB1B6 +gText_ReadyToStart:: @ 85EB1B6 .string "READY TO START$" -gUnknown_085EB1C5:: @ 85EB1C5 +gText_NormalRank:: @ 85EB1C5 .string "NORMAL RANK$" -gUnknown_085EB1D1:: @ 85EB1D1 +gText_SuperRank:: @ 85EB1D1 .string "SUPER RANK$" -gUnknown_085EB1DC:: @ 85EB1DC +gText_HyperRank:: @ 85EB1DC .string "HYPER RANK$" -gUnknown_085EB1E7:: @ 85EB1E7 +gText_MasterRank:: @ 85EB1E7 .string "MASTER RANK$" -gUnknown_085EB1F3:: @ 85EB1F3 +gText_Single2:: @ 85EB1F3 .string "SINGLE$" -gUnknown_085EB1FA:: @ 85EB1FA +gText_Double2:: @ 85EB1FA .string "DOUBLE$" -gUnknown_085EB201:: @ 85EB201 +gText_Multi:: @ 85EB201 .string "MULTI$" -gUnknown_085EB207:: @ 85EB207 +gText_MultiLink:: @ 85EB207 .string "MULTI-LINK$" -gUnknown_085EB212:: @ 85EB212 +gText_BattleBag:: @ 85EB212 .string "BATTLE BAG$" -gUnknown_085EB21D:: @ 85EB21D +gText_HeldItem:: @ 85EB21D .string "HELD ITEM$" -gUnknown_085EB227:: @ 85EB227 +gText_LinkContest:: @ 85EB227 .string "LINK CONTEST$" -gUnknown_085EB234:: @ 85EB234 +gText_AboutE_Mode:: @ 85EB234 .string "ABOUT E-MODE$" -gUnknown_085EB241:: @ 85EB241 +gText_AboutG_Mode:: @ 85EB241 .string "ABOUT G-MODE$" -gUnknown_085EB24E:: @ 85EB24E +gText_E_Mode:: @ 85EB24E .string "E-MODE$" -gUnknown_085EB255:: @ 85EB255 +gText_G_Mode:: @ 85EB255 .string "G-MODE$" gText_MenuOptionPokedex:: @ 85EB25C @@ -2138,16 +2138,16 @@ gUnknown_085EB29A:: @ 85EB29A gUnknown_085EB2A3:: @ 85EB2A3 .string "BLUE TENT$" -gUnknown_085EB2AD:: @ 85EB2AD +gText_SouthernIsland:: @ 85EB2AD .string "SOUTHERN ISLAND$" -gUnknown_085EB2BD:: @ 85EB2BD +gText_BirthIsland:: @ 85EB2BD .string "BIRTH ISLAND$" -gUnknown_085EB2CA:: @ 85EB2CA +gText_FarawayIsland:: @ 85EB2CA .string "FARAWAY ISLAND$" -gUnknown_085EB2D9:: @ 85EB2D9 +gText_NavelRock:: @ 85EB2D9 .string "NAVEL ROCK$" gUnknown_085EB2E4:: @ 85EB2E4 @@ -2477,22 +2477,22 @@ gUnknown_085EB77D:: @ 85EB77D gUnknown_085EB78A:: @ 85EB78A .string "EXCHANGE SERVICE$" -gUnknown_085EB79B:: @ 85EB79B +gText_LilycoveCity:: @ 85EB79B .string "LILYCOVE CITY$" -gUnknown_085EB7A9:: @ 85EB7A9 +gText_SlateportCity:: @ 85EB7A9 .string "SLATEPORT CITY$" -gUnknown_085EB7B8:: @ 85EB7B8 +gText_CaveOfOrigin:: @ 85EB7B8 .string "CAVE OF ORIGIN$" -gUnknown_085EB7C7:: @ 85EB7C7 +gText_MtPyre:: @ 85EB7C7 .string "MT. PYRE$" -gUnknown_085EB7D0:: @ 85EB7D0 +gText_SkyPillar:: @ 85EB7D0 .string "SKY PILLAR$" -gUnknown_085EB7DB:: @ 85EB7DB +gText_DontRemember:: @ 85EB7DB .string "Don’t remember$" gText_Exit:: @ 85EB7EA @@ -3563,25 +3563,25 @@ gText_BattleTower:: @ 85ED0D3 gText_WSlashStraightSlash:: @ 85ED0E0 .string "W/{COLOR RED}{SHADOW LIGHT_RED}{STR_VAR_1}{COLOR DARK_GREY}{SHADOW LIGHT_GREY} STRAIGHT/{COLOR RED}{SHADOW LIGHT_RED}{STR_VAR_2}$" -gUnknown_085ED104:: @ 85ED104 +gText_BattleTower2:: @ 85ED104 .string "BATTLE TOWER$" -gUnknown_085ED111:: @ 85ED111 +gText_BattleDome:: @ 85ED111 .string "BATTLE DOME$" -gUnknown_085ED11D:: @ 85ED11D +gText_BattlePalace:: @ 85ED11D .string "BATTLE PALACE$" -gUnknown_085ED12B:: @ 85ED12B +gText_BattleFactory:: @ 85ED12B .string "BATTLE FACTORY$" -gUnknown_085ED13A:: @ 85ED13A +gText_BattleArena:: @ 85ED13A .string "BATTLE ARENA$" -gUnknown_085ED147:: @ 85ED147 +gText_BattlePike:: @ 85ED147 .string "BATTLE PIKE$" -gUnknown_085ED153:: @ 85ED153 +gText_BattlePyramid:: @ 85ED153 .string "BATTLE PYRAMID$" .align 2 diff --git a/graphics/berry_blender/arrow.pal b/graphics/berry_blender/arrow.pal new file mode 100644 index 000000000..4c975292d --- /dev/null +++ b/graphics/berry_blender/arrow.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +255 255 255 +213 222 238 +180 197 230 +148 172 222 +115 148 205 +82 123 197 +49 98 189 +255 180 205 +255 115 98 +255 49 0 +205 65 65 +189 24 24 +148 16 16 +74 57 139 +8 0 82 diff --git a/graphics/berry_blender/arrow.png b/graphics/berry_blender/arrow.png new file mode 100644 index 000000000..a40948824 Binary files /dev/null and b/graphics/berry_blender/arrow.png differ diff --git a/graphics/berry_blender/center.pal b/graphics/berry_blender/center.pal new file mode 100644 index 000000000..606c527a3 --- /dev/null +++ b/graphics/berry_blender/center.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +255 255 255 +205 197 255 +172 164 222 +139 139 189 +106 106 156 +74 82 123 +41 57 90 +213 222 189 +180 189 156 +148 156 123 +115 123 90 +255 172 123 +246 115 82 +238 57 41 +156 24 0 diff --git a/graphics/berry_blender/center.png b/graphics/berry_blender/center.png new file mode 100644 index 000000000..1da3629d4 Binary files /dev/null and b/graphics/berry_blender/center.png differ diff --git a/graphics/berry_blender/center_map.bin b/graphics/berry_blender/center_map.bin new file mode 100644 index 000000000..ef28d5093 Binary files /dev/null and b/graphics/berry_blender/center_map.bin differ diff --git a/graphics/berry_blender/countdown_numbers.png b/graphics/berry_blender/countdown_numbers.png new file mode 100644 index 000000000..7884d0c07 Binary files /dev/null and b/graphics/berry_blender/countdown_numbers.png differ diff --git a/graphics/berry_blender/marubatsu.png b/graphics/berry_blender/marubatsu.png new file mode 100644 index 000000000..f927bbce9 Binary files /dev/null and b/graphics/berry_blender/marubatsu.png differ diff --git a/graphics/berry_blender/misc.pal b/graphics/berry_blender/misc.pal new file mode 100644 index 000000000..9c1db8d12 --- /dev/null +++ b/graphics/berry_blender/misc.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +0 0 0 +0 0 0 +255 213 0 +255 82 82 +98 255 255 +0 189 255 +98 255 98 +205 0 0 +255 0 0 +255 156 156 +0 0 0 +255 255 0 +255 255 148 +189 189 189 +255 255 255 diff --git a/graphics/berry_blender/outer.pal b/graphics/berry_blender/outer.pal new file mode 100644 index 000000000..c3b83cf16 --- /dev/null +++ b/graphics/berry_blender/outer.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +255 255 255 +213 222 238 +180 197 230 +148 172 222 +115 148 205 +82 123 197 +49 98 189 +255 180 205 +255 115 98 +255 49 0 +205 65 65 +189 24 24 +148 123 197 +74 57 139 +8 0 82 diff --git a/graphics/berry_blender/outer.png b/graphics/berry_blender/outer.png new file mode 100644 index 000000000..d8040b022 Binary files /dev/null and b/graphics/berry_blender/outer.png differ diff --git a/graphics/berry_blender/outer_map.bin b/graphics/berry_blender/outer_map.bin new file mode 100644 index 000000000..092e3997e Binary files /dev/null and b/graphics/berry_blender/outer_map.bin differ diff --git a/graphics/berry_blender/particles.png b/graphics/berry_blender/particles.png new file mode 100644 index 000000000..d0086b029 Binary files /dev/null and b/graphics/berry_blender/particles.png differ diff --git a/graphics/berry_blender/start.png b/graphics/berry_blender/start.png new file mode 100644 index 000000000..5c8d8d5d9 Binary files /dev/null and b/graphics/berry_blender/start.png differ diff --git a/graphics/unknown/unknown_339514.pal b/graphics/unknown/unknown_339514.pal new file mode 100644 index 000000000..b87f25a6c --- /dev/null +++ b/graphics/unknown/unknown_339514.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +255 255 255 +213 222 238 +180 197 230 +148 172 222 +115 148 205 +82 123 197 +49 98 189 +255 230 205 +255 164 98 +255 106 0 +222 65 8 +189 24 24 +106 106 0 +222 65 8 +189 24 24 diff --git a/include/battle.h b/include/battle.h index ace2bb4ad..4cf0d2e03 100644 --- a/include/battle.h +++ b/include/battle.h @@ -6,6 +6,7 @@ #include "battle_script_commands.h" #include "battle_2.h" #include "battle_ai_switch_items.h" +#include "battle_gfx_sfx_util.h" /* Banks are a name given to what could be called a 'battlerId' or 'monControllerId'. @@ -670,7 +671,7 @@ struct BattleStruct u8 fillerDC[0xDF-0xDC]; u8 field_DF; u8 mirrorMoveArrays[32]; - u16 castformPalette[4][16]; + u16 castformPalette[BATTLE_BANKS_COUNT][16]; u8 field_180; u8 field_181; u8 field_182; @@ -807,6 +808,18 @@ extern struct BattleStruct* gBattleStruct; #define B_ANIM_SUBSTITUTE_TO_MON 0x5 #define B_ANIM_MON_TO_SUBSTITUTE 0x6 +// status animation table +#define B_ANIM_STATUS_PSN 0x0 +#define B_ANIM_STATUS_CONFUSION 0x1 +#define B_ANIM_STATUS_BRN 0x2 +#define B_ANIM_STATUS_INFATUATION 0x3 +#define B_ANIM_STATUS_SLP 0x4 +#define B_ANIM_STATUS_PRZ 0x5 +#define B_ANIM_STATUS_FRZ 0x6 +#define B_ANIM_STATUS_CURSED 0x7 +#define B_ANIM_STATUS_NIGHTMARE 0x8 +#define B_ANIM_STATUS_WRAPPED 0x9 + #define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8 #define GET_STAT_BUFF_VALUE(n)(((n >> 4) & 7)) // 0x10, 0x20, 0x40 #define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit @@ -864,43 +877,6 @@ void AdjustFriendshipOnBattleFaint(u8 bank); void sub_80571DC(u8 bank, u8 arg1); u32 sub_805725C(u8 bank); -// battle 7 -void AllocateBattleSpritesData(void); -void FreeBattleSpritesData(void); -void AllocateMonSpritesGfx(void); -void FreeMonSpritesGfx(void); -void BattleMusicStop(void); -void sub_805E990(struct Pokemon *mon, u8 bank); -void sub_805EF14(void); -bool8 BattleInitAllSprites(u8 *state1, u8 *state2); -void sub_805E350(void); -bool8 BattleLoadAllHealthBoxesGfx(u8 state); -void LoadAndCreateEnemyShadowSprites(void); -void SetBankEnemyShadowSpriteCallback(u8 bank, u16 species); -void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 bank); -void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 bank); -void BattleLoadSubstituteSpriteGfx(u8 bank, bool8 arg1); -void nullsub_24(u16 arg0); -void nullsub_25(u8 arg0); -void ClearTemporarySpeciesSpriteData(u8 bank, bool8 dontClearSubstitute); -void sub_805D714(struct Sprite *sprite); -void DecompressTrainerBackPic(u16 backPicId, u8 bank); -void DecompressTrainerFrontPic(u16 frontPicId, u8 bank); -void FreeTrainerFrontPicPalette(u16 frontPicId); -void sub_805D7AC(struct Sprite *sprite); -bool8 IsMoveWithoutAnimation(u16 moveId, u8 animationTurn); -void sub_805EB9C(u8 arg0); -void sub_805E394(void); -void TrySetBehindSubstituteSpriteBit(u8 bank, u16 move); -void DoStatusAnimation(bool8 isStatus2, u32 status); -void DoSpecialBattleAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId); -bool8 DoBattleAnimationFromTable(u8 active, u8 atkBank, u8 defBank, u8 tableId, u16 argument); -void CopyBattleSpriteInvisibility(u8 bank); -u16 ChooseMoveAndTargetInBattlePalace(void); -void LoadBattleBarGfx(u8 arg0); -bool8 mplay_80342A4(u8 bank); -void sub_805EEE0(u8 bank); - enum { BACK_PIC_BRENDAN, @@ -921,7 +897,7 @@ u8 GetBankByIdentity(u8 bank); struct BattleSpriteInfo { u16 invisible : 1; // 0x1 - u16 flag_x2 : 1; // 0x2 + u16 lowHpSong : 1; // 0x2 u16 behindSubstitute : 1; // 0x4 u16 flag_x8 : 1; // 0x8 u16 hpNumbersNoBars : 1; // 0x10 @@ -930,7 +906,7 @@ struct BattleSpriteInfo struct BattleAnimationInfo { - u16 field; // to fill up later + u16 animArg; // to fill up later u8 field_2; u8 field_3; u8 field_4; @@ -944,6 +920,12 @@ struct BattleAnimationInfo u8 field_9_x20 : 1; u8 field_9_x40 : 1; u8 field_9_x80 : 1; + u8 field_A; + u8 field_B; + u8 field_C; + u8 field_D; + u8 field_E; + u8 field_F; }; struct BattleHealthboxInfo @@ -966,7 +948,7 @@ struct BattleHealthboxInfo u8 animationState; u8 field_5; u8 field_6; - u8 field_7; + u8 shadowSpriteId; u8 field_8; u8 field_9; u8 field_A; @@ -1006,8 +988,11 @@ struct MonSpritesGfx void* firstDecompressed; // ptr to the decompressed sprite of the first pokemon void* sprites[4]; struct SpriteTemplate templates[4]; - u8 field_74[0x100]; - u8 *fontPixels; + struct SpriteFrameImage field_74[4][4]; + u8 field_F4[0x80]; + u8 *barFontGfx; + void *field_178; + void *field_17C; }; extern struct BattleSpritesGfx* gMonSpritesGfx; diff --git a/include/battle_anim.h b/include/battle_anim.h index e912af6b1..c055e94fa 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -92,7 +92,11 @@ u8 sub_80A6D94(void); u8 sub_80A8364(u8); void StoreSpriteCallbackInData6(struct Sprite *sprite, void (*spriteCallback)(struct Sprite*)); void oamt_add_pos2_onto_pos1(struct Sprite *sprite); -u8 sub_80A6138(u8 bank); +u8 GetBankSpriteDefault_Y(u8 bank); u8 sub_80A82E4(u8 bank); +u8 GetSubstituteSpriteDefault_Y(u8 bank); + +// battle_anim_80A9C70.s +void LaunchStatusAnimation(u8 bank, u8 statusAnimId); #endif // GUARD_BATTLE_ANIM_H diff --git a/include/battle_gfx_sfx_util.h b/include/battle_gfx_sfx_util.h new file mode 100644 index 000000000..313a29811 --- /dev/null +++ b/include/battle_gfx_sfx_util.h @@ -0,0 +1,50 @@ +#ifndef GUARD_BATTLE_GFX_SFX_UTIL +#define GUARD_BATTLE_GFX_SFX_UTIL + +void AllocateBattleSpritesData(void); +void FreeBattleSpritesData(void); +u16 ChooseMoveAndTargetInBattlePalace(void); +void sub_805D714(struct Sprite *sprite); +void sub_805D770(struct Sprite *sprite, bool8 arg1); +void sub_805D7AC(struct Sprite *sprite); +void InitAndLaunchChosenStatusAnimation(bool8 isStatus2, u32 status); +bool8 TryHandleLaunchBattleTableAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId, u16 argument); +void InitAndLaunchSpecialAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId); +bool8 IsMoveWithoutAnimation(u16 moveId, u8 animationTurn); +bool8 mplay_80342A4(u8 bank); +void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 bank); +void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 bank); +void nullsub_23(void); +void nullsub_24(u16 species); +void DecompressTrainerFrontPic(u16 frontPicId, u8 bank); +void DecompressTrainerBackPic(u16 backPicId, u8 bank); +void nullsub_25(u8 arg0); +void FreeTrainerFrontPicPalette(u16 frontPicId); +void sub_805DFFC(void); +bool8 BattleLoadAllHealthBoxesGfx(u8 state); +void LoadBattleBarGfx(u8 arg0); +bool8 BattleInitAllSprites(u8 *state1, u8 *bank); +void ClearSpritesHealthboxAnimData(void); +void CopyAllBattleSpritesInvisibilities(void); +void CopyBattleSpriteInvisibility(u8 bank); +void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform); +void BattleLoadSubstituteOrMonSpriteGfx(u8 bank, bool8 loadMonSprite); +void LoadBattleMonGfxAndAnimate(u8 bank, bool8 loadMonSprite, u8 spriteId); +void TrySetBehindSubstituteSpriteBit(u8 bank, u16 move); +void ClearBehindSubstituteBit(u8 bank); +void HandleLowHpMusicChange(struct Pokemon *mon, u8 bank); +void BattleStopLowHpSound(void); +u8 GetMonHPBarLevel(struct Pokemon *mon); +void sub_805EAE8(void); +void sub_805EB9C(u8 affineMode); +void LoadAndCreateEnemyShadowSprites(void); +void SpriteCB_SetInvisible(struct Sprite *sprite); +void SetBankEnemyShadowSpriteCallback(u8 bank, u16 species); +void EnemyShadowCallbackToSetInvisible(u8 bank); +void sub_805EF14(void); +void ClearTemporarySpeciesSpriteData(u8 bank, bool8 dontClearSubstitute); +void AllocateMonSpritesGfx(void); +void FreeMonSpritesGfx(void); +bool32 ShouldPlayNormalPokeCry(struct Pokemon *mon); + +#endif // GUARD_BATTLE_GFX_SFX_UTIL diff --git a/include/battle_interface.h b/include/battle_interface.h index aad30f7b3..b2d3b1b97 100644 --- a/include/battle_interface.h +++ b/include/battle_interface.h @@ -15,6 +15,15 @@ enum EXP_BAR }; +enum +{ + HP_BAR_EMPTY, + HP_BAR_RED, + HP_BAR_YELLOW, + HP_BAR_GREEN, + HP_BAR_FULL, +}; + #define TAG_HEALTHBOX_PLAYER1_TILE 0xD6FF #define TAG_HEALTHBOX_PLAYER2_TILE 0xD700 #define TAG_HEALTHBOX_OPPONENT1_TILE 0xD701 diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h index a466abc04..ebfeabccc 100644 --- a/include/battle_script_commands.h +++ b/include/battle_script_commands.h @@ -57,6 +57,6 @@ void HandleBattleWindow(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags); bool8 UproarWakeUpCheck(u8 bank); extern void (* const gBattleScriptingCommandsTable[])(void); -extern const u8 gUnknown_0831C494[]; +extern const u8 gUnknown_0831C494[][4]; #endif // GUARD_BATTLE_SCRIPT_COMMANDS_H diff --git a/include/contest.h b/include/contest.h index 7dcde7da2..76fbaad3e 100644 --- a/include/contest.h +++ b/include/contest.h @@ -20,6 +20,12 @@ struct ContestStruct_field_18 { // unknown size u16 field_0; + u16 field_2; + u16 field_4; + u16 field_6; + u32 field_8; + u32 field_C; + u32 field_10; }; struct ContestResources diff --git a/include/decompress.h b/include/decompress.h index c3a771893..36be803e0 100644 --- a/include/decompress.h +++ b/include/decompress.h @@ -3,6 +3,8 @@ #include "sprite.h" +extern u8 gDecompressionBuffer[0x4000]; + void LZDecompressWram(const void *src, void *dest); void LZDecompressVram(const void *src, void *dest); diff --git a/include/pokemon.h b/include/pokemon.h index 0c7d6ac40..69b9e71d5 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -612,8 +612,8 @@ u32 CanMonLearnTMHM(struct Pokemon *, u8); u32 CanSpeciesLearnTMHM(u16 species, u8 tm); u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves); void ClearBattleMonForms(void); -const u8 *pokemon_get_pal(struct Pokemon *mon); -const u8 *species_and_otid_get_pal(u16, u32, u32); +const u8 *GetMonFrontSpritePal(struct Pokemon *mon); +const u8 *GetFrontSpritePalFromSpeciesAndPersonality(u16, u32, u32); const struct CompressedSpritePalette *sub_80409C8(u16, u32, u32); bool8 IsOtherTrainer(u32, u8 *); void SetWildMonHeldItem(void); diff --git a/ld_script.txt b/ld_script.txt index 32faa58ee..40f592e3a 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -62,7 +62,7 @@ SECTIONS { src/battle_script_commands.o(.text); asm/battle_5.o(.text); src/battle_controller_player.o(.text); - asm/battle_7.o(.text); + src/battle_gfx_sfx_util.o(.text); src/battle_controller_opponent.o(.text); src/battle_ai_switch_items.o(.text); src/battle_controller_link_opponent.o(.text); @@ -85,6 +85,7 @@ SECTIONS { src/load_save.o(.text); asm/load_save.o(.text); asm/trade.o(.text); + src/berry_blender.o(.text); asm/berry_blender.o(.text); src/play_time.o(.text); src/new_game.o(.text); @@ -344,11 +345,11 @@ SECTIONS { src/util.o(.rodata); data/daycare.o(.rodata); src/egg_hatch.o(.rodata); - data/battle_7.o(.rodata); + src/battle_gfx_sfx_util.o(.rodata); src/battle_interface.o(.rodata); data/pokeball.o(.rodata); data/trade.o(.rodata); - data/berry_blender.o(.rodata); + src/berry_blender.o(.rodata); src/new_game.o(.rodata); data/rom4.o(.rodata); data/fieldmap.o(.rodata); diff --git a/src/battle_2.c b/src/battle_2.c index 24b43bdbd..e4ee624fb 100644 --- a/src/battle_2.c +++ b/src/battle_2.c @@ -4767,7 +4767,7 @@ static void HandleEndTurn_BattleWon(void) else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_x4000000 | BATTLE_TYPE_EREADER_TRAINER)) { - BattleMusicStop(); + BattleStopLowHpSound(); gBattlescriptCurrInstr = BattleScript_FrontierTrainerBattleWon; if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_3FE) @@ -4777,7 +4777,7 @@ static void HandleEndTurn_BattleWon(void) } else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && !(gBattleTypeFlags & BATTLE_TYPE_LINK)) { - BattleMusicStop(); + BattleStopLowHpSound(); gBattlescriptCurrInstr = BattleScript_LocalTrainerBattleWon; switch (gTrainers[gTrainerBattleOpponent_A].trainerClass) diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 968f6d49f..cb2ca0a4c 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -449,7 +449,7 @@ static void sub_8064C58(void) { FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); - sub_805EEE0(gActiveBank); + EnemyShadowCallbackToSetInvisible(gActiveBank); SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); LinkOpponentBufferExecCompleted(); } @@ -485,7 +485,7 @@ static void sub_8064D60(void) if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) { if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); gBattleBankFunc[gActiveBank] = sub_8064DD0; } @@ -1164,7 +1164,7 @@ static void LinkOpponentHandleLoadMonSprite(void) gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, sub_80A5C6C(gActiveBank, 2), - sub_80A6138(gActiveBank), + GetBankSpriteDefault_Y(gActiveBank), sub_80A82E4(gActiveBank)); gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; @@ -1198,7 +1198,7 @@ static void sub_8066494(u8 bank, bool8 dontClearSubstituteBit) gBankSpriteIds[bank] = CreateSprite( &gUnknown_0202499C, sub_80A5C6C(bank, 2), - sub_80A6138(bank), + GetBankSpriteDefault_Y(bank), sub_80A82E4(bank)); gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; @@ -1227,7 +1227,7 @@ static void LinkOpponentHandleReturnMonToBall(void) { FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); - sub_805EEE0(gActiveBank); + EnemyShadowCallbackToSetInvisible(gActiveBank); SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); LinkOpponentBufferExecCompleted(); } @@ -1239,7 +1239,7 @@ static void DoSwitchOutAnimation(void) { case 0: if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; break; @@ -1247,7 +1247,7 @@ static void DoSwitchOutAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_OPPONENT_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_OPPONENT_MON); gBattleBankFunc[gActiveBank] = sub_8064C58; } break; @@ -1382,7 +1382,7 @@ static void LinkOpponentHandleFaintAnimation(void) if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) { if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; } else @@ -1455,7 +1455,7 @@ static void LinkOpponentDoMoveAnimation(void) && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) { gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); } gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; break; @@ -1474,7 +1474,7 @@ static void LinkOpponentDoMoveAnimation(void) sub_805EB9C(1); if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) { - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; } gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; @@ -1483,7 +1483,7 @@ static void LinkOpponentDoMoveAnimation(void) case 3: if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { - sub_805E394(); + CopyAllBattleSpritesInvisibilities(); TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; LinkOpponentBufferExecCompleted(); @@ -1586,7 +1586,7 @@ static void LinkOpponentHandleStatusAnimation(void) { if (!mplay_80342A4(gActiveBank)) { - DoStatusAnimation(gBattleBufferA[gActiveBank][1], + InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; } @@ -1698,7 +1698,7 @@ static void LinkOpponentHandlePlayFanfareOrBGM(void) { if (gBattleBufferA[gActiveBank][3]) { - BattleMusicStop(); + BattleStopLowHpSound(); PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); } else @@ -1850,7 +1850,7 @@ static void LinkOpponentHandleBattleAnimation(void) u8 animationId = gBattleBufferA[gActiveBank][1]; u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); - if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) LinkOpponentBufferExecCompleted(); else gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index 4a70a4dc1..79776c15d 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -312,7 +312,7 @@ static void CompleteOnHealthbarDone(void) } else { - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); LinkPartnerBufferExecCompleted(); } } @@ -373,7 +373,7 @@ static void sub_814B4E0(void) { CopyBattleSpriteInvisibility(gActiveBank); if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); gBattleBankFunc[gActiveBank] = sub_814B554; } @@ -399,7 +399,7 @@ static void sub_814B5A8(void) FreeSpritePaletteByTag(0x27F9); CreateTask(c3_0802FDF4, 10); - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 0); UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); sub_8076918(gActiveBank); @@ -1026,7 +1026,7 @@ static void SetLinkPartnerMonData(u8 monId) break; } - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); } static void LinkPartnerHandleSetRawMonData(void) @@ -1050,7 +1050,7 @@ static void LinkPartnerHandleLoadMonSprite(void) gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, sub_80A5C6C(gActiveBank, 2), - sub_80A6138(gActiveBank), + GetBankSpriteDefault_Y(gActiveBank), sub_80A82E4(gActiveBank)); gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank; @@ -1081,7 +1081,7 @@ static void sub_814CC98(u8 bank, bool8 dontClearSubstituteBit) gBankSpriteIds[bank] = CreateSprite( &gUnknown_0202499C, sub_80A5C6C(bank, 2), - sub_80A6138(bank), + GetBankSpriteDefault_Y(bank), sub_80A82E4(bank)); gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; @@ -1121,7 +1121,7 @@ static void DoSwitchOutAnimation(void) { case 0: if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; break; @@ -1129,7 +1129,7 @@ static void DoSwitchOutAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); gBattleBankFunc[gActiveBank] = sub_814B3DC; } break; @@ -1201,7 +1201,7 @@ static void LinkPartnerHandleFaintAnimation(void) if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) { if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; } else @@ -1209,7 +1209,7 @@ static void LinkPartnerHandleFaintAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER); gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; gSprites[gBankSpriteIds[gActiveBank]].data2 = 5; @@ -1277,7 +1277,7 @@ static void LinkPartnerDoMoveAnimation(void) && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) { gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); } gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; break; @@ -1296,7 +1296,7 @@ static void LinkPartnerDoMoveAnimation(void) sub_805EB9C(1); if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) { - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; } gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; @@ -1305,7 +1305,7 @@ static void LinkPartnerDoMoveAnimation(void) case 3: if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { - sub_805E394(); + CopyAllBattleSpritesInvisibilities(); TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; LinkPartnerBufferExecCompleted(); @@ -1408,7 +1408,7 @@ static void LinkPartnerHandleStatusAnimation(void) { if (!mplay_80342A4(gActiveBank)) { - DoStatusAnimation(gBattleBufferA[gActiveBank][1], + InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; } @@ -1520,7 +1520,7 @@ static void LinkPartnerHandlePlayFanfareOrBGM(void) { if (gBattleBufferA[gActiveBank][3]) { - BattleMusicStop(); + BattleStopLowHpSound(); PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); } else @@ -1683,7 +1683,7 @@ static void LinkPartnerHandleBattleAnimation(void) u8 animationId = gBattleBufferA[gActiveBank][1]; u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); - if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) LinkPartnerBufferExecCompleted(); else gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index 7ffd9d64b..831f434b0 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -437,7 +437,7 @@ static void sub_805FB08(void) { FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); - sub_805EEE0(gActiveBank); + EnemyShadowCallbackToSetInvisible(gActiveBank); SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); OpponentBufferExecCompleted(); } @@ -473,7 +473,7 @@ static void sub_805FC10(void) if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) { if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); gBattleBankFunc[gActiveBank] = sub_805FC80; } } @@ -1152,7 +1152,7 @@ static void OpponentHandleLoadMonSprite(void) gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, sub_80A5C6C(gActiveBank, 2), - sub_80A6138(gActiveBank), + GetBankSpriteDefault_Y(gActiveBank), sub_80A82E4(gActiveBank)); gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; @@ -1187,7 +1187,7 @@ static void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit) gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, sub_80A5C6C(bank, 2), - sub_80A6138(bank), + GetBankSpriteDefault_Y(bank), sub_80A82E4(bank)); gSprites[gBankSpriteIds[bank]].data0 = bank; @@ -1217,7 +1217,7 @@ static void OpponentHandleReturnMonToBall(void) { FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); - sub_805EEE0(gActiveBank); + EnemyShadowCallbackToSetInvisible(gActiveBank); SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); OpponentBufferExecCompleted(); } @@ -1229,7 +1229,7 @@ static void DoSwitchOutAnimation(void) { case 0: if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; break; @@ -1237,7 +1237,7 @@ static void DoSwitchOutAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_OPPONENT_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_OPPONENT_MON); gBattleBankFunc[gActiveBank] = sub_805FB08; } break; @@ -1415,7 +1415,7 @@ static void OpponentHandleFaintAnimation(void) if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) { if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; } else @@ -1487,7 +1487,7 @@ static void OpponentDoMoveAnimation(void) && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) { gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); } gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; break; @@ -1506,7 +1506,7 @@ static void OpponentDoMoveAnimation(void) sub_805EB9C(1); if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) { - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; } gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; @@ -1515,7 +1515,7 @@ static void OpponentDoMoveAnimation(void) case 3: if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { - sub_805E394(); + CopyAllBattleSpritesInvisibilities(); TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; OpponentBufferExecCompleted(); @@ -1731,7 +1731,7 @@ static void OpponentHandleStatusAnimation(void) { if (!mplay_80342A4(gActiveBank)) { - DoStatusAnimation(gBattleBufferA[gActiveBank][1], + InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; } @@ -1843,7 +1843,7 @@ static void OpponentHandlePlayFanfareOrBGM(void) { if (gBattleBufferA[gActiveBank][3]) { - BattleMusicStop(); + BattleStopLowHpSound(); PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); } else @@ -2000,7 +2000,7 @@ static void OpponentHandleBattleAnimation(void) u8 animationId = gBattleBufferA[gActiveBank][1]; u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); - if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) OpponentBufferExecCompleted(); else gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 10d361cb9..91d3d55eb 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -1008,10 +1008,10 @@ static void sub_805896C(void) FreeSpriteTilesByTag(0x27F9); FreeSpritePaletteByTag(0x27F9); - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); if (IsDoubleBattle()) - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], gActiveBank ^ BIT_MON); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], gActiveBank ^ BIT_MON); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3; gBattleBankFunc[gActiveBank] = sub_8058924; @@ -1107,7 +1107,7 @@ static void sub_8058EDC(void) FreeSpritePaletteByTag(0x27F9); if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); gBattleBankFunc[gActiveBank] = sub_8058FC0; } @@ -1119,7 +1119,7 @@ static void sub_8058FC0(void) && !IsCryPlayingOrClearCrySongs()) { m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); PlayerBufferExecCompleted(); } } @@ -1164,7 +1164,7 @@ static void CompleteOnHealthbarDone(void) } else { - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); PlayerBufferExecCompleted(); } } @@ -1305,7 +1305,7 @@ static void sub_8059544(u8 taskId) if (IsDoubleBattle() == TRUE && monIndex == gBattlePartyID[bank ^ BIT_MON]) bank ^= BIT_MON; - DoSpecialBattleAnimation(bank, bank, bank, B_ANIM_LVL_UP); + InitAndLaunchSpecialAnimation(bank, bank, bank, B_ANIM_LVL_UP); gTasks[taskId].func = sub_80595A4; } @@ -2193,7 +2193,7 @@ static void SetPlayerMonData(u8 monId) break; } - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); } static void PlayerHandleSetRawMonData(void) @@ -2238,7 +2238,7 @@ static void sub_805B258(u8 bank, bool8 dontClearSubstituteBit) gBankSpriteIds[bank] = CreateSprite( &gUnknown_0202499C, sub_80A5C6C(bank, 2), - sub_80A6138(bank), + GetBankSpriteDefault_Y(bank), sub_80A82E4(bank)); gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; @@ -2278,7 +2278,7 @@ static void DoSwitchOutAnimation(void) { case 0: if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; break; @@ -2286,7 +2286,7 @@ static void DoSwitchOutAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); gBattleBankFunc[gActiveBank] = sub_8059744; } break; @@ -2434,7 +2434,7 @@ static void PlayerHandleFaintAnimation(void) if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) { if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; } else @@ -2442,7 +2442,7 @@ static void PlayerHandleFaintAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER); gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; gSprites[gBankSpriteIds[gActiveBank]].data2 = 5; @@ -2462,7 +2462,7 @@ static void PlayerHandleSuccessBallThrowAnim(void) { gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; gDoingBattleAnim = TRUE; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_BALL_THROW); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_BALL_THROW); gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone; } @@ -2472,7 +2472,7 @@ static void PlayerHandleBallThrowAnim(void) gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; gDoingBattleAnim = TRUE; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_BALL_THROW); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_BALL_THROW); gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone; } @@ -2525,7 +2525,7 @@ static void PlayerDoMoveAnimation(void) && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) { gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); } gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; break; @@ -2544,7 +2544,7 @@ static void PlayerDoMoveAnimation(void) sub_805EB9C(1); if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) { - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; } gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; @@ -2553,7 +2553,7 @@ static void PlayerDoMoveAnimation(void) case 3: if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { - sub_805E394(); + CopyAllBattleSpritesInvisibilities(); TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; PlayerBufferExecCompleted(); @@ -2709,7 +2709,7 @@ static void PlayerHandleChoosePokemon(void) static void PlayerHandleCmd23(void) { - BattleMusicStop(); + BattleStopLowHpSound(); BeginNormalPaletteFade(-1, 2, 0, 16, 0); PlayerBufferExecCompleted(); } @@ -2788,7 +2788,7 @@ static void PlayerHandleStatusAnimation(void) { if (!mplay_80342A4(gActiveBank)) { - DoStatusAnimation(gBattleBufferA[gActiveBank][1], + InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; } @@ -2930,7 +2930,7 @@ static void PlayerHandlePlayFanfareOrBGM(void) { if (gBattleBufferA[gActiveBank][3]) { - BattleMusicStop(); + BattleStopLowHpSound(); PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); } else @@ -3088,7 +3088,7 @@ static void PlayerHandleBattleAnimation(void) u8 animationId = gBattleBufferA[gActiveBank][1]; u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); - if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) PlayerBufferExecCompleted(); else gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index 34fd8a3eb..6ace9121c 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -327,7 +327,7 @@ static void CompleteOnHealthbarDone(void) } else { - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); PlayerPartnerBufferExecCompleted(); } } @@ -469,7 +469,7 @@ static void sub_81BB628(u8 taskId) if (IsDoubleBattle() == TRUE && monIndex == gBattlePartyID[bank ^ BIT_MON]) bank ^= BIT_MON; - DoSpecialBattleAnimation(bank, bank, bank, B_ANIM_LVL_UP); + InitAndLaunchSpecialAnimation(bank, bank, bank, B_ANIM_LVL_UP); gTasks[taskId].func = sub_81BB688; } @@ -560,7 +560,7 @@ static void sub_81BB92C(void) { CopyBattleSpriteInvisibility(gActiveBank); if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); gBattleBankFunc[gActiveBank] = sub_81BB9A0; } @@ -586,7 +586,7 @@ static void sub_81BB9F4(void) FreeSpritePaletteByTag(0x27F9); CreateTask(c3_0802FDF4, 10); - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 0); UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); sub_8076918(gActiveBank); @@ -1213,7 +1213,7 @@ static void SetPlayerPartnerMonData(u8 monId) break; } - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); } static void PlayerPartnerHandleSetRawMonData(void) @@ -1237,7 +1237,7 @@ static void PlayerPartnerHandleLoadMonSprite(void) gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, sub_80A5C6C(gActiveBank, 2), - sub_80A6138(gActiveBank), + GetBankSpriteDefault_Y(gActiveBank), sub_80A82E4(gActiveBank)); gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank; @@ -1268,7 +1268,7 @@ static void sub_81BD0E4(u8 bank, bool8 dontClearSubstituteBit) gBankSpriteIds[bank] = CreateSprite( &gUnknown_0202499C, sub_80A5C6C(bank, 2), - sub_80A6138(bank), + GetBankSpriteDefault_Y(bank), sub_80A82E4(bank)); gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; @@ -1308,7 +1308,7 @@ static void DoSwitchOutAnimation(void) { case 0: if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; break; @@ -1316,7 +1316,7 @@ static void DoSwitchOutAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); gBattleBankFunc[gActiveBank] = sub_81BB828; } break; @@ -1395,7 +1395,7 @@ static void PlayerPartnerHandleFaintAnimation(void) if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) { if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; } else @@ -1403,7 +1403,7 @@ static void PlayerPartnerHandleFaintAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER); gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; gSprites[gBankSpriteIds[gActiveBank]].data2 = 5; @@ -1470,7 +1470,7 @@ static void PlayerPartnerDoMoveAnimation(void) && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) { gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); } gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; break; @@ -1489,7 +1489,7 @@ static void PlayerPartnerDoMoveAnimation(void) sub_805EB9C(1); if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) { - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; } gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; @@ -1498,7 +1498,7 @@ static void PlayerPartnerDoMoveAnimation(void) case 3: if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { - sub_805E394(); + CopyAllBattleSpritesInvisibilities(); TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; PlayerPartnerBufferExecCompleted(); @@ -1661,7 +1661,7 @@ static void PlayerPartnerHandleStatusAnimation(void) { if (!mplay_80342A4(gActiveBank)) { - DoStatusAnimation(gBattleBufferA[gActiveBank][1], + InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; } @@ -1773,7 +1773,7 @@ static void PlayerPartnerHandlePlayFanfareOrBGM(void) { if (gBattleBufferA[gActiveBank][3]) { - BattleMusicStop(); + BattleStopLowHpSound(); PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); } else @@ -1929,7 +1929,7 @@ static void PlayerPartnerHandleBattleAnimation(void) u8 animationId = gBattleBufferA[gActiveBank][1]; u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); - if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) PlayerPartnerBufferExecCompleted(); else gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 0dc7631ce..914ad9c43 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -433,7 +433,7 @@ static void sub_8186D9C(void) { FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); - sub_805EEE0(gActiveBank); + EnemyShadowCallbackToSetInvisible(gActiveBank); SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); RecordedOpponentBufferExecCompleted(); } @@ -469,7 +469,7 @@ static void sub_8186EA4(void) if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) { if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); gBattleBankFunc[gActiveBank] = sub_8186F14; } @@ -1149,7 +1149,7 @@ static void RecordedOpponentHandleLoadMonSprite(void) gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, sub_80A5C6C(gActiveBank, 2), - sub_80A6138(gActiveBank), + GetBankSpriteDefault_Y(gActiveBank), sub_80A82E4(gActiveBank)); @@ -1184,7 +1184,7 @@ static void sub_81885D8(u8 bank, bool8 dontClearSubstituteBit) gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, sub_80A5C6C(bank, 2), - sub_80A6138(bank), + GetBankSpriteDefault_Y(bank), sub_80A82E4(bank)); gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; @@ -1213,7 +1213,7 @@ static void RecordedOpponentHandleReturnMonToBall(void) { FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); - sub_805EEE0(gActiveBank); + EnemyShadowCallbackToSetInvisible(gActiveBank); SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); RecordedOpponentBufferExecCompleted(); } @@ -1225,7 +1225,7 @@ static void DoSwitchOutAnimation(void) { case 0: if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; break; @@ -1233,7 +1233,7 @@ static void DoSwitchOutAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_OPPONENT_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_OPPONENT_MON); gBattleBankFunc[gActiveBank] = sub_8186D9C; } break; @@ -1314,7 +1314,7 @@ static void RecordedOpponentHandleFaintAnimation(void) if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) { if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; } else @@ -1386,7 +1386,7 @@ static void RecordedOpponentDoMoveAnimation(void) && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) { gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); } gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; break; @@ -1405,7 +1405,7 @@ static void RecordedOpponentDoMoveAnimation(void) sub_805EB9C(1); if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) { - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; } gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; @@ -1414,7 +1414,7 @@ static void RecordedOpponentDoMoveAnimation(void) case 3: if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { - sub_805E394(); + CopyAllBattleSpritesInvisibilities(); TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; RecordedOpponentBufferExecCompleted(); @@ -1530,7 +1530,7 @@ static void RecordedOpponentHandleStatusAnimation(void) { if (!mplay_80342A4(gActiveBank)) { - DoStatusAnimation(gBattleBufferA[gActiveBank][1], + InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; } @@ -1642,7 +1642,7 @@ static void RecordedOpponentHandlePlayFanfareOrBGM(void) { if (gBattleBufferA[gActiveBank][3]) { - BattleMusicStop(); + BattleStopLowHpSound(); PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); } else @@ -1794,7 +1794,7 @@ static void RecordedOpponentHandleBattleAnimation(void) u8 animationId = gBattleBufferA[gActiveBank][1]; u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); - if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) RecordedOpponentBufferExecCompleted(); else gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index a3343a391..8db7b5626 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -272,9 +272,9 @@ static void sub_8189AA0(void) FreeSpriteTilesByTag(0x27F9); FreeSpritePaletteByTag(0x27F9); - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); if (IsDoubleBattle()) - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], gActiveBank ^ BIT_MON); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], gActiveBank ^ BIT_MON); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3; gBattleBankFunc[gActiveBank] = sub_8189A58; @@ -397,7 +397,7 @@ static void CompleteOnHealthbarDone(void) } else { - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); RecordedPlayerBufferExecCompleted(); } } @@ -458,7 +458,7 @@ static void sub_818A2B4(void) { CopyBattleSpriteInvisibility(gActiveBank); if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); gBattleBankFunc[gActiveBank] = sub_818A328; } @@ -484,7 +484,7 @@ static void sub_818A37C(void) FreeSpritePaletteByTag(0x27F9); CreateTask(c3_0802FDF4, 10); - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 0); UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); sub_8076918(gActiveBank); @@ -1111,7 +1111,7 @@ static void SetRecordedPlayerMonData(u8 monId) break; } - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); } static void RecordedPlayerHandleSetRawMonData(void) @@ -1135,7 +1135,7 @@ static void RecordedPlayerHandleLoadMonSprite(void) gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, sub_80A5C6C(gActiveBank, 2), - sub_80A6138(gActiveBank), + GetBankSpriteDefault_Y(gActiveBank), sub_80A82E4(gActiveBank)); gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank; @@ -1166,7 +1166,7 @@ static void sub_818BA6C(u8 bank, bool8 dontClearSubstituteBit) gBankSpriteIds[bank] = CreateSprite( &gUnknown_0202499C, sub_80A5C6C(bank, 2), - sub_80A6138(bank), + GetBankSpriteDefault_Y(bank), sub_80A82E4(bank)); gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; @@ -1206,7 +1206,7 @@ static void DoSwitchOutAnimation(void) { case 0: if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; break; @@ -1214,7 +1214,7 @@ static void DoSwitchOutAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); gBattleBankFunc[gActiveBank] = sub_818A1B0; } break; @@ -1313,7 +1313,7 @@ static void RecordedPlayerHandleFaintAnimation(void) if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) { if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; } else @@ -1321,7 +1321,7 @@ static void RecordedPlayerHandleFaintAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); PlaySE12WithPanning(SE_POKE_DEAD, -64); gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; gSprites[gBankSpriteIds[gActiveBank]].data2 = 5; @@ -1388,7 +1388,7 @@ static void RecordedPlayerDoMoveAnimation(void) && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) { gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); } gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; break; @@ -1407,7 +1407,7 @@ static void RecordedPlayerDoMoveAnimation(void) sub_805EB9C(1); if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) { - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; } gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; @@ -1416,7 +1416,7 @@ static void RecordedPlayerDoMoveAnimation(void) case 3: if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { - sub_805E394(); + CopyAllBattleSpritesInvisibilities(); TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; RecordedPlayerBufferExecCompleted(); @@ -1549,7 +1549,7 @@ static void RecordedPlayerHandleStatusAnimation(void) { if (!mplay_80342A4(gActiveBank)) { - DoStatusAnimation(gBattleBufferA[gActiveBank][1], + InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; } @@ -1661,7 +1661,7 @@ static void RecordedPlayerHandlePlayFanfareOrBGM(void) { if (gBattleBufferA[gActiveBank][3]) { - BattleMusicStop(); + BattleStopLowHpSound(); PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); } else @@ -1813,7 +1813,7 @@ static void RecordedPlayerHandleBattleAnimation(void) u8 animationId = gBattleBufferA[gActiveBank][1]; u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); - if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) RecordedPlayerBufferExecCompleted(); else gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index 0c5b698cf..468a92610 100644 --- a/src/battle_controller_safari.c +++ b/src/battle_controller_safari.c @@ -413,7 +413,7 @@ 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); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone; } @@ -423,7 +423,7 @@ static void SafariHandleBallThrowAnim(void) gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; gDoingBattleAnim = TRUE; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone; } @@ -624,7 +624,7 @@ static void SafariHandlePlayFanfareOrBGM(void) { if (gBattleBufferA[gActiveBank][3]) { - BattleMusicStop(); + BattleStopLowHpSound(); PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); } else @@ -683,7 +683,7 @@ 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)) + if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) SafariBufferExecCompleted(); else gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index c2addd30c..ec052555a 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -369,7 +369,7 @@ static void sub_8168818(void) FreeSpritePaletteByTag(0x27F9); CreateTask(c3_0802FDF4, 10); - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); WallyBufferExecCompleted(); } @@ -387,7 +387,7 @@ static void CompleteOnHealthbarDone(void) } else { - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); WallyBufferExecCompleted(); } } @@ -1029,7 +1029,7 @@ static void SetWallyMonData(u8 monId) break; } - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); } static void WallyHandleSetRawMonData(void) @@ -1051,7 +1051,7 @@ static void WallyHandleReturnMonToBall(void) { if (gBattleBufferA[gActiveBank][1] == 0) { - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); gBattleBankFunc[gActiveBank] = sub_8168A20; } else @@ -1112,7 +1112,7 @@ static void WallyHandleSuccessBallThrowAnim(void) { gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; gDoingBattleAnim = TRUE; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); gBattleBankFunc[gActiveBank] = CompleteOnFinishedAnimation; } @@ -1122,7 +1122,7 @@ static void WallyHandleBallThrowAnim(void) gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; gDoingBattleAnim = TRUE; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); gBattleBankFunc[gActiveBank] = CompleteOnFinishedAnimation; } @@ -1163,7 +1163,7 @@ static void WallyDoMoveAnimation(void) case 0: if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) { - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); } gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; break; @@ -1182,7 +1182,7 @@ static void WallyDoMoveAnimation(void) sub_805EB9C(1); if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) { - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); } gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; } @@ -1190,7 +1190,7 @@ static void WallyDoMoveAnimation(void) case 3: if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { - sub_805E394(); + CopyAllBattleSpritesInvisibilities(); TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; WallyBufferExecCompleted(); @@ -1429,7 +1429,7 @@ static void WallyHandlePlayFanfareOrBGM(void) { if (gBattleBufferA[gActiveBank][3]) { - BattleMusicStop(); + BattleStopLowHpSound(); PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); } else @@ -1496,7 +1496,7 @@ static void sub_816AA80(u8 bank) sub_806A068(species, GetBankIdentity(bank)); gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, sub_80A5C6C(bank, 2), - sub_80A6138(bank), + GetBankSpriteDefault_Y(bank), sub_80A82E4(bank)); gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; @@ -1565,7 +1565,7 @@ static void WallyHandleBattleAnimation(void) u8 animationId = gBattleBufferA[gActiveBank][1]; u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); - if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) WallyBufferExecCompleted(); else gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; diff --git a/src/battle_dome_cards.c b/src/battle_dome_cards.c index e6c67b20e..9385417b4 100644 --- a/src/battle_dome_cards.c +++ b/src/battle_dome_cards.c @@ -119,7 +119,7 @@ static void sub_818D0C4(u16 species, u32 otId, u32 personality, u8 paletteSlot, if (paletteTag == 0xFFFF) { gUnknown_0203CCEC.paletteTag |= 0xFFFF; - LoadCompressedPalette(species_and_otid_get_pal(species, otId, personality), 0x100 + paletteSlot * 0x10, 0x20); + LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality), 0x100 + paletteSlot * 0x10, 0x20); } else { @@ -146,7 +146,7 @@ static void sub_818D180(u16 species, u32 otId, u32 personality, u8 paletteSlot, { if (!isTrainer) { - LoadCompressedPalette(species_and_otid_get_pal(species, otId, personality), paletteSlot * 0x10, 0x20); + LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality), paletteSlot * 0x10, 0x20); } else { diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c new file mode 100644 index 000000000..99a82f3ca --- /dev/null +++ b/src/battle_gfx_sfx_util.c @@ -0,0 +1,1299 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_ai_script_commands.h" +#include "battle_anim.h" +#include "battle_interface.h" +#include "main.h" +#include "malloc.h" +#include "rng.h" +#include "util.h" +#include "pokemon.h" +#include "moves.h" +#include "task.h" +#include "sprite.h" +#include "sound.h" +#include "m4a.h" +#include "species.h" +#include "decompress.h" +#include "data2.h" +#include "palette.h" +#include "blend_palette.h" +#include "contest.h" +#include "songs.h" + +extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200]; +extern u8 gActiveBank; +extern u8 gNoOfAllBanks; +extern u16 gUnknown_020243FC; +extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; +extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern u8 gBanksByIdentity[BATTLE_BANKS_COUNT]; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern struct MusicPlayerInfo gMPlay_SE1; +extern struct MusicPlayerInfo gMPlay_SE2; +extern struct MusicPlayerInfo gMPlay_BGM; + +extern const struct BattleMove gBattleMoves[]; +extern const u8 gUnknown_0831C604[]; +extern const u8 * const gUnknown_082C9320[]; +extern const u8 * const gUnknown_082C937C[]; +extern const struct CompressedSpriteSheet gMonFrontPicTable[]; +extern const struct CompressedSpriteSheet gMonBackPicTable[]; +extern const struct CompressedSpriteSheet gTrainerFrontPicTable[]; +extern const struct CompressedSpriteSheet gTrainerBackPicTable[]; +extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; +extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; +extern const union AnimCmd* const * const gMonAnimationsSpriteAnimsPtrTable[]; +extern const struct SpriteTemplate gUnknown_08329D98[4]; +extern const struct CompressedSpriteSheet gSpriteSheet_EnemyShadow; +extern const struct SpriteTemplate gSpriteTemplate_EnemyShadow; +extern const u8 gEnemyMonElevation[]; + +// graphics +extern const u32 gUnknown_08C093F0[]; +extern const u32 gSubstituteDollTilemap[]; +extern const u32 gSubstituteDollGfx[]; +extern const u16 gSubstituteDollPal[]; +extern const u8 gUnknown_08C1F1C8[]; +extern const u8 gUnknown_08C1F46C[]; +extern const u8 gUnknown_08C1F5E8[]; +extern const u8 gUnknown_08C1F76C[]; +extern const u8 gUnknown_08C1F8E8[]; +extern const u8 gUnknown_08C0237C[]; +extern const u16 gBattleInterface_BallStatusBarPal[]; +extern const u16 gBattleInterface_BallDisplayPal[]; + +extern u8 sub_80688F8(u8, u8 bank); +extern u8 pokemon_order_func(u8); // party menu +extern void sub_81B8C68(void); + +// this file's functions +static u8 sub_805D4A8(u16 move); +static u16 BattlePalaceGetTargetRetValue(void); +static void sub_805D7EC(struct Sprite *sprite); +static bool8 ShouldAnimBeDoneRegardlessOfSubsitute(u8 animId); +static void Task_ClearBitWhenBattleTableAnimDone(u8 taskId); +static void Task_ClearBitWhenSpecialAnimDone(u8 taskId); +static void ClearSpritesBankHealthboxAnimData(void); + +// const rom data +static const struct CompressedSpriteSheet gUnknown_0832C0D0 = +{ + gUnknown_08C1F1C8, 0x1000, TAG_HEALTHBOX_PLAYER1_TILE +}; + +static const struct CompressedSpriteSheet gUnknown_0832C0D8 = +{ + gUnknown_08C1F46C, 0x1000, TAG_HEALTHBOX_OPPONENT1_TILE +}; + +static const struct CompressedSpriteSheet gUnknown_0832C0E0[2] = +{ + {gUnknown_08C1F5E8, 0x800, TAG_HEALTHBOX_PLAYER1_TILE}, + {gUnknown_08C1F5E8, 0x800, TAG_HEALTHBOX_PLAYER2_TILE} +}; + +static const struct CompressedSpriteSheet gUnknown_0832C0F0[2] = +{ + {gUnknown_08C1F76C, 0x800, TAG_HEALTHBOX_OPPONENT1_TILE}, + {gUnknown_08C1F76C, 0x800, TAG_HEALTHBOX_OPPONENT2_TILE} +}; + +static const struct CompressedSpriteSheet gUnknown_0832C100 = +{ + gUnknown_08C1F8E8, 0x1000, TAG_HEALTHBOX_SAFARI_TILE +}; + +static const struct CompressedSpriteSheet gUnknown_0832C108[BATTLE_BANKS_COUNT] = +{ + {gUnknown_08C0237C, 0x0100, 0xd704}, + {gUnknown_08C0237C, 0x0120, 0xd705}, + {gUnknown_08C0237C, 0x0100, 0xd706}, + {gUnknown_08C0237C, 0x0120, 0xd707} +}; + +static const struct SpritePalette gUnknown_0832C128[2] = +{ + {gBattleInterface_BallStatusBarPal, TAG_HEALTHBOX_PAL}, + {gBattleInterface_BallDisplayPal, 0xd704} +}; + +// code +void AllocateBattleSpritesData(void) +{ + gBattleSpritesDataPtr = AllocZeroed(sizeof(struct BattleSpriteData)); + gBattleSpritesDataPtr->bankData = AllocZeroed(sizeof(struct BattleSpriteInfo) * BATTLE_BANKS_COUNT); + gBattleSpritesDataPtr->healthBoxesData = AllocZeroed(sizeof(struct BattleHealthboxInfo) * BATTLE_BANKS_COUNT); + gBattleSpritesDataPtr->animationData = AllocZeroed(sizeof(struct BattleAnimationInfo)); + gBattleSpritesDataPtr->battleBars = AllocZeroed(sizeof(struct BattleBarInfo) * BATTLE_BANKS_COUNT); +} + +void FreeBattleSpritesData(void) +{ + if (gBattleSpritesDataPtr == NULL) + return; + + FREE_AND_SET_NULL(gBattleSpritesDataPtr->battleBars); + FREE_AND_SET_NULL(gBattleSpritesDataPtr->animationData); + FREE_AND_SET_NULL(gBattleSpritesDataPtr->healthBoxesData); + FREE_AND_SET_NULL(gBattleSpritesDataPtr->bankData); + FREE_AND_SET_NULL(gBattleSpritesDataPtr); +} + +u16 ChooseMoveAndTargetInBattlePalace(void) +{ + s32 i, var1, var2; + s32 chosenMoveId = -1; + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); + u8 unusableMovesBits = CheckMoveLimitations(gActiveBank, 0, 0xFF); + s32 percent = Random() % 100; + + i = (gBattleStruct->field_92 & gBitTable[gActiveBank]) ? 2 : 0; + var2 = i; + var1 = i + 2; + + for (; i < var1; i++) + { + if (gUnknown_0831C494[GetNatureFromPersonality(gBattleMons[gActiveBank].personality)][i] > percent) + break; + } + + percent = i - var2; + if (i == var1) + percent = 2; + + for (var2 = 0, i = 0; i < 4; i++) + { + if (moveInfo->moves[i] == MOVE_NONE) + break; + if (percent == sub_805D4A8(moveInfo->moves[i]) && moveInfo->currentPp[i] != 0) + var2 |= gBitTable[i]; + } + + if (var2 != 0) + { + gBattleStruct->field_92 &= 0xF; + gBattleStruct->field_92 |= (var2 << 4); + BattleAI_SetupAIData(var2); + chosenMoveId = BattleAI_ChooseMoveOrAction(); + } + + if (chosenMoveId == -1) + { + if (unusableMovesBits != 0xF) + { + var1 = 0, var2 = 0; + + for (i = 0; i < 4; i++) + { + if (sub_805D4A8(moveInfo->moves[i]) == 0 && !(gBitTable[i] & unusableMovesBits)) + var1 += 0x1; + if (sub_805D4A8(moveInfo->moves[i]) == 1 && !(gBitTable[i] & unusableMovesBits)) + var1 += 0x10; + if (sub_805D4A8(moveInfo->moves[i]) == 2 && !(gBitTable[i] & unusableMovesBits)) + var1 += 0x100; + } + + if ((var1 & 0xF) > 1) + var2++; + if ((var1 & 0xF0) > 0x1F) + var2++; + if ((var1 & 0xF0) > 0x1FF) + var2++; + + if (var2 > 1 || var2 == 0) + { + do + { + i = Random() % 4; + if (!(gBitTable[i] & unusableMovesBits)) + chosenMoveId = i; + } while (chosenMoveId == -1); + } + else + { + if ((var1 & 0xF) > 1) + var2 = 0; + if ((var1 & 0xF0) > 0x1F) + var2 = 1; + if ((var1 & 0xF0) > 0x1FF) + var2 = 2; + + do + { + i = Random() % 4; + if (!(gBitTable[i] & unusableMovesBits) && var2 == sub_805D4A8(moveInfo->moves[i])) + chosenMoveId = i; + } while (chosenMoveId == -1); + } + + if (Random() % 100 > 49) + { + gProtectStructs[gActiveBank].flag_x10 = 1; + return 0; + } + } + else + { + gProtectStructs[gActiveBank].flag_x10 = 1; + return 0; + } + } + + if (moveInfo->moves[chosenMoveId] == MOVE_CURSE) + { + if (moveInfo->monType1 != TYPE_GHOST && moveInfo->monType2 != TYPE_GHOST) + var1 = MOVE_TARGET_x10; + else + var1 = MOVE_TARGET_SELECTED; + } + else + { + var1 = gBattleMoves[moveInfo->moves[chosenMoveId]].target; + } + + if (var1 & MOVE_TARGET_x10) + chosenMoveId |= (gActiveBank << 8); + else if (var1 == MOVE_TARGET_SELECTED) + chosenMoveId |= (BattlePalaceGetTargetRetValue()); + else + chosenMoveId |= (GetBankByIdentity((GetBankIdentity(gActiveBank) & BIT_SIDE) ^ BIT_SIDE) << 8); + + return chosenMoveId; +} + +static u8 sub_805D4A8(u16 move) +{ + switch (gBattleMoves[move].target) + { + case MOVE_TARGET_SELECTED: + case MOVE_TARGET_USER: + case MOVE_TARGET_RANDOM: + case MOVE_TARGET_BOTH: + case MOVE_TARGET_FOES_AND_ALLY: + if (gBattleMoves[move].power == 0) + return 2; + else + return 0; + break; + case MOVE_TARGET_DEPENDS: + case MOVE_TARGET_OPPONENTS_FIELD: + return 2; + case MOVE_TARGET_x10: + return 1; + default: + return 0; + } +} + +static u16 BattlePalaceGetTargetRetValue(void) +{ + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) + { + u8 opposing1, opposing2; + + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + { + opposing1 = GetBankByIdentity(IDENTITY_OPPONENT_MON1); + opposing2 = GetBankByIdentity(IDENTITY_OPPONENT_MON2); + } + else + { + opposing1 = GetBankByIdentity(IDENTITY_PLAYER_MON1); + opposing2 = GetBankByIdentity(IDENTITY_PLAYER_MON2); + } + + if (gBattleMons[opposing1].hp == gBattleMons[opposing2].hp) + return (((gActiveBank & BIT_SIDE) ^ BIT_SIDE) + (Random() & 2)) << 8; + + switch (gUnknown_0831C604[GetNatureFromPersonality(gBattleMons[gActiveBank].personality)]) + { + case 0: + if (gBattleMons[opposing1].hp > gBattleMons[opposing2].hp) + return opposing1 << 8; + else + return opposing2 << 8; + case 1: + if (gBattleMons[opposing1].hp < gBattleMons[opposing2].hp) + return opposing1 << 8; + else + return opposing2 << 8; + case 2: + return (((gActiveBank & BIT_SIDE) ^ BIT_SIDE) + (Random() & 2)) << 8; + } + } + + return (gActiveBank ^ BIT_SIDE) << 8; +} + +void sub_805D714(struct Sprite *sprite) +{ + u8 spriteId = sprite->data1; + + if (!gSprites[spriteId].affineAnimEnded) + return; + if (gSprites[spriteId].invisible) + return; + + if (gSprites[spriteId].animPaused) + { + gSprites[spriteId].animPaused = 0; + } + else + { + if (gSprites[spriteId].animEnded) + sprite->callback = SpriteCallbackDummy; + } +} + +void sub_805D770(struct Sprite *sprite, bool8 arg1) +{ + sprite->animPaused = 1; + sprite->callback = SpriteCallbackDummy; + + if (!arg1) + StartSpriteAffineAnim(sprite, 1); + else + StartSpriteAffineAnim(sprite, 1); + + AnimateSprite(sprite); +} + +void sub_805D7AC(struct Sprite *sprite) +{ + if (!(gUnknown_020243FC & 1)) + { + sprite->pos2.x += sprite->data0; + if (sprite->pos2.x == 0) + { + if (sprite->pos2.y != 0) + sprite->callback = sub_805D7EC; + else + sprite->callback = SpriteCallbackDummy; + } + } +} + +static void sub_805D7EC(struct Sprite *sprite) +{ + sprite->pos2.y -= 2; + if (sprite->pos2.y == 0) + sprite->callback = SpriteCallbackDummy; +} + +void InitAndLaunchChosenStatusAnimation(bool8 isStatus2, u32 status) +{ + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive = 1; + if (!isStatus2) + { + if (status == STATUS_FREEZE) + LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_FRZ); + else if (status == STATUS_POISON || status & STATUS_TOXIC_POISON) + LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_PSN); + else if (status == STATUS_BURN) + LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_BRN); + else if (status & STATUS_SLEEP) + LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_SLP); + else if (status == STATUS_PARALYSIS) + LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_PRZ); + else // no animation + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive = 0; + } + else + { + if (status & STATUS2_INFATUATION) + LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_INFATUATION); + else if (status & STATUS2_CONFUSION) + LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_CONFUSION); + else if (status & STATUS2_CURSED) + LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_CURSED); + else if (status & STATUS2_NIGHTMARE) + LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_NIGHTMARE); + else if (status & STATUS2_WRAPPED) + LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_WRAPPED); + else // no animation + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive = 0; + } +} + +#define tBank data[0] + +bool8 TryHandleLaunchBattleTableAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId, u16 argument) +{ + u8 taskId; + + if (tableId == B_ANIM_CASTFORM_CHANGE && (argument & 0x80)) + { + gBattleMonForms[activeBank] = (argument & ~(0x80)); + return TRUE; + } + if (gBattleSpritesDataPtr->bankData[activeBank].behindSubstitute + && !ShouldAnimBeDoneRegardlessOfSubsitute(tableId)) + { + return TRUE; + } + if (gBattleSpritesDataPtr->bankData[activeBank].behindSubstitute + && tableId == B_ANIM_SUBSTITUTE_FADE + && gSprites[gBankSpriteIds[activeBank]].invisible) + { + LoadBattleMonGfxAndAnimate(activeBank, TRUE, gBankSpriteIds[activeBank]); + ClearBehindSubstituteBit(activeBank); + return TRUE; + } + + gAnimBankAttacker = atkBank; + gAnimBankTarget = defBank; + gBattleSpritesDataPtr->animationData->animArg = argument; + LaunchBattleAnimation(gUnknown_082C9320, tableId, FALSE); + taskId = CreateTask(Task_ClearBitWhenBattleTableAnimDone, 10); + gTasks[taskId].tBank = activeBank; + gBattleSpritesDataPtr->healthBoxesData[gTasks[taskId].tBank].animFromTableActive = 1; + + return FALSE; +} + +static void Task_ClearBitWhenBattleTableAnimDone(u8 taskId) +{ + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + gBattleSpritesDataPtr->healthBoxesData[gTasks[taskId].tBank].animFromTableActive = 0; + DestroyTask(taskId); + } +} + +#undef tBank + +static bool8 ShouldAnimBeDoneRegardlessOfSubsitute(u8 animId) +{ + switch (animId) + { + case B_ANIM_SUBSTITUTE_FADE: + case B_ANIM_RAIN_CONTINUES: + case B_ANIM_SUN_CONTINUES: + case B_ANIM_SANDSTORM_CONTINUES: + case B_ANIM_HAIL_CONTINUES: + case B_ANIM_SNATCH_MOVE: + return TRUE; + default: + return FALSE; + } +} + +#define tBank data[0] + +void InitAndLaunchSpecialAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId) +{ + u8 taskId; + + gAnimBankAttacker = atkBank; + gAnimBankTarget = defBank; + LaunchBattleAnimation(gUnknown_082C937C, tableId, FALSE); + taskId = CreateTask(Task_ClearBitWhenSpecialAnimDone, 10); + gTasks[taskId].tBank = activeBank; + gBattleSpritesDataPtr->healthBoxesData[gTasks[taskId].tBank].specialAnimActive = 1; +} + +static void Task_ClearBitWhenSpecialAnimDone(u8 taskId) +{ + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + gBattleSpritesDataPtr->healthBoxesData[gTasks[taskId].tBank].specialAnimActive = 0; + DestroyTask(taskId); + } +} + +#undef tBank + +// great function to include newly added moves that don't have animation yet +bool8 IsMoveWithoutAnimation(u16 moveId, u8 animationTurn) +{ + return FALSE; +} + +bool8 mplay_80342A4(u8 bank) +{ + u8 zero = 0; + + if (IsSEPlaying()) + { + gBattleSpritesDataPtr->healthBoxesData[bank].field_8++; + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_8 < 30) + return TRUE; + + m4aMPlayStop(&gMPlay_SE1); + m4aMPlayStop(&gMPlay_SE2); + } + if (zero == 0) + { + gBattleSpritesDataPtr->healthBoxesData[bank].field_8 = 0; + return FALSE; + } + + return TRUE; +} + +void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 bank) +{ + u32 monsPersonality, currentPersonality, otId; + u16 species; + u8 identity; + u16 paletteOffset; + const void *lzPaletteData; + + monsPersonality = GetMonData(mon, MON_DATA_PERSONALITY); + + if (gBattleSpritesDataPtr->bankData[bank].transformSpecies == SPECIES_NONE) + { + species = GetMonData(mon, MON_DATA_SPECIES); + currentPersonality = monsPersonality; + } + else + { + species = gBattleSpritesDataPtr->bankData[bank].transformSpecies; + currentPersonality = gTransformedPersonalities[bank]; + } + + otId = GetMonData(mon, MON_DATA_OT_ID); + identity = GetBankIdentity(bank); + HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species], + gMonSpritesGfxPtr->sprites[identity], + species, currentPersonality); + + paletteOffset = 0x100 + bank * 16; + + if (gBattleSpritesDataPtr->bankData[bank].transformSpecies == SPECIES_NONE) + lzPaletteData = GetMonFrontSpritePal(mon); + else + lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(species, otId, monsPersonality); + + LZDecompressWram(lzPaletteData, gDecompressionBuffer); + LoadPalette(gDecompressionBuffer, paletteOffset, 0x20); + LoadPalette(gDecompressionBuffer, 0x80 + bank * 16, 0x20); + + if (species == SPECIES_CASTFORM) + { + paletteOffset = 0x100 + bank * 16; + LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[0]); + LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[bank]], paletteOffset, 0x20); + } + + // transform's pink color + if (gBattleSpritesDataPtr->bankData[bank].transformSpecies != SPECIES_NONE) + { + BlendPalette(paletteOffset, 16, 6, 0x7FFF); + CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32); + } +} + +void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 bank) +{ + u32 monsPersonality, currentPersonality, otId; + u16 species; + u8 identity; + u16 paletteOffset; + const void *lzPaletteData; + + monsPersonality = GetMonData(mon, MON_DATA_PERSONALITY); + + if (gBattleSpritesDataPtr->bankData[bank].transformSpecies == SPECIES_NONE) + { + species = GetMonData(mon, MON_DATA_SPECIES); + currentPersonality = monsPersonality; + } + else + { + species = gBattleSpritesDataPtr->bankData[bank].transformSpecies; + currentPersonality = gTransformedPersonalities[bank]; + } + + otId = GetMonData(mon, MON_DATA_OT_ID); + identity = GetBankIdentity(bank); + + if (sub_80688F8(1, bank) == 1 || gBattleSpritesDataPtr->bankData[bank].transformSpecies != SPECIES_NONE) + { + HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[species], + gMonSpritesGfxPtr->sprites[identity], + species, currentPersonality); + } + else + { + HandleLoadSpecialPokePic(&gMonBackPicTable[species], + gMonSpritesGfxPtr->sprites[identity], + species, currentPersonality); + } + + paletteOffset = 0x100 + bank * 16; + + if (gBattleSpritesDataPtr->bankData[bank].transformSpecies == SPECIES_NONE) + lzPaletteData = GetMonFrontSpritePal(mon); + else + lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(species, otId, monsPersonality); + + LZDecompressWram(lzPaletteData, gDecompressionBuffer); + LoadPalette(gDecompressionBuffer, paletteOffset, 0x20); + LoadPalette(gDecompressionBuffer, 0x80 + bank * 16, 0x20); + + if (species == SPECIES_CASTFORM) + { + paletteOffset = 0x100 + bank * 16; + LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[0]); + LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[bank]], paletteOffset, 0x20); + } + + // transform's pink color + if (gBattleSpritesDataPtr->bankData[bank].transformSpecies != SPECIES_NONE) + { + BlendPalette(paletteOffset, 16, 6, 0x7FFF); + CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32); + } +} + +void nullsub_23(void) +{ +} + +void nullsub_24(u16 species) +{ +} + +void DecompressTrainerFrontPic(u16 frontPicId, u8 bank) +{ + u8 identity = GetBankIdentity(bank); + DecompressPicFromTable_2(&gTrainerFrontPicTable[frontPicId], + gMonSpritesGfxPtr->sprites[identity], + SPECIES_NONE); + LoadCompressedObjectPalette(&gTrainerFrontPicPaletteTable[frontPicId]); +} + +void DecompressTrainerBackPic(u16 backPicId, u8 bank) +{ + u8 identity = GetBankIdentity(bank); + DecompressPicFromTable_2(&gTrainerBackPicTable[backPicId], + gMonSpritesGfxPtr->sprites[identity], + SPECIES_NONE); + LoadCompressedPalette(gTrainerBackPicPaletteTable[backPicId].data, + 0x100 + 16 * bank, 0x20); +} + +void nullsub_25(u8 arg0) +{ +} + +void FreeTrainerFrontPicPalette(u16 frontPicId) +{ + FreeSpritePaletteByTag(gTrainerFrontPicPaletteTable[frontPicId].tag); +} + +void sub_805DFFC(void) +{ + u8 numberOfBanks = 0; + u8 i; + + LoadSpritePalette(&gUnknown_0832C128[0]); + LoadSpritePalette(&gUnknown_0832C128[1]); + if (!IsDoubleBattle()) + { + LoadCompressedObjectPic(&gUnknown_0832C0D0); + LoadCompressedObjectPic(&gUnknown_0832C0D8); + numberOfBanks = 2; + } + else + { + LoadCompressedObjectPic(&gUnknown_0832C0E0[0]); + LoadCompressedObjectPic(&gUnknown_0832C0E0[1]); + LoadCompressedObjectPic(&gUnknown_0832C0F0[0]); + LoadCompressedObjectPic(&gUnknown_0832C0F0[1]); + numberOfBanks = 4; + } + for (i = 0; i < numberOfBanks; i++) + LoadCompressedObjectPic(&gUnknown_0832C108[gBanksByIdentity[i]]); +} + +bool8 BattleLoadAllHealthBoxesGfx(u8 state) +{ + bool8 retVal = FALSE; + + if (state != 0) + { + if (state == 1) + { + LoadSpritePalette(&gUnknown_0832C128[0]); + LoadSpritePalette(&gUnknown_0832C128[1]); + } + else if (!IsDoubleBattle()) + { + if (state == 2) + { + if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) + LoadCompressedObjectPic(&gUnknown_0832C100); + else + LoadCompressedObjectPic(&gUnknown_0832C0D0); + } + else if (state == 3) + LoadCompressedObjectPic(&gUnknown_0832C0D8); + else if (state == 4) + LoadCompressedObjectPic(&gUnknown_0832C108[gBanksByIdentity[0]]); + else if (state == 5) + LoadCompressedObjectPic(&gUnknown_0832C108[gBanksByIdentity[1]]); + else + retVal = TRUE; + } + else + { + if (state == 2) + LoadCompressedObjectPic(&gUnknown_0832C0E0[0]); + else if (state == 3) + LoadCompressedObjectPic(&gUnknown_0832C0E0[1]); + else if (state == 4) + LoadCompressedObjectPic(&gUnknown_0832C0F0[0]); + else if (state == 5) + LoadCompressedObjectPic(&gUnknown_0832C0F0[1]); + else if (state == 6) + LoadCompressedObjectPic(&gUnknown_0832C108[gBanksByIdentity[0]]); + else if (state == 7) + LoadCompressedObjectPic(&gUnknown_0832C108[gBanksByIdentity[1]]); + else if (state == 8) + LoadCompressedObjectPic(&gUnknown_0832C108[gBanksByIdentity[2]]); + else if (state == 9) + LoadCompressedObjectPic(&gUnknown_0832C108[gBanksByIdentity[3]]); + else + retVal = TRUE; + } + } + + return retVal; +} + +void LoadBattleBarGfx(u8 arg0) +{ + LZDecompressWram(gUnknown_08C093F0, gMonSpritesGfxPtr->barFontGfx); +} + +bool8 BattleInitAllSprites(u8 *state1, u8 *bank) +{ + bool8 retVal = FALSE; + + switch (*state1) + { + case 0: + ClearSpritesBankHealthboxAnimData(); + (*state1)++; + break; + case 1: + if (!BattleLoadAllHealthBoxesGfx(*bank)) + { + (*bank)++; + } + else + { + *bank = 0; + (*state1)++; + } + break; + case 2: + (*state1)++; + break; + case 3: + if ((gBattleTypeFlags & BATTLE_TYPE_SAFARI) && *bank == 0) + gHealthBoxesIds[*bank] = CreateSafariPlayerHealthboxSprites(); + else + gHealthBoxesIds[*bank] = CreateBankHealthboxSprites(*bank); + + (*bank)++; + if (*bank == gNoOfAllBanks) + { + *bank = 0; + (*state1)++; + } + break; + case 4: + SetBankHealthboxSpritePos(*bank); + if (gBanksByIdentity[*bank] <= 1) + DummyBattleInterfaceFunc(gHealthBoxesIds[*bank], FALSE); + else + DummyBattleInterfaceFunc(gHealthBoxesIds[*bank], TRUE); + + (*bank)++; + if (*bank == gNoOfAllBanks) + { + *bank = 0; + (*state1)++; + } + break; + case 5: + if (GetBankSide(*bank) == SIDE_PLAYER) + { + if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI)) + UpdateHealthboxAttribute(gHealthBoxesIds[*bank], &gPlayerParty[gBattlePartyID[*bank]], HEALTHBOX_ALL); + } + else + { + UpdateHealthboxAttribute(gHealthBoxesIds[*bank], &gEnemyParty[gBattlePartyID[*bank]], HEALTHBOX_ALL); + } + SetHealthboxSpriteInvisible(gHealthBoxesIds[*bank]); + (*bank)++; + if (*bank == gNoOfAllBanks) + { + *bank = 0; + (*state1)++; + } + break; + case 6: + LoadAndCreateEnemyShadowSprites(); + sub_81B8C68(); + retVal = TRUE; + break; + } + + return retVal; +} + +void ClearSpritesHealthboxAnimData(void) +{ + memset(gBattleSpritesDataPtr->healthBoxesData, 0, sizeof(struct BattleHealthboxInfo) * BATTLE_BANKS_COUNT); + memset(gBattleSpritesDataPtr->animationData, 0, sizeof(struct BattleAnimationInfo)); +} + +static void ClearSpritesBankHealthboxAnimData(void) +{ + ClearSpritesHealthboxAnimData(); + memset(gBattleSpritesDataPtr->bankData, 0, sizeof(struct BattleSpriteInfo) * BATTLE_BANKS_COUNT); +} + +void CopyAllBattleSpritesInvisibilities(void) +{ + s32 i; + + for (i = 0; i < gNoOfAllBanks; i++) + gBattleSpritesDataPtr->bankData[i].invisible = gSprites[gBankSpriteIds[i]].invisible; +} + +void CopyBattleSpriteInvisibility(u8 bank) +{ + gBattleSpritesDataPtr->bankData[bank].invisible = gSprites[gBankSpriteIds[bank]].invisible; +} + +void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform) +{ + u16 paletteOffset; + u32 personalityValue; + u32 otId; + u8 identity; + const u8 *lzPaletteData; + + if (notTransform) + { + StartSpriteAnim(&gSprites[gBankSpriteIds[bankAtk]], gBattleSpritesDataPtr->animationData->animArg); + paletteOffset = 0x100 + bankAtk * 16; + LoadPalette(gBattleStruct->castformPalette[gBattleSpritesDataPtr->animationData->animArg], paletteOffset, 32); + gBattleMonForms[bankAtk] = gBattleSpritesDataPtr->animationData->animArg; + if (gBattleSpritesDataPtr->bankData[bankAtk].transformSpecies != SPECIES_NONE) + { + BlendPalette(paletteOffset, 16, 6, 0x7FFF); + CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32); + } + gSprites[gBankSpriteIds[bankAtk]].pos1.y = GetBankSpriteDefault_Y(bankAtk); + } + else + { + const void *src; + void *dst; + u16 targetSpecies; + + if (IsContest()) + { + identity = 0; + targetSpecies = gContestResources->field_18->field_2; + personalityValue = gContestResources->field_18->field_8; + otId = gContestResources->field_18->field_C; + + HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[targetSpecies], + gMonSpritesGfxPtr->sprites[0], + targetSpecies, + gContestResources->field_18->field_10); + } + else + { + identity = GetBankIdentity(bankAtk); + + if (GetBankSide(bankDef) == SIDE_OPPONENT) + targetSpecies = GetMonData(&gEnemyParty[gBattlePartyID[bankDef]], MON_DATA_SPECIES); + else + targetSpecies = GetMonData(&gPlayerParty[gBattlePartyID[bankDef]], MON_DATA_SPECIES); + + if (GetBankSide(bankAtk) == SIDE_PLAYER) + { + personalityValue = GetMonData(&gPlayerParty[gBattlePartyID[bankAtk]], MON_DATA_PERSONALITY); + otId = GetMonData(&gPlayerParty[gBattlePartyID[bankAtk]], MON_DATA_OT_ID); + + HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[targetSpecies], + gMonSpritesGfxPtr->sprites[identity], + targetSpecies, + gTransformedPersonalities[bankAtk]); + } + else + { + personalityValue = GetMonData(&gEnemyParty[gBattlePartyID[bankAtk]], MON_DATA_PERSONALITY); + otId = GetMonData(&gEnemyParty[gBattlePartyID[bankAtk]], MON_DATA_OT_ID); + + HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[targetSpecies], + gMonSpritesGfxPtr->sprites[identity], + targetSpecies, + gTransformedPersonalities[bankAtk]); + } + } + + src = gMonSpritesGfxPtr->sprites[identity]; + dst = (void *)(VRAM + 0x10000 + gSprites[gBankSpriteIds[bankAtk]].oam.tileNum * 32); + DmaCopy32(3, src, dst, 0x800); + paletteOffset = 0x100 + bankAtk * 16; + lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(targetSpecies, otId, personalityValue); + LZDecompressWram(lzPaletteData, gDecompressionBuffer); + LoadPalette(gDecompressionBuffer, paletteOffset, 32); + + if (targetSpecies == SPECIES_CASTFORM) + { + gSprites[gBankSpriteIds[bankAtk]].anims = gMonAnimationsSpriteAnimsPtrTable[targetSpecies]; + LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[0]); + LoadPalette(gBattleStruct->castformPalette[0] + gBattleMonForms[bankDef] * 16, paletteOffset, 32); + } + + BlendPalette(paletteOffset, 16, 6, 0x7FFF); + CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32); + + if (!IsContest()) + { + gBattleSpritesDataPtr->bankData[bankAtk].transformSpecies = targetSpecies; + gBattleMonForms[bankAtk] = gBattleMonForms[bankDef]; + } + + gSprites[gBankSpriteIds[bankAtk]].pos1.y = GetBankSpriteDefault_Y(bankAtk); + StartSpriteAnim(&gSprites[gBankSpriteIds[bankAtk]], gBattleMonForms[bankAtk]); + } +} + +void BattleLoadSubstituteOrMonSpriteGfx(u8 bank, bool8 loadMonSprite) +{ + u8 identity; + s32 i; + u32 var; + const void *substitutePal; + + if (!loadMonSprite) + { + if (IsContest()) + identity = 0; + else + identity = GetBankIdentity(bank); + + if (IsContest()) + LZDecompressVram(gSubstituteDollTilemap, gMonSpritesGfxPtr->sprites[identity]); + else if (GetBankSide(bank) != SIDE_PLAYER) + LZDecompressVram(gSubstituteDollGfx, gMonSpritesGfxPtr->sprites[identity]); + else + LZDecompressVram(gSubstituteDollTilemap, gMonSpritesGfxPtr->sprites[identity]); + + i = 1; + var = bank * 16; + substitutePal = gSubstituteDollPal; + for (; i < 4; i++) + { + register void *dmaSrc asm("r0") = gMonSpritesGfxPtr->sprites[identity]; + void *dmaDst = (i * 0x800) + dmaSrc; + u32 dmaSize = 0x800; + DmaCopy32(3, dmaSrc, dmaDst, dmaSize); + i++;i--; + } + + LoadCompressedPalette(substitutePal, 0x100 + var, 32); + } + else + { + if (!IsContest()) + { + if (GetBankSide(bank) != SIDE_PLAYER) + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank); + else + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[bank]], bank); + } + } +} + +void LoadBattleMonGfxAndAnimate(u8 bank, bool8 loadMonSprite, u8 spriteId) +{ + BattleLoadSubstituteOrMonSpriteGfx(bank, loadMonSprite); + StartSpriteAnim(&gSprites[spriteId], gBattleMonForms[bank]); + + if (!loadMonSprite) + gSprites[spriteId].pos1.y = GetSubstituteSpriteDefault_Y(bank); + else + gSprites[spriteId].pos1.y = GetBankSpriteDefault_Y(bank); +} + +void TrySetBehindSubstituteSpriteBit(u8 bank, u16 move) +{ + if (move == MOVE_SUBSTITUTE) + gBattleSpritesDataPtr->bankData[bank].behindSubstitute = 1; +} + +void ClearBehindSubstituteBit(u8 bank) +{ + gBattleSpritesDataPtr->bankData[bank].behindSubstitute = 0; +} + +void HandleLowHpMusicChange(struct Pokemon *mon, u8 bank) +{ + u16 hp = GetMonData(mon, MON_DATA_HP); + u16 maxHP = GetMonData(mon, MON_DATA_MAX_HP); + + if (GetHPBarLevel(hp, maxHP) == HP_BAR_RED) + { + if (!gBattleSpritesDataPtr->bankData[bank].lowHpSong) + { + if (!gBattleSpritesDataPtr->bankData[bank ^ BIT_MON].lowHpSong) + PlaySE(SE_HINSI); + gBattleSpritesDataPtr->bankData[bank].lowHpSong = 1; + } + } + else + { + gBattleSpritesDataPtr->bankData[bank].lowHpSong = 0; + if (!IsDoubleBattle()) + { + m4aSongNumStop(SE_HINSI); + return; + } + if (IsDoubleBattle() && !gBattleSpritesDataPtr->bankData[bank ^ BIT_MON].lowHpSong) + { + m4aSongNumStop(SE_HINSI); + return; + } + } +} + +void BattleStopLowHpSound(void) +{ + u8 playerBank = GetBankByIdentity(IDENTITY_PLAYER_MON1); + + gBattleSpritesDataPtr->bankData[playerBank].lowHpSong = 0; + if (IsDoubleBattle()) + gBattleSpritesDataPtr->bankData[playerBank ^ BIT_MON].lowHpSong = 0; + + m4aSongNumStop(SE_HINSI); +} + +u8 GetMonHPBarLevel(struct Pokemon *mon) +{ + u16 hp = GetMonData(mon, MON_DATA_HP); + u16 maxHP = GetMonData(mon, MON_DATA_MAX_HP); + + return GetHPBarLevel(hp, maxHP); +} + +void sub_805EAE8(void) +{ + if (gMain.inBattle) + { + u8 playerBank1 = GetBankByIdentity(IDENTITY_PLAYER_MON1); + u8 playerBank2 = GetBankByIdentity(IDENTITY_PLAYER_MON2); + u8 bank1PartyId = pokemon_order_func(gBattlePartyID[playerBank1]); + u8 bank2PartyId = pokemon_order_func(gBattlePartyID[playerBank2]); + + if (GetMonData(&gPlayerParty[bank1PartyId], MON_DATA_HP) != 0) + HandleLowHpMusicChange(&gPlayerParty[bank1PartyId], playerBank1); + if (IsDoubleBattle() && GetMonData(&gPlayerParty[bank2PartyId], MON_DATA_HP) != 0) + HandleLowHpMusicChange(&gPlayerParty[bank2PartyId], playerBank2); + } +} + +void sub_805EB9C(u8 affineMode) +{ + s32 i; + + for (i = 0; i < gNoOfAllBanks; i++) + { + if (IsBankSpritePresent(i)) + { + gSprites[gBankSpriteIds[i]].oam.affineMode = affineMode; + if (affineMode == 0) + { + gBattleSpritesDataPtr->healthBoxesData[i].field_6 = gSprites[gBankSpriteIds[i]].oam.matrixNum; + gSprites[gBankSpriteIds[i]].oam.matrixNum = 0; + } + else + { + gSprites[gBankSpriteIds[i]].oam.matrixNum = gBattleSpritesDataPtr->healthBoxesData[i].field_6; + } + } + } +} + +#define tBank data0 + +void LoadAndCreateEnemyShadowSprites(void) +{ + u8 bank; + + LoadCompressedObjectPic(&gSpriteSheet_EnemyShadow); + + bank = GetBankByIdentity(IDENTITY_OPPONENT_MON1); + gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, sub_80A5C6C(bank, 0), sub_80A5C6C(bank, 1) + 29, 0xC8); + gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].data0 = bank; + + if (IsDoubleBattle()) + { + bank = GetBankByIdentity(IDENTITY_OPPONENT_MON2); + gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, sub_80A5C6C(bank, 0), sub_80A5C6C(bank, 1) + 29, 0xC8); + gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].data0 = bank; + } +} + +void SpriteCB_EnemyShadow(struct Sprite *shadowSprite) +{ + bool8 invisible = FALSE; + u8 bank = shadowSprite->tBank; + struct Sprite *bankSprite = &gSprites[gBankSpriteIds[bank]]; + + if (!bankSprite->inUse || !IsBankSpritePresent(bank)) + { + shadowSprite->callback = SpriteCB_SetInvisible; + return; + } + if (gAnimScriptActive || bankSprite->invisible) + invisible = TRUE; + else if (gBattleSpritesDataPtr->bankData[bank].transformSpecies != SPECIES_NONE + && gEnemyMonElevation[gBattleSpritesDataPtr->bankData[bank].transformSpecies] == 0) + invisible = TRUE; + + if (gBattleSpritesDataPtr->bankData[bank].behindSubstitute) + invisible = TRUE; + + shadowSprite->pos1.x = bankSprite->pos1.x; + shadowSprite->pos2.x = bankSprite->pos2.x; + shadowSprite->invisible = invisible; +} + +#undef tBank + +void SpriteCB_SetInvisible(struct Sprite *sprite) +{ + sprite->invisible = 1; +} + +void SetBankEnemyShadowSpriteCallback(u8 bank, u16 species) +{ + if (GetBankSide(bank) == SIDE_PLAYER) + return; + + if (gBattleSpritesDataPtr->bankData[bank].transformSpecies != SPECIES_NONE) + species = gBattleSpritesDataPtr->bankData[bank].transformSpecies; + + if (gEnemyMonElevation[species] != 0) + gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].callback = SpriteCB_EnemyShadow; + else + gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].callback = SpriteCB_SetInvisible; +} + +void EnemyShadowCallbackToSetInvisible(u8 bank) +{ + gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].callback = SpriteCB_SetInvisible; +} + +void sub_805EF14(void) +{ + u16 *vramPtr = (u16*)(VRAM + 0x240); + s32 i; + s32 j; + + for (i = 0; i < 9; i++) + { + for (j = 0; j < 16; j++) + { + if (!(*vramPtr & 0xF000)) + *vramPtr |= 0xF000; + if (!(*vramPtr & 0x0F00)) + *vramPtr |= 0x0F00; + if (!(*vramPtr & 0x00F0)) + *vramPtr |= 0x00F0; + if (!(*vramPtr & 0x000F)) + *vramPtr |= 0x000F; + vramPtr++; + } + } +} + +void ClearTemporarySpeciesSpriteData(u8 bank, bool8 dontClearSubstitute) +{ + gBattleSpritesDataPtr->bankData[bank].transformSpecies = SPECIES_NONE; + gBattleMonForms[bank] = 0; + if (!dontClearSubstitute) + ClearBehindSubstituteBit(bank); +} + +void AllocateMonSpritesGfx(void) +{ + u8 i = 0, j; + + gMonSpritesGfxPtr = NULL; + gMonSpritesGfxPtr = AllocZeroed(sizeof(*gMonSpritesGfxPtr)); + gMonSpritesGfxPtr->firstDecompressed = AllocZeroed(0x8000); + + for (i = 0; i < BATTLE_BANKS_COUNT; i++) + { + gMonSpritesGfxPtr->sprites[i] = gMonSpritesGfxPtr->firstDecompressed + (i * 0x2000); + *(gMonSpritesGfxPtr->templates + i) = gUnknown_08329D98[i]; + + for (j = 0; j < 4; j++) + { + gMonSpritesGfxPtr->field_74[i][j].data = gMonSpritesGfxPtr->sprites[i] + (j * 0x800); + gMonSpritesGfxPtr->field_74[i][j].size = 0x800; + } + + gMonSpritesGfxPtr->templates[i].images = gMonSpritesGfxPtr->field_74[i]; + } + + gMonSpritesGfxPtr->barFontGfx = AllocZeroed(0x1000); +} + +void FreeMonSpritesGfx(void) +{ + if (gMonSpritesGfxPtr == NULL) + return; + + if (gMonSpritesGfxPtr->field_17C != NULL) + FREE_AND_SET_NULL(gMonSpritesGfxPtr->field_17C); + if (gMonSpritesGfxPtr->field_178 != NULL) + FREE_AND_SET_NULL(gMonSpritesGfxPtr->field_178); + + FREE_AND_SET_NULL(gMonSpritesGfxPtr->barFontGfx); + FREE_AND_SET_NULL(gMonSpritesGfxPtr->firstDecompressed); + gMonSpritesGfxPtr->sprites[0] = NULL; + gMonSpritesGfxPtr->sprites[1] = NULL; + gMonSpritesGfxPtr->sprites[2] = NULL; + gMonSpritesGfxPtr->sprites[3] = NULL; + FREE_AND_SET_NULL(gMonSpritesGfxPtr); +} + +bool32 ShouldPlayNormalPokeCry(struct Pokemon *mon) +{ + s16 hp, maxHP; + s32 barLevel; + + if (GetMonData(mon, MON_DATA_STATUS) & (STATUS_ANY | STATUS_TOXIC_COUNTER)) + return FALSE; + + hp = GetMonData(mon, MON_DATA_HP); + maxHP = GetMonData(mon, MON_DATA_MAX_HP); + + barLevel = GetHPBarLevel(hp, maxHP); + if (barLevel <= HP_BAR_YELLOW) + return FALSE; + + return TRUE; +} diff --git a/src/battle_interface.c b/src/battle_interface.c index 5f582a366..240c64862 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -1239,11 +1239,11 @@ void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent) } ConvertIntToDecimalStringN(text + 6, value, STR_CONV_MODE_RIGHT_ALIGN, 3); - RenderTextFont9(gMonSpritesGfxPtr->fontPixels, 9, text); + RenderTextFont9(gMonSpritesGfxPtr->barFontGfx, 9, text); for (i = 0; i < 3; i++) { - CpuCopy32(&gMonSpritesGfxPtr->fontPixels[i * 64 + 32], + CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[i * 64 + 32], (void*)((OBJ_VRAM0) + 32 * (gSprites[healthboxSpriteId].oam.tileNum + var + i)), 0x20); } @@ -1308,19 +1308,19 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8 txtPtr = ConvertIntToDecimalStringN(text + 6, value, STR_CONV_MODE_RIGHT_ALIGN, 3); if (!maxOrCurrent) StringCopy(txtPtr, gText_Slash); - RenderTextFont9(gMonSpritesGfxPtr->fontPixels, 9, text); + RenderTextFont9(gMonSpritesGfxPtr->barFontGfx, 9, text); for (i = var; i < var + 3; i++) { if (i < 3) { - CpuCopy32(&gMonSpritesGfxPtr->fontPixels[((i - var) * 64) + 32], + CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[((i - var) * 64) + 32], (void*)((OBJ_VRAM0) + 32 * (1 + gSprites[r7].oam.tileNum + i)), 0x20); } else { - CpuCopy32(&gMonSpritesGfxPtr->fontPixels[((i - var) * 64) + 32], + CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[((i - var) * 64) + 32], (void*)((OBJ_VRAM0 + 0x20) + 32 * (i + gSprites[r7].oam.tileNum)), 0x20); } @@ -1328,7 +1328,7 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8 if (maxOrCurrent == HP_CURRENT) { - CpuCopy32(&gMonSpritesGfxPtr->fontPixels[224], + CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[224], (void*)((OBJ_VRAM0) + ((gSprites[r7].oam.tileNum + 4) * 32)), 0x20); CpuFill32(0, (void*)((OBJ_VRAM0) + (gSprites[r7].oam.tileNum * 32)), 0x20); @@ -1350,15 +1350,15 @@ static void sub_80730D4(u8 healthboxSpriteId, struct Pokemon *mon) { u8 text[20]; s32 j, var2; - u8 *fontPixels; + u8 *barFontGfx; u8 i, var, nature, healthboxSpriteId_2; memcpy(text, sUnknown_0832C3C4, sizeof(sUnknown_0832C3C4)); - fontPixels = &gMonSpritesGfxPtr->fontPixels[0x520 + (GetBankIdentity(gSprites[healthboxSpriteId].data6) * 384)]; + barFontGfx = &gMonSpritesGfxPtr->barFontGfx[0x520 + (GetBankIdentity(gSprites[healthboxSpriteId].data6) * 384)]; var = 5; nature = GetNature(mon); StringCopy(text + 6, gNatureNamePointers[nature]); - RenderTextFont9(fontPixels, 9, text); + RenderTextFont9(barFontGfx, 9, text); for (j = 6, i = 0; i < var; i++, j++) { @@ -1371,18 +1371,18 @@ static void sub_80730D4(u8 healthboxSpriteId, struct Pokemon *mon) else elementId = 43; - CpuCopy32(GetHealthboxElementGfxPtr(elementId), fontPixels + (i * 64), 0x20); + CpuCopy32(GetHealthboxElementGfxPtr(elementId), barFontGfx + (i * 64), 0x20); } for (j = 1; j < var + 1; j++) { var2 = (gSprites[healthboxSpriteId].oam.tileNum + (j - (j / 8 * 8)) + (j / 8 * 64)) * 32; - CpuCopy32(fontPixels, (void*)(OBJ_VRAM0) + (var2), 0x20); - fontPixels += 0x20; + CpuCopy32(barFontGfx, (void*)(OBJ_VRAM0) + (var2), 0x20); + barFontGfx += 0x20; var2 = (8 + gSprites[healthboxSpriteId].oam.tileNum + (j - (j / 8 * 8)) + (j / 8 * 64)) * 32; - CpuCopy32(fontPixels, (void*)(OBJ_VRAM0) + (var2), 0x20); - fontPixels += 0x20; + CpuCopy32(barFontGfx, (void*)(OBJ_VRAM0) + (var2), 0x20); + barFontGfx += 0x20; } healthboxSpriteId_2 = gSprites[healthboxSpriteId].data5; @@ -1390,20 +1390,20 @@ static void sub_80730D4(u8 healthboxSpriteId, struct Pokemon *mon) ConvertIntToDecimalStringN(text + 9, gBattleStruct->field_7B, STR_CONV_MODE_RIGHT_ALIGN, 2); text[5] = CHAR_SPACE; text[8] = CHAR_SLASH; - RenderTextFont9(gMonSpritesGfxPtr->fontPixels, 9, text); + RenderTextFont9(gMonSpritesGfxPtr->barFontGfx, 9, text); j = healthboxSpriteId_2; // needed to match for some reason for (j = 0; j < 5; j++) { if (j <= 1) { - CpuCopy32(&gMonSpritesGfxPtr->fontPixels[0x40 * j + 0x20], + CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[0x40 * j + 0x20], (void*)(OBJ_VRAM0) + (gSprites[healthboxSpriteId_2].oam.tileNum + 2 + j) * 32, 32); } else { - CpuCopy32(&gMonSpritesGfxPtr->fontPixels[0x40 * j + 0x20], + CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[0x40 * j + 0x20], (void*)(OBJ_VRAM0 + 0xC0) + (j + gSprites[healthboxSpriteId_2].oam.tileNum) * 32, 32); } @@ -2545,19 +2545,19 @@ u8 GetHPBarLevel(s16 hp, s16 maxhp) if (hp == maxhp) { - result = 4; + result = HP_BAR_FULL; } else { u8 fraction = GetScaledHPFraction(hp, maxhp, 48); if (fraction > 24) - result = 3; + result = HP_BAR_GREEN; else if (fraction > 9) - result = 2; + result = HP_BAR_YELLOW; else if (fraction > 0) - result = 1; + result = HP_BAR_RED; else - result = 0; + result = HP_BAR_EMPTY; } return result; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index c6cec7f0d..91be4fd9d 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1068,22 +1068,33 @@ static const u8 sBallCatchBonuses[] = 20, 15, 10, 15 // Ultra, Great, Poke, Safari }; -// could be a 2d array or a struct -const ALIGNED(4) u8 gUnknown_0831C494[] = +const ALIGNED(4) u8 gUnknown_0831C494[][4] = { - 0x3d, 0x44, 0x3d, 0x44, 0x14, 0x2d, 0x54, 0x5c, - 0x46, 0x55, 0x20, 0x5c, 0x26, 0x45, 0x46, 0x55, - 0x14, 0x5a, 0x46, 0x5c, 0x1e, 0x32, 0x20, 0x5a, - 0x38, 0x4e, 0x38, 0x4e, 0x19, 0x28, 0x4b, 0x5a, - 0x45, 0x4b, 0x1c, 0x53, 0x23, 0x2d, 0x1d, 0x23, - 0x3e, 0x48, 0x1e, 0x32, 0x3a, 0x5f, 0x58, 0x5e, - 0x22, 0x2d, 0x1d, 0x28, 0x23, 0x28, 0x23, 0x5f, - 0x38, 0x4e, 0x38, 0x4e, 0x23, 0x50, 0x22, 0x5e, - 0x2c, 0x5e, 0x22, 0x28, 0x38, 0x4e, 0x38, 0x4e, - 0x1e, 0x58, 0x1e, 0x58, 0x1e, 0x2b, 0x1b, 0x21, - 0x28, 0x5a, 0x19, 0x57, 0x12, 0x58, 0x5a, 0x5f, - 0x58, 0x5e, 0x16, 0x2a, 0x2a, 0x5c, 0x2a, 0x2f, - 0x38, 0x4e, 0x38, 0x4e + {0x3d, 0x44, 0x3d, 0x44}, + {0x14, 0x2d, 0x54, 0x5c}, + {0x46, 0x55, 0x20, 0x5c}, + {0x26, 0x45, 0x46, 0x55}, + {0x14, 0x5a, 0x46, 0x5c}, + {0x1e, 0x32, 0x20, 0x5a}, + {0x38, 0x4e, 0x38, 0x4e}, + {0x19, 0x28, 0x4b, 0x5a}, + {0x45, 0x4b, 0x1c, 0x53}, + {0x23, 0x2d, 0x1d, 0x23}, + {0x3e, 0x48, 0x1e, 0x32}, + {0x3a, 0x5f, 0x58, 0x5e}, + {0x22, 0x2d, 0x1d, 0x28}, + {0x23, 0x28, 0x23, 0x5f}, + {0x38, 0x4e, 0x38, 0x4e}, + {0x23, 0x50, 0x22, 0x5e}, + {0x2c, 0x5e, 0x22, 0x28}, + {0x38, 0x4e, 0x38, 0x4e}, + {0x1e, 0x58, 0x1e, 0x58}, + {0x1e, 0x2b, 0x1b, 0x21}, + {0x28, 0x5a, 0x19, 0x57}, + {0x12, 0x58, 0x5a, 0x5f}, + {0x58, 0x5e, 0x16, 0x2a}, + {0x2a, 0x5c, 0x2a, 0x2f}, + {0x38, 0x4e, 0x38, 0x4e} }; static const u8 sUnknown_0831C4F8[] = @@ -3533,7 +3544,7 @@ static void atk23_getexp(void) // music change in wild battle after fainting a poke if (!(gBattleTypeFlags & BATTLE_TYPE_TRAINER) && gBattleMons[0].hp && !gBattleStruct->wildVictorySong) { - BattleMusicStop(); + BattleStopLowHpSound(); PlayBGM(0x161); gBattleStruct->wildVictorySong++; } @@ -3628,7 +3639,7 @@ static void atk23_getexp(void) if (gBattleBufferB[gActiveBank][0] == CONTROLLER_TWORETURNVALUES && gBattleBufferB[gActiveBank][1] == RET_VALUE_LEVELLED_UP) { if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlePartyID[gActiveBank] == gBattleStruct->expGetterId) - sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gActiveBank, gBattleStruct->expGetterId) diff --git a/src/berry_blender.c b/src/berry_blender.c index db50fe4c4..8e5a51845 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -1,6 +1,8 @@ - -// Includes #include "global.h" +#include "bg.h" +#include "window.h" +#include "task.h" +#include "sprite.h" // Static type declarations @@ -11,8 +13,585 @@ IWRAM_DATA s16 gUnknown_03000DF8[6]; IWRAM_DATA s16 gUnknown_03000E04; IWRAM_DATA s16 gUnknown_03000E06; -// Static ROM declarations +// graphics +extern const u8 gBerryBlenderArrowTiles[]; +extern const u8 gBerryBlenderStartTiles[]; +extern const u8 gBerryBlenderMarubatsuTiles[]; +extern const u8 gBerryBlenderParticlesTiles[]; +extern const u8 gBerryBlenderCountdownNumbersTiles[]; +extern const u16 gBerryBlenderMiscPalette[]; +extern const u16 gBerryBlenderArrowPalette[]; + +void sub_8080EA4(u8 taskId); +void sub_8080FD0(u8 taskId); +void sub_80810F8(u8 taskId); +void sub_80833F8(struct Sprite *sprite); +void sub_8082F68(struct Sprite *sprite); +void sub_8083010(struct Sprite *sprite); +void sub_80830C0(struct Sprite *sprite); // .rodata +// TODO: make those static once the file is decompiled +const u16 sBlenderCenterPal[] = INCBIN_U16("graphics/berry_blender/center.gbapal"); +const u8 sBlenderCenterMap[] = INCBIN_U8("graphics/berry_blender/center_map.bin"); +const u16 sBlenderOuterPal[] = INCBIN_U16("graphics/berry_blender/outer.gbapal"); + +// unreferenced pals? +static const u16 sUnknownPal_0[] = INCBIN_U16("graphics/unknown/unknown_339514.gbapal"); +static const u16 sUnknownArray_1[224] = {0}; + +// unused text? +static const u8 sUnusedText_YesNo[] = _("YES\nNO"); +static const u8 sUnusedText_2[] = _("▶"); +static const u8 sUnusedText_Space[] = _(" "); +static const u8 sUnusedText_Terminating[] = _("Terminating."); +static const u8 sUnusedText_LinkPartnerNotFound[] = _("Link partner(s) not found.\nPlease try again.\p"); + +const u8 gText_BerryBlenderStart[] = _("Starting up the BERRY BLENDER.\pPlease select a BERRY from your BAG\nto put in the BERRY BLENDER.\p"); +const u8 gText_NewParagraph[] = _("\p"); +const u8 gText_WasMade[] = _(" was made!"); +static const u8 sText_Mister[] = _("MISTER"); +static const u8 sText_Laddie[] = _("LADDIE"); +static const u8 sText_Lassie[] = _("LASSIE"); +static const u8 sText_Master[] = _("MASTER"); +static const u8 sText_Dude[] = _("DUDE"); +static const u8 sText_Miss[] = _("MISS"); + +const u8* const sBlenderOpponentsNames[] = +{ + sText_Mister, + sText_Laddie, + sText_Lassie, + sText_Master, + sText_Dude, + sText_Miss +}; + +static const u8 sText_PressAToStart[] = _("Press the A Button to start."); +static const u8 sText_PleaseWaitAWhile[] = _("Please wait a while."); +const u8 sText_CommunicationStandby[] = _("Communication standby…"); +const u8 sText_WouldLikeToBlendAnotherBerry[] = _("Would you like to blend another BERRY?"); +const u8 sText_RunOutOfBerriesForBlending[] = _("You’ve run out of BERRIES for\nblending in the BERRY BLENDER.\p"); +const u8 sText_YourPokeblockCaseIsFull[] = _("Your {POKEBLOCK} CASE is full.\p"); +const u8 sText_HasNoBerriesToPut[] = _(" has no BERRIES to put in\nthe BERRY BLENDER."); +const u8 sText_ApostropheSPokeblockCaseIsFull[] = _("’s {POKEBLOCK} CASE is full.\p"); +const u8 sText_BlendingResults[] = _("RESULTS OF BLENDING"); +static const u8 sText_BerryUsed[] = _("BERRY USED"); +const u8 sText_SpaceBerry[] = _(" BERRY"); +const u8 sText_Time[] = _("Time:"); +const u8 sText_Min[] = _(" min. "); +const u8 sText_Sec[] = _(" sec."); +const u8 sText_MaximumSpeed[] = _("MAXIMUM SPEED"); +const u8 sText_RPM[] = _(" RPM"); +const u8 sText_Dot[] = _("."); +const u8 sText_NewLine[] = _("\n"); +static const u8 sText_Space[] = _(" "); +const u8 sText_Ranking[] = _("RANKING"); +const u8 sText_TheLevelIs[] = _("The level is "); +const u8 sText_TheFeelIs[] = _(", and the feel is "); +const u8 sText_Dot2[] = _("."); + +const struct BgTemplate gUnknown_08339974[3] = +{ + { + .bg = 0, + .charBaseIndex = 3, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0, + }, + { + .bg = 1, + .charBaseIndex = 2, + .mapBaseIndex = 12, + .screenSize = 0, + .paletteMode = 0, + .priority = 1, + .baseTile = 0, + }, + { + .bg = 2, + .charBaseIndex = 0, + .mapBaseIndex = 8, + .screenSize = 1, + .paletteMode = 1, + .priority = 0, + .baseTile = 0, + } +}; + +const struct WindowTemplate gUnknown_08339980[] = +{ + {0, 1, 6, 7, 2, 0xE, 0x28}, + {0, 0x16, 6, 7, 2, 0xE, 0x36}, + {0, 1, 0xC, 7, 2, 0xE, 0x44}, + {0, 0x16, 0xC, 7, 2, 0xE, 0x52}, + {0, 2, 0xF, 0x1B, 4, 0xE, 0x60}, + {0, 5, 3, 0x15, 0xE, 0xE, 0x60}, + DUMMY_WIN_TEMPLATE +}; + +const struct WindowTemplate gUnknown_083399B8 = +{ + 0, 0x15, 9, 5, 4, 0xE, 0xCC +}; + +const s8 gUnknown_083399C0[][2] = +{ + {-1, -1}, {1, -1}, {-1, 1}, {1, 1} +}; + +const u8 sBlenderSyncArrowsPos[][2] = +{ + {72, 32}, {168, 32}, {72, 128}, {168, 128} +}; + +const u8 gUnknown_083399D0[3][4] = +{ + {-1, 0, 1, -1}, {-1, 0, 1, 2}, {0, 1, 2, 3} +}; + +const u16 gUnknown_083399DC[] = {0, 0xC000, 0x4000, 0x8000}; +const u8 gUnknown_083399E4[] = {1, 1, 0}; +const u8 gUnknown_083399E7[] = {32, 224, 96, 160, 0}; + +const TaskFunc gUnknown_083399EC[] = +{ + sub_8080EA4, sub_8080FD0, sub_80810F8 +}; + +static const struct OamData sOamData_8216314 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 2, + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0, +}; + +static const union AnimCmd sSpriteAnim_821631C[] = +{ + ANIMCMD_FRAME(16, 5, 1, 1), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_8216324[] = +{ + ANIMCMD_FRAME(16, 5, .vFlip = TRUE), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_821632C[] = +{ + ANIMCMD_FRAME(16, 5, .hFlip = TRUE), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_8216334[] = +{ + ANIMCMD_FRAME(16, 5, 0, 0), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_821633C[] = +{ + ANIMCMD_FRAME(48, 2, 1, 1), + ANIMCMD_FRAME(32, 5, 1, 1), + ANIMCMD_FRAME(48, 3, 1, 1), + ANIMCMD_FRAME(16, 5, 1, 1), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_8216350[] = +{ + ANIMCMD_FRAME(48, 2, .vFlip = TRUE), + ANIMCMD_FRAME(32, 5, .vFlip = TRUE), + ANIMCMD_FRAME(48, 3, .vFlip = TRUE), + ANIMCMD_FRAME(16, 5, .vFlip = TRUE), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_8216364[] = +{ + ANIMCMD_FRAME(48, 2, .hFlip = TRUE), + ANIMCMD_FRAME(32, 5, .hFlip = TRUE), + ANIMCMD_FRAME(48, 3, .hFlip = TRUE), + ANIMCMD_FRAME(16, 5, .hFlip = TRUE), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_8216378[] = +{ + ANIMCMD_FRAME(48, 2, 0, 0), + ANIMCMD_FRAME(32, 5, 0, 0), + ANIMCMD_FRAME(48, 3, 0, 0), + ANIMCMD_FRAME(16, 5, 0, 0), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_821638C[] = +{ + ANIMCMD_FRAME(0, 5, 1, 1), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_8216394[] = +{ + ANIMCMD_FRAME(0, 5, .vFlip = TRUE), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_821639C[] = +{ + ANIMCMD_FRAME(0, 5, .hFlip = TRUE), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82163A4[] = +{ + ANIMCMD_FRAME(0, 5, 0, 0), + ANIMCMD_END +}; + +static const union AnimCmd *const sSpriteAnimTable_82163AC[] = +{ + sSpriteAnim_821631C, + sSpriteAnim_8216324, + sSpriteAnim_821632C, + sSpriteAnim_8216334, + sSpriteAnim_821633C, + sSpriteAnim_8216350, + sSpriteAnim_8216364, + sSpriteAnim_8216378, + sSpriteAnim_821638C, + sSpriteAnim_8216394, + sSpriteAnim_821639C, + sSpriteAnim_82163A4 +}; + +const struct SpriteSheet sSpriteSheet_BlenderArrow = +{ + gBerryBlenderArrowTiles, 0x800, 46545 +}; + +const struct SpritePalette sSpritePal_BlenderMisc = +{ + gBerryBlenderMiscPalette, 46546 +}; + +const struct SpritePalette sSpritePal_BlenderArrow = +{ + gBerryBlenderArrowPalette, 12312 +}; + +const struct SpriteTemplate sBlenderSyncArrow_SpriteTemplate = +{ + .tileTag = 46545, + .paletteTag = 12312, + .oam = &sOamData_8216314, + .anims = sSpriteAnimTable_82163AC, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80833F8 +}; + +static const struct OamData sOamData_821640C = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 1, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; + +static const union AnimCmd sSpriteAnim_8216414[] = +{ + ANIMCMD_FRAME(0, 20), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_821641C[] = +{ + ANIMCMD_FRAME(4, 20, 1, 0), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_8216424[] = +{ + ANIMCMD_FRAME(8, 4), + ANIMCMD_FRAME(12, 4), + ANIMCMD_FRAME(8, 4), + ANIMCMD_FRAME(12, 4), + ANIMCMD_FRAME(8, 4), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_821643C[] = +{ + ANIMCMD_FRAME(8, 4), + ANIMCMD_END +}; + +static const union AnimCmd *const sSpriteAnimTable_8216444[] = +{ + sSpriteAnim_8216414, + sSpriteAnim_821641C, + sSpriteAnim_8216424, + sSpriteAnim_821643C, +}; + +const struct SpriteSheet gUnknown_08339B38 = +{ + gBerryBlenderMarubatsuTiles, 0x200, 48888 +}; + +const struct SpriteTemplate gUnknown_08339B40 = +{ + .tileTag = 48888, + .paletteTag = 46546, + .oam = &sOamData_821640C, + .anims = sSpriteAnimTable_8216444, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8082F68 +}; + +static const struct OamData sOamData_8216474 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 0, + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0, +}; + +static const union AnimCmd sSpriteAnim_821647C[] = +{ + ANIMCMD_FRAME(0, 3), + ANIMCMD_FRAME(1, 4), + ANIMCMD_FRAME(3, 5), + ANIMCMD_FRAME(1, 4), + ANIMCMD_FRAME(0, 3), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_8216494[] = +{ + ANIMCMD_FRAME(0, 3), + ANIMCMD_FRAME(2, 4), + ANIMCMD_FRAME(4, 5), + ANIMCMD_FRAME(2, 4), + ANIMCMD_FRAME(0, 3), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82164AC[] = +{ + ANIMCMD_FRAME(0, 2), + ANIMCMD_FRAME(1, 2), + ANIMCMD_FRAME(2, 2), + ANIMCMD_FRAME(4, 4), + ANIMCMD_FRAME(3, 3), + ANIMCMD_FRAME(2, 2), + ANIMCMD_FRAME(1, 2), + ANIMCMD_FRAME(0, 2), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82164D0[] = +{ + ANIMCMD_FRAME(5, 5, 1, 1), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82164D8[] = +{ + ANIMCMD_FRAME(6, 5, 1, 1), + ANIMCMD_END +}; + +static const union AnimCmd *const sSpriteAnimTable_82164E0[] = +{ + sSpriteAnim_821647C, + sSpriteAnim_8216494, + sSpriteAnim_82164AC, + sSpriteAnim_82164D0, + sSpriteAnim_82164D8, +}; + +const struct SpriteSheet gUnknown_08339BD8 = +{ + gBerryBlenderParticlesTiles, 0xE0, 23456 +}; + +const struct SpriteTemplate gUnknown_08339BE0 = +{ + .tileTag = 23456, + .paletteTag = 46546, + .oam = &sOamData_8216474, + .anims = sSpriteAnimTable_82164E0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +static const struct OamData sOamData_8216514 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 2, + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0, +}; + +static const union AnimCmd sSpriteAnim_821651C[] = +{ + ANIMCMD_FRAME(32, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_8216524[] = +{ + ANIMCMD_FRAME(16, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_821652C[] = +{ + ANIMCMD_FRAME(0, 30), + ANIMCMD_END +}; + +static const union AnimCmd *const sSpriteAnimTable_8216534[] = +{ + sSpriteAnim_821651C, + sSpriteAnim_8216524, + sSpriteAnim_821652C, +}; + +const struct SpriteSheet gUnknown_08339C24 = +{ + gBerryBlenderCountdownNumbersTiles, 0x600, 12345 +}; + +const struct SpriteTemplate gUnknown_08339C2C = +{ + .tileTag = 12345, + .paletteTag = 46546, + .oam = &sOamData_8216514, + .anims = sSpriteAnimTable_8216534, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8083010 +}; + +static const struct OamData sOamData_8216560 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 1, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0, +}; + +static const union AnimCmd sSpriteAnim_8216568[] = +{ + ANIMCMD_FRAME(0, 30), + ANIMCMD_END +}; + +static const union AnimCmd *const sSpriteAnimTable_8216570[] = +{ + sSpriteAnim_8216568, +}; + +const struct SpriteSheet gUnknown_08339C58 = +{ + gBerryBlenderStartTiles, 0x400, 12346 +}; + +const struct SpriteTemplate gUnknown_08339C60 = +{ + .tileTag = 12346, + .paletteTag = 46546, + .oam = &sOamData_8216560, + .anims = sSpriteAnimTable_8216570, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80830C0 +}; + +const s16 gUnknown_08339C78[][5] = +{ + {-10, 20, 10, 2, 1}, + {250, 20, 10, -2, 1}, + {-10, 140, 10, 2, -1}, + {250, 140, 10, -2, -1}, +}; + +const u8 gUnknown_08339CA0[][3] = +{ + {4, 3, 2}, {0, 4, 3}, {1, 0, 4}, {2, 1, 0}, {3, 2, 1}, {0, 2, 3}, {1, 3, 4}, {2, 4, 0}, {3, 0, 1}, {4, 1, 2}, +}; + +const u8 gUnknown_08339CBE[] = {30, 31, 32, 33, 34}; + +const u8 gUnknown_08339CC3[] = {1, 1, 2, 3, 4}; + +const u8 gUnknown_08339CC8[] = {0x1C, 0x16, 0x13, 0x1A, 0x19, 0x0E, 0x0D, 0x0B, 0x07, 0x15}; + +static const u8 gUnknown_08339CD2[] = +{ + 0xfe, 0x02, 0x02, 0xce, 0xd0, 0x37, 0x44, 0x07, 0x1f, 0x0c, 0x10, + 0x00, 0xff, 0xfe, 0x91, 0x72, 0xce, 0xd0, 0x37, 0x44, 0x07, 0x1f, + 0x0c, 0x10, 0x00, 0xff, 0x06, 0x27, 0x02, 0xff, 0x00, 0x0c, 0x48, + 0x02, 0xff, 0x00, 0x01, 0x1f, 0x02, 0xff, 0x00, 0x16, 0x37, 0x02, + 0xff, 0x00, 0x0d, 0x50, 0x4b, 0x02, 0xff, 0x06, 0x06, 0x06, 0x06, + 0x05, 0x03, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x02 +}; + +const struct WindowTemplate gUnknown_08339D14[] = {0, 6, 4, 0x12, 0xB, 0xF, 8}; // .text diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 2148daddf..e3ad88cfe 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -29,14 +29,14 @@ struct HallofFameMon { u32 tid; u32 personality; - u16 species : 9; - u16 lvl : 7; + u16 species:9; + u16 lvl:7; u8 nick[10]; }; -struct HallofFameMons +struct HallofFameTeam { - struct HallofFameMon mons[6]; + struct HallofFameMon mon[6]; }; struct HofGfx @@ -47,7 +47,7 @@ struct HofGfx u8 tilemap2[0x1000]; }; -static EWRAM_DATA struct HallofFameMons *sHofMonsPtr = NULL; +static EWRAM_DATA struct HallofFameTeam *sHofMonPtr = NULL; static EWRAM_DATA struct HofGfx *sHofGfxPtr = NULL; extern bool8 gHasHallOfFameRecords; @@ -203,7 +203,7 @@ static const struct CompressedSpritePalette sHallOfFame_ConfettiSpritePalette = static const u8 sUnused1[8] = {}; -static const s16 sHallOfFame_MonsFullTeamPositions[6][4] = +static const s16 sHallOfFame_MonFullTeamPositions[6][4] = { {120, 210, 120, 40}, {326, 220, 56, 40}, @@ -213,7 +213,7 @@ static const s16 sHallOfFame_MonsFullTeamPositions[6][4] = {310, -92, 40, 88} }; -static const s16 sHallOfFame_MonsHalfTeamPositions[3][4] = +static const s16 sHallOfFame_MonHalfTeamPositions[3][4] = { {120, 234, 120, 64}, {326, 244, 56, 64}, @@ -554,7 +554,7 @@ static bool8 InitHallOfFameScreen(void) #define tDontSaveData data[0] #define tDisplayedMonId data[1] -#define tPokesNumber data[2] +#define tMonNumber data[2] #define tFrameCount data[3] #define tPlayerSpriteID data[4] #define tMonSpriteId(i) data[i + 5] @@ -565,7 +565,7 @@ void CB2_DoHallOfFameScreen(void) { u8 taskId = CreateTask(Task_Hof_InitMonData, 0); gTasks[taskId].tDontSaveData = FALSE; - sHofMonsPtr = AllocZeroed(sizeof(*sHofMonsPtr)); + sHofMonPtr = AllocZeroed(sizeof(*sHofMonPtr)); } } @@ -575,7 +575,7 @@ void CB2_DoHallOfFameScreenDontSaveData(void) { u8 taskId = CreateTask(Task_Hof_InitMonData, 0); gTasks[taskId].tDontSaveData = TRUE; - sHofMonsPtr = AllocZeroed(sizeof(*sHofMonsPtr)); + sHofMonPtr = AllocZeroed(sizeof(*sHofMonPtr)); } } @@ -583,31 +583,31 @@ static void Task_Hof_InitMonData(u8 taskId) { u16 i, j; - gTasks[taskId].tPokesNumber = 0; // valid pokes + gTasks[taskId].tMonNumber = 0; // valid pokes for (i = 0; i < 6; i++) { u8 nick[POKEMON_NAME_LENGTH + 2]; if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES)) { - sHofMonsPtr->mons[i].species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); - sHofMonsPtr->mons[i].tid = GetMonData(&gPlayerParty[i], MON_DATA_OT_ID); - sHofMonsPtr->mons[i].personality = GetMonData(&gPlayerParty[i], MON_DATA_PERSONALITY); - sHofMonsPtr->mons[i].lvl = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL); + sHofMonPtr->mon[i].species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); + sHofMonPtr->mon[i].tid = GetMonData(&gPlayerParty[i], MON_DATA_OT_ID); + sHofMonPtr->mon[i].personality = GetMonData(&gPlayerParty[i], MON_DATA_PERSONALITY); + sHofMonPtr->mon[i].lvl = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL); GetMonData(&gPlayerParty[i], MON_DATA_NICKNAME, nick); for (j = 0; j < POKEMON_NAME_LENGTH; j++) { - sHofMonsPtr->mons[i].nick[j] = nick[j]; + sHofMonPtr->mon[i].nick[j] = nick[j]; } - gTasks[taskId].tPokesNumber++; + gTasks[taskId].tMonNumber++; } else { - sHofMonsPtr->mons[i].species = 0; - sHofMonsPtr->mons[i].tid = 0; - sHofMonsPtr->mons[i].personality = 0; - sHofMonsPtr->mons[i].lvl = 0; - sHofMonsPtr->mons[i].nick[0] = EOS; + sHofMonPtr->mon[i].species = 0; + sHofMonPtr->mon[i].tid = 0; + sHofMonPtr->mon[i].personality = 0; + sHofMonPtr->mon[i].lvl = 0; + sHofMonPtr->mon[i].nick[0] = EOS; } } @@ -629,7 +629,7 @@ static void Task_Hof_InitMonData(u8 taskId) static void Task_Hof_InitTeamSaveData(u8 taskId) { u16 i; - struct HallofFameMons* lastSavedTeam = (struct HallofFameMons*)(gDecompressionBuffer); + struct HallofFameTeam* lastSavedTeam = (struct HallofFameTeam*)(gDecompressionBuffer); if (!gHasHallOfFameRecords) { @@ -643,13 +643,13 @@ static void Task_Hof_InitTeamSaveData(u8 taskId) for (i = 0; i < HALL_OF_FAME_MAX_TEAMS; i++, lastSavedTeam++) { - if (lastSavedTeam->mons[0].species == 0) + if (lastSavedTeam->mon[0].species == 0) break; } if (i >= HALL_OF_FAME_MAX_TEAMS) { - struct HallofFameMons *afterTeam = (struct HallofFameMons*)(gDecompressionBuffer); - struct HallofFameMons *beforeTeam = (struct HallofFameMons*)(gDecompressionBuffer); + struct HallofFameTeam *afterTeam = (struct HallofFameTeam*)(gDecompressionBuffer); + struct HallofFameTeam *beforeTeam = (struct HallofFameTeam*)(gDecompressionBuffer); afterTeam++; for (i = 0; i < HALL_OF_FAME_MAX_TEAMS - 1; i++, beforeTeam++, afterTeam++) { @@ -657,7 +657,7 @@ static void Task_Hof_InitTeamSaveData(u8 taskId) } lastSavedTeam--; } - *lastSavedTeam = *sHofMonsPtr; + *lastSavedTeam = *sHofMonPtr; sub_81973C4(0, 0); AddTextPrinterParametrized(0, 1, gText_SavingDontTurnOffPower, 0, NULL, 2, 1, 3); @@ -676,8 +676,8 @@ static void Task_Hof_TrySaveData(u8 taskId) if (sHofGfxPtr != NULL) FREE_AND_SET_NULL(sHofGfxPtr); - if (sHofMonsPtr != NULL) - FREE_AND_SET_NULL(sHofMonsPtr); + if (sHofMonPtr != NULL) + FREE_AND_SET_NULL(sHofMonPtr); DestroyTask(taskId); } @@ -712,21 +712,21 @@ static void Task_Hof_DisplayMon(u8 taskId) s16 xPos, yPos, field4, field6; u16 currMonId = gTasks[taskId].tDisplayedMonId; - struct HallofFameMon* currMon = &sHofMonsPtr->mons[currMonId]; + struct HallofFameMon* currMon = &sHofMonPtr->mon[currMonId]; - if (gTasks[taskId].tPokesNumber > 3) + if (gTasks[taskId].tMonNumber > 3) { - xPos = sHallOfFame_MonsFullTeamPositions[currMonId][0]; - yPos = sHallOfFame_MonsFullTeamPositions[currMonId][1]; - field4 = sHallOfFame_MonsFullTeamPositions[currMonId][2]; - field6 = sHallOfFame_MonsFullTeamPositions[currMonId][3]; + xPos = sHallOfFame_MonFullTeamPositions[currMonId][0]; + yPos = sHallOfFame_MonFullTeamPositions[currMonId][1]; + field4 = sHallOfFame_MonFullTeamPositions[currMonId][2]; + field6 = sHallOfFame_MonFullTeamPositions[currMonId][3]; } else { - xPos = sHallOfFame_MonsHalfTeamPositions[currMonId][0]; - yPos = sHallOfFame_MonsHalfTeamPositions[currMonId][1]; - field4 = sHallOfFame_MonsHalfTeamPositions[currMonId][2]; - field6 = sHallOfFame_MonsHalfTeamPositions[currMonId][3]; + xPos = sHallOfFame_MonHalfTeamPositions[currMonId][0]; + yPos = sHallOfFame_MonHalfTeamPositions[currMonId][1]; + field4 = sHallOfFame_MonHalfTeamPositions[currMonId][2]; + field6 = sHallOfFame_MonHalfTeamPositions[currMonId][3]; } if (currMon->species == SPECIES_EGG) @@ -746,7 +746,7 @@ static void Task_Hof_DisplayMon(u8 taskId) static void Task_Hof_PrintMonInfoAfterAnimating(u8 taskId) { u16 currMonId = gTasks[taskId].tDisplayedMonId; - struct HallofFameMon* currMon = &sHofMonsPtr->mons[currMonId]; + struct HallofFameMon* currMon = &sHofMonPtr->mon[currMonId]; struct Sprite *monSprite = &gSprites[gTasks[taskId].tMonSpriteId(currMonId)]; if (monSprite->callback == SpriteCallbackDummy) @@ -761,7 +761,7 @@ static void Task_Hof_PrintMonInfoAfterAnimating(u8 taskId) static void Task_Hof_TryDisplayAnotherMon(u8 taskId) { u16 currPokeID = gTasks[taskId].tDisplayedMonId; - struct HallofFameMon* currMon = &sHofMonsPtr->mons[currPokeID]; + struct HallofFameMon* currMon = &sHofMonPtr->mon[currPokeID]; if (gTasks[taskId].tFrameCount != 0) { @@ -917,8 +917,8 @@ static void Task_Hof_HandleExit(u8 taskId) if (sHofGfxPtr != NULL) FREE_AND_SET_NULL(sHofGfxPtr); - if (sHofMonsPtr != NULL) - FREE_AND_SET_NULL(sHofMonsPtr); + if (sHofMonPtr != NULL) + FREE_AND_SET_NULL(sHofMonPtr); SetCallback2AfterHallOfFameDisplay(); } @@ -931,15 +931,15 @@ static void SetCallback2AfterHallOfFameDisplay(void) #undef tDontSaveData #undef tDisplayedPoke -#undef tPokesNumber +#undef tMonNumber #undef tFrameCount #undef tPlayerSpriteID #undef tMonSpriteId #define tCurrTeamNo data[0] #define tCurrPageNo data[1] -#define tCurrPokeId data[2] -#define tPokesNo data[4] +#define tCurrMonId data[2] +#define tMonNo data[4] #define tMonSpriteId(i) data[i + 5] void CB2_DoHallOfFamePC(void) @@ -967,8 +967,8 @@ void CB2_DoHallOfFamePC(void) case 3: if (!sub_8175024()) { - struct HallofFameMons *fameMons = (struct HallofFameMons*)(gDecompressionBuffer); - fameMons->mons[0] = sDummyFameMon; + struct HallofFameTeam *fameTeam = (struct HallofFameTeam*)(gDecompressionBuffer); + fameTeam->mon[0] = sDummyFameMon; sub_80F9BCC(0, 0, 0); SetVBlankCallback(VBlankCB_HallOfFame); gMain.state++; @@ -996,7 +996,7 @@ void CB2_DoHallOfFamePC(void) gTasks[taskId].tMonSpriteId(i) = 0xFF; } - sHofMonsPtr = AllocZeroed(0x2000); + sHofMonPtr = AllocZeroed(0x2000); SetMainCallback2(CB2_HallOfFame); } break; @@ -1013,13 +1013,13 @@ static void Task_HofPC_CopySaveData(u8 taskId) else { u16 i; - struct HallofFameMons* savedTeams; + struct HallofFameTeam* savedTeams; - CpuCopy16(gDecompressionBuffer, sHofMonsPtr, 0x2000); - savedTeams = sHofMonsPtr; + CpuCopy16(gDecompressionBuffer, sHofMonPtr, 0x2000); + savedTeams = sHofMonPtr; for (i = 0; i < HALL_OF_FAME_MAX_TEAMS; i++, savedTeams++) { - if (savedTeams->mons[0].species == SPECIES_NONE) + if (savedTeams->mon[0].species == SPECIES_NONE) break; } @@ -1036,25 +1036,25 @@ static void Task_HofPC_CopySaveData(u8 taskId) static void Task_HofPC_DrawSpritesPrintText(u8 taskId) { - struct HallofFameMons* savedTeams = sHofMonsPtr; + struct HallofFameTeam* savedTeams = sHofMonPtr; struct HallofFameMon* currMon; u16 i; for (i = 0; i < gTasks[taskId].tCurrTeamNo; i++) savedTeams++; - currMon = &savedTeams->mons[0]; + currMon = &savedTeams->mon[0]; gUnknown_0203BCD4 = 0; - gTasks[taskId].tCurrPokeId = 0; - gTasks[taskId].tPokesNo = 0; + gTasks[taskId].tCurrMonId = 0; + gTasks[taskId].tMonNo = 0; for (i = 0; i < 6; i++, currMon++) { if (currMon->species != 0) - gTasks[taskId].tPokesNo++; + gTasks[taskId].tMonNo++; } - currMon = &savedTeams->mons[0]; + currMon = &savedTeams->mon[0]; for (i = 0; i < 6; i++, currMon++) { @@ -1063,15 +1063,15 @@ static void Task_HofPC_DrawSpritesPrintText(u8 taskId) u16 spriteId; s16 posX, posY; - if (gTasks[taskId].tPokesNo > 3) + if (gTasks[taskId].tMonNo > 3) { - posX = sHallOfFame_MonsFullTeamPositions[i][2]; - posY = sHallOfFame_MonsFullTeamPositions[i][3]; + posX = sHallOfFame_MonFullTeamPositions[i][2]; + posY = sHallOfFame_MonFullTeamPositions[i][3]; } else { - posX = sHallOfFame_MonsHalfTeamPositions[i][2]; - posY = sHallOfFame_MonsHalfTeamPositions[i][3]; + posX = sHallOfFame_MonHalfTeamPositions[i][2]; + posY = sHallOfFame_MonHalfTeamPositions[i][3]; } if (currMon->species == SPECIES_EGG) @@ -1102,7 +1102,7 @@ static void Task_HofPC_DrawSpritesPrintText(u8 taskId) static void Task_HofPC_PrintMonInfo(u8 taskId) { - struct HallofFameMons* savedTeams = sHofMonsPtr; + struct HallofFameTeam* savedTeams = sHofMonPtr; struct HallofFameMon* currMon; u16 i; u16 currMonID; @@ -1117,12 +1117,12 @@ static void Task_HofPC_PrintMonInfo(u8 taskId) gSprites[spriteId].oam.priority = 1; } - currMonID = gTasks[taskId].tMonSpriteId(gTasks[taskId].tCurrPokeId); + currMonID = gTasks[taskId].tMonSpriteId(gTasks[taskId].tCurrMonId); gSprites[currMonID].oam.priority = 0; gUnknown_0203BCD4 = (0x10000 << gSprites[currMonID].oam.paletteNum) ^ 0xFFFF0000; BlendPalettesUnfaded(gUnknown_0203BCD4, 0xC, 0x63B0); - currMon = &savedTeams->mons[gTasks[taskId].tCurrPokeId]; + currMon = &savedTeams->mon[gTasks[taskId].tCurrMonId]; if (currMon->species != SPECIES_EGG) { StopCryAndClearCrySongs(); @@ -1174,25 +1174,25 @@ static void Task_HofPC_HandleInput(u8 taskId) } gTasks[taskId].func = Task_HofPC_HandlePaletteOnExit; } - else if (gMain.newKeys & DPAD_UP && gTasks[taskId].tCurrPokeId != 0) // change mon -1 + else if (gMain.newKeys & DPAD_UP && gTasks[taskId].tCurrMonId != 0) // change mon -1 { - gTasks[taskId].tCurrPokeId--; + gTasks[taskId].tCurrMonId--; gTasks[taskId].func = Task_HofPC_PrintMonInfo; } - else if (gMain.newKeys & DPAD_DOWN && gTasks[taskId].tCurrPokeId < gTasks[taskId].tPokesNo - 1) // change mon +1 + else if (gMain.newKeys & DPAD_DOWN && gTasks[taskId].tCurrMonId < gTasks[taskId].tMonNo - 1) // change mon +1 { - gTasks[taskId].tCurrPokeId++; + gTasks[taskId].tCurrMonId++; gTasks[taskId].func = Task_HofPC_PrintMonInfo; } } static void Task_HofPC_HandlePaletteOnExit(u8 taskId) { - struct HallofFameMons* fameMons; + struct HallofFameTeam* fameTeam; CpuCopy16(gPlttBufferFaded, gPlttBufferUnfaded, 0x400); - fameMons = (struct HallofFameMons*)(gDecompressionBuffer); - fameMons->mons[0] = sDummyFameMon; + fameTeam = (struct HallofFameTeam*)(gDecompressionBuffer); + fameTeam->mon[0] = sDummyFameMon; sub_80F9BF4(0, 0, 0); gTasks[taskId].func = Task_HofPC_HandleExit; } @@ -1225,8 +1225,8 @@ static void Task_HofPC_HandleExit(u8 taskId) if (sHofGfxPtr != NULL) FREE_AND_SET_NULL(sHofGfxPtr); - if (sHofMonsPtr != NULL) - FREE_AND_SET_NULL(sHofMonsPtr); + if (sHofMonPtr != NULL) + FREE_AND_SET_NULL(sHofMonPtr); sub_8137C3C(); } @@ -1249,8 +1249,8 @@ static void Task_HofPC_ExitOnButtonPress(u8 taskId) #undef tCurrTeamNo #undef tCurrPageNo -#undef tCurrPokeId -#undef tPokesNo +#undef tCurrMonId +#undef tMonNo #undef tMonSpriteId static void HallOfFame_PrintWelcomeText(u8 unusedPossiblyWindowId, u8 unused2) diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 27da8b18e..01dfc954a 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -1234,12 +1234,12 @@ static void sub_806E6CC(u8 taskId) DestroyTask(taskId); } -const u8 *pokemon_get_pal(struct Pokemon *mon) +const u8 *GetMonFrontSpritePal(struct Pokemon *mon) { u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0); u32 otId = GetMonData(mon, MON_DATA_OT_ID, 0); u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, 0); - return species_and_otid_get_pal(species, otId, personality); + return GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality); } // Extracts the upper 16 bits of a 32-bit number @@ -1248,7 +1248,7 @@ const u8 *pokemon_get_pal(struct Pokemon *mon) // Extracts the lower 16 bits of a 32-bit number #define LOHALF(n) ((n) & 0xFFFF) -const u8 *species_and_otid_get_pal(u16 species, u32 otId, u32 personality) +const u8 *GetFrontSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 personality) { u32 shinyValue; diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c index 002f4f069..3177a8946 100644 --- a/src/reshow_battle_screen.c +++ b/src/reshow_battle_screen.c @@ -37,8 +37,8 @@ extern const union AnimCmd * const * const gMonAnimationsSpriteAnimsPtrTable[]; extern void dp12_8087EA4(void); extern void trs_config(void); extern bool8 IsDoubleBattle(void); -extern u8 sub_80A614C(u8 bank); -extern u8 sub_80A6138(u8 bank); +extern u8 GetSubstituteSpriteDefault_Y(u8 bank); +extern u8 GetBankSpriteDefault_Y(u8 bank); extern u8 sub_80A82E4(u8 bank); extern void sub_806A068(u16 species, u8 bankIdentity); extern void sub_806A12C(u16 backPicId, u8 bankIdentity); @@ -104,7 +104,7 @@ static void CB2_ReshowBattleScreenAfterMenu(void) gReservedSpritePaletteCount = 4; break; case 5: - sub_805E350(); + ClearSpritesHealthboxAnimData(); break; case 6: if (BattleLoadAllHealthBoxesGfx(gBattleScripting.reshowHelperState)) @@ -217,7 +217,7 @@ static bool8 LoadBankSpriteGfx(u8 bank) if (!gBattleSpritesDataPtr->bankData[bank].behindSubstitute) BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank); else - BattleLoadSubstituteSpriteGfx(bank, FALSE); + BattleLoadSubstituteOrMonSpriteGfx(bank, FALSE); } else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI && bank == 0) DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, bank); @@ -226,7 +226,7 @@ static bool8 LoadBankSpriteGfx(u8 bank) else if (!gBattleSpritesDataPtr->bankData[bank].behindSubstitute) BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[bank]], bank); else - BattleLoadSubstituteSpriteGfx(bank, FALSE); + BattleLoadSubstituteOrMonSpriteGfx(bank, FALSE); gBattleScripting.reshowHelperState = 0; } @@ -250,9 +250,9 @@ static void CreateBankSprite(u8 bank) u8 posY; if (gBattleSpritesDataPtr->bankData[bank].behindSubstitute) - posY = sub_80A614C(bank); + posY = GetSubstituteSpriteDefault_Y(bank); else - posY = sub_80A6138(bank); + posY = GetBankSpriteDefault_Y(bank); if (GetBankSide(bank) != SIDE_PLAYER) {