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

Function lara_as_turn_slow

TombEngine/Game/Lara/lara_basic.cpp:781–935  ·  view source on GitHub ↗

State: LS_TURN_RIGHT_SLOW (6), LS_TURN_LEFT_SLOW (7) Collision: lara_col_turn_slow()

Source from the content-addressed store, hash-verified

779// State: LS_TURN_RIGHT_SLOW (6), LS_TURN_LEFT_SLOW (7)
780// Collision: lara_col_turn_slow()
781void lara_as_turn_slow(ItemInfo* item, CollisionInfo* coll)
782{
783 auto& player = GetLaraInfo(*item);
784
785 bool isWading = (player.Control.WaterStatus == WaterStatus::Wade);
786 bool isInSwamp = TestEnvironment(ENV_FLAG_SWAMP, item);
787 player.Control.CanLook = (isWading && isInSwamp) ? false : true;
788
789 player.Control.Look.Mode = LookMode::Vertical;
790
791 if (item->HitPoints <= 0)
792 {
793 item->Animation.TargetState = LS_DEATH;
794 return;
795 }
796
797 if (isWading)
798 {
799 ModulateLaraTurnRateY(item, LARA_TURN_RATE_ACCEL, 0, isInSwamp ? LARA_SWAMP_TURN_RATE_MAX : LARA_WADE_TURN_RATE_MAX);
800 }
801 else
802 {
803 ModulateLaraTurnRateY(item, LARA_TURN_RATE_ACCEL, 0, LARA_MED_FAST_TURN_RATE_MAX);
804 }
805
806 if (IsHeld(In::Jump) && CanPerformJump(*item, *coll))
807 {
808 auto jumpDirection = GetPlayerJumpDirection(*item, *coll);
809 if (jumpDirection != JumpDirection::None)
810 {
811 item->Animation.TargetState = LS_JUMP_PREPARE;
812 player.Control.JumpDirection = jumpDirection;
813 return;
814 }
815 }
816
817 if ((IsHeld(In::Roll) || (IsHeld(In::Forward) && IsHeld(In::Back))) &&
818 !isWading)
819 {
820 item->Animation.TargetState = LS_ROLL_180_FORWARD;
821 return;
822 }
823
824 if (IsHeld(In::Crouch) && CanCrouch(*item, *coll))
825 {
826 item->Animation.TargetState = LS_CROUCH_IDLE;
827 return;
828 }
829
830 if (IsHeld(In::Forward))
831 {
832 if (IsHeld(In::Action))
833 {
834 auto vaultContext = TestLaraVault(item, coll);
835 if (vaultContext.has_value())
836 {
837 item->Animation.TargetState = vaultContext->TargetState;
838 SetLaraVault(item, coll, *vaultContext);

Callers

nothing calls this directly

Calls 15

TestEnvironmentFunction · 0.85
ModulateLaraTurnRateYFunction · 0.85
IsHeldFunction · 0.85
CanPerformJumpFunction · 0.85
GetPlayerJumpDirectionFunction · 0.85
CanCrouchFunction · 0.85
TestLaraVaultFunction · 0.85
SetLaraVaultFunction · 0.85
CanWadeForwardFunction · 0.85
CanWalkForwardFunction · 0.85
CanRunForwardFunction · 0.85
CanWadeBackwardFunction · 0.85

Tested by

no test coverage detected