From 54e83fe561ed750450e03ffa54b1df93fd01a252 Mon Sep 17 00:00:00 2001 From: Luis Michaelis Date: Thu, 4 Jan 2024 15:49:32 +0100 Subject: [PATCH] feat(CutsceneLibrary): add block index accessors --- include/zenkit-capi/CutsceneLibrary.h | 2 ++ src/CutsceneLibrary.cc | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/zenkit-capi/CutsceneLibrary.h b/include/zenkit-capi/CutsceneLibrary.h index cc33c99..64d98d2 100644 --- a/include/zenkit-capi/CutsceneLibrary.h +++ b/include/zenkit-capi/CutsceneLibrary.h @@ -23,7 +23,9 @@ ZKC_API ZkCutsceneLibrary* ZkCutsceneLibrary_loadPath(ZkString path); ZKC_API ZkCutsceneLibrary* ZkCutsceneLibrary_loadVfs(ZkVfs const* vfs, ZkString string); ZKC_API void ZkCutsceneLibrary_del(ZkCutsceneLibrary* slf); +ZKC_API ZkSize ZkCutsceneLibrary_getBlockCount(ZkCutsceneLibrary const* slf); ZKC_API ZkCutsceneBlock const* ZkCutsceneLibrary_getBlock(ZkCutsceneLibrary const* slf, ZkString name); +ZKC_API ZkCutsceneBlock const* ZkCutsceneLibrary_getBlockByIndex(ZkCutsceneLibrary const* slf, ZkSize i); ZKC_API void ZkCutsceneLibrary_enumerateBlocks(ZkCutsceneLibrary const* slf, ZkCutsceneBlockEnumerator cb, void* ctx); ZKC_API ZkString ZkCutsceneBlock_getName(ZkCutsceneBlock const* slf); diff --git a/src/CutsceneLibrary.cc b/src/CutsceneLibrary.cc index 50a3ede..aef0bfc 100644 --- a/src/CutsceneLibrary.cc +++ b/src/CutsceneLibrary.cc @@ -9,6 +9,19 @@ ZKC_PATH_LOADER(ZkCutsceneLibrary); ZKC_VFS_LOADER(ZkCutsceneLibrary); ZKC_DELETER(ZkCutsceneLibrary); +ZkSize ZkCutsceneLibrary_getBlockCount(ZkCutsceneLibrary const* slf) { + ZKC_TRACE_FN(); + ZKC_CHECK_NULL(slf); + return slf->blocks.size(); +} + +ZkCutsceneBlock const* ZkCutsceneLibrary_getBlockByIndex(ZkCutsceneLibrary const* slf, ZkSize i) { + ZKC_TRACE_FN(); + ZKC_CHECK_NULL(slf); + ZKC_CHECK_LEN(slf->blocks, i); + return &slf->blocks[i]; +} + ZkCutsceneBlock const* ZkCutsceneLibrary_getBlock(ZkCutsceneLibrary const* slf, ZkString name) { ZKC_TRACE_FN(); ZKC_CHECK_NULL(slf);