summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorHenny022p <info@henny022.de>2025-03-09 12:01:00 +0000
committerHenny022p <info@henny022.de>2025-03-09 19:00:33 +0000
commit46506530fc489732833e26d321b8879e9b13e6b4 (patch)
treeb4a93723ef662c60c2b5a6e3f755efd8994e3f5a /include
parent3b9b1a388beba1d8293bea15352775a6139d3d52 (diff)
cleanup structures.h
Diffstat (limited to 'include')
-rw-r--r--include/beanstalkSubtask.h15
-rw-r--r--include/color.h2
-rw-r--r--include/entity.h10
-rw-r--r--include/fade.h3
-rw-r--r--include/gfx.h8
-rw-r--r--include/itemDefinitions.h20
-rw-r--r--include/main.h12
-rw-r--r--include/message.h8
-rw-r--r--include/pauseMenu.h16
-rw-r--r--include/player.h31
-rw-r--r--include/scroll.h6
-rw-r--r--include/structures.h268
-rw-r--r--include/ui.h98
-rw-r--r--include/vram.h28
14 files changed, 257 insertions, 268 deletions
diff --git a/include/beanstalkSubtask.h b/include/beanstalkSubtask.h
index e89df836..3a91465e 100644
--- a/include/beanstalkSubtask.h
+++ b/include/beanstalkSubtask.h
@@ -45,4 +45,19 @@ typedef struct {
*/
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/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/entity.h b/include/entity.h
index de76f3b7..a332089e 100644
--- a/include/entity.h
+++ b/include/entity.h
@@ -537,6 +537,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
diff --git a/include/fade.h b/include/fade.h
index c9b30e10..e623df25 100644
--- a/include/fade.h
+++ b/include/fade.h
@@ -100,4 +100,7 @@ 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/gfx.h b/include/gfx.h
new file mode 100644
index 00000000..b0ecd2a4
--- /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/itemDefinitions.h b/include/itemDefinitions.h
new file mode 100644
index 00000000..f48fa18a
--- /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/main.h b/include/main.h
index 859f90ce..8a38f36f 100644
--- a/include/main.h
+++ b/include/main.h
@@ -101,6 +101,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.
*/
diff --git a/include/message.h b/include/message.h
index ddbc473e..dbb5ac55 100644
--- a/include/message.h
+++ b/include/message.h
@@ -127,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.
*/
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/player.h b/include/player.h
index 956c98f7..ac8bcddf 100644
--- a/include/player.h
+++ b/include/player.h
@@ -676,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,
diff --git a/include/scroll.h b/include/scroll.h
index a100093c..486814f2 100644
--- a/include/scroll.h
+++ b/include/scroll.h
@@ -4,6 +4,12 @@
#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);
diff --git a/include/structures.h b/include/structures.h
index 68dd1f10..811bae31 100644
--- a/include/structures.h
+++ b/include/structures.h
@@ -2,223 +2,6 @@
#define STRUCTURES_H
#include "global.h"
-#include "entity.h"
-
-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;
-
-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 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 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 {
- 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;
@@ -233,60 +16,11 @@ typedef struct {
u32 pad;
} SpritePtr;
-extern SpritePtr gSpritePtrs[];
-
-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 {
- /*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/ui.h b/include/ui.h
index 669c29d1..77c27f4a 100644
--- a/include/ui.h
+++ b/include/ui.h
@@ -2,6 +2,104 @@
#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);
diff --git a/include/vram.h b/include/vram.h
index a3fde71c..eae470e5 100644
--- a/include/vram.h
+++ b/include/vram.h
@@ -50,4 +50,32 @@ 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