sub_812CAD8

New macro `PRESSED(x)` tests `gMain.newKeys & (x)`.  The macro itself
is inoptimal.  However, its use is required to match this function.
We suspect this macro may have been implemented globally, hence we
put it in `global.h`.  Propagating its use through the remainder of
this project, as well as [Ruby](/pret/pokeruby) and [Emerald](/pret/pokeemerald),
has been left as a to-do item.
This commit is contained in:
PikalaxALT
2018-11-24 20:04:50 -05:00
parent 8ef1594d20
commit 93f67f9557
3 changed files with 84 additions and 198 deletions
-194
View File
@@ -5,200 +5,6 @@
.text
thumb_func_start sub_812CAD8
sub_812CAD8: @ 812CAD8
push {r4-r6,lr}
lsls r0, 24
lsrs r4, r0, 24
lsls r1, r4, 2
adds r1, r4
lsls r1, 3
ldr r0, _0812CB9C @ =gTasks
adds r5, r1, r0
adds r0, 0x8
adds r6, r1, r0
bl RunTextPrinters
ldr r0, _0812CBA0 @ =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _0812CB2E
movs r0, 0x2
bl IsTextPrinterActive
lsls r0, 16
cmp r0, 0
bne _0812CB2E
ldr r0, _0812CBA4 @ =gUnknown_203B0FC
ldr r0, [r0]
movs r2, 0x2
ldrsh r1, [r6, r2]
adds r0, 0x1D
adds r0, r1
ldrb r1, [r0]
ldr r2, _0812CBA8 @ =gSprites
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r2
movs r1, 0x30
ldrsh r0, [r0, r1]
cmp r0, 0xFF
beq _0812CB2E
adds r0, r4, 0
bl sub_812CE04
_0812CB2E:
ldr r0, _0812CBA0 @ =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0x2
ands r0, r1
cmp r0, 0
beq _0812CBB8
movs r0, 0x5
bl PlaySE
movs r4, 0
ldr r6, _0812CBA4 @ =gUnknown_203B0FC
_0812CB44:
ldr r0, [r6]
adds r0, 0x1D
adds r0, r4
ldrb r0, [r0]
movs r1, 0
bl sub_812CEFC
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x5
bls _0812CB44
bl sub_812CE9C
ldr r2, _0812CBA8 @ =gSprites
movs r0, 0x8
ldrsh r1, [r5, r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r2, 0x1C
adds r0, r2
ldr r1, _0812CBAC @ =sub_812D764
str r1, [r0]
ldr r0, _0812CBB0 @ =gUnknown_3005EC8
ldrb r0, [r0]
cmp r0, 0xFF
beq _0812CB80
bl sub_812DB10
_0812CB80:
movs r0, 0x1
bl sub_812E4A4
movs r0, 0
bl sub_812D0F4
bl sub_812E000
bl sub_812C990
ldr r0, _0812CBB4 @ =sub_812C694
str r0, [r5]
b _0812CC62
.align 2, 0
_0812CB9C: .4byte gTasks
_0812CBA0: .4byte gMain
_0812CBA4: .4byte gUnknown_203B0FC
_0812CBA8: .4byte gSprites
_0812CBAC: .4byte sub_812D764
_0812CBB0: .4byte gUnknown_3005EC8
_0812CBB4: .4byte sub_812C694
_0812CBB8:
movs r0, 0x40
ands r0, r1
cmp r0, 0
bne _0812CBC8
movs r0, 0x80
ands r0, r1
cmp r0, 0
beq _0812CBF4
_0812CBC8:
ldrh r1, [r5, 0xA]
movs r2, 0xA
ldrsh r0, [r5, r2]
cmp r0, 0x2
ble _0812CBE4
subs r0, r1, 0x3
strh r0, [r5, 0xA]
movs r2, 0x1B
negs r2, r2
adds r0, r4, 0
movs r1, 0
bl sub_812CC68
b _0812CC62
_0812CBE4:
adds r0, r1, 0x3
strh r0, [r5, 0xA]
adds r0, r4, 0
movs r1, 0
movs r2, 0x1B
bl sub_812CC68
b _0812CC62
_0812CBF4:
movs r0, 0x20
ands r0, r1
cmp r0, 0
beq _0812CC26
ldrh r6, [r5, 0xA]
movs r1, 0xA
ldrsh r0, [r5, r1]
cmp r0, 0
beq _0812CC12
movs r1, 0x3
bl __modsi3
lsls r0, 16
cmp r0, 0
bne _0812CC1C
_0812CC12:
adds r0, r6, 0x2
strh r0, [r5, 0xA]
adds r0, r4, 0
movs r1, 0x5E
b _0812CC4A
_0812CC1C:
subs r0, r6, 0x1
strh r0, [r5, 0xA]
movs r1, 0x2F
negs r1, r1
b _0812CC48
_0812CC26:
movs r0, 0x10
ands r0, r1
cmp r0, 0
beq _0812CC62
movs r1, 0xA
ldrsh r0, [r5, r1]
adds r0, 0x1
movs r1, 0x3
bl __modsi3
cmp r0, 0
bne _0812CC52
ldrh r0, [r5, 0xA]
subs r0, 0x2
strh r0, [r5, 0xA]
movs r1, 0x5E
negs r1, r1
_0812CC48:
adds r0, r4, 0
_0812CC4A:
movs r2, 0
bl sub_812CC68
b _0812CC62
_0812CC52:
ldrh r0, [r5, 0xA]
adds r0, 0x1
strh r0, [r5, 0xA]
adds r0, r4, 0
movs r1, 0x2F
movs r2, 0
bl sub_812CC68
_0812CC62:
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_812CAD8
thumb_func_start sub_812CC68
sub_812CC68: @ 812CC68
push {r4-r7,lr}