summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authoroctorock <79596758+octorock@users.noreply.github.com>2023-12-29 23:07:22 +0100
committeroctorock <79596758+octorock@users.noreply.github.com>2023-12-29 23:07:22 +0100
commit242336c3851f33caa09af7ab332071d1ae9fb8bf (patch)
treee7dfa362696260756c5585b90224fc2ac1291a5f /include
parent870c08fad6576a219deca4e6f6cc46634267248e (diff)
parentc2f081600bca5c3f1f82d7bac8bc5827faf0d17a (diff)
Merge branch 'master' into enemies
Diffstat (limited to 'include')
-rw-r--r--include/entity.h36
-rw-r--r--include/functions.h2
-rw-r--r--include/message.h4
-rw-r--r--include/object/linkAnimation.h23
-rw-r--r--include/player.h36
-rw-r--r--include/structures.h4
6 files changed, 68 insertions, 37 deletions
diff --git a/include/entity.h b/include/entity.h
index 78dcde47..067e9ff4 100644
--- a/include/entity.h
+++ b/include/entity.h
@@ -6,7 +6,9 @@
#include "color.h"
#include "sprite.h"
-#define MAX_ENTITIES 71
+#define MAX_ENTITIES 72
+#define MAX_MANAGERS 32
+#define MAX_AUX_PLAYER_ENTITIES 7
/** Kinds of Entity's supported by the game. */
typedef enum {
@@ -38,6 +40,8 @@ typedef enum {
typedef enum {
ENT_DID_INIT = 0x1, /**< Graphics and other data loaded. */
ENT_SCRIPTED = 0x2, /**< Execute in a scripted environment. */
+ ENT_UNUSED1 = 0x4, /**< Unused delete flag. */
+ ENT_UNUSED2 = 0x8, /**< Unused delete flag. */
ENT_DELETED = 0x10, /**< Queue deletion next frame. */
ENT_PERSIST = 0x20, /**< Persist between rooms. */
ENT_COLLIDE = 0x80, /**< Collide with other Entity's. */
@@ -238,6 +242,15 @@ typedef struct LinkedList {
Entity* first;
} LinkedList;
+/**
+ * LinkedList's which point to allocate Entities.
+ * These work together with Entity.prev and Entity.next fields
+ * to allow the iteration of all Entity's.
+ */
+extern LinkedList gEntityLists[9];
+extern Entity gAuxPlayerEntities[MAX_AUX_PLAYER_ENTITIES];
+extern Entity gEntities[MAX_ENTITIES];
+
typedef void(EntityAction)(Entity*);
typedef void (*EntityActionPtr)(Entity*);
typedef void (*const* EntityActionArray)(Entity*);
@@ -283,7 +296,7 @@ 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* CreateItemGetEntity(void);
+Entity* CreateAuxPlayerEntity(void);
Entity* CreateFx(Entity* parent, u32 type, u32 type2);
/// @}
@@ -386,12 +399,15 @@ Entity* FindEntity(u32 kind, u32 id, u32 listIndex, u32 type, u32 type2);
* @param entity Entity to set the priority of.
* @param prio #Priority level.
*/
-void SetDefaultPriority(Entity* entity, u32 prio);
+void SetEntityPriority(Entity* entity, u32 prio);
/**
- * Check if entity will be deleted next frame.
+ * Check if entity is disabled. Entities are disabled if:
+ * - They are deleted.
+ * - There is an event and the entity doesn't have priority
+ * (n/a if entity is in action 0).
*/
-bool32 EntityIsDeleted(Entity* entity);
+bool32 EntityDisabled(Entity* entity);
/**
* Check if system or entity is blocking updates.
@@ -477,18 +493,10 @@ void SetInitializationPriority(void);
/**
* Reset the system update priority.
*/
-void ResetSystemPriority(void);
+void ClearEventPriority(void);
void sub_0805E958(void);
-/**
- * LinkedList's which point to allocate Entities.
- * These work together with Entity.prev and Entity.next fields
- * to allow the iteration of all Entity's.
- */
-extern LinkedList gEntityLists[9];
-extern Entity gItemGetEntities[7];
-
typedef struct {
u8 unk_0;
u8 unk_1;
diff --git a/include/functions.h b/include/functions.h
index a770563b..49fb3f31 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -83,7 +83,7 @@ extern void sub_08030118(u32);
extern void sub_0803C0AC(Entity*);
extern void sub_08049CF4(Entity*);
extern u32 sub_0804A024(Entity*, u32, u32);
-extern u32 sub_080542AC(u32);
+extern u32 IsMinishItem(u32);
extern void DisableRandomDrops();
extern void EnableRandomDrops(void);
extern s32 sub_08056338(void);
diff --git a/include/message.h b/include/message.h
index 344bf4ed..32f9f582 100644
--- a/include/message.h
+++ b/include/message.h
@@ -5,8 +5,10 @@
#include "entity.h"
#include "structures.h"
+#define MESSAGE_ACTIVE 0x7f
+
typedef struct {
- u8 doTextBox;
+ u8 state;
u8 unk;
u8 textSpeed;
u8 unk3; // HI?
diff --git a/include/object/linkAnimation.h b/include/object/linkAnimation.h
new file mode 100644
index 00000000..9fb2fad4
--- /dev/null
+++ b/include/object/linkAnimation.h
@@ -0,0 +1,23 @@
+#ifndef LINKANIMATION_H
+#define LINKANIMATION_H
+
+#ifndef NENT_DEPRECATED
+#error "linkAnimtion.h requires new entities"
+#endif
+#include "entity.h"
+
+typedef struct {
+ /*0x00*/ Entity base;
+ /*0x68*/ u8 storeDrawFlags;
+ /*0x69*/ u8 storeFlags;
+ /*0x6a*/ u8 storeIFrames;
+ /*0x6b*/ u8 storeField7;
+ /*0x6c*/ u8 storeKeepFacing;
+ /*0x6d*/ u8 storeFieldA;
+ /*0x6e*/ u8 storeField27;
+ /*0x6f*/ u8 storeMobility;
+ /*0x70*/ u32 storeStateFlags;
+ /*0x74*/ u8 store8A;
+} LinkAnimationEntity;
+
+#endif // LINKANIMATION_H
diff --git a/include/player.h b/include/player.h
index 49a4bce7..38e186e5 100644
--- a/include/player.h
+++ b/include/player.h
@@ -243,29 +243,27 @@ typedef struct {
} PlayerMacroEntry;
typedef enum {
- PLAYER_INPUT_1 = 0x1, // A
- PLAYER_INPUT_2 = 0x2, // B
- PLAYER_INPUT_8 = 0x8, // A sub_080782C0, sub_0807953C, PlayerUpdateSwimming, sub_08076518. ItemForSale_Action2
- PLAYER_INPUT_10 = 0x10, // B sub_0807953C, ToggleDiving, sub_08076518, ItemForSale_Action2
- PLAYER_INPUT_20 = 0x20, // R sub_0807953C
- PLAYER_INPUT_40 = 0x40, // A CrenelBeanSprout_Action1
- PLAYER_INPUT_80 =
+ INPUT_USE_ITEM1 = 0x1, // A
+ INPUT_USE_ITEM2 = 0x2, // B
+ INPUT_INTERACT = 0x8, // A sub_080782C0, sub_0807953C, PlayerUpdateSwimming, sub_08076518. ItemForSale_Action2
+ INPUT_CANCEL = 0x10, // B sub_0807953C, ToggleDiving, sub_08076518, ItemForSale_Action2
+ INPUT_CONTEXT = 0x20, // R sub_0807953C
+ INPUT_40 = 0x40, // A CrenelBeanSprout_Action1
+ INPUT_ACTION =
0x80, // R sub_08073584, IsPreventedFromUsingItem, sub_080782C0, CrenelBeanSprout_Action1, ItemForSale_Action2
- PLAYER_INPUT_RIGHT = 0x100,
- PLAYER_INPUT_LEFT = 0x200,
- PLAYER_INPUT_UP = 0x400,
- PLAYER_INPUT_DOWN = 0x800,
- PLAYER_INPUT_ANY_DIRECTION = 0xf00,
- PLAYER_INPUT_1000 = 0x1000, // L, where is it set? sub_080782C0
- PLAYER_INPUT_8000 = 0x8000, // R, IsTryingToPickupObject, sub_08076518
-
- // TODO What is the result of u32 result = (s32) - (keys & 0x200) >> 0x1f & 0x1000;?
+ INPUT_RIGHT = 0x100,
+ INPUT_LEFT = 0x200,
+ INPUT_UP = 0x400,
+ INPUT_DOWN = 0x800,
+ INPUT_ANY_DIRECTION = 0xf00,
+ INPUT_FUSE = 0x1000, // L, where is it set? sub_080782C0
+ INPUT_LIFT_THROW = 0x8000, // R, IsTryingToPickupObject, sub_08076518
} PlayerInputState;
typedef struct {
/*0x0*/ u16 heldInput; /**< Input currently held @see PlayerInputState */
/*0x2*/ u16 newInput; /**< New input this frame @see PlayerInputState */
- /*0x4*/ u32 field_0x94;
+ /*0x4*/ u32 unused;
/*0x8*/ u16 playerMacroWaiting;
/*0xa*/ u16 playerMacroHeldKeys;
/*0xc*/ PlayerMacroEntry* playerMacro;
@@ -535,7 +533,7 @@ typedef struct {
/*0x09*/ u8 _hasAllFigurines;
/*0x0a*/ u8 charm;
/*0x0b*/ u8 picolyteType;
- /*0x0c*/ u8 itemButtons[2];
+ /*0x0c*/ u8 equipped[2];
/*0x0e*/ u8 bottles[4];
/*0x12*/ u8 effect;
/*0x13*/ u8 hasAllFigurines;
@@ -722,7 +720,7 @@ s32 AddInteractableObject(Entity*, u32, u32);
void RemoveInteractableObject(Entity*);
s32 GetInteractableObjectIndex();
void sub_08078AC0(u32, u32, u32);
-void sub_08078B48(void);
+void PausePlayer(void);
void sub_08078E84(Entity*, Entity*);
void sub_08078FB0(Entity*);
void sub_080792BC(s32, u32, u32);
diff --git a/include/structures.h b/include/structures.h
index 0cbe9c71..f4dc51cd 100644
--- a/include/structures.h
+++ b/include/structures.h
@@ -191,8 +191,8 @@ extern ItemBehavior gActiveItems[MAX_ACTIVE_ITEMS];
static_assert(sizeof(gActiveItems) == 0x70);
typedef struct {
- u8 sys_priority; // system requested priority
- u8 ent_priority; // entity requested priority
+ u8 event_priority; // system requested priority
+ u8 ent_priority; // entity requested priority
u8 queued_priority;
u8 queued_priority_reset;
Entity* requester;