Virazek / Spyro2-Decomp

Disassembly of Spyro 2
MIT License
1 stars 0 forks source link

Identify cause of the double jump glitch and allow it to be available as an Archipelago item #12

Open Virazek opened 2 months ago

Virazek commented 2 months ago

This isn't strictly the cause, but it seems that most of aircharging handling is done in HANDLE_POSITION_CHANGE_FROM_ACTION (starting 0x80033300), starting at branch 0x800341C0. This doesn't actually fix the cause of double-jump (which is still unknown), but we can insert a jump here to force 0x8006A08C (aircharge z-velocity?) to always be non-positive. This subroutine already does this to lock aircharge at a terminal velocity of -0x2300.

Virazek commented 2 months ago

If I were to hazard a guess, the cause of double-jump is reusing this 0x8006A08C from the normal jump subroutine. This value isn't flushed upon doing an aircharge, so it takes this large positive value as its initial velocity. This value is flushed when a directional button is pressed correctly before starting an aircharge, so if we can find where this check happens and make it conditional, then we can fully enable double jump as an item.

Virazek commented 2 months ago

It seems like branch 0x80035BA0 is the culprit: it checks whether 0x8006A0A8 (which is some sort of relative velocity) is less than 0x800. If it is, it sets this value to 0x800 and does some other calculations. This value is constantly zero during a normal jump, but is non-zero with enough movement (which is why walking double-jumps are still possible). Changing the comparison value to 0x00 removes double-jump entirely, while changing the threshold allows for full walking double-jumps. As well, changing the write to 0x8006A0A8 in the following instructions changes the angle of the double-jump, so it's probably something related to this and could be patched out in some other way.