Super Metroid: hacking the frozen enemies

I’ve been messing around in the Super Metroid code.  My main goal is to make Screw Attack destroy frozen enemies, and for style points, not destroy them when landing on them from above.  I made a CPU trace of jumping into an enemy normally, and found that in the Samus/Enemy collision code, there’s a check so that if the enemy has a freeze timer (is frozen), then it just backs out and considers it “not a collision.”  For some reason, it also skips the freeze check for enemy $DAFF, a metroid without any AI.  Which probably means that enemy is unused and checking for it is useless.

Seems straightforward, but the Samus/enemy collision code doesn’t get run in normal use with a frozen enemy!  There’s another set of collision-checking code that checks frozen enemies, does its collision detection with Samus’ predicted position for the next frame, and adds the enemy to the “enemies that may interact with Samus” list if the enemy is frozen and a collision is predicted.  (I don’t have the trace in front of me, but IIRC, non-frozen enemies skip the entire collision detection.)

I painstakingly annotated a collision-detection and nothing interesting ever happened, because it turns out, that was the horizontal code and I was colliding vertically.  So I made the table-flip gesture (yay, wasting 45 minutes) and ragequit for the night, and now I get to do it all again tonight.

 

Leave a Reply

Your email address will not be published. Required fields are marked *