Fix Zebetite function fakematch

This commit is contained in:
y.demaisonregne 2023-05-27 20:07:49 +02:00
parent 3d411afdc9
commit 1150d96828
4 changed files with 36 additions and 26 deletions

View File

@ -2,7 +2,7 @@
This is a work in progress decompilation of Metroid - Zero Mission.
2567/2721 functions decompiled (94.34%, 154 left)
2568/2721 functions decompiled (94.38%, 153 left)
Progress can be seen here : https://docs.google.com/spreadsheets/d/1X8XarD5evY8ZI7r_GQqh1pYmdVMbBcINYfRBUlogmKY/edit#gid=0
**This decomp is not shiftable, don't use it as a base to work on anything**

View File

@ -1,8 +1,15 @@
#include "gba.h"
#include "sprites_AI/escape_ship.h"
#include "gba.h"
#include "data/sprites/escape_ship.h"
#include "constants/particle.h"
#include "constants/samus.h"
#include "constants/event.h"
#include "constants/color_fading.h"
#include "constants/sprite.h"
#include "structs/samus.h"
#include "structs/sprite.h"
/**
@ -182,7 +189,9 @@ void EscapeShipCheckCollidingWithLaser(void)
void EscapeShip(void)
{
/*u16 yPosition;
// https://decomp.me/scratch/qJSzq
u16 yPosition;
u16 xPosition;
i32 movement;
u8 offset;
@ -300,16 +309,22 @@ void EscapeShip(void)
case ESCAPE_SHIP_POSE_CLOSED:
if (gCurrentSprite.timer != 0x0)
{
timer = --gCurrentSprite.timer;
if (timer < 0xB)
gCurrentSprite.timer--;
if (gCurrentSprite.timer < 0xB)
{
gCurrentSprite.xPosition += 0x2;
else if (timer == 0xB)
break;
}
if (gCurrentSprite.timer == 0xB)
{
SpriteSpawnSecondary(SSPRITE_ESCAPE_SHIP_PART, ESCAPE_SHIP_PART_FLAMES,
gCurrentSprite.spritesetGFXSlot, gCurrentSprite.primarySpriteRAMSlot, yPosition, xPosition, 0x0);
SoundPlay(0x250);
break;
}
else if (timer == 0xC)
if (gCurrentSprite.timer == 0xC)
StartEffectForCutscene(EFFECT_CUTSCENE_SAMUS_IN_BLUE_SHIP);
}
else
@ -427,7 +442,7 @@ void EscapeShip(void)
EscapeShipSetPirateDrawOrder();
if (gCurrentSprite.pose > ESCAPE_SHIP_POSE_HOVERING && gCurrentSprite.workVariable > 0x10)
EscapeShipPirateCollision();
}*/
}
}
/**
@ -436,6 +451,8 @@ void EscapeShip(void)
*/
void EscapeShipPart(void)
{
// https://decomp.me/scratch/XdNST
u8 ramSlot;
u8 delay;
register u8 temp asm("r5");

View File

@ -1206,11 +1206,10 @@ void ImagoPartSyncPalette(void)
void Imago(void)
{
// https://decomp.me/scratch/H8S1t
u16 xDistance;
u16 yDistance;
u16 health;
u8 pose;
u32 health;
if (gCurrentSprite.pose < IMAGO_POSE_DYING_INIT && gCurrentSprite.properties & SP_DAMAGED)
{
@ -1222,12 +1221,12 @@ void Imago(void)
if (!(gFrameCounter8Bit & 0xF))
{
health = gCurrentSprite.health;
pose = gCurrentSprite.pose - 0x8;
if (pose < IMAGO_POSE_DESTROY_WALL - 0x8)
if ((u8)(gCurrentSprite.pose - 0x8) < IMAGO_POSE_DESTROY_WALL - 0x8)
{
yDistance = gSubSpriteData1.yPosition > gSamusData.yPosition ?
gSubSpriteData1.yPosition - gSamusData.yPosition :
gSamusData.yPosition - gSubSpriteData1.yPosition;
if (gSubSpriteData1.yPosition > gSamusData.yPosition)
yDistance = gSubSpriteData1.yPosition - gSamusData.yPosition;
else
yDistance = gSamusData.yPosition - gSubSpriteData1.yPosition;
if (gSubSpriteData1.xPosition > gSamusData.xPosition)
{
@ -1238,7 +1237,7 @@ void Imago(void)
if (health == 0x0)
SoundPlay(0xBB);
}
else if (xDistance< 0xFA)
else if (xDistance < 0xFA)
{
SoundPlay(0xB9);
if (health == 0x0)

View File

@ -20,14 +20,10 @@
*/
void Zebetite(void)
{
// https://decomp.me/scratch/0Oxa5
u32 alreadyDead;
u16 maxHealth;
u16 spawnHealth;
register u32 health asm("r4");
u32 phase;
i32 healthDiff;
if (gCurrentSprite.pose == 0)
{
@ -94,12 +90,10 @@ void Zebetite(void)
}
maxHealth = sPrimarySpriteStats[gCurrentSprite.spriteID][0];
health = gCurrentSprite.health;
healthDiff = maxHealth - health;
phase = healthDiff / 20;
phase = (maxHealth - gCurrentSprite.health) / 20;
if (health == gCurrentSprite.oamScaling)
if (gCurrentSprite.health == gCurrentSprite.oamScaling)
{
if (phase != 0)
{
@ -110,7 +104,7 @@ void Zebetite(void)
}
else
{
if (health < maxHealth)
if (gCurrentSprite.health < maxHealth)
{
if (gDifficulty == DIFF_EASY)
gCurrentSprite.timer = 0x3C;