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

Function lara_as_idle

TombEngine/Game/Lara/lara_basic.cpp:414–622  ·  view source on GitHub ↗

State: LS_IDLE (2), LS_SPLAT_SOFT (170) Collision: lara_col_idle()

Source from the content-addressed store, hash-verified

412// State: LS_IDLE (2), LS_SPLAT_SOFT (170)
413// Collision: lara_col_idle()
414void lara_as_idle(ItemInfo* item, CollisionInfo* coll)
415{
416 auto& player = GetLaraInfo(*item);
417
418 bool isWading = (player.Control.WaterStatus == WaterStatus::Wade);
419 bool isInSwamp = TestEnvironment(ENV_FLAG_SWAMP, item);
420 player.Control.CanLook = !((isWading && isInSwamp) || item->Animation.AnimNumber == LA_SWANDIVE_ROLL);
421
422 player.Control.Look.Mode = LookMode::Free;
423
424 if (item->HitPoints <= 0)
425 {
426 item->Animation.TargetState = LS_DEATH;
427 return;
428 }
429
430 // HACK: Interaction alignment.
431 if (player.Control.IsMoving)
432 {
433 ResetPlayerTurnRateY(*item);
434 return;
435 }
436
437 // TODO: Handle waterskin and mechanical scarab.
438 if (UseSpecialItem(item))
439 return;
440
441 if (player.Control.Look.IsUsingBinoculars)
442 return;
443
444 // Jump locks orientation.
445 if (!IsHeld(In::Jump))
446 {
447 // Sidestep locks orientation.
448 if ((IsHeld(In::StepLeft) || (IsHeld(In::Walk) && IsHeld(In::Left))) ||
449 (IsHeld(In::StepRight) || (IsHeld(In::Walk) && IsHeld(In::Right))))
450 {
451 ResetPlayerTurnRateY(*item);
452 }
453 else if (IsHeld(In::Left) || IsHeld(In::Right))
454 {
455 ModulateLaraTurnRateY(item, LARA_TURN_RATE_ACCEL, 0, LARA_SLOW_MED_TURN_RATE_MAX);
456 }
457 }
458
459 if (IsHeld(In::Jump) && CanPerformJump(*item, *coll))
460 {
461 auto jumpDirection = GetPlayerJumpDirection(*item, *coll);
462 if (jumpDirection != JumpDirection::None)
463 {
464 item->Animation.TargetState = LS_JUMP_PREPARE;
465 player.Control.JumpDirection = jumpDirection;
466 return;
467 }
468 }
469
470 if (IsHeld(In::Roll) || (IsHeld(In::Forward) && IsHeld(In::Back)))
471 {

Callers

nothing calls this directly

Calls 15

TestEnvironmentFunction · 0.85
ResetPlayerTurnRateYFunction · 0.85
UseSpecialItemFunction · 0.85
IsHeldFunction · 0.85
ModulateLaraTurnRateYFunction · 0.85
CanPerformJumpFunction · 0.85
GetPlayerJumpDirectionFunction · 0.85
CanTurn180Function · 0.85
CanCrouchFunction · 0.85
CanPlayerLookAroundFunction · 0.85
TestLaraVaultFunction · 0.85
SetLaraVaultFunction · 0.85

Tested by

no test coverage detected