130 lines
2.4 KiB
C++
130 lines
2.4 KiB
C++
#pragma once
|
|
|
|
#include "cutscene/CutsceneTypes.h"
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <unordered_set>
|
|
#include <vector>
|
|
|
|
namespace ZL::Dialogue {
|
|
|
|
enum class NodeType {
|
|
Line,
|
|
Choice,
|
|
Condition,
|
|
SetFlag,
|
|
Jump,
|
|
End,
|
|
CutsceneStart
|
|
};
|
|
|
|
enum class ChoiceKind {
|
|
Main,
|
|
Optional,
|
|
Exit
|
|
};
|
|
|
|
enum class ComparisonOp {
|
|
Exists,
|
|
Equals,
|
|
NotEquals,
|
|
GreaterOrEqual,
|
|
LessOrEqual
|
|
};
|
|
|
|
struct Condition {
|
|
std::string flag;
|
|
ComparisonOp op = ComparisonOp::Exists;
|
|
int value = 1;
|
|
};
|
|
|
|
struct Effect {
|
|
std::string flag;
|
|
int value = 1;
|
|
bool relative = false;
|
|
};
|
|
|
|
struct Choice {
|
|
std::string id;
|
|
std::string text;
|
|
std::string next;
|
|
ChoiceKind kind = ChoiceKind::Main;
|
|
std::vector<Condition> conditions;
|
|
std::vector<Effect> effects;
|
|
bool consumeOnce = false;
|
|
};
|
|
|
|
struct Node {
|
|
std::string id;
|
|
NodeType type = NodeType::Line;
|
|
|
|
std::string speaker;
|
|
std::string text;
|
|
std::string portrait;
|
|
std::string next;
|
|
std::string luaCallback;
|
|
|
|
// For Condition nodes
|
|
std::string trueNext;
|
|
std::string falseNext;
|
|
std::vector<Condition> conditions;
|
|
|
|
// For Choice / SetFlag
|
|
std::vector<Choice> choices;
|
|
std::vector<Effect> effects;
|
|
|
|
// For CutsceneStart
|
|
std::string cutsceneId;
|
|
|
|
// "in" or "out" — creates a dynamic chat bubble; empty = not a chat message
|
|
std::string chatBubble;
|
|
|
|
// Quest actions fired when this line is presented (empty = no action)
|
|
std::string questUnlock;
|
|
std::string questComplete;
|
|
std::string questFail;
|
|
std::string objectiveComplete; // "quest_id.objective_id"
|
|
std::string objectiveVisible; // "quest_id.objective_id"
|
|
};
|
|
|
|
struct DialogueDefinition {
|
|
std::string id;
|
|
std::string displayName;
|
|
std::string startNode;
|
|
bool uninterruptible = false;
|
|
std::unordered_map<std::string, Node> nodes;
|
|
};
|
|
|
|
struct PresentedChoice {
|
|
std::string id;
|
|
std::string text;
|
|
ChoiceKind kind = ChoiceKind::Main;
|
|
};
|
|
|
|
enum class PresentationMode {
|
|
Hidden,
|
|
Dialogue,
|
|
Choice,
|
|
Cutscene
|
|
};
|
|
|
|
struct PresentationModel {
|
|
PresentationMode mode = PresentationMode::Hidden;
|
|
std::string dialogueId;
|
|
std::string speaker;
|
|
std::string fullText;
|
|
std::string visibleText;
|
|
std::string portraitPath;
|
|
std::vector<PresentedChoice> choices;
|
|
int selectedChoice = -1;
|
|
bool revealCompleted = true;
|
|
bool showCutsceneSubtitle = false;
|
|
bool cutsceneSkippable = false;
|
|
|
|
std::vector<ZL::Cutscene::PresentedCutsceneImage> cutsceneImages;
|
|
float cutsceneGlobalFadeAlpha = 1.0f;
|
|
float cutsceneBlackAlpha = 0.0f;
|
|
};
|
|
|
|
} // namespace ZL::Dialogue
|