summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/bag.h79
-rw-r--r--include/constants/items.h9
-rw-r--r--include/main.h2
-rw-r--r--include/pokemon.h2
-rw-r--r--include/save_block_2.h30
-rw-r--r--include/sound.h4
6 files changed, 110 insertions, 16 deletions
diff --git a/include/bag.h b/include/bag.h
new file mode 100644
index 00000000..14735443
--- /dev/null
+++ b/include/bag.h
@@ -0,0 +1,79 @@
+#ifndef POKEDIAMOND_BAG_H
+#define POKEDIAMOND_BAG_H
+
+#include "itemtool.h"
+#include "save_block_2.h"
+
+struct Bag
+{
+ struct ItemSlot items[NUM_BAG_ITEMS];
+ struct ItemSlot keyItems[NUM_BAG_KEY_ITEMS];
+ struct ItemSlot TMsHMs[NUM_BAG_TMS_HMS];
+ struct ItemSlot mail[NUM_BAG_MAIL];
+ struct ItemSlot medicine[NUM_BAG_MEDICINE];
+ struct ItemSlot berries[NUM_BAG_BERRIES];
+ struct ItemSlot balls[NUM_BAG_BALLS];
+ struct ItemSlot battleItems[NUM_BAG_BATTLE_ITEMS];
+ u32 registeredItem;
+};
+
+struct BagView
+{
+ struct ItemSlot * slots;
+ u32 count;
+ u8 pocket;
+};
+
+struct UnkStruct_0206F164
+{
+ u8 unk_00[8];
+ u8 unk_08[8];
+ u16 unk_10;
+ u8 filler_12[2];
+ u8 unk_14[5];
+ u8 unk_19[5];
+ u16 unk_1e;
+ u16 unk_20;
+ u16 unk_22;
+};
+
+u32 Sav2_Bag_sizeof(void);
+struct Bag * Sav2_Bag_new(u32 heap_id);
+void Sav2_Bag_init(struct Bag * bag);
+void Sav2_Bag_copy(const struct Bag * src, struct Bag * dest);
+u32 Bag_GetRegisteredItem(struct Bag * bag);
+void Bag_SetRegisteredItem(struct Bag * bag, u32 item);
+u32 Bag_GetItemPocket(struct Bag * bag, u16 item_id, struct ItemSlot ** slot_p, u32 * count_p, u32 heap_id);
+struct ItemSlot * Pocket_GetItemSlotForAdd(struct ItemSlot * slots, u32 count, u16 item_id, u16 quantity, u16 maxquantity);
+struct ItemSlot * Bag_GetItemSlotForAdd(struct Bag * bag, u16 item_id, u16 quantity, u32 heap_id);
+BOOL Bag_HasSpaceForItem(struct Bag * bag, u16 item_id, u16 quantity, u32 heap_id);
+BOOL Bag_AddItem(struct Bag * bag, u16 item_id, u16 quantity, u32 heap_id);
+struct ItemSlot * Pocket_GetItemSlotForRemove(struct ItemSlot * slots, u32 count, u16 item_id, u16 quantity);
+struct ItemSlot * Bag_GetItemSlotForRemove(struct Bag * bag, u16 item_id, u16 quantity, u32 heap_id);
+BOOL Bag_TakeItem(struct Bag * bag, u16 item_id, u16 quantity, u32 heap_id);
+BOOL Pocket_TakeItem(struct ItemSlot * slots, u32 count, u16 item_id, u16 quantity);
+BOOL Bag_HasItem(struct Bag * bag, u16 item_id, u16 quantity, u32 heap_id);
+BOOL Bag_PocketNotEmpty(struct Bag * bag, u32 pocket);
+u16 Bag_GetQuantity(struct Bag * bag, u16 item_id, u32 heap_id);
+u16 Pocket_GetQuantity(struct ItemSlot * slots, u32 count, u16 item_id);
+void SwapItemSlots(struct ItemSlot * a, struct ItemSlot * b);
+void PocketCompaction(struct ItemSlot * slots, u32 count);
+void SortPocket(struct ItemSlot * slots, u32 count);
+struct BagView * CreateBagView(struct Bag * bag, const u8 * pockets, u32 heap_id);
+struct ItemSlot * Bag_GetPocketSlotN(struct Bag * bag, u32 pocket, u32 slot);
+struct Bag * Sav2_Bag_get(struct SaveBlock2 * sav2);
+struct UnkStruct_0206F164 * FUN_0206F164(u32 heap_id);
+void FUN_0206F17C(struct UnkStruct_0206F164 * a0, u32 a1, u8 * a2, u8 * a3);
+u16 FUN_0206F18C(struct UnkStruct_0206F164 * a0);
+void FUN_0206F190(struct UnkStruct_0206F164 * a0, u32 a1, u8 a2, u8 a3);
+void FUN_0206F19C(struct UnkStruct_0206F164 * a0, u16 a1);
+void FUN_0206F1A0(struct UnkStruct_0206F164 * a0, u32 a1, u8 * a2, u8 * a3);
+u16 FUN_0206F1AC(struct UnkStruct_0206F164 * a0);
+u16 FUN_0206F1B0(struct UnkStruct_0206F164 * a0);
+u16 FUN_0206F1B4(struct UnkStruct_0206F164 * a0);
+void FUN_0206F1B8(struct UnkStruct_0206F164 * a0, u32 a1, u8 a2, u8 a3);
+void FUN_0206F1C0(struct UnkStruct_0206F164 * a0);
+void FUN_0206F1E4(struct UnkStruct_0206F164 * a0, u16 a1, u16 a2);
+void FUN_0206F1EC(struct UnkStruct_0206F164 * a0, u16 a1);
+
+#endif //POKEDIAMOND_BAG_H
diff --git a/include/constants/items.h b/include/constants/items.h
index 5fb58947..f1649cf3 100644
--- a/include/constants/items.h
+++ b/include/constants/items.h
@@ -10,6 +10,15 @@
#define POCKET_BATTLE_ITEMS 6
#define POCKET_KEY_ITEMS 7
+#define NUM_BAG_ITEMS 165
+#define NUM_BAG_KEY_ITEMS 50
+#define NUM_BAG_TMS_HMS 100
+#define NUM_BAG_MAIL 12
+#define NUM_BAG_MEDICINE 40
+#define NUM_BAG_BERRIES 64
+#define NUM_BAG_BALLS 15
+#define NUM_BAG_BATTLE_ITEMS 30
+
#define HOLD_EFFECT_NONE 0
#define HOLD_EFFECT_HP_RESTORE 1
#define HOLD_EFFECT_DIALGA_BOOST 2
diff --git a/include/main.h b/include/main.h
index b61e68b9..a01f06ce 100644
--- a/include/main.h
+++ b/include/main.h
@@ -105,6 +105,6 @@ void FUN_02000EE8(void);
void DoSoftReset(u32 parameter);
void FUN_02000F4C(u32 arg0, u32 arg1);
void InitializeMainRNG(void);
-void FUN_02000FE8(void);
+void HandleDSLidAction(void);
#endif //GUARD_MAIN_H
diff --git a/include/pokemon.h b/include/pokemon.h
index 1ab3c401..d3be0c34 100644
--- a/include/pokemon.h
+++ b/include/pokemon.h
@@ -273,7 +273,7 @@ BOOL FUN_020690E8(struct Pokemon * pokemon);
u32 FUN_02069698(struct Pokemon * pokemon, u16 move);
void FUN_02069708(struct Pokemon * pokemon, u16 move);
void FUN_02069718(struct BoxPokemon * boxmon, u16 move);
-void FUN_020697CC(struct Pokemon * pokemon, u16 move, u8 slot);
+void MonSetMoveInSlot(struct Pokemon * pokemon, u16 move, u8 slot);
u32 FUN_02069818(struct Pokemon * pokemon, u32 * r5, u16 * sp0);
void FUN_020698E0(struct Pokemon * pokemon, int slot1, int slot2);
void FUN_020698E8(struct BoxPokemon * boxmon, int slot1, int slot2);
diff --git a/include/save_block_2.h b/include/save_block_2.h
index fe052b1d..5257b11d 100644
--- a/include/save_block_2.h
+++ b/include/save_block_2.h
@@ -13,31 +13,37 @@ struct SavArrayHeader
u16 field_E;
};
+struct SavArrayFooter
+{
+ u32 magic;
+ u32 next;
+ u32 size;
+ u16 id;
+ u16 crc;
+};
+
struct SaveBlock2_Sub_20464 {
- u8 unk_0;
- u8 padding[3];
- int unk_4;
- int unk_8;
- u8 unk_C;
- u8 unk_D;
- u8 unk_E;
- u8 padding2;
+ u32 unk_0;
+ u32 offset;
+ u32 size;
};
struct SaveBlock2
{
- /* 0x00000 */ int unk_00000;
+ /* 0x00000 */ int flashType;
/* 0x00004 */ int unk_00004;
/* 0x00008 */ int unk_00008;
/* 0x0000C */ int unk_0000C;
/* 0x00010 */ int unk_00010;
- /* 0x00014 */ struct MATHCRC16Table unk_00014;
+ /* 0x00014 */ struct MATHCRC16Table crcTable;
/* 0x00214 */ u8 dynamic_region[0x20000];
/* 0x20214 */ int unk_20214;
/* 0x20218 */ u8 unk_20218[8];
- /* 0x20220 */ int unk_20220;
+ /* 0x20220 */ u8 unk_20220[2];
+ /* 0x20222 */ u8 filler_20222[2];
/* 0x20224 */ struct SavArrayHeader arrayHeaders[36];
- /* 0x20464 */ struct SaveBlock2_Sub_20464 unk_20464[4];
+ /* 0x20464 */ struct SaveBlock2_Sub_20464 saveSlotSpecs[2];
+ /* 0x2047C */ u8 filler_2047C[0x28];
/* 0x204A4 */ int unk_204A4;
// TODO: finish this struct
}; // size: 0x204A8
diff --git a/include/sound.h b/include/sound.h
index 6e78bfa4..9cec824d 100644
--- a/include/sound.h
+++ b/include/sound.h
@@ -42,7 +42,7 @@ struct SoundData
u32 unk_BCD3C;
u64 unk_BCD40;
u32 unk_BCD48;
- u32 unk_BCD4C;
+ void * unk_BCD4C;
u32 unk_BCD50;
u32 unk_BCD54;
u32 unk_BCD58;
@@ -50,7 +50,7 @@ struct SoundData
};
struct SoundData * GetSoundDataPointer(void);
-void InitSoundData(u32 a0, struct Options * a1);
+void InitSoundData(void * a0, struct Options * a1);
void * FUN_02003D38(u32 a0);
int FUN_02003F3C(int * a0);
void FUN_02003F64(int a0);