diff --git a/src/code_0805EC04.c b/src/code_0805EC04.c index e8197e14..dbcf312f 100644 --- a/src/code_0805EC04.c +++ b/src/code_0805EC04.c @@ -67,7 +67,12 @@ void InitPlayerMacro(u32 param_1) { ASM_FUNC("asm/non_matching/code_0805EC04/UpdatePlayerInput.inc", void UpdatePlayerInput()) u32 ConvInputToState(u32 keys) { - u32 result = (s32) - (keys & 0x200) >> 0x1f & 0x1000; + u32 result; + if (keys & L_BUTTON) { + result = 0x1000; + } else { + result = 0; + } if (keys & R_BUTTON) { result |= 0x20; result |= 0x8000; diff --git a/src/enemy/bowMoblin.c b/src/enemy/bowMoblin.c index 831477de..fd7e73bd 100644 --- a/src/enemy/bowMoblin.c +++ b/src/enemy/bowMoblin.c @@ -31,7 +31,7 @@ void sub_0803C624(BowMoblinEntity*); void sub_0803C6DC(BowMoblinEntity*); void sub_0803C714(BowMoblinEntity*); void sub_0803C634(BowMoblinEntity*); -u32 sub_0803C6F8(BowMoblinEntity*); +bool32 sub_0803C6F8(BowMoblinEntity*); bool32 sub_0803C568(BowMoblinEntity*); void sub_0803C664(BowMoblinEntity*); @@ -111,7 +111,7 @@ void sub_0803C234(BowMoblinEntity* this) { sub_0803C4B0(this); } - } else if (sub_0803C6F8(this) != 0) { + } else if (sub_0803C6F8(this)) { sub_0800417E(super, super->collisions); super->animationState = ((super->direction + 4) & 0x18) >> 2; this->unk_0x83++; @@ -369,10 +369,8 @@ void sub_0803C6DC(BowMoblinEntity* this) { GetNextFrame(super); } -u32 sub_0803C6F8(BowMoblinEntity* this) { - u32 tmp = (super->collisions & gUnk_080CFFBC[(super->animationState ^ 1) / 2]); - u32 tmp2 = -tmp; - return (tmp2 | tmp) >> 0x1f; +bool32 sub_0803C6F8(BowMoblinEntity* this) { + return (super->collisions & gUnk_080CFFBC[(super->animationState ^ 1) / 2]) != 0; } void sub_0803C714(BowMoblinEntity* this) { diff --git a/src/enemy/eyegore.c b/src/enemy/eyegore.c index a3e189ba..7e308ab8 100644 --- a/src/enemy/eyegore.c +++ b/src/enemy/eyegore.c @@ -370,7 +370,7 @@ void sub_08031024(EyegoreEntity* this) { gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI); } else { this->unk_79 = 1; - this->unk_78 = (boolresult >> 0x1f); + this->unk_78 = boolresult != 0; super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, this->unk_74, this->unk_76); } } else { diff --git a/src/npc/cat.c b/src/npc/cat.c index 92154bbb..cb8e1c99 100644 --- a/src/npc/cat.c +++ b/src/npc/cat.c @@ -342,7 +342,12 @@ void sub_08067C44(Entity* this) { s32 iVar4; u32 uVar5; - uVar5 = -((s32) - (gPlayerState.flags & PL_MINISH) >> 0x1f); + if ((gPlayerState.flags & PL_MINISH) != 0) { + uVar5 = TRUE; + } else { + uVar5 = FALSE; + } + if (uVar5 != this->field_0x68.HALF.HI) { if (uVar5 == 0) { sub_08078778(this); diff --git a/src/npc/cow.c b/src/npc/cow.c index 99f5514a..e418ecd9 100644 --- a/src/npc/cow.c +++ b/src/npc/cow.c @@ -200,8 +200,12 @@ void Cow_ShowDialogue(Entity* ent) { } void sub_0806920C(Entity* ent) { - u32 var0 = gPlayerState.flags & PL_MINISH; - u32 var1 = -var0 >> 0x1F; + u32 var1; + if ((gPlayerState.flags & PL_MINISH) != 0) { + var1 = TRUE; + } else { + var1 = FALSE; + } if (var1 != ent->field_0x6c.HALF.HI) { if (var1 == 0) { diff --git a/src/npc/dog.c b/src/npc/dog.c index e88a4486..82bd62d2 100644 --- a/src/npc/dog.c +++ b/src/npc/dog.c @@ -278,7 +278,13 @@ void sub_08069FBC(Entity* this) { } void sub_08069FE8(Entity* this) { - u32 tmp = -((s32) - (gPlayerState.flags & PL_MINISH) >> 0x1f); + u32 tmp; + if ((gPlayerState.flags & PL_MINISH) != 0) { + tmp = TRUE; + } else { + tmp = FALSE; + } + if (tmp != this->field_0x6a.HALF.LO) { if (tmp == 0) { sub_08078778(this); diff --git a/src/npc/epona.c b/src/npc/epona.c index 5ac95ddb..ce180670 100644 --- a/src/npc/epona.c +++ b/src/npc/epona.c @@ -65,7 +65,12 @@ void sub_08065A50(Entity* this) { void sub_08065A64(Entity* this) { u32 uVar2; - uVar2 = -(gPlayerState.flags & PL_MINISH) >> 0x1f; + if ((gPlayerState.flags & PL_MINISH) != 0) { + uVar2 = TRUE; + } else { + uVar2 = FALSE; + } + if (uVar2 != this->field_0x68.HALF.HI) { if (uVar2 == 0) { sub_08078778(this); diff --git a/src/npc/tingleSiblings.c b/src/npc/tingleSiblings.c index 3b00da9d..6c998270 100644 --- a/src/npc/tingleSiblings.c +++ b/src/npc/tingleSiblings.c @@ -141,7 +141,11 @@ void sub_08064F28(Entity* this, ScriptExecutionContext* context) { iVar3 = GetInventoryValue(ITEM_MAGIC_BOOMERANG); uVar5 = 2; if (iVar3 == 0) { - uVar5 = (-bVar2 | bVar2) >> 0x1f; + if (bVar2) { + uVar5 = 1; + } else { + uVar5 = 0; + } } } iVar4 = 0xffffffff; diff --git a/src/object/chestSpawner.c b/src/object/chestSpawner.c index 1c8527e1..04ca7420 100644 --- a/src/object/chestSpawner.c +++ b/src/object/chestSpawner.c @@ -307,7 +307,14 @@ void sub_080842D8(ChestSpawnerEntity* this) { gUnk_0811F880, gUnk_0811F88A, }; - s32 index = -(-(super->x.HALF.HI & 8) >> 0x1f); + s32 index; + + if ((super->x.HALF.HI & 8) != 0) { + index = 1; + } else { + index = 0; + } + if ((super->y.HALF.HI & 8) != 0) { index += 2; } diff --git a/src/playerItem/playerItemBoomerang.c b/src/playerItem/playerItemBoomerang.c index 5f8d95ce..1c9fa0f6 100644 --- a/src/playerItem/playerItemBoomerang.c +++ b/src/playerItem/playerItemBoomerang.c @@ -149,7 +149,11 @@ void sub_0801B680(Entity* this) { if (sub_0801B864(this)) { uvar1 = this->field_0x68.HALF.LO; uvar1 ^= 0xc; - uVar6 = ((u32)(-uvar1 | uvar1)) >> 0x1f; + if (uvar1) { + uVar6 = TRUE; + } else { + uVar6 = FALSE; + } } if (sub_080B1BA4(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) == 0) { diff --git a/src/playerItem/playerItemSword.c b/src/playerItem/playerItemSword.c index 680ea92f..76ae377f 100644 --- a/src/playerItem/playerItemSword.c +++ b/src/playerItem/playerItemSword.c @@ -356,8 +356,8 @@ NONMATCH("asm/non_matching/playerItemSword/sub_080A7A84.inc", void sub_080A7A84( if (super->type != 0) { sub_08008796(super, 0, super->x.HALF.HI + uVar3, super->y.HALF.HI + uVar4); } else { - if ((((super->z.WORD == 0) && (sub_08008796(super, ((u32) - (gPlayerState.skills & 8)) >> 0x1f, - super->x.HALF.HI + uVar3, super->y.HALF.HI + uVar4) == NULL)) && + if ((((super->z.WORD == 0) && (sub_08008796(super, (gPlayerState.skills & 8) != 0, super->x.HALF.HI + uVar3, + super->y.HALF.HI + uVar4) == NULL)) && (gPlayerState.sword_state != 0)) && ((gPlayerState.sword_state & 0xc0) == 0)) { if (GetRelativeCollisionTile(super, uVar3, uVar4) == 0x2e) { diff --git a/src/text.c b/src/text.c index 277b0a65..c4cc0c10 100644 --- a/src/text.c +++ b/src/text.c @@ -201,8 +201,11 @@ u32 GetCharacter(Token* token) { case 0x14: case 0x15: code = 0xb; - // This is a comparison to 0 but couldn't make it do the bit trick - uVar6 = (-(uVar6 ^ 0x14) | (uVar6 ^ 0x14)) >> 0x1f; + if ((uVar6 ^ 0x14) != 0) { + uVar6 = 1; + } else { + uVar6 = 0; + } } token->param = (u16)uVar6; break;