mirror of
https://github.com/zeldaret/tmc
synced 2026-07-11 15:28:41 -04:00
Fix all the zero comparison bit tricks I could find
This commit is contained in:
+6
-1
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+1
-1
@@ -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 {
|
||||
|
||||
+6
-1
@@ -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);
|
||||
|
||||
+6
-2
@@ -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) {
|
||||
|
||||
+7
-1
@@ -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);
|
||||
|
||||
+6
-1
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+5
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user