From 39c060636f1061d02fbe74c819d5a4aa3a0c8380 Mon Sep 17 00:00:00 2001 From: Luis Michaelis Date: Sun, 11 Feb 2024 15:45:43 +0100 Subject: [PATCH] docs(CutsceneLibrary): update CutsceneLibrary docs --- docs/library/api/cutscene-library.md | 50 ++++++++++++++++------------ include/zenkit/CutsceneLibrary.hh | 24 ++----------- 2 files changed, 32 insertions(+), 42 deletions(-) diff --git a/docs/library/api/cutscene-library.md b/docs/library/api/cutscene-library.md index 835d05de..b730eba4 100644 --- a/docs/library/api/cutscene-library.md +++ b/docs/library/api/cutscene-library.md @@ -5,30 +5,27 @@ audio recording. These files are used in conjunction with [scripts](daedalus-scr conversations in-game. *Cutscene libraries* are found within the `_work/data/scripts/content/cutscene/` directory of Gothic and Gothic II installations. -# Loading Cutscene Libraries - === "C" ```c title="Example" - #include - #include + #include + #include int main(int, const char** argv) { - PxBuffer* buf = pxBufferMmap("OU.csl"); - PxCutsceneLib* csl = pxCslLoad(buf); - pxBufferDestroy(csl); - - // ... + // Load from a file on disk: + ZkCutsceneLibrary* csl = ZkCutsceneLibrary_loadPath("OU.csl"); + ZkCutsceneLibrary_del(csl); + + // ... or from a VFS: + ZkVfs* vfs = ZkVfs_new(); + ZkVfs_mountHost(vfs, "_work/", "/", ZkVfsOverwriteBehavior_OLDER); + csl = ZkCutsceneLibrary_loadVfs(vfs, "OU.csl"); + ZkCutsceneLibrary_del(csl); - pxCslDestroy(man); return 0; } ``` - !!! info - As with all resources, cutscene libraries can also be loaded from a [virtual file system](virtual-file-system.md) - by passing a `PxVfs` and the file name to `pxCslLoadFromVfs`. - === "C++" ```cpp title="Example" @@ -38,23 +35,34 @@ of Gothic and Gothic II installations. int main(int, char const** argv) { zenkit::CutsceneLibrary csl {}; + // Load from a file on disk: auto r = zenkit::Read::from("OU.csl"); csl.load(r.get()); - // ... + // ... or from a VFS + zenkit::Vfs vfs; + vfs.mount_host("_work/", "/", zenkit::VfsOverwriteBehavior::OLDER) + + r = vfs->find("OU.csl")->open_read(); + font.load(r.get()); return 0; } ``` - !!! info - As with all resources, cutscene libraries can also be loaded from a [virtual file system](virtual-file-system.md) - by passing the input obtained from `zenkit::VfsNode::open_read` into `zenkit::CutsceneLibrary::load`. - === "C#" - !!! note - No documentation available. + ```c# title="Example" + using ZenKit; + + // Load from a file on disk: + var csl = new CutsceneLibrary("OU.csl"); + + // ... or from a VFS: + var vfs = new Vfs(); + vfs.Mount("_work/", "/", VfsOverwriteBehavior.Older); + csl = new CutsceneLibrary(vfs, "OU.csl"); + ``` === "Java" diff --git a/include/zenkit/CutsceneLibrary.hh b/include/zenkit/CutsceneLibrary.hh index 72013c39..3ad4d1c0 100644 --- a/include/zenkit/CutsceneLibrary.hh +++ b/include/zenkit/CutsceneLibrary.hh @@ -33,9 +33,9 @@ namespace zenkit { std::string name; /// \brief The content of the message. - /// \details It seems like it was possible to specify multiple atomic_message object for each message_block. - /// This seems to have been abandoned, however, so this implementation only supports one atomic_message - /// per message block. + /// \details It seems like it was at one point possible to specify multiple CutsceneMessage objects for each + /// CutsceneBlock. This seems to have been abandoned, however, so this implementation only supports + /// one CutsceneMessage per message block. CutsceneMessage message; }; @@ -49,25 +49,7 @@ namespace zenkit { /// text files

class CutsceneLibrary { public: - /// \brief Parses a message database from the data in the given buffer. - /// - ///

This implementation is heavily based on the implementation found in - /// [ZenLib](https://github.com/Try/ZenLib).

- /// - /// \param[in,out] buf The buffer to read from. - /// \return The parsed message database object. - /// \note After this function returns the position of \p buf will be at the end of the parsed object. - /// If you would like to keep your buffer immutable, consider passing a copy of it to #parse(buffer&&) - /// using buffer::duplicate. - /// \throws zenkit::ParserError if parsing fails. - /// \see #parse(buffer&&) [[nodiscard]] ZKREM("use ::load()") ZKAPI static CutsceneLibrary parse(phoenix::buffer& buf); - - /// \brief Parses a message database from the data in the given buffer. - /// \param[in] buf The buffer to read from (by rvalue-reference). - /// \return The parsed message database object. - /// \throws zenkit::ParserError if parsing fails. - /// \see #parse(buffer&) [[nodiscard]] ZKREM("use ::load()") ZKAPI static CutsceneLibrary parse(phoenix::buffer&& buf); /// \brief Retrieves a message block by it's name.