MMX5 sets the player health to 0 after exiting a stage, and restores it when entering a new stage. During the final boss rush, the transitions are quick and health stays at 0 for a single frame, which hits an edge case in generic_swap. HP at 0 fulfills currhp < prevhp and starts data.hpcountdown, but when hpcountdown reaches 0 health is back at its max value and fulfills currhp > minhp, swapping even though the life count hasn't decreased. This happens at the beginning and end of each boss rush fight.
It would probably be better to address this in generic_swap, either by not triggering hpcountdown if currhp is 0, or by making sure currhp is still decreased when hpcountdown reaches 0, but I don't want to have to test that a potential fix doesn't break any other game using generic_swap, so this PR works around it with a gmode that seems to reliably indicate gameplay.
MMX5 sets the player health to 0 after exiting a stage, and restores it when entering a new stage. During the final boss rush, the transitions are quick and health stays at 0 for a single frame, which hits an edge case in
generic_swap
. HP at 0 fulfillscurrhp < prevhp
and startsdata.hpcountdown
, but whenhpcountdown
reaches 0 health is back at its max value and fulfillscurrhp > minhp
, swapping even though the life count hasn't decreased. This happens at the beginning and end of each boss rush fight.https://github.com/authorblues/bizhawk-shuffler-2/blob/1f37b9719474275ebf44f8c0653bdda589e27e93/plugins/megaman-damage-shuffler.lua#L88-L100
It would probably be better to address this in
generic_swap
, either by not triggeringhpcountdown
ifcurrhp
is 0, or by making surecurrhp
is still decreased whenhpcountdown
reaches 0, but I don't want to have to test that a potential fix doesn't break any other game usinggeneric_swap
, so this PR works around it with agmode
that seems to reliably indicate gameplay.