Add playeritem enum and use ids and kinds in all Findentity calls

This commit is contained in:
Tal Hayon
2022-02-18 18:18:40 +02:00
parent 10f8096abd
commit 0e224cf232
20 changed files with 81 additions and 43 deletions
+12 -12
View File
@@ -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;
+2 -1
View File
@@ -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);
+1 -1
View File
@@ -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;
+2 -1
View File
@@ -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);
}
+2 -2
View File
@@ -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;
+5 -5
View File
@@ -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);
}
+1 -1
View File
@@ -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);
}
+2 -2
View File
@@ -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);