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

Function CanQueueRunningJump

TombEngine/Game/Lara/PlayerContext.cpp:911–937  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

909 }
910
911 bool CanQueueRunningJump(const ItemInfo& item, const CollisionInfo& coll)
912 {
913 constexpr auto UPPER_FLOOR_BOUND = CLICK(0.5f);
914 constexpr auto LOWER_CEIL_BOUND_BASE = -LARA_HEADROOM * 0.8f;
915
916 auto& player = GetLaraInfo(item);
917
918 // 1) Test if running jump is immediately possible.
919 if (CanRunJumpForward(item, coll))
920 return IsRunJumpQueueableState(item.Animation.TargetState);
921
922 // Get point collision.
923 auto pointColl = GetPointCollision(item, item.Pose.Orientation.y, BLOCK(1), -coll.Setup.Height);
924
925 int lowerCeilingBound = (LOWER_CEIL_BOUND_BASE - coll.Setup.Height);
926 int relFloorHeight = pointColl.GetFloorHeight() - item.Pose.Position.y;
927 int relCeilHeight = pointColl.GetCeilingHeight() - item.Pose.Position.y;
928
929 // 2) Assess point collision for possible running jump ahead.
930 if (relCeilHeight < lowerCeilingBound || // Ceiling height is above lower ceiling bound.
931 relFloorHeight >= UPPER_FLOOR_BOUND) // OR floor height ahead is below upper floor bound.
932 {
933 return IsRunJumpQueueableState(item.Animation.TargetState);
934 }
935
936 return false;
937 }
938
939 bool CanRunJumpForward(const ItemInfo& item, const CollisionInfo& coll)
940 {

Callers 2

lara_as_run_forwardFunction · 0.85
lara_as_sprintFunction · 0.85

Calls 5

CanRunJumpForwardFunction · 0.85
IsRunJumpQueueableStateFunction · 0.85
GetPointCollisionFunction · 0.85
GetFloorHeightMethod · 0.45
GetCeilingHeightMethod · 0.45

Tested by

no test coverage detected