use std::collections::BTreeMap;
#[derive(Debug, Default)]
pub(crate) struct Story {
pub(crate) title: String,
pub(crate) characters: BTreeMap<String, Character>,
pub(crate) nodes: Vec<Node>,
pub(crate) background: Option<String>,
}
#[derive(Debug, Clone)]
pub(crate) struct Character {
pub(crate) name: String,
pub(crate) color: [f32; 3],
}
#[derive(Debug, Default)]
pub(crate) struct Node {
pub(crate) slug: String,
pub(crate) heading: String,
pub(crate) pages: Vec<Page>,
pub(crate) choices: Vec<Choice>,
pub(crate) choice_music: Option<String>,
pub(crate) choice_sounds: Vec<String>,
pub(crate) choice_stage: Stage,
pub(crate) choice_ops: Vec<FlagOp>,
pub(crate) choice_gates: Vec<Gate>,
}
#[derive(Debug, Default, Clone)]
pub(crate) struct Stage {
pub(crate) bg: Option<String>,
pub(crate) left: Option<String>,
pub(crate) center: Option<String>,
pub(crate) right: Option<String>,
}
#[derive(Debug, Default)]
pub(crate) struct Page {
pub(crate) speaker: Option<String>,
pub(crate) text: String,
pub(crate) jump: Option<String>,
pub(crate) music: Option<String>,
pub(crate) sounds: Vec<String>,
pub(crate) stage: Stage,
pub(crate) ops: Vec<FlagOp>,
pub(crate) gates: Vec<Gate>,
}
#[derive(Debug)]
pub(crate) struct Choice {
pub(crate) label: String,
pub(crate) target: String,
pub(crate) condition: Option<Condition>,
}
#[derive(Debug, Clone)]
pub(crate) struct FlagOp {
pub(crate) name: String,
pub(crate) value: i32,
pub(crate) add: bool,
}
#[derive(Debug, Clone)]
pub(crate) struct Gate {
pub(crate) condition: Condition,
pub(crate) target: String,
}
#[derive(Debug, Clone)]
pub(crate) struct Condition {
pub(crate) name: String,
pub(crate) op: &'static str,
pub(crate) value: i32,
}
pub(super) enum Directive {
Music(String),
Sound(String),
Bg(String),
Left(String),
Center(String),
Right(String),
}
pub(super) enum ScriptLine {
Op(FlagOp),
Gate(Gate),
}
#[derive(Default)]
pub(super) struct ParaAcc {
pub(super) speaker: Option<String>,
pub(super) text: String,
pub(super) links: Vec<(String, String)>,
pub(super) images: Vec<(String, String)>,
pub(super) has_plain_text: bool,
}
pub(super) enum ParaOut {
Page(Box<Page>),
Directives(Vec<Directive>),
}
pub(super) struct BlockCharacter {
pub(super) id: String,
pub(super) line: usize,
pub(super) name: Option<String>,
pub(super) color: [f32; 3],
}
pub(crate) type ImageDims<'a> = &'a dyn Fn(&str) -> Result<(u32, u32), String>;