Fix jump bug

This commit is contained in:
Miloslav Číž 2020-09-13 19:53:04 +02:00
parent a426d0678b
commit 57bc76e577

View File

@ -267,7 +267,12 @@
#endif #endif
#define SFG_PLAYER_JUMP_OFFSET_PER_FRAME \ #define SFG_PLAYER_JUMP_OFFSET_PER_FRAME \
((SFG_PLAYER_JUMP_SPEED * RCL_UNITS_PER_SQUARE) / SFG_FPS) (((SFG_PLAYER_JUMP_SPEED * RCL_UNITS_PER_SQUARE) / SFG_FPS) \
- SFG_GRAVITY_SPEED_INCREASE_PER_FRAME / 2)
/* ^ This substraction corrects the initial veloc. so that the numeric curve
copies the analytical (smooth) curve. Without it the numeric curve goes
ABOVE and makes player jump higher with lower FPS. To make sense of this
try to solve the differential equation and plot it. */
#if SFG_PLAYER_JUMP_OFFSET_PER_FRAME == 0 #if SFG_PLAYER_JUMP_OFFSET_PER_FRAME == 0
#define SFG_PLAYER_JUMP_OFFSET_PER_FRAME 1 #define SFG_PLAYER_JUMP_OFFSET_PER_FRAME 1