Skip to content

Commit

Permalink
Merge pull request #70 from dyanikoglu/dev
Browse files Browse the repository at this point in the history
Release v4.8
  • Loading branch information
dyanikoglu authored Sep 27, 2020
2 parents 1c8902c + 20a5b42 commit 14ee9d1
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 44 deletions.
2 changes: 1 addition & 1 deletion ALSV4_CPP.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "4.7",
"VersionName": "4.8",
"FriendlyName": "Advanced Locomotion System V4 on C++",
"Description": "Performance optimized C++ port of LongmireLocomotion's Advanced Locomotion System V4",
"Category": "Animation",
Expand Down
Binary file modified Content/AdvancedLocomotionV4/Blueprints/UI/ALS_HUD.uasset
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ EBTNodeResult::Type UALS_BTTask_GetRandomLocation::ExecuteTask(UBehaviorTreeComp

if (NavSys && Pawn)
{
FSharedConstNavQueryFilter SharedFilter = 0;
FSharedConstNavQueryFilter SharedFilter = nullptr;

if (Filter)
{
Expand Down
16 changes: 9 additions & 7 deletions Source/ALSV4_CPP/Private/Character/ALSBaseCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
#include "Kismet/KismetMathLibrary.h"
#include "Kismet/GameplayStatics.h"
#include "TimerManager.h"
#include "Logging/TokenizedMessage.h"
#include "Net/UnrealNetwork.h"

AALSBaseCharacter::AALSBaseCharacter(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer.SetDefaultSubobjectClass<UALSCharacterMovementComponent>(ACharacter::CharacterMovementComponentName))
: Super(ObjectInitializer.SetDefaultSubobjectClass<UALSCharacterMovementComponent>(CharacterMovementComponentName))
{
PrimaryActorTick.bCanEverTick = true;
MantleTimeline = CreateDefaultSubobject<UTimelineComponent>(FName(TEXT("MantleTimeline")));
Expand Down Expand Up @@ -112,7 +113,7 @@ void AALSBaseCharacter::BeginPlay()
TimelineFinished.BindUFunction(this, FName(TEXT("MantleEnd")));
MantleTimeline->SetTimelineFinishedFunc(TimelineFinished);
MantleTimeline->SetLooping(false);
MantleTimeline->SetTimelineLengthMode(ETimelineLengthMode::TL_TimelineLength);
MantleTimeline->SetTimelineLengthMode(TL_TimelineLength);
MantleTimeline->AddInterpFloat(MantleTimelineCurve, TimelineUpdated);

// Make sure the mesh and animbp update after the CharacterBP to ensure it gets the most recent values.
Expand Down Expand Up @@ -227,7 +228,7 @@ void AALSBaseCharacter::RagdollStart()
ServerRagdollPull = 0;

// Step 1: Clear the Character Movement Mode and set the Movement State to Ragdoll
GetCharacterMovement()->SetMovementMode(EMovementMode::MOVE_None);
GetCharacterMovement()->SetMovementMode(MOVE_None);
SetMovementState(EALSMovementState::Ragdoll);

// Step 2: Disable capsule collision and enable mesh physics simulation starting from the pelvis.
Expand Down Expand Up @@ -1011,9 +1012,9 @@ void AALSBaseCharacter::UpdateDynamicMovementSettings(EALSGait AllowedGait)
{
MyCharacterMovementComponent->SetMaxWalkingSpeed(NewMaxSpeed);
}
if (GetCharacterMovement()->MaxAcceleration != CurveVec.X
|| GetCharacterMovement()->BrakingDecelerationWalking != CurveVec.Y
|| GetCharacterMovement()->GroundFriction != CurveVec.Z)
if (GetCharacterMovement()->MaxAcceleration != CurveVec.X
|| GetCharacterMovement()->BrakingDecelerationWalking != CurveVec.Y
|| GetCharacterMovement()->GroundFriction != CurveVec.Z)
{
MyCharacterMovementComponent->SetMovementSettings(CurveVec);
}
Expand Down Expand Up @@ -1082,7 +1083,8 @@ void AALSBaseCharacter::UpdateGroundedRotation(float DeltaTime)
{
if (GetLocalRole() == ROLE_AutonomousProxy)
{
TargetRotation.Yaw = UKismetMathLibrary::NormalizeAxis(TargetRotation.Yaw + (RotAmountCurve * (DeltaTime / (1.0f / 30.0f))));
TargetRotation.Yaw = UKismetMathLibrary::NormalizeAxis(
TargetRotation.Yaw + (RotAmountCurve * (DeltaTime / (1.0f / 30.0f))));
SetActorRotation(TargetRotation);
}
else
Expand Down
2 changes: 0 additions & 2 deletions Source/ALSV4_CPP/Private/Character/ALSCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ ECollisionChannel AALSCharacter::GetThirdPersonTraceParams(FVector& TraceOrigin,
{
FName CameraSocketName = bRightShoulder ? TEXT("TP_CameraTrace_R") : TEXT("TP_CameraTrace_L");
TraceOrigin = GetMesh()->GetSocketLocation(CameraSocketName);
float Pelvis_Z_Offset = GetMesh()->GetSocketTransform(TEXT("pelvis")).GetLocation().Z - 96;
TraceOrigin.Z += Pelvis_Z_Offset;
TraceRadius = 15.0f;
return ECC_Camera;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ void UALSCharacterMovementComponent::OnMovementUpdated(float DeltaTime, const FV

// Ensures server Movement Settings values updates to latest
bRequestMovementSettingsChange = MaxAcceleration != RealMaxAcceleration
|| BrakingDecelerationWalking != RealBraking
|| GroundFriction != RealGroundFriction;
|| BrakingDecelerationWalking != RealBraking
|| GroundFriction != RealGroundFriction;
}
}

Expand Down Expand Up @@ -118,16 +118,15 @@ UALSCharacterMovementComponent::FNetworkPredictionData_Client_My::FNetworkPredic

FSavedMovePtr UALSCharacterMovementComponent::FNetworkPredictionData_Client_My::AllocateNewMove()
{
return FSavedMovePtr(new FSavedMove_My());
return MakeShared<FSavedMove_My>();
}

// Set Movement Settings RPC to transfer the current Movement Settings from the Owning Client to the Server
bool UALSCharacterMovementComponent::Server_SetMaxWalkingSpeed_Validate(const float NewMaxWalkSpeed)
{
if (NewMaxWalkSpeed < 0.f || NewMaxWalkSpeed > 2000.f)
return false;
else
return true;
return true;
}

void UALSCharacterMovementComponent::Server_SetMaxWalkingSpeed_Implementation(const float NewMaxWalkSpeed)
Expand All @@ -148,7 +147,7 @@ void UALSCharacterMovementComponent::SetMaxWalkingSpeed(float NewMaxWalkSpeed)
// Set Max Walking Speed RPC to transfer the current Max Walking Speed from the Owning Client to the Server
bool UALSCharacterMovementComponent::Server_SetMovementSettings_Validate(const FVector NewMovementSettings)
{
return true;
return true;
}

void UALSCharacterMovementComponent::Server_SetMovementSettings_Implementation(const FVector NewMovementSettings)
Expand All @@ -174,4 +173,4 @@ void UALSCharacterMovementComponent::SetMovementSettings(FVector NewMovementSett
RealMaxAcceleration = NewMovementSettings.X;
RealBraking = NewMovementSettings.Y;
RealGroundFriction = NewMovementSettings.Z;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ bool AALSPlayerCameraManager::CustomCameraBehavior(float DeltaTime, FVector& Loc
World->SweepSingleByChannel(HitResult, TraceOrigin, TargetCameraLocation, FQuat::Identity,
TraceChannel, FCollisionShape::MakeSphere(TraceRadius), Params);

if (HitResult.bBlockingHit)
if (HitResult.IsValidBlockingHit())
{
TargetCameraLocation += (HitResult.Location - HitResult.TraceEnd);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ void UALSCharacterAnimInstance::SetFootLocking(float DeltaSeconds, FName EnableF
if (CurFootLockAlpha >= 0.99f)
{
const FTransform& OwnerTransform =
GetOwningComponent()->GetSocketTransform(IKFootBone, ERelativeTransformSpace::RTS_Component);
GetOwningComponent()->GetSocketTransform(IKFootBone, RTS_Component);
CurFootLockLoc = OwnerTransform.GetLocation();
CurFootLockRot = OwnerTransform.Rotator();
}
Expand Down Expand Up @@ -421,7 +421,7 @@ void UALSCharacterAnimInstance::SetFootOffsets(float DeltaSeconds, FName EnableF
World->LineTraceSingleByChannel(HitResult,
IKFootFloorLoc + FVector(0.0, 0.0, Config.IK_TraceDistanceAboveFoot),
IKFootFloorLoc - FVector(0.0, 0.0, Config.IK_TraceDistanceBelowFoot),
ECollisionChannel::ECC_Visibility, Params);
ECC_Visibility, Params);

FRotator TargetRotOffset = FRotator::ZeroRotator;
if (Character->GetCharacterMovement()->IsWalkable(HitResult))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ void UALSNotifyStateOverlayOverride::NotifyEnd(USkeletalMeshComponent* MeshComp,
FString UALSNotifyStateOverlayOverride::GetNotifyName_Implementation() const
{
FString Name(TEXT("Overlay Override State: "));
Name.Append(GetEnumerationToString(EALSOverlayState(OverlayOverrideState)));
Name.Append(GetEnumerationToString(static_cast<EALSOverlayState>(OverlayOverrideState)));
return Name;
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ALSV4_CPP_API UALSCharacterMovementComponent : public UCharacterMovementCo

virtual void UpdateFromCompressedFlags(uint8 Flags) override;
virtual class FNetworkPredictionData_Client* GetPredictionData_Client() const override;
void OnMovementUpdated(float DeltaTime, const FVector& OldLocation, const FVector& OldVelocity);
virtual void OnMovementUpdated(float DeltaTime, const FVector& OldLocation, const FVector& OldVelocity) override;


// Movement Settings Variables
Expand All @@ -68,12 +68,12 @@ class ALSV4_CPP_API UALSCharacterMovementComponent : public UCharacterMovementCo
void SetMaxWalkingSpeed(float NewMaxWalkSpeed);

UFUNCTION(reliable, Server, WithValidation)
void Server_SetMaxWalkingSpeed(const float NewMaxWalkSpeed);
void Server_SetMaxWalkingSpeed(float NewMaxWalkSpeed);

// Set Movement Settings (Called from the owning client)
UFUNCTION(BlueprintCallable, Category = "Movement Settings")
void SetMovementSettings(FVector NewMovementSettings);

UFUNCTION(reliable, Server, WithValidation)
void Server_SetMovementSettings(const FVector NewMovementSettings);
void Server_SetMovementSettings(FVector NewMovementSettings);
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class ALSV4_CPP_API UALSNotifyStateMovementAction : public UAnimNotifyState
{
GENERATED_BODY()

virtual void NotifyBegin(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, float TotalDuration);
virtual void NotifyBegin(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, float TotalDuration) override;

virtual void NotifyEnd(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation);
virtual void NotifyEnd(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation) override;

FString GetNotifyName_Implementation() const override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class ALSV4_CPP_API UALSNotifyStateOverlayOverride : public UAnimNotifyState
{
GENERATED_BODY()

virtual void NotifyBegin(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, float TotalDuration);
virtual void NotifyBegin(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, float TotalDuration) override;

virtual void NotifyEnd(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation);
virtual void NotifyEnd(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation) override;

FString GetNotifyName_Implementation() const override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ struct FALSAnimGraphFootIK
float FootLock_R_Alpha = 0.0f;

UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly)
bool UseFootLockCurve_L;
bool UseFootLockCurve_L;

UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly)
bool UseFootLockCurve_R;
Expand Down
51 changes: 37 additions & 14 deletions Source/ALSV4_CPP/Public/Library/ALSStructEnumLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,17 @@ struct FALSMovementState
bool Ragdoll_ = false;

public:
FALSMovementState() {}
FALSMovementState()
{
}

FALSMovementState(const EALSMovementState InitialState) { *this = InitialState; }

FORCEINLINE const bool& None() const { return None_; }
FORCEINLINE const bool& None() const { return None_; }
FORCEINLINE const bool& Grounded() const { return Grounded_; }
FORCEINLINE const bool& InAir() const { return InAir_; }
FORCEINLINE const bool& InAir() const { return InAir_; }
FORCEINLINE const bool& Mantling() const { return Mantling_; }
FORCEINLINE const bool& Ragdoll() const { return Ragdoll_; }
FORCEINLINE const bool& Ragdoll() const { return Ragdoll_; }

FORCEINLINE operator EALSMovementState() const { return State; }

Expand Down Expand Up @@ -76,10 +79,13 @@ struct FALSStance
bool Crouching_ = false;

public:
FALSStance() {}
FALSStance()
{
}

FALSStance(const EALSStance InitialStance) { *this = InitialStance; }

FORCEINLINE const bool& Standing() const { return Standing_; }
FORCEINLINE const bool& Standing() const { return Standing_; }
FORCEINLINE const bool& Crouching() const { return Crouching_; }

FORCEINLINE operator EALSStance() const { return Stance; }
Expand Down Expand Up @@ -111,7 +117,10 @@ struct FALSRotationMode
bool Aiming_ = false;

public:
FALSRotationMode() {}
FALSRotationMode()
{
}

FALSRotationMode(const EALSRotationMode InitialRotationMode) { *this = InitialRotationMode; }

FORCEINLINE const bool& VelocityDirection() const { return VelocityDirection_; }
Expand Down Expand Up @@ -151,7 +160,10 @@ struct FALSMovementDirection
bool Backward_ = false;

public:
FALSMovementDirection() {}
FALSMovementDirection()
{
}

FALSMovementDirection(const EALSMovementDirection InitialMovementDirection) { *this = InitialMovementDirection; }

FORCEINLINE const bool& Forward() const { return Forward_; }
Expand Down Expand Up @@ -196,7 +208,10 @@ struct FALSMovementAction
bool GettingUp_ = false;

public:
FALSMovementAction() {}
FALSMovementAction()
{
}

FALSMovementAction(const EALSMovementAction InitialAction) { *this = InitialAction; }

FORCEINLINE const bool& None() const { return None_; }
Expand Down Expand Up @@ -237,7 +252,10 @@ struct FALSGait
bool Sprinting_ = false;

public:
FALSGait() {}
FALSGait()
{
}

FALSGait(const EALSGait InitialGait) { *this = InitialGait; }

FORCEINLINE const bool& Walking() const { return Walking_; }
Expand All @@ -251,7 +269,7 @@ struct FALSGait
Gait = NewGait;
Walking_ = Gait == EALSGait::Walking;
Running_ = Gait == EALSGait::Running,
Sprinting_ = Gait == EALSGait::Sprinting;
Sprinting_ = Gait == EALSGait::Sprinting;
}
};

Expand Down Expand Up @@ -304,7 +322,10 @@ struct FALSOverlayState
bool Barrel_ = false;

public:
FALSOverlayState() {}
FALSOverlayState()
{
}

FALSOverlayState(const EALSOverlayState InitialState) { *this = InitialState; }

FORCEINLINE const bool& Default() const { return Default_; }
Expand Down Expand Up @@ -358,7 +379,10 @@ struct FALSGroundedEntryState
bool Roll_ = false;

public:
FALSGroundedEntryState() {}
FALSGroundedEntryState()
{
}

FALSGroundedEntryState(const EALSGroundedEntryState InitialState) { *this = InitialState; }

FORCEINLINE const bool& None() const { return None_; }
Expand All @@ -373,4 +397,3 @@ struct FALSGroundedEntryState
Roll_ = State == EALSGroundedEntryState::Roll;
}
};

0 comments on commit 14ee9d1

Please sign in to comment.