summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/coins.h13
-rw-r--r--include/options.h13
-rw-r--r--include/player_data.h39
-rw-r--r--include/save_block_2.h38
4 files changed, 66 insertions, 37 deletions
diff --git a/include/coins.h b/include/coins.h
new file mode 100644
index 00000000..f68d44a0
--- /dev/null
+++ b/include/coins.h
@@ -0,0 +1,13 @@
+#ifndef POKEDIAMOND_COINS_H
+#define POKEDIAMOND_COINS_H
+
+#define MAX_COINS 50000
+
+void InitCoins(u16 * coins);
+void SetCoins(u16 * coins, u16 value);
+u16 CheckCoins(u16 * coins);
+BOOL GiveCoins(u16 * coins, u16 amount);
+BOOL CanGiveCoins(u16 * coins, u16 amount);
+BOOL TakeCoins(u16 * coins, u16 amount);
+
+#endif //POKEDIAMOND_COINS_H
diff --git a/include/options.h b/include/options.h
new file mode 100644
index 00000000..4ed466df
--- /dev/null
+++ b/include/options.h
@@ -0,0 +1,13 @@
+#ifndef POKEDIAMOND_OPTIONS_H
+#define POKEDIAMOND_OPTIONS_H
+
+struct Options {
+ u16 unk0_0:4;
+ u16 unk0_4:2;
+ u16 unk0_6:1;
+ u16 unk0_7:1;
+ u16 unk0_8:2;
+ u16 unk0_A:5;
+};
+
+#endif //POKEDIAMOND_OPTIONS_H
diff --git a/include/player_data.h b/include/player_data.h
new file mode 100644
index 00000000..f051b1ce
--- /dev/null
+++ b/include/player_data.h
@@ -0,0 +1,39 @@
+#ifndef POKEDIAMOND_PLAYER_DATA_H
+#define POKEDIAMOND_PLAYER_DATA_H
+
+#include "options.h"
+
+struct SaveBlock2;
+
+struct PlayerData
+{
+ /* 0x00 */ u16 playerName[OT_NAME_LENGTH + 1];
+ /* 0x10 */ u32 playerId;
+ /* 0x14 */ u32 money;
+ /* 0x18 */ u8 gender;
+ /* 0x19 */ u8 language;
+ /* 0x1A */ u8 badges;
+ /* 0x1B */ u8 avatar;
+ /* 0x1C */ u8 field_1C;
+ /* 0x1D */ u8 field_1D_0:1;
+ u8 field_1D_1:1;
+ u8 field_1D_pad:6;
+ /* 0x1E */ u8 padding_1E[2];
+};
+
+struct PlayerDataSav
+{
+ struct Options options;
+ u8 padding[2];
+ struct PlayerData data;
+ u16 field_24;
+ u16 field_26;
+ u32 field_28;
+};
+
+struct Options * LoadPlayerDataAddress(struct SaveBlock2 *);
+struct String * PlayerData_GetPlayerName_NewString(struct PlayerData *, u32 heap_id);
+u32 PlayerData_GetTrainerID(struct PlayerData *);
+u32 PlayerData_GetTrainerGender(struct PlayerData *);
+
+#endif //POKEDIAMOND_PLAYER_DATA_H
diff --git a/include/save_block_2.h b/include/save_block_2.h
index e969bde7..fe052b1d 100644
--- a/include/save_block_2.h
+++ b/include/save_block_2.h
@@ -2,13 +2,7 @@
#define POKEDIAMOND_SAVE_BLOCK_2_H
#include "MATH_crc.h"
-
-struct Options {
- u16 unk0_0:4;
- u16 unk0_4:2;
- u16 unk0_6:10;
- u8 padding[2]; // TODO: finish me
-};
+#include "player_data.h"
struct SavArrayHeader
{
@@ -19,31 +13,6 @@ struct SavArrayHeader
u16 field_E;
};
-struct PlayerData
-{
- /* 0x00 */ u16 playerName[OT_NAME_LENGTH + 1];
- /* 0x10 */ u32 playerId;
- /* 0x14 */ u32 money;
- /* 0x18 */ u8 gender;
- /* 0x19 */ u8 language;
- /* 0x1A */ u8 badges;
- /* 0x1B */ u8 avatar;
- /* 0x1C */ u8 field_1C;
- /* 0x1D */ u8 field_1D_0:1;
- u8 field_1D_1:1;
- u8 field_1D_pad:6;
- /* 0x1E */ u8 padding_1E[2];
-};
-
-struct PlayerDataSav
-{
- struct Options options;
- struct PlayerData data;
- u16 field_24;
- u16 field_26;
- u32 field_28;
-};
-
struct SaveBlock2_Sub_20464 {
u8 unk_0;
u8 padding[3];
@@ -73,11 +42,6 @@ struct SaveBlock2
// TODO: finish this struct
}; // size: 0x204A8
-struct String * PlayerData_GetPlayerName_NewString(struct PlayerData *, u32 heap_id);
-u32 PlayerData_GetTrainerID(struct PlayerData *);
-u32 PlayerData_GetTrainerGender(struct PlayerData *);
void * SavArray_get(struct SaveBlock2 *, int);
-struct Options * LoadPlayerDataAddress(struct SaveBlock2 *);
-
#endif //POKEDIAMOND_SAVE_BLOCK_2_H