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

Function FindBridge

TombEngine/Game/Lara/lara_overhang.cpp:60–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60short FindBridge(int tiltGrade, short orient, Vector3i& pos, int* returnHeight, int ceilingMinY = 0, int ceilingMaxY = 0)
61{
62 short bridgeSlot;
63
64 switch (tiltGrade)
65 {
66 case 0:
67 bridgeSlot = ID_BRIDGE_FLAT;
68 break;
69 case 1:
70 bridgeSlot = ID_BRIDGE_TILT1;
71 break;
72 case 2:
73 bridgeSlot = ID_BRIDGE_TILT2;
74 break;
75 case 3:
76 bridgeSlot = ID_BRIDGE_TILT3;
77 break;
78 case 4:
79 bridgeSlot = ID_BRIDGE_TILT4;
80 break;
81 default:
82 bridgeSlot = ID_BRIDGE_CUSTOM;
83 break;
84 }
85
86 int xMin = pos.x & ~WALL_MASK;
87 int xMax = xMin + WALL_MASK;
88 int zMin = pos.z & ~WALL_MASK;
89 int zMax = zMin + WALL_MASK;
90
91 for (int i = 0; i < g_Level.Items.size(); i++)
92 {
93 auto* bridgeItem = &g_Level.Items[i];
94 if (bridgeItem->ObjectNumber != bridgeSlot)
95 continue;
96
97 const auto& bridge = GetBridgeObject(*bridgeItem);
98
99 short orientDelta = (short)(bridgeItem->Pose.Orientation.y - orient);
100
101 bool orientCheck = false;
102 if (orientDelta == ANGLE(90.0f))
103 orientCheck = true;
104 else if (bridgeItem->ObjectNumber == ID_BRIDGE_FLAT)
105 orientCheck = true;
106 else if ((bridgeItem->ObjectNumber == ID_BRIDGE_TILT1 || bridgeItem->ObjectNumber == ID_BRIDGE_TILT2) && abs(orientDelta) == ANGLE(90.0f))
107 orientCheck = true;
108
109 if (!orientCheck)
110 continue;
111
112 if (bridgeItem->Pose.Position.x >= xMin &&
113 bridgeItem->Pose.Position.x <= xMax &&
114 bridgeItem->Pose.Position.z >= zMin &&
115 bridgeItem->Pose.Position.z <= zMax)
116 {
117 if (ceilingMinY || ceilingMaxY)

Callers 7

lara_col_slopeclimbFunction · 0.85
lara_col_slopehangFunction · 0.85
lara_col_slopeshimmyFunction · 0.85
SlopeReachExtraFunction · 0.85
SlopeClimbExtraFunction · 0.85
SlopeClimbDownExtraFunction · 0.85
SlopeMonkeyExtraFunction · 0.85

Calls 3

ANGLEFunction · 0.85
sizeMethod · 0.45
GetCeilingHeightMethod · 0.45

Tested by

no test coverage detected