Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Commit

Permalink
Fixes to replays and tweaked audio volume
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-Pearson committed May 8, 2018
1 parent 89a22cc commit c6556b5
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 9 deletions.
4 changes: 2 additions & 2 deletions ParkourGame/Content/Audio/Crowd/Crowd_Ambient.uasset
Git LFS file not shown
4 changes: 2 additions & 2 deletions ParkourGame/Content/Audio/Effects.uasset
Git LFS file not shown
4 changes: 2 additions & 2 deletions ParkourGame/Content/Audio/GameMaster.uasset
Git LFS file not shown
Git LFS file not shown
10 changes: 10 additions & 0 deletions ParkourGame/Source/ParkourGame/Private/Core/ParkourGameState.cpp
Original file line number Diff line number Diff line change
@@ -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<AReplayManager>(GetWorld());

if (Replay)
Replay->RegisterActorForReplay(Actor);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,13 @@ void AParkourPlayerController::SetPawn(APawn* InPawn)
Replay->RegisterActorForReplay(Char);
}
}

void AParkourPlayerController::BeginPlay()
{
Super::BeginPlay();

if (AParkourGameCharacter* Char = Cast<AParkourGameCharacter>(GetPawn()))
{
Cast<AParkourGameState>(GetWorld()->GetGameState())->Net_RegisterForReplay(Char);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ class AParkourPlayerController : public APlayerController

virtual void SetPawn(APawn* InPawn) override;

protected:
virtual void BeginPlay() override;

};
12 changes: 12 additions & 0 deletions ParkourGame/Source/ParkourGame/Private/Spectator/ReplayManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ void AReplayManager::Tick(float DeltaSeconds)
{
UpdateReplay(CurrentTime);
}

for (TActorIterator<AParkourGameCharacter> It(GetWorld()); It; ++It)
{
SetupNewPlayer((*It)->GetController(), (*It));
}
}

void AReplayManager::SetRecording(bool bShouldRecord)
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ParkourGame/Source/ParkourGame/Private/Utils/GameVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c6556b5

Please sign in to comment.