blob: cae46bc823f51ba7e1d3058a22b7090631a1cf75 (
plain)
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
|
#include "global.h"
#include "memory.h"
#include "item.h"
#include "friend_area.h"
#include "constants/friend_area.h"
#include "sub_8095228.h"
#include "wonder_mail.h"
#include "constants/wonder_mail.h"
struct subStruct_203B490
{
// size: 0xC
u8 unk0;
u8 unk1;
u32 unk4;
u32 unk8;
};
struct unkStruct_203B490
{
// size: 0x330?
u8 fill0[0x190];
u8 unk190[0x28];
u8 unk1B8[0x78];
struct subStruct_203B490 unk230[16];
u8 unk2F0[0x38];
u8 unk328;
};
extern bool8 sub_809095C(u8);
extern s32 sub_8090298(u8);
extern bool8 sub_809017C(u8 *);
extern s16 GetBaseSpecies(s16);
extern bool8 IsInvalidItemReward(u8);
extern u8 sub_803C1D0(u8 *, u8);
extern bool8 IsNotMoneyOrUsedTMItem(u8);
extern u8 xxx_bit_lut_lookup_8091E50(u8 ,u8 );
extern u32 GetMaxItemCount(u8);
extern u8 sub_803C0DC(s16);
extern void sub_8096040(u8);
extern void sub_80965B8(u8);
extern void sub_8096C3C(u8);
extern bool8 ValidateWonderMail(struct WonderMail *);
extern struct unkStruct_203B490 *gUnknown_203B490;
extern struct unkStruct_203B490 gUnknown_2039448;
void sub_80958E8()
{
gUnknown_203B490 = &gUnknown_2039448;
}
struct unkStruct_203B490 *sub_80958F8(void)
{
return &gUnknown_2039448;
}
void sub_8095900(void)
{
s32 iVar2;
for(iVar2 = 0; iVar2 < 4; iVar2++)
{
sub_8096040(iVar2);
}
for(iVar2 = 0; iVar2 < 8; iVar2++)
{
sub_80965B8(iVar2);
}
for(iVar2 = 0; iVar2 < 8; iVar2++)
{
sub_8096C3C(iVar2);
}
for(iVar2 = 0; iVar2 < 0x38; iVar2++)
{
gUnknown_203B490->unk2F0[iVar2] = 0;
}
gUnknown_203B490->unk328 = 0;
MemoryClear8(gUnknown_203B490->unk190, sizeof(gUnknown_203B490->unk190));
MemoryClear8(gUnknown_203B490->unk1B8, sizeof(gUnknown_203B490->unk1B8));
for(iVar2 = 0; iVar2 < 16; iVar2++)
{
gUnknown_203B490->unk230[iVar2].unk0 = 99;
gUnknown_203B490->unk230[iVar2].unk1 = 1;
gUnknown_203B490->unk230[iVar2].unk4 = 0;
gUnknown_203B490->unk230[iVar2].unk8 = 0;
}
}
bool8 IsValidWonderMail(struct WonderMail *WonderMailData)
{
// Has to equal 5 for Wonder Mail
// https://web.archive.org/web/20080913124416/http://www.upokecenter.com/games/dungeon/guides/passwords.html
//
if(WonderMailData->mailType != WONDER_MAIL_TYPE_WONDER)
{
return FALSE;
}
else
{
return ValidateWonderMail(WonderMailData);
}
}
bool8 ValidateWonderMail(struct WonderMail *data)
{
if(data->missionType > WONDER_MAIL_MISSION_TYPE_DELIVER_ITEM)
return FALSE;
else
{
if(data->missionType == WONDER_MAIL_MISSION_TYPE_DELIVER_ITEM && GetMaxItemCount(data->dungeon) == 0)
return FALSE;
if(data->unk2 > 9)
return FALSE;
if(sub_809095C(data->dungeon))
return FALSE;
if(data->floor >= sub_8090298(data->dungeon))
return FALSE;
if(sub_809017C(&(data->dungeon)))
return FALSE;
if(data->clientSpecies == SPECIES_NONE)
return FALSE;
if(data->clientSpecies > SPECIES_RAYQUAZA_CUTSCENE)
return FALSE;
if(data->clientSpecies != GetBaseSpecies(data->clientSpecies))
return FALSE;
if(sub_803C0DC(data->clientSpecies) == 0)
return FALSE;
if(data->targetSpecies > SPECIES_RAYQUAZA_CUTSCENE)
return FALSE;
if(data->targetSpecies != GetBaseSpecies(data->targetSpecies))
return FALSE;
if(sub_803C0DC(data->targetSpecies) == 0)
return FALSE;
// Item Delivery/Finding
if((u8)(data->missionType - 1) > WONDER_MAIL_MISSION_TYPE_RESCUE_TARGET)
if(data->targetSpecies != data->clientSpecies)
return FALSE;
if(IsInvalidItemReward(data->targetItem))
return FALSE;
if(IsThrowableItem(data->targetItem))
return FALSE;
if(!IsNotMoneyOrUsedTMItem(data->targetItem))
return FALSE;
// Item finding
if(data->missionType == WONDER_MAIL_MISSION_TYPE_FIND_ITEM && xxx_bit_lut_lookup_8091E50(data->dungeon, data->targetItem) == 0)
return FALSE;
if(data->rewardType == BLANK_4 || data->rewardType == END_REWARDS || data->rewardType > END_REWARDS)
return FALSE;
if(IsInvalidItemReward(data->itemReward))
return FALSE;
// Friend Area Reward
if(data->friendAreaReward > FINAL_ISLAND)
return FALSE;
if(data->rewardType == FRIEND_AREA)
{
if(GetFriendAreaUnlockCondition(data->friendAreaReward) != UNLOCK_WONDER_MAIL)
return FALSE;
if(sub_803C1D0(&(data->dungeon), data->missionType) == 0)
return FALSE;
}
return TRUE;
}
}
|