MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / ProcessSectorFlags

Function ProcessSectorFlags

TombEngine/Game/control/trigger.cpp:883–948  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

881}
882
883void 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, &sector))
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);

Callers 5

CreatureAnimationFunction · 0.85
LaraAboveWaterFunction · 0.85
LaraWaterSurfaceFunction · 0.85
LaraUnderwaterFunction · 0.85
DoLaraFallDamageFunction · 0.85

Calls 12

GetPointCollisionFunction · 0.85
IsJumpStateFunction · 0.85
KayakLaraRapidsDrownFunction · 0.85
LavaBurnFunction · 0.85
TestEnvironmentFunction · 0.85
DoDamageFunction · 0.85
ItemBurnFunction · 0.85
IsLaraMethod · 0.80
GetSurfaceMaterialMethod · 0.80
GetPositionMethod · 0.45

Tested by

no test coverage detected