Helion-Engine / Helion

A modern fast paced Doom FPS engine
GNU General Public License v3.0
86 stars 9 forks source link

Chainsaw weapon sprite bobbing isn't interpolated (unlike in GZDoom) #550

Open Calinou opened 8 months ago

Calinou commented 8 months ago

Helion version: https://github.com/Helion-Engine/Helion/commit/3e60de303e27c74738b6e98e125ffb48a552c2cd

You can see interpolation is still slightly in effect if you move while holding a chainsaw, but it snaps between discrete positions every time the animation frame changes:

https://github.com/Helion-Engine/Helion/assets/180032/ec970153-fb5f-4e59-b21f-1f8a8b7c97ba

While vanilla Doom has the same issue, it's quite jarring compared to other weapons and should probably be changed to match GZDoom behavior.

72hr commented 6 days ago

I don't know anything about Doom internals but I looked through the code... WeaponBobOffset is only updated in SetBob() on ticks where the weapon is ready to fire, and that only happens if A_WeaponReady was called, which the chainsaw calls every 4 ticks but with the state lasting for 4 ticks. So ReadyToFire is false on ticks 2-4. What could be a proper solution? Adding a counter field for A_WeaponReady ticks remaining? Checking the current state action to see if it's A_WeaponReady?

https://github.com/Helion-Engine/Helion/blob/ac28d810c143780621679e73b7157da27240d1cc/Core/World/Entities/Players/Player.cs#L944-L953