| 86 | } |
| 87 | |
| 88 | Vector3i* NormaliseRopeVector(Vector3i* vec) |
| 89 | { |
| 90 | int x = vec->x >> FP_SHIFT; |
| 91 | int y = vec->y >> FP_SHIFT; |
| 92 | int z = vec->z >> FP_SHIFT; |
| 93 | |
| 94 | if (!x && !y && !z) |
| 95 | return vec; |
| 96 | |
| 97 | int length = SQUARE(x) + SQUARE(y) + SQUARE(z); |
| 98 | if (length < 0) |
| 99 | length = -length; |
| 100 | |
| 101 | length = 65536 / sqrt(length); |
| 102 | |
| 103 | vec->x = ((int64_t)length * vec->x) >> FP_SHIFT; |
| 104 | vec->y = ((int64_t)length * vec->y) >> FP_SHIFT; |
| 105 | vec->z = ((int64_t)length * vec->z) >> FP_SHIFT; |
| 106 | return vec; |
| 107 | } |
| 108 | |
| 109 | void GetRopePos(ROPE_STRUCT* rope, int segmentFrame, int* x, int* y, int* z) |
| 110 | { |
no outgoing calls
no test coverage detected