mirror of
https://github.com/pret/pokeruby.git
synced 2024-12-11 14:54:06 +00:00
decompile sub_802CA60
This commit is contained in:
parent
b57c52c1b3
commit
2730d1c422
837
asm/battle_5.s
837
asm/battle_5.s
@ -6,843 +6,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_802CA60
|
||||
sub_802CA60: @ 802CA60
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x2C
|
||||
ldr r0, _0802CDEC @ =gMain
|
||||
ldrh r1, [r0, 0x2E]
|
||||
movs r0, 0x5
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0802CA7A
|
||||
b _0802CE78
|
||||
_0802CA7A:
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
ldr r0, _0802CDF0 @ =gMoveSelectionCursor
|
||||
mov r10, r0
|
||||
ldr r1, _0802CDF4 @ =gActiveBank
|
||||
mov r8, r1
|
||||
ldrb r1, [r1]
|
||||
adds r2, r1, r0
|
||||
ldr r5, _0802CDF8 @ =gUnknown_03004344
|
||||
ldrb r0, [r2]
|
||||
ldrb r3, [r5]
|
||||
cmp r0, r3
|
||||
bne _0802CA98
|
||||
b _0802CE14
|
||||
_0802CA98:
|
||||
lsls r1, 9
|
||||
ldr r0, _0802CDFC @ =gUnknown_02023A64
|
||||
adds r1, r0
|
||||
mov r9, r1
|
||||
ldrb r1, [r2]
|
||||
lsls r1, 1
|
||||
add r1, r9
|
||||
ldrh r6, [r1]
|
||||
ldrb r0, [r5]
|
||||
lsls r0, 1
|
||||
add r0, r9
|
||||
ldrh r0, [r0]
|
||||
strh r0, [r1]
|
||||
ldrb r0, [r5]
|
||||
lsls r0, 1
|
||||
add r0, r9
|
||||
strh r6, [r0]
|
||||
mov r1, r8
|
||||
ldrb r0, [r1]
|
||||
add r0, r10
|
||||
ldrb r1, [r0]
|
||||
mov r7, r9
|
||||
adds r7, 0x8
|
||||
adds r1, r7, r1
|
||||
ldrb r6, [r1]
|
||||
ldrb r0, [r5]
|
||||
adds r0, r7, r0
|
||||
ldrb r0, [r0]
|
||||
strb r0, [r1]
|
||||
ldrb r0, [r5]
|
||||
adds r0, r7, r0
|
||||
strb r6, [r0]
|
||||
mov r2, r8
|
||||
ldrb r0, [r2]
|
||||
add r0, r10
|
||||
ldrb r1, [r0]
|
||||
mov r2, r9
|
||||
adds r2, 0xC
|
||||
adds r1, r2, r1
|
||||
ldrb r6, [r1]
|
||||
ldrb r0, [r5]
|
||||
adds r0, r2, r0
|
||||
ldrb r0, [r0]
|
||||
strb r0, [r1]
|
||||
ldrb r0, [r5]
|
||||
adds r2, r0
|
||||
strb r6, [r2]
|
||||
mov r3, r8
|
||||
ldrb r1, [r3]
|
||||
lsls r0, r1, 3
|
||||
subs r0, r1
|
||||
lsls r0, 2
|
||||
ldr r2, _0802CE00 @ =gDisableStructs
|
||||
adds r6, r0, r2
|
||||
ldrb r4, [r6, 0x18]
|
||||
lsls r3, r4, 24
|
||||
lsrs r2, r3, 28
|
||||
ldr r0, _0802CE04 @ =gBitTable
|
||||
mov r12, r0
|
||||
add r1, r10
|
||||
ldrb r0, [r1]
|
||||
lsls r0, 2
|
||||
add r0, r12
|
||||
ldr r0, [r0]
|
||||
ands r2, r0
|
||||
cmp r2, 0
|
||||
beq _0802CB52
|
||||
lsrs r1, r3, 28
|
||||
bics r1, r0
|
||||
lsls r1, 4
|
||||
movs r2, 0xF
|
||||
adds r0, r2, 0
|
||||
ands r0, r4
|
||||
orrs r0, r1
|
||||
strb r0, [r6, 0x18]
|
||||
mov r1, r8
|
||||
ldrb r0, [r1]
|
||||
lsls r1, r0, 3
|
||||
subs r1, r0
|
||||
lsls r1, 2
|
||||
ldr r3, _0802CE00 @ =gDisableStructs
|
||||
adds r1, r3
|
||||
ldrb r4, [r1, 0x18]
|
||||
lsrs r3, r4, 4
|
||||
ldrb r0, [r5]
|
||||
lsls r0, 2
|
||||
add r0, r12
|
||||
ldr r0, [r0]
|
||||
orrs r0, r3
|
||||
lsls r0, 4
|
||||
ands r2, r4
|
||||
orrs r2, r0
|
||||
strb r2, [r1, 0x18]
|
||||
_0802CB52:
|
||||
bl sub_802E1B0
|
||||
movs r6, 0
|
||||
mov r12, r7
|
||||
mov r5, sp
|
||||
adds r5, 0x20
|
||||
str r5, [sp, 0x28]
|
||||
ldr r2, _0802CE08 @ =gBattleMons
|
||||
mov r0, r8
|
||||
ldrb r1, [r0]
|
||||
movs r0, 0x58
|
||||
muls r0, r1
|
||||
adds r0, r2
|
||||
adds r4, r0, 0
|
||||
adds r4, 0x3B
|
||||
mov r7, r8
|
||||
mov r10, r2
|
||||
movs r5, 0x3
|
||||
_0802CB76:
|
||||
mov r3, sp
|
||||
adds r3, r6
|
||||
adds r3, 0x8
|
||||
ldrb r1, [r4]
|
||||
lsls r2, r6, 1
|
||||
adds r0, r5, 0
|
||||
lsls r0, r2
|
||||
ands r1, r0
|
||||
asrs r1, r2
|
||||
strb r1, [r3]
|
||||
adds r6, 0x1
|
||||
cmp r6, 0x3
|
||||
ble _0802CB76
|
||||
ldr r1, _0802CDF0 @ =gMoveSelectionCursor
|
||||
ldrb r0, [r7]
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
add r0, sp
|
||||
adds r0, 0x8
|
||||
ldrb r0, [r0]
|
||||
ldr r2, [sp, 0x28]
|
||||
strb r0, [r2]
|
||||
ldrb r0, [r7]
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
mov r2, sp
|
||||
adds r2, r0
|
||||
adds r2, 0x8
|
||||
ldr r1, _0802CDF8 @ =gUnknown_03004344
|
||||
ldrb r0, [r1]
|
||||
add r0, sp
|
||||
adds r0, 0x8
|
||||
ldrb r0, [r0]
|
||||
movs r3, 0
|
||||
strb r0, [r2]
|
||||
ldrb r0, [r1]
|
||||
mov r1, sp
|
||||
adds r1, r0
|
||||
adds r1, 0x8
|
||||
ldr r5, [sp, 0x28]
|
||||
ldrb r0, [r5]
|
||||
strb r0, [r1]
|
||||
strb r3, [r5]
|
||||
movs r6, 0
|
||||
ldr r2, [sp, 0x28]
|
||||
_0802CBD0:
|
||||
mov r0, sp
|
||||
adds r0, r6
|
||||
adds r0, 0x8
|
||||
ldrb r1, [r0]
|
||||
lsls r0, r6, 1
|
||||
lsls r1, r0
|
||||
ldrb r0, [r2]
|
||||
orrs r0, r1
|
||||
strb r0, [r2]
|
||||
adds r6, 0x1
|
||||
cmp r6, 0x3
|
||||
ble _0802CBD0
|
||||
ldrb r1, [r7]
|
||||
movs r0, 0x58
|
||||
muls r0, r1
|
||||
add r0, r10
|
||||
adds r0, 0x3B
|
||||
ldr r2, [sp, 0x28]
|
||||
ldrb r1, [r2]
|
||||
strb r1, [r0]
|
||||
movs r6, 0
|
||||
adds r4, r7, 0
|
||||
movs r3, 0x58
|
||||
movs r5, 0x24
|
||||
add r5, r10
|
||||
mov r8, r5
|
||||
mov r2, r9
|
||||
mov r7, r10
|
||||
adds r7, 0xC
|
||||
mov r5, r12
|
||||
_0802CC0C:
|
||||
lsls r1, r6, 1
|
||||
ldrb r0, [r4]
|
||||
muls r0, r3
|
||||
adds r1, r0
|
||||
adds r1, r7
|
||||
ldrh r0, [r2]
|
||||
strh r0, [r1]
|
||||
ldrb r0, [r4]
|
||||
adds r1, r0, 0
|
||||
muls r1, r3
|
||||
adds r1, r6, r1
|
||||
add r1, r8
|
||||
adds r0, r5, r6
|
||||
ldrb r0, [r0]
|
||||
strb r0, [r1]
|
||||
adds r2, 0x2
|
||||
adds r6, 0x1
|
||||
cmp r6, 0x3
|
||||
ble _0802CC0C
|
||||
ldr r2, _0802CDF4 @ =gActiveBank
|
||||
ldrb r1, [r2]
|
||||
movs r0, 0x58
|
||||
muls r0, r1
|
||||
mov r1, r10
|
||||
adds r1, 0x50
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
movs r1, 0x80
|
||||
lsls r1, 14
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0802CC4E
|
||||
b _0802CE1C
|
||||
_0802CC4E:
|
||||
movs r6, 0
|
||||
mov r0, sp
|
||||
adds r0, 0xC
|
||||
str r0, [sp, 0x24]
|
||||
add r1, sp, 0x14
|
||||
mov r10, r1
|
||||
ldr r3, _0802CE0C @ =gBattlePartyID
|
||||
mov r9, r3
|
||||
mov r8, r2
|
||||
movs r7, 0x64
|
||||
ldr r5, _0802CE10 @ =gPlayerParty
|
||||
adds r4, r0, 0
|
||||
_0802CC66:
|
||||
mov r1, r8
|
||||
ldrb r0, [r1]
|
||||
lsls r0, 1
|
||||
add r0, r9
|
||||
ldrh r0, [r0]
|
||||
muls r0, r7
|
||||
adds r0, r5
|
||||
adds r1, r6, 0
|
||||
adds r1, 0xD
|
||||
bl GetMonData
|
||||
strh r0, [r4]
|
||||
mov r2, r8
|
||||
ldrb r0, [r2]
|
||||
lsls r0, 1
|
||||
add r0, r9
|
||||
ldrh r0, [r0]
|
||||
muls r0, r7
|
||||
adds r0, r5
|
||||
adds r1, r6, 0
|
||||
adds r1, 0x11
|
||||
bl GetMonData
|
||||
mov r3, r10
|
||||
adds r1, r3, r6
|
||||
strb r0, [r1]
|
||||
adds r4, 0x2
|
||||
adds r6, 0x1
|
||||
cmp r6, 0x3
|
||||
ble _0802CC66
|
||||
ldr r1, _0802CE0C @ =gBattlePartyID
|
||||
ldr r0, _0802CDF4 @ =gActiveBank
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 1
|
||||
adds r0, r1
|
||||
ldrh r1, [r0]
|
||||
movs r0, 0x64
|
||||
muls r0, r1
|
||||
ldr r1, _0802CE10 @ =gPlayerParty
|
||||
adds r0, r1
|
||||
movs r1, 0x15
|
||||
bl GetMonData
|
||||
ldr r5, [sp, 0x28]
|
||||
strb r0, [r5]
|
||||
movs r6, 0
|
||||
movs r5, 0x3
|
||||
ldr r4, [sp, 0x28]
|
||||
_0802CCC6:
|
||||
mov r3, sp
|
||||
adds r3, r6
|
||||
adds r3, 0x8
|
||||
lsls r2, r6, 1
|
||||
adds r1, r5, 0
|
||||
lsls r1, r2
|
||||
ldrb r0, [r4]
|
||||
ands r0, r1
|
||||
asrs r0, r2
|
||||
strb r0, [r3]
|
||||
adds r6, 0x1
|
||||
cmp r6, 0x3
|
||||
ble _0802CCC6
|
||||
ldr r4, _0802CDF0 @ =gMoveSelectionCursor
|
||||
ldr r3, _0802CDF4 @ =gActiveBank
|
||||
ldrb r0, [r3]
|
||||
adds r0, r4
|
||||
ldrb r1, [r0]
|
||||
lsls r1, 1
|
||||
ldr r0, [sp, 0x24]
|
||||
adds r1, r0, r1
|
||||
ldrh r6, [r1]
|
||||
ldr r2, _0802CDF8 @ =gUnknown_03004344
|
||||
ldrb r0, [r2]
|
||||
lsls r0, 1
|
||||
ldr r5, [sp, 0x24]
|
||||
adds r0, r5, r0
|
||||
ldrh r0, [r0]
|
||||
movs r5, 0
|
||||
strh r0, [r1]
|
||||
ldrb r0, [r2]
|
||||
lsls r0, 1
|
||||
ldr r1, [sp, 0x24]
|
||||
adds r0, r1, r0
|
||||
strh r6, [r0]
|
||||
ldrb r0, [r3]
|
||||
adds r0, r4
|
||||
ldrb r1, [r0]
|
||||
add r1, r10
|
||||
ldrb r6, [r1]
|
||||
ldrb r0, [r2]
|
||||
add r0, r10
|
||||
ldrb r0, [r0]
|
||||
strb r0, [r1]
|
||||
ldrb r0, [r2]
|
||||
add r0, r10
|
||||
strb r6, [r0]
|
||||
ldrb r0, [r3]
|
||||
adds r0, r4
|
||||
ldrb r0, [r0]
|
||||
add r0, sp
|
||||
adds r0, 0x8
|
||||
ldrb r0, [r0]
|
||||
ldr r1, [sp, 0x28]
|
||||
strb r0, [r1]
|
||||
ldrb r0, [r3]
|
||||
adds r0, r4
|
||||
ldrb r0, [r0]
|
||||
mov r1, sp
|
||||
adds r1, r0
|
||||
adds r1, 0x8
|
||||
ldrb r0, [r2]
|
||||
add r0, sp
|
||||
adds r0, 0x8
|
||||
ldrb r0, [r0]
|
||||
strb r0, [r1]
|
||||
ldrb r0, [r2]
|
||||
mov r1, sp
|
||||
adds r1, r0
|
||||
adds r1, 0x8
|
||||
ldr r2, [sp, 0x28]
|
||||
ldrb r0, [r2]
|
||||
strb r0, [r1]
|
||||
strb r5, [r2]
|
||||
movs r6, 0
|
||||
ldr r2, [sp, 0x28]
|
||||
_0802CD5E:
|
||||
mov r0, sp
|
||||
adds r0, r6
|
||||
adds r0, 0x8
|
||||
ldrb r1, [r0]
|
||||
lsls r0, r6, 1
|
||||
lsls r1, r0
|
||||
ldrb r0, [r2]
|
||||
orrs r0, r1
|
||||
strb r0, [r2]
|
||||
adds r6, 0x1
|
||||
cmp r6, 0x3
|
||||
ble _0802CD5E
|
||||
movs r6, 0
|
||||
ldr r3, _0802CE0C @ =gBattlePartyID
|
||||
mov r10, r3
|
||||
ldr r5, _0802CDF4 @ =gActiveBank
|
||||
mov r9, r5
|
||||
movs r0, 0x64
|
||||
mov r8, r0
|
||||
ldr r7, _0802CE10 @ =gPlayerParty
|
||||
ldr r5, [sp, 0x24]
|
||||
adds r5, 0x8
|
||||
ldr r4, [sp, 0x24]
|
||||
_0802CD8C:
|
||||
mov r1, r9
|
||||
ldrb r0, [r1]
|
||||
lsls r0, 1
|
||||
add r0, r10
|
||||
ldrh r0, [r0]
|
||||
mov r2, r8
|
||||
muls r2, r0
|
||||
adds r0, r2, 0
|
||||
adds r0, r7
|
||||
adds r1, r6, 0
|
||||
adds r1, 0xD
|
||||
adds r2, r4, 0
|
||||
bl SetMonData
|
||||
mov r3, r9
|
||||
ldrb r0, [r3]
|
||||
lsls r0, 1
|
||||
add r0, r10
|
||||
ldrh r0, [r0]
|
||||
mov r1, r8
|
||||
muls r1, r0
|
||||
adds r0, r1, 0
|
||||
adds r0, r7
|
||||
adds r1, r6, 0
|
||||
adds r1, 0x11
|
||||
adds r2, r5, 0
|
||||
bl SetMonData
|
||||
adds r5, 0x1
|
||||
adds r4, 0x2
|
||||
adds r6, 0x1
|
||||
cmp r6, 0x3
|
||||
ble _0802CD8C
|
||||
ldr r1, _0802CE0C @ =gBattlePartyID
|
||||
ldr r0, _0802CDF4 @ =gActiveBank
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 1
|
||||
adds r0, r1
|
||||
ldrh r1, [r0]
|
||||
movs r0, 0x64
|
||||
muls r0, r1
|
||||
ldr r1, _0802CE10 @ =gPlayerParty
|
||||
adds r0, r1
|
||||
movs r1, 0x15
|
||||
ldr r2, [sp, 0x28]
|
||||
bl SetMonData
|
||||
b _0802CE1C
|
||||
.align 2, 0
|
||||
_0802CDEC: .4byte gMain
|
||||
_0802CDF0: .4byte gMoveSelectionCursor
|
||||
_0802CDF4: .4byte gActiveBank
|
||||
_0802CDF8: .4byte gUnknown_03004344
|
||||
_0802CDFC: .4byte gUnknown_02023A64
|
||||
_0802CE00: .4byte gDisableStructs
|
||||
_0802CE04: .4byte gBitTable
|
||||
_0802CE08: .4byte gBattleMons
|
||||
_0802CE0C: .4byte gBattlePartyID
|
||||
_0802CE10: .4byte gPlayerParty
|
||||
_0802CE14:
|
||||
ldrb r0, [r5]
|
||||
ldr r1, _0802CF20 @ =gUnknown_08400D49
|
||||
bl sub_802E12C
|
||||
_0802CE1C:
|
||||
ldr r1, _0802CF24 @ =gBattleBankFunc
|
||||
ldr r2, _0802CF28 @ =gActiveBank
|
||||
ldrb r0, [r2]
|
||||
lsls r0, 2
|
||||
adds r0, r1
|
||||
ldr r1, _0802CF2C @ =sub_802C68C
|
||||
str r1, [r0]
|
||||
ldr r3, _0802CF30 @ =gMoveSelectionCursor
|
||||
ldrb r0, [r2]
|
||||
adds r0, r3
|
||||
ldr r1, _0802CF34 @ =gUnknown_03004344
|
||||
ldrb r1, [r1]
|
||||
strb r1, [r0]
|
||||
ldrb r0, [r2]
|
||||
adds r0, r3
|
||||
ldrb r0, [r0]
|
||||
movs r1, 0
|
||||
bl sub_802E3B4
|
||||
ldr r4, _0802CF38 @ =gUnknown_03004210
|
||||
ldr r1, _0802CF3C @ =0x00001016
|
||||
movs r0, 0x1C
|
||||
str r0, [sp]
|
||||
movs r0, 0x3A
|
||||
str r0, [sp, 0x4]
|
||||
adds r0, r4, 0
|
||||
movs r2, 0x17
|
||||
movs r3, 0x37
|
||||
bl FillWindowRect
|
||||
ldr r1, _0802CF40 @ =gUnknown_08400D38
|
||||
movs r2, 0xA4
|
||||
lsls r2, 2
|
||||
movs r0, 0x37
|
||||
str r0, [sp]
|
||||
adds r0, r4, 0
|
||||
movs r3, 0x17
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
bl sub_802E220
|
||||
bl sub_802E2D4
|
||||
_0802CE78:
|
||||
ldr r6, _0802CF44 @ =gMain
|
||||
ldrh r1, [r6, 0x2E]
|
||||
movs r0, 0x6
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0802CEF0
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
ldr r0, _0802CF34 @ =gUnknown_03004344
|
||||
ldrb r0, [r0]
|
||||
bl nullsub_7
|
||||
ldr r5, _0802CF30 @ =gMoveSelectionCursor
|
||||
ldr r4, _0802CF28 @ =gActiveBank
|
||||
ldrb r0, [r4]
|
||||
adds r0, r5
|
||||
ldrb r0, [r0]
|
||||
movs r1, 0
|
||||
bl sub_802E3B4
|
||||
ldrb r0, [r4]
|
||||
adds r0, r5
|
||||
ldrb r0, [r0]
|
||||
ldr r1, _0802CF20 @ =gUnknown_08400D49
|
||||
bl sub_802E12C
|
||||
ldr r1, _0802CF24 @ =gBattleBankFunc
|
||||
ldrb r0, [r4]
|
||||
lsls r0, 2
|
||||
adds r0, r1
|
||||
ldr r1, _0802CF2C @ =sub_802C68C
|
||||
str r1, [r0]
|
||||
ldr r4, _0802CF38 @ =gUnknown_03004210
|
||||
ldr r1, _0802CF3C @ =0x00001016
|
||||
movs r0, 0x1C
|
||||
str r0, [sp]
|
||||
movs r0, 0x3A
|
||||
str r0, [sp, 0x4]
|
||||
adds r0, r4, 0
|
||||
movs r2, 0x17
|
||||
movs r3, 0x37
|
||||
bl FillWindowRect
|
||||
ldr r1, _0802CF40 @ =gUnknown_08400D38
|
||||
movs r2, 0xA4
|
||||
lsls r2, 2
|
||||
movs r0, 0x37
|
||||
str r0, [sp]
|
||||
adds r0, r4, 0
|
||||
movs r3, 0x17
|
||||
bl InitWindow
|
||||
adds r0, r4, 0
|
||||
bl sub_8002F44
|
||||
bl sub_802E220
|
||||
bl sub_802E2D4
|
||||
_0802CEF0:
|
||||
ldrh r1, [r6, 0x2E]
|
||||
movs r0, 0x20
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0802CF8C
|
||||
ldr r3, _0802CF34 @ =gUnknown_03004344
|
||||
ldrb r2, [r3]
|
||||
movs r0, 0x1
|
||||
ands r0, r2
|
||||
cmp r0, 0
|
||||
beq _0802CF8C
|
||||
ldr r0, _0802CF30 @ =gMoveSelectionCursor
|
||||
ldr r1, _0802CF28 @ =gActiveBank
|
||||
ldrb r1, [r1]
|
||||
adds r1, r0
|
||||
ldrb r5, [r1]
|
||||
cmp r2, r5
|
||||
bne _0802CF48
|
||||
ldrb r0, [r1]
|
||||
movs r1, 0x1D
|
||||
bl sub_802E3B4
|
||||
b _0802CF4E
|
||||
.align 2, 0
|
||||
_0802CF20: .4byte gUnknown_08400D49
|
||||
_0802CF24: .4byte gBattleBankFunc
|
||||
_0802CF28: .4byte gActiveBank
|
||||
_0802CF2C: .4byte sub_802C68C
|
||||
_0802CF30: .4byte gMoveSelectionCursor
|
||||
_0802CF34: .4byte gUnknown_03004344
|
||||
_0802CF38: .4byte gUnknown_03004210
|
||||
_0802CF3C: .4byte 0x00001016
|
||||
_0802CF40: .4byte gUnknown_08400D38
|
||||
_0802CF44: .4byte gMain
|
||||
_0802CF48:
|
||||
ldrb r0, [r3]
|
||||
bl nullsub_7
|
||||
_0802CF4E:
|
||||
ldr r4, _0802CF78 @ =gUnknown_03004344
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x1
|
||||
eors r0, r1
|
||||
strb r0, [r4]
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
ldr r1, _0802CF7C @ =gMoveSelectionCursor
|
||||
ldr r0, _0802CF80 @ =gActiveBank
|
||||
ldrb r0, [r0]
|
||||
adds r0, r1
|
||||
ldrb r1, [r4]
|
||||
ldrb r0, [r0]
|
||||
cmp r1, r0
|
||||
bne _0802CF84
|
||||
adds r0, r1, 0
|
||||
movs r1, 0
|
||||
bl sub_802E3B4
|
||||
b _0802CF8C
|
||||
.align 2, 0
|
||||
_0802CF78: .4byte gUnknown_03004344
|
||||
_0802CF7C: .4byte gMoveSelectionCursor
|
||||
_0802CF80: .4byte gActiveBank
|
||||
_0802CF84:
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x1B
|
||||
bl sub_802E3B4
|
||||
_0802CF8C:
|
||||
ldr r0, _0802CFC8 @ =gMain
|
||||
ldrh r1, [r0, 0x2E]
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0802D020
|
||||
ldr r3, _0802CFCC @ =gUnknown_03004344
|
||||
ldrb r2, [r3]
|
||||
movs r0, 0x1
|
||||
ands r0, r2
|
||||
cmp r0, 0
|
||||
bne _0802D020
|
||||
ldr r1, _0802CFD0 @ =gUnknown_03004348
|
||||
movs r0, 0x1
|
||||
eors r0, r2
|
||||
ldrb r1, [r1]
|
||||
cmp r0, r1
|
||||
bcs _0802D020
|
||||
ldr r0, _0802CFD4 @ =gMoveSelectionCursor
|
||||
ldr r1, _0802CFD8 @ =gActiveBank
|
||||
ldrb r1, [r1]
|
||||
adds r1, r0
|
||||
ldrb r0, [r1]
|
||||
cmp r2, r0
|
||||
bne _0802CFDC
|
||||
ldrb r0, [r1]
|
||||
movs r1, 0x1D
|
||||
bl sub_802E3B4
|
||||
b _0802CFE2
|
||||
.align 2, 0
|
||||
_0802CFC8: .4byte gMain
|
||||
_0802CFCC: .4byte gUnknown_03004344
|
||||
_0802CFD0: .4byte gUnknown_03004348
|
||||
_0802CFD4: .4byte gMoveSelectionCursor
|
||||
_0802CFD8: .4byte gActiveBank
|
||||
_0802CFDC:
|
||||
ldrb r0, [r3]
|
||||
bl nullsub_7
|
||||
_0802CFE2:
|
||||
ldr r4, _0802D00C @ =gUnknown_03004344
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x1
|
||||
eors r0, r1
|
||||
strb r0, [r4]
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
ldr r1, _0802D010 @ =gMoveSelectionCursor
|
||||
ldr r0, _0802D014 @ =gActiveBank
|
||||
ldrb r0, [r0]
|
||||
adds r0, r1
|
||||
ldrb r1, [r4]
|
||||
ldrb r0, [r0]
|
||||
cmp r1, r0
|
||||
bne _0802D018
|
||||
adds r0, r1, 0
|
||||
movs r1, 0
|
||||
bl sub_802E3B4
|
||||
b _0802D020
|
||||
.align 2, 0
|
||||
_0802D00C: .4byte gUnknown_03004344
|
||||
_0802D010: .4byte gMoveSelectionCursor
|
||||
_0802D014: .4byte gActiveBank
|
||||
_0802D018:
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x1B
|
||||
bl sub_802E3B4
|
||||
_0802D020:
|
||||
ldr r0, _0802D050 @ =gMain
|
||||
ldrh r1, [r0, 0x2E]
|
||||
movs r0, 0x40
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0802D0A4
|
||||
ldr r3, _0802D054 @ =gUnknown_03004344
|
||||
ldrb r2, [r3]
|
||||
movs r0, 0x2
|
||||
ands r0, r2
|
||||
cmp r0, 0
|
||||
beq _0802D0A4
|
||||
ldr r0, _0802D058 @ =gMoveSelectionCursor
|
||||
ldr r1, _0802D05C @ =gActiveBank
|
||||
ldrb r1, [r1]
|
||||
adds r1, r0
|
||||
ldrb r5, [r1]
|
||||
cmp r2, r5
|
||||
bne _0802D060
|
||||
ldrb r0, [r1]
|
||||
movs r1, 0x1D
|
||||
bl sub_802E3B4
|
||||
b _0802D066
|
||||
.align 2, 0
|
||||
_0802D050: .4byte gMain
|
||||
_0802D054: .4byte gUnknown_03004344
|
||||
_0802D058: .4byte gMoveSelectionCursor
|
||||
_0802D05C: .4byte gActiveBank
|
||||
_0802D060:
|
||||
ldrb r0, [r3]
|
||||
bl nullsub_7
|
||||
_0802D066:
|
||||
ldr r4, _0802D090 @ =gUnknown_03004344
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x2
|
||||
eors r0, r1
|
||||
strb r0, [r4]
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
ldr r1, _0802D094 @ =gMoveSelectionCursor
|
||||
ldr r0, _0802D098 @ =gActiveBank
|
||||
ldrb r0, [r0]
|
||||
adds r0, r1
|
||||
ldrb r1, [r4]
|
||||
ldrb r0, [r0]
|
||||
cmp r1, r0
|
||||
bne _0802D09C
|
||||
adds r0, r1, 0
|
||||
movs r1, 0
|
||||
bl sub_802E3B4
|
||||
b _0802D0A4
|
||||
.align 2, 0
|
||||
_0802D090: .4byte gUnknown_03004344
|
||||
_0802D094: .4byte gMoveSelectionCursor
|
||||
_0802D098: .4byte gActiveBank
|
||||
_0802D09C:
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x1B
|
||||
bl sub_802E3B4
|
||||
_0802D0A4:
|
||||
ldr r0, _0802D0E0 @ =gMain
|
||||
ldrh r1, [r0, 0x2E]
|
||||
movs r0, 0x80
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0802D138
|
||||
ldr r3, _0802D0E4 @ =gUnknown_03004344
|
||||
ldrb r2, [r3]
|
||||
movs r0, 0x2
|
||||
ands r0, r2
|
||||
cmp r0, 0
|
||||
bne _0802D138
|
||||
ldr r1, _0802D0E8 @ =gUnknown_03004348
|
||||
movs r0, 0x2
|
||||
eors r0, r2
|
||||
ldrb r1, [r1]
|
||||
cmp r0, r1
|
||||
bcs _0802D138
|
||||
ldr r0, _0802D0EC @ =gMoveSelectionCursor
|
||||
ldr r1, _0802D0F0 @ =gActiveBank
|
||||
ldrb r1, [r1]
|
||||
adds r1, r0
|
||||
ldrb r0, [r1]
|
||||
cmp r2, r0
|
||||
bne _0802D0F4
|
||||
ldrb r0, [r1]
|
||||
movs r1, 0x1D
|
||||
bl sub_802E3B4
|
||||
b _0802D0FA
|
||||
.align 2, 0
|
||||
_0802D0E0: .4byte gMain
|
||||
_0802D0E4: .4byte gUnknown_03004344
|
||||
_0802D0E8: .4byte gUnknown_03004348
|
||||
_0802D0EC: .4byte gMoveSelectionCursor
|
||||
_0802D0F0: .4byte gActiveBank
|
||||
_0802D0F4:
|
||||
ldrb r0, [r3]
|
||||
bl nullsub_7
|
||||
_0802D0FA:
|
||||
ldr r4, _0802D124 @ =gUnknown_03004344
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x2
|
||||
eors r0, r1
|
||||
strb r0, [r4]
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
ldr r1, _0802D128 @ =gMoveSelectionCursor
|
||||
ldr r0, _0802D12C @ =gActiveBank
|
||||
ldrb r0, [r0]
|
||||
adds r0, r1
|
||||
ldrb r1, [r4]
|
||||
ldrb r0, [r0]
|
||||
cmp r1, r0
|
||||
bne _0802D130
|
||||
adds r0, r1, 0
|
||||
movs r1, 0
|
||||
bl sub_802E3B4
|
||||
b _0802D138
|
||||
.align 2, 0
|
||||
_0802D124: .4byte gUnknown_03004344
|
||||
_0802D128: .4byte gMoveSelectionCursor
|
||||
_0802D12C: .4byte gActiveBank
|
||||
_0802D130:
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x1B
|
||||
bl sub_802E3B4
|
||||
_0802D138:
|
||||
add sp, 0x2C
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_802CA60
|
||||
|
||||
thumb_func_start sub_802D148
|
||||
sub_802D148: @ 802D148
|
||||
push {lr}
|
||||
|
190
src/battle_5.c
190
src/battle_5.c
@ -31,6 +31,7 @@ extern u16 gUnknown_030042A4;
|
||||
extern struct Window gUnknown_03004210;
|
||||
extern const u8 gUnknown_08400D89[];
|
||||
extern u8 gUnknown_03004348;
|
||||
extern struct BattlePokemon gBattleMons[];
|
||||
|
||||
extern void dp11b_obj_instanciate(u8, u8, s8, s8);
|
||||
extern u8 GetBankIdentity(u8);
|
||||
@ -43,6 +44,7 @@ extern void sub_802E3B4();
|
||||
extern void sub_802E220();
|
||||
extern void sub_802E2D4();
|
||||
extern void sub_802E12C();
|
||||
extern void sub_802E1B0(void);
|
||||
|
||||
void PlayerHandleGetAttributes(void);
|
||||
void sub_802ECF0(void);
|
||||
@ -448,11 +450,12 @@ void sub_802C2EC(void)
|
||||
|
||||
struct UnknownStruct1
|
||||
{
|
||||
u16 unk0[4];
|
||||
u8 unk8[4];
|
||||
u8 fillerC[0x12-0xC];
|
||||
u16 moves[4];
|
||||
u8 pp[4];
|
||||
u8 unkC[0x12-0xC];
|
||||
u8 unk12;
|
||||
u8 unk13;
|
||||
u8 filler14[0x20-0x14];
|
||||
};
|
||||
|
||||
void sub_802C68C(void)
|
||||
@ -466,10 +469,10 @@ void sub_802C68C(void)
|
||||
|
||||
PlaySE(SE_SELECT);
|
||||
|
||||
if (r6->unk0[gMoveSelectionCursor[gActiveBank]] == 0xAE)
|
||||
if (r6->moves[gMoveSelectionCursor[gActiveBank]] == 0xAE)
|
||||
r4 = (r6->unk12 != 7 && (r6->unk13 ^ 7)) ? 0x10 : 0;
|
||||
else
|
||||
r4 = gBattleMoves[r6->unk0[gMoveSelectionCursor[gActiveBank]]].target;
|
||||
r4 = gBattleMoves[r6->moves[gMoveSelectionCursor[gActiveBank]]].target;
|
||||
|
||||
if (r4 & 0x10)
|
||||
gUnknown_03004344 = gActiveBank;
|
||||
@ -485,7 +488,7 @@ void sub_802C68C(void)
|
||||
{
|
||||
if (!(r4 & 0x7D))
|
||||
r8++;
|
||||
if (r6->unk8[gMoveSelectionCursor[gActiveBank]] == 0)
|
||||
if (r6->pp[gMoveSelectionCursor[gActiveBank]] == 0)
|
||||
{
|
||||
r8 = 0;
|
||||
}
|
||||
@ -589,3 +592,178 @@ void sub_802C68C(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern const u8 gUnknown_08400D49[];
|
||||
extern const u8 gUnknown_08400D38[];
|
||||
|
||||
void sub_802CA60(void)
|
||||
{
|
||||
u8 perMovePPBonuses[4];
|
||||
struct
|
||||
{
|
||||
u16 moves[4];
|
||||
u8 pp[4];
|
||||
u8 filler18[8]; // what is this?
|
||||
} sp0;
|
||||
//struct UnknownStruct1 sp0;
|
||||
u8 totalPPBonuses;
|
||||
|
||||
if (gMain.newKeys & (A_BUTTON | SELECT_BUTTON))
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
if (gMoveSelectionCursor[gActiveBank] != gUnknown_03004344)
|
||||
{
|
||||
struct UnknownStruct1 *r9 = (struct UnknownStruct1 *)&gBattleBufferA[gActiveBank][4];
|
||||
s32 i;
|
||||
|
||||
i = r9->moves[gMoveSelectionCursor[gActiveBank]];
|
||||
r9->moves[gMoveSelectionCursor[gActiveBank]] = r9->moves[gUnknown_03004344];
|
||||
r9->moves[gUnknown_03004344] = i;
|
||||
|
||||
i = r9->pp[gMoveSelectionCursor[gActiveBank]];
|
||||
r9->pp[gMoveSelectionCursor[gActiveBank]] = r9->pp[gUnknown_03004344];
|
||||
r9->pp[gUnknown_03004344] = i;
|
||||
|
||||
i = r9->unkC[gMoveSelectionCursor[gActiveBank]];
|
||||
r9->unkC[gMoveSelectionCursor[gActiveBank]] = r9->unkC[gUnknown_03004344];
|
||||
r9->unkC[gUnknown_03004344] = i;
|
||||
|
||||
if (gDisableStructs[gActiveBank].unk18_b & gBitTable[gMoveSelectionCursor[gActiveBank]])
|
||||
{
|
||||
gDisableStructs[gActiveBank].unk18_b &= ~gBitTable[gMoveSelectionCursor[gActiveBank]];
|
||||
gDisableStructs[gActiveBank].unk18_b |= gBitTable[gUnknown_03004344];
|
||||
}
|
||||
|
||||
sub_802E1B0();
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
perMovePPBonuses[i] = (gBattleMons[gActiveBank].ppBonuses & (3 << (i * 2))) >> (i * 2);
|
||||
totalPPBonuses = perMovePPBonuses[gMoveSelectionCursor[gActiveBank]];
|
||||
perMovePPBonuses[gMoveSelectionCursor[gActiveBank]] = perMovePPBonuses[gUnknown_03004344];
|
||||
perMovePPBonuses[gUnknown_03004344] = totalPPBonuses;
|
||||
|
||||
totalPPBonuses = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
totalPPBonuses |= perMovePPBonuses[i] << (i * 2);
|
||||
gBattleMons[gActiveBank].ppBonuses = totalPPBonuses;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
gBattleMons[gActiveBank].moves[i] = r9->moves[i];
|
||||
gBattleMons[gActiveBank].pp[i] = r9->pp[i];
|
||||
}
|
||||
if (!(gBattleMons[gActiveBank].status2 & 0x200000))
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
sp0.moves[i] = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MOVE1 + i);
|
||||
sp0.pp[i] = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_PP1 + i);
|
||||
}
|
||||
|
||||
totalPPBonuses = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_PP_BONUSES);
|
||||
for (i = 0; i < 4; i++)
|
||||
perMovePPBonuses[i] = (totalPPBonuses & (3 << (i * 2))) >> (i * 2);
|
||||
|
||||
i = sp0.moves[gMoveSelectionCursor[gActiveBank]];
|
||||
sp0.moves[gMoveSelectionCursor[gActiveBank]] = sp0.moves[gUnknown_03004344];
|
||||
sp0.moves[gUnknown_03004344] = i;
|
||||
|
||||
i = sp0.pp[gMoveSelectionCursor[gActiveBank]];
|
||||
sp0.pp[gMoveSelectionCursor[gActiveBank]] = sp0.pp[gUnknown_03004344];
|
||||
sp0.pp[gUnknown_03004344] = i;
|
||||
|
||||
totalPPBonuses = perMovePPBonuses[gMoveSelectionCursor[gActiveBank]];
|
||||
perMovePPBonuses[gMoveSelectionCursor[gActiveBank]] = perMovePPBonuses[gUnknown_03004344];
|
||||
perMovePPBonuses[gUnknown_03004344] = totalPPBonuses;
|
||||
|
||||
totalPPBonuses = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
totalPPBonuses |= perMovePPBonuses[i] << (i * 2);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MOVE1 + i, (u8 *)&sp0.moves[i]);
|
||||
SetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_PP1 + i, &sp0.pp[i]);
|
||||
}
|
||||
SetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_PP_BONUSES, &totalPPBonuses);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_802E12C(gUnknown_03004344, gUnknown_08400D49);
|
||||
}
|
||||
gBattleBankFunc[gActiveBank] = sub_802C68C;
|
||||
gMoveSelectionCursor[gActiveBank] = gUnknown_03004344;
|
||||
sub_802E3B4(gMoveSelectionCursor[gActiveBank], 0);
|
||||
FillWindowRect(&gUnknown_03004210, 0x1016, 0x17, 0x37, 0x1C, 0x3A);
|
||||
InitWindow(&gUnknown_03004210, gUnknown_08400D38, 0x290, 0x17, 0x37);
|
||||
sub_8002F44(&gUnknown_03004210);
|
||||
sub_802E220();
|
||||
sub_802E2D4();
|
||||
}
|
||||
if (gMain.newKeys & (B_BUTTON | SELECT_BUTTON))
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
nullsub_7(gUnknown_03004344);
|
||||
sub_802E3B4(gMoveSelectionCursor[gActiveBank], 0);
|
||||
sub_802E12C(gMoveSelectionCursor[gActiveBank], gUnknown_08400D49);
|
||||
gBattleBankFunc[gActiveBank] = sub_802C68C;
|
||||
FillWindowRect(&gUnknown_03004210, 0x1016, 0x17, 0x37, 0x1C, 0x3A);
|
||||
InitWindow(&gUnknown_03004210, gUnknown_08400D38, 0x290, 0x17, 0x37);
|
||||
sub_8002F44(&gUnknown_03004210);
|
||||
sub_802E220();
|
||||
sub_802E2D4();
|
||||
}
|
||||
if ((gMain.newKeys & DPAD_LEFT) && (gUnknown_03004344 & 1))
|
||||
{
|
||||
if (gUnknown_03004344 == gMoveSelectionCursor[gActiveBank])
|
||||
sub_802E3B4(gMoveSelectionCursor[gActiveBank], 0x1D);
|
||||
else
|
||||
nullsub_7(gUnknown_03004344);
|
||||
gUnknown_03004344 ^= 1;
|
||||
PlaySE(SE_SELECT);
|
||||
if (gUnknown_03004344 == gMoveSelectionCursor[gActiveBank])
|
||||
sub_802E3B4(gUnknown_03004344, 0);
|
||||
else
|
||||
sub_802E3B4(gUnknown_03004344, 0x1B);
|
||||
}
|
||||
if ((gMain.newKeys & DPAD_RIGHT) && !(gUnknown_03004344 & 1) && (gUnknown_03004344 ^ 1) < gUnknown_03004348)
|
||||
{
|
||||
if (gUnknown_03004344 == gMoveSelectionCursor[gActiveBank])
|
||||
sub_802E3B4(gMoveSelectionCursor[gActiveBank], 0x1D);
|
||||
else
|
||||
nullsub_7(gUnknown_03004344);
|
||||
gUnknown_03004344 ^= 1;
|
||||
PlaySE(SE_SELECT);
|
||||
if (gUnknown_03004344 == gMoveSelectionCursor[gActiveBank])
|
||||
sub_802E3B4(gUnknown_03004344, 0);
|
||||
else
|
||||
sub_802E3B4(gUnknown_03004344, 0x1B);
|
||||
}
|
||||
if ((gMain.newKeys & DPAD_UP) && (gUnknown_03004344 & 2))
|
||||
{
|
||||
if (gUnknown_03004344 == gMoveSelectionCursor[gActiveBank])
|
||||
sub_802E3B4(gMoveSelectionCursor[gActiveBank], 0x1D);
|
||||
else
|
||||
nullsub_7(gUnknown_03004344);
|
||||
gUnknown_03004344 ^= 2;
|
||||
PlaySE(SE_SELECT);
|
||||
if (gUnknown_03004344 == gMoveSelectionCursor[gActiveBank])
|
||||
sub_802E3B4(gUnknown_03004344, 0);
|
||||
else
|
||||
sub_802E3B4(gUnknown_03004344, 0x1B);
|
||||
}
|
||||
if ((gMain.newKeys & DPAD_DOWN) && !(gUnknown_03004344 & 2) && (gUnknown_03004344 ^ 2) < gUnknown_03004348)
|
||||
{
|
||||
if (gUnknown_03004344 == gMoveSelectionCursor[gActiveBank])
|
||||
sub_802E3B4(gMoveSelectionCursor[gActiveBank], 0x1D);
|
||||
else
|
||||
nullsub_7(gUnknown_03004344);
|
||||
gUnknown_03004344 ^= 2;
|
||||
PlaySE(SE_SELECT);
|
||||
if (gUnknown_03004344 == gMoveSelectionCursor[gActiveBank])
|
||||
sub_802E3B4(gUnknown_03004344, 0);
|
||||
else
|
||||
sub_802E3B4(gUnknown_03004344, 0x1B);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user