| 881 | } |
| 882 | |
| 883 | void ProcessSectorFlags(ItemInfo* item) |
| 884 | { |
| 885 | if (g_GameFlow->CurrentFreezeMode != FreezeMode::None) |
| 886 | return; |
| 887 | |
| 888 | bool isPlayer = item->IsLara(); |
| 889 | |
| 890 | // HACK: because of L-shaped portal configurations, we need to fetch room number from Location struct for player. |
| 891 | auto pointColl = isPlayer ? GetPointCollision(item->Pose.Position, item->Location.RoomNumber) : GetPointCollision(*item); |
| 892 | auto& sector = pointColl.GetBottomSector(); |
| 893 | |
| 894 | // Set monkeyswing and wall climb statuses for player. |
| 895 | if (isPlayer) |
| 896 | { |
| 897 | auto& player = GetLaraInfo(*item); |
| 898 | |
| 899 | // Set wall climb status. |
| 900 | if (TestLaraNearClimbableWall(item, §or)) |
| 901 | { |
| 902 | player.Control.CanClimbLadder = true; |
| 903 | } |
| 904 | else |
| 905 | { |
| 906 | player.Control.CanClimbLadder = false; |
| 907 | } |
| 908 | |
| 909 | // Set monkey swing status. |
| 910 | player.Control.CanMonkeySwing = sector.Flags.Monkeyswing; |
| 911 | } |
| 912 | |
| 913 | // Burn or drown item. |
| 914 | if (sector.Flags.Death && item->Pose.Position.y == item->Floor && pointColl.GetFloorBridgeItemNumber() == NO_VALUE) |
| 915 | { |
| 916 | if (isPlayer) |
| 917 | { |
| 918 | const auto& player = GetLaraInfo(*item); |
| 919 | |
| 920 | if (!IsJumpState((LaraState)item->Animation.ActiveState) || player.Control.WaterStatus != WaterStatus::Dry || item->HitPoints <= 0) |
| 921 | { |
| 922 | // Check floor material. |
| 923 | auto material = sector.GetSurfaceMaterial(pointColl.GetPosition().x, pointColl.GetPosition().z, true); |
| 924 | if (material == MaterialType::Water && Objects[ID_KAYAK_LARA_ANIMS].loaded) // HACK: Allow both lava and rapids in same level. |
| 925 | { |
| 926 | KayakLaraRapidsDrown(item); |
| 927 | } |
| 928 | else |
| 929 | { |
| 930 | LavaBurn(item); |
| 931 | } |
| 932 | } |
| 933 | } |
| 934 | else if (Objects[item->ObjectNumber].intelligent && item->HitPoints != NOT_TARGETABLE) |
| 935 | { |
| 936 | auto material = sector.GetSurfaceMaterial(pointColl.GetPosition().x, pointColl.GetPosition().z, true); |
| 937 | if (material == MaterialType::Water || TestEnvironment(RoomEnvFlags::ENV_FLAG_WATER, sector.RoomNumber)) |
| 938 | { |
| 939 | // TODO: Implement correct rapids behaviour for other objects. |
| 940 | DoDamage(item, INT_MAX); |
no test coverage detected