| 349 | } |
| 350 | |
| 351 | void ChaffFlareControl(short itemNumber) |
| 352 | { |
| 353 | auto* item = &g_Level.Items[itemNumber]; |
| 354 | |
| 355 | if (item->Animation.Velocity.y) |
| 356 | { |
| 357 | item->Pose.Orientation.x += ANGLE(3.0f); |
| 358 | item->Pose.Orientation.z += ANGLE(5.0f); |
| 359 | } |
| 360 | |
| 361 | int dx = item->Animation.Velocity.z * phd_sin(item->Pose.Orientation.y); |
| 362 | int dz = item->Animation.Velocity.z * phd_cos(item->Pose.Orientation.y); |
| 363 | |
| 364 | item->Pose.Position.x += dx; |
| 365 | item->Pose.Position.z += dz; |
| 366 | |
| 367 | if (TestEnvironment(ENV_FLAG_WATER, item->RoomNumber)) |
| 368 | { |
| 369 | item->Animation.Velocity.y += (5.0f - item->Animation.Velocity.y) / 2.0f; |
| 370 | item->Animation.Velocity.z += (5.0f - item->Animation.Velocity.z) / 2.0f; |
| 371 | } |
| 372 | else |
| 373 | { |
| 374 | item->Animation.Velocity.y += g_GameFlow->GetSettings()->Physics.Gravity; |
| 375 | } |
| 376 | |
| 377 | item->Pose.Position.y += item->Animation.Velocity.y; |
| 378 | |
| 379 | DoProjectileDynamics(itemNumber, item->Pose.Position.x, item->Pose.Position.y, item->Pose.Position.z, dx, item->Animation.Velocity.y, dz); |
| 380 | |
| 381 | auto pos1 = GetJointPosition(item, 0, Vector3i(0, 0, (GlobalCounter & 1) != 0 ? 48 : -48)); |
| 382 | auto pos2 = GetJointPosition(item, 0, Vector3i(0, 0, 8 * ((GlobalCounter & 1) != 0 ? 48 : -48))); |
| 383 | TriggerTorpedoBubbles(&pos1, &pos2, 1); |
| 384 | |
| 385 | if (item->ItemFlags[0] >= 300) |
| 386 | { |
| 387 | if (!item->Animation.Velocity.y && !item->Animation.Velocity.z) |
| 388 | { |
| 389 | if (item->ItemFlags[1] <= 90) |
| 390 | item->ItemFlags[1]++; |
| 391 | else |
| 392 | KillItem(itemNumber); |
| 393 | } |
| 394 | } |
| 395 | else |
| 396 | item->ItemFlags[0]++; |
| 397 | } |
| 398 | |
| 399 | void TorpedoControl(short itemNumber) |
| 400 | { |
nothing calls this directly
no test coverage detected