Add cutsceneAppend/cutsceneAppendNext for mutating a running cutscene

cutsceneAppend adds items to the end of a cutscene_t's item array;
cutsceneAppendNext inserts them at a given index instead (e.g.
CUTSCENE_SYSTEM.currentItem + 1, to run immediately after the
currently-executing item), shifting everything from that index
onward to make room. Both are capacity-bounded against the caller-
supplied itemsMax, matching cutsceneParseDoc's convention of never
assuming ownership of the backing buffer's size.

cutscene_t.items drops its const qualifier to allow this in-place
mutation; cutsceneitem_t backing arrays in the test fixtures that get
assigned into a mutable cutscene_t.items are no longer declared const
either, since a const source would otherwise silently violate the
field's new type.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
2026-09-15 13:16:02 -05:00
co-authored by Claude Sonnet 5
parent dbb5301ade
commit 44594f7011
5 changed files with 97 additions and 21 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
// Fighter slots as added by test_battleCutsceneForceActionOverridesTarget:
// 0 = allyA, 1 = allyB, 2 = enemy.
static const cutsceneitem_t CUTSCENE_TEST_SCRATCH_ITEMS[] = {
static cutsceneitem_t CUTSCENE_TEST_SCRATCH_ITEMS[] = {
// Waiting BEFORE pausing is the correct order: pausing first would
// freeze BATTLE.state wherever it happened to be and it would never
// reach PRE_ROUND on its own to satisfy the wait.