diff options
| author | notyourav <65437533+notyourav@users.noreply.github.com> | 2021-02-28 17:05:57 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-28 17:05:57 -0800 |
| commit | 082b0c03a3e5c34a511069e159e9485ced292dbc (patch) | |
| tree | 4284940e28d2c44940dee10bfa352fcd3bee5b1b /src/object | |
| parent | 6596831a6bff9638c00baf7d81632d6ed1ed7e02 (diff) | |
| parent | e3ee1058bb05edd47321a5554995a1bc78b42289 (diff) | |
Merge pull request #126 from notyourav/ent_enums
create object enum and update entity type struct
Diffstat (limited to 'src/object')
42 files changed, 135 insertions, 136 deletions
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); } |
