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

Function UPVPlayerCollision

TombEngine/Objects/TR3/Vehicles/upv.cpp:172–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170 }
171
172 void UPVPlayerCollision(short itemNumber, ItemInfo* laraItem, CollisionInfo* coll)
173 {
174 auto* UPVItem = &g_Level.Items[itemNumber];
175 auto* lara = GetLaraInfo(laraItem);
176
177 if (laraItem->HitPoints <= 0 || lara->Context.Vehicle != NO_VALUE)
178 return;
179
180 auto mountType = GetVehicleMountType(UPVItem, laraItem, coll, UPVMountTypes, UPV_MOUNT_DISTANCE);
181 if (mountType == VehicleMountType::None)
182 {
183 // HACK: Collision in water behaves differently? @Sezz 2022.06.28
184 if (TestBoundsCollide(UPVItem, laraItem, coll->Setup.Radius) && HandleItemSphereCollision(*UPVItem, *laraItem))
185 ItemPushItem(UPVItem, laraItem, coll, false, 0);
186 }
187 else
188 {
189 SetLaraVehicle(laraItem, UPVItem);
190 DoUPVMount(UPVItem, laraItem, mountType);
191 }
192 }
193
194 void DoUPVMount(ItemInfo* UPVItem, ItemInfo* laraItem, VehicleMountType mountType)
195 {

Callers

nothing calls this directly

Calls 6

GetVehicleMountTypeFunction · 0.85
TestBoundsCollideFunction · 0.85
ItemPushItemFunction · 0.85
SetLaraVehicleFunction · 0.85
DoUPVMountFunction · 0.85

Tested by

no test coverage detected