Raptor007 / aq2-tng

Action Quake 2: The Next Generation. Raptor007's sandbox for testing changes. When verified stable, this code is pushed to the official aq2-tng repo:
https://github.com/aq2-tng/aq2-tng/tree/bots
4 stars 2 forks source link

Constant footsteps when going down ladders. #71

Closed Raptor007 closed 6 years ago

Raptor007 commented 6 years ago

The "small fall" doesn't check if you're on a ladder, so every frame climbing down, it makes a footstep sound: https://github.com/Raptor007/aq2-tng/blob/19e78f171fa7bd45dc95caf8cc545fd721de6d67/source/p_view.c#L633-L637

This behavior existed in AQ2 1.52 and even in baseq2, but I don't think it was intentional as traveling up ladders is silent. It also happens on every server frame, which means traditionally it would make 10 sounds per second, but now might do even more depending on sv_fps.

Raptor007 commented 6 years ago

It's partially caused by this part: https://github.com/Raptor007/aq2-tng/blob/19e78f171fa7bd45dc95caf8cc545fd721de6d67/source/p_view.c#L601-L606 The purpose seems to be making sure footstep sounds are generated if you bounce off some slopes without stopping.

Raptor007 commented 6 years ago

It seems Pmove checks if you're on a ladder but never shares this flag with the mod: https://github.com/skullernet/q2pro/blob/49c150d0b1b081f2da431188fd27ba8b52243957/src/common/pmove.c#L751-L760

Raptor007 commented 6 years ago

Fixed: https://github.com/Raptor007/aq2-tng/commit/742044566591f26637876e5a3e467085a555e18e

Trickier than I thought. It's important to preserve the ladder fall damage, and my ladder and old_ladder flags are not necessarily in sync with Pmove. So to be safe I only consider the small delta that would create a foostep sound and don't touch anything with a higher delta, nor change the way it deals with groundentity (which is NULL on ladders): https://github.com/Raptor007/aq2-tng/blob/742044566591f26637876e5a3e467085a555e18e/source/p_view.c#L662-L666

Side note: It may also be worth investigating if fall damage is correct when sv_fps is not 10: https://github.com/Raptor007/aq2-tng/blob/742044566591f26637876e5a3e467085a555e18e/source/p_view.c#L612-L613