Remove per-item cutscene authoring macros
Every CUTSCENE_XXX(...) shorthand (CUTSCENE_WAIT, CUTSCENE_TEXT, CUTSCENE_ENTITY_WALK_TO, etc.) existed to build a cutsceneitem_t literal in C; real cutscenes are now authored exclusively as .jsonc files, and the only other users were test fixtures. Deletes all ~55 of these macros (and the shared CUTSCENE_ITEM(...) helper they built on) along with their doc comments, leaving each item's struct/enum/Start/Update/ Load declarations untouched. test_battle.c, test_cutscenecontrol.c, test_cutscenemaparea.c, test_cutscenesystem.c and test_entityinteract.c now build their cutsceneitem_t fixtures as plain struct literals instead. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
static void test_cutsceneWaitCompletesAfterItsDuration(void **state) {
|
||||
|
||||
cutsceneitem_t item = CUTSCENE_WAIT(1.0f);
|
||||
cutsceneitem_t item = { .type = CUTSCENE_ITEM_TYPE_WAIT, .wait = 1.0f };
|
||||
cutsceneitemdata_t data;
|
||||
memoryZero(&data, sizeof(data));
|
||||
|
||||
@@ -38,7 +38,8 @@ static void test_cutsceneCallbackFiresOnStartWithUserData(void **state) {
|
||||
callbackCallCount = 0;
|
||||
lastUserData = NULL;
|
||||
|
||||
cutsceneitem_t item = CUTSCENE_CALLBACK(recordCallback);
|
||||
cutsceneitem_t item =
|
||||
{ .type = CUTSCENE_ITEM_TYPE_CALLBACK, .callback = recordCallback };
|
||||
cutsceneitemdata_t data;
|
||||
|
||||
cutsceneCallbackStart(&item, &data);
|
||||
@@ -65,8 +66,10 @@ static void test_cutsceneCallbackNullIsNoop(void **state) {
|
||||
static void test_cutsceneSetPauseAppliesImmediately(void **state) {
|
||||
|
||||
CUTSCENE_SYSTEM.pause = CUTSCENE_PAUSE_NONE;
|
||||
cutsceneitem_t item =
|
||||
CUTSCENE_SET_PAUSE(CUTSCENE_PAUSE_NPC | CUTSCENE_PAUSE_BATTLE);
|
||||
cutsceneitem_t item = {
|
||||
.type = CUTSCENE_ITEM_TYPE_SET_PAUSE,
|
||||
.setPause = CUTSCENE_PAUSE_NPC | CUTSCENE_PAUSE_BATTLE
|
||||
};
|
||||
cutsceneitemdata_t data;
|
||||
|
||||
cutsceneSetPauseStart(&item, &data);
|
||||
@@ -78,10 +81,16 @@ static void test_cutsceneSetPauseAppliesImmediately(void **state) {
|
||||
|
||||
static void test_cutsceneConcurrentCompletesOnceAllChildrenDo(void **state) {
|
||||
|
||||
cutsceneitem_t item = CUTSCENE_CONCURRENT(
|
||||
CUTSCENE_WAIT(0.2f),
|
||||
CUTSCENE_WAIT(0.5f)
|
||||
);
|
||||
cutsceneitem_t item = {
|
||||
.type = CUTSCENE_ITEM_TYPE_CONCURRENT,
|
||||
.concurrent = {
|
||||
.items = (const cutsceneitem_t[]){
|
||||
{ .type = CUTSCENE_ITEM_TYPE_WAIT, .wait = 0.2f },
|
||||
{ .type = CUTSCENE_ITEM_TYPE_WAIT, .wait = 0.5f }
|
||||
},
|
||||
.count = 2
|
||||
}
|
||||
};
|
||||
cutsceneitemdata_t data;
|
||||
memoryZero(&data, sizeof(data));
|
||||
|
||||
@@ -100,10 +109,16 @@ static void test_cutsceneConcurrentDoesNotReUpdateFinishedChildren(
|
||||
void **state
|
||||
) {
|
||||
|
||||
cutsceneitem_t item = CUTSCENE_CONCURRENT(
|
||||
CUTSCENE_WAIT(0.1f),
|
||||
CUTSCENE_WAIT(10.0f)
|
||||
);
|
||||
cutsceneitem_t item = {
|
||||
.type = CUTSCENE_ITEM_TYPE_CONCURRENT,
|
||||
.concurrent = {
|
||||
.items = (const cutsceneitem_t[]){
|
||||
{ .type = CUTSCENE_ITEM_TYPE_WAIT, .wait = 0.1f },
|
||||
{ .type = CUTSCENE_ITEM_TYPE_WAIT, .wait = 10.0f }
|
||||
},
|
||||
.count = 2
|
||||
}
|
||||
};
|
||||
cutsceneitemdata_t data;
|
||||
memoryZero(&data, sizeof(data));
|
||||
|
||||
@@ -121,8 +136,23 @@ static void test_cutsceneConcurrentDoesNotReUpdateFinishedChildren(
|
||||
|
||||
static void test_cutsceneConcurrentCannotNest(void **state) {
|
||||
|
||||
cutsceneitem_t outer =
|
||||
CUTSCENE_CONCURRENT(CUTSCENE_CONCURRENT(CUTSCENE_WAIT(1.0f)));
|
||||
cutsceneitem_t outer = {
|
||||
.type = CUTSCENE_ITEM_TYPE_CONCURRENT,
|
||||
.concurrent = {
|
||||
.items = (const cutsceneitem_t[]){
|
||||
{
|
||||
.type = CUTSCENE_ITEM_TYPE_CONCURRENT,
|
||||
.concurrent = {
|
||||
.items = (const cutsceneitem_t[]){
|
||||
{ .type = CUTSCENE_ITEM_TYPE_WAIT, .wait = 1.0f }
|
||||
},
|
||||
.count = 1
|
||||
}
|
||||
}
|
||||
},
|
||||
.count = 1
|
||||
}
|
||||
};
|
||||
cutsceneitemdata_t data;
|
||||
|
||||
expect_assert_failure(cutsceneConcurrentStart(&outer, &data));
|
||||
|
||||
@@ -19,9 +19,14 @@ static void test_cutsceneMapAreaAddCreatesAreaAndStoresLastCreated(
|
||||
) {
|
||||
|
||||
resetMapAreas();
|
||||
cutsceneitem_t item = CUTSCENE_MAP_AREA_ADD(
|
||||
0, 0, 0, 5, 5, 0, mapAreaNoopCallback, MAP_AREA_NOTIFY_ALL, MAP_TRIGGER_ALL
|
||||
);
|
||||
cutsceneitem_t item = {
|
||||
.type = CUTSCENE_ITEM_TYPE_MAP_AREA_ADD,
|
||||
.mapAreaAdd = {
|
||||
.min = { 0, 0, 0 }, .max = { 5, 5, 0 },
|
||||
.callback = mapAreaNoopCallback,
|
||||
.notify = MAP_AREA_NOTIFY_ALL, .trigger = MAP_TRIGGER_ALL
|
||||
}
|
||||
};
|
||||
cutsceneitemdata_t data;
|
||||
|
||||
cutsceneMapAreaAddStart(&item, &data);
|
||||
@@ -40,7 +45,10 @@ static void test_cutsceneMapAreaRemoveClearsSlot(void **state) {
|
||||
mapAreaNoopCallback, MAP_AREA_NOTIFY_ALL, MAP_TRIGGER_ALL
|
||||
);
|
||||
|
||||
cutsceneitem_t item = CUTSCENE_MAP_AREA_REMOVE(id);
|
||||
cutsceneitem_t item = {
|
||||
.type = CUTSCENE_ITEM_TYPE_MAP_AREA_REMOVE,
|
||||
.mapAreaRemove = { .areaId = id }
|
||||
};
|
||||
cutsceneitemdata_t data;
|
||||
|
||||
cutsceneMapAreaRemoveStart(&item, &data);
|
||||
@@ -53,15 +61,22 @@ static void test_cutsceneMapAreaRemoveResolvesLastCreatedSentinel(
|
||||
) {
|
||||
|
||||
resetMapAreas();
|
||||
cutsceneitem_t addItem = CUTSCENE_MAP_AREA_ADD(
|
||||
0, 0, 0, 5, 5, 0, mapAreaNoopCallback, MAP_AREA_NOTIFY_ALL, MAP_TRIGGER_ALL
|
||||
);
|
||||
cutsceneitem_t addItem = {
|
||||
.type = CUTSCENE_ITEM_TYPE_MAP_AREA_ADD,
|
||||
.mapAreaAdd = {
|
||||
.min = { 0, 0, 0 }, .max = { 5, 5, 0 },
|
||||
.callback = mapAreaNoopCallback,
|
||||
.notify = MAP_AREA_NOTIFY_ALL, .trigger = MAP_TRIGGER_ALL
|
||||
}
|
||||
};
|
||||
cutsceneitemdata_t data;
|
||||
cutsceneMapAreaAddStart(&addItem, &data);
|
||||
uint8_t id = CUTSCENE_SYSTEM.areaLastCreated;
|
||||
|
||||
cutsceneitem_t removeItem =
|
||||
CUTSCENE_MAP_AREA_REMOVE(CUTSCENE_AREA_LAST_CREATED);
|
||||
cutsceneitem_t removeItem = {
|
||||
.type = CUTSCENE_ITEM_TYPE_MAP_AREA_REMOVE,
|
||||
.mapAreaRemove = { .areaId = CUTSCENE_AREA_LAST_CREATED }
|
||||
};
|
||||
cutsceneMapAreaRemoveStart(&removeItem, &data);
|
||||
assert_null(MAP_AREAS[id].callback);
|
||||
}
|
||||
@@ -76,7 +91,10 @@ static void test_cutsceneMapAreaWaitCompletesWhenTriggerCountChanges(
|
||||
mapAreaNoopCallback, MAP_AREA_NOTIFY_ALL, MAP_TRIGGER_ALL
|
||||
);
|
||||
|
||||
cutsceneitem_t item = CUTSCENE_MAP_AREA_WAIT(id);
|
||||
cutsceneitem_t item = {
|
||||
.type = CUTSCENE_ITEM_TYPE_MAP_AREA_WAIT,
|
||||
.mapAreaWait = { .areaIds = { id }, .count = 1 }
|
||||
};
|
||||
cutsceneitemdata_t data;
|
||||
|
||||
cutsceneMapAreaWaitStart(&item, &data);
|
||||
@@ -100,7 +118,10 @@ static void test_cutsceneMapAreaWaitCompletesWhenAnyWatchedAreaChanges(
|
||||
mapAreaNoopCallback, MAP_AREA_NOTIFY_ALL, MAP_TRIGGER_ALL
|
||||
);
|
||||
|
||||
cutsceneitem_t item = CUTSCENE_MAP_AREA_WAIT(idA, idB);
|
||||
cutsceneitem_t item = {
|
||||
.type = CUTSCENE_ITEM_TYPE_MAP_AREA_WAIT,
|
||||
.mapAreaWait = { .areaIds = { idA, idB }, .count = 2 }
|
||||
};
|
||||
cutsceneitemdata_t data;
|
||||
|
||||
cutsceneMapAreaWaitStart(&item, &data);
|
||||
@@ -115,14 +136,22 @@ static void test_cutsceneMapAreaWaitResolvesLastCreatedSentinel(
|
||||
) {
|
||||
|
||||
resetMapAreas();
|
||||
cutsceneitem_t addItem = CUTSCENE_MAP_AREA_ADD(
|
||||
0, 0, 0, 5, 5, 0, mapAreaNoopCallback, MAP_AREA_NOTIFY_ALL, MAP_TRIGGER_ALL
|
||||
);
|
||||
cutsceneitem_t addItem = {
|
||||
.type = CUTSCENE_ITEM_TYPE_MAP_AREA_ADD,
|
||||
.mapAreaAdd = {
|
||||
.min = { 0, 0, 0 }, .max = { 5, 5, 0 },
|
||||
.callback = mapAreaNoopCallback,
|
||||
.notify = MAP_AREA_NOTIFY_ALL, .trigger = MAP_TRIGGER_ALL
|
||||
}
|
||||
};
|
||||
cutsceneitemdata_t data;
|
||||
cutsceneMapAreaAddStart(&addItem, &data);
|
||||
uint8_t id = CUTSCENE_SYSTEM.areaLastCreated;
|
||||
|
||||
cutsceneitem_t waitItem = CUTSCENE_MAP_AREA_WAIT(CUTSCENE_AREA_LAST_CREATED);
|
||||
cutsceneitem_t waitItem = {
|
||||
.type = CUTSCENE_ITEM_TYPE_MAP_AREA_WAIT,
|
||||
.mapAreaWait = { .areaIds = { CUTSCENE_AREA_LAST_CREATED }, .count = 1 }
|
||||
};
|
||||
cutsceneMapAreaWaitStart(&waitItem, &data);
|
||||
assert_false(cutsceneMapAreaWaitUpdate(&waitItem, &data));
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ static void recordCallback(void *userData) {
|
||||
// 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.
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INNER_ITEMS[] = {
|
||||
CUTSCENE_CALLBACK(recordCallback)
|
||||
{ .type = CUTSCENE_ITEM_TYPE_CALLBACK, .callback = recordCallback }
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INNER = {
|
||||
.items = CUTSCENE_TEST_INNER_ITEMS,
|
||||
@@ -30,7 +30,7 @@ static const cutscene_t CUTSCENE_TEST_INNER = {
|
||||
};
|
||||
|
||||
static const cutsceneitem_t CUTSCENE_TEST_OUTER_ITEMS[] = {
|
||||
CUTSCENE_WAIT(0.5f),
|
||||
{ .type = CUTSCENE_ITEM_TYPE_WAIT, .wait = 0.5f },
|
||||
{
|
||||
.type = CUTSCENE_ITEM_TYPE_CUTSCENE,
|
||||
.cutsceneRef = { .cutscene = &CUTSCENE_TEST_INNER, .name = NULL }
|
||||
@@ -89,7 +89,7 @@ static void test_cutsceneSystemUpdateIsNoopWithNoActiveCutscene(void **state) {
|
||||
}
|
||||
|
||||
static const cutsceneitem_t CUTSCENE_TEST_SINGLE_WAIT_ITEMS[] = {
|
||||
CUTSCENE_WAIT(1.0f)
|
||||
{ .type = CUTSCENE_ITEM_TYPE_WAIT, .wait = 1.0f }
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_SINGLE_WAIT = {
|
||||
.items = CUTSCENE_TEST_SINGLE_WAIT_ITEMS,
|
||||
@@ -207,9 +207,9 @@ static void recordOrderA(void *userData) { insertOrderLog[insertOrderLogCount++]
|
||||
static void recordOrderB(void *userData) { insertOrderLog[insertOrderLogCount++] = 4; }
|
||||
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_SNIPPET_ITEMS[] = {
|
||||
CUTSCENE_CALLBACK(recordOrderA),
|
||||
CUTSCENE_WAIT(2.0f),
|
||||
CUTSCENE_CALLBACK(recordOrderB)
|
||||
{ .type = CUTSCENE_ITEM_TYPE_CALLBACK, .callback = recordOrderA },
|
||||
{ .type = CUTSCENE_ITEM_TYPE_WAIT, .wait = 2.0f },
|
||||
{ .type = CUTSCENE_ITEM_TYPE_CALLBACK, .callback = recordOrderB }
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_SNIPPET = {
|
||||
.items = CUTSCENE_TEST_INSERT_SNIPPET_ITEMS,
|
||||
@@ -219,14 +219,14 @@ static const cutscene_t CUTSCENE_TEST_INSERT_SNIPPET = {
|
||||
};
|
||||
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_OUTER_ITEMS[] = {
|
||||
CUTSCENE_CALLBACK(recordOrder0),
|
||||
CUTSCENE_WAIT(1.0f),
|
||||
CUTSCENE_CALLBACK(recordOrder1),
|
||||
{ .type = CUTSCENE_ITEM_TYPE_CALLBACK, .callback = recordOrder0 },
|
||||
{ .type = CUTSCENE_ITEM_TYPE_WAIT, .wait = 1.0f },
|
||||
{ .type = CUTSCENE_ITEM_TYPE_CALLBACK, .callback = recordOrder1 },
|
||||
{
|
||||
.type = CUTSCENE_ITEM_TYPE_INSERT,
|
||||
.insert = { .cutscene = &CUTSCENE_TEST_INSERT_SNIPPET, .name = NULL }
|
||||
},
|
||||
CUTSCENE_CALLBACK(recordOrder2)
|
||||
{ .type = CUTSCENE_ITEM_TYPE_CALLBACK, .callback = recordOrder2 }
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_OUTER = {
|
||||
.items = CUTSCENE_TEST_INSERT_OUTER_ITEMS,
|
||||
@@ -264,7 +264,7 @@ static void test_cutsceneInsertSplicesItemsInPlaceThenResumes(void **state) {
|
||||
}
|
||||
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_AS_LAST_ITEM_SNIPPET_ITEMS[] = {
|
||||
CUTSCENE_CALLBACK(recordOrderA)
|
||||
{ .type = CUTSCENE_ITEM_TYPE_CALLBACK, .callback = recordOrderA }
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_AS_LAST_ITEM_SNIPPET = {
|
||||
.items = CUTSCENE_TEST_INSERT_AS_LAST_ITEM_SNIPPET_ITEMS,
|
||||
@@ -274,7 +274,7 @@ static const cutscene_t CUTSCENE_TEST_INSERT_AS_LAST_ITEM_SNIPPET = {
|
||||
};
|
||||
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_AS_LAST_ITEM_OUTER_ITEMS[] = {
|
||||
CUTSCENE_CALLBACK(recordOrder0),
|
||||
{ .type = CUTSCENE_ITEM_TYPE_CALLBACK, .callback = recordOrder0 },
|
||||
{
|
||||
.type = CUTSCENE_ITEM_TYPE_INSERT,
|
||||
.insert = {
|
||||
@@ -314,7 +314,7 @@ static void test_cutsceneInsertAsLastItemEndsCutsceneNaturally(
|
||||
}
|
||||
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_NESTED_INNER_ITEMS[] = {
|
||||
CUTSCENE_CALLBACK(recordOrderA)
|
||||
{ .type = CUTSCENE_ITEM_TYPE_CALLBACK, .callback = recordOrderA }
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_NESTED_INNER = {
|
||||
.items = CUTSCENE_TEST_INSERT_NESTED_INNER_ITEMS,
|
||||
@@ -331,7 +331,7 @@ 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)
|
||||
{ .type = CUTSCENE_ITEM_TYPE_CALLBACK, .callback = recordOrderB }
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_NESTED_MID = {
|
||||
.items = CUTSCENE_TEST_INSERT_NESTED_MID_ITEMS,
|
||||
@@ -341,12 +341,12 @@ static const cutscene_t CUTSCENE_TEST_INSERT_NESTED_MID = {
|
||||
};
|
||||
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_NESTED_OUTER_ITEMS[] = {
|
||||
CUTSCENE_CALLBACK(recordOrder0),
|
||||
{ .type = CUTSCENE_ITEM_TYPE_CALLBACK, .callback = recordOrder0 },
|
||||
{
|
||||
.type = CUTSCENE_ITEM_TYPE_INSERT,
|
||||
.insert = { .cutscene = &CUTSCENE_TEST_INSERT_NESTED_MID, .name = NULL }
|
||||
},
|
||||
CUTSCENE_CALLBACK(recordOrder2)
|
||||
{ .type = CUTSCENE_ITEM_TYPE_CALLBACK, .callback = recordOrder2 }
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_NESTED_OUTER = {
|
||||
.items = CUTSCENE_TEST_INSERT_NESTED_OUTER_ITEMS,
|
||||
@@ -381,7 +381,7 @@ static void test_cutsceneInsertNestsThroughMultipleLevels(void **state) {
|
||||
}
|
||||
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL5_ITEMS[] = {
|
||||
CUTSCENE_CALLBACK(recordOrderA)
|
||||
{ .type = CUTSCENE_ITEM_TYPE_CALLBACK, .callback = recordOrderA }
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL5 = {
|
||||
.items = CUTSCENE_TEST_INSERT_OVERFLOW_LEVEL5_ITEMS,
|
||||
@@ -467,7 +467,7 @@ static void test_cutsceneInsertAssertsWhenNestingExceedsStackMax(
|
||||
static void noopInsertCallback(void *userData) {}
|
||||
|
||||
static const cutsceneitem_t CUTSCENE_TEST_INSERT_PERSIST_SNIPPET_ITEMS[] = {
|
||||
CUTSCENE_CALLBACK(noopInsertCallback)
|
||||
{ .type = CUTSCENE_ITEM_TYPE_CALLBACK, .callback = noopInsertCallback }
|
||||
};
|
||||
static const cutscene_t CUTSCENE_TEST_INSERT_PERSIST_SNIPPET = {
|
||||
.items = CUTSCENE_TEST_INSERT_PERSIST_SNIPPET_ITEMS,
|
||||
|
||||
Reference in New Issue
Block a user