CST Scene - AtomCrafty/TriggersTools.CatSystem2 Wiki

File Structure fully deciphered!

Decompiling not guaranteed to be fully deciphered, need to play around with custom line type values.

The structure and basic language syntax for Cat Scenes are slightly over 20 years old now, as they existed in the original CatSystem (1) engine in the late 1990's.

File Structure

Data Type Value Description
char[8] "CatScene" File Signature
uint32 CompressedSize Compressed size of ScriptData
uint32 DecompressedSize Decompressed size of ScriptData
byte[CompressedSize] ScriptData Zlib-compressed scene script contents

ScriptData Structure

Header

Data Type Value Description
uint32 ScriptLength Size of ScriptData excluding sizeof(Header)
uint32 InputCount Number of Input Offsets
uint32 OffsetTable Offset to String Offset Table
uint32 StringTable Offset to String Table

EntryCount = (StringTable - OffsetTable) / 4

Input Offset Table

These values can be calculated programmatically and are not necessary to read when parsing the file. They mark the offsets and indexes of the script line after every Input Flag line and most likely aid the game engine in skipping.

N = InputCount

Data Type Value Description
uint32 OffsetNext Offset from Index to line after next input
uint32 Index Index of line after input

StringOffset Table

Position = sizeof(Header) + OffsetTable N = EntryCount

Data Type Value Description
uint32 Offset Offset of to String n

String Table

The string table for script lines. Each line has a type that determines what it does, and content that is either used to parse a command or display a message or name.

Position = sizeof(Header) + StringTable + StringOffsets[n] N = EntryCount

Data Type Value Description
uint16 Type Action performed by the line
string Content Content of the line

LineTypes

(There may be more unknown values that are not listed here)

Name Value Description
Input 0x0201 Wait for input after message
Page 0x0301 Novel page break and wait for input after message
Message 0x2001 Display a message
Name 0x2101 Set speaker of the message
Command 0x3001 Perform any other command
InputFlag 0x0200 Any type with this flag is treated as input