keeperfx
keeperfx copied to clipboard
Shots with speeds over 255 aim too high
Any projectile with speeds set above 256, warps their trajectory. Any angle that is not facing perfectly cardinal and the projectile veers off course from the center. see video example, its more extreme when looking up and down...
https://github.com/dkfans/keeperfx/assets/167131626/a546856e-8e53-4eed-9e0e-22c75c874ba6
I looked into it a bit.
In thing_fire_shot
the code is using the shot speed in this seemingly unrelated function:
angles_to_vector(shotng->move_angle_xy, shotng->move_angle_z, speed, &cvect);
shotng->veloc_push_add.x.val += cvect.x;
shotng->veloc_push_add.y.val += cvect.y;
shotng->veloc_push_add.z.val += cvect.z;
In angles_to_vector it does set vertical momentum too, which I have not bothered to figure out. It seems likely though that it assumes a max speed of 255.