From 558133bba0ca6fba3ff71217e9f750e7a3e9033a Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 24 Feb 2018 13:44:26 +0100 Subject: [PATCH] almost match --- asm/battle_link_817C95C.s | 2486 ------------------------------------- ld_script.txt | 2 +- src/battle_link_817C95C.c | 320 ++++- 3 files changed, 269 insertions(+), 2539 deletions(-) diff --git a/asm/battle_link_817C95C.s b/asm/battle_link_817C95C.s index 55d0bae39..e64d142fa 100644 --- a/asm/battle_link_817C95C.s +++ b/asm/battle_link_817C95C.s @@ -5,2492 +5,6 @@ .text - thumb_func_start sub_817C95C -sub_817C95C: @ 817C95C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - bne _0817C988 - ldr r0, [sp] - cmp r0, 0x1B - beq _0817C988 - cmp r0, 0xDD - beq _0817C988 - bl _0817E0A6 -_0817C988: - ldr r0, =gBattleStruct - ldr r0, [r0] - movs r1, 0x81 - lsls r1, 2 - adds r7, r0, r1 - ldr r5, =gBattlerAttacker - ldrb r0, [r5] - bl GetBattlerSide - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gBattlerTarget - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gEffectBattler - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r0, =gStringInfo - ldr r0, [r0] - ldrb r0, [r0, 0x7] - bl GetBattlerSide - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - cmp r4, 0 - bne _0817CA00 - ldr r2, =gBattlerPartyIndexes - ldrb r0, [r5] - lsls r0, 1 - adds r0, r2 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - b _0817CA10 - .pool -_0817CA00: - ldr r2, =gBattlerPartyIndexes - ldrb r0, [r5] - lsls r0, 1 - adds r0, r2 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty -_0817CA10: - adds r1, r0 - str r1, [sp, 0x8] - cmp r6, 0 - bne _0817CA3C - ldr r0, =gBattlerTarget - ldrb r0, [r0] - lsls r0, 1 - adds r0, r2 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - b _0817CA4C - .pool -_0817CA3C: - ldr r0, =gBattlerTarget - ldrb r0, [r0] - lsls r0, 1 - adds r0, r2 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty -_0817CA4C: - adds r1, r0 - str r1, [sp, 0xC] - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - ldr r1, =gStringInfo - ldr r1, [r1] - ldrh r1, [r1] - bl GetBattlerMoveSlotId - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - cmp r0, 0x3 - bls _0817CA9C - ldr r0, [sp] - bl sub_817E0B8 - lsls r0, 24 - cmp r0, 0 - beq _0817CA9C - ldr r2, [sp] - cmp r2, 0xC - bls _0817CA9C - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r0, r7, r0 - adds r0, 0x57 - ldrb r1, [r0] - movs r2, 0x1E - bl _0817E0A2 - .pool -_0817CA9C: - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - bl GetBattlerPosition - lsls r0, 24 - lsrs r0, 25 - mov r8, r0 - ldr r0, =gBattlerTarget - ldrb r0, [r0] - bl GetBattlerPosition - lsls r0, 24 - lsrs r5, r0, 25 - ldr r0, =gEffectBattler - ldrb r0, [r0] - bl GetBattlerPosition - lsls r0, 24 - lsrs r3, r0, 25 - ldr r1, [sp] - subs r1, 0x2 - movs r0, 0xB0 - lsls r0, 1 - cmp r1, r0 - bls _0817CAD2 - bl _0817E0A6 -_0817CAD2: - lsls r0, r1, 2 - ldr r1, =_0817CAEC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0817CAEC: - .4byte _0817DD7A - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817D070 - .4byte _0817DD74 - .4byte _0817DD80 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817DA68 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817D7D8 - .4byte _0817E0A6 - .4byte _0817D8A4 - .4byte _0817E0A6 - .4byte _0817D838 - .4byte _0817E0A6 - .4byte _0817D704 - .4byte _0817E0A6 - .4byte _0817D76C - .4byte _0817DB24 - .4byte _0817E0A6 - .4byte _0817DB90 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817D9C2 - .4byte _0817E0A6 - .4byte _0817DA24 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817DBD4 - .4byte _0817E0A6 - .4byte _0817D94C - .4byte _0817E0A6 - .4byte _0817D994 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E040 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817DE10 - .4byte _0817DDC8 - .4byte _0817DEDC - .4byte _0817DF24 - .4byte _0817DF4E - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817D65E - .4byte _0817D65E - .4byte _0817D65E - .4byte _0817D65E - .4byte _0817D698 - .4byte _0817E0A6 - .4byte _0817E08E - .4byte _0817DF70 - .4byte _0817DFBC - .4byte _0817E0A6 - .4byte _0817E08E - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817D53C - .4byte _0817E0A6 - .4byte _0817D584 - .4byte _0817DACC - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817D3A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817D296 - .4byte _0817D2E4 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817D5CE - .4byte _0817D608 - .4byte _0817D498 - .4byte _0817D4E0 - .4byte _0817DC62 - .4byte _0817DC98 - .4byte _0817E0A6 - .4byte _0817D1B8 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817DCDC - .4byte _0817E0A6 - .4byte _0817D0DC - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817D1E0 - .4byte _0817D314 - .4byte _0817D354 - .4byte _0817D372 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817D216 - .4byte _0817D260 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817D3C0 - .4byte _0817D3F2 - .4byte _0817D440 - .4byte _0817D45C - .4byte _0817D3B8 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817D098 - .4byte _0817D0D4 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817DC20 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817D16C - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817DD38 - .4byte _0817DCFC - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817D65E - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817D124 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817E0A6 - .4byte _0817DE58 - .4byte _0817DDC8 - .4byte _0817DE10 - .4byte _0817DFE6 -_0817D070: - movs r0, 0x1 - mov r1, r10 - movs r2, 0x2 - movs r3, 0 - bl sub_817E684 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0817D08C - bl _0817E0A6 -_0817D08C: - bl sub_817EECC - bl _0817E0A6 - .pool -_0817D098: - movs r0, 0x1 - mov r1, r10 - movs r2, 0x1 - movs r3, 0 - bl sub_817E684 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0817D0B4 - bl _0817E0A6 -_0817D0B4: - ldr r0, [sp, 0xC] - movs r1, 0x39 - movs r2, 0 - bl GetMonData - cmp r0, 0 - bne _0817D0C6 - bl _0817E0A6 -_0817D0C6: - bl sub_817EECC - bl _0817E0A6 - .pool -_0817D0D4: - movs r0, 0x1 - mov r1, r10 - movs r2, 0 - b _0817D48E -_0817D0DC: - lsls r3, r4, 1 - adds r3, r4 - lsls r3, 2 - adds r3, r7, r3 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] - adds r0, 0x1 - movs r1, 0x7 - ands r0, r1 - lsls r0, 15 - ldr r1, [r3, 0x50] - ldr r2, =0xfffc7fff - ands r1, r2 - orrs r1, r0 - str r1, [r3, 0x50] - adds r3, 0x55 - movs r0, 0x3 - mov r1, r10 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r3] - movs r0, 0xD - negs r0, r0 - bl _0817DC0C - .pool -_0817D124: - lsls r2, r4, 1 - adds r2, r4 - lsls r2, 2 - adds r2, r7, r2 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - adds r4, r2, 0 - adds r4, 0x52 - movs r0, 0x7 - ands r1, r0 - lsls r1, 2 - ldrb r3, [r4] - movs r0, 0x1D - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r4] - adds r2, 0x55 - movs r0, 0x3 - mov r1, r10 - ands r1, r0 - lsls r1, 4 - ldrb r3, [r2] - movs r0, 0x31 - negs r0, r0 - bl _0817DFAA - .pool -_0817D16C: - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r5, r7, r0 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - adds r3, r5, 0 - adds r3, 0x52 - lsls r1, 5 - ldrb r2, [r3] - movs r0, 0x1F - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - adds r4, r5, 0 - adds r4, 0x55 - mov r0, r10 - lsls r2, r0, 6 - ldrb r1, [r4] - movs r0, 0x3F - ands r0, r1 - orrs r0, r2 - strb r0, [r4] - adds r2, r5, 0 - adds r2, 0x58 - ldrb r0, [r2] - movs r1, 0x40 - bl _0817DFAC - .pool -_0817D1B8: - ldr r1, =gBattleTextBuff1 + 4 - ldrb r0, [r1] - cmp r0, 0 - beq _0817D1C4 - bl _0817E0A6 -_0817D1C4: - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r0, r7, r0 - adds r0, 0x57 - ldrb r2, [r0] - movs r1, 0x1F - negs r1, r1 - ands r1, r2 - movs r2, 0x14 - bl _0817E0A2 - .pool -_0817D1E0: - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 2 - adds r3, r7, r0 - adds r0, r3, 0 - adds r0, 0x53 - ldrb r0, [r0] - lsls r0, 29 - lsrs r0, 29 - cmp r0, 0 - bne _0817D1FA - bl _0817E0A6 -_0817D1FA: - adds r2, r6, 0 - subs r1, r0, 0x1 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x56 - ldrb r3, [r0] - lsls r3, 30 - lsrs r3, 30 - adds r3, r1 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x2 - bl _0817DB10 -_0817D216: - lsls r2, r4, 1 - adds r2, r4 - lsls r2, 2 - adds r2, r7, r2 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - adds r4, r2, 0 - adds r4, 0x53 - movs r0, 0x7 - ands r1, r0 - lsls r1, 3 - ldrb r3, [r4] - movs r0, 0x39 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r4] - adds r2, 0x56 - movs r0, 0x3 - mov r1, r10 - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0xD - negs r0, r0 - bl _0817DFAA - .pool -_0817D260: - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 2 - adds r3, r7, r0 - adds r0, r3, 0 - adds r0, 0x53 - ldrb r0, [r0] - lsls r0, 26 - lsrs r0, 29 - cmp r0, 0 - bne _0817D27A - bl _0817E0A6 -_0817D27A: - adds r2, r6, 0 - subs r1, r0, 0x1 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x56 - ldrb r3, [r0] - lsls r3, 28 - lsrs r3, 30 - adds r3, r1 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x2 - bl _0817DBC2 -_0817D296: - lsls r2, r4, 1 - adds r2, r4 - lsls r2, 2 - adds r2, r7, r2 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - adds r2, 0x56 - movs r0, 0x7 - ands r1, r0 - lsls r1, 4 - ldrb r3, [r2] - movs r0, 0x71 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - movs r0, 0x3 - mov r1, r10 - ands r1, r0 - lsls r1, 7 - ldrh r3, [r2] - ldr r0, =0xfffffe7f - ands r0, r3 - orrs r0, r1 - strh r0, [r2] - bl _0817E0A6 - .pool -_0817D2E4: - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 2 - adds r0, r7, r0 - adds r0, 0x56 - ldrb r0, [r0] - lsls r0, 25 - lsrs r0, 29 - cmp r0, 0 - bne _0817D2FC - bl _0817E0A6 -_0817D2FC: - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r0, r7, r0 - adds r0, 0x57 - ldrb r2, [r0] - movs r1, 0x1F - negs r1, r1 - ands r1, r2 - movs r2, 0x16 - bl _0817E0A2 -_0817D314: - mov r2, r8 - lsls r3, r2, 3 - lsls r0, r4, 4 - adds r3, r0 - adds r3, r7, r3 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - adds r3, 0x35 - movs r0, 0x7 - ands r1, r0 - ldrb r2, [r3] - movs r0, 0x8 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - movs r2, 0x3 - mov r1, r10 - ands r1, r2 - lsls r1, 3 - movs r2, 0x19 - negs r2, r2 - bl _0817DC0C - .pool -_0817D354: - mov r1, r8 - lsls r0, r1, 3 - lsls r1, r4, 4 - adds r0, r1 - adds r0, r7, r0 - adds r0, 0x35 - ldrb r1, [r0] - lsls r0, r1, 29 - lsrs r0, 29 - cmp r0, 0 - bne _0817D36E - bl _0817E0A6 -_0817D36E: - adds r2, r4, 0 - b _0817D38C -_0817D372: - lsls r0, r5, 3 - lsls r1, r6, 4 - adds r0, r1 - adds r0, r7, r0 - adds r0, 0x35 - ldrb r1, [r0] - lsls r0, r1, 29 - lsrs r0, 29 - cmp r0, 0 - bne _0817D38A - bl _0817E0A6 -_0817D38A: - adds r2, r6, 0 -_0817D38C: - subs r0, 0x1 - lsls r0, 2 - lsls r3, r1, 27 - lsrs r3, 30 - adds r3, r0 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x2 - movs r1, 0x6 - bl sub_817E684 - bl _0817E0A6 -_0817D3A6: - ldr r0, =gBattleStruct - ldr r0, [r0] - adds r0, 0xB3 - movs r1, 0x1 - bl _0817E0A4 - .pool -_0817D3B8: - movs r0, 0x12 - mov r1, r10 - movs r2, 0 - b _0817D48E -_0817D3C0: - ldr r0, =gBattleTextBuff1 - ldrb r2, [r0, 0x2] - cmp r2, 0 - bne _0817D3CC - bl _0817E0A6 -_0817D3CC: - ldr r1, =gBattleTextBuff2 + 2 - ldrh r0, [r1] - cmp r0, 0xD1 - bne _0817D3E8 - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x17 - b _0817D48C - .pool -_0817D3E8: - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x16 - b _0817D48C -_0817D3F2: - ldr r0, =gBattleTextBuff1 - ldrb r2, [r0, 0x2] - cmp r2, 0 - bne _0817D3FE - bl _0817E0A6 -_0817D3FE: - ldr r0, =gBattlerAttacker - ldr r1, =gBattlerTarget - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - bne _0817D436 - ldr r1, =gBattleTextBuff2 + 2 - ldrh r0, [r1] - cmp r0, 0xD1 - bne _0817D42C - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x17 - b _0817D48C - .pool -_0817D42C: - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x16 - b _0817D48C -_0817D436: - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x1B - b _0817D48C -_0817D440: - ldr r0, =gBattleTextBuff1 - ldrb r2, [r0, 0x2] - cmp r2, 0 - bne _0817D44C - bl _0817E0A6 -_0817D44C: - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x18 - b _0817D48C - .pool -_0817D45C: - ldr r0, =gBattleTextBuff1 - ldrb r2, [r0, 0x2] - cmp r2, 0 - bne _0817D468 - bl _0817E0A6 -_0817D468: - ldr r1, =gBattleTextBuff2 + 2 - ldrh r0, [r1] - cmp r0, 0xD3 - bne _0817D484 - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x1A - b _0817D48C - .pool -_0817D484: - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x19 -_0817D48C: - mov r1, r10 -_0817D48E: - movs r3, 0 - bl sub_817E684 - bl _0817E0A6 -_0817D498: - lsls r2, r5, 3 - lsls r0, r6, 4 - adds r2, r0 - adds r2, r7, r2 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - adds r4, r2, 0 - adds r4, 0x30 - movs r0, 0x7 - ands r1, r0 - ldrb r3, [r4] - movs r0, 0x8 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r4] - adds r2, 0x32 - movs r0, 0x3 - mov r1, r10 - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0xD - negs r0, r0 - bl _0817DFAA - .pool -_0817D4E0: - ldr r0, [sp, 0x8] - movs r1, 0x39 - movs r2, 0 - bl GetMonData - cmp r0, 0 - bne _0817D4F2 - bl _0817E0A6 -_0817D4F2: - mov r2, r8 - lsls r0, r2, 3 - lsls r1, r4, 4 - adds r0, r1 - adds r1, r7, r0 - adds r0, r1, 0 - adds r0, 0x30 - ldrb r0, [r0] - lsls r0, 29 - lsrs r0, 29 - cmp r0, 0 - bne _0817D50E - bl _0817E0A6 -_0817D50E: - subs r2, r0, 0x1 - lsls r2, 24 - lsrs r2, 24 - adds r0, r1, 0 - adds r0, 0x32 - ldrb r3, [r0] - lsls r3, 28 - lsrs r3, 30 - movs r0, 0x8 - movs r1, 0 - bl sub_817E684 - lsls r1, r4, 1 - adds r1, r4 - lsls r1, 2 - adds r1, r7, r1 - adds r1, 0x57 - ldrb r2, [r1] - movs r0, 0x1F - negs r0, r0 - ands r0, r2 - movs r2, 0x2 - b _0817D6F2 -_0817D53C: - lsls r2, r5, 3 - lsls r0, r6, 4 - adds r2, r0 - adds r2, r7, r2 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - adds r4, r2, 0 - adds r4, 0x30 - movs r0, 0x7 - ands r1, r0 - lsls r1, 3 - ldrb r3, [r4] - movs r0, 0x39 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r4] - adds r2, 0x32 - movs r0, 0x3 - mov r1, r10 - ands r1, r0 - lsls r1, 4 - ldrb r3, [r2] - movs r0, 0x31 - negs r0, r0 - bl _0817DFAA - .pool -_0817D584: - mov r1, r8 - lsls r0, r1, 3 - lsls r1, r4, 4 - adds r0, r1 - adds r1, r7, r0 - adds r0, r1, 0 - adds r0, 0x30 - ldrb r0, [r0] - lsls r0, 26 - lsrs r0, 29 - cmp r0, 0 - bne _0817D5A0 - bl _0817E0A6 -_0817D5A0: - subs r2, r0, 0x1 - lsls r2, 24 - lsrs r2, 24 - adds r0, r1, 0 - adds r0, 0x32 - ldrb r3, [r0] - lsls r3, 26 - lsrs r3, 30 - movs r0, 0x8 - movs r1, 0x1 - bl sub_817E684 - lsls r1, r4, 1 - adds r1, r4 - lsls r1, 2 - adds r1, r7, r1 - adds r1, 0x57 - ldrb r2, [r1] - movs r0, 0x1F - negs r0, r0 - ands r0, r2 - movs r2, 0x4 - b _0817D6F2 -_0817D5CE: - lsls r2, r5, 3 - lsls r0, r6, 4 - adds r2, r0 - adds r2, r7, r2 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - movs r0, 0x7 - ands r1, r0 - lsls r1, 6 - ldrh r3, [r2, 0x30] - ldr r0, =0xfffffe3f - ands r0, r3 - orrs r0, r1 - strh r0, [r2, 0x30] - adds r2, 0x32 - bl _0817DF0A - .pool -_0817D608: - ldr r0, [sp, 0x8] - movs r1, 0x39 - movs r2, 0 - bl GetMonData - cmp r0, 0 - bne _0817D61A - bl _0817E0A6 -_0817D61A: - mov r1, r8 - lsls r0, r1, 3 - lsls r1, r4, 4 - adds r0, r1 - adds r1, r7, r0 - ldrh r0, [r1, 0x30] - lsls r0, 23 - lsrs r0, 29 - cmp r0, 0 - bne _0817D632 - bl _0817E0A6 -_0817D632: - subs r2, r0, 0x1 - lsls r2, 24 - lsrs r2, 24 - adds r0, r1, 0 - adds r0, 0x32 - ldrb r3, [r0] - lsrs r3, 6 - movs r0, 0x8 - movs r1, 0x5 - bl sub_817E684 - lsls r1, r4, 1 - adds r1, r4 - lsls r1, 2 - adds r1, r7, r1 - adds r1, 0x57 - ldrb r2, [r1] - movs r0, 0x1F - negs r0, r0 - ands r0, r2 - movs r2, 0xA - b _0817D6F2 -_0817D65E: - lsls r2, r5, 3 - lsls r0, r6, 4 - adds r2, r0 - adds r2, r7, r2 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - adds r4, r2, 0 - adds r4, 0x31 - movs r0, 0x7 - ands r1, r0 - lsls r1, 1 - ldrb r3, [r4] - movs r0, 0xF - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r4] - adds r2, 0x33 - bl _0817DF9E - .pool -_0817D698: - ldr r0, [sp, 0x8] - movs r1, 0x39 - movs r2, 0 - bl GetMonData - cmp r0, 0 - bne _0817D6AA - bl _0817E0A6 -_0817D6AA: - mov r1, r8 - lsls r0, r1, 3 - lsls r1, r4, 4 - adds r0, r1 - adds r1, r7, r0 - adds r0, r1, 0 - adds r0, 0x31 - ldrb r0, [r0] - lsls r0, 28 - lsrs r0, 29 - cmp r0, 0 - bne _0817D6C6 - bl _0817E0A6 -_0817D6C6: - subs r2, r0, 0x1 - lsls r2, 24 - lsrs r2, 24 - adds r0, r1, 0 - adds r0, 0x33 - ldrb r3, [r0] - lsls r3, 30 - lsrs r3, 30 - movs r0, 0x8 - movs r1, 0x6 - bl sub_817E684 - lsls r1, r4, 1 - adds r1, r4 - lsls r1, 2 - adds r1, r7, r1 - adds r1, 0x57 - ldrb r2, [r1] - movs r0, 0x1F - negs r0, r0 - ands r0, r2 - movs r2, 0xC -_0817D6F2: - orrs r0, r2 - mov r2, r8 - lsls r3, r2, 5 - movs r2, 0x1F - ands r0, r2 - orrs r0, r3 - strb r0, [r1] - bl _0817E0A6 -_0817D704: - ldr r5, =gBattlerPartyIndexes - ldr r6, =gEffectBattler - ldrb r0, [r6] - lsls r0, 1 - adds r0, r5 - ldrh r2, [r0] - lsls r2, 2 - mov r0, r9 - lsls r4, r0, 1 - add r4, r9 - lsls r4, 3 - adds r2, r4 - adds r2, r7, r2 - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r5 - ldrh r1, [r0] - adds r1, 0x1 - movs r0, 0x7 - ands r1, r0 - lsls r1, 6 - ldrh r3, [r2] - ldr r0, =0xfffffe3f - ands r0, r3 - orrs r0, r1 - strh r0, [r2] - ldrb r0, [r6] - lsls r0, 1 - adds r0, r5 - ldrh r1, [r0] - lsls r1, 2 - adds r1, r4 - adds r1, r7, r1 - mov r2, r10 - lsls r3, r2, 6 - ldrb r2, [r1, 0x2] - movs r0, 0x3F - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x2] - bl _0817E0A6 - .pool -_0817D76C: - ldr r0, [sp, 0x8] - movs r1, 0x39 - movs r2, 0 - bl GetMonData - cmp r0, 0 - bne _0817D77E - bl _0817E0A6 -_0817D77E: - ldr r6, =gBattlerPartyIndexes - ldr r5, =gBattlerAttacker - ldrb r0, [r5] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - lsls r0, 2 - lsls r1, r4, 1 - adds r4, r1, r4 - lsls r1, r4, 3 - adds r0, r1 - adds r1, r7, r0 - ldrh r0, [r1] - lsls r0, 23 - lsrs r0, 29 - cmp r0, 0 - beq _0817D7B2 - subs r2, r0, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r1, 0x2] - lsrs r3, 6 - movs r0, 0x8 - movs r1, 0x4 - bl sub_817E684 -_0817D7B2: - lsls r3, r4, 2 - adds r3, r7, r3 - adds r3, 0x57 - ldrb r0, [r3] - movs r1, 0x1F - negs r1, r1 - ands r1, r0 - movs r0, 0x8 - orrs r1, r0 - strb r1, [r3] - ldrb r0, [r5] - lsls r0, 1 - adds r0, r6 - b _0817D934 - .pool -_0817D7D8: - ldr r5, =gBattlerPartyIndexes - ldr r6, =gEffectBattler - ldrb r0, [r6] - lsls r0, 1 - adds r0, r5 - ldrh r2, [r0] - lsls r2, 2 - mov r0, r9 - lsls r4, r0, 1 - add r4, r9 - lsls r4, 3 - adds r2, r4 - adds r2, r7, r2 - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r5 - ldrh r1, [r0] - adds r1, 0x1 - movs r0, 0x7 - ands r1, r0 - ldrb r3, [r2] - movs r0, 0x8 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r6] - lsls r0, 1 - adds r0, r5 - ldrh r1, [r0] - lsls r1, 2 - adds r1, r4 - adds r1, r7, r1 - movs r0, 0x3 - mov r2, r10 - ands r2, r0 - lsls r2, 2 - ldrb r3, [r1, 0x2] - movs r0, 0xD - negs r0, r0 - b _0817D88C - .pool -_0817D838: - ldr r5, =gBattlerPartyIndexes - ldr r6, =gEffectBattler - ldrb r0, [r6] - lsls r0, 1 - adds r0, r5 - ldrh r2, [r0] - lsls r2, 2 - mov r1, r9 - lsls r4, r1, 1 - add r4, r9 - lsls r4, 3 - adds r2, r4 - adds r2, r7, r2 - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r5 - ldrh r1, [r0] - adds r1, 0x1 - movs r0, 0x7 - ands r1, r0 - lsls r1, 3 - ldrb r3, [r2] - movs r0, 0x39 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r6] - lsls r0, 1 - adds r0, r5 - ldrh r1, [r0] - lsls r1, 2 - adds r1, r4 - adds r1, r7, r1 - movs r0, 0x3 - mov r2, r10 - ands r2, r0 - lsls r2, 4 - ldrb r3, [r1, 0x2] - movs r0, 0x31 - negs r0, r0 -_0817D88C: - ands r0, r3 - orrs r0, r2 - strb r0, [r1, 0x2] - bl _0817E0A6 - .pool -_0817D8A4: - ldr r0, [sp, 0x8] - movs r1, 0x39 - movs r2, 0 - bl GetMonData - cmp r0, 0 - bne _0817D8B6 - bl _0817E0A6 -_0817D8B6: - ldr r2, =gBattlerPartyIndexes - mov r8, r2 - ldr r6, =gBattlerAttacker - ldrb r0, [r6] - lsls r0, 1 - add r0, r8 - ldrh r0, [r0] - lsls r0, 2 - lsls r1, r4, 1 - adds r5, r1, r4 - lsls r4, r5, 3 - adds r0, r4 - adds r1, r7, r0 - ldrb r0, [r1] - lsls r0, 29 - lsrs r0, 29 - cmp r0, 0 - beq _0817D8EE - subs r2, r0, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r1, 0x2] - lsls r3, 28 - lsrs r3, 30 - movs r0, 0x8 - movs r1, 0x2 - bl sub_817E684 -_0817D8EE: - ldrb r0, [r6] - lsls r0, 1 - add r0, r8 - ldrh r0, [r0] - lsls r0, 2 - adds r0, r4 - adds r1, r7, r0 - ldrb r0, [r1] - lsls r0, 26 - lsrs r0, 29 - cmp r0, 0 - beq _0817D91A - subs r2, r0, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r1, 0x2] - lsls r3, 26 - lsrs r3, 30 - movs r0, 0x8 - movs r1, 0x3 - bl sub_817E684 -_0817D91A: - lsls r3, r5, 2 - adds r3, r7, r3 - adds r3, 0x57 - ldrb r0, [r3] - movs r1, 0x1F - negs r1, r1 - ands r1, r0 - movs r0, 0x6 - orrs r1, r0 - strb r1, [r3] - ldrb r0, [r6] - lsls r0, 1 - add r0, r8 -_0817D934: - ldrh r0, [r0] - lsls r0, 5 - movs r2, 0x1F - ands r1, r2 - orrs r1, r0 - strb r1, [r3] - b _0817E0A6 - .pool -_0817D94C: - lsls r2, r5, 3 - lsls r0, r6, 4 - adds r2, r0 - adds r2, r7, r2 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - adds r4, r2, 0 - adds r4, 0x31 - movs r0, 0x7 - ands r1, r0 - lsls r1, 4 - ldrb r3, [r4] - movs r0, 0x71 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r4] - adds r2, 0x33 - movs r0, 0x3 - mov r1, r10 - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0xD - negs r0, r0 - b _0817DFAA - .pool -_0817D994: - mov r1, r8 - lsls r0, r1, 3 - lsls r1, r4, 4 - adds r0, r1 - adds r1, r7, r0 - adds r0, r1, 0 - adds r0, 0x31 - ldrb r0, [r0] - lsls r0, 25 - lsrs r0, 29 - cmp r0, 0 - bne _0817D9AE - b _0817E0A6 -_0817D9AE: - subs r2, r0, 0x1 - lsls r2, 24 - lsrs r2, 24 - adds r0, r1, 0 - adds r0, 0x33 - ldrb r3, [r0] - lsls r3, 28 - lsrs r3, 30 - movs r0, 0x9 - b _0817E086 -_0817D9C2: - ldr r5, =gBattlerPartyIndexes - ldr r6, =gEffectBattler - ldrb r0, [r6] - lsls r0, 1 - adds r0, r5 - ldrh r2, [r0] - lsls r2, 2 - mov r0, r9 - lsls r4, r0, 1 - add r4, r9 - lsls r4, 3 - adds r2, r4 - adds r2, r7, r2 - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r5 - ldrh r1, [r0] - adds r1, 0x1 - movs r0, 0x7 - ands r1, r0 - lsls r1, 1 - ldrb r3, [r2, 0x1] - movs r0, 0xF - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x1] - ldrb r0, [r6] - lsls r0, 1 - adds r0, r5 - ldrh r1, [r0] - lsls r1, 2 - adds r1, r4 - adds r1, r7, r1 - movs r0, 0x3 - mov r2, r10 - ands r2, r0 - ldrb r3, [r1, 0x3] - movs r0, 0x4 - negs r0, r0 - b _0817DB76 - .pool -_0817DA24: - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - lsls r1, 2 - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 3 - adds r1, r0 - adds r1, r7, r1 - ldrb r0, [r1, 0x1] - lsls r0, 28 - lsrs r0, 29 - cmp r0, 0 - bne _0817DA48 - b _0817E0A6 -_0817DA48: - subs r2, r0, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r1, 0x3] - lsls r3, 30 - lsrs r3, 30 - movs r0, 0x9 - movs r1, 0x2 - bl sub_817E684 - b _0817E0A6 - .pool -_0817DA68: - ldr r5, =gBattlerPartyIndexes - ldr r6, =gEffectBattler - ldrb r0, [r6] - lsls r0, 1 - adds r0, r5 - ldrh r2, [r0] - lsls r2, 2 - mov r1, r9 - lsls r4, r1, 1 - add r4, r9 - lsls r4, 3 - adds r2, r4 - adds r2, r7, r2 - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r5 - ldrh r1, [r0] - adds r1, 0x1 - movs r0, 0x7 - ands r1, r0 - lsls r1, 4 - ldrb r3, [r2, 0x1] - movs r0, 0x71 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x1] - ldrb r0, [r6] - lsls r0, 1 - adds r0, r5 - ldrh r1, [r0] - lsls r1, 2 - adds r1, r4 - adds r1, r7, r1 - movs r0, 0x3 - mov r2, r10 - ands r2, r0 - lsls r2, 2 - ldrb r3, [r1, 0x3] - movs r0, 0xD - negs r0, r0 - b _0817DB76 - .pool -_0817DACC: - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - lsls r1, 2 - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 3 - adds r1, r0 - adds r1, r7, r1 - ldrb r0, [r1, 0x1] - lsls r0, 25 - lsrs r2, r0, 29 - cmp r2, 0 - bne _0817DAF0 - b _0817E0A6 -_0817DAF0: - ldr r0, =gStringInfo - ldr r0, [r0] - ldrh r0, [r0] - cmp r0, 0xAD - bne _0817DAFC - b _0817E0A6 -_0817DAFC: - cmp r0, 0xD6 - bne _0817DB02 - b _0817E0A6 -_0817DB02: - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r1, 0x3] - lsls r3, 28 - lsrs r3, 30 - movs r0, 0x9 -_0817DB10: - movs r1, 0x3 - bl sub_817E684 - b _0817E0A6 - .pool -_0817DB24: - ldr r5, =gBattlerPartyIndexes - ldr r6, =gEffectBattler - ldrb r0, [r6] - lsls r0, 1 - adds r0, r5 - ldrh r3, [r0] - lsls r3, 2 - mov r2, r9 - lsls r4, r2, 1 - add r4, r9 - lsls r4, 3 - adds r3, r4 - adds r3, r7, r3 - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - adds r0, 0x1 - movs r1, 0x7 - ands r0, r1 - lsls r0, 15 - ldr r1, [r3] - ldr r2, =0xfffc7fff - ands r1, r2 - orrs r1, r0 - str r1, [r3] - ldrb r0, [r6] - lsls r0, 1 - adds r0, r5 - ldrh r1, [r0] - lsls r1, 2 - adds r1, r4 - adds r1, r7, r1 - movs r0, 0x3 - mov r2, r10 - ands r2, r0 - lsls r2, 4 - ldrb r3, [r1, 0x3] - movs r0, 0x31 - negs r0, r0 -_0817DB76: - ands r0, r3 - orrs r0, r2 - strb r0, [r1, 0x3] - b _0817E0A6 - .pool -_0817DB90: - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - lsls r1, 2 - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 3 - adds r1, r0 - adds r1, r7, r1 - ldr r0, [r1] - lsls r0, 14 - lsrs r0, 29 - cmp r0, 0 - bne _0817DBB4 - b _0817E0A6 -_0817DBB4: - subs r2, r0, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r1, 0x3] - lsls r3, 26 - lsrs r3, 30 - movs r0, 0x9 -_0817DBC2: - movs r1, 0x4 - bl sub_817E684 - b _0817E0A6 - .pool -_0817DBD4: - lsls r3, 3 - mov r1, r9 - lsls r0, r1, 4 - adds r3, r0 - adds r3, r7, r3 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] - adds r0, 0x1 - movs r1, 0x7 - ands r0, r1 - lsls r0, 15 - ldr r1, [r3, 0x30] - ldr r2, =0xfffc7fff - ands r1, r2 - orrs r1, r0 - str r1, [r3, 0x30] - adds r3, 0x33 - movs r0, 0x3 - mov r1, r10 - ands r1, r0 - lsls r1, 4 - ldrb r2, [r3] - movs r0, 0x31 - negs r0, r0 -_0817DC0C: - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - b _0817E0A6 - .pool -_0817DC20: - mov r2, r8 - lsls r0, r2, 3 - lsls r1, r4, 4 - adds r0, r1 - adds r3, r7, r0 - ldr r0, [r3, 0x30] - lsls r0, 14 - lsrs r0, 29 - cmp r0, 0 - beq _0817DC4C - subs r2, r0, 0x1 - lsls r2, 24 - lsrs r2, 24 - adds r0, r3, 0 - adds r0, 0x33 - ldrb r3, [r0] - lsls r3, 26 - lsrs r3, 30 - movs r0, 0x9 - movs r1, 0x1 - bl sub_817E684 -_0817DC4C: - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r0, r7, r0 - adds r0, 0x57 - ldrb r2, [r0] - movs r1, 0x1F - negs r1, r1 - ands r1, r2 - movs r2, 0x18 - b _0817E0A2 -_0817DC62: - lsls r2, r6, 1 - adds r2, r6 - lsls r2, 2 - adds r2, r7, r2 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - adds r4, r2, 0 - adds r4, 0x50 - movs r0, 0x7 - ands r1, r0 - ldrb r3, [r4] - movs r0, 0x8 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r4] - adds r2, 0x54 - b _0817DF9E - .pool -_0817DC98: - ldr r1, [sp, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r4, r7, r0 - adds r0, r4, 0 - adds r0, 0x50 - ldrb r0, [r0] - lsls r0, 29 - lsrs r2, r0, 29 - cmp r2, 0 - bne _0817DCB2 - b _0817E0A6 -_0817DCB2: - movs r0, 0x1 - eors r1, r0 - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r0, 0x54 - ldrb r3, [r0] - lsls r3, 30 - lsrs r3, 30 - movs r0, 0xA - bl sub_817E684 - adds r2, r4, 0 - adds r2, 0x57 - ldrb r1, [r2] - movs r0, 0x1F - negs r0, r0 - ands r0, r1 - movs r1, 0xE - b _0817DFAC -_0817DCDC: - lsls r1, r4, 1 - adds r1, r4 - lsls r1, 2 - adds r1, r7, r1 - adds r3, r1, 0 - adds r3, 0x50 - ldrb r2, [r3] - movs r0, 0x8 - negs r0, r0 - ands r0, r2 - strb r0, [r3] - adds r1, 0x54 - ldrb r2, [r1] - movs r0, 0x4 - negs r0, r0 - b _0817DF6A -_0817DCFC: - mov r0, r8 - lsls r2, r0, 3 - lsls r0, r4, 4 - adds r2, r0 - adds r2, r7, r2 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - adds r4, r2, 0 - adds r4, 0x34 - movs r0, 0x7 - ands r1, r0 - ldrb r3, [r4] - movs r0, 0x8 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r4] - adds r2, 0x33 - mov r1, r10 - lsls r3, r1, 6 - b _0817DF0E - .pool -_0817DD38: - mov r0, r8 - lsls r2, r0, 3 - lsls r0, r4, 4 - adds r2, r0 - adds r2, r7, r2 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - adds r2, 0x34 - movs r0, 0x7 - ands r1, r0 - lsls r1, 3 - ldrb r3, [r2] - movs r0, 0x39 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - mov r1, r10 - lsls r3, r1, 6 - movs r1, 0x3F - b _0817DF12 - .pool -_0817DD74: - movs r0, 0 - bl sub_817EA80 -_0817DD7A: - mov r2, r8 - lsls r0, r2, 3 - b _0817DD88 -_0817DD80: - movs r0, 0x1 - bl sub_817EA80 - lsls r0, r5, 3 -_0817DD88: - lsls r1, r4, 4 - adds r0, r1 - adds r1, r7, r0 - adds r4, r1, 0 - adds r4, 0x34 - ldrb r5, [r4] - lsls r0, r5, 29 - cmp r0, 0 - beq _0817DDAE - movs r0, 0x8 - negs r0, r0 - ands r0, r5 - strb r0, [r4] - adds r2, r1, 0 - adds r2, 0x33 - ldrb r1, [r2] - movs r0, 0x3F - ands r0, r1 - strb r0, [r2] -_0817DDAE: - ldrb r1, [r4] - lsls r0, r1, 26 - lsrs r0, 29 - cmp r0, 0 - bne _0817DDBA - b _0817E0A6 -_0817DDBA: - movs r0, 0x39 - negs r0, r0 - ands r0, r1 - movs r1, 0x3F - ands r0, r1 - strb r0, [r4] - b _0817E0A6 -_0817DDC8: - lsls r2, r4, 1 - adds r2, r4 - lsls r2, 2 - adds r2, r7, r2 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - adds r4, r2, 0 - adds r4, 0x50 - movs r0, 0x7 - ands r1, r0 - lsls r1, 3 - ldrb r3, [r4] - movs r0, 0x39 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r4] - adds r2, 0x54 - movs r0, 0x3 - mov r1, r10 - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0xD - negs r0, r0 - b _0817DFAA - .pool -_0817DE10: - lsls r2, r4, 1 - adds r2, r4 - lsls r2, 2 - adds r2, r7, r2 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - adds r4, r2, 0 - adds r4, 0x50 - movs r0, 0x7 - ands r1, r0 - lsls r1, 6 - ldrh r3, [r4] - ldr r0, =0xfffffe3f - ands r0, r3 - orrs r0, r1 - strh r0, [r4] - adds r2, 0x54 - movs r0, 0x3 - mov r1, r10 - ands r1, r0 - lsls r1, 4 - ldrb r3, [r2] - movs r0, 0x31 - negs r0, r0 - b _0817DFAA - .pool -_0817DE58: - ldr r1, =gBattleTextBuff1 + 2 - ldrh r0, [r1] - cmp r0, 0x73 - bne _0817DE82 - lsls r1, r4, 1 - adds r1, r4 - lsls r1, 2 - adds r1, r7, r1 - adds r3, r1, 0 - adds r3, 0x50 - ldrb r2, [r3] - movs r0, 0x39 - negs r0, r0 - ands r0, r2 - strb r0, [r3] - adds r1, 0x54 - ldrb r2, [r1] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_0817DE82: - ldr r2, =gBattleTextBuff1 + 2 - ldrh r0, [r2] - cmp r0, 0x71 - bne _0817DEAA - lsls r1, r4, 1 - adds r1, r4 - lsls r1, 2 - adds r1, r7, r1 - adds r3, r1, 0 - adds r3, 0x50 - ldrh r2, [r3] - ldr r0, =0xfffffe3f - ands r0, r2 - strh r0, [r3] - adds r1, 0x54 - ldrb r2, [r1] - movs r0, 0x31 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_0817DEAA: - ldr r1, =gBattleTextBuff1 + 2 - ldrh r0, [r1] - cmp r0, 0x36 - beq _0817DEB4 - b _0817E0A6 -_0817DEB4: - lsls r1, r4, 1 - adds r1, r4 - lsls r1, 2 - adds r1, r7, r1 - adds r4, r1, 0 - adds r4, 0x51 - ldrb r2, [r4] - movs r0, 0x71 - negs r0, r0 - ands r0, r2 - strb r0, [r4] - adds r1, 0x55 - ldrb r2, [r1] - movs r0, 0x4 - negs r0, r0 - b _0817DF6A - .pool -_0817DEDC: - lsls r2, r4, 1 - adds r2, r4 - lsls r2, 2 - adds r2, r7, r2 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - adds r4, r2, 0 - adds r4, 0x51 - movs r0, 0x7 - ands r1, r0 - lsls r1, 1 - ldrb r3, [r4] - movs r0, 0xF - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r4] - adds r2, 0x54 -_0817DF0A: - mov r0, r10 - lsls r3, r0, 6 -_0817DF0E: - ldrb r1, [r2] - movs r0, 0x3F -_0817DF12: - ands r0, r1 - orrs r0, r3 - strb r0, [r2] - b _0817E0A6 - .pool -_0817DF24: - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 2 - adds r1, r7, r0 - adds r0, r1, 0 - adds r0, 0x51 - ldrb r0, [r0] - lsls r0, 28 - lsrs r0, 29 - cmp r0, 0 - bne _0817DF3C - b _0817E0A6 -_0817DF3C: - subs r2, r0, 0x1 - lsls r2, 24 - lsrs r2, 24 - adds r0, r1, 0 - adds r0, 0x54 - ldrb r3, [r0] - lsrs r3, 6 - movs r0, 0xF - b _0817E086 -_0817DF4E: - lsls r1, r4, 1 - adds r1, r4 - lsls r1, 2 - adds r1, r7, r1 - adds r4, r1, 0 - adds r4, 0x51 - ldrb r2, [r4] - movs r0, 0xF - negs r0, r0 - ands r0, r2 - strb r0, [r4] - adds r1, 0x54 - ldrb r2, [r1] - movs r0, 0x3F -_0817DF6A: - ands r0, r2 - strb r0, [r1] - b _0817E0A6 -_0817DF70: - lsls r2, r4, 1 - adds r2, r4 - lsls r2, 2 - adds r2, r7, r2 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - adds r4, r2, 0 - adds r4, 0x51 - movs r0, 0x7 - ands r1, r0 - lsls r1, 4 - ldrb r3, [r4] - movs r0, 0x71 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r4] - adds r2, 0x55 -_0817DF9E: - movs r0, 0x3 - mov r1, r10 - ands r1, r0 - ldrb r3, [r2] - movs r0, 0x4 - negs r0, r0 -_0817DFAA: - ands r0, r3 -_0817DFAC: - orrs r0, r1 - strb r0, [r2] - b _0817E0A6 - .pool -_0817DFBC: - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 2 - adds r1, r7, r0 - adds r0, r1, 0 - adds r0, 0x51 - ldrb r0, [r0] - lsls r0, 25 - lsrs r0, 29 - cmp r0, 0 - beq _0817E0A6 - subs r2, r0, 0x1 - lsls r2, 24 - lsrs r2, 24 - adds r0, r1, 0 - adds r0, 0x55 - ldrb r3, [r0] - lsls r3, 30 - lsrs r3, 30 - movs r0, 0x10 - b _0817E086 -_0817DFE6: - lsls r1, r6, 1 - adds r1, r6 - lsls r1, 2 - adds r1, r7, r1 - adds r3, r1, 0 - adds r3, 0x50 - ldrb r2, [r3] - movs r0, 0x39 - negs r0, r0 - ands r0, r2 - strb r0, [r3] - adds r1, 0x54 - ldrb r2, [r1] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldrh r2, [r3] - ldr r0, =0xfffffe3f - ands r0, r2 - strh r0, [r3] - ldrb r2, [r1] - movs r0, 0x31 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrb r2, [r0] - movs r0, 0x11 - movs r1, 0 - mov r3, r10 - bl sub_817E684 - b _0817E0A6 - .pool -_0817E040: - lsls r0, r4, 4 - adds r4, r7, r0 - adds r0, r4, 0 - adds r0, 0x35 - ldrb r0, [r0] - lsrs r0, 5 - cmp r0, 0 - beq _0817E068 - subs r2, r0, 0x1 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r0, 0x36 - ldrb r3, [r0] - lsls r3, 30 - lsrs r3, 30 - movs r0, 0x15 - movs r1, 0 - bl sub_817E684 -_0817E068: - adds r0, r4, 0 - adds r0, 0x3D - ldrb r0, [r0] - lsrs r0, 5 - cmp r0, 0 - beq _0817E0A6 - subs r2, r0, 0x1 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r0, 0x3E - ldrb r3, [r0] - lsls r3, 30 - lsrs r3, 30 - movs r0, 0x15 -_0817E086: - movs r1, 0 - bl sub_817E684 - b _0817E0A6 -_0817E08E: - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r0, r7, r0 - adds r0, 0x57 - ldrb r2, [r0] - movs r1, 0x1F - negs r1, r1 - ands r1, r2 - movs r2, 0x1C -_0817E0A2: - orrs r1, r2 -_0817E0A4: - strb r1, [r0] -_0817E0A6: - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_817C95C - thumb_func_start sub_817E0B8 sub_817E0B8: @ 817E0B8 push {r4-r6,lr} diff --git a/ld_script.txt b/ld_script.txt index 4ec960eb4..4ae3f183a 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -236,8 +236,8 @@ SECTIONS { src/evolution_graphics.o(.text); src/bard_music.o(.text); src/fldeff_teleport.o(.text); - asm/battle_link_817C95C.o(.text); src/battle_link_817C95C.o(.text); + asm/battle_link_817C95C.o(.text); src/pokemon_animation.o(.text); src/recorded_battle.o(.text); src/battle_controller_recorded_opponent.o(.text); diff --git a/src/battle_link_817C95C.c b/src/battle_link_817C95C.c index 25640b12c..9ac402a03 100644 --- a/src/battle_link_817C95C.c +++ b/src/battle_link_817C95C.c @@ -3,11 +3,16 @@ #include "battle.h" #include "battle_link_817C95C.h" #include "constants/battle_string_ids.h" +#include "constants/moves.h" #include "battle_message.h" -struct UnknownBattleLinkSubStruct1 +struct BattleLinkStringSide { - u32 field_8_0:15; + u32 field_8_0:3; // correct + u32 field_8_0_b:3; // correct + u32 field_8_0_c:3; // correct + u32 field_8_0_d:3; + u32 field_8_0_e:3; u32 field_8_1:3; // correct u32 field_8_2:3; // correct u32 field_8_3:3; // correct @@ -15,8 +20,11 @@ struct UnknownBattleLinkSubStruct1 u32 field_8_5:3; // correct u32 field_8_6:2; - u32 field_0_0a:3; // correct - u32 field_0_0b:7; + u32 field_0_0a:2; // correct + u32 field_0_0b:2; // correct + u32 field_0_0c:2; // correct + u32 field_0_0d:2; + u32 field_0_0e:2; u32 field_0_1:2; // correct u32 field_0_2:2; // correct u32 field_0_3:2; // correct @@ -34,73 +42,78 @@ struct UnknownBattleLinkSubStruct1 u32 field_5_0:3; // correct u32 field_5_1:2; // correct - u32 field_4_3:19; }; -struct UnknownBattleLinkSubStruct2 +struct BattleLinkStringPosition { u32 field_0_0:3; // correct u32 field_0_3:3; // correct u32 field_0_6:3; // correct u32 field_1_1:3; // correct - u32 field_1_4:4; - u32 field_2_0:2; + u32 field_1_4:3; // correct + u32 field_2_0:3; u32 field_2_3:2; // correct u32 field_2_5:2; // correct u32 field_2_7:2; // correct u32 field_3_0:2; // correct - u32 field_3_2:6; - u32 field_4:8; + u32 field_3_2:2; // correct + u32 field_3_4:2; + u32 field_3_6:2; + u32 field_4_0:3; + u32 field_4_3:3; + u32 field_4_6:2; u32 field_5_0:3; // correct u32 field_5_3:2; // correct - u32 field_5_5:2; - u32 field_5_7:1; - u32 field_6:8; - u32 field_7:8; + u32 field_5_5:3; // correct + u32 field_6_0:2; }; -struct UnknownBattleLinkSubStruct3 +struct BattleLinkStringMon { - u32 field_0 : 8; - u32 field_1 : 8; - u32 field_2 : 8; - u32 field_3 : 8; - u32 field_4 : 8; - u32 field_5 : 8; - u32 field_6 : 8; - u32 field_7 : 8; - u32 field_8 : 8; - u32 field_9 : 8; - u32 field_A : 8; - u32 field_B : 8; + u32 field_0_0:3; // correct + u32 field_0_3:3; // correct + u32 field_0_6:3; // correct + u32 field_1_1:3; // correct + u32 field_1_4:3; // correct + u32 field_1_7:3; + u32 field_2_2:2; + u32 field_2_4:2; // correct + u32 field_2_6:2; // correct + u32 field_3_0:2; // correct + u32 field_3_2:2; // correct + u32 field_3_4:2; + u32 field_3_6:2; }; struct UnknownBattleLinkStruct { - u8 field_0[0x2f]; - struct UnknownBattleLinkSubStruct2 pos[2][2]; // [side][flank] - struct UnknownBattleLinkSubStruct1 side[2]; // [side] + struct BattleLinkStringMon mon[2][6]; // [side][partyId] + struct BattleLinkStringPosition pos[2][2]; // [side][flank] + struct BattleLinkStringSide side[2]; // [side] }; extern struct StringInfoBattle *gStringInfo; // this file's functions bool8 sub_817E0B8(u16 stringId); -void sub_817E684(u8 arg0, u16 moveSlotId, u8 arg2, u8 arg3); +void sub_817E684(u8 arg0, u16 arg1, u8 arg2, u8 arg3); void sub_817EECC(void); +void sub_817EA80(u8 arg0); void sub_817C95C(u16 stringId) { struct UnknownBattleLinkStruct *structPtr; - u8 atkSide, defSide, effSide, scriptingSide; + u32 atkSide, defSide, effSide, scriptingSide; struct Pokemon *atkMon, *defMon; u8 moveSlot; - u8 atkFlank, defFlank, effFlank; + u32 atkFlank, defFlank, effFlank; + + register void *var1 asm("r1"), *var2 asm("r2"); if (!(gBattleTypeFlags & BATTLE_TYPE_LINK) && stringId != STRINGID_ITDOESNTAFFECT && stringId != STRINGID_NOTVERYEFFECTIVE) return; - structPtr = (void*)(&gBattleStruct->field_204); + structPtr = (struct UnknownBattleLinkStruct*)(&gBattleStruct->field_204); atkSide = GetBattlerSide(gBattlerAttacker); defSide = GetBattlerSide(gBattlerTarget); @@ -113,14 +126,15 @@ void sub_817C95C(u16 stringId) atkMon = &gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker]]; if (defSide == B_SIDE_PLAYER) - defMon = &gPlayerParty[gBattlerPartyIndexes[gBattlerAttacker]]; + defMon = &gPlayerParty[gBattlerPartyIndexes[gBattlerTarget]]; else - defMon = &gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker]]; + defMon = &gEnemyParty[gBattlerPartyIndexes[gBattlerTarget]]; moveSlot = GetBattlerMoveSlotId(gBattlerAttacker, gStringInfo->currentMove); - if (moveSlot >= 4 && sub_817E0B8(stringId) && stringId >= BATTLESTRINGS_ID_ADDER) + if (moveSlot >= 4 && sub_817E0B8(stringId) && stringId > BATTLESTRINGS_ID_ADDER) { + structPtr->side[atkSide].field_3_0 = 15; return; } @@ -144,7 +158,7 @@ void sub_817C95C(u16 stringId) sub_817E684(1, moveSlot, 0, 0); break; case STRINGID_PKMNFORESAWATTACK: - structPtr->side[atkSide].field_8_1 = gBattlerPartyIndexes[gBattlerAttacker]; + structPtr->side[atkSide].field_8_1 = gBattlerPartyIndexes[gBattlerAttacker] + 1; structPtr->side[atkSide].field_0_1 = moveSlot; break; case STRINGID_PKMNCHOSEXASDESTINY: @@ -157,12 +171,16 @@ void sub_817C95C(u16 stringId) structPtr->side[atkSide].field_4_1 = 1; break; case STRINGID_PKMNPERISHCOUNTFELL: - if (gBattleTextBuff1[4] == 0) + var1 = gBattleTextBuff1 + 4; + if (*(u8*)(var1) == 0) structPtr->side[atkSide].field_3_0 = 10; break; case STRINGID_PKMNWISHCAMETRUE: if (structPtr->side[defSide].field_8_4 != 0) - sub_817E684(2, 3, defSide, (structPtr->side[defSide].field_8_4 - 1) * 4 + structPtr->side[defSide].field_0_4); + { + sub_817E684(2, 3, defSide, + (structPtr->side[defSide].field_8_4 - 1) * 4 + structPtr->side[defSide].field_0_4); + } break; case STRINGID_PKMNWANTSGRUDGE: structPtr->side[atkSide].field_8_5 = gBattlerPartyIndexes[gBattlerAttacker] + 1; @@ -170,7 +188,10 @@ void sub_817C95C(u16 stringId) break; case STRINGID_PKMNLOSTPPGRUDGE: if (structPtr->side[defSide].field_8_5 != 0) - sub_817E684(2, 4, defSide, (structPtr->side[defSide].field_8_5 - 1) * 4 + structPtr->side[defSide].field_0_5); + { + sub_817E684(2, 4, defSide, + (structPtr->side[defSide].field_8_5 - 1) * 4 + structPtr->side[defSide].field_0_5); + } break; case STRINGID_PKMNTRYINGTOTAKEFOE: structPtr->side[atkSide].field_0_6 = gBattlerPartyIndexes[gBattlerAttacker] + 1; @@ -178,7 +199,7 @@ void sub_817C95C(u16 stringId) break; case STRINGID_PKMNTOOKFOE: if (structPtr->side[defSide].field_0_6 != 0) - structPtr->side[defSide].field_3_0 = 11; + structPtr->side[atkSide].field_3_0 = 11; break; case STRINGID_PKMNPLANTEDROOTS: structPtr->pos[atkSide][atkFlank].field_5_0 = gBattlerPartyIndexes[gBattlerAttacker] + 1; @@ -186,11 +207,17 @@ void sub_817C95C(u16 stringId) break; case STRINGID_PKMNABSORBEDNUTRIENTS: if (structPtr->pos[atkSide][atkFlank].field_5_0 != 0) - sub_817E684(2, 6, atkSide, (structPtr->pos[atkSide][atkFlank].field_5_0 - 1) * 4 + structPtr->pos[atkSide][atkFlank].field_5_3); + { + sub_817E684(2, 6, atkSide, + (structPtr->pos[atkSide][atkFlank].field_5_0 - 1) * 4 + structPtr->pos[atkSide][atkFlank].field_5_3); + } break; case STRINGID_PKMNANCHOREDITSELF: if (structPtr->pos[defSide][defFlank].field_5_0 != 0) - sub_817E684(2, 6, defSide, (structPtr->pos[defSide][defFlank].field_5_0 - 1) * 4 + structPtr->pos[defSide][defFlank].field_5_3); + { + sub_817E684(2, 6, defSide, + (structPtr->pos[defSide][defFlank].field_5_0 - 1) * 4 + structPtr->pos[defSide][defFlank].field_5_3); + } break; case STRINGID_PKMNTRANSFORMEDINTO: gBattleStruct->field_B3 = 1; @@ -201,8 +228,8 @@ void sub_817C95C(u16 stringId) case STRINGID_PKMNSSTATCHANGED: if (gBattleTextBuff1[2] != 0) { - u16 *statStringId = (void*)(gBattleTextBuff2 + 2); - if (*statStringId == STRINGID_STATSHARPLY) + var1 = gBattleTextBuff2 + 2; + if (*(u16*)(var1) == STRINGID_STATSHARPLY) sub_817E684(0x17, moveSlot, gBattleTextBuff1[2] - 1, 0); else sub_817E684(0x16, moveSlot, gBattleTextBuff1[2] - 1, 0); @@ -213,8 +240,8 @@ void sub_817C95C(u16 stringId) { if (gBattlerAttacker == gBattlerTarget) { - u16 *statStringId = (void*)(gBattleTextBuff2 + 2); - if (*statStringId == STRINGID_STATSHARPLY) + var1 = gBattleTextBuff2 + 2; + if (*(u16*)(var1) == STRINGID_STATSHARPLY) sub_817E684(0x17, moveSlot, gBattleTextBuff1[2] - 1, 0); else sub_817E684(0x16, moveSlot, gBattleTextBuff1[2] - 1, 0); @@ -232,8 +259,8 @@ void sub_817C95C(u16 stringId) case STRINGID_PKMNSSTATCHANGED4: if (gBattleTextBuff1[2] != 0) { - u16 *statStringId = (void*)(gBattleTextBuff2 + 2); - if (*statStringId == STRINGID_STATHARSHLY) + var1 = gBattleTextBuff2 + 2; + if (*(u16*)(var1) == STRINGID_STATHARSHLY) sub_817E684(0x1A, moveSlot, gBattleTextBuff1[2] - 1, 0); else sub_817E684(0x19, moveSlot, gBattleTextBuff1[2] - 1, 0); @@ -244,7 +271,7 @@ void sub_817C95C(u16 stringId) structPtr->pos[defSide][defFlank].field_2_3 = moveSlot; break; case STRINGID_PKMNAFFLICTEDBYCURSE: - if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0 + if (GetMonData(atkMon, MON_DATA_HP, NULL) && structPtr->pos[atkSide][atkFlank].field_0_0 != 0) { sub_817E684(8, 0, structPtr->pos[atkSide][atkFlank].field_0_0 - 1, structPtr->pos[atkSide][atkFlank].field_2_3); @@ -295,7 +322,196 @@ void sub_817C95C(u16 stringId) } break; case STRINGID_PKMNWASBURNED: - + structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_0_6 = gBattlerPartyIndexes[gBattlerAttacker] + 1; + structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_2_6 = moveSlot; + break; + case STRINGID_PKMNHURTBYBURN: + if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0) + { + if (structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_0_6 != 0) + sub_817E684(8, 4, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_0_6 - 1, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_2_6); + structPtr->side[atkSide].field_3_0 = 4; + structPtr->side[atkSide].field_3_1 = gBattlerPartyIndexes[gBattlerAttacker]; + } + break; + case STRINGID_PKMNWASPOISONED: + structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_0_0 = gBattlerPartyIndexes[gBattlerAttacker] + 1; + structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_2_2 = moveSlot; + break; + case STRINGID_PKMNBADLYPOISONED: + structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_0_3 = gBattlerPartyIndexes[gBattlerAttacker] + 1; + structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_2_4 = moveSlot; + break; + case STRINGID_PKMNHURTBYPOISON: + if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0) + { + if (structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_0_0 != 0) + sub_817E684(8, 2, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_0_0 - 1, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_2_2); + if (structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_0_3 != 0) + sub_817E684(8, 3, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_0_3 - 1, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_2_4); + structPtr->side[atkSide].field_3_0 = 3; + structPtr->side[atkSide].field_3_1 = gBattlerPartyIndexes[gBattlerAttacker]; + } + break; + case STRINGID_PKMNFELLINLOVE: + structPtr->pos[defSide][defFlank].field_1_4 = gBattlerPartyIndexes[gBattlerAttacker] + 1; + structPtr->pos[defSide][defFlank].field_3_2 = moveSlot; + break; + case STRINGID_PKMNIMMOBILIZEDBYLOVE: + if (structPtr->pos[atkSide][atkFlank].field_1_4 != 0) + sub_817E684(9, 0, structPtr->pos[atkSide][atkFlank].field_1_4 - 1, structPtr->pos[atkSide][atkFlank].field_3_2); + break; + case STRINGID_PKMNWASPARALYZED: + structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_1_1 = gBattlerPartyIndexes[gBattlerAttacker] + 1; + structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_3_0 = moveSlot; + break; + case STRINGID_PKMNISPARALYZED: + if (structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_1_1 != 0) + sub_817E684(9, 2, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_1_1 - 1, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_3_0); + break; + case STRINGID_PKMNFELLASLEEP: + structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_1_4 = gBattlerPartyIndexes[gBattlerAttacker] + 1; + structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_3_2 = moveSlot; + break; + case STRINGID_PKMNFASTASLEEP: + if (structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_1_4 != 0 + && gStringInfo->currentMove != MOVE_SNORE + && gStringInfo->currentMove != MOVE_SLEEP_TALK) + sub_817E684(9, 3, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_1_4 - 1, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_3_2); + break; + case STRINGID_PKMNWASFROZEN: + structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_1_7 = gBattlerPartyIndexes[gBattlerAttacker] + 1; + structPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].field_3_4 = moveSlot; + break; + case STRINGID_PKMNISFROZEN: + if (structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_1_7 != 0) + sub_817E684(9, 4, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_1_7 - 1, structPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].field_3_4); + break; + case STRINGID_PKMNWASCONFUSED: + structPtr->pos[effSide][effFlank].field_2_0 = gBattlerPartyIndexes[gBattlerAttacker] + 1; + structPtr->pos[effSide][effFlank].field_3_4 = moveSlot; + break; + case STRINGID_ITHURTCONFUSION: + if (structPtr->pos[atkSide][atkFlank].field_2_0 != 0) + sub_817E684(9, 1, structPtr->pos[atkSide][atkFlank].field_2_0 - 1, structPtr->pos[atkSide][atkFlank].field_3_4); + structPtr->side[atkSide].field_3_0 = 12; + break; + case STRINGID_SPIKESSCATTERED: + structPtr->side[defSide].field_8_0 = gBattlerPartyIndexes[gBattlerAttacker] + 1; + structPtr->side[defSide].field_0_0a = moveSlot; + break; + case STRINGID_PKMNHURTBYSPIKES: + if (structPtr->side[scriptingSide].field_8_0 != 0) + { + sub_817E684(10, scriptingSide ^ BIT_SIDE, structPtr->side[scriptingSide].field_8_0 - 1, structPtr->side[scriptingSide].field_0_0a); + structPtr->side[scriptingSide].field_3_0 = 7; + } + break; + case STRINGID_PKMNBLEWAWAYSPIKES: + structPtr->side[atkSide].field_8_0 = 0; + structPtr->side[atkSide].field_0_0a = 0; + break; + case STRINGID_FIREWEAKENED: + structPtr->pos[atkSide][atkFlank].field_4_0 = gBattlerPartyIndexes[gBattlerAttacker] + 1; + structPtr->pos[atkSide][atkFlank].field_3_6 = moveSlot; + break; + case STRINGID_ELECTRICITYWEAKENED: + structPtr->pos[atkSide][atkFlank].field_4_3 = gBattlerPartyIndexes[gBattlerAttacker] + 1; + structPtr->pos[atkSide][atkFlank].field_4_6 = moveSlot; + break; + case STRINGID_ATTACKERFAINTED: + sub_817EA80(0); + case STRINGID_RETURNMON: + if (structPtr->pos[atkSide][atkFlank].field_4_0 != 0) + { + structPtr->pos[atkSide][atkFlank].field_4_0 = 0; + structPtr->pos[atkSide][atkFlank].field_3_6 = 0; + } + if (structPtr->pos[atkSide][atkFlank].field_4_3 != 0) + { + structPtr->pos[atkSide][atkFlank].field_4_3 = 0; + structPtr->pos[atkSide][atkFlank].field_4_6 = 0; + } + break; + case STRINGID_TARGETFAINTED: + sub_817EA80(1); + if (structPtr->pos[atkSide][defFlank].field_4_0 != 0) + { + structPtr->pos[atkSide][defFlank].field_4_0 = 0; + structPtr->pos[atkSide][defFlank].field_3_6 = 0; + } + if (structPtr->pos[atkSide][defFlank].field_4_3 != 0) + { + structPtr->pos[atkSide][defFlank].field_4_3 = 0; + structPtr->pos[atkSide][defFlank].field_4_6 = 0; + } + break; + case STRINGID_PKMNRAISEDDEF: + case STRINGID_PKMNRAISEDDEFALITTLE: + structPtr->side[atkSide].field_8_0_b = gBattlerPartyIndexes[gBattlerAttacker] + 1; + structPtr->side[atkSide].field_0_0b = moveSlot; + break; + case STRINGID_PKMNRAISEDSPDEF: + case STRINGID_PKMNRAISEDSPDEFALITTLE: + structPtr->side[atkSide].field_8_0_c = gBattlerPartyIndexes[gBattlerAttacker] + 1; + structPtr->side[atkSide].field_0_0c = moveSlot; + break; + case STRINGID_PKMNSXWOREOFF: + var1 = gBattleTextBuff1 + 2; + if (*(u16*)(var1) == MOVE_REFLECT) + { + structPtr->side[atkSide].field_8_0_b = 0; + structPtr->side[atkSide].field_0_0b = 0; + } + var2 = gBattleTextBuff1 + 2; + if (*(u16*)(var2) == MOVE_LIGHT_SCREEN) + { + structPtr->side[atkSide].field_8_0_c = 0; + structPtr->side[atkSide].field_0_0c = 0; + } + var1 = gBattleTextBuff1 + 2; + if (*(u16*)(var1) == MOVE_MIST) + { + structPtr->side[atkSide].field_8_0_e = 0; + structPtr->side[atkSide].field_0_0e = 0; + } + break; + case STRINGID_PKMNCOVEREDBYVEIL: + structPtr->side[atkSide].field_8_0_d = gBattlerPartyIndexes[gBattlerAttacker] + 1; + structPtr->side[atkSide].field_0_0d = moveSlot; + break; + case STRINGID_PKMNUSEDSAFEGUARD: + if (structPtr->side[defSide].field_8_0_d != 0) + sub_817E684(15, 0, structPtr->side[defSide].field_8_0_d - 1, structPtr->side[defSide].field_0_0d); + break; + case STRINGID_PKMNSAFEGUARDEXPIRED: + structPtr->side[atkSide].field_8_0_d = 0; + structPtr->side[atkSide].field_0_0d = 0; + break; + case STRINGID_PKMNSHROUDEDINMIST: + structPtr->side[atkSide].field_8_0_e = gBattlerPartyIndexes[gBattlerAttacker] + 1; + structPtr->side[atkSide].field_0_0e = moveSlot; + break; + case STRINGID_PKMNPROTECTEDBYMIST: + if (structPtr->side[defSide].field_8_0_e != 0) + sub_817E684(16, 0, structPtr->side[defSide].field_8_0_e - 1, structPtr->side[defSide].field_0_0e); + break; + case STRINGID_THEWALLSHATTERED: + structPtr->side[defSide].field_8_0_b = 0; + structPtr->side[defSide].field_0_0b = 0; + structPtr->side[defSide].field_8_0_c = 0; + structPtr->side[defSide].field_0_0c = 0; + sub_817E684(17, 0, gBattlerPartyIndexes[gBattlerAttacker], moveSlot); + break; + case STRINGID_PKMNFLINCHED: + if (structPtr->pos[atkSide][0].field_5_5 != 0) + sub_817E684(21, 0, structPtr->pos[atkSide][0].field_5_5 - 1, structPtr->pos[atkSide][0].field_6_0); + if (structPtr->pos[atkSide][1].field_5_5 != 0) + sub_817E684(21, 0, structPtr->pos[atkSide][1].field_5_5 - 1, structPtr->pos[atkSide][1].field_6_0); + break; + case STRINGID_PKMNCRASHED: + case STRINGID_PKMNHITWITHRECOIL: + structPtr->side[atkSide].field_3_0 = 14; break; } }