Fix DEZ Eggrobo boss collision glitch
From Sonic Retro
(Original guide by Flamewing)
In Death Egg Zone, the final boss you fight is the infamous Giant Mech. While cited for its difficulty, it is also known for a particularly annoying bug that makes the boss fight that much more difficult. When hitting the boss in a certain manner, (this is better described by flamewing) it can cause you to fall into the robot, being killed by its arms, instead of rebounding much in the manner that you would when fighting any other boss. In the Sonic 2 Heroes forum topic, flamewing discusses how exactly to fix it, and it is far simpler than many people believed.
Open up s2.asm and find label 'loc_3DFF8' or 'ObjC7_CheckHit'; this function is responsible for checking if:
1. If Eggrobo has been defeated: causes him to break up if so;
1. If Eggrobo is flashing from a previous hit: keep flashing until timer runs out;
1. If Eggrobo was hit on the body: play hit sound, start flashing;
2. Otherwise, if Eggrobo was hit on the head, then subtract 1 hit from hit counter, remove collision from body and proceed as previous item.
If you paid attention, you will have noticed that hitting Eggrobo in the head removes collision from the body, but that hitting him on the body does not remove collision from the head; we will fix this now. The easiest fix is to go to this piece of code:
loc_3E01E: move.b #$3C,objoff_2A(a0) move.w #SndID_BossHit,d0 jsr (PlaySound).l
and change it to this:
loc_3E01E: movea.w objoff_36(a0),a1 ; a1=Eggrobo's head clr.b collision_flags(a1) ; Remove collision from head move.b #$3C,objoff_2A(a0) move.w #SndID_BossHit,d0 jsr (PlaySound).l