mirror of
https://github.com/pret/pmd-red.git
synced 2024-11-27 15:00:33 +00:00
387 lines
6.1 KiB
ArmAsm
387 lines
6.1 KiB
ArmAsm
#include "asm/constants/gba_constants.inc"
|
|
#include "asm/macros.inc"
|
|
|
|
.syntax unified
|
|
|
|
.text
|
|
|
|
thumb_func_start sub_8078A58
|
|
sub_8078A58:
|
|
push {r4-r7,lr}
|
|
mov r7, r8
|
|
push {r7}
|
|
sub sp, 0x14
|
|
mov r8, r0
|
|
adds r6, r1, 0
|
|
adds r7, r2, 0
|
|
adds r5, r3, 0
|
|
adds r0, r6, 0
|
|
bl EntityExists
|
|
lsls r0, 24
|
|
cmp r0, 0
|
|
beq _08078B4A
|
|
ldr r4, [r6, 0x70]
|
|
cmp r5, 0
|
|
beq _08078AE0
|
|
mov r0, sp
|
|
adds r1, r5, 0
|
|
bl sub_80943A0
|
|
ldr r2, [sp]
|
|
movs r0, 0xA0
|
|
lsls r0, 1
|
|
adds r5, r4, r0
|
|
ldr r7, [r5]
|
|
add r0, sp, 0x4
|
|
adds r1, r7, 0
|
|
bl sub_80942C0
|
|
ldr r2, [sp, 0x4]
|
|
str r2, [r5]
|
|
movs r0, 0x9E
|
|
lsls r0, 1
|
|
adds r4, r0
|
|
ldr r1, [r4]
|
|
add r0, sp, 0x8
|
|
bl sub_8094318
|
|
ldr r0, [sp, 0x8]
|
|
str r0, [r4]
|
|
ldr r0, _08078AD0
|
|
adds r1, r6, 0
|
|
movs r2, 0
|
|
bl SetMessageArgument
|
|
adds r0, r7, 0
|
|
bl RoundUpFixedPoint
|
|
adds r4, r0, 0
|
|
ldr r0, [r5]
|
|
bl RoundUpFixedPoint
|
|
cmp r4, r0
|
|
beq _08078AD8
|
|
adds r0, r6, 0
|
|
bl sub_8041D9C
|
|
ldr r0, _08078AD4
|
|
b _08078B22
|
|
.align 2, 0
|
|
_08078AD0: .4byte gAvailablePokemonNames
|
|
_08078AD4: .4byte gUnknown_80FBD9C
|
|
_08078AD8:
|
|
ldr r0, _08078ADC
|
|
b _08078B22
|
|
.align 2, 0
|
|
_08078ADC: .4byte gUnknown_80FBE3C
|
|
_08078AE0:
|
|
add r0, sp, 0xC
|
|
adds r1, r7, 0
|
|
bl sub_80943A0
|
|
ldr r2, [sp, 0xC]
|
|
movs r0, 0x9E
|
|
lsls r0, 1
|
|
adds r4, r0
|
|
ldr r7, [r4]
|
|
add r0, sp, 0x10
|
|
adds r1, r7, 0
|
|
bl sub_80942C0
|
|
ldr r0, [sp, 0x10]
|
|
str r0, [r4]
|
|
ldr r0, _08078B30
|
|
adds r1, r6, 0
|
|
movs r2, 0
|
|
bl SetMessageArgument
|
|
adds r0, r7, 0
|
|
bl RoundUpFixedPoint
|
|
adds r5, r0, 0
|
|
ldr r0, [r4]
|
|
bl RoundUpFixedPoint
|
|
cmp r5, r0
|
|
beq _08078B38
|
|
adds r0, r6, 0
|
|
bl nullsub_84
|
|
ldr r0, _08078B34
|
|
_08078B22:
|
|
ldr r2, [r0]
|
|
mov r0, r8
|
|
adds r1, r6, 0
|
|
bl sub_80522F4
|
|
b _08078B44
|
|
.align 2, 0
|
|
_08078B30: .4byte gAvailablePokemonNames
|
|
_08078B34: .4byte gUnknown_80FBD78
|
|
_08078B38:
|
|
ldr r0, _08078B58
|
|
ldr r2, [r0]
|
|
mov r0, r8
|
|
adds r1, r6, 0
|
|
bl sub_80522F4
|
|
_08078B44:
|
|
adds r0, r6, 0
|
|
bl EntityUpdateStatusSprites
|
|
_08078B4A:
|
|
add sp, 0x14
|
|
pop {r3}
|
|
mov r8, r3
|
|
pop {r4-r7}
|
|
pop {r0}
|
|
bx r0
|
|
.align 2, 0
|
|
_08078B58: .4byte gUnknown_80FBE40
|
|
thumb_func_end sub_8078A58
|
|
|
|
thumb_func_start sub_8078B5C
|
|
sub_8078B5C:
|
|
push {r4-r7,lr}
|
|
mov r7, r10
|
|
mov r6, r9
|
|
mov r5, r8
|
|
push {r5-r7}
|
|
sub sp, 0x28
|
|
mov r9, r0
|
|
adds r6, r1, 0
|
|
mov r10, r2
|
|
str r3, [sp, 0x1C]
|
|
ldr r0, [sp, 0x48]
|
|
lsls r0, 24
|
|
lsrs r0, 24
|
|
mov r8, r0
|
|
adds r0, r6, 0
|
|
bl EntityExists
|
|
lsls r0, 24
|
|
cmp r0, 0
|
|
bne _08078B86
|
|
b _08078D78
|
|
_08078B86:
|
|
ldr r7, [r6, 0x70]
|
|
ldrb r0, [r7, 0x7]
|
|
cmp r0, 0
|
|
bne _08078BB8
|
|
adds r0, r6, 0
|
|
movs r1, 0x1B
|
|
bl HasHeldItem
|
|
lsls r0, 24
|
|
cmp r0, 0
|
|
beq _08078BB8
|
|
mov r0, r8
|
|
cmp r0, 0
|
|
bne _08078BA4
|
|
b _08078D78
|
|
_08078BA4:
|
|
ldr r0, _08078BB4
|
|
ldr r2, [r0]
|
|
mov r0, r9
|
|
adds r1, r6, 0
|
|
bl sub_80522F4
|
|
b _08078D78
|
|
.align 2, 0
|
|
_08078BB4: .4byte gUnknown_80FBEA0
|
|
_08078BB8:
|
|
movs r5, 0
|
|
ldr r1, [sp, 0x1C]
|
|
cmp r1, 0
|
|
beq _08078BE8
|
|
movs r1, 0x9E
|
|
lsls r1, 1
|
|
adds r0, r7, r1
|
|
ldr r0, [r0]
|
|
bl RoundUpFixedPoint
|
|
adds r4, r0, 0
|
|
movs r1, 0xA0
|
|
lsls r1, 1
|
|
adds r0, r7, r1
|
|
ldr r0, [r0]
|
|
bl RoundUpFixedPoint
|
|
cmp r4, r0
|
|
blt _08078BE0
|
|
movs r5, 0x1
|
|
_08078BE0:
|
|
ldr r0, _08078C8C
|
|
cmp r10, r0
|
|
bne _08078BE8
|
|
movs r5, 0x1
|
|
_08078BE8:
|
|
cmp r5, 0
|
|
beq _08078CC0
|
|
movs r0, 0xA0
|
|
lsls r0, 1
|
|
adds r5, r7, r0
|
|
ldr r1, [r5]
|
|
str r1, [sp, 0x20]
|
|
subs r0, 0x4
|
|
adds r0, r7
|
|
mov r10, r0
|
|
ldr r0, [r0]
|
|
bl RoundUpFixedPoint
|
|
adds r4, r0, 0
|
|
ldr r0, [r5]
|
|
bl RoundUpFixedPoint
|
|
movs r1, 0
|
|
str r1, [sp, 0x24]
|
|
cmp r4, r0
|
|
bne _08078C16
|
|
movs r0, 0x1
|
|
str r0, [sp, 0x24]
|
|
_08078C16:
|
|
mov r0, sp
|
|
ldr r1, [sp, 0x1C]
|
|
bl sub_80943A0
|
|
ldr r2, [sp]
|
|
ldr r1, [r5]
|
|
add r0, sp, 0x4
|
|
bl sub_8094268
|
|
ldr r4, [sp, 0x4]
|
|
str r4, [r5]
|
|
add r0, sp, 0x8
|
|
movs r1, 0xC8
|
|
bl sub_80943A0
|
|
ldr r2, [sp, 0x8]
|
|
add r0, sp, 0xC
|
|
adds r1, r4, 0
|
|
bl sub_8094318
|
|
ldr r0, [sp, 0xC]
|
|
str r0, [r5]
|
|
mov r1, r10
|
|
str r0, [r1]
|
|
ldr r0, [sp, 0x24]
|
|
cmp r0, 0
|
|
bne _08078C5E
|
|
mov r1, r8
|
|
cmp r1, 0
|
|
beq _08078C5E
|
|
ldr r0, _08078C90
|
|
ldr r2, [r0]
|
|
mov r0, r9
|
|
adds r1, r6, 0
|
|
bl sub_80522F4
|
|
_08078C5E:
|
|
ldr r0, [sp, 0x20]
|
|
bl RoundUpFixedPoint
|
|
adds r4, r0, 0
|
|
movs r1, 0xA0
|
|
lsls r1, 1
|
|
adds r0, r7, r1
|
|
ldr r0, [r0]
|
|
bl RoundUpFixedPoint
|
|
cmp r4, r0
|
|
bne _08078C9C
|
|
ldr r0, _08078C94
|
|
adds r1, r6, 0
|
|
movs r2, 0
|
|
bl SetMessageArgument
|
|
mov r0, r8
|
|
cmp r0, 0
|
|
beq _08078D72
|
|
ldr r0, _08078C98
|
|
b _08078D4E
|
|
.align 2, 0
|
|
_08078C8C: .4byte 0x000003e7
|
|
_08078C90: .4byte gUnknown_80FBE64
|
|
_08078C94: .4byte gAvailablePokemonNames
|
|
_08078C98: .4byte gUnknown_80FBDF0
|
|
_08078C9C:
|
|
adds r0, r6, 0
|
|
bl sub_8041DB0
|
|
ldr r0, _08078CB8
|
|
adds r1, r6, 0
|
|
movs r2, 0
|
|
bl SetMessageArgument
|
|
mov r1, r8
|
|
cmp r1, 0
|
|
beq _08078D72
|
|
ldr r0, _08078CBC
|
|
b _08078D4E
|
|
.align 2, 0
|
|
_08078CB8: .4byte gAvailablePokemonNames
|
|
_08078CBC: .4byte gUnknown_80FBDC4
|
|
_08078CC0:
|
|
movs r0, 0x9E
|
|
lsls r0, 1
|
|
adds r5, r7, r0
|
|
ldr r4, [r5]
|
|
add r0, sp, 0x10
|
|
mov r1, r10
|
|
bl sub_80943A0
|
|
ldr r2, [sp, 0x10]
|
|
ldr r1, [r5]
|
|
add r0, sp, 0x14
|
|
bl sub_8094268
|
|
ldr r1, [sp, 0x14]
|
|
str r1, [r5]
|
|
movs r0, 0xA0
|
|
lsls r0, 1
|
|
adds r7, r0
|
|
ldr r2, [r7]
|
|
add r0, sp, 0x18
|
|
bl sub_8094318
|
|
ldr r0, [sp, 0x18]
|
|
str r0, [r5]
|
|
ldr r0, _08078D28
|
|
cmp r10, r0
|
|
bne _08078CFA
|
|
ldr r0, [r7]
|
|
str r0, [r5]
|
|
_08078CFA:
|
|
adds r0, r6, 0
|
|
bl nullsub_85
|
|
ldr r0, _08078D2C
|
|
adds r1, r6, 0
|
|
movs r2, 0
|
|
bl SetMessageArgument
|
|
adds r0, r4, 0
|
|
bl RoundUpFixedPoint
|
|
adds r4, r0, 0
|
|
ldr r0, [r5]
|
|
bl RoundUpFixedPoint
|
|
cmp r4, r0
|
|
bne _08078D34
|
|
mov r1, r8
|
|
cmp r1, 0
|
|
beq _08078D72
|
|
ldr r0, _08078D30
|
|
b _08078D4E
|
|
.align 2, 0
|
|
_08078D28: .4byte 0x000003e7
|
|
_08078D2C: .4byte gAvailablePokemonNames
|
|
_08078D30: .4byte gUnknown_80FBE14
|
|
_08078D34:
|
|
ldr r0, [r5]
|
|
bl RoundUpFixedPoint
|
|
adds r4, r0, 0
|
|
ldr r0, [r7]
|
|
bl RoundUpFixedPoint
|
|
cmp r4, r0
|
|
blt _08078D60
|
|
mov r0, r8
|
|
cmp r0, 0
|
|
beq _08078D72
|
|
ldr r0, _08078D5C
|
|
_08078D4E:
|
|
ldr r2, [r0]
|
|
mov r0, r9
|
|
adds r1, r6, 0
|
|
bl sub_80522F4
|
|
b _08078D72
|
|
.align 2, 0
|
|
_08078D5C: .4byte gUnknown_80FBE64
|
|
_08078D60:
|
|
mov r1, r8
|
|
cmp r1, 0
|
|
beq _08078D72
|
|
ldr r0, _08078D88
|
|
ldr r2, [r0]
|
|
mov r0, r9
|
|
adds r1, r6, 0
|
|
bl sub_80522F4
|
|
_08078D72:
|
|
adds r0, r6, 0
|
|
bl EntityUpdateStatusSprites
|
|
_08078D78:
|
|
add sp, 0x28
|
|
pop {r3-r5}
|
|
mov r8, r3
|
|
mov r9, r4
|
|
mov r10, r5
|
|
pop {r4-r7}
|
|
pop {r0}
|
|
bx r0
|
|
.align 2, 0
|
|
_08078D88: .4byte gUnknown_80FBE84
|
|
thumb_func_end sub_8078B5C
|
|
|
|
.align 2,0
|