Originally posted by KilloZapit
How did you fix it? I was thinking of making an extra flag that simply disables jumping for one frame after you land, which should also disable bunny hopping, but may throw off people's timing.
The code that pushes Mario out of a wall runs after the code that detects if Mario is in contact with the ground, making walljumping possible. I just moved that code to freespace and called it from a hijack that runs before the "Mario is on ground" code runs. This prevents that code from detecting Mario on the ground for one frame when against a wall.
Then I realized the hijack I used doesn't run when Mario is against the side of the screen, but only when Mario is touching a block, meaning you could walk through the side of the screen and die. So I added another hijack to the same code that runs only when Mario is against the side of the screen, fixing that.
If you aren't pushed out of small spaces, isn't it possible to get stuck, or can you still duckjump out?
You can still duckjump out. But there's a patch that disables duckjumping, right? If that is used with this patch, you could get stuck.
Edit: fixed it by simulating the default behavior (and adding yet another hijack). Depending on the value of $77, it either does nothing, or subtracts 1 or 2 from $94 (using 16-bit mode of course *facepalm*).
Edit: Realized you could still walljump when moving at a wall really fast, because the anti-clipping code only moves Mario out of the block by 1 pixel per frame, meaning you could still be in the wall after the code runs if moving really fast, so you could still walljump. Fixed it by moving Mario outside the block instantly instead of one pixel per frame.
Edit: fixed a glitch where Mario would clip in and out of a block really fast before dying when being crushed between layer 1 and layer 2.
Edit: restored a missing line of code that broke the simulated behavior of big Mario moving left in a one block high space.
Edit: added code to properly fix the note block clipping glitch where you jump on a note block that is against a wall and clip through the wall and die. It needs the same hijack used by this patch, so I combined them.