Skip to content

Commit

Permalink
docs(CutsceneLibrary): update CutsceneLibrary docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lmichaelis committed Feb 11, 2024
1 parent 8f8b03c commit 39c0606
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 42 deletions.
50 changes: 29 additions & 21 deletions docs/library/api/cutscene-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <phoenix/cffi/Cutscene.h>
#include <phoenix/cffi/Buffer.h>
#include <zenkit-capi/CutsceneLibrary.h>
#include <zenkit-capi/Vfs.h>

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"
Expand All @@ -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"

Expand Down
24 changes: 3 additions & 21 deletions include/zenkit/CutsceneLibrary.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand All @@ -49,25 +49,7 @@ namespace zenkit {
/// text files</p>
class CutsceneLibrary {
public:
/// \brief Parses a message database from the data in the given buffer.
///
/// <p>This implementation is heavily based on the implementation found in
/// [ZenLib](https://github.com/Try/ZenLib).</p>
///
/// \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.
Expand Down

0 comments on commit 39c0606

Please sign in to comment.