From 82f40860adf700bcb19f38f91ee65fde6a116710 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Fri, 29 Apr 2022 10:01:15 +0300 Subject: [PATCH] Remove some gotos --- src/item/itemGustJar.c | 16 +++++++--------- src/object/lilypadLarge.c | 1 - src/script.c | 11 ++++++----- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/item/itemGustJar.c b/src/item/itemGustJar.c index a749ea37..7b1d681e 100644 --- a/src/item/itemGustJar.c +++ b/src/item/itemGustJar.c @@ -125,7 +125,7 @@ void sub_08076F64(ItemBehavior* this, u32 idx) { return; } - break; + return; case 3: gPlayerState.field_0x1c = 4; case 4: @@ -147,31 +147,29 @@ void sub_08076F64(ItemBehavior* this, u32 idx) { gPlayerEntity.direction = DirectionTurnAround(Direction8FromAnimationState(gPlayerEntity.animationState)); gPlayerEntity.speed = 0x80; UpdatePlayerMovement(); - break; + return; case 6: UpdateItemAnim(this); if ((this->field_0x5[9] & 0x80) == 0) return; - goto case0; break; case 7: sub_08077DF4(this, 0x514); gPlayerState.field_0x1c = 3; gPlayerState.gustJarSpeed = 0; - break; + return; case 1: case 2: default: gPlayerState.field_0x1c = 3; sub_08077DF4(this, 0x514); - break; + return; case 0: - case0: - gPlayerState.field_0x1c = 0; - gPlayerEntity.field_0x70.WORD = 0; - DeletePlayerItem(this, idx); break; } + gPlayerState.field_0x1c = 0; + gPlayerEntity.field_0x70.WORD = 0; + DeletePlayerItem(this, idx); } void (*const ItemGustJar_StateFunctions[])(ItemBehavior* beh, u32) = { diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c index 2e478e2c..81314d9b 100644 --- a/src/object/lilypadLarge.c +++ b/src/object/lilypadLarge.c @@ -313,7 +313,6 @@ void sub_080855E8(LilypadLargeEntity* this) { this->unk_70 -= 0x80; } if ((super->collisions & 0xe0) == 0xe0) { - // goto _080859D8; u32 tmp2 = this->unk_70; if ((s32)this->unk_70 < 0) { tmp2 += 3; diff --git a/src/script.c b/src/script.c index 22725cc9..93b919c0 100644 --- a/src/script.c +++ b/src/script.c @@ -1150,10 +1150,13 @@ void ScriptCommand_0807E9E4(Entity* entity, ScriptExecutionContext* context) { } void ScriptCommand_0807E9F0(Entity* entity, ScriptExecutionContext* context) { - u32 tmp; + bool32 tmp; sub_0801E00C(); - tmp = 1; + tmp = TRUE; switch (gFuseInfo._0) { + default: + tmp = FALSE; + break; case 2: gPlayerState.controlMode = CONTROL_DISABLED; gPauseMenuOptions.disabled = tmp; @@ -1162,14 +1165,12 @@ void ScriptCommand_0807E9F0(Entity* entity, ScriptExecutionContext* context) { case 1: context->condition = 0; break; - default: - goto lbl; } + if (tmp) { PlayerResetStateFromFusion(); gPlayerState.controlMode = CONTROL_1; } else { - lbl: gActiveScriptInfo.commandSize = 0; } }