diff --git a/asm/battle_controller_linkopponent.s b/asm/battle_controller_linkopponent.s index cda07f31f..2c52c2b16 100644 --- a/asm/battle_controller_linkopponent.s +++ b/asm/battle_controller_linkopponent.s @@ -5954,7 +5954,7 @@ _080677B4: subs r4, 0x2 adds r3, r4 ldrb r3, [r3] - bl sub_80735DC + bl CreatePartyStatusSummarySprites ldr r2, =gUnknown_020244B4 ldrb r1, [r5] adds r1, r2 diff --git a/asm/battle_controller_linkpartner.s b/asm/battle_controller_linkpartner.s index 071f66787..a97dae84c 100644 --- a/asm/battle_controller_linkpartner.s +++ b/asm/battle_controller_linkpartner.s @@ -5349,7 +5349,7 @@ _0814DE08: subs r4, 0x2 adds r3, r4 ldrb r3, [r3] - bl sub_80735DC + bl CreatePartyStatusSummarySprites ldr r2, =gUnknown_020244B4 ldrb r1, [r5] adds r1, r2 diff --git a/asm/battle_controller_opponent.s b/asm/battle_controller_opponent.s index 82f705e01..cad8d0f56 100644 --- a/asm/battle_controller_opponent.s +++ b/asm/battle_controller_opponent.s @@ -6409,7 +6409,7 @@ _080629B4: subs r4, 0x2 adds r3, r4 ldrb r3, [r3] - bl sub_80735DC + bl CreatePartyStatusSummarySprites ldr r2, =gUnknown_020244B4 ldrb r1, [r5] adds r1, r2 diff --git a/asm/battle_controller_player.s b/asm/battle_controller_player.s index 653746f54..ff3dd459c 100644 --- a/asm/battle_controller_player.s +++ b/asm/battle_controller_player.s @@ -403,7 +403,7 @@ _080577DC: ands r0, r2 cmp r0, 0 beq _080577E8 - bl sub_8073314 + bl SwapHpBarsWithHpText _080577E8: pop {r4-r7} pop {r0} @@ -10038,7 +10038,7 @@ _0805CDA4: subs r4, 0x2 adds r3, r4 ldrb r3, [r3] - bl sub_80735DC + bl CreatePartyStatusSummarySprites ldr r2, =gUnknown_020244B4 ldrb r1, [r5] adds r1, r2 diff --git a/asm/battle_controller_player_partner.s b/asm/battle_controller_player_partner.s index 4231b0167..dba618f01 100644 --- a/asm/battle_controller_player_partner.s +++ b/asm/battle_controller_player_partner.s @@ -6082,7 +6082,7 @@ _081BE404: subs r4, 0x2 adds r3, r4 ldrb r3, [r3] - bl sub_80735DC + bl CreatePartyStatusSummarySprites ldr r2, =gUnknown_020244B4 ldrb r1, [r5] adds r1, r2 diff --git a/asm/battle_controller_recorded_opponent.s b/asm/battle_controller_recorded_opponent.s index 8c0f52ffa..fa6b8f511 100644 --- a/asm/battle_controller_recorded_opponent.s +++ b/asm/battle_controller_recorded_opponent.s @@ -5693,7 +5693,7 @@ _081896E4: subs r4, 0x2 adds r3, r4 ldrb r3, [r3] - bl sub_80735DC + bl CreatePartyStatusSummarySprites ldr r2, =gUnknown_020244B4 ldrb r1, [r5] adds r1, r2 diff --git a/asm/battle_controller_recorded_player.s b/asm/battle_controller_recorded_player.s index 2b71e13ba..8e3db1ffb 100644 --- a/asm/battle_controller_recorded_player.s +++ b/asm/battle_controller_recorded_player.s @@ -5878,7 +5878,7 @@ _0818CD60: subs r4, 0x2 adds r3, r4 ldrb r3, [r3] - bl sub_80735DC + bl CreatePartyStatusSummarySprites ldr r2, =gUnknown_020244B4 ldrb r1, [r5] adds r1, r2 diff --git a/asm/battle_controller_wally.s b/asm/battle_controller_wally.s index ddceb87e6..9ca0c6bf2 100644 --- a/asm/battle_controller_wally.s +++ b/asm/battle_controller_wally.s @@ -4645,7 +4645,7 @@ _0816ACA8: subs r3, 0x2 adds r4, r3 ldrb r3, [r4] - bl sub_80735DC + bl CreatePartyStatusSummarySprites ldr r2, =gUnknown_020244B4 ldrb r1, [r5] adds r1, r2 diff --git a/asm/battle_interface.s b/asm/battle_interface.s index e0a766a5d..6f91c86b6 100755 --- a/asm/battle_interface.s +++ b/asm/battle_interface.s @@ -7,2203 +7,6 @@ - thumb_func_start sub_80730D4 -sub_80730D4: @ 80730D4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x14] - ldr r1, =gUnknown_0832C3C4 - mov r0, sp - movs r2, 0x14 - bl memcpy - ldr r1, =gSprites - ldr r2, [sp, 0x14] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrh r0, [r0, 0x3A] - lsls r0, 24 - lsrs r0, 24 - bl GetBankIdentity - ldr r1, =gMonSpritesGfxPtr - ldr r2, [r1] - movs r3, 0xBA - lsls r3, 1 - adds r2, r3 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 7 - movs r0, 0xA4 - lsls r0, 3 - adds r1, r0 - ldr r0, [r2] - adds r6, r0, r1 - movs r1, 0x5 - mov r8, r1 - adds r0, r4, 0 - bl GetNature - lsls r0, 24 - mov r4, sp - adds r4, 0x6 - ldr r1, =gNatureNamePointers - lsrs r0, 22 - adds r0, r1 - ldr r1, [r0] - adds r0, r4, 0 - bl StringCopy - adds r0, r6, 0 - movs r1, 0x9 - mov r2, sp - bl RenderTextFont9 - movs r7, 0x6 - movs r5, 0 - mov r2, sp - adds r2, 0x9 - str r2, [sp, 0x1C] -_08073158: - mov r3, sp - adds r0, r3, r7 - ldrb r1, [r0] - adds r0, r1, 0 - subs r0, 0x37 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x13 - bls _08073176 - adds r0, r1, 0 - adds r0, 0x79 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x13 - bhi _0807318C -_08073176: - movs r0, 0x2C - b _080731AA - .pool -_0807318C: - adds r0, r1, 0 - subs r0, 0x4B - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bls _080731A4 - adds r0, r1, 0 - adds r0, 0x65 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bhi _080731A8 -_080731A4: - movs r0, 0x2D - b _080731AA -_080731A8: - movs r0, 0x2B -_080731AA: - bl GetHealthboxElementGfxPtr - lsls r1, r5, 6 - adds r1, r6, r1 - ldr r2, =0x04000008 - bl CpuSet - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - adds r7, 0x1 - cmp r5, r8 - bcc _08073158 - movs r7, 0x1 - ldr r0, [sp, 0x14] - lsls r0, 4 - str r0, [sp, 0x18] - movs r1, 0x1 - add r1, r8 - mov r9, r1 - cmp r7, r9 - bge _08073236 - ldr r1, =gSprites - ldr r2, =0x04000008 - mov r10, r2 - ldr r3, [sp, 0x14] - adds r0, r3 - lsls r0, 2 - adds r0, r1 - mov r8, r0 -_080731E6: - mov r1, r8 - ldrh r0, [r1, 0x4] - lsls r0, 22 - lsrs r0, 22 - adds r5, r7, 0 - cmp r7, 0 - bge _080731F6 - adds r5, r7, 0x7 -_080731F6: - asrs r5, 3 - lsls r4, r5, 3 - subs r4, r7, r4 - adds r0, r4 - lsls r5, 6 - adds r0, r5 - lsls r0, 5 - ldr r2, =0x06010000 - adds r1, r0, r2 - adds r0, r6, 0 - mov r2, r10 - bl CpuSet - adds r6, 0x20 - mov r3, r8 - ldrh r0, [r3, 0x4] - lsls r0, 22 - lsrs r0, 22 - adds r4, 0x8 - adds r0, r4 - adds r0, r5 - lsls r0, 5 - ldr r2, =0x06010000 - adds r1, r0, r2 - adds r0, r6, 0 - mov r2, r10 - bl CpuSet - adds r6, 0x20 - adds r7, 0x1 - cmp r7, r9 - blt _080731E6 -_08073236: - ldr r6, =gSprites - ldr r3, [sp, 0x18] - ldr r1, [sp, 0x14] - adds r0, r3, r1 - lsls r0, 2 - adds r0, r6 - ldrh r4, [r0, 0x38] - lsls r4, 24 - lsrs r4, 24 - ldr r5, =gBattleStruct - ldr r0, [r5] - adds r0, 0x7C - ldrb r1, [r0] - mov r0, sp - adds r0, 0x6 - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r0, [r5] - adds r0, 0x7B - ldrb r1, [r0] - ldr r0, [sp, 0x1C] - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - mov r1, sp - movs r0, 0 - strb r0, [r1, 0x5] - movs r0, 0xBA - strb r0, [r1, 0x8] - ldr r5, =gMonSpritesGfxPtr - ldr r0, [r5] - movs r2, 0xBA - lsls r2, 1 - adds r0, r2 - ldr r0, [r0] - movs r1, 0x9 - mov r2, sp - bl RenderTextFont9 - movs r7, 0 - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r6, r0, r6 - movs r4, 0x20 -_08073296: - cmp r7, 0x1 - bgt _080732D4 - ldr r0, [r5] - movs r3, 0xBA - lsls r3, 1 - adds r0, r3 - ldr r0, [r0] - adds r0, r4 - ldrh r1, [r6, 0x4] - lsls r1, 22 - lsrs r1, 22 - adds r2, r7, 0x2 - adds r1, r2 - lsls r1, 5 - ldr r2, =0x06010000 - adds r1, r2 - ldr r2, =0x04000008 - bl CpuSet - b _080732F4 - .pool -_080732D4: - ldr r0, [r5] - movs r3, 0xBA - lsls r3, 1 - adds r0, r3 - ldr r0, [r0] - adds r0, r4 - ldrh r1, [r6, 0x4] - lsls r1, 22 - lsrs r1, 22 - adds r1, r7, r1 - lsls r1, 5 - ldr r2, =0x060100c0 - adds r1, r2 - ldr r2, =0x04000008 - bl CpuSet -_080732F4: - adds r4, 0x40 - adds r7, 0x1 - cmp r7, 0x4 - ble _08073296 - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80730D4 - - thumb_func_start sub_8073314 -sub_8073314: @ 8073314 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - movs r0, 0 - mov r9, r0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r9, r0 - blt _0807332E - b _080735BA -_0807332E: - ldr r1, =gSprites - mov r10, r1 - ldr r2, =gBattlePartyID - mov r8, r2 -_08073336: - ldr r0, =gHealthBoxesIds - mov r1, r9 - adds r6, r1, r0 - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - mov r1, r10 - adds r1, 0x1C - adds r0, r1 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _08073354 - b _080735A8 -_08073354: - mov r2, r9 - lsls r0, r2, 24 - lsrs r7, r0, 24 - adds r0, r7, 0 - bl GetBankSide - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0807336A - b _080735A8 -_0807336A: - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - bne _08073382 - adds r0, r7, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _08073382 - b _080735A8 -_08073382: - ldr r5, =gBattleSpritesDataPtr - ldr r0, [r5] - ldr r3, [r0] - mov r0, r9 - lsls r4, r0, 2 - adds r3, r4, r3 - ldr r0, [r3] - lsls r0, 27 - lsrs r0, 31 - movs r2, 0x1 - eors r2, r0 - lsls r2, 4 - mov r12, r2 - ldrb r0, [r3] - movs r2, 0x11 - negs r2, r2 - adds r1, r2, 0 - ands r0, r1 - mov r1, r12 - orrs r0, r1 - strb r0, [r3] - ldr r0, [r5] - ldr r0, [r0] - adds r4, r0 - ldr r0, [r4] - lsls r0, 27 - lsrs r4, r0, 31 - adds r0, r7, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _080734B0 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - bne _080733D0 - b _080735A8 -_080733D0: - ldr r0, =gBattleTypeFlags - ldr r2, [r0] - movs r0, 0x80 - ands r2, r0 - cmp r2, 0 - beq _080733DE - b _080735A8 -_080733DE: - cmp r4, 0x1 - bne _08073468 - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r10 - ldrh r0, [r0, 0x38] - lsls r0, 24 - lsrs r1, r0, 24 - str r2, [sp] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r10 - ldrh r1, [r0, 0x4] - lsls r1, 22 - lsrs r1, 17 - ldr r2, =0x06010000 - adds r1, r2 - mov r0, sp - ldr r2, =0x05000040 - bl CpuSet - ldrb r4, [r6] - mov r1, r8 - ldrh r0, [r1] - movs r2, 0x64 - muls r0, r2 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x39 - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - asrs r1, 16 - adds r0, r4, 0 - movs r2, 0 - bl UpdateHpTextInHealthboxInDoubles - ldrb r4, [r6] - mov r2, r8 - ldrh r0, [r2] - movs r1, 0x64 - muls r0, r1 - ldr r2, =gPlayerParty - b _08073536 - .pool -_08073468: - ldrb r0, [r6] - bl draw_status_ailment_maybe - ldrb r0, [r6] - mov r2, r8 - ldrh r1, [r2] - movs r2, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0x5 - bl UpdateHealthboxAttribute - movs r0, 0x75 - bl GetHealthboxElementGfxPtr - ldrb r2, [r6] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r10 - ldrh r1, [r1, 0x4] - lsls r1, 22 - lsrs r1, 17 - ldr r2, =0x06010680 - adds r1, r2 - ldr r2, =0x04000008 - bl CpuSet - b _08073592 - .pool -_080734B0: - cmp r4, 0x1 - bne _0807355C - ldr r0, =gBattleTypeFlags - ldr r2, [r0] - movs r0, 0x80 - ands r2, r0 - cmp r2, 0 - beq _080734DC - ldrb r0, [r6] - mov r2, r8 - ldrh r1, [r2] - movs r2, 0x64 - muls r1, r2 - ldr r2, =gEnemyParty - adds r1, r2 - bl sub_80730D4 - b _08073592 - .pool -_080734DC: - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r10 - ldrh r0, [r0, 0x38] - lsls r0, 24 - lsrs r1, r0, 24 - str r2, [sp] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r10 - ldrh r1, [r0, 0x4] - lsls r1, 22 - lsrs r1, 17 - ldr r0, =0x06010000 - adds r1, r0 - mov r0, sp - ldr r2, =0x05000040 - bl CpuSet - ldrb r4, [r6] - mov r1, r8 - ldrh r0, [r1] - movs r2, 0x64 - muls r0, r2 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x39 - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - asrs r1, 16 - adds r0, r4, 0 - movs r2, 0 - bl UpdateHpTextInHealthboxInDoubles - ldrb r4, [r6] - mov r2, r8 - ldrh r0, [r2] - movs r1, 0x64 - muls r0, r1 - ldr r2, =gEnemyParty -_08073536: - adds r0, r2 - movs r1, 0x3A - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - asrs r1, 16 - adds r0, r4, 0 - movs r2, 0x1 - bl UpdateHpTextInHealthboxInDoubles - b _08073592 - .pool -_0807355C: - ldrb r0, [r6] - bl draw_status_ailment_maybe - ldrb r0, [r6] - mov r2, r8 - ldrh r1, [r2] - movs r5, 0x64 - muls r1, r5 - ldr r4, =gEnemyParty - adds r1, r4 - movs r2, 0x5 - bl UpdateHealthboxAttribute - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08073592 - ldrb r0, [r6] - mov r2, r8 - ldrh r1, [r2] - muls r1, r5 - adds r1, r4 - movs r2, 0x4 - bl UpdateHealthboxAttribute -_08073592: - ldr r0, =gHealthBoxesIds - add r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r10 - ldrh r1, [r0, 0x3C] - movs r2, 0x1 - eors r1, r2 - strh r1, [r0, 0x3C] -_080735A8: - movs r0, 0x2 - add r8, r0 - movs r1, 0x1 - add r9, r1 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r9, r0 - bge _080735BA - b _08073336 -_080735BA: - 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_8073314 - - thumb_func_start sub_80735DC -sub_80735DC: @ 80735DC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x24 - str r1, [sp, 0xC] - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x8] - lsls r2, 24 - lsrs r2, 24 - adds r4, r2, 0 - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0x10] - cmp r4, 0 - beq _0807360C - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - beq _0807365C -_0807360C: - ldr r0, [sp, 0x8] - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _08073630 - movs r0, 0 - mov r9, r0 - movs r5, 0x88 - movs r4, 0x60 - movs r1, 0x64 - mov r10, r1 - ldr r2, =0x0000fffb - mov r8, r2 - b _0807366C - .pool -_08073630: - movs r3, 0x1 - mov r9, r3 - cmp r4, 0 - beq _08073642 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - bne _08073648 -_08073642: - movs r5, 0x68 - movs r4, 0x28 - b _0807364C -_08073648: - movs r5, 0x68 - movs r4, 0x10 -_0807364C: - ldr r6, =0x0000ff9c - mov r10, r6 - movs r0, 0x5 - mov r8, r0 - b _0807366C - .pool -_0807365C: - movs r1, 0x1 - mov r9, r1 - movs r5, 0x68 - movs r4, 0x28 - ldr r2, =0x0000ff9c - mov r10, r2 - movs r3, 0x5 - mov r8, r3 -_0807366C: - ldr r0, =gUnknown_0832C334 - bl LoadCompressedObjectPicUsingHeap - ldr r0, =gUnknown_0832C34C - bl LoadSpriteSheet - ldr r0, =gUnknown_0832C33C - bl LoadSpritePalette - ldr r0, =gUnknown_0832C344 - bl LoadSpritePalette - mov r0, r9 - lsls r6, r0, 1 - adds r0, r6, r0 - lsls r0, 3 - ldr r1, =gUnknown_0832C364 - adds r0, r1 - lsls r5, 16 - asrs r1, r5, 16 - lsls r4, 16 - asrs r2, r4, 16 - movs r3, 0xA - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x14] - lsls r0, 4 - ldr r1, [sp, 0x14] - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r7, r0, r1 - ldr r1, =gUnknown_0832C2C4 - adds r0, r7, 0 - bl SetSubspriteTables - mov r2, r10 - strh r2, [r7, 0x24] - mov r3, r8 - strh r3, [r7, 0x2E] - str r5, [sp, 0x1C] - str r4, [sp, 0x20] - mov r5, r9 - cmp r5, 0 - beq _08073700 - ldrh r0, [r7, 0x20] - subs r0, 0x60 - strh r0, [r7, 0x20] - ldrb r1, [r7, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - movs r1, 0x10 - orrs r0, r1 - strb r0, [r7, 0x3] - b _08073706 - .pool -_08073700: - ldrh r0, [r7, 0x20] - adds r0, 0x60 - strh r0, [r7, 0x20] -_08073706: - movs r0, 0 - mov r8, r0 - ldr r1, =gSprites - mov r10, r1 - mov r7, sp - mov r2, r9 - adds r0, r6, r2 - lsls r0, 3 - str r0, [sp, 0x18] - movs r6, 0xA - movs r5, 0 -_0807371C: - ldr r0, =gUnknown_0832C394 - ldr r3, [sp, 0x20] - ldr r1, =0xfffc0000 - adds r2, r3, r1 - ldr r3, [sp, 0x18] - adds r0, r3, r0 - ldr r3, [sp, 0x1C] - asrs r1, r3, 16 - asrs r2, 16 - movs r3, 0x9 - bl CreateSpriteAtEnd - strb r0, [r7] - ldr r0, [sp, 0x10] - cmp r0, 0 - bne _0807374C - ldrb r0, [r7] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r2, =gSprites + 0x1C - adds r1, r2 - ldr r0, =sub_80741C8 - str r0, [r1] -_0807374C: - ldr r4, =gSprites - mov r3, r9 - cmp r3, 0 - bne _0807376E - ldrb r1, [r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r10 - strh r3, [r0, 0x24] - ldrb r1, [r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r10 - mov r1, r9 - strh r1, [r0, 0x26] -_0807376E: - ldrb r1, [r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0 - mov r2, sp - ldrh r2, [r2, 0x14] - strh r2, [r0, 0x2E] - mov r3, r9 - cmp r3, 0 - bne _080737C8 - ldrb r0, [r7] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldrh r0, [r1, 0x20] - adds r0, 0x18 - adds r0, r5 - strh r0, [r1, 0x20] - ldrb r1, [r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r6, [r0, 0x30] - ldrb r1, [r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x78 - b _0807380A - .pool -_080737C8: - ldrb r0, [r7] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r4 - ldrh r3, [r2, 0x20] - subs r3, 0x18 - movs r1, 0x5 - mov r0, r8 - subs r1, r0 - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 1 - subs r3, r0 - strh r3, [r2, 0x20] - ldrb r0, [r7] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r4 - movs r1, 0x6 - mov r3, r8 - subs r1, r3 - lsls r0, r1, 3 - subs r0, r1 - adds r0, 0xA - strh r0, [r2, 0x30] - ldrb r1, [r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ff88 -_0807380A: - strh r1, [r0, 0x24] - ldrb r1, [r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - mov r1, r9 - strh r1, [r0, 0x32] - adds r7, 0x1 - adds r6, 0x7 - adds r5, 0xA - movs r2, 0x1 - add r8, r2 - mov r3, r8 - cmp r3, 0x5 - bgt _0807382C - b _0807371C -_0807382C: - ldr r0, [sp, 0x8] - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - beq _0807383A - b _080739E8 -_0807383A: - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - movs r2, 0x40 - ands r1, r2 - cmp r1, 0 - beq _080738F4 - ldr r5, =0x0000ffff - mov r10, r5 - ldr r6, =gSprites - ldr r0, =0x000003ff - adds r7, r0, 0 - ldr r1, =0xfffffc00 - mov r9, r1 - mov r4, sp - ldr r5, [sp, 0xC] - movs r2, 0x5 - mov r8, r2 -_0807385C: - ldrh r0, [r5] - cmp r0, r10 - bne _080738A8 - ldrb r0, [r4] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r6 - ldrh r3, [r2, 0x4] - lsls r1, r3, 22 - lsrs r1, 22 - adds r1, 0x1 - ands r1, r7 - mov r0, r9 - ands r0, r3 - orrs r0, r1 - strh r0, [r2, 0x4] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0x1 - strh r1, [r0, 0x3C] - b _080738E2 - .pool -_080738A8: - cmp r0, 0 - bne _080738C0 - ldrb r0, [r4] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r6 - ldrh r3, [r2, 0x4] - lsls r1, r3, 22 - lsrs r1, 22 - adds r1, 0x3 - b _080738D8 -_080738C0: - ldr r0, [r5, 0x4] - cmp r0, 0 - beq _080738E2 - ldrb r0, [r4] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r6 - ldrh r3, [r2, 0x4] - lsls r1, r3, 22 - lsrs r1, 22 - adds r1, 0x2 -_080738D8: - ands r1, r7 - mov r0, r9 - ands r0, r3 - orrs r0, r1 - strh r0, [r2, 0x4] -_080738E2: - adds r4, 0x1 - adds r5, 0x8 - movs r3, 0x1 - negs r3, r3 - add r8, r3 - mov r0, r8 - cmp r0, 0 - bge _0807385C - b _08073B9A -_080738F4: - movs r1, 0x5 - mov r10, r1 - movs r7, 0 - ldr r2, =gSprites - mov r8, r2 - ldr r3, =0x000003ff - mov r9, r3 - ldr r5, =0xfffffc00 - mov r12, r5 - ldr r6, [sp, 0xC] - mov r5, sp -_0807390A: - ldrh r0, [r6] - ldr r1, =0x0000ffff - cmp r0, r1 - bne _08073958 - mov r4, sp - add r4, r10 - ldrb r0, [r4] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - add r2, r8 - ldrh r3, [r2, 0x4] - lsls r1, r3, 22 - lsrs r1, 22 - adds r1, 0x1 - mov r0, r9 - ands r1, r0 - mov r0, r12 - ands r0, r3 - orrs r0, r1 - strh r0, [r2, 0x4] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r8 - movs r1, 0x1 - strh r1, [r0, 0x3C] - subs r1, 0x2 - add r10, r1 - b _080739DE - .pool -_08073958: - cmp r0, 0 - bne _08073970 - ldrb r0, [r5] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - add r2, r8 - ldrh r3, [r2, 0x4] - lsls r1, r3, 22 - lsrs r1, 22 - adds r1, 0x3 - b _080739D0 -_08073970: - ldr r1, =gBattleTypeFlags - ldr r0, [r1] - movs r1, 0x80 - lsls r1, 11 - ands r0, r1 - cmp r0, 0 - beq _080739B8 - ldr r0, =gBattleStruct - ldr r0, [r0] - movs r2, 0xA8 - lsls r2, 2 - adds r0, r2 - ldrb r1, [r0] - ldr r2, =gBitTable - lsls r0, r7, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _080739B8 - ldrb r0, [r5] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - add r2, r8 - ldrh r3, [r2, 0x4] - lsls r1, r3, 22 - lsrs r1, 22 - adds r1, 0x3 - b _080739D0 - .pool -_080739B8: - ldr r0, [r6, 0x4] - cmp r0, 0 - beq _080739DC - ldrb r0, [r5] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - add r2, r8 - ldrh r3, [r2, 0x4] - lsls r1, r3, 22 - lsrs r1, 22 - adds r1, 0x2 -_080739D0: - mov r0, r9 - ands r1, r0 - mov r0, r12 - ands r0, r3 - orrs r0, r1 - strh r0, [r2, 0x4] -_080739DC: - adds r5, 0x1 -_080739DE: - adds r6, 0x8 - adds r7, 0x1 - cmp r7, 0x5 - ble _0807390A - b _08073B9A -_080739E8: - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - ldr r2, =0x00008040 - ands r1, r2 - cmp r1, 0 - beq _08073AA4 - ldr r1, =0x0000ffff - mov r10, r1 - ldr r6, =gSprites - ldr r2, =0x000003ff - adds r7, r2, 0 - ldr r3, =0xfffffc00 - mov r9, r3 - ldr r5, [sp, 0xC] - mov r4, sp - adds r4, 0x5 - movs r0, 0x5 - mov r8, r0 -_08073A0C: - ldrh r0, [r5] - cmp r0, r10 - bne _08073A58 - ldrb r0, [r4] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r6 - ldrh r3, [r2, 0x4] - lsls r1, r3, 22 - lsrs r1, 22 - adds r1, 0x1 - ands r1, r7 - mov r0, r9 - ands r0, r3 - orrs r0, r1 - strh r0, [r2, 0x4] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0x1 - strh r1, [r0, 0x3C] - b _08073A92 - .pool -_08073A58: - cmp r0, 0 - bne _08073A70 - ldrb r0, [r4] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r6 - ldrh r3, [r2, 0x4] - lsls r1, r3, 22 - lsrs r1, 22 - adds r1, 0x3 - b _08073A88 -_08073A70: - ldr r0, [r5, 0x4] - cmp r0, 0 - beq _08073A92 - ldrb r0, [r4] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r6 - ldrh r3, [r2, 0x4] - lsls r1, r3, 22 - lsrs r1, 22 - adds r1, 0x2 -_08073A88: - ands r1, r7 - mov r0, r9 - ands r0, r3 - orrs r0, r1 - strh r0, [r2, 0x4] -_08073A92: - subs r4, 0x1 - adds r5, 0x8 - movs r1, 0x1 - negs r1, r1 - add r8, r1 - mov r2, r8 - cmp r2, 0 - bge _08073A0C - b _08073B9A -_08073AA4: - movs r3, 0 - mov r8, r3 - movs r7, 0 - ldr r5, =gSprites - mov r9, r5 - ldr r6, =0x000003ff - mov r12, r6 - ldr r0, =0xfffffc00 - mov r10, r0 - ldr r6, [sp, 0xC] - mov r5, sp - adds r5, 0x5 -_08073ABC: - ldrh r0, [r6] - ldr r1, =0x0000ffff - cmp r0, r1 - bne _08073B08 - mov r4, sp - add r4, r8 - ldrb r0, [r4] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - add r2, r9 - ldrh r3, [r2, 0x4] - lsls r1, r3, 22 - lsrs r1, 22 - adds r1, 0x1 - mov r0, r12 - ands r1, r0 - mov r0, r10 - ands r0, r3 - orrs r0, r1 - strh r0, [r2, 0x4] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r9 - movs r1, 0x1 - strh r1, [r0, 0x3C] - add r8, r1 - b _08073B92 - .pool -_08073B08: - cmp r0, 0 - bne _08073B20 - ldrb r0, [r5] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - add r2, r9 - ldrh r3, [r2, 0x4] - lsls r1, r3, 22 - lsrs r1, 22 - adds r1, 0x3 - b _08073B84 -_08073B20: - ldr r1, =gBattleTypeFlags - ldr r0, [r1] - movs r1, 0x80 - lsls r1, 11 - ands r0, r1 - cmp r0, 0 - beq _08073B6C - ldr r2, =gBattleStruct - ldr r0, [r2] - ldr r3, =0x000002a1 - adds r0, r3 - ldrb r1, [r0] - lsls r0, r7, 2 - ldr r2, =gBitTable - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _08073B6C - ldrb r0, [r5] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - add r2, r9 - ldrh r3, [r2, 0x4] - lsls r1, r3, 22 - lsrs r1, 22 - adds r1, 0x3 - b _08073B84 - .pool -_08073B6C: - ldr r0, [r6, 0x4] - cmp r0, 0 - beq _08073B90 - ldrb r0, [r5] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - add r2, r9 - ldrh r3, [r2, 0x4] - lsls r1, r3, 22 - lsrs r1, 22 - adds r1, 0x2 -_08073B84: - mov r0, r12 - ands r1, r0 - mov r0, r10 - ands r0, r3 - orrs r0, r1 - strh r0, [r2, 0x4] -_08073B90: - subs r5, 0x1 -_08073B92: - adds r6, 0x8 - adds r7, 0x1 - cmp r7, 0x5 - ble _08073ABC -_08073B9A: - ldr r0, =TaskDummy - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r4, r0, 24 - ldr r2, =gTasks - lsls r3, r4, 2 - adds r1, r3, r4 - lsls r1, 3 - adds r0, r1, r2 - mov r5, sp - ldrh r5, [r5, 0x8] - strh r5, [r0, 0x8] - mov r6, sp - ldrh r6, [r6, 0x14] - strh r6, [r0, 0xA] - movs r0, 0 - mov r8, r0 - adds r0, r2, 0 - adds r0, 0xE - adds r1, r0 -_08073BC6: - mov r0, sp - add r0, r8 - ldrb r0, [r0] - strh r0, [r1] - adds r1, 0x2 - movs r5, 0x1 - add r8, r5 - mov r6, r8 - cmp r6, 0x5 - ble _08073BC6 - adds r0, r3, r4 - lsls r0, 3 - adds r0, r2 - mov r1, sp - ldrh r1, [r1, 0x10] - strh r1, [r0, 0x1C] - ldr r2, [sp, 0x10] - cmp r2, 0 - beq _08073C0A - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r3, [r0, 0x8] - ldrb r2, [r3, 0x9] - lsls r1, r2, 27 - lsrs r1, 29 - adds r1, 0x1 - movs r0, 0x7 - ands r1, r0 - lsls r1, 2 - movs r0, 0x1D - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x9] -_08073C0A: - movs r0, 0x72 - movs r1, 0 - bl PlaySE12WithPanning - adds r0, r4, 0 - add sp, 0x24 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80735DC - - thumb_func_start sub_8073C30 -sub_8073C30: @ 8073C30 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r2, =gTasks - lsls r3, r0, 2 - adds r1, r3, r0 - lsls r1, 3 - adds r0, r1, r2 - ldrb r7, [r0, 0x1C] - ldrb r4, [r0, 0xA] - mov r10, r4 - ldrb r0, [r0, 0x8] - str r0, [sp, 0x8] - movs r5, 0 - str r3, [sp, 0xC] - adds r2, 0xE - adds r2, r1, r2 -_08073C5E: - mov r0, sp - adds r1, r0, r5 - ldrh r0, [r2] - strb r0, [r1] - adds r2, 0x2 - adds r5, 0x1 - cmp r5, 0x5 - ble _08073C5E - movs r1, 0xFD - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0x10 - bl SetGpuReg - ldr r1, =gTasks - ldr r0, [sp, 0xC] - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x10 - strh r1, [r0, 0x26] - movs r5, 0 - mov r1, r10 - lsls r1, 4 - str r1, [sp, 0x10] - ldr r3, =gSprites - movs r6, 0xD - negs r6, r6 - mov r12, r3 - movs r4, 0x4 -_08073CA0: - mov r2, sp - adds r0, r2, r5 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - ldrb r2, [r1, 0x1] - adds r0, r6, 0 - ands r0, r2 - orrs r0, r4 - strb r0, [r1, 0x1] - adds r5, 0x1 - cmp r5, 0x5 - ble _08073CA0 - ldr r2, [sp, 0x10] - add r2, r10 - lsls r2, 2 - add r2, r12 - ldrb r1, [r2, 0x1] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2, 0x1] - cmp r7, 0 - bne _08073CDA - b _08073DE0 -_08073CDA: - movs r5, 0 - mov r6, r12 - mov r9, r5 - adds r3, r6, 0 - adds r3, 0x1C - mov r4, sp - movs r7, 0 -_08073CE8: - ldr r0, [sp, 0x8] - str r3, [sp, 0x14] - bl GetBankSide - lsls r0, 24 - lsrs r2, r0, 24 - ldr r3, [sp, 0x14] - cmp r2, 0 - beq _08073D4C - movs r0, 0x5 - subs r0, r5 - mov r1, sp - adds r2, r1, r0 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - strh r7, [r0, 0x30] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - mov r1, r9 - strh r1, [r0, 0x34] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - mov r1, r9 - strh r1, [r0, 0x36] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldr r1, =sub_8074158 - str r1, [r0] - ldr r2, =gSprites - mov r12, r2 - b _08073D82 - .pool -_08073D4C: - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - strh r7, [r0, 0x30] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - strh r2, [r0, 0x34] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - strh r2, [r0, 0x36] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldr r1, =sub_8074158 - str r1, [r0] - ldr r0, =gSprites - mov r12, r0 -_08073D82: - adds r4, 0x1 - adds r7, 0x7 - adds r5, 0x1 - cmp r5, 0x5 - ble _08073CE8 - ldr r3, [sp, 0x10] - add r3, r10 - lsls r3, 2 - mov r1, r12 - adds r0, r3, r1 - movs r2, 0x2E - ldrsh r1, [r0, r2] - lsrs r2, r1, 31 - adds r1, r2 - asrs r1, 1 - movs r2, 0 - strh r1, [r0, 0x2E] - strh r2, [r0, 0x30] - mov r1, r12 - adds r1, 0x1C - adds r3, r1 - ldr r1, =sub_8074090 - str r1, [r3] - ldr r1, =gUnknown_0832C2CC - bl SetSubspriteTables - ldr r1, =gTasks - ldr r0, [sp, 0xC] - add r0, r8 - lsls r0, 3 - adds r0, r1 - ldr r1, =task_battle_throw_own_ball - str r1, [r0] - b _08073DEE - .pool -_08073DE0: - ldr r0, =gTasks - ldr r1, [sp, 0xC] - add r1, r8 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_8073F98 - str r0, [r1] -_08073DEE: - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8073C30 - - thumb_func_start task_battle_throw_own_ball -task_battle_throw_own_ball: @ 8073E08 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 - ldrh r0, [r4, 0x1E] - adds r1, r0, 0x1 - strh r1, [r4, 0x1E] - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08073E48 - ldrh r0, [r4, 0x26] - subs r1, r0, 0x1 - strh r1, [r4, 0x26] - lsls r0, r1, 16 - cmp r0, 0 - blt _08073E54 - movs r0, 0x10 - subs r0, r1 - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg -_08073E48: - movs r1, 0x26 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08073E54 - ldr r0, =sub_8073E64 - str r0, [r4] -_08073E54: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_battle_throw_own_ball - - thumb_func_start sub_8073E64 -sub_8073E64: @ 8073E64 - push {r4-r7,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r7, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r3, r0, 3 - adds r4, r3, r7 - ldrb r2, [r4, 0x8] - ldrh r0, [r4, 0x26] - subs r0, 0x1 - strh r0, [r4, 0x26] - lsls r0, 16 - asrs r1, r0, 16 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - bne _08073F54 - ldrb r5, [r4, 0xA] - movs r4, 0 - ldr r6, =gBattleSpritesDataPtr - adds r0, r7, 0 - adds r0, 0xE - adds r2, r3, r0 -_08073E96: - mov r0, sp - adds r1, r0, r4 - ldrh r0, [r2] - strb r0, [r1] - adds r2, 0x2 - adds r4, 0x1 - cmp r4, 0x5 - ble _08073E96 - ldr r0, [r6] - ldr r3, [r0, 0x8] - ldrb r2, [r3, 0x9] - lsls r1, r2, 27 - lsrs r1, 29 - subs r1, 0x1 - movs r0, 0x7 - ands r1, r0 - lsls r1, 2 - movs r0, 0x1D - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x9] - ldr r0, [r6] - ldr r0, [r0, 0x8] - ldrb r1, [r0, 0x9] - movs r0, 0x1C - ands r0, r1 - cmp r0, 0 - bne _08073EFC - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl DestroySpriteAndFreeResources - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySpriteAndFreeResources - b _08073F32 - .pool -_08073EFC: - lsls r4, r5, 4 - adds r4, r5 - lsls r4, 2 - ldr r5, =gSprites - adds r4, r5 - adds r0, r4, 0 - bl FreeSpriteOamMatrix - adds r0, r4, 0 - bl DestroySprite - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl FreeSpriteOamMatrix - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl DestroySprite -_08073F32: - movs r4, 0x1 - ldr r5, =gSprites -_08073F36: - mov r1, sp - adds r0, r1, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl DestroySprite - adds r4, 0x1 - cmp r4, 0x5 - ble _08073F36 - b _08073F8A - .pool -_08073F54: - movs r0, 0x3 - negs r0, r0 - cmp r1, r0 - bne _08073F8A - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - adds r0, r5, 0 - bl DestroyTask -_08073F8A: - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8073E64 - - thumb_func_start sub_8073F98 -sub_8073F98: @ 8073F98 - push {r4-r7,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - adds r4, r0, 0 - ldr r7, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r6, r0, 3 - adds r3, r6, r7 - ldrb r5, [r3, 0x8] - ldrh r0, [r3, 0x26] - subs r1, r0, 0x1 - strh r1, [r3, 0x26] - lsls r0, r1, 16 - asrs r2, r0, 16 - cmp r2, 0 - blt _08073FD4 - movs r0, 0x10 - subs r0, r1 - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - b _0807406A - .pool -_08073FD4: - movs r0, 0x1 - negs r0, r0 - cmp r2, r0 - bne _08074034 - ldrb r3, [r3, 0xA] - movs r5, 0 - adds r0, r7, 0 - adds r0, 0xE - adds r2, r6, r0 -_08073FE6: - mov r0, sp - adds r1, r0, r5 - ldrh r0, [r2] - strb r0, [r1] - adds r2, 0x2 - adds r5, 0x1 - cmp r5, 0x5 - ble _08073FE6 - lsls r0, r3, 4 - adds r0, r3 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl DestroySpriteAndFreeResources - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySpriteAndFreeResources - movs r5, 0x1 -_08074016: - mov r1, sp - adds r0, r1, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - adds r5, 0x1 - cmp r5, 0x5 - ble _08074016 - b _0807406A - .pool -_08074034: - movs r0, 0x3 - negs r0, r0 - cmp r2, r0 - bne _0807406A - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x4] - lsls r1, r5, 1 - adds r1, r5 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - adds r0, r4, 0 - bl DestroyTask -_0807406A: - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8073F98 - - thumb_func_start sub_8074078 -sub_8074078: @ 8074078 - push {lr} - adds r1, r0, 0 - ldrh r2, [r1, 0x24] - movs r3, 0x24 - ldrsh r0, [r1, r3] - cmp r0, 0 - beq _0807408C - ldrh r0, [r1, 0x2E] - adds r0, r2, r0 - strh r0, [r1, 0x24] -_0807408C: - pop {r0} - bx r0 - thumb_func_end sub_8074078 - - thumb_func_start sub_8074090 -sub_8074090: @ 8074090 - push {lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x30] - adds r1, r0, 0 - adds r1, 0x20 - strh r1, [r2, 0x30] - movs r3, 0x2E - ldrsh r0, [r2, r3] - cmp r0, 0 - ble _080740AE - lsls r0, r1, 16 - asrs r0, 20 - ldrh r1, [r2, 0x24] - adds r0, r1 - b _080740B6 -_080740AE: - lsls r1, 16 - asrs r1, 20 - ldrh r0, [r2, 0x24] - subs r0, r1 -_080740B6: - strh r0, [r2, 0x24] - ldrh r1, [r2, 0x30] - movs r0, 0xF - ands r0, r1 - strh r0, [r2, 0x30] - pop {r0} - bx r0 - thumb_func_end sub_8074090 - - thumb_func_start sub_80740C4 -sub_80740C4: @ 80740C4 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x30] - movs r2, 0x30 - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _080740D8 - subs r0, r1, 0x1 - strh r0, [r4, 0x30] - b _0807414E -_080740D8: - ldrh r0, [r4, 0x32] - lsls r0, 24 - lsrs r3, r0, 24 - ldrh r2, [r4, 0x34] - adds r0, r2, 0 - adds r0, 0x38 - lsls r1, r0, 16 - lsrs r2, r1, 16 - ldr r0, =0x0000fff0 - ands r2, r0 - strh r2, [r4, 0x34] - cmp r3, 0 - beq _0807410C - lsrs r0, r1, 20 - ldrh r1, [r4, 0x24] - adds r0, r1 - strh r0, [r4, 0x24] - lsls r0, 16 - cmp r0, 0 - ble _0807411C - movs r0, 0 - strh r0, [r4, 0x24] - b _0807411C - .pool -_0807410C: - lsrs r1, 20 - ldrh r0, [r4, 0x24] - subs r0, r1 - strh r0, [r4, 0x24] - lsls r0, 16 - cmp r0, 0 - bge _0807411C - strh r3, [r4, 0x24] -_0807411C: - movs r2, 0x24 - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _0807414E - movs r1, 0x3F - cmp r3, 0 - beq _0807412C - movs r1, 0xC0 -_0807412C: - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _08074140 - lsls r1, 24 - asrs r1, 24 - movs r0, 0x74 - bl PlaySE2WithPanning - b _0807414A -_08074140: - lsls r1, 24 - asrs r1, 24 - movs r0, 0x73 - bl PlaySE1WithPanning -_0807414A: - ldr r0, =SpriteCallbackDummy - str r0, [r4, 0x1C] -_0807414E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80740C4 - - thumb_func_start sub_8074158 -sub_8074158: @ 8074158 - push {r4,lr} - adds r3, r0, 0 - ldrh r1, [r3, 0x30] - movs r2, 0x30 - ldrsh r0, [r3, r2] - cmp r0, 0 - ble _0807416C - subs r0, r1, 0x1 - strh r0, [r3, 0x30] - b _080741BC -_0807416C: - ldrh r0, [r3, 0x32] - lsls r0, 24 - ldrh r2, [r3, 0x34] - adds r1, r2, 0 - adds r1, 0x38 - lsls r4, r1, 16 - lsrs r2, r4, 16 - ldr r1, =0x0000fff0 - ands r2, r1 - strh r2, [r3, 0x34] - cmp r0, 0 - beq _08074190 - lsrs r0, r4, 20 - ldrh r1, [r3, 0x24] - adds r0, r1 - b _08074196 - .pool -_08074190: - lsrs r1, r4, 20 - ldrh r0, [r3, 0x24] - subs r0, r1 -_08074196: - strh r0, [r3, 0x24] - movs r2, 0x24 - ldrsh r0, [r3, r2] - movs r2, 0x20 - ldrsh r1, [r3, r2] - adds r0, r1 - adds r0, 0x8 - movs r1, 0x80 - lsls r1, 1 - cmp r0, r1 - bls _080741BC - adds r2, r3, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r0, =SpriteCallbackDummy - str r0, [r3, 0x1C] -_080741BC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8074158 - - thumb_func_start sub_80741C8 -sub_80741C8: @ 80741C8 - ldrh r2, [r0, 0x2E] - lsls r2, 24 - lsrs r2, 24 - ldr r3, =gSprites - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r3 - ldrh r2, [r1, 0x24] - strh r2, [r0, 0x24] - ldrh r1, [r1, 0x26] - strh r1, [r0, 0x26] - bx lr - .pool - thumb_func_end sub_80741C8 - - thumb_func_start sub_80741E8 -sub_80741E8: @ 80741E8 - push {r4-r7,lr} - sub sp, 0x14 - adds r4, r1, 0 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r5, =gDisplayedStringBattle - ldr r1, =gText_HighlightDarkGrey - adds r0, r5, 0 - bl StringCopy - adds r0, r4, 0 - movs r1, 0x2 - add r2, sp, 0x4 - bl GetMonData - add r0, sp, 0x4 - bl StringGetEnd10 - adds r0, r5, 0 - add r1, sp, 0x4 - bl StringAppend - adds r5, r0, 0 - adds r0, r4, 0 - bl GetMonGender - lsls r0, 24 - lsrs r6, r0, 24 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - adds r1, r0, 0 - cmp r0, 0x1D - beq _08074236 - cmp r0, 0x20 - bne _0807424A -_08074236: - movs r0, 0xB - muls r1, r0 - ldr r0, =gSpeciesNames - adds r1, r0 - add r0, sp, 0x4 - bl StringCompare - cmp r0, 0 - bne _0807424A - movs r6, 0x64 -_0807424A: - cmp r6, 0 - beq _08074268 - cmp r6, 0xFE - beq _08074270 - ldr r1, =gText_DynColor2 - b _08074272 - .pool -_08074268: - ldr r1, =gText_DynColor2Male - b _08074272 - .pool -_08074270: - ldr r1, =gText_DynColor1Female -_08074272: - adds r0, r5, 0 - bl StringCopy - ldr r0, =gDisplayedStringBattle - add r1, sp, 0x10 - str r1, [sp] - movs r1, 0 - movs r2, 0x3 - movs r3, 0x2 - bl AddTextPrinterAndCreateWindowOnHealthbox - adds r6, r0, 0 - ldr r0, =gSprites - lsls r1, r7, 4 - adds r1, r7 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r1, 0x4] - lsls r0, 22 - lsrs r4, r0, 17 - ldrh r0, [r1, 0x3A] - lsls r0, 24 - lsrs r0, 24 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _080742F0 - ldr r1, =0x06010040 - adds r0, r4, r1 - adds r1, r6, 0 - movs r2, 0x6 - bl sub_8075198 - bl IsDoubleBattle - lsls r0, 24 - ldr r1, =0x06010400 - adds r5, r4, r1 - cmp r0, 0 - bne _080742C8 - ldr r0, =0x06010800 - adds r5, r4, r0 -_080742C8: - adds r1, r6, 0 - adds r1, 0xC0 - adds r0, r5, 0 - movs r2, 0x1 - bl sub_8075198 - b _080742FC - .pool -_080742F0: - ldr r1, =0x06010020 - adds r0, r4, r1 - adds r1, r6, 0 - movs r2, 0x7 - bl sub_8075198 -_080742FC: - ldr r0, [sp, 0x10] - bl RemoveWindow_ - add sp, 0x14 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80741E8 thumb_func_start sub_8074310 sub_8074310: @ 8074310 @@ -2305,8 +108,8 @@ _080743E6: .pool thumb_func_end sub_8074310 - thumb_func_start draw_status_ailment_maybe -draw_status_ailment_maybe: @ 80743F8 + thumb_func_start UpdateStatusIconInHealthbox +UpdateStatusIconInHealthbox: @ 80743F8 push {r4-r7,lr} mov r7, r10 mov r6, r9 @@ -2600,7 +403,7 @@ _0807467A: pop {r0} bx r0 .pool - thumb_func_end draw_status_ailment_maybe + thumb_func_end UpdateStatusIconInHealthbox thumb_func_start sub_80746A8 sub_80746A8: @ 80746A8 @@ -2981,7 +784,7 @@ _080749CE: _080749D6: adds r0, r6, 0 mov r1, r8 - bl sub_80741E8 + bl UpdateNickInHealthbox _080749DE: cmp r7, 0x9 beq _080749E6 @@ -2989,7 +792,7 @@ _080749DE: bne _080749EC _080749E6: adds r0, r6, 0 - bl draw_status_ailment_maybe + bl UpdateStatusIconInHealthbox _080749EC: cmp r7, 0xA bne _080749F6 @@ -3055,7 +858,7 @@ _08074A70: _08074A78: adds r0, r6, 0 mov r1, r8 - bl sub_80741E8 + bl UpdateNickInHealthbox _08074A80: cmp r7, 0x9 beq _08074A88 @@ -3063,7 +866,7 @@ _08074A80: bne _08074A8E _08074A88: adds r0, r6, 0 - bl draw_status_ailment_maybe + bl UpdateStatusIconInHealthbox _08074A8E: add sp, 0x4 pop {r3-r5} diff --git a/include/battle.h b/include/battle.h index 948111d43..ae7fa3ce4 100644 --- a/include/battle.h +++ b/include/battle.h @@ -883,6 +883,19 @@ struct BattleSpriteInfo struct BattleAnimationInfo { u16 field; // to fill up later + u8 field_2; + u8 field_3; + u8 field_4; + u8 field_5; + u8 field_6; + u8 field_7; + u8 field_8; + u8 field_9_x1 : 1; + u8 field_9_x2 : 1; + u8 field_9_x1C : 3; + u8 field_9_x20 : 1; + u8 field_9_x40 : 1; + u8 field_9_x80 : 1; }; struct BattleHealthboxInfo diff --git a/include/decompress.h b/include/decompress.h index 6c925f730..c3a771893 100644 --- a/include/decompress.h +++ b/include/decompress.h @@ -8,7 +8,7 @@ void LZDecompressVram(const void *src, void *dest); u16 LoadCompressedObjectPic(const struct CompressedSpriteSheet *src); void LoadCompressedObjectPicOverrideBuffer(const struct CompressedSpriteSheet *src, void *buffer); -bool8 LoadCompressedObjectPicUsingHeap(struct CompressedSpriteSheet* src); +bool8 LoadCompressedObjectPicUsingHeap(const struct CompressedSpriteSheet* src); void LoadCompressedObjectPalette(const struct CompressedSpritePalette *src); void LoadCompressedObjectPaletteOverrideBuffer(const struct CompressedSpritePalette *a, void *buffer); diff --git a/src/battle_interface.c b/src/battle_interface.c index e8ab8e478..9080b3905 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -6,9 +6,24 @@ #include "window.h" #include "string_util.h" #include "text.h" +#include "battle_controllers.h" +#include "sound.h" +#include "songs.h" +#include "decompress.h" +#include "task.h" +#include "util.h" +#include "gpu_regs.h" +#include "battle_message.h" +#include "species.h" extern bool8 IsDoubleBattle(void); extern u8 gBanksByIdentity[BATTLE_BANKS_COUNT]; +extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; +extern u8 gNoOfAllBanks; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; + +extern const u8 * const gNatureNamePointers[]; +extern const u8 gText_Slash[]; // this file's functions void sub_8072924(struct Sprite *sprite); @@ -20,6 +35,13 @@ void RemoveWindow_(u32 windowId); void sub_8075170(void *dest, u32 arg1, u32 arg2); void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent); void sub_807513C(void *dest, u32 arg1, u32 arg2); +void UpdateStatusIconInHealthbox(u8 healthboxSpriteId); +void sub_80741C8(struct Sprite *sprite); +void sub_8073E08(u8 taskId); +void sub_8073F98(u8 taskId); +void sub_8073E64(u8 taskId); +void sub_8074158(struct Sprite *sprite); +void sub_8074090(struct Sprite *sprite); // const rom data const struct OamData gUnknown_0832C138 = @@ -155,6 +177,15 @@ static const struct SpriteTemplate gUnknown_0832C1C0[4] = extern const u8 gUnknown_0832C3C4[0x14]; extern const u8 gUnknown_0832C3D8[0x14]; +extern const u32 gHealthboxElementsGfxTable[][8]; +extern const struct CompressedSpriteSheet gUnknown_0832C334; +extern const struct SpriteSheet gUnknown_0832C34C; +extern const struct SpritePalette gUnknown_0832C33C; +extern const struct SpritePalette gUnknown_0832C344; +extern const struct SpriteTemplate gUnknown_0832C364[2]; +extern const struct SpriteTemplate gUnknown_0832C394[2]; +extern const struct SubspriteTable gUnknown_0832C2C4; +extern const struct SubspriteTable gUnknown_0832C2CC; u8 sub_8072304(void) { @@ -574,8 +605,6 @@ u8 CreateSafariPlayerHealthboxSprites(void) return healthboxSpriteId_1; } -extern const u32 gHealthboxElementsGfxTable[][8]; - const u32 *GetHealthboxElementGfxPtr(u8 elementId) { return gHealthboxElementsGfxTable[elementId]; @@ -658,9 +687,6 @@ void nullsub_30(u8 healthboxSpriteId, bool8 isDoubleBattleBankOnly) } -extern u8 gNoOfAllBanks; -extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; - void UpdateOamPriorityInAllHealthboxes(u8 priority) { s32 i; @@ -827,8 +853,6 @@ void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent) } } -extern const u8 gText_Slash[]; - void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent) { u32 windowId, windowTileData, spriteTileNum; @@ -922,3 +946,639 @@ void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8 maxOrC } } } + +void sub_80730D4(u8 healthboxSpriteId, struct Pokemon *mon) +{ + u8 text[20]; + s32 j, var2; + u8 *fontPixels; + u8 i, var, nature, healthboxSpriteId_2; + + memcpy(text, gUnknown_0832C3C4, sizeof(gUnknown_0832C3C4)); + fontPixels = &gMonSpritesGfxPtr->fontPixels[0x520 + (GetBankIdentity(gSprites[healthboxSpriteId].data6) * 384)]; + var = 5; + nature = GetNature(mon); + StringCopy(text + 6, gNatureNamePointers[nature]); + RenderTextFont9(fontPixels, 9, text); + + for (j = 6, i = 0; i < var; i++, j++) + { + u8 elementId; + + if ((text[j] >= 55 && text[j] <= 74) || (text[j] >= 135 && text[j] <= 154)) + elementId = 44; + else if ((text[j] >= 75 && text[j] <= 79) || (text[j] >= 155 && text[j] <= 159)) + elementId = 45; + else + elementId = 43; + + CpuCopy32(GetHealthboxElementGfxPtr(elementId), fontPixels + (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; + + var2 = (8 + gSprites[healthboxSpriteId].oam.tileNum + (j - (j / 8 * 8)) + (j / 8 * 64)) * 32; + CpuCopy32(fontPixels, (void*)(OBJ_VRAM0) + (var2), 0x20); + fontPixels += 0x20; + } + + healthboxSpriteId_2 = gSprites[healthboxSpriteId].data5; + ConvertIntToDecimalStringN(text + 6, gBattleStruct->field_7C, STR_CONV_MODE_RIGHT_ALIGN, 2); + 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); + + j = healthboxSpriteId_2; // needed to match for some reason + for (j = 0; j < 5; j++) + { + if (j <= 1) + { + CpuCopy32(&gMonSpritesGfxPtr->fontPixels[0x40 * j + 0x20], + (void*)(OBJ_VRAM0) + (gSprites[healthboxSpriteId_2].oam.tileNum + 2 + j) * 32, + 32); + } + else + { + CpuCopy32(&gMonSpritesGfxPtr->fontPixels[0x40 * j + 0x20], + (void*)(OBJ_VRAM0 + 0xC0) + (j + gSprites[healthboxSpriteId_2].oam.tileNum) * 32, + 32); + } + } +} + +void SwapHpBarsWithHpText(void) +{ + s32 i; + u8 spriteId; + + for (i = 0; i < gNoOfAllBanks; i++) + { + if (gSprites[gHealthBoxesIds[i]].callback == SpriteCallbackDummy + && GetBankSide(i) != SIDE_OPPONENT + && (IsDoubleBattle() || GetBankSide(i) != SIDE_PLAYER)) + { + bool8 noBars; + + gBattleSpritesDataPtr->bankData[i].hpNumbersNoBars ^= 1; + noBars = gBattleSpritesDataPtr->bankData[i].hpNumbersNoBars; + if (GetBankSide(i) == SIDE_PLAYER) + { + if (!IsDoubleBattle()) + continue; + if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) + continue; + + if (noBars == TRUE) // bars to text + { + spriteId = gSprites[gHealthBoxesIds[i]].data5; + + CpuFill32(0, (void*)(OBJ_VRAM0 + gSprites[spriteId].oam.tileNum * 32), 0x100); + UpdateHpTextInHealthboxInDoubles(gHealthBoxesIds[i], GetMonData(&gPlayerParty[gBattlePartyID[i]], MON_DATA_HP), 0); + UpdateHpTextInHealthboxInDoubles(gHealthBoxesIds[i], GetMonData(&gPlayerParty[gBattlePartyID[i]], MON_DATA_MAX_HP), 1); + } + else // text to bars + { + UpdateStatusIconInHealthbox(gHealthBoxesIds[i]); + UpdateHealthboxAttribute(gHealthBoxesIds[i], &gPlayerParty[gBattlePartyID[i]], HEALTHBOX_HEALTH_BAR); + CpuCopy32(GetHealthboxElementGfxPtr(0x75), (void*)(OBJ_VRAM0 + 0x680 + gSprites[gHealthBoxesIds[i]].oam.tileNum * 32), 32); + } + } + else + { + if (noBars == TRUE) // bars to text + { + if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) + { + sub_80730D4(gHealthBoxesIds[i], &gEnemyParty[gBattlePartyID[i]]); + } + else + { + spriteId = gSprites[gHealthBoxesIds[i]].data5; + + CpuFill32(0, (void *)(OBJ_VRAM0 + gSprites[spriteId].oam.tileNum * 32), 0x100); + UpdateHpTextInHealthboxInDoubles(gHealthBoxesIds[i], GetMonData(&gEnemyParty[gBattlePartyID[i]], MON_DATA_HP), 0); + UpdateHpTextInHealthboxInDoubles(gHealthBoxesIds[i], GetMonData(&gEnemyParty[gBattlePartyID[i]], MON_DATA_MAX_HP), 1); + } + } + else // text to bars + { + UpdateStatusIconInHealthbox(gHealthBoxesIds[i]); + UpdateHealthboxAttribute(gHealthBoxesIds[i], &gEnemyParty[gBattlePartyID[i]], HEALTHBOX_HEALTH_BAR); + if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) + UpdateHealthboxAttribute(gHealthBoxesIds[i], &gEnemyParty[gBattlePartyID[i]], HEALTHBOX_NICK); + } + } + gSprites[gHealthBoxesIds[i]].data7 ^= 1; + } + } +} + +u8 CreatePartyStatusSummarySprites(u8 bank, struct HpAndStatus *partyInfo, u8 arg2, bool8 isBattleStart) +{ + bool8 isOpponent; + s16 bar_X, bar_Y, bar_pos2_X, bar_data0; + s32 i, j, var; + u8 barSpriteId; + u8 ballIconSpritesIds[6]; + u8 taskId; + + if (!arg2 || GetBankIdentity(bank) != IDENTITY_OPPONENT_MON2) + { + if (GetBankSide(bank) == SIDE_PLAYER) + { + isOpponent = FALSE; + bar_X = 136, bar_Y = 96; + bar_pos2_X = 100; + bar_data0 = -5; + } + else + { + isOpponent = TRUE; + + if (!arg2 || !IsDoubleBattle()) + bar_X = 104, bar_Y = 40; + else + bar_X = 104, bar_Y = 16; + + bar_pos2_X = -100; + bar_data0 = 5; + } + } + else + { + isOpponent = TRUE; + bar_X = 104, bar_Y = 40; + bar_pos2_X = -100; + bar_data0 = 5; + } + + LoadCompressedObjectPicUsingHeap(&gUnknown_0832C334); + LoadSpriteSheet(&gUnknown_0832C34C); + LoadSpritePalette(&gUnknown_0832C33C); + LoadSpritePalette(&gUnknown_0832C344); + + barSpriteId = CreateSprite(&gUnknown_0832C364[isOpponent], bar_X, bar_Y, 10); + SetSubspriteTables(&gSprites[barSpriteId], &gUnknown_0832C2C4); + gSprites[barSpriteId].pos2.x = bar_pos2_X; + gSprites[barSpriteId].data0 = bar_data0; + + if (isOpponent) + { + gSprites[barSpriteId].pos1.x -= 96; + gSprites[barSpriteId].oam.matrixNum = 8; + } + else + { + gSprites[barSpriteId].pos1.x += 96; + } + + for (i = 0; i < 6; i++) + { + ballIconSpritesIds[i] = CreateSpriteAtEnd(&gUnknown_0832C394[isOpponent], bar_X, bar_Y - 4, 9); + + if (!isBattleStart) + gSprites[ballIconSpritesIds[i]].callback = sub_80741C8; + + if (!isOpponent) + { + gSprites[ballIconSpritesIds[i]].pos2.x = 0; + gSprites[ballIconSpritesIds[i]].pos2.y = 0; + } + + gSprites[ballIconSpritesIds[i]].data0 = barSpriteId; + + if (!isOpponent) + { + gSprites[ballIconSpritesIds[i]].pos1.x += 10 * i + 24; + gSprites[ballIconSpritesIds[i]].data1 = i * 7 + 10; + gSprites[ballIconSpritesIds[i]].pos2.x = 120; + } + else + { + gSprites[ballIconSpritesIds[i]].pos1.x -= 10 * (5 - i) + 24; + gSprites[ballIconSpritesIds[i]].data1 = (6 - i) * 7 + 10; + gSprites[ballIconSpritesIds[i]].pos2.x = -120; + } + + gSprites[ballIconSpritesIds[i]].data2 = isOpponent; + } + + if (GetBankSide(bank) == SIDE_PLAYER) + { + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + { + for (i = 0; i < 6; i++) + { + if (partyInfo[i].hp == 0xFFFF) // empty slot or an egg + { + gSprites[ballIconSpritesIds[i]].oam.tileNum += 1; + gSprites[ballIconSpritesIds[i]].data7 = 1; + } + else if (partyInfo[i].hp == 0) // fainted mon + { + gSprites[ballIconSpritesIds[i]].oam.tileNum += 3; + } + else if (partyInfo[i].status != 0) // mon with major status + { + gSprites[ballIconSpritesIds[i]].oam.tileNum += 2; + } + } + } + else + { + for (i = 0, var = 5, j = 0; j < 6; j++) + { + if (partyInfo[j].hp == 0xFFFF) // empty slot or an egg + { + gSprites[ballIconSpritesIds[var]].oam.tileNum += 1; + gSprites[ballIconSpritesIds[var]].data7 = 1; + var--; + continue; + } + else if (partyInfo[j].hp == 0) // fainted mon + { + gSprites[ballIconSpritesIds[i]].oam.tileNum += 3; + } + else if (gBattleTypeFlags & BATTLE_TYPE_ARENA && gBattleStruct->field_2A0 & gBitTable[j]) // hmm...? + { + gSprites[ballIconSpritesIds[i]].oam.tileNum += 3; + } + else if (partyInfo[j].status != 0) // mon with major status + { + gSprites[ballIconSpritesIds[i]].oam.tileNum += 2; + } + i++; + } + } + } + else + { + if (gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_TWO_OPPONENTS)) + { + for (var = 5, i = 0; i < 6; i++) + { + if (partyInfo[i].hp == 0xFFFF) // empty slot or an egg + { + gSprites[ballIconSpritesIds[var]].oam.tileNum += 1; + gSprites[ballIconSpritesIds[var]].data7 = 1; + } + else if (partyInfo[i].hp == 0) // fainted mon + { + gSprites[ballIconSpritesIds[var]].oam.tileNum += 3; + } + else if (partyInfo[i].status != 0) // mon with major status + { + gSprites[ballIconSpritesIds[var]].oam.tileNum += 2; + } + var--; + } + } + else + { + for (var = 0, i = 0, j = 0; j < 6; j++) + { + if (partyInfo[j].hp == 0xFFFF) // empty slot or an egg + { + gSprites[ballIconSpritesIds[i]].oam.tileNum += 1; + gSprites[ballIconSpritesIds[i]].data7 = 1; + i++; + continue; + } + else if (partyInfo[j].hp == 0) // fainted mon + { + gSprites[ballIconSpritesIds[5 - var]].oam.tileNum += 3; + } + else if (gBattleTypeFlags & BATTLE_TYPE_ARENA && gBattleStruct->field_2A1 & gBitTable[j]) // hmm...? + { + gSprites[ballIconSpritesIds[5 - var]].oam.tileNum += 3; + } + else if (partyInfo[j].status != 0) // mon with major status + { + gSprites[ballIconSpritesIds[5 - var]].oam.tileNum += 2; + } + var++; + } + } + } + + taskId = CreateTask(TaskDummy, 5); + gTasks[taskId].data[0] = bank; + gTasks[taskId].data[1] = barSpriteId; + + for (i = 0; i < 6; i++) + gTasks[taskId].data[3 + i] = ballIconSpritesIds[i]; + + gTasks[taskId].data[10] = isBattleStart; + + if (isBattleStart) + { + gBattleSpritesDataPtr->animationData->field_9_x1C++; + } + + PlaySE12WithPanning(SE_TB_START, 0); + return taskId; +} + +void sub_8073C30(u8 taskId) +{ + u8 sp[6]; + u8 r7; + u8 r10; + u8 bank; + s32 i; + + r7 = gTasks[taskId].data[10]; + r10 = gTasks[taskId].data[1]; + bank = gTasks[taskId].data[0]; + + for (i = 0; i < 6; i++) + sp[i] = gTasks[taskId].data[3 + i]; + + SetGpuReg(REG_OFFSET_BLDCNT, 0x3F40); + SetGpuReg(REG_OFFSET_BLDALPHA, 0x10); + + gTasks[taskId].data[15] = 16; + + for (i = 0; i < 6; i++) + gSprites[sp[i]].oam.objMode = 1; + + gSprites[r10].oam.objMode = 1; + + if (r7 != 0) + { + for (i = 0; i < 6; i++) + { + if (GetBankSide(bank) != SIDE_PLAYER) + { + gSprites[sp[5 - i]].data1 = 7 * i; + gSprites[sp[5 - i]].data3 = 0; + gSprites[sp[5 - i]].data4 = 0; + gSprites[sp[5 - i]].callback = sub_8074158; + } + else + { + gSprites[sp[i]].data1 = 7 * i; + gSprites[sp[i]].data3 = 0; + gSprites[sp[i]].data4 = 0; + gSprites[sp[i]].callback = sub_8074158; + } + } + gSprites[r10].data0 /= 2; + gSprites[r10].data1 = 0; + gSprites[r10].callback = sub_8074090; + SetSubspriteTables(&gSprites[r10], &gUnknown_0832C2CC); + gTasks[taskId].func = sub_8073E08; + } + else + { + gTasks[taskId].func = sub_8073F98; + } +} + +void sub_8073E08(u8 taskId) +{ + u16 temp = gTasks[taskId].data[11]++; + + if (!(temp & 1)) + { + gTasks[taskId].data[15]--; + if (gTasks[taskId].data[15] < 0) + return; + + SetGpuReg(REG_OFFSET_BLDALPHA, (gTasks[taskId].data[15]) | ((16 - gTasks[taskId].data[15]) << 8)); + } + if (gTasks[taskId].data[15] == 0) + gTasks[taskId].func = sub_8073E64; +} + +void sub_8073E64(u8 taskId) +{ + u8 sp[6]; + s32 i; + + u8 bank = gTasks[taskId].data[0]; + gTasks[taskId].data[15]--; + if (gTasks[taskId].data[15] == -1) + { + u8 var = gTasks[taskId].data[1]; + + for (i = 0; i < 6; i++) + sp[i] = gTasks[taskId].data[3 + i]; + + gBattleSpritesDataPtr->animationData->field_9_x1C--; + if (!gBattleSpritesDataPtr->animationData->field_9_x1C) + { + DestroySpriteAndFreeResources(&gSprites[var]); + DestroySpriteAndFreeResources(&gSprites[sp[0]]); + } + else + { + FreeSpriteOamMatrix(&gSprites[var]); + DestroySprite(&gSprites[var]); + FreeSpriteOamMatrix(&gSprites[sp[0]]); + DestroySprite(&gSprites[sp[0]]); + } + + for (i = 1; i < 6; i++) + DestroySprite(&gSprites[sp[i]]); + } + else if (gTasks[taskId].data[15] == -3) + { + gBattleSpritesDataPtr->healthBoxesData[bank].flag_x1 = 0; + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + DestroyTask(taskId); + } +} + +void sub_8073F98(u8 taskId) +{ + u8 sp[6]; + s32 i; + + u8 bank = gTasks[taskId].data[0]; + gTasks[taskId].data[15]--; + if (gTasks[taskId].data[15] >= 0) + { + SetGpuReg(REG_OFFSET_BLDALPHA, (gTasks[taskId].data[15]) | ((16 - gTasks[taskId].data[15]) << 8)); + } + else if (gTasks[taskId].data[15] == -1) + { + u8 var = gTasks[taskId].data[1]; + + for (i = 0; i < 6; i++) + sp[i] = gTasks[taskId].data[3 + i]; + + DestroySpriteAndFreeResources(&gSprites[var]); + DestroySpriteAndFreeResources(&gSprites[sp[0]]); + + for (i = 1; i < 6; i++) + DestroySprite(&gSprites[sp[i]]); + } + else if (gTasks[taskId].data[15] == -3) + { + gBattleSpritesDataPtr->healthBoxesData[bank].flag_x1 = 0; + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + DestroyTask(taskId); + } +} + +void sub_8074078(struct Sprite *sprite) +{ + if (sprite->pos2.x != 0) + sprite->pos2.x += sprite->data0; +} + +void sub_8074090(struct Sprite *sprite) +{ + sprite->data1 += 32; + if (sprite->data0 > 0) + sprite->pos2.x += sprite->data1 >> 4; + else + sprite->pos2.x -= sprite->data1 >> 4; + sprite->data1 &= 0xF; +} + +void sub_80740C4(struct Sprite *sprite) +{ + u8 var1; + u16 var2; + s8 pan; + + if (sprite->data1 > 0) + { + sprite->data1--; + return; + } + var1 = sprite->data2; + var2 = sprite->data3; + var2 += 56; + sprite->data3 = var2 & 0xFFF0; + if (var1 != 0) + { + sprite->pos2.x += var2 >> 4; + if (sprite->pos2.x > 0) + sprite->pos2.x = 0; + } + else + { + sprite->pos2.x -= var2 >> 4; + if (sprite->pos2.x < 0) + sprite->pos2.x = 0; + } + if (sprite->pos2.x == 0) + { + pan = 63; + if (var1 != 0) + pan = -64; + if (sprite->data7 != 0) + PlaySE2WithPanning(SE_TB_KARA, pan); + else + PlaySE1WithPanning(SE_TB_KON, pan); + sprite->callback = SpriteCallbackDummy; + } +} + +void sub_8074158(struct Sprite *sprite) +{ + u8 var1; + u16 var2; + + if (sprite->data1 > 0) + { + sprite->data1--; + return; + } + var1 = sprite->data2; + var2 = sprite->data3; + var2 += 56; + sprite->data3 = var2 & 0xFFF0; + if (var1 != 0) + sprite->pos2.x += var2 >> 4; + else + sprite->pos2.x -= var2 >> 4; + if (sprite->pos2.x + sprite->pos1.x > 248 + || sprite->pos2.x + sprite->pos1.x < -8) + { + sprite->invisible = TRUE; + sprite->callback = SpriteCallbackDummy; + } +} + +void sub_80741C8(struct Sprite *sprite) +{ + u8 barSpriteId = sprite->data0; + + sprite->pos2.x = gSprites[barSpriteId].pos2.x; + sprite->pos2.y = gSprites[barSpriteId].pos2.y; +} + +extern const u8 gText_HighlightDarkGrey[]; +extern const u8 gText_DynColor2[]; +extern const u8 gText_DynColor2Male[]; +extern const u8 gText_DynColor1Female[]; +extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1]; + +void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon) +{ + u8 nickname[POKEMON_NAME_LENGTH + 1]; + void *ptr; + const u8 *genderTxt; + u32 windowId, windowTileData, spriteTileNum; + u16 species; + u8 gender; + + StringCopy(gDisplayedStringBattle, gText_HighlightDarkGrey); + GetMonData(mon, MON_DATA_NICKNAME, nickname); + StringGetEnd10(nickname); + ptr = StringAppend(gDisplayedStringBattle, nickname); + + gender = GetMonGender(mon); + species = GetMonData(mon, MON_DATA_SPECIES); + + if ((species == SPECIES_NIDORAN_F || species == SPECIES_NIDORAN_M) && StringCompare(nickname, gSpeciesNames[species]) == 0) + gender = 100; + + // AddTextPrinterAndCreateWindowOnHealthbox's arguments are the same in all 3 cases. + // It's possible they may have been different in early development phases. + switch (gender) + { + default: + StringCopy(ptr, gText_DynColor2); + windowTileData = AddTextPrinterAndCreateWindowOnHealthbox(gDisplayedStringBattle, 0, 3, 2, &windowId); + break; + case MON_MALE: + StringCopy(ptr, gText_DynColor2Male); + windowTileData = AddTextPrinterAndCreateWindowOnHealthbox(gDisplayedStringBattle, 0, 3, 2, &windowId); + break; + case MON_FEMALE: + StringCopy(ptr, gText_DynColor1Female); + windowTileData = AddTextPrinterAndCreateWindowOnHealthbox(gDisplayedStringBattle, 0, 3, 2, &windowId); + break; + } + + spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * 32; + + if (GetBankSide(gSprites[healthboxSpriteId].data6) == SIDE_PLAYER) + { + sub_8075198((void*)(0x6010040 + spriteTileNum), windowTileData, 6); + ptr = (void*)(OBJ_VRAM0); + if (!IsDoubleBattle()) + ptr += spriteTileNum + 0x800; + else + ptr += spriteTileNum + 0x400; + sub_8075198(ptr, windowTileData + 0xC0, 1); + } + else + { + sub_8075198((void*)(0x6010020 + spriteTileNum), windowTileData, 7); + } + + RemoveWindow_(windowId); +}