NagyD / SDLPoP

An open-source port of Prince of Persia, based on the disassembly of the DOS version.
GNU General Public License v3.0
1.1k stars 140 forks source link

Fix for Prince or guard falling through the floor during a strike #274

Closed dstarosta closed 2 years ago

dstarosta commented 2 years ago

The prince or a guard can fall through a floor during a sword strike even though there is a floor tile in front of him followed by a cliff/drop.

A strike sequence consists of 4 important frames, 151-154. Frame 153 is different from the other 3 because has a flag that it "needs a floor". The problem is strike frames a pretty wide so the character's tile is not calculated correctly causing him to visually fall through the floor.

This fix prevents falling during that frame by treating it like it does not require a floor.

Here are some videos of the bug. For the prince video I temporarily added an ability to draw a sword anytime but it can happen in a fight as well.

https://youtu.be/D5MiTmQrFD8 https://youtu.be/V59Z668bhWM

After the fix

https://youtu.be/mODEhtIy-bI

NagyD commented 2 years ago

Can you make a testcase replay file for this?

dstarosta commented 2 years ago

pr274testcase.zip

NagyD commented 2 years ago

Thank you!

I have added it to the testcase directory: 8b1be5c4f43bf2b9e277e0ab19dc7959b0788948