| 444 | } |
| 445 | |
| 446 | static void BackgroundCollision(ItemInfo* UPVItem, ItemInfo* laraItem) |
| 447 | { |
| 448 | auto* UPV = GetUPVInfo(UPVItem); |
| 449 | auto* lara = GetLaraInfo(laraItem); |
| 450 | CollisionInfo cinfo, * coll = &cinfo; // ?? |
| 451 | |
| 452 | coll->Setup.Mode = CollisionProbeMode::Quadrants; |
| 453 | coll->Setup.Radius = UPV_RADIUS; |
| 454 | |
| 455 | coll->Setup.LowerFloorBound = NO_LOWER_BOUND; |
| 456 | coll->Setup.UpperFloorBound = -UPV_HEIGHT; |
| 457 | coll->Setup.LowerCeilingBound = UPV_HEIGHT; |
| 458 | coll->Setup.UpperCeilingBound = NO_UPPER_BOUND; |
| 459 | |
| 460 | coll->Setup.BlockFloorSlopeUp = false; |
| 461 | coll->Setup.BlockFloorSlopeDown = false; |
| 462 | coll->Setup.BlockDeathFloorDown = false; |
| 463 | coll->Setup.BlockMonkeySwingEdge = false; |
| 464 | coll->Setup.EnableObjectPush = true; |
| 465 | coll->Setup.EnableSpasm = false; |
| 466 | |
| 467 | coll->Setup.PrevPosition = UPVItem->Pose.Position; |
| 468 | |
| 469 | if ((UPVItem->Pose.Orientation.x >= -(SHRT_MAX / 2 + 1)) && (UPVItem->Pose.Orientation.x <= (SHRT_MAX / 2 + 1))) |
| 470 | { |
| 471 | lara->Control.MoveAngle = UPVItem->Pose.Orientation.y; |
| 472 | coll->Setup.ForwardAngle = lara->Control.MoveAngle; |
| 473 | } |
| 474 | else |
| 475 | { |
| 476 | lara->Control.MoveAngle = UPVItem->Pose.Orientation.y - ANGLE(180.0f); |
| 477 | coll->Setup.ForwardAngle = lara->Control.MoveAngle; |
| 478 | } |
| 479 | |
| 480 | int height = phd_sin(UPVItem->Pose.Orientation.x) * UPV_LENGTH; |
| 481 | if (height < 0) |
| 482 | height = -height; |
| 483 | if (height < 200) |
| 484 | height = 200; |
| 485 | |
| 486 | coll->Setup.UpperFloorBound = -height; |
| 487 | coll->Setup.Height = height; |
| 488 | |
| 489 | GetCollisionInfo(coll, UPVItem, Vector3i(0, height / 2, 0)); |
| 490 | ShiftItem(UPVItem, coll); |
| 491 | |
| 492 | if (coll->CollisionType == CollisionType::Front) |
| 493 | { |
| 494 | if (UPV->TurnRate.x > UPV_DEFLECT_ANGLE) |
| 495 | UPV->TurnRate.x += UPV_DEFLCT_TURN_RATE_MAX; |
| 496 | else if (UPV->TurnRate.x < -UPV_DEFLECT_ANGLE) |
| 497 | UPV->TurnRate.x -= UPV_DEFLCT_TURN_RATE_MAX; |
| 498 | else |
| 499 | { |
| 500 | if (abs(UPV->Velocity) >= UPV_VELOCITY_MAX) |
| 501 | { |
| 502 | laraItem->Animation.TargetState = UPV_STATE_COLLIDE; |
| 503 | UPV->Velocity = -UPV->Velocity / 2; |
no test coverage detected