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

Function UpdateLaraRoom

TombEngine/Game/Lara/lara.cpp:756–772  ·  view source on GitHub ↗

Offset values may be used to account for the quirk of room traversal only being able to occur at portals.

Source from the content-addressed store, hash-verified

754
755// Offset values may be used to account for the quirk of room traversal only being able to occur at portals.
756bool UpdateLaraRoom(ItemInfo* item, int height, int xOffset, int zOffset)
757{
758 auto point = Geometry::TranslatePoint(item->Pose.Position, item->Pose.Orientation.y, zOffset, height, xOffset);
759
760 // Hacky L-shaped Location traversal.
761 item->Location = GetRoomVector(item->Location, point);
762 item->Location = GetRoomVector(item->Location, Vector3i(item->Pose.Position.x, point.y, item->Pose.Position.z));
763 item->Floor = GetSurfaceHeight(item->Location, item->Pose.Position.x, item->Pose.Position.z, true).value_or(NO_HEIGHT);
764
765 if (item->RoomNumber != item->Location.RoomNumber)
766 {
767 ItemNewRoom(item->Index, item->Location.RoomNumber);
768 return true;
769 }
770
771 return false;
772}

Callers 10

UPVControlFunction · 0.85
LaraControlFunction · 0.85
LaraAboveWaterFunction · 0.85
LaraWaterSurfaceFunction · 0.85
LaraUnderwaterFunction · 0.85
TestPlayerWaterStepOutFunction · 0.85
TestLaraWaterClimbOutFunction · 0.85
ExecuteMethod · 0.85
ItemPushStaticFunction · 0.85
SetPositionMethod · 0.85

Calls 5

TranslatePointFunction · 0.85
GetRoomVectorFunction · 0.85
GetSurfaceHeightFunction · 0.85
ItemNewRoomFunction · 0.85
Vector3iClass · 0.70

Tested by 2

TestPlayerWaterStepOutFunction · 0.68
TestLaraWaterClimbOutFunction · 0.68