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

Function lara_as_turn_fast

TombEngine/Game/Lara/lara_basic.cpp:1129–1256  ·  view source on GitHub ↗

State: LS_TURN_RIGHT_FAST (20), LS_TURN_LEFT_FAST (152) Collision: lara_col_turn_fast()

Source from the content-addressed store, hash-verified

1127// State: LS_TURN_RIGHT_FAST (20), LS_TURN_LEFT_FAST (152)
1128// Collision: lara_col_turn_fast()
1129void lara_as_turn_fast(ItemInfo* item, CollisionInfo* coll)
1130{
1131 auto& player = GetLaraInfo(*item);
1132
1133 bool isWading = (player.Control.WaterStatus == WaterStatus::Wade);
1134
1135 player.Control.Look.Mode = LookMode::Vertical;
1136
1137 if (item->HitPoints <= 0)
1138 {
1139 item->Animation.TargetState = LS_DEATH;
1140 return;
1141 }
1142
1143 ModulateLaraTurnRateY(item, LARA_TURN_RATE_ACCEL, LARA_MED_TURN_RATE_MAX, LARA_FAST_TURN_RATE_MAX);
1144
1145 if (IsHeld(In::Jump) && CanPerformJump(*item, *coll))
1146 {
1147 auto jumpDirection = GetPlayerJumpDirection(*item, *coll);
1148 if (jumpDirection != JumpDirection::None)
1149 {
1150 item->Animation.TargetState = LS_JUMP_PREPARE;
1151 player.Control.JumpDirection = jumpDirection;
1152 return;
1153 }
1154 }
1155
1156 if ((IsHeld(In::Roll) || (IsHeld(In::Forward) && IsHeld(In::Back))) &&
1157 !isWading)
1158 {
1159 item->Animation.TargetState = LS_ROLL_180_FORWARD;
1160 return;
1161 }
1162
1163 if (IsHeld(In::Crouch) && CanCrouch(*item, *coll))
1164 {
1165 item->Animation.TargetState = LS_CROUCH_IDLE;
1166 return;
1167 }
1168
1169 if (IsHeld(In::Forward))
1170 {
1171 if (IsHeld(In::Action))
1172 {
1173 auto vaultContext = TestLaraVault(item, coll);
1174 if (vaultContext.has_value())
1175 {
1176 item->Animation.TargetState = vaultContext->TargetState;
1177 SetLaraVault(item, coll, *vaultContext);
1178 return;
1179 }
1180 }
1181
1182 if (CanWadeForward(*item, *coll))
1183 {
1184 item->Animation.TargetState = LS_WADE_FORWARD;
1185 return;
1186 }

Callers

nothing calls this directly

Calls 15

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
CanWalkBackwardFunction · 0.85

Tested by

no test coverage detected