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

Function CanFallFromMonkeySwing

TombEngine/Game/Lara/PlayerContext.cpp:593–616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

591 }
592
593 bool CanFallFromMonkeySwing(const ItemInfo& item, const CollisionInfo& coll)
594 {
595 constexpr auto ABS_CEIL_BOUND = CLICK(1.25f);
596
597 auto& player = GetLaraInfo(item);
598
599 // 1) Check for monkey swing ceiling.
600 if (!player.Control.CanMonkeySwing)
601 return true;
602
603 // Get point collision.
604 auto pointColl = GetPointCollision(item);
605
606 // 2) Test for slippery ceiling slope and check if overhang climb is disabled.
607 if (pointColl.IsSteepCeiling() && !g_GameFlow->GetSettings()->Animations.OverhangClimb)
608 return true;
609
610 // 3) Assess point collision.
611 int relCeilHeight = pointColl.GetCeilingHeight() - (item.Pose.Position.y - LARA_HEIGHT_MONKEY);
612 if (abs(relCeilHeight) > ABS_CEIL_BOUND) // Ceiling height is within lower/upper ceiling bound.
613 return true;
614
615 return false;
616 }
617
618 bool CanGrabMonkeySwing(const ItemInfo& item, const CollisionInfo& coll)
619 {

Callers 5

lara_col_monkey_idleFunction · 0.85
lara_col_monkey_forwardFunction · 0.85
lara_col_monkey_backFunction · 0.85

Calls 4

GetPointCollisionFunction · 0.85
GetSettingsMethod · 0.80
IsSteepCeilingMethod · 0.45
GetCeilingHeightMethod · 0.45

Tested by

no test coverage detected