Match kraid, improve a few functions

This commit is contained in:
YohannDR 2024-07-29 18:19:56 +02:00
parent b57868f77a
commit de305c3ed5
11 changed files with 190 additions and 637 deletions

View File

@ -2,7 +2,7 @@
This is a work in progress decompilation of Metroid - Zero Mission. This is a work in progress decompilation of Metroid - Zero Mission.
2703/2721 functions decompiled (99.34%, 18 left) 2704/2721 functions decompiled (99.38%, 17 left)
0x76b014/0x76b014 bytes of data not in blobs (100%, 0 left) 0x76b014/0x76b014 bytes of data not in blobs (100%, 0 left)

View File

@ -48,6 +48,8 @@ struct FrameData {
.timer = 0\ .timer = 0\
} }
#define FRAME_DATA_LAST_ANIM_FRAME(oam) (ARRAY_SIZE((oam)) - 2)
union OamData { union OamData {
struct { struct {
/*0x00*/ u32 y:8; /*0x00*/ u32 y:8;

View File

@ -7,7 +7,7 @@
#define BOSS_STATUE_POSE_OPENING 0xB #define BOSS_STATUE_POSE_OPENING 0xB
#define BOSS_STATUE_POSE_IDLE 0xF #define BOSS_STATUE_POSE_IDLE 0xF
void BossStatueVerticalLignChangeCcaa(u8 caa); void BossStatusSetWallBehindSamusCollision(u8 caa);
void KraidStatueHorizontalLignThreeChangeCcaa(u8 caa); void KraidStatueHorizontalLignThreeChangeCcaa(u8 caa);
void KraidStatueInsideChangeCcaa(u8 caa); void KraidStatueInsideChangeCcaa(u8 caa);
void KraidStatueOpenedInit(void); void KraidStatueOpenedInit(void);

View File

@ -929,7 +929,6 @@ void CutsceneUpdateSpecialEffect(void)
void CutsceneStartSpriteEffect(u16 bldcnt, u8 bldy, u32 interval, u8 intensity) void CutsceneStartSpriteEffect(u16 bldcnt, u8 bldy, u32 interval, u8 intensity)
{ {
u8 _interval; u8 _interval;
u8* ptr;
CUTSCENE_DATA.specialEffect.status &= ~CUTSCENE_SPECIAL_EFFECT_STATUS_SPRITE_ENDED; CUTSCENE_DATA.specialEffect.status &= ~CUTSCENE_SPECIAL_EFFECT_STATUS_SPRITE_ENDED;
CUTSCENE_DATA.specialEffect.status |= CUTSCENE_SPECIAL_EFFECT_STATUS_ON_SPRITE; CUTSCENE_DATA.specialEffect.status |= CUTSCENE_SPECIAL_EFFECT_STATUS_ON_SPRITE;
@ -937,11 +936,12 @@ void CutsceneStartSpriteEffect(u16 bldcnt, u8 bldy, u32 interval, u8 intensity)
CUTSCENE_DATA.specialEffect.s_WrittenToBLDY = bldy; CUTSCENE_DATA.specialEffect.s_WrittenToBLDY = bldy;
CUTSCENE_DATA.specialEffect.s_Intensity = intensity; CUTSCENE_DATA.specialEffect.s_Intensity = intensity;
// The following code is written like that to produce matching ASM: if (CUTSCENE_DATA.specialEffect.s_Interval)
ptr = &CUTSCENE_DATA.specialEffect.s_Interval; {
_interval = interval; }
*ptr = _interval;
_interval = interval;
CUTSCENE_DATA.specialEffect.s_Interval = _interval;
CUTSCENE_DATA.specialEffect.s_Timer = _interval; CUTSCENE_DATA.specialEffect.s_Timer = _interval;
CUTSCENE_DATA.bldcnt = CUTSCENE_DATA.specialEffect.s_Bldcnt = bldcnt; CUTSCENE_DATA.bldcnt = CUTSCENE_DATA.specialEffect.s_Bldcnt = bldcnt;
@ -959,7 +959,6 @@ void CutsceneStartSpriteEffect(u16 bldcnt, u8 bldy, u32 interval, u8 intensity)
void CutsceneStartBackgroundEffect(u16 bldcnt, u8 bldalphaL, u8 bldalphaH, u32 interval, u8 intensity) void CutsceneStartBackgroundEffect(u16 bldcnt, u8 bldalphaL, u8 bldalphaH, u32 interval, u8 intensity)
{ {
u8 _interval; u8 _interval;
u8* ptr;
CUTSCENE_DATA.specialEffect.status &= ~CUTSCENE_SPECIAL_EFFECT_STATUS_BG_ENDED; CUTSCENE_DATA.specialEffect.status &= ~CUTSCENE_SPECIAL_EFFECT_STATUS_BG_ENDED;
CUTSCENE_DATA.specialEffect.status |= CUTSCENE_SPECIAL_EFFECT_STATUS_ON_BG; CUTSCENE_DATA.specialEffect.status |= CUTSCENE_SPECIAL_EFFECT_STATUS_ON_BG;
@ -968,11 +967,12 @@ void CutsceneStartBackgroundEffect(u16 bldcnt, u8 bldalphaL, u8 bldalphaH, u32 i
CUTSCENE_DATA.specialEffect.bg_WrittenToBldalpha_H = bldalphaH; CUTSCENE_DATA.specialEffect.bg_WrittenToBldalpha_H = bldalphaH;
CUTSCENE_DATA.specialEffect.bg_Intensity = intensity; CUTSCENE_DATA.specialEffect.bg_Intensity = intensity;
// The following code is written like that to produce matching ASM: if (CUTSCENE_DATA.specialEffect.bg_Interval)
ptr = &CUTSCENE_DATA.specialEffect.bg_Interval; {
_interval = interval; }
*ptr = _interval;
_interval = interval;
CUTSCENE_DATA.specialEffect.bg_Interval = _interval;
CUTSCENE_DATA.specialEffect.bg_Timer = _interval; CUTSCENE_DATA.specialEffect.bg_Timer = _interval;
CUTSCENE_DATA.specialEffect.bg_WrittenToBLDCNT = bldcnt; CUTSCENE_DATA.specialEffect.bg_WrittenToBLDCNT = bldcnt;

View File

@ -43,24 +43,24 @@
u32 unk_68168(u16 param_1, u8 param_2, s8 param_3) u32 unk_68168(u16 param_1, u8 param_2, s8 param_3)
{ {
s32 _param_3 = param_3; s32 _param_3 = param_3;
u32 _uselessVarForMatching = !sNonGameplayRamPointer;
if (!PAUSE_SCREEN_DATA.unk_7C && param_2 != 0)
{
PAUSE_SCREEN_DATA.unk_7C++;
PAUSE_SCREEN_DATA.unk_7D = param_2; if (PAUSE_SCREEN_DATA.unk_7C)
PAUSE_SCREEN_DATA.unk_7F = _param_3; return FALSE;
PAUSE_SCREEN_DATA.unk_80 = 0x1F & param_1; if (param_2 == 0)
PAUSE_SCREEN_DATA.unk_81 = _uselessVarForMatching = (param_1 >> 8) & 0x1F; return FALSE;
PAUSE_SCREEN_DATA.unk_7E = 0; PAUSE_SCREEN_DATA.unk_7C++;
return TRUE; PAUSE_SCREEN_DATA.unk_7D = param_2;
} PAUSE_SCREEN_DATA.unk_7F = _param_3;
return FALSE; PAUSE_SCREEN_DATA.unk_80 = param_1 & 0x1F;
PAUSE_SCREEN_DATA.unk_81 = (param_1 >> 8) & 0x1F;
PAUSE_SCREEN_DATA.unk_7E = 0;
return TRUE;
} }
/** /**

View File

@ -993,15 +993,11 @@ void ProjectileSetTrail(struct ProjectileData* pProj, u8 effect, u8 delay)
u16 xPosition; u16 xPosition;
u16 yPosition; u16 yPosition;
u16 movement; u16 movement;
u16 diagMovement;
u32 tmp1;
u32 tmp2;
if (gFrameCounter8Bit & delay) if (gFrameCounter8Bit & delay)
return; return;
movement = HALF_BLOCK_SIZE; movement = HALF_BLOCK_SIZE;
diagMovement = QUARTER_BLOCK_SIZE + EIGHTH_BLOCK_SIZE;
yPosition = pProj->yPosition; yPosition = pProj->yPosition;
xPosition = pProj->xPosition; xPosition = pProj->xPosition;
@ -1017,25 +1013,21 @@ void ProjectileSetTrail(struct ProjectileData* pProj, u8 effect, u8 delay)
break; break;
case ACD_DIAGONALLY_UP: case ACD_DIAGONALLY_UP:
tmp1 = BLOCK_SIZE; yPosition += FRACT_MUL(movement, 3, 4);
yPosition += diagMovement;
if (pProj->status & PROJ_STATUS_XFLIP) if (pProj->status & PROJ_STATUS_XFLIP)
xPosition -= diagMovement; xPosition -= FRACT_MUL(movement, 3, 4);
else else
xPosition += diagMovement; xPosition += FRACT_MUL(movement, 3, 4);
movement = tmp1;
break; break;
case ACD_DIAGONALLY_DOWN: case ACD_DIAGONALLY_DOWN:
tmp2 = BLOCK_SIZE; yPosition -= FRACT_MUL(movement, 3, 4);
yPosition -= diagMovement;
if (pProj->status & PROJ_STATUS_XFLIP) if (pProj->status & PROJ_STATUS_XFLIP)
xPosition -= diagMovement; xPosition -= FRACT_MUL(movement, 3, 4);
else else
xPosition += diagMovement; xPosition += FRACT_MUL(movement, 3, 4);
movement = tmp2;
break; break;
default: default:
@ -1062,7 +1054,7 @@ void ProjectileMoveTumbling(struct ProjectileData* pProj)
if (!(pProj->status & PROJ_STATUS_ON_SCREEN)) if (!(pProj->status & PROJ_STATUS_ON_SCREEN))
{ {
pProj->status = 0x0; pProj->status = 0;
return; return;
} }

View File

@ -107,7 +107,7 @@ s32 ScreenShakeUpdateVertical(void)
gScreenShakeY.direction ^= TRUE; gScreenShakeY.direction ^= TRUE;
if (gScreenShakeY.timer < 16) if (gScreenShakeY.timer < 16)
offset >>= 1; offset = DIV_SHIFT(offset, 2);
gScreenShakeYOffset = offset; gScreenShakeYOffset = offset;
@ -153,7 +153,7 @@ s32 ScreenShakeUpdateHorizontal(void)
gScreenShakeX.direction ^= TRUE; gScreenShakeX.direction ^= TRUE;
if (gScreenShakeX.timer < 16) if (gScreenShakeX.timer < 16)
offset >>= 1; offset = DIV_SHIFT(offset, 2);
gScreenShakeXOffset = offset; gScreenShakeXOffset = offset;

View File

@ -17,6 +17,7 @@
#include "structs/sprite.h" #include "structs/sprite.h"
#define JUMPING_X_VELOCITY (PIXEL_SIZE * 2 + PIXEL_SIZE / 2) #define JUMPING_X_VELOCITY (PIXEL_SIZE * 2 + PIXEL_SIZE / 2)
#define WALKING_SPEED (ONE_SUB_PIXEL * 3)
/** /**
* @brief 47600 | 20 | Checks if samus is near the baristute (8 blocks range on each side) * @brief 47600 | 20 | Checks if samus is near the baristute (8 blocks range on each side)
@ -102,10 +103,11 @@ void BaristuteCheckBeforeJumpingAnimEnded(void)
xPosition = gCurrentSprite.xPosition; xPosition = gCurrentSprite.xPosition;
// Check if there's still ground under the baristute // Check if there's still ground under the baristute
if (SpriteUtilGetCollisionAtPosition(yPosition, xPosition + gCurrentSprite.hitboxRightOffset) == COLLISION_AIR if (SpriteUtilGetCollisionAtPosition(yPosition, xPosition + gCurrentSprite.hitboxRightOffset) == COLLISION_AIR &&
&& SpriteUtilGetCollisionAtPosition(yPosition, xPosition + gCurrentSprite.hitboxLeftOffset) == COLLISION_AIR) SpriteUtilGetCollisionAtPosition(yPosition, xPosition + gCurrentSprite.hitboxLeftOffset) == COLLISION_AIR)
{ {
gCurrentSprite.pose = BARISTUTE_POSE_FALLING_INIT; // Set falling // Set falling
gCurrentSprite.pose = BARISTUTE_POSE_FALLING_INIT;
return; return;
} }
@ -130,7 +132,7 @@ void BaristuteCheckBeforeJumpingAnimEnded(void)
void BaristuteJumping(void) void BaristuteJumping(void)
{ {
s32 movement; s32 movement;
u32 topEdge; u32 blockTop;
movement = sBaristuteJumpingYVelocity[gCurrentSprite.work3 / 4]; movement = sBaristuteJumpingYVelocity[gCurrentSprite.work3 / 4];
@ -174,13 +176,13 @@ void BaristuteJumping(void)
if (gCurrentSprite.work3 < ARRAY_SIZE(sBaristuteJumpingYVelocity) * 4 - 1) if (gCurrentSprite.work3 < ARRAY_SIZE(sBaristuteJumpingYVelocity) * 4 - 1)
gCurrentSprite.work3++; gCurrentSprite.work3++;
if (movement >= 1) if (movement > 0)
{ {
// Check landing if velocity is positive // Check landing if velocity is positive
topEdge = SpriteUtilCheckVerticalCollisionAtPositionSlopes(gCurrentSprite.yPosition, gCurrentSprite.xPosition); blockTop = SpriteUtilCheckVerticalCollisionAtPositionSlopes(gCurrentSprite.yPosition, gCurrentSprite.xPosition);
if (gPreviousVerticalCollisionCheck != COLLISION_AIR) if (gPreviousVerticalCollisionCheck != COLLISION_AIR)
{ {
gCurrentSprite.yPosition = topEdge; gCurrentSprite.yPosition = blockTop;
gCurrentSprite.pose = BARISTUTE_POSE_LANDING_INIT; gCurrentSprite.pose = BARISTUTE_POSE_LANDING_INIT;
} }
} }
@ -234,6 +236,7 @@ void BaristuteIdleInit(void)
gCurrentSprite.animationDurationCounter = 0; gCurrentSprite.animationDurationCounter = 0;
gCurrentSprite.currentAnimationFrame = 0; gCurrentSprite.currentAnimationFrame = 0;
// Random variable to determine behavior after being idle
gCurrentSprite.work1 = MOD_AND(gSpriteRng, 4); gCurrentSprite.work1 = MOD_AND(gSpriteRng, 4);
} }
@ -249,40 +252,48 @@ void BaristuteIdle(void)
yPosition = gCurrentSprite.yPosition; yPosition = gCurrentSprite.yPosition;
xPosition = gCurrentSprite.xPosition; xPosition = gCurrentSprite.xPosition;
if (SpriteUtilGetCollisionAtPosition(yPosition, xPosition + gCurrentSprite.hitboxRightOffset) == COLLISION_AIR // Check if there's still ground under the baristute
&& SpriteUtilGetCollisionAtPosition(yPosition, xPosition + gCurrentSprite.hitboxLeftOffset) == COLLISION_AIR) if (SpriteUtilGetCollisionAtPosition(yPosition, xPosition + gCurrentSprite.hitboxRightOffset) == COLLISION_AIR &&
SpriteUtilGetCollisionAtPosition(yPosition, xPosition + gCurrentSprite.hitboxLeftOffset) == COLLISION_AIR)
{ {
// Set falling
gCurrentSprite.pose = BARISTUTE_POSE_FALLING_INIT; gCurrentSprite.pose = BARISTUTE_POSE_FALLING_INIT;
return; return;
} }
// Wait for the idle animatio to end
if (!SpriteUtilCheckNearEndCurrentSpriteAnim()) if (!SpriteUtilCheckNearEndCurrentSpriteAnim())
return; return;
// Face samus
SpriteUtilMakeSpriteFaceSamusDirection(); SpriteUtilMakeSpriteFaceSamusDirection();
if (gCurrentSprite.status & SPRITE_STATUS_FACING_RIGHT) if (gCurrentSprite.status & SPRITE_STATUS_FACING_RIGHT)
gCurrentSprite.status |= SPRITE_STATUS_XFLIP; gCurrentSprite.status |= SPRITE_STATUS_XFLIP;
else else
gCurrentSprite.status &= ~SPRITE_STATUS_XFLIP; gCurrentSprite.status &= ~SPRITE_STATUS_XFLIP;
// Check should walk or jump, get the collision in front of the baristute
if ((gCurrentSprite.status & SPRITE_STATUS_FACING_RIGHT if ((gCurrentSprite.status & SPRITE_STATUS_FACING_RIGHT
? SpriteUtilGetCollisionAtPosition(yPosition - QUARTER_BLOCK_SIZE, xPosition + gCurrentSprite.hitboxRightOffset + QUARTER_BLOCK_SIZE) ? SpriteUtilGetCollisionAtPosition(yPosition - QUARTER_BLOCK_SIZE, xPosition + gCurrentSprite.hitboxRightOffset + QUARTER_BLOCK_SIZE)
: SpriteUtilGetCollisionAtPosition(yPosition - QUARTER_BLOCK_SIZE, xPosition + gCurrentSprite.hitboxLeftOffset - QUARTER_BLOCK_SIZE)) == COLLISION_AIR) : SpriteUtilGetCollisionAtPosition(yPosition - QUARTER_BLOCK_SIZE, xPosition + gCurrentSprite.hitboxLeftOffset - QUARTER_BLOCK_SIZE)) == COLLISION_AIR)
{ {
if (gCurrentSprite.spriteId == PSPRITE_BARISTUTE_KRAID_UPPER) if (gCurrentSprite.spriteId == PSPRITE_BARISTUTE_KRAID_UPPER)
{ {
// The upper kraid baristute can't jump, so always walk
gCurrentSprite.pose = BARISTUTE_POSE_WALKING_INIT; gCurrentSprite.pose = BARISTUTE_POSE_WALKING_INIT;
} }
else if (gCurrentSprite.spriteId != PSPRITE_BARISTUTE_KRAID_LOWER) else if (gCurrentSprite.spriteId == PSPRITE_BARISTUTE_KRAID_LOWER)
{ {
if (gCurrentSprite.work1 > 1) // The upper kraid baristute can't walk, so always jump
gCurrentSprite.pose = BARISTUTE_POSE_WALKING_INIT; gCurrentSprite.pose = BARISTUTE_POSE_JUMP_WARNING_INIT;
else
gCurrentSprite.pose = BARISTUTE_POSE_JUMP_WARNING_INIT;
} }
else else
{ {
gCurrentSprite.pose = BARISTUTE_POSE_JUMP_WARNING_INIT; // Is a normal baristute, so have random behavior, 50/50 to either wlak or jump
if (gCurrentSprite.work1 >= 2)
gCurrentSprite.pose = BARISTUTE_POSE_WALKING_INIT;
else
gCurrentSprite.pose = BARISTUTE_POSE_JUMP_WARNING_INIT;
} }
} }
} }
@ -306,22 +317,22 @@ void BaristuteWalkingInit(void)
if (paletteRow == 1) if (paletteRow == 1)
{ {
gCurrentSprite.pOam = sBaristuteOam_WalkingFast; gCurrentSprite.pOam = sBaristuteOam_WalkingFast;
gCurrentSprite.work2 = PIXEL_SIZE + PIXEL_SIZE / 2; gCurrentSprite.work2 = WALKING_SPEED * 2;
} }
else if (paletteRow == 2) else if (paletteRow == 2)
{ {
gCurrentSprite.pOam = sBaristuteOam_WalkingVeryFast; gCurrentSprite.pOam = sBaristuteOam_WalkingVeryFast;
gCurrentSprite.work2 = PIXEL_SIZE * 2; gCurrentSprite.work2 = WALKING_SPEED * 2.8f;
} }
else if (paletteRow == 3) else if (paletteRow == 3)
{ {
gCurrentSprite.pOam = sBaristuteOam_WalkingExtremelyFast; gCurrentSprite.pOam = sBaristuteOam_WalkingExtremelyFast;
gCurrentSprite.work2 = PIXEL_SIZE * 2 + PIXEL_SIZE / 2; gCurrentSprite.work2 = WALKING_SPEED * 3.5f;
} }
else else
{ {
gCurrentSprite.pOam = sBaristuteOam_WalkingSlow; gCurrentSprite.pOam = sBaristuteOam_WalkingSlow;
gCurrentSprite.work2 = PIXEL_SIZE / 4 * 3; gCurrentSprite.work2 = WALKING_SPEED * 1;
} }
} }
@ -333,7 +344,7 @@ void BaristutePlayWalkingSound(void)
{ {
if (gCurrentSprite.animationDurationCounter == 1 && (gCurrentSprite.currentAnimationFrame == 1 || gCurrentSprite.currentAnimationFrame == 4)) if (gCurrentSprite.animationDurationCounter == 1 && (gCurrentSprite.currentAnimationFrame == 1 || gCurrentSprite.currentAnimationFrame == 4))
{ {
if (gCurrentSprite.work2 <= PIXEL_SIZE + PIXEL_SIZE / 2) if (gCurrentSprite.work2 <= WALKING_SPEED * 2)
{ {
// Slow or fast // Slow or fast
if (gCurrentSprite.status & SPRITE_STATUS_ONSCREEN) if (gCurrentSprite.status & SPRITE_STATUS_ONSCREEN)
@ -368,8 +379,8 @@ void BaristuteWalking(void)
if (gCurrentSprite.status & SPRITE_STATUS_FACING_RIGHT) if (gCurrentSprite.status & SPRITE_STATUS_FACING_RIGHT)
{ {
// Check collision // Check collision
if (SpriteUtilGetCollisionAtPosition(gCurrentSprite.yPosition - QUARTER_BLOCK_SIZE, gCurrentSprite.xPosition + gCurrentSprite.hitboxRightOffset + PIXEL_SIZE) == COLLISION_AIR if (SpriteUtilGetCollisionAtPosition(gCurrentSprite.yPosition - QUARTER_BLOCK_SIZE, gCurrentSprite.xPosition + gCurrentSprite.hitboxRightOffset + PIXEL_SIZE) == COLLISION_AIR &&
&& SpriteUtilGetCollisionAtPosition(gCurrentSprite.yPosition, gCurrentSprite.xPosition + gCurrentSprite.hitboxRightOffset + PIXEL_SIZE) == COLLISION_SOLID) SpriteUtilGetCollisionAtPosition(gCurrentSprite.yPosition, gCurrentSprite.xPosition + gCurrentSprite.hitboxRightOffset + PIXEL_SIZE) == COLLISION_SOLID)
{ {
currentDistance = gCurrentSprite.xPosition - gCurrentSprite.xPositionSpawn; currentDistance = gCurrentSprite.xPosition - gCurrentSprite.xPositionSpawn;
if (currentDistance > walkingDistance) if (currentDistance > walkingDistance)
@ -394,8 +405,8 @@ void BaristuteWalking(void)
else else
{ {
// Check collision // Check collision
if (SpriteUtilGetCollisionAtPosition(gCurrentSprite.yPosition - QUARTER_BLOCK_SIZE, gCurrentSprite.xPosition + gCurrentSprite.hitboxLeftOffset - PIXEL_SIZE) == COLLISION_AIR if (SpriteUtilGetCollisionAtPosition(gCurrentSprite.yPosition - QUARTER_BLOCK_SIZE, gCurrentSprite.xPosition + gCurrentSprite.hitboxLeftOffset - PIXEL_SIZE) == COLLISION_AIR &&
&& SpriteUtilGetCollisionAtPosition(gCurrentSprite.yPosition, gCurrentSprite.xPosition + gCurrentSprite.hitboxLeftOffset - PIXEL_SIZE) == COLLISION_SOLID) SpriteUtilGetCollisionAtPosition(gCurrentSprite.yPosition, gCurrentSprite.xPosition + gCurrentSprite.hitboxLeftOffset - PIXEL_SIZE) == COLLISION_SOLID)
{ {
currentDistance = gCurrentSprite.xPositionSpawn - gCurrentSprite.xPosition; currentDistance = gCurrentSprite.xPositionSpawn - gCurrentSprite.xPosition;
if (currentDistance > walkingDistance) if (currentDistance > walkingDistance)
@ -439,16 +450,16 @@ void BaristuteFallingInit(void)
*/ */
void BaristuteFalling(void) void BaristuteFalling(void)
{ {
u32 topEdge; u32 blockTop;
s32 velocity; s32 velocity;
u8 offset; u8 offset;
topEdge = SpriteUtilCheckVerticalCollisionAtPositionSlopes(gCurrentSprite.yPosition, gCurrentSprite.xPosition); blockTop = SpriteUtilCheckVerticalCollisionAtPositionSlopes(gCurrentSprite.yPosition, gCurrentSprite.xPosition);
if (gPreviousVerticalCollisionCheck != COLLISION_AIR) if (gPreviousVerticalCollisionCheck != COLLISION_AIR)
{ {
// Touching ground // Touching ground
gCurrentSprite.yPosition = topEdge; gCurrentSprite.yPosition = blockTop;
gCurrentSprite.pose = BARISTUTE_POSE_LANDING_INIT; gCurrentSprite.pose = BARISTUTE_POSE_LANDING_INIT;
} }
else else
@ -486,7 +497,7 @@ void BaristuteDeath(void)
// Check for the second baristute in Kraid // Check for the second baristute in Kraid
// Get sprite ID // Get sprite ID
spriteId = 0; spriteId = PSPRITE_UNUSED0;
if (gCurrentSprite.spriteId == PSPRITE_BARISTUTE_KRAID_UPPER) if (gCurrentSprite.spriteId == PSPRITE_BARISTUTE_KRAID_UPPER)
spriteId = PSPRITE_BARISTUTE_KRAID_LOWER; spriteId = PSPRITE_BARISTUTE_KRAID_LOWER;
else if (gCurrentSprite.spriteId == PSPRITE_BARISTUTE_KRAID_LOWER) else if (gCurrentSprite.spriteId == PSPRITE_BARISTUTE_KRAID_LOWER)

View File

@ -21,11 +21,11 @@
#include "structs/game_state.h" #include "structs/game_state.h"
/** /**
* @brief 49184 | 80 | Changes the clipdata of a 6 blocks vertical lign * @brief 49184 | 80 | Sets the collision of the wall behind Samus to lock here in the screen
* *
* @param caa Clipdata Affecting Action * @param caa Clipdata Affecting Action
*/ */
void BossStatueVerticalLignChangeCcaa(u8 caa) void BossStatusSetWallBehindSamusCollision(u8 caa)
{ {
u16 yPosition; u16 yPosition;
u16 xPosition; u16 xPosition;
@ -34,17 +34,22 @@ void BossStatueVerticalLignChangeCcaa(u8 caa)
xPosition = gCurrentSprite.xPosition + HALF_BLOCK_SIZE; xPosition = gCurrentSprite.xPosition + HALF_BLOCK_SIZE;
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition, xPosition + (BLOCK_SIZE * 8)); ClipdataProcess(yPosition - BLOCK_SIZE * 0, xPosition + BLOCK_SIZE * 8);
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - BLOCK_SIZE, xPosition + (BLOCK_SIZE * 8)); ClipdataProcess(yPosition - BLOCK_SIZE * 1, xPosition + BLOCK_SIZE * 8);
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - (BLOCK_SIZE * 2), xPosition + (BLOCK_SIZE * 8)); ClipdataProcess(yPosition - BLOCK_SIZE * 2, xPosition + BLOCK_SIZE * 8);
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - (BLOCK_SIZE * 3), xPosition + (BLOCK_SIZE * 8)); ClipdataProcess(yPosition - BLOCK_SIZE * 3, xPosition + BLOCK_SIZE * 8);
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - (BLOCK_SIZE * 4), xPosition + (BLOCK_SIZE * 8)); ClipdataProcess(yPosition - BLOCK_SIZE * 4, xPosition + BLOCK_SIZE * 8);
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - (BLOCK_SIZE * 5), xPosition + (BLOCK_SIZE * 8)); ClipdataProcess(yPosition - BLOCK_SIZE * 5, xPosition + BLOCK_SIZE * 8);
} }
/** /**
@ -62,8 +67,10 @@ void KraidStatueHorizontalLignThreeChangeCcaa(u8 caa)
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - BLOCK_SIZE * 4, xPosition + BLOCK_SIZE * 2); ClipdataProcess(yPosition - BLOCK_SIZE * 4, xPosition + BLOCK_SIZE * 2);
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - BLOCK_SIZE * 4, xPosition + BLOCK_SIZE * 3); ClipdataProcess(yPosition - BLOCK_SIZE * 4, xPosition + BLOCK_SIZE * 3);
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - BLOCK_SIZE * 4, xPosition + BLOCK_SIZE * 4); ClipdataProcess(yPosition - BLOCK_SIZE * 4, xPosition + BLOCK_SIZE * 4);
} }
@ -82,20 +89,26 @@ void KraidStatueInsideChangeCcaa(u8 caa)
xPosition = gCurrentSprite.xPosition + HALF_BLOCK_SIZE; xPosition = gCurrentSprite.xPosition + HALF_BLOCK_SIZE;
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - BLOCK_SIZE, xPosition + BLOCK_SIZE * 2); ClipdataProcess(yPosition - BLOCK_SIZE * 1, xPosition + BLOCK_SIZE * 2);
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - BLOCK_SIZE, xPosition + BLOCK_SIZE * 3); ClipdataProcess(yPosition - BLOCK_SIZE * 1, xPosition + BLOCK_SIZE * 3);
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - BLOCK_SIZE, xPosition + BLOCK_SIZE * 4); ClipdataProcess(yPosition - BLOCK_SIZE * 1, xPosition + BLOCK_SIZE * 4);
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - BLOCK_SIZE, xPosition + BLOCK_SIZE * 5); ClipdataProcess(yPosition - BLOCK_SIZE * 1, xPosition + BLOCK_SIZE * 5);
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - BLOCK_SIZE * 2, xPosition + BLOCK_SIZE * 2); ClipdataProcess(yPosition - BLOCK_SIZE * 2, xPosition + BLOCK_SIZE * 2);
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - BLOCK_SIZE * 2, xPosition + BLOCK_SIZE * 3); ClipdataProcess(yPosition - BLOCK_SIZE * 2, xPosition + BLOCK_SIZE * 3);
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - BLOCK_SIZE * 2, xPosition + BLOCK_SIZE * 4); ClipdataProcess(yPosition - BLOCK_SIZE * 2, xPosition + BLOCK_SIZE * 4);
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - BLOCK_SIZE * 3, xPosition + BLOCK_SIZE * 3); ClipdataProcess(yPosition - BLOCK_SIZE * 3, xPosition + BLOCK_SIZE * 3);
} }
@ -109,6 +122,7 @@ void KraidStatueOpenedInit(void)
gCurrentSprite.pOam = sKraidStatueOam_Opened; gCurrentSprite.pOam = sKraidStatueOam_Opened;
gCurrentSprite.currentAnimationFrame = 0; gCurrentSprite.currentAnimationFrame = 0;
gCurrentSprite.animationDurationCounter = 0; gCurrentSprite.animationDurationCounter = 0;
gCurrentSprite.pose = BOSS_STATUE_POSE_IDLE; gCurrentSprite.pose = BOSS_STATUE_POSE_IDLE;
KraidStatueHorizontalLignThreeChangeCcaa(CAA_MAKE_NON_POWER_GRIP); KraidStatueHorizontalLignThreeChangeCcaa(CAA_MAKE_NON_POWER_GRIP);
} }
@ -161,6 +175,7 @@ void KraidStatueInit(void)
gCurrentSprite.pOam = sKraidStatueOam_Idle; gCurrentSprite.pOam = sKraidStatueOam_Idle;
gCurrentSprite.pose = BOSS_STATUE_POSE_IDLE; gCurrentSprite.pose = BOSS_STATUE_POSE_IDLE;
} }
gCurrentSprite.currentAnimationFrame = 0; gCurrentSprite.currentAnimationFrame = 0;
gCurrentSprite.animationDurationCounter = 0; gCurrentSprite.animationDurationCounter = 0;
@ -181,12 +196,14 @@ void KraidStatueCheckBackgroundLocked(void)
SoundPlay(0x12A); SoundPlay(0x12A);
spriteX = gCurrentSprite.xPosition + HALF_BLOCK_SIZE; spriteX = gCurrentSprite.xPosition + HALF_BLOCK_SIZE;
spriteX /= 4; spriteX = SUB_PIXEL_TO_PIXEL(spriteX);
bgX = gBg1XPosition / 4; bgX = SUB_PIXEL_TO_PIXEL(gBg1XPosition);
distance = spriteX - bgX; distance = spriteX - bgX;
if (distance == BLOCK_SIZE * 2 - EIGHTH_BLOCK_SIZE) // Sprite is also 2 blocks from lock screen center
// Check if the sprite reached the middle of the screen with the scrolling
if (distance == SUB_PIXEL_TO_PIXEL(SCREEN_SIZE_X_SUB_PIXEL / 2))
{ {
// Set opening behavior // Set opening behavior
gCurrentSprite.pose = BOSS_STATUE_POSE_OPENING; gCurrentSprite.pose = BOSS_STATUE_POSE_OPENING;
@ -199,7 +216,7 @@ void KraidStatueCheckBackgroundLocked(void)
gCurrentSprite.work2 = 0; gCurrentSprite.work2 = 0;
SoundPlay(0x12B); SoundPlay(0x12B);
BossStatueVerticalLignChangeCcaa(CAA_MAKE_NON_POWER_GRIP); BossStatusSetWallBehindSamusCollision(CAA_MAKE_NON_POWER_GRIP);
} }
} }
@ -216,7 +233,7 @@ void KraidStatueOpening(void)
u16 xPosition; u16 xPosition;
if (gSamusData.xPosition > gCurrentSprite.xPosition + (BLOCK_SIZE * 8 + HALF_BLOCK_SIZE)) if (gSamusData.xPosition > gCurrentSprite.xPosition + (BLOCK_SIZE * 8 + HALF_BLOCK_SIZE))
BossStatueVerticalLignChangeCcaa(CAA_REMOVE_SOLID); BossStatusSetWallBehindSamusCollision(CAA_REMOVE_SOLID);
if (gCurrentSprite.currentAnimationFrame == 29 && gCurrentSprite.animationDurationCounter == 1) if (gCurrentSprite.currentAnimationFrame == 29 && gCurrentSprite.animationDurationCounter == 1)
KraidStatueInsideChangeCcaa(CAA_REMOVE_SOLID); KraidStatueInsideChangeCcaa(CAA_REMOVE_SOLID);
@ -225,20 +242,24 @@ void KraidStatueOpening(void)
{ {
// Set opened // Set opened
KraidStatueOpenedInit(); KraidStatueOpenedInit();
// Set event // Set event
EventFunction(EVENT_ACTION_SETTING, EVENT_KRAID_STATUE_OPENED); EventFunction(EVENT_ACTION_SETTING, EVENT_KRAID_STATUE_OPENED);
// Check should open doors // Check should open doors
if (!EventFunction(EVENT_ACTION_CHECKING, EVENT_RIDLEY_KILLED) || EventFunction(EVENT_ACTION_CHECKING, EVENT_RIDLEY_STATUE_OPENED)) if (!EventFunction(EVENT_ACTION_CHECKING, EVENT_RIDLEY_KILLED) || EventFunction(EVENT_ACTION_CHECKING, EVENT_RIDLEY_STATUE_OPENED))
{ {
gDoorUnlockTimer = -20; gDoorUnlockTimer = -20;
BossStatueVerticalLignChangeCcaa(CAA_REMOVE_SOLID); BossStatusSetWallBehindSamusCollision(CAA_REMOVE_SOLID);
} }
return;
} }
else if ((u16)(gCurrentSprite.currentAnimationFrame - 0x9) < 0x1F) else if (gCurrentSprite.currentAnimationFrame > 8 && gCurrentSprite.currentAnimationFrame < 40)
{ {
gCurrentSprite.work2++; gCurrentSprite.work2++;
if (!(gCurrentSprite.work1++ & 0x1F)) if (MOD_AND(gCurrentSprite.work1++, 32) == 0)
ScreenShakeStartVertical(0xA, 0x81); ScreenShakeStartVertical(10, 0x80 | 1);
// Set debris // Set debris
rngParam1 = gCurrentSprite.work1; rngParam1 = gCurrentSprite.work1;
@ -253,7 +274,6 @@ void KraidStatueOpening(void)
{ {
if (rngParam2 & 0x20) if (rngParam2 & 0x20)
{ {
SpriteDebrisInit(0, 0x5, yPosition, xPosition + 0x78 - rngParam3 * 0x10); SpriteDebrisInit(0, 0x5, yPosition, xPosition + 0x78 - rngParam3 * 0x10);
SpriteDebrisInit(0, 0x8, yPosition, xPosition - 0x190 + rngParam3 * 0x8); SpriteDebrisInit(0, 0x8, yPosition, xPosition - 0x190 + rngParam3 * 0x8);
} }
@ -315,13 +335,14 @@ void RidleyStatueInsideChangeCcaa(u8 caa)
xPosition = gCurrentSprite.xPosition - HALF_BLOCK_SIZE; xPosition = gCurrentSprite.xPosition - HALF_BLOCK_SIZE;
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - BLOCK_SIZE, xPosition); ClipdataProcess(yPosition - BLOCK_SIZE * 1, xPosition - BLOCK_SIZE * 0);
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - BLOCK_SIZE, xPosition - BLOCK_SIZE); ClipdataProcess(yPosition - BLOCK_SIZE * 1, xPosition - BLOCK_SIZE * 1);
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - BLOCK_SIZE * 2, xPosition); ClipdataProcess(yPosition - BLOCK_SIZE * 2, xPosition - BLOCK_SIZE * 0);
gCurrentClipdataAffectingAction = caa; gCurrentClipdataAffectingAction = caa;
ClipdataProcess(yPosition - BLOCK_SIZE * 2, xPosition - BLOCK_SIZE); ClipdataProcess(yPosition - BLOCK_SIZE * 2, xPosition - BLOCK_SIZE * 1);
} }
/** /**
@ -333,6 +354,7 @@ void RidleyStatueOpenedInit(void)
gCurrentSprite.pOam = sRidleyStatueOam_Opened; gCurrentSprite.pOam = sRidleyStatueOam_Opened;
gCurrentSprite.currentAnimationFrame = 0; gCurrentSprite.currentAnimationFrame = 0;
gCurrentSprite.animationDurationCounter = 0; gCurrentSprite.animationDurationCounter = 0;
gCurrentSprite.pose = BOSS_STATUE_POSE_IDLE; gCurrentSprite.pose = BOSS_STATUE_POSE_IDLE;
RidleyStatueChangeThreeCcaa(CAA_MAKE_NON_POWER_GRIP); RidleyStatueChangeThreeCcaa(CAA_MAKE_NON_POWER_GRIP);
} }
@ -345,9 +367,9 @@ void RidleyStatueInit(void)
{ {
gCurrentSprite.xPosition += HALF_BLOCK_SIZE; gCurrentSprite.xPosition += HALF_BLOCK_SIZE;
gCurrentSprite.drawDistanceTopOffset = 0x58; gCurrentSprite.drawDistanceTopOffset = SUB_PIXEL_TO_PIXEL(BLOCK_SIZE * 5 + HALF_BLOCK_SIZE);
gCurrentSprite.drawDistanceBottomOffset = 0; gCurrentSprite.drawDistanceBottomOffset = SUB_PIXEL_TO_PIXEL(0);
gCurrentSprite.drawDistanceHorizontalOffset = 0x70; gCurrentSprite.drawDistanceHorizontalOffset = SUB_PIXEL_TO_PIXEL(BLOCK_SIZE * 7);
gCurrentSprite.hitboxTopOffset = 0; gCurrentSprite.hitboxTopOffset = 0;
gCurrentSprite.hitboxBottomOffset = 0; gCurrentSprite.hitboxBottomOffset = 0;
@ -394,21 +416,25 @@ void RidleyStatueCheckBackgroundLocked(void)
{ {
u16 spriteX; u16 spriteX;
u16 bgX; u16 bgX;
u16 distance;
if (gCurrentSprite.currentAnimationFrame == 0 && gCurrentSprite.animationDurationCounter == 1) if (gCurrentSprite.currentAnimationFrame == 0 && gCurrentSprite.animationDurationCounter == 1)
SoundPlay(0x12A); SoundPlay(0x12A);
spriteX = gCurrentSprite.xPosition + HALF_BLOCK_SIZE; spriteX = gCurrentSprite.xPosition + HALF_BLOCK_SIZE;
spriteX /= 4; spriteX = SUB_PIXEL_TO_PIXEL(spriteX);
bgX = gBg1XPosition / 4; bgX = SUB_PIXEL_TO_PIXEL(gBg1XPosition);
if ((u16)(spriteX - bgX) == 0x78) // Sprite is 0x78 pixels from lock screen center distance = spriteX - bgX;
// Check if the sprite reached the middle of the screen with the scrolling
if (distance == SUB_PIXEL_TO_PIXEL(SCREEN_SIZE_X_SUB_PIXEL / 2))
{ {
// Set opening behavior // Set opening behavior
gCurrentSprite.pose = BOSS_STATUE_POSE_OPENING; gCurrentSprite.pose = BOSS_STATUE_POSE_OPENING;
gCurrentSprite.work0 = 0x3C; gCurrentSprite.work0 = 60;
BossStatueVerticalLignChangeCcaa(CAA_MAKE_NON_POWER_GRIP); BossStatusSetWallBehindSamusCollision(CAA_MAKE_NON_POWER_GRIP);
} }
} }
@ -424,8 +450,8 @@ void RidleyStatueOpening(void)
u16 yPosition; u16 yPosition;
u16 xPosition; u16 xPosition;
if (gSamusData.xPosition > gCurrentSprite.xPosition + 0x220) if (gSamusData.xPosition > gCurrentSprite.xPosition + BLOCK_SIZE * 8 + HALF_BLOCK_SIZE)
BossStatueVerticalLignChangeCcaa(CAA_REMOVE_SOLID); BossStatusSetWallBehindSamusCollision(CAA_REMOVE_SOLID);
if (gCurrentSprite.work0 != 0) if (gCurrentSprite.work0 != 0)
{ {
@ -454,18 +480,19 @@ void RidleyStatueOpening(void)
{ {
// Set opened // Set opened
RidleyStatueOpenedInit(); RidleyStatueOpenedInit();
// Set event // Set event
EventFunction(EVENT_ACTION_SETTING, EVENT_RIDLEY_STATUE_OPENED); EventFunction(EVENT_ACTION_SETTING, EVENT_RIDLEY_STATUE_OPENED);
// Unlock doors // Unlock doors
gDoorUnlockTimer = -20; gDoorUnlockTimer = -20;
BossStatueVerticalLignChangeCcaa(CAA_REMOVE_SOLID); BossStatusSetWallBehindSamusCollision(CAA_REMOVE_SOLID);
} }
else if ((u16)(gCurrentSprite.currentAnimationFrame - 0x9) < 0x1F) else if (gCurrentSprite.currentAnimationFrame > 8 && gCurrentSprite.currentAnimationFrame < 40)
{ {
// Set random debris // Set random debris
gCurrentSprite.work2++; gCurrentSprite.work2++;
if (!(gCurrentSprite.work1++ & 0x1F)) if (MOD_AND(gCurrentSprite.work1++, 32) == 0)
ScreenShakeStartVertical(10, 0x80 | 1); ScreenShakeStartVertical(10, 0x80 | 1);
rngParam1 = gCurrentSprite.work1; rngParam1 = gCurrentSprite.work1;

View File

@ -2364,13 +2364,8 @@ void KraidNailMovement(void)
* @brief 1aa3c | 474 | Kraid AI * @brief 1aa3c | 474 | Kraid AI
* *
*/ */
#ifdef NON_MATCHING
void Kraid(void) void Kraid(void)
{ {
// https://decomp.me/scratch/AWjiU
struct SubSpriteData* pSub;
if (gCurrentSprite.pose != 0 && gSubSpriteData1.health != 0) if (gCurrentSprite.pose != 0 && gSubSpriteData1.health != 0)
KraidOpenCloseRoutineAndProjectileCollision(); KraidOpenCloseRoutineAndProjectileCollision();
@ -2432,83 +2427,88 @@ void Kraid(void)
SpriteUtilUpdateSubSprite1Anim(); SpriteUtilUpdateSubSprite1Anim();
SpriteUtilSyncCurrentSpritePositionWithSubSprite1Position(); SpriteUtilSyncCurrentSpritePositionWithSubSprite1Position();
pSub = &gSubSpriteData1; if (gSubSpriteData1.animationDurationCounter == 1)
if (pSub->animationDurationCounter == 1)
{ {
if (pSub->pMultiOam == sKraidMultiSpriteData_Rising || if (gSubSpriteData1.pMultiOam == sKraidMultiSpriteData_Rising ||
pSub->pMultiOam == sKraidMultiSpriteData_Standing || gSubSpriteData1.pMultiOam == sKraidMultiSpriteData_Standing)
pSub->pMultiOam == sKraidMultiSpriteData_StandingBetweenSteps)
{ {
if (pSub->currentAnimationFrame == 1) if (gSubSpriteData1.currentAnimationFrame == 1)
gBg2Movement.yOffset -= 4; gBg2Movement.yOffset -= 4;
else if (pSub->currentAnimationFrame == 2) else if (gSubSpriteData1.currentAnimationFrame == 2)
gBg2Movement.yOffset += 4; gBg2Movement.yOffset += 4;
} }
else if (pSub->pMultiOam == sKraidMultiSpriteData_MovingLeftFeetToRight || else if (gSubSpriteData1.pMultiOam == sKraidMultiSpriteData_StandingBetweenSteps)
pSub->pMultiOam == sKraidMultiSpriteData_MovingRightFeetToLeft)
{ {
if (pSub->currentAnimationFrame == 1) if (gSubSpriteData1.currentAnimationFrame == 1)
gBg2Movement.xOffset -= 4;
else if (pSub->currentAnimationFrame == 2)
gBg2Movement.xOffset -= 4;
else if (pSub->currentAnimationFrame == 3)
gBg2Movement.xOffset -= 4;
else if (pSub->currentAnimationFrame == 4)
gBg2Movement.yOffset -= 4; gBg2Movement.yOffset -= 4;
else if (pSub->currentAnimationFrame == 5) else if (gSubSpriteData1.currentAnimationFrame == 2)
gBg2Movement.yOffset += 4;
}
else if (gSubSpriteData1.pMultiOam == sKraidMultiSpriteData_MovingLeftFeetToRight ||
gSubSpriteData1.pMultiOam == sKraidMultiSpriteData_MovingRightFeetToLeft)
{
if (gSubSpriteData1.currentAnimationFrame == 1)
gBg2Movement.xOffset -= 4;
else if (gSubSpriteData1.currentAnimationFrame == 2)
gBg2Movement.xOffset -= 4;
else if (gSubSpriteData1.currentAnimationFrame == 3)
gBg2Movement.xOffset -= 4;
else if (gSubSpriteData1.currentAnimationFrame == 4)
gBg2Movement.yOffset -= 4;
else if (gSubSpriteData1.currentAnimationFrame == 5)
{ {
gBg2Movement.yOffset += 4; gBg2Movement.yOffset += 4;
ScreenShakeStartVertical(10, 0x80 | 1); ScreenShakeStartVertical(10, 0x80 | 1);
SoundPlay(0x1CC); SoundPlay(0x1CC);
if (pSub->pMultiOam == sKraidMultiSpriteData_MovingLeftFeetToRight) if (gSubSpriteData1.pMultiOam == sKraidMultiSpriteData_MovingLeftFeetToRight)
{ {
ParticleSet(gCurrentSprite.yPositionSpawn + BLOCK_SIZE * 7 + HALF_BLOCK_SIZE, ParticleSet(gCurrentSprite.yPositionSpawn + BLOCK_SIZE * 7 + HALF_BLOCK_SIZE,
pSub->xPosition - (HALF_BLOCK_SIZE + 12), PE_SECOND_MEDIUM_DUST); gSubSpriteData1.xPosition - (HALF_BLOCK_SIZE + 12), PE_SECOND_MEDIUM_DUST);
ParticleSet(gCurrentSprite.yPositionSpawn + BLOCK_SIZE * 7 + HALF_BLOCK_SIZE, ParticleSet(gCurrentSprite.yPositionSpawn + BLOCK_SIZE * 7 + HALF_BLOCK_SIZE,
pSub->xPosition - (BLOCK_SIZE * 2 + QUARTER_BLOCK_SIZE), PE_SECOND_MEDIUM_DUST); gSubSpriteData1.xPosition - (BLOCK_SIZE * 2 + QUARTER_BLOCK_SIZE), PE_SECOND_MEDIUM_DUST);
} }
else else
{ {
ParticleSet(gCurrentSprite.yPositionSpawn + BLOCK_SIZE * 7 + HALF_BLOCK_SIZE, ParticleSet(gCurrentSprite.yPositionSpawn + BLOCK_SIZE * 7 + HALF_BLOCK_SIZE,
pSub->xPosition + (BLOCK_SIZE * 3 + HALF_BLOCK_SIZE + 12), PE_SECOND_MEDIUM_DUST); gSubSpriteData1.xPosition + (BLOCK_SIZE * 3 + HALF_BLOCK_SIZE + 12), PE_SECOND_MEDIUM_DUST);
ParticleSet(gCurrentSprite.yPositionSpawn + BLOCK_SIZE * 7 + HALF_BLOCK_SIZE, ParticleSet(gCurrentSprite.yPositionSpawn + BLOCK_SIZE * 7 + HALF_BLOCK_SIZE,
pSub->xPosition + (BLOCK_SIZE * 5 + QUARTER_BLOCK_SIZE), PE_SECOND_MEDIUM_DUST); gSubSpriteData1.xPosition + (BLOCK_SIZE * 5 + QUARTER_BLOCK_SIZE), PE_SECOND_MEDIUM_DUST);
} }
} }
} }
else if (pSub->pMultiOam == sKraidMultiSpriteData_MovingRightFeetToRight || else if (gSubSpriteData1.pMultiOam == sKraidMultiSpriteData_MovingRightFeetToRight ||
pSub->pMultiOam == sKraidMultiSpriteData_MovingLeftFeetToLeft) gSubSpriteData1.pMultiOam == sKraidMultiSpriteData_MovingLeftFeetToLeft)
{ {
if (pSub->currentAnimationFrame == 1) if (gSubSpriteData1.currentAnimationFrame == 1)
gBg2Movement.xOffset += 4; gBg2Movement.xOffset += 4;
else if (pSub->currentAnimationFrame == 2) else if (gSubSpriteData1.currentAnimationFrame == 2)
gBg2Movement.xOffset += 4; gBg2Movement.xOffset += 4;
else if (pSub->currentAnimationFrame == 3) else if (gSubSpriteData1.currentAnimationFrame == 3)
gBg2Movement.xOffset += 4; gBg2Movement.xOffset += 4;
else if (pSub->currentAnimationFrame == 4) else if (gSubSpriteData1.currentAnimationFrame == 4)
gBg2Movement.yOffset -= 4; gBg2Movement.yOffset -= 4;
else if (pSub->currentAnimationFrame == 5) else if (gSubSpriteData1.currentAnimationFrame == 5)
{ {
gBg2Movement.yOffset += 4; gBg2Movement.yOffset += 4;
ScreenShakeStartVertical(10, 0x80 | 1); ScreenShakeStartVertical(10, 0x80 | 1);
SoundPlay(0x1CC); SoundPlay(0x1CC);
if (pSub->pMultiOam == sKraidMultiSpriteData_MovingLeftFeetToLeft) if (gSubSpriteData1.pMultiOam == sKraidMultiSpriteData_MovingLeftFeetToLeft)
{ {
ParticleSet(gCurrentSprite.yPositionSpawn + BLOCK_SIZE * 7 + HALF_BLOCK_SIZE, ParticleSet(gCurrentSprite.yPositionSpawn + BLOCK_SIZE * 7 + HALF_BLOCK_SIZE,
pSub->xPosition - (BLOCK_SIZE + HALF_BLOCK_SIZE + 4), PE_SECOND_MEDIUM_DUST); gSubSpriteData1.xPosition - (BLOCK_SIZE + HALF_BLOCK_SIZE + 4), PE_SECOND_MEDIUM_DUST);
ParticleSet(gCurrentSprite.yPositionSpawn + BLOCK_SIZE * 7 + HALF_BLOCK_SIZE, ParticleSet(gCurrentSprite.yPositionSpawn + BLOCK_SIZE * 7 + HALF_BLOCK_SIZE,
pSub->xPosition - (BLOCK_SIZE * 3 + 8), PE_SECOND_MEDIUM_DUST); gSubSpriteData1.xPosition - (BLOCK_SIZE * 3 + 8), PE_SECOND_MEDIUM_DUST);
} }
else else
{ {
ParticleSet(gCurrentSprite.yPositionSpawn + BLOCK_SIZE * 7 + HALF_BLOCK_SIZE, ParticleSet(gCurrentSprite.yPositionSpawn + BLOCK_SIZE * 7 + HALF_BLOCK_SIZE,
pSub->xPosition + (BLOCK_SIZE * 4 + 10), PE_SECOND_MEDIUM_DUST); gSubSpriteData1.xPosition + (BLOCK_SIZE * 4 + 10), PE_SECOND_MEDIUM_DUST);
ParticleSet(gCurrentSprite.yPositionSpawn + BLOCK_SIZE * 7 + HALF_BLOCK_SIZE, ParticleSet(gCurrentSprite.yPositionSpawn + BLOCK_SIZE * 7 + HALF_BLOCK_SIZE,
pSub->xPosition + (BLOCK_SIZE * 5 + HALF_BLOCK_SIZE + 14), PE_SECOND_MEDIUM_DUST); gSubSpriteData1.xPosition + (BLOCK_SIZE * 5 + HALF_BLOCK_SIZE + 14), PE_SECOND_MEDIUM_DUST);
} }
} }
} }
@ -2532,474 +2532,6 @@ void Kraid(void)
else else
gLockScreen.lock = LOCK_SCREEN_TYPE_NONE; gLockScreen.lock = LOCK_SCREEN_TYPE_NONE;
} }
#else
NAKED_FUNCTION
void Kraid(void)
{
asm(" \n\
push {r4, r5, r6, lr} \n\
ldr r0, lbl_0801aa6c @ =gCurrentSprite \n\
add r0, #0x24 \n\
ldrb r0, [r0] \n\
cmp r0, #0 \n\
beq lbl_0801aa54 \n\
ldr r0, lbl_0801aa70 @ =gSubSpriteData1 \n\
ldrh r0, [r0, #0xa] \n\
cmp r0, #0 \n\
beq lbl_0801aa54 \n\
bl KraidOpenCloseRoutineAndProjectileCollision \n\
lbl_0801aa54: \n\
ldr r0, lbl_0801aa6c @ =gCurrentSprite \n\
add r0, #0x24 \n\
ldrb r0, [r0] \n\
cmp r0, #0x68 \n\
bls lbl_0801aa60 \n\
b lbl_0801ac64 \n\
lbl_0801aa60: \n\
lsl r0, r0, #2 \n\
ldr r1, lbl_0801aa74 @ =lbl_0801aa78 \n\
add r0, r0, r1 \n\
ldr r0, [r0] \n\
mov pc, r0 \n\
.align 2, 0 \n\
lbl_0801aa6c: .4byte gCurrentSprite \n\
lbl_0801aa70: .4byte gSubSpriteData1 \n\
lbl_0801aa74: .4byte lbl_0801aa78 \n\
lbl_0801aa78: @ jump table \n\
.4byte lbl_0801ac1c @ case 0 \n\
.4byte lbl_0801ac22 @ case 1 \n\
.4byte lbl_0801ac28 @ case 2 \n\
.4byte lbl_0801ac64 @ case 3 \n\
.4byte lbl_0801ac64 @ case 4 \n\
.4byte lbl_0801ac64 @ case 5 \n\
.4byte lbl_0801ac64 @ case 6 \n\
.4byte lbl_0801ac64 @ case 7 \n\
.4byte lbl_0801ac2e @ case 8 \n\
.4byte lbl_0801ac32 @ case 9 \n\
.4byte lbl_0801ac64 @ case 10 \n\
.4byte lbl_0801ac64 @ case 11 \n\
.4byte lbl_0801ac64 @ case 12 \n\
.4byte lbl_0801ac64 @ case 13 \n\
.4byte lbl_0801ac42 @ case 14 \n\
.4byte lbl_0801ac46 @ case 15 \n\
.4byte lbl_0801ac4c @ case 16 \n\
.4byte lbl_0801ac50 @ case 17 \n\
.4byte lbl_0801ac64 @ case 18 \n\
.4byte lbl_0801ac64 @ case 19 \n\
.4byte lbl_0801ac64 @ case 20 \n\
.4byte lbl_0801ac64 @ case 21 \n\
.4byte lbl_0801ac64 @ case 22 \n\
.4byte lbl_0801ac64 @ case 23 \n\
.4byte lbl_0801ac64 @ case 24 \n\
.4byte lbl_0801ac64 @ case 25 \n\
.4byte lbl_0801ac64 @ case 26 \n\
.4byte lbl_0801ac64 @ case 27 \n\
.4byte lbl_0801ac64 @ case 28 \n\
.4byte lbl_0801ac64 @ case 29 \n\
.4byte lbl_0801ac64 @ case 30 \n\
.4byte lbl_0801ac64 @ case 31 \n\
.4byte lbl_0801ac64 @ case 32 \n\
.4byte lbl_0801ac64 @ case 33 \n\
.4byte lbl_0801ac38 @ case 34 \n\
.4byte lbl_0801ac3c @ case 35 \n\
.4byte lbl_0801ac64 @ case 36 \n\
.4byte lbl_0801ac64 @ case 37 \n\
.4byte lbl_0801ac64 @ case 38 \n\
.4byte lbl_0801ac64 @ case 39 \n\
.4byte lbl_0801ac64 @ case 40 \n\
.4byte lbl_0801ac64 @ case 41 \n\
.4byte lbl_0801ac64 @ case 42 \n\
.4byte lbl_0801ac64 @ case 43 \n\
.4byte lbl_0801ac64 @ case 44 \n\
.4byte lbl_0801ac64 @ case 45 \n\
.4byte lbl_0801ac64 @ case 46 \n\
.4byte lbl_0801ac64 @ case 47 \n\
.4byte lbl_0801ac64 @ case 48 \n\
.4byte lbl_0801ac64 @ case 49 \n\
.4byte lbl_0801ac64 @ case 50 \n\
.4byte lbl_0801ac64 @ case 51 \n\
.4byte lbl_0801ac64 @ case 52 \n\
.4byte lbl_0801ac64 @ case 53 \n\
.4byte lbl_0801ac64 @ case 54 \n\
.4byte lbl_0801ac64 @ case 55 \n\
.4byte lbl_0801ac64 @ case 56 \n\
.4byte lbl_0801ac64 @ case 57 \n\
.4byte lbl_0801ac64 @ case 58 \n\
.4byte lbl_0801ac64 @ case 59 \n\
.4byte lbl_0801ac64 @ case 60 \n\
.4byte lbl_0801ac64 @ case 61 \n\
.4byte lbl_0801ac64 @ case 62 \n\
.4byte lbl_0801ac64 @ case 63 \n\
.4byte lbl_0801ac64 @ case 64 \n\
.4byte lbl_0801ac64 @ case 65 \n\
.4byte lbl_0801ac64 @ case 66 \n\
.4byte lbl_0801ac64 @ case 67 \n\
.4byte lbl_0801ac64 @ case 68 \n\
.4byte lbl_0801ac64 @ case 69 \n\
.4byte lbl_0801ac64 @ case 70 \n\
.4byte lbl_0801ac64 @ case 71 \n\
.4byte lbl_0801ac64 @ case 72 \n\
.4byte lbl_0801ac64 @ case 73 \n\
.4byte lbl_0801ac64 @ case 74 \n\
.4byte lbl_0801ac64 @ case 75 \n\
.4byte lbl_0801ac64 @ case 76 \n\
.4byte lbl_0801ac64 @ case 77 \n\
.4byte lbl_0801ac64 @ case 78 \n\
.4byte lbl_0801ac64 @ case 79 \n\
.4byte lbl_0801ac64 @ case 80 \n\
.4byte lbl_0801ac64 @ case 81 \n\
.4byte lbl_0801ac64 @ case 82 \n\
.4byte lbl_0801ac64 @ case 83 \n\
.4byte lbl_0801ac64 @ case 84 \n\
.4byte lbl_0801ac64 @ case 85 \n\
.4byte lbl_0801ac64 @ case 86 \n\
.4byte lbl_0801ac64 @ case 87 \n\
.4byte lbl_0801ac64 @ case 88 \n\
.4byte lbl_0801ac64 @ case 89 \n\
.4byte lbl_0801ac64 @ case 90 \n\
.4byte lbl_0801ac64 @ case 91 \n\
.4byte lbl_0801ac64 @ case 92 \n\
.4byte lbl_0801ac64 @ case 93 \n\
.4byte lbl_0801ac64 @ case 94 \n\
.4byte lbl_0801ac64 @ case 95 \n\
.4byte lbl_0801ac64 @ case 96 \n\
.4byte lbl_0801ac64 @ case 97 \n\
.4byte lbl_0801ac56 @ case 98 \n\
.4byte lbl_0801ac64 @ case 99 \n\
.4byte lbl_0801ac64 @ case 100 \n\
.4byte lbl_0801ac64 @ case 101 \n\
.4byte lbl_0801ac64 @ case 102 \n\
.4byte lbl_0801ac5a @ case 103 \n\
.4byte lbl_0801ac60 @ case 104 \n\
lbl_0801ac1c: \n\
bl KraidInit \n\
b lbl_0801ac64 \n\
lbl_0801ac22: \n\
bl KraidGoUp \n\
b lbl_0801ac64 \n\
lbl_0801ac28: \n\
bl KraidCheckFullyUp \n\
b lbl_0801ac64 \n\
lbl_0801ac2e: \n\
bl KraidFirstStepInit \n\
lbl_0801ac32: \n\
bl KraidFirstStep \n\
b lbl_0801ac64 \n\
lbl_0801ac38: \n\
bl KraidSecondStepInit \n\
lbl_0801ac3c: \n\
bl KraidSecondStep \n\
b lbl_0801ac64 \n\
lbl_0801ac42: \n\
bl KraidStandingInit \n\
lbl_0801ac46: \n\
bl KraidStanding \n\
b lbl_0801ac64 \n\
lbl_0801ac4c: \n\
bl KraidStandingBetweenStepsInit \n\
lbl_0801ac50: \n\
bl KraidStandingBetweenSteps \n\
b lbl_0801ac64 \n\
lbl_0801ac56: \n\
bl KraidDyingInit \n\
lbl_0801ac5a: \n\
bl KraidDying \n\
b lbl_0801ac64 \n\
lbl_0801ac60: \n\
bl KraidBeforeDeath \n\
lbl_0801ac64: \n\
ldr r5, lbl_0801acac @ =gCurrentSprite \n\
ldrb r0, [r5, #0x1d] \n\
cmp r0, #0x6f \n\
beq lbl_0801ac6e \n\
b lbl_0801aea0 \n\
lbl_0801ac6e: \n\
bl SpriteUtilUpdateSubSprite1Anim \n\
bl SpriteUtilSyncCurrentSpritePositionWithSubSprite1Position \n\
ldr r6, lbl_0801acb0 @ =gSubSpriteData1 \n\
ldrb r0, [r6, #0xc] \n\
cmp r0, #1 \n\
beq lbl_0801ac80 \n\
b lbl_0801ae26 \n\
lbl_0801ac80: \n\
ldr r1, [r6] \n\
ldr r0, lbl_0801acb4 @ =sKraidMultiSpriteData_Rising \n\
cmp r1, r0 \n\
beq lbl_0801ac94 \n\
ldr r0, lbl_0801acb8 @ =sKraidMultiSpriteData_Standing \n\
cmp r1, r0 \n\
beq lbl_0801ac94 \n\
ldr r0, lbl_0801acbc @ =sKraidMultiSpriteData_StandingBetweenSteps \n\
cmp r1, r0 \n\
bne lbl_0801acc4 \n\
lbl_0801ac94: \n\
ldrh r0, [r6, #4] \n\
cmp r0, #1 \n\
bne lbl_0801ac9c \n\
b lbl_0801ad98 \n\
lbl_0801ac9c: \n\
cmp r0, #2 \n\
beq lbl_0801aca2 \n\
b lbl_0801ae26 \n\
lbl_0801aca2: \n\
ldr r1, lbl_0801acc0 @ =gBg2Movement \n\
ldrh r0, [r1, #2] \n\
add r0, #4 \n\
strh r0, [r1, #2] \n\
b lbl_0801ae26 \n\
.align 2, 0 \n\
lbl_0801acac: .4byte gCurrentSprite \n\
lbl_0801acb0: .4byte gSubSpriteData1 \n\
lbl_0801acb4: .4byte sKraidMultiSpriteData_Rising \n\
lbl_0801acb8: .4byte sKraidMultiSpriteData_Standing \n\
lbl_0801acbc: .4byte sKraidMultiSpriteData_StandingBetweenSteps \n\
lbl_0801acc0: .4byte gBg2Movement \n\
lbl_0801acc4: \n\
ldr r4, lbl_0801ace8 @ =sKraidMultiSpriteData_MovingLeftFeetToRight \n\
cmp r1, r4 \n\
beq lbl_0801acd0 \n\
ldr r0, lbl_0801acec @ =sKraidMultiSpriteData_MovingRightFeetToLeft \n\
cmp r1, r0 \n\
bne lbl_0801ad64 \n\
lbl_0801acd0: \n\
ldrh r0, [r6, #4] \n\
cmp r0, #1 \n\
beq lbl_0801acde \n\
cmp r0, #2 \n\
beq lbl_0801acde \n\
cmp r0, #3 \n\
bne lbl_0801acf4 \n\
lbl_0801acde: \n\
ldr r1, lbl_0801acf0 @ =gBg2Movement \n\
ldrh r0, [r1] \n\
sub r0, #4 \n\
strh r0, [r1] \n\
b lbl_0801ae26 \n\
.align 2, 0 \n\
lbl_0801ace8: .4byte sKraidMultiSpriteData_MovingLeftFeetToRight \n\
lbl_0801acec: .4byte sKraidMultiSpriteData_MovingRightFeetToLeft \n\
lbl_0801acf0: .4byte gBg2Movement \n\
lbl_0801acf4: \n\
cmp r0, #4 \n\
beq lbl_0801ad98 \n\
cmp r0, #5 \n\
beq lbl_0801acfe \n\
b lbl_0801ae26 \n\
lbl_0801acfe: \n\
ldr r1, lbl_0801ad38 @ =gBg2Movement \n\
ldrh r0, [r1, #2] \n\
add r0, #4 \n\
strh r0, [r1, #2] \n\
movs r0, #0xa \n\
movs r1, #0x81 \n\
bl ScreenShakeStartVertical \n\
movs r0, #0xe6 \n\
lsl r0, r0, #1 \n\
bl SoundPlay \n\
ldr r0, [r6] \n\
cmp r0, r4 \n\
bne lbl_0801ad3c \n\
ldrh r0, [r5, #6] \n\
movs r4, #0xf0 \n\
lsl r4, r4, #1 \n\
add r0, r0, r4 \n\
ldrh r1, [r6, #8] \n\
sub r1, #0x2c \n\
movs r2, #0x38 \n\
bl ParticleSet \n\
ldrh r0, [r5, #6] \n\
add r0, r0, r4 \n\
ldrh r1, [r6, #8] \n\
sub r1, #0x90 \n\
b lbl_0801ade8 \n\
.align 2, 0 \n\
lbl_0801ad38: .4byte gBg2Movement \n\
lbl_0801ad3c: \n\
ldr r5, lbl_0801ad60 @ =gCurrentSprite \n\
ldrh r0, [r5, #6] \n\
movs r4, #0xf0 \n\
lsl r4, r4, #1 \n\
add r0, r0, r4 \n\
ldrh r1, [r6, #8] \n\
add r1, #0xec \n\
movs r2, #0x38 \n\
bl ParticleSet \n\
ldrh r0, [r5, #6] \n\
add r0, r0, r4 \n\
ldrh r1, [r6, #8] \n\
movs r2, #0xa8 \n\
lsl r2, r2, #1 \n\
add r1, r1, r2 \n\
b lbl_0801ade8 \n\
.align 2, 0 \n\
lbl_0801ad60: .4byte gCurrentSprite \n\
lbl_0801ad64: \n\
ldr r0, lbl_0801ad88 @ =sKraidMultiSpriteData_MovingLeftFeetToLeft \n\
cmp r1, r0 \n\
beq lbl_0801ad70 \n\
ldr r0, lbl_0801ad8c @ =sKraidMultiSpriteData_MovingLeftFeetToLeft \n\
cmp r1, r0 \n\
bne lbl_0801ae26 \n\
lbl_0801ad70: \n\
ldrh r0, [r6, #4] \n\
cmp r0, #1 \n\
beq lbl_0801ad7e \n\
cmp r0, #2 \n\
beq lbl_0801ad7e \n\
cmp r0, #3 \n\
bne lbl_0801ad94 \n\
lbl_0801ad7e: \n\
ldr r1, lbl_0801ad90 @ =gBg2Movement \n\
ldrh r0, [r1] \n\
add r0, #4 \n\
strh r0, [r1] \n\
b lbl_0801ae26 \n\
.align 2, 0 \n\
lbl_0801ad88: .4byte sKraidMultiSpriteData_MovingRightFeetToRight \n\
lbl_0801ad8c: .4byte sKraidMultiSpriteData_MovingLeftFeetToLeft \n\
lbl_0801ad90: .4byte gBg2Movement \n\
lbl_0801ad94: \n\
cmp r0, #4 \n\
bne lbl_0801ada8 \n\
lbl_0801ad98: \n\
ldr r1, lbl_0801ada4 @ =gBg2Movement \n\
ldrh r0, [r1, #2] \n\
sub r0, #4 \n\
strh r0, [r1, #2] \n\
b lbl_0801ae26 \n\
.align 2, 0 \n\
lbl_0801ada4: .4byte gBg2Movement \n\
lbl_0801ada8: \n\
cmp r0, #5 \n\
bne lbl_0801ae26 \n\
ldr r1, lbl_0801adf0 @ =gBg2Movement \n\
ldrh r0, [r1, #2] \n\
add r0, #4 \n\
strh r0, [r1, #2] \n\
movs r0, #0xa \n\
movs r1, #0x81 \n\
bl ScreenShakeStartVertical \n\
movs r0, #0xe6 \n\
lsl r0, r0, #1 \n\
bl SoundPlay \n\
ldr r1, [r6] \n\
ldr r0, lbl_0801adf4 @ =sKraidMultiSpriteData_MovingLeftFeetToLeft \n\
cmp r1, r0 \n\
bne lbl_0801adfc \n\
ldr r5, lbl_0801adf8 @ =gCurrentSprite \n\
ldrh r0, [r5, #6] \n\
movs r4, #0xf0 \n\
lsl r4, r4, #1 \n\
add r0, r0, r4 \n\
ldrh r1, [r6, #8] \n\
sub r1, #0x64 \n\
movs r2, #0x38 \n\
bl ParticleSet \n\
ldrh r0, [r5, #6] \n\
add r0, r0, r4 \n\
ldrh r1, [r6, #8] \n\
sub r1, #0xc8 \n\
lbl_0801ade8: \n\
movs r2, #0x38 \n\
bl ParticleSet \n\
b lbl_0801ae26 \n\
.align 2, 0 \n\
lbl_0801adf0: .4byte gBg2Movement \n\
lbl_0801adf4: .4byte sKraidMultiSpriteData_MovingLeftFeetToLeft \n\
lbl_0801adf8: .4byte gCurrentSprite \n\
lbl_0801adfc: \n\
ldr r5, lbl_0801ae74 @ =gCurrentSprite \n\
ldrh r0, [r5, #6] \n\
movs r4, #0xf0 \n\
lsl r4, r4, #1 \n\
add r0, r0, r4 \n\
ldrh r1, [r6, #8] \n\
movs r3, #0x85 \n\
lsl r3, r3, #1 \n\
add r1, r1, r3 \n\
movs r2, #0x38 \n\
bl ParticleSet \n\
ldrh r0, [r5, #6] \n\
add r0, r0, r4 \n\
ldrh r1, [r6, #8] \n\
movs r2, #0xb7 \n\
lsl r2, r2, #1 \n\
add r1, r1, r2 \n\
movs r2, #0x38 \n\
bl ParticleSet \n\
lbl_0801ae26: \n\
ldr r1, lbl_0801ae78 @ =gSubSpriteData1 \n\
ldrb r0, [r1, #0xd] \n\
cmp r0, #0 \n\
beq lbl_0801ae34 \n\
ldrb r0, [r1, #0xc] \n\
add r0, #4 \n\
strb r0, [r1, #0xc] \n\
lbl_0801ae34: \n\
ldr r1, lbl_0801ae7c @ =gLockScreen \n\
movs r0, #1 \n\
strb r0, [r1] \n\
ldr r2, lbl_0801ae80 @ =gSamusData \n\
ldrh r0, [r2, #0x14] \n\
strh r0, [r1, #4] \n\
ldr r3, lbl_0801ae84 @ =0xfffffec0 \n\
add r0, r3, #0 \n\
ldrh r2, [r2, #0x12] \n\
add r0, r0, r2 \n\
strh r0, [r1, #2] \n\
ldr r3, lbl_0801ae74 @ =gCurrentSprite \n\
add r0, r3, #0 \n\
add r0, #0x20 \n\
ldrb r2, [r0] \n\
add r0, #0x13 \n\
ldrb r1, [r0] \n\
movs r0, #0xe \n\
sub r0, r0, r1 \n\
cmp r2, r0 \n\
bne lbl_0801ae88 \n\
ldrh r1, [r3] \n\
movs r2, #0x80 \n\
lsl r2, r2, #3 \n\
add r0, r2, #0 \n\
and r0, r1 \n\
cmp r0, #0 \n\
bne lbl_0801aea6 \n\
add r0, r2, #0 \n\
orr r0, r1 \n\
strh r0, [r3] \n\
b lbl_0801aea6 \n\
.align 2, 0 \n\
lbl_0801ae74: .4byte gCurrentSprite \n\
lbl_0801ae78: .4byte gSubSpriteData1 \n\
lbl_0801ae7c: .4byte gLockScreen \n\
lbl_0801ae80: .4byte gSamusData \n\
lbl_0801ae84: .4byte 0xfffffec0 \n\
lbl_0801ae88: \n\
ldrh r1, [r3] \n\
movs r0, #0x80 \n\
lsl r0, r0, #3 \n\
and r0, r1 \n\
cmp r0, #0 \n\
beq lbl_0801aea6 \n\
ldr r0, lbl_0801ae9c @ =0x0000fbff \n\
and r0, r1 \n\
strh r0, [r3] \n\
b lbl_0801aea6 \n\
.align 2, 0 \n\
lbl_0801ae9c: .4byte 0x0000fbff \n\
lbl_0801aea0: \n\
ldr r1, lbl_0801aeac @ =gLockScreen \n\
movs r0, #0 \n\
strb r0, [r1] \n\
lbl_0801aea6: \n\
pop {r4, r5, r6} \n\
pop {r0} \n\
bx r0 \n\
.align 2, 0 \n\
lbl_0801aeac: .4byte gLockScreen \n\
");
}
#endif
/** /**
* @brief 1aeb0 | 198 | Kraid part AI * @brief 1aeb0 | 198 | Kraid part AI

View File

@ -4368,34 +4368,24 @@ void SpacePirate(void)
{ {
if (gCurrentSprite.status & SPRITE_STATUS_FACING_RIGHT) if (gCurrentSprite.status & SPRITE_STATUS_FACING_RIGHT)
{ {
if (gSpriteDrawOrder[1] == TRUE) if (gSpriteDrawOrder[1] == TRUE && !(gCurrentSprite.status & SPRITE_STATUS_NOT_DRAWN))
{ gCurrentSprite.spriteId = PSPRITE_SPACE_PIRATE;
if (!(gCurrentSprite.status & SPRITE_STATUS_NOT_DRAWN)) else
{ gSpriteDrawOrder[2] = FALSE;
gCurrentSprite.spriteId = PSPRITE_SPACE_PIRATE;
goto lasercheck;
}
}
gSpriteDrawOrder[2] = FALSE;
} }
else else
{ {
if (gSpriteDrawOrder[1] == FALSE) if (gSpriteDrawOrder[1] == FALSE && !(gCurrentSprite.status & SPRITE_STATUS_NOT_DRAWN))
{ gCurrentSprite.spriteId = PSPRITE_SPACE_PIRATE;
if (!(gCurrentSprite.status & SPRITE_STATUS_NOT_DRAWN)) else
{ gSpriteDrawOrder[2] = FALSE;
gCurrentSprite.spriteId = PSPRITE_SPACE_PIRATE;
goto lasercheck;
}
}
gSpriteDrawOrder[2] = FALSE;
} }
} }
} }
else if (gAlarmTimer == 0) else if (gAlarmTimer == 0)
{
gCurrentSprite.status &= ~SPRITE_STATUS_UNKNOWN_400; gCurrentSprite.status &= ~SPRITE_STATUS_UNKNOWN_400;
}
} }
else else
@ -4404,7 +4394,6 @@ void SpacePirate(void)
gCurrentSprite.status |= SPRITE_STATUS_UNKNOWN_400; gCurrentSprite.status |= SPRITE_STATUS_UNKNOWN_400;
} }
lasercheck:
SpacePirateCheckCollidingWithLaser(); SpacePirateCheckCollidingWithLaser();
} }