|
|
|
@@ -60,9 +60,8 @@
|
|
|
|
|
|
|
|
|
|
typedef struct cutscene_s cutscene_t;
|
|
|
|
|
|
|
|
|
|
// Max length of a CUTSCENE/INSERT item's "name" field - bounded by what
|
|
|
|
|
// fits in the "cutscenes/<name>.jsonc" path built from it (see
|
|
|
|
|
// cutsceneCutsceneRefLoad), so this is never reached in practice.
|
|
|
|
|
// Max length of a CUTSCENE/INSERT item's "name" field - it's the full
|
|
|
|
|
// asset path to load, so this is bounded by ASSET_FILE_NAME_MAX directly.
|
|
|
|
|
#define CUTSCENE_CUTSCENE_REF_NAME_MAX ASSET_FILE_NAME_MAX
|
|
|
|
|
|
|
|
|
|
// A CUTSCENE (or INSERT) item's target. A C-authored cutscene_t* set
|
|
|
|
@@ -230,7 +229,7 @@ void cutsceneCutsceneStart(
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Resolves a JSON-authored CUTSCENE item's referenced cutscene by name:
|
|
|
|
|
* locks+loads assets/cutscenes/<name>.jsonc, parses it into
|
|
|
|
|
* locks+loads name as a plain ASSET_LOADER_TYPE_JSON asset, parses it into
|
|
|
|
|
* CUTSCENE_SYSTEM.loadedItems/loadedScene, then unlocks the asset entry
|
|
|
|
|
* like any other asset - the parsed items don't reference the doc past
|
|
|
|
|
* that (see cutsceneInsertResolveAndSplice's matching comment for why).
|
|
|
|
@@ -240,8 +239,7 @@ void cutsceneCutsceneStart(
|
|
|
|
|
* error overlay (matching cutsceneSystemLoad's runtime-failure handling)
|
|
|
|
|
* and returns NULL.
|
|
|
|
|
*
|
|
|
|
|
* @param name Bare cutscene name (without "cutscenes/" prefix or
|
|
|
|
|
* ".jsonc" suffix).
|
|
|
|
|
* @param name Full asset path to the referenced cutscene's JSON file.
|
|
|
|
|
* @return The resolved cutscene, or NULL on failure.
|
|
|
|
|
*/
|
|
|
|
|
cutscene_t * cutsceneCutsceneResolve(const char_t *name);
|
|
|
|
@@ -265,10 +263,9 @@ bool_t cutsceneCutsceneUpdate(
|
|
|
|
|
* (rather than its own file) since it's tightly bound to the asset/loader
|
|
|
|
|
* system itself. Only stores the 'name' string (which points into the
|
|
|
|
|
* cutscene asset's still-alive yyjson doc, so no copy is needed) -
|
|
|
|
|
* resolving it to the referenced assets/cutscenes/<name>.jsonc asset is
|
|
|
|
|
* deferred to cutsceneCutsceneStart, the first time this item actually
|
|
|
|
|
* runs, so a cutscene referencing many others doesn't pay to load every
|
|
|
|
|
* one of them up front.
|
|
|
|
|
* resolving it to the referenced asset is deferred to cutsceneCutsceneStart,
|
|
|
|
|
* the first time this item actually runs, so a cutscene referencing many
|
|
|
|
|
* others doesn't pay to load every one of them up front.
|
|
|
|
|
*
|
|
|
|
|
* @param itemObj The item's JSON object.
|
|
|
|
|
* @param item Destination item, already zeroed by the caller.
|
|
|
|
@@ -281,9 +278,10 @@ errorret_t cutsceneCutsceneLoad(
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Shared JSON parsing body for both CUTSCENE and INSERT items - both need
|
|
|
|
|
* exactly a 'name' string field, validated to fit the eventual
|
|
|
|
|
* "cutscenes/<name>.jsonc" asset path. Only stores the name (see
|
|
|
|
|
* cutsceneCutsceneLoad for why resolving is deferred).
|
|
|
|
|
* exactly a 'name' string field, the full asset path to the referenced
|
|
|
|
|
* cutscene's JSON file, validated to fit CUTSCENE_CUTSCENE_REF_NAME_MAX.
|
|
|
|
|
* Only stores the name (see cutsceneCutsceneLoad for why resolving is
|
|
|
|
|
* deferred).
|
|
|
|
|
*
|
|
|
|
|
* @param itemObj The item's JSON object.
|
|
|
|
|
* @param outRef Destination ref, already zeroed by the caller.
|
|
|
|
@@ -318,19 +316,18 @@ void cutsceneInsertStart(
|
|
|
|
|
/**
|
|
|
|
|
* Resolves a JSON-authored INSERT item's referenced cutscene by name and
|
|
|
|
|
* splices it into the running cutscene (CUTSCENE_SYSTEM.scene): locks+
|
|
|
|
|
* loads assets/cutscenes/<name>.jsonc as a plain ASSET_LOADER_TYPE_JSON
|
|
|
|
|
* asset, parses it into a small scratch buffer local to this call
|
|
|
|
|
* (capacity CUTSCENE_INSERT_ITEMS_MAX) straight out of the asset entry's
|
|
|
|
|
* own doc, then unlocks the entry like any other asset - nothing needs
|
|
|
|
|
* to keep the doc itself resident past the parse: every cutscene item
|
|
|
|
|
* field that could reference it owns its string data by value (see
|
|
|
|
|
* loads name as a plain ASSET_LOADER_TYPE_JSON asset, parses it into a
|
|
|
|
|
* small scratch buffer local to this call (capacity
|
|
|
|
|
* CUTSCENE_INSERT_ITEMS_MAX) straight out of the asset entry's own doc,
|
|
|
|
|
* then unlocks the entry like any other asset - nothing needs to keep the
|
|
|
|
|
* doc itself resident past the parse: every cutscene item field that could
|
|
|
|
|
* reference it owns its string data by value (see
|
|
|
|
|
* cutscenecutsceneref_t/cutscenemarker_t's doc comments), and
|
|
|
|
|
* cutsceneSystemInsertCutscene copies the scratch items into the running
|
|
|
|
|
* scene's own array right after. On failure, opens the fatal error
|
|
|
|
|
* overlay, matching cutsceneCutsceneResolve.
|
|
|
|
|
*
|
|
|
|
|
* @param name Bare cutscene name (without "cutscenes/" prefix or
|
|
|
|
|
* ".jsonc" suffix).
|
|
|
|
|
* @param name Full asset path to the referenced cutscene's JSON file.
|
|
|
|
|
*/
|
|
|
|
|
void cutsceneInsertResolveAndSplice(const char_t *name);
|
|
|
|
|
|
|
|
|
|