mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
daycare file is decompiled
This commit is contained in:
parent
1e79d53d2f
commit
616edd6c3f
961
asm/daycare.s
961
asm/daycare.s
@ -1,961 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
|
||||
|
||||
thumb_func_start sub_8070BD0
|
||||
sub_8070BD0: @ 8070BD0
|
||||
push {lr}
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r1, =0x00003030
|
||||
adds r0, r1
|
||||
bl _DoEggActions_CheckHatch
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8070BD0
|
||||
|
||||
thumb_func_start sub_8070BF0
|
||||
sub_8070BF0: @ 8070BF0
|
||||
push {lr}
|
||||
movs r1, 0x8C
|
||||
lsls r1, 1
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _08070C00
|
||||
movs r0, 0x1
|
||||
_08070C00:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8070BF0
|
||||
|
||||
thumb_func_start sub_8070C04
|
||||
sub_8070C04: @ 8070C04
|
||||
push {r4,lr}
|
||||
sub sp, 0xC
|
||||
adds r4, r0, 0
|
||||
movs r1, 0xB
|
||||
bl GetBoxMonData
|
||||
cmp r0, 0
|
||||
beq _08070C2E
|
||||
ldr r1, =gStringVar1
|
||||
adds r0, r4, 0
|
||||
bl GetBoxMonNick
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x7
|
||||
mov r2, sp
|
||||
bl GetBoxMonData
|
||||
ldr r0, =gStringVar3
|
||||
mov r1, sp
|
||||
bl StringCopy
|
||||
_08070C2E:
|
||||
adds r4, 0x8C
|
||||
adds r0, r4, 0
|
||||
movs r1, 0xB
|
||||
bl GetBoxMonData
|
||||
cmp r0, 0
|
||||
beq _08070C44
|
||||
ldr r1, =gStringVar2
|
||||
adds r0, r4, 0
|
||||
bl GetBoxMonNick
|
||||
_08070C44:
|
||||
add sp, 0xC
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8070C04
|
||||
|
||||
thumb_func_start sub_8070C58
|
||||
sub_8070C58: @ 8070C58
|
||||
push {r4,r5,lr}
|
||||
bl GetCursorSelectionMonId
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
movs r5, 0x64
|
||||
muls r0, r5
|
||||
ldr r4, =gPlayerParty
|
||||
adds r0, r4
|
||||
ldr r1, =gStringVar1
|
||||
bl GetBoxMonNick
|
||||
bl GetCursorSelectionMonId
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
muls r0, r5
|
||||
adds r0, r4
|
||||
movs r1, 0xB
|
||||
bl GetBoxMonData
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8070C58
|
||||
|
||||
thumb_func_start sp0B5_daycare
|
||||
sp0B5_daycare: @ 8070C94
|
||||
push {lr}
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r1, =0x00003030
|
||||
adds r0, r1
|
||||
bl sub_8070C04
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sp0B5_daycare
|
||||
|
||||
thumb_func_start sp0B6_daycare
|
||||
sp0B6_daycare: @ 8070CB0
|
||||
push {r4,lr}
|
||||
ldr r4, =gSaveBlock1Ptr
|
||||
ldr r0, [r4]
|
||||
ldr r1, =0x00003030
|
||||
adds r0, r1
|
||||
bl sub_8070BF0
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08070CD0
|
||||
movs r0, 0x1
|
||||
b _08070CF2
|
||||
.pool
|
||||
_08070CD0:
|
||||
ldr r0, [r4]
|
||||
ldr r1, =0x00003030
|
||||
adds r0, r1
|
||||
bl CountPokemonInDaycare
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0
|
||||
bne _08070CEC
|
||||
movs r0, 0
|
||||
b _08070CF2
|
||||
.pool
|
||||
_08070CEC:
|
||||
adds r0, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
_08070CF2:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sp0B6_daycare
|
||||
|
||||
thumb_func_start sub_8070CF8
|
||||
sub_8070CF8: @ 8070CF8
|
||||
push {lr}
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r1, =0x00003030
|
||||
adds r0, r1
|
||||
bl CountPokemonInDaycare
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0
|
||||
bne _08070D10
|
||||
movs r0, 0
|
||||
_08070D10:
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8070CF8
|
||||
|
||||
thumb_func_start sub_8070D1C
|
||||
sub_8070D1C: @ 8070D1C
|
||||
push {r4-r6,lr}
|
||||
adds r5, r1, 0
|
||||
movs r4, 0
|
||||
adds r1, r0, 0
|
||||
_08070D24:
|
||||
movs r3, 0
|
||||
ldrh r0, [r1]
|
||||
adds r2, r5, 0
|
||||
_08070D2A:
|
||||
ldrh r6, [r2]
|
||||
cmp r0, r6
|
||||
bne _08070D34
|
||||
movs r0, 0x1
|
||||
b _08070D46
|
||||
_08070D34:
|
||||
adds r2, 0x2
|
||||
adds r3, 0x1
|
||||
cmp r3, 0x1
|
||||
ble _08070D2A
|
||||
adds r1, 0x2
|
||||
adds r4, 0x1
|
||||
cmp r4, 0x1
|
||||
ble _08070D24
|
||||
movs r0, 0
|
||||
_08070D46:
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8070D1C
|
||||
|
||||
thumb_func_start GetDaycareCompatibilityScore
|
||||
GetDaycareCompatibilityScore: @ 8070D4C
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x30
|
||||
str r0, [sp, 0x1C]
|
||||
movs r7, 0
|
||||
mov r0, sp
|
||||
adds r0, 0x8
|
||||
str r0, [sp, 0x20]
|
||||
add r1, sp, 0xC
|
||||
mov r9, r1
|
||||
mov r2, sp
|
||||
adds r2, 0x14
|
||||
str r2, [sp, 0x24]
|
||||
subs r0, 0x6
|
||||
ldr r1, =gBaseStats
|
||||
mov r10, r1
|
||||
ldr r5, [sp, 0x20]
|
||||
mov r8, r0
|
||||
mov r6, sp
|
||||
str r2, [sp, 0x28]
|
||||
mov r2, r9
|
||||
str r2, [sp, 0x2C]
|
||||
_08070D7E:
|
||||
movs r0, 0x8C
|
||||
adds r4, r7, 0
|
||||
muls r4, r0
|
||||
ldr r0, [sp, 0x1C]
|
||||
adds r4, r0, r4
|
||||
adds r0, r4, 0
|
||||
movs r1, 0xB
|
||||
bl GetBoxMonData
|
||||
strh r0, [r5]
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x1
|
||||
bl GetBoxMonData
|
||||
ldr r1, [sp, 0x2C]
|
||||
stm r1!, {r0}
|
||||
str r1, [sp, 0x2C]
|
||||
adds r0, r4, 0
|
||||
movs r1, 0
|
||||
bl GetBoxMonData
|
||||
adds r1, r0, 0
|
||||
ldrh r0, [r5]
|
||||
bl GetGenderFromSpeciesAndPersonality
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
ldr r2, [sp, 0x28]
|
||||
stm r2!, {r0}
|
||||
str r2, [sp, 0x28]
|
||||
ldrh r1, [r5]
|
||||
lsls r0, r1, 3
|
||||
subs r0, r1
|
||||
lsls r0, 2
|
||||
add r0, r10
|
||||
ldrb r0, [r0, 0x14]
|
||||
strh r0, [r6]
|
||||
ldrh r1, [r5]
|
||||
lsls r0, r1, 3
|
||||
subs r0, r1
|
||||
lsls r0, 2
|
||||
add r0, r10
|
||||
ldrb r0, [r0, 0x15]
|
||||
mov r1, r8
|
||||
strh r0, [r1]
|
||||
adds r5, 0x2
|
||||
movs r2, 0x4
|
||||
add r8, r2
|
||||
adds r6, 0x4
|
||||
adds r7, 0x1
|
||||
cmp r7, 0x1
|
||||
bls _08070D7E
|
||||
mov r0, sp
|
||||
ldrh r1, [r0]
|
||||
cmp r1, 0xF
|
||||
beq _08070DFC
|
||||
ldrh r0, [r0, 0x4]
|
||||
cmp r0, 0xF
|
||||
beq _08070DFC
|
||||
cmp r1, 0xD
|
||||
bne _08070E04
|
||||
cmp r0, 0xD
|
||||
bne _08070E08
|
||||
_08070DFC:
|
||||
movs r0, 0
|
||||
b _08070E5C
|
||||
.pool
|
||||
_08070E04:
|
||||
cmp r0, 0xD
|
||||
bne _08070E14
|
||||
_08070E08:
|
||||
ldr r1, [sp, 0xC]
|
||||
mov r2, r9
|
||||
ldr r0, [r2, 0x4]
|
||||
cmp r1, r0
|
||||
beq _08070E56
|
||||
b _08070E5A
|
||||
_08070E14:
|
||||
ldr r0, [sp, 0x14]
|
||||
ldr r2, [sp, 0x24]
|
||||
ldr r1, [r2, 0x4]
|
||||
cmp r0, r1
|
||||
beq _08070DFC
|
||||
cmp r0, 0xFF
|
||||
beq _08070DFC
|
||||
cmp r1, 0xFF
|
||||
beq _08070DFC
|
||||
add r1, sp, 0x4
|
||||
mov r0, sp
|
||||
bl sub_8070D1C
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08070DFC
|
||||
ldr r0, [sp, 0x20]
|
||||
ldrh r1, [r0, 0x2]
|
||||
ldrh r0, [r0]
|
||||
cmp r0, r1
|
||||
bne _08070E4C
|
||||
ldr r1, [sp, 0xC]
|
||||
mov r2, r9
|
||||
ldr r0, [r2, 0x4]
|
||||
cmp r1, r0
|
||||
beq _08070E5A
|
||||
movs r0, 0x46
|
||||
b _08070E5C
|
||||
_08070E4C:
|
||||
ldr r1, [sp, 0xC]
|
||||
mov r2, r9
|
||||
ldr r0, [r2, 0x4]
|
||||
cmp r1, r0
|
||||
bne _08070E5A
|
||||
_08070E56:
|
||||
movs r0, 0x14
|
||||
b _08070E5C
|
||||
_08070E5A:
|
||||
movs r0, 0x32
|
||||
_08070E5C:
|
||||
add sp, 0x30
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end GetDaycareCompatibilityScore
|
||||
|
||||
thumb_func_start daycare_relationship_score_from_savegame
|
||||
daycare_relationship_score_from_savegame: @ 8070E6C
|
||||
push {lr}
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r1, =0x00003030
|
||||
adds r0, r1
|
||||
bl GetDaycareCompatibilityScore
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end daycare_relationship_score_from_savegame
|
||||
|
||||
thumb_func_start sp0B9_daycare_relationship_comment
|
||||
sp0B9_daycare_relationship_comment: @ 8070E8C
|
||||
push {lr}
|
||||
bl daycare_relationship_score_from_savegame
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
adds r2, r0, 0
|
||||
movs r1, 0
|
||||
cmp r0, 0
|
||||
bne _08070EA0
|
||||
movs r1, 0x3
|
||||
_08070EA0:
|
||||
cmp r0, 0x14
|
||||
bne _08070EA6
|
||||
movs r1, 0x2
|
||||
_08070EA6:
|
||||
cmp r0, 0x32
|
||||
bne _08070EAC
|
||||
movs r1, 0x1
|
||||
_08070EAC:
|
||||
cmp r2, 0x46
|
||||
bne _08070EB2
|
||||
movs r1, 0
|
||||
_08070EB2:
|
||||
ldr r0, =gStringVar4
|
||||
ldr r2, =gUnknown_0832B6F8
|
||||
lsls r1, 2
|
||||
adds r1, r2
|
||||
ldr r1, [r1]
|
||||
bl StringCopy
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sp0B9_daycare_relationship_comment
|
||||
|
||||
thumb_func_start sub_8070ECC
|
||||
sub_8070ECC: @ 8070ECC
|
||||
push {r4,r5,lr}
|
||||
sub sp, 0x4
|
||||
adds r4, r0, 0
|
||||
lsls r1, 24
|
||||
lsrs r5, r1, 24
|
||||
mov r2, sp
|
||||
mov r1, sp
|
||||
movs r0, 0
|
||||
strb r0, [r1, 0x1]
|
||||
strb r0, [r2]
|
||||
movs r3, 0
|
||||
ldrb r0, [r4]
|
||||
cmp r0, 0xFF
|
||||
beq _08070F10
|
||||
_08070EE8:
|
||||
adds r1, r4, r3
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0xB5
|
||||
bne _08070EF6
|
||||
ldrb r0, [r2]
|
||||
adds r0, 0x1
|
||||
strb r0, [r2]
|
||||
_08070EF6:
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0xB6
|
||||
bne _08070F02
|
||||
ldrb r0, [r2, 0x1]
|
||||
adds r0, 0x1
|
||||
strb r0, [r2, 0x1]
|
||||
_08070F02:
|
||||
adds r0, r3, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r3, r0, 24
|
||||
adds r0, r4, r3
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0xFF
|
||||
bne _08070EE8
|
||||
_08070F10:
|
||||
cmp r5, 0
|
||||
bne _08070F24
|
||||
mov r0, sp
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _08070F24
|
||||
mov r0, sp
|
||||
ldrb r0, [r0, 0x1]
|
||||
cmp r0, 0
|
||||
beq _08070F38
|
||||
_08070F24:
|
||||
cmp r5, 0xFE
|
||||
bne _08070F3C
|
||||
mov r0, sp
|
||||
ldrb r0, [r0, 0x1]
|
||||
cmp r0, 0
|
||||
beq _08070F3C
|
||||
mov r0, sp
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
bne _08070F3C
|
||||
_08070F38:
|
||||
movs r0, 0x1
|
||||
b _08070F3E
|
||||
_08070F3C:
|
||||
movs r0, 0
|
||||
_08070F3E:
|
||||
add sp, 0x4
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8070ECC
|
||||
|
||||
thumb_func_start sub_8070F48
|
||||
sub_8070F48: @ 8070F48
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
cmp r1, 0
|
||||
bne _08070F68
|
||||
movs r1, 0
|
||||
bl sub_8070ECC
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08070F84
|
||||
ldr r1, =gUnknown_0832DAC7
|
||||
b _08070F86
|
||||
.pool
|
||||
_08070F68:
|
||||
cmp r1, 0xFE
|
||||
bne _08070F84
|
||||
adds r0, r4, 0
|
||||
movs r1, 0xFE
|
||||
bl sub_8070ECC
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08070F84
|
||||
ldr r1, =gUnknown_0832DAC9
|
||||
b _08070F86
|
||||
.pool
|
||||
_08070F84:
|
||||
ldr r1, =gUnknown_0832DACB
|
||||
_08070F86:
|
||||
adds r0, r4, 0
|
||||
bl StringAppend
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8070F48
|
||||
|
||||
thumb_func_start sub_8070F98
|
||||
sub_8070F98: @ 8070F98
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
adds r0, r1, 0
|
||||
bl GetBoxMonGender
|
||||
adds r1, r0, 0
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
adds r0, r4, 0
|
||||
bl sub_8070F48
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8070F98
|
||||
|
||||
thumb_func_start sub_8070FB4
|
||||
sub_8070FB4: @ 8070FB4
|
||||
push {r4-r7,lr}
|
||||
mov r7, r9
|
||||
mov r6, r8
|
||||
push {r6,r7}
|
||||
sub sp, 0x28
|
||||
mov r8, r0
|
||||
adds r7, r1, 0
|
||||
movs r0, 0xFF
|
||||
strb r0, [r7]
|
||||
movs r6, 0
|
||||
add r0, sp, 0x14
|
||||
mov r9, r0
|
||||
_08070FCC:
|
||||
movs r0, 0x8C
|
||||
adds r4, r6, 0
|
||||
muls r4, r0
|
||||
add r4, r8
|
||||
lsls r0, r6, 2
|
||||
adds r0, r6
|
||||
lsls r0, 2
|
||||
mov r1, sp
|
||||
adds r5, r1, r0
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl GetBoxMonNick
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
bl sub_8070F98
|
||||
adds r0, r6, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r6, r0, 24
|
||||
cmp r6, 0x1
|
||||
bls _08070FCC
|
||||
adds r0, r7, 0
|
||||
mov r1, sp
|
||||
bl StringCopy
|
||||
ldr r4, =gText_NewLine2
|
||||
adds r0, r7, 0
|
||||
adds r1, r4, 0
|
||||
bl StringAppend
|
||||
adds r0, r7, 0
|
||||
mov r1, r9
|
||||
bl StringAppend
|
||||
adds r0, r7, 0
|
||||
adds r1, r4, 0
|
||||
bl StringAppend
|
||||
ldr r1, =gText_Exit4
|
||||
adds r0, r7, 0
|
||||
bl StringAppend
|
||||
add sp, 0x28
|
||||
pop {r3,r4}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8070FB4
|
||||
|
||||
thumb_func_start sub_8071038
|
||||
sub_8071038: @ 8071038
|
||||
push {r4-r6,lr}
|
||||
sub sp, 0x14
|
||||
adds r6, r0, 0
|
||||
adds r4, r1, 0
|
||||
movs r0, 0xFF
|
||||
strb r0, [r4]
|
||||
movs r5, 0
|
||||
_08071046:
|
||||
adds r0, r4, 0
|
||||
ldr r1, =gText_Lv
|
||||
bl StringAppend
|
||||
movs r0, 0x8C
|
||||
adds r2, r5, 0
|
||||
muls r2, r0
|
||||
adds r0, r6, r2
|
||||
adds r1, r6, 0
|
||||
adds r1, 0x88
|
||||
adds r1, r2
|
||||
ldr r1, [r1]
|
||||
bl GetLevelAfterDaycareSteps
|
||||
adds r1, r0, 0
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
mov r0, sp
|
||||
movs r2, 0
|
||||
movs r3, 0x3
|
||||
bl ConvertIntToDecimalStringN
|
||||
adds r0, r4, 0
|
||||
mov r1, sp
|
||||
bl StringAppend
|
||||
adds r0, r4, 0
|
||||
ldr r1, =gText_NewLine2
|
||||
bl StringAppend
|
||||
adds r0, r5, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
cmp r5, 0x1
|
||||
bls _08071046
|
||||
add sp, 0x14
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8071038
|
||||
|
||||
thumb_func_start sub_807109C
|
||||
sub_807109C: @ 807109C
|
||||
push {r4-r6,lr}
|
||||
sub sp, 0x10
|
||||
str r1, [sp]
|
||||
mov r1, sp
|
||||
movs r5, 0
|
||||
strb r0, [r1, 0x4]
|
||||
mov r0, sp
|
||||
movs r6, 0x1
|
||||
movs r4, 0x1
|
||||
strb r4, [r0, 0x5]
|
||||
strb r2, [r0, 0x6]
|
||||
strb r3, [r0, 0x7]
|
||||
strb r2, [r0, 0x8]
|
||||
strb r3, [r0, 0x9]
|
||||
mov r3, sp
|
||||
ldrb r1, [r3, 0xC]
|
||||
movs r2, 0x10
|
||||
negs r2, r2
|
||||
adds r0, r2, 0
|
||||
ands r0, r1
|
||||
strb r0, [r3, 0xC]
|
||||
ldr r3, =gTextFlags
|
||||
ldrb r1, [r3]
|
||||
movs r0, 0x3
|
||||
negs r0, r0
|
||||
ands r0, r1
|
||||
strb r0, [r3]
|
||||
mov r0, sp
|
||||
strb r5, [r0, 0xA]
|
||||
strb r4, [r0, 0xB]
|
||||
mov r3, sp
|
||||
ldrb r1, [r3, 0xC]
|
||||
movs r4, 0xF
|
||||
adds r0, r4, 0
|
||||
ands r0, r1
|
||||
movs r1, 0x20
|
||||
orrs r0, r1
|
||||
strb r0, [r3, 0xC]
|
||||
mov r1, sp
|
||||
ldrb r0, [r1, 0xD]
|
||||
ands r2, r0
|
||||
orrs r2, r6
|
||||
strb r2, [r1, 0xD]
|
||||
ands r2, r4
|
||||
movs r0, 0x30
|
||||
orrs r2, r0
|
||||
strb r2, [r1, 0xD]
|
||||
mov r0, sp
|
||||
movs r1, 0xFF
|
||||
movs r2, 0
|
||||
bl AddTextPrinter
|
||||
add sp, 0x10
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_807109C
|
||||
|
||||
thumb_func_start sub_8071110
|
||||
sub_8071110: @ 8071110
|
||||
push {r4-r6,lr}
|
||||
sub sp, 0x14
|
||||
adds r5, r0, 0
|
||||
adds r4, r1, 0
|
||||
adds r6, r3, 0
|
||||
lsls r4, 24
|
||||
lsrs r4, 24
|
||||
movs r0, 0x8C
|
||||
muls r0, r2
|
||||
adds r5, r0
|
||||
adds r0, r5, 0
|
||||
mov r1, sp
|
||||
bl GetBoxMonNick
|
||||
mov r0, sp
|
||||
adds r1, r5, 0
|
||||
bl sub_8070F98
|
||||
adds r0, r4, 0
|
||||
mov r1, sp
|
||||
movs r2, 0x8
|
||||
adds r3, r6, 0
|
||||
bl sub_807109C
|
||||
add sp, 0x14
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_8071110
|
||||
|
||||
thumb_func_start sub_8071148
|
||||
sub_8071148: @ 8071148
|
||||
push {r4-r6,lr}
|
||||
mov r6, r8
|
||||
push {r6}
|
||||
sub sp, 0x14
|
||||
adds r4, r0, 0
|
||||
adds r5, r1, 0
|
||||
adds r6, r2, 0
|
||||
mov r8, r3
|
||||
lsls r5, 24
|
||||
lsrs r5, 24
|
||||
ldr r1, =gText_Lv
|
||||
mov r0, sp
|
||||
bl StringCopy
|
||||
movs r0, 0x8C
|
||||
adds r1, r6, 0
|
||||
muls r1, r0
|
||||
adds r0, r4, r1
|
||||
adds r4, 0x88
|
||||
adds r4, r1
|
||||
ldr r1, [r4]
|
||||
bl GetLevelAfterDaycareSteps
|
||||
adds r1, r0, 0
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
add r4, sp, 0xC
|
||||
adds r0, r4, 0
|
||||
movs r2, 0
|
||||
movs r3, 0x3
|
||||
bl ConvertIntToDecimalStringN
|
||||
mov r0, sp
|
||||
adds r1, r4, 0
|
||||
bl StringAppend
|
||||
movs r0, 0x1
|
||||
mov r1, sp
|
||||
movs r2, 0x70
|
||||
bl GetStringRightAlignXOffset
|
||||
adds r2, r0, 0
|
||||
adds r0, r5, 0
|
||||
mov r1, sp
|
||||
mov r3, r8
|
||||
bl sub_807109C
|
||||
add sp, 0x14
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8071148
|
||||
|
||||
thumb_func_start sub_80711B8
|
||||
sub_80711B8: @ 80711B8
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
adds r6, r1, 0
|
||||
lsls r0, 24
|
||||
lsrs r7, r0, 24
|
||||
lsls r2, 24
|
||||
lsrs r5, r2, 24
|
||||
cmp r6, 0x1
|
||||
bhi _080711F0
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
mov r8, r0
|
||||
ldr r0, [r0]
|
||||
ldr r4, =0x00003030
|
||||
adds r0, r4
|
||||
adds r1, r7, 0
|
||||
adds r2, r6, 0
|
||||
adds r3, r5, 0
|
||||
bl sub_8071110
|
||||
mov r1, r8
|
||||
ldr r0, [r1]
|
||||
adds r0, r4
|
||||
adds r1, r7, 0
|
||||
adds r2, r6, 0
|
||||
adds r3, r5, 0
|
||||
bl sub_8071148
|
||||
_080711F0:
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80711B8
|
||||
|
||||
thumb_func_start c3_080469FC
|
||||
c3_080469FC: @ 8071204
|
||||
push {r4,r5,lr}
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
adds r5, r0, 0
|
||||
ldr r1, =gTasks
|
||||
lsls r0, r5, 2
|
||||
adds r0, r5
|
||||
lsls r0, 3
|
||||
adds r4, r0, r1
|
||||
ldrb r0, [r4, 0x8]
|
||||
bl ListMenuHandleInput
|
||||
adds r1, r0, 0
|
||||
ldr r0, =gMain
|
||||
ldrh r2, [r0, 0x2E]
|
||||
movs r0, 0x1
|
||||
ands r0, r2
|
||||
cmp r0, 0
|
||||
beq _08071284
|
||||
cmp r1, 0x1
|
||||
bls _0807123C
|
||||
cmp r1, 0x5
|
||||
beq _08071248
|
||||
b _0807124E
|
||||
.pool
|
||||
_0807123C:
|
||||
ldr r0, =gSpecialVar_Result
|
||||
strh r1, [r0]
|
||||
b _0807124E
|
||||
.pool
|
||||
_08071248:
|
||||
ldr r1, =gSpecialVar_Result
|
||||
movs r0, 0x2
|
||||
strh r0, [r1]
|
||||
_0807124E:
|
||||
ldr r0, =gTasks
|
||||
lsls r4, r5, 2
|
||||
adds r4, r5
|
||||
lsls r4, 3
|
||||
adds r4, r0
|
||||
ldrb r0, [r4, 0x8]
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
bl sub_81AE6C8
|
||||
ldrb r0, [r4, 0xA]
|
||||
movs r1, 0x1
|
||||
bl sub_819746C
|
||||
ldrb r0, [r4, 0xA]
|
||||
bl RemoveWindow
|
||||
adds r0, r5, 0
|
||||
bl DestroyTask
|
||||
bl EnableBothScriptContexts
|
||||
b _080712B4
|
||||
.pool
|
||||
_08071284:
|
||||
movs r1, 0x2
|
||||
adds r0, r1, 0
|
||||
ands r0, r2
|
||||
cmp r0, 0
|
||||
beq _080712B4
|
||||
ldr r0, =gSpecialVar_Result
|
||||
strh r1, [r0]
|
||||
ldrb r0, [r4, 0x8]
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
bl sub_81AE6C8
|
||||
ldrb r0, [r4, 0xA]
|
||||
movs r1, 0x1
|
||||
bl sub_819746C
|
||||
ldrb r0, [r4, 0xA]
|
||||
bl RemoveWindow
|
||||
adds r0, r5, 0
|
||||
bl DestroyTask
|
||||
bl EnableBothScriptContexts
|
||||
_080712B4:
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end c3_080469FC
|
||||
|
||||
thumb_func_start sub_80712C0
|
||||
sub_80712C0: @ 80712C0
|
||||
push {r4,r5,lr}
|
||||
sub sp, 0x18
|
||||
ldr r0, =gUnknown_0832B6C0
|
||||
bl AddWindow
|
||||
adds r4, r0, 0
|
||||
lsls r4, 24
|
||||
lsrs r4, 24
|
||||
adds r0, r4, 0
|
||||
movs r1, 0
|
||||
bl sub_81973FC
|
||||
mov r1, sp
|
||||
ldr r0, =gUnknown_0832B6E0
|
||||
ldm r0!, {r2,r3,r5}
|
||||
stm r1!, {r2,r3,r5}
|
||||
ldm r0!, {r2,r3,r5}
|
||||
stm r1!, {r2,r3,r5}
|
||||
mov r0, sp
|
||||
strb r4, [r0, 0x10]
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
bl ListMenuInit
|
||||
adds r5, r0, 0
|
||||
lsls r5, 24
|
||||
lsrs r5, 24
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x3
|
||||
bl CopyWindowToVram
|
||||
ldr r0, =c3_080469FC
|
||||
movs r1, 0x3
|
||||
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 r5, [r1, 0x8]
|
||||
strh r4, [r1, 0xA]
|
||||
add sp, 0x18
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80712C0
|
||||
|
||||
thumb_func_start sub_8071330
|
||||
sub_8071330: @ 8071330
|
||||
push {lr}
|
||||
bl sub_81B9328
|
||||
ldr r1, =gMain
|
||||
ldr r0, =c2_exit_to_overworld_2_switch
|
||||
str r0, [r1, 0x8]
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8071330
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
@ -1390,7 +1390,7 @@ _0809CA04:
|
||||
b _0809CB28
|
||||
.pool
|
||||
_0809CA48:
|
||||
bl sub_8070BD0
|
||||
bl DoEggActions_CheckHatch
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0809CA64
|
||||
|
@ -5112,7 +5112,7 @@ _08079DDE:
|
||||
_08079DF0:
|
||||
add r0, sp, 0xC
|
||||
movs r1, 0
|
||||
bl sub_8070ECC
|
||||
bl NameHasGenderSymbol
|
||||
lsls r0, 24
|
||||
movs r2, 0x83
|
||||
cmp r0, 0
|
||||
@ -5122,7 +5122,7 @@ _08079DF0:
|
||||
_08079E04:
|
||||
add r0, sp, 0xC
|
||||
movs r1, 0xFE
|
||||
bl sub_8070ECC
|
||||
bl NameHasGenderSymbol
|
||||
lsls r0, 24
|
||||
movs r2, 0x83
|
||||
cmp r0, 0
|
||||
|
@ -9,13 +9,13 @@
|
||||
|
||||
|
||||
.align 2
|
||||
gUnknown_0832B6C0:: @ 832B6C0
|
||||
sDaycareLevelMenuWindowTemplate:: @ 832B6C0
|
||||
.incbin "baserom.gba", 0x32b6c0, 0x20
|
||||
|
||||
gUnknown_0832B6E0:: @ 832B6E0
|
||||
sDaycareListMenuLevelTemplate:: @ 832B6E0
|
||||
.incbin "baserom.gba", 0x32b6e0, 0x18
|
||||
|
||||
gUnknown_0832B6F8:: @ 832B6F8
|
||||
sCompatibilityMessages:: @ 832B6F8
|
||||
.incbin "baserom.gba", 0x32b6f8, 0x10
|
||||
|
||||
sJapaneseEggNickname:: @ 832B708
|
||||
|
@ -1,8 +1,8 @@
|
||||
Route117_EventScript_291C18:: @ 8291C18
|
||||
lock
|
||||
faceplayer
|
||||
special sp0B5_daycare
|
||||
specialvar VAR_RESULT, sp0B6_daycare
|
||||
special GetDaycareMonNicknames
|
||||
specialvar VAR_RESULT, GetDaycareState
|
||||
compare_var_to_value VAR_RESULT, 1
|
||||
goto_eq Route117_EventScript_291C4D
|
||||
compare_var_to_value VAR_RESULT, 2
|
||||
@ -56,7 +56,7 @@ Route117_EventScript_291CC8:: @ 8291CC8
|
||||
return
|
||||
|
||||
Route117_EventScript_291CD1:: @ 8291CD1
|
||||
special sp0B5_daycare
|
||||
special GetDaycareMonNicknames
|
||||
msgbox Route117_Text_292114, 4
|
||||
setvar VAR_0x8004, 0
|
||||
call Route117_EventScript_291CB7
|
||||
@ -64,9 +64,9 @@ Route117_EventScript_291CD1:: @ 8291CD1
|
||||
end
|
||||
|
||||
Route117_EventScript_291CE8:: @ 8291CE8
|
||||
special sp0B5_daycare
|
||||
special GetDaycareMonNicknames
|
||||
msgbox Route117_Text_292299, 4
|
||||
special sp0B9_daycare_relationship_comment
|
||||
special SetDaycareCompatibilityString
|
||||
special sub_8138AC0
|
||||
waitmessage
|
||||
waitbuttonpress
|
||||
@ -80,7 +80,7 @@ Route117_EventScript_291CE8:: @ 8291CE8
|
||||
Route117_PokemonDayCare_EventScript_291D11:: @ 8291D11
|
||||
lock
|
||||
faceplayer
|
||||
specialvar VAR_RESULT, sp0B6_daycare
|
||||
specialvar VAR_RESULT, GetDaycareState
|
||||
compare_var_to_value VAR_RESULT, 1
|
||||
goto_eq Route117_PokemonDayCare_EventScript_291E0B
|
||||
compare_var_to_value VAR_RESULT, 2
|
||||
@ -103,21 +103,21 @@ Route117_PokemonDayCare_EventScript_291D56:: @ 8291D56
|
||||
goto_eq Route117_PokemonDayCare_EventScript_291E01
|
||||
msgbox Route117_PokemonDayCare_Text_292349, 4
|
||||
fadescreen 1
|
||||
special sub_8071330
|
||||
special ChooseSendDaycareMon
|
||||
waitstate
|
||||
compare_var_to_value VAR_0x8004, 255
|
||||
goto_eq Route117_PokemonDayCare_EventScript_291DCA
|
||||
specialvar VAR_RESULT, sub_80C70AC
|
||||
compare_var_to_value VAR_RESULT, 0
|
||||
goto_eq Route117_PokemonDayCare_EventScript_291DF7
|
||||
specialvar VAR_0x8005, sub_8070C58
|
||||
specialvar VAR_0x8005, GetSelectedMonNickAndSpecies
|
||||
waitse
|
||||
playmoncry VAR_0x8005, 0
|
||||
msgbox Route117_PokemonDayCare_Text_292370, 4
|
||||
waitmoncry
|
||||
special StoreSelectedPokemonInDaycare
|
||||
incrementgamestat 47
|
||||
specialvar VAR_RESULT, sp0B6_daycare
|
||||
specialvar VAR_RESULT, GetDaycareState
|
||||
compare_var_to_value VAR_RESULT, 2
|
||||
goto_eq Route117_PokemonDayCare_EventScript_291DD4
|
||||
release
|
||||
@ -182,11 +182,11 @@ Route117_PokemonDayCare_EventScript_291E6D:: @ 8291E6D
|
||||
specialvar VAR_RESULT, CalculatePlayerPartyCount
|
||||
compare_var_to_value VAR_RESULT, 6
|
||||
goto_eq Route117_PokemonDayCare_EventScript_291F3D
|
||||
specialvar VAR_RESULT, sp0B6_daycare
|
||||
specialvar VAR_RESULT, GetDaycareState
|
||||
setvar VAR_0x8004, 0
|
||||
compare_var_to_value VAR_RESULT, 2
|
||||
goto_eq Route117_PokemonDayCare_EventScript_291EAC
|
||||
special sub_80712C0
|
||||
special ShowDaycareLevelMenu
|
||||
waitstate
|
||||
copyvar VAR_0x8004, VAR_RESULT
|
||||
compare_var_to_value VAR_RESULT, 2
|
||||
@ -221,7 +221,7 @@ Route117_PokemonDayCare_EventScript_291EE2:: @ 8291EE2
|
||||
playmoncry VAR_RESULT, 0
|
||||
msgbox Route117_PokemonDayCare_Text_292593, 4
|
||||
waitmoncry
|
||||
specialvar VAR_RESULT, sp0B6_daycare
|
||||
specialvar VAR_RESULT, GetDaycareState
|
||||
compare_var_to_value VAR_RESULT, 2
|
||||
goto_eq Route117_PokemonDayCare_EventScript_291F24
|
||||
goto Route117_PokemonDayCare_EventScript_291DCA
|
||||
@ -278,7 +278,7 @@ Route117_PokemonDayCare_EventScript_291F5C:: @ 8291F5C
|
||||
end
|
||||
|
||||
Route117_PokemonDayCare_EventScript_291F95:: @ 8291F95
|
||||
special sub_80712C0
|
||||
special ShowDaycareLevelMenu
|
||||
waitstate
|
||||
compare_var_to_value VAR_RESULT, 2
|
||||
goto_eq Route117_PokemonDayCare_EventScript_291DCA
|
||||
|
@ -191,15 +191,15 @@ gSpecials:: @ 81DBA64
|
||||
def_special GabbyAndTyGetLastBattleTrivia
|
||||
def_special GabbyAndTySetScriptVarsToFieldObjectLocalIds
|
||||
def_special sub_8138B80
|
||||
def_special sp0B5_daycare
|
||||
def_special sp0B6_daycare
|
||||
def_special GetDaycareMonNicknames
|
||||
def_special GetDaycareState
|
||||
def_special RejectEggFromDayCare
|
||||
def_special GiveEggFromDaycare
|
||||
def_special sp0B9_daycare_relationship_comment
|
||||
def_special sub_8070C58
|
||||
def_special SetDaycareCompatibilityString
|
||||
def_special GetSelectedMonNickAndSpecies
|
||||
def_special StoreSelectedPokemonInDaycare
|
||||
def_special sub_8071330
|
||||
def_special sub_80712C0
|
||||
def_special ChooseSendDaycareMon
|
||||
def_special ShowDaycareLevelMenu
|
||||
def_special GetNumLevelsGainedFromDaycare
|
||||
def_special GetDaycareCost
|
||||
def_special TakePokemonFromDaycare
|
||||
|
@ -19,13 +19,13 @@ gUnknown_0832D2BC:: @ 832D2BC
|
||||
gUnknown_0832DABC:: @ 832DABC
|
||||
.incbin "baserom.gba", 0x32dabc, 0xb
|
||||
|
||||
gUnknown_0832DAC7:: @ 832DAC7
|
||||
gText_MaleSymbol4:: @ 832DAC7
|
||||
.incbin "baserom.gba", 0x32dac7, 0x2
|
||||
|
||||
gUnknown_0832DAC9:: @ 832DAC9
|
||||
gText_FemaleSymbol4:: @ 832DAC9
|
||||
.incbin "baserom.gba", 0x32dac9, 0x2
|
||||
|
||||
gUnknown_0832DACB:: @ 832DACB
|
||||
gText_GenderlessSymbol:: @ 832DACB
|
||||
.incbin "baserom.gba", 0x32dacb, 0x7
|
||||
|
||||
gUnknown_0832DAD2:: @ 832DAD2
|
||||
|
@ -78,7 +78,6 @@ SECTIONS {
|
||||
src/util.o(.text);
|
||||
src/blend_palette.o(.text);
|
||||
src/daycare.o(.text);
|
||||
asm/daycare.o(.text);
|
||||
src/egg_hatch.o(.text);
|
||||
src/battle_interface.o(.text);
|
||||
asm/smokescreen.o(.text);
|
||||
|
401
src/daycare.c
401
src/daycare.c
@ -11,6 +11,13 @@
|
||||
#include "main.h"
|
||||
#include "moves.h"
|
||||
#include "egg_hatch.h"
|
||||
#include "text.h"
|
||||
#include "menu.h"
|
||||
#include "international_string_util.h"
|
||||
#include "script.h"
|
||||
#include "task.h"
|
||||
#include "window.h"
|
||||
#include "list_menu.h"
|
||||
|
||||
#define EGG_MOVES_ARRAY_COUNT 10
|
||||
#define EGG_LVL_UP_MOVES_ARRAY_COUNT 50
|
||||
@ -19,6 +26,12 @@ extern u16 gMoveToLearn;
|
||||
|
||||
extern u8 GetCursorSelectionMonId(void);
|
||||
extern u16 ItemIdToBattleMoveId(u16);
|
||||
extern s32 ListMenuHandleInput(u8);
|
||||
extern void sub_81AE6C8(u8, u16*, u16*);
|
||||
extern void sub_819746C(u8, bool8);
|
||||
extern void sub_81973FC(u8, bool8);
|
||||
extern void sub_81B9328(void);
|
||||
extern void c2_exit_to_overworld_2_switch(void);
|
||||
|
||||
// this file's functions
|
||||
static void ClearDaycareMonMisc(struct DaycareMiscMon *misc);
|
||||
@ -34,6 +47,9 @@ EWRAM_DATA static u16 sHatchedEggMotherMoves[4] = {0};
|
||||
|
||||
#include "data/pokemon/egg_moves.h"
|
||||
|
||||
extern const struct WindowTemplate sDaycareLevelMenuWindowTemplate;
|
||||
extern const struct ListMenuTemplate sDaycareListMenuLevelTemplate;
|
||||
extern const u8 *sCompatibilityMessages[];
|
||||
extern const u8 sJapaneseEggNickname[];
|
||||
|
||||
u8 *GetMonNick(struct Pokemon *mon, u8 *dest)
|
||||
@ -821,7 +837,7 @@ void GiveEggFromDaycare(void)
|
||||
_GiveEggFromDaycare(&gSaveBlock1Ptr->daycare);
|
||||
}
|
||||
|
||||
bool8 _DoEggActions_CheckHatch(struct DayCare *daycare)
|
||||
static bool8 _DoEggActions_CheckHatch(struct DayCare *daycare)
|
||||
{
|
||||
u32 i, validEggs = 0;
|
||||
|
||||
@ -871,3 +887,386 @@ bool8 _DoEggActions_CheckHatch(struct DayCare *daycare)
|
||||
|
||||
return FALSE; // no hatching
|
||||
}
|
||||
|
||||
bool8 DoEggActions_CheckHatch(void)
|
||||
{
|
||||
return _DoEggActions_CheckHatch(&gSaveBlock1Ptr->daycare);
|
||||
}
|
||||
|
||||
static bool8 IsEggPending(struct DayCare *daycare)
|
||||
{
|
||||
return (daycare->offspringPersonality != 0);
|
||||
}
|
||||
|
||||
// gStringVar1 = first mon's nickname
|
||||
// gStringVar2 = second mon's nickname
|
||||
// gStringVar3 = first mon trainer's name
|
||||
void _GetDaycareMonNicknames(struct DayCare *daycare)
|
||||
{
|
||||
u8 text[12];
|
||||
if (GetBoxMonData(&daycare->mons[0].mon, MON_DATA_SPECIES) != 0)
|
||||
{
|
||||
GetBoxMonNick(&daycare->mons[0].mon, gStringVar1);
|
||||
GetBoxMonData(&daycare->mons[0].mon, MON_DATA_OT_NAME, text);
|
||||
StringCopy(gStringVar3, text);
|
||||
}
|
||||
|
||||
if (GetBoxMonData(&daycare->mons[1].mon, MON_DATA_SPECIES) != 0)
|
||||
{
|
||||
GetBoxMonNick(&daycare->mons[1].mon, gStringVar2);
|
||||
}
|
||||
}
|
||||
|
||||
u16 GetSelectedMonNickAndSpecies(void)
|
||||
{
|
||||
GetBoxMonNick(&gPlayerParty[GetCursorSelectionMonId()].box, gStringVar1);
|
||||
return GetBoxMonData(&gPlayerParty[GetCursorSelectionMonId()].box, MON_DATA_SPECIES);
|
||||
}
|
||||
|
||||
void GetDaycareMonNicknames(void)
|
||||
{
|
||||
_GetDaycareMonNicknames(&gSaveBlock1Ptr->daycare);
|
||||
}
|
||||
|
||||
u8 GetDaycareState(void)
|
||||
{
|
||||
// The daycare can be in 4 possible states:
|
||||
// 0: default state--no deposited mons, no egg
|
||||
// 1: there is an egg waiting for the player to pick it up
|
||||
// 2: there is a single pokemon in the daycare
|
||||
// 3: there are two pokemon in the daycare, no egg
|
||||
|
||||
u8 numMons;
|
||||
if (IsEggPending(&gSaveBlock1Ptr->daycare))
|
||||
{
|
||||
// There is an Egg waiting for the player.
|
||||
return 1;
|
||||
}
|
||||
|
||||
numMons = CountPokemonInDaycare(&gSaveBlock1Ptr->daycare);
|
||||
if (numMons != 0)
|
||||
{
|
||||
return numMons + 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 GetDaycarePokemonCount(void)
|
||||
{
|
||||
u8 ret = CountPokemonInDaycare(&gSaveBlock1Ptr->daycare);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool8 EggGroupsOverlap(u16 *eggGroups1, u16 *eggGroups2)
|
||||
{
|
||||
// Determine if the two given egg group lists contain any of the
|
||||
// same egg groups.
|
||||
s32 i, j;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
for (j = 0; j < 2; j++)
|
||||
{
|
||||
if (eggGroups1[i] == eggGroups2[j])
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
u8 GetDaycareCompatibilityScore(struct DayCare *daycare)
|
||||
{
|
||||
u32 i;
|
||||
u16 eggGroups[2][2];
|
||||
u16 species[2];
|
||||
u32 trainerIds[2];
|
||||
u32 genders[2];
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
u32 personality;
|
||||
|
||||
species[i] = GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SPECIES);
|
||||
trainerIds[i] = GetBoxMonData(&daycare->mons[i].mon, MON_DATA_OT_ID);
|
||||
personality = GetBoxMonData(&daycare->mons[i].mon, MON_DATA_PERSONALITY);
|
||||
genders[i] = GetGenderFromSpeciesAndPersonality(species[i], personality);
|
||||
eggGroups[i][0] = gBaseStats[species[i]].eggGroup1;
|
||||
eggGroups[i][1] = gBaseStats[species[i]].eggGroup2;
|
||||
}
|
||||
|
||||
// check unbreedable egg group
|
||||
if (eggGroups[0][0] == EGG_GROUP_UNDISCOVERED || eggGroups[1][0] == EGG_GROUP_UNDISCOVERED)
|
||||
return 0;
|
||||
// two Ditto can't breed
|
||||
if (eggGroups[0][0] == EGG_GROUP_DITTO && eggGroups[1][0] == EGG_GROUP_DITTO)
|
||||
return 0;
|
||||
|
||||
// now that we checked, one ditto can breed with any other mon
|
||||
if (eggGroups[0][0] == EGG_GROUP_DITTO || eggGroups[1][0] == EGG_GROUP_DITTO)
|
||||
{
|
||||
if (trainerIds[0] == trainerIds[1]) // same trainer
|
||||
return 20;
|
||||
|
||||
return 50; // different trainers, more chance of poke sex
|
||||
}
|
||||
else
|
||||
{
|
||||
if (genders[0] == genders[1]) // no homo
|
||||
return 0;
|
||||
if (genders[0] == MON_GENDERLESS || genders[1] == MON_GENDERLESS)
|
||||
return 0;
|
||||
if (!EggGroupsOverlap(eggGroups[0], eggGroups[1])) // not compatible with each other
|
||||
return 0;
|
||||
|
||||
if (species[0] == species[1]) // same species
|
||||
{
|
||||
if (trainerIds[0] == trainerIds[1]) // same species and trainer
|
||||
return 50;
|
||||
|
||||
return 70; // different trainers, same species
|
||||
}
|
||||
else
|
||||
{
|
||||
if (trainerIds[0] != trainerIds[1]) // different trainers, different species
|
||||
return 50;
|
||||
|
||||
return 20; // different species, same trainer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u8 GetDaycareCompatibilityScoreFromSave(void)
|
||||
{
|
||||
return GetDaycareCompatibilityScore(&gSaveBlock1Ptr->daycare);
|
||||
}
|
||||
|
||||
void SetDaycareCompatibilityString(void)
|
||||
{
|
||||
u8 whichString;
|
||||
u8 relationshipScore;
|
||||
|
||||
relationshipScore = GetDaycareCompatibilityScoreFromSave();
|
||||
whichString = 0;
|
||||
if (relationshipScore == 0)
|
||||
whichString = 3;
|
||||
if (relationshipScore == 20)
|
||||
whichString = 2;
|
||||
if (relationshipScore == 50)
|
||||
whichString = 1;
|
||||
if (relationshipScore == 70)
|
||||
whichString = 0;
|
||||
|
||||
StringCopy(gStringVar4, sCompatibilityMessages[whichString]);
|
||||
}
|
||||
|
||||
bool8 NameHasGenderSymbol(const u8 *name, u8 genderRatio)
|
||||
{
|
||||
u8 i;
|
||||
u8 symbolsCount[2]; // male, female
|
||||
symbolsCount[0] = symbolsCount[1] = 0;
|
||||
|
||||
for (i = 0; name[i] != EOS; i++)
|
||||
{
|
||||
if (name[i] == CHAR_MALE)
|
||||
symbolsCount[0]++;
|
||||
if (name[i] == CHAR_FEMALE)
|
||||
symbolsCount[1]++;
|
||||
}
|
||||
|
||||
if (genderRatio == MON_MALE && symbolsCount[0] != 0 && symbolsCount[1] == 0)
|
||||
return TRUE;
|
||||
if (genderRatio == MON_FEMALE && symbolsCount[1] != 0 && symbolsCount[0] == 0)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern const u8 gText_MaleSymbol4[];
|
||||
extern const u8 gText_FemaleSymbol4[];
|
||||
extern const u8 gText_GenderlessSymbol[];
|
||||
extern const u8 gText_NewLine2[];
|
||||
extern const u8 gText_Exit4[];
|
||||
extern const u8 gText_Lv[];
|
||||
|
||||
static u8 *AppendGenderSymbol(u8 *name, u8 gender)
|
||||
{
|
||||
if (gender == MON_MALE)
|
||||
{
|
||||
if (!NameHasGenderSymbol(name, MON_MALE))
|
||||
return StringAppend(name, gText_MaleSymbol4);
|
||||
}
|
||||
else if (gender == MON_FEMALE)
|
||||
{
|
||||
if (!NameHasGenderSymbol(name, MON_FEMALE))
|
||||
return StringAppend(name, gText_FemaleSymbol4);
|
||||
}
|
||||
|
||||
return StringAppend(name, gText_GenderlessSymbol);
|
||||
}
|
||||
|
||||
u8 *AppendMonGenderSymbol(u8 *name, struct BoxPokemon *boxMon)
|
||||
{
|
||||
return AppendGenderSymbol(name, GetBoxMonGender(boxMon));
|
||||
}
|
||||
|
||||
static void GetDaycareLevelMenuText(struct DayCare *daycare, u8 *dest)
|
||||
{
|
||||
u8 monNames[2][20];
|
||||
u8 i;
|
||||
|
||||
*dest = EOS;
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
GetBoxMonNick(&daycare->mons[i].mon, monNames[i]);
|
||||
AppendMonGenderSymbol(monNames[i], &daycare->mons[i].mon);
|
||||
}
|
||||
|
||||
StringCopy(dest, monNames[0]);
|
||||
StringAppend(dest, gText_NewLine2);
|
||||
StringAppend(dest, monNames[1]);
|
||||
StringAppend(dest, gText_NewLine2);
|
||||
StringAppend(dest, gText_Exit4);
|
||||
}
|
||||
|
||||
static void GetDaycareLevelMenuLevelText(struct DayCare *daycare, u8 *dest)
|
||||
{
|
||||
u8 i;
|
||||
u8 level;
|
||||
u8 text[20];
|
||||
|
||||
*dest = EOS;
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
StringAppend(dest, gText_Lv);
|
||||
level = GetLevelAfterDaycareSteps(&daycare->mons[i].mon, daycare->mons[i].steps);
|
||||
ConvertIntToDecimalStringN(text, level, STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
StringAppend(dest, text);
|
||||
StringAppend(dest, gText_NewLine2);
|
||||
}
|
||||
}
|
||||
|
||||
void DaycareAddTextPrinter(u8 windowId, const u8 *text, u32 x, u32 y)
|
||||
{
|
||||
struct TextSubPrinter printer;
|
||||
|
||||
printer.current_text_offset = text;
|
||||
printer.windowId = windowId;
|
||||
printer.fontId = 1;
|
||||
printer.x = x;
|
||||
printer.y = y;
|
||||
printer.currentX = x;
|
||||
printer.currentY = y;
|
||||
printer.fontColor_l = 0;
|
||||
gTextFlags.flag_1 = 0;
|
||||
printer.letterSpacing = 0;
|
||||
printer.lineSpacing = 1;
|
||||
printer.fontColor_h = 2;
|
||||
printer.bgColor = 1;
|
||||
printer.shadowColor = 3;
|
||||
|
||||
AddTextPrinter(&printer, 0xFF, NULL);
|
||||
}
|
||||
|
||||
void DaycarePrintMonNick(struct DayCare *daycare, u8 windowId, u32 daycareSlotId, u32 y)
|
||||
{
|
||||
u8 nick[POKEMON_NAME_LENGTH * 2];
|
||||
|
||||
GetBoxMonNick(&daycare->mons[daycareSlotId].mon, nick);
|
||||
AppendMonGenderSymbol(nick, &daycare->mons[daycareSlotId].mon);
|
||||
DaycareAddTextPrinter(windowId, nick, 8, y);
|
||||
}
|
||||
|
||||
void DaycarePrintMonLvl(struct DayCare *daycare, u8 windowId, u32 daycareSlotId, u32 y)
|
||||
{
|
||||
u8 level;
|
||||
u32 x;
|
||||
u8 lvlText[12];
|
||||
u8 intText[8];
|
||||
|
||||
StringCopy(lvlText, gText_Lv);
|
||||
level = GetLevelAfterDaycareSteps(&daycare->mons[daycareSlotId].mon, daycare->mons[daycareSlotId].steps);
|
||||
ConvertIntToDecimalStringN(intText, level, STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
StringAppend(lvlText, intText);
|
||||
x = GetStringRightAlignXOffset(1, lvlText, 112);
|
||||
DaycareAddTextPrinter(windowId, lvlText, x, y);
|
||||
}
|
||||
|
||||
void DaycarePrintMonInfo(u8 windowId, u32 daycareSlotId, u8 y)
|
||||
{
|
||||
if (daycareSlotId < DAYCARE_MON_COUNT)
|
||||
{
|
||||
DaycarePrintMonNick(&gSaveBlock1Ptr->daycare, windowId, daycareSlotId, y);
|
||||
DaycarePrintMonLvl(&gSaveBlock1Ptr->daycare, windowId, daycareSlotId, y);
|
||||
}
|
||||
}
|
||||
|
||||
#define tMenuListTaskId data[0]
|
||||
#define tWindowId data[1]
|
||||
|
||||
void Task_HandleDaycareLevelMenuInput(u8 taskId)
|
||||
{
|
||||
u32 var = ListMenuHandleInput(gTasks[taskId].tMenuListTaskId);
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
switch (var)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
gSpecialVar_Result = var;
|
||||
break;
|
||||
case 5:
|
||||
gSpecialVar_Result = 2;
|
||||
break;
|
||||
}
|
||||
sub_81AE6C8(gTasks[taskId].tMenuListTaskId, NULL, NULL);
|
||||
sub_819746C(gTasks[taskId].tWindowId, TRUE);
|
||||
RemoveWindow(gTasks[taskId].tWindowId);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
}
|
||||
else if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
gSpecialVar_Result = 2;
|
||||
sub_81AE6C8(gTasks[taskId].tMenuListTaskId, NULL, NULL);
|
||||
sub_819746C(gTasks[taskId].tWindowId, TRUE);
|
||||
RemoveWindow(gTasks[taskId].tWindowId);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
}
|
||||
}
|
||||
|
||||
void ShowDaycareLevelMenu(void)
|
||||
{
|
||||
struct ListMenuTemplate menuTemplate;
|
||||
u8 windowId;
|
||||
u8 listMenuTaskId;
|
||||
u8 daycareMenuTaskId;
|
||||
|
||||
windowId = AddWindow(&sDaycareLevelMenuWindowTemplate);
|
||||
sub_81973FC(windowId, FALSE);
|
||||
|
||||
menuTemplate = sDaycareListMenuLevelTemplate;
|
||||
menuTemplate.unk_10 = windowId;
|
||||
listMenuTaskId = ListMenuInit(&menuTemplate, 0, 0);
|
||||
|
||||
CopyWindowToVram(windowId, 3);
|
||||
|
||||
daycareMenuTaskId = CreateTask(Task_HandleDaycareLevelMenuInput, 3);
|
||||
gTasks[daycareMenuTaskId].tMenuListTaskId = listMenuTaskId;
|
||||
gTasks[daycareMenuTaskId].tWindowId = windowId;
|
||||
}
|
||||
|
||||
#undef tMenuListTaskId
|
||||
#undef tWindowId
|
||||
|
||||
void ChooseSendDaycareMon(void)
|
||||
{
|
||||
sub_81B9328();
|
||||
gMain.savedCallback = c2_exit_to_overworld_2_switch;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user