Match EscapeShipPart

This commit is contained in:
y.demaisonregne 2023-06-21 12:25:51 +02:00
parent 3c7ce53228
commit 40d6ac112d
4 changed files with 34 additions and 1247 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.
2641/2721 functions decompiled (97.06%, 80 left) 2642/2721 functions decompiled (97.10%, 79 left)
0x350b6c/0x76b014 bytes of data not in blobs (44.69%, 0x41a4a8 left) 0x350b6c/0x76b014 bytes of data not in blobs (44.69%, 0x41a4a8 left)

File diff suppressed because it is too large Load Diff

View File

@ -490,7 +490,7 @@ SECTIONS {
src/sprites_AI/gadora.o(.text); src/sprites_AI/gadora.o(.text);
src/sprites_AI/steam.o(.text); src/sprites_AI/steam.o(.text);
src/sprites_AI/unknown_item_block.o(.text); src/sprites_AI/unknown_item_block.o(.text);
asm/disasm_0x0804ac00.o(.text); src/sprites_AI/escape_ship.o(.text);
src/sprites_AI/space_pirate_carrying_power_bomb.o(.text); src/sprites_AI/space_pirate_carrying_power_bomb.o(.text);
src/sprites_AI/falling_chozo_pillar.o(.text); src/sprites_AI/falling_chozo_pillar.o(.text);
src/sprites_AI/mecha_ridley.o(.text); src/sprites_AI/mecha_ridley.o(.text);

View File

@ -217,7 +217,7 @@ void EscapeShip(void)
gCurrentSprite.animationDurationCounter = 0; gCurrentSprite.animationDurationCounter = 0;
gCurrentSprite.pose = ESCAPE_SHIP_POSE_CHECK_OPEN; gCurrentSprite.pose = ESCAPE_SHIP_POSE_CHECK_OPEN;
gSubSpriteData1.workVariable1 = 0; gSubSpriteData1.workVariable3 = 0;
SpriteSpawnSecondary(SSPRITE_ESCAPE_SHIP_PART, ESCAPE_SHIP_PART_TOP, gCurrentSprite.spritesetGfxSlot, SpriteSpawnSecondary(SSPRITE_ESCAPE_SHIP_PART, ESCAPE_SHIP_PART_TOP, gCurrentSprite.spritesetGfxSlot,
gCurrentSprite.primarySpriteRamSlot, yPosition, xPosition, 0); gCurrentSprite.primarySpriteRamSlot, yPosition, xPosition, 0);
@ -304,7 +304,7 @@ void EscapeShip(void)
gCurrentSprite.workVariable2 = 0; gCurrentSprite.workVariable2 = 0;
gCurrentSprite.arrayOffset = 0; gCurrentSprite.arrayOffset = 0;
gSubSpriteData1.workVariable1 = 1; gSubSpriteData1.workVariable3 = 1;
} }
break; break;
@ -385,7 +385,7 @@ void EscapeShip(void)
SoundPlay(0x251); SoundPlay(0x251);
} }
else if (gCurrentSprite.timer == 60 + 60 / 3 * 2) else if (gCurrentSprite.timer == 60 + 60 / 3 * 2)
gSubSpriteData1.workVariable1 = 2; gSubSpriteData1.workVariable3 = 2;
gCurrentSprite.yPosition -= 2; gCurrentSprite.yPosition -= 2;
} }
@ -460,11 +460,9 @@ void EscapeShip(void)
*/ */
void EscapeShipPart(void) void EscapeShipPart(void)
{ {
// https://decomp.me/scratch/XdNST
u8 ramSlot; u8 ramSlot;
u8 roomSlot;
u8 delay; u8 delay;
register u8 temp asm("r5");
ramSlot = gCurrentSprite.primarySpriteRamSlot; ramSlot = gCurrentSprite.primarySpriteRamSlot;
gCurrentSprite.yPosition = gSpriteData[ramSlot].yPosition; gCurrentSprite.yPosition = gSpriteData[ramSlot].yPosition;
@ -472,80 +470,81 @@ void EscapeShipPart(void)
switch (gCurrentSprite.pose) switch (gCurrentSprite.pose)
{ {
case 0x0: case 0:
temp = ramSlot = gCurrentSprite.roomSlot; roomSlot = gCurrentSprite.roomSlot;
gCurrentSprite.properties |= SP_ALWAYS_ACTIVE; gCurrentSprite.properties |= SP_ALWAYS_ACTIVE;
gCurrentSprite.status &= ~SPRITE_STATUS_NOT_DRAWN; gCurrentSprite.status &= ~SPRITE_STATUS_NOT_DRAWN;
gCurrentSprite.hitboxTopOffset = 0x0; gCurrentSprite.hitboxTopOffset = 0;
gCurrentSprite.hitboxBottomOffset = 0x0; gCurrentSprite.hitboxBottomOffset = 0;
gCurrentSprite.hitboxLeftOffset = 0x0; gCurrentSprite.hitboxLeftOffset = 0;
gCurrentSprite.hitboxRightOffset = 0x0; gCurrentSprite.hitboxRightOffset = 0;
gCurrentSprite.currentAnimationFrame = 0x0; gCurrentSprite.currentAnimationFrame = 0;
gCurrentSprite.animationDurationCounter = 0x0; gCurrentSprite.animationDurationCounter = 0;
gCurrentSprite.samusCollision = SSC_NONE; gCurrentSprite.samusCollision = SSC_NONE;
if (ramSlot == ESCAPE_SHIP_PART_TOP) if (roomSlot == ESCAPE_SHIP_PART_TOP)
{ {
gCurrentSprite.drawDistanceTopOffset = 0x30; gCurrentSprite.drawDistanceTopOffset = 0x30;
gCurrentSprite.drawDistanceBottomOffset = 0x8; gCurrentSprite.drawDistanceBottomOffset = 0x8;
gCurrentSprite.drawDistanceHorizontalOffset = 0x58; gCurrentSprite.drawDistanceHorizontalOffset = 0x58;
gCurrentSprite.drawOrder = 0xA; gCurrentSprite.drawOrder = 10;
gCurrentSprite.pOam = sEscapeShipPartOAM_Top; gCurrentSprite.pOam = sEscapeShipPartOAM_Top;
gCurrentSprite.pose = ESCAPE_SHIP_PART_POSE_UPDATE_TOP; gCurrentSprite.pose = ESCAPE_SHIP_PART_POSE_UPDATE_TOP;
} }
else if (ramSlot == ESCAPE_SHIP_PART_TAIL) else if (roomSlot == ESCAPE_SHIP_PART_TAIL)
{ {
gCurrentSprite.drawDistanceTopOffset = 0x30; gCurrentSprite.drawDistanceTopOffset = 0x30;
gCurrentSprite.drawDistanceBottomOffset = 0x0; gCurrentSprite.drawDistanceBottomOffset = 0;
gCurrentSprite.drawDistanceHorizontalOffset = 0x70; gCurrentSprite.drawDistanceHorizontalOffset = 0x70;
gCurrentSprite.drawOrder = 0xD; gCurrentSprite.drawOrder = 13;
gCurrentSprite.pOam = sEscapeShipPartOAM_Tail; gCurrentSprite.pOam = sEscapeShipPartOAM_Tail;
gCurrentSprite.pose = ESCAPE_SHIP_PART_POSE_WAIT_FOR_MOVING_TAIL; gCurrentSprite.pose = ESCAPE_SHIP_PART_POSE_WAIT_FOR_MOVING_TAIL;
gCurrentSprite.workVariable = 0x0; gCurrentSprite.workVariable = 0;
gCurrentSprite.workVariable2 = 0x4; gCurrentSprite.workVariable2 = 4;
} }
else if (temp == ESCAPE_SHIP_PART_FLAMES) else if (roomSlot == ESCAPE_SHIP_PART_FLAMES)
{ {
gCurrentSprite.drawDistanceTopOffset = 0x10; gCurrentSprite.drawDistanceTopOffset = 0x10;
gCurrentSprite.drawDistanceBottomOffset = 0x8; gCurrentSprite.drawDistanceBottomOffset = 0x8;
gCurrentSprite.drawDistanceHorizontalOffset = 0x60; gCurrentSprite.drawDistanceHorizontalOffset = 0x60;
gCurrentSprite.drawOrder = 0xE; gCurrentSprite.drawOrder = 14;
gCurrentSprite.pOam = sEscapeShipPartOAM_Flames; gCurrentSprite.pOam = sEscapeShipPartOAM_Flames;
gCurrentSprite.pose = ESCAPE_SHIP_PART_POSE_UPDATE_FLAMES; gCurrentSprite.pose = ESCAPE_SHIP_PART_POSE_UPDATE_FLAMES;
} }
break; break;
case ESCAPE_SHIP_PART_POSE_UPDATE_TOP: case ESCAPE_SHIP_PART_POSE_UPDATE_TOP:
if (gSpriteData[ramSlot].drawOrder == 0x4) if (gSpriteData[ramSlot].drawOrder == 4)
gCurrentSprite.drawOrder = 0x3; gCurrentSprite.drawOrder = 3;
else else
gCurrentSprite.drawOrder = 0xA; gCurrentSprite.drawOrder = 10;
break; break;
case ESCAPE_SHIP_PART_POSE_WAIT_FOR_MOVING_TAIL: case ESCAPE_SHIP_PART_POSE_WAIT_FOR_MOVING_TAIL:
if (gSpriteData[ramSlot].pose == ESCAPE_SHIP_POSE_CLOSED && gSpriteData[ramSlot].timer == 0x1) if (gSpriteData[ramSlot].pose == ESCAPE_SHIP_POSE_CLOSED && gSpriteData[ramSlot].timer == 1)
{ {
gCurrentSprite.pOam = sEscapeShipPartOAM_TailMoving; gCurrentSprite.pOam = sEscapeShipPartOAM_TailMoving;
gCurrentSprite.currentAnimationFrame = 0x0; gCurrentSprite.currentAnimationFrame = 0;
gCurrentSprite.animationDurationCounter = 0x0; gCurrentSprite.animationDurationCounter = 0;
gCurrentSprite.pose = ESCAPE_SHIP_PART_POSE_UPDATE_PALETTE; gCurrentSprite.pose = ESCAPE_SHIP_PART_POSE_UPDATE_PALETTE;
} }
EscapeShipPartUpdatePalette(0x8); EscapeShipPartUpdatePalette(8);
break; break;
case ESCAPE_SHIP_PART_POSE_UPDATE_PALETTE: case ESCAPE_SHIP_PART_POSE_UPDATE_PALETTE:
if (gSpriteData[ramSlot].pose >= ESCAPE_SHIP_POSE_HOVERING) if (gSpriteData[ramSlot].pose >= ESCAPE_SHIP_POSE_HOVERING)
{ {
gCurrentSprite.animationDurationCounter++; gCurrentSprite.animationDurationCounter++;
delay = 0x4; delay = 4;
} }
else else
delay = 0x8; delay = 8;
EscapeShipPartUpdatePalette(delay); EscapeShipPartUpdatePalette(delay);
break; break;
@ -553,4 +552,4 @@ void EscapeShipPart(void)
if (gSpriteData[ramSlot].pose > ESCAPE_SHIP_POSE_HOVERING) if (gSpriteData[ramSlot].pose > ESCAPE_SHIP_POSE_HOVERING)
gCurrentSprite.status |= SPRITE_STATUS_NOT_DRAWN; gCurrentSprite.status |= SPRITE_STATUS_NOT_DRAWN;
} }
} }