Skip to content
Snippets Groups Projects

Replace P_AproxDistance with FixedHypot, and replace FixedHypot's algorithm with R_PointToDist2's

Merged James R. requested to merge redundant-hypot into next
  1. Dec 12, 2020
    • James R.'s avatar
      75633bde
    • Sal's avatar
      Use R_PointToDist2 instead · e19196a8
      Sal authored and James R.'s avatar James R. committed
      Apparently overflows less often
      
      Actually, lets just fix FixedHypot instead.
      
      Now FixedHypot uses the code from R_PointToDist2, and R_PointToDist2 just calls FixedHypot.
      
      Ultimately, this branch was intended to get rid of a redundant way to retrieve distance and replace it with the one that was actually good at its job. So consolidating FixedHypot and R_PointToDist2 together is just an extension of that.
      e19196a8
    • Sal's avatar
      Use FixedHypot over P_AproxDistance · c5474436
      Sal authored and James R.'s avatar James R. committed
      Not convinced that the small speed benefit from P_AproxDistance is worth the "aproximate"[sic] results it gives. Let's instead try a define to replace it with FixedHypot. In Lua, the function gives a deprecated warning.
      
      Inspired by the hyperwall fix for vanilla, except for everything. From little testing, actively improves waypoint checks, bumping, speed checks, wall collisions, Jawz targetting, Lightning Shield attacks, so on.
      
      The only way I see this as a potential downgrade is A_Look (and related functions) getting slower, which are barely used in Kart.
      c5474436
Loading