diff options
Diffstat (limited to 'src/new_game.c')
-rw-r--r-- | src/new_game.c | 58 |
1 files changed, 37 insertions, 21 deletions
diff --git a/src/new_game.c b/src/new_game.c index 3225ba2bd..4f93e4e3c 100644 --- a/src/new_game.c +++ b/src/new_game.c @@ -1,9 +1,16 @@ #include "global.h" +#include "new_game.h" +#include "asm.h" +#include "berry.h" +#include "play_time.h" +#include "pokemon_size_record.h" +#include "script.h" +#include "rom4.h" +#include "pokedex.h" +#include "lottery_corner.h" #include "rng.h" #include "rtc.h" -#include "pokemon.h" - -extern void warp1_set(s8, s8, s8, s8, s8); +#include "event_data.h" extern u8 gUnknown_020297EC; @@ -12,21 +19,29 @@ 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 = +{ + { + 0x00, 0x00, 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) @@ -34,6 +49,7 @@ void set_player_trainer_id(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; @@ -44,7 +60,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)); @@ -61,10 +77,10 @@ void sub_8052DA8(void) void sub_8052DE4(void) { - CpuFill32(0, gSaveBlock2.filler_A8, sizeof(gSaveBlock2.filler_A8)); + 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(); @@ -96,18 +112,18 @@ void NewGameInitData(void) sub_8052DE4(); memset(&gSaveBlock1, 0, sizeof(gSaveBlock1)); sub_80A2B18(); - gSaveBlock2.sb2_field_9 = 0; + gSaveBlock2.specialSaveWarp = 0; set_player_trainer_id(); PlayTimeCounter_Reset(); - sub_8052D78(); - sub_8069030(); + ClearPokedexFlags(); + InitEventData(); sub_80BD7A8(); sub_80BDAB4(); sub_80BB5B4(); - sub_80B4A90(); + ClearBerryTrees(); gSaveBlock1.money = 3000; sub_80AB1B0(); - sub_80530AC(); + ResetGameStats(); sub_8052DA8(); InitLinkBattleRecords(); InitShroomishSizeRecord(); @@ -126,7 +142,7 @@ void NewGameInitData(void) sub_80F7AA4(); sub_80FA17C(); sub_810FA54(); - sub_8145A78(); - sub_8052E04(); + ResetLotteryCorner(); + WarpToTruck(); ScriptContext2_RunNewScript(gUnknown_0819FA81); } |