mirror of
https://github.com/pret/pokeheartgold.git
synced 2024-11-27 15:10:26 +00:00
get_egg.c, 2
This commit is contained in:
parent
d120a4a0f8
commit
8283b523ee
292
asm/get_egg_s.s
292
asm/get_egg_s.s
@ -11,292 +11,10 @@
|
||||
.public Daycare_GetBoxMonI
|
||||
.public Sav2_DayCare_CountMonsInDayCare
|
||||
.public Sav2_DayCare_GetAvailableSlot
|
||||
|
||||
thumb_func_start DayCareMon_CopyFromPartySlot
|
||||
DayCareMon_CopyFromPartySlot: ; 0x0206BE34
|
||||
push {r4, r5, r6, r7, lr}
|
||||
sub sp, #0x24
|
||||
add r5, r2, #0
|
||||
add r6, r0, #0
|
||||
str r1, [sp]
|
||||
add r7, r3, #0
|
||||
bl GetPartyMonByIndex
|
||||
add r4, r0, #0
|
||||
add r0, r5, #0
|
||||
bl DayCareMon_GetExtras
|
||||
str r0, [sp, #8]
|
||||
add r0, r5, #0
|
||||
bl DayCareMon_GetBoxMon
|
||||
str r0, [sp, #4]
|
||||
add r0, r7, #0
|
||||
bl Sav2_PlayerData_GetProfileAddr
|
||||
bl PlayerProfile_GetNamePtr
|
||||
add r2, sp, #0xc
|
||||
add r0, r4, #0
|
||||
mov r1, #0x75
|
||||
add r2, #2
|
||||
bl GetMonData
|
||||
add r0, r4, #0
|
||||
bl Mon_GetBoxMon
|
||||
bl BoxMonIsHoldingMail
|
||||
cmp r0, #0
|
||||
beq _0206BE8A
|
||||
ldr r0, [sp, #8]
|
||||
bl DayCareMail_GetCapsule
|
||||
add r2, r0, #0
|
||||
add r0, r4, #0
|
||||
mov r1, #0xaa
|
||||
bl GetMonData
|
||||
_0206BE8A:
|
||||
mov r1, #0
|
||||
add r0, sp, #0xc
|
||||
strb r1, [r0]
|
||||
add r0, r4, #0
|
||||
mov r1, #0xbb
|
||||
add r2, sp, #0xc
|
||||
bl SetMonData
|
||||
ldr r1, [sp, #4]
|
||||
add r0, r4, #0
|
||||
bl CopyBoxPokemonToBoxPokemon
|
||||
ldr r0, [sp, #4]
|
||||
mov r1, #0
|
||||
bl BoxMon_UpdateShayminForme
|
||||
add r0, r5, #0
|
||||
mov r1, #0
|
||||
bl DayCareMon_SetSteps
|
||||
ldr r1, [sp]
|
||||
add r0, r6, #0
|
||||
bl RemoveMonFromParty
|
||||
ldr r1, _0206BED4 ; =0x000001B9
|
||||
add r0, r6, #0
|
||||
bl PartyHasMon
|
||||
cmp r0, #0
|
||||
bne _0206BED0
|
||||
add r0, r7, #0
|
||||
bl Sav2_Chatot_get
|
||||
bl Chatot_invalidate
|
||||
_0206BED0:
|
||||
add sp, #0x24
|
||||
pop {r4, r5, r6, r7, pc}
|
||||
.balign 4, 0
|
||||
_0206BED4: .word 0x000001B9
|
||||
thumb_func_end DayCareMon_CopyFromPartySlot
|
||||
|
||||
thumb_func_start Sav2_DayCare_PutMonIn
|
||||
Sav2_DayCare_PutMonIn: ; 0x0206BED8
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
add r7, r3, #0
|
||||
add r5, r0, #0
|
||||
add r0, r7, #0
|
||||
add r6, r1, #0
|
||||
add r4, r2, #0
|
||||
bl Sav2_GameStats_get
|
||||
mov r1, #0x29
|
||||
bl GameStats_Inc
|
||||
add r0, r4, #0
|
||||
bl Sav2_DayCare_GetAvailableSlot
|
||||
add r1, r0, #0
|
||||
add r0, r4, #0
|
||||
bl Sav2_DayCare_GetMonX
|
||||
add r2, r0, #0
|
||||
add r0, r5, #0
|
||||
add r1, r6, #0
|
||||
add r3, r7, #0
|
||||
bl DayCareMon_CopyFromPartySlot
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
.balign 4, 0
|
||||
thumb_func_end Sav2_DayCare_PutMonIn
|
||||
|
||||
thumb_func_start Sav2_DayCare_Compaction
|
||||
Sav2_DayCare_Compaction: ; 0x0206BF0C
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
add r4, r0, #0
|
||||
mov r1, #0
|
||||
bl Sav2_DayCare_GetMonX
|
||||
add r5, r0, #0
|
||||
add r0, r4, #0
|
||||
mov r1, #1
|
||||
bl Sav2_DayCare_GetMonX
|
||||
add r4, r0, #0
|
||||
add r0, r5, #0
|
||||
bl DayCareMon_GetBoxMon
|
||||
add r6, r0, #0
|
||||
add r0, r4, #0
|
||||
bl DayCareMon_GetBoxMon
|
||||
add r7, r0, #0
|
||||
add r0, r6, #0
|
||||
mov r1, #5
|
||||
mov r2, #0
|
||||
bl GetBoxMonData
|
||||
cmp r0, #0
|
||||
bne _0206BF5C
|
||||
add r0, r7, #0
|
||||
mov r1, #5
|
||||
mov r2, #0
|
||||
bl GetBoxMonData
|
||||
cmp r0, #0
|
||||
beq _0206BF5C
|
||||
add r0, r5, #0
|
||||
add r1, r4, #0
|
||||
bl DayCareMon_Copy
|
||||
add r0, r4, #0
|
||||
bl DayCareMon_init
|
||||
_0206BF5C:
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
.balign 4, 0
|
||||
thumb_func_end Sav2_DayCare_Compaction
|
||||
|
||||
thumb_func_start sub_0206BF60
|
||||
sub_0206BF60: ; 0x0206BF60
|
||||
push {r4, r5, r6, r7, lr}
|
||||
sub sp, #0xc
|
||||
add r5, r0, #0
|
||||
mov r0, #0
|
||||
str r0, [sp]
|
||||
str r0, [sp, #8]
|
||||
add r4, sp, #8
|
||||
add r6, sp, #4
|
||||
add r7, sp, #4
|
||||
_0206BF72:
|
||||
add r0, r5, #0
|
||||
bl sub_02070DB4
|
||||
cmp r0, #0
|
||||
beq _0206BFB4
|
||||
mov r0, #0
|
||||
str r0, [sp, #8]
|
||||
add r0, r5, #0
|
||||
add r1, r4, #0
|
||||
add r2, r6, #0
|
||||
bl MonTryLearnMoveOnLevelUp
|
||||
cmp r0, #0
|
||||
beq _0206BFAA
|
||||
_0206BF8E:
|
||||
ldr r1, _0206BFC0 ; =0x0000FFFF
|
||||
cmp r0, r1
|
||||
bne _0206BF9C
|
||||
ldrh r1, [r7]
|
||||
add r0, r5, #0
|
||||
bl DeleteMonFirstMoveAndAppend
|
||||
_0206BF9C:
|
||||
add r0, r5, #0
|
||||
add r1, r4, #0
|
||||
add r2, r6, #0
|
||||
bl MonTryLearnMoveOnLevelUp
|
||||
cmp r0, #0
|
||||
bne _0206BF8E
|
||||
_0206BFAA:
|
||||
ldr r0, [sp]
|
||||
add r0, r0, #1
|
||||
str r0, [sp]
|
||||
cmp r0, #0x64
|
||||
blt _0206BF72
|
||||
_0206BFB4:
|
||||
add r0, r5, #0
|
||||
bl CalcMonLevelAndStats
|
||||
add sp, #0xc
|
||||
pop {r4, r5, r6, r7, pc}
|
||||
nop
|
||||
_0206BFC0: .word 0x0000FFFF
|
||||
thumb_func_end sub_0206BF60
|
||||
|
||||
thumb_func_start Sav2_DayCare_MoveMonToParty
|
||||
Sav2_DayCare_MoveMonToParty: ; 0x0206BFC4
|
||||
push {r4, r5, r6, r7, lr}
|
||||
sub sp, #0xc
|
||||
str r0, [sp]
|
||||
add r6, r1, #0
|
||||
mov r0, #4
|
||||
add r7, r2, #0
|
||||
bl AllocMonZeroed
|
||||
add r4, r0, #0
|
||||
add r0, r6, #0
|
||||
bl DayCareMon_GetBoxMon
|
||||
add r5, r0, #0
|
||||
add r0, r6, #0
|
||||
bl DayCareMon_GetExtras
|
||||
str r0, [sp, #4]
|
||||
add r0, r7, #0
|
||||
mov r1, #0
|
||||
add r2, r5, #0
|
||||
bl BufferBoxMonNickname
|
||||
add r0, r5, #0
|
||||
mov r1, #5
|
||||
mov r2, #0
|
||||
bl GetBoxMonData
|
||||
lsl r0, r0, #0x10
|
||||
lsr r7, r0, #0x10
|
||||
add r0, r5, #0
|
||||
add r1, r4, #0
|
||||
bl CopyBoxPokemonToPokemon
|
||||
add r0, r4, #0
|
||||
mov r1, #0xa1
|
||||
mov r2, #0
|
||||
bl GetMonData
|
||||
cmp r0, #0x64
|
||||
beq _0206C03C
|
||||
add r0, r4, #0
|
||||
mov r1, #8
|
||||
mov r2, #0
|
||||
bl GetMonData
|
||||
str r0, [sp, #8]
|
||||
add r0, r6, #0
|
||||
bl DayCareMon_GetSteps
|
||||
ldr r1, [sp, #8]
|
||||
add r2, sp, #8
|
||||
add r0, r1, r0
|
||||
str r0, [sp, #8]
|
||||
add r0, r4, #0
|
||||
mov r1, #8
|
||||
bl SetMonData
|
||||
add r0, r4, #0
|
||||
bl sub_0206BF60
|
||||
_0206C03C:
|
||||
add r0, r5, #0
|
||||
bl BoxMonIsHoldingMail
|
||||
cmp r0, #0
|
||||
beq _0206C056
|
||||
ldr r0, [sp, #4]
|
||||
bl DayCareMail_GetCapsule
|
||||
add r2, r0, #0
|
||||
add r0, r4, #0
|
||||
mov r1, #0xaa
|
||||
bl SetMonData
|
||||
_0206C056:
|
||||
ldr r0, [sp]
|
||||
add r1, r4, #0
|
||||
bl AddMonToParty
|
||||
add r0, r5, #0
|
||||
bl ZeroBoxMonData
|
||||
add r0, r6, #0
|
||||
mov r1, #0
|
||||
bl DayCareMon_SetSteps
|
||||
add r0, r4, #0
|
||||
bl FreeToHeap
|
||||
add r0, r7, #0
|
||||
add sp, #0xc
|
||||
pop {r4, r5, r6, r7, pc}
|
||||
thumb_func_end Sav2_DayCare_MoveMonToParty
|
||||
|
||||
thumb_func_start Sav2_DayCare_RetrieveMon
|
||||
Sav2_DayCare_RetrieveMon: ; 0x0206C078
|
||||
push {r4, r5, r6, lr}
|
||||
add r6, r2, #0
|
||||
add r5, r0, #0
|
||||
add r4, r1, #0
|
||||
add r0, r6, #0
|
||||
add r1, r3, #0
|
||||
bl Sav2_DayCare_GetMonX
|
||||
add r1, r0, #0
|
||||
add r0, r5, #0
|
||||
add r2, r4, #0
|
||||
bl Sav2_DayCare_MoveMonToParty
|
||||
lsl r0, r0, #0x10
|
||||
lsr r4, r0, #0x10
|
||||
add r0, r6, #0
|
||||
bl Sav2_DayCare_Compaction
|
||||
add r0, r4, #0
|
||||
pop {r4, r5, r6, pc}
|
||||
thumb_func_end Sav2_DayCare_RetrieveMon
|
||||
.public DayCareMon_CopyFromPartySlot
|
||||
.public Sav2_DayCare_Compaction
|
||||
.public sub_0206BF60
|
||||
.public Sav2_DayCare_MoveMonToParty
|
||||
|
||||
thumb_func_start GetDayCareUpdatedLevel
|
||||
GetDayCareUpdatedLevel: ; 0x0206C0A0
|
||||
@ -310,7 +28,7 @@ GetDayCareUpdatedLevel: ; 0x0206C0A0
|
||||
add r4, r0, #0
|
||||
add r0, r6, #0
|
||||
add r1, r4, #0
|
||||
bl CopyPokemonToBoxPokemon
|
||||
bl CopyBoxPokemonToBoxPokemon
|
||||
add r0, r4, #0
|
||||
mov r1, #8
|
||||
mov r2, #0
|
||||
|
@ -258,10 +258,10 @@
|
||||
.public ClearTempFieldEventData
|
||||
.public ClearWindowTilemapAndCopyToVram
|
||||
.public ConvertUIntToDecimalString
|
||||
.public CopyBoxPokemonToBoxPokemon
|
||||
.public CopyPokemonToBoxPokemon
|
||||
.public CopyBoxPokemonToPokemon
|
||||
.public CopyCapsule
|
||||
.public CopyPokemonToBoxPokemon
|
||||
.public CopyBoxPokemonToBoxPokemon
|
||||
.public CopyPokemonToPokemon
|
||||
.public CopyStringToU16Array
|
||||
.public CopyU16ArrayToString
|
||||
@ -288,7 +288,7 @@
|
||||
.public DGT_Hash1GetDigest_R
|
||||
.public DGT_Hash1Reset
|
||||
.public DGT_Hash1SetSource
|
||||
.public DayCareMail_GetCapsule
|
||||
.public DayCareMail_GetMailPtr
|
||||
.public DayCareMon_AddSteps
|
||||
.public DayCareMon_Copy
|
||||
.public DayCareMon_GetBoxMon
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "pokemon.h"
|
||||
|
||||
typedef struct DAYCAREMAIL {
|
||||
MAIL seal;
|
||||
MAIL mail;
|
||||
u16 ot_name[OT_NAME_LENGTH + 1];
|
||||
u16 nickname[POKEMON_NAME_LENGTH + 1];
|
||||
u8 padding_5E[2];
|
||||
@ -30,7 +30,7 @@ DAYCAREMON* Sav2_DayCare_GetMonX(DAYCARE* daycare, s32 i);
|
||||
BOXMON* DayCareMon_GetBoxMon(DAYCAREMON* dcmon);
|
||||
DAYCAREMAIL* DayCareMon_GetExtras(DAYCAREMON* dcmon);
|
||||
u32 DayCareMon_GetSteps(DAYCAREMON* dcmon);
|
||||
MAIL* DayCareMail_GetCapsule(DAYCAREMAIL* dcmail);
|
||||
MAIL* DayCareMail_GetMailPtr(DAYCAREMAIL* dcmail);
|
||||
u32 Sav2_DayCare_GetEggPID(DAYCARE* daycare);
|
||||
u8 Sav2_DayCare_GetEggCycleCounter(DAYCARE* daycare);
|
||||
void DayCareMon_SetSteps(DAYCAREMON* dcmon, u32 steps);
|
||||
|
13
include/game_stats.h
Normal file
13
include/game_stats.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef POKEHEARTGOLD_GAME_STATS_H
|
||||
#define POKEHEARTGOLD_GAME_STATS_H
|
||||
|
||||
#include "save.h"
|
||||
|
||||
typedef struct GAME_STATS GAME_STATS;
|
||||
|
||||
u32 Sav2_GameStats_sizeof(void);
|
||||
void Sav2_GameStats_init(GAME_STATS *gameStats);
|
||||
GAME_STATS *Sav2_GameStats_get(SAVEDATA *saveData);
|
||||
void GameStats_Inc(GAME_STATS *gameStats, int which);
|
||||
|
||||
#endif //POKEHEARTGOLD_GAME_STATS_H
|
@ -20,6 +20,12 @@
|
||||
#define WOTBL_LEVEL_MASK 0xFE00
|
||||
#define WOTBL_LEVEL_SHIFT 9
|
||||
|
||||
#define WOTBL_MOVE(x) ((u16)(((x) & WOTBL_MOVEID_MASK) >> WOTBL_MOVEID_SHIFT))
|
||||
#define WOTBL_LVL(x) ((u8)(((x) & WOTBL_LEVEL_MASK) >> WOTBL_LEVEL_SHIFT))
|
||||
|
||||
#define WAZA_APPEND_FULL 0xFFFFu
|
||||
#define WAZA_APPEND_KNOWN 0xFFFEu
|
||||
|
||||
extern const s8 gNatureStatMods[NATURE_NUM][NUM_EV_STATS];
|
||||
|
||||
void ZeroMonData(POKEMON * pokemon);
|
||||
@ -94,8 +100,8 @@ u8 Party_GetMaxLevel(PARTY * party);
|
||||
u16 SpeciesToSinnohDexNo(u16 species);
|
||||
u16 SinnohDexNoToSpecies(u16 sinnoh_dex);
|
||||
void CopyPokemonToPokemon(const POKEMON * src, POKEMON * dest);
|
||||
void CopyPokemonToBoxPokemon(const POKEMON * src, BOXMON * dest);
|
||||
void CopyBoxPokemonToBoxPokemon(const BOXMON * src, BOXMON * dest);
|
||||
void CopyPokemonToBoxPokemon(const POKEMON * src, BOXMON * dest);
|
||||
s8 MonGetFlavorPreference(POKEMON * pokemon, int flavor);
|
||||
s8 BoxMonGetFlavorPreference(BOXMON * boxmon, int flavor);
|
||||
s8 GetFlavorPreferenceFromPID(u32 personality, int flavor);
|
||||
|
@ -8,5 +8,6 @@ typedef struct SOUND_CHATOT SOUND_CHATOT;
|
||||
SOUND_CHATOT *Sav2_Chatot_get(SAVEDATA *saveData);
|
||||
u32 Sav2_Chatot_sizeof(void);
|
||||
void Sav2_Chatot_init(SOUND_CHATOT *chatot);
|
||||
void Chatot_invalidate(SOUND_CHATOT *chatot);
|
||||
|
||||
#endif //POKEHEARTGOLD_SAV_CHATOT_H
|
||||
|
@ -28,8 +28,8 @@ u32 DayCareMon_GetSteps(DAYCAREMON* dcmon) {
|
||||
return dcmon->steps;
|
||||
}
|
||||
|
||||
MAIL* DayCareMail_GetCapsule(DAYCAREMAIL* dcmail) {
|
||||
return &dcmail->seal;
|
||||
MAIL* DayCareMail_GetMailPtr(DAYCAREMAIL* dcmail) {
|
||||
return &dcmail->mail;
|
||||
}
|
||||
|
||||
BOOL Sav2_DayCare_HasEgg(DAYCARE* daycare) {
|
||||
|
115
src/get_egg.c
115
src/get_egg.c
@ -1,4 +1,7 @@
|
||||
#include "get_egg.h"
|
||||
#include "party.h"
|
||||
#include "game_stats.h"
|
||||
#include "constants/moves.h"
|
||||
|
||||
BOXMON *Daycare_GetBoxMonI(DAYCARE *daycare, int idx) {
|
||||
return DayCareMon_GetBoxMon(Sav2_DayCare_GetMonX(daycare, idx));
|
||||
@ -31,3 +34,115 @@ int Sav2_DayCare_GetAvailableSlot(DAYCARE *daycare) {
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void DayCareMon_CopyFromPartySlot(PARTY *party, int partyIdx, DAYCAREMON *daycareMon, SAVEDATA *saveData) {
|
||||
u16 nickname[POKEMON_NAME_LENGTH + 1];
|
||||
u8 mood;
|
||||
DAYCAREMAIL *daycareMail;
|
||||
BOXMON *boxmon;
|
||||
POKEMON *partymon;
|
||||
const u16 *playerNamePtr;
|
||||
|
||||
partymon = GetPartyMonByIndex(party, partyIdx);
|
||||
daycareMail = DayCareMon_GetExtras(daycareMon);
|
||||
boxmon = DayCareMon_GetBoxMon(daycareMon);
|
||||
playerNamePtr = PlayerProfile_GetNamePtr(Sav2_PlayerData_GetProfileAddr(saveData));
|
||||
GetMonData(partymon, MON_DATA_NICKNAME, nickname);
|
||||
if (BoxMonIsHoldingMail(Mon_GetBoxMon(partymon))) {
|
||||
GetMonData(partymon, MON_DATA_MAIL_STRUCT, DayCareMail_GetMailPtr(daycareMail));
|
||||
}
|
||||
mood = 0;
|
||||
SetMonData(partymon, MON_DATA_MOOD, &mood);
|
||||
CopyPokemonToBoxPokemon(partymon, boxmon);
|
||||
BoxMon_UpdateShayminForme(boxmon, SHAYMIN_LAND);
|
||||
DayCareMon_SetSteps(daycareMon, 0);
|
||||
RemoveMonFromParty(party, partyIdx);
|
||||
if (!PartyHasMon(party, SPECIES_CHATOT)) {
|
||||
Chatot_invalidate(Sav2_Chatot_get(saveData));
|
||||
}
|
||||
}
|
||||
|
||||
void Sav2_DayCare_PutMonIn(PARTY *party, u8 partyIdx, DAYCARE *dayCare, SAVEDATA *saveData) {
|
||||
GameStats_Inc(Sav2_GameStats_get(saveData), 41);
|
||||
DayCareMon_CopyFromPartySlot(party, partyIdx, Sav2_DayCare_GetMonX(dayCare, Sav2_DayCare_GetAvailableSlot(dayCare)), saveData);
|
||||
}
|
||||
|
||||
void Sav2_DayCare_Compaction(DAYCARE *daycare) {
|
||||
DAYCAREMON *mon1;
|
||||
DAYCAREMON *mon2;
|
||||
BOXMON *boxmon1;
|
||||
BOXMON *boxmon2;
|
||||
|
||||
mon1 = Sav2_DayCare_GetMonX(daycare, 0);
|
||||
mon2 = Sav2_DayCare_GetMonX(daycare, 1);
|
||||
boxmon1 = DayCareMon_GetBoxMon(mon1);
|
||||
boxmon2 = DayCareMon_GetBoxMon(mon2);
|
||||
|
||||
if (GetBoxMonData(boxmon1, MON_DATA_SPECIES, NULL) == SPECIES_NONE && GetBoxMonData(boxmon2, MON_DATA_SPECIES, NULL) != SPECIES_NONE) {
|
||||
DayCareMon_Copy(mon1, mon2);
|
||||
DayCareMon_init(mon2);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0206BF60(POKEMON *pokemon) {
|
||||
int i;
|
||||
int last_i;
|
||||
u16 learned;
|
||||
int stat;
|
||||
|
||||
for (i = 0, last_i = 0; i < MAX_LEVEL; i++) {
|
||||
if (!sub_02070DB4(pokemon)) {
|
||||
break;
|
||||
}
|
||||
last_i = 0;
|
||||
for (
|
||||
stat = MonTryLearnMoveOnLevelUp(pokemon, &last_i, &learned);
|
||||
stat != 0;
|
||||
stat = MonTryLearnMoveOnLevelUp(pokemon, &last_i, &learned)
|
||||
) {
|
||||
if (stat == WAZA_APPEND_FULL) {
|
||||
DeleteMonFirstMoveAndAppend(pokemon, learned);
|
||||
}
|
||||
}
|
||||
}
|
||||
CalcMonLevelAndStats(pokemon);
|
||||
}
|
||||
|
||||
int Sav2_DayCare_MoveMonToParty(PARTY *party, DAYCAREMON *daycareMon, MSGFMT *msgFmt) {
|
||||
u32 exp;
|
||||
POKEMON *pokemon;
|
||||
BOXMON *boxmon;
|
||||
DAYCAREMAIL *daycareMail;
|
||||
u16 species;
|
||||
|
||||
pokemon = AllocMonZeroed(4);
|
||||
boxmon = DayCareMon_GetBoxMon(daycareMon);
|
||||
daycareMail = DayCareMon_GetExtras(daycareMon);
|
||||
|
||||
BufferBoxMonNickname(msgFmt, 0, boxmon);
|
||||
species = GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL);
|
||||
|
||||
CopyBoxPokemonToPokemon(boxmon, pokemon);
|
||||
if (GetMonData(pokemon, MON_DATA_LEVEL, NULL) != MAX_LEVEL) {
|
||||
exp = GetMonData(pokemon, MON_DATA_EXPERIENCE, NULL);
|
||||
exp += DayCareMon_GetSteps(daycareMon);
|
||||
SetMonData(pokemon, MON_DATA_EXPERIENCE, &exp);
|
||||
sub_0206BF60(pokemon);
|
||||
}
|
||||
if (BoxMonIsHoldingMail(boxmon)) {
|
||||
SetMonData(pokemon, MON_DATA_MAIL_STRUCT, DayCareMail_GetMailPtr(daycareMail));
|
||||
}
|
||||
AddMonToParty(party, pokemon);
|
||||
ZeroBoxMonData(boxmon);
|
||||
DayCareMon_SetSteps(daycareMon, 0);
|
||||
FreeToHeap(pokemon);
|
||||
return species;
|
||||
}
|
||||
|
||||
u16 Sav2_DayCare_RetrieveMon(PARTY *party, MSGFMT *msgFmt, DAYCARE *daycare, u8 whomst) {
|
||||
u16 ret;
|
||||
|
||||
ret = Sav2_DayCare_MoveMonToParty(party, Sav2_DayCare_GetMonX(daycare, whomst), msgFmt);
|
||||
Sav2_DayCare_Compaction(daycare);
|
||||
return ret;
|
||||
}
|
||||
|
@ -3036,17 +3036,6 @@ u16 GetEggSpecies(u16 species) {
|
||||
}
|
||||
}
|
||||
|
||||
#define WOTBL_END 0xFFFF
|
||||
#define WOTBL_MOVE_MASK 0x01FF
|
||||
#define WOTBL_MOVE_SHIFT 0
|
||||
#define WOTBL_LVL_MASK 0xFE00
|
||||
#define WOTBL_LVL_SHIFT 9
|
||||
#define WOTBL_MOVE(x) ((u16)(((x) & WOTBL_MOVE_MASK) >> WOTBL_MOVE_SHIFT))
|
||||
#define WOTBL_LVL(x) ((u8)(((x) & WOTBL_LVL_MASK) >> WOTBL_LVL_SHIFT))
|
||||
|
||||
#define WAZA_APPEND_FULL 0xFFFFu
|
||||
#define WAZA_APPEND_KNOWN 0xFFFEu
|
||||
|
||||
void InitBoxMonMoveset(BOXMON * boxmon) {
|
||||
BOOL decry;
|
||||
u16 * wotbl;
|
||||
@ -3062,7 +3051,7 @@ void InitBoxMonMoveset(BOXMON * boxmon) {
|
||||
level = (u8)CalcBoxMonLevel(boxmon);
|
||||
LoadWotbl_HandleAlternateForme(species, (int)forme, wotbl);
|
||||
for (i = 0; wotbl[i] != WOTBL_END; i++) {
|
||||
if ((wotbl[i] & WOTBL_LVL_MASK) > (level << WOTBL_LVL_SHIFT))
|
||||
if ((wotbl[i] & WOTBL_LEVEL_MASK) > (level << WOTBL_LEVEL_SHIFT))
|
||||
break;
|
||||
move = WOTBL_MOVE(wotbl[i]);
|
||||
if (TryAppendBoxMonMove(boxmon, move) == WAZA_APPEND_FULL)
|
||||
@ -3164,14 +3153,14 @@ u32 MonTryLearnMoveOnLevelUp(POKEMON * pokemon, int * last_i, u16 * sp0) {
|
||||
FreeToHeap(wotbl);
|
||||
return 0;
|
||||
}
|
||||
while ((wotbl[*last_i] & WOTBL_LVL_MASK) != (level << WOTBL_LVL_SHIFT)) {
|
||||
while ((wotbl[*last_i] & WOTBL_LEVEL_MASK) != (level << WOTBL_LEVEL_SHIFT)) {
|
||||
(*last_i)++;
|
||||
if (wotbl[*last_i] == WOTBL_END) {
|
||||
FreeToHeap(wotbl);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if ((wotbl[*last_i] & WOTBL_LVL_MASK) == (level << WOTBL_LVL_SHIFT)) {
|
||||
if ((wotbl[*last_i] & WOTBL_LEVEL_MASK) == (level << WOTBL_LEVEL_SHIFT)) {
|
||||
*sp0 = WOTBL_MOVE(wotbl[*last_i]);
|
||||
(*last_i)++;
|
||||
ret = TryAppendMonMove(pokemon, *sp0);
|
||||
@ -3288,14 +3277,14 @@ void CopyPokemonToPokemon(const POKEMON *src, POKEMON *dest) {
|
||||
*dest = *src;
|
||||
}
|
||||
|
||||
void CopyPokemonToBoxPokemon(const POKEMON *src, BOXMON *dest) {
|
||||
*dest = src->box;
|
||||
}
|
||||
|
||||
void CopyBoxPokemonToBoxPokemon(const BOXMON *src, BOXMON *dest) {
|
||||
*dest = *src;
|
||||
}
|
||||
|
||||
void CopyPokemonToBoxPokemon(const POKEMON *src, BOXMON *dest) {
|
||||
*dest = src->box;
|
||||
}
|
||||
|
||||
s8 MonGetFlavorPreference(POKEMON * pokemon, int flavor) {
|
||||
return BoxMonGetFlavorPreference(&pokemon->box, flavor);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user