Improve SpriteUtilMoveSpriteTowardsSamus

This commit is contained in:
YohannDR 2024-07-12 17:41:06 +02:00
parent 019eed3e11
commit aa0b03128c

View File

@ -2635,11 +2635,8 @@ void SpriteUtilMoveSpriteTowardsSamus(u16 samusY, u16 samusX, u8 ySpeed, u8 xSpe
}
else
{
gCurrentSprite.work1--;
if (gCurrentSprite.work1 != 0)
{
if (--gCurrentSprite.work1 != 0)
gCurrentSprite.xPosition += (gCurrentSprite.work1 >> speedDivisor);
}
else
flip++;
}
@ -2667,17 +2664,12 @@ void SpriteUtilMoveSpriteTowardsSamus(u16 samusY, u16 samusX, u8 ySpeed, u8 xSpe
else
{
gCurrentSprite.xPosition = newPos;
gCurrentSprite.yPosition += 0; // Needed to produce matching ASM.
}
}
}
else
{
u32 cond;
gCurrentSprite.work1--;
cond = gCurrentSprite.work1 != 0; // Needed to produce matching ASM.
if (cond)
if (--gCurrentSprite.work1 != 0)
{
speed = gCurrentSprite.work1 >> speedDivisor;
newPos = gCurrentSprite.xPosition - speed;
@ -2692,7 +2684,9 @@ void SpriteUtilMoveSpriteTowardsSamus(u16 samusY, u16 samusX, u8 ySpeed, u8 xSpe
}
}
else
{
flip++;
}
}
}
@ -2721,11 +2715,8 @@ void SpriteUtilMoveSpriteTowardsSamus(u16 samusY, u16 samusX, u8 ySpeed, u8 xSpe
}
else
{
gCurrentSprite.work0--;
if (gCurrentSprite.work0 != 0)
{
gCurrentSprite.yPosition += (gCurrentSprite.work0 >> speedDivisor);
}
if (--gCurrentSprite.work0 != 0)
gCurrentSprite.yPosition += gCurrentSprite.work0 >> speedDivisor;
else
flip++;
}
@ -2758,8 +2749,7 @@ void SpriteUtilMoveSpriteTowardsSamus(u16 samusY, u16 samusX, u8 ySpeed, u8 xSpe
}
else
{
gCurrentSprite.work0--;
if (gCurrentSprite.work0 != 0)
if (--gCurrentSprite.work0 != 0)
{
speed = gCurrentSprite.work0 >> speedDivisor;
newPos = gCurrentSprite.yPosition - speed;
@ -2774,7 +2764,9 @@ void SpriteUtilMoveSpriteTowardsSamus(u16 samusY, u16 samusX, u8 ySpeed, u8 xSpe
}
}
else
{
flip++;
}
}
}