| 767 | } |
| 768 | |
| 769 | void shorten(const vec &from, vec &target, float distsquared) |
| 770 | { |
| 771 | target.sub(from); |
| 772 | float m = target.squaredlen(); |
| 773 | if(m < 0.07f) target.add(vec(0.1f, 0.1f, 0.1f)); // if "from == target" just fake a target to avoid zero-length fx vectors |
| 774 | else target.mul(max(0.07f, sqrtf(distsquared / m))); |
| 775 | target.add(from); |
| 776 | } |
| 777 | |
| 778 | void raydamage(vec &from, vec &to, playerent *d) |
| 779 | { |