From e1d2f0b168ebd698d7a69dbb53fe15cc7fa548aa Mon Sep 17 00:00:00 2001 From: Aetias Date: Sun, 19 Jan 2025 11:58:47 +0100 Subject: Move ov000 documentation from Ghidra --- include/DTCM/UnkStruct_027e0d38.hpp | 30 +++++++++ include/Item/Item.hpp | 73 ++++++++++++++++++++ include/Item/ItemManager.hpp | 128 +----------------------------------- include/Map/MapManager.hpp | 2 +- include/Physics/AABB.hpp | 13 ++++ include/Physics/Cube.hpp | 11 ++++ include/Save/SaveItemManager.hpp | 37 +++++++++++ include/global.h | 2 - include/types.h | 2 + 9 files changed, 168 insertions(+), 130 deletions(-) create mode 100644 include/DTCM/UnkStruct_027e0d38.hpp create mode 100644 include/Physics/Cube.hpp create mode 100644 include/Save/SaveItemManager.hpp (limited to 'include') diff --git a/include/DTCM/UnkStruct_027e0d38.hpp b/include/DTCM/UnkStruct_027e0d38.hpp new file mode 100644 index 00000000..a36af0fe --- /dev/null +++ b/include/DTCM/UnkStruct_027e0d38.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include "global.h" +#include "types.h" + +struct UnkStruct_027e0d38 { + /* 00 */ unk8 mUnk_00; + /* 01 */ unk8 mUnk_01[3]; // padding? + /* 04 */ unk32 mUnk_04; + /* 08 */ unk32 mUnk_08; + /* 0c */ unk32 mUnk_0c; + /* 10 */ unk32 mUnk_10; + /* 14 */ unk32 mUnk_14; + /* 18 */ unk32 mUnk_18; + /* 1c */ unk16 mUnk_1c; + /* 1e */ unk8 mUnk_1e; + /* 1f */ unk8 mUnk_1f; + /* 20 */ unk8 mUnk_20; + /* 21 */ unk8 mUnk_21; + /* 22 */ unk8 mUnk_22[2]; // padding? + /* 24 */ void *mUnk_24; + /* 28 */ void *mUnk_28; + /* 2c */ + + unk32 func_ov000_02078b40(); + unk8 func_ov000_02078b64(); + bool func_ov000_02078b88(); +}; + +extern UnkStruct_027e0d38 *data_027e0d38; 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 1fcabe31..813b0e0f 100644 --- a/include/Item/ItemManager.hpp +++ b/include/Item/ItemManager.hpp @@ -9,21 +9,16 @@ extern "C" { #include "types.h" #include "Actor/ActorNavi.hpp" -#include "DTCM/UnkStruct_027e0f78.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,98 +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 */ -}; - -struct UnkStruct_027e0d38 { - /* 00 */ unk8 mUnk_00; - /* 01 */ unk8 mUnk_01[3]; // padding? - /* 04 */ unk32 mUnk_04; - /* 08 */ unk32 mUnk_08; - /* 0c */ unk32 mUnk_0c; - /* 10 */ unk32 mUnk_10; - /* 14 */ unk32 mUnk_14; - /* 18 */ unk32 mUnk_18; - /* 1c */ unk16 mUnk_1c; - /* 1e */ unk8 mUnk_1e; - /* 1f */ unk8 mUnk_1f; - /* 20 */ unk8 mUnk_20; - /* 21 */ unk8 mUnk_21; - /* 22 */ unk8 mUnk_22[2]; // padding? - /* 24 */ void *mUnk_24; - /* 28 */ void *mUnk_28; - /* 2c */ -}; - typedef u32 ItemModelId; enum ItemModelId_ { ItemModelId_OshusSword, // swA @@ -156,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 { private: /* 000 */ ItemFlag mEquippedItem; diff --git a/include/Map/MapManager.hpp b/include/Map/MapManager.hpp index de53ebe9..0cfa7479 100644 --- a/include/Map/MapManager.hpp +++ b/include/Map/MapManager.hpp @@ -177,7 +177,7 @@ public: unk8 MapData_vfunc_6c(); unk8 MapData_vfunc_70(); static unk8 func_ov00_02083fb0(u32 *param_1, MapManager *param_2, Vec3p *param_3); - void func_ov00_02084024(unk32 param_2, AABB *param_3); + void GetTileWorldBounds(Vec2b *tile, AABB *tileBounds); unk8 MapData_vfunc_54(); unk8 func_ov00_020840a0(unk8 param_2, unk8 param_3, unk32 param_4); unk8 MapData_vfunc_78(); diff --git a/include/Physics/AABB.hpp b/include/Physics/AABB.hpp index 19ce9f38..25a7f34b 100644 --- a/include/Physics/AABB.hpp +++ b/include/Physics/AABB.hpp @@ -5,10 +5,23 @@ #include "nds/math.h" +#include "Physics/Cube.hpp" + struct AABB { Vec3p min; Vec3p max; + bool func_ov000_0208e680(); + void GetCenter(Vec3p *center); + q20 GetSizeX(); + q20 GetSizeZ(); + q20 GetSizeY(); bool Contains(Vec3p *vec); bool ContainsInXZ(Vec3p *vec); + bool ContainsInXY(Vec3p *vec); + bool IntersectsCube(Cube *cube); + bool func_ov000_0208e87c(Cube *cube, Vec3p *vec, u32 *out); + void GrowToPoint(Vec3p *point); + void Grow(Vec3p *dimensions); + void GrowScalar(q20 amount); }; diff --git a/include/Physics/Cube.hpp b/include/Physics/Cube.hpp new file mode 100644 index 00000000..b16ac97f --- /dev/null +++ b/include/Physics/Cube.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "global.h" +#include "types.h" + +#include "nds/math.h" + +struct Cube { + Vec3p center; + q20 size; +}; diff --git a/include/Save/SaveItemManager.hpp b/include/Save/SaveItemManager.hpp new file mode 100644 index 00000000..0f0142f8 --- /dev/null +++ b/include/Save/SaveItemManager.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include "global.h" +#include "types.h" + +#include "../Item/Item.hpp" + +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[MAX_POTIONS]; + /* 99 */ u8 numGems[Gem_COUNT]; + /* 9c */ u8 quiverSize; + /* 9d */ u8 bombBagSize; + /* 9e */ u8 bombchuBagSize; + /* 9f */ u8 unk_9f[6]; + /* a5 */ u8 equippedFairy; + /* a6 */ + + SaveItemManager(); +}; diff --git a/include/global.h b/include/global.h index 617f672f..593c720b 100644 --- a/include/global.h +++ b/include/global.h @@ -1,8 +1,6 @@ #ifndef PH_GLOBAL_H #define PH_GLOBAL_H -#define NULL 0 - #define GET_FLAG(arr, pos) (((1 << ((pos) & 0x1f)) & (arr)[((u32) (pos)) >> 5]) != 0) #define SET_FLAG(arr, pos) ((arr)[((u32) (pos)) >> 5] |= 1 << ((pos) & 0x1f)) #define RESET_FLAG(arr, pos) ((arr)[((u32) (pos)) >> 5] &= ~(1 << ((pos) & 0x1f))) diff --git a/include/types.h b/include/types.h index 0dd5ecf5..03e8352f 100644 --- a/include/types.h +++ b/include/types.h @@ -1,6 +1,8 @@ #ifndef PH_TYPES_H #define PH_TYPES_H +#include + typedef unsigned long long u64; typedef unsigned int u32; typedef unsigned short u16; -- cgit v1.2.3