From 335f24f39397a854b5ddaa53af3626e1fc8ca584 Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Mon, 24 Apr 2023 22:35:45 -0700 Subject: [PATCH] Fixed parallel event bug --- src/dawn/games/vn/events/VNParallelEvent.hpp | 3 ++- src/dawntools/vnscenetool/VNSceneGen.cpp | 2 +- .../vnscenetool/events/VNMarkerParser.hpp | 25 +++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 src/dawntools/vnscenetool/events/VNMarkerParser.hpp diff --git a/src/dawn/games/vn/events/VNParallelEvent.hpp b/src/dawn/games/vn/events/VNParallelEvent.hpp index f751fddd..e511ed69 100644 --- a/src/dawn/games/vn/events/VNParallelEvent.hpp +++ b/src/dawn/games/vn/events/VNParallelEvent.hpp @@ -25,13 +25,14 @@ namespace Dawn { auto itEvents = this->events.begin(); while(itEvents != this->events.end()) { auto event = *itEvents; - event->start(this, this); eventCount++; useEvent([&]{ eventCompleteCount++; if(eventCompleteCount >= eventCount) this->next(); }, event->eventFinished); + + event->start(this, this); itEvents++; } } diff --git a/src/dawntools/vnscenetool/VNSceneGen.cpp b/src/dawntools/vnscenetool/VNSceneGen.cpp index cfa55f0e..83a7c999 100644 --- a/src/dawntools/vnscenetool/VNSceneGen.cpp +++ b/src/dawntools/vnscenetool/VNSceneGen.cpp @@ -23,7 +23,7 @@ void VNSceneGen::test( case VN_SCENE_EVENT_TYPE_TEXT: initType = "VNTextEvent"; toInclude = "games/vn/events/VNTextEvent.hpp"; - line(body, eventName + "->" + "text = \"" + event->text.texts.begin()->text + "\";", ""); + line(&afterLines, eventName + "->" + "text = \"" + event->text.texts.begin()->text + "\";", ""); break; case VN_SCENE_EVENT_TYPE_POSITION: diff --git a/src/dawntools/vnscenetool/events/VNMarkerParser.hpp b/src/dawntools/vnscenetool/events/VNMarkerParser.hpp new file mode 100644 index 00000000..f9b05c68 --- /dev/null +++ b/src/dawntools/vnscenetool/events/VNMarkerParser.hpp @@ -0,0 +1,25 @@ +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "util/XmlParser.hpp" + +namespace Dawn { + struct VNMarker { + std::string name; + }; + + class VNMarkerParser : public XmlParser { + protected: + std::vector getRequiredAttributes() override; + std::map getOptionalAttributes() override; + int32_t onParse( + Xml *node, + std::map values, + struct VNMarker *out, + std::string *error + ) override; + }; +} \ No newline at end of file