This commit is contained in:
Jan Racek
2026-03-27 21:29:01 +01:00
parent 85eb7e59d9
commit bfab154547
42 changed files with 118 additions and 1013 deletions

View File

@@ -24,22 +24,19 @@ enum class TrackType : uint8_t {
ObjectPosition = 2,
ObjectRotationY = 3,
ObjectActive = 4,
// UI track types (v13+)
UICanvasVisible = 5, // Step: values[0] = 0/1. target unused, uiHandle = canvas index.
UIElementVisible= 6, // Step: values[0] = 0/1. uiHandle = element handle.
UIProgress = 7, // Linear: values[0] = 0-100. uiHandle = element handle.
UIPosition = 8, // Linear: values[0] = x, values[1] = y. uiHandle = element handle.
UIColor = 9, // Linear: values[0] = r, values[1] = g, values[2] = b. uiHandle = element handle.
UICanvasVisible = 5,
UIElementVisible= 6,
UIProgress = 7,
UIPosition = 8,
UIColor = 9,
};
/// Per-keyframe interpolation mode.
/// Packed into upper 3 bits of the frame field in CutsceneKeyframe.
enum class InterpMode : uint8_t {
Linear = 0, // Default linear interpolation
Step = 1, // Instant jump (no interpolation)
EaseIn = 2, // Slow start, fast end (quadratic)
EaseOut = 3, // Fast start, slow end (quadratic)
EaseInOut = 4, // Smooth start and end (smoothstep)
Linear = 0,
Step = 1,
EaseIn = 2,
EaseOut = 3,
EaseInOut = 4,
};
struct CutsceneKeyframe {
@@ -66,16 +63,9 @@ struct CutsceneTrack {
TrackType trackType;
uint8_t keyframeCount;
uint8_t pad[2];
CutsceneKeyframe* keyframes; // Points into splashpack data (resolved at load time)
GameObject* target; // nullptr = camera track or UI track
/// For UI tracks: flat handle into UISystem (canvas index or element handle).
/// Set during cutscene load by resolving canvas/element names.
CutsceneKeyframe* keyframes;
GameObject* target;
int16_t uiHandle;
/// Initial values captured at play() time for pre-first-keyframe blending.
/// For position tracks: fp12 x,y,z. For rotation tracks: raw angle values.
/// For ObjectActive: values[0] = 1 (active) or 0 (inactive).
int16_t initialValues[3];
};
@@ -88,8 +78,7 @@ struct Cutscene {
CutsceneAudioEvent* audioEvents; // Points into splashpack data
};
/// Zero-allocation cutscene player. Call init() once after splashpack is loaded,
/// then tick() once per frame from the scene loop.
class CutscenePlayer {
public:
/// Initialize with loaded cutscene data. Safe to pass nullptr/0 if no cutscenes.