Remove the C-authoring shorthand for declaring cutscenes
CUTSCENE(...)/CUTSCENE_REFERENCE/CUTSCENE_CUTSCENE/CUTSCENE_INSERT existed to build a cutscene_t and its item array directly in C; real cutscenes are now authored exclusively as .jsonc files parsed via cutsceneParseDoc, so these are dead weight in production. Deletes the demo scene that still used them (testcutscene.h, wired to NPC #3) along with its now-dead include in npc.c. test_cutscenesystem.c - the only other user, building cutscenes in-memory for tests - now writes the equivalent struct literals directly, matching the convention already used by test_battle.c/test_entityinteract.c. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
@@ -15,64 +15,6 @@ typedef struct cutscene_s {
|
||||
cutscenepause_t pause;
|
||||
} cutscene_t;
|
||||
|
||||
/**
|
||||
* Declares a standalone, named cutscene_t (and its backing item array) -
|
||||
* the entry point for a C-authored cutscene.
|
||||
*
|
||||
* @param NAME Suffix for the generated CUTSCENE_##NAME cutscene/items
|
||||
* statics.
|
||||
* @param PAUSE_TYPE Suffix of the CUTSCENE_PAUSE_* flag(s) to apply
|
||||
* while this cutscene runs (e.g. NONE, ALL).
|
||||
* @param ... The cutscene's cutsceneitem_t entries, in order.
|
||||
*/
|
||||
#define CUTSCENE(NAME, PAUSE_TYPE, ...) \
|
||||
static const cutsceneitem_t CUTSCENE_##NAME##_ITEMS[] = { __VA_ARGS__ }; \
|
||||
static const cutscene_t CUTSCENE_##NAME = { \
|
||||
.items = CUTSCENE_##NAME##_ITEMS, \
|
||||
.itemCount = sizeof(CUTSCENE_##NAME##_ITEMS) / sizeof(cutsceneitem_t), \
|
||||
.pause = CUTSCENE_PAUSE_##PAUSE_TYPE, \
|
||||
};
|
||||
|
||||
/**
|
||||
* References a CUTSCENE(NAME, ...)-declared cutscene by name.
|
||||
*
|
||||
* @param CUTSCENE The cutscene's NAME, as passed to CUTSCENE(...).
|
||||
*/
|
||||
#define CUTSCENE_REFERENCE(CUTSCENE) \
|
||||
&CUTSCENE_##CUTSCENE
|
||||
|
||||
/**
|
||||
* Hands control over to another CUTSCENE(NAME, ...)-declared cutscene.
|
||||
* Has no dedicated item header of its own - cutscenecutsceneref_t is
|
||||
* defined inline in cutsceneitem.h, tightly bound to the asset/loader
|
||||
* system, so this shorthand stays here too.
|
||||
*
|
||||
* @param CUTSCENE The referenced cutscene's NAME, as passed to
|
||||
* CUTSCENE(...).
|
||||
*/
|
||||
#define CUTSCENE_CUTSCENE(CUTSCENE) \
|
||||
{ \
|
||||
.type = CUTSCENE_ITEM_TYPE_CUTSCENE, \
|
||||
.cutsceneRef = { .cutscene = CUTSCENE_REFERENCE(CUTSCENE), .name = NULL } \
|
||||
}
|
||||
|
||||
/**
|
||||
* Splices another CUTSCENE(NAME, ...)-declared cutscene's items into this
|
||||
* one in place, resuming right after this item once the referenced
|
||||
* cutscene's items run out - unlike CUTSCENE_CUTSCENE (a one-way jump that
|
||||
* never returns). Has no dedicated item header of its own, same rationale
|
||||
* as CUTSCENE_CUTSCENE - cutsceneInsertStart/Update/Load are defined
|
||||
* inline in cutsceneitem.h/.c, tightly bound to the asset/loader system.
|
||||
*
|
||||
* @param CUTSCENE The referenced cutscene's NAME, as passed to
|
||||
* CUTSCENE(...).
|
||||
*/
|
||||
#define CUTSCENE_INSERT(CUTSCENE) \
|
||||
{ \
|
||||
.type = CUTSCENE_ITEM_TYPE_INSERT, \
|
||||
.insert = { .cutscene = CUTSCENE_REFERENCE(CUTSCENE), .name = NULL } \
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses one cutscene item object into item. Every field/enum name is
|
||||
* validated as real (untrusted, authored) file content - failures are
|
||||
|
||||
@@ -34,9 +34,8 @@ typedef struct entity_s entity_t;
|
||||
// into this fixed, static buffer via cutsceneParseDoc (see cutscene.h),
|
||||
// once the raw JSON itself has been read+parsed via the generic
|
||||
// ASSET_LOADER_TYPE_JSON asset loader. Bump this if a real cutscene ever
|
||||
// needs more; C-authored cutscenes (the CUTSCENE(...) macro) don't use
|
||||
// this at all - they're compiled directly into their own static const
|
||||
// arrays.
|
||||
// needs more; C-authored cutscenes (used only by tests) don't use this
|
||||
// at all - they're compiled directly into their own static const arrays.
|
||||
#define CUTSCENE_LOADED_ITEMS_MAX 128
|
||||
|
||||
extern cutsceneitem_t CUTSCENE_LOADED_ITEMS[CUTSCENE_LOADED_ITEMS_MAX];
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "rpg/cutscene/cutscene.h"
|
||||
#include "rpg/cutscene/cutscenesystem.h"
|
||||
|
||||
CUTSCENE(TEST_ONE, DEFAULT,
|
||||
CUTSCENE_TEXT("Test One."),
|
||||
);
|
||||
|
||||
CUTSCENE(TEST_TWO, DEFAULT,
|
||||
CUTSCENE_TEXT("Test Two."),
|
||||
CUTSCENE_ENTITY_ADD(ENTITY_TYPE_NPC, 4, 4, 0),
|
||||
CUTSCENE_TEXT_MINI("Hello!", 4, 4, 0, 3.0f),
|
||||
CUTSCENE_EMOJI(
|
||||
CUTSCENE_ENTITY_LAST_CREATED, UI_EMOJI_EXCLAMATION_MARK, 2.0f
|
||||
),
|
||||
CUTSCENE_ENTITY_WALK_TO(CUTSCENE_ENTITY_LAST_CREATED, 8, 2, 0),
|
||||
// CUTSCENE_CONCURRENT(
|
||||
// CUTSCENE_ENTITY_WALK_TO(CUTSCENE_ENTITY_INTERACT, 4, 4, 0),
|
||||
// CUTSCENE_ENTITY_WALK_TO(CUTSCENE_ENTITY_INTERACTED, 8, 2, 0),
|
||||
// ),
|
||||
// CUTSCENE_ITEM_GIVE(ITEM_ID_POTATO, 3),
|
||||
// CUTSCENE_ENTITY_REMOVE(CUTSCENE_ENTITY_INTERACT),
|
||||
CUTSCENE_TEXT("Done."),
|
||||
);
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
#pragma once
|
||||
#include "entityglobaldefs.h"
|
||||
#include "rpg/cutscene/scene/testcutscene.h"
|
||||
#include "rpg/cutscene/item/cutsceneitem.h"
|
||||
|
||||
ENTITY_GLOBAL_CALLBACK(3) {
|
||||
@@ -16,9 +15,6 @@ ENTITY_GLOBAL_CALLBACK(3) {
|
||||
npcPathAddNode(&create->entity->data.npc, (worldpos_t){ 10, 10, 1 });
|
||||
npcPathAddNode(&create->entity->data.npc, (worldpos_t){ 4, 4, 0 });
|
||||
npcPathAddNode(&create->entity->data.npc, (worldpos_t){ 10, 10, 1 });
|
||||
|
||||
create->entity->interact.type = ENTITY_INTERACT_CUTSCENE;
|
||||
create->entity->interact.data.cutscene = CUTSCENE_REFERENCE(TEST_TWO);
|
||||
}
|
||||
|
||||
ENTITY_GLOBAL_CALLBACK(4) {
|
||||
|
||||
@@ -29,10 +29,10 @@ typedef enum {
|
||||
* Per-type data for an entity's interact component.
|
||||
*/
|
||||
typedef union {
|
||||
// A compile-time cutscene_t* (e.g. CUTSCENE_REFERENCE(...)) - safe to
|
||||
// hold onto indefinitely, since C-authored cutscenes are compiled
|
||||
// directly into their own static const arrays, never the shared
|
||||
// CUTSCENE_LOADED_ITEMS buffer (see cutscenesystem.h).
|
||||
// A compile-time cutscene_t* (a C-authored, test-only cutscene) - safe
|
||||
// to hold onto indefinitely, since it's compiled directly into its own
|
||||
// static const arrays, never the shared CUTSCENE_LOADED_ITEMS buffer
|
||||
// (see cutscenesystem.h).
|
||||
const cutscene_t *cutscene;
|
||||
// A bare cutscene name (as passed to cutsceneCutsceneResolve), resolved
|
||||
// lazily at interact time rather than once up front - only one
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#include "assert/assert.h"
|
||||
#include "rpg/cutscene/cutscenesystem.h"
|
||||
|
||||
#include "rpg/cutscene/scene/testcutscene.h"
|
||||
|
||||
const npcmovecallback_t NPC_MOVE_CALLBACKS[NPC_MOVE_TYPE_COUNT] = {
|
||||
[NPC_MOVE_TYPE_NULL] = { 0 },
|
||||
|
||||
|
||||
@@ -20,14 +20,27 @@ static void recordCallback(void *userData) {
|
||||
// the "nested cutscene is a one-way jump" behavior: cutsceneCutsceneStart
|
||||
// replaces CUTSCENE_SYSTEM.scene outright, and the callback item's effect
|
||||
// fires in Start, not Update, so it fires the same frame the jump happens.
|
||||
CUTSCENE(TEST_INNER, NONE,
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INNER_ITEMS[] = {
|
||||
CUTSCENE_CALLBACK(recordCallback)
|
||||
);
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INNER = {
|
||||
.items = CUTSCENE_TEST_INNER_ITEMS,
|
||||
.itemCount = sizeof(CUTSCENE_TEST_INNER_ITEMS) / sizeof(cutsceneitem_t),
|
||||
.pause = CUTSCENE_PAUSE_NONE
|
||||
};
|
||||
|
||||
CUTSCENE(TEST_OUTER, DEFAULT,
|
||||
static const cutsceneitem_t CUTSCENE_TEST_OUTER_ITEMS[] = {
|
||||
CUTSCENE_WAIT(0.5f),
|
||||
CUTSCENE_CUTSCENE(TEST_INNER)
|
||||
);
|
||||
{
|
||||
.type = CUTSCENE_ITEM_TYPE_CUTSCENE,
|
||||
.cutsceneRef = { .cutscene = &CUTSCENE_TEST_INNER, .name = NULL }
|
||||
}
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_OUTER = {
|
||||
.items = CUTSCENE_TEST_OUTER_ITEMS,
|
||||
.itemCount = sizeof(CUTSCENE_TEST_OUTER_ITEMS) / sizeof(cutsceneitem_t),
|
||||
.pause = CUTSCENE_PAUSE_DEFAULT
|
||||
};
|
||||
|
||||
static void test_cutsceneSystemStartSetsUpInitialItem(void **state) {
|
||||
|
||||
@@ -75,9 +88,14 @@ static void test_cutsceneSystemUpdateIsNoopWithNoActiveCutscene(void **state) {
|
||||
assert_null(CUTSCENE_SYSTEM.scene);
|
||||
}
|
||||
|
||||
CUTSCENE(TEST_SINGLE_WAIT, NONE,
|
||||
static const cutsceneitem_t CUTSCENE_TEST_SINGLE_WAIT_ITEMS[] = {
|
||||
CUTSCENE_WAIT(1.0f)
|
||||
);
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_SINGLE_WAIT = {
|
||||
.items = CUTSCENE_TEST_SINGLE_WAIT_ITEMS,
|
||||
.itemCount = sizeof(CUTSCENE_TEST_SINGLE_WAIT_ITEMS) / sizeof(cutsceneitem_t),
|
||||
.pause = CUTSCENE_PAUSE_NONE
|
||||
};
|
||||
|
||||
static void test_cutsceneSystemStartWithSetsInteractEntities(void **state) {
|
||||
|
||||
@@ -188,19 +206,34 @@ static void recordOrder2(void *userData) { insertOrderLog[insertOrderLogCount++]
|
||||
static void recordOrderA(void *userData) { insertOrderLog[insertOrderLogCount++] = 3; }
|
||||
static void recordOrderB(void *userData) { insertOrderLog[insertOrderLogCount++] = 4; }
|
||||
|
||||
CUTSCENE(TEST_INSERT_SNIPPET, NONE,
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_SNIPPET_ITEMS[] = {
|
||||
CUTSCENE_CALLBACK(recordOrderA),
|
||||
CUTSCENE_WAIT(2.0f),
|
||||
CUTSCENE_CALLBACK(recordOrderB)
|
||||
);
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_SNIPPET = {
|
||||
.items = CUTSCENE_TEST_INSERT_SNIPPET_ITEMS,
|
||||
.itemCount =
|
||||
sizeof(CUTSCENE_TEST_INSERT_SNIPPET_ITEMS) / sizeof(cutsceneitem_t),
|
||||
.pause = CUTSCENE_PAUSE_NONE
|
||||
};
|
||||
|
||||
CUTSCENE(TEST_INSERT_OUTER, NONE,
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_OUTER_ITEMS[] = {
|
||||
CUTSCENE_CALLBACK(recordOrder0),
|
||||
CUTSCENE_WAIT(1.0f),
|
||||
CUTSCENE_CALLBACK(recordOrder1),
|
||||
CUTSCENE_INSERT(TEST_INSERT_SNIPPET),
|
||||
{
|
||||
.type = CUTSCENE_ITEM_TYPE_INSERT,
|
||||
.insert = { .cutscene = &CUTSCENE_TEST_INSERT_SNIPPET, .name = NULL }
|
||||
},
|
||||
CUTSCENE_CALLBACK(recordOrder2)
|
||||
);
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_OUTER = {
|
||||
.items = CUTSCENE_TEST_INSERT_OUTER_ITEMS,
|
||||
.itemCount =
|
||||
sizeof(CUTSCENE_TEST_INSERT_OUTER_ITEMS) / sizeof(cutsceneitem_t),
|
||||
.pause = CUTSCENE_PAUSE_NONE
|
||||
};
|
||||
|
||||
static void test_cutsceneInsertSplicesItemsInPlaceThenResumes(void **state) {
|
||||
|
||||
@@ -230,14 +263,31 @@ static void test_cutsceneInsertSplicesItemsInPlaceThenResumes(void **state) {
|
||||
assert_memory_equal(insertOrderLog, expected, sizeof(expected));
|
||||
}
|
||||
|
||||
CUTSCENE(TEST_INSERT_AS_LAST_ITEM_SNIPPET, NONE,
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_AS_LAST_ITEM_SNIPPET_ITEMS[] = {
|
||||
CUTSCENE_CALLBACK(recordOrderA)
|
||||
);
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_AS_LAST_ITEM_SNIPPET = {
|
||||
.items = CUTSCENE_TEST_INSERT_AS_LAST_ITEM_SNIPPET_ITEMS,
|
||||
.itemCount = sizeof(CUTSCENE_TEST_INSERT_AS_LAST_ITEM_SNIPPET_ITEMS) /
|
||||
sizeof(cutsceneitem_t),
|
||||
.pause = CUTSCENE_PAUSE_NONE
|
||||
};
|
||||
|
||||
CUTSCENE(TEST_INSERT_AS_LAST_ITEM_OUTER, NONE,
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_AS_LAST_ITEM_OUTER_ITEMS[] = {
|
||||
CUTSCENE_CALLBACK(recordOrder0),
|
||||
CUTSCENE_INSERT(TEST_INSERT_AS_LAST_ITEM_SNIPPET)
|
||||
);
|
||||
{
|
||||
.type = CUTSCENE_ITEM_TYPE_INSERT,
|
||||
.insert = {
|
||||
.cutscene = &CUTSCENE_TEST_INSERT_AS_LAST_ITEM_SNIPPET, .name = NULL
|
||||
}
|
||||
}
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_AS_LAST_ITEM_OUTER = {
|
||||
.items = CUTSCENE_TEST_INSERT_AS_LAST_ITEM_OUTER_ITEMS,
|
||||
.itemCount = sizeof(CUTSCENE_TEST_INSERT_AS_LAST_ITEM_OUTER_ITEMS) /
|
||||
sizeof(cutsceneitem_t),
|
||||
.pause = CUTSCENE_PAUSE_NONE
|
||||
};
|
||||
|
||||
static void test_cutsceneInsertAsLastItemEndsCutsceneNaturally(
|
||||
void **state
|
||||
@@ -263,23 +313,47 @@ static void test_cutsceneInsertAsLastItemEndsCutsceneNaturally(
|
||||
assert_memory_equal(insertOrderLog, expected, sizeof(expected));
|
||||
}
|
||||
|
||||
CUTSCENE(TEST_INSERT_NESTED_INNER, NONE,
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_NESTED_INNER_ITEMS[] = {
|
||||
CUTSCENE_CALLBACK(recordOrderA)
|
||||
);
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_NESTED_INNER = {
|
||||
.items = CUTSCENE_TEST_INSERT_NESTED_INNER_ITEMS,
|
||||
.itemCount =
|
||||
sizeof(CUTSCENE_TEST_INSERT_NESTED_INNER_ITEMS) / sizeof(cutsceneitem_t),
|
||||
.pause = CUTSCENE_PAUSE_NONE
|
||||
};
|
||||
|
||||
// INSERT is MID's first item, so entering MID (from OUTER) cascades
|
||||
// straight through into INNER within the same Start chain, one level
|
||||
// deeper than a single insert.
|
||||
CUTSCENE(TEST_INSERT_NESTED_MID, NONE,
|
||||
CUTSCENE_INSERT(TEST_INSERT_NESTED_INNER),
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_NESTED_MID_ITEMS[] = {
|
||||
{
|
||||
.type = CUTSCENE_ITEM_TYPE_INSERT,
|
||||
.insert = { .cutscene = &CUTSCENE_TEST_INSERT_NESTED_INNER, .name = NULL }
|
||||
},
|
||||
CUTSCENE_CALLBACK(recordOrderB)
|
||||
);
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_NESTED_MID = {
|
||||
.items = CUTSCENE_TEST_INSERT_NESTED_MID_ITEMS,
|
||||
.itemCount =
|
||||
sizeof(CUTSCENE_TEST_INSERT_NESTED_MID_ITEMS) / sizeof(cutsceneitem_t),
|
||||
.pause = CUTSCENE_PAUSE_NONE
|
||||
};
|
||||
|
||||
CUTSCENE(TEST_INSERT_NESTED_OUTER, NONE,
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_NESTED_OUTER_ITEMS[] = {
|
||||
CUTSCENE_CALLBACK(recordOrder0),
|
||||
CUTSCENE_INSERT(TEST_INSERT_NESTED_MID),
|
||||
{
|
||||
.type = CUTSCENE_ITEM_TYPE_INSERT,
|
||||
.insert = { .cutscene = &CUTSCENE_TEST_INSERT_NESTED_MID, .name = NULL }
|
||||
},
|
||||
CUTSCENE_CALLBACK(recordOrder2)
|
||||
);
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_NESTED_OUTER = {
|
||||
.items = CUTSCENE_TEST_INSERT_NESTED_OUTER_ITEMS,
|
||||
.itemCount =
|
||||
sizeof(CUTSCENE_TEST_INSERT_NESTED_OUTER_ITEMS) / sizeof(cutsceneitem_t),
|
||||
.pause = CUTSCENE_PAUSE_NONE
|
||||
};
|
||||
|
||||
static void test_cutsceneInsertNestsThroughMultipleLevels(void **state) {
|
||||
|
||||
@@ -306,24 +380,75 @@ static void test_cutsceneInsertNestsThroughMultipleLevels(void **state) {
|
||||
assert_memory_equal(insertOrderLog, expected, sizeof(expected));
|
||||
}
|
||||
|
||||
CUTSCENE(TEST_INSERT_OVERFLOW_LEVEL5, NONE,
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL5_ITEMS[] = {
|
||||
CUTSCENE_CALLBACK(recordOrderA)
|
||||
);
|
||||
CUTSCENE(TEST_INSERT_OVERFLOW_LEVEL4, NONE,
|
||||
CUTSCENE_INSERT(TEST_INSERT_OVERFLOW_LEVEL5)
|
||||
);
|
||||
CUTSCENE(TEST_INSERT_OVERFLOW_LEVEL3, NONE,
|
||||
CUTSCENE_INSERT(TEST_INSERT_OVERFLOW_LEVEL4)
|
||||
);
|
||||
CUTSCENE(TEST_INSERT_OVERFLOW_LEVEL2, NONE,
|
||||
CUTSCENE_INSERT(TEST_INSERT_OVERFLOW_LEVEL3)
|
||||
);
|
||||
CUTSCENE(TEST_INSERT_OVERFLOW_LEVEL1, NONE,
|
||||
CUTSCENE_INSERT(TEST_INSERT_OVERFLOW_LEVEL2)
|
||||
);
|
||||
CUTSCENE(TEST_INSERT_OVERFLOW_LEVEL0, NONE,
|
||||
CUTSCENE_INSERT(TEST_INSERT_OVERFLOW_LEVEL1)
|
||||
);
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL5 = {
|
||||
.items = CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL5_ITEMS,
|
||||
.itemCount = sizeof(CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL5_ITEMS) /
|
||||
sizeof(cutsceneitem_t),
|
||||
.pause = CUTSCENE_PAUSE_NONE
|
||||
};
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL4_ITEMS[] = {
|
||||
{
|
||||
.type = CUTSCENE_ITEM_TYPE_INSERT,
|
||||
.insert = { .cutscene = &CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL5, .name = NULL }
|
||||
}
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL4 = {
|
||||
.items = CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL4_ITEMS,
|
||||
.itemCount = sizeof(CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL4_ITEMS) /
|
||||
sizeof(cutsceneitem_t),
|
||||
.pause = CUTSCENE_PAUSE_NONE
|
||||
};
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL3_ITEMS[] = {
|
||||
{
|
||||
.type = CUTSCENE_ITEM_TYPE_INSERT,
|
||||
.insert = { .cutscene = &CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL4, .name = NULL }
|
||||
}
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL3 = {
|
||||
.items = CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL3_ITEMS,
|
||||
.itemCount = sizeof(CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL3_ITEMS) /
|
||||
sizeof(cutsceneitem_t),
|
||||
.pause = CUTSCENE_PAUSE_NONE
|
||||
};
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL2_ITEMS[] = {
|
||||
{
|
||||
.type = CUTSCENE_ITEM_TYPE_INSERT,
|
||||
.insert = { .cutscene = &CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL3, .name = NULL }
|
||||
}
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL2 = {
|
||||
.items = CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL2_ITEMS,
|
||||
.itemCount = sizeof(CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL2_ITEMS) /
|
||||
sizeof(cutsceneitem_t),
|
||||
.pause = CUTSCENE_PAUSE_NONE
|
||||
};
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL1_ITEMS[] = {
|
||||
{
|
||||
.type = CUTSCENE_ITEM_TYPE_INSERT,
|
||||
.insert = { .cutscene = &CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL2, .name = NULL }
|
||||
}
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL1 = {
|
||||
.items = CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL1_ITEMS,
|
||||
.itemCount = sizeof(CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL1_ITEMS) /
|
||||
sizeof(cutsceneitem_t),
|
||||
.pause = CUTSCENE_PAUSE_NONE
|
||||
};
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL0_ITEMS[] = {
|
||||
{
|
||||
.type = CUTSCENE_ITEM_TYPE_INSERT,
|
||||
.insert = { .cutscene = &CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL1, .name = NULL }
|
||||
}
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL0 = {
|
||||
.items = CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL0_ITEMS,
|
||||
.itemCount = sizeof(CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL0_ITEMS) /
|
||||
sizeof(cutsceneitem_t),
|
||||
.pause = CUTSCENE_PAUSE_NONE
|
||||
};
|
||||
|
||||
static void test_cutsceneInsertAssertsWhenNestingExceedsStackMax(
|
||||
void **state
|
||||
@@ -341,13 +466,28 @@ static void test_cutsceneInsertAssertsWhenNestingExceedsStackMax(
|
||||
|
||||
static void noopInsertCallback(void *userData) {}
|
||||
|
||||
CUTSCENE(TEST_INSERT_PERSIST_SNIPPET, ALL,
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_PERSIST_SNIPPET_ITEMS[] = {
|
||||
CUTSCENE_CALLBACK(noopInsertCallback)
|
||||
);
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_PERSIST_SNIPPET = {
|
||||
.items = CUTSCENE_TEST_INSERT_PERSIST_SNIPPET_ITEMS,
|
||||
.itemCount = sizeof(CUTSCENE_TEST_INSERT_PERSIST_SNIPPET_ITEMS) /
|
||||
sizeof(cutsceneitem_t),
|
||||
.pause = CUTSCENE_PAUSE_ALL
|
||||
};
|
||||
|
||||
CUTSCENE(TEST_INSERT_PERSIST_OUTER, NPC,
|
||||
CUTSCENE_INSERT(TEST_INSERT_PERSIST_SNIPPET)
|
||||
);
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_PERSIST_OUTER_ITEMS[] = {
|
||||
{
|
||||
.type = CUTSCENE_ITEM_TYPE_INSERT,
|
||||
.insert = { .cutscene = &CUTSCENE_TEST_INSERT_PERSIST_SNIPPET, .name = NULL }
|
||||
}
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_PERSIST_OUTER = {
|
||||
.items = CUTSCENE_TEST_INSERT_PERSIST_OUTER_ITEMS,
|
||||
.itemCount = sizeof(CUTSCENE_TEST_INSERT_PERSIST_OUTER_ITEMS) /
|
||||
sizeof(cutsceneitem_t),
|
||||
.pause = CUTSCENE_PAUSE_NPC
|
||||
};
|
||||
|
||||
static void test_cutsceneInsertDoesNotResetPauseOrInteractEntities(
|
||||
void **state
|
||||
|
||||
Reference in New Issue
Block a user