summaryrefslogtreecommitdiff
path: root/include/Item
diff options
context:
space:
mode:
authorAetias <aetias@outlook.com>2025-02-04 21:30:00 +0100
committerAetias <aetias@outlook.com>2025-02-04 21:30:00 +0100
commitc380ac51a48d17348b1cdcbb615ce22be22f409e (patch)
tree6713ed5a1cd172f665e52ea0f995fc905ca3db2d /include/Item
parent8cda3ca2d7f5fe424cc1a649baec2ff992368e62 (diff)
parent3f7197110627adbbe7ff1f69db1f5a15f9b6c598 (diff)
Merge remote-tracking branch 'zeldaret/main' into decomp-PlayerControl
Diffstat (limited to 'include/Item')
-rw-r--r--include/Item/Item.hpp73
-rw-r--r--include/Item/ItemManager.hpp119
-rw-r--r--include/Item/ItemModelLoader.hpp29
3 files changed, 112 insertions, 109 deletions
diff --git a/include/Item/Item.hpp b/include/Item/Item.hpp
index 1b67ada3..4d70c9f1 100644
--- a/include/Item/Item.hpp
+++ b/include/Item/Item.hpp
@@ -2,6 +2,8 @@
#include "types.h"
+#define MAX_POTIONS 2
+
typedef s32 ItemFlag;
enum ItemFlag_ {
ItemFlag_None = -1,
@@ -233,6 +235,77 @@ enum ItemId_ {
/* 0x88 */ ItemId_Unk_136 = 136,
};
+enum Gem {
+ Gem_Courage,
+ Gem_Power,
+ Gem_Wisdom,
+ Gem_COUNT,
+};
+
+typedef u32 ShipPart;
+enum ShipPart_ {
+ ShipPart_Anchor,
+ ShipPart_Prow,
+ ShipPart_Hull,
+ ShipPart_Cannon,
+ ShipPart_Handrail,
+ ShipPart_Wheel,
+ ShipPart_Chimney,
+ ShipPart_Bridge,
+ ShipPart_COUNT,
+};
+
+typedef u32 ShipType;
+enum ShipType_ {
+ ShipType_Linebeck,
+ ShipType_Bright,
+ ShipType_Iron,
+ ShipType_Stone,
+ ShipType_Vintage,
+ ShipType_Demon,
+ ShipType_Tropical,
+ ShipType_Dignified,
+ ShipType_Golden,
+ ShipType_COUNT,
+};
+
+typedef u32 ShipItem;
+#define SHIP_ITEM(part, ship) (ShipPart_##part * ShipPart_COUNT + ShipType_##type)
+#define ShipItem_COUNT (ShipPart_COUNT * ShipType_COUNT)
+
+typedef u32 Treasure;
+enum Treasure_ {
+ Treasure_PinkCoral,
+ Treasure_WhitePearlLoop,
+ Treasure_DarkPearlLoop,
+ Treasure_ZoraScale,
+ Treasure_GoronAmber,
+ Treasure_RutoCrown,
+ Treasure_HelmarocPlume,
+ Treasure_RegalRing,
+
+ Treasure_COUNT,
+};
+
+typedef u8 Potion;
+enum Potion_ {
+ Potion_None,
+ Potion_Red,
+ Potion_Purple,
+ Potion_Yellow,
+ Potion_COUNT,
+};
+
+struct ItemFlags {
+ /* 00 */ u32 flags[CEIL_DIV(ItemFlag_COUNT, 32)];
+ /* 10 */
+};
+
+struct ShipPartPricesShown {
+ /* 0 */ u32 flags[CEIL_DIV(ShipItem_COUNT, 32)];
+ /* c */
+};
+
namespace Item {
bool func_ov00_020ad020(ItemId item);
bool func_ov00_020ad068(ItemId item);
diff --git a/include/Item/ItemManager.hpp b/include/Item/ItemManager.hpp
index 3599c17c..00a9e52e 100644
--- a/include/Item/ItemManager.hpp
+++ b/include/Item/ItemManager.hpp
@@ -5,25 +5,20 @@ extern "C" {
}
#include "global.h"
-#include "lib/math.h"
+#include "nds/math.h"
#include "types.h"
-#include "Actor/ActorNaviBase.hpp"
-#include "DTCM/UnkStruct_027e0f78.hpp"
+#include "Actor/Navi/ActorNaviBase.hpp"
#include "Item/Item.hpp"
-#include "Map/MapManager.hpp"
#include "Player/EquipItem.hpp"
-#include "Player/HealthManager.hpp"
#include "Render/ModelRender.hpp"
-#include "Save/AdventureFlags.hpp"
+#include "Save/SaveItemManager.hpp"
#include "Sound/Sfx.hpp"
-#include "System/OverlayManager.hpp"
#include "System/SysNew.hpp"
#define MAX_HOURGLASS_SECONDS 1500 // 25 minutes
#define MAX_AMMO_UPGRADE 2
#define MAX_UNK_0BA 9
-#define MAX_POTIONS 2
typedef s32 FairyId;
enum FairyId_ {
@@ -34,78 +29,6 @@ enum FairyId_ {
FairyId_COUNT = 3,
};
-enum Gem {
- Gem_Courage,
- Gem_Power,
- Gem_Wisdom,
- Gem_COUNT,
-};
-
-typedef u32 ShipPart;
-enum ShipPart_ {
- ShipPart_Anchor,
- ShipPart_Prow,
- ShipPart_Hull,
- ShipPart_Cannon,
- ShipPart_Handrail,
- ShipPart_Wheel,
- ShipPart_Chimney,
- ShipPart_Bridge,
- ShipPart_COUNT,
-};
-
-typedef u32 ShipType;
-enum ShipType_ {
- ShipType_Linebeck,
- ShipType_Bright,
- ShipType_Iron,
- ShipType_Stone,
- ShipType_Vintage,
- ShipType_Demon,
- ShipType_Tropical,
- ShipType_Dignified,
- ShipType_Golden,
- ShipType_COUNT,
-};
-
-typedef u32 ShipItem;
-#define SHIP_ITEM(part, ship) (ShipPart_##part * ShipPart_COUNT + ShipType_##type)
-#define ShipItem_COUNT (ShipPart_COUNT * ShipType_COUNT)
-
-typedef u32 Treasure;
-enum Treasure_ {
- Treasure_PinkCoral,
- Treasure_WhitePearlLoop,
- Treasure_DarkPearlLoop,
- Treasure_ZoraScale,
- Treasure_GoronAmber,
- Treasure_RutoCrown,
- Treasure_HelmarocPlume,
- Treasure_RegalRing,
-
- Treasure_COUNT,
-};
-
-#define NUM_POTIONS 2
-typedef u8 Potion;
-enum Potion_ {
- Potion_None,
- Potion_Red,
- Potion_Purple,
- Potion_Yellow,
- Potion_COUNT,
-};
-
-struct ItemFlags {
- /* 00 */ u32 flags[CEIL_DIV(ItemFlag_COUNT, 32)];
- /* 10 */
-};
-
-struct ShipPartPricesShown {
- /* 0 */ u32 flags[CEIL_DIV(ShipItem_COUNT, 32)];
- /* c */
-};
-
typedef u32 ItemModelId;
enum ItemModelId_ {
ItemModelId_OshusSword, // swA
@@ -136,35 +59,6 @@ enum DungeonItemModelId_ {
DungeonItemModelId_COUNT,
};
-struct SaveItemManager {
- /* 00 */ ItemFlags itemFlags;
- /* 10 */ u32 salvagedTreasureFlags;
- /* 14 */ ShipPartPricesShown shipPartPricesShown;
- /* 20 */ u32 treasurePriceShownFlags[CEIL_DIV(Treasure_COUNT, 32)];
- /* 24 */ u8 equippedShipParts[ShipPart_COUNT];
- /* 2c */ s8 shipParts[ShipPart_COUNT][ShipType_COUNT];
- /* 74 */ s8 treasure[Treasure_COUNT];
- /* 7c */ unk8 unk_7c[4];
- /* 80 */ u16 hourglassSeconds;
- /* 82 */ u16 unk_82[6];
- /* 8e */ u16 numRupees;
- /* 90 */ unk8 unk_90;
- /* 91 */ unk8 unk_91;
- /* 92 */ unk8 unk_92;
- /* 93 */ u8 numBombs;
- /* 94 */ u8 numBombchus;
- /* 95 */ u8 numArrows;
- /* 96 */ s8 equippedItem;
- /* 97 */ Potion potions[NUM_POTIONS];
- /* 99 */ u8 numGems[Gem_COUNT];
- /* 9c */ u8 quiverSize;
- /* 9d */ u8 bombBagSize;
- /* 9e */ u8 bombchuBagSize;
- /* 9f */ u8 unk_9f[6];
- /* a5 */ u8 equippedFairy;
- /* a6 */
-};
-
class ItemManager : public SysObject {
public:
/* 000 */ ItemFlag mEquippedItem;
@@ -211,6 +105,7 @@ public:
static void Destroy();
ItemManager();
~ItemManager();
+ void Init();
// Save/load
void Save(SaveItemManager *save);
@@ -221,6 +116,7 @@ public:
ActorNaviBase *GetFairy(FairyId id) const;
u32 GetActiveFairyLevel(FairyId id) const;
u32 GetFairyLevel(FairyId id) const;
+ void SpawnFairies();
// Equip item
void ClearPrevEquippedItem();
@@ -239,6 +135,11 @@ public:
bool ClearForcedEquipItem();
void UpdateSwordShieldInUse();
static EquipItem *GetEquipItemUnchecked(ItemFlag equipId);
+ void InitEquipItems();
+ void func_ov004_02107648();
+ void func_ov004_02107650();
+ void func_ov004_02107698();
+ void func_ov004_021076bc();
// Ammo
u16 GetAmmo(ItemFlag equipId) const;
diff --git a/include/Item/ItemModelLoader.hpp b/include/Item/ItemModelLoader.hpp
new file mode 100644
index 00000000..6b06893a
--- /dev/null
+++ b/include/Item/ItemModelLoader.hpp
@@ -0,0 +1,29 @@
+#pragma once
+
+#include "global.h"
+#include "types.h"
+
+class ItemModelLoader {
+public:
+ /* 00 */ unk32 mItems;
+ /* 04 */ unk32 mDungeonItems;
+ /* 08 */ unk32 mUnk_08;
+ /* 0c */ unk8 mUnk_0c[0x14];
+ /* 20 */
+
+ ItemModelLoader();
+ ItemModelLoader *func_ov000_020bb2ec();
+ unk32 func_ov000_020bb34c();
+ void func_ov000_020bb378(s32 param1);
+ unk32 func_ov000_020bb390(s32 equipId);
+ unk32 func_ov000_020bb3a8(s32 param1);
+ s32 func_ov000_020bb3b4(s32 param1, char *param2);
+ unk32 func_ov000_020bb3d4(s32 param1, unk32 param2);
+ void func_ov000_020bb3f4(char *param2);
+ void func_ov000_020bb414(unk32 param1);
+ void func_ov000_020bb420(unk32 param1);
+ void func_ov000_020bb42c(unk32 param1);
+
+ static void Create();
+ static void Destroy();
+};