broken ui system

This commit is contained in:
Jan Racek
2026-03-25 12:25:29 +01:00
parent 60a7063a17
commit f485ec36a8
14 changed files with 1309 additions and 18 deletions

View File

@@ -11,6 +11,8 @@
namespace psxsplash {
class UISystem; // Forward declaration
static constexpr int MAX_CUTSCENES = 16;
static constexpr int MAX_TRACKS = 8;
static constexpr int MAX_KEYFRAMES = 64;
@@ -22,6 +24,12 @@ 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.
};
/// Per-keyframe interpolation mode.
@@ -59,13 +67,16 @@ struct CutsceneTrack {
uint8_t keyframeCount;
uint8_t pad[2];
CutsceneKeyframe* keyframes; // Points into splashpack data (resolved at load time)
GameObject* target; // nullptr = camera track
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.
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];
int16_t _initPad;
};
struct Cutscene {
@@ -82,7 +93,8 @@ struct Cutscene {
class CutscenePlayer {
public:
/// Initialize with loaded cutscene data. Safe to pass nullptr/0 if no cutscenes.
void init(Cutscene* cutscenes, int count, Camera* camera, AudioManager* audio);
void init(Cutscene* cutscenes, int count, Camera* camera, AudioManager* audio,
UISystem* uiSystem = nullptr);
/// Play cutscene by name. Returns false if not found.
bool play(const char* name);
@@ -104,6 +116,7 @@ private:
uint8_t m_nextAudio = 0;
Camera* m_camera = nullptr;
AudioManager* m_audio = nullptr;
UISystem* m_uiSystem = nullptr;
psyqo::Trig<> m_trig;