Improved speed preserving strafing

For speed preserving strafing, we now deal with the case where the player is on
ground separately.  Some measures are added to avoid getting NaNs which can
freeze the game.

One problem is that the speed would still increase very gradually, so it is not
really "speed preserving".