diff --git a/isometric-park-fna/Engines/DialogEngine.cs b/isometric-park-fna/Engines/DialogEngine.cs --- a/isometric-park-fna/Engines/DialogEngine.cs +++ b/isometric-park-fna/Engines/DialogEngine.cs @@ -86,15 +86,23 @@ foreach (ref readonly var choiceMessage in ReadMessages()) { - if (Story.currentChoices.Count > 0) + if (Story.currentChoices.Count > 0 + | Story.canContinue) { //Advance the story - Logging.Debug("Advancing story."); - Story.ChooseChoiceIndex(choiceMessage.Choice); + + if (Story.currentChoices.Count > 0) + { + Logging.Debug("Advancing story (choice)."); + Story.ChooseChoiceIndex(choiceMessage.Choice); + } + else { + Logging.Debug("Advancing story (continuation)."); + } //Update the dialog component with the new speaker, dialog, and options: - var continuation = this.Grammar.Flatten(this.Story.ContinueMaximally()); + var continuation = this.Grammar.Flatten(this.Story.Continue()); var parts = Regex.Split(continuation, ":", 0); var speaker = (parts.Length == 2) ? this.Grammar.Flatten(parts[0]) : "Dialog"; var dialog = (parts.Length == 2) ? this.Grammar.Flatten(parts[1]) : continuation; @@ -144,7 +152,7 @@ var Knot = GetComponent(lowestEntity).Knot; Story.ChoosePathString(Knot); - var continuation = this.Story.ContinueMaximally(); + var continuation = this.Story.Continue(); var parts = Regex.Split(continuation, ":", 0); var speaker = (parts.Length == 2) ? this.Grammar.Flatten(parts[0]) : "Dialog"; var dialog = (parts.Length == 2) ? this.Grammar.Flatten(parts[1]) : continuation; diff --git a/isometric-park-fna/Renderers/ImGuiWindowRenderer.cs b/isometric-park-fna/Renderers/ImGuiWindowRenderer.cs --- a/isometric-park-fna/Renderers/ImGuiWindowRenderer.cs +++ b/isometric-park-fna/Renderers/ImGuiWindowRenderer.cs @@ -89,6 +89,9 @@ DialogComponent dialogNode = default; var image_index = 0; // Needs to be here for scoping reasons. + var dialog_count = 0; + var dialog_open = false; + ProfanityLevel profanityLevel = default; foreach (ref readonly var entity in ReadEntities()) @@ -147,6 +150,8 @@ break; case Window.Dialog: + dialog_count++; + if (HasComponent(entity)) { @@ -163,7 +168,8 @@ if ((dialogEntity == null) || (dialogEntity.ID == 0) - || entity.ID < dialogEntity.ID) + || entity.ID < dialogEntity.ID + && dialog.Hydrated) { dialogEntity = entity; dialogNode = dialog; @@ -181,9 +187,12 @@ var show = true; var paused = true; DialogInterface.RenderDialog(dialogEntity, this.BridgeEngine, ref show, ref paused, this.BridgeEngine.font, dialogNode, image_index); + dialog_open = true; } + Logging.Debug(String.Format("{0} dialogs (open? {1}).", dialog_count, dialog_open)); } + public void setFont(ImFontPtr font) { this.BridgeEngine.font = font;