| 419 | } |
| 420 | |
| 421 | int RopeNodeCollision(ROPE_STRUCT* rope, int x, int y, int z, int radius) |
| 422 | { |
| 423 | for (int i = 0; i < ROPE_SEGMENTS - 2; ++i) |
| 424 | { |
| 425 | if (y > rope->position.y + (rope->meshSegment[i].y >> FP_SHIFT) |
| 426 | && y < rope->position.y + (rope->meshSegment[i + 1].y >> FP_SHIFT)) |
| 427 | { |
| 428 | int dx = x - ((rope->meshSegment[i + 1].x + rope->meshSegment[i].x) >> (FP_SHIFT + 1)) - rope->position.x; |
| 429 | int dy = y - ((rope->meshSegment[i + 1].y + rope->meshSegment[i].y) >> (FP_SHIFT + 1)) - rope->position.y; |
| 430 | int dz = z - ((rope->meshSegment[i + 1].z + rope->meshSegment[i].z) >> (FP_SHIFT + 1)) - rope->position.z; |
| 431 | |
| 432 | if (pow(dx, 2) + pow(dy, 2) + pow(dz, 2) < pow(radius + 64, 2)) |
| 433 | return i; |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | return -1; |
| 438 | } |
| 439 | |
| 440 | void ApplyVelocityToRope(int node, short angle, short n) |
| 441 | { |