Merge pull request #470 from hatal175/actiondelay

Change --x !=/== 0xff comparisons
This commit is contained in:
notyourav 2022-03-27 23:13:22 -07:00 committed by GitHub
commit ea34ee76f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 27 additions and 27 deletions

View File

@ -242,7 +242,7 @@ void sub_0802AB40(Entity* this) {
this->field_0xf = 0x4; this->field_0xf = 0x4;
this->field_0x80.HALF.LO ^= 1; this->field_0x80.HALF.LO ^= 1;
} }
} else if ((--this->field_0xf & 0xff) == 0) { } else if (--this->field_0xf == 0) {
sub_0802ACDC(this, 4); sub_0802ACDC(this, 4);
} }
} }

View File

@ -408,7 +408,7 @@ void sub_08046EF4(GyorgMaleEntity* this) {
super->direction ^= 0x80; super->direction ^= 0x80;
} }
super->speed = gUnk_080D1B74[(super->actionDelay >> 3) & 0xF]; super->speed = gUnk_080D1B74[(super->actionDelay >> 3) & 0xF];
if ((--super->field_0xf & 0xFF) == 0) { if (--super->field_0xf == 0) {
Entity* tmp; Entity* tmp;
super->field_0xf = (Random() & 0x38) + 0x78; super->field_0xf = (Random() & 0x38) + 0x78;
tmp = CreateProjectile(GYORG_MALE_ENERGY_PROJECTILE); tmp = CreateProjectile(GYORG_MALE_ENERGY_PROJECTILE);

View File

@ -59,7 +59,7 @@ void sub_080765E0(ItemBehavior* this, u32 arg1) {
void sub_0807660C(ItemBehavior* this, u32 arg1) { void sub_0807660C(ItemBehavior* this, u32 arg1) {
UpdateItemAnim(this); 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; gPlayerState.field_0x0[1] = 0;
DeletePlayerItem(this, arg1); DeletePlayerItem(this, arg1);
} }

View File

@ -153,7 +153,7 @@ void sub_080919AC(MinecartEntity* this) {
SoundReq(SFX_138); SoundReq(SFX_138);
} }
if (--super->field_0xf == 0xff) { if (super->field_0xf-- == 0) {
SoundReq(SFX_PLY_VO7); SoundReq(SFX_PLY_VO7);
super->field_0xf = 0x3c; super->field_0xf = 0x3c;
} }

View File

@ -71,7 +71,7 @@ void sub_08082098(Entity* this) {
if (this->animIndex != animIndex) { if (this->animIndex != animIndex) {
this->z.WORD = 0; this->z.WORD = 0;
this->actionDelay = 6; this->actionDelay = 6;
} else if (--this->actionDelay == 0xff) { } else if (this->actionDelay-- == 0) {
switch (this->spriteOffsetY) { switch (this->spriteOffsetY) {
case 0: case 0:
this->spriteOffsetY = -2; this->spriteOffsetY = -2;

View File

@ -52,7 +52,7 @@ void sub_08089BA0(Entity* this) {
return; return;
case 1: case 1:
case 2: case 2:
if (--this->actionDelay != 0xff) if (this->actionDelay-- != 0)
return; return;
if (this->type == 2) { if (this->type == 2) {
sub_0807B7D8(((u16*)this->child)[3], COORD_TO_TILE(this), this->collisionLayer); sub_0807B7D8(((u16*)this->child)[3], COORD_TO_TILE(this), this->collisionLayer);

View File

@ -217,7 +217,7 @@ void sub_0808F498(Entity* this) {
DeleteThisEntity(); DeleteThisEntity();
} }
if (--this->actionDelay == 0xFF) { if (this->actionDelay-- == 0) {
DeleteThisEntity(); DeleteThisEntity();
} }

View File

@ -95,7 +95,7 @@ void Object79_Action2(Object79Entity* this) {
this->objDir.WORD += this->unk74; this->objDir.WORD += this->unk74;
this->objDir.HALF.HI = DirectionNormalize(this->objDir.HALF.HI); this->objDir.HALF.HI = DirectionNormalize(this->objDir.HALF.HI);
this->unk74 += 0x140; this->unk74 += 0x140;
if (--super->field_0xf == 0xff) { if (super->field_0xf-- == 0) {
super->field_0xf = 30; super->field_0xf = 30;
super->actionDelay ^= 1; super->actionDelay ^= 1;
} }

View File

@ -170,7 +170,7 @@ void sub_08082614(Entity* this) {
u32 tileType; u32 tileType;
sub_0800445C(this); sub_0800445C(this);
if (--this->actionDelay != 0xFF) { if (this->actionDelay-- != 0) {
LinearMoveUpdate(this); LinearMoveUpdate(this);
sub_08016A6C(this); sub_08016A6C(this);
return; return;

View File

@ -199,7 +199,7 @@ void sub_0808ADF0(PullableMushroomEntity* this) {
SoundReq(SFX_12E); SoundReq(SFX_12E);
} else { } else {
GetNextFrame(super); 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); InitializeAnimation(super, super->animationState + 0xd);
} }
} }
@ -226,7 +226,7 @@ void sub_0808AEB0(PullableMushroomEntity* this) {
GetNextFrame(super); GetNextFrame(super);
if (uVar1 < 0x40) { if (uVar1 < 0x40) {
sub_080044AE(&gPlayerEntity, 0x40, super->direction); sub_080044AE(&gPlayerEntity, 0x40, super->direction);
if (--this->unk_7c == 0xffffffff) { if (this->unk_7c-- == 0) {
this->unk_7c = 4; this->unk_7c = 4;
SoundReq(SFX_12F); SoundReq(SFX_12F);
} }

View File

@ -723,7 +723,7 @@ static void PlayerBounceUpdate(Entity* this) {
return; return;
} }
if (--this->actionDelay != 0xFF) { if (this->actionDelay-- != 0) {
this->zVelocity = Q_16_16(1.0); this->zVelocity = Q_16_16(1.0);
return; return;
} }
@ -969,7 +969,7 @@ static void sub_08071208(Entity* this) {
} }
} }
if (--this->actionDelay == 0xff) { if (this->actionDelay-- == 0) {
gPlayerState.jump_status = 0; gPlayerState.jump_status = 0;
ResetPlayerAnimationAndAction(); ResetPlayerAnimationAndAction();
} }
@ -1114,7 +1114,7 @@ static void PortalStandUpdate(Entity* this) {
if (this->direction != gPlayerState.field_0xd) { if (this->direction != gPlayerState.field_0xd) {
this->actionDelay = 8; this->actionDelay = 8;
} }
if (--this->actionDelay == 0xff) { if (this->actionDelay-- == 0) {
this->direction = gPlayerState.field_0xd; this->direction = gPlayerState.field_0xd;
this->animationState = Direction8ToAnimationState(this->direction); this->animationState = Direction8ToAnimationState(this->direction);
this->zVelocity = Q_16_16(2.0); this->zVelocity = Q_16_16(2.0);
@ -1796,7 +1796,7 @@ static void sub_08072064(Entity* this) {
static void sub_08072098(Entity* this) { static void sub_08072098(Entity* this) {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
if (this->actionDelay != 0) if (this->actionDelay != 0)
if (--this->actionDelay != 0xFF) if (this->actionDelay-- != 0)
return; return;
else else
; ;
@ -1850,7 +1850,7 @@ static void sub_08072168(Entity* this) {
} }
gPlayerState.field_0xd = this->direction; gPlayerState.field_0xd = this->direction;
UpdatePlayerCollision(); UpdatePlayerCollision();
if (--this->actionDelay == 0xff) { if (this->actionDelay-- == 0) {
this->knockbackDuration = 0; this->knockbackDuration = 0;
COLLISION_ON(this); COLLISION_ON(this);
UpdateSpriteForCollisionLayer(this); UpdateSpriteForCollisionLayer(this);
@ -1954,7 +1954,7 @@ static void sub_08072354(Entity* this) {
static void sub_080723D0(Entity* this) { static void sub_080723D0(Entity* this) {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
if (--this->actionDelay == 0xff) { if (this->actionDelay-- == 0) {
this->spritePriority.b1 = 1; this->spritePriority.b1 = 1;
this->iframes = 20; this->iframes = 20;
ModHealth(-2); ModHealth(-2);
@ -1963,7 +1963,7 @@ static void sub_080723D0(Entity* this) {
} }
static void sub_0807240C(Entity* this) { static void sub_0807240C(Entity* this) {
if (--this->knockbackDuration == 0xff) { if (this->knockbackDuration-- == 0) {
this->spriteSettings.draw = 3; this->spriteSettings.draw = 3;
this->iframes = 20; this->iframes = 20;
gPlayerState.flags &= ~PL_BURNING; gPlayerState.flags &= ~PL_BURNING;
@ -1989,7 +1989,7 @@ static void sub_0807246C(Entity* this) {
} }
static void sub_08072490(Entity* this) { static void sub_08072490(Entity* this) {
if (--this->actionDelay != 0xff) { if (this->actionDelay-- != 0) {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
UpdatePlayerMovement(); UpdatePlayerMovement();
} else { } else {
@ -2111,7 +2111,7 @@ static void PlayerRollUpdate(Entity* this) {
} }
this->direction = Direction8FromAnimationState(AnimationStateIdle(this->animationState)); 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); CreateFx(&gPlayerEntity, FX_DASH, 0x40);
this->actionDelay = 4; this->actionDelay = 4;
} }
@ -2355,7 +2355,7 @@ static void sub_08072CC0(Entity* this) {
static void sub_08072CFC(Entity* this) { static void sub_08072CFC(Entity* this) {
sub_080042BA(this, 2); sub_080042BA(this, 2);
if (--this->field_0xf != 0xff) { if (this->field_0xf-- != 0) {
LinearMoveUpdate(this); LinearMoveUpdate(this);
return; return;
} }
@ -2464,7 +2464,7 @@ void sub_08072D54(Entity* this) {
} }
/*static*/ void sub_08072F14(Entity* this) { /*static*/ void sub_08072F14(Entity* this) {
if (--this->actionDelay != 0xff) { if (this->actionDelay-- != 0) {
sub_0807921C(); sub_0807921C();
} else { } else {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
@ -3121,7 +3121,7 @@ void sub_08073B8C(Entity* this) {
} }
void sub_08073C30(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); sub_08073B60(this);
} else { } else {
COLLISION_ON(this); COLLISION_ON(this);

View File

@ -68,7 +68,7 @@ void PlayerItemGustJar_Action2(Entity* this) {
this->type = 2; this->type = 2;
} else { } else {
sub_080ADCDC(this, 1); sub_080ADCDC(this, 1);
if (--this->actionDelay == 0xff) { if (this->actionDelay-- == 0) {
sub_080ADCA0(this, 0); sub_080ADCA0(this, 0);
this->type = 0; this->type = 0;
} }

View File

@ -91,7 +91,7 @@ void GleerokProjectile_Action1(Entity* this) {
} else { } else {
GetNextFrame(this); GetNextFrame(this);
LinearMoveUpdate(this); LinearMoveUpdate(this);
if ((this->type != 2) && (--this->field_0xf == 0xff)) { if ((this->type != 2) && (this->field_0xf-- == 0)) {
this->field_0xf = 0x1e; this->field_0xf = 0x1e;
sub_08004596(this, GetFacingDirection(this, &gPlayerEntity)); sub_08004596(this, GetFacingDirection(this, &gPlayerEntity));
} }
@ -111,7 +111,7 @@ void GleerokProjectile_Action1(Entity* this) {
void GleerokProjectile_Action2(Entity* this) { void GleerokProjectile_Action2(Entity* this) {
GetNextFrame(this); GetNextFrame(this);
if (this->type == 2) { if (this->type == 2) {
if (--this->actionDelay == 0xff) { if (this->actionDelay-- == 0) {
COLLISION_OFF(this); COLLISION_OFF(this);
this->action = 3; this->action = 3;
InitializeAnimation(this, 0x55); InitializeAnimation(this, 0x55);

View File

@ -175,7 +175,7 @@ void OctorokBossProjectile_Action1(Entity* this) {
break; break;
case 2: case 2:
GetNextFrame(this); GetNextFrame(this);
if (--this->actionDelay != 0xff) { if (this->actionDelay-- != 0) {
LinearMoveAngle(this, this->speed, this->direction); LinearMoveAngle(this, this->speed, this->direction);
return; return;
} }