From 9df9e77512dd4ee28b62c9226e65b28f6f602ed8 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Mon, 28 Mar 2022 09:07:30 +0300 Subject: [PATCH] Change --x !=/== 0xff comparisons --- src/enemy/bombPeahat.c | 2 +- src/enemy/gyorgMale.c | 2 +- src/item/itemTryPickupObject.c | 2 +- src/object/minecart.c | 2 +- src/object/minishEmoticon.c | 2 +- src/object/object2A.c | 2 +- src/object/object49.c | 2 +- src/object/object79.c | 2 +- src/object/pot.c | 2 +- src/object/pullableMushroom.c | 4 ++-- src/player.c | 24 ++++++++++++------------ src/playerItem/playerItemGustJar.c | 2 +- src/projectile/gleerokProjectile.c | 4 ++-- src/projectile/octorokBossProjectile.c | 2 +- 14 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index 5cb6e1db..f49316d5 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -242,7 +242,7 @@ void sub_0802AB40(Entity* this) { this->field_0xf = 0x4; this->field_0x80.HALF.LO ^= 1; } - } else if ((--this->field_0xf & 0xff) == 0) { + } else if (--this->field_0xf == 0) { sub_0802ACDC(this, 4); } } diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c index e0af39c7..8e6365da 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -408,7 +408,7 @@ void sub_08046EF4(GyorgMaleEntity* this) { super->direction ^= 0x80; } super->speed = gUnk_080D1B74[(super->actionDelay >> 3) & 0xF]; - if ((--super->field_0xf & 0xFF) == 0) { + if (--super->field_0xf == 0) { Entity* tmp; super->field_0xf = (Random() & 0x38) + 0x78; tmp = CreateProjectile(GYORG_MALE_ENERGY_PROJECTILE); diff --git a/src/item/itemTryPickupObject.c b/src/item/itemTryPickupObject.c index c4addc70..2e4c9fd3 100644 --- a/src/item/itemTryPickupObject.c +++ b/src/item/itemTryPickupObject.c @@ -59,7 +59,7 @@ void sub_080765E0(ItemBehavior* this, u32 arg1) { void sub_0807660C(ItemBehavior* this, u32 arg1) { UpdateItemAnim(this); - if ((--this->field_0x5[2] == 0xff) || (gPlayerState.field_0x0[1] == 0)) { + if ((this->field_0x5[2]-- == 0) || (gPlayerState.field_0x0[1] == 0)) { gPlayerState.field_0x0[1] = 0; DeletePlayerItem(this, arg1); } diff --git a/src/object/minecart.c b/src/object/minecart.c index c43d574e..2d0f95f7 100644 --- a/src/object/minecart.c +++ b/src/object/minecart.c @@ -153,7 +153,7 @@ void sub_080919AC(MinecartEntity* this) { SoundReq(SFX_138); } - if (--super->field_0xf == 0xff) { + if (super->field_0xf-- == 0) { SoundReq(SFX_PLY_VO7); super->field_0xf = 0x3c; } diff --git a/src/object/minishEmoticon.c b/src/object/minishEmoticon.c index 5ba969b7..20c68e43 100644 --- a/src/object/minishEmoticon.c +++ b/src/object/minishEmoticon.c @@ -71,7 +71,7 @@ void sub_08082098(Entity* this) { if (this->animIndex != animIndex) { this->z.WORD = 0; this->actionDelay = 6; - } else if (--this->actionDelay == 0xff) { + } else if (this->actionDelay-- == 0) { switch (this->spriteOffsetY) { case 0: this->spriteOffsetY = -2; diff --git a/src/object/object2A.c b/src/object/object2A.c index 743eb305..2f24592d 100644 --- a/src/object/object2A.c +++ b/src/object/object2A.c @@ -52,7 +52,7 @@ void sub_08089BA0(Entity* this) { return; case 1: case 2: - if (--this->actionDelay != 0xff) + if (this->actionDelay-- != 0) return; if (this->type == 2) { sub_0807B7D8(((u16*)this->child)[3], COORD_TO_TILE(this), this->collisionLayer); diff --git a/src/object/object49.c b/src/object/object49.c index 4eca5e6e..12ad7e38 100644 --- a/src/object/object49.c +++ b/src/object/object49.c @@ -217,7 +217,7 @@ void sub_0808F498(Entity* this) { DeleteThisEntity(); } - if (--this->actionDelay == 0xFF) { + if (this->actionDelay-- == 0) { DeleteThisEntity(); } diff --git a/src/object/object79.c b/src/object/object79.c index 52480738..b90046a1 100644 --- a/src/object/object79.c +++ b/src/object/object79.c @@ -95,7 +95,7 @@ void Object79_Action2(Object79Entity* this) { this->objDir.WORD += this->unk74; this->objDir.HALF.HI = DirectionNormalize(this->objDir.HALF.HI); this->unk74 += 0x140; - if (--super->field_0xf == 0xff) { + if (super->field_0xf-- == 0) { super->field_0xf = 30; super->actionDelay ^= 1; } diff --git a/src/object/pot.c b/src/object/pot.c index a11c6d4d..b75999d6 100644 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -170,7 +170,7 @@ void sub_08082614(Entity* this) { u32 tileType; sub_0800445C(this); - if (--this->actionDelay != 0xFF) { + if (this->actionDelay-- != 0) { LinearMoveUpdate(this); sub_08016A6C(this); return; diff --git a/src/object/pullableMushroom.c b/src/object/pullableMushroom.c index 0c0e5796..80d2c605 100644 --- a/src/object/pullableMushroom.c +++ b/src/object/pullableMushroom.c @@ -199,7 +199,7 @@ void sub_0808ADF0(PullableMushroomEntity* this) { SoundReq(SFX_12E); } else { GetNextFrame(super); - if (((super->frame & ANIM_DONE) != 0) && (--super->actionDelay == 0xff)) { + if (((super->frame & ANIM_DONE) != 0) && (super->actionDelay-- == 0)) { InitializeAnimation(super, super->animationState + 0xd); } } @@ -226,7 +226,7 @@ void sub_0808AEB0(PullableMushroomEntity* this) { GetNextFrame(super); if (uVar1 < 0x40) { sub_080044AE(&gPlayerEntity, 0x40, super->direction); - if (--this->unk_7c == 0xffffffff) { + if (this->unk_7c-- == 0) { this->unk_7c = 4; SoundReq(SFX_12F); } diff --git a/src/player.c b/src/player.c index 23250474..ca6ff416 100644 --- a/src/player.c +++ b/src/player.c @@ -723,7 +723,7 @@ static void PlayerBounceUpdate(Entity* this) { return; } - if (--this->actionDelay != 0xFF) { + if (this->actionDelay-- != 0) { this->zVelocity = Q_16_16(1.0); return; } @@ -969,7 +969,7 @@ static void sub_08071208(Entity* this) { } } - if (--this->actionDelay == 0xff) { + if (this->actionDelay-- == 0) { gPlayerState.jump_status = 0; ResetPlayerAnimationAndAction(); } @@ -1114,7 +1114,7 @@ static void PortalStandUpdate(Entity* this) { if (this->direction != gPlayerState.field_0xd) { this->actionDelay = 8; } - if (--this->actionDelay == 0xff) { + if (this->actionDelay-- == 0) { this->direction = gPlayerState.field_0xd; this->animationState = Direction8ToAnimationState(this->direction); this->zVelocity = Q_16_16(2.0); @@ -1796,7 +1796,7 @@ static void sub_08072064(Entity* this) { static void sub_08072098(Entity* this) { UpdateAnimationSingleFrame(this); if (this->actionDelay != 0) - if (--this->actionDelay != 0xFF) + if (this->actionDelay-- != 0) return; else ; @@ -1850,7 +1850,7 @@ static void sub_08072168(Entity* this) { } gPlayerState.field_0xd = this->direction; UpdatePlayerCollision(); - if (--this->actionDelay == 0xff) { + if (this->actionDelay-- == 0) { this->knockbackDuration = 0; COLLISION_ON(this); UpdateSpriteForCollisionLayer(this); @@ -1954,7 +1954,7 @@ static void sub_08072354(Entity* this) { static void sub_080723D0(Entity* this) { UpdateAnimationSingleFrame(this); - if (--this->actionDelay == 0xff) { + if (this->actionDelay-- == 0) { this->spritePriority.b1 = 1; this->iframes = 20; ModHealth(-2); @@ -1963,7 +1963,7 @@ static void sub_080723D0(Entity* this) { } static void sub_0807240C(Entity* this) { - if (--this->knockbackDuration == 0xff) { + if (this->knockbackDuration-- == 0) { this->spriteSettings.draw = 3; this->iframes = 20; gPlayerState.flags &= ~PL_BURNING; @@ -1989,7 +1989,7 @@ static void sub_0807246C(Entity* this) { } static void sub_08072490(Entity* this) { - if (--this->actionDelay != 0xff) { + if (this->actionDelay-- != 0) { UpdateAnimationSingleFrame(this); UpdatePlayerMovement(); } else { @@ -2111,7 +2111,7 @@ static void PlayerRollUpdate(Entity* this) { } this->direction = Direction8FromAnimationState(AnimationStateIdle(this->animationState)); - if (((gPlayerState.flags & PL_MINISH) == 0) && (--this->actionDelay == 0xff)) { + if (((gPlayerState.flags & PL_MINISH) == 0) && (this->actionDelay-- == 0)) { CreateFx(&gPlayerEntity, FX_DASH, 0x40); this->actionDelay = 4; } @@ -2355,7 +2355,7 @@ static void sub_08072CC0(Entity* this) { static void sub_08072CFC(Entity* this) { sub_080042BA(this, 2); - if (--this->field_0xf != 0xff) { + if (this->field_0xf-- != 0) { LinearMoveUpdate(this); return; } @@ -2464,7 +2464,7 @@ void sub_08072D54(Entity* this) { } /*static*/ void sub_08072F14(Entity* this) { - if (--this->actionDelay != 0xff) { + if (this->actionDelay-- != 0) { sub_0807921C(); } else { UpdateAnimationSingleFrame(this); @@ -3121,7 +3121,7 @@ void sub_08073B8C(Entity* this) { } void sub_08073C30(Entity* this) { - if (!gPlayerState.field_0x3[1] || --this->actionDelay == 0xFF) { + if (!gPlayerState.field_0x3[1] || this->actionDelay-- == 0) { sub_08073B60(this); } else { COLLISION_ON(this); diff --git a/src/playerItem/playerItemGustJar.c b/src/playerItem/playerItemGustJar.c index df29a22e..6c550694 100644 --- a/src/playerItem/playerItemGustJar.c +++ b/src/playerItem/playerItemGustJar.c @@ -68,7 +68,7 @@ void PlayerItemGustJar_Action2(Entity* this) { this->type = 2; } else { sub_080ADCDC(this, 1); - if (--this->actionDelay == 0xff) { + if (this->actionDelay-- == 0) { sub_080ADCA0(this, 0); this->type = 0; } diff --git a/src/projectile/gleerokProjectile.c b/src/projectile/gleerokProjectile.c index 8346d260..a3c82267 100644 --- a/src/projectile/gleerokProjectile.c +++ b/src/projectile/gleerokProjectile.c @@ -91,7 +91,7 @@ void GleerokProjectile_Action1(Entity* this) { } else { GetNextFrame(this); LinearMoveUpdate(this); - if ((this->type != 2) && (--this->field_0xf == 0xff)) { + if ((this->type != 2) && (this->field_0xf-- == 0)) { this->field_0xf = 0x1e; sub_08004596(this, GetFacingDirection(this, &gPlayerEntity)); } @@ -111,7 +111,7 @@ void GleerokProjectile_Action1(Entity* this) { void GleerokProjectile_Action2(Entity* this) { GetNextFrame(this); if (this->type == 2) { - if (--this->actionDelay == 0xff) { + if (this->actionDelay-- == 0) { COLLISION_OFF(this); this->action = 3; InitializeAnimation(this, 0x55); diff --git a/src/projectile/octorokBossProjectile.c b/src/projectile/octorokBossProjectile.c index 54ac6c32..54331d1c 100644 --- a/src/projectile/octorokBossProjectile.c +++ b/src/projectile/octorokBossProjectile.c @@ -175,7 +175,7 @@ void OctorokBossProjectile_Action1(Entity* this) { break; case 2: GetNextFrame(this); - if (--this->actionDelay != 0xff) { + if (this->actionDelay-- != 0) { LinearMoveAngle(this, this->speed, this->direction); return; }