Repository navigation
TALK.DAT
Contains scripts, mainly for cut scenes. Is located at SUBDATA.DAT->START.DAT , START.DAT needs to be decompressed first.
Original work has been done by Krisan Thyme by his Toolpack.
| Type | Size | Description |
|---|---|---|
| uInt | 4 byte | Number of scripts |
| uInt | 4 byte | Number of scripts again |
For each script (32 byte):
| Type | Size | Description |
|---|---|---|
| uInt | 4 byte | Start address (The header size is not counted, therefore is first value is 0) |
| uInt | 4 byte | The script id |
| uShort | 2 byte | DungeonId |
| uShort | 2 byte | Unknown Search Flag (mostly 0-2, 102-111) |
| uShort | 2 byte | Game state filter positive size (from 0-4) |
| uShort | 2 byte | Game state filter negative size (from 0-4) |
| uShort | 2 byte | Game state filter positive 0 |
| uShort | 2 byte | Game state filter positive 1 |
| uShort | 2 byte | Game state filter positive 2 |
| uShort | 2 byte | Game state filter positive 3 |
| uShort | 2 byte | Game state filter negative 0 |
| uShort | 2 byte | Game state filter negative 1 |
| uShort | 2 byte | Game state filter negative 2 |
| uShort | 2 byte | Game state filter negative 3 |
The game chooses a script based on a combination of ID, Dungeon ID, and some Unknown Flag. Afterwards the game checks the current state of the game (probably from the save file), but only if any are given, i.e the size is bigger 0. If these checks pass, then the script is chosen. Otherwise it searches until it finds one.
The positive filter tests if a bit is set, while the negative tests if a bit is not set. The first 3 bits of "game state filter" are used to create a bit mask for checking against a global game state, determined by the rest of the bits:
const byte mask = 1 << ((byte)gameStateFilter & 7); // Create a bit mask (0-7)
const byte state = (globalStateStartPtr)[gameStateFilter >> 3]; // Get the state to check
return (state & mask) != 0; // Positive: When true then script is valid
return (state & mask) == 0; // Negative: When true then script is valid
| Name | Index | Bit | Description |
|---|---|---|---|
| Skip Story | 275 | 0 | When set then the story at the beginning of a stage should be skipped |
Each script byte size can be calculated by subtracting the next start address with the current.
There are two types of script languages used, we will call them TALK and PROGRAMM. Both have exclusive commands to there system, but there are commands which both share.
TALK
- Handles all the dialog in the game
- Handles displayed portraits and there position/animation
- Handles opening hardcoded menus like the area select, shop, assembly, etc
PROGRAMM
- Will call TALK scripts
Each command is identified by exacly one byte. Then commands are then followed by x number of arguments. In most cases its just one.
List of shared commands between TALK and PROGRAMM:
| Name | Hex Value | Arguments | Arguments Size | Description |
|---|---|---|---|---|
| Call | 0C | TALK Id to call, opcode (type of script?) | 2 byte (uShort), 1 byte (Enum) | Runs the TALK script |
| Script | 0B | PROGRAMM Id to call | 3 byte (uInt) | Runs the PROGRAMM script |
| Return | FF | None | End of script. Must follow by a script call to Id 0. | |
| Set | 09 | 2 byte (uShort) | Sets some value? | |
| Clear | 0A | 2 byte (uShort) | Clears a set value? |
Exculusive commands to PROGRAMM:
| Name | Hex Value | Arguments | Arguments Size | Description |
|---|---|---|---|---|
Exculusive commands to TALK:
| Name | Hex Value | Arguments | Arguments Size | Description |
|---|---|---|---|---|
| PopUp | 07 | Pop up window style | 2 byte (uShort) | The style of pop up window. Must be closed by 'EndPopUp'. |
| ShowBox | C9 | Type? | 1 byte | Will open a box? |
| Portrait | 05 | Character portrait Id | 2 byte (uShort) | Character portrait to display |
| CharLeft | 04 | |||
| CharMid | 0E | |||
| CharRight | 18 | |||
| NameLabel | 08 | |||
| Voice | 06 | Id of a sound clip | 2 byte (uShort) | Will play a sound clip, usually character dialog |
| Dialog | 01 | |||
| Confirm | 02 | |||
| EndPopUp | 03 | Defines the end of the Pop Up dialog | ||
| Select | 14 | If it is the first select, then it must follow by a number of menu options, else it has no arguments | 1 byte (UChar) | Defines a conversation selection entry, a dialog command must follow directly afterwards. If it the first entry then it also must define the number of total entrys. |
| EndSelect | FD | None | Marks the end of conversation selection. |