diff --git a/src/collision.c b/src/collision.c index 6a402be9..9832b61c 100644 --- a/src/collision.c +++ b/src/collision.c @@ -564,22 +564,22 @@ s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) s32 sub_0801802C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { int kind; - ColSettings* p; u32 x; kind = org->kind; if (kind == 1) { if (sub_08079F8C()) { if (((((direction ^ 0x10) - 4 * tgt->animationState + 5) & 0x1F)) > 0xA) { - goto _08018090; + x = 0x11aa; + return sub_08018308(org, tgt, direction, &gCollisionMtx[x + org->hurtType]); } else { - goto _0801807A; + sub_080180BC(org, tgt); + return 1; } } } else if (kind == 8) { if ((((org->direction ^ 0x10) - 4 * tgt->animationState + 5) & 0x1F) <= 0xA) { org->health = 0; - _0801807A: sub_080180BC(org, tgt); return 1; } @@ -587,7 +587,7 @@ s32 sub_0801802C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) org->health = 0; return 0; } -_08018090: + x = 0x11aa; return sub_08018308(org, tgt, direction, &gCollisionMtx[x + org->hurtType]); } diff --git a/src/enemy/gleerok.c b/src/enemy/gleerok.c index bd1584b4..fb2777e4 100644 --- a/src/enemy/gleerok.c +++ b/src/enemy/gleerok.c @@ -814,41 +814,40 @@ void sub_0802DDD8(GleerokEntity* this) { break; case 1: case 2: - if (super->type2 == 1) - goto code13; - if (this->unk_76 == 0) { - r2 = 1; - r8 = 2; - r4 = 1; - } else { - r2 = 2; - r8 = 6; - r4 = 0; - } - - if (this->unk_84->ent2->field_0xf == 1) { - super->child = CreateProjectileWithParent(super, GLEEROK_PROJECTILE, r2); - if (super->child) { - super->child->direction = this->unk_84->filler[0x15]; - super->child->type2 = this->unk_84->ent2->frame & 0xf; - super->child->parent = this->unk_84->ent2; - super->child->child = this->unk_84->entities[0]; + if (super->type2 != 1) { + if (this->unk_76 == 0) { + r2 = 1; + r8 = 2; + r4 = 1; + } else { + r2 = 2; + r8 = 6; + r4 = 0; } - } - if (this->unk_74 == 0) { - this->unk_74 = r4; - this->unk_84->entities[super->field_0xf]->field_0xf = r8; - - if (++super->field_0xf > 5) { - super->field_0xf = 0; + if (this->unk_84->ent2->field_0xf == 1) { + super->child = CreateProjectileWithParent(super, GLEEROK_PROJECTILE, r2); + if (super->child) { + super->child->direction = this->unk_84->filler[0x15]; + super->child->type2 = this->unk_84->ent2->frame & 0xf; + super->child->parent = this->unk_84->ent2; + super->child->child = this->unk_84->entities[0]; + } + } + + if (this->unk_74 == 0) { + this->unk_74 = r4; + this->unk_84->entities[super->field_0xf]->field_0xf = r8; + + if (++super->field_0xf > 5) { + super->field_0xf = 0; + } + } else { + this->unk_74--; } - } else { - this->unk_74--; } if (super->type2 == 1) { - code13: sub_0802EA48(this->unk_84, 5, 0x40, super->direction); } else { if (this->unk_76 == 0) { diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c index 69f1e461..1bb11fcd 100644 --- a/src/enemy/smallPesto.c +++ b/src/enemy/smallPesto.c @@ -68,19 +68,15 @@ void sub_08031704(Entity* this) { } void sub_08031714(Entity* this) { - u8 newDirection; sub_080317B4(this); if (--this->field_0xf == 0) { this->field_0xf = (Random() & 0xf) + 0x10; - if (sub_08049FA0(this) == 0) { - if ((this->field_0xf & 1) != 0) { - this->direction = sub_08049EE4(this); - goto _08031766; - } + if (sub_08049FA0(this) == 0 && (this->field_0xf & 1) != 0) { + this->direction = sub_08049EE4(this); + } else { + this->direction += 0x18; + this->direction = ((Random() & 0xe) + this->direction) & 0x1f; } - this->direction += 0x18; - this->direction = ((Random() & 0xe) + this->direction) & 0x1f; - _08031766: sub_080317E0(this); } } diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c index 49aefdfe..e916f2c1 100644 --- a/src/npc/bladeBrothers.c +++ b/src/npc/bladeBrothers.c @@ -234,7 +234,6 @@ void sub_08068CA0(Entity* this, ScriptExecutionContext* context) { void sub_08068CFC(Entity* this, ScriptExecutionContext* context) { u8 bVar1; u8 itemID; - u32 uVar2; context->condition = 0; bVar1 = this->actionDelay; @@ -244,7 +243,8 @@ void sub_08068CFC(Entity* this, ScriptExecutionContext* context) { switch (bVar1) { case 0: default: - goto switchD_08068d12_caseD_0; + context->condition = 1; + return; case 1: itemID = 0x2; break; @@ -255,13 +255,16 @@ void sub_08068CFC(Entity* this, ScriptExecutionContext* context) { itemID = 0x14; break; case 5: - uVar2 = CheckLocalFlag(3); - goto LABEL1; - break; + if (CheckLocalFlag(3) == 0) { + return; + } + context->condition = 1; + return; case 6: if (gSave.stats.maxHealth < 0x50) return; - goto switchD_08068d12_caseD_0; + context->condition = 1; + return; case 7: if (GetInventoryValue(ITEM_SKILL_SPIN_ATTACK) == 0) { return; @@ -285,13 +288,12 @@ void sub_08068CFC(Entity* this, ScriptExecutionContext* context) { break; case 10: itemID = ITEM_SKILL_GREAT_SPIN; + break; } - uVar2 = GetInventoryValue(itemID); -LABEL1: - if (uVar2 == 0) { + + if (GetInventoryValue(itemID) == 0) { return; } -switchD_08068d12_caseD_0: context->condition = 1; } diff --git a/src/npc/talon.c b/src/npc/talon.c index 87f6b3ad..4f52ea9d 100644 --- a/src/npc/talon.c +++ b/src/npc/talon.c @@ -100,24 +100,21 @@ void sub_080656D4(Entity* this) { this->action = 4; this->interactType = 0; sub_0806F118(this); - goto label; + sub_0806574C(this); } else { if (this->interactType != 0) { if (GetInventoryValue(ITEM_QST_LONLON_KEY) != 0) { StartCutscene(this, (u16*)&script_TalonGotKey); - goto label2; } else { this->field_0x68.HALF.HI = this->action; this->action = 3; this->interactType = 0; MessageNoOverlap(*(u32*)(*(u32*)&this->cutsceneBeh.HWORD + 4), this); - label: sub_0806574C(this); + return; } - } else { - label2: - sub_0807DD94(this, NULL); } + sub_0807DD94(this, NULL); } } diff --git a/src/object/mask.c b/src/object/mask.c index df9a4e7a..689d3a88 100644 --- a/src/object/mask.c +++ b/src/object/mask.c @@ -20,16 +20,16 @@ void sub_080929A4(Entity* this) { case 0x44D ... 0x44F: case 0x182: DeleteThisEntity(); - goto switchEnd; + break; + default: + ClearFlag(this->field_0x86.HWORD); } - ClearFlag(this->field_0x86.HWORD); break; case 0x80: DeleteThisEntity(); break; } - switchEnd: } } diff --git a/src/object/minecartDoor.c b/src/object/minecartDoor.c index 32f427bc..514e9b1a 100644 --- a/src/object/minecartDoor.c +++ b/src/object/minecartDoor.c @@ -105,7 +105,7 @@ void MinecartDoor_Action3(MinecartDoorEntity* this) { if (sub_08083734(super, super->type) == 0) { return; } - goto label; + bVar3 = FALSE; } else { bVar3 = --super->actionDelay * 0x1000000; } @@ -113,7 +113,6 @@ void MinecartDoor_Action3(MinecartDoorEntity* this) { bVar3 = sub_08096D84(this); } if (bVar3 == FALSE) { - label: super->action = 4; sub_080836DC(super, super->type, this->unk_76); } diff --git a/src/object/pushableFurniture.c b/src/object/pushableFurniture.c index 0d1f98a9..b4cc4a13 100644 --- a/src/object/pushableFurniture.c +++ b/src/object/pushableFurniture.c @@ -161,18 +161,20 @@ bool32 sub_0808FC5C(PushableFurnitureEntity* this) { } bVar2 = FALSE; if (*(u16*)&super->type == 0x101) { - if (super->y.HALF.HI != this->unk_7e) - goto _0808FCC8; + if (super->y.HALF.HI == this->unk_7e) { + bVar2 = TRUE; + } } else { if (super->x.HALF.HI == this->unk_7e) { bVar2 = TRUE; } - _0808FCC8: - if (!bVar2) { - sub_0808FF50(this); - return TRUE; - } } + + if (!bVar2) { + sub_0808FF50(this); + return TRUE; + } + this->unk_81 = 1; if (super->parent == NULL) { SetFlag((u32)this->unk_86); diff --git a/src/roomInit.c b/src/roomInit.c index 4d670f37..714ffc3b 100644 --- a/src/roomInit.c +++ b/src/roomInit.c @@ -2211,20 +2211,22 @@ u32 sub_unk3_DeepwoodShrine_Barrel(void) { } void sub_StateChange_DeepwoodShrine_Barrel(void) { - if (gSave.unk7 == 0) { - goto a; - } - if (gSave.unk7 != 2) { - a: - SetTileType(0x90, 0x20b, 1); - SetTileType(0x90, 0x411, 1); - } else { - SetTileType(0x90, 0x211, 1); - SetTileType(0x90, 0x40b, 1); + switch (gSave.unk7) { + case 0: + default: + SetTileType(0x90, 0x20b, 1); + SetTileType(0x90, 0x411, 1); + break; + case 2: + SetTileType(0x90, 0x211, 1); + SetTileType(0x90, 0x40b, 1); + break; } + if (CheckLocalFlag(0x15)) { SetTileType(0x76, 0x304, 2); } + if (CheckLocalFlag(0x16)) { SetTileType(0x76, 0x318, 2); }