79 lines
1.8 KiB
C++
79 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace ZL::Cutscene {
|
|
|
|
enum class EasingType {
|
|
Linear,
|
|
EaseInSine,
|
|
EaseOutSine,
|
|
EaseInOutSine,
|
|
EaseInQuad,
|
|
EaseOutQuad,
|
|
EaseInOutQuad,
|
|
EaseInCubic,
|
|
EaseOutCubic,
|
|
EaseInOutCubic
|
|
};
|
|
|
|
struct CutsceneLine {
|
|
std::string speaker;
|
|
std::string text;
|
|
std::string luaCallback;
|
|
int durationMs = 0;
|
|
bool waitForConfirm = false;
|
|
};
|
|
|
|
// Describes where/how an image is framed on screen.
|
|
// centerX/Y: 0..1 normalized over the image; 0.5/0.5 = center of image fills center of screen.
|
|
// scale: 1 = image fits screen (aspect-corrected), 2 = zoomed in 2x.
|
|
struct CutsceneImagePose {
|
|
float centerX = 0.5f;
|
|
float centerY = 0.5f;
|
|
float scale = 1.0f;
|
|
};
|
|
|
|
// One image layer: defines path, active time window, fades, and animated movement.
|
|
struct CutsceneImageSegment {
|
|
std::string path;
|
|
int startMs = 0;
|
|
int endMs = 0;
|
|
int fadeInMs = 0;
|
|
int fadeOutMs = 0;
|
|
// Logical size used for all UV/aspect calculations.
|
|
// 0 = use actual texture pixel dimensions.
|
|
int width = 0;
|
|
int height = 0;
|
|
CutsceneImagePose from;
|
|
CutsceneImagePose to;
|
|
EasingType easing = EasingType::Linear;
|
|
};
|
|
|
|
struct StaticCutsceneDefinition {
|
|
std::string id;
|
|
std::string onFadeInCallback;
|
|
bool skippable = true;
|
|
int durationMs = 0;
|
|
int fadeOutMs = 0;
|
|
int fadeInMs = 0;
|
|
int endFadeOutMs = 0;
|
|
int endFadeInMs = 0;
|
|
std::vector<CutsceneImageSegment> imageSegments;
|
|
std::vector<CutsceneLine> lines;
|
|
};
|
|
|
|
// A single image layer at an evaluated point in time, ready for rendering.
|
|
struct PresentedCutsceneImage {
|
|
std::string path;
|
|
float alpha = 1.0f;
|
|
CutsceneImagePose pose;
|
|
// Logical size for UV math — mirrors CutsceneImageSegment::width/height.
|
|
// 0 = use actual texture pixel dimensions.
|
|
int width = 0;
|
|
int height = 0;
|
|
};
|
|
|
|
} // namespace ZL::Cutscene
|