improve dialogue advance and add flexible cutscene camera system
This commit is contained in:
1 parent
422ff1fbe3
commit
ceebb13719
10 files changed
+502
-74
No files matched your search
@@ -29,6 +29,19 @@ ComparisonOp DialogueDatabase::parseComparisonOp(const std::string& value) {
|
||||
return ComparisonOp::Exists;
|
||||
}
|
||||
|
||||
EasingType DialogueDatabase::parseEasingType(const std::string& value) {
|
||||
if (value == "EaseInSine") return EasingType::EaseInSine;
|
||||
if (value == "EaseOutSine") return EasingType::EaseOutSine;
|
||||
if (value == "EaseInOutSine") return EasingType::EaseInOutSine;
|
||||
if (value == "EaseInQuad") return EasingType::EaseInQuad;
|
||||
if (value == "EaseOutQuad") return EasingType::EaseOutQuad;
|
||||
if (value == "EaseInOutQuad") return EasingType::EaseInOutQuad;
|
||||
if (value == "EaseInCubic") return EasingType::EaseInCubic;
|
||||
if (value == "EaseOutCubic") return EasingType::EaseOutCubic;
|
||||
if (value == "EaseInOutCubic") return EasingType::EaseInOutCubic;
|
||||
return EasingType::Linear;
|
||||
}
|
||||
|
||||
Condition DialogueDatabase::parseCondition(const json& j) {
|
||||
Condition c;
|
||||
c.flag = j.value("flag", "");
|
||||
@@ -126,12 +139,44 @@ CutsceneLine DialogueDatabase::parseCutsceneLine(const json& j) {
|
||||
return line;
|
||||
}
|
||||
|
||||
CutsceneCameraPose DialogueDatabase::parseCutsceneCameraPose(const json& j) {
|
||||
CutsceneCameraPose pose;
|
||||
pose.focusX = j.value("focusX", 0.5f);
|
||||
pose.focusY = j.value("focusY", 0.5f);
|
||||
pose.zoom = j.value("zoom", 1.0f);
|
||||
pose.rotationDeg = j.value("rotationDeg", 0.0f);
|
||||
return pose;
|
||||
}
|
||||
|
||||
CutsceneCameraSegment DialogueDatabase::parseCutsceneCameraSegment(const json& j) {
|
||||
CutsceneCameraSegment segment;
|
||||
segment.durationMs = j.value("durationMs", 0);
|
||||
segment.easing = parseEasingType(j.value("easing", "EaseInOutSine"));
|
||||
if (j.contains("from") && j["from"].is_object()) {
|
||||
segment.from = parseCutsceneCameraPose(j["from"]);
|
||||
}
|
||||
if (j.contains("to") && j["to"].is_object()) {
|
||||
segment.to = parseCutsceneCameraPose(j["to"]);
|
||||
}
|
||||
else {
|
||||
segment.to = segment.from;
|
||||
}
|
||||
return segment;
|
||||
}
|
||||
|
||||
StaticCutsceneDefinition DialogueDatabase::parseCutscene(const json& j) {
|
||||
StaticCutsceneDefinition cutscene;
|
||||
cutscene.id = j.value("id", "");
|
||||
cutscene.background = j.value("background", "");
|
||||
cutscene.music = j.value("music", "");
|
||||
cutscene.skippable = j.value("skippable", true);
|
||||
cutscene.durationMs = j.value("durationMs", 0);
|
||||
|
||||
if (j.contains("cameraTrack") && j["cameraTrack"].is_array()) {
|
||||
for (const auto& item : j["cameraTrack"]) {
|
||||
cutscene.cameraTrack.push_back(parseCutsceneCameraSegment(item));
|
||||
}
|
||||
}
|
||||
|
||||
if (j.contains("lines") && j["lines"].is_array()) {
|
||||
for (const auto& item : j["lines"]) {
|
||||
|
||||
Reference in new issue
Block a user