summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorultima-soul <akshayjhanji@hotmail.com>2019-10-06 14:47:08 -0700
committerultima-soul <akshayjhanji@hotmail.com>2019-10-06 14:47:08 -0700
commit52d40061ecdb2b47da10083c0359e06df5470eb1 (patch)
tree7ad8e6736a9c43cc7b87b97c4953f8a215359b68
parent0873084a5d143c4e7eab682f7d27a3255ed281b7 (diff)
Resolve review suggestions.
-rw-r--r--include/battle_records.h6
-rw-r--r--include/event_scripts.h3
-rw-r--r--include/global.h14
-rw-r--r--include/new_game.h2
-rw-r--r--src/berry_powder.c14
-rw-r--r--src/mevent.c2
-rw-r--r--src/mevent_server.c2
-rw-r--r--src/mystery_event_script.c2
-rw-r--r--src/new_game.c10
-rw-r--r--sym_ewram.txt5
10 files changed, 31 insertions, 29 deletions
diff --git a/include/battle_records.h b/include/battle_records.h
index 88ff6adc9..97f28a3b0 100644
--- a/include/battle_records.h
+++ b/include/battle_records.h
@@ -1,12 +1,6 @@
#ifndef GUARD_BATTLE_RECORDS_H
#define GUARD_BATTLE_RECORDS_H
-extern u8 gRecordsWindowId;
-
void ClearPlayerLinkBattleRecords(void);
-void UpdatePlayerLinkBattleRecords(s32 battlerId);
-void ShowLinkBattleRecords(void);
-void RemoveRecordsWindow(void);
-void ShowTrainerHillRecords(void);
#endif // GUARD_BATTLE_RECORDS_H
diff --git a/include/event_scripts.h b/include/event_scripts.h
index 310335196..41a7a7bf2 100644
--- a/include/event_scripts.h
+++ b/include/event_scripts.h
@@ -1155,4 +1155,7 @@ extern const u8 EventScript_SafariOutOfBalls[];
extern const u8 EventScript_ItemfinderDigUpUnderfootItem[];
+// new_game
+extern const u8 EventScript_ResetAllMapFlags[];
+
#endif //GUARD_EVENT_SCRIPTS_H
diff --git a/include/global.h b/include/global.h
index c206cf5f1..98dd8ab2c 100644
--- a/include/global.h
+++ b/include/global.h
@@ -205,6 +205,14 @@ struct UnkSaveBlock2Substruct_55C
/* 0x016:0x572 */ u8 unk_16;
}; // size: 0x018
+struct UnkSaveBlock2Substruct_B0
+{
+ /* 0x000:0x0B0 */ u8 field_0[0x3F0];
+ /* 0x3F0:0x4A0 */ u32 field_3F0[0x2F];
+ /* 0x4AC:0x55C */ struct UnkSaveBlock2Substruct_55C field_4AC;
+ /* 0x4C4:0x574 */ u8 field_4C4[0x324];
+}; // size: 0x7E8
+
struct SaveBlock2
{
/*0x000*/ u8 playerName[PLAYER_NAME_LENGTH];
@@ -230,11 +238,7 @@ struct SaveBlock2
/*0x0AC*/ u8 field_AC;
/*0x0AD*/ u8 field_AD;
/*0x0AE*/ u8 filler_AE[0x2];
- /*0x0B0*/ u8 field_B0;
- /*0x0B1*/ u8 filler_B1[0x3EF];
- /*0x4A0*/ u32 unk_4A0[0x2F];
- /*0x55c*/ struct UnkSaveBlock2Substruct_55C unk_55C;
- /*0x574*/ u8 filler_574[0x324];
+ /*0x0B0*/ struct UnkSaveBlock2Substruct_B0 unk_B0;
/*0x898*/ u16 mapView[0x100];
/*0xA98*/ struct LinkBattleRecords linkBattleRecords;
/*0xAF0*/ struct BerryCrush berryCrush;
diff --git a/include/new_game.h b/include/new_game.h
index eedaea724..ed40546ba 100644
--- a/include/new_game.h
+++ b/include/new_game.h
@@ -1,6 +1,8 @@
#ifndef GUARD_NEW_GAME_H
#define GUARD_NEW_GAME_H
+#include "global.h"
+
void SetTrainerId(u32 trainerId, u8 *dst);
void CopyTrainerId(u8 *dst, u8 *src);
void NewGameInitData(void);
diff --git a/src/berry_powder.c b/src/berry_powder.c
index ad824b24b..992e82522 100644
--- a/src/berry_powder.c
+++ b/src/berry_powder.c
@@ -11,7 +11,7 @@
EWRAM_DATA u8 gUnknown_203F464 = 0;
-u32 sub_815EE3C(u32 * a0)
+u32 DecryptBerryPowder(u32 * a0)
{
return *a0 ^ gSaveBlock2Ptr->encryptionKey;
}
@@ -28,7 +28,7 @@ void sub_815EE6C(u32 a0)
bool8 sub_815EE88(u32 a0)
{
- if (sub_815EE3C(&gSaveBlock2Ptr->berryCrush.berryPowderAmount) < a0)
+ if (DecryptBerryPowder(&gSaveBlock2Ptr->berryCrush.berryPowderAmount) < a0)
return FALSE;
else
return TRUE;
@@ -36,7 +36,7 @@ bool8 sub_815EE88(u32 a0)
bool8 sub_815EEB0(void)
{
- if (sub_815EE3C(&gSaveBlock2Ptr->berryCrush.berryPowderAmount) < gSpecialVar_0x8004)
+ if (DecryptBerryPowder(&gSaveBlock2Ptr->berryCrush.berryPowderAmount) < gSpecialVar_0x8004)
return FALSE;
else
return TRUE;
@@ -45,7 +45,7 @@ bool8 sub_815EEB0(void)
bool8 sub_815EEE0(u32 a0)
{
u32 * ptr = &gSaveBlock2Ptr->berryCrush.berryPowderAmount;
- u32 amount = sub_815EE3C(ptr) + a0;
+ u32 amount = DecryptBerryPowder(ptr) + a0;
if (amount > 99999)
{
SetBerryPowder(ptr, 99999);
@@ -65,7 +65,7 @@ bool8 sub_815EF20(u32 a0)
return FALSE;
else
{
- u32 amount = sub_815EE3C(ptr);
+ u32 amount = DecryptBerryPowder(ptr);
SetBerryPowder(ptr, amount - a0);
return TRUE;
}
@@ -78,7 +78,7 @@ bool8 sub_815EF5C(void)
return FALSE;
else
{
- u32 amount = sub_815EE3C(ptr);
+ u32 amount = DecryptBerryPowder(ptr);
SetBerryPowder(ptr, amount - gSpecialVar_0x8004);
return TRUE;
}
@@ -86,7 +86,7 @@ bool8 sub_815EF5C(void)
u32 GetBerryPowder(void)
{
- return sub_815EE3C(&gSaveBlock2Ptr->berryCrush.berryPowderAmount);
+ return DecryptBerryPowder(&gSaveBlock2Ptr->berryCrush.berryPowderAmount);
}
void sub_815EFBC(u8 windowId, u32 powder, u8 x, u8 y, u8 speed)
diff --git a/src/mevent.c b/src/mevent.c
index b03f1ffe9..78880c228 100644
--- a/src/mevent.c
+++ b/src/mevent.c
@@ -588,7 +588,7 @@ void DestroyWonderCard(void)
ClearRamScript();
sub_806E2D0();
sub_806E370();
- sub_80E7524(gSaveBlock2Ptr->unk_4A0);
+ sub_80E7524(gSaveBlock2Ptr->unk_B0.field_3F0);
}
bool32 sub_8143F68(const struct MEventBuffer_32E0_Sub * data)
diff --git a/src/mevent_server.c b/src/mevent_server.c
index 1c2dc4ced..4e2b7280d 100644
--- a/src/mevent_server.c
+++ b/src/mevent_server.c
@@ -226,7 +226,7 @@ static u32 ish_mainseq_4(struct mevent_client * svr)
sub_8069EA4(svr->recvBuffer, 1000);
break;
case 18:
- memcpy(gSaveBlock2Ptr->unk_4A0, svr->recvBuffer, 0xbc);
+ memcpy(gSaveBlock2Ptr->unk_B0.field_3F0, svr->recvBuffer, 0xbc);
ValidateEReaderTrainer();
break;
case 21:
diff --git a/src/mystery_event_script.c b/src/mystery_event_script.c
index 70566ca58..89df1ee34 100644
--- a/src/mystery_event_script.c
+++ b/src/mystery_event_script.c
@@ -281,7 +281,7 @@ bool8 MEScrCmd_givepokemon(struct ScriptContext *ctx)
bool8 MEScrCmd_addtrainer(struct ScriptContext *ctx)
{
u32 data = ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0];
- memcpy(gSaveBlock2Ptr->unk_4A0, (void *)data, 0xBC);
+ memcpy(gSaveBlock2Ptr->unk_B0.field_3F0, (void *)data, 0xBC);
ValidateEReaderTrainer();
StringExpandPlaceholders(gStringVar4, gText_MysteryGiftNewTrainer);
ctx->data[2] = 2;
diff --git a/src/new_game.c b/src/new_game.c
index 3b10d7ddd..58deac9b9 100644
--- a/src/new_game.c
+++ b/src/new_game.c
@@ -29,8 +29,7 @@
#include "script.h"
#include "berry_powder.h"
#include "pokemon_jump.h"
-
-extern const u8 EventScript_ResetAllMapFlags[];
+#include "event_scripts.h"
// this file's functions
static void ResetMiniGamesResults(void);
@@ -78,7 +77,7 @@ static void ClearPokedexFlags(void)
static void sub_80549D4(void)
{
- CpuFill32(0, &gSaveBlock2Ptr->field_B0, (u32) &gSaveBlock2Ptr->mapView - (u32) &gSaveBlock2Ptr->field_B0);
+ CpuFill32(0, &gSaveBlock2Ptr->unk_B0, sizeof(gSaveBlock2Ptr->unk_B0));
}
static void WarpToPlayersRoom(void)
@@ -95,7 +94,7 @@ void Sav2_ClearSetDefault(void)
void ResetMenuAndMonGlobals(void)
{
- gDifferentSaveFile = 0;
+ gDifferentSaveFile = FALSE;
ZeroPlayerPartyMons();
ZeroEnemyPartyMons();
sub_81089BC();
@@ -111,7 +110,7 @@ void NewGameInitData(void)
u8 rivalName[PLAYER_NAME_LENGTH];
StringCopy(rivalName, gSaveBlock1Ptr->rivalName);
- gDifferentSaveFile = 1;
+ gDifferentSaveFile = TRUE;
gSaveBlock2Ptr->encryptionKey = 0;
ZeroPlayerPartyMons();
ZeroEnemyPartyMons();
@@ -160,4 +159,3 @@ static void ResetMiniGamesResults(void)
ResetPokeJumpResults();
CpuFill16(0, &gSaveBlock2Ptr->berryPick, sizeof(struct BerryPickingResults));
}
- \ No newline at end of file
diff --git a/sym_ewram.txt b/sym_ewram.txt
index 109f4d89a..8ef93ab54 100644
--- a/sym_ewram.txt
+++ b/sym_ewram.txt
@@ -485,9 +485,10 @@ gUnknown_2031DA8: @ 2031DA8
gUnknown_2031DAC: @ 2031DAC
.space 0x4
-gDifferentSaveFile: @ 2031DB0
- .space 0x4
+ .align 2
+ .include "src/new_game.o"
+ .align 2
gUnknown_2031DB4: @ 2031DB4
.space 0x8