Skip to content

Commit

Permalink
Minor code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Sixze committed Aug 27, 2021
1 parent 4bf391a commit e328457
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions ALS/Source/ALS/Private/AlsCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,9 @@ bool AAlsCharacter::CanSprint() const

return LocomotionState.bHasInput &&
(RotationMode != EAlsRotationMode::Aiming || bSprintHasPriorityOverAiming) &&
// ReSharper disable once CppRedundantParentheses
((ViewMode != EAlsViewMode::FirstPerson &&
(DesiredRotationMode == EAlsRotationMode::VelocityDirection || bRotateToVelocityWhenSprinting)) ||
(DesiredRotationMode == EAlsRotationMode::VelocityDirection || bRotateToVelocityWhenSprinting)) ||
FMath::Abs(FRotator::NormalizeAxis(LocomotionState.InputYawAngle - ViewState.SmoothRotation.Yaw)) < 50.0f);
}

Expand Down Expand Up @@ -487,6 +488,7 @@ void AAlsCharacter::RefreshRotationMode()
return;
}

// ReSharper disable once CppRedundantParentheses
if ((bSprinting && DesiredRotationMode == EAlsRotationMode::Aiming) ||
DesiredRotationMode == EAlsRotationMode::VelocityDirection)
{
Expand Down Expand Up @@ -865,8 +867,9 @@ void AAlsCharacter::RefreshGroundedActorRotation(const float DeltaTime)

// Not moving.

// ReSharper disable once CppRedundantParentheses
if ((!TryRefreshCustomGroundedNotMovingActorRotation(DeltaTime) &&
RotationMode == EAlsRotationMode::Aiming) || ViewMode == EAlsViewMode::FirstPerson)
RotationMode == EAlsRotationMode::Aiming) || ViewMode == EAlsViewMode::FirstPerson)
{
RefreshGroundedNotMovingAimingActorRotation(DeltaTime);
}
Expand Down Expand Up @@ -1811,7 +1814,7 @@ void AAlsCharacter::TryStartRolling(const float PlayRate)
{
StartRolling(PlayRate, LocomotionState.bHasInput &&
(RollingSettings.bRotateToInputOnStart ||
(RollingSettings.bRotateToInputDuringRoll && RollingSettings.InputInterpolationSpeed <= 0.0f))
RollingSettings.bRotateToInputDuringRoll && RollingSettings.InputInterpolationSpeed <= 0.0f)
? LocomotionState.InputYawAngle
: LocomotionState.Rotation.Yaw);
}
Expand All @@ -1820,8 +1823,9 @@ void AAlsCharacter::TryStartRolling(const float PlayRate)
bool AAlsCharacter::IsRollingAllowedToStart(const UAnimMontage* Montage) const
{
return LocomotionAction == EAlsLocomotionAction::None ||
// ReSharper disable once CppRedundantParentheses
(LocomotionAction == EAlsLocomotionAction::Rolling &&
!GetMesh()->GetAnimInstance()->Montage_IsPlaying(Montage));
!GetMesh()->GetAnimInstance()->Montage_IsPlaying(Montage));
}

void AAlsCharacter::StartRolling(const float PlayRate, const float TargetYawAngle)
Expand Down
4 changes: 2 additions & 2 deletions ALS/Source/ALS/Public/ControlRig/AlsRigUnit_Math.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ struct ALS_API FAlsRigUnit_CalculatePoleVector : public FAlsRigUnit_MathBase
FRigElementKey ItemC;

UPROPERTY(Meta = (Input))
bool bInitial;
bool bInitial{false};

UPROPERTY(Meta = (Output))
bool bSuccess;
bool bSuccess{false};

UPROPERTY(Meta = (Output))
FVector StartLocation{FVector::ZeroVector};
Expand Down

0 comments on commit e328457

Please sign in to comment.