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

Function InitializeItemBoxData

TombEngine/Game/control/box.cpp:3324–3360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3322}
3323
3324void InitializeItemBoxData()
3325{
3326 for (int i = 0; i < g_Level.Items.size(); i++)
3327 {
3328 auto* currentItem = &g_Level.Items[i];
3329 }
3330
3331 for (auto& room : g_Level.Rooms)
3332 {
3333 for (const auto& mesh : room.mesh)
3334 {
3335 long index = ((mesh.Pose.Position.z - room.Position.z) / BLOCK(1)) + room.ZSize * ((mesh.Pose.Position.x - room.Position.x) / BLOCK(1));
3336 if (index >= room.Sectors.size())
3337 continue;
3338
3339 auto* floor = &room.Sectors[index];
3340 if (floor->PathfindingBoxID == NO_VALUE)
3341 continue;
3342
3343 if (!(g_Level.PathfindingBoxes[floor->PathfindingBoxID].flags & BLOCKED))
3344 {
3345 int floorHeight = floor->GetSurfaceHeight(mesh.Pose.Position.x, mesh.Pose.Position.z, true);
3346 const auto& bBox = GetBoundsAccurate(mesh, false);
3347
3348 if (floorHeight <= mesh.Pose.Position.y - bBox.Y2 + CLICK(2) &&
3349 floorHeight < mesh.Pose.Position.y - bBox.Y1)
3350 {
3351 if (bBox.X1 == 0 || bBox.X2 == 0 || bBox.Z1 == 0 || bBox.Z2 == 0 ||
3352 ((bBox.X1 < 0) ^ (bBox.X2 < 0)) && ((bBox.Z1 < 0) ^ (bBox.Z2 < 0)))
3353 {
3354 floor->Stopper = true;
3355 }
3356 }
3357 }
3358 }
3359 }
3360}
3361
3362bool CanCreatureJump(ItemInfo& item, JumpDistance jumpDistType)
3363{

Callers 1

DoLevelFunction · 0.85

Calls 2

GetSurfaceHeightMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected