summaryrefslogtreecommitdiff
path: root/src/new_game.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/new_game.c')
-rw-r--r--src/new_game.c115
1 files changed, 71 insertions, 44 deletions
diff --git a/src/new_game.c b/src/new_game.c
index d63e50236..33aacd10a 100644
--- a/src/new_game.c
+++ b/src/new_game.c
@@ -1,45 +1,70 @@
#include "global.h"
#include "new_game.h"
-#include "asm.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 "pokemon_size_record.h"
-#include "script.h"
-#include "rom4.h"
+#include "player_pc.h"
+#include "pokeblock.h"
#include "pokedex.h"
-#include "lottery_corner.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"
-extern u8 gUnknown_020297EC;
+extern u8 gDifferentSaveFile;
extern u8 gPlayerPartyCount;
extern u8 gUnknown_03005CE8;
extern u16 gSaveFileStatus;
extern u8 gUnknown_0819FA81[];
-extern const struct SB1_2EFC_Struct gUnknown_08216604;
-void write_word_to_mem(u32 a1, u8 *a2)
+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)
{
- a2[0] = a1;
- a2[1] = a1 >> 8;
- a2[2] = a1 >> 16;
- a2[3] = a1 >> 24;
+ dataPtr[0] = var;
+ dataPtr[1] = var >> 8;
+ dataPtr[2] = var >> 16;
+ dataPtr[3] = var >> 24;
}
-void sub_8052D10(u8 *a1, u8 *a2)
+void copy_word_to_mem(u8 *copyTo, u8 *copyFrom)
{
s32 i;
for (i = 0; i < 4; i++)
- a1[i] = a2[i];
+ copyTo[i] = copyFrom[i];
}
-void set_player_trainer_id(void)
+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;
@@ -50,7 +75,7 @@ void SetDefaultOptions(void)
gSaveBlock2.regionMapZoom = FALSE;
}
-void sub_8052D78(void)
+void ClearPokedexFlags(void)
{
gUnknown_03005CE8 = 0;
memset(&gSaveBlock2.pokedex.owned, 0, sizeof(gSaveBlock2.pokedex.owned));
@@ -60,9 +85,10 @@ void sub_8052D78(void)
void sub_8052DA8(void)
{
s32 i;
+
sub_80B2D1C();
for (i = 0; i < 5; i++)
- gSaveBlock1.sb1_2EFC_struct[i] = gUnknown_08216604;
+ gSaveBlock1.sbStruct.unkSB1.sb1_2EFC_struct[i] = gUnknown_08216604;
}
void sub_8052DE4(void)
@@ -70,7 +96,7 @@ void sub_8052DE4(void)
CpuFill32(0, &gSaveBlock2.filler_A8, sizeof(gSaveBlock2.filler_A8));
}
-void sub_8052E04(void)
+void WarpToTruck(void)
{
warp1_set(25, 40, -1, -1, -1); // inside of truck
warp_in();
@@ -84,7 +110,7 @@ void ClearSav2(void)
void sub_8052E4C(void)
{
- gUnknown_020297EC = 0;
+ gDifferentSaveFile = 0;
sub_808C0A0();
ZeroPlayerPartyMons();
ZeroEnemyPartyMons();
@@ -93,46 +119,47 @@ void sub_8052E4C(void)
void NewGameInitData(void)
{
- if (!gSaveFileStatus || gSaveFileStatus == 2)
+ if (gSaveFileStatus == 0 || gSaveFileStatus == 2)
RtcReset();
- gUnknown_020297EC = 1;
+
+ gDifferentSaveFile = 1;
ZeroPlayerPartyMons();
ZeroEnemyPartyMons();
- sub_808C02C();
+ ResetPokedex();
sub_8052DE4();
memset(&gSaveBlock1, 0, sizeof(gSaveBlock1));
- sub_80A2B18();
+ ClearMailData();
gSaveBlock2.specialSaveWarp = 0;
- set_player_trainer_id();
+ InitPlayerTrainerId();
PlayTimeCounter_Reset();
- sub_8052D78();
- sub_8069030();
- sub_80BD7A8();
- sub_80BDAB4();
- sub_80BB5B4();
- sub_80B4A90();
+ ClearPokedexFlags();
+ InitEventData();
+ ClearTVShowData();
+ ResetGabbyAndTy();
+ ResetSecretBases();
+ ClearBerryTrees();
gSaveBlock1.money = 3000;
- sub_80AB1B0();
- sub_80530AC();
+ ResetLinkContestBoolean();
+ ResetGameStats();
sub_8052DA8();
InitLinkBattleRecords();
InitShroomishSizeRecord();
InitBarboachSizeRecord();
gPlayerPartyCount = 0;
ZeroPlayerPartyMons();
- sub_80961D8();
- sub_81341F8();
- sub_813420C();
+ ResetPokemonStorageSystem();
+ ClearRoamerData();
+ ClearRoamerLocationData();
gSaveBlock1.registeredItem = 0;
- sub_80A3714();
+ ClearBag();
NewGameInitPCItems();
- sub_810C994();
- sub_8133F80();
- sub_80E6764();
- sub_80F7AA4();
- sub_80FA17C();
- sub_810FA54();
- sub_8145A78();
- sub_8052E04();
+ ClearPokeblocks();
+ ClearDecorationInventories();
+ InitEasyChatPhrases();
+ SetMauvilleOldMan();
+ InitDewfordTrend();
+ ResetFanClub();
+ ResetLotteryCorner();
+ WarpToTruck();
ScriptContext2_RunNewScript(gUnknown_0819FA81);
}