Text Book: Difference between revisions
mNo edit summary |
mNo edit summary |
||
| (7 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
'''''Text Book''''' is a file format used in [[Sonic the Hedgehog (2006)]] for storing text with friendly names and variables. | '''''Text Book''''' is a file format used in [[Sonic the Hedgehog (2006)]] for storing text with friendly names and variables. | ||
These files are located in <code>cache.arc</code> and <code>text.arc</code> under the <code>./text/</code> directory from platform root as <code>*.mst</code> files. | These files are located in <code>cache.arc</code> and <code>text.arc</code> under the <code>./text/</code> directory from [[Sonic the Hedgehog (2006) File System#Platform Root|platform root]] as <code>*.mst</code> files. | ||
== Specification == | == Specification == | ||
| Line 58: | Line 58: | ||
== Variables == | == Variables == | ||
Variables are stored as comma-separated values, there should be one for each '$' character in the actual text to be displayed. | Variables are stored as comma-separated values, there should be one for each '$' character in the actual text to be displayed. | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ | |+ | ||
!Variable | !Variable | ||
!Parameters | |||
!Description | !Description | ||
|- | |||
|blue | |||
|None | |||
|Once encountered, starts colouring characters blue. <span title="#00C6C6" style="display: inline-block; width: 12px; height: 12px; background: #00C6C6; margin: 0 4px; vertical-align: middle;"></span> | |||
|- | |- | ||
|color | |color | ||
|Once encountered, | |None | ||
|< | |Once encountered, starts colouring characters white. <span title="#FFFFFF" style="display: inline-block; width: 12px; height: 12px; background: #FFFFFF; margin: 0 4px; vertical-align: middle;"></span> | ||
|- | |||
|color! | |||
|None | |||
|Once encountered, starts colouring characters yellow. <span title="#FFC658" style="display: inline-block; width: 12px; height: 12px; background: #FFC658; margin: 0 4px; vertical-align: middle;"></span> Presumably this is meant as the "warning" colour, hence the exclamation mark. | |||
|- | |||
|gray | |||
|None | |||
|Once encountered, starts colouring characters grey. <span title="#737373" style="display: inline-block; width: 12px; height: 12px; background: #737373; margin: 0 4px; vertical-align: middle;"></span> | |||
|- | |||
|green | |||
|None | |||
|Once encountered, starts colouring characters green. <span title="#58FF8E" style="display: inline-block; width: 12px; height: 12px; background: #58FF8E; margin: 0 4px; vertical-align: middle;"></span> | |||
|- | |- | ||
|picture | |picture | ||
|Once encountered, draws | |String | ||
|< | |Once encountered, draws the specified picture defined in the game's [[Text Font Picture]] file. | ||
|- | |||
|red | |||
|None | |||
|Once encountered, starts colouring characters red. <span title="#FD5858" style="display: inline-block; width: 12px; height: 12px; background: #FD5858; margin: 0 4px; vertical-align: middle;"></span> | |||
|- | |- | ||
|rgba | |rgba | ||
|Once encountered, starts colouring characters the specified colour. | |Byte, Byte, Byte | ||
|Once encountered, starts colouring characters the specified colour. Despite the name, this does not support setting the alpha colour of the text. | |||
|- | |- | ||
|sound | |sound | ||
|Once encountered, | |String | ||
|< | |Once encountered, plays the specified sound effect if the '''Sound Bank''' containing it is loaded. | ||
|- | |||
|text | |||
|Unknown | |||
|Unknown. | |||
|- | |||
|value | |||
|Unknown | |||
|Unknown. | |||
|- | |||
|yellow | |||
|None | |||
|Once encountered, starts colouring characters yellow. <span title="#FCC658" style="display: inline-block; width: 12px; height: 12px; background: #FCC658; margin: 0 4px; vertical-align: middle;"></span> | |||
|} | |} | ||
{{Notice|type=example|content= | |||
With the following text: | |||
<syntaxhighlight lang="text"> | |||
$The quick $brown$ fox jumps over the $lazy$ dog.\nPress the $ button to continue. | $The quick $brown$ fox jumps over the $lazy$ dog.\nPress the $ button to continue. | ||
</syntaxhighlight>And the following variables:<syntaxhighlight lang="text"> | </syntaxhighlight> | ||
sound(all01_a00_sn),rgba(127,51,0),color, | And the following variables: | ||
</syntaxhighlight>The game should first play the sound <code>all01_a00_sn</code>, then draw something akin to the following text: | <syntaxhighlight lang="text"> | ||
The quick <span style="color:#7F3300;">brown</span> fox jumps over the <span style="color:# | sound(all01_a00_sn),rgba(127,51,0),color,red,color,picture(button_a) | ||
</syntaxhighlight> | |||
The game should first play the sound <code>all01_a00_sn</code>, then draw something akin to the following text: | |||
<div class="mw-code" style="display: flex; align-items: center; margin: 20px 0 0 0; background-color: var(--hedgedocs-frame-bg-color); border-color: var(--hedgedocs-base-border-color);"> | |||
The quick <span style="color:#7F3300;">brown</span> fox jumps over the <span style="color:#FD5858;">lazy</span> dog. | |||
Press the <span style="color:#58FF8E;">'''Ⓐ'''</span> button to continue. | |||
</div> | |||
}} | |||
[[Category:File Formats]] | [[Category:File Formats]] | ||
Latest revision as of 20:46, 4 December 2025
Text Book is a file format used in Sonic the Hedgehog (2006) for storing text with friendly names and variables.
These files are located in cache.arc and text.arc under the ./text/ directory from platform root as *.mst files.
Specification
Text Book uses a Binary Resource container. The text to be displayed is encoded as UTF-16, whereas the names and variables are encoded as Shift-JIS.
Header
The header consists of the following data structure:
| Offset | Type | Name | Description |
|---|---|---|---|
| 0x00 | Char[4] | Signature | Always "WTXT" (referring to UTF-16). |
| 0x04 | UInt32 | NameOffset | The offset of the name of this Text Book. |
| 0x08 | UInt32 | CardCount | The total number of Text Cards in this Text Book. |
Text Card
Text Cards consist of the following data structure:
| Offset | Type | Name | Description |
|---|---|---|---|
| 0x00 | UInt32 | NameOffset | The offset of the name of this Text Card. |
| 0x04 | UInt32 | TextOffset | The offset of the UTF-16 text for this Text Card. |
| 0x08 | UInt32 | VariablesOffset | The offset of the variables for this Text Card. |
Variables
Variables are stored as comma-separated values, there should be one for each '$' character in the actual text to be displayed.
| Variable | Parameters | Description |
|---|---|---|
| blue | None | Once encountered, starts colouring characters blue. |
| color | None | Once encountered, starts colouring characters white. |
| color! | None | Once encountered, starts colouring characters yellow. Presumably this is meant as the "warning" colour, hence the exclamation mark. |
| gray | None | Once encountered, starts colouring characters grey. |
| green | None | Once encountered, starts colouring characters green. |
| picture | String | Once encountered, draws the specified picture defined in the game's Text Font Picture file. |
| red | None | Once encountered, starts colouring characters red. |
| rgba | Byte, Byte, Byte | Once encountered, starts colouring characters the specified colour. Despite the name, this does not support setting the alpha colour of the text. |
| sound | String | Once encountered, plays the specified sound effect if the Sound Bank containing it is loaded. |
| text | Unknown | Unknown. |
| value | Unknown | Unknown. |
| yellow | None | Once encountered, starts colouring characters yellow. |
$The quick $brown$ fox jumps over the $lazy$ dog.\nPress the $ button to continue.
And the following variables:
sound(all01_a00_sn),rgba(127,51,0),color,red,color,picture(button_a)
The game should first play the sound all01_a00_sn, then draw something akin to the following text:
The quick brown fox jumps over the lazy dog. Press the Ⓐ button to continue.