mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 11:14:15 +01:00
start working on daycare
This commit is contained in:
parent
72b57b342e
commit
a972de7bca
1256
asm/daycare.s
1256
asm/daycare.s
File diff suppressed because it is too large
Load Diff
@ -1988,7 +1988,7 @@ task00_8084310: @ 80B6A24
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080B6A8A
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
ldr r1, =gFieldEffectArguments
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
|
@ -642,7 +642,7 @@ _080FA0C4:
|
||||
thumb_func_start sub_80FA0DC
|
||||
sub_80FA0DC: @ 80FA0DC
|
||||
push {lr}
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
ldr r1, =gFieldEffectArguments
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
@ -777,7 +777,7 @@ sub_80FA1D8: @ 80FA1D8
|
||||
thumb_func_start sub_80FA1E8
|
||||
sub_80FA1E8: @ 80FA1E8
|
||||
push {lr}
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
ldr r1, =gFieldEffectArguments
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
@ -950,7 +950,7 @@ sub_80FA33C: @ 80FA33C
|
||||
thumb_func_start sub_80FA34C
|
||||
sub_80FA34C: @ 80FA34C
|
||||
push {lr}
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
ldr r1, =gFieldEffectArguments
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
|
@ -32,7 +32,7 @@ _080D3754:
|
||||
ldr r0, =gUnknown_0203AB40
|
||||
adds r1, r0, 0x2
|
||||
bl PlayerGetDestCoords
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
movs r1, 0x64
|
||||
@ -384,7 +384,7 @@ hm2_ruin_valley: @ 80D3A50
|
||||
push {lr}
|
||||
movs r0, 0x1
|
||||
bl FieldEffectStart
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
ldr r1, =gFieldEffectArguments
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
@ -420,7 +420,7 @@ sub_80D3A6C: @ 80D3A6C
|
||||
thumb_func_start sub_80D3A9C
|
||||
sub_80D3A9C: @ 80D3A9C
|
||||
push {lr}
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
ldr r1, =gFieldEffectArguments
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
|
@ -8,7 +8,7 @@
|
||||
thumb_func_start hm_prepare_dive_probably
|
||||
hm_prepare_dive_probably: @ 8161508
|
||||
push {r4-r6,lr}
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
movs r6, 0x64
|
||||
@ -20,7 +20,7 @@ hm_prepare_dive_probably: @ 8161508
|
||||
adds r5, r0, 0
|
||||
lsls r5, 16
|
||||
lsrs r5, 16
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
muls r0, r6
|
||||
@ -59,7 +59,7 @@ sub_8161560: @ 8161560
|
||||
strb r1, [r0, 0xB]
|
||||
ldrb r1, [r0, 0x9]
|
||||
strb r1, [r0, 0xA]
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
movs r1, 0x1
|
||||
|
@ -18,7 +18,7 @@ hm_prepare_rocksmash: @ 8145DC4
|
||||
b _08145DF2
|
||||
_08145DD8:
|
||||
ldr r4, =gScriptResult
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
strh r0, [r4]
|
||||
@ -39,7 +39,7 @@ _08145DF2:
|
||||
thumb_func_start sub_8145E0C
|
||||
sub_8145E0C: @ 8145E0C
|
||||
push {lr}
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
ldr r1, =gFieldEffectArguments
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
|
@ -23,7 +23,7 @@ hm2_sweet_scent: @ 8159F10
|
||||
push {lr}
|
||||
movs r0, 0x33
|
||||
bl FieldEffectStart
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
ldr r1, =gFieldEffectArguments
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
|
@ -38,7 +38,7 @@ hm_teleport_run_dp02scr: @ 817C8FC
|
||||
bl sub_808469C
|
||||
movs r0, 0x3F
|
||||
bl FieldEffectStart
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
ldr r1, =gFieldEffectArguments
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
|
10
asm/link.s
10
asm/link.s
@ -21515,7 +21515,7 @@ _08014714:
|
||||
movs r1, 0x5
|
||||
movs r2, 0x1
|
||||
bl sub_8014290
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
ldr r1, =c2_load_new_map
|
||||
@ -21536,7 +21536,7 @@ _0801474C:
|
||||
movs r1, 0x5
|
||||
movs r2, 0x1
|
||||
bl sub_8014290
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
ldr r1, =c2_load_new_map
|
||||
@ -23406,7 +23406,7 @@ _080158E0:
|
||||
ldrh r0, [r4]
|
||||
cmp r0, 0
|
||||
beq _080159A0
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
ldrh r0, [r4]
|
||||
@ -23434,7 +23434,7 @@ _08015900:
|
||||
b _0801598E
|
||||
.pool
|
||||
_0801592C:
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
adds r1, r4, 0
|
||||
@ -23468,7 +23468,7 @@ _0801596C:
|
||||
ldr r1, =gUnknown_02022C2C
|
||||
movs r0, 0x44
|
||||
strb r0, [r1]
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
adds r1, r4, 0
|
||||
|
@ -18,7 +18,7 @@ _080D4372:
|
||||
adds r1, r0
|
||||
ldr r0, [r5]
|
||||
adds r0, r1
|
||||
bl sub_80D439C
|
||||
bl ClearMailStruct
|
||||
adds r0, r4, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
@ -30,8 +30,8 @@ _080D4372:
|
||||
.pool
|
||||
thumb_func_end ClearMailData
|
||||
|
||||
thumb_func_start sub_80D439C
|
||||
sub_80D439C: @ 80D439C
|
||||
thumb_func_start ClearMailStruct
|
||||
ClearMailStruct: @ 80D439C
|
||||
push {r4-r6,lr}
|
||||
adds r3, r0, 0
|
||||
ldr r0, =0x0000ffff
|
||||
@ -76,10 +76,10 @@ _080D43D6:
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80D439C
|
||||
thumb_func_end ClearMailStruct
|
||||
|
||||
thumb_func_start sub_80D43F0
|
||||
sub_80D43F0: @ 80D43F0
|
||||
thumb_func_start MonHasMail
|
||||
MonHasMail: @ 80D43F0
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
movs r1, 0xC
|
||||
@ -103,7 +103,7 @@ _080D441A:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_80D43F0
|
||||
thumb_func_end MonHasMail
|
||||
|
||||
thumb_func_start sub_80D4420
|
||||
sub_80D4420: @ 80D4420
|
||||
@ -349,8 +349,8 @@ _080D4606:
|
||||
bx r1
|
||||
thumb_func_end sub_80D45E8
|
||||
|
||||
thumb_func_start sub_80D460C
|
||||
sub_80D460C: @ 80D460C
|
||||
thumb_func_start GiveMailToMon2
|
||||
GiveMailToMon2: @ 80D460C
|
||||
push {r4-r7,lr}
|
||||
sub sp, 0x8
|
||||
adds r6, r0, 0
|
||||
@ -401,7 +401,7 @@ _080D4672:
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_80D460C
|
||||
thumb_func_end GiveMailToMon2
|
||||
|
||||
thumb_func_start sub_80D467C
|
||||
sub_80D467C: @ 80D467C
|
||||
@ -409,12 +409,12 @@ sub_80D467C: @ 80D467C
|
||||
bx lr
|
||||
thumb_func_end sub_80D467C
|
||||
|
||||
thumb_func_start sub_80D4680
|
||||
sub_80D4680: @ 80D4680
|
||||
thumb_func_start TakeMailFromMon
|
||||
TakeMailFromMon: @ 80D4680
|
||||
push {r4,lr}
|
||||
sub sp, 0x8
|
||||
adds r4, r0, 0
|
||||
bl sub_80D43F0
|
||||
bl MonHasMail
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080D46D2
|
||||
@ -454,7 +454,7 @@ _080D46D2:
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80D4680
|
||||
thumb_func_end TakeMailFromMon
|
||||
|
||||
thumb_func_start sub_80D46E0
|
||||
sub_80D46E0: @ 80D46E0
|
||||
|
@ -727,9 +727,9 @@ _08153D86:
|
||||
beq _08153DA4
|
||||
adds r0, r7, 0
|
||||
mov r1, sp
|
||||
bl sub_80D460C
|
||||
bl GiveMailToMon2
|
||||
_08153DA4:
|
||||
bl party_compaction
|
||||
bl CompactPartySlots
|
||||
bl CalculatePlayerPartyCount
|
||||
ldr r0, =gStringVar4
|
||||
ldr r1, =gUnknown_08674BF0
|
||||
|
@ -2111,13 +2111,13 @@ _081B134C:
|
||||
bx r0
|
||||
thumb_func_end c3_0811FAB4
|
||||
|
||||
thumb_func_start brm_get_pokemon_selection
|
||||
brm_get_pokemon_selection: @ 81B1354
|
||||
thumb_func_start GetCursorSelectionMonId
|
||||
GetCursorSelectionMonId: @ 81B1354
|
||||
ldr r0, =gUnknown_0203CEC8
|
||||
ldrb r0, [r0, 0x9]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end brm_get_pokemon_selection
|
||||
thumb_func_end GetCursorSelectionMonId
|
||||
|
||||
thumb_func_start sub_81B1360
|
||||
sub_81B1360: @ 81B1360
|
||||
@ -8140,7 +8140,7 @@ sub_81B4578: @ 81B4578
|
||||
cmp r7, 0
|
||||
bne _081B45F8
|
||||
adds r0, r5, 0
|
||||
bl sub_80D4680
|
||||
bl TakeMailFromMon
|
||||
ldr r4, =gUnknown_0203CEFC
|
||||
adds r0, r5, 0
|
||||
movs r1, 0xC
|
||||
@ -8925,7 +8925,7 @@ _081B4CBE:
|
||||
ldrsb r0, [r1, r0]
|
||||
muls r0, r7
|
||||
adds r0, r6
|
||||
bl sub_80D4680
|
||||
bl TakeMailFromMon
|
||||
ldr r0, =gText_MailTakenFromPkmn
|
||||
movs r1, 0
|
||||
bl sub_81B1B5C
|
||||
@ -10134,7 +10134,7 @@ _081B57FE:
|
||||
thumb_func_start hm_surf_run_dp02scr
|
||||
hm_surf_run_dp02scr: @ 81B5804
|
||||
push {lr}
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
ldr r1, =gFieldEffectArguments
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
@ -10238,7 +10238,7 @@ sub_81B58A8: @ 81B58A8
|
||||
thumb_func_start hm2_waterfall
|
||||
hm2_waterfall: @ 81B58D4
|
||||
push {lr}
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
ldr r1, =gFieldEffectArguments
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
@ -10298,7 +10298,7 @@ _081B594E:
|
||||
thumb_func_start sub_81B5958
|
||||
sub_81B5958: @ 81B5958
|
||||
push {lr}
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
ldr r1, =gFieldEffectArguments
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
@ -14938,7 +14938,7 @@ sub_81B81A8: @ 81B81A8
|
||||
cmp r0, 0
|
||||
bne _081B8208
|
||||
adds r0, r5, 0
|
||||
bl sub_80D4680
|
||||
bl TakeMailFromMon
|
||||
ldr r4, =gUnknown_0203CEFC
|
||||
adds r0, r5, 0
|
||||
movs r1, 0xC
|
||||
@ -15281,9 +15281,9 @@ sub_81B8474: @ 81B8474
|
||||
_081B84DC:
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
bl sub_80D460C
|
||||
bl GiveMailToMon2
|
||||
adds r0, r4, 0
|
||||
bl sub_80D439C
|
||||
bl ClearMailStruct
|
||||
ldr r0, =gText_MailTransferredFromMailbox
|
||||
movs r1, 0x1
|
||||
bl sub_81B1B5C
|
||||
@ -15994,7 +15994,7 @@ sub_81B8A7C: @ 81B8A7C
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
bl sub_81B1250
|
||||
@ -17113,7 +17113,7 @@ sub_81B9354: @ 81B9354
|
||||
sub_81B9390: @ 81B9390
|
||||
push {r4,lr}
|
||||
ldr r4, =gSpecialVar_0x8004
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
strh r0, [r4]
|
||||
@ -17218,7 +17218,7 @@ _081B945C:
|
||||
thumb_func_start sub_81B9470
|
||||
sub_81B9470: @ 81B9470
|
||||
push {lr}
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
ldr r2, =gUnknown_02039F24
|
||||
strb r0, [r2]
|
||||
lsls r0, 24
|
||||
@ -17345,7 +17345,7 @@ _081B9574:
|
||||
sub_81B9588: @ 81B9588
|
||||
push {r4,r5,lr}
|
||||
ldr r5, =gSpecialVar_0x8004
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
strh r0, [r5]
|
||||
|
@ -1444,7 +1444,7 @@ _0816BA68:
|
||||
adds r0, r6, 0
|
||||
bl DisplayItemMessageOnField
|
||||
adds r0, r5, 0
|
||||
bl sub_80D439C
|
||||
bl ClearMailStruct
|
||||
bl sub_816B54C
|
||||
ldrb r0, [r4, 0x5]
|
||||
subs r0, 0x1
|
||||
|
@ -1310,8 +1310,8 @@ _08068FF4:
|
||||
bx r0
|
||||
thumb_func_end CalculateMonStats
|
||||
|
||||
thumb_func_start sub_8069004
|
||||
sub_8069004: @ 8069004
|
||||
thumb_func_start BoxMonToMon
|
||||
BoxMonToMon: @ 8069004
|
||||
push {r4,lr}
|
||||
sub sp, 0x4
|
||||
adds r2, r0, 0
|
||||
@ -1346,7 +1346,7 @@ sub_8069004: @ 8069004
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_8069004
|
||||
thumb_func_end BoxMonToMon
|
||||
|
||||
thumb_func_start GetLevelFromMonExp
|
||||
GetLevelFromMonExp: @ 8069054
|
||||
|
@ -3539,7 +3539,7 @@ _080C8E38:
|
||||
b _080C8EA0
|
||||
.pool
|
||||
_080C8E4C:
|
||||
bl party_compaction
|
||||
bl CompactPartySlots
|
||||
bl sub_80CB950
|
||||
ldr r0, =gUnknown_02039D08
|
||||
ldr r1, [r0]
|
||||
@ -3699,7 +3699,7 @@ _080C8FA4:
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _080C8FD0
|
||||
bl party_compaction
|
||||
bl CompactPartySlots
|
||||
bl sub_80CB950
|
||||
b _080C905C
|
||||
.pool
|
||||
@ -4453,7 +4453,7 @@ sub_80C9670: @ 80C9670
|
||||
b _080C96AE
|
||||
.pool
|
||||
_080C9688:
|
||||
bl party_compaction
|
||||
bl CompactPartySlots
|
||||
bl sub_80CB950
|
||||
ldr r1, [r4]
|
||||
ldrb r0, [r1]
|
||||
@ -6567,7 +6567,7 @@ _080CA94C:
|
||||
movs r1, 0
|
||||
strb r1, [r0]
|
||||
bl sub_80CBB9C
|
||||
bl party_compaction
|
||||
bl CompactPartySlots
|
||||
movs r0, 0x2
|
||||
str r0, [sp]
|
||||
movs r1, 0
|
||||
@ -14193,8 +14193,8 @@ _080CE900:
|
||||
.pool
|
||||
thumb_func_end sub_80CE8E4
|
||||
|
||||
thumb_func_start party_compaction
|
||||
party_compaction: @ 80CE90C
|
||||
thumb_func_start CompactPartySlots
|
||||
CompactPartySlots: @ 80CE90C
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
@ -14271,7 +14271,7 @@ _080CE992:
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end party_compaction
|
||||
thumb_func_end CompactPartySlots
|
||||
|
||||
thumb_func_start sub_80CE9A8
|
||||
sub_80CE9A8: @ 80CE9A8
|
||||
@ -21042,7 +21042,7 @@ sub_80D2054: @ 80D2054
|
||||
lsls r1, 4
|
||||
adds r0, r1
|
||||
adds r1, r5, 0
|
||||
bl sub_8069004
|
||||
bl BoxMonToMon
|
||||
_080D2088:
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
|
@ -3607,7 +3607,7 @@ sub_80E89F8: @ 80E89F8
|
||||
ldr r1, =0x00003030
|
||||
adds r0, r1
|
||||
adds r1, r5, 0
|
||||
bl sub_806FA9C
|
||||
bl InitDaycareMailRecordMixing
|
||||
ldr r0, =gUnknown_03001148
|
||||
ldr r1, [r0]
|
||||
adds r0, r6, 0
|
||||
|
10
asm/rom6.s
10
asm/rom6.s
@ -263,7 +263,7 @@ sub_8135654: @ 8135654
|
||||
cmp r0, 0
|
||||
beq _0813568C
|
||||
ldr r4, =gScriptResult
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
strh r0, [r4]
|
||||
@ -302,7 +302,7 @@ _081356AC:
|
||||
thumb_func_start sub_81356C4
|
||||
sub_81356C4: @ 81356C4
|
||||
push {lr}
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
ldr r1, =gFieldEffectArguments
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
@ -379,7 +379,7 @@ hm2_dig: @ 8135760
|
||||
bl flagmods_08054D70
|
||||
movs r0, 0x26
|
||||
bl FieldEffectStart
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
ldr r1, =gFieldEffectArguments
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
@ -3334,7 +3334,7 @@ sub_81370FC: @ 81370FC
|
||||
cmp r0, 0
|
||||
beq _08137134
|
||||
ldr r4, =gScriptResult
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
strh r0, [r4]
|
||||
@ -3380,7 +3380,7 @@ hm2_flash: @ 8137178
|
||||
adds r4, r0, 0
|
||||
lsls r4, 24
|
||||
lsrs r4, 24
|
||||
bl brm_get_pokemon_selection
|
||||
bl GetCursorSelectionMonId
|
||||
ldr r1, =gFieldEffectArguments
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
|
@ -7948,7 +7948,7 @@ sub_807B4D0: @ 807B4D0
|
||||
adds r1, r2
|
||||
ldr r0, [r0]
|
||||
adds r0, r1
|
||||
bl sub_80D439C
|
||||
bl ClearMailStruct
|
||||
_0807B52A:
|
||||
ldr r4, =gUnknown_020322A0
|
||||
ldr r0, [r4]
|
||||
@ -7985,7 +7985,7 @@ _0807B566:
|
||||
ldr r0, =gUnknown_020321C0
|
||||
adds r1, r0
|
||||
adds r0, r7, 0
|
||||
bl sub_80D460C
|
||||
bl GiveMailToMon2
|
||||
_0807B57C:
|
||||
mov r0, r9
|
||||
bl sub_807B464
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
|
||||
|
||||
@ 832ADD8
|
||||
.include "data/egg_moves.inc"
|
||||
|
||||
.align 2
|
||||
gUnknown_0832B6C0:: @ 832B6C0
|
||||
|
1306
data/egg_moves.inc
1306
data/egg_moves.inc
File diff suppressed because it is too large
Load Diff
@ -197,12 +197,12 @@ gSpecials:: @ 81DBA64
|
||||
def_special sp0B8_daycare
|
||||
def_special sp0B9_daycare_relationship_comment
|
||||
def_special sub_8070C58
|
||||
def_special daycare_send_selected_pokemon
|
||||
def_special StoreSelectedPokemonInDaycare
|
||||
def_special sub_8071330
|
||||
def_special sub_80712C0
|
||||
def_special sub_806FF30
|
||||
def_special sub_806FED8
|
||||
def_special sub_806FDC4
|
||||
def_special GetNumLevelsGainedFromDaycare
|
||||
def_special GetDaycareCost
|
||||
def_special TakePokemonFromDaycare
|
||||
def_special ScriptHatchMon
|
||||
def_special EggHatch
|
||||
def_special sub_8071614
|
||||
|
1315
include/data/pokemon/egg_moves.h
Normal file
1315
include/data/pokemon/egg_moves.h
Normal file
File diff suppressed because it is too large
Load Diff
6
include/daycare.h
Normal file
6
include/daycare.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef GUARD_DAYCARE
|
||||
#define GUARD_DAYCARE
|
||||
|
||||
|
||||
|
||||
#endif // GUARD_DAYCARE
|
@ -1,6 +1,8 @@
|
||||
#ifndef GUARD_FLAGS_H
|
||||
#define GUARD_FLAGS_H
|
||||
|
||||
#define FLAG_PENDING_DAYCARE_EGG 0x86
|
||||
|
||||
#define TRAINER_FLAG_START 0x500
|
||||
#define TRAINERS_FLAG_NO 0x356
|
||||
#define CODE_FLAGS (TRAINER_FLAG_START + TRAINERS_FLAG_NO + 0xA) // 0x860
|
||||
|
@ -426,30 +426,52 @@ struct ContestWinner
|
||||
u8 contestRank;
|
||||
};
|
||||
|
||||
struct DaycareMiscMon
|
||||
{
|
||||
struct MailStruct mail;
|
||||
u8 OT_name[OT_NAME_LENGTH + 1];
|
||||
u8 monName[POKEMON_NAME_LENGTH + 1];
|
||||
u8 gameLanguage:4;
|
||||
u8 monLanguage:4;
|
||||
};
|
||||
|
||||
struct DaycareMon
|
||||
{
|
||||
struct BoxPokemon mon;
|
||||
struct MailStruct mail;
|
||||
u8 OT_name[OT_NAME_LENGTH + 1];
|
||||
u8 monName[11];
|
||||
u8 language_maybe : 4;
|
||||
u8 unknown : 4;
|
||||
u32 stepsTaken;
|
||||
struct DaycareMiscMon misc;
|
||||
u32 steps;
|
||||
};
|
||||
|
||||
struct DaycareData
|
||||
#define DAYCARE_MON_COUNT 2
|
||||
|
||||
struct DayCare
|
||||
{
|
||||
struct DaycareMon mons[2];
|
||||
struct DaycareMon mons[DAYCARE_MON_COUNT];
|
||||
u32 offspringPersonality;
|
||||
u8 stepCounter;
|
||||
};
|
||||
|
||||
struct DayCareMail
|
||||
{
|
||||
/*0x00*/ struct MailStruct message;
|
||||
/*0x24*/ u8 names[19];
|
||||
};
|
||||
|
||||
struct RecordMixingDayCareMail
|
||||
{
|
||||
struct DayCareMail mail[DAYCARE_MON_COUNT];
|
||||
u32 numDaycareMons;
|
||||
bool16 holdsItem[DAYCARE_MON_COUNT];
|
||||
};
|
||||
|
||||
#define MAP_OBJECTS_COUNT 16
|
||||
#define BERRY_TREES_COUNT 128
|
||||
#define FLAGS_COUNT 300
|
||||
#define VARS_COUNT 256
|
||||
#define MAIL_COUNT 16
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
LILYCOVE_LADY_QUIZ,
|
||||
LILYCOVE_LADY_FAVOUR,
|
||||
LILYCOVE_LADY_CONTEST
|
||||
@ -579,15 +601,14 @@ struct SaveBlock1
|
||||
/*0x2BB0*/ u16 unk2BB0[6];
|
||||
/*0x2BBC*/ u16 unk2BBC[6];
|
||||
/*0x2BC8*/ u16 unk2BC8[6];
|
||||
/*0x2BD4*/ u16 unk2BD4[3];
|
||||
/*0x2BE0*/ struct MailStruct mail[16];
|
||||
/*0x2BD4*/ u16 unk2BD4[6];
|
||||
/*0x2BE0*/ struct MailStruct mail[MAIL_COUNT];
|
||||
/*0x2E20*/ u8 additionalPhrases[5]; // bitfield for 33 additional phrases in easy chat system
|
||||
/*0x2E25*/ u8 unk2E25[3]; // possibly padding?
|
||||
/*0x2E28*/ OldMan oldMan;
|
||||
/*0x2e64*/ struct EasyChatPair easyChatPairs[5]; //Dewford trend [0] and some other stuff
|
||||
/*0x2e8c*/ u8 filler_2E8C[0x4];
|
||||
/*0x2e90*/ struct ContestWinner contestWinners[13]; // 0 - 5 used in contest hall, 6 - 7 unused?, 8 - 12 museum
|
||||
/*0x3030*/ struct DaycareData daycare;
|
||||
/*0x3030*/ struct DayCare daycare;
|
||||
/*0x3150*/ struct LinkBattleRecord linkBattleRecords[5];
|
||||
/*0x31A0*/ u8 unk_31A0;
|
||||
/*0x31A1*/ u8 filler_31A1[7];
|
||||
|
@ -16,4 +16,10 @@
|
||||
|| itemId == ITEM_FAB_MAIL \
|
||||
|| itemId == ITEM_RETRO_MAIL))
|
||||
|
||||
|
||||
bool8 MonHasMail(struct Pokemon *mon);
|
||||
void TakeMailFromMon(struct Pokemon *mon);
|
||||
u8 GiveMailToMon2(struct Pokemon *mon, struct MailStruct *mail);
|
||||
void ClearMailStruct(struct MailStruct *mail);
|
||||
|
||||
#endif // GUARD_MAIL_H
|
||||
|
@ -509,9 +509,11 @@ struct Evolution
|
||||
u16 targetSpecies;
|
||||
};
|
||||
|
||||
#define EVOS_PER_MON 5
|
||||
|
||||
struct EvolutionData
|
||||
{
|
||||
struct Evolution evolutions[5];
|
||||
struct Evolution evolutions[EVOS_PER_MON];
|
||||
};
|
||||
|
||||
extern u8 gPlayerPartyCount;
|
||||
@ -648,6 +650,8 @@ u16 PlayerGenderToFrontTrainerPicId(u8 playerGender);
|
||||
void sub_806A1C0(u16 arg0, u8 bankIdentity);
|
||||
void sub_806A12C(u16 trainerSpriteId, u8 bankIdentity);
|
||||
u8 GetSecretBaseTrainerPicIndex(void);
|
||||
bool8 TryIncrementMonLevel(struct Pokemon *mon);
|
||||
void BoxMonToMon(struct BoxPokemon *srcMon, struct Pokemon *dstMon);
|
||||
|
||||
#include "sprite.h"
|
||||
|
||||
|
@ -4,5 +4,6 @@
|
||||
u8* GetBoxNamePtr(u8 boxNumber);
|
||||
struct BoxPokemon *GetBoxedMonPtr(u8, u8);
|
||||
void SetBoxMonNickFromAnyBox(u8, u8, u8 *);
|
||||
void CompactPartySlots(void);
|
||||
|
||||
#endif // GUARD_POKEMON_STORAGE_SYSTEM_H
|
||||
|
@ -77,6 +77,7 @@ SECTIONS {
|
||||
src/rng.o(.text);
|
||||
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);
|
||||
@ -343,6 +344,7 @@ SECTIONS {
|
||||
data/data2c.o(.rodata);
|
||||
src/trig.o(.rodata);
|
||||
src/util.o(.rodata);
|
||||
src/daycare.o(.rodata);
|
||||
data/daycare.o(.rodata);
|
||||
src/egg_hatch.o(.rodata);
|
||||
src/battle_gfx_sfx_util.o(.rodata);
|
||||
|
@ -13,7 +13,7 @@ extern void DrawWholeMapView(); // field_camera
|
||||
extern void SetCameraPanningCallback(void ( *callback)()); // field_camera
|
||||
extern void InstallCameraPanAheadCallback(void);
|
||||
extern void SetCameraPanning(s16 x, s16 y);
|
||||
extern u8 brm_get_pokemon_selection(void);
|
||||
extern u8 GetCursorSelectionMonId(void);
|
||||
extern void FieldEffectActiveListRemove(u8 id); // field_effect
|
||||
extern u8 oei_task_add(void);
|
||||
|
||||
@ -220,7 +220,7 @@ bool8 ShouldDoBrailleStrengthEffect(void)
|
||||
|
||||
void sub_8179834(void)
|
||||
{
|
||||
gFieldEffectArguments[0] = brm_get_pokemon_selection();
|
||||
gFieldEffectArguments[0] = GetCursorSelectionMonId();
|
||||
FieldEffectStart(FLDEFF_USE_FLY_ANCIENT_TOMB);
|
||||
}
|
||||
|
||||
@ -256,7 +256,7 @@ bool8 ShouldDoBrailleFlyEffect(void)
|
||||
|
||||
void sub_8179918(void)
|
||||
{
|
||||
gFieldEffectArguments[0] = brm_get_pokemon_selection();
|
||||
gFieldEffectArguments[0] = GetCursorSelectionMonId();
|
||||
FieldEffectStart(FLDEFF_USE_FLY_ANCIENT_TOMB);
|
||||
}
|
||||
|
||||
|
524
src/daycare.c
Normal file
524
src/daycare.c
Normal file
@ -0,0 +1,524 @@
|
||||
#include "global.h"
|
||||
#include "pokemon.h"
|
||||
#include "daycare.h"
|
||||
#include "string_util.h"
|
||||
#include "species.h"
|
||||
#include "items.h"
|
||||
#include "mail.h"
|
||||
#include "pokemon_storage_system.h"
|
||||
#include "event_data.h"
|
||||
#include "rng.h"
|
||||
#include "main.h"
|
||||
#include "moves.h"
|
||||
|
||||
#define EGG_MOVES_ARRAY_COUNT 10
|
||||
|
||||
extern u16 gMoveToLearn;
|
||||
|
||||
extern u8 GetCursorSelectionMonId(void);
|
||||
|
||||
// this file's functions
|
||||
static void ClearDaycareMonMisc(struct DaycareMiscMon *misc);
|
||||
|
||||
#include "data/pokemon/egg_moves.h"
|
||||
|
||||
u8 *GetMonNick(struct Pokemon *mon, u8 *dest)
|
||||
{
|
||||
u8 nickname[POKEMON_NAME_LENGTH * 2];
|
||||
|
||||
GetMonData(mon, MON_DATA_NICKNAME, nickname);
|
||||
return StringCopy10(dest, nickname);
|
||||
}
|
||||
|
||||
u8 *GetBoxMonNick(struct BoxPokemon *mon, u8 *dest)
|
||||
{
|
||||
u8 nickname[POKEMON_NAME_LENGTH * 2];
|
||||
|
||||
GetBoxMonData(mon, MON_DATA_NICKNAME, nickname);
|
||||
return StringCopy10(dest, nickname);
|
||||
}
|
||||
|
||||
u8 CountPokemonInDaycare(struct DayCare *daycare)
|
||||
{
|
||||
u8 i, count;
|
||||
count = 0;
|
||||
|
||||
for (i = 0; i < DAYCARE_MON_COUNT; i++)
|
||||
{
|
||||
if (GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SPECIES) != 0)
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
void InitDaycareMailRecordMixing(struct DayCare *daycare, struct RecordMixingDayCareMail *daycareMail)
|
||||
{
|
||||
u8 i;
|
||||
u8 numDaycareMons = 0;
|
||||
|
||||
for (i = 0; i < DAYCARE_MON_COUNT; i++)
|
||||
{
|
||||
if (GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SPECIES) != SPECIES_NONE)
|
||||
{
|
||||
numDaycareMons++;
|
||||
if (GetBoxMonData(&daycare->mons[i].mon, MON_DATA_HELD_ITEM) == ITEM_NONE)
|
||||
{
|
||||
daycareMail->holdsItem[i] = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
daycareMail->holdsItem[i] = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
daycareMail->holdsItem[i] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
daycareMail->numDaycareMons = numDaycareMons;
|
||||
}
|
||||
|
||||
static s8 Daycare_FindEmptySpot(struct DayCare *daycare)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < DAYCARE_MON_COUNT; i++)
|
||||
{
|
||||
if (GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SPECIES) == 0)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void StorePokemonInDaycare(struct Pokemon *mon, struct DaycareMon *daycareMon)
|
||||
{
|
||||
if (MonHasMail(mon))
|
||||
{
|
||||
u8 mailId;
|
||||
|
||||
StringCopy(daycareMon->misc.OT_name, gSaveBlock2Ptr->playerName);
|
||||
GetMonNick(mon, daycareMon->misc.monName);
|
||||
StripExtCtrlCodes(daycareMon->misc.monName);
|
||||
daycareMon->misc.gameLanguage = LANGUAGE_ENGLISH;
|
||||
daycareMon->misc.monLanguage = GetMonData(mon, MON_DATA_LANGUAGE);
|
||||
mailId = GetMonData(mon, MON_DATA_MAIL);
|
||||
daycareMon->misc.mail = gSaveBlock1Ptr->mail[mailId];
|
||||
TakeMailFromMon(mon);
|
||||
}
|
||||
|
||||
daycareMon->mon = mon->box;
|
||||
BoxMonRestorePP(&daycareMon->mon);
|
||||
daycareMon->steps = 0;
|
||||
ZeroMonData(mon);
|
||||
CompactPartySlots();
|
||||
CalculatePlayerPartyCount();
|
||||
}
|
||||
|
||||
static void StorePokemonInEmptyDaycareSlot(struct Pokemon *mon, struct DayCare *daycare)
|
||||
{
|
||||
s8 slotId = Daycare_FindEmptySpot(daycare);
|
||||
StorePokemonInDaycare(mon, &daycare->mons[slotId]);
|
||||
}
|
||||
|
||||
void StoreSelectedPokemonInDaycare(void)
|
||||
{
|
||||
u8 monId = GetCursorSelectionMonId();
|
||||
StorePokemonInEmptyDaycareSlot(&gPlayerParty[monId], &gSaveBlock1Ptr->daycare);
|
||||
}
|
||||
|
||||
// Shifts the second daycare pokemon slot into the first slot.
|
||||
static void ShiftDaycareSlots(struct DayCare *daycare)
|
||||
{
|
||||
// This condition is only satisfied when the player takes out the first pokemon from the daycare.
|
||||
if (GetBoxMonData(&daycare->mons[1].mon, MON_DATA_SPECIES) != 0
|
||||
&& GetBoxMonData(&daycare->mons[0].mon, MON_DATA_SPECIES) == 0)
|
||||
{
|
||||
daycare->mons[0].mon = daycare->mons[1].mon;
|
||||
ZeroBoxMonData(&daycare->mons[1].mon);
|
||||
|
||||
daycare->mons[0].misc = daycare->mons[1].misc;
|
||||
daycare->mons[0].steps = daycare->mons[1].steps;
|
||||
daycare->mons[1].steps = 0;
|
||||
ClearDaycareMonMisc(&daycare->mons[1].misc);
|
||||
}
|
||||
}
|
||||
|
||||
static void ApplyDaycareExperience(struct Pokemon *mon)
|
||||
{
|
||||
s32 i;
|
||||
bool8 firstMove;
|
||||
u16 learnedMove;
|
||||
|
||||
for (i = 0; i < MAX_MON_LEVEL; i++)
|
||||
{
|
||||
// Add the mon's gained daycare experience level by level until it can't level up anymore.
|
||||
if (TryIncrementMonLevel(mon))
|
||||
{
|
||||
// Teach the mon new moves it learned while in the daycare.
|
||||
firstMove = TRUE;
|
||||
while ((learnedMove = MonTryLearningNewMove(mon, firstMove)) != 0)
|
||||
{
|
||||
firstMove = FALSE;
|
||||
if (learnedMove == 0xFFFF)
|
||||
{
|
||||
// Mon already knows 4 moves.
|
||||
DeleteFirstMoveAndGiveMoveToMon(mon, gMoveToLearn);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Re-calculate the mons stats at its new level.
|
||||
CalculateMonStats(mon);
|
||||
}
|
||||
|
||||
static u16 TakeSelectedPokemonFromDaycare(struct DaycareMon *daycareMon)
|
||||
{
|
||||
u16 species;
|
||||
u32 experience;
|
||||
struct Pokemon pokemon;
|
||||
|
||||
GetBoxMonNick(&daycareMon->mon, gStringVar1);
|
||||
species = GetBoxMonData(&daycareMon->mon, MON_DATA_SPECIES);
|
||||
BoxMonToMon(&daycareMon->mon, &pokemon);
|
||||
|
||||
if (GetMonData(&pokemon, MON_DATA_LEVEL) != MAX_MON_LEVEL)
|
||||
{
|
||||
experience = GetMonData(&pokemon, MON_DATA_EXP) + daycareMon->steps;
|
||||
SetMonData(&pokemon, MON_DATA_EXP, &experience);
|
||||
ApplyDaycareExperience(&pokemon);
|
||||
}
|
||||
|
||||
gPlayerParty[PARTY_SIZE - 1] = pokemon;
|
||||
if (daycareMon->misc.mail.itemId)
|
||||
{
|
||||
GiveMailToMon2(&gPlayerParty[PARTY_SIZE - 1], &daycareMon->misc.mail);
|
||||
ClearDaycareMonMisc(&daycareMon->misc);
|
||||
}
|
||||
|
||||
ZeroBoxMonData(&daycareMon->mon);
|
||||
daycareMon->steps = 0;
|
||||
CompactPartySlots();
|
||||
CalculatePlayerPartyCount();
|
||||
return species;
|
||||
}
|
||||
|
||||
static u16 TakeSelectedPokemonMonFromDaycareShiftSlots(struct DayCare *daycare, u8 slotId)
|
||||
{
|
||||
u16 species = TakeSelectedPokemonFromDaycare(&daycare->mons[slotId]);
|
||||
ShiftDaycareSlots(daycare);
|
||||
return species;
|
||||
}
|
||||
|
||||
u16 TakePokemonFromDaycare(void)
|
||||
{
|
||||
return TakeSelectedPokemonMonFromDaycareShiftSlots(&gSaveBlock1Ptr->daycare, gSpecialVar_0x8004);
|
||||
}
|
||||
|
||||
u8 GetLevelAfterDaycareSteps(struct BoxPokemon *mon, u32 steps)
|
||||
{
|
||||
struct BoxPokemon tempMon = *mon;
|
||||
|
||||
u32 experience = GetBoxMonData(mon, MON_DATA_EXP) + steps;
|
||||
SetBoxMonData(&tempMon, MON_DATA_EXP, &experience);
|
||||
return GetLevelFromBoxMonExp(&tempMon);
|
||||
}
|
||||
|
||||
u8 GetNumLevelsGainedFromSteps(struct DaycareMon *daycareMon)
|
||||
{
|
||||
u8 levelBefore;
|
||||
u8 levelAfter;
|
||||
|
||||
levelBefore = GetLevelFromBoxMonExp(&daycareMon->mon);
|
||||
levelAfter = GetLevelAfterDaycareSteps(&daycareMon->mon, daycareMon->steps);
|
||||
return levelAfter - levelBefore;
|
||||
}
|
||||
|
||||
u8 GetNumLevelsGainedForDaycareMon(struct DaycareMon *daycareMon)
|
||||
{
|
||||
u8 numLevelsGained = GetNumLevelsGainedFromSteps(daycareMon);
|
||||
ConvertIntToDecimalStringN(gStringVar2, numLevelsGained, STR_CONV_MODE_LEFT_ALIGN, 2);
|
||||
GetBoxMonNick(&daycareMon->mon, gStringVar1);
|
||||
return numLevelsGained;
|
||||
}
|
||||
|
||||
static u32 GetDaycareCostForSelectedMon(struct DaycareMon *daycareMon)
|
||||
{
|
||||
u32 cost;
|
||||
|
||||
u8 numLevelsGained = GetNumLevelsGainedFromSteps(daycareMon);
|
||||
GetBoxMonNick(&daycareMon->mon, gStringVar1);
|
||||
cost = 100 + 100 * numLevelsGained;
|
||||
ConvertIntToDecimalStringN(gStringVar2, cost, STR_CONV_MODE_LEFT_ALIGN, 5);
|
||||
return cost;
|
||||
}
|
||||
|
||||
static u16 GetDaycareCostForMon(struct DayCare *daycare, u8 slotId)
|
||||
{
|
||||
return GetDaycareCostForSelectedMon(&daycare->mons[slotId]);
|
||||
}
|
||||
|
||||
void GetDaycareCost(void)
|
||||
{
|
||||
gSpecialVar_0x8005 = GetDaycareCostForMon(&gSaveBlock1Ptr->daycare, gSpecialVar_0x8004);
|
||||
}
|
||||
|
||||
static void Debug_AddDaycareSteps(u16 numSteps)
|
||||
{
|
||||
gSaveBlock1Ptr->daycare.mons[0].steps += numSteps;
|
||||
gSaveBlock1Ptr->daycare.mons[1].steps += numSteps;
|
||||
}
|
||||
|
||||
u8 GetNumLevelsGainedFromDaycare(void)
|
||||
{
|
||||
if (GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[gSpecialVar_0x8004], MON_DATA_SPECIES) != 0)
|
||||
return GetNumLevelsGainedForDaycareMon(&gSaveBlock1Ptr->daycare.mons[gSpecialVar_0x8004]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ClearDaycareMonMisc(struct DaycareMiscMon *misc)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < OT_NAME_LENGTH + 1; i++)
|
||||
misc->OT_name[i] = 0;
|
||||
for (i = 0; i < POKEMON_NAME_LENGTH + 1; i++)
|
||||
misc->monName[i] = 0;
|
||||
|
||||
ClearMailStruct(&misc->mail);
|
||||
}
|
||||
|
||||
static void ClearDaycareMon(struct DaycareMon *daycareMon)
|
||||
{
|
||||
ZeroBoxMonData(&daycareMon->mon);
|
||||
daycareMon->steps = 0;
|
||||
ClearDaycareMonMisc(&daycareMon->misc);
|
||||
}
|
||||
|
||||
static void ClearAllDaycareData(struct DayCare *daycare)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < DAYCARE_MON_COUNT; i++)
|
||||
ClearDaycareMon(&daycare->mons[i]);
|
||||
|
||||
daycare->offspringPersonality = 0;
|
||||
daycare->stepCounter = 0;
|
||||
}
|
||||
|
||||
// Determines what the species of an Egg would be based on the given species.
|
||||
// It determines this by working backwards through the evolution chain of the
|
||||
// given species.
|
||||
u16 GetEggSpecies(u16 species)
|
||||
{
|
||||
int i, j, k;
|
||||
bool8 found;
|
||||
|
||||
// Working backwards up to 5 times seems arbitrary, since the maximum number
|
||||
// of times would only be 3 for 3-stage evolutions.
|
||||
for (i = 0; i < EVOS_PER_MON; i++)
|
||||
{
|
||||
found = FALSE;
|
||||
for (j = 1; j < NUM_SPECIES; j++)
|
||||
{
|
||||
for (k = 0; k < EVOS_PER_MON; k++)
|
||||
{
|
||||
if (gEvolutionTable[j].evolutions[k].targetSpecies == species)
|
||||
{
|
||||
species = j;
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
break;
|
||||
}
|
||||
|
||||
if (j == NUM_SPECIES)
|
||||
break;
|
||||
}
|
||||
|
||||
return species;
|
||||
}
|
||||
|
||||
static s32 GetSlotToInheritNature(struct DayCare *daycare)
|
||||
{
|
||||
u32 species[DAYCARE_MON_COUNT];
|
||||
s32 i, slot = -1, dittoCount;
|
||||
|
||||
// search for female gender
|
||||
for (i = 0; i < DAYCARE_MON_COUNT; i++)
|
||||
{
|
||||
if (GetBoxMonGender(&daycare->mons[i].mon) == MON_FEMALE)
|
||||
slot = i;
|
||||
}
|
||||
|
||||
// search for ditto
|
||||
for (dittoCount = 0, i = 0; i < DAYCARE_MON_COUNT; i++)
|
||||
{
|
||||
species[i] = GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SPECIES);
|
||||
if (species[i] == SPECIES_DITTO)
|
||||
dittoCount++, slot = i;
|
||||
}
|
||||
|
||||
// coin flip on ...two Dittos
|
||||
if (dittoCount == 2)
|
||||
{
|
||||
if (Random() >= USHRT_MAX / 2)
|
||||
slot = 0;
|
||||
else
|
||||
slot = 1;
|
||||
}
|
||||
|
||||
// nature inheritance only if holds everstone
|
||||
if (GetBoxMonData(&daycare->mons[slot].mon, MON_DATA_HELD_ITEM) != ITEM_EVERSTONE
|
||||
|| Random() >= USHRT_MAX / 2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return slot;
|
||||
}
|
||||
|
||||
static void _TriggerPendingDaycareEgg(struct DayCare *daycare)
|
||||
{
|
||||
s32 natureSlot;
|
||||
s32 natureTries = 0;
|
||||
|
||||
SeedRng2(gMain.vblankCounter2);
|
||||
natureSlot = GetSlotToInheritNature(daycare);
|
||||
|
||||
if (natureSlot < 0)
|
||||
{
|
||||
daycare->offspringPersonality = (Random2() << 0x10) | ((Random() % 0xfffe) + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
u8 wantedNature = GetNatureFromPersonality(GetBoxMonData(&daycare->mons[natureSlot].mon, MON_DATA_PERSONALITY, NULL));
|
||||
u32 personality;
|
||||
|
||||
do
|
||||
{
|
||||
personality = (Random2() << 0x10) | (Random());
|
||||
if (wantedNature == GetNatureFromPersonality(personality) && personality != 0)
|
||||
break; // we found a personality with the same nature
|
||||
|
||||
natureTries++;
|
||||
} while (natureTries <= 2400);
|
||||
|
||||
daycare->offspringPersonality = personality;
|
||||
}
|
||||
|
||||
FlagSet(FLAG_PENDING_DAYCARE_EGG);
|
||||
}
|
||||
|
||||
static void _TriggerPendingDaycareMaleEgg(struct DayCare *daycare)
|
||||
{
|
||||
daycare->offspringPersonality = (Random()) | (0x8000);
|
||||
FlagSet(FLAG_PENDING_DAYCARE_EGG);
|
||||
}
|
||||
|
||||
void TriggerPendingDaycareEgg(void)
|
||||
{
|
||||
_TriggerPendingDaycareEgg(&gSaveBlock1Ptr->daycare);
|
||||
}
|
||||
|
||||
void TriggerPendingDaycareMaleEgg(void)
|
||||
{
|
||||
_TriggerPendingDaycareMaleEgg(&gSaveBlock1Ptr->daycare);
|
||||
}
|
||||
|
||||
// Removes the selected index from the given IV list and shifts the remaining
|
||||
// elements to the left.
|
||||
void RemoveIVIndexFromList(u8 *ivs, u8 selectedIv)
|
||||
{
|
||||
s32 i, j;
|
||||
u8 temp[NUM_STATS];
|
||||
|
||||
ivs[selectedIv] = 0xff;
|
||||
for (i = 0; i < NUM_STATS; i++)
|
||||
{
|
||||
temp[i] = ivs[i];
|
||||
}
|
||||
|
||||
j = 0;
|
||||
for (i = 0; i < NUM_STATS; i++)
|
||||
{
|
||||
if (temp[i] != 0xff)
|
||||
ivs[j++] = temp[i];
|
||||
}
|
||||
}
|
||||
|
||||
void InheritIVs(struct Pokemon *egg, struct DayCare *daycare)
|
||||
{
|
||||
u8 i;
|
||||
u8 selectedIvs[3];
|
||||
u8 availableIVs[NUM_STATS];
|
||||
u8 whichParent[ARRAY_COUNT(selectedIvs)];
|
||||
u8 iv;
|
||||
|
||||
// Initialize a list of IV indices.
|
||||
for (i = 0; i < NUM_STATS; i++)
|
||||
{
|
||||
availableIVs[i] = i;
|
||||
}
|
||||
|
||||
// Select the 3 IVs that will be inherited.
|
||||
for (i = 0; i < ARRAY_COUNT(selectedIvs); i++)
|
||||
{
|
||||
// Randomly pick an IV from the available list.
|
||||
selectedIvs[i] = availableIVs[Random() % (NUM_STATS - i)];
|
||||
|
||||
// Remove the selected IV index from the available IV indices.
|
||||
RemoveIVIndexFromList(availableIVs, i);
|
||||
}
|
||||
|
||||
// Determine which parent each of the selected IVs should inherit from.
|
||||
for (i = 0; i < ARRAY_COUNT(selectedIvs); i++)
|
||||
{
|
||||
whichParent[i] = Random() % 2;
|
||||
}
|
||||
|
||||
// Set each of inherited IVs on the egg mon.
|
||||
for (i = 0; i < ARRAY_COUNT(selectedIvs); i++)
|
||||
{
|
||||
switch (selectedIvs[i])
|
||||
{
|
||||
case 0:
|
||||
iv = GetBoxMonData(&daycare->mons[whichParent[i]].mon, MON_DATA_HP_IV);
|
||||
SetMonData(egg, MON_DATA_HP_IV, &iv);
|
||||
break;
|
||||
case 1:
|
||||
iv = GetBoxMonData(&daycare->mons[whichParent[i]].mon, MON_DATA_ATK_IV);
|
||||
SetMonData(egg, MON_DATA_ATK_IV, &iv);
|
||||
break;
|
||||
case 2:
|
||||
iv = GetBoxMonData(&daycare->mons[whichParent[i]].mon, MON_DATA_DEF_IV);
|
||||
SetMonData(egg, MON_DATA_DEF_IV, &iv);
|
||||
break;
|
||||
case 3:
|
||||
iv = GetBoxMonData(&daycare->mons[whichParent[i]].mon, MON_DATA_SPEED_IV);
|
||||
SetMonData(egg, MON_DATA_SPEED_IV, &iv);
|
||||
break;
|
||||
case 4:
|
||||
iv = GetBoxMonData(&daycare->mons[whichParent[i]].mon, MON_DATA_SPATK_IV);
|
||||
SetMonData(egg, MON_DATA_SPATK_IV, &iv);
|
||||
break;
|
||||
case 5:
|
||||
iv = GetBoxMonData(&daycare->mons[whichParent[i]].mon, MON_DATA_SPDEF_IV);
|
||||
SetMonData(egg, MON_DATA_SPDEF_IV, &iv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,6 @@ extern u8 gUnknown_08D97D0C;
|
||||
extern void reset_temp_tile_data_buffers();
|
||||
extern void decompress_and_copy_tile_data_to_vram(u8 a, void* tiledata, u8 b, u8 c, u8 d);
|
||||
extern u8 free_temp_tile_data_buffers_if_possible();
|
||||
extern void sub_8069004(struct BoxPokemon* a, void* b);
|
||||
extern void sub_81C1E20(u8 taskId);
|
||||
extern u8 *GetMonNickname(struct Pokemon *mon, u8 *dest);
|
||||
extern u16 SpeciesToPokedexNum(u16 species);
|
||||
@ -667,7 +666,7 @@ void sub_81C0098(struct Pokemon *mon)
|
||||
else
|
||||
{
|
||||
struct BoxPokemon *boxMon = gUnknown_0203CF1C->unk0->boxMon;
|
||||
sub_8069004(&boxMon[gUnknown_0203CF1C->unk40BE], mon);
|
||||
BoxMonToMon(&boxMon[gUnknown_0203CF1C->unk40BE], mon);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1810,7 +1809,7 @@ void sub_81C171C(u8 taskId)
|
||||
void sub_81C174C(u8 taskId)
|
||||
{
|
||||
s16* data = gTasks[taskId].data;
|
||||
|
||||
|
||||
if (sub_81221EC() != 1)
|
||||
{
|
||||
if (gPaletteFade.active != 1)
|
||||
@ -1857,7 +1856,7 @@ void sub_81C174C(u8 taskId)
|
||||
gUnknown_0203CF21 = 4;
|
||||
gSpecialVar_0x8005 = 4;
|
||||
sub_81C044C(taskId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1907,7 +1906,7 @@ void sub_81C1940(u8 taskId)
|
||||
{
|
||||
if (gUnknown_0203CF1C->unk40C0 != 2)
|
||||
{
|
||||
|
||||
|
||||
ClearWindowTilemap(19);
|
||||
if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible)
|
||||
ClearWindowTilemap(13);
|
||||
@ -2224,7 +2223,7 @@ void sub_81C1E20(u8 taskId)
|
||||
{
|
||||
if (gUnknown_0203CF1C->unk40C0 == 2)
|
||||
PutWindowTilemap(14);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2277,7 +2276,7 @@ void sub_81C1F80(u8 taskId)
|
||||
PutWindowTilemap(15);
|
||||
sub_81C240C(data[2]);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible)
|
||||
{
|
||||
@ -3645,7 +3644,7 @@ void sub_81C3D54(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
s16 dataa = data[0] - 1;
|
||||
|
||||
|
||||
switch (dataa)
|
||||
{
|
||||
case 0:
|
||||
@ -3676,4 +3675,4 @@ void sub_81C3D54(u8 taskId)
|
||||
return;
|
||||
}
|
||||
data[0]++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user