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
|
#include "global.h"
#include "new_game.h"
#include "battle_records.h"
#include "berry.h"
#include "contest.h"
#include "decoration_inventory.h"
#include "dewford_trend.h"
#include "easy_chat.h"
#include "event_data.h"
#include "field_specials.h"
#include "item_menu.h"
#include "lottery_corner.h"
#include "mail_data.h"
#include "mauville_old_man.h"
#include "play_time.h"
#include "player_pc.h"
#include "pokeblock.h"
#include "pokedex.h"
#include "pokemon_size_record.h"
#include "pokemon_storage_system.h"
#include "rng.h"
#include "roamer.h"
#include "rom4.h"
#include "rtc.h"
#include "script.h"
#include "secret_base.h"
#include "tv.h"
EWRAM_DATA u8 gDifferentSaveFile = 0;
EWRAM_DATA u8 gUnknown_020297ED = 0;
extern u8 gPlayerPartyCount;
extern u8 gUnknown_03005CE8;
extern u16 gSaveFileStatus;
extern u8 gUnknown_0819FA81[];
const struct SB1_2EFC_Struct gUnknown_08216604 =
{
0x0000,
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}
};
void write_word_to_mem(u32 var, u8 *dataPtr)
{
dataPtr[0] = var;
dataPtr[1] = var >> 8;
dataPtr[2] = var >> 16;
dataPtr[3] = var >> 24;
}
void copy_word_to_mem(u8 *copyTo, u8 *copyFrom)
{
s32 i;
for (i = 0; i < 4; i++)
copyTo[i] = copyFrom[i];
}
void InitPlayerTrainerId(void)
{
write_word_to_mem((Random() << 16) | Random(), gSaveBlock2.playerTrainerId);
}
// L=A isnt set here for some reason.
void SetDefaultOptions(void)
{
gSaveBlock2.optionsTextSpeed = OPTIONS_TEXT_SPEED_MID;
gSaveBlock2.optionsWindowFrameType = 0;
gSaveBlock2.optionsSound = OPTIONS_SOUND_MONO;
gSaveBlock2.optionsBattleStyle = OPTIONS_BATTLE_STYLE_SHIFT;
gSaveBlock2.optionsBattleSceneOff = FALSE;
gSaveBlock2.regionMapZoom = FALSE;
}
void ClearPokedexFlags(void)
{
gUnknown_03005CE8 = 0;
memset(&gSaveBlock2.pokedex.owned, 0, sizeof(gSaveBlock2.pokedex.owned));
memset(&gSaveBlock2.pokedex.seen, 0, sizeof(gSaveBlock2.pokedex.seen));
}
void sub_8052DA8(void)
{
s32 i;
sub_80B2D1C();
for (i = 0; i < 5; i++)
gSaveBlock1.sbStruct.unkSB1.sb1_2EFC_struct[i] = gUnknown_08216604;
}
void sub_8052DE4(void)
{
CpuFill32(0, &gSaveBlock2.filler_A8, sizeof(gSaveBlock2.filler_A8));
}
void WarpToTruck(void)
{
warp1_set(25, 40, -1, -1, -1); // inside of truck
warp_in();
}
void ClearSav2(void)
{
CpuFill16(0, &gSaveBlock2, sizeof(gSaveBlock2));
SetDefaultOptions();
}
void sub_8052E4C(void)
{
gDifferentSaveFile = 0;
sub_808C0A0();
ZeroPlayerPartyMons();
ZeroEnemyPartyMons();
ResetBagScrollPositions();
}
void NewGameInitData(void)
{
if (gSaveFileStatus == 0 || gSaveFileStatus == 2)
RtcReset();
gDifferentSaveFile = 1;
ZeroPlayerPartyMons();
ZeroEnemyPartyMons();
ResetPokedex();
sub_8052DE4();
memset(&gSaveBlock1, 0, sizeof(gSaveBlock1));
ClearMailData();
gSaveBlock2.specialSaveWarp = 0;
InitPlayerTrainerId();
PlayTimeCounter_Reset();
ClearPokedexFlags();
InitEventData();
ClearTVShowData();
ResetGabbyAndTy();
ResetSecretBases();
ClearBerryTrees();
gSaveBlock1.money = 3000;
ResetLinkContestBoolean();
ResetGameStats();
sub_8052DA8();
InitLinkBattleRecords();
InitShroomishSizeRecord();
InitBarboachSizeRecord();
gPlayerPartyCount = 0;
ZeroPlayerPartyMons();
ResetPokemonStorageSystem();
ClearRoamerData();
ClearRoamerLocationData();
gSaveBlock1.registeredItem = 0;
ClearBag();
NewGameInitPCItems();
ClearPokeblocks();
ClearDecorationInventories();
InitEasyChatPhrases();
SetMauvilleOldMan();
InitDewfordTrend();
ResetFanClub();
ResetLotteryCorner();
WarpToTruck();
ScriptContext2_RunNewScript(gUnknown_0819FA81);
}
|