1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
#include "global.h"
#include "asm.h"
#include "link.h"
#include "menu.h"
#include "pokemon.h"
#include "string_util.h"
extern struct Pokemon *unk_2018000;
extern u8 *(gNatureNames[]);
extern const u8 gOtherText_Terminator4[];
extern const u8 gOtherText_Nature[];
extern const u8 gOtherText_Met[];
extern const u8 gOtherText_Egg2[];
extern const u8 gOtherText_ObtainedInTrade[];
extern const u8 gOtherText_FatefulEncounter[];
extern const u8 gOtherText_Met2[];
extern const u8 gOtherText_EggDayCare[];
extern const u8 gOtherText_EggNicePlace[];
extern const u8 gOtherText_EggObtainedInTrade[];
extern const u8 gOtherText_EggHotSprings[];
u8 *sub_80A1E9C(u8 *dest, u8 *src, u8);
u8 PokemonSummaryScreen_CheckOT(struct Pokemon *pokemon);
u8 *PokemonSummaryScreen_CopyPokemonLevel(u8 *dest, u8 level);
u32 GetPlayerTrainerId(void);
bool8 PokemonSummaryScreen_CheckOT(struct Pokemon *mon)
{
u32 trainerId;
if (unk_2018000 == gEnemyParty)
{
u8 enemyId = GetMultiplayerId() ^ 1;
trainerId = gLinkPlayers[enemyId].trainerId & 0xFFFF;
StringCopy(gStringVar1, gLinkPlayers[enemyId].name);
StripExtCtrlCodes(gStringVar1);
}
else
{
trainerId = GetPlayerTrainerId() & 0xFFFF;
StringCopy(gStringVar1, gSaveBlock2.playerName);
}
if (trainerId != (GetMonData(mon, MON_DATA_OT_ID) & 0xFFFF))
return FALSE;
GetMonData(mon, MON_DATA_OT_NAME, gStringVar2);
if (!StringCompareWithoutExtCtrlCodes(gStringVar1, gStringVar2))
return TRUE;
return FALSE;
}
void PokemonSummaryScreen_PrintEggTrainerMemo(struct Pokemon *mon, u8 left, u8 top)
{
u8 locationMet;
u8 gameMet = GetMonData(mon, MON_DATA_MET_GAME);
if (!(gameMet == VERSION_RUBY || gameMet == VERSION_SAPPHIRE || gameMet == VERSION_EMERALD))
{
MenuPrint(gOtherText_EggObtainedInTrade, left, top);
return;
}
locationMet = GetMonData(mon, MON_DATA_MET_LOCATION);
if (locationMet == 255)
{
MenuPrint(gOtherText_EggNicePlace, left, top);
return;
}
if (!PokemonSummaryScreen_CheckOT(mon))
{
MenuPrint(gOtherText_EggObtainedInTrade, left, top);
return;
}
asm(""); // needed to match for some reason
if (locationMet == 253)
{
MenuPrint(gOtherText_EggHotSprings, left, top);
return;
}
MenuPrint(gOtherText_EggDayCare, left, top);
}
void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *pokemon, u8 left, u8 top)
{
u8 locationMet;
u8 gameMet;
u8 *ptr = gStringVar4;
u8 nature = GetNature(pokemon);
ptr = sub_80A1E9C(ptr, gNatureNames[nature], 14);
if (nature != NATURE_BOLD && nature != NATURE_GENTLE)
{
ptr = StringCopy(ptr, gOtherText_Terminator4);
}
ptr = StringCopy(ptr, gOtherText_Nature);
if (PokemonSummaryScreen_CheckOT(pokemon) == TRUE)
{
locationMet = GetMonData(pokemon, MON_DATA_MET_LOCATION);
if (GetMonData(pokemon, MON_DATA_MET_LEVEL) == 0)
{
ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, 5);
*ptr = CHAR_NEWLINE;
ptr++;
CopyLocationName(gStringVar1, locationMet);
ptr = sub_80A1E9C(ptr, gStringVar1, 14);
StringCopy(ptr, gOtherText_Egg2);
}
else if (locationMet >= 88)
{
*ptr = CHAR_NEWLINE;
ptr++;
StringCopy(ptr, gOtherText_ObtainedInTrade);
}
else
{
u8 levelMet = GetMonData(pokemon, MON_DATA_MET_LEVEL);
ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, levelMet);
*ptr = CHAR_NEWLINE;
ptr++;
CopyLocationName(gStringVar1, locationMet);
ptr = sub_80A1E9C(ptr, gStringVar1, 14);
StringCopy(ptr, gOtherText_Met);
}
}
else
{
gameMet = GetMonData(pokemon, MON_DATA_MET_GAME);
if (!(gameMet == VERSION_RUBY || gameMet == VERSION_SAPPHIRE || gameMet == VERSION_EMERALD))
{
*ptr = CHAR_NEWLINE;
ptr++;
StringCopy(ptr, gOtherText_ObtainedInTrade);
}
else
{
locationMet = GetMonData(pokemon, MON_DATA_MET_LOCATION);
if (locationMet == 0xFF)
{
u8 levelMet = GetMonData(pokemon, MON_DATA_MET_LEVEL);
ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, levelMet);
*ptr = CHAR_NEWLINE;
ptr++;
StringCopy(ptr, gOtherText_FatefulEncounter);
}
else if (locationMet >= 88)
{
*ptr = CHAR_NEWLINE;
ptr++;
StringCopy(ptr, gOtherText_ObtainedInTrade);
}
else
{
u8 levelMet = GetMonData(pokemon, MON_DATA_MET_LEVEL);
ptr = PokemonSummaryScreen_CopyPokemonLevel(ptr, levelMet);
*ptr = CHAR_NEWLINE;
ptr++;
CopyLocationName(gStringVar1, locationMet);
ptr = sub_80A1E9C(ptr, gStringVar1, 14);
StringCopy(ptr, gOtherText_Met2);
}
}
}
MenuPrint(gStringVar4, left++, top++);
}
|