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

Function CanSlide

TombEngine/Game/Lara/PlayerContext.cpp:396–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394 }
395
396 bool CanSlide(const ItemInfo& item, const CollisionInfo& coll)
397 {
398 constexpr auto ABS_FLOOR_BOUND = STEPUP_HEIGHT;
399
400 const auto& player = GetLaraInfo(item);
401
402 // 1) Test player water status.
403 if (player.Control.WaterStatus == WaterStatus::Wade)
404 return false;
405
406 // Get point collision.
407 auto pointColl = GetPointCollision(item, 0, 0, -coll.Setup.Height / 2); // NOTE: Offset required for correct bridge collision.
408 int relFloorHeight = pointColl.GetFloorHeight() - item.Pose.Position.y;
409
410 // 2) Assess point collision.
411 if (abs(relFloorHeight) <= ABS_FLOOR_BOUND && // Floor height is within upper/lower floor bounds.
412 pointColl.IsSteepFloor()) // Floor is a slippery slope.
413 {
414 return true;
415 }
416
417 return false;
418 }
419
420 bool CanSteerOnSlide(const ItemInfo& item, const CollisionInfo& coll)
421 {

Callers 15

lara_col_jump_prepareFunction · 0.85
lara_col_walk_forwardFunction · 0.85
lara_col_run_forwardFunction · 0.85
lara_col_idleFunction · 0.85
lara_col_run_backFunction · 0.85
lara_col_walk_backFunction · 0.85
lara_col_step_rightFunction · 0.85
lara_col_step_leftFunction · 0.85
lara_col_roll_180_backFunction · 0.85
lara_col_sprintFunction · 0.85
lara_col_sprint_slideFunction · 0.85

Calls 3

GetPointCollisionFunction · 0.85
GetFloorHeightMethod · 0.45
IsSteepFloorMethod · 0.45

Tested by

no test coverage detected