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

Function ItemNearTarget

TombEngine/Game/collision/collide_item.cpp:460–478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

458}
459
460bool ItemNearTarget(const Vector3i& origin, ItemInfo* targetEntity, int radius)
461{
462 auto pos = origin - targetEntity->Pose.Position;
463
464 if (!ItemCollide(pos.y, ITEM_RADIUS_YMAX))
465 return false;
466
467 if (!ItemCollide(pos.x, radius) || !ItemCollide(pos.z, radius))
468 return false;
469
470 if (!ItemInRange(pos.x, pos.z, radius))
471 return false;
472
473 auto bounds = GameBoundingBox(targetEntity);
474 if (pos.y >= bounds.Y1 && pos.y <= bounds.Y2)
475 return true;
476
477 return false;
478}
479
480bool Move3DPosTo3DPos(ItemInfo* item, Pose& fromPose, const Pose& toPose, int velocity, short turnRate)
481{

Callers 3

UpdateFishSwarmFunction · 0.85
UpdateBatsFunction · 0.85
UpdateLocustsFunction · 0.85

Calls 3

ItemCollideFunction · 0.85
ItemInRangeFunction · 0.85
GameBoundingBoxClass · 0.50

Tested by

no test coverage detected