| 222 | } |
| 223 | |
| 224 | void RopeDynamics(ROPE_STRUCT* rope) |
| 225 | { |
| 226 | PENDULUM* pendulumPointer; |
| 227 | Vector3i vec, vec2; |
| 228 | |
| 229 | int flag = 0; |
| 230 | if (rope->coiled) |
| 231 | { |
| 232 | --rope->coiled; |
| 233 | if (!rope->coiled) |
| 234 | { |
| 235 | for (int i = 0; i < ROPE_SEGMENTS; ++i) |
| 236 | rope->velocity[i].y = 0; |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | if (Lara.Control.Rope.Ptr != -1 && rope == &Ropes[Lara.Control.Rope.Ptr]) |
| 241 | { |
| 242 | pendulumPointer = &CurrentPendulum; |
| 243 | if (CurrentPendulum.node != Lara.Control.Rope.Segment + 1) |
| 244 | { |
| 245 | SetPendulumPoint(rope, Lara.Control.Rope.Segment + 1); |
| 246 | flag = 1; |
| 247 | } |
| 248 | } |
| 249 | else |
| 250 | { |
| 251 | pendulumPointer = &AlternatePendulum; |
| 252 | if (Lara.Control.Rope.Ptr == -1 && CurrentPendulum.rope) |
| 253 | { |
| 254 | for (int i = 0; i < CurrentPendulum.node; i++) |
| 255 | { |
| 256 | CurrentPendulum.rope->velocity[i].x = CurrentPendulum.rope->velocity[CurrentPendulum.node].x; |
| 257 | CurrentPendulum.rope->velocity[i].y = CurrentPendulum.rope->velocity[CurrentPendulum.node].y; |
| 258 | CurrentPendulum.rope->velocity[i].z = CurrentPendulum.rope->velocity[CurrentPendulum.node].z; |
| 259 | } |
| 260 | |
| 261 | CurrentPendulum.position.x = 0; |
| 262 | CurrentPendulum.position.y = 0; |
| 263 | CurrentPendulum.position.z = 0; |
| 264 | |
| 265 | CurrentPendulum.velocity.x = 0; |
| 266 | CurrentPendulum.velocity.y = 0; |
| 267 | CurrentPendulum.velocity.z = 0; |
| 268 | |
| 269 | CurrentPendulum.node = -1; |
| 270 | CurrentPendulum.rope = NULL; |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | if (Lara.Control.Rope.Ptr != -1) |
| 275 | { |
| 276 | vec.x = pendulumPointer->position.x - rope->segment[0].x; |
| 277 | vec.y = pendulumPointer->position.y - rope->segment[0].y; |
| 278 | vec.z = pendulumPointer->position.z - rope->segment[0].z; |
| 279 | NormaliseRopeVector(&vec); |
| 280 | |
| 281 | for (int i = pendulumPointer->node; i >= 0; --i) |
no test coverage detected