summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTal Hayon <talhayon1@gmail.com>2022-02-18 18:18:40 +0200
committerTal Hayon <talhayon1@gmail.com>2022-02-18 18:18:40 +0200
commit0e224cf2323a76539730ee35f4e8a0856cf7a1fd (patch)
tree4153b4359e569ce555626b85c63a0533d26eb348 /src
parent10f8096abd9533e14a5ad03eedcbee4fcbb9019a (diff)
Add playeritem enum and use ids and kinds in all Findentity calls
Diffstat (limited to 'src')
-rw-r--r--src/code_08077B98.c2
-rw-r--r--src/enemy/pesto.c5
-rw-r--r--src/item/itemBomb.c4
-rw-r--r--src/item/itemSword.c2
-rw-r--r--src/manager/manager22.c2
-rw-r--r--src/manager/manager36.c2
-rw-r--r--src/manager/managerF.c2
-rw-r--r--src/npc/bigGoron.c24
-rw-r--r--src/npc/forestMinish.c3
-rw-r--r--src/npc/goronMerchant.c2
-rw-r--r--src/npc/guardWithSpear.c3
-rw-r--r--src/npc/malon.c4
-rw-r--r--src/npc/pina.c10
-rw-r--r--src/npc/rem.c2
-rw-r--r--src/npc/zelda.c4
-rw-r--r--src/npcUtils.c2
-rw-r--r--src/object/book.c3
-rw-r--r--src/object/greatFairy.c4
-rw-r--r--src/object/object6A.c12
19 files changed, 49 insertions, 43 deletions
diff --git a/src/code_08077B98.c b/src/code_08077B98.c
index 2d011e33..970644d3 100644
--- a/src/code_08077B98.c
+++ b/src/code_08077B98.c
@@ -83,7 +83,7 @@ void* sub_08077C54(UnkItemStruct* unk) {
Entity* sub_08077C94(ItemBehavior* arg0, u32 arg1) {
Entity* iVar1;
- iVar1 = FindEntityByID(8, gUnk_0811BE48[arg1].unk0[3], 2);
+ iVar1 = FindEntityByID(PLAYER_ITEM, gUnk_0811BE48[arg1].unk0[3], 2);
if (iVar1 == NULL) {
return NULL;
}
diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c
index 9fa20418..f89f23e0 100644
--- a/src/enemy/pesto.c
+++ b/src/enemy/pesto.c
@@ -10,6 +10,7 @@
#include "game.h"
#include "functions.h"
#include "save.h"
+#include "playeritem.h"
void sub_080249F4(Entity*);
void sub_08024940(Entity*);
@@ -659,7 +660,7 @@ bool32 sub_08024B38(Entity* this) {
}
}
- ent = FindEntityByID(8, 2, 2);
+ ent = FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_BOMB, 2);
if (ent) {
do {
if (ent->action != 2 && ent->z.HALF.HI == 0 && sub_08049F1C(this, ent, 0xa0)) {
@@ -676,7 +677,7 @@ bool32 sub_08024B38(Entity* this) {
return iVar4;
}
- ent = FindEntityByID(6, 5, 6);
+ ent = FindEntityByID(OBJECT, POT, 6);
if (ent) {
do {
if (ent->action == 1 && sub_08049F1C(this, ent, 0xa0)) {
diff --git a/src/item/itemBomb.c b/src/item/itemBomb.c
index 4cba1598..4154e1f6 100644
--- a/src/item/itemBomb.c
+++ b/src/item/itemBomb.c
@@ -2,6 +2,7 @@
#include "coord.h"
#include "sound.h"
#include "functions.h"
+#include "playeritem.h"
extern void (*const gUnk_0811BD98[])(ItemBehavior*, u32);
@@ -23,7 +24,8 @@ void sub_08075FF8(ItemBehavior* this, u32 arg1) {
if ((gPlayerState.jump_status | gPlayerState.field_0x3[1]) == 0) {
bombCount = 0;
- for (entity = FindEntityByID(8, 2, 2); entity != NULL; entity = FindNextDuplicateID(entity, 2)) {
+ for (entity = FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_BOMB, 2); entity != NULL;
+ entity = FindNextDuplicateID(entity, 2)) {
bombCount += 1;
}
maxBombs = this->behaviorID == 7 ? 3 : 1;
diff --git a/src/item/itemSword.c b/src/item/itemSword.c
index bcba4054..ae15069d 100644
--- a/src/item/itemSword.c
+++ b/src/item/itemSword.c
@@ -112,7 +112,7 @@ void sub_080754B8(ItemBehavior* this, u32 arg1) {
if (gPlayerEntity.frameSpriteSettings & 1) {
iVar1 = sub_0807B014();
- if (iVar1 && FindEntityByID(PLAYER_ITEM, 15, 2) == 0) {
+ if (iVar1 && FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_SWORD_BEAM1, 2) == 0) {
CreatePlayerBomb(this, 0xf);
if (iVar1 == 0xf) {
gPlayerState.field_0xab = 5;
diff --git a/src/manager/manager22.c b/src/manager/manager22.c
index 4d6130cc..a8bb0794 100644
--- a/src/manager/manager22.c
+++ b/src/manager/manager22.c
@@ -159,7 +159,7 @@ void sub_0805BB74(s32 lightLevel) {
}
gArea.lightLevel = lightLevel;
gRoomVars.lightLevel = gArea.lightLevel;
- manager = (Manager22*)DeepFindEntityByID(9, 0x22);
+ manager = (Manager22*)DeepFindEntityByID(MANAGER, 0x22);
if (manager) {
Manager22_Main(manager);
gScreen.lcd.displayControl |= DISPCNT_BG3_ON;
diff --git a/src/manager/manager36.c b/src/manager/manager36.c
index ca9c5c24..7dcf71c4 100644
--- a/src/manager/manager36.c
+++ b/src/manager/manager36.c
@@ -36,7 +36,7 @@ void CreateManager36(Entity* entity, ScriptExecutionContext* context) {
}
void DeleteManager36(Entity* entity, ScriptExecutionContext* context) {
- Entity* manager = FindEntity(9, 0x36, 6, context->intVariable, 0);
+ Entity* manager = FindEntity(MANAGER, 0x36, 6, context->intVariable, 0);
if (manager != NULL) {
DeleteEntityAny(manager);
}
diff --git a/src/manager/managerF.c b/src/manager/managerF.c
index f1cc1aca..1c3bd127 100644
--- a/src/manager/managerF.c
+++ b/src/manager/managerF.c
@@ -286,7 +286,7 @@ void sub_08059220(ManagerF* this) {
void sub_08059278(void) {
ManagerF* tmp;
- tmp = (ManagerF*)FindEntityByID(0x9, 0xF, 0x6);
+ tmp = (ManagerF*)FindEntityByID(MANAGER, 0xF, 0x6);
if (tmp) {
sub_08058ECC(tmp);
}
diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c
index cb791a38..182b71f1 100644
--- a/src/npc/bigGoron.c
+++ b/src/npc/bigGoron.c
@@ -77,7 +77,7 @@ void sub_0806CF30(Entity* this) {
}
Entity* sub_0806D00C(Entity* this) {
- Entity* entity = FindEntity(7, 76, 7, 0, 0);
+ Entity* entity = FindEntity(NPC, BIG_GORON, 7, 0, 0);
if (entity != NULL) {
this->parent = entity;
}
@@ -100,7 +100,7 @@ void sub_0806D0B0(Entity* this) {
}
void sub_0806D0F8(void) {
- Entity* entity = FindEntityByID(7, 0x4c, 7);
+ Entity* entity = FindEntityByID(NPC, BIG_GORON, 7);
if (entity != NULL) {
sub_0806D0B0(entity);
}
@@ -359,22 +359,22 @@ void sub_0806D66C(Entity* this) {
ASM_FUNC("asm/non_matching/bigGoron/sub_0806D67C.inc", void sub_0806D67C(Entity* this))
void sub_0806D6D0(void) {
- Entity* entity = FindEntity(7, 0x4c, 7, 2, 0);
+ Entity* entity = FindEntity(NPC, BIG_GORON, 7, 2, 0);
if (entity != NULL) {
entity->subAction = 2;
}
- entity = FindEntity(7, 0x4c, 7, 1, 0);
+ entity = FindEntity(NPC, BIG_GORON, 7, 1, 0);
if (entity != NULL) {
entity->subAction = 1;
}
}
void sub_0806D70C(void) {
- Entity* entity = FindEntity(7, 0x4c, 7, 2, 0);
+ Entity* entity = FindEntity(NPC, BIG_GORON, 7, 2, 0);
if (entity != NULL) {
entity->subAction = 0;
}
- entity = FindEntity(7, 0x4c, 7, 1, 0);
+ entity = FindEntity(NPC, BIG_GORON, 7, 1, 0);
if (entity != NULL) {
entity->subAction = 0;
entity->spriteSettings.draw = 3;
@@ -382,22 +382,22 @@ void sub_0806D70C(void) {
}
void sub_0806D74C(void) {
- Entity* entity = FindEntity(7, 0x4c, 7, 2, 0);
+ Entity* entity = FindEntity(NPC, BIG_GORON, 7, 2, 0);
if (entity != NULL) {
entity->subAction = 3;
}
- entity = FindEntity(7, 0x4c, 7, 1, 0);
+ entity = FindEntity(NPC, BIG_GORON, 7, 1, 0);
if (entity != NULL) {
entity->subAction = 2;
}
}
void sub_0806D788(void) {
- Entity* entity = FindEntity(7, 0x4c, 7, 2, 0);
+ Entity* entity = FindEntity(NPC, BIG_GORON, 7, 2, 0);
if (entity != NULL) {
entity->subAction = 4;
}
- entity = FindEntity(7, 0x4c, 7, 1, 0);
+ entity = FindEntity(NPC, BIG_GORON, 7, 1, 0);
if (entity != NULL) {
entity->subAction = 1;
}
@@ -408,14 +408,14 @@ void sub_0806D7C4(Entity* this, ScriptExecutionContext* context) {
this->x.HALF.HI = gPlayerEntity.x.HALF.HI;
this->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0x18;
- entity = FindEntity(7, 0x4c, 7, 2, 0);
+ entity = FindEntity(NPC, BIG_GORON, 7, 2, 0);
if (entity != NULL) {
sub_0807DEDC(this, context, entity->x.HALF.HI, entity->y.HALF.HI);
}
}
void sub_0806D804(Entity* this, ScriptExecutionContext* context) {
- Entity* entity = FindEntity(7, 0x4c, 7, 2, 0);
+ Entity* entity = FindEntity(NPC, BIG_GORON, 7, 2, 0);
if (entity != NULL) {
this->x.HALF.HI = entity->x.HALF.HI;
this->y.HALF.HI = entity->y.HALF.HI - 0x10;
diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c
index ea0b9bb7..e31cb80d 100644
--- a/src/npc/forestMinish.c
+++ b/src/npc/forestMinish.c
@@ -1,6 +1,7 @@
#include "npc.h"
#include "object.h"
#include "functions.h"
+#include "playeritem.h"
extern void sub_080600F0(Entity*);
extern void sub_08060158(Entity*);
@@ -215,7 +216,7 @@ void sub_08060318(void) {
int i;
for (i = 2; i >= 0; i--) {
- ent = FindEntityByID(8, 2, 2);
+ ent = FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_BOMB, 2);
if (ent != NULL) {
CreateDust(ent);
DeleteEntity(ent);
diff --git a/src/npc/goronMerchant.c b/src/npc/goronMerchant.c
index 07f6117f..0aae9b37 100644
--- a/src/npc/goronMerchant.c
+++ b/src/npc/goronMerchant.c
@@ -83,7 +83,7 @@ void sub_08069660(Entity* this) {
void sub_08069684(void) {
Manager* mgr;
- if (FindEntityByID(9, 0x31, 8) == NULL) {
+ if (FindEntityByID(MANAGER, 0x31, 8) == NULL) {
mgr = GetEmptyManager();
if (mgr != NULL) {
mgr->type = 9;
diff --git a/src/npc/guardWithSpear.c b/src/npc/guardWithSpear.c
index ddb8ffde..8293f541 100644
--- a/src/npc/guardWithSpear.c
+++ b/src/npc/guardWithSpear.c
@@ -1,12 +1,13 @@
#include "entity.h"
#include "script.h"
#include "player.h"
+#include "npc.h"
ASM_FUNC("asm/non_matching/guardWithSpear/sub_0806407C.inc",
void sub_0806407C(Entity* this, ScriptExecutionContext* context))
void sub_08064180(void) {
- Entity* entity = FindEntityByID(7, 0x15, 7);
+ Entity* entity = FindEntityByID(NPC, GUARD_1, 7);
if (entity != NULL) {
DeleteEntity(entity);
}
diff --git a/src/npc/malon.c b/src/npc/malon.c
index 77d6a20c..2a3b2fa1 100644
--- a/src/npc/malon.c
+++ b/src/npc/malon.c
@@ -56,12 +56,12 @@ void sub_08065900(Entity* this) {
void sub_08065914(Entity* this) {
Entity* target;
- target = FindEntityByID(7, 0x1F, 7);
+ target = FindEntityByID(NPC, EPONA, 7);
if (target != NULL) {
PositionRelative(this, target, Q_16_16(24.0), Q_16_16(-1.0));
target->parent = this;
}
- target = FindEntityByID(7, 0x20, 7);
+ target = FindEntityByID(NPC, MILK_CART, 7);
if (target != NULL) {
PositionRelative(this, target, Q_16_16(40.0), 0);
target->parent = this;
diff --git a/src/npc/pina.c b/src/npc/pina.c
index 5d49e1b3..3186f3ea 100644
--- a/src/npc/pina.c
+++ b/src/npc/pina.c
@@ -102,35 +102,35 @@ void sub_08063B68(Entity* this) {
}
void sub_08063C14(void) {
- Entity* entity = DeepFindEntityByID(7, 0x14);
+ Entity* entity = DeepFindEntityByID(NPC, PINA);
if (entity != NULL) {
InitAnimationForceUpdate(entity, 8);
}
}
void sub_08063C2C(void) {
- Entity* entity = DeepFindEntityByID(7, 0x14);
+ Entity* entity = DeepFindEntityByID(NPC, PINA);
if (entity != NULL) {
InitAnimationForceUpdate(entity, 4);
}
}
void sub_08063C44(void) {
- Entity* entity = DeepFindEntityByID(7, 0x14);
+ Entity* entity = DeepFindEntityByID(NPC, PINA);
if (entity != NULL) {
InitAnimationForceUpdate(entity, 0);
}
}
void sub_08063C5C(void) {
- Entity* entity = DeepFindEntityByID(7, 0x14);
+ Entity* entity = DeepFindEntityByID(NPC, PINA);
if (entity != NULL) {
InitAnimationForceUpdate(entity, 9);
}
}
void sub_08063C74(void) {
- Entity* entity = DeepFindEntityByID(7, 0x14);
+ Entity* entity = DeepFindEntityByID(NPC, PINA);
if (entity != NULL) {
CreateSpeechBubbleExclamationMark(entity, 8, 0xffffffe8);
}
diff --git a/src/npc/rem.c b/src/npc/rem.c
index 392c8198..8c2c98f8 100644
--- a/src/npc/rem.c
+++ b/src/npc/rem.c
@@ -309,7 +309,7 @@ void sub_0806AB74(Entity* this) {
}
void sub_0806AB9C(Entity* this, ScriptExecutionContext* context) {
- Entity* entity = FindEntity(7, 0x37, 7, 1, 0);
+ Entity* entity = FindEntity(NPC, REM, 7, 1, 0);
if (entity != NULL) {
DeleteEntity(entity);
}
diff --git a/src/npc/zelda.c b/src/npc/zelda.c
index 90222873..46187a72 100644
--- a/src/npc/zelda.c
+++ b/src/npc/zelda.c
@@ -30,7 +30,7 @@ void sub_08066CF8(Entity* this) {
}
void sub_08066D04(Entity* this) {
- this->parent = DeepFindEntityByID(7, 0x2E);
+ this->parent = DeepFindEntityByID(NPC, ZELDA_FOLLOWER);
}
void sub_08066D14(Entity* this, ScriptExecutionContext* context) {
@@ -85,7 +85,7 @@ void sub_08066D94(Entity* this) {
void SetZeldaFollowTarget(Entity* this) {
Entity* pEVar1;
- pEVar1 = DeepFindEntityByID(7, 0x2E);
+ pEVar1 = DeepFindEntityByID(NPC, ZELDA_FOLLOWER);
if (pEVar1 != NULL) {
CopyPosition(this, pEVar1);
sub_080686C4(this, pEVar1);
diff --git a/src/npcUtils.c b/src/npcUtils.c
index bf609c86..1fabfe67 100644
--- a/src/npcUtils.c
+++ b/src/npcUtils.c
@@ -34,7 +34,7 @@ void sub_0806EC20(Entity* ent) {
}
void sub_0806EC38(void) {
- Entity* e = FindEntityByID(7, 0x58, 7);
+ Entity* e = FindEntityByID(NPC, NPC_UNK_58, 7);
if (e != NULL)
DeleteEntity(e);
}
diff --git a/src/object/book.c b/src/object/book.c
index c0003115..3cea262b 100644
--- a/src/object/book.c
+++ b/src/object/book.c
@@ -2,6 +2,7 @@
#include "functions.h"
#include "message.h"
#include "item.h"
+#include "npc.h"
extern void (*const BookActionFuncs[])(Entity*);
extern s8 const gUnk_08123D94[];
@@ -152,7 +153,7 @@ void sub_0809B5EC(Entity* this) {
switch (this->subAction) {
case 0: {
Entity* parent;
- parent = FindEntityByID(7, 26, 7);
+ parent = FindEntityByID(NPC, STURGEON, 7);
if (!parent) {
return;
}
diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c
index a0e29797..a03d9344 100644
--- a/src/object/greatFairy.c
+++ b/src/object/greatFairy.c
@@ -517,7 +517,7 @@ void sub_080873FC(void) {
SoundReq(SFX_APPARATE);
gRoomControls.camera_target = NULL;
- while (ent = FindEntityByID(0x6, 0x1b, 0x6), ent != NULL) {
+ while (ent = FindEntityByID(OBJECT, GREAT_FAIRY, 0x6), ent != NULL) {
DeleteEntity(ent);
}
}
@@ -546,7 +546,7 @@ void sub_08087424(Entity* this, ScriptExecutionContext* context) {
void sub_0808747C(Entity* this, ScriptExecutionContext* context) {
u32 iVar1 = 0;
- iVar1 = (u32)FindEntity(0x6, 0xf, 0x6, 0xb, 0x0);
+ iVar1 = (u32)FindEntity(OBJECT, SPECIAL_FX, 0x6, 0xb, 0x0);
if (iVar1 != 0) {
iVar1 = 1;
}
diff --git a/src/object/object6A.c b/src/object/object6A.c
index 0d2fb68e..2b655443 100644
--- a/src/object/object6A.c
+++ b/src/object/object6A.c
@@ -195,7 +195,7 @@ void sub_08094B94(Object6AEntity* this) {
}
void sub_08094BE0(Entity* this) {
- Entity* e = FindEntity(6, OBJECT_6A, 6, 0x22, 0);
+ Entity* e = FindEntity(OBJECT, OBJECT_6A, 6, 0x22, 0);
if (e != NULL) {
CopyPosition(&gPlayerEntity, e);
e->z.HALF.HI = -12;
@@ -257,14 +257,14 @@ void sub_08094CDC(Object6AEntity* this) {
}
void sub_08094D10(Object6AEntity* this) {
- Entity* e = FindEntity(6, 0x6a, 6, 3, 98);
+ Entity* e = FindEntity(OBJECT, OBJECT_6A, 6, 3, 98);
if (e != NULL) {
e->action = 0xFF;
}
}
void sub_08094D34(Object6AEntity* this) {
- Entity* e = CreateObject(0x6a, 0x15, 0xd);
+ Entity* e = CreateObject(OBJECT_6A, 0x15, 0xd);
if (e != NULL) {
e->x.HALF.HI = gRoomControls.origin_x + Q_8_8(1.0);
e->y.HALF.HI = gRoomControls.origin_y + Q_8_8(2.345);
@@ -273,7 +273,7 @@ void sub_08094D34(Object6AEntity* this) {
}
void sub_08094D70(Object6AEntity* this) {
- Entity* e = FindEntity(6, 0x6a, 6, 0x15, 0xd);
+ Entity* e = FindEntity(OBJECT, OBJECT_6A, 6, 0x15, 0xd);
if (e != NULL) {
e->action = 0xFF;
}
@@ -306,7 +306,7 @@ void sub_08094DD8(Object6AEntity* this) {
}
void sub_08094E0C(Object6AEntity* this) {
- Entity* e = FindEntity(6, 0x6a, 6, 4, 0);
+ Entity* e = FindEntity(OBJECT, OBJECT_6A, 6, 4, 0);
if (e != NULL) {
e->action = 0xFF;
}
@@ -483,7 +483,7 @@ void sub_08095120(Object6AEntity* this) {
}
void sub_08095164(Object6AEntity* this) {
- Entity* e = FindEntity(6, 0x6A, 6, 8, 0);
+ Entity* e = FindEntity(OBJECT, OBJECT_6A, 6, 8, 0);
if (e != NULL) {
InitAnimationForceUpdate(e, 3);
}