summaryrefslogtreecommitdiff
path: root/include/entity.h
diff options
context:
space:
mode:
authortheo3 <arisstephenson2@gmail.com>2021-03-21 22:59:52 -0700
committertheo3 <arisstephenson2@gmail.com>2021-03-21 22:59:52 -0700
commitf56a1cade6911129ea32d48727a70ce8f9bc783f (patch)
treea3bb7d9a96555fd227aae887921af20c228e9e71 /include/entity.h
parent8734f766b467b5f469afd6b24b5cf07be7e53ad0 (diff)
parent41684172807db9cb74cfe2879e527eb2fcb6b230 (diff)
fix merge conflict
Diffstat (limited to 'include/entity.h')
-rw-r--r--include/entity.h93
1 files changed, 67 insertions, 26 deletions
diff --git a/include/entity.h b/include/entity.h
index 10867f53..f19e0876 100644
--- a/include/entity.h
+++ b/include/entity.h
@@ -175,12 +175,33 @@ extern LinkedList gUnk_03003DA0;
#define COORD_TO_TILE_OFFSET(entity, xOff, yOff) \
TILE((entity)->x.HALF.HI - (xOff), (entity)->y.HALF.HI - (yOff))
+enum {
+ DirectionNorth = 0x00,
+ DirectionEast = 0x08,
+ DirectionSouth = 0x10,
+ DirectionWest = 0x18,
+};
+
+#define DirectionRound(expr) ((expr) & 0x18)
+#define DirectionRoundUp(expr) DirectionRound((expr) + 4)
+#define DirectionIsHorizontal(expr) ((expr) & 0x08)
+#define DirectionIsVertical(expr) ((expr) & 0x10)
+#define DirectionTurnAround(expr) (DirectionRoundUp(expr) ^ 0x10)
+#define DirectionToAnimationState(expr) (DirectionRoundUp(expr) >> 3)
+#define DirectionFromAnimationState(expr) ((expr) << 3)
+
+#define Direction8Round(expr) ((expr) & 0x1c)
+#define Direction8RoundUp(expr) Direction8Round((expr) + 2)
+#define Direction8TurnAround(expr) (Direction8RoundUp(expr) ^ 0x10)
+#define Direction8ToAnimationState(expr) (Direction8RoundUp(expr) >> 2)
+#define Direction8FromAnimationState(expr) (((expr) << 2)
+
Entity* GetEmptyEntity(void);
-extern Entity* CreateEnemy(u32 subtype, u32 form);
-extern Entity* CreateObject(u32 subtype, u32 form, u32 parameter);
-extern Entity* CreateNPC(u32 subtype, u32 form, u32 parameter);
-extern Entity* CreateObjectWithParent(Entity* parent, u32 subtype, u32 form, u32 parameter);
-extern Entity* CreateFx(Entity* parent, u32 form, u32 parameter);
+extern Entity* CreateEnemy(u32 id, u32 type);
+extern Entity* CreateNPC(u32 id, u32 type, u32 type2);
+extern Entity* CreateObject(u32 id, u32 type, u32 type2);
+extern Entity* CreateObjectWithParent(Entity* parent, u32 id, u32 type, u32 type2);
+extern Entity* CreateFx(Entity* parent, u32 type, u32 type2);
extern void InitializeAnimation(Entity*, u32);
extern void InitAnimationForceUpdate(Entity*, u32);
@@ -194,34 +215,54 @@ extern void SetSpriteSubEntryOffsetData2(Entity*, u32, u32);
extern u32 GetFacingDirection(Entity*, Entity*);
+/**
+ * @brief Delete the entity currently in execution.
+ */
void DeleteThisEntity(void);
+
+/**
+ * @brief Delete an entity.
+ */
void DeleteEntity(Entity*);
+/**
+ * @brief Append entity to linked list.
+ */
void AppendEntityToList(Entity* entity, u32 listIndex);
-void PrependEntityToList(Entity* entity, int listIndex);
-Entity* FindEntityInListBySubtype(u32 type, u32 subtype, u32 listIndex);
-Entity* FindEntityInListByForm(u32 type, u32 subtype, u32 listIndex, u32 form, u32 parameter);
+/**
+ * @brief Prepend entity to linked list.
+ */
+void PrependEntityToList(Entity* entity, u32 listIndex);
-enum {
- DirectionNorth = 0x00,
- DirectionEast = 0x08,
- DirectionSouth = 0x10,
- DirectionWest = 0x18,
-};
+/**
+ * @brief Find an entity for a given kind and ID.
+ * @return Entity* First result or NULL if none found
+ */
+Entity* FindEntityByID(u32 kind, u32 id, u32 listIndex);
-#define DirectionRound(expr) ((expr) & 0x18)
-#define DirectionRoundUp(expr) DirectionRound((expr) + 4)
-#define DirectionIsHorizontal(expr) ((expr) & 0x08)
-#define DirectionIsVertical(expr) ((expr) & 0x10)
-#define DirectionTurnAround(expr) (DirectionRoundUp(expr) ^ 0x10)
-#define DirectionToAnimationState(expr) (DirectionRoundUp(expr) >> 3)
-#define DirectionFromAnimationState(expr) ((expr) << 3)
+/**
+ * @brief Search all lists for an entity of same kind and id.
+ * @return Entity* First result or NULL if none found
+ */
+Entity* DeepFindEntityByID(u32 kind, u32 id);
-#define Direction8Round(expr) ((expr) & 0x1c)
-#define Direction8RoundUp(expr) Direction8Round((expr) + 2)
-#define Direction8TurnAround(expr) (Direction8RoundUp(expr) ^ 0x10)
-#define Direction8ToAnimationState(expr) (Direction8RoundUp(expr) >> 2)
-#define Direction8FromAnimationState(expr) (((expr) << 2)
+/**
+ * @brief Search all lists for entity of same kind and id.
+ * @return bool32 Duplicate was entity found
+ */
+bool32 EntityHasDuplicateID(Entity* ent);
+
+/**
+ * @brief Find an entity of same kind and id in list.
+ * @return Entity* First result or NULL if none found
+ */
+Entity* FindNextDuplicateID(Entity* ent, int listIndex);
+
+/**
+ * @brief Find Entity with full identifiers.
+ * @return Entity* First result or NULL if none found
+ */
+Entity* FindEntity(u32 kind, u32 id, u32 listIndex, u32 type, u32 type2);
#endif