Fixed parallel event bug
This commit is contained in:
@ -4,10 +4,40 @@
|
|||||||
<events>
|
<events>
|
||||||
<!-- Set the default values -->
|
<!-- Set the default values -->
|
||||||
<position item="cube" x="0" y="0" z="0" />
|
<position item="cube" x="0" y="0" z="0" />
|
||||||
|
|
||||||
|
<set property="cube->material->color" value="COLOR_BLACK" type="struct Color" />
|
||||||
|
<set property="cube->material->color.a" value="0" type="uint8_t" />
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Fade out the black overlay -->
|
||||||
|
<set property="cube->material->color.a" to="0" duration="1" curve="easeOut" type="uint8_t" />
|
||||||
|
|
||||||
|
<!-- Example Text, also showing how in future we can support multiple languages -->
|
||||||
|
<text character="eth">
|
||||||
|
<string lang="en">Hi, I'm Ethereality.</string>
|
||||||
|
</text>
|
||||||
|
|
||||||
|
<!-- Fade in craig -->
|
||||||
|
<set property="cube->material->color.a" to="255" duration="1" curve="easeOut" type="uint8_t" />
|
||||||
|
<text character="craig">
|
||||||
|
<string lang="en">Hi, I'm Craig.</string>
|
||||||
|
</text>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Because each event stops things happening until it's complete, let's
|
||||||
|
assume we want to do two things at once, say move and fade out a character
|
||||||
|
at the same time. This will make craig exit screen left.
|
||||||
|
-->
|
||||||
<parallel>
|
<parallel>
|
||||||
<wait time="1" />
|
<set property="cube->material->color.a" to="0" duration="1" curve="easeOut" type="uint8_t" />
|
||||||
<wait time="3" />
|
<position item="cube" x="-2" duration="1" curve="easeOut" />
|
||||||
</parallel>
|
</parallel>
|
||||||
|
|
||||||
|
<!-- Now Craig is gone, so sad, let's now fade the screen out and present some choices -->
|
||||||
|
<set property="cube->material->color.a" to="255" duration="1" curve="easeOut" type="uint8_t" />
|
||||||
|
|
||||||
|
<!-- Here I am creating a marker -->
|
||||||
|
<marker name="craigCool" />
|
||||||
|
|
||||||
</events>
|
</events>
|
||||||
</vnscene>
|
</vnscene>
|
@ -25,13 +25,14 @@ namespace Dawn {
|
|||||||
auto itEvents = this->events.begin();
|
auto itEvents = this->events.begin();
|
||||||
while(itEvents != this->events.end()) {
|
while(itEvents != this->events.end()) {
|
||||||
auto event = *itEvents;
|
auto event = *itEvents;
|
||||||
event->start(this, this);
|
|
||||||
eventCount++;
|
eventCount++;
|
||||||
|
|
||||||
useEvent([&]{
|
useEvent([&]{
|
||||||
eventCompleteCount++;
|
eventCompleteCount++;
|
||||||
if(eventCompleteCount >= eventCount) this->next();
|
if(eventCompleteCount >= eventCount) this->next();
|
||||||
}, event->eventFinished);
|
}, event->eventFinished);
|
||||||
|
|
||||||
|
event->start(this, this);
|
||||||
itEvents++;
|
itEvents++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ void VNSceneGen::test(
|
|||||||
case VN_SCENE_EVENT_TYPE_TEXT:
|
case VN_SCENE_EVENT_TYPE_TEXT:
|
||||||
initType = "VNTextEvent";
|
initType = "VNTextEvent";
|
||||||
toInclude = "games/vn/events/VNTextEvent.hpp";
|
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;
|
break;
|
||||||
|
|
||||||
case VN_SCENE_EVENT_TYPE_POSITION:
|
case VN_SCENE_EVENT_TYPE_POSITION:
|
||||||
|
25
src/dawntools/vnscenetool/events/VNMarkerParser.hpp
Normal file
25
src/dawntools/vnscenetool/events/VNMarkerParser.hpp
Normal file
@ -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<struct VNMarker> {
|
||||||
|
protected:
|
||||||
|
std::vector<std::string> getRequiredAttributes() override;
|
||||||
|
std::map<std::string, std::string> getOptionalAttributes() override;
|
||||||
|
int32_t onParse(
|
||||||
|
Xml *node,
|
||||||
|
std::map<std::string, std::string> values,
|
||||||
|
struct VNMarker *out,
|
||||||
|
std::string *error
|
||||||
|
) override;
|
||||||
|
};
|
||||||
|
}
|
Reference in New Issue
Block a user