diff --git a/include/entity.h b/include/entity.h index 9ab0aa64..a1dd6d93 100644 --- a/include/entity.h +++ b/include/entity.h @@ -5,19 +5,22 @@ #include "global.h" #include "sprite.h" +typedef enum { + PLAYER = 1, + ENEMY = 3, + PROJECTILE = 4, + OBJECT = 6, + NPC = 7, + PLAYER_ITEM = 8, + MANAGER = 9, +} EntityType; + typedef struct { void* entity1; void* entity2; u8 filler[14]; } UnkStruct; -typedef struct { - u8 type; - u8 subtype; - u8 form; - u8 parameter; -} EntityType; - typedef struct { s8 offset_x; s8 offset_y; @@ -39,7 +42,10 @@ typedef struct { typedef struct Entity { /*0x00*/ struct Entity* prev; /*0x04*/ struct Entity* next; - /*0x08*/ EntityType entityType; + /*0x08*/ u8 kind; // was: type + /*0x09*/ u8 id; // was: subtype + /*0x0a*/ u8 type; // was: form + /*0x0b*/ u8 type2; // was: parameter /*0x0c*/ u8 action; /*0x0d*/ u8 previousActionFlag; /*0x0e*/ u8 actionDelay; diff --git a/include/object.h b/include/object.h index 5480a8a2..465ef064 100644 --- a/include/object.h +++ b/include/object.h @@ -4,6 +4,203 @@ #include "global.h" #include "entity.h" +typedef enum { + GROUND_ITEM, + DEATH_FX, + SHOP_ITEM, + BUTTON, + OBJECT_4, + POT, + OBJECT_6, + PUSHED_BLOCK, + LOCKED_DOOR, + OBJECT_9, + OBJECT_A, + OBJECT_B, + CHEST_SPAWNER, + OBJECT_D, + OBJECT_E, + SPECIAL_FX, + OBJECT_10, + OBJECT_11, + OBJECT_12, + RAILTRACK, + LILYPAD_LARGE, + OBJECT_15, + FLOATING_PLATFORM, + OBJECT_17, + EVIL_SPIRIT, + HOUSE_DOOR_EXT, + OBJECT_1A, + GREAT_FAIRY, + OBJECT_1C, + OBJECT_1D, + OBJECT_1E, + OBJECT_1F, + OBJECT_20, + OBJECT_21, + FIGURINE_DEVICE, + EYE_SWITCH, + OBJECT_24, + BIG_BARREL, + OBJECT_26, + PUSHABLE_STATUE, + OBJECT_28, + OBJECT_29, + OBJECT_2A, + OBJECT_2B, + BEANSTALK, + SMOKE, + PUSHABLE_ROCK, + HITTABLE_LEVER, + OBJECT_30, + OBJECT_31, + PULLABLE_MUSHROOM, + BOLLARD, + WARP_POINT, + OBJECT_35, + OBJECT_36, + OBJECT_37, + JAR_PORTAL, + BOSS_DOOR, + OBJECT_3A, + PORTAL_MUSHROOM_STALKS, + PORTAL_FALLING_PLAYER, + OBJECT_3D, + OBJECT_3E, + GIANT_LEAF, + FAIRY, + LADDER_UP, + OBJECT_42, + OBJECT_43, + OBJECT_44, + OBJECT_45, + GIANT_BOOK_LADDER, + HEART_CONTAINER, + FILE_SCREEN_OBJECTS, + OBJECT_49, + BACKGROUND_CLOUD, + OBJECT_4B, + PUSHABLE_FURNITURE, + FURNITURE, + MINISH_SIZED_ENTRANCE, + ARCHWAY, + GIANT_ROCK, + OBJECT_51, + OBJECT_52, + OBJECT_53, + PULLABLE_LEVER, + MINECART, + THOUGHT_BUBBLE, + HIDDEN_LADDER_DOWN, + GENTARI_CURTAIN, + LAVA_PLATFORM, + OBJECT_5A, + OBJECT_5B, + MASK, + HOUSE_DOOR_INT, + WHIRLWIND, + OBJECT_BLOCKING_STAIRS, + SWORDSMAN_NEWSLETTER, + OBJECT_61, + GIANT_TWIG, + OBJECT_63, + OBJECT_64, + LADDER_HOLE, + OBJECT_66, + OBJECT_67, + OBJECT_68, + OBJECT_69, + OBJECT_6A, + CRENAL_BEAN_SPROUT, + MINECART_DOOR, + OBJECT_ON_PILLAR, + MINERAL_WATER_SOURCE, + MINISH_SIZED_ARCHWAY, + OBJECT_70, + PUSHABLE_GRAVE, + OBJECT_72, + LILYPAD_SMALL, + OBJECT_74, + OBJECT_75, + OBJECT_76, + BELL, + HUGE_DECORATION, + OBJECT_79, + STEAM, + PUSHABLE_LEVER, + HUGE_SHOES, + OBJECT_ON_BEETLE, + OBJECT_7E, + PICO_BLOOM, + OBJECT_80, + OBJECT_81, + BIG_VORTEX, + BIG_PUSHABLE_LEVER, + SMALL_ICE_BLOCK, + BIG_ICE_BLOCK, + OBJECT_86, + OBJECT_87, + HUGE_BOOK, + OBJECT_89, + OBJECT_8A, + OBJECT_8B, + BOOK, + FIREPLACE, + OBJECT_8E, + FROZEN_WATER_ELEMENT, + OBJECT_90, + OBJECT_91, + BAKER_OVEN, + OBJECT_93, + WIND_TRIBE_FLAG, + BIRD, + OBJECT_96, + OBJECT_97, + OBJECT_98, + OBJECT_99, + HUGE_ACORN, + OBJECT_9B, + TREE_HIDING_PORTAL, + LIGHTABLE_SWITCH, + OBJECT_9E, + FAN, + OBJECT_A0, + PALACE_ARCHWAY, + OBJECT_A2, + CLOUD, + MINISH_LIGHT, + OBJECT_A5, + OBJECT_A6, + OBJECT_A7, + OBJECT_A8, + OBJECT_A9, + WATERFALL_OPENING, + OBJECT_AB, + FOUR_ELEMENTS, + OBJECT_AD, + FLOATING_BLOCK, + OBJECT_AF, + METAL_DOOR, + JAIL_BARS, + OBJECT_B2, + OBJECT_B3, + OBJECT_B4, + OBJECT_B5, + OBJECT_B6, + WELL, + WIND_TRIBE_TELEPORTER, + OBJECT_B9, + OBJECT_BA, + WINDCREST, + LIT_AREA, + OBJECT_BD, + PINWHEEL, + OBJECT_BF, + ENEMY_ITEM, + OBJECT_C1, +} Object; + extern void ItemOnGround(Entity*); extern void DeathFx(Entity*); extern void ItemForSale(Entity*); diff --git a/src/arm_proxy.c b/src/arm_proxy.c index 9771daa5..e18e4a1c 100644 --- a/src/arm_proxy.c +++ b/src/arm_proxy.c @@ -290,7 +290,7 @@ void ItemUpdate(Entity* this) { ItemInit(this); if (!sub_0805E3B0(this)) { - gPlayerItemFunctions[this->entityType.subtype](this); + gPlayerItemFunctions[this->id](this); this->bitfield &= ~0x80; if (this->hurtBlinkTime != 0) { if (this->hurtBlinkTime > 0) @@ -306,7 +306,7 @@ void ItemUpdate(Entity* this) { NONMATCH("asm/non_matching/arm_proxy/ItemInit.inc", void ItemInit(Entity* this)) { ItemFrame* entry; - entry = &gUnk_08126DA8[this->entityType.subtype]; + entry = &gUnk_08126DA8[this->id]; if (entry->unk0 == 0xff) { u32 temp = entry->unk2; ItemFrame* temp2 = gUnk_08126ED8[entry->unk1]; @@ -343,7 +343,7 @@ void ObjectUpdate(Entity* this) { if (this->hurtBlinkTime != 0) this->hurtBlinkTime++; if (!sub_0805E3B0(this)) { - gObjectFunctions[this->entityType.subtype](this); + gObjectFunctions[this->id](this); this->bitfield &= ~0x80; } DrawEntity(this); @@ -351,7 +351,7 @@ void ObjectUpdate(Entity* this) { void sub_08017508(Entity* this) { if (!sub_0805E3B0(this)) - gManagerFunctions[this->entityType.subtype](this); + gManagerFunctions[this->id](this); } // regalloc @@ -361,10 +361,10 @@ NONMATCH("asm/non_matching/arm_proxy/sub_08017530.inc", void NPCUpdate(Entity* t if ((this->action == 0) && ((this->flags & 1) == 0)) sub_0806EC78(this); if (!sub_0805E3B0(this)) - gNPCFunctions[this->entityType.subtype][0](this); + gNPCFunctions[this->id][0](this); if (this->next != NULL) { - if (gNPCFunctions[this->entityType.subtype][1] != NULL) - gNPCFunctions[this->entityType.subtype][1](this); + if (gNPCFunctions[this->id][1] != NULL) + gNPCFunctions[this->id][1](this); if ((this->currentHealth & 0x7f) != 0) { u32 temp = this->currentHealth & 0x7f; gUnk_02031EC0[temp * 2 - 2].x = this->x.HALF.HI - gRoomControls.roomOriginX; diff --git a/src/code_0805436C.c b/src/code_0805436C.c index 4e545cb6..76a9b18c 100644 --- a/src/code_0805436C.c +++ b/src/code_0805436C.c @@ -250,10 +250,10 @@ u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) { } else { itemEntity->actionDelay = 0; } - if ((arg0->entityType).type == 6) { - if (arg0->entityType.subtype == 99) { + if (arg0->kind == 6) { + if (arg0->id == 99) { arg0->attachedEntity = itemEntity; - } else if (arg0->entityType.subtype == 0x1e) { + } else if (arg0->id == 0x1e) { itemEntity->direction = arg0->animationState << 3 | 0x80; itemEntity->nonPlanarMovement = 0xc0; itemEntity->field_0x20 = 0x18000; diff --git a/src/code_08077B98.c b/src/code_08077B98.c index 83d0089b..c3fbf5dd 100644 --- a/src/code_08077B98.c +++ b/src/code_08077B98.c @@ -69,8 +69,8 @@ void* sub_08077C54(UnkItemStruct* unk) { item = sub_0805E744(); if (item != NULL) { - item->entityType.subtype = gUnk_0811BE48[unk->field_0x1].unk[3]; - item->entityType.type = 8; + item->id = gUnk_0811BE48[unk->field_0x1].unk[3]; + item->kind = 8; item->flags = 0xa0; item->parent = (Entity*)unk; item->field_0x68.HALF.LO = unk->field_0x1; @@ -95,10 +95,10 @@ Entity* CreatePlayerItem(u32 subtype, u32 form, u32 parameter, u32 unk) { ent = GetEmptyEntity(); if (ent != NULL) { ent->flags = 0x80; - (ent->entityType).type = 8; - (ent->entityType).subtype = subtype; - (ent->entityType).form = form; - (ent->entityType).parameter = parameter; + ent->kind = 8; + ent->id = subtype; + ent->type = form; + ent->type2 = parameter; ent->field_0x68.HALF.LO = unk; AppendEntityToList(ent, 2); } @@ -111,10 +111,10 @@ Entity* sub_08077CF8(u32 subtype, u32 form, u32 parameter, u32 unk) { ent = sub_0805E744(); if (ent != NULL) { ent->flags = 0x80; - (ent->entityType).type = 8; - (ent->entityType).subtype = subtype; - (ent->entityType).form = form; - (ent->entityType).parameter = parameter; + ent->kind = 8; + ent->id = subtype; + ent->type = form; + ent->type2 = parameter; ent->field_0x68.HALF.LO = unk; AppendEntityToList(ent, 2); } diff --git a/src/code_08077DF4.c b/src/code_08077DF4.c index 7312ecd0..1697ecb0 100644 --- a/src/code_08077DF4.c +++ b/src/code_08077DF4.c @@ -15,7 +15,7 @@ typedef struct { void sub_08077DF4(Entity* ent, u32 arg1) { *(u16*)&ent->flags = arg1; if ((arg1 & 0xff) > 0xb8) { - arg1 += (ent->entityType).form >> 1; + arg1 += ent->type >> 1; } gPlayerEntity.spriteIndex = (short)(arg1 >> 8); InitAnimationForceUpdate(&gPlayerEntity, (u8)arg1); diff --git a/src/createEnemy.c b/src/createEnemy.c index 3b243e79..5ce7af89 100644 --- a/src/createEnemy.c +++ b/src/createEnemy.c @@ -9,9 +9,9 @@ Entity* CreateEnemy(u32 subtype, u32 form) { enemy = GetEmptyEntity(); if (enemy != NULL) { - (enemy->entityType).type = 3; - (enemy->entityType).subtype = subtype; - (enemy->entityType).form = form; + enemy->kind = 3; + enemy->id = subtype; + enemy->type = form; AppendEntityToList(enemy, 4); } return enemy; diff --git a/src/createEntity.c b/src/createEntity.c index 7feff11b..e83312a1 100644 --- a/src/createEntity.c +++ b/src/createEntity.c @@ -28,7 +28,7 @@ // (entity->entityType).form = param_1->entityform; // RegisterRoomEntity(entity,param_1); // if ((param_1->field_0x1 & 240) != 16) { -// (entity->entityType).parameter = *(u8 *)¶m_1->entityparameter; +// (entity->type2 = *(u8 *)¶m_1->entityparameter; // entity->actionDelay = (u8)((u32)param_1->entityparameter >> 8); // if ((type != 9) && (sub_0804AF0C(entity,param_1), entity->field_0x4 != NULL)) { // if ((param_1->entityType & 16) == 0) { diff --git a/src/createNPC.c b/src/createNPC.c index 3e11ba91..b8a30fdf 100644 --- a/src/createNPC.c +++ b/src/createNPC.c @@ -4,17 +4,15 @@ extern Entity* GetEmptyEntity(); extern void AppendEntityToList(Entity*, u8); -Entity* CreateNPC(u32 subtype, u32 form, u32 parameter) - -{ +Entity* CreateNPC(u32 subtype, u32 form, u32 parameter) { Entity* pEVar1; pEVar1 = GetEmptyEntity(); if (pEVar1 != NULL) { - (pEVar1->entityType).type = 7; - (pEVar1->entityType).subtype = subtype; - (pEVar1->entityType).form = form; - (pEVar1->entityType).parameter = parameter; + pEVar1->kind = 7; + pEVar1->id = subtype; + pEVar1->type = form; + pEVar1->type2 = parameter; AppendEntityToList(pEVar1, 7); } return pEVar1; diff --git a/src/createObject.c b/src/createObject.c index ad852900..62c67062 100644 --- a/src/createObject.c +++ b/src/createObject.c @@ -10,10 +10,10 @@ Entity* CreateObject(u32 subtype, u32 form, u32 parameter) { ent = GetEmptyEntity(); if (ent != NULL) { - ent->entityType.type = 6; - ent->entityType.subtype = subtype; - ent->entityType.form = form; - ent->entityType.parameter = parameter; + ent->kind = 6; + ent->id = subtype; + ent->type = form; + ent->type2 = parameter; AppendEntityToList(ent, 6); } return ent; diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index 73212e2f..3344b5b5 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -47,14 +47,14 @@ void AcroBandit(Entity* this) { } void sub_080318C4(Entity* this) { - gUnk_080CE584[this->entityType.form](this); + gUnk_080CE584[this->type](this); } void sub_080318DC(Entity* this) { Entity* brother; if (this->bitfield != 0x80 && this->bitfield != 0x81) { - if (this->entityType.form == 1) { + if (this->type == 1) { if (this->action < 7 && this->field_0x42) { brother = this->attachedEntity; if (brother) { @@ -85,13 +85,13 @@ void sub_080318DC(Entity* this) { if (this->currentHealth == 0) { this->field_0x3e = ((this->field_0x3e + (7 & Random())) - 4) & 0x1f; - this->field_0x42 += this->entityType.parameter * 3; + this->field_0x42 += this->type2 * 3; sub_08032338(this); } } if (this->field_0x42 && this->frames.all & 0x10) { - if (this->entityType.form == 0) { + if (this->type == 0) { this->action = 8; } else { this->action = 9; @@ -216,35 +216,35 @@ void sub_08031C58(Entity* this) { tmp &= 3; a = CreateEnemy(0x2e, 1); - a->entityType.parameter = 0; + a->type2 = 0; a->parent = NULL; a->field_0x74.HALF.LO = tmp; sub_08031E48(this, a); a->attachedEntity = CreateEnemy(0x2e, 1); b = a->attachedEntity; - b->entityType.parameter = 1; + b->type2 = 1; b->parent = a; b->field_0x74.HALF.LO = tmp; sub_08031E48(this, b); b->attachedEntity = CreateEnemy(0x2e, 1); a = b->attachedEntity; - a->entityType.parameter = 2; + a->type2 = 2; a->parent = b; a->field_0x74.HALF.LO = tmp; sub_08031E48(this, a); a->attachedEntity = CreateEnemy(0x2e, 1); b = a->attachedEntity; - b->entityType.parameter = 3; + b->type2 = 3; b->parent = a; b->field_0x74.HALF.LO = tmp; sub_08031E48(this, b); b->attachedEntity = CreateEnemy(0x2e, 1); a = b->attachedEntity; - a->entityType.parameter = 4; + a->type2 = 4; a->parent = b; a->attachedEntity = NULL; a->field_0x74.HALF.LO = tmp; @@ -327,7 +327,7 @@ void sub_08031EA8(Entity* this) { this->action = 1; this->spritePriority.b1 = 1; this->field_0x20 = 0x40000; - this->height.HALF.HI = (4 - this->entityType.parameter) * 0xe; + this->height.HALF.HI = (4 - this->type2) * 0xe; this->field_0x78.HALF.HI = Random(); InitializeAnimation(this, 4); } @@ -358,11 +358,11 @@ void sub_08031EE8(Entity* this) { } void sub_08031F54(Entity* this) { - sub_08003FC4(this, gUnk_080CE5F0[this->entityType.parameter]); - if (this->entityType.parameter * -0xe <= this->height.HALF.HI) { + sub_08003FC4(this, gUnk_080CE5F0[this->type2]); + if (this->type2 * -0xe <= this->height.HALF.HI) { this->action = 3; this->actionDelay = 20; - this->height.HALF.HI = this->entityType.parameter * -0xe; + this->height.HALF.HI = this->type2 * -0xe; if (this->parent != NULL) this->spritePriority.b1 = 0; InitializeAnimation(this, 6); @@ -445,7 +445,7 @@ void sub_08032160(Entity* this) { if (this->actionDelay == 0) { this->action = 7; - dir = gUnk_080CE5FA[this->field_0x74.HALF.LO * 5 + this->entityType.parameter]; + dir = gUnk_080CE5FA[this->field_0x74.HALF.LO * 5 + this->type2]; this->direction = dir; if (dir >= 0x10) { this->spriteSettings.b.flipX = 1; diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c index 9536f297..6f888658 100644 --- a/src/enemy/beetle.c +++ b/src/enemy/beetle.c @@ -52,7 +52,7 @@ void sub_08021780(Entity* this) { } void sub_08021818(Entity* this) { - if (this->entityType.form == 0) { + if (this->type == 0) { sub_0804A7D4(this); } else { Entity* ent = this->parent; @@ -94,7 +94,7 @@ void Beetle_Initialize(Entity* this) { } void sub_080218B4(Entity* this) { - gUnk_080CB5D4[this->entityType.parameter](this); + gUnk_080CB5D4[this->type2](this); } void sub_080218CC(Entity* this) { @@ -222,7 +222,7 @@ void sub_08021B64(Entity* this) { int iVar4 = 1; if (gPlayerState.field_0xa8 != 11 && gPlayerState.field_0xa8 != 20) { if (sub_0807953C()) - iVar4 = this->entityType.form * 3 + 8; + iVar4 = this->type * 3 + 8; iVar4 = this->actionDelay - iVar4; if (iVar4 < 0) diff --git a/src/enemy/bladeTrap.c b/src/enemy/bladeTrap.c index 397afc93..c8ffa9af 100644 --- a/src/enemy/bladeTrap.c +++ b/src/enemy/bladeTrap.c @@ -11,7 +11,7 @@ void BladeTrap(Entity* ent) { u16* puVar3; if (ent->action == 0) { ent->action = 1; - pEVar2 = GetCurrentRoomProperty((u8)(ent->entityType).form); + pEVar2 = GetCurrentRoomProperty((u8)ent->type); ent->attachedEntity = pEVar2; sub_080A2CC0((EntityData*)ent, &ent->attachedEntity, &ent->field_0x74); } diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index 8cbb4b51..b8dc9575 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -39,7 +39,7 @@ extern const Hitbox gUnk_080CD17C; void BombPeahat(Entity* this) { s32 iVar1; - if ((this->entityType.form == 2) && (iVar1 = sub_080012DC(this), iVar1)) { + if ((this->type == 2) && (iVar1 = sub_080012DC(this), iVar1)) { gUnk_080012C8[iVar1](this); } else { gUnk_080CD0F0[GetNextFunction(this)](this); @@ -47,7 +47,7 @@ void BombPeahat(Entity* this) { } void sub_0802A84C(Entity* this) { - switch (this->entityType.form) { + switch (this->type) { default: gUnk_080CD108[this->action](this); sub_0802AD54(this); @@ -64,7 +64,7 @@ void sub_0802A84C(Entity* this) { void sub_0802A8AC(Entity* this) { this->field_0x80.HALF.HI = 0; - if (this->entityType.form < 2) { + if (this->type < 2) { InitializeAnimation(this, 0); } } @@ -118,7 +118,7 @@ void sub_0802A924(Entity* this) { this->spriteOrientation.flipY = 1; this->spriteRendering.b3 = 1; this->spritePriority.b0 = 1; - InitializeAnimation(this, this->entityType.form + 1); + InitializeAnimation(this, this->type + 1); } void sub_0802A9A8(Entity* this) { @@ -245,7 +245,7 @@ void sub_0802AB40(Entity* this) { } else { this->action = 5; this->nonPlanarMovement = 0; - InitializeAnimation(this, this->entityType.form + 1); + InitializeAnimation(this, this->type + 1); } break; } @@ -341,14 +341,14 @@ void sub_0802AD54(Entity* this) { } void sub_0802ADDC(Entity* this) { - Entity* ent = CreateEnemy(0x1b, this->entityType.form + 2); + Entity* ent = CreateEnemy(0x1b, this->type + 2); if (ent != NULL) { - ent->entityType.parameter = !!sub_0802B234(this); + ent->type2 = !!sub_0802B234(this); ent->parent = this; this->attachedEntity = ent; CopyPosition(this, ent); this->field_0x80.HALF.HI = 1; - if (this->entityType.form == 0) { + if (this->type == 0) { this->field_0x7a.HALF.LO++; } } @@ -400,7 +400,7 @@ void sub_0802AED4(Entity* this) { sub_08078930(this); } } - if (this->entityType.parameter != 0 && this->field_0x80.HALF.HI) { + if (this->type2 != 0 && this->field_0x80.HALF.HI) { this->actionDelay = 0; this->field_0xf = 1; } diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c index 0dbb7dd1..49ba9ea1 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -335,7 +335,7 @@ void sub_08028E84(Entity* this) { bool32 sub_08029198(const struct SalesOffering*); void sub_08028E9C(Entity* this) { - const struct SalesOffering* offer = &gUnk_080CC954[this->entityType.form]; + const struct SalesOffering* offer = &gUnk_080CC954[this->type]; if (sub_08029198(offer) && (offer->field_0x0 & 2)) { offer = &gUnk_080CC954[offer->field_0xa]; } diff --git a/src/enemy/chuchu.c b/src/enemy/chuchu.c index 9b816805..99a9160a 100644 --- a/src/enemy/chuchu.c +++ b/src/enemy/chuchu.c @@ -49,7 +49,7 @@ void Chuchu(Entity* this) { case 2: this->field_0x3a &= 0xfe; if (index != this->field_0x80.HALF.HI) { - switch (this->entityType.form) { + switch (this->type) { case 0: if (this->flags & 0x80) { this->action = 6; @@ -73,13 +73,13 @@ void Chuchu(Entity* this) { gUnk_080CA21C[GetNextFunction(this)](this); if (*(char*)(*(int*)&this->field_0x68 + 10) == 0x1c) { SetChildOffset(this, 0, 1, -0x10); - } else if (this->entityType.form == 2) { + } else if (this->type == 2) { sub_0801FB34(this); } } void Chuchu_OnTick(Entity* this) { - switch (this->entityType.form) { + switch (this->type) { case 0: sub_0801F3AC(this); gUnk_080CA234[this->action](this); @@ -97,7 +97,7 @@ void Chuchu_OnTick(Entity* this) { void sub_0801EF40(Entity* this) { u8 health; - if (this->entityType.form == 2) { + if (this->type == 2) { if (this->bitfield == 0x8e || this->bitfield == 0x95) { this->flags &= ~0x80; this->currentHealth = 0; @@ -146,9 +146,9 @@ void sub_0801F02C(Entity* this) { void sub_0801F048(Entity* this) { sub_08003FC4(this, 0x1800); GetNextFrame(this); - if (this->entityType.form == 0) { + if (this->type == 0) { sub_0804A7D4(this); - } else if (this->entityType.form == 1) { + } else if (this->type == 1) { CreateDeathFx(this, 0xf2, 0); } else { CreateDeathFx(this, 0xf1, 0); @@ -337,7 +337,7 @@ void sub_0801F428(Entity* this) { this->actionDelay = Random(); this->field_0x80.HALF.LO = this->currentHealth; this->field_0x82.HALF.LO = 0; - if (this->entityType.parameter == 0) + if (this->type2 == 0) return; this->action = 3; @@ -545,7 +545,7 @@ void sub_0801F884(Entity* this) { } else { Entity* ent = sub_0804A9FC(this, 0x1b); if (ent) { - ent->entityType.parameter = 64; + ent->type2 = 64; this->action = 4; this->damageType = 165; EnqueueSFX(0x193); @@ -676,7 +676,7 @@ void sub_0801FB34(Entity* this) { } void sub_0801FB68(Entity* this) { - switch (this->entityType.form) { + switch (this->type) { case 0: this->action = 9; break; diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index ee21e03c..674e8774 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -29,7 +29,7 @@ void ChuchuBoss(Entity* this) { void sub_08025CBC(Entity* this) { sub_08001324(this); - if (this->entityType.form == 0) { + if (this->type == 0) { sub_08027870(this); } } diff --git a/src/enemy/darkNut.c b/src/enemy/darkNut.c index b0c63e8a..49acb71d 100644 --- a/src/enemy/darkNut.c +++ b/src/enemy/darkNut.c @@ -60,7 +60,7 @@ void sub_08020BB8(Entity* this) { switch (this->bitfield & 0x7f) { case 0x1c: this->action = 11; - this->actionDelay = gUnk_080CAB0C[this->entityType.form]; + this->actionDelay = gUnk_080CAB0C[this->type]; this->damageType = 81; sub_08021218(this, 8, DirectionToAnimationState(this->field_0x3e ^ 0x10)); sub_08021588(this); @@ -68,7 +68,7 @@ void sub_08020BB8(Entity* this) { break; case 0x16: this->action = 11; - this->actionDelay = gUnk_080CAB10[this->entityType.form]; + this->actionDelay = gUnk_080CAB10[this->type]; this->damageType = 81; sub_08021218(this, 8, DirectionToAnimationState(this->field_0x3e ^ 0x10)); sub_08021588(this); @@ -79,10 +79,10 @@ void sub_08020BB8(Entity* this) { break; switch (this->field_0x78.HALF.HI) { case 8 ... 12: - this->field_0x7a.HALF.LO = gUnk_080CAB04[this->entityType.form]; + this->field_0x7a.HALF.LO = gUnk_080CAB04[this->type]; break; case 4 ... 6: - this->field_0x7a.HALF.LO = gUnk_080CAB00[this->entityType.form]; + this->field_0x7a.HALF.LO = gUnk_080CAB00[this->type]; break; default: this->field_0x7a.HALF.LO = 0; @@ -100,7 +100,7 @@ void sub_08020BB8(Entity* this) { bVar3 = this->attachedEntity->bitfield & 0x7f; } if (bVar3 == 2) { - sub_080213D0(this, gUnk_080CAB08[this->entityType.form]); + sub_080213D0(this, gUnk_080CAB08[this->type]); } else { sub_080213D0(this, 0); } @@ -412,7 +412,7 @@ void sub_080212B0(Entity* this) { break; } - if (this->entityType.form < 2 && tmp == 2) + if (this->type < 2 && tmp == 2) tmp = gUnk_080CAB52[Random() & 3]; this->attachedEntity = NULL; @@ -421,7 +421,7 @@ void sub_080212B0(Entity* this) { void sub_08021328(Entity* this) { this->action = 13; - this->field_0x7c.BYTES.byte0 = gUnk_080CAB68[this->entityType.form]; + this->field_0x7c.BYTES.byte0 = gUnk_080CAB68[this->type]; sub_08021218(this, 0xc, this->animationState); } diff --git a/src/enemy/doorMimic.c b/src/enemy/doorMimic.c index d79f61ff..27357c08 100644 --- a/src/enemy/doorMimic.c +++ b/src/enemy/doorMimic.c @@ -24,7 +24,7 @@ extern s16 gUnk_080B4488[]; void DoorMimic(Entity* this) { gUnk_080CB734[GetNextFunction(this)](this); - this->hitbox = (Hitbox*)gUnk_080CB8A4[this->entityType.parameter][this->frameIndex]; + this->hitbox = (Hitbox*)gUnk_080CB8A4[this->type2][this->frameIndex]; } void sub_08021FDC(Entity* this) { @@ -44,11 +44,11 @@ void sub_08022004(Entity* this) { void sub_08022034(Entity* this) { this->action = 1; - this->entityType.parameter = this->entityType.form & 3; + this->type2 = this->type & 3; this->spritePriority.b0 = 5; - this->field_0x78.HWORD = gUnk_080CB764[this->entityType.parameter * 2 + 0] + this->x.HALF.HI; - this->field_0x7a.HWORD = gUnk_080CB764[this->entityType.parameter * 2 + 1] + this->y.HALF.HI; - InitializeAnimation(this, this->entityType.parameter); + this->field_0x78.HWORD = gUnk_080CB764[this->type2 * 2 + 0] + this->x.HALF.HI; + this->field_0x7a.HWORD = gUnk_080CB764[this->type2 * 2 + 1] + this->y.HALF.HI; + InitializeAnimation(this, this->type2); sub_080221C0(this); } @@ -57,7 +57,7 @@ void sub_0802209C(Entity* this) { if (sub_0806FBFC(this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x10, 0x10)) { this->action = 2; this->actionDelay = 0x12; - InitializeAnimation(this, this->entityType.parameter + 4); + InitializeAnimation(this, this->type2 + 4); } } else { this->actionDelay = this->actionDelay - 1; @@ -78,7 +78,7 @@ void sub_080220F0(Entity* this) { this->action = 4; this->actionDelay = 0x78; this->field_0x44 = 0; - off = gUnk_080CB76C[this->entityType.parameter]; + off = gUnk_080CB76C[this->type2]; for (i = 0; i < 6; i++, off++) { Entity* fx = CreateFx(this, 0x11, 0); if (fx) { @@ -96,7 +96,7 @@ void sub_08022174(Entity* this) { sub_0800445C(this); if (--this->actionDelay == 0) { this->action = 5; - InitializeAnimation(this, this->entityType.parameter + 8); + InitializeAnimation(this, this->type2 + 8); } } @@ -110,10 +110,10 @@ void sub_08022198(Entity* this) { } void sub_080221C0(Entity* this) { - u32 tile = COORD_TO_TILE(this) + gUnk_080B4488[this->entityType.parameter]; + u32 tile = COORD_TO_TILE(this) + gUnk_080B4488[this->type2]; this->field_0x7c.HALF.HI = tile; this->field_0x7c.HALF.LO = sub_080001DA(tile, this->collisionLayer); - SetTile(gUnk_080CB79C[this->entityType.parameter], tile, this->collisionLayer); + SetTile(gUnk_080CB79C[this->type2], tile, this->collisionLayer); } // clang-format off diff --git a/src/enemy/fallingBoulder.c b/src/enemy/fallingBoulder.c index 24f18515..4b469258 100644 --- a/src/enemy/fallingBoulder.c +++ b/src/enemy/fallingBoulder.c @@ -31,7 +31,7 @@ void sub_0802C258(Entity* this) { this->field_0x20 = 0x20000; this->actionDelay = 2; this->field_0x7a.HWORD = Random() & 0x70; - switch (this->entityType.form) { + switch (this->type) { case 1: this->field_0x7a.HWORD |= 0x100; break; @@ -86,7 +86,7 @@ void sub_0802C334(Entity* this) { this->flags &= ~0x80; break; case 8: - if (this->entityType.parameter != 0 && !sub_08049FA0(this)) { + if (this->type2 != 0 && !sub_08049FA0(this)) { u32 diff = 0; s32 i; for (i = 1; i > -1; i--) { @@ -113,7 +113,7 @@ void sub_0802C334(Entity* this) { if (this->height.HALF.HI - y > 0x38) { sub_0802C62C(this); this->field_0x7a.HWORD = (Random() & 0x7f) | 0x80; - if (this->entityType.form == 3) { + if (this->type == 3) { this->action = 3; } } diff --git a/src/enemy/fireballGuy.c b/src/enemy/fireballGuy.c index f7f51c71..3a4e4148 100644 --- a/src/enemy/fireballGuy.c +++ b/src/enemy/fireballGuy.c @@ -63,13 +63,13 @@ void sub_08045454(Entity* this) { u32 tmp; /* Can we create enough new entities? */ - count = gUnk_080D180C[this->entityType.form]; + count = gUnk_080D180C[this->type]; if (72 - count <= gEntCount) return; /* Create 2-5 new MiniFireballGuy */ for (i = 0; i < count; i++) - entities[i] = CreateEnemy(0x59, this->entityType.form); + entities[i] = CreateEnemy(0x59, this->type); off = gUnk_080D1810; for (i = 0; i < count; i++) { @@ -77,7 +77,7 @@ void sub_08045454(Entity* this) { ent->attachedEntity = entities[(i + 1) % count]; ent->parent = entities[(i + count - 1) % count]; tmp = 0; - ent->entityType.parameter = 1; + ent->type2 = 1; ent->height.HALF.HI = tmp; ent->hurtBlinkTime = -0x10; diff --git a/src/enemy/gibdo.c b/src/enemy/gibdo.c index 96d6a08a..a1a9833d 100644 --- a/src/enemy/gibdo.c +++ b/src/enemy/gibdo.c @@ -374,7 +374,7 @@ NONMATCH("asm/non_matching/gibdo/sub_08037B48.inc", void sub_08037B48(Entity* th Entity* E; E = CreateObject(0x2a, 3, 0); if (E != 0) { - E->entityType.parameter = this->actionDelay; + E->type2 = this->actionDelay; E->spritePriority.b0 = (E->spritePriority.b0 & 0xf8) | 3; E->spriteOffsetX = 0; E->spriteOffsetY = 0xfc; @@ -383,7 +383,7 @@ NONMATCH("asm/non_matching/gibdo/sub_08037B48.inc", void sub_08037B48(Entity* th *(Entity**)&this->field_0x80.HWORD = E; E = CreateObject(0x2a, 3, 0); if (E != 0) { - E->entityType.parameter = this->actionDelay; + E->type2 = this->actionDelay; E->spritePriority.b0 = (E->spritePriority.b0 & 0xf8) | 3; E->spriteOffsetX = 0xfd; E->spriteOffsetY = 0xf8; @@ -392,7 +392,7 @@ NONMATCH("asm/non_matching/gibdo/sub_08037B48.inc", void sub_08037B48(Entity* th *(Entity**)&this->cutsceneBeh.HWORD = E; E = CreateObject(0x2a, 3, 0); if (E != 0) { - E->entityType.parameter = this->actionDelay; + E->type2 = this->actionDelay; E->spritePriority.b0 = (E->spritePriority.b0 & 0xf8) | 3; E->spriteOffsetX = 0x5; E->spriteOffsetY = 0xf5; diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c index e728ba20..330e68b8 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -114,7 +114,7 @@ void sub_08046898(Entity* this) { u32 tmp2; if (!tmp) return; - tmp->entityType.form = 1; + tmp->type = 1; tmp->parent = this; this->attachedEntity = tmp; this->action = 1; @@ -141,7 +141,7 @@ void sub_08046910(Entity* this) { } void sub_08046930(Entity* this) { - if (this->entityType.form) { + if (this->type) { this->previousActionFlag = 5; this->direction = 0x20; this->nonPlanarMovement = 0x280; @@ -806,7 +806,7 @@ void sub_08047914(Entity* this) { } else { this->previousActionFlag = 3; this->field_0x70.HALF.LO = 0x3C; - this->field_0x7c.HALF.HI = ((this->entityType.form * 0xF) << 2) + 0x78; + this->field_0x7c.HALF.HI = ((this->type * 0xF) << 2) + 0x78; sub_080A1D70(((Entity*)this->myHeap)->prev, this->animationState); } } @@ -816,7 +816,7 @@ void sub_08047978(Entity* this) { if (this->currentHealth != 0) { if (--this->field_0x70.HALF_U.LO == 0) { this->field_0x70.HALF.HI = 1; - if (this->entityType.form == 0) { + if (this->type == 0) { this->field_0x70.HALF.LO = 0xB4; } else { this->field_0x70.HALF.LO = 0x168; @@ -849,7 +849,7 @@ void sub_08047978(Entity* this) { if (this->attachedEntity->action != 1) return; this->previousActionFlag = 4; - if (this->entityType.form == 0) { + if (this->type == 0) { if ((((Entity*)this->myHeap)->next->animationState >> 6) == 1) { this->field_0x80.HWORD = gRoomControls.roomOriginX + 0x1C0; this->field_0x82.HWORD = gRoomControls.roomOriginY + 0x250; @@ -880,7 +880,7 @@ void sub_08047B08(Entity* this) { sub_08047E58(this); if (!sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, 4)) return; - if (this->entityType.form == 0) { + if (this->type == 0) { this->action = 7; this->previousActionFlag = 0; this->direction ^= 0x80; @@ -968,7 +968,7 @@ void sub_08047BF0(Entity* this) { void sub_08047D24(Entity* this) { this->field_0x7c.HALF_U.HI += 8; if (this->field_0x7c.HALF_U.HI > 0x800) { - if (this->entityType.form == 0) { + if (this->type == 0) { ((u32*)this->myHeap)[2] = 0; } else { ((u32*)this->myHeap)[3] = 0; diff --git a/src/enemy/hangingSeed.c b/src/enemy/hangingSeed.c index 7ca8808a..fc09db31 100644 --- a/src/enemy/hangingSeed.c +++ b/src/enemy/hangingSeed.c @@ -26,7 +26,7 @@ void nullsub_7(Entity* this) { void HangingSeed_Initialize(Entity* this) { this->action = 1; this->spriteSettings.b.draw = 1; - this->frameIndex = this->entityType.form; + this->frameIndex = this->type; this->spriteRendering.b3 = 1; this->spritePriority.b0 = 3; } diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c index 5e19018a..64a97b39 100644 --- a/src/enemy/helmasaur.c +++ b/src/enemy/helmasaur.c @@ -27,7 +27,7 @@ extern const s8 gUnk_080CD45C[]; extern const s8 gUnk_080CD464[]; void Helmasaur(Entity* this) { - if (this->entityType.form == 0) { + if (this->type == 0) { EnemyFunctionHandler(this, gUnk_080CD3E4); SetChildOffset(this, 0, 1, -0x10); } else { diff --git a/src/enemy/keese.c b/src/enemy/keese.c index 0b9890c0..0462b254 100644 --- a/src/enemy/keese.c +++ b/src/enemy/keese.c @@ -63,7 +63,7 @@ void sub_08021DDC(Entity* this) { void Keese_Initialize(Entity* this) { sub_0804A720(this); - if (this->entityType.form != 0) { + if (this->type != 0) { this->spritePriority.b1 = 1; this->height.HALF.HI = -0x10; } diff --git a/src/enemy/lakituCloud.c b/src/enemy/lakituCloud.c index 4ee9063b..80679029 100644 --- a/src/enemy/lakituCloud.c +++ b/src/enemy/lakituCloud.c @@ -75,7 +75,7 @@ void sub_0803CD6C(Entity* this) { this->height.HALF.HI = -2; // Set parent to lakitu - lakitu = GetCurrentRoomProperty(this->entityType.form); + lakitu = GetCurrentRoomProperty(this->type); this->attachedEntity = lakitu; this->parent = lakitu; diff --git a/src/enemy/leever.c b/src/enemy/leever.c index a71c28c0..5ce12ee5 100644 --- a/src/enemy/leever.c +++ b/src/enemy/leever.c @@ -57,7 +57,7 @@ void sub_0801FC40(Entity* this) { } void sub_0801FC7C(Entity* this) { - if (this->entityType.form == LeeverForm_Red) { + if (this->type == LeeverForm_Red) { sub_0804A7D4(this); } else { CreateDeathFx(this, 0xf1, 0); @@ -89,7 +89,7 @@ void Leever_DigUp(Entity* this) { if (this->frames.b.f3 != 0) { this->action = 3; - if (this->entityType.form == LeeverForm_Red) { + if (this->type == LeeverForm_Red) { this->field_0x74.HWORD = 180; } else { this->field_0x74.HWORD = 110; @@ -173,7 +173,7 @@ void Leever_Move(Entity* this) { } this->nonPlanarMovement = (this->frames.all & 0xf) * 0x20; - if (this->entityType.form == LeeverForm_Red) { + if (this->type == LeeverForm_Red) { if ((this->field_0xf++ & 0xf) == 0) { sub_08004596(this, sub_0800132C(this, gUnk_020000B0)); } diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c index 64207c30..60a7b7b7 100644 --- a/src/enemy/likeLike.c +++ b/src/enemy/likeLike.c @@ -70,7 +70,7 @@ void nullsub_139(Entity* this) { void sub_08027E70(Entity* this) { sub_0804A720(this); - switch (this->entityType.form) { + switch (this->type) { case 0: this->action = 3; this->spriteSettings.b.draw = 0; diff --git a/src/enemy/madderpillar.c b/src/enemy/madderpillar.c index 4bed2e91..cea511b4 100644 --- a/src/enemy/madderpillar.c +++ b/src/enemy/madderpillar.c @@ -27,7 +27,7 @@ extern const u8 gUnk_080CCDC8[]; extern const u16 gUnk_080CCDD4[]; void Madderpillar(Entity* this) { - gUnk_080CCD44[this->entityType.form](this); + gUnk_080CCD44[this->type](this); } void sub_08029870(Entity* this) { @@ -167,7 +167,7 @@ void sub_08029B2C(Entity* this) { } } else { this->flags &= ~0x80; - this->actionDelay = -(this->entityType.form * 15 - 90); + this->actionDelay = -(this->type * 15 - 90); this->field_0x86.HALF.LO = 1; } } else { @@ -179,7 +179,7 @@ void sub_08029B90(Entity* this) { this->action = 1; this->spriteSettings.b.draw = 1; sub_0802A058(this); - if (this->entityType.form < 2) { + if (this->type < 2) { InitializeAnimation(this, 0); } else { InitializeAnimation(this, 4); @@ -195,7 +195,7 @@ void sub_08029BC4(Entity* this) { uVar2 = this->y.HALF.HI; if (sub_08029FE4(this)) { u32 index; - if (this->entityType.form < 2) { + if (this->type < 2) { index = 0; } else { index = 4; @@ -207,7 +207,7 @@ void sub_08029BC4(Entity* this) { void sub_08029C08(Entity* this) { this->action = 3; - this->actionDelay = gUnk_080CCDA0[this->entityType.form]; + this->actionDelay = gUnk_080CCDA0[this->type]; this->damageType = 0x6b; this->attachedEntity->action = 2; } diff --git a/src/enemy/miniSlime.c b/src/enemy/miniSlime.c index 55af91ab..08c94fa7 100644 --- a/src/enemy/miniSlime.c +++ b/src/enemy/miniSlime.c @@ -52,7 +52,7 @@ void sub_080452A4(Entity* this) { this->nonPlanarMovement = 0x100; sub_0804A720(this); InitializeAnimation(this, 6); - if (this->entityType.parameter) { + if (this->type2) { this->action = 2; this->actionDelay = 1; } else { diff --git a/src/enemy/moldorm.c b/src/enemy/moldorm.c index 6f86d987..186bee30 100644 --- a/src/enemy/moldorm.c +++ b/src/enemy/moldorm.c @@ -14,7 +14,7 @@ extern u8 gEntCount; extern const s8 gUnk_080CBBC4[]; void Moldorm(Entity* this) { - gUnk_080CBB90[this->entityType.form](this); + gUnk_080CBB90[this->type](this); } void sub_08022BA0(Entity* this) { @@ -133,8 +133,8 @@ void sub_08022DE8(Entity* this) { this->animationState = this->parent->animationState; *(u32*)&this->cutsceneBeh = this->animationState * 0x11111111; - if (this->entityType.form != 3) { - this->frameIndex = this->entityType.form + 7; + if (this->type != 3) { + this->frameIndex = this->type + 7; } else { this->frameIndex = this->animationState + 10; } diff --git a/src/enemy/moldworm.c b/src/enemy/moldworm.c index ffa1dc94..3bf68715 100644 --- a/src/enemy/moldworm.c +++ b/src/enemy/moldworm.c @@ -31,7 +31,7 @@ void Moldworm(Entity* this) { u16 prevX = this->x.HALF.HI; u16 prevY = this->y.HALF.HI; - if (this->entityType.form == 0) { + if (this->type == 0) { if (this->action != 0) { sub_0802390C(this); } @@ -39,7 +39,7 @@ void Moldworm(Entity* this) { EnemyFunctionHandler(this, gUnk_080CBC38); } else { if (this->parent->next) { - if (this->entityType.form != 8) { + if (this->type != 8) { sub_080235BC(this); } else { sub_08023730(this); @@ -76,10 +76,10 @@ void sub_080230E4(Entity* this) { this->field_0x7c.BYTES.byte3 = 0; this->field_0x7a.HALF.HI = 0; if (this->bitfield == 0x80 || this->bitfield == 0x9e) { - this->entityType.parameter = 0; + this->type2 = 0; this->field_0x80.HALF.LO = 0x14; } else { - this->entityType.parameter = 1; + this->type2 = 1; this->field_0x80.HALF.LO = 8; } } @@ -259,7 +259,7 @@ void sub_080234D8(Entity* this) { } void sub_0802351C(Entity* this) { - if (this->actionDelay != 0 && (this->entityType.parameter == 1 || gPlayerEntity.frameIndex == 0xff)) { + if (this->actionDelay != 0 && (this->type2 == 1 || gPlayerEntity.frameIndex == 0xff)) { this->actionDelay = 0; this->attachedEntity->action = 3; this->attachedEntity->field_0xf = this->field_0x80.HALF.LO; @@ -268,7 +268,7 @@ void sub_0802351C(Entity* this) { } if (this->field_0x7c.BYTES.byte3 == 0) { - if (this->entityType.parameter == 0) { + if (this->type2 == 0) { gPlayerEntity.animationState = this->animationState & 7; gPlayerState.flags.all |= 0x80000; PositionRelative(this, &gPlayerEntity, 0, gUnk_080CBC90[this->animationState & 7] << 0x10); @@ -291,7 +291,7 @@ void sub_080235D4(Entity* this) { this->x.HALF.HI = parent->x.HALF.HI; this->y.HALF.HI = parent->y.HALF.HI; sub_080239F0(this); - if (this->entityType.form == 1) { + if (this->type == 1) { this->animationState = 0x10; } else { this->animationState = 0x12; @@ -404,7 +404,7 @@ void sub_08023894(Entity* this) { this->action = 2; this->parent->field_0x7c.BYTES.byte3 = 1; InitializeAnimation(this, this->animationState); - if ((this->parent->entityType).parameter == 0) { + if (this->parent->type2 == 0) { gPlayerState.flags.all |= 0x200000; gPlayerEntity.x.HALF.HI = this->x.HALF.HI; gPlayerEntity.y.HALF.HI = this->y.HALF.HI; diff --git a/src/enemy/octorok.c b/src/enemy/octorok.c index 7e563ab0..d89e4e65 100644 --- a/src/enemy/octorok.c +++ b/src/enemy/octorok.c @@ -47,7 +47,7 @@ void sub_0801EAE8(Entity* this) { // Death void sub_0801EB0C(Entity* this) { - if (this->entityType.form == 0) { + if (this->type == 0) { sub_0804A7D4(this); } else { CreateDeathFx(this, 241, 0); @@ -97,8 +97,8 @@ void sub_0801EB9C(Entity* this) { // Init void Octorok_Initialize(Entity* this) { sub_0804A720(this); - if (this->entityType.form == 2) { - this->animationState = this->entityType.form; + if (this->type == 2) { + this->animationState = this->type; } else { this->animationState = Random() & 3; } @@ -120,7 +120,7 @@ void Octorok_Move(Entity* this) { ProcessMovement(this); GetNextFrame(this); if (--this->actionDelay == 0) { - if (Octorok_FacesPlayer(this) && gOctorokSpitChanceModifier[this->entityType.form] <= (Random() & 3)) { + if (Octorok_FacesPlayer(this) && gOctorokSpitChanceModifier[this->type] <= (Random() & 3)) { this->action = 3; InitializeAnimation(this, this->animationState + 4); } else { @@ -155,9 +155,9 @@ void Octorok_Pause(Entity* this) { } void Octorok_Turn(Entity* this) { - if (this->entityType.form != 2) { + if (this->type != 2) { if (sub_08049FA0(this)) { - if (this->entityType.form == 1 && (Random() & 3) == 0 && sub_08049FDC(this, 1)) { + if (this->type == 1 && (Random() & 3) == 0 && sub_08049FDC(this, 1)) { this->direction = DirectionRoundUp(GetFacingDirection(this, gUnk_020000B0)); } else { this->direction = DirectionRound(Random()); diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c index 828c2c4d..165bf1eb 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -32,7 +32,7 @@ enum { }; void Peahat(Entity* this) { - if (this->entityType.form == PeahatForm_Torso) { + if (this->type == PeahatForm_Torso) { EnemyFunctionHandler(this, gPeahatFunctions); SetChildOffset(this, 0, 1, -0x10); } else { diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index 7a12529a..c3e67cc8 100644 --- a/src/enemy/pesto.c +++ b/src/enemy/pesto.c @@ -137,7 +137,7 @@ void sub_080240B8(Entity* this) { this->x.HALF.HI += (direction & 0x10) ? -0x20 : 0x20; } - switch (this->entityType.form) { + switch (this->type) { case 0: this->field_0x78.HWORD = -0x10; this->height.HALF.HI = -0x10; @@ -164,7 +164,7 @@ void sub_080240B8(Entity* this) { this->direction = direction; sub_080249DC(this); - if (this->entityType.form == 1) { + if (this->type == 1) { Entity* ent; this->field_0x82.HALF.HI = 0; @@ -192,7 +192,7 @@ void sub_080241C0(Entity* this) { break; case 1: if (--this->field_0xf == 0) { - if (this->entityType.form != 0) { + if (this->type != 0) { u8 tmp = this->field_0x82.HALF.HI & 0x80; if (tmp) { sub_08024C94(this); @@ -535,7 +535,7 @@ void sub_08024940(Entity* this) { this->height.HALF.HI += 2; } - if (this->entityType.parameter != 0 || CheckIsDungeon()) { + if (this->type2 != 0 || CheckIsDungeon()) { if (!sub_08049FA0(this)) { this->direction = sub_08049EE4(this); sub_080249F4(this); diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c index 881437f5..08908191 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -60,9 +60,9 @@ void sub_08025020(Entity* this) { case 0x1b: sub_0804AA1C(this); - tmp = gUnk_080CBFE8[(*(Entity**)&this->field_0x4c)->entityType.form]; + tmp = gUnk_080CBFE8[(*(Entity**)&this->field_0x4c)->type]; if (tmp < this->field_0x82.HALF.LO) { - this->field_0x82.HALF.LO -= gUnk_080CBFE8[(*(Entity**)&this->field_0x4c)->entityType.form]; + this->field_0x82.HALF.LO -= gUnk_080CBFE8[(*(Entity**)&this->field_0x4c)->type]; } else { this->cutsceneBeh.HWORD = 0x294; this->damageType = 0x83; diff --git a/src/enemy/rockChuchu.c b/src/enemy/rockChuchu.c index 8c4a82f3..01a0c9c7 100644 --- a/src/enemy/rockChuchu.c +++ b/src/enemy/rockChuchu.c @@ -42,7 +42,7 @@ void sub_08022254(Entity* this) { CreateFx(this, 4, 0); ent = CreateEnemy(1, 1); if (ent) { - ent->entityType.parameter = 1; + ent->type2 = 1; ent->hurtBlinkTime = -8; sub_0804A4E4(this, ent); this->action = 2; diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index 98eccc87..74775cab 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -26,7 +26,7 @@ extern Hitbox gUnk_080FD260; void RupeeLike(Entity* this) { u32 uVar1; - if (this->entityType.parameter == 0) { + if (this->type2 == 0) { uVar1 = (u8)sub_080043E8(this); if (uVar1 != 0) { if (this->action == 4) { @@ -75,7 +75,7 @@ void sub_08029318(Entity* this) { } void sub_080293B4(Entity* this) { - CreateDeathFx(this, 0xff, gUnk_080CCC34[this->cutsceneBeh.HALF.LO * 3 + this->entityType.form]); + CreateDeathFx(this, 0xff, gUnk_080CCC34[this->cutsceneBeh.HALF.LO * 3 + this->type]); } void nullsub_141() { @@ -91,11 +91,11 @@ void sub_080293DC(Entity* this) { void sub_0802940C(Entity* this) { Entity* ent; - ent = CreateEnemy(0x17, this->entityType.form); + ent = CreateEnemy(0x17, this->type); if (ent != NULL) { sub_0804A720(this); ent->parent = this; - ent->entityType.parameter = 1; + ent->type2 = 1; this->attachedEntity = ent; this->field_0x80.HALF.HI = 0; this->cutsceneBeh.HALF.LO = 0; @@ -172,7 +172,7 @@ void sub_0802953C(Entity* this) { if (--this->field_0x82.HALF.HI == 0) { this->field_0x82.HALF.HI = 0x41; if (gSave.stats.rupees != 0) { - ModRupees(gUnk_080CCC44[this->entityType.form]); + ModRupees(gUnk_080CCC44[this->type]); this->cutsceneBeh.HALF.LO = 1; } } @@ -200,7 +200,7 @@ void sub_08029660(Entity* this) { u32 temp; this->action = 1; this->spriteIndex = 0xd1; - temp = gUnk_080CCC47[this->entityType.form]; + temp = gUnk_080CCC47[this->type]; this->palette.b.b0 = temp; } @@ -275,7 +275,7 @@ void sub_080297F0(Entity* this) { this->damageType = 0x8e; sub_080AE068(this); this->spriteIndex = 0x143; - temp = gUnk_080CCC47[this->entityType.form]; + temp = gUnk_080CCC47[this->type]; this->palette.b.b0 = temp; this->spriteVramOffset = 9; InitializeAnimation(this, 0x54); diff --git a/src/enemy/sensorBladeTrap.c b/src/enemy/sensorBladeTrap.c index a0a049c0..d1bfd125 100644 --- a/src/enemy/sensorBladeTrap.c +++ b/src/enemy/sensorBladeTrap.c @@ -21,7 +21,7 @@ void SensorBladeTrap(Entity* this) { void sub_0802B9EC(Entity* this) { this->action = 1; - this->field_0x78.HWORD = gUnk_080CD3D4[this->entityType.form]; + this->field_0x78.HWORD = gUnk_080CD3D4[this->type]; this->field_0x7c.HALF.LO = this->cutsceneBeh.HWORD; this->field_0x7c.HALF.HI = this->field_0x86.HWORD; } diff --git a/src/enemy/slime.c b/src/enemy/slime.c index fee54771..13782f7a 100644 --- a/src/enemy/slime.c +++ b/src/enemy/slime.c @@ -102,20 +102,20 @@ void sub_080450A8(Entity* this) { PosOffset* off; /* Can we create enough new entities? */ - count = gUnk_080D16D0[this->entityType.form]; + count = gUnk_080D16D0[this->type]; if (72 - count <= gEntCount) return; /* Create 2-4 new MiniSlime */ for (i = 0; i < count; i++) - entities[i] = CreateEnemy(0x57, this->entityType.form); + entities[i] = CreateEnemy(0x57, this->type); off = gUnk_080D16D4; for (i = 0; i < count; i++) { ent = entities[i]; ent->attachedEntity = entities[(i + 1) % count]; ent->parent = entities[(i + count - 1) % count]; - ent->entityType.parameter = 1; + ent->type2 = 1; ent->height.HALF.HI = 0; ent->hurtBlinkTime = -0x10; diff --git a/src/enemy/sluggula.c b/src/enemy/sluggula.c index e11170bb..86b90864 100644 --- a/src/enemy/sluggula.c +++ b/src/enemy/sluggula.c @@ -21,11 +21,11 @@ extern const s8 gUnk_080CBDF7[]; extern const s8 gUnk_080CBDFF[]; void Sluggula(Entity* this) { - if (this->entityType.form == 1) { + if (this->type == 1) { EnemyFunctionHandler(this, gUnk_080CBDBC); SetChildOffset(this, 0, 1, -0x10); - } else if (this->entityType.form == 0) { + } else if (this->type == 0) { if (this->height.HALF.HI == 0) { u32 idx = sub_080012DC(this); if (idx != 0) { @@ -49,7 +49,7 @@ void sub_08023C20(Entity* this) { if (this->field_0x43) sub_0804A9FC(this, 0x1c); - if (this->entityType.form == 1) { + if (this->type == 1) { sub_0804AA30(this, gUnk_080CBDBC); } else { sub_0804AA30(this, gUnk_080CBDD4); @@ -89,7 +89,7 @@ void sub_08023CE0(Entity* this) { switch (this->action) { case 0: sub_0804A720(this); - if (this->entityType.parameter == 1) { + if (this->type2 == 1) { this->action = 2; if (this->actionDelay == 0) { this->actionDelay = 1; diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c index 356baa4a..f1b039f4 100644 --- a/src/enemy/smallPesto.c +++ b/src/enemy/smallPesto.c @@ -130,11 +130,11 @@ void sub_080317F8(Entity* this) { } void sub_08031840(Entity* this) { - Entity* enemy = CreateEnemy(0x2d, this->entityType.form); + Entity* enemy = CreateEnemy(0x2d, this->type); if (enemy != NULL) { CopyPosition(this, enemy); enemy->parent = this; this->attachedEntity = enemy; - enemy->entityType.parameter = 1; + enemy->type2 = 1; } } diff --git a/src/enemy/spark.c b/src/enemy/spark.c index 9299c856..210b8431 100644 --- a/src/enemy/spark.c +++ b/src/enemy/spark.c @@ -39,7 +39,7 @@ void nullsub_15(Entity* this) { void sub_0802B33C(Entity* this) { sub_0804A720(this); this->action = 1; - this->direction = (this->entityType).parameter; + this->direction = this->type2; this->field_0xf = 0x78; InitializeAnimation(this, 0); } @@ -49,7 +49,7 @@ void sub_0802B35C(Entity* this) { GetNextFrame(this); ProcessMovement(this); - is_head = this->entityType.form == 0; + is_head = this->type == 0; if (this->collisions == 0) { if (--this->field_0xf == 0) { this->field_0xf = 0x78; diff --git a/src/enemy/spearMoblin.c b/src/enemy/spearMoblin.c index 42a5a3a4..24009c34 100644 --- a/src/enemy/spearMoblin.c +++ b/src/enemy/spearMoblin.c @@ -84,7 +84,7 @@ void sub_08028314(Entity* this) { this->field_0x82.HALF.LO = 1; if (this->actionDelay) { - this->animationState = this->entityType.parameter << 1; + this->animationState = this->type2 << 1; this->actionDelay = 0x1e; this->nonPlanarMovement = 0x80; this->direction = this->animationState << 2; diff --git a/src/enemy/tektite.c b/src/enemy/tektite.c index f2eeee55..66d2ca82 100644 --- a/src/enemy/tektite.c +++ b/src/enemy/tektite.c @@ -30,7 +30,7 @@ void sub_0802F150(Entity* this) { case 0x14: this->action = 1; this->previousActionFlag = 0; - if ((this->entityType).form != 0) { + if (this->type != 0) { this->actionDelay = 0xc0; } else { this->actionDelay = gUnk_080CDEF8[Random() & 3]; @@ -76,9 +76,9 @@ void sub_0802F210(Entity* this) { this->field_0xf = 0; *(u8*)&this->field_0x7c = 0; - this->field_0x80.HWORD = this->entityType.form == 0 ? 0x1800 : 0x2800; + this->field_0x80.HWORD = this->type == 0 ? 0x1800 : 0x2800; - this->field_0x82.HWORD = this->entityType.form == 0 ? 0x2800 : 0x3000; + this->field_0x82.HWORD = this->type == 0 ? 0x2800 : 0x3000; InitializeAnimation(this, 0); } @@ -95,7 +95,7 @@ void sub_0802F284(Entity* this) { if ((this->frames.b.f3) != 0) { this->action = 2; this->actionDelay = 0x10; - this->field_0xf = this->entityType.form; + this->field_0xf = this->type; this->field_0x20 = this->field_0x82.HWORD << 4; sub_0802F45C(this); InitializeAnimation(this, 2); @@ -120,7 +120,7 @@ void sub_0802F300(Entity* this) { if (sub_080044EC(this, this->field_0x80.HWORD) == 1) { this->action = 3; this->previousActionFlag = 0; - if (this->entityType.form != 0) { + if (this->type != 0) { rand = 0; } @@ -165,10 +165,10 @@ void sub_0802F3F4(Entity* this) { GetNextFrame(this); if ((this->frames.b.f3) != 0) { - if ((*(u8*)&this->field_0x7c.HALF.LO < 2) && ((this->entityType.form % 2) != 0)) { + if ((*(u8*)&this->field_0x7c.HALF.LO < 2) && ((this->type % 2) != 0)) { this->action = 2; this->actionDelay = 0x10; - this->field_0xf = this->entityType.form; + this->field_0xf = this->type; this->field_0x20 = this->field_0x82.HWORD << 4; (*(u8*)&this->field_0x7c.HALF.LO)++; sub_0802F45C(this); diff --git a/src/enemy/tektiteGolden.c b/src/enemy/tektiteGolden.c index e09309eb..3bf14e34 100644 --- a/src/enemy/tektiteGolden.c +++ b/src/enemy/tektiteGolden.c @@ -45,9 +45,9 @@ void sub_08037F58(Entity* this) { u32 uVar1; if ((this->field_0x3a & 2) == 0) { - SetGlobalFlag(this->entityType.parameter); + SetGlobalFlag(this->type2); } - if ((this->entityType).form != 0) { + if (this->type != 0) { uVar1 = 0x59; } else { uVar1 = 0x58; @@ -64,7 +64,7 @@ void sub_08037F84(Entity* this) { void sub_08037FA0(Entity* this) { - if (CheckGlobalFlag(this->entityType.parameter)) { + if (CheckGlobalFlag(this->type2)) { DeleteThisEntity(); } sub_0804A720(this); diff --git a/src/enemy/treeItem.c b/src/enemy/treeItem.c index 38fce4c3..bf541184 100644 --- a/src/enemy/treeItem.c +++ b/src/enemy/treeItem.c @@ -17,7 +17,7 @@ void TreeItem(Entity* this) { if (this->action == 0) { this->action++; - this->field_0x68.HALF.LO = sub_080028F4(gUnk_080D29E0[this->entityType.form]); + this->field_0x68.HALF.LO = sub_080028F4(gUnk_080D29E0[this->type]); if (this->field_0x68.HALF.LO > 8) { DeleteThisEntity(); } diff --git a/src/enemy/vaatiBall.c b/src/enemy/vaatiBall.c index 0b339c71..02bf4e39 100644 --- a/src/enemy/vaatiBall.c +++ b/src/enemy/vaatiBall.c @@ -50,7 +50,7 @@ void sub_0804468C(Entity* this) { this->spriteRendering.b3 = 2; this->spritePriority.b0 = 5; this->cutsceneBeh.HALF.LO = 0; - switch (this->entityType.form) { + switch (this->type) { case 0: this->action = 1; this->actionDelay = 1; @@ -183,7 +183,7 @@ void sub_08044868(Entity* this) { if (draw == 1 && this->cutsceneBeh.HALF.LO == 0) { vaati = sub_0804A98C(this, 0x18, 0); if (vaati) { - vaati->entityType.parameter = 1; + vaati->type2 = 1; vaati->parent = this; this->cutsceneBeh.HALF.LO = 1; this->damageType = 0; diff --git a/src/enemy/wallMaster.c b/src/enemy/wallMaster.c index 8f359f31..1ba24a96 100644 --- a/src/enemy/wallMaster.c +++ b/src/enemy/wallMaster.c @@ -58,7 +58,7 @@ void sub_0802A4E4(Entity* this) { this->action = 1; this->collisionLayer = 3; this->field_0x7c.BYTES.byte1 = Random(); - this->field_0x7a.HWORD = this->entityType.parameter * 0x3c; + this->field_0x7a.HWORD = this->type2 * 0x3c; this->field_0x7c.BYTES.byte0 = this->actionDelay; this->field_0x78.HWORD = this->actionDelay * 0x3c; UpdateSpriteForCollisionLayer(this); @@ -184,7 +184,7 @@ void sub_0802A78C(Entity* this) { } } } else { - this->field_0x7a.HWORD = this->entityType.parameter * 0x3c + 1; + this->field_0x7a.HWORD = this->type2 * 0x3c + 1; } } } diff --git a/src/enemy/wisp.c b/src/enemy/wisp.c index c423b00a..10463258 100644 --- a/src/enemy/wisp.c +++ b/src/enemy/wisp.c @@ -36,9 +36,9 @@ void sub_08033564(Entity* this) { this->flags &= 0x7f; this->field_0x7c.HALF.LO = 0x27c; gPlayerState.flags.all |= 0x4000; - gSave.stats.effect = this->entityType.form + 1; + gSave.stats.effect = this->type + 1; gSave.stats.effectTimer = 600; - if (this->entityType.form == 0) { + if (this->type == 0) { break; } DeleteThisEntity(); @@ -90,7 +90,7 @@ void sub_08033674(Entity* this) { this->field_0x80.HWORD = this->x.HALF.HI; this->field_0x82.HWORD = this->y.HALF.HI; sub_08033744(this); - InitializeAnimation(this, this->entityType.parameter); + InitializeAnimation(this, this->type2); } void sub_080336A8(Entity* this) { diff --git a/src/entity.c b/src/entity.c index 6a980bbb..cb81ae21 100644 --- a/src/entity.c +++ b/src/entity.c @@ -61,7 +61,7 @@ typedef void (*Deleter)(void*); void DeleteEntityAny(Entity* ent) { Deleter deleter = NULL; - if (ent->entityType.type == 9) { + if (ent->kind == 9) { deleter = (Deleter)DeleteManager; } else { deleter = (Deleter)DeleteEntity; @@ -97,7 +97,7 @@ void DeleteEntity(Entity* ent) { UnloadHitbox(ent); sub_0801DA0C(ent->myHeap); ent->myHeap = NULL; - if ((ent->entityType).type == 3) { + if (ent->kind == 3) { sub_0804AA1C(ent); } ent->flags = ent->flags & 0x7f; @@ -132,8 +132,6 @@ void ClearDeletedEntity(Entity* ent) { gEntCount--; } -extern EntityType gHitboxCount; - void DeleteAllEntities(void) { Entity* ent; Entity* next; @@ -248,7 +246,7 @@ void AppendEntityToList(Entity* ent, int listIndex) { ent->prev = list->last; list->last->next = ent; list->last = ent; - if (ent->entityType.type != 9) { + if (ent->kind != 9) { ent->spritePriority.b0 = 4; gEntCount++; } else { @@ -283,8 +281,7 @@ bool32 DoesSimilarEntityExist(Entity* ent) { list = &gEntityLists[0]; do { for (i = list->first; (u32)i != (u32)list; i = i->next) { - if ((u32)i != (u32)ent && i->entityType.type == ent->entityType.type && - i->entityType.subtype == ent->entityType.subtype) { + if ((u32)i != (u32)ent && i->kind == ent->kind && i->id == ent->id) { return TRUE; } } @@ -299,7 +296,7 @@ Entity* FindEntityInListBySubtype(int type, int subtype, int listIndex) { list = &gEntityLists[listIndex]; for (it = list->first; (u32)it != (u32)list; it = it->next) { - if (type == it->entityType.type && subtype == it->entityType.subtype) + if (type == it->kind && subtype == it->id) return it; } return NULL; @@ -311,8 +308,7 @@ Entity* FindEntityInListByForm(int type, int subtype, int listIndex, int form, i list = &gEntityLists[listIndex]; for (i = list->first; (u32)i != (u32)list; i = i->next) { - if (type == i->entityType.type && subtype == i->entityType.subtype && form == i->entityType.form && - parameter == i->entityType.parameter) + if (type == i->kind && subtype == i->id && form == i->type && parameter == i->type2) return i; } return NULL; @@ -324,7 +320,7 @@ Entity* FindNextEntityOfSameSubtype(Entity* ent, int listIndex) { list = &gEntityLists[listIndex]; for (i = ent->next; (u32)i != (u32)list; i = i->next) { - if (i->entityType.type == ent->entityType.type && i->entityType.subtype == ent->entityType.subtype) + if (i->kind == ent->kind && i->id == ent->id) return i; } return NULL; @@ -337,7 +333,7 @@ Entity* FindEntityBySubtype(int type, int subtype) { list = &gEntityLists[0]; do { for (i = (Entity*)list->first; (u32)i != (u32)list; i = i->next) { - if ((type == (i->entityType).type) && (subtype == (i->entityType).subtype)) + if (type == i->kind && (subtype == i->id)) return i; } } while (++list < &gEntityLists[9]); @@ -354,7 +350,7 @@ void DeleteAllEnemies(void) { do { for (ent = list->first; (u32)ent != (u32)list; ent = next) { next = ent->next; - if (ent->entityType.type == 3) + if (ent->kind == 3) DeleteEntity(ent); } } while (++list < &gEntityLists[9]); diff --git a/src/ezloCap.c b/src/ezloCap.c index 36b7d3cf..fce6880f 100644 --- a/src/ezloCap.c +++ b/src/ezloCap.c @@ -94,7 +94,7 @@ void sub_0806DA1C(Entity* this, u32* param_2) { u8 sub_0806DA3C(Entity* this) { u32 result; - switch (this->entityType.form) { + switch (this->type) { default: result = 0; break; @@ -141,7 +141,7 @@ void sub_0806DAD0(Entity* this) { } void sub_0806DAE8(Entity* this) { - switch (this->entityType.form - 1) { + switch (this->type - 1) { case 0: SetLocalFlag(0xee); break; @@ -253,7 +253,7 @@ void sub_0806DCC0() { void NPC4E_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - switch (this->entityType.form) { + switch (this->type) { case 1: case 2: case 3: diff --git a/src/game.c b/src/game.c index 3afb4f11..b56f4836 100644 --- a/src/game.c +++ b/src/game.c @@ -274,7 +274,7 @@ void InitializePlayer(void) { case 0xc: gPlayerState.field_0x34[4] = 4; } - pl->entityType.type = 1; + pl->kind = 1; pl->flags |= 0xa0; pl->spritePriority.b0 = 4; pl->currentHealth = gSave.stats.health; diff --git a/src/item11.c b/src/item11.c index 2a1257e1..5821d0b5 100644 --- a/src/item11.c +++ b/src/item11.c @@ -55,15 +55,15 @@ void sub_08018CBC(Entity* this) { this->spriteIndex = 0xa6; this->palette.raw = 0x33; this->spriteVramOffset = 0; - (this->entityType).form = gPlayerState.field_0x1d[0] - 1; - this->actionDelay = gUnk_080B3DE0[(this->entityType).form * 2]; - this->field_0x44 = gUnk_080B3DE0[(this->entityType).form * 2 + 1]; + this->type = gPlayerState.field_0x1d[0] - 1; + this->actionDelay = gUnk_080B3DE0[this->type * 2]; + this->field_0x44 = gUnk_080B3DE0[this->type * 2 + 1]; this->field_0x40 = 0x1b; - this->hitbox = gUnk_080B3DE8[(this->entityType).form]; + this->hitbox = gUnk_080B3DE8[this->type]; (u32*)gPlayerEntity.field_0x70.WORD = this; sub_08078CD0(&gPlayerEntity); (u32*)gPlayerEntity.field_0x70.WORD = pEVar3; - InitializeAnimation(this, (this->entityType).form + 10); + InitializeAnimation(this, this->type + 10); sub_08018FA0(this); } sub_0801766C(this); diff --git a/src/item14.c b/src/item14.c index d27a6345..7ca56f53 100644 --- a/src/item14.c +++ b/src/item14.c @@ -22,7 +22,7 @@ void sub_0805FBE8(Entity* this) { this->nonPlanarMovement = 0x380; this->animationState = this->animationState & 0x7f; if (this->collisionLayer == 2) { - this->entityType.parameter = 1; + this->type2 = 1; } this->direction = this->animationState << 2; *(u32*)&this->field_0x6c = 0x3c; @@ -40,7 +40,7 @@ void sub_0805FC74(Entity* this) { GetNextFrame(this); sub_0806F69C(this); ++this->actionDelay; - if (this->entityType.parameter == 0) { + if (this->type2 == 0) { sub_0800451C(this); } if (!sub_080002F0(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) && diff --git a/src/loadRoom.c b/src/loadRoom.c index f0106fc2..04b8e02c 100644 --- a/src/loadRoom.c +++ b/src/loadRoom.c @@ -37,7 +37,7 @@ void sub_0804B058(EntityData* dat) { if ((uVar2 < 0x20) && ((dat->type) == 3)) { if (sub_08049D1C(uVar2) != 0) { ent = LoadRoomEntity(dat); - if ((ent != NULL) && ((ent->entityType).type == 3)) { + if ((ent != NULL) && (ent->kind == 3)) { ent->field_0x6c.HALF.LO = uVar2 | 0x80; } } diff --git a/src/manager/manager15.c b/src/manager/manager15.c index b8bf806a..bde4f0df 100644 --- a/src/manager/manager15.c +++ b/src/manager/manager15.c @@ -87,7 +87,7 @@ void sub_0805A370(Manager15* this) { void sub_0805A394(Manager15* this) { Entity* ent; if ((ent = FindEntityInListBySubtype(0x3, 0x13, 0x4))) { - if (ent->entityType.form != 4) { + if (ent->type != 4) { return; } } diff --git a/src/manager/manager27.c b/src/manager/manager27.c index 3463e825..b2e0e15a 100644 --- a/src/manager/manager27.c +++ b/src/manager/manager27.c @@ -18,10 +18,10 @@ const u8 gUnk_08108D20[] = { 0x6F, 0x70, 0x71, 0x72, 0x71, 0x70 }; void Manager27(Entity* this) { gUnk_08108D10[this->action](this); - if (CheckLocalFlagByOffset(0x300, this->entityType.form + 0x67)) { - gScreenTransition.field_0xac |= (1 << (this->entityType).form); + if (CheckLocalFlagByOffset(0x300, this->type + 0x67)) { + gScreenTransition.field_0xac |= (1 << this->type); } else { - gScreenTransition.field_0xac &= ~(1 << (this->entityType).form); + gScreenTransition.field_0xac &= ~(1 << this->type); } } @@ -75,5 +75,5 @@ void sub_0805C908(Entity* this) { } u32 sub_0805C920(Entity* this) { - return CheckLocalFlagByOffset(0x300, (this->entityType).form + 0x67); + return CheckLocalFlagByOffset(0x300, this->type + 0x67); } diff --git a/src/manager/manager28.c b/src/manager/manager28.c index 9f518f1c..af59e09e 100644 --- a/src/manager/manager28.c +++ b/src/manager/manager28.c @@ -115,8 +115,7 @@ Entity* Manager28_FindMatchingEntity(EntityData* unk1) { y = unk1->yPos + gRoomControls.roomOriginY; tmp = &gUnk_03003D90; for (i = tmp->first; (u32)i != (u32)tmp; i = i->next) { - if (x == i->x.HALF.HI && y == i->y.HALF.HI && unk1->subtype == i->entityType.subtype && - 3 == i->entityType.type && unk1->form == i->entityType.form) { + if (x == i->x.HALF.HI && y == i->y.HALF.HI && unk1->subtype == i->id && 3 == i->kind && unk1->form == i->type) { return i; } } diff --git a/src/manager/manager2E.c b/src/manager/manager2E.c index cc07c980..6dd5ea3e 100644 --- a/src/manager/manager2E.c +++ b/src/manager/manager2E.c @@ -5,7 +5,7 @@ extern void (*const gUnk_08108D3C[])(Entity*); extern void (*const gUnk_08108D44[])(Entity*); void sub_0805D250(Entity* this) { - gUnk_08108D3C[this->entityType.form](this); + gUnk_08108D3C[this->type](this); } void sub_0805D268(Entity* this) { diff --git a/src/manager/managerB.c b/src/manager/managerB.c index 5201322b..e6e43a12 100644 --- a/src/manager/managerB.c +++ b/src/manager/managerB.c @@ -101,7 +101,7 @@ void ManagerB_LoadFight(Manager* this) { if (prop) { while (*((u8*)prop) != 0xFF) { ent = LoadRoomEntity(prop++); - if (ent && (ent->entityType.type == 3)) { + if (ent && (ent->kind == 3)) { ent->field_0x6c.HALF.HI |= 0x40; ManagerBHelper_Monitor(monitor, ent, counter++); } diff --git a/src/npc/beedle.c b/src/npc/beedle.c index 654ff301..9e7a5755 100644 --- a/src/npc/beedle.c +++ b/src/npc/beedle.c @@ -99,14 +99,14 @@ void sub_08063410(Entity* this) { return; } this->action++; - if (this->entityType.form != 0) { + if (this->type != 0) { this->hitbox = &gUnk_0810C894; - this->entityType.parameter = 0; + this->type2 = 0; } sub_0807DD64(this); sub_08078778(this); } - if (this->entityType.form != 0) { + if (this->type != 0) { sub_0806346C(this); } sub_0807DDAC(this, NULL); @@ -141,24 +141,24 @@ void sub_0806346C(Entity* this) { iVar2 >>= 4; bVar1 = gUnk_0810C8F0[(gPlayerEntity.animationState >> 1) + iVar3 * 4 + iVar2 * 0x18]; - if (bVar1 != this->entityType.parameter) { + if (bVar1 != this->type2) { gUnk_0810C89C_struct* temp = &gUnk_0810C89C[bVar1]; sub_08078850(this, 1, temp->unk_04, temp); - this->entityType.parameter = bVar1; + this->type2 = bVar1; } } void sub_080634E4(Entity* this, u32* param_1) { - param_1[1] = this->entityType.parameter; + param_1[1] = this->type2; } void sub_080634EC(Entity* this) { - gRoomVars.itemForSaleIndex = gUnk_0810C88C[this->entityType.parameter]; + gRoomVars.itemForSaleIndex = gUnk_0810C88C[this->type2]; } void sub_08063504(Entity* this, u32* param_2) { u32 uVar1; - uVar1 = sub_080544DC(gUnk_0810C88C[this->entityType.parameter]); + uVar1 = sub_080544DC(gUnk_0810C88C[this->type2]); param_2[5] = BOOLCAST(uVar1); } diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index ed49aa45..2874115f 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -16,7 +16,7 @@ extern void sub_0806D02C(Entity*); extern Entity* FindEntityInListByForm(u32, u32, u32, u32, u32); void BigGoron(Entity* this) { - gUnk_081140D4[this->entityType.form](this); + gUnk_081140D4[this->type](this); } void sub_0806CF30(Entity* this) { diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c index ad9c84bf..913f30cc 100644 --- a/src/npc/bladeBrothers.c +++ b/src/npc/bladeBrothers.c @@ -48,7 +48,7 @@ void sub_08068A1C(Entity* this) { u8 bVar1; int offset; - (this->entityType).parameter = (this->entityType).form; + this->type2 = this->type; if (gScreenTransition.field_0x24[8] != 0) { offset = 6; bVar1 = 3; @@ -92,13 +92,13 @@ void sub_08068AA4(Entity* this) { u8 bVar1; this->action = 1; - if (this->entityType.form != 0) { - this->entityType.parameter++; - this->entityType.parameter &= 7; - if (this->entityType.parameter == 0) { - this->entityType.parameter += 1; + if (this->type != 0) { + this->type2++; + this->type2 &= 7; + if (this->type2 == 0) { + this->type2 += 1; } - sub_0801D2B4(this, gUnk_081115DC[this->entityType.parameter]); + sub_0801D2B4(this, gUnk_081115DC[this->type2]); } } @@ -175,8 +175,8 @@ void sub_08068C28(Entity* this) { u8 bVar1; u32 uVar2; - this->actionDelay = gUnk_08111623[(this->entityType).form]; - if ((this->entityType).form == 1) { + this->actionDelay = gUnk_08111623[this->type]; + if (this->type == 1) { if (GetInventoryValue(0x48)) { // spin attack if (!GetInventoryValue(0x4b)) { // rock breaker this->actionDelay = 1; @@ -205,7 +205,7 @@ void sub_08068CA0(Entity* param_1, Entity* param_2) { u8 bVar1; u32 uVar2; - bVar1 = (param_1->entityType).form; + bVar1 = param_1->type; if (bVar1 == 1) { *(u32*)¶m_2->animationState = bVar1; uVar2 = GetInventoryValue(0x48); // spin attack diff --git a/src/npc/carpenter.c b/src/npc/carpenter.c index db160475..f4bdb04a 100644 --- a/src/npc/carpenter.c +++ b/src/npc/carpenter.c @@ -23,7 +23,7 @@ void Carpenter(Entity* this) { } switch (this->action) { case 0: - if (!LoadExtraSpriteData(this, gUnk_08110CA8 + this->entityType.form * 4)) + if (!LoadExtraSpriteData(this, gUnk_08110CA8 + this->type * 4)) break; this->action = 1; this->field_0x68.HALF.HI = 0; @@ -35,8 +35,8 @@ void Carpenter(Entity* this) { this->action = 2; this->interactType = 0; this->field_0x68.HALF.HI = this->animIndex; - InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4 + - (this->entityType.form * 8)); + InitializeAnimation(this, + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4 + (this->type * 8)); sub_0806F118(this); } else { sub_0807DDAC(this, 0); @@ -54,7 +54,7 @@ void Carpenter(Entity* this) { } void Carpenter_Head(Entity* this) { - if ((this->entityType).form < 2) { + if (this->type < 2) { SetExtraSpriteFrame(this, 0, this->frames.all & 0xffffff7f); SetExtraSpriteFrame(this, 1, this->frameIndex); SetExtraSpriteFrame(this, 2, this->frameSpriteSettings & 0x3f); @@ -70,5 +70,5 @@ void Carpenter_Head(Entity* this) { } void sub_080672b0(Entity* this, u32 param_2) { - InitializeAnimation(this, *(u32*)(param_2 + 4) + (this->animationState >> 1) + this->entityType.form * 8); + InitializeAnimation(this, *(u32*)(param_2 + 4) + (this->animationState >> 1) + this->type * 8); } diff --git a/src/npc/cat.c b/src/npc/cat.c index 1ec7df88..c00a41ef 100644 --- a/src/npc/cat.c +++ b/src/npc/cat.c @@ -10,7 +10,7 @@ extern void (*gCat[9])(Entity*); void Cat(Entity* ent) { gCat[ent->action](ent); sub_08067C44(ent); - if (((ent->flags & 128) == 0) && ((ent->entityType).form != 5)) { + if (((ent->flags & 128) == 0) && (ent->type != 5)) { sub_0806ED78(ent); } } diff --git a/src/npc/cow.c b/src/npc/cow.c index db7707fd..aeb62982 100644 --- a/src/npc/cow.c +++ b/src/npc/cow.c @@ -28,7 +28,7 @@ void sub_08068FC0(Entity* ent) { u32 r2; ent->action = 1; - ent->animationState = ent->entityType.parameter; + ent->animationState = ent->type2; ent->nonPlanarMovement = 0x40; ent->field_0x6c.HALF.HI = 0xFF; @@ -181,7 +181,7 @@ void sub_080691E0(Entity* ent) { // Show dialogue void Cow_ShowDialogue(Entity* ent) { - ShowNPCDialogue(ent, &gUnk_08111938[ent->entityType.form]); + ShowNPCDialogue(ent, &gUnk_08111938[ent->type]); } void sub_0806920C(Entity* ent) { diff --git a/src/npc/epona.c b/src/npc/epona.c index a685150f..a79ccd48 100644 --- a/src/npc/epona.c +++ b/src/npc/epona.c @@ -50,7 +50,7 @@ void sub_08065A34(Entity* this) { } void sub_08065A50(Entity* this) { - ShowNPCDialogue(this, &gUnk_08110080[this->entityType.form]); + ShowNPCDialogue(this, &gUnk_08110080[this->type]); } void sub_08065A64(Entity* this) { diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c index 66933ef3..ce829a81 100644 --- a/src/npc/forestMinish.c +++ b/src/npc/forestMinish.c @@ -41,7 +41,7 @@ void ForestMinish(Entity* this) { this->field_0x68.HALF.HI = this->animationState = this->actionDelay << 1; this->actionDelay = 0; sub_0805E3A0(this, 2); - StartCutscene(this, (u16*)gUnk_08109D18[this->entityType.parameter]); + StartCutscene(this, (u16*)gUnk_08109D18[this->type2]); sub_0807DD50(this); } break; @@ -161,7 +161,7 @@ void sub_080601D4(Entity* this) { } void sub_08060208(Entity* this) { - ShowNPCDialogue(this, &gUnk_08109DC8[this->entityType.parameter * 0x4]); + ShowNPCDialogue(this, &gUnk_08109DC8[this->type2 * 0x4]); } void sub_0806021C(Entity* this) { @@ -181,11 +181,11 @@ void sub_0806021C(Entity* this) { if (GetInventoryValue(0x13)) { uVar2 = 3; } - ShowNPCDialogue(this, gUnk_08109DC8 + this->entityType.parameter * 0x4 + uVar2); + ShowNPCDialogue(this, gUnk_08109DC8 + this->type2 * 0x4 + uVar2); } void sub_0806025C(Entity* this) { - ShowNPCDialogue(this, &gUnk_08109DC8[this->entityType.parameter * 0x4]); + ShowNPCDialogue(this, &gUnk_08109DC8[this->type2 * 0x4]); } void sub_08060270(Entity* this) { diff --git a/src/npc/goron.c b/src/npc/goron.c index a7d4ee54..0203969c 100644 --- a/src/npc/goron.c +++ b/src/npc/goron.c @@ -112,7 +112,7 @@ void sub_080694B0(Entity* this) { } void sub_080694D8(Entity* this) { - ShowNPCDialogue(this, &gUnk_08111A94[this->entityType.form]); + ShowNPCDialogue(this, &gUnk_08111A94[this->type]); } void sub_080694EC(Entity* this) { diff --git a/src/npc/guard.c b/src/npc/guard.c index e225c33b..782253ee 100644 --- a/src/npc/guard.c +++ b/src/npc/guard.c @@ -66,15 +66,15 @@ void sub_08063D44(Entity* this) { if (gEntCount > 0x46) return; - temp = this->entityType.subtype; + temp = this->id; temp ^= 0x15; idx = BOOLCAST(temp) * 4; if (!LoadExtraSpriteData(this, &gUnk_0810F524[idx])) return; InitializeAnimation(this, 4); - sub_0806EE04(this, gUnk_0810F6BC[this->entityType.form], 0); - switch (this->entityType.form) { + sub_0806EE04(this, gUnk_0810F6BC[this->type], 0); + switch (this->type) { case 0 ... 3: ent = sub_080A7EE0(0xc); ent->parent = this; @@ -85,12 +85,12 @@ void sub_08063D44(Entity* this) { break; } this->action++; - this->entityType.form = 0; + this->type = 0; sub_08063DC8(this); } void sub_08063DC8(Entity* this) { - if ((this->entityType).form == 0xff) { + if (this->type == 0xff) { this->action = 2; this->actionDelay = 0x1e; this->animationState = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)); @@ -130,7 +130,7 @@ void sub_08063E90(Entity* this) { u32 temp, idx; u32 unk; - temp = this->entityType.subtype; + temp = this->id; temp ^= 0x15; idx = BOOLCAST(temp) * 4; if (!LoadExtraSpriteData(this, &gUnk_0810F524[idx])) @@ -188,7 +188,7 @@ void Guard_Head(Entity* this) { uVar2 = this->frames.all & 0x3f; pbVar5 = (this->frameIndex & 0x3f); uVar4 = this->frameSpriteSettings & 0x3f; - if ((this->entityType).subtype == 0x15) { + if (this->id == 0x15) { if ((this->frameIndex & 0x40) != 0) { pbVar5 = pbVar5 + 0x21; pbVar3 = 0xffffffff; @@ -227,7 +227,7 @@ void sub_08064050(Entity* arg0, struct_08064050* arg1) { u32 unk; arg1->unk2 = 0; - switch (arg0->entityType.parameter) { + switch (arg0->type2) { case 0x11: arg1->unk2 = 1; break; diff --git a/src/npc/melari.c b/src/npc/melari.c index ca01de04..38bc4e54 100644 --- a/src/npc/melari.c +++ b/src/npc/melari.c @@ -72,7 +72,7 @@ void sub_08068780(Entity* this) { } this->action = 1; this->spriteSettings.b.draw = TRUE; - this->animationState = this->entityType.form; + this->animationState = this->type; sub_0805E3A0(this, 2); sub_0807DD50(this); break; diff --git a/src/npc/percy.c b/src/npc/percy.c index 484ee13b..a2a8fcd8 100644 --- a/src/npc/percy.c +++ b/src/npc/percy.c @@ -60,7 +60,7 @@ void sub_0806B41C(Entity* this) { if (LoadExtraSpriteData(this, &gUnk_08112E1C)) { this->action = 1; this->spriteSettings.b.draw = 1; - if (this->entityType.parameter == 2) { + if (this->type2 == 2) { CreateFx(this, 0x25, 0); } sub_0807DD50(this); @@ -90,7 +90,7 @@ void sub_0806B41C(Entity* this) { } void sub_0806B4F0(Entity* this) { - ShowNPCDialogue(this, &gUnk_08112E2C[this->entityType.parameter]); + ShowNPCDialogue(this, &gUnk_08112E2C[this->type2]); } void sub_0806B504(Entity* this) { diff --git a/src/npc/postman.c b/src/npc/postman.c index 266c3fb6..532f129f 100644 --- a/src/npc/postman.c +++ b/src/npc/postman.c @@ -53,8 +53,8 @@ void sub_08060428(Entity* this) { this->actionDelay = 0x5a; this->nonPlanarMovement = 0x180; - if (this->entityType.parameter != 0) { - data = GetCurrentRoomProperty(this->entityType.parameter); + if (this->type2 != 0) { + data = GetCurrentRoomProperty(this->type2); } else { data = NULL; } diff --git a/src/npc/rem.c b/src/npc/rem.c index 6c45830f..a0b87267 100644 --- a/src/npc/rem.c +++ b/src/npc/rem.c @@ -13,7 +13,7 @@ extern void (*gUnk_08112278[])(Entity*); extern void gUnk_08012F0C; void Rem(Entity* this) { - gUnk_08112260[this->entityType.form](this); + gUnk_08112260[this->type](this); } void sub_0806a370(Entity* this) { diff --git a/src/npc/syrup.c b/src/npc/syrup.c index 7904ce09..307c75bd 100644 --- a/src/npc/syrup.c +++ b/src/npc/syrup.c @@ -24,7 +24,7 @@ void sub_0806A1F8(Entity* this) { u32 iVar1; SpriteLoadData* paVar2; - (this->entityType).form == 0 ? (paVar2 = &gUnk_081121B4) : (paVar2 = &gUnk_081121C4); + this->type == 0 ? (paVar2 = &gUnk_081121B4) : (paVar2 = &gUnk_081121C4); iVar1 = LoadExtraSpriteData(this, paVar2); if (iVar1) { diff --git a/src/npc/teachers.c b/src/npc/teachers.c index 9a9f0509..eaae979d 100644 --- a/src/npc/teachers.c +++ b/src/npc/teachers.c @@ -19,7 +19,7 @@ extern Dialog gUnk_08113930[]; void Teachers(Entity* this) { switch (this->action) { case 0: - if (LoadExtraSpriteData(this, &gUnk_08113910[this->entityType.form * 4])) { + if (LoadExtraSpriteData(this, &gUnk_08113910[this->type * 4])) { this->action = 1; this->spriteSettings.b.draw = TRUE; this->animationState = this->actionDelay; @@ -61,7 +61,7 @@ void Teachers_Head(Entity* this) { uVar3 = this->frames.all & -0x81; bVar1 = this->frameIndex; bVar2 = this->frameSpriteSettings & 0x3f; - if ((this->entityType).form == 0) { + if (this->type == 0) { SetExtraSpriteFrame(this, 0, (uVar3 + 3)); SetExtraSpriteFrame(this, 1, bVar1); SetSpriteSubEntryOffsetData1(this, 1, 0); @@ -83,12 +83,12 @@ void sub_0806C70C(Entity* this) { if (offset < 0) offset = 0; - ShowNPCDialogue(this, gUnk_08113930 + this->entityType.form * 8 + offset); + ShowNPCDialogue(this, gUnk_08113930 + this->type * 8 + offset); } void Teachers_Fusion(Entity* this) { if (this->action == 0) { - if (LoadExtraSpriteData(this, &gUnk_08113910[this->entityType.form * 4])) { + if (LoadExtraSpriteData(this, &gUnk_08113910[this->type * 4])) { this->action++; this->spriteSettings.b.draw = TRUE; InitializeAnimation(this, 2); diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c index 9217fdd7..3f97b540 100644 --- a/src/npc/townMinish.c +++ b/src/npc/townMinish.c @@ -43,7 +43,7 @@ void TownMinish(Entity* this) { } void sub_0806ABFC(Entity* this) { - SpriteLoadData* SpriteLoadData = &gUnk_08112674[this->entityType.form * 4]; + SpriteLoadData* SpriteLoadData = &gUnk_08112674[this->type * 4]; if (!LoadExtraSpriteData(this, SpriteLoadData)) { return; } @@ -93,7 +93,7 @@ void sub_0806ACC4(Entity* this) { u8 delay; switch (this->action) { case 0: - if (LoadExtraSpriteData(this, &gUnk_08112674[this->entityType.form * 4]) == 0) + if (LoadExtraSpriteData(this, &gUnk_08112674[this->type * 4]) == 0) return; this->action = 1; @@ -114,13 +114,13 @@ void sub_0806ACC4(Entity* this) { } else { sub_0807DDAC(this, NULL); sub_0806AEA8(this); - if (this->entityType.parameter == 10 && this->interactType) { + if (this->type2 == 10 && this->interactType) { this->action = 2; this->interactType = 0; InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 8); sub_0806AFE8(this, *(s32**)&this->cutsceneBeh); } - if (this->entityType.form == 1) { + if (this->type == 1) { u8 idx = gPlayerEntity.animationState >> 1; sub_08078850(this, 1, gUnk_081126E4[idx], &gUnk_081126D4[idx]); } @@ -250,12 +250,12 @@ void sub_0806AFBC(Entity* this) { if (idx < 0) idx = 0; - ShowNPCDialogue(this, gUnk_081126F0 + this->entityType.parameter * 8 + idx); + ShowNPCDialogue(this, gUnk_081126F0 + this->type2 * 8 + idx); } void sub_0806AFE8(Entity* this, s32* unk) { unk[5] = 0; - gUnk_08112BF0[this->entityType.parameter](this, unk); + gUnk_08112BF0[this->type2](this, unk); } void sub_0806B004(Entity* this, int* unk) { @@ -304,7 +304,7 @@ void sub_0806B098(Entity* this) { idx = BOOLCAST(f); } } - TextboxNoOverlap(gUnk_08112C50[(this->entityType.parameter - 7) * 3 + idx], this); + TextboxNoOverlap(gUnk_08112C50[(this->type2 - 7) * 3 + idx], this); } void sub_0806B0E0(Entity* this) { @@ -339,7 +339,7 @@ void sub_0806B134(Entity* this) { void TownMinish_Fusion(Entity* this) { if (this->action == 0) { - if (LoadExtraSpriteData(this, &gUnk_08112674[this->entityType.form * 4])) { + if (LoadExtraSpriteData(this, &gUnk_08112674[this->type * 4])) { this->action++; this->spriteSettings.b.draw = 1; InitializeAnimation(this, 6); diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c index e7d815db..dbc50909 100644 --- a/src/npc/townsperson.c +++ b/src/npc/townsperson.c @@ -58,9 +58,9 @@ void Townsperson(Entity* this) { } void sub_08061BC8(Entity* this) { - if (LoadExtraSpriteData(this, gUnk_0810B6EC[this->entityType.form])) { + if (LoadExtraSpriteData(this, gUnk_0810B6EC[this->type])) { this->animationState = 2; - this->field_0xf = this->entityType.form + 1; + this->field_0xf = this->type + 1; this->action++; sub_08061CB4(this, 2); } @@ -84,15 +84,14 @@ void sub_08061C00(Entity* this) { sub_0806ED78(this); if (this->interactType != 0) { this->interactType = 0; - TextboxNoOverlapFollow(this->entityType.parameter + 0xa01); + TextboxNoOverlapFollow(this->type2 + 0xa01); } } #if NON_MATCHING void Townsperson_Head(Entity* this) { - SetExtraSpriteFrame(this, 0, - *(gUnk_0810B78C + (this->animIndex & 3)) + gUnk_0810B680[this->entityType.form].frame1); - SetExtraSpriteFrame(this, 1, this->frameIndex + gUnk_0810B680[this->entityType.form].frame2); + SetExtraSpriteFrame(this, 0, *(gUnk_0810B78C + (this->animIndex & 3)) + gUnk_0810B680[this->type].frame1); + SetExtraSpriteFrame(this, 1, this->frameIndex + gUnk_0810B680[this->type].frame2); SetSpriteSubEntryOffsetData1(this, 1, 0); sub_0807000C(this); } @@ -110,14 +109,14 @@ void sub_08061CB4(Entity* this, u32 arg1) { GetNextFrame(this); } if (this->frameDuration == 0xff) { - this->frameDuration = gUnk_0810B680[this->entityType.form].unk2; + this->frameDuration = gUnk_0810B680[this->type].unk2; } } void sub_08061CEC(Entity* this) { u32 uVar2; - if (LoadExtraSpriteData(this, gUnk_0810B6EC[this->entityType.form])) { + if (LoadExtraSpriteData(this, gUnk_0810B6EC[this->type])) { this->action = 1; this->spriteSettings.b.draw = TRUE; this->animationState = this->actionDelay; @@ -147,7 +146,7 @@ void sub_08061D64(Entity* this) { sub_0807DDAC(this, NULL); sub_0807DDE4(this); if (this->frameDuration == 0xff) { - this->frameDuration = gUnk_0810B680[this->entityType.form].unk2; + this->frameDuration = gUnk_0810B680[this->type].unk2; } GetNextFrame(this); if (this->interactType != 0) { @@ -177,7 +176,7 @@ void sub_08061E50(Entity* this) { } void sub_08061E70(Entity* this) { - if ((this->entityType).subtype == 6) { + if (this->id == 6) { sub_08078784(this, this->field_0x68.HALF.LO); } else { sub_08078778(this); @@ -215,7 +214,7 @@ void sub_08061E90(Entity* this, Entity* arg1) { } this->direction = (u8)animIndex; this->animationState = sub_0806F5B0(animIndex); - this->nonPlanarMovement = gUnk_0810B74A[this->entityType.form]; + this->nonPlanarMovement = gUnk_0810B74A[this->type]; } animIndex = (this->animationState >> 1) + 4; if (animIndex != this->animIndex) { @@ -274,7 +273,7 @@ void sub_08061FE4(Entity* this) { } void sub_08061FF4(Entity* this) { - TextboxNoOverlap(gUnk_0810B790[this->entityType.form], this); + TextboxNoOverlap(gUnk_0810B790[this->type], this); } void sub_0806200C(Entity* this) { @@ -296,12 +295,12 @@ void sub_0806200C(Entity* this) { void sub_08062048(Entity* this) { int iVar1; - if ((this->entityType).subtype == 6) { + if (this->id == 6) { iVar1 = gSave.unk8 - 2; if (iVar1 < 0) { iVar1 = 0; } - ShowNPCDialogue(this, gUnk_0810B7C0 + this->entityType.form * 0x8 + iVar1); + ShowNPCDialogue(this, gUnk_0810B7C0 + this->type * 0x8 + iVar1); } else { TextboxNoOverlap(0, this); } @@ -309,7 +308,7 @@ void sub_08062048(Entity* this) { void Townsperson_Fusion(Entity* this) { if (this->action == 0) { - if (LoadExtraSpriteData(this, gUnk_0810B6EC[this->entityType.form]) == 0) { + if (LoadExtraSpriteData(this, gUnk_0810B6EC[this->type]) == 0) { return; } this->action++; diff --git a/src/npc/windTribespeople.c b/src/npc/windTribespeople.c index 05dca467..9429ccd6 100644 --- a/src/npc/windTribespeople.c +++ b/src/npc/windTribespeople.c @@ -35,7 +35,7 @@ void WindTribespeople(Entity* this) { void sub_0806C798(Entity* this) { s32 iVar1; - iVar1 = LoadExtraSpriteData(this, gUnk_08113A1C + (this->entityType.form * 4)); + iVar1 = LoadExtraSpriteData(this, gUnk_08113A1C + (this->type * 4)); if (iVar1 != 0) { this->action = 1; this->spriteSettings.b.draw = 1; @@ -55,9 +55,8 @@ void sub_0806C7D4(Entity* this) { sub_0806F118(this); } else { sub_0807DD94(this, NULL); - if ((this->entityType.parameter == 3) && (!CheckGlobalFlag(WARP_EVENT_END)) && (CheckLocalFlag(0x63)) && - (CheckRoomFlag(0))) { - (this->entityType).parameter = 7; + if ((this->type2 == 3) && (!CheckGlobalFlag(WARP_EVENT_END)) && (CheckLocalFlag(0x63)) && (CheckRoomFlag(0))) { + this->type2 = 7; sub_0807DD80(this, &gUnk_08014A80); } } @@ -90,7 +89,7 @@ void WindTribespeople_Head(Entity* this) { u8 pbVar3; pbVar3 = (this->frames.all & 0x3F); - if (this->entityType.form == 4) { + if (this->type == 4) { SetExtraSpriteFrame(this, 0, 9); SetExtraSpriteFrame(this, 1, pbVar3); SetExtraSpriteFrame(this, 2, this->frameIndex); @@ -115,7 +114,7 @@ void WindTribespeople_Head(Entity* this) { // body and head entities? void sub_0806C90C(Entity* param_1, Entity* param_2) { *(u32*)¶m_2->animationState = 0; - gUnk_08113A8C[param_1->entityType.parameter](param_1, param_2); + gUnk_08113A8C[param_1->type2](param_1, param_2); } void sub_0806C928(Entity* this) { diff --git a/src/object.c b/src/object.c index e27e6cf2..b5eff460 100644 --- a/src/object.c +++ b/src/object.c @@ -3,198 +3,198 @@ #include "object.h" void (*const gObjectFunctions[])(Entity*) = { - /*0x00*/ ItemOnGround, - /*0x01*/ DeathFx, - /*0x02*/ ItemForSale, - /*0x03*/ Button, - /*0x04*/ Object4, - /*0x05*/ Pot, - /*0x06*/ Object6, - /*0x07*/ BlockPushed, - /*0x08*/ LockedDoor, - /*0x09*/ Object9, - /*0x0a*/ ObjectA, - /*0x0b*/ ObjectB, - /*0x0c*/ ChestSpawner, - /*0x0d*/ ObjectD, - /*0x0e*/ ObjectE, - /*0x0f*/ SpecialFx, - /*0x10*/ Object10, - /*0x11*/ Object11, - /*0x12*/ Object12, - /*0x13*/ Railtrack, - /*0x14*/ LilypadLarge, - /*0x15*/ Object15, - /*0x16*/ FloatingPlatform, - /*0x17*/ Object17, - /*0x18*/ EvilSpirit, - /*0x19*/ HouseDoorExterior, - /*0x1a*/ Object1A, - /*0x1b*/ GreatFairy, - /*0x1c*/ Object1C, - /*0x1d*/ Object1D, - /*0x1e*/ Object1E, - /*0x1f*/ Object1F, - /*0x20*/ Object20, - /*0x21*/ Object21, - /*0x22*/ FigurineDevice, - /*0x23*/ EyeSwitch, - /*0x24*/ Object24, - /*0x25*/ BigBarrel, - /*0x26*/ Object26, - /*0x27*/ PushableStatue, - /*0x28*/ Object28, - /*0x29*/ Object29, - /*0x2a*/ Object2A, - /*0x2b*/ Object2B, - /*0x2c*/ Beanstalk, - /*0x2d*/ Smoke, - /*0x2e*/ PushableRock, - /*0x2f*/ HittableLever, - /*0x30*/ Object30, - /*0x31*/ Object31, - /*0x32*/ PullableMushroom, - /*0x33*/ Bollard, - /*0x34*/ WarpPoint, - /*0x35*/ Object35, - /*0x36*/ Object36, - /*0x37*/ Object37, - /*0x38*/ JarPortal, - /*0x39*/ BossDoor, - /*0x3a*/ Object3A, - /*0x3b*/ MacroMushromStalks, - /*0x3c*/ MacroPlayer, - /*0x3d*/ Object3D, - /*0x3e*/ Object3E, - /*0x3f*/ GiantLeaf, - /*0x40*/ Fairy, - /*0x41*/ LadderUp, - /*0x42*/ Object42, - /*0x43*/ Object43, - /*0x44*/ Object44, - /*0x45*/ Object45, - /*0x46*/ GiantBookLadder, - /*0x47*/ HeartContainer, - /*0x48*/ FileScreenObjects, - /*0x49*/ Object49, - /*0x4a*/ BackgroundCloud, - /*0x4b*/ Object4B, - /*0x4c*/ PushableFurniture, - /*0x4d*/ Furniture, - /*0x4e*/ MinishSizedEntrance, - /*0x4f*/ Archway, - /*0x50*/ GiantRock, - /*0x51*/ Object51, - /*0x52*/ Object52, - /*0x53*/ Object53, - /*0x54*/ PullableLever, - /*0x55*/ Minecart, - /*0x56*/ ThoughtBubble, - /*0x57*/ HiddenLadderDown, - /*0x58*/ GentariCurtain, - /*0x59*/ LavaPlatform, - /*0x5a*/ Object5A, - /*0x5b*/ Object5B, - /*0x5c*/ Mask, - /*0x5d*/ HouseDoorInterior, - /*0x5e*/ Whirlwind, - /*0x5f*/ ObjectBlockingStairs, - /*0x60*/ SwordsmanNewsletter, - /*0x61*/ Object61, - /*0x62*/ GiantTwig, - /*0x63*/ Object63, - /*0x64*/ Object64, - /*0x65*/ LadderHoleInBookshelf, - /*0x66*/ Object66, - /*0x67*/ Object67, - /*0x68*/ Object68, - /*0x69*/ Object69, - /*0x6a*/ Object6A, - /*0x6b*/ CrenalBeanSprout, - /*0x6c*/ MinecartDoor, - /*0x6d*/ ObjectOnPillar, - /*0x6e*/ MineralWaterSource, - /*0x6f*/ MinishSizedArchway, - /*0x70*/ Object70, - /*0x71*/ PushableGrave, - /*0x72*/ Object72, - /*0x73*/ LilypadSmall, - /*0x74*/ Object74, - /*0x75*/ Object75, - /*0x76*/ Object76, - /*0x77*/ Bell, - /*0x78*/ MacroDecoration, - /*0x79*/ Object79, - /*0x7a*/ Steam, - /*0x7b*/ PushableLever, - /*0x7c*/ MacroShoes, - /*0x7d*/ ObjectOnSpinyBeetle, - /*0x7e*/ Object7E, - /*0x7f*/ PicoBloom, - /*0x80*/ Object80, - /*0x81*/ Object81, - /*0x82*/ BigVortex, - /*0x83*/ BigPushableLever, - /*0x84*/ SmallIceBlock, - /*0x85*/ BigIceBlock, - /*0x86*/ Object86, - /*0x87*/ Object87, - /*0x88*/ MacroBook, - /*0x89*/ Object89, - /*0x8a*/ Object8A, - /*0x8b*/ Object8B, - /*0x8c*/ Book, - /*0x8d*/ Fireplace, - /*0x8e*/ Object8E, - /*0x8f*/ FrozenWaterElement, - /*0x90*/ Object90, - /*0x91*/ Object91, - /*0x92*/ BakerOven, - /*0x93*/ Object93, - /*0x94*/ WindTribeFlag, - /*0x95*/ Bird, - /*0x96*/ Object96, - /*0x97*/ Object97, - /*0x98*/ Object98, - /*0x99*/ Object99, - /*0x9a*/ MacroAcorn, - /*0x9b*/ Object9B, - /*0x9c*/ TreeHidingPortal, - /*0x9d*/ LightableSwitch, - /*0x9e*/ Object9E, - /*0x9f*/ Fan, - /*0xa0*/ ObjectA0, - /*0xa1*/ PalaceArchway, - /*0xa2*/ ObjectA2, - /*0xa3*/ Cloud, - /*0xa4*/ MinishLight, - /*0xa5*/ ObjectA5, - /*0xa6*/ ObjectA6, - /*0xa7*/ ObjectA7, - /*0xa8*/ ObjectA8, - /*0xa9*/ ObjectA9, - /*0xaa*/ WaterfallOpening, - /*0xab*/ ObjectAB, - /*0xac*/ FourElements, - /*0xad*/ ObjectAD, - /*0xae*/ FloatingBlock, - /*0xaf*/ ObjectAF, - /*0xb0*/ MetalDoor, - /*0xb1*/ JailBars, - /*0xb2*/ ObjectB2, - /*0xb3*/ ObjectB3, - /*0xb4*/ ObjectB4, - /*0xb5*/ ObjectB5, - /*0xb6*/ ObjectB6, - /*0xb7*/ Well, - /*0xb8*/ WindTribeTeleporter, - /*0xb9*/ ObjectB9, - /*0xba*/ ObjectBA, - /*0xbb*/ Windcrest, - /*0xbc*/ LitArea, - /*0xbd*/ ObjectBD, - /*0xbe*/ Pinwheel, - /*0xbf*/ ObjectBF, - /*0xc0*/ EnemyItem, - /*0xc1*/ ObjectC1 + [GROUND_ITEM] = ItemOnGround, + [DEATH_FX] = DeathFx, + [SHOP_ITEM] = ItemForSale, + [BUTTON] = Button, + [OBJECT_4] = Object4, + [POT] = Pot, + [OBJECT_6] = Object6, + [PUSHED_BLOCK] = BlockPushed, + [LOCKED_DOOR] = LockedDoor, + [OBJECT_9] = Object9, + [OBJECT_A] = ObjectA, + [OBJECT_B] = ObjectB, + [CHEST_SPAWNER] = ChestSpawner, + [OBJECT_D] = ObjectD, + [OBJECT_E] = ObjectE, + [SPECIAL_FX] = SpecialFx, + [OBJECT_10] = Object10, + [OBJECT_11] = Object11, + [OBJECT_12] = Object12, + [RAILTRACK] = Railtrack, + [LILYPAD_LARGE] = LilypadLarge, + [OBJECT_15] = Object15, + [FLOATING_PLATFORM] = FloatingPlatform, + [OBJECT_17] = Object17, + [EVIL_SPIRIT] = EvilSpirit, + [HOUSE_DOOR_EXT] = HouseDoorExterior, + [OBJECT_1A] = Object1A, + [GREAT_FAIRY] = GreatFairy, + [OBJECT_1C] = Object1C, + [OBJECT_1D] = Object1D, + [OBJECT_1E] = Object1E, + [OBJECT_1F] = Object1F, + [OBJECT_20] = Object20, + [OBJECT_21] = Object21, + [FIGURINE_DEVICE] = FigurineDevice, + [EYE_SWITCH] = EyeSwitch, + [OBJECT_24] = Object24, + [BIG_BARREL] = BigBarrel, + [OBJECT_26] = Object26, + [PUSHABLE_STATUE] = PushableStatue, + [OBJECT_28] = Object28, + [OBJECT_29] = Object29, + [OBJECT_2A] = Object2A, + [OBJECT_2B] = Object2B, + [BEANSTALK] = Beanstalk, + [SMOKE] = Smoke, + [PUSHABLE_ROCK] = PushableRock, + [HITTABLE_LEVER] = HittableLever, + [OBJECT_30] = Object30, + [OBJECT_31] = Object31, + [PULLABLE_MUSHROOM] = PullableMushroom, + [BOLLARD] = Bollard, + [WARP_POINT] = WarpPoint, + [OBJECT_35] = Object35, + [OBJECT_36] = Object36, + [OBJECT_37] = Object37, + [JAR_PORTAL] = JarPortal, + [BOSS_DOOR] = BossDoor, + [OBJECT_3A] = Object3A, + [PORTAL_MUSHROOM_STALKS] = MacroMushromStalks, + [PORTAL_FALLING_PLAYER] = MacroPlayer, + [OBJECT_3D] = Object3D, + [OBJECT_3E] = Object3E, + [GIANT_LEAF] = GiantLeaf, + [FAIRY] = Fairy, + [LADDER_UP] = LadderUp, + [OBJECT_42] = Object42, + [OBJECT_43] = Object43, + [OBJECT_44] = Object44, + [OBJECT_45] = Object45, + [GIANT_BOOK_LADDER] = GiantBookLadder, + [HEART_CONTAINER] = HeartContainer, + [FILE_SCREEN_OBJECTS] = FileScreenObjects, + [OBJECT_49] = Object49, + [BACKGROUND_CLOUD] = BackgroundCloud, + [OBJECT_4B] = Object4B, + [PUSHABLE_FURNITURE] = PushableFurniture, + [FURNITURE] = Furniture, + [MINISH_SIZED_ENTRANCE] = MinishSizedEntrance, + [ARCHWAY] = Archway, + [GIANT_ROCK] = GiantRock, + [OBJECT_51] = Object51, + [OBJECT_52] = Object52, + [OBJECT_53] = Object53, + [PULLABLE_LEVER] = PullableLever, + [MINECART] = Minecart, + [THOUGHT_BUBBLE] = ThoughtBubble, + [HIDDEN_LADDER_DOWN] = HiddenLadderDown, + [GENTARI_CURTAIN] = GentariCurtain, + [LAVA_PLATFORM] = LavaPlatform, + [OBJECT_5A] = Object5A, + [OBJECT_5B] = Object5B, + [MASK] = Mask, + [HOUSE_DOOR_INT] = HouseDoorInterior, + [WHIRLWIND] = Whirlwind, + [OBJECT_BLOCKING_STAIRS] = ObjectBlockingStairs, + [SWORDSMAN_NEWSLETTER] = SwordsmanNewsletter, + [OBJECT_61] = Object61, + [GIANT_TWIG] = GiantTwig, + [OBJECT_63] = Object63, + [OBJECT_64] = Object64, + [LADDER_HOLE] = LadderHoleInBookshelf, + [OBJECT_66] = Object66, + [OBJECT_67] = Object67, + [OBJECT_68] = Object68, + [OBJECT_69] = Object69, + [OBJECT_6A] = Object6A, + [CRENAL_BEAN_SPROUT] = CrenalBeanSprout, + [MINECART_DOOR] = MinecartDoor, + [OBJECT_ON_PILLAR] = ObjectOnPillar, + [MINERAL_WATER_SOURCE] = MineralWaterSource, + [MINISH_SIZED_ARCHWAY] = MinishSizedArchway, + [OBJECT_70] = Object70, + [PUSHABLE_GRAVE] = PushableGrave, + [OBJECT_72] = Object72, + [LILYPAD_SMALL] = LilypadSmall, + [OBJECT_74] = Object74, + [OBJECT_75] = Object75, + [OBJECT_76] = Object76, + [BELL] = Bell, + [HUGE_DECORATION] = MacroDecoration, + [OBJECT_79] = Object79, + [STEAM] = Steam, + [PUSHABLE_LEVER] = PushableLever, + [HUGE_SHOES] = MacroShoes, + [OBJECT_ON_BEETLE] = ObjectOnSpinyBeetle, + [OBJECT_7E] = Object7E, + [PICO_BLOOM] = PicoBloom, + [OBJECT_80] = Object80, + [OBJECT_81] = Object81, + [BIG_VORTEX] = BigVortex, + [BIG_PUSHABLE_LEVER] = BigPushableLever, + [SMALL_ICE_BLOCK] = SmallIceBlock, + [BIG_ICE_BLOCK] = BigIceBlock, + [OBJECT_86] = Object86, + [OBJECT_87] = Object87, + [HUGE_BOOK] = MacroBook, + [OBJECT_89] = Object89, + [OBJECT_8A] = Object8A, + [OBJECT_8B] = Object8B, + [BOOK] = Book, + [FIREPLACE] = Fireplace, + [OBJECT_8E] = Object8E, + [FROZEN_WATER_ELEMENT] = FrozenWaterElement, + [OBJECT_90] = Object90, + [OBJECT_91] = Object91, + [BAKER_OVEN] = BakerOven, + [OBJECT_93] = Object93, + [WIND_TRIBE_FLAG] = WindTribeFlag, + [BIRD] = Bird, + [OBJECT_96] = Object96, + [OBJECT_97] = Object97, + [OBJECT_98] = Object98, + [OBJECT_99] = Object99, + [HUGE_ACORN] = MacroAcorn, + [OBJECT_9B] = Object9B, + [TREE_HIDING_PORTAL] = TreeHidingPortal, + [LIGHTABLE_SWITCH] = LightableSwitch, + [OBJECT_9E] = Object9E, + [FAN] = Fan, + [OBJECT_A0] = ObjectA0, + [PALACE_ARCHWAY] = PalaceArchway, + [OBJECT_A2] = ObjectA2, + [CLOUD] = Cloud, + [MINISH_LIGHT] = MinishLight, + [OBJECT_A5] = ObjectA5, + [OBJECT_A6] = ObjectA6, + [OBJECT_A7] = ObjectA7, + [OBJECT_A8] = ObjectA8, + [OBJECT_A9] = ObjectA9, + [WATERFALL_OPENING] = WaterfallOpening, + [OBJECT_AB] = ObjectAB, + [FOUR_ELEMENTS] = FourElements, + [OBJECT_AD] = ObjectAD, + [FLOATING_BLOCK] = FloatingBlock, + [OBJECT_AF] = ObjectAF, + [METAL_DOOR] = MetalDoor, + [JAIL_BARS] = JailBars, + [OBJECT_B2] = ObjectB2, + [OBJECT_B3] = ObjectB3, + [OBJECT_B4] = ObjectB4, + [OBJECT_B5] = ObjectB5, + [OBJECT_B6] = ObjectB6, + [WELL] = Well, + [WIND_TRIBE_TELEPORTER] = WindTribeTeleporter, + [OBJECT_B9] = ObjectB9, + [OBJECT_BA] = ObjectBA, + [WINDCREST] = Windcrest, + [LIT_AREA] = LitArea, + [OBJECT_BD] = ObjectBD, + [PINWHEEL] = Pinwheel, + [OBJECT_BF] = ObjectBF, + [ENEMY_ITEM] = EnemyItem, + [OBJECT_C1] = ObjectC1, }; diff --git a/src/object/archway.c b/src/object/archway.c index b00192db..39975ee7 100644 --- a/src/object/archway.c +++ b/src/object/archway.c @@ -15,7 +15,7 @@ void Archway(Entity* this) { v1 = v1 - 0x5; v1 = v1 & v2; this->spriteSettings.raw = v1 | 1; - this->frameIndex = this->entityType.parameter; + this->frameIndex = this->type2; this->collisionLayer = 2; UpdateSpriteForCollisionLayer(this); v3 = CheckIsDungeon(); diff --git a/src/object/backgroundCloud.c b/src/object/backgroundCloud.c index 909a88a8..ceebf3d7 100644 --- a/src/object/backgroundCloud.c +++ b/src/object/backgroundCloud.c @@ -15,10 +15,10 @@ void sub_0808F658(Entity* this) { this->spriteSettings.b.draw = 1; this->spriteOrientation.flipY = 3; this->spriteRendering.b3 = 3; - this->spritePriority.b0 = this->entityType.form; - this->frameIndex = this->entityType.form; + this->spritePriority.b0 = this->type; + this->frameIndex = this->type; this->direction = 8; - this->nonPlanarMovement = gUnk_08121EB0[(this->entityType).form]; + this->nonPlanarMovement = gUnk_08121EB0[this->type]; this->field_0x78.HWORD = gRoomControls.roomOriginX - 0x60; this->field_0x7a.HWORD = gRoomControls.roomOriginX + gRoomControls.width + 0x60; this->animationState = 0; @@ -45,8 +45,8 @@ void sub_0808F70C(Entity* this) { this->x.HALF.HI = this->field_0x78.HWORD; } - if (this->entityType.form == 2) - this->y.HALF.HI = gUnk_08121EB3[this->entityType.parameter * 2 + (Random() & 1)]; + if (this->type == 2) + this->y.HALF.HI = gUnk_08121EB3[this->type2 * 2 + (Random() & 1)]; } if (this->previousActionFlag == 1) { diff --git a/src/object/bakerOven.c b/src/object/bakerOven.c index 0ddc3132..a64217f1 100644 --- a/src/object/bakerOven.c +++ b/src/object/bakerOven.c @@ -19,7 +19,7 @@ void sub_0809CC74(Entity* this) { this->action = 1; UpdateSpriteForCollisionLayer(this); - if (this->entityType.form == 0) { + if (this->type == 0) { this->spritePriority.b0 = 5; /* Create steam clouds */ for (i = 0; i < 3; i++) { @@ -31,12 +31,12 @@ void sub_0809CC74(Entity* this) { } sub_0809CDF0(this); } else { - if (this->entityType.parameter & 1) { + if (this->type2 & 1) { this->spriteSettings.b.draw = 1; this->actionDelay = 20; } else { this->action = 2; - this->actionDelay = (this->entityType.parameter & 2) ? 20 : 18; + this->actionDelay = (this->type2 & 2) ? 20 : 18; } InitializeAnimation(this, 0); } @@ -45,7 +45,7 @@ void sub_0809CC74(Entity* this) { void sub_0809CD0C(Entity* this) { u8* frames; - if (this->entityType.form) { + if (this->type) { GetNextFrame(this); frames = &this->frames.all; if (*frames & 1) { diff --git a/src/object/bigVortex.c b/src/object/bigVortex.c index 67d69520..fb771024 100644 --- a/src/object/bigVortex.c +++ b/src/object/bigVortex.c @@ -11,7 +11,7 @@ extern void (*const gUnk_0812367C[])(Entity*); extern u16 gUnk_08123690[]; void BigVortex(Entity* this) { - if ((this->entityType).form == 0) { + if (this->type == 0) { gUnk_0812367C[this->action](this); } else { sub_08098E3C(this); @@ -67,9 +67,9 @@ void sub_08098DC4(Entity* this) { ResolveEntityOnTop(this, &gPlayerEntity); gPlayerState.playerAction = 0x1f; gPlayerState.field_0x34[4] = 1; - gPlayerState.field_0x34[5] = this->entityType.parameter; + gPlayerState.field_0x34[5] = this->type2; this->action = 4; - if (this->entityType.parameter == 1) { + if (this->type2 == 1) { SetGlobalFlag(0x23); } sub_08077B20(); @@ -87,9 +87,9 @@ void sub_08098E3C(Entity* this) { if (this->action == 0) { this->action = 1; this->spriteSettings.b.draw = TRUE; - InitAnimationForceUpdate(this, this->entityType.form); + InitAnimationForceUpdate(this, this->type); } - temp = &gUnk_08123690[this->entityType.form & 2]; + temp = &gUnk_08123690[this->type & 2]; sub_0805EC9C(this, temp[0], temp[1], 0); UpdateAnimationSingleFrame(this); } diff --git a/src/object/bird.c b/src/object/bird.c index c69a24ef..2b6f194b 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -11,7 +11,7 @@ extern void (*const gUnk_08123EFC[])(Entity*); extern void (*const gUnk_08123F04[])(Entity*); void Bird(Entity* this) { - gUnk_08123EC0[this->entityType.form](this); + gUnk_08123EC0[this->type](this); } void sub_0809CF3C(Entity* this) { @@ -90,7 +90,7 @@ void sub_0809D0AC(Entity* this) { Entity* fx; if (sub_080044EC(this, 0x1800) < 2) { - (this->entityType).form = 2; + this->type = 2; this->action = 1; this->height.WORD = 0; this->collisionLayer = 1; diff --git a/src/object/button.c b/src/object/button.c index e81d6bbe..23a2ee8d 100644 --- a/src/object/button.c +++ b/src/object/button.c @@ -22,7 +22,7 @@ void sub_08081AE0(Entity* this) { this->field_0x74.HWORD = (((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3F) | ((((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3F) << 6); this->field_0x70.HALF.HI = GetTileType(this->field_0x74.HWORD, this->collisionLayer); - if (this->entityType.form == 0 && CheckFlags(this->field_0x86.HWORD)) { + if (this->type == 0 && CheckFlags(this->field_0x86.HWORD)) { this->action = 5; SetTileType(0x7A, this->field_0x74.HWORD, this->collisionLayer); } else { @@ -51,7 +51,7 @@ void sub_08081BAC(Entity* this) { this->actionDelay = 0xA; sub_0805E4E0(this, 0xA); sub_08081FF8(this); - if (this->entityType.form == 1) { + if (this->type == 1) { this->action = 3; } else { this->action = 5; @@ -211,7 +211,7 @@ void sub_08081E6C(Entity* this) { if (tile < 0x4000) return; r1 = GetLayerByIndex(r5); - r4 = (this->entityType.form == 0 ? 0x7a : 0x78); + r4 = (this->type == 0 ? 0x7a : 0x78); tmp = r1 + 0x3802; r1 += 0x3002 + r4; tmp = tmp + (*r1 << 2); diff --git a/src/object/chestSpawner.c b/src/object/chestSpawner.c index 06782b2e..790d1251 100644 --- a/src/object/chestSpawner.c +++ b/src/object/chestSpawner.c @@ -12,7 +12,7 @@ extern void (*const gUnk_0811F818[])(Entity*); extern u32 gUnk_0811F8B0; void ChestSpawner(Entity* this) { - gUnk_0811F7E8[this->entityType.form](this); + gUnk_0811F7E8[this->type](this); } void sub_08083DF0(Entity* this) { diff --git a/src/object/cloud.c b/src/object/cloud.c index 0bd0fa5e..a2637b6b 100644 --- a/src/object/cloud.c +++ b/src/object/cloud.c @@ -31,11 +31,11 @@ extern u16 gUnk_081247C8[]; extern u32 gUnk_081247D0; void Cloud(Entity* this) { - gUnk_08124798[(this->entityType).form](this); + gUnk_08124798[this->type](this); } void sub_0809F4DC(Entity* this) { - if ((this->entityType).parameter == 0) { + if (this->type2 == 0) { gUnk_081247A0[this->action](this); } else { gUnk_081247AC[this->action](this); @@ -100,7 +100,7 @@ void sub_0809F61C(Entity* this) { if ((gRoomControls.unk6 & 4) == 0) { if (this->actionDelay == 30) { - SetLocalFlag(this->entityType.parameter); + SetLocalFlag(this->type2); } if (--this->actionDelay == 0) { this->action = 3; diff --git a/src/object/fan.c b/src/object/fan.c index 5d8874bf..5d800011 100644 --- a/src/object/fan.c +++ b/src/object/fan.c @@ -16,10 +16,10 @@ void Fan(Entity* this) { } void sub_0809ED30(Entity* this) { - this->direction = (this->entityType.form ^ 2) << 3; + this->direction = (this->type ^ 2) << 3; sub_0809EE34(this); sub_0809EFB0(this); - InitializeAnimation(this, this->entityType.form); + InitializeAnimation(this, this->type); } void sub_0809ED54(Entity* this) { @@ -27,7 +27,7 @@ void sub_0809ED54(Entity* this) { u32 iVar2; if (((this->cutsceneBeh.HWORD == 0) || CheckFlags(this->cutsceneBeh.HWORD)) && - ((this->entityType.parameter != 1 || (--this->field_0x74.HWORD == 0)))) { + ((this->type2 != 1 || (--this->field_0x74.HWORD == 0)))) { sub_0809EE08(this); } } @@ -44,7 +44,7 @@ void sub_0809ED88(Entity* this) { return; } sub_0809EE24(this); - } else if (((this->entityType).parameter == 1) && (--this->field_0x74.HWORD == 0)) { + } else if ((this->type2 == 1) && (--this->field_0x74.HWORD == 0)) { sub_0809EE24(this); } } @@ -60,12 +60,12 @@ void sub_0809EDE4(Entity* this) { void sub_0809EE08(Entity* this) { this->action = 2; this->field_0x74.HWORD = *((u8*)&this->field_0x7c + 3) << 2; - InitializeAnimation(this, this->entityType.form); + InitializeAnimation(this, this->type); } void sub_0809EE24(Entity* this) { this->action = 3; - InitializeAnimation(this, this->entityType.form + 4); + InitializeAnimation(this, this->type + 4); } void sub_0809EE34(Entity* this) { diff --git a/src/object/fileScreenObjects.c b/src/object/fileScreenObjects.c index 7bc3f717..51403761 100644 --- a/src/object/fileScreenObjects.c +++ b/src/object/fileScreenObjects.c @@ -51,7 +51,7 @@ void FileScreenObjects(Entity* this) { if (this->currentHealth == 0) { sub_0808EFF0(this); } - gUnk_08121C64[this->entityType.form](this); + gUnk_08121C64[this->type](this); if (this->animIndex < 64) { UpdateAnimationSingleFrame(this); } @@ -65,7 +65,7 @@ void sub_0808E7F0(Entity* this) { sub_080AE008(this, 1, 2); this->palette.b.b0 = 0xF; this->spriteSettings.b.draw = 0; - this->entityType.parameter = 0xFF; + this->type2 = 0xFF; this->action = 1; } @@ -75,15 +75,15 @@ void sub_0808E818(Entity* this) { if (!sub_0808E950()) { int var2 = -1; - this->entityType.parameter = var2; + this->type2 = var2; this->field_0x68.HWORD = var2; this->field_0x6a.HWORD = var2; this->spriteSettings.b.draw = 0; return; } - if (this->entityType.parameter != gUnk_02019EE0.unk6) { - this->entityType.parameter = gUnk_02019EE0.unk6; + if (this->type2 != gUnk_02019EE0.unk6) { + this->type2 = gUnk_02019EE0.unk6; this->field_0x68.HWORD = CheckGlobalFlag(EZERO_1ST) == 0 ? 0x400 : 0x100; this->field_0x70.BYTES.byte0 = 4; this->animationState = 2; @@ -142,7 +142,7 @@ void sub_0808E988(Entity* this) { if (this->action == 0) { this->action = 1; this->spriteIndex = 0x142; - this->entityType.parameter = 0xFF; + this->type2 = 0xFF; sub_080AE008(this, 1, 3); } @@ -155,7 +155,7 @@ void sub_0808E988(Entity* this) { } if (i != 0) { - if (this->entityType.parameter != i) { + if (this->type2 != i) { InitAnimationForceUpdate(this, i); } this->spriteSettings.b.draw = 2; @@ -178,7 +178,7 @@ void sub_0808EA28(Entity* this) { u32 var0; u32 var1; - if (this->entityType.form == 3) { + if (this->type == 3) { if (gUnk_02000000->gameLanguage > LANGUAGE_EN) { this->spriteSettings.b.draw = 2; } else { @@ -186,11 +186,11 @@ void sub_0808EA28(Entity* this) { } } - if (this->entityType.form == gUnk_02019EE0.unk6) { + if (this->type == gUnk_02019EE0.unk6) { var0 = 12; var1 = 1; } else { - if (gUnk_02032EC0.lastState == 5 && this->entityType.form == gUnk_02019EE0.unk7) { + if (gUnk_02032EC0.lastState == 5 && this->type == gUnk_02019EE0.unk7) { var0 = 13; var1 = 2; } else { @@ -207,8 +207,8 @@ void sub_0808EA28(Entity* this) { void sub_0808EABC(Entity* this) { int var0 = -72; - int var1 = this->entityType.form * 32 + 40; - int var2 = gUnk_02019EE0.unk6 == this->entityType.form; + int var1 = this->type * 32 + 40; + int var2 = gUnk_02019EE0.unk6 == this->type; switch (gUnk_02032EC0.lastState) { case 0: var0 = 24; @@ -223,7 +223,7 @@ void sub_0808EABC(Entity* this) { } break; case 5: - switch (gMenu.focusCoords[this->entityType.form]) { + switch (gMenu.focusCoords[this->type]) { case 0: var0 = 42; var1 = 40; @@ -232,7 +232,7 @@ void sub_0808EABC(Entity* this) { case 2: var0 = 20; var1 = 144; - var1 -= (gMenu.unk16 - gMenu.focusCoords[this->entityType.form]) * 32; + var1 -= (gMenu.unk16 - gMenu.focusCoords[this->type]) * 32; break; } break; @@ -326,8 +326,7 @@ static Entity* sub_0808EC80(int form) { Entity* entityA = (Entity*)&gUnk_03003DA0; Entity* entityB = entityA->next; while (entityB != entityA) { - if ((entityB->entityType.type == 0x6 && entityB->entityType.subtype == 0x48) && - form == entityB->entityType.form) { + if ((entityB->kind == 0x6 && entityB->id == 0x48) && form == entityB->type) { return entityB; } entityB = entityB->next; @@ -361,7 +360,7 @@ void sub_0808ECBC(Entity* this) { break; } - var2 = this->entityType.form - 4; + var2 = this->type - 4; var3 = &gUnk_08121CD4[var1][var2]; this->field_0x68.HWORD = var3->unk1; this->field_0x6a.HWORD = var3->unk2; @@ -408,7 +407,7 @@ void sub_0808EE00(Entity* this) { int var0, var1, var2; var0 = ((struct_02000000*)0x2000000)->gameLanguage != 0; - var1 = this->entityType.form - 10; + var1 = this->type - 10; this->frameIndex = gUnk_08121D38[var0][var1]; this->x.HALF.HI = gUnk_08121D18[var0][var1]; this->field_0x68.HWORD = gUnk_08121D18[var0][var1]; @@ -445,7 +444,7 @@ void sub_0808EED8(Entity* this) { this->spriteSettings.b.draw = 0; } else { this->spriteSettings.b.draw = 2; - var0 = this->entityType.form - 19; + var0 = this->type - 19; this->palette.b.b0 = gMenu.column_idx == var0 ? 4 : 3; } } @@ -456,7 +455,7 @@ void sub_0808EF24(Entity* this) { this->spriteSettings.b.draw = 0; } else { this->spriteSettings.b.draw = 2; - if (this->entityType.form == 21) { + if (this->type == 21) { var0 = ((struct_02000000*)0x2000000)->messageSpeed; } else { var0 = ((struct_02000000*)0x2000000)->brightnessPref; @@ -522,7 +521,7 @@ static void sub_0808EFF0(Entity* this) { this->currentHealth = 1; this->frameIndex = 0xFF; this->animIndex = 0xFF; - var0 = &gUnk_08121D54[this->entityType.form]; + var0 = &gUnk_08121D54[this->type]; this->x.HALF.HI = var0->unk2; this->field_0x68.HWORD = var0->unk2; this->y.HALF.HI = var0->unk4; diff --git a/src/object/floatingBlock.c b/src/object/floatingBlock.c index e9bb10e8..661cec72 100644 --- a/src/object/floatingBlock.c +++ b/src/object/floatingBlock.c @@ -5,7 +5,7 @@ void FloatingBlock(Entity* this) { if (this->action == 0) { this->action = 1; - this->frameIndex = this->entityType.form; + this->frameIndex = this->type; this->spritePriority.b0 = 0xe; this->collisionLayer = 1; UpdateSpriteForCollisionLayer(this); diff --git a/src/object/giantLeaf.c b/src/object/giantLeaf.c index 9003f28b..cf2fb1df 100644 --- a/src/object/giantLeaf.c +++ b/src/object/giantLeaf.c @@ -15,7 +15,7 @@ void GiantLeaf(Entity* ent) { ent->spriteSettings.b.draw = 1; ent->spriteRendering.b3 = 3; ent->spritePriority.b0 = 7; - ent->frameIndex = ent->entityType.form; + ent->frameIndex = ent->type; sub_0808D618(ent); } } @@ -25,7 +25,7 @@ void sub_0808D618(Entity* ent) { s16* arr; u32 i; - arr = (ent->entityType.form != 0) ? gUnk_0812176A : gUnk_08121750; + arr = (ent->type != 0) ? gUnk_0812176A : gUnk_08121750; tilePos = (((ent->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3F) | ((((ent->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3F) * 64); diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c index 9ed9fd67..e71ddfc6 100644 --- a/src/object/greatFairy.c +++ b/src/object/greatFairy.c @@ -25,10 +25,10 @@ void GreatFairy(Entity* this) { u8 bVar1; if (this->action == 0) { - bVar1 = __modsi3(this->entityType.form, 11); - this->entityType.parameter = bVar1; + bVar1 = __modsi3(this->type, 11); + this->type2 = bVar1; } - GreatFairy_Main[(this->entityType).parameter](this); + GreatFairy_Main[this->type2](this); } // Behaviors @@ -366,7 +366,7 @@ void GreatFairy_EnergyUpdate(Entity* this) { } void sub_08087114(Entity* this) { - if ((this->entityType).parameter == 0) { + if (this->type2 == 0) { GreatFairy_Form1Behaviors[this->action](this); } else { GreatFairy_Form2Behaviors[this->action](this); @@ -485,10 +485,10 @@ void GreatFairy_InitializeAnimation(Entity* this) { s32 temp; this->action = 1; - temp = this->entityType.form; - this->entityType.parameter = temp % 11; + temp = this->type; + this->type2 = temp % 11; this->collisionLayer = 2; - InitializeAnimation(this, this->entityType.parameter); + InitializeAnimation(this, this->type2); sub_0805E3A0(this, 2); } @@ -496,7 +496,7 @@ Entity* GreatFairy_CreateForm(Entity* this, u32 curForm, u32 parameter) { s32 nextForm; Entity* ent; - nextForm = this->entityType.form; + nextForm = this->type; nextForm /= 11; ent = CreateObject(0x1b, (u8)nextForm * 11 + curForm, parameter); diff --git a/src/object/heartContainer.c b/src/object/heartContainer.c index 8181dacc..f6858b50 100644 --- a/src/object/heartContainer.c +++ b/src/object/heartContainer.c @@ -29,7 +29,7 @@ static void sub_0808E6A0(Entity* this) { DeleteThisEntity(); } this->action = 1; - this->entityType.form = 0x62; + this->type = 0x62; this->spriteSettings.b.draw = 0; this->hitbox = &gUnk_08121C58; this->collisionLayer = 3; diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c index f323363f..d500686c 100644 --- a/src/object/houseDoorExterior.c +++ b/src/object/houseDoorExterior.c @@ -32,7 +32,7 @@ extern void (*const gUnk_081206B4[])(Entity*); extern Hitbox gUnk_081206AC; // TODO: should be const void HouseDoorExterior(Entity* this) { - gUnk_081206B4[this->entityType.parameter](this); + gUnk_081206B4[this->type2](this); } void sub_080866D8(Entity* this) { @@ -156,7 +156,7 @@ static void sub_080868EC(Entity* entity, unk_80868EC* arg1) { void sub_0808692C(Entity* this) { this->flags &= 0xFD; - this->entityType.parameter = 2; + this->type2 = 2; this->action = this->frameIndex == 0 ? 1 : 2; this->previousActionFlag = 0; this->actionDelay = 8; diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c index 114e42e7..409c1d04 100644 --- a/src/object/itemOnGround.c +++ b/src/object/itemOnGround.c @@ -75,7 +75,7 @@ void ItemOnGround(Entity* this) { gUnk_0811E7D4[this->action](this); } - if (this->entityType.form == 0x5C) { + if (this->type == 0x5C) { gRoomVars.field_0x4++; } @@ -87,7 +87,7 @@ void sub_08080F20(Entity* this) { DeleteThisEntity(); } - if (this->entityType.form != 0x60) { + if (this->type != 0x60) { this->spriteSettings.b.draw = 1; this->spritePriority.b1 = 3; this->spriteSettings.b.shadow = 0; @@ -96,7 +96,7 @@ void sub_08080F20(Entity* this) { this->field_0x40 = 0x44; this->currentHealth = 0xFF; this->hitbox = &gUnk_080FD1A8; - switch (this->entityType.form - 0x3F) { + switch (this->type - 0x3F) { case 0: case 21: case 22: @@ -120,14 +120,14 @@ void sub_08080F20(Entity* this) { this->field_0x68.HALF.LO = 0; this->actionDelay = 0; sub_0805E3A0(this, 3); - this->field_0x1c = sub_0808147C(this->entityType.form); + this->field_0x1c = sub_0808147C(this->type); gUnk_0811E7E8[this->field_0x68.HALF.HI](this); } else { Entity* entity = CreateObject(0x40, 0x60, 0); if (entity) { entity->actionDelay = 0; if (this->actionDelay == 1) { - entity->entityType.parameter = 2; + entity->type2 = 2; } CopyPosition(this, entity); @@ -158,7 +158,7 @@ static void sub_080810A8(Entity* this) { } static void sub_080810FC(Entity* this) { - if (this->entityType.form != 0x5F) { + if (this->type != 0x5F) { sub_08081598(this); } else { this->action = 2; @@ -278,7 +278,7 @@ void nullsub_510(Entity* this) { void sub_08081328(Entity* this) { Entity* other = this->attachedEntity; - if (!(other->entityType.type == 8 && other->entityType.subtype == 3)) { + if (!(other->kind == 8 && other->id == 3)) { sub_08081404(this, 0); } else { CopyPosition(other, this); @@ -334,17 +334,17 @@ void sub_08081404(Entity* this, u32 arg1) { bool32 sub_08081420(Entity* this) { if (CheckShouldPlayItemGetCutscene(this)) { sub_0805E3A0(this, 6); - CreateItemEntity(this->entityType.form, this->entityType.parameter, 0); + CreateItemEntity(this->type, this->type2, 0); return TRUE; } else { - GiveItem(this->entityType.form, this->entityType.parameter); + GiveItem(this->type, this->type2); return FALSE; } } static bool32 CheckShouldPlayItemGetCutscene(Entity* this) { bool32 result = FALSE; - if ((gUnk_080FD5B4[this->entityType.form].unk0[3] & 0x2) || !GetInventoryValue(this->entityType.form)) { + if ((gUnk_080FD5B4[this->type].unk0[3] & 0x2) || !GetInventoryValue(this->type)) { result = TRUE; } return result; @@ -391,7 +391,7 @@ static void sub_08081500(Entity* this) { this->field_0x68.HALF.LO = 1; } else { if (var0 == 1) { - sub_0808148C(this->entityType.form); + sub_0808148C(this->type); UpdateSpriteForCollisionLayer(this); } @@ -408,13 +408,13 @@ static void sub_0808153C(Entity* this) { if (!sub_08003FC4(this, 0x1000) && !sub_0800442E(this)) { this->field_0x68.HALF.LO = 1; this->field_0x20 = 0x1E000; - sub_0808148C(this->entityType.form); + sub_0808148C(this->type); UpdateSpriteForCollisionLayer(this); } } else { if (!sub_08003FC4(this, 0x2800)) { this->field_0x68.HALF.LO = 2; - sub_0808148C(this->entityType.form); + sub_0808148C(this->type); } } } @@ -434,7 +434,7 @@ static void sub_08081598(Entity* this) { this->attachedEntity = &gPlayerEntity; CopyPosition(this->attachedEntity, this); this->height.HALF.HI -= 4; - if (this->entityType.form != 0x5F && sub_08081420(this)) { + if (this->type != 0x5F && sub_08081420(this)) { sub_08081404(this, 1); } } diff --git a/src/object/lightableSwitch.c b/src/object/lightableSwitch.c index ffe2d28e..cfbf0ba5 100644 --- a/src/object/lightableSwitch.c +++ b/src/object/lightableSwitch.c @@ -19,7 +19,7 @@ extern void (*const gUnk_081243C4[])(Entity*); extern Hitbox gUnk_080FD150; void LightableSwitch(Entity* this) { - gUnk_081243B4[this->entityType.form](this); + gUnk_081243B4[this->type](this); sub_0809EB30(this); } @@ -69,9 +69,9 @@ void sub_0809EAD8(Entity* this) { u8 bVar1; Entity* pEVar2; - if (this->entityType.parameter != 0) { + if (this->type2 != 0) { - this->attachedEntity = GetCurrentRoomProperty(this->entityType.parameter); + this->attachedEntity = GetCurrentRoomProperty(this->type2); sub_080A2CC0(this, &this->attachedEntity, &this->field_0x74.HWORD); } else { @@ -83,7 +83,7 @@ void sub_0809EB30(Entity* this) { u16 uVar1; u16* puVar2; - if (this->entityType.parameter != 0) { + if (this->type2 != 0) { if ((this->direction & 0x80) == 0) { sub_0806F69C(this); } diff --git a/src/object/lilypadSmall.c b/src/object/lilypadSmall.c index 7dc35ae2..a96c49ad 100644 --- a/src/object/lilypadSmall.c +++ b/src/object/lilypadSmall.c @@ -19,7 +19,7 @@ void LilypadSmall(Entity* this) { this->frameIndex = (rand >> 0x10) & 3; this->spriteSettings.b.draw = TRUE; this->spritePriority.b0 = 7; - this->attachedEntity = GetCurrentRoomProperty(this->entityType.parameter); + this->attachedEntity = GetCurrentRoomProperty(this->type2); sub_080A2CC0(this, &this->attachedEntity, &this->field_0x70.HALF.LO); } sub_080A2BE4(this, sub_08097ADC(this)); diff --git a/src/object/mask.c b/src/object/mask.c index 03dceea7..e405df5f 100644 --- a/src/object/mask.c +++ b/src/object/mask.c @@ -29,11 +29,11 @@ void Mask(Entity* this) { } void sub_080929A4(Entity* this) { - if (this->entityType.parameter & 0xC0) { + if (this->type2 & 0xC0) { if (CheckFlags(this->field_0x86.HWORD)) { s32 field_0x0a; - switch (this->entityType.parameter & 0xC0) { + switch (this->type2 & 0xC0) { case 0x40: field_0x0a = gScreenTransition[0x5]; @@ -62,7 +62,7 @@ void sub_080929A4(Entity* this) { this->field_0xf = this->actionDelay >> 1; this->actionDelay = 0; - this->frameIndex = this->entityType.parameter & 0x3f; + this->frameIndex = this->type2 & 0x3f; this->field_0x7c.HALF.HI = COORD_TO_TILE(this); this->field_0x7c.HALF.LO = sub_080001DA(this->field_0x7c.HALF.HI, 1); @@ -112,7 +112,7 @@ void sub_08092B0C(Entity* this) { this->action = 3; this->actionDelay = 0; - switch (this->entityType.parameter & 0xC0) { + switch (this->type2 & 0xC0) { case 0x80: EnqueueSFX(0x72); case 0x40: diff --git a/src/object/minecart.c b/src/object/minecart.c index ca233985..53d1ff82 100644 --- a/src/object/minecart.c +++ b/src/object/minecart.c @@ -42,7 +42,7 @@ void sub_080916EC(Entity* this) { this->x.HALF.HI = gRoomControls.roomOriginX + ((unk->field_0x0 & 0x3f) << 4) + 8; this->y.HALF.HI = gRoomControls.roomOriginY + ((unk->field_0x0 & 0xfc << 4) >> 2) + 8; this->animationState = unk->field_0x5; - this->entityType.parameter = unk->field_0x6; + this->type2 = unk->field_0x6; this->action = 1; this->hitbox = &gUnk_080FD310; this->flags |= 0x80; @@ -53,7 +53,7 @@ void sub_080916EC(Entity* this) { this->direction = DirectionFromAnimationState(this->animationState); this->nonPlanarMovement = 0x700; this->spritePriority.b1 = 3; - InitAnimationForceUpdate(this, this->entityType.parameter + 4 + this->animationState); + InitAnimationForceUpdate(this, this->type2 + 4 + this->animationState); SetTile(0x4022, COORD_TO_TILE(this), this->collisionLayer); } @@ -62,7 +62,7 @@ void sub_080917DC(Entity* this) { if ((this->bitfield & 0x7f) == 0x1d) { this->field_0x20 = 0x2a000; this->action = 7; - InitAnimationForceUpdate(this, this->entityType.parameter + 4 + this->animationState); + InitAnimationForceUpdate(this, this->type2 + 4 + this->animationState); SoundReq(0x13b); } else { if (sub_0800445C(this) != 0) { @@ -75,7 +75,7 @@ void sub_080917DC(Entity* this) { } else { this->actionDelay = 0; } - if ((this->entityType).parameter == 0) { + if (this->type2 == 0) { if (8 < this->actionDelay) { this->action = this->action + 1; gPlayerState.jumpStatus = 0x81; diff --git a/src/object/mineralWaterSource.c b/src/object/mineralWaterSource.c index 644da9c1..50212f44 100644 --- a/src/object/mineralWaterSource.c +++ b/src/object/mineralWaterSource.c @@ -25,9 +25,9 @@ void MineralWaterSource_Init(Entity* this) { return; } - unknownParameters = &MineralWaterSourceParameters[this->entityType.form]; + unknownParameters = &MineralWaterSourceParameters[this->type]; - this->entityType.parameter = unknownParameters->field_0x00; + this->type2 = unknownParameters->field_0x00; this->field_0x40 = unknownParameters->field_0x03; this->hitbox->width = unknownParameters->field_0x01; diff --git a/src/object/minishLight.c b/src/object/minishLight.c index 21465597..458a0864 100644 --- a/src/object/minishLight.c +++ b/src/object/minishLight.c @@ -13,7 +13,7 @@ void sub_0809F840(Entity* this) { this->actionDelay = 0x20; this->field_0xf = 0; - if (this->entityType.parameter != 0) { + if (this->type2 != 0) { this->spriteSettings.b.flipX = 1; } diff --git a/src/object/minishSizedEntrance.c b/src/object/minishSizedEntrance.c index 59a9294b..78410c6c 100644 --- a/src/object/minishSizedEntrance.c +++ b/src/object/minishSizedEntrance.c @@ -15,7 +15,7 @@ void sub_08090EC0(Entity* this) { this->action = 1; this->spriteRendering.b3 = 3; this->spritePriority.b0 = 7; - this->frameIndex = (this->entityType).parameter; + this->frameIndex = this->type2; if (CheckIsDungeon()) { this->frameIndex += 4; sub_080AE068(this); diff --git a/src/object/object1A.c b/src/object/object1A.c index 4670f231..26ece918 100644 --- a/src/object/object1A.c +++ b/src/object/object1A.c @@ -20,7 +20,7 @@ void sub_080869DC(Entity* ent) { ent->spriteSettings.b.draw = 0; ent->hitbox = &gUnk_080FD1A8; ent->field_0x3c |= 16; - itemEntity = CreateObject(0, ent->entityType.form, 0); + itemEntity = CreateObject(0, ent->type, 0); if (itemEntity != NULL) { itemEntity->actionDelay = 10; itemEntity->parent = ent; diff --git a/src/object/object1C.c b/src/object/object1C.c index ace54e82..c12a6c1d 100644 --- a/src/object/object1C.c +++ b/src/object/object1C.c @@ -12,7 +12,7 @@ void Object1C(Entity* this) { } iVar1 = CheckRectOnScreen(this->field_0x80.HWORD, this->field_0x82.HWORD, 0x10, 0x10); if (iVar1 == 0) { - this->parent->field_0x20 &= ~(1 << this->entityType.parameter); + this->parent->field_0x20 &= ~(1 << this->type2); DeleteThisEntity(); } } diff --git a/src/object/object2A.c b/src/object/object2A.c index 9844ec72..ffd00460 100644 --- a/src/object/object2A.c +++ b/src/object/object2A.c @@ -12,11 +12,11 @@ void Object2A(Entity* this) { void sub_08089B18(Entity* this) { this->action = 1; this->spriteSettings.b.draw = TRUE; - if (this->entityType.parameter != 0) { - this->actionDelay = this->entityType.parameter; + if (this->type2 != 0) { + this->actionDelay = this->type2; } InitializeAnimation(this, 0); - switch (this->entityType.form) { + switch (this->type) { case 1: this->y.HALF.HI -= 8; this->actionDelay = 0x28; diff --git a/src/object/object49.c b/src/object/object49.c index e871d959..16bf7bb9 100644 --- a/src/object/object49.c +++ b/src/object/object49.c @@ -19,7 +19,7 @@ extern void (*const gUnk_08121E98[])(Entity*); extern const u16 gUnk_08121EA0[]; void Object49(Entity* this) { - gUnk_08121E5C[this->entityType.form](this); + gUnk_08121E5C[this->type](this); } void sub_0808F0B8(Entity* this) { @@ -179,10 +179,10 @@ void sub_0808F3DC(Entity* this) { this->spriteSettings.b.draw = 1; this->action = 1; this->actionDelay = 120; - InitializeAnimation(this, this->entityType.form + 1); + InitializeAnimation(this, this->type + 1); // TODO: This block of code might supposed to be a switch statement. - if (this->entityType.form != 8) { - if (this->entityType.form == 7) { + if (this->type != 8) { + if (this->type == 7) { sub_0806FAD8(this->attachedEntity, this); return; } @@ -193,13 +193,13 @@ void sub_0808F3DC(Entity* this) { ResolveEntityOnTop(this->attachedEntity, this); } else { if (*(u32*)&this->parent->field_0x74 == 0) { - if (this->entityType.form == 8) { + if (this->type == 8) { this->attachedEntity->damageType = this->damageType; } DeleteThisEntity(); } - if (this->entityType.form == 5 && this->frames.b.f0) { + if (this->type == 5 && this->frames.b.f0) { Entity* entity = CreateObjectWithParent(this->attachedEntity, 0x49, 8, 0); if (entity) { entity->parent = this->parent; @@ -233,7 +233,7 @@ void sub_0808F498(Entity* this) { } else { this->action = 1; this->actionDelay = 64; - var0 = this->entityType.parameter != 0 ? 44 : 43; + var0 = this->type2 != 0 ? 44 : 43; this->x.HALF.HI -= this->parent->hitbox->width; this->x.HALF.HI += (s32)Random() % (this->parent->hitbox->width * 2); this->y.HALF.HI -= this->parent->hitbox->height; diff --git a/src/object/object7E.c b/src/object/object7E.c index a8120b22..6c89947e 100644 --- a/src/object/object7E.c +++ b/src/object/object7E.c @@ -11,15 +11,15 @@ void Object7E(Entity* this) { this->action = 1; this->spritePriority.b0 = 7; this->frameIndex = 0x28; - if (this->entityType.form == 0) { + if (this->type == 0) { this->spriteSettings.b.draw = TRUE; - } else if (this->entityType.form == 2) { + } else if (this->type == 2) { this->spriteSettings.b.flipX = TRUE; } } PositionRelative(this->parent, this, 0, 0x80000); this->height.HALF.HI = 0; - if ((this->entityType).form != 0) { + if (this->type != 0) { this->spriteSettings.b.draw = this->attachedEntity->spriteSettings.b.draw; this->frameIndex = this->attachedEntity->frameIndex + 0x1f; } diff --git a/src/object/object9E.c b/src/object/object9E.c index 4549a18d..858ee01b 100644 --- a/src/object/object9E.c +++ b/src/object/object9E.c @@ -14,7 +14,7 @@ void Object9E(Entity* this) { if (this->action == 0) { this->action = 1; this->spritePriority.b0 = 6; - if ((this->entityType).form == 0) { + if (this->type == 0) { this->flags = this->flags | 0x80; this->frameIndex = 1; layer = &this->collisionLayer; diff --git a/src/object/objectA2.c b/src/object/objectA2.c index bf308a4d..01fd9fa6 100644 --- a/src/object/objectA2.c +++ b/src/object/objectA2.c @@ -36,7 +36,7 @@ void sub_0809F318(Entity* this) { this->height.HALF.HI = 0xFFB0; this->spriteOrientation.flipY = 2; this->action = 1; - sub_0801D2B4(this, gUnk_08124704[this->entityType.form]); + sub_0801D2B4(this, gUnk_08124704[this->type]); sub_0805E3A0(this, 7); } diff --git a/src/object/objectA8.c b/src/object/objectA8.c index ce298c29..4cca37f2 100644 --- a/src/object/objectA8.c +++ b/src/object/objectA8.c @@ -26,7 +26,7 @@ void ObjectA8(Entity* this) { case 0x1f: this->action = 5; this->attachedEntity = &gPlayerEntity; - CreateItemEntity((this->entityType).form, 0, 0); + CreateItemEntity(this->type, 0, 0); DeleteThisEntity(); } } diff --git a/src/object/objectAF.c b/src/object/objectAF.c index eba574f3..c1d32b60 100644 --- a/src/object/objectAF.c +++ b/src/object/objectAF.c @@ -10,7 +10,7 @@ void ObjectAF(Entity* this) { } void sub_080A05A4(Entity* this) { - if ((this->entityType).form != 2) { + if (this->type != 2) { this->action = 1; this->spritePriority.b0 = 6; sub_080A0640(this); @@ -45,7 +45,7 @@ void sub_080A0624(Entity* this) { } void sub_080A0640(Entity* this) { - if (this->entityType.form == 0) { + if (this->type == 0) { PositionRelative(*(Entity**)(this->parent->myHeap + 0x4), this, 0, 0x80000); } else { CopyPosition(this->parent, this); diff --git a/src/object/objectB2.c b/src/object/objectB2.c index 7c4073fb..4722d2e9 100644 --- a/src/object/objectB2.c +++ b/src/object/objectB2.c @@ -13,14 +13,14 @@ void ObjectB2(Entity* this) { if (this->action == 0) { this->action = 1; this->actionDelay = 0x10; - this->direction = (this->entityType).form << 3; + this->direction = this->type << 3; if (this->collisionLayer == 2) { pEVar3 = &gUnk_0200D654; } else { pEVar3 = &gUnk_02027EB4; } this->attachedEntity = pEVar3; - InitializeAnimation(this, this->entityType.form); + InitializeAnimation(this, this->type); } this->nonPlanarMovement = this->parent->nonPlanarMovement; sub_0806F69C(this); diff --git a/src/object/palaceArchway.c b/src/object/palaceArchway.c index de1e5297..cec05cbe 100644 --- a/src/object/palaceArchway.c +++ b/src/object/palaceArchway.c @@ -11,7 +11,7 @@ void PalaceArchway(Entity* this) { void sub_0809F2A0(Entity* this) { this->action = 1; - this->frameIndex = this->entityType.parameter; + this->frameIndex = this->type2; this->spriteRendering.b3 = 3; this->spritePriority.b0 = 7; SetTile(0x4069, COORD_TO_TILE(this), this->collisionLayer); diff --git a/src/object/pinwheel.c b/src/object/pinwheel.c index 5862c3ca..d6a24471 100644 --- a/src/object/pinwheel.c +++ b/src/object/pinwheel.c @@ -21,7 +21,7 @@ void Pinwheel(Entity* this) { } void sub_080A23DC(Entity* this) { - this->field_0x68.HWORD = gUnk_08125050[this->entityType.parameter]; + this->field_0x68.HWORD = gUnk_08125050[this->type2]; this->spritePriority.b0 = 7; if (CheckLocalFlag(this->field_0x68.HWORD) != 0) { this->action = 2; diff --git a/src/object/pot.c b/src/object/pot.c index a4cddb5e..cd73f9a8 100644 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -28,7 +28,7 @@ void Pot(Entity* this) { } void sub_0808222C(Entity* this) { - if (this->entityType.parameter == 1 && CheckFlags(this->field_0x86.HWORD)) { + if (this->type2 == 1 && CheckFlags(this->field_0x86.HWORD)) { DeleteThisEntity(); } @@ -261,13 +261,13 @@ static void sub_08082824(Entity* this) { } static void sub_08082850(Entity* this, Entity* parent) { - u32 parameter = sub_0808288C(this, this->entityType.form, this->field_0x7c.BYTES.byte1, this->entityType.parameter); + u32 parameter = sub_0808288C(this, this->type, this->field_0x7c.BYTES.byte1, this->type2); Entity* fxEntity = CreateFx(this, 5, parameter); if (fxEntity) { fxEntity->parent = parent; } - if (this->entityType.parameter == 1) { + if (this->type2 == 1) { SetFlag(this->field_0x86.HWORD); } diff --git a/src/object/railtrack.c b/src/object/railtrack.c index 57f58f76..2e3a3d66 100644 --- a/src/object/railtrack.c +++ b/src/object/railtrack.c @@ -25,13 +25,13 @@ void sub_080851AC(Entity* this) { this->action = 1; this->spriteSettings.b.draw = 1; this->spritePriority.b0 = 7; - if ((this->entityType.parameter & 1) != 0) { + if ((this->type2 & 1) != 0) { this->field_0x7c.HALF.LO = -1; } else { this->field_0x7c.HALF.LO = 1; } - this->animationState = this->entityType.parameter & 2; - if ((this->entityType).form == 3) { + this->animationState = this->type2 & 2; + if (this->type == 3) { uVar1 = CheckFlags(this->field_0x86.HWORD); this->field_0x7a.HWORD = uVar1; if ((u16)(uVar1 & -1) != 0) { @@ -48,7 +48,7 @@ void sub_08085264(Entity* this) { if (CheckFlags(this->field_0x86.HWORD)) { this->action = 2; this->field_0xf = 8; - if (this->entityType.form == 1) { + if (this->type == 1) { ClearFlag(this->field_0x86.HWORD); } this->animationState = (this->animationState + *(u8*)&this->field_0x7c) & 3; @@ -72,7 +72,7 @@ void sub_080852B4(Entity* this) { void sub_08085308(Entity* this) { if (sub_080854A8(this) == 0) { - switch (this->entityType.form) { + switch (this->type) { case 0: case 1: break; diff --git a/src/object/smoke.c b/src/object/smoke.c index c8759c7c..5ec708b9 100644 --- a/src/object/smoke.c +++ b/src/object/smoke.c @@ -10,7 +10,7 @@ extern void (*const gUnk_08121070[])(Entity*); extern s8 gUnk_08121068[]; void Smoke(Entity* this) { - gUnk_08121060[this->entityType.form](this); + gUnk_08121060[this->type](this); } void sub_0808A40C(Entity* this) { diff --git a/src/object/swordsmanNewsletter.c b/src/object/swordsmanNewsletter.c index 229980ea..e74d2ee1 100644 --- a/src/object/swordsmanNewsletter.c +++ b/src/object/swordsmanNewsletter.c @@ -15,7 +15,7 @@ void SwordsmanNewsletter(Entity* this) { void sub_080933D8(Entity* this) { this->action = 1; - this->frameIndex = this->entityType.form; + this->frameIndex = this->type; UpdateSpriteForCollisionLayer(this); this->hitbox = &gUnk_081228A8; sub_080787B4(this); @@ -24,6 +24,6 @@ void sub_080933D8(Entity* this) { void sub_080933FC(Entity* this) { if (this->interactType != 0) { this->interactType = 0; - TextboxNoOverlap(gUnk_081228B8[this->entityType.form], this); + TextboxNoOverlap(gUnk_081228B8[this->type], this); } } diff --git a/src/object/thoughtBubble.c b/src/object/thoughtBubble.c index 13996ad9..596cb382 100644 --- a/src/object/thoughtBubble.c +++ b/src/object/thoughtBubble.c @@ -21,8 +21,8 @@ void ThoughtBubble_Init(Entity* this) { this->actionDelay = 0x2d; } this->spriteOrientation.flipY = 1; - InitializeAnimation(this, this->entityType.parameter); - SoundReq(ThoughtBubble_SFX[this->entityType.parameter]); + InitializeAnimation(this, this->type2); + SoundReq(ThoughtBubble_SFX[this->type2]); } void ThoughtBubble_Update(Entity* this) { @@ -31,7 +31,7 @@ void ThoughtBubble_Update(Entity* this) { this->y.HALF.HI = this->parent->y.HALF.HI; this->height.HALF.HI = this->parent->height.HALF.HI; } - if ((this->entityType).parameter != 2) { + if (this->type2 != 2) { if (--this->actionDelay == 0) { DeleteThisEntity(); } diff --git a/src/object/windTribeFlag.c b/src/object/windTribeFlag.c index 01d7e554..9c769808 100644 --- a/src/object/windTribeFlag.c +++ b/src/object/windTribeFlag.c @@ -6,7 +6,7 @@ void WindTribeFlag(Entity* this) { if (this->action == 0) { this->action++; this->collisionLayer = 2; - if ((this->entityType).form == 0) { + if (this->type == 0) { this->spriteSettings.b.flipX = 0; } else { this->spriteSettings.b.flipX = 1; diff --git a/src/object/windcrest.c b/src/object/windcrest.c index 967e7004..efc11dc4 100644 --- a/src/object/windcrest.c +++ b/src/object/windcrest.c @@ -28,6 +28,6 @@ void sub_080A2124(Entity* this) { void Windcrest_Unlock(Entity* this) { SoundReq(0x72); - gSave.windcrests = gSave.windcrests | 1 << (this->entityType.parameter + 0x18); + gSave.windcrests = gSave.windcrests | 1 << (this->type2 + 0x18); CreateFx(this, 0x46, 0); } diff --git a/src/script.c b/src/script.c index a7427cde..494e0ae5 100644 --- a/src/script.c +++ b/src/script.c @@ -389,7 +389,7 @@ void sub_0807DDE4(Entity* entity) { loopVar = loopVar ^ switchVar; switch (switchVar) { case 2: - if (entity->entityType.type == 7) { + if (entity->kind == 7) { sub_0806ED78(entity); } else { sub_0800445C(entity); diff --git a/src/sub_0805E374.c b/src/sub_0805E374.c index ebad1b0e..5767e6da 100644 --- a/src/sub_0805E374.c +++ b/src/sub_0805E374.c @@ -10,5 +10,5 @@ Entity* sub_0805E374(Entity* param_1) { if (r3 != '\x02') { array = gUnk_081091EE; } - return sub_0805E3A0(param_1, array[(param_1->entityType).type]); + return sub_0805E3A0(param_1, array[param_1->kind]); }