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

Function FireRopeCollision

TombEngine/Objects/TR4/Object/FireRope.cpp:179–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179void FireRopeCollision(short itemNumber, ItemInfo* laraItem, CollisionInfo* coll)
180{
181 auto& item = g_Level.Items[itemNumber];
182 auto lara = GetLaraInfo(laraItem);
183
184 if (item.Active || !lara->Torch.IsLit)
185 return;
186
187 if (Vector3i::Distance(item.Pose.Position, laraItem->Pose.Position) > BLOCK(4))
188 return;
189
190 auto jointPos = GetJointPosition(laraItem, LM_LHAND, FIRE_OFFSET).ToVector3();
191 auto flameSphere = BoundingSphere(jointPos, FIRE_RADIUS);
192 auto spheres = item.GetSpheres();
193
194 for (int i = 0; i < spheres.size(); i++)
195 {
196 auto& sphere = spheres[i];
197
198 if (!sphere.Intersects(flameSphere))
199 continue;
200
201 item.ItemFlags[FireRopeItemFlags::LowerMesh] =
202 item.ItemFlags[FireRopeItemFlags::UpperMesh] =
203 item.ItemFlags[FireRopeItemFlags::StartMesh] = i;
204
205 AddActiveItem(itemNumber);
206 item.Status = ITEM_ACTIVE;
207 item.Flags |= IFLAG_ACTIVATION_MASK;
208 }
209}

Callers

nothing calls this directly

Calls 6

GetJointPositionFunction · 0.85
AddActiveItemFunction · 0.85
IntersectsMethod · 0.80
ToVector3Method · 0.45
GetSpheresMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected