Using EntityKind enum in various places

This commit is contained in:
Tal Hayon 2022-01-29 15:12:23 +02:00
parent fd9049f598
commit 578fb3d1d8
12 changed files with 26 additions and 25 deletions

View File

@ -240,7 +240,7 @@ u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
} else {
itemEntity->actionDelay = 0;
}
if (arg0->kind == 6) {
if (arg0->kind == OBJECT) {
if (arg0->id == 99) {
arg0->child = itemEntity;
} else if (arg0->id == 0x1e) {
@ -332,7 +332,7 @@ u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
} else {
itemEntity->actionDelay = 0;
}
if (arg0->kind == 6) {
if (arg0->kind == OBJECT) {
if (arg0->id == 99) {
arg0->child = itemEntity;
} else if (arg0->id == 0x1e) {

View File

@ -68,7 +68,7 @@ void* sub_08077C54(UnkItemStruct* unk) {
item = sub_0805E744();
if (item != NULL) {
item->id = gUnk_0811BE48[unk->field_0x1].unk[3];
item->kind = 8;
item->kind = PLAYER_ITEM;
item->flags = 0xa0;
item->parent = (Entity*)unk;
item->field_0x68.HALF.LO = unk->field_0x1;
@ -93,7 +93,7 @@ Entity* CreatePlayerItem(u32 subtype, u32 form, u32 parameter, u32 unk) {
ent = GetEmptyEntity();
if (ent != NULL) {
ent->flags = 0x80;
ent->kind = 8;
ent->kind = PLAYER_ITEM;
ent->id = subtype;
ent->type = form;
ent->type2 = parameter;
@ -109,7 +109,7 @@ Entity* sub_08077CF8(u32 subtype, u32 form, u32 parameter, u32 unk) {
ent = sub_0805E744();
if (ent != NULL) {
ent->flags = 0x80;
ent->kind = 8;
ent->kind = PLAYER_ITEM;
ent->id = subtype;
ent->type = form;
ent->type2 = parameter;

View File

@ -218,7 +218,7 @@ s32 sub_08017874(Entity* a, Entity* b) {
s32 v6;
asm("" ::: "r1");
if (a->kind == 1) {
if (a->kind == PLAYER) {
newDmg = b->damage;
switch (gSave.stats.charm) {
case 47:
@ -234,7 +234,7 @@ s32 sub_08017874(Entity* a, Entity* b) {
SoundReqClipped(a, 122);
} else {
v6 = b->damage;
if (b->kind == 8) {
if (b->kind == PLAYER_ITEM) {
switch (gSave.stats.charm) {
case 48:
v6 = 3 * v6 / 2;
@ -245,7 +245,7 @@ s32 sub_08017874(Entity* a, Entity* b) {
}
}
v5 = a->health - v6;
if (a->kind == 3) {
if (a->kind == ENEMY) {
if ((a->field_0x6c.HALF.HI & 1) != 0)
SoundReqClipped(a, 295);
else
@ -510,7 +510,7 @@ s32 sub_08017EB0(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
gPlayerEntity.knockbackDuration = 12;
gPlayerEntity.iframes = 16;
gPlayerEntity.field_0x46 = 384;
} else if (org->kind == 8 && org->id == 5) {
} else if (org->kind == PLAYER_ITEM && org->id == 5) {
org->knockbackDuration = 8;
org->iframes = -6;
org->field_0x46 = 384;
@ -556,7 +556,7 @@ s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
} else {
org->health = 0;
}
} else if (tgt->kind == 3 && org == &gPlayerEntity) {
} else if (tgt->kind == ENEMY && org == &gPlayerEntity) {
sub_08004484(tgt, org);
}
return 0;
@ -644,7 +644,7 @@ s32 sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
} else {
org->health = 0;
}
} else if ((tgt->kind == 3) && (org == &gPlayerEntity)) {
} else if ((tgt->kind == ENEMY) && (org == &gPlayerEntity)) {
sub_08004484(tgt, &gPlayerEntity);
}
return 0;
@ -690,11 +690,12 @@ s32 sub_080182A8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
u32 temp = 0;
if (tgt->field_0x43 && tgt->kind == 3 && org == &gPlayerEntity) {
if (tgt->field_0x43 && tgt->kind == ENEMY && org == &gPlayerEntity) {
sub_08004484(tgt, org);
temp = 1;
}
if ((org->kind == 8 && org->id == 0x5) && gPlayerEntity.animationState == ((((direction + 4) & 0x18) >> 2) ^ 4)) {
if ((org->kind == PLAYER_ITEM && org->id == 0x5) &&
gPlayerEntity.animationState == ((((direction + 4) & 0x18) >> 2) ^ 4)) {
return 0;
}
if (!temp) {
@ -738,7 +739,7 @@ s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
parent->field_0x4c = org;
}
}
if (org->kind == 8) {
if (org->kind == PLAYER_ITEM) {
if (org->id == 1) {
if (settings->_8) {
sub_080179EC(org, tgt);
@ -755,7 +756,7 @@ s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
gPlayerEntity.iframes = 0x80;
}
}
if (tgt->kind == 8 && org->id == 5) {
if (tgt->kind == PLAYER_ITEM && org->id == 5) {
gPlayerEntity.iframes = 0x80;
}
return 1;

View File

@ -113,7 +113,7 @@ Entity* Manager28_FindMatchingEntity(EntityData* unk1) {
y = unk1->yPos + gRoomControls.origin_y;
tmp = &gEntityLists[4];
for (i = tmp->first; (u32)i != (u32)tmp; i = i->next) {
if (x == i->x.HALF.HI && y == i->y.HALF.HI && unk1->id == i->id && 3 == i->kind && unk1->type == i->type) {
if (x == i->x.HALF.HI && y == i->y.HALF.HI && unk1->id == i->id && ENEMY == i->kind && unk1->type == i->type) {
return i;
}
}

View File

@ -98,7 +98,7 @@ void ManagerB_LoadFight(Manager* this) {
if (prop) {
while (*((u8*)prop) != 0xFF) {
ent = LoadRoomEntity(prop++);
if (ent && (ent->kind == 3)) {
if (ent && (ent->kind == ENEMY)) {
ent->field_0x6c.HALF.HI |= 0x40;
ManagerBHelper_Monitor(monitor, ent, counter++);
}

View File

@ -89,7 +89,7 @@ void NPCInit(Entity* this) {
Entity* CreateNPC(u32 subtype, u32 form, u32 parameter) {
Entity* entity = GetEmptyEntity();
if (entity != NULL) {
entity->kind = 7;
entity->kind = NPC;
entity->id = subtype;
entity->type = form;
entity->type2 = parameter;

View File

@ -322,7 +322,7 @@ static Entity* sub_0808EC80(int form) {
Entity* entityA = (Entity*)&gEntityLists[6];
Entity* entityB = entityA->next;
while (entityB != entityA) {
if ((entityB->kind == 0x6 && entityB->id == 0x48) && form == entityB->type) {
if ((entityB->kind == OBJECT && entityB->id == 0x48) && form == entityB->type) {
return entityB;
}
entityB = entityB->next;

View File

@ -283,7 +283,7 @@ void nullsub_510(Entity* this) {
void sub_08081328(Entity* this) {
Entity* other = this->child;
if (!(other->kind == 8 && other->id == 3)) {
if (!(other->kind == PLAYER_ITEM && other->id == 3)) {
sub_08081404(this, 0);
} else {
CopyPosition(other, this);

View File

@ -16,7 +16,7 @@ Entity* sub_080A276C(Entity* parent, u32 type, u32 type2) {
Entity* e = sub_0805E744();
if (e != NULL) {
e->id = 0xC1;
e->kind = 6;
e->kind = OBJECT;
e->type = type;
e->type2 = type2;
e->parent = parent;
@ -100,7 +100,7 @@ u32 LoadObjectSprite(Entity* this, s32 type, const ObjectDefinition* definition)
Entity* CreateObject(u32 subtype, u32 form, u32 parameter) {
Entity* entity = GetEmptyEntity();
if (entity != NULL) {
entity->kind = 6;
entity->kind = OBJECT;
entity->id = subtype;
entity->type = form;
entity->type2 = parameter;

View File

@ -20,7 +20,7 @@ ASM_FUNC("asm/non_matching/playerItem13/sub_080AD27C.inc", void sub_080AD27C(Ent
bool32 sub_080AD32C(Entity* this) {
bool32 result = FALSE;
if (((this->field_0x16 & 0xf0) == 0x10) || ((this->kind == 6 && ((this->id == 5 || (this->id == 0x7d)))))) {
if (((this->field_0x16 & 0xf0) == 0x10) || ((this->kind == OBJECT && ((this->id == 5 || (this->id == 0x7d)))))) {
result = TRUE;
}
return result;

View File

@ -77,7 +77,7 @@ bool32 IsProjectileOffScreen(Entity* this) {
Entity* CreateProjectile(u32 id) {
Entity* entity = GetEmptyEntity();
if (entity != NULL) {
entity->kind = 4;
entity->kind = PROJECTILE;
entity->id = id;
AppendEntityToList(entity, 5);
}

View File

@ -194,7 +194,7 @@ void sub_0804B058(EntityData* dat) {
if ((uVar2 < 0x20) && ((dat->kind & 0xF) == 3)) {
if (sub_08049D1C(uVar2) != 0) {
ent = LoadRoomEntity(dat);
if ((ent != NULL) && (ent->kind == 3)) {
if ((ent != NULL) && (ent->kind == ENEMY)) {
ent->field_0x6c.HALF.LO = uVar2 | 0x80;
}
}