mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Decompile apprentice
This commit is contained in:
parent
36b8a6a9a2
commit
b4a42a6832
@ -6,941 +6,6 @@
|
||||
.text
|
||||
|
||||
|
||||
thumb_func_start sub_81A0FFC
|
||||
sub_81A0FFC: @ 81A0FFC
|
||||
push {r4-r6,lr}
|
||||
sub sp, 0x10
|
||||
ldr r0, =gSpecialVar_0x8005
|
||||
ldrh r0, [r0]
|
||||
cmp r0, 0x1
|
||||
beq _081A1028
|
||||
cmp r0, 0x1
|
||||
bgt _081A1018
|
||||
cmp r0, 0
|
||||
beq _081A101E
|
||||
b _081A11E6
|
||||
.pool
|
||||
_081A1018:
|
||||
cmp r0, 0x2
|
||||
beq _081A1030
|
||||
b _081A11E6
|
||||
_081A101E:
|
||||
ldr r5, =gStringVar1
|
||||
b _081A1032
|
||||
.pool
|
||||
_081A1028:
|
||||
ldr r5, =gStringVar2
|
||||
b _081A1032
|
||||
.pool
|
||||
_081A1030:
|
||||
ldr r5, =gStringVar3
|
||||
_081A1032:
|
||||
ldr r0, =gSpecialVar_0x8006
|
||||
ldrh r0, [r0]
|
||||
cmp r0, 0x9
|
||||
bls _081A103C
|
||||
b _081A11E6
|
||||
_081A103C:
|
||||
lsls r0, 2
|
||||
ldr r1, =_081A1054
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
mov pc, r0
|
||||
.pool
|
||||
.align 2, 0
|
||||
_081A1054:
|
||||
.4byte _081A107C
|
||||
.4byte _081A1094
|
||||
.4byte _081A10AC
|
||||
.4byte _081A10C4
|
||||
.4byte _081A10DC
|
||||
.4byte _081A10F4
|
||||
.4byte _081A1118
|
||||
.4byte _081A1164
|
||||
.4byte _081A1140
|
||||
.4byte _081A1184
|
||||
_081A107C:
|
||||
ldr r0, =gUnknown_030062F0
|
||||
ldr r0, [r0]
|
||||
ldrh r1, [r0]
|
||||
movs r0, 0xB
|
||||
muls r1, r0
|
||||
ldr r0, =gSpeciesNames
|
||||
adds r1, r0
|
||||
b _081A1174
|
||||
.pool
|
||||
_081A1094:
|
||||
ldr r0, =gUnknown_030062F0
|
||||
ldr r0, [r0]
|
||||
ldrh r1, [r0, 0x2]
|
||||
movs r0, 0xB
|
||||
muls r1, r0
|
||||
ldr r0, =gSpeciesNames
|
||||
adds r1, r0
|
||||
b _081A1174
|
||||
.pool
|
||||
_081A10AC:
|
||||
ldr r0, =gUnknown_030062F0
|
||||
ldr r0, [r0]
|
||||
ldrh r1, [r0]
|
||||
movs r0, 0xB
|
||||
muls r1, r0
|
||||
ldr r0, =gSpeciesNames
|
||||
adds r1, r0
|
||||
b _081A1174
|
||||
.pool
|
||||
_081A10C4:
|
||||
ldr r0, =gUnknown_030062F0
|
||||
ldr r0, [r0]
|
||||
ldrh r1, [r0, 0x4]
|
||||
movs r0, 0xD
|
||||
muls r1, r0
|
||||
ldr r0, =gMoveNames
|
||||
adds r1, r0
|
||||
b _081A1174
|
||||
.pool
|
||||
_081A10DC:
|
||||
ldr r0, =gUnknown_030062F0
|
||||
ldr r0, [r0]
|
||||
ldrh r1, [r0, 0x6]
|
||||
movs r0, 0xD
|
||||
muls r1, r0
|
||||
ldr r0, =gMoveNames
|
||||
adds r1, r0
|
||||
b _081A1174
|
||||
.pool
|
||||
_081A10F4:
|
||||
ldr r0, =gSaveBlock2Ptr
|
||||
ldr r1, [r0]
|
||||
adds r0, r1, 0
|
||||
adds r0, 0xB1
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 26
|
||||
lsrs r0, 28
|
||||
subs r0, 0x3
|
||||
lsls r0, 2
|
||||
adds r1, r0
|
||||
adds r1, 0xBA
|
||||
ldrh r0, [r1]
|
||||
bl ItemId_GetName
|
||||
adds r1, r0, 0
|
||||
b _081A1174
|
||||
.pool
|
||||
_081A1118:
|
||||
ldr r0, =gSaveBlock2Ptr
|
||||
ldr r0, [r0]
|
||||
adds r0, 0xB0
|
||||
ldrb r0, [r0]
|
||||
movs r1, 0x2
|
||||
bl sub_81A1650
|
||||
adds r1, r0, 0
|
||||
mov r0, sp
|
||||
movs r2, 0x2
|
||||
bl TVShowConvertInternationalString
|
||||
adds r0, r5, 0
|
||||
mov r1, sp
|
||||
bl StringCopy
|
||||
b _081A11E6
|
||||
.pool
|
||||
_081A1140:
|
||||
ldr r0, =gSaveBlock2Ptr
|
||||
ldr r0, [r0]
|
||||
adds r0, 0xB1
|
||||
ldrb r1, [r0]
|
||||
movs r0, 0x3
|
||||
ands r0, r1
|
||||
cmp r0, 0x1
|
||||
bne _081A115C
|
||||
ldr r1, =gText_Lv50
|
||||
b _081A1174
|
||||
.pool
|
||||
_081A115C:
|
||||
ldr r1, =gText_OpenLevel
|
||||
b _081A1174
|
||||
.pool
|
||||
_081A1164:
|
||||
ldr r0, =gSaveBlock2Ptr
|
||||
ldr r0, [r0]
|
||||
movs r1, 0x82
|
||||
lsls r1, 1
|
||||
adds r0, r1
|
||||
bl ConvertBattleFrontierTrainerSpeechToString
|
||||
ldr r1, =gStringVar4
|
||||
_081A1174:
|
||||
adds r0, r5, 0
|
||||
bl StringCopy
|
||||
b _081A11E6
|
||||
.pool
|
||||
_081A1184:
|
||||
ldr r0, =gSaveBlock2Ptr
|
||||
ldr r3, [r0]
|
||||
adds r1, r3, 0
|
||||
adds r1, 0xB1
|
||||
ldrb r1, [r1]
|
||||
lsls r4, r1, 24
|
||||
lsrs r1, r4, 30
|
||||
adds r6, r0, 0
|
||||
cmp r1, 0x2
|
||||
bhi _081A11C0
|
||||
adds r0, r3, 0
|
||||
adds r0, 0xB4
|
||||
adds r0, r1
|
||||
ldrb r2, [r0]
|
||||
adds r0, r3, 0
|
||||
adds r0, 0xB2
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 29
|
||||
lsrs r0, 29
|
||||
asrs r0, r1
|
||||
movs r1, 0x1
|
||||
ands r0, r1
|
||||
lsls r0, 2
|
||||
asrs r2, r0
|
||||
movs r0, 0xF
|
||||
ands r2, r0
|
||||
b _081A11C2
|
||||
.pool
|
||||
_081A11C0:
|
||||
movs r2, 0
|
||||
_081A11C2:
|
||||
ldr r3, =gApprentices
|
||||
lsls r1, r2, 1
|
||||
ldr r0, [r6]
|
||||
adds r0, 0xB0
|
||||
ldrb r2, [r0]
|
||||
movs r0, 0x58
|
||||
muls r0, r2
|
||||
adds r1, r0
|
||||
adds r3, 0x34
|
||||
adds r1, r3
|
||||
ldrh r1, [r1]
|
||||
movs r0, 0xB
|
||||
muls r1, r0
|
||||
ldr r0, =gSpeciesNames
|
||||
adds r1, r0
|
||||
adds r0, r5, 0
|
||||
bl StringCopy
|
||||
_081A11E6:
|
||||
add sp, 0x10
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81A0FFC
|
||||
|
||||
thumb_func_start sub_81A11F8
|
||||
sub_81A11F8: @ 81A11F8
|
||||
ldr r0, =gSaveBlock2Ptr
|
||||
ldr r2, [r0]
|
||||
ldr r0, =gSpecialVar_0x8005
|
||||
ldrb r1, [r0]
|
||||
adds r2, 0xB1
|
||||
lsls r1, 6
|
||||
ldrb r3, [r2]
|
||||
movs r0, 0x3F
|
||||
ands r0, r3
|
||||
orrs r0, r1
|
||||
strb r0, [r2]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_81A11F8
|
||||
|
||||
thumb_func_start sub_81A1218
|
||||
sub_81A1218: @ 81A1218
|
||||
push {lr}
|
||||
bl sub_81AAC28
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_81A1218
|
||||
|
||||
thumb_func_start sub_81A1224
|
||||
sub_81A1224: @ 81A1224
|
||||
push {r4-r7,lr}
|
||||
mov r7, r9
|
||||
mov r6, r8
|
||||
push {r6,r7}
|
||||
ldr r1, =gSaveBlock2Ptr
|
||||
ldr r3, [r1]
|
||||
adds r0, r3, 0
|
||||
adds r0, 0xB1
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 26
|
||||
lsrs r0, 28
|
||||
adds r7, r1, 0
|
||||
cmp r0, 0x2
|
||||
bhi _081A1242
|
||||
b _081A1362
|
||||
_081A1242:
|
||||
movs r5, 0
|
||||
movs r2, 0
|
||||
adds r0, r3, 0
|
||||
adds r0, 0xB8
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 30
|
||||
ldr r1, =gSpecialVar_0x8005
|
||||
mov r12, r1
|
||||
ldr r1, =gSpecialVar_Result
|
||||
mov r8, r1
|
||||
cmp r0, 0
|
||||
beq _081A127C
|
||||
adds r3, r7, 0
|
||||
_081A125C:
|
||||
adds r0, r5, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
adds r0, r2, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r2, r0, 24
|
||||
cmp r2, 0x8
|
||||
bhi _081A127C
|
||||
ldr r0, [r3]
|
||||
lsls r1, r2, 2
|
||||
adds r0, r1
|
||||
adds r0, 0xB8
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 30
|
||||
cmp r0, 0
|
||||
bne _081A125C
|
||||
_081A127C:
|
||||
movs r4, 0
|
||||
cmp r4, r5
|
||||
bcs _081A1322
|
||||
ldr r0, [r7]
|
||||
adds r0, 0xB1
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 26
|
||||
lsrs r0, 28
|
||||
subs r0, 0x3
|
||||
cmp r4, r0
|
||||
bge _081A1322
|
||||
adds r6, r7, 0
|
||||
mov r9, r4
|
||||
_081A1296:
|
||||
ldr r3, [r6]
|
||||
lsls r0, r4, 2
|
||||
adds r2, r3, r0
|
||||
adds r0, r2, 0
|
||||
adds r0, 0xB8
|
||||
ldrb r1, [r0]
|
||||
lsls r0, r1, 30
|
||||
lsrs r0, 30
|
||||
cmp r0, 0x1
|
||||
bne _081A1308
|
||||
lsrs r0, r1, 6
|
||||
cmp r0, 0
|
||||
beq _081A1308
|
||||
adds r0, r2, 0
|
||||
adds r0, 0xBA
|
||||
ldrh r0, [r0]
|
||||
mov r2, r12
|
||||
ldrh r2, [r2]
|
||||
cmp r0, r2
|
||||
bne _081A1308
|
||||
adds r0, r3, 0
|
||||
adds r0, 0xB1
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 26
|
||||
lsrs r0, 28
|
||||
subs r0, 0x3
|
||||
lsls r0, 2
|
||||
adds r0, r3, r0
|
||||
adds r0, 0xB8
|
||||
ldrb r2, [r0]
|
||||
movs r1, 0x3F
|
||||
ands r1, r2
|
||||
strb r1, [r0]
|
||||
ldr r1, [r6]
|
||||
adds r0, r1, 0
|
||||
adds r0, 0xB1
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 26
|
||||
lsrs r0, 28
|
||||
subs r0, 0x3
|
||||
lsls r0, 2
|
||||
adds r1, r0
|
||||
mov r2, r12
|
||||
ldrh r0, [r2]
|
||||
adds r1, 0xBA
|
||||
strh r0, [r1]
|
||||
mov r1, r9
|
||||
mov r0, r8
|
||||
strh r1, [r0]
|
||||
b _081A1362
|
||||
.pool
|
||||
_081A1308:
|
||||
adds r0, r4, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
cmp r4, r5
|
||||
bcs _081A1322
|
||||
ldr r0, [r6]
|
||||
adds r0, 0xB1
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 26
|
||||
lsrs r0, 28
|
||||
subs r0, 0x3
|
||||
cmp r4, r0
|
||||
blt _081A1296
|
||||
_081A1322:
|
||||
ldr r2, [r7]
|
||||
adds r0, r2, 0
|
||||
adds r0, 0xB1
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 26
|
||||
lsrs r0, 28
|
||||
subs r0, 0x3
|
||||
lsls r0, 2
|
||||
adds r2, r0
|
||||
adds r2, 0xB8
|
||||
ldrb r1, [r2]
|
||||
movs r0, 0x3F
|
||||
ands r0, r1
|
||||
movs r1, 0x40
|
||||
orrs r0, r1
|
||||
strb r0, [r2]
|
||||
ldr r1, [r7]
|
||||
adds r0, r1, 0
|
||||
adds r0, 0xB1
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 26
|
||||
lsrs r0, 28
|
||||
subs r0, 0x3
|
||||
lsls r0, 2
|
||||
adds r1, r0
|
||||
mov r2, r12
|
||||
ldrh r0, [r2]
|
||||
adds r1, 0xBA
|
||||
strh r0, [r1]
|
||||
movs r0, 0x1
|
||||
mov r1, r8
|
||||
strh r0, [r1]
|
||||
_081A1362:
|
||||
pop {r3,r4}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_81A1224
|
||||
|
||||
thumb_func_start sub_81A1370
|
||||
sub_81A1370: @ 81A1370
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
ldr r0, =gSaveBlock2Ptr
|
||||
ldr r1, [r0]
|
||||
movs r2, 0x8A
|
||||
lsls r2, 1
|
||||
adds r1, r2
|
||||
ldrb r1, [r1]
|
||||
adds r4, r0, 0
|
||||
cmp r1, 0xFF
|
||||
beq _081A1422
|
||||
movs r5, 0
|
||||
_081A138E:
|
||||
ldr r1, [r4]
|
||||
adds r2, r5, 0x1
|
||||
lsls r0, r2, 4
|
||||
adds r0, r2
|
||||
lsls r0, 2
|
||||
adds r3, r1, r0
|
||||
movs r5, 0x8A
|
||||
lsls r5, 1
|
||||
adds r0, r3, r5
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0xFF
|
||||
bne _081A13B8
|
||||
adds r0, r3, 0
|
||||
adds r0, 0xDC
|
||||
adds r1, 0xDC
|
||||
movs r2, 0x44
|
||||
bl memcpy
|
||||
b _081A1422
|
||||
.pool
|
||||
_081A13B8:
|
||||
adds r5, r2, 0
|
||||
cmp r5, 0x2
|
||||
ble _081A138E
|
||||
ldr r0, =0x0000ffff
|
||||
mov r10, r0
|
||||
movs r2, 0x1
|
||||
negs r2, r2
|
||||
mov r9, r2
|
||||
movs r5, 0x1
|
||||
ldr r7, =gSaveBlock2Ptr
|
||||
movs r0, 0x90
|
||||
lsls r0, 1
|
||||
mov r8, r0
|
||||
movs r6, 0x44
|
||||
_081A13D4:
|
||||
ldr r0, [r7]
|
||||
add r0, r8
|
||||
adds r0, 0x34
|
||||
bl ReadUnalignedWord
|
||||
adds r4, r0, 0
|
||||
ldr r0, [r7]
|
||||
adds r0, 0xA
|
||||
bl ReadUnalignedWord
|
||||
cmp r4, r0
|
||||
bne _081A13FC
|
||||
ldr r0, [r7]
|
||||
adds r0, r6
|
||||
adds r0, 0xDE
|
||||
ldrb r0, [r0]
|
||||
cmp r0, r10
|
||||
bge _081A13FC
|
||||
mov r10, r0
|
||||
mov r9, r5
|
||||
_081A13FC:
|
||||
movs r2, 0x44
|
||||
add r8, r2
|
||||
adds r6, 0x44
|
||||
adds r5, 0x1
|
||||
cmp r5, 0x3
|
||||
ble _081A13D4
|
||||
mov r5, r9
|
||||
cmp r5, 0
|
||||
ble _081A1422
|
||||
ldr r0, =gSaveBlock2Ptr
|
||||
ldr r1, [r0]
|
||||
lsls r0, r5, 4
|
||||
add r0, r9
|
||||
lsls r0, 2
|
||||
adds r0, r1, r0
|
||||
adds r0, 0xDC
|
||||
adds r1, 0xDC
|
||||
bl memcpy
|
||||
_081A1422:
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81A1370
|
||||
|
||||
thumb_func_start sub_81A1438
|
||||
sub_81A1438: @ 81A1438
|
||||
push {r4,r5,lr}
|
||||
ldr r4, =gSaveBlock2Ptr
|
||||
ldr r2, [r4]
|
||||
adds r0, r2, 0
|
||||
adds r0, 0xB0
|
||||
ldrb r0, [r0]
|
||||
adds r2, 0xDC
|
||||
movs r1, 0x1F
|
||||
ands r1, r0
|
||||
ldrb r3, [r2]
|
||||
movs r0, 0x20
|
||||
negs r0, r0
|
||||
ands r0, r3
|
||||
orrs r0, r1
|
||||
strb r0, [r2]
|
||||
ldr r2, [r4]
|
||||
adds r0, r2, 0
|
||||
adds r0, 0xB1
|
||||
ldrb r1, [r0]
|
||||
lsls r1, 30
|
||||
adds r2, 0xDC
|
||||
lsrs r1, 25
|
||||
ldrb r3, [r2]
|
||||
movs r0, 0x61
|
||||
negs r0, r0
|
||||
ands r0, r3
|
||||
orrs r0, r1
|
||||
strb r0, [r2]
|
||||
movs r2, 0
|
||||
ldr r0, [r4]
|
||||
b _081A148C
|
||||
.pool
|
||||
_081A147C:
|
||||
adds r0, r2, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r2, r0, 24
|
||||
cmp r2, 0x8
|
||||
bhi _081A1496
|
||||
ldr r0, [r4]
|
||||
lsls r1, r2, 2
|
||||
adds r0, r1
|
||||
_081A148C:
|
||||
adds r0, 0xB8
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 30
|
||||
cmp r0, 0
|
||||
bne _081A147C
|
||||
_081A1496:
|
||||
ldr r4, =gSaveBlock2Ptr
|
||||
ldr r0, [r4]
|
||||
adds r0, 0xDD
|
||||
strb r2, [r0]
|
||||
ldr r0, [r4]
|
||||
adds r1, r0, 0
|
||||
adds r1, 0xDE
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0xFE
|
||||
bhi _081A14AE
|
||||
adds r0, 0x1
|
||||
strb r0, [r1]
|
||||
_081A14AE:
|
||||
ldr r0, [r4]
|
||||
adds r0, 0xDD
|
||||
ldrb r0, [r0]
|
||||
bl sub_81A0390
|
||||
movs r2, 0
|
||||
adds r3, r4, 0
|
||||
movs r4, 0x88
|
||||
lsls r4, 1
|
||||
adds r5, r3, 0
|
||||
_081A14C2:
|
||||
ldr r0, [r3]
|
||||
adds r1, r0, r4
|
||||
adds r1, r2
|
||||
adds r0, 0xA
|
||||
adds r0, r2
|
||||
ldrb r0, [r0]
|
||||
strb r0, [r1]
|
||||
adds r0, r2, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r2, r0, 24
|
||||
cmp r2, 0x3
|
||||
bls _081A14C2
|
||||
ldr r1, [r5]
|
||||
movs r2, 0x8A
|
||||
lsls r2, 1
|
||||
adds r0, r1, r2
|
||||
bl StringCopy
|
||||
ldr r1, [r5]
|
||||
ldr r0, =gGameLanguage
|
||||
ldrb r0, [r0]
|
||||
ldr r2, =0x0000011b
|
||||
adds r1, r2
|
||||
strb r0, [r1]
|
||||
ldr r0, [r5]
|
||||
adds r0, 0xDC
|
||||
bl sub_8165AE8
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81A1438
|
||||
|
||||
thumb_func_start sub_81A150C
|
||||
sub_81A150C: @ 81A150C
|
||||
push {lr}
|
||||
ldr r2, =gApprentices
|
||||
ldr r0, =gSaveBlock2Ptr
|
||||
ldr r0, [r0]
|
||||
adds r0, 0xDC
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 27
|
||||
lsrs r0, 27
|
||||
movs r1, 0x58
|
||||
muls r0, r1
|
||||
adds r0, r2
|
||||
adds r0, 0x32
|
||||
ldrb r2, [r0]
|
||||
movs r1, 0
|
||||
ldr r3, =gUnknown_085DCEDC
|
||||
ldrb r0, [r3]
|
||||
cmp r0, r2
|
||||
beq _081A1542
|
||||
_081A1530:
|
||||
adds r0, r1, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r1, r0, 24
|
||||
cmp r1, 0x1D
|
||||
bhi _081A1542
|
||||
adds r0, r1, r3
|
||||
ldrb r0, [r0]
|
||||
cmp r0, r2
|
||||
bne _081A1530
|
||||
_081A1542:
|
||||
cmp r1, 0x1E
|
||||
beq _081A1568
|
||||
ldr r0, =gUnknown_085DCF0E
|
||||
adds r0, r1, r0
|
||||
ldrb r1, [r0]
|
||||
ldr r0, =0x00004010
|
||||
bl VarSet
|
||||
b _081A1594
|
||||
.pool
|
||||
_081A1568:
|
||||
movs r1, 0
|
||||
ldr r3, =gUnknown_085DCEFA
|
||||
ldrb r0, [r3]
|
||||
cmp r0, r2
|
||||
beq _081A1584
|
||||
_081A1572:
|
||||
adds r0, r1, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r1, r0, 24
|
||||
cmp r1, 0x13
|
||||
bhi _081A1584
|
||||
adds r0, r1, r3
|
||||
ldrb r0, [r0]
|
||||
cmp r0, r2
|
||||
bne _081A1572
|
||||
_081A1584:
|
||||
cmp r1, 0x14
|
||||
beq _081A1594
|
||||
ldr r0, =gUnknown_085DCF2C
|
||||
adds r0, r1, r0
|
||||
ldrb r1, [r0]
|
||||
ldr r0, =0x00004010
|
||||
bl VarSet
|
||||
_081A1594:
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81A150C
|
||||
|
||||
thumb_func_start sub_81A15A4
|
||||
sub_81A15A4: @ 81A15A4
|
||||
push {lr}
|
||||
ldr r2, =gApprentices
|
||||
ldr r0, =gSaveBlock2Ptr
|
||||
ldr r0, [r0]
|
||||
adds r0, 0xB0
|
||||
ldrb r1, [r0]
|
||||
movs r0, 0x58
|
||||
muls r0, r1
|
||||
adds r0, r2
|
||||
adds r0, 0x32
|
||||
ldrb r2, [r0]
|
||||
movs r1, 0
|
||||
ldr r3, =gUnknown_085DCEDC
|
||||
ldrb r0, [r3]
|
||||
cmp r0, r2
|
||||
beq _081A15D6
|
||||
_081A15C4:
|
||||
adds r0, r1, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r1, r0, 24
|
||||
cmp r1, 0x1D
|
||||
bhi _081A15D6
|
||||
adds r0, r1, r3
|
||||
ldrb r0, [r0]
|
||||
cmp r0, r2
|
||||
bne _081A15C4
|
||||
_081A15D6:
|
||||
cmp r1, 0x1E
|
||||
beq _081A15FC
|
||||
ldr r0, =gUnknown_085DCF0E
|
||||
adds r0, r1, r0
|
||||
ldrb r1, [r0]
|
||||
ldr r0, =0x00004010
|
||||
bl VarSet
|
||||
b _081A1628
|
||||
.pool
|
||||
_081A15FC:
|
||||
movs r1, 0
|
||||
ldr r3, =gUnknown_085DCEFA
|
||||
ldrb r0, [r3]
|
||||
cmp r0, r2
|
||||
beq _081A1618
|
||||
_081A1606:
|
||||
adds r0, r1, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r1, r0, 24
|
||||
cmp r1, 0x13
|
||||
bhi _081A1618
|
||||
adds r0, r1, r3
|
||||
ldrb r0, [r0]
|
||||
cmp r0, r2
|
||||
bne _081A1606
|
||||
_081A1618:
|
||||
cmp r1, 0x14
|
||||
beq _081A1628
|
||||
ldr r0, =gUnknown_085DCF2C
|
||||
adds r0, r1, r0
|
||||
ldrb r1, [r0]
|
||||
ldr r0, =0x00004010
|
||||
bl VarSet
|
||||
_081A1628:
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81A15A4
|
||||
|
||||
thumb_func_start sub_81A1638
|
||||
sub_81A1638: @ 81A1638
|
||||
ldr r1, =gSpecialVar_0x8004
|
||||
movs r0, 0x1
|
||||
strh r0, [r1]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_81A1638
|
||||
|
||||
thumb_func_start sub_81A1644
|
||||
sub_81A1644: @ 81A1644
|
||||
ldr r1, =gSpecialVar_0x8004
|
||||
movs r0, 0x1
|
||||
strh r0, [r1]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_81A1644
|
||||
|
||||
thumb_func_start sub_81A1650
|
||||
sub_81A1650: @ 81A1650
|
||||
push {lr}
|
||||
movs r2, 0x58
|
||||
muls r2, r0
|
||||
ldr r0, =gApprentices
|
||||
adds r2, r0
|
||||
subs r0, r1, 0x1
|
||||
cmp r0, 0x6
|
||||
bhi _081A16AC
|
||||
lsls r0, 2
|
||||
ldr r1, =_081A1674
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
mov pc, r0
|
||||
.pool
|
||||
.align 2, 0
|
||||
_081A1674:
|
||||
.4byte _081A1690
|
||||
.4byte _081A1694
|
||||
.4byte _081A169A
|
||||
.4byte _081A16A0
|
||||
.4byte _081A16A6
|
||||
.4byte _081A16AC
|
||||
.4byte _081A16AC
|
||||
_081A1690:
|
||||
adds r0, r2, 0
|
||||
b _081A16B0
|
||||
_081A1694:
|
||||
adds r0, r2, 0
|
||||
adds r0, 0x8
|
||||
b _081A16B0
|
||||
_081A169A:
|
||||
adds r0, r2, 0
|
||||
adds r0, 0x10
|
||||
b _081A16B0
|
||||
_081A16A0:
|
||||
adds r0, r2, 0
|
||||
adds r0, 0x18
|
||||
b _081A16B0
|
||||
_081A16A6:
|
||||
adds r0, r2, 0
|
||||
adds r0, 0x20
|
||||
b _081A16B0
|
||||
_081A16AC:
|
||||
adds r0, r2, 0
|
||||
adds r0, 0x28
|
||||
_081A16B0:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81A1650
|
||||
|
||||
thumb_func_start sub_81A16B4
|
||||
sub_81A16B4: @ 81A16B4
|
||||
push {lr}
|
||||
lsls r0, 24
|
||||
lsrs r2, r0, 24
|
||||
ldr r0, =gMain
|
||||
ldrh r1, [r0, 0x2E]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _081A16CE
|
||||
movs r0, 0x2
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _081A16D4
|
||||
_081A16CE:
|
||||
adds r0, r2, 0
|
||||
bl SwitchTaskToFollowupFunc
|
||||
_081A16D4:
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81A16B4
|
||||
|
||||
thumb_func_start sub_81A16DC
|
||||
sub_81A16DC: @ 81A16DC
|
||||
push {r4,lr}
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
ldr r0, =gMain
|
||||
ldrh r1, [r0, 0x2E]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _081A16F6
|
||||
movs r0, 0x2
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _081A1718
|
||||
_081A16F6:
|
||||
ldr r2, =gUnknown_030062F4
|
||||
ldr r1, =gTasks
|
||||
lsls r0, r4, 2
|
||||
adds r0, r4
|
||||
lsls r0, 3
|
||||
adds r0, r1
|
||||
ldrh r1, [r0, 0x8]
|
||||
movs r3, 0xA
|
||||
ldrsh r0, [r0, r3]
|
||||
lsls r0, 16
|
||||
orrs r1, r0
|
||||
str r1, [r2]
|
||||
bl _call_via_r1
|
||||
adds r0, r4, 0
|
||||
bl DestroyTask
|
||||
_081A1718:
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81A16DC
|
||||
|
||||
thumb_func_start sub_81A172C
|
||||
sub_81A172C: @ 81A172C
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
ldr r0, =sub_81A16DC
|
||||
movs r1, 0x1
|
||||
bl CreateTask
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
ldr r2, =gTasks
|
||||
lsls r1, r0, 2
|
||||
adds r1, r0
|
||||
lsls r1, 3
|
||||
adds r1, r2
|
||||
strh r4, [r1, 0x8]
|
||||
lsrs r4, 16
|
||||
strh r4, [r1, 0xA]
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81A172C
|
||||
|
||||
thumb_func_start sub_81A175C
|
||||
sub_81A175C: @ 81A175C
|
||||
push {r4,r5,lr}
|
||||
adds r5, r0, 0
|
||||
ldr r4, =sub_81A16B4
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x1
|
||||
bl CreateTask
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
adds r1, r4, 0
|
||||
adds r2, r5, 0
|
||||
bl SetTaskFuncWithFollowupFunc
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81A175C
|
||||
|
||||
thumb_func_start sub_81A1780
|
||||
sub_81A1780: @ 81A1780
|
||||
push {lr}
|
||||
|
@ -1578,7 +1578,7 @@ _08162F24:
|
||||
_08162F3E:
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
bl sub_81A1650
|
||||
bl GetApprenticeNameInLanguage
|
||||
adds r1, r0, 0
|
||||
adds r0, r6, 0
|
||||
adds r2, r4, 0
|
||||
|
2979
data/event_scripts.s
2979
data/event_scripts.s
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@ BattleFrontier_BattleTowerLobby_EventObjects: @ 853B638
|
||||
object_event 3, EVENT_OBJ_GFX_WOMAN_7, 0, 17, 8, 3, MOVEMENT_TYPE_WANDER_AROUND, 1, 1, 0, 0, BattleFrontier_BattleTowerLobby_EventScript_23EFB5, 0
|
||||
object_event 4, EVENT_OBJ_GFX_BOY_1, 0, 15, 9, 3, MOVEMENT_TYPE_WANDER_AROUND, 1, 1, 0, 0, BattleFrontier_BattleTowerLobby_EventScript_23EFBE, 0
|
||||
object_event 5, EVENT_OBJ_GFX_REPORTER_F, 0, 11, 9, 3, MOVEMENT_TYPE_FACE_RIGHT, 0, 0, 0, 0, BattleFrontier_BattleTowerLobby_EventScript_28CB96, 918
|
||||
object_event 6, EVENT_OBJ_GFX_HIPSTER, 0, 1, 5, 3, MOVEMENT_TYPE_FACE_DOWN, 1, 1, 0, 0, BattleFrontier_BattleTowerLobby_EventScript_2B688D, 701
|
||||
object_event 6, EVENT_OBJ_GFX_HIPSTER, 0, 1, 5, 3, MOVEMENT_TYPE_FACE_DOWN, 1, 1, 0, 0, EventScript_Apprentice, 701
|
||||
object_event 7, EVENT_OBJ_GFX_TEALA, 0, 10, 5, 3, MOVEMENT_TYPE_FACE_DOWN, 0, 0, 0, 0, BattleFrontier_BattleTowerLobby_EventScript_23EA9F, 0
|
||||
object_event 8, EVENT_OBJ_GFX_TEALA, 0, 14, 5, 3, MOVEMENT_TYPE_FACE_DOWN, 0, 0, 0, 0, BattleFrontier_BattleTowerLobby_EventScript_23EC08, 0
|
||||
object_event 9, EVENT_OBJ_GFX_TEALA, 0, 18, 5, 3, MOVEMENT_TYPE_FACE_DOWN, 0, 0, 0, 0, BattleFrontier_BattleTowerLobby_EventScript_23ED74, 0
|
||||
|
2978
data/scripts/apprentice.inc
Normal file
2978
data/scripts/apprentice.inc
Normal file
File diff suppressed because it is too large
Load Diff
@ -7,11 +7,13 @@ struct ApprenticeTrainer
|
||||
{
|
||||
u8 name[6][PLAYER_NAME_LENGTH + 1]; // For all six languages.
|
||||
u16 otId;
|
||||
u16 facilityClass;
|
||||
u8 facilityClass;
|
||||
u16 species[APPRENTICE_SPECIES_COUNT];
|
||||
u8 rest[14];
|
||||
};
|
||||
|
||||
extern const struct ApprenticeTrainer gApprentices[];
|
||||
|
||||
const u8 *GetApprenticeNameInLanguage(u32 apprenticeId, s32 language);
|
||||
|
||||
#endif // GUARD_APPRENTICE_H
|
||||
|
11
include/constants/apprentice.h
Normal file
11
include/constants/apprentice.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef GUARD_CONSTANTS_APPRENTICE_H
|
||||
#define GUARD_CONSTANTS_APPRENTICE_H
|
||||
|
||||
#define APPRENTICE_ASK_WHICH_LEVEL 0
|
||||
#define APPRENTICE_ASK_3SPECIES 1
|
||||
#define APPRENTICE_ASK_2SPECIES 2
|
||||
#define APPRENTICE_ASK_MOVES 3
|
||||
#define APPRENTICE_ASK_GIVE 4
|
||||
#define APPRENTICE_ASK_YES_NO 6
|
||||
|
||||
#endif // GUARD_CONSTANTS_APPRENTICE_H
|
@ -54,6 +54,7 @@ extern u16 gSpecialVar_ItemId;
|
||||
void sub_81AAC14(void);
|
||||
void sub_81AAC50(void);
|
||||
void sub_81AAC70(void);
|
||||
void sub_81AAC28(void);
|
||||
void bag_menu_mail_related(void);
|
||||
void CB2_BagMenuFromStartMenu(void);
|
||||
u8 sub_81ABB2C(u8 pocketId);
|
||||
|
528
src/apprentice.c
528
src/apprentice.c
@ -1,5 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "apprentice.h"
|
||||
#include "constants/apprentice.h"
|
||||
#include "string_util.h"
|
||||
#include "script.h"
|
||||
#include "text.h"
|
||||
@ -10,11 +11,16 @@
|
||||
#include "menu.h"
|
||||
#include "script_menu.h"
|
||||
#include "party_menu.h"
|
||||
#include "item_menu.h"
|
||||
#include "data2.h"
|
||||
#include "task.h"
|
||||
#include "item.h"
|
||||
#include "sound.h"
|
||||
#include "battle_tower.h"
|
||||
#include "event_data.h"
|
||||
#include "international_string_util.h"
|
||||
#include "field_player_avatar.h"
|
||||
#include "new_game.h"
|
||||
#include "event_object_movement.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/songs.h"
|
||||
@ -36,6 +42,9 @@ struct Unk030062F0Struct
|
||||
|
||||
extern struct Unk030062ECStruct *gUnknown_030062EC;
|
||||
extern struct Unk030062F0Struct *gUnknown_030062F0;
|
||||
extern void (*gUnknown_030062F4)(void);
|
||||
|
||||
extern void sub_8165AE8(struct Apprentice *);
|
||||
|
||||
extern const u8 *const gUnknown_08611330[];
|
||||
extern const u8 *const gUnknown_08610FF0[][2];
|
||||
@ -49,6 +58,11 @@ extern const u8 gUnknown_086114D3[];
|
||||
extern const bool8 gUnknown_08611370[];
|
||||
extern void (* const gUnknown_086114E0[])(void);
|
||||
|
||||
extern const u8 gUnknown_085DCEDC[];
|
||||
extern const u8 gUnknown_085DCF0E[];
|
||||
extern const u8 gUnknown_085DCEFA[];
|
||||
extern const u8 gUnknown_085DCF2C[];
|
||||
|
||||
// text
|
||||
extern const u8 gText_Give[];
|
||||
extern const u8 gText_NoNeed[];
|
||||
@ -57,12 +71,12 @@ extern const u8 gText_No[];
|
||||
|
||||
// This file's functions.
|
||||
void sub_81A087C(void);
|
||||
u16 sub_819FF98(u8 arg0);
|
||||
bool8 sub_81A0194(u8 arg0, u16 moveId);
|
||||
void sub_81A0804(bool8 noBButton, u8 itemsCount, u8 windowId);
|
||||
u8 sub_81A0784(u8 left, u8 top, u8 width, u8 height);
|
||||
void sub_81A07E8(u8 windowId);
|
||||
void sub_81A172C(void (*func)(void));
|
||||
static u16 sub_819FF98(u8 arg0);
|
||||
static bool8 sub_81A0194(u8 arg0, u16 moveId);
|
||||
static void CreateChooseAnswerTask(bool8 noBButton, u8 itemsCount, u8 windowId);
|
||||
static u8 CreateAndShowWindow(u8 left, u8 top, u8 width, u8 height);
|
||||
static void RemoveAndHideWindow(u8 windowId);
|
||||
static void ExecuteFuncAfterButtonPress(void (*func)(void));
|
||||
|
||||
void sub_819F99C(u8 id)
|
||||
{
|
||||
@ -274,7 +288,7 @@ void sub_819FD64(void)
|
||||
speciesArrId = ((speciesArrId) >> (a0 << 2)) & 0xF; \
|
||||
}
|
||||
|
||||
u16 sub_819FF98(u8 arg0)
|
||||
static u16 sub_819FF98(u8 arg0)
|
||||
{
|
||||
u8 i, j;
|
||||
u8 id;
|
||||
@ -380,7 +394,7 @@ u16 sub_819FF98(u8 arg0)
|
||||
return moveId;
|
||||
}
|
||||
|
||||
bool8 sub_81A0194(u8 arg0, u16 moveId)
|
||||
static bool8 sub_81A0194(u8 arg0, u16 moveId)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
@ -498,7 +512,7 @@ void sub_81A0390(u8 arg0)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_81A04E4(u8 arg0)
|
||||
static void CreateMenuWithAnswers(u8 arg0)
|
||||
{
|
||||
u8 i;
|
||||
u8 windowId;
|
||||
@ -511,13 +525,13 @@ void sub_81A04E4(u8 arg0)
|
||||
|
||||
switch (arg0)
|
||||
{
|
||||
case 0:
|
||||
case APPRENTICE_ASK_WHICH_LEVEL:
|
||||
left = 0x12;
|
||||
top = 8;
|
||||
strings[0] = gText_Lv50;
|
||||
strings[1] = gText_OpenLevel;
|
||||
break;
|
||||
case 1:
|
||||
case APPRENTICE_ASK_3SPECIES:
|
||||
count = 3;
|
||||
left = 0x12;
|
||||
top = 6;
|
||||
@ -531,7 +545,7 @@ void sub_81A04E4(u8 arg0)
|
||||
strings[i] = gSpeciesNames[species];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case APPRENTICE_ASK_2SPECIES:
|
||||
left = 0x12;
|
||||
top = 8;
|
||||
if (gSaveBlock2Ptr->field_B1_1 > 2)
|
||||
@ -539,19 +553,19 @@ void sub_81A04E4(u8 arg0)
|
||||
strings[1] = gSpeciesNames[gUnknown_030062F0->unk2];
|
||||
strings[0] = gSpeciesNames[gUnknown_030062F0->unk0];
|
||||
break;
|
||||
case 3:
|
||||
case APPRENTICE_ASK_MOVES:
|
||||
left = 0x11;
|
||||
top = 8;
|
||||
strings[0] = gMoveNames[gUnknown_030062F0->unk4];
|
||||
strings[1] = gMoveNames[gUnknown_030062F0->unk6];
|
||||
break;
|
||||
case 4:
|
||||
case APPRENTICE_ASK_GIVE:
|
||||
left = 0x12;
|
||||
top = 8;
|
||||
strings[0] = gText_Give;
|
||||
strings[1] = gText_NoNeed;
|
||||
break;
|
||||
case 6:
|
||||
case APPRENTICE_ASK_YES_NO:
|
||||
left = 0x14;
|
||||
top = 8;
|
||||
strings[0] = gText_Yes;
|
||||
@ -573,21 +587,21 @@ void sub_81A04E4(u8 arg0)
|
||||
|
||||
width = convert_pixel_width_to_tile_width(pixelWidth);
|
||||
left = sub_80E2D5C(left, width);
|
||||
windowId = sub_81A0784(left, top, width, count * 2);
|
||||
windowId = CreateAndShowWindow(left, top, width, count * 2);
|
||||
SetStandardWindowBorderStyle(windowId, 0);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
AddTextPrinterParameterized(windowId, 1, strings[i], 8, (i * 16) + 1, TEXT_SPEED_FF, NULL);
|
||||
|
||||
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, count, 0);
|
||||
sub_81A0804(TRUE, count, windowId);
|
||||
CreateChooseAnswerTask(TRUE, count, windowId);
|
||||
}
|
||||
|
||||
#define tNoBButton data[4]
|
||||
#define tWrapAround data[5]
|
||||
#define tWindowId data[6]
|
||||
|
||||
void sub_81A070C(u8 taskId)
|
||||
void Task_ChooseAnswer(u8 taskId)
|
||||
{
|
||||
s8 input;
|
||||
s16 *data = gTasks[taskId].data;
|
||||
@ -613,12 +627,12 @@ void sub_81A070C(u8 taskId)
|
||||
break;
|
||||
}
|
||||
|
||||
sub_81A07E8(tWindowId);
|
||||
RemoveAndHideWindow(tWindowId);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
}
|
||||
|
||||
u8 sub_81A0784(u8 left, u8 top, u8 width, u8 height)
|
||||
static u8 CreateAndShowWindow(u8 left, u8 top, u8 width, u8 height)
|
||||
{
|
||||
u8 windowId;
|
||||
struct WindowTemplate winTemplate = CreateWindowTemplate(0, left + 1, top + 1, width, height, 15, 100);
|
||||
@ -629,15 +643,15 @@ u8 sub_81A0784(u8 left, u8 top, u8 width, u8 height)
|
||||
return windowId;
|
||||
}
|
||||
|
||||
void sub_81A07E8(u8 windowId)
|
||||
static void RemoveAndHideWindow(u8 windowId)
|
||||
{
|
||||
sub_8198070(windowId, TRUE);
|
||||
RemoveWindow(windowId);
|
||||
}
|
||||
|
||||
void sub_81A0804(bool8 noBButton, u8 itemsCount, u8 windowId)
|
||||
static void CreateChooseAnswerTask(bool8 noBButton, u8 itemsCount, u8 windowId)
|
||||
{
|
||||
u8 taskId = CreateTask(sub_81A070C, 80);
|
||||
u8 taskId = CreateTask(Task_ChooseAnswer, 80);
|
||||
gTasks[taskId].tNoBButton = noBButton;
|
||||
|
||||
if (itemsCount > 3)
|
||||
@ -734,22 +748,22 @@ void sub_81A09D0(void)
|
||||
|
||||
void sub_81A0A20(void)
|
||||
{
|
||||
sub_81A04E4(gSpecialVar_0x8005);
|
||||
CreateMenuWithAnswers(gSpecialVar_0x8005);
|
||||
}
|
||||
|
||||
void sub_81A0A34(u8 taskId)
|
||||
static void Task_WaitForPrintingMessage(u8 taskId)
|
||||
{
|
||||
if (!RunTextPrintersAndIsPrinter0Active())
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
if (gSpecialVar_0x8005)
|
||||
sub_81A172C(EnableBothScriptContexts);
|
||||
ExecuteFuncAfterButtonPress(EnableBothScriptContexts);
|
||||
else
|
||||
EnableBothScriptContexts();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_81A0A70(void)
|
||||
static void PrintMessage(void)
|
||||
{
|
||||
const u8 *string;
|
||||
|
||||
@ -829,7 +843,7 @@ void sub_81A0A70(void)
|
||||
|
||||
StringExpandPlaceholders(gStringVar4, string);
|
||||
AddTextPrinterForMessage(TRUE);
|
||||
CreateTask(sub_81A0A34, 1);
|
||||
CreateTask(Task_WaitForPrintingMessage, 1);
|
||||
}
|
||||
|
||||
void sub_81A0C9C(void)
|
||||
@ -839,7 +853,7 @@ void sub_81A0C9C(void)
|
||||
sub_808B864();
|
||||
sub_808BCF4();
|
||||
NewMenuHelpers_DrawDialogueFrame(0, 1);
|
||||
sub_81A0A70();
|
||||
PrintMessage();
|
||||
}
|
||||
|
||||
void sub_81A0CC0(void)
|
||||
@ -945,3 +959,459 @@ void sub_81A0FE4(void)
|
||||
{
|
||||
FREE_AND_SET_NULL(gUnknown_030062F0);
|
||||
}
|
||||
|
||||
void sub_81A0FFC(void)
|
||||
{
|
||||
u8 *stringDst;
|
||||
u8 text[16];
|
||||
u32 speciesArrayId;
|
||||
|
||||
switch (gSpecialVar_0x8005)
|
||||
{
|
||||
case 0:
|
||||
stringDst = gStringVar1;
|
||||
break;
|
||||
case 1:
|
||||
stringDst = gStringVar2;
|
||||
break;
|
||||
case 2:
|
||||
stringDst = gStringVar3;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
switch (gSpecialVar_0x8006)
|
||||
{
|
||||
case 0:
|
||||
StringCopy(stringDst, gSpeciesNames[gUnknown_030062F0->unk0]);
|
||||
break;
|
||||
case 1:
|
||||
StringCopy(stringDst, gSpeciesNames[gUnknown_030062F0->unk2]);
|
||||
break;
|
||||
case 2:
|
||||
StringCopy(stringDst, gSpeciesNames[gUnknown_030062F0->unk0]);
|
||||
break;
|
||||
case 3:
|
||||
StringCopy(stringDst, gMoveNames[gUnknown_030062F0->unk4]);
|
||||
break;
|
||||
case 4:
|
||||
StringCopy(stringDst, gMoveNames[gUnknown_030062F0->unk6]);
|
||||
break;
|
||||
case 5:
|
||||
StringCopy(stringDst, ItemId_GetName(gSaveBlock2Ptr->field_B8[gSaveBlock2Ptr->field_B1_1 - 3].unk2));
|
||||
break;
|
||||
case 6:
|
||||
TVShowConvertInternationalString(text, GetApprenticeNameInLanguage(gSaveBlock2Ptr->field_B0, LANGUAGE_ENGLISH), LANGUAGE_ENGLISH);
|
||||
StringCopy(stringDst, text);
|
||||
break;
|
||||
case 8:
|
||||
if (gSaveBlock2Ptr->field_B1_0 == 1)
|
||||
StringCopy(stringDst, gText_Lv50);
|
||||
else
|
||||
StringCopy(stringDst, gText_OpenLevel);
|
||||
break;
|
||||
case 7:
|
||||
ConvertBattleFrontierTrainerSpeechToString(gSaveBlock2Ptr->field_DC[0].easyChatWords);
|
||||
StringCopy(stringDst, gStringVar4);
|
||||
break;
|
||||
case 9:
|
||||
if (gSaveBlock2Ptr->field_B1_2 < 3)
|
||||
{
|
||||
APPRENTICE_SPECIES_ID(speciesArrayId, gSaveBlock2Ptr->field_B1_2);
|
||||
}
|
||||
else
|
||||
{
|
||||
speciesArrayId = 0;
|
||||
}
|
||||
StringCopy(stringDst, gSpeciesNames[gApprentices[gSaveBlock2Ptr->field_B0].species[speciesArrayId]]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_81A11F8(void)
|
||||
{
|
||||
gSaveBlock2Ptr->field_B1_2 = gSpecialVar_0x8005;
|
||||
}
|
||||
|
||||
void sub_81A1218(void)
|
||||
{
|
||||
sub_81AAC28();
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
void sub_81A1224(void)
|
||||
{
|
||||
u8 count;
|
||||
u8 i, j;
|
||||
|
||||
if (gSaveBlock2Ptr->field_B1_1 < 3)
|
||||
return;
|
||||
|
||||
count = 0;
|
||||
for (j = 0; j < 9 && gSaveBlock2Ptr->field_B8[j].unk0_0; count++, j++)
|
||||
;
|
||||
|
||||
for (i = 0; i < count && i < gSaveBlock2Ptr->field_B1_1 - 3; i++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->field_B8[i].unk0_0 == 1
|
||||
&& gSaveBlock2Ptr->field_B8[i].unk0_3
|
||||
&& gSaveBlock2Ptr->field_B8[i].unk2 == gSpecialVar_0x8005)
|
||||
{
|
||||
gSaveBlock2Ptr->field_B8[gSaveBlock2Ptr->field_B1_1 - 3].unk0_3 = 0;
|
||||
gSaveBlock2Ptr->field_B8[gSaveBlock2Ptr->field_B1_1 - 3].unk2 = gSpecialVar_0x8005;
|
||||
gSpecialVar_Result = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
gSaveBlock2Ptr->field_B8[gSaveBlock2Ptr->field_B1_1 - 3].unk0_3 = 1;
|
||||
gSaveBlock2Ptr->field_B8[gSaveBlock2Ptr->field_B1_1 - 3].unk2 = gSpecialVar_0x8005;
|
||||
gSpecialVar_Result = 1;
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_81A1224(void)
|
||||
{
|
||||
asm_unified("\n\
|
||||
push {r4-r7,lr}\n\
|
||||
mov r7, r9\n\
|
||||
mov r6, r8\n\
|
||||
push {r6,r7}\n\
|
||||
ldr r1, =gSaveBlock2Ptr\n\
|
||||
ldr r3, [r1]\n\
|
||||
adds r0, r3, 0\n\
|
||||
adds r0, 0xB1\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 26\n\
|
||||
lsrs r0, 28\n\
|
||||
adds r7, r1, 0\n\
|
||||
cmp r0, 0x2\n\
|
||||
bhi _081A1242\n\
|
||||
b _081A1362\n\
|
||||
_081A1242:\n\
|
||||
movs r5, 0\n\
|
||||
movs r2, 0\n\
|
||||
adds r0, r3, 0\n\
|
||||
adds r0, 0xB8\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 30\n\
|
||||
ldr r1, =gSpecialVar_0x8005\n\
|
||||
mov r12, r1\n\
|
||||
ldr r1, =gSpecialVar_Result\n\
|
||||
mov r8, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _081A127C\n\
|
||||
adds r3, r7, 0\n\
|
||||
_081A125C:\n\
|
||||
adds r0, r5, 0x1\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r5, r0, 24\n\
|
||||
adds r0, r2, 0x1\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r2, r0, 24\n\
|
||||
cmp r2, 0x8\n\
|
||||
bhi _081A127C\n\
|
||||
ldr r0, [r3]\n\
|
||||
lsls r1, r2, 2\n\
|
||||
adds r0, r1\n\
|
||||
adds r0, 0xB8\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 30\n\
|
||||
cmp r0, 0\n\
|
||||
bne _081A125C\n\
|
||||
_081A127C:\n\
|
||||
movs r4, 0\n\
|
||||
cmp r4, r5\n\
|
||||
bcs _081A1322\n\
|
||||
ldr r0, [r7]\n\
|
||||
adds r0, 0xB1\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 26\n\
|
||||
lsrs r0, 28\n\
|
||||
subs r0, 0x3\n\
|
||||
cmp r4, r0\n\
|
||||
bge _081A1322\n\
|
||||
adds r6, r7, 0\n\
|
||||
mov r9, r4\n\
|
||||
_081A1296:\n\
|
||||
ldr r3, [r6]\n\
|
||||
lsls r0, r4, 2\n\
|
||||
adds r2, r3, r0\n\
|
||||
adds r0, r2, 0\n\
|
||||
adds r0, 0xB8\n\
|
||||
ldrb r1, [r0]\n\
|
||||
lsls r0, r1, 30\n\
|
||||
lsrs r0, 30\n\
|
||||
cmp r0, 0x1\n\
|
||||
bne _081A1308\n\
|
||||
lsrs r0, r1, 6\n\
|
||||
cmp r0, 0\n\
|
||||
beq _081A1308\n\
|
||||
adds r0, r2, 0\n\
|
||||
adds r0, 0xBA\n\
|
||||
ldrh r0, [r0]\n\
|
||||
mov r2, r12\n\
|
||||
ldrh r2, [r2]\n\
|
||||
cmp r0, r2\n\
|
||||
bne _081A1308\n\
|
||||
adds r0, r3, 0\n\
|
||||
adds r0, 0xB1\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 26\n\
|
||||
lsrs r0, 28\n\
|
||||
subs r0, 0x3\n\
|
||||
lsls r0, 2\n\
|
||||
adds r0, r3, r0\n\
|
||||
adds r0, 0xB8\n\
|
||||
ldrb r2, [r0]\n\
|
||||
movs r1, 0x3F\n\
|
||||
ands r1, r2\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r1, [r6]\n\
|
||||
adds r0, r1, 0\n\
|
||||
adds r0, 0xB1\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 26\n\
|
||||
lsrs r0, 28\n\
|
||||
subs r0, 0x3\n\
|
||||
lsls r0, 2\n\
|
||||
adds r1, r0\n\
|
||||
mov r2, r12\n\
|
||||
ldrh r0, [r2]\n\
|
||||
adds r1, 0xBA\n\
|
||||
strh r0, [r1]\n\
|
||||
mov r1, r9\n\
|
||||
mov r0, r8\n\
|
||||
strh r1, [r0]\n\
|
||||
b _081A1362\n\
|
||||
.pool\n\
|
||||
_081A1308:\n\
|
||||
adds r0, r4, 0x1\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r4, r0, 24\n\
|
||||
cmp r4, r5\n\
|
||||
bcs _081A1322\n\
|
||||
ldr r0, [r6]\n\
|
||||
adds r0, 0xB1\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 26\n\
|
||||
lsrs r0, 28\n\
|
||||
subs r0, 0x3\n\
|
||||
cmp r4, r0\n\
|
||||
blt _081A1296\n\
|
||||
_081A1322:\n\
|
||||
ldr r2, [r7]\n\
|
||||
adds r0, r2, 0\n\
|
||||
adds r0, 0xB1\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 26\n\
|
||||
lsrs r0, 28\n\
|
||||
subs r0, 0x3\n\
|
||||
lsls r0, 2\n\
|
||||
adds r2, r0\n\
|
||||
adds r2, 0xB8\n\
|
||||
ldrb r1, [r2]\n\
|
||||
movs r0, 0x3F\n\
|
||||
ands r0, r1\n\
|
||||
movs r1, 0x40\n\
|
||||
orrs r0, r1\n\
|
||||
strb r0, [r2]\n\
|
||||
ldr r1, [r7]\n\
|
||||
adds r0, r1, 0\n\
|
||||
adds r0, 0xB1\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 26\n\
|
||||
lsrs r0, 28\n\
|
||||
subs r0, 0x3\n\
|
||||
lsls r0, 2\n\
|
||||
adds r1, r0\n\
|
||||
mov r2, r12\n\
|
||||
ldrh r0, [r2]\n\
|
||||
adds r1, 0xBA\n\
|
||||
strh r0, [r1]\n\
|
||||
movs r0, 0x1\n\
|
||||
mov r1, r8\n\
|
||||
strh r0, [r1]\n\
|
||||
_081A1362:\n\
|
||||
pop {r3,r4}\n\
|
||||
mov r8, r3\n\
|
||||
mov r9, r4\n\
|
||||
pop {r4-r7}\n\
|
||||
pop {r0}\n\
|
||||
bx r0\n\
|
||||
");
|
||||
}
|
||||
#endif // NONMATCHING
|
||||
|
||||
void sub_81A1370(void)
|
||||
{
|
||||
s32 i;
|
||||
s32 r10;
|
||||
s32 r9;
|
||||
|
||||
if (gSaveBlock2Ptr->field_DC[0].playerName[0] == EOS)
|
||||
return;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->field_DC[i + 1].playerName[0] == EOS)
|
||||
{
|
||||
gSaveBlock2Ptr->field_DC[i + 1] = gSaveBlock2Ptr->field_DC[0];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
r10 = 0xFFFF;
|
||||
r9 = -1;
|
||||
for (i = 1; i < 4; i++)
|
||||
{
|
||||
if (ReadUnalignedWord(gSaveBlock2Ptr->field_DC[i].playerId) == ReadUnalignedWord(gSaveBlock2Ptr->playerTrainerId)
|
||||
&& gSaveBlock2Ptr->field_DC[i].field_2 < r10)
|
||||
{
|
||||
r10 = gSaveBlock2Ptr->field_DC[i].field_2;
|
||||
r9 = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (r9 > 0)
|
||||
gSaveBlock2Ptr->field_DC[r9] = gSaveBlock2Ptr->field_DC[0];
|
||||
}
|
||||
|
||||
void sub_81A1438(void)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
gSaveBlock2Ptr->field_DC[0].field_0_0 = gSaveBlock2Ptr->field_B0;
|
||||
gSaveBlock2Ptr->field_DC[0].field_0_1 = gSaveBlock2Ptr->field_B1_0;
|
||||
|
||||
for (i = 0; i < 9 && gSaveBlock2Ptr->field_B8[i].unk0_0; i++)
|
||||
;
|
||||
|
||||
gSaveBlock2Ptr->field_DC[0].field_1 = i;
|
||||
if (gSaveBlock2Ptr->field_DC[0].field_2 < 255)
|
||||
gSaveBlock2Ptr->field_DC[0].field_2++;
|
||||
|
||||
sub_81A0390(gSaveBlock2Ptr->field_DC[0].field_1);
|
||||
for (i = 0; i < 4; i++)
|
||||
gSaveBlock2Ptr->field_DC[0].playerId[i] = gSaveBlock2Ptr->playerTrainerId[i];
|
||||
|
||||
StringCopy(gSaveBlock2Ptr->field_DC[0].playerName, gSaveBlock2Ptr->playerName);
|
||||
gSaveBlock2Ptr->field_DC[0].language = gGameLanguage;
|
||||
sub_8165AE8(&gSaveBlock2Ptr->field_DC[0]);
|
||||
}
|
||||
|
||||
void sub_81A150C(void)
|
||||
{
|
||||
u8 i;
|
||||
u8 mapObjectGfxId;
|
||||
u8 class = gApprentices[gSaveBlock2Ptr->field_DC[0].field_0_0].facilityClass;
|
||||
|
||||
for (i = 0; i < 30 && gUnknown_085DCEDC[i] != class; i++)
|
||||
;
|
||||
|
||||
if (i != 30)
|
||||
{
|
||||
mapObjectGfxId = gUnknown_085DCF0E[i];
|
||||
VarSet(VAR_OBJ_GFX_ID_0, mapObjectGfxId);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 20 && gUnknown_085DCEFA[i] != class; i++)
|
||||
;
|
||||
|
||||
if (i != 20)
|
||||
{
|
||||
mapObjectGfxId = gUnknown_085DCF2C[i];
|
||||
VarSet(VAR_OBJ_GFX_ID_0, mapObjectGfxId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_81A15A4(void)
|
||||
{
|
||||
u8 i;
|
||||
u8 mapObjectGfxId;
|
||||
u8 class = gApprentices[gSaveBlock2Ptr->field_B0].facilityClass;
|
||||
|
||||
for (i = 0; i < 30 && gUnknown_085DCEDC[i] != class; i++)
|
||||
;
|
||||
|
||||
if (i != 30)
|
||||
{
|
||||
mapObjectGfxId = gUnknown_085DCF0E[i];
|
||||
VarSet(VAR_OBJ_GFX_ID_0, mapObjectGfxId);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 20 && gUnknown_085DCEFA[i] != class; i++)
|
||||
;
|
||||
|
||||
if (i != 20)
|
||||
{
|
||||
mapObjectGfxId = gUnknown_085DCF2C[i];
|
||||
VarSet(VAR_OBJ_GFX_ID_0, mapObjectGfxId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_81A1638(void)
|
||||
{
|
||||
gSpecialVar_0x8004 = 1;
|
||||
}
|
||||
|
||||
void sub_81A1644(void)
|
||||
{
|
||||
gSpecialVar_0x8004 = 1;
|
||||
}
|
||||
|
||||
const u8 *GetApprenticeNameInLanguage(u32 apprenticeId, s32 language)
|
||||
{
|
||||
const struct ApprenticeTrainer *apprentice = &gApprentices[apprenticeId];
|
||||
|
||||
switch (language)
|
||||
{
|
||||
case LANGUAGE_JAPANESE:
|
||||
return apprentice->name[0];
|
||||
case LANGUAGE_ENGLISH:
|
||||
return apprentice->name[1];
|
||||
case LANGUAGE_FRENCH:
|
||||
return apprentice->name[2];
|
||||
case LANGUAGE_ITALIAN:
|
||||
return apprentice->name[3];
|
||||
case LANGUAGE_GERMAN:
|
||||
return apprentice->name[4];
|
||||
case LANGUAGE_SPANISH:
|
||||
default:
|
||||
return apprentice->name[5];
|
||||
}
|
||||
}
|
||||
|
||||
void sub_81A16B4(u8 taskId)
|
||||
{
|
||||
if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
|
||||
SwitchTaskToFollowupFunc(taskId);
|
||||
}
|
||||
|
||||
static void Task_ExecuteFuncAfterButtonPress(u8 taskId)
|
||||
{
|
||||
if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
gUnknown_030062F4 = (void*)(u32)(((u16)gTasks[taskId].data[0] | (gTasks[taskId].data[1] << 0x10)));
|
||||
gUnknown_030062F4();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
static void ExecuteFuncAfterButtonPress(void (*func)(void))
|
||||
{
|
||||
u8 taskId = CreateTask(Task_ExecuteFuncAfterButtonPress, 1);
|
||||
gTasks[taskId].data[0] = (u32)(func);
|
||||
gTasks[taskId].data[1] = (u32)(func) >> 16;
|
||||
}
|
||||
|
||||
void sub_81A175C(TaskFunc taskFunc)
|
||||
{
|
||||
u8 taskId = CreateTask(sub_81A16B4, 1);
|
||||
SetTaskFuncWithFollowupFunc(taskId, sub_81A16B4, taskFunc);
|
||||
}
|
||||
|
@ -80,7 +80,6 @@ extern u8 StorageGetCurrentBox(void);
|
||||
extern void set_unknown_box_id(u8);
|
||||
extern void sub_803FA70(u8 battlerId);
|
||||
extern u8 sav1_map_get_name(void);
|
||||
extern const u8 *sub_81A1650(u8, u8 language);
|
||||
extern u8 GetFrontierEnemyMonLevel(u8);
|
||||
extern bool8 InBattlePyramid(void);
|
||||
extern bool8 InBattlePike(void);
|
||||
@ -2901,7 +2900,7 @@ void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 m
|
||||
|
||||
language = src->language;
|
||||
SetMonData(mon, MON_DATA_LANGUAGE, &language);
|
||||
SetMonData(mon, MON_DATA_OT_NAME, sub_81A1650(src->field_0_0, language));
|
||||
SetMonData(mon, MON_DATA_OT_NAME, GetApprenticeNameInLanguage(src->field_0_0, language));
|
||||
CalculateMonStats(mon);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user