LEAP Documentation 40220
Documentation for the LEAP project
AdvancedCharacterMovement.h
Go to the documentation of this file.
1// Copyright Blue Isle Studios Inc 2018. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "GameFramework/CharacterMovementComponent.h"
7#include "AdvancedCharacterMovement.generated.h"
8
9UCLASS()
10class PROJECTX_API UAdvancedCharacterMovement : public UCharacterMovementComponent
11{
12 GENERATED_UCLASS_BODY()
13
14public:
15 UFUNCTION(BlueprintCallable, Category = "Pawn|Components|CharacterMovement")
16 virtual void GetProxyMovementComponents(TArray<class UProxyMovementComponent*>& ProxyMovementComponents) const;
17
18 virtual FNetworkPredictionData_Client* GetPredictionData_Client() const override;
19 virtual FNetworkPredictionData_Server* GetPredictionData_Server() const override;
20
21 virtual void AddProxy(class UProxyMovementComponent* ProxyMovementComponents);
22 virtual void RemovedProxy(class UProxyMovementComponent* ProxyMovementComponents);
23
24protected:
25 virtual void PerformMovement(float DeltaTime) override;
26 virtual void UpdateFromCompressedFlags(uint8 Flags) override;
27
28protected:
29 UPROPERTY()
30 TArray<TWeakObjectPtr<class UProxyMovementComponent>> ProxyList;
31};
32
33class PROJECTX_API FNetworkPredictionData_Client_AdvCharacter : public FNetworkPredictionData_Client_Character
34{
35public:
36 FNetworkPredictionData_Client_AdvCharacter(const UCharacterMovementComponent& ClientMovement);
37
38 virtual FSavedMovePtr AllocateNewMove() override;
39};
40
41class PROJECTX_API FNetworkPredictionData_Server_AdvCharacter : public FNetworkPredictionData_Server_Character
42{
43public:
44 FNetworkPredictionData_Server_AdvCharacter(const UCharacterMovementComponent& ServerMovement);
45};
46
47class PROJECTX_API FSavedMove_AdvCharacter : public FSavedMove_Character
48{
49public:
51
52public:
53 uint8 bIsUsingJetPack : 1;
54 uint8 bIsUsingDash : 1;
58
59//~ Begin FSavedMove_Character Interface.
60 virtual void Clear() override;
61 virtual void SetMoveFor(ACharacter* Character, float InDeltaTime, FVector const& NewAccel, class FNetworkPredictionData_Client_Character & ClientData) override;
62 virtual void SetInitialPosition(ACharacter* Character) override;
63 virtual bool IsImportantMove(const FSavedMovePtr& LastAckedMove) const override;
64 virtual FVector GetRevertedLocation() const override;
65 virtual void PostUpdate(ACharacter* Character, EPostUpdateMode PostUpdateMode) override;
66 virtual bool CanCombineWith(const FSavedMovePtr& NewMove, ACharacter* InPawn, float MaxDelta) const override;
67 virtual void PrepMoveFor(ACharacter* Character) override;
68 virtual uint8 GetCompressedFlags() const override;
69//~ End FSavedMove_Character Interface.
70};
71
76UCLASS()
77class PROJECTX_API UProxyMovementComponent : public UActorComponent
78{
79 GENERATED_UCLASS_BODY()
80
81//~ Begin UActorComponent Interface.
82public:
83 virtual void BeginPlay() override;
84 virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
85//~ End UActorComponent Interface.
86
87public:
88 //Called by FSavedMove_AdvCharacter::SetMoveFor to store information about the current move for future use (replication and move prediction/correction)
89 virtual void ModifySavedMove(FSavedMove_AdvCharacter& SavedMove);
90 //Called by UAdvancedCharacterMovement::UpdateFromCompressedFlags to update a component based on move flags from the current move.
91 virtual void UpdateFromCompressedFlags(uint8 Flags);
92 //Called by UAdvancedCharacterMovement::PerformMovement. Is called before the Super::PerformMovement is called.
93 virtual void PerformMovement(float DeltaTime);
94
95 //Called by UAdvancedCharacterMovement::PrepMoveFor right before a replayed move occurs. Allows this movement effect to put itself into a state to replay a specified move.
96 virtual void PrepareMoveFromSave(const FSavedMove_AdvCharacter& SavedMove);
97 //Called by UAdvancedCharacterMovement::PostUpdate right after a move occurs. Allows this movement effect to clean itself up after putting itself into a state to replay a specified move.
98 virtual void PostUpdate();
99
100 //Returns true if this proxy movement component is in a replaying move state.
101 UFUNCTION(BlueprintCallable, Category = Movement)
102 FORCEINLINE bool IsReplay() const { return bIsReplayingMoves; }
103
104public:
105 static void GetProxyMovementComponents(ACharacter* Character, TArray<UProxyMovementComponent*>& Components);
106
107protected:
108 UPROPERTY()
109 UAdvancedCharacterMovement* OwningComponent = NULL;
110
111private:
112 bool bIsReplayingMoves = false;
113};
Definition: AdvancedCharacterMovement.h:34
Definition: AdvancedCharacterMovement.h:42
Definition: AdvancedCharacterMovement.h:48
uint8 bIsUsingOmniDash
Definition: AdvancedCharacterMovement.h:56
uint8 bIsUsingHookshot
Definition: AdvancedCharacterMovement.h:55
uint8 bIsUsingJetPack
Definition: AdvancedCharacterMovement.h:53
uint8 bIsUsingAutoClamber
Definition: AdvancedCharacterMovement.h:57
uint8 bIsUsingDash
Definition: AdvancedCharacterMovement.h:54
Definition: AdvancedCharacterMovement.h:11
Definition: AdvancedCharacterMovement.h:78