From 4142af94bd45962670d23f54d2aeee571b089f53 Mon Sep 17 00:00:00 2001 From: PHILIP WHITE Date: Sun, 12 May 2024 15:36:32 +0100 Subject: [PATCH] Bugfix Dialogue Voice Overs for More Text Edge Cases --- .../AC_PlayerDialogueInterpreter.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/AC_PlayerDialogueInterpreter.cpp b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/AC_PlayerDialogueInterpreter.cpp index 2e20ce29..3cd9ca8d 100644 --- a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/AC_PlayerDialogueInterpreter.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/AC_PlayerDialogueInterpreter.cpp @@ -96,8 +96,11 @@ void UAC_PlayerDialogueInterpreter::NextDialogue() CurrentTextNode = Cast(CurrentTextNode->ChildrenNodes[0]); CurrentCharacterSpeaking = *GetCharacterSpeakingFromEnum(CurrentTextNode->DialogueCharacterSpeaking); OnNextDialogue.Broadcast(CurrentTextNode); - CurrentVoiceOverAudioComponent = UGameplayStatics::SpawnSound2D( - GetWorld(), CurrentTextNode->DialogueVoiceOver, 1.f, 1.f, 0.f, nullptr, false, false); + if (IsValid(CurrentTextNode->DialogueVoiceOver)) + { + CurrentVoiceOverAudioComponent = UGameplayStatics::SpawnSound2D( + GetWorld(), CurrentTextNode->DialogueVoiceOver, 1.f, 1.f, 0.f, nullptr, false, false); + } CurrentChoiceNode = nullptr; CurrentAddItemNode = nullptr; } @@ -129,6 +132,11 @@ void UAC_PlayerDialogueInterpreter::NextDialogue() CurrentTextNode = Cast(CurrentAddItemNode->ChildrenNodes[0]); CurrentCharacterSpeaking = *GetCharacterSpeakingFromEnum(CurrentTextNode->DialogueCharacterSpeaking); OnNextDialogue.Broadcast(CurrentTextNode); + if (IsValid(CurrentTextNode->DialogueVoiceOver)) + { + CurrentVoiceOverAudioComponent = UGameplayStatics::SpawnSound2D( + GetWorld(), CurrentTextNode->DialogueVoiceOver, 1.f, 1.f, 0.f, nullptr, false, false); + } CurrentChoiceNode = nullptr; CurrentAddItemNode = nullptr; } @@ -158,6 +166,11 @@ void UAC_PlayerDialogueInterpreter::MakeChoiceDialogue(const int Choice) CurrentTextNode = Cast(CurrentChoiceNode->ChildrenNodes[Choice]); CurrentCharacterSpeaking = *GetCharacterSpeakingFromEnum(CurrentTextNode->DialogueCharacterSpeaking); OnNextDialogue.Broadcast(CurrentTextNode); + if (IsValid(CurrentTextNode->DialogueVoiceOver)) + { + CurrentVoiceOverAudioComponent = UGameplayStatics::SpawnSound2D( + GetWorld(), CurrentTextNode->DialogueVoiceOver, 1.f, 1.f, 0.f, nullptr, false, false); + } CurrentChoiceNode = nullptr; } else if (Cast(CurrentChoiceNode->ChildrenNodes[Choice]))