diff --git a/ParkourGame/Content/Audio/Crowd/Crowd_Ambient.uasset b/ParkourGame/Content/Audio/Crowd/Crowd_Ambient.uasset index 53ab181..a01aed0 100644 --- a/ParkourGame/Content/Audio/Crowd/Crowd_Ambient.uasset +++ b/ParkourGame/Content/Audio/Crowd/Crowd_Ambient.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ebdb4fa5d02693938c9353c8e41d25cf83d1d13f7321f8d714f9c6627964e269 -size 27100445 +oid sha256:5e154e39b36ae124dc815cc556fe7ceeb2af0b49f83e8fca73d4d41666cb4525 +size 27100451 diff --git a/ParkourGame/Content/Audio/Effects.uasset b/ParkourGame/Content/Audio/Effects.uasset index 68cdd9c..65350e2 100644 --- a/ParkourGame/Content/Audio/Effects.uasset +++ b/ParkourGame/Content/Audio/Effects.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c08a5957fafd857d11b499798521591d413f81430d6a41fd9c52ee5ea8f3bdee -size 1487 +oid sha256:b3ede2691a0f6c8396875ffdb4d64e636d855bb5187f5af493049c11ba39b133 +size 1643 diff --git a/ParkourGame/Content/Audio/GameMaster.uasset b/ParkourGame/Content/Audio/GameMaster.uasset index 629081d..64fe587 100644 --- a/ParkourGame/Content/Audio/GameMaster.uasset +++ b/ParkourGame/Content/Audio/GameMaster.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f8bba78c547016d8dfc66d0f36adfd84f1b8d738f0208824a5f7ea208aeee4ce -size 1308 +oid sha256:1d6f4dfa2a3c7b4eedf1e1252ad95f00558479d96d9b803a4497afc29b7abe47 +size 1270 diff --git a/ParkourGame/Content/ThirdPersonCPP/Blueprints/ThirdPersonCharacter.uasset b/ParkourGame/Content/ThirdPersonCPP/Blueprints/ThirdPersonCharacter.uasset index 237ca55..d45e4d1 100644 --- a/ParkourGame/Content/ThirdPersonCPP/Blueprints/ThirdPersonCharacter.uasset +++ b/ParkourGame/Content/ThirdPersonCPP/Blueprints/ThirdPersonCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7a5c6ff639e74d10cc1c2e91149e0574ce435b9739d69d4684745dc954a0bc84 -size 1370961 +oid sha256:c6b43ab761bdf433af39a521d58f1ab96f90367724449923ae69da7b554b79d9 +size 1373241 diff --git a/ParkourGame/Source/ParkourGame/Private/Core/ParkourGameState.cpp b/ParkourGame/Source/ParkourGame/Private/Core/ParkourGameState.cpp index 21012c4..33e463e 100644 --- a/ParkourGame/Source/ParkourGame/Private/Core/ParkourGameState.cpp +++ b/ParkourGame/Source/ParkourGame/Private/Core/ParkourGameState.cpp @@ -1,7 +1,17 @@ #include "ParkourGameState.h" +#include "../Spectator/ReplayManager.h" +#include "../Utils/SingletonHelper.h" void AParkourGameState::Net_PlayAnnouncerSound_Implementation(EAnnouncerSound Sound) { if(!HasAuthority()) PlayAnnouncerSound(Sound); } + +void AParkourGameState::Net_RegisterForReplay_Implementation(AActor* Actor) +{ + AReplayManager* Replay = FSingletonHelper::Static_GetSingletonObject(GetWorld()); + + if (Replay) + Replay->RegisterActorForReplay(Actor); +} diff --git a/ParkourGame/Source/ParkourGame/Private/Core/ParkourGameState.h b/ParkourGame/Source/ParkourGame/Private/Core/ParkourGameState.h index 9308192..2ae6f24 100644 --- a/ParkourGame/Source/ParkourGame/Private/Core/ParkourGameState.h +++ b/ParkourGame/Source/ParkourGame/Private/Core/ParkourGameState.h @@ -24,6 +24,9 @@ class AParkourGameState : public AGameStateBase UFUNCTION(BlueprintCallable, NetMulticast, Unreliable, Category = "Audio") void Net_PlayAnnouncerSound(EAnnouncerSound Sound); + UFUNCTION(NetMulticast, Reliable) + void Net_RegisterForReplay(AActor* Actor); + UFUNCTION(BlueprintImplementableEvent, Category = "Audio") void PlayAnnouncerSound(EAnnouncerSound Sound); diff --git a/ParkourGame/Source/ParkourGame/Private/Core/ParkourPlayerController.cpp b/ParkourGame/Source/ParkourGame/Private/Core/ParkourPlayerController.cpp index d068bb9..693db31 100644 --- a/ParkourGame/Source/ParkourGame/Private/Core/ParkourPlayerController.cpp +++ b/ParkourGame/Source/ParkourGame/Private/Core/ParkourPlayerController.cpp @@ -63,3 +63,13 @@ void AParkourPlayerController::SetPawn(APawn* InPawn) Replay->RegisterActorForReplay(Char); } } + +void AParkourPlayerController::BeginPlay() +{ + Super::BeginPlay(); + + if (AParkourGameCharacter* Char = Cast(GetPawn())) + { + Cast(GetWorld()->GetGameState())->Net_RegisterForReplay(Char); + } +} diff --git a/ParkourGame/Source/ParkourGame/Private/Core/ParkourPlayerController.h b/ParkourGame/Source/ParkourGame/Private/Core/ParkourPlayerController.h index 62be4db..e784fe4 100644 --- a/ParkourGame/Source/ParkourGame/Private/Core/ParkourPlayerController.h +++ b/ParkourGame/Source/ParkourGame/Private/Core/ParkourPlayerController.h @@ -31,4 +31,7 @@ class AParkourPlayerController : public APlayerController virtual void SetPawn(APawn* InPawn) override; +protected: + virtual void BeginPlay() override; + }; diff --git a/ParkourGame/Source/ParkourGame/Private/Spectator/ReplayManager.cpp b/ParkourGame/Source/ParkourGame/Private/Spectator/ReplayManager.cpp index 62f0246..26eb118 100644 --- a/ParkourGame/Source/ParkourGame/Private/Spectator/ReplayManager.cpp +++ b/ParkourGame/Source/ParkourGame/Private/Spectator/ReplayManager.cpp @@ -70,6 +70,11 @@ void AReplayManager::Tick(float DeltaSeconds) { UpdateReplay(CurrentTime); } + + for (TActorIterator It(GetWorld()); It; ++It) + { + SetupNewPlayer((*It)->GetController(), (*It)); + } } void AReplayManager::SetRecording(bool bShouldRecord) @@ -360,6 +365,13 @@ void AReplayManager::UpdatePlayerReplay(FPlayerReplayData& Player, float ReplayT void AReplayManager::SetupNewPlayer(AController* Controller, AActor* Player) { + // ensure no duplicates + FPlayerReplayData* DataPtr = m_KeyframeData.FindByPredicate([&](const FPlayerReplayData& Data) { + return Data.RealActor == Player; + }); + + if (DataPtr) return; + FPlayerReplayData& NewEntry = m_KeyframeData[m_KeyframeData.AddDefaulted()]; NewEntry.PlayerController = Controller; diff --git a/ParkourGame/Source/ParkourGame/Private/Utils/GameVersion.h b/ParkourGame/Source/ParkourGame/Private/Utils/GameVersion.h index 856f325..4938e33 100644 --- a/ParkourGame/Source/ParkourGame/Private/Utils/GameVersion.h +++ b/ParkourGame/Source/ParkourGame/Private/Utils/GameVersion.h @@ -6,7 +6,7 @@ #define GAME_VERSION_MAJOR 0 #define GAME_VERSION_MINOR 11 -#define GAME_VERSION_PATCH 1 +#define GAME_VERSION_PATCH 2 USTRUCT(BlueprintType) struct FGameVersion