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

Function CanLand

TombEngine/Game/Lara/PlayerContext.cpp:792–813  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

790 }
791
792 bool CanLand(const ItemInfo& item, const CollisionInfo& coll)
793 {
794 float projVerticalVel = item.Animation.Velocity.y + GetEffectiveGravity(item.Animation.Velocity.y);
795
796 // 1) Check airborne status and vertical velocity.
797 if (!item.Animation.IsAirborne || projVerticalVel < 0.0f)
798 return false;
799
800 // 2) Check for swamp.
801 if (TestEnvironment(ENV_FLAG_SWAMP, &item))
802 return true;
803
804 // Get point collision.
805 auto pointColl = GetPointCollision(item);
806 int vPos = item.Pose.Position.y;
807
808 // 3) Assess point collision.
809 if ((pointColl.GetFloorHeight() - vPos) <= projVerticalVel) // Floor height is above projected vertical position.
810 return true;
811
812 return false;
813 }
814
815 bool CanPerformJump(const ItemInfo& item, const CollisionInfo& coll)
816 {

Callers 10

lara_as_jump_forwardFunction · 0.85
lara_as_freefallFunction · 0.85
lara_as_reachFunction · 0.85
lara_as_jump_backFunction · 0.85
lara_as_jump_rightFunction · 0.85
lara_as_jump_leftFunction · 0.85
lara_as_jump_upFunction · 0.85
lara_as_fall_backFunction · 0.85
lara_as_swan_diveFunction · 0.85
lara_as_freefall_diveFunction · 0.85

Calls 4

GetEffectiveGravityFunction · 0.85
TestEnvironmentFunction · 0.85
GetPointCollisionFunction · 0.85
GetFloorHeightMethod · 0.45

Tested by

no test coverage detected