SHARE
TWEET

Untitled

a guest Jan 12th, 2020 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     /** Apply ocean/canal speed fraction to a velocity */
  2.     uint ApplyWaterClassSpeedFrac(uint raw_speed, WaterDepth depth) const
  3.     {
  4.         bool is_ocean = depth >= WATER_DEPTH_DEEP;
  5.         WaterDepth depth_diff = WATER_DEPTH_MAX - depth;
  6.         byte speed_frac = min(256, is_ocean ? this->ocean_speed_frac + depth_diff : this->canal_speed_frac + depth_diff);
  7.         /* speed_frac == 0 means no reduction while 0xFF means reduction to 1/256. */
  8.         return raw_speed * (256 - speed_frac) / 256;
  9.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top