summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorHenny022p <73211432+Henny022p@users.noreply.github.com>2026-02-08 18:32:38 +0100
committerGitHub <noreply@github.com>2026-02-08 18:32:38 +0100
commit5ab63f00e522ff69c5bc987e379f0163943f2833 (patch)
tree53622222ac729c6ab6dc75ef7f9bafa8031daf18 /include
parent73901a0a012d55ebb66a4627dcb246d19737fcb5 (diff)
parent5b2cafdc894823d57beee8f3947a391d881d91de (diff)
Merge pull request #701 from Henny022p/cleanup/250302HEADmaster
Various code cleanup changes
Diffstat (limited to 'include')
-rw-r--r--include/affine.h21
-rw-r--r--include/area.h2
-rw-r--r--include/asm.h20
-rw-r--r--include/backgroundAnimations.h3
-rw-r--r--include/beanstalkSubtask.h32
-rw-r--r--include/collision.h2
-rw-r--r--include/color.h2
-rw-r--r--include/common.h2
-rw-r--r--include/effects.h19
-rw-r--r--include/enemy.h16
-rw-r--r--include/enemy/armos.h8
-rw-r--r--include/entity.h16
-rw-r--r--include/fade.h6
-rw-r--r--include/fileselect.h19
-rw-r--r--include/functions.h101
-rw-r--r--include/game.h4
-rw-r--r--include/gba/defines.h6
-rw-r--r--include/gfx.h8
-rw-r--r--include/item.h12
-rw-r--r--include/itemDefinitions.h20
-rw-r--r--include/kinstone.h1
-rw-r--r--include/main.h16
-rw-r--r--include/manager.h5
-rw-r--r--include/manager/flagAndOperatorManager.h4
-rw-r--r--include/manager/holeManager.h16
-rw-r--r--include/manager/horizontalMinishPathBackgroundManager.h2
-rw-r--r--include/manager/hyruleTownTileSetManager.h8
-rw-r--r--include/manager/lightManager.h2
-rw-r--r--include/manager/manager29.h2
-rw-r--r--include/manager/minishRaftersBackgroundManager.h2
-rw-r--r--include/manager/miscManager.h7
-rw-r--r--include/manager/staticBackgroundManager.h2
-rw-r--r--include/manager/templeOfDropletsManager.h4
-rw-r--r--include/manager/verticalMinishPathBackgroundManager.h3
-rw-r--r--include/message.h64
-rw-r--r--include/npc.h15
-rw-r--r--include/npc/bigGoron.h8
-rw-r--r--include/object.h50
-rw-r--r--include/object/cutsceneMiscObject.h8
-rw-r--r--include/object/itemOnGround.h2
-rw-r--r--include/object/lockedDoor.h8
-rw-r--r--include/object/pot.h8
-rw-r--r--include/object/pushableFurniture.h2
-rw-r--r--include/pauseMenu.h16
-rw-r--r--include/physics.h3
-rw-r--r--include/player.h47
-rw-r--r--include/playeritem.h4
-rw-r--r--include/room.h20
-rw-r--r--include/save.h13
-rw-r--r--include/screen.h12
-rw-r--r--include/screenTransitions.h64
-rw-r--r--include/script.h3
-rw-r--r--include/scroll.h13
-rw-r--r--include/structures.h374
-rw-r--r--include/subtask.h5
-rw-r--r--include/transitions.h32
-rw-r--r--include/ui.h99
-rw-r--r--include/vram.h81
58 files changed, 682 insertions, 662 deletions
diff --git a/include/affine.h b/include/affine.h
new file mode 100644
index 00000000..ae8d2ddb
--- /dev/null
+++ b/include/affine.h
@@ -0,0 +1,21 @@
+#ifndef AFFINE_H
+#define AFFINE_H
+
+#include "gba/types.h"
+
+typedef struct {
+ s16 x;
+ s16 y;
+ u16 _4;
+ u16 _6;
+ u16 _8;
+} OAMCommand;
+extern OAMCommand gOamCmd;
+
+extern void FlushSprites(void);
+extern void CopyOAM(void);
+extern void DrawEntities(void);
+extern void sub_080ADA04(OAMCommand*, void*);
+extern void DrawDirect(u32 spriteIndex, u32 frameIndex);
+
+#endif // AFFINE_H
diff --git a/include/area.h b/include/area.h
index 0bfbf919..8c49e393 100644
--- a/include/area.h
+++ b/include/area.h
@@ -83,7 +83,7 @@ typedef struct {
u16 pixel_width;
u16 pixel_height;
u16 tileSet_id;
-} FORCE_WORD_ALIGNED RoomHeader;
+} PACKED ALIGNED(2) RoomHeader;
static_assert(sizeof(RoomHeader) == 0xa);
extern RoomHeader* gAreaRoomHeaders[];
diff --git a/include/asm.h b/include/asm.h
index dbf374d2..20a57c35 100644
--- a/include/asm.h
+++ b/include/asm.h
@@ -11,10 +11,7 @@ extern void SetTile(u32 tileIndex, u32 tilePos, u32 layer);
extern void UpdateScrollVram(void);
extern u32 sub_080B1BA4(u32, u32, u32);
-extern void LoadResourceAsync(const void* src, u32 dest, u32 size);
-extern void GenericConfused(struct Entity_*);
-extern void sub_08001290(struct Entity_*, u32);
-extern void GenericKnockback(struct Entity_*);
+extern void LoadResourceAsync(const void* src, void* dest, u32 size);
extern u32 GetFuserId(struct Entity_*);
#define GetFuserIdAndFuserTextId(ent) ((union SplitDWord)(*(MultiReturnTypeSingleEntityArg)(&GetFuserId))(ent))
extern u32 CheckPlayerInRegion(u32 centerX, u32 centerY, u32 radiusX, u32 radiusY);
@@ -39,12 +36,9 @@ extern void sub_08004596(struct Entity_*, u32);
extern u32 sub_080045B4(struct Entity_*, u32, u32);
extern u32 CalculateDirectionTo(u32, u32, u32, u32);
extern u32 CalculateDirectionFromOffsets(s32, s32);
-extern u32 sub_080086B4(u32, u32, const u8*);
-extern u32 ResolveCollisionLayer(struct Entity_*);
extern void sub_0800417E(struct Entity_*, u32);
extern u32 sub_0800442E(struct Entity_*);
extern void SoundReqClipped(struct Entity_*, u32);
-extern u32 sub_0800132C(struct Entity_*, struct Entity_*);
extern u32 sub_0800445C(struct Entity_*);
extern u32 CheckRectOnScreen(s32, s32, u32, u32);
@@ -106,4 +100,16 @@ typedef struct {
*/
extern u32 FindValueForKey(u32 key, const KeyValuePair* keyValuePairList);
+extern u32 GetTileIndex(u32 tilePos, u32 layer);
+extern void LinearMoveDirectionOLD(struct Entity_*, u32, u32);
+extern void sub_080028E0(struct Entity_*);
+extern void SnapToTile(struct Entity_*);
+extern u32 sub_0800419C(struct Entity_*, struct Entity_*, u32, u32);
+extern u32 sub_080041DC(struct Entity_*, u32, u32);
+extern void sub_080042BA(struct Entity_*, u32);
+extern void sub_080042D0(struct Entity_*, u32, u16);
+extern void sub_080044AE(struct Entity_*, u32, u32);
+extern void sub_0800451C(struct Entity_*);
+extern void sub_08004542(struct Entity_*);
+
#endif // ASM_H
diff --git a/include/backgroundAnimations.h b/include/backgroundAnimations.h
index 4c3ad5c8..180105f0 100644
--- a/include/backgroundAnimations.h
+++ b/include/backgroundAnimations.h
@@ -32,4 +32,7 @@ extern BgAnimation gBgAnimations[MAX_BG_ANIMATIONS];
extern const u16* const gUnk_080B755C[];
extern const u16 gUnk_080B77C0[];
+extern void LoadBgAnimations(u16*);
+extern void ClearBgAnimations(void);
+
#endif // BACKGROUNDANIMATIONS_H
diff --git a/include/beanstalkSubtask.h b/include/beanstalkSubtask.h
index f7bebbaf..3a91465e 100644
--- a/include/beanstalkSubtask.h
+++ b/include/beanstalkSubtask.h
@@ -28,4 +28,36 @@ void LoadMapData(MapDataDefinition* dataDefinition);
*/
void RenderMapLayerToSubTileMap(u16* tileMap, MapLayer* mapLayer);
+extern void sub_0801AFE4(void);
+extern void SetBGDefaults(void);
+
+typedef struct {
+ s16 tileIndex;
+ s16 tilePosOffset;
+} TileData;
+
+/**
+ * @brief Sets multiple tiles at once
+ *
+ * @param tileData [u16 tileIndex, s16 positionOffset], ends with 0xffff
+ * @param basePosition the position the offsets in tileData are based on
+ * @param layer the tile layer
+ */
+extern void SetMultipleTiles(const TileData* tileData, u32 basePosition, u32 layer);
+
+typedef struct {
+ u8 unk_0;
+ u8 unk_1;
+ u8 unk_2[2];
+ u16 unk_4;
+ u8 filler[12];
+ struct Entity_* unk_14;
+ u8 unk_18;
+ u8 unk_19;
+ u8 unk_1a;
+ u8 unk_1b;
+} struct_02018EB0;
+
+extern struct_02018EB0 gUnk_02018EB0;
+
#endif // BEANSTALKSUBTASK_H
diff --git a/include/collision.h b/include/collision.h
index f2d50367..068c3ecd 100644
--- a/include/collision.h
+++ b/include/collision.h
@@ -67,4 +67,6 @@ u32 sub_080176E4(Entity*);
extern const u8 gMapTileTypeToActTile[]; // actTile for tileType?
+extern u32 sub_0801766C(Entity*);
+
#endif // COLLISION_H
diff --git a/include/color.h b/include/color.h
index eaebb6a6..06c6662c 100644
--- a/include/color.h
+++ b/include/color.h
@@ -23,7 +23,7 @@ typedef struct {
u16 unk_02;
union SplitWord unk_04;
union SplitWord unk_08;
- u32 unk_0C;
+ void* unk_0C;
} struct_gUnk_020000C0_1;
typedef struct {
diff --git a/include/common.h b/include/common.h
index 5f620c23..f9182284 100644
--- a/include/common.h
+++ b/include/common.h
@@ -143,4 +143,6 @@ typedef struct {
u32 mapDataOffset;
} DungeonLayout;
+extern void sub_0801E104(void);
+
#endif // COMMON_H
diff --git a/include/effects.h b/include/effects.h
index 88f04fa4..99998c97 100644
--- a/include/effects.h
+++ b/include/effects.h
@@ -115,4 +115,23 @@ typedef enum {
FX_6C
} Effect;
+Entity* CreateFx(Entity* parent, Effect type, u32 type2);
+void CreateDeathFx(Entity* parent);
+void CreateDeathFxAt(s32 xOff, s32 yOff, u32 layer);
+void CreateDashFx(Entity* parent);
+void CreateExplosionBrokenFx(Entity* parent);
+void CreateWaterSplashFx(Entity* parent);
+Entity* CreateRippleFx(Entity* parent);
+void CreateRippleFxRandom(Entity* parent, s32 range);
+Entity* CreateLargeRippleFx(Entity* parent);
+void CreateLargeRippleFxRandom(Entity* parent, s32 minDistance, s32 maxDistance);
+void CreateSparkleFx(Entity* parent);
+
+extern void CreateDrownFx(Entity*);
+extern void CreateLavaDrownFx(Entity* parent);
+extern void CreateSwampDrownFx(Entity* parent);
+extern void CreatePitFallFx(Entity* parent);
+
+void CreateMagicSparklesFxAt(u32 baseX, u32 baseY, u32 layer);
+
#endif // EFFECTS_H
diff --git a/include/enemy.h b/include/enemy.h
index 84c2d1e0..cc67a457 100644
--- a/include/enemy.h
+++ b/include/enemy.h
@@ -2,15 +2,7 @@
#define ENEMY_H
#include "global.h"
-#include "asm.h"
-
-#include "sound.h"
-#include "effects.h"
-#include "flags.h"
-#include "common.h"
-
#include "entity.h"
-#include "projectile.h"
#define EM_FLAG_BOSS (1 << 0)
#define EM_FLAG_BOSS_KILLED (1 << 1)
@@ -76,6 +68,14 @@ bool32 sub_08049F1C(Entity*, Entity*, s32);
bool32 PlayerInRange(Entity*, u32, s32);
void EnemyCopyParams(Entity*, Entity*);
void GenericKnockback2(Entity*);
+extern void GenericConfused(struct Entity_*);
+
+extern void sub_08001318(Entity*);
+extern void sub_08001290(Entity*, u32);
+extern u32 sub_0800132C(struct Entity_*, struct Entity_*);
+
+extern void StealRupees(Entity*);
+extern void EnemyDisableRespawn(Enemy*);
enum {
/*0x00*/ OCTOROK,
diff --git a/include/enemy/armos.h b/include/enemy/armos.h
new file mode 100644
index 00000000..277f80ca
--- /dev/null
+++ b/include/enemy/armos.h
@@ -0,0 +1,8 @@
+#ifndef ARMOS_H
+#define ARMOS_H
+
+#include "gba/types.h"
+
+void Armos_SetFlagFromTransition(u32 armosId);
+
+#endif // ARMOS_H
diff --git a/include/entity.h b/include/entity.h
index d1d08517..7361d119 100644
--- a/include/entity.h
+++ b/include/entity.h
@@ -3,7 +3,6 @@
#define ENTITY_H
#include "global.h"
-#include "color.h"
#include "sprite.h"
#define MAX_ENTITIES 72
@@ -325,10 +324,7 @@ bool32 ProcessMovement0(Entity*);
Entity* GetEmptyEntity(void);
Entity* CreateEnemy(u32 id, u32 type);
Entity* CreateNPC(u32 id, u32 type, u32 type2);
-Entity* CreateObject(u32 id, u32 type, u32 type2);
-Entity* CreateObjectWithParent(Entity* parent, u32 id, u32 type, u32 type2);
Entity* CreateAuxPlayerEntity(void);
-Entity* CreateFx(Entity* parent, u32 type, u32 type2);
/// @}
/**
@@ -540,6 +536,16 @@ typedef struct {
} CarriedEntity;
extern CarriedEntity gCarriedEntity;
+typedef struct {
+ u8 event_priority; /**< system requested priority @see Priority */
+ u8 ent_priority; /**< entity requested priority @see Priority */
+ u8 queued_priority; /**< @see Priority */
+ u8 queued_priority_reset; /**< @see Priority */
+ Entity* requester;
+ u16 priority_timer;
+} PriorityHandler;
+extern PriorityHandler gPriorityHandler;
+
/**
* Current number of entities.
* @see Entity
@@ -560,7 +566,7 @@ extern u8 gManagerCount;
#define TILE(x, y) (((((x)-gRoomControls.origin_x) >> 4) & 0x3F) | ((((y)-gRoomControls.origin_y) >> 4) & 0x3F) << 6)
// Calculate tilePos from x and y coordinates where x and y are already relative to the current room.
#define TILE_LOCAL(x, y) ((((x) >> 4) & 0x3F) | (((y) >> 4) & 0x3F) << 6)
-#define TILE_POS(x, y) (x + (y << 6))
+#define TILE_POS(x, y) ((x) + ((y) << 6))
#define TILE_POS_X_COMPONENT 0x3f
#define TILE_POS_Y_COMPONENT 0xfc0
#define COORD_TO_TILE(entity) TILE((entity)->x.HALF.HI, (entity)->y.HALF.HI)
diff --git a/include/fade.h b/include/fade.h
index c9b30e10..aa7c86e1 100644
--- a/include/fade.h
+++ b/include/fade.h
@@ -100,4 +100,10 @@ void FadeVBlank(void);
*/
void ResetFadeMask(void);
+extern u32 gUsedPalettes;
+#define USE_PALETTE(i) \
+ do { \
+ gUsedPalettes |= 1 << (i); \
+ } while (0)
+
#endif // FADE_H
diff --git a/include/fileselect.h b/include/fileselect.h
index 704fb1b1..5544c60d 100644
--- a/include/fileselect.h
+++ b/include/fileselect.h
@@ -1,9 +1,9 @@
#ifndef FILESELECT_H
#define FILESELECT_H
-#include "sound.h"
#include "global.h"
#include "save.h"
+#include "message.h"
typedef struct {
/*0x00*/ u8 unk_0x0;
@@ -23,19 +23,6 @@ static_assert(sizeof(ChooseFileState) == 0x30);
// TODO: This occupies the same memory region as gMenu
extern ChooseFileState gChooseFileState;
-// typedef struct {
-// u8 unk00 : 4;
-// u8 unk04 : 4;
-// u8 unk1;
-// u8 charColor;
-// u8 bgColor;
-// u16 unk4;
-// u16 unk6;
-// u8* unk8;
-// } struct_02036540;
-
-extern struct_020227E8 gUnk_020227E8[];
-
typedef struct {
/*0x00*/ u8 isTransitioning;
/*0x01*/ u8 unk1;
@@ -51,13 +38,9 @@ typedef struct {
extern struct_02019EE0 gMapDataBottomSpecial;
// TODO size: 0x8000 from ClearTileMaps?
-extern void sub_08056FEC(u32, struct_020227E8*);
extern u32 ShowTextBox(u32 textIndexOrPtr, const Font* font);
extern void ClearTileMaps(void);
extern void ResetSaveFile(u32);
-extern WStruct* sub_0805F2C8(void);
-extern u32 sub_0805F7DC(u32, WStruct*);
-extern void sub_0805F300(WStruct*);
extern void sub_08050A64(u32);
extern void sub_08050AFC(u32);
extern void sub_08050384();
diff --git a/include/functions.h b/include/functions.h
index d0eace75..e5b9e565 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -2,105 +2,8 @@
#define FUNCTIONS_H
#include "global.h"
-#include "entity.h"
-#include "manager.h"
-#include "physics.h"
-#include "player.h"
-#include "room.h"
-#include "structures.h"
-#include "script.h"
-#include "map.h"
-// Identified - to be sorted into header files
-extern u32 CheckRegionOnScreen(u32, u32, u32, u32);
-extern void CopyOAM(void);
-extern void CreateLavaDrownFX(Entity*);
-extern Entity* CreateGroundItem(Entity*, u32, u32);
-extern Entity* CreateGroundItemWithFlags(Entity*, u32, u32, u32);
-extern void CreatePitFallFX(Entity*);
-extern void CreateMagicSparkles(u32, u32, u32);
-extern void CreateMinishEntrance(u32 tile);
-extern u32 CreateRandomItemDrop(Entity*, u32);
-extern void DrawDirect(u32 spriteIndex, u32 frameIndex);
-extern void DrawEntities(void);
-extern void FlushSprites(void);
-extern u32 GetTileIndex(u32 tilePos, u32 layer);
-extern u32 GiveItem(u32, u32);
-extern bool32 LoadFixedGFX(Entity*, u32);
-extern void LoadResources(void);
-extern bool32 LoadSwapGFX(Entity*, u16, u32);
-extern void MenuFadeIn(u32, u32);
-extern void SetDirtTile(u32);
-/**
- * @brief Sets multiple tiles at once
- *
- * @param tileData [u16 tileIndex, s16 positionOffset], ends with 0xffff
- * @param basePosition the position the offsets in tileData are based on
- * @param layer the tile layer
- */
-extern void SetMultipleTiles(const TileData* tileData, u32 basePosition, u32 layer);
-extern void TryLoadPrologueHyruleTown(void);
-extern void UnloadGFXSlots(Entity*);
-extern void UnloadOBJPalette(Entity*);
-extern void UpdateDisplayControls(void);
-extern void ClearBgAnimations(void);
-extern void SetBGDefaults(void);
-
-// Unidentified
-extern s32 sub_080012DC(Entity*);
-extern void sub_08001318(Entity*);
-extern void LinearMoveDirectionOLD(Entity*, u32, u32);
-extern void sub_080028E0(Entity*);
-extern u32 sub_080040A2(Entity*);
-extern u32 sub_080040D8(Entity*, u8*, s32, s32);
-extern void SnapToTile(Entity*);
-extern u32 sub_0800419C(Entity*, Entity*, u32, u32);
-extern u32 sub_080041DC(Entity*, u32, u32);
-extern void sub_080042BA(Entity*, u32);
-extern void sub_080042D0(Entity*, u32, u16);
-extern void CreateDrownFX(Entity*);
-extern u32 sub_0800445C(Entity*);
-extern void sub_080044AE(Entity*, u32, u32);
-extern u32 BounceUpdate(Entity*, u32);
-extern void sub_0800451C(Entity*);
-extern void sub_08004542(Entity*);
-extern void sub_080085B0(Entity*);
-extern u16* DoTileInteraction(Entity*, u32, u32, u32);
-extern void UpdateCollisionLayer(Entity*);
-extern u32 sub_0801766C(Entity*);
-extern void sub_0801AFE4(void);
-extern void UpdateUIElements(void);
-extern void sub_0801E104(void);
-extern void sub_08030118(u32);
-extern void sub_0803C0AC(Entity*);
-extern void EnemyDisableRespawn(Entity*);
-extern u32 sub_0804A024(Entity*, u32, u32);
-extern u32 IsMinishItem(u32);
-extern void DisableRandomDrops();
-extern void EnableRandomDrops(void);
-extern s32 sub_08056338(void);
-extern void sub_080575C8(u32);
-extern void sub_08057688(void);
-extern void sub_080580B0(u32);
-extern void sub_08058324(u32);
-extern void sub_08059278(void);
-extern void LoadStaticBackground(u32);
-extern void sub_0805BC4C(void);
-extern void sub_0805EC60(Entity*);
-extern void InitPlayerMacro(PlayerMacroEntry*);
-extern u32* sub_0805F25C(u32);
-extern void sub_0805F8E4(u32 r0, WStruct* r1);
-extern void sub_0806D0B0(Entity*);
-extern bool32 sub_080806BC(u32, u32, u32, u32);
-extern void sub_0808091C(const ScreenTransitionData* screenTransition, u32 transitionType);
-extern void sub_080809D4(void);
-extern void sub_08080CB4(Entity*);
-extern u32 sub_0808288C(Entity*, u32, u32, u32);
-extern bool32 sub_08083734(Entity*, u32);
-extern void sub_08095C48(Entity*);
-extern void sub_080A57F4(void);
-extern void sub_080A71C4(u32, u32, u32, u32);
-extern void sub_080ADD70(void);
-extern void sub_080AF284(void);
+extern u32 sub_0804A024(struct Entity_*, u32, u32);
+extern void sub_0805EC60(struct Entity_*);
#endif // FUNCTIONS_H
diff --git a/include/game.h b/include/game.h
index 9e1bc655..20d8088c 100644
--- a/include/game.h
+++ b/include/game.h
@@ -3,7 +3,7 @@
#include "global.h"
#include "area.h"
-#include "structures.h"
+#include "message.h"
/**
* Change the light level of the room.
@@ -200,7 +200,7 @@ void InitParachuteRoom(void);
* @param onEnter Room enter callback.
* @param onExit Room exit callback.
*/
-void RegisterTransitionManager(void* mgr, void (*onEnter)(void*), void (*onExit)(void*));
+void RegisterTransitionHandler(void* mgr, void (*onEnter)(), void (*onExit)());
/**
* Call the room exit callback.
diff --git a/include/gba/defines.h b/include/gba/defines.h
index a135969e..73802774 100644
--- a/include/gba/defines.h
+++ b/include/gba/defines.h
@@ -16,9 +16,13 @@
#define NAKED __attribute__((naked))
#define UNUSED __attribute__((unused))
+#ifdef __CLION_IDE__
+#define PACKED
+#define ALIGNED(n)
+#else
#define PACKED __attribute__((packed))
-
#define ALIGNED(n) __attribute__((aligned(n)))
+#endif
#define SOUND_INFO_PTR (*(struct SoundInfo**)0x3007FF0)
#define INTR_CHECK (*(u16*)0x3007FF8)
diff --git a/include/gfx.h b/include/gfx.h
new file mode 100644
index 00000000..2620debc
--- /dev/null
+++ b/include/gfx.h
@@ -0,0 +1,8 @@
+#ifndef GFX_H
+#define GFX_H
+
+#include "global.h"
+
+extern const u8 gGlobalGfxAndPalettes[];
+
+#endif // GFX_H
diff --git a/include/item.h b/include/item.h
index ec20160d..5aa1913c 100644
--- a/include/item.h
+++ b/include/item.h
@@ -5,6 +5,12 @@
#include "entity.h"
#include "player.h"
+extern u32 GiveItem(u32, u32);
+extern u32 CreateRandomItemDrop(Entity*, u32);
+extern void DisableRandomDrops();
+extern void EnableRandomDrops(void);
+extern u32 IsMinishItem(u32);
+
void CreateItemEntity(u32, u32, u32);
extern void ExecuteItemFunction(ItemBehavior* this, u32 index);
@@ -153,7 +159,11 @@ typedef enum {
} Item;
/** Slot that the item is equipped in. */
-typedef enum { EQUIP_SLOT_A, EQUIP_SLOT_B, EQUIP_SLOT_NONE } EquipSlot;
+typedef enum {
+ EQUIP_SLOT_A,
+ EQUIP_SLOT_B,
+ EQUIP_SLOT_NONE,
+} EquipSlot;
/** Function used to create the item. */
typedef enum {
diff --git a/include/itemDefinitions.h b/include/itemDefinitions.h
new file mode 100644
index 00000000..e5816dd5
--- /dev/null
+++ b/include/itemDefinitions.h
@@ -0,0 +1,20 @@
+#ifndef ITEMDEFINITIONS_H
+#define ITEMDEFINITIONS_H
+
+#include "global.h"
+
+typedef struct {
+ /*0x00*/ bool8 isOnlyActiveFirstFrame; /**< Is the behavior for this item only created on the first frame */
+ /*0x01*/ u8 priority;
+ /*0x02*/ u8 createFunc;
+ /*0x03*/ u8 playerItemId; /**< Id for the corresponsing PlayerItem. */
+ /*0x04*/ u16 frameIndex;
+ /*0x06*/ u8 animPriority;
+ /*0x07*/ bool8 isChangingAttackStatus;
+ /*0x08*/ bool8 isUseableAsMinish;
+ /*0x09*/ u8 pad[3];
+} ItemDefinition;
+
+static_assert(sizeof(ItemDefinition) == 0xc);
+
+#endif // ITEMDEFINITIONS_H
diff --git a/include/kinstone.h b/include/kinstone.h
index c50ba857..0c994b24 100644
--- a/include/kinstone.h
+++ b/include/kinstone.h
@@ -4,6 +4,7 @@
#include "global.h"
#include "entity.h"
+extern void CreateMinishEntrance(u32 tile);
extern void sub_08018C58(u32);
typedef enum {
diff --git a/include/main.h b/include/main.h
index f2a229ea..03356134 100644
--- a/include/main.h
+++ b/include/main.h
@@ -2,10 +2,11 @@
#define MAIN_H
#include "global.h"
-#include "structures.h"
#include "room.h"
#include "script.h"
#include "screen.h"
+#include "vram.h"
+#include "color.h"
/** File signature */
#define SIGNATURE 'MCZ3'
@@ -101,6 +102,18 @@ static_assert(sizeof(UI) == 0x3b4);
extern Main gMain; /**< Main instance. */
extern UI gUI; /**< UI instance. */
+typedef struct {
+ s32 signature;
+ u8 field_0x4;
+ u8 listenForKeyPresses;
+ u8 field_0x6;
+ u8 field_0x7;
+ u8 pad[24];
+} struct_02000010;
+static_assert(sizeof(struct_02000010) == 0x20);
+
+extern struct_02000010 gUnk_02000010;
+
/**
* Program entry point.
*/
@@ -158,6 +171,7 @@ extern void DemoTask(void);
extern u8 gUnk_03003DE4[0xC];
extern u16 gPaletteBuffer[];
+extern u32 CheckRegionOnScreen(u32, u32, u32, u32);
extern u32 CheckRegionsOnScreen(const u16* arr);
#endif // MAIN_H
diff --git a/include/manager.h b/include/manager.h
index c96a1785..322510c7 100644
--- a/include/manager.h
+++ b/include/manager.h
@@ -152,11 +152,6 @@ extern void (*const gMiscManagerunctions[58])();
Manager* GetEmptyManager(void);
-/**
- * @brief Set manager responsible for handling room changes
- */
-extern void RegisterTransitionManager(void* mgr, void (*onEnter)(), void (*onExit)());
-
extern u32 sub_0805ACC0(Entity*);
extern void sub_0801855C(void);
extern void SetNextAreaHint(u32 textId);
diff --git a/include/manager/flagAndOperatorManager.h b/include/manager/flagAndOperatorManager.h
index f41a129a..352cbf8f 100644
--- a/include/manager/flagAndOperatorManager.h
+++ b/include/manager/flagAndOperatorManager.h
@@ -6,8 +6,8 @@
typedef struct FlagAndOperatorManager {
Manager base;
u8 unk_20[0x1C];
- u16 unk_3c;
- u16 unk_3e;
+ u16 setFlag;
+ u16 checkFlags;
} FlagAndOperatorManager;
#endif // FLAGANDOPERATORMANAGER_H
diff --git a/include/manager/holeManager.h b/include/manager/holeManager.h
index 59bb8d66..6bf14c93 100644
--- a/include/manager/holeManager.h
+++ b/include/manager/holeManager.h
@@ -5,15 +5,15 @@
typedef struct {
Manager base;
- s16 unk_20;
- s16 unk_22;
- u16 unk_24;
- u16 unk_26;
+ s16 x;
+ s16 y;
+ u16 width;
+ u16 height;
u8 unk_28[8];
- u16 unk_30;
- u16 unk_32;
- u16 unk_34;
- u16 unk_36;
+ u16 persistance_x;
+ u16 persistance_y;
+ u16 persistance_offset_x;
+ u16 persistance_offset_y;
u8 unk_38[7];
u8 unk_3f;
} HoleManager;
diff --git a/include/manager/horizontalMinishPathBackgroundManager.h b/include/manager/horizontalMinishPathBackgroundManager.h
index f67d4841..3835f6c2 100644
--- a/include/manager/horizontalMinishPathBackgroundManager.h
+++ b/include/manager/horizontalMinishPathBackgroundManager.h
@@ -11,4 +11,6 @@ typedef struct {
u32 unk_3c;
} HorizontalMinishPathBackgroundManager;
+extern void sub_080580B0(u32);
+
#endif // HORIZONTALMINISHPATHBACKGROUNDMANAGER_H
diff --git a/include/manager/hyruleTownTileSetManager.h b/include/manager/hyruleTownTileSetManager.h
index ee908238..7e43bb2c 100644
--- a/include/manager/hyruleTownTileSetManager.h
+++ b/include/manager/hyruleTownTileSetManager.h
@@ -5,9 +5,11 @@
typedef struct {
Manager base;
- u8 field_0x20;
- u8 field_0x21;
- u8 field_0x22;
+ u8 gfxGroup0;
+ u8 gfxGroup1;
+ u8 gfxGroup2;
} HyruleTownTileSetManager;
+extern void TryLoadPrologueHyruleTown(void);
+
#endif // HYRULETOWNTILESETMANAGER_H
diff --git a/include/manager/lightManager.h b/include/manager/lightManager.h
index 9bbb1c6b..4a49d488 100644
--- a/include/manager/lightManager.h
+++ b/include/manager/lightManager.h
@@ -8,4 +8,6 @@ typedef struct {
s32 unk20;
} LightManager;
+extern void UnDarkRoom(void);
+
#endif // LIGHTMANAGER_H
diff --git a/include/manager/manager29.h b/include/manager/manager29.h
index c7d99b69..da4c96b2 100644
--- a/include/manager/manager29.h
+++ b/include/manager/manager29.h
@@ -16,7 +16,7 @@ typedef struct {
s16 unk_38;
u16 unk_3a;
u16 unk_3c;
- u16 unk_3e;
+ u16 flag;
} Manager29;
#endif // MANAGER29_H
diff --git a/include/manager/minishRaftersBackgroundManager.h b/include/manager/minishRaftersBackgroundManager.h
index 1c746870..4c034ab1 100644
--- a/include/manager/minishRaftersBackgroundManager.h
+++ b/include/manager/minishRaftersBackgroundManager.h
@@ -9,4 +9,6 @@ typedef struct {
u32 unk_3c;
} MinishRaftersBackgroundManager;
+extern void sub_08058324(u32);
+
#endif // MINISHRAFTERSBACKGROUNDMANAGER_H
diff --git a/include/manager/miscManager.h b/include/manager/miscManager.h
index 44047584..592f1878 100644
--- a/include/manager/miscManager.h
+++ b/include/manager/miscManager.h
@@ -8,8 +8,11 @@ typedef struct {
u8 unk_20[0x18];
s16 x;
s16 y;
- u16 unk_3c;
- u16 flags;
+ u16 flag1;
+ u16 flag2;
} MiscManager;
+extern void sub_08059278(void);
+extern void SetDirtTile(u32);
+
#endif // MISCMANAGER_H
diff --git a/include/manager/staticBackgroundManager.h b/include/manager/staticBackgroundManager.h
index f2cab28a..46e8ca0f 100644
--- a/include/manager/staticBackgroundManager.h
+++ b/include/manager/staticBackgroundManager.h
@@ -8,4 +8,6 @@ typedef struct {
u32 field_0x20;
} StaticBackgroundManager;
+extern void LoadStaticBackground(u32);
+
#endif // STATICBACKGROUNDMANAGER_H
diff --git a/include/manager/templeOfDropletsManager.h b/include/manager/templeOfDropletsManager.h
index da1e8f66..43355eee 100644
--- a/include/manager/templeOfDropletsManager.h
+++ b/include/manager/templeOfDropletsManager.h
@@ -18,8 +18,8 @@ typedef struct {
s16 unk_36;
s16 unk_38;
s16 unk_3a;
- u16 unk_3c;
- u16 unk_3e; // used
+ u16 flag;
+ u16 localFlag; // used
} TempleOfDropletsManager;
#endif // TEMPLEOFDROPLETSMANAGER_H
diff --git a/include/manager/verticalMinishPathBackgroundManager.h b/include/manager/verticalMinishPathBackgroundManager.h
index 34a80080..42e51b30 100644
--- a/include/manager/verticalMinishPathBackgroundManager.h
+++ b/include/manager/verticalMinishPathBackgroundManager.h
@@ -10,4 +10,7 @@ typedef struct {
void* field_0x3c;
} VerticalMinishPathBackgroundManager;
+extern void sub_080575C8(u32);
+extern void sub_08057688(void);
+
#endif // VERTICALMINISHPATHBACKGROUNDMANAGER_H
diff --git a/include/message.h b/include/message.h
index b25e9df5..dbb5ac55 100644
--- a/include/message.h
+++ b/include/message.h
@@ -3,11 +3,55 @@
#include "global.h"
#include "entity.h"
-#include "structures.h"
#define MESSAGE_ACTIVE 0x7f
typedef struct {
+ u8 unk00 : 1;
+ u8 unk01 : 3;
+ u8 unk04 : 4;
+ u8 unk1;
+ u8 charColor;
+ u8 bgColor;
+ u16 unk4;
+ u16 unk6;
+ void* unk8;
+} WStruct;
+
+static_assert(sizeof(WStruct) == 12);
+
+typedef union {
+ char s[8];
+ u32 w[2];
+} String8;
+
+extern String8 gUnk_020227E8[];
+extern u32 NumberToAscii(u32, String8*);
+extern WStruct* sub_0805F2C8(void);
+extern u32 sub_0805F7DC(u32, WStruct*);
+extern void sub_0805F300(WStruct*);
+extern void sub_0805F8E4(u32 r0, WStruct* r1);
+extern s32 sub_08056338(void);
+
+typedef struct {
+ u16* dest;
+ void* gfx_dest;
+ void* buffer_loc;
+ u32 _c;
+ u16 gfx_src;
+ u8 width;
+ u8 right_align : 1;
+ u8 sm_border : 1;
+ u8 unused : 1;
+ u8 draw_border : 1;
+ u8 border_type : 4;
+ u8 fill_type;
+ u8 charColor;
+ u8 _16;
+ u8 stylized;
+} Font;
+
+typedef struct {
u8 state;
u8 unk;
u8 textSpeed;
@@ -45,9 +89,11 @@ typedef struct {
Token curToken;
WStruct _50;
char player_name[10];
- u8 _66[0x10];
- u8 _76;
- u8 _77[0x11];
+ u8 _66[2];
+ String8 _68;
+ String8 _70;
+ String8 _78;
+ String8 _80;
u8 msgStatus;
u8 renderStatus;
u8 newlineDelay;
@@ -81,6 +127,14 @@ typedef struct {
extern TextRender gTextRender;
static_assert(sizeof(TextRender) == 0xa8);
+typedef struct {
+ u8 unk_00;
+ u8 unk_01;
+ u8 unk_02[0xE];
+} struct_02000040;
+
+extern struct_02000040 gUnk_02000040;
+
/**
* @brief Initialize the message system.
*/
@@ -138,7 +192,7 @@ void MessageClose(void);
void DispMessageFrame(u16*, s32, s32, u32);
-void sub_08057044(u32, struct_020227E8*, u32);
+void NumberToAsciiPad3Digits(u32, String8*, u32);
typedef enum {
TEXT_SAVE,
diff --git a/include/npc.h b/include/npc.h
index 525cc5d1..b3adc9f8 100644
--- a/include/npc.h
+++ b/include/npc.h
@@ -2,22 +2,7 @@
#define NPC_H
#include "global.h"
-#include "asm.h"
-#include "common.h"
-
-#include "sound.h"
-#include "effects.h"
-#include "room.h"
-#include "flags.h"
-#include "physics.h"
-#include "message.h"
-#include "script.h"
-#include "save.h"
-
#include "entity.h"
-#include "player.h"
-
-#include "structures.h"
typedef enum {
DIALOG_ROOM_FLAG,
diff --git a/include/npc/bigGoron.h b/include/npc/bigGoron.h
new file mode 100644
index 00000000..568c420b
--- /dev/null
+++ b/include/npc/bigGoron.h
@@ -0,0 +1,8 @@
+#ifndef BIGGORON_H
+#define BIGGORON_H
+
+#include "global.h"
+
+extern void sub_0806D0B0(struct Entity_*);
+
+#endif // BIGGORON_H
diff --git a/include/object.h b/include/object.h
index 67c000cf..231f7239 100644
--- a/include/object.h
+++ b/include/object.h
@@ -1,37 +1,8 @@
#ifndef OBJECT_H
#define OBJECT_H
-#include "global.h"
-#include "asm.h"
-#include "common.h"
-
-#include "sound.h"
-#include "flags.h"
-#include "effects.h"
-#include "room.h"
-#include "physics.h"
-
+#include "definitions.h"
#include "entity.h"
-#include "player.h"
-
-void AddInteractablePedestal(Entity*);
-void AddInteractableCheckableObject(Entity*);
-void sub_0808C650(Entity*, u32);
-u32 sub_0808C67C(void);
-void sub_0808C688(void);
-void SyncPlayerToPlatform(Entity*, bool32);
-void UpdateRailMovement(Entity*, u16**, u16*);
-void sub_080A2AF4(Entity*, s32, s32);
-Entity* CreateLargeWaterTrace(Entity*);
-void CreateSparkle(Entity*);
-
-void CreateDust(Entity* parent);
-void CreateDustAt(s32, s32, u32);
-void CreateDustSmall(Entity* parent);
-Entity* CreateWaterTrace(Entity*);
-Entity* CreateSpeechBubbleQuestionMark(Entity*, s32, s32);
-Entity* CreateSpeechBubbleExclamationMark(Entity*, s32, s32);
-Entity* CreateSpeechBubbleSleep(Entity*, s32, s32);
typedef enum {
GROUND_ITEM,
@@ -230,6 +201,25 @@ typedef enum {
LINK_ANIMATION,
} Object;
+Entity* CreateLinkAnimation(Entity* parent, u32 type, u32 type2);
+void ObjectInit(Entity* this);
+u32 LoadObjectSprite(Entity* this, s32 type, const ObjectDefinition* definition);
+Entity* CreateObject(Object id, u32 type, u32 type2);
+Entity* CreateObjectWithParent(Entity* parent, Object id, u32 type, u32 type2);
+extern Entity* CreateGroundItem(Entity*, u32 item, u32 subvalue);
+extern Entity* CreateGroundItemWithFlags(Entity*, u32 item, u32 subvalue, u32 flags);
+void SyncPlayerToPlatform(Entity* this, bool32 param_2);
+void UpdateRailMovement(Entity* this, u16** param_2, u16* param_3);
+Entity* CreateSpeechBubbleExclamationMark(Entity* parent, s32 offsetX, s32 offsetY);
+Entity* CreateSpeechBubbleQuestionMark(Entity* parent, s32 offsetX, s32 offsetY);
+Entity* CreateSpeechBubbleSleep(Entity* parent, s32 offsetX, s32 offsetY);
+
+void AddInteractablePedestal(Entity*);
+void AddInteractableCheckableObject(Entity*);
+void sub_0808C650(Entity*, u32);
+u32 sub_0808C67C(void);
+void sub_0808C688(void);
+
void ItemOnGround();
void DeathFx();
void ItemForSale();
diff --git a/include/object/cutsceneMiscObject.h b/include/object/cutsceneMiscObject.h
new file mode 100644
index 00000000..49772846
--- /dev/null
+++ b/include/object/cutsceneMiscObject.h
@@ -0,0 +1,8 @@
+#ifndef CUTSCENEMISCOBJECT_H
+#define CUTSCENEMISCOBJECT_H
+
+#include "global.h"
+
+extern void sub_08095C48(struct Entity_*);
+
+#endif // CUTSCENEMISCOBJECT_H
diff --git a/include/object/itemOnGround.h b/include/object/itemOnGround.h
index 47ab89a8..151dcc28 100644
--- a/include/object/itemOnGround.h
+++ b/include/object/itemOnGround.h
@@ -12,7 +12,7 @@ typedef struct {
/*0x6c*/ u16 unk_6c;
/*0x6e*/ u16 unk_6e;
/*0x70*/ u8 unused2[22];
- /*0x86*/ u16 unk_86;
+ /*0x86*/ u16 flag;
} ItemOnGroundEntity;
#endif // ITEMONGROUND_H
diff --git a/include/object/lockedDoor.h b/include/object/lockedDoor.h
new file mode 100644
index 00000000..8bbca19c
--- /dev/null
+++ b/include/object/lockedDoor.h
@@ -0,0 +1,8 @@
+#ifndef LOCKEDDOOR_H
+#define LOCKEDDOOR_H
+
+#include "global.h"
+
+extern bool32 sub_08083734(struct Entity_*, u32);
+
+#endif // LOCKEDDOOR_H
diff --git a/include/object/pot.h b/include/object/pot.h
new file mode 100644
index 00000000..65429388
--- /dev/null
+++ b/include/object/pot.h
@@ -0,0 +1,8 @@
+#ifndef POT_H
+#define POT_H
+
+#include "global.h"
+
+extern u32 sub_0808288C(struct Entity_*, u32, u32, u32);
+
+#endif // POT_H
diff --git a/include/object/pushableFurniture.h b/include/object/pushableFurniture.h
index db693183..c17ff6ce 100644
--- a/include/object/pushableFurniture.h
+++ b/include/object/pushableFurniture.h
@@ -19,7 +19,7 @@ typedef struct {
/*0x82*/ u8 unk_82;
/*0x83*/ u8 unk_83;
/*0x84*/ u8 unk_84[0x2];
- /*0x86*/ u16 unk_86;
+ /*0x86*/ u16 flag;
} PushableFurnitureEntity;
#endif // PUSHABLEFURNITURE_H
diff --git a/include/pauseMenu.h b/include/pauseMenu.h
index 1197b2f3..aba00a4a 100644
--- a/include/pauseMenu.h
+++ b/include/pauseMenu.h
@@ -40,4 +40,20 @@ typedef enum {
PauseMenuScreen_19,
} PauseMenuScreen;
+typedef struct {
+ u8 disabled;
+ u8 screen;
+ u8 unk2[0xf]; // cursor positions on the different screens
+ u8 unk11;
+ u8 unk12;
+ u8 unk13;
+ s8 screen2;
+ u8 unk15;
+ s8 unk16;
+ u8 unk17;
+} PauseMenuOptions;
+
+extern PauseMenuOptions gPauseMenuOptions;
+static_assert(sizeof(PauseMenuOptions) == 0x18);
+
#endif // PAUSEMENU_H
diff --git a/include/physics.h b/include/physics.h
index dc6460cc..9c1a8206 100644
--- a/include/physics.h
+++ b/include/physics.h
@@ -55,8 +55,11 @@ extern bool32 ProcessMovement4(Entity*);
extern bool32 ProcessMovement5(Entity*);
extern bool32 ProcessMovement6(Entity*);
extern bool32 ProcessMovementInternal(Entity*, s32, s32, u32);
+extern void sub_080AF284(void);
extern const s16 gSineTable[64];
extern const s16 gCosineTable[256];
+extern u32 BounceUpdate(Entity*, u32);
+
#endif // PHYSICS_H
diff --git a/include/player.h b/include/player.h
index 05f550d3..3248f04f 100644
--- a/include/player.h
+++ b/include/player.h
@@ -609,6 +609,17 @@ typedef struct {
/*0x18*/ Entity* field_0x18;
} ItemBehavior;
+typedef enum { ACTIVE_ITEM_0, ACTIVE_ITEM_1, ACTIVE_ITEM_2, ACTIVE_ITEM_LANTERN, MAX_ACTIVE_ITEMS } ActiveItemIndex;
+/**
+ * Currently active items.
+ * 0: Active items?
+ * 1: Boots, Cape
+ * 2: would be used by CreateItem1 if gActiveItems[1] was already filled
+ * 3: Lamp
+ */
+extern ItemBehavior gActiveItems[MAX_ACTIVE_ITEMS];
+static_assert(sizeof(gActiveItems) == 0x70);
+
extern void (*const gPlayerItemFunctions[])(Entity*);
typedef struct {
@@ -665,6 +676,37 @@ typedef enum {
INTERACTION_NULL = 0xFF,
} InteractionType;
+typedef struct {
+ s8 x;
+ s8 y;
+ s8 width;
+ s8 height;
+} Rect;
+
+typedef struct {
+ /*0x00*/ u8 ignoreLayer; /* if bit 0 set, skip layer check for collision */
+ /*0x01*/ u8 type;
+ /*0x02*/ u8 interactDirections; /* lower 4 bits determine Link's allowed facing directions to interact, 0 to allow
+ (0000WSEN) */
+ /*0x03*/ u8 kinstoneId;
+ /*0x04*/ const Rect* customHitbox; /* optional custom rectangle */
+ /*0x08*/ Entity* entity;
+} InteractableObject;
+
+typedef struct {
+ /*0x00*/ u8 isUpdated;
+ /*0x01*/ u8 unused;
+ /*0x02*/ u8 kinstoneId;
+ /*0x03*/ u8 currentIndex; /* index of currentObject in candidate list, or 0xFF */
+ /*0x04*/ InteractableObject* currentObject;
+ /*0x08*/ InteractableObject
+ candidates[0x20]; /* contains the loaded NPCs, key doors, windcrests and other objects */
+} PossibleInteraction;
+
+static_assert(sizeof(PossibleInteraction) == 0x188);
+
+extern PossibleInteraction gPossibleInteraction;
+
typedef enum {
R_ACTION_NONE,
R_ACTION_CANCEL,
@@ -778,6 +820,8 @@ bool32 HasSwordEquipped();
u32 GetPlayerPalette(bool32 use);
void PlayerShrinkByRay(void);
+extern void InitPlayerMacro(PlayerMacroEntry*);
+
// player.s
extern u32 PlayerCheckNEastTile();
extern u32* DoTileInteractionHere(Entity*, u32);
@@ -786,6 +830,9 @@ extern void sub_08008AC6(Entity*);
extern void sub_08008926(Entity*);
extern void sub_08008AC6(Entity*);
extern void sub_08008AA0(Entity*);
+extern void sub_080085B0(Entity*);
+extern u32 sub_080086B4(u32, u32, const u8*);
+extern u16* DoTileInteraction(struct Entity_*, u32, u32, u32);
// zelda.c
void SetZeldaFollowTarget(Entity* target);
diff --git a/include/playeritem.h b/include/playeritem.h
index 3736cb31..40695872 100644
--- a/include/playeritem.h
+++ b/include/playeritem.h
@@ -1,6 +1,8 @@
#ifndef PLAYERITEM_H
#define PLAYERITEM_H
+#include "global.h"
+
typedef enum {
PLAYER_ITEM_NONE,
PLAYER_ITEM_SWORD,
@@ -29,4 +31,6 @@ typedef enum {
PLAYER_ITEM_CELL_OVERWRITE_SET2,
} PlayerItem;
+extern u32 sub_080040D8(struct Entity_*, u8*, s32, s32);
+
#endif // PLAYERITEM_H
diff --git a/include/room.h b/include/room.h
index 09d2b2fb..1802a934 100644
--- a/include/room.h
+++ b/include/room.h
@@ -3,7 +3,7 @@
#include "entity.h"
#include "droptables.h"
-#include "map.h"
+#include "transitions.h"
enum RoomTransition {
TRANSITION_DEFAULT,
@@ -189,20 +189,6 @@ static_assert(sizeof(RoomTransition) == 0xB0);
extern RoomTransition gRoomTransition;
typedef struct {
- u16 type;
- u8 field_0x2[4];
- s16 playerXPos;
- s16 playerYPos;
- u8 field_0xa;
- u8 area;
- u8 room;
- u8 playerLayer;
- u8 spawn_type;
- u8 playerState;
- u16 transitionSFX;
-} ScreenTransitionData;
-
-typedef struct {
u8 type;
u8 localFlag;
u8 _2;
@@ -246,11 +232,9 @@ Entity* LoadRoomEntity(const EntityData*);
void LoadRoomEntityList(const EntityData* listPtr);
void* GetRoomProperty(u32 area, u32 room, u32 property);
-bool32 LoadFixedGFX(Entity*, u32);
-void UnloadGFXSlots(Entity*);
void LoadSmallChestTile2(TileEntity*);
void sub_0804B0B0(u32 arg0, u32 arg1);
-void DoExitTransition(const ScreenTransitionData* data);
+void DoExitTransition(const Transition* data);
#endif // ROOM_H
diff --git a/include/save.h b/include/save.h
index bc966efc..6269380a 100644
--- a/include/save.h
+++ b/include/save.h
@@ -3,11 +3,22 @@
#include "global.h"
#include "player.h"
-#include "structures.h"
#include "room.h"
#define FILENAME_LENGTH 6
+typedef struct {
+ int signature;
+ u8 saveFileId;
+ u8 msg_speed;
+ u8 brightness;
+ u8 language;
+ u8 name[6];
+ u8 invalid;
+ u8 initialized;
+} SaveHeader;
+#define gSaveHeader ((SaveHeader*)(0x2000000))
+
typedef enum {
SAVE_BUSY = 0,
SAVE_OK = 1,
diff --git a/include/screen.h b/include/screen.h
index a1391401..fd0dd0b7 100644
--- a/include/screen.h
+++ b/include/screen.h
@@ -2,7 +2,6 @@
#define SCREEN_H
#include "global.h"
-#include "fade.h"
typedef struct {
/*0x00*/ u16 displayControl;
@@ -76,17 +75,6 @@ typedef struct {
// /*0x78*/ u32 _78;
} Screen;
-typedef struct {
- s16 x;
- s16 y;
- u16 _4;
- u16 _6;
- u16 _8;
-} OAMCommand;
-
extern Screen gScreen;
-extern OAMCommand gOamCmd;
-
-extern void sub_080ADA04(OAMCommand*, void*);
#endif // SCREEN_H
diff --git a/include/screenTransitions.h b/include/screenTransitions.h
index fa1d98b5..2a28b04f 100644
--- a/include/screenTransitions.h
+++ b/include/screenTransitions.h
@@ -1,37 +1,37 @@
#ifndef SCREENTRANSITIONS_H
#define SCREENTRANSITIONS_H
-#include "room.h"
+#include "transitions.h"
-extern const ScreenTransitionData* const gWallMasterScreenTransitions[];
-extern const ScreenTransitionData gUnk_0813AB58;
-extern const ScreenTransitionData gUnk_0813AB6C;
-extern const ScreenTransitionData gUnk_0813AB80;
-extern const ScreenTransitionData gUnk_0813AB94;
-extern const ScreenTransitionData gUnk_0813ABA8;
-extern const ScreenTransitionData gUnk_0813ABBC;
-extern const ScreenTransitionData gUnk_0813ABD0;
-extern const ScreenTransitionData gUnk_0813ABE4;
-extern const ScreenTransitionData gUnk_0813ABF8;
-extern const ScreenTransitionData gUnk_0813AC0C;
-extern const ScreenTransitionData gUnk_0813AC20;
-extern const ScreenTransitionData gUnk_0813AC34;
-extern const ScreenTransitionData gUnk_0813AC48;
-extern const ScreenTransitionData gUnk_0813AC5C;
-extern const ScreenTransitionData gUnk_0813AC70;
-extern const ScreenTransitionData gUnk_0813AC84;
-extern const ScreenTransitionData gUnk_0813AC98;
-extern const ScreenTransitionData gUnk_0813ACAC;
-extern const ScreenTransitionData gUnk_0813ACC0;
-extern const ScreenTransitionData gUnk_0813ACD4;
-extern const ScreenTransitionData gUnk_0813ACE8;
-extern const ScreenTransitionData gUnk_0813ACFC;
-extern const ScreenTransitionData gUnk_0813AD10; // w
-extern const ScreenTransitionData gUnk_0813AD24; // m
-extern const ScreenTransitionData gUnk_0813AD38; // l
-extern const ScreenTransitionData gUnk_0813AD4C;
-extern const ScreenTransitionData gUnk_0813AD60;
-extern const ScreenTransitionData gUnk_0813AD74;
-extern const ScreenTransitionData gUnk_0813AD88[];
-extern const ScreenTransitionData gUnk_0813ADEC[];
+extern const Transition* const gWallMasterScreenTransitions[];
+extern const Transition gUnk_0813AB58;
+extern const Transition gUnk_0813AB6C;
+extern const Transition gUnk_0813AB80;
+extern const Transition gUnk_0813AB94;
+extern const Transition gUnk_0813ABA8;
+extern const Transition gUnk_0813ABBC;
+extern const Transition gUnk_0813ABD0;
+extern const Transition gUnk_0813ABE4;
+extern const Transition gUnk_0813ABF8;
+extern const Transition gUnk_0813AC0C;
+extern const Transition gUnk_0813AC20;
+extern const Transition gUnk_0813AC34;
+extern const Transition gUnk_0813AC48;
+extern const Transition gUnk_0813AC5C;
+extern const Transition gUnk_0813AC70;
+extern const Transition gUnk_0813AC84;
+extern const Transition gUnk_0813AC98;
+extern const Transition gUnk_0813ACAC;
+extern const Transition gUnk_0813ACC0;
+extern const Transition gUnk_0813ACD4;
+extern const Transition gUnk_0813ACE8;
+extern const Transition gUnk_0813ACFC;
+extern const Transition gUnk_0813AD10; // w
+extern const Transition gUnk_0813AD24; // m
+extern const Transition gUnk_0813AD38; // l
+extern const Transition gUnk_0813AD4C;
+extern const Transition gUnk_0813AD60;
+extern const Transition gUnk_0813AD74;
+extern const Transition gUnk_0813AD88[];
+extern const Transition gUnk_0813ADEC[];
#endif // SCREENTRANSITIONS_H
diff --git a/include/script.h b/include/script.h
index 6a0688d6..de391faf 100644
--- a/include/script.h
+++ b/include/script.h
@@ -64,4 +64,7 @@ void ExecuteScriptAndHandleAnimation(Entity* entity, void (*postScriptCallback)(
ScriptExecutionContext* CreateScriptExecutionContext(void);
void InitScriptForEntity(Entity* entity, ScriptExecutionContext* context, Script* script);
+extern u32 ResolveCollisionLayer(struct Entity_*);
+extern void UpdateCollisionLayer(struct Entity_*);
+
#endif // SCRIPT_H
diff --git a/include/scroll.h b/include/scroll.h
index 3f6d47b4..486814f2 100644
--- a/include/scroll.h
+++ b/include/scroll.h
@@ -2,8 +2,21 @@
#define SCROLL_H
#include "global.h"
+#include "transitions.h"
+
+typedef struct {
+ u16 unk_00;
+ u8 unk_02[0xE];
+} struct_02034480;
+extern struct_02034480 gUnk_02034480;
+
+extern bool32 DoApplicableTransition(u32, u32, u32, u32);
+extern void DoExitTransitionWithType(const Transition* screenTransition, u32 transitionType);
void UpdateIsDiggingCave(void);
void sub_08080930(u32);
+extern void sub_080809D4(void);
+extern void sub_08080CB4(struct Entity_*);
+
#endif // SCROLL_H
diff --git a/include/structures.h b/include/structures.h
index 97233eea..811bae31 100644
--- a/include/structures.h
+++ b/include/structures.h
@@ -2,306 +2,6 @@
#define STRUCTURES_H
#include "global.h"
-#include "entity.h"
-#include "player.h"
-
-typedef struct {
- int signature;
- u8 saveFileId;
- u8 msg_speed;
- u8 brightness;
- u8 language;
- u8 name[6];
- u8 invalid;
- u8 initialized;
-} SaveHeader;
-#define gSaveHeader ((SaveHeader*)(0x2000000))
-
-typedef struct {
- u8 unk_00;
- u8 unk_01;
- u8 unk_02[0xE];
-} struct_02000040;
-
-extern struct_02000040 gUnk_02000040;
-
-typedef struct {
- s32 signature;
- u8 field_0x4;
- u8 listenForKeyPresses;
- u8 field_0x6;
- u8 field_0x7;
- u8 pad[24];
-} struct_02000010;
-static_assert(sizeof(struct_02000010) == 0x20);
-
-extern struct_02000010 gUnk_02000010;
-
-typedef struct {
- u8 unk0;
- u8 unk1;
- u16 unk2;
-} struct_020354C0;
-extern struct_020354C0 gUnk_020354C0[0x20];
-
-#define MAX_UI_ELEMENTS 24
-
-typedef enum {
- UI_ELEMENT_BUTTON_A,
- UI_ELEMENT_BUTTON_B,
- UI_ELEMENT_BUTTON_R,
- UI_ELEMENT_ITEM_A,
- UI_ELEMENT_ITEM_B,
- UI_ELEMENT_TEXT_R,
- UI_ELEMENT_HEART,
- UI_ELEMENT_EZLONAGSTART,
- UI_ELEMENT_EZLONAGACTIVE,
- UI_ELEMENT_TEXT_A,
- UI_ELEMENT_TEXT_B
-} UIElementType;
-
-/**
- * @brief Floating UI element
- */
-typedef struct {
- u8 used : 1;
- u8 unk_0_1 : 1;
- u8 unk_0_2 : 2; // Load data into VRAM? 0: do not load, 1: ready to load 2: loaded
- u8 unk_0_4 : 4;
- u8 type; /**< @see UIElementType */
- u8 type2; // Subtype
- u8 buttonElementId; /**< Id of the button UI element this text is attached to */
- u8 action;
- u8 unk_5;
- u8 unk_6;
- u8 unk_7;
- u8 unk_8;
- u8 unk_9[3];
- u16 x;
- u16 y;
- u8 frameIndex;
- u8 duration;
- u8 spriteSettings;
- u8 frameSettings;
- Frame* framePtr;
- u8 unk_18;
- u8 numTiles;
- u16 unk_1a; // TODO oam id? VRAM target (element->unk_1a * 0x20 + 0x6010000)
- u32* firstTile;
-} UIElement;
-
-typedef enum {
- HUD_HIDE_NONE,
- HUD_HIDE_1 = 0x1, // A
- HUD_HIDE_2 = 0x2, // B
- HUD_HIDE_4 = 0x4, // R
- HUD_HIDE_8 = 0x8,
- HUD_HIDE_HEARTS = 0x10,
- HUD_HIDE_CHARGE_BAR = 0x20,
- HUD_HIDE_RUPEES = 0x40,
- HUD_HIDE_KEYS = 0x80,
-
- HUD_HIDE_ALL = 0xff
-} HUDHideFlags;
-
-typedef struct {
- u8 unk_0;
- u8 hideFlags;
- u8 unk_2;
- u8 health;
- u8 maxHealth;
- u8 unk_5;
- u8 unk_6;
- u8 unk_7;
- u8 unk_8;
- u8 unk_9;
- u8 unk_a;
- u8 unk_b;
- u8 unk_c;
- u8 unk_d;
- u16 rupees;
- u8 unk_10; // TODO drawing keys dirty flag or something?
- u8 unk_11;
- u8 dungeonKeys;
- s8 unk_13;
- s8 unk_14;
- u8 unk_15;
- u16 buttonX[3]; /**< X coordinates for the button UI elements */
- u16 buttonY[3]; /**< Y coordinates for the button UI elements */
- u8 filler22[0x2];
- u8 ezloNagFuncIndex;
- u8 filler25[7];
- u8 rActionInteractObject; // used as R button UI frame index
- u8 rActionInteractTile;
- u8 rActionGrabbing;
- u8 rActionPlayerState; // if not 0, overrides other R actions
- u8 buttonText[3];
- u8 unk_33;
- UIElement elements[MAX_UI_ELEMENTS];
-} HUD;
-extern HUD gHUD;
-
-#define MAX_GFX_SLOTS 44
-
-typedef enum {
- GFX_SLOT_FREE,
- GFX_SLOT_UNLOADED, // some sort of free? no longer in use?
- GFX_SLOT_STATUS2, // some sort of free?
- GFX_SLOT_FOLLOWER, // Set by SetGFXSlotStatus for the following slots
- GFX_SLOT_RESERVED, // maybe ready to be loaded?
- GFX_SLOT_GFX,
- GFX_SLOT_PALETTE
-} GfxSlotStatus;
-
-typedef enum {
- GFX_VRAM_0,
- GFX_VRAM_1, // uploaded to vram?
- GFX_VRAM_2,
- GFX_VRAM_3, // not yet uploaded to vram?
-} GfxSlotVramStatus;
-
-typedef struct {
- /*0x00*/ u8 status : 4;
- /*0x00*/ u8 vramStatus : 4; // Whether the gfx was uploaded to the vram?
- /*0x01*/ u8 slotCount;
- /*0x02*/ u8 referenceCount; /**< How many entities use this gfx slot */
- /*0x03*/ u8 unk_3;
- /*0x04*/ u16 gfxIndex;
- /*0x06*/ u16 paletteIndex;
- /*0x08*/ const void* palettePointer;
-} GfxSlot;
-
-typedef struct {
- /*0x00*/ u8 unk0;
- /*0x01*/ u8 unk_1;
- /*0x02*/ u8 unk_2;
- /*0x03*/ u8 unk_3;
- /*0x04*/ GfxSlot slots[MAX_GFX_SLOTS];
-} GfxSlotList;
-extern GfxSlotList gGFXSlots;
-
-static_assert(sizeof(GfxSlotList) == 0x214);
-
-typedef struct {
- u16 unk_00;
- u8 unk_02[0xE];
-} struct_02034480;
-extern struct_02034480 gUnk_02034480;
-
-extern u16 gBG0Buffer[0x400];
-extern u16 gBG1Buffer[0x400];
-extern u16 gBG2Buffer[0x400];
-extern u16 gBG3Buffer[0x800];
-
-typedef enum { ACTIVE_ITEM_0, ACTIVE_ITEM_1, ACTIVE_ITEM_2, ACTIVE_ITEM_LANTERN, MAX_ACTIVE_ITEMS } ActiveItemIndex;
-/**
- * Currently active items.
- * 0: Active items?
- * 1: Boots, Cape
- * 2: would be used by CreateItem1 if gActiveItems[1] was already filled
- * 3: Lamp
- */
-extern ItemBehavior gActiveItems[MAX_ACTIVE_ITEMS];
-static_assert(sizeof(gActiveItems) == 0x70);
-
-typedef struct {
- u8 event_priority; // system requested priority
- u8 ent_priority; // entity requested priority
- u8 queued_priority;
- u8 queued_priority_reset;
- Entity* requester;
- u16 priority_timer;
-} PriorityHandler;
-extern PriorityHandler gPriorityHandler;
-
-typedef struct {
- u8 disabled;
- u8 screen;
- u8 unk2[0xf]; // cursor positions on the different screens
- u8 unk11;
- u8 unk12;
- u8 unk13;
- s8 screen2;
- u8 unk15;
- s8 unk16;
- u8 unk17;
-} PauseMenuOptions;
-
-extern PauseMenuOptions gPauseMenuOptions;
-static_assert(sizeof(PauseMenuOptions) == 0x18);
-
-typedef struct {
- u8 unk00 : 1;
- u8 unk01 : 3;
- u8 unk04 : 4;
- u8 unk1;
- u8 charColor;
- u8 bgColor;
- u16 unk4;
- u16 unk6;
- void* unk8;
-} WStruct;
-
-static_assert(sizeof(WStruct) == 12);
-
-typedef struct {
- u8 unk0;
- u8 unk1;
- u16 unk2;
- u8 unk4;
- u8 unk5;
- u8 unk6;
- u8 unk7;
-} OAMObj;
-
-typedef struct {
- u8 field_0x0;
- u8 field_0x1;
- u8 spritesOffset;
- u8 updated;
- u16 _4;
- u16 _6;
- u8 _0[0x18];
- struct OamData oam[0x80];
- OAMObj unk[0xA0]; /* todo: affine */
-} OAMControls;
-extern OAMControls gOAMControls;
-
-typedef struct {
- union SplitWord _0;
- union SplitWord _4;
-} struct_020227E8;
-
-typedef struct {
- s8 x;
- s8 y;
- s8 width;
- s8 height;
-} Rect;
-
-typedef struct {
- /*0x00*/ u8 ignoreLayer; /* if bit 0 set, skip layer check for collision */
- /*0x01*/ u8 type;
- /*0x02*/ u8 interactDirections; /* lower 4 bits determine Link's allowed facing directions to interact, 0 to allow
- (0000WSEN) */
- /*0x03*/ u8 kinstoneId;
- /*0x04*/ const Rect* customHitbox; /* optional custom rectangle */
- /*0x08*/ Entity* entity;
-} InteractableObject;
-
-typedef struct {
- /*0x00*/ u8 isUpdated;
- /*0x01*/ u8 unused;
- /*0x02*/ u8 kinstoneId;
- /*0x03*/ u8 currentIndex; /* index of currentObject in candidate list, or 0xFF */
- /*0x04*/ InteractableObject* currentObject;
- /*0x08*/ InteractableObject
- candidates[0x20]; /* contains the loaded NPCs, key doors, windcrests and other objects */
-} PossibleInteraction;
-
-static_assert(sizeof(PossibleInteraction) == 0x188);
-
-extern PossibleInteraction gPossibleInteraction;
typedef struct {
u8 numTiles;
@@ -316,83 +16,11 @@ typedef struct {
u32 pad;
} SpritePtr;
-extern SpritePtr gSpritePtrs[];
-
-typedef struct {
- u16* dest;
- void* gfx_dest;
- void* buffer_loc;
- u32 _c;
- u16 gfx_src;
- u8 width;
- u8 right_align : 1;
- u8 sm_border : 1;
- u8 unused : 1;
- u8 draw_border : 1;
- u8 border_type : 4;
- u8 fill_type;
- u8 charColor;
- u8 _16;
- u8 stylized;
-} Font;
-
-typedef struct {
- u8 unk_0;
- u8 unk_1;
- u8 unk_2[2];
- u16 unk_4;
- u8 filler[12];
- Entity* unk_14;
- u8 unk_18;
- u8 unk_19;
- u8 unk_1a;
- u8 unk_1b;
-} struct_02018EB0;
-
-extern struct_02018EB0 gUnk_02018EB0;
-
-typedef struct {
- s16 tileIndex;
- s16 tilePosOffset;
-} TileData;
-
-typedef struct {
- /*0x00*/ bool8 isOnlyActiveFirstFrame; /**< Is the behavior for this item only created on the first frame */
- /*0x01*/ u8 priority;
- /*0x02*/ u8 createFunc;
- /*0x03*/ u8 playerItemId; /**< Id for the corresponsing PlayerItem. */
- /*0x04*/ u16 frameIndex;
- /*0x06*/ u8 animPriority;
- /*0x07*/ bool8 isChangingAttackStatus;
- /*0x08*/ bool8 isUseableAsMinish;
- /*0x09*/ u8 pad[3];
-} ItemDefinition;
-
-static_assert(sizeof(ItemDefinition) == 0xc);
+extern const SpritePtr gSpritePtrs[];
typedef struct {
u8 frame;
u8 frameIndex;
} PACKED FrameStruct;
-typedef struct {
- /*0x0*/ u8 menuType;
- /*0x1*/ u16 font;
- /*0x3*/ u8 unk_3; // TODO padding?
- /*0x4*/ u16 transitionTimer;
- /*0x6*/ u16 gfxEntry;
- /*0x8*/ u16 bg2XOffset;
- /*0xa*/ u16 sm_unk_14;
-} PACKED StaffrollEntry;
-
-static_assert(sizeof(StaffrollEntry) == 0xc);
-
-typedef struct {
- u8 paletteGroup;
- u8 gfxGroup;
-} PACKED StaffrollGfxEntry;
-
-extern const u8 gGlobalGfxAndPalettes[];
-extern u32 gUsedPalettes;
-
#endif // STRUCTURES_H
diff --git a/include/subtask.h b/include/subtask.h
index e1d98a16..c1c4894f 100644
--- a/include/subtask.h
+++ b/include/subtask.h
@@ -95,7 +95,7 @@ u32 sub_080A6F40();
s32 sub_080A69E0();
const OverworldLocation* GetOverworldLocation(u32 x, u32 y);
void sub_080A6498(void);
-void sub_080A71F4(const ScreenTransitionData* exitTransition);
+void sub_080A71F4(const Transition* exitTransition);
void sub_080A6F6C(u32 textIndexOrPtr);
typedef struct {
@@ -117,4 +117,7 @@ extern const struct_gUnk_08128E94 gUnk_08128E94[];
#define DRAW_DIRECT_SPRITE_INDEX 0x1fb
#endif
+extern void MenuFadeIn(u32, u32);
+extern void sub_080A71C4(u32, u32, u32, u32);
+
#endif // SUBTASK_H
diff --git a/include/transitions.h b/include/transitions.h
index 3da9d77e..dd4dfc30 100644
--- a/include/transitions.h
+++ b/include/transitions.h
@@ -7,7 +7,9 @@
typedef enum {
WARP_TYPE_BORDER,
WARP_TYPE_AREA,
- WARP_TYPE_END_OF_LIST = -1,
+ WARP_TYPE_BORDER2,
+ WARP_TYPE_AREA2,
+ WARP_TYPE_END_OF_LIST = 0xffff,
} WarpType;
typedef enum {
@@ -26,9 +28,28 @@ typedef enum {
TRANSITION_TYPE_FLY_IN,
} TransitionType;
+typedef enum {
+ TRANSITION_SHAPE_AREA_12x12,
+ TRANSITION_SHAPE_AREA_12x28,
+ TRANSITION_SHAPE_AREA_28x12,
+ TRANSITION_SHAPE_AREA_44x12,
+
+ TRANSITION_SHAPE_BORDER_NORTH_WEST = 0x01,
+ TRANSITION_SHAPE_BORDER_NORTH_EAST = 0x02,
+ TRANSITION_SHAPE_BORDER_NORTH = 0x03,
+ TRANSITION_SHAPE_BORDER_EAST_NORTH = 0x04,
+ TRANSITION_SHAPE_BORDER_EAST_SOUTH = 0x08,
+ TRANSITION_SHAPE_BORDER_EAST = 0x0c,
+ TRANSITION_SHAPE_BORDER_SOUTH_WEST = 0x10,
+ TRANSITION_SHAPE_BORDER_SOUTH_EAST = 0x20,
+ TRANSITION_SHAPE_BORDER_SOUTH = 0x30,
+ TRANSITION_SHAPE_BORDER_WEST_NORTH = 0x40,
+ TRANSITION_SHAPE_BORDER_WEST_SOUTH = 0x80,
+ TRANSITION_SHAPE_BORDER_WEST = 0xc0,
+} TransitionShape;
+
typedef struct Transition {
- WarpType warp_type : 8;
- u8 subtype;
+ u16 warp_type; /**< @see WarpType */
u16 startX;
u16 startY;
u16 endX;
@@ -36,11 +57,10 @@ typedef struct Transition {
u8 shape;
u8 area;
RoomID room : 8;
- u8 height;
+ u8 layer;
TransitionType transition_type : 8;
u8 facing_direction; // 0-4
- u8 unk0;
- u8 unk1;
+ u16 transitionSFX;
u8 unk2;
u8 unk3;
} Transition;
diff --git a/include/ui.h b/include/ui.h
index 2a4994ee..77c27f4a 100644
--- a/include/ui.h
+++ b/include/ui.h
@@ -2,8 +2,107 @@
#define UI_H
#include "global.h"
+#include "sprite.h"
+
+#define MAX_UI_ELEMENTS 24
+
+typedef enum {
+ UI_ELEMENT_BUTTON_A,
+ UI_ELEMENT_BUTTON_B,
+ UI_ELEMENT_BUTTON_R,
+ UI_ELEMENT_ITEM_A,
+ UI_ELEMENT_ITEM_B,
+ UI_ELEMENT_TEXT_R,
+ UI_ELEMENT_HEART,
+ UI_ELEMENT_EZLONAGSTART,
+ UI_ELEMENT_EZLONAGACTIVE,
+ UI_ELEMENT_TEXT_A,
+ UI_ELEMENT_TEXT_B
+} UIElementType;
+
+/**
+ * @brief Floating UI element
+ */
+typedef struct {
+ u8 used : 1;
+ u8 unk_0_1 : 1;
+ u8 unk_0_2 : 2; // Load data into VRAM? 0: do not load, 1: ready to load 2: loaded
+ u8 unk_0_4 : 4;
+ u8 type; /**< @see UIElementType */
+ u8 type2; // Subtype
+ u8 buttonElementId; /**< Id of the button UI element this text is attached to */
+ u8 action;
+ u8 unk_5;
+ u8 unk_6;
+ u8 unk_7;
+ u8 unk_8;
+ u8 unk_9[3];
+ u16 x;
+ u16 y;
+ u8 frameIndex;
+ u8 duration;
+ u8 spriteSettings;
+ u8 frameSettings;
+ Frame* framePtr;
+ u8 unk_18;
+ u8 numTiles;
+ u16 unk_1a; // TODO oam id? VRAM target (element->unk_1a * 0x20 + 0x6010000)
+ u32* firstTile;
+} UIElement;
+
+typedef enum {
+ HUD_HIDE_NONE,
+ HUD_HIDE_1 = 0x1, // A
+ HUD_HIDE_2 = 0x2, // B
+ HUD_HIDE_4 = 0x4, // R
+ HUD_HIDE_8 = 0x8,
+ HUD_HIDE_HEARTS = 0x10,
+ HUD_HIDE_CHARGE_BAR = 0x20,
+ HUD_HIDE_RUPEES = 0x40,
+ HUD_HIDE_KEYS = 0x80,
+
+ HUD_HIDE_ALL = 0xff
+} HUDHideFlags;
+
+typedef struct {
+ u8 unk_0;
+ u8 hideFlags;
+ u8 unk_2;
+ u8 health;
+ u8 maxHealth;
+ u8 unk_5;
+ u8 unk_6;
+ u8 unk_7;
+ u8 unk_8;
+ u8 unk_9;
+ u8 unk_a;
+ u8 unk_b;
+ u8 unk_c;
+ u8 unk_d;
+ u16 rupees;
+ u8 unk_10; // TODO drawing keys dirty flag or something?
+ u8 unk_11;
+ u8 dungeonKeys;
+ s8 unk_13;
+ s8 unk_14;
+ u8 unk_15;
+ u16 buttonX[3]; /**< X coordinates for the button UI elements */
+ u16 buttonY[3]; /**< Y coordinates for the button UI elements */
+ u8 filler22[0x2];
+ u8 ezloNagFuncIndex;
+ u8 filler25[7];
+ u8 rActionInteractObject; // used as R button UI frame index
+ u8 rActionInteractTile;
+ u8 rActionGrabbing;
+ u8 rActionPlayerState; // if not 0, overrides other R actions
+ u8 buttonText[3];
+ u8 unk_33;
+ UIElement elements[MAX_UI_ELEMENTS];
+} HUD;
+extern HUD gHUD;
extern void DrawUIElements(void);
+extern void UpdateUIElements(void);
extern void CreateUIElement(u32, u32);
extern void sub_0801C2F0(u32, u32);
extern void sub_0801C25C(void);
diff --git a/include/vram.h b/include/vram.h
new file mode 100644
index 00000000..26fa4412
--- /dev/null
+++ b/include/vram.h
@@ -0,0 +1,81 @@
+#ifndef VRAM_H
+#define VRAM_H
+
+#include "global.h"
+#include "entity.h"
+
+#define MAX_GFX_SLOTS 44
+
+typedef enum {
+ GFX_SLOT_FREE,
+ GFX_SLOT_UNLOADED, // some sort of free? no longer in use?
+ GFX_SLOT_STATUS2, // some sort of free?
+ GFX_SLOT_FOLLOWER, // Set by SetGFXSlotStatus for the following slots
+ GFX_SLOT_RESERVED, // maybe ready to be loaded?
+ GFX_SLOT_GFX,
+ GFX_SLOT_PALETTE
+} GfxSlotStatus;
+
+typedef enum {
+ GFX_VRAM_0,
+ GFX_VRAM_1, // uploaded to vram?
+ GFX_VRAM_2,
+ GFX_VRAM_3, // not yet uploaded to vram?
+} GfxSlotVramStatus;
+
+typedef struct {
+ /*0x00*/ u8 status : 4;
+ /*0x00*/ u8 vramStatus : 4; // Whether the gfx was uploaded to the vram?
+ /*0x01*/ u8 slotCount;
+ /*0x02*/ u8 referenceCount; /**< How many entities use this gfx slot */
+ /*0x03*/ u8 unk_3;
+ /*0x04*/ u16 gfxIndex;
+ /*0x06*/ u16 paletteIndex;
+ /*0x08*/ const void* palettePointer;
+} GfxSlot;
+
+typedef struct {
+ /*0x00*/ u8 unk0;
+ /*0x01*/ u8 unk_1;
+ /*0x02*/ u8 unk_2;
+ /*0x03*/ u8 unk_3;
+ /*0x04*/ GfxSlot slots[MAX_GFX_SLOTS];
+} GfxSlotList;
+extern GfxSlotList gGFXSlots;
+
+static_assert(sizeof(GfxSlotList) == 0x214);
+
+extern bool32 LoadFixedGFX(Entity*, u32);
+extern bool32 LoadSwapGFX(Entity*, u32, u32);
+extern void UnloadGFXSlots(Entity*);
+extern void sub_080ADD70(void);
+
+extern u16 gBG0Buffer[0x400];
+extern u16 gBG1Buffer[0x400];
+extern u16 gBG2Buffer[0x400];
+extern u16 gBG3Buffer[0x800];
+
+typedef struct {
+ u8 unk0;
+ u8 unk1;
+ u16 unk2;
+ u8 unk4;
+ u8 unk5;
+ u8 unk6;
+ u8 unk7;
+} OAMObj;
+
+typedef struct {
+ u8 field_0x0;
+ u8 field_0x1;
+ u8 spritesOffset;
+ u8 updated;
+ u16 _4;
+ u16 _6;
+ u8 _0[0x18];
+ struct OamData oam[0x80];
+ OAMObj unk[0xA0]; /* todo: affine */
+} OAMControls;
+extern OAMControls gOAMControls;
+
+#endif // VRAM_H