mirror of
https://github.com/Kaisaan/lostkefin.git
synced 2025-06-18 16:45:40 -04:00
141 lines
5.4 KiB
Markdown
141 lines
5.4 KiB
Markdown
# Script File Format Documentation
|
|
This is information for the `stageXX.bin` files that are found in `DATA.BIN` of the game's ISO. There are 12 script files.
|
|
|
|
## The Format
|
|
|
|
|Address|Section|
|
|
|---|---|
|
|
|$0-$2000|Pointer Table|
|
|
|$2001-EOF|Script|
|
|
|
|
## Pointer Table
|
|
The pointer table has a repeating pattern of a **Script Index** and **Pointer**.
|
|
**Script Index** is 4 bytes long and is stored in little-endian.
|
|
**Pointer** is 4 bytes long and is stored in little-endian.
|
|
To get the true offset of the pointer add $2000 to the value.
|
|
For example, a pointer value of `00 E1 0C 00` ($CE100) means the true offset is at `$D0100`.
|
|
The table is always $2000 bytes long allowing for a maximum of 1024 entries.
|
|
If there is less than 1024 entries the table section is padded with `$00`'s.
|
|
|
|
## Script
|
|
One pointer can have as many lines of text and has no length limitations.
|
|
|
|
### Font Info
|
|
All text is Shift-JIS encoded with fullwidth characters being 2 bytes long and 20 pixels wide while halfwidth characters are 1 byte long and 10 pixels wide.
|
|
In `SLPM_663.60` the font graphics are located at $1A3E99 as 4BPP graphics, its palette is stored at $25E4C0, and the fontmap is at $1A31F0.
|
|
`font.py` extracts the fontmap from `SLPM_663.60` to create a `font.tbl` table file.
|
|
Use `kefin.tbl` for corrected values and control codes.
|
|
|
|
### Control Codes
|
|
Control codes and related info can be found at the function located at `$4CE00` in `SLPM_663.60` (Loaded into `$0014CD80`)
|
|
|
|
|Hex Values|Meaning|Table file|
|
|
|---|---|---|
|
|
|`$0A`|Newline|`[LINE]`|
|
|
|`$1D $XXXX`|Move NPC? If `$XXXX` is not `$3000` then the NPC will not face Adol|`[MOVE]`|
|
|
|`$1D $XXXX $YYYY`|Move NPC? `$YYYY` is the direction the NPC will face|`[MOVE]`|
|
|
|`$23 $XXXX`|Normally `#`, change colour of text based on ASCII values of $XXXX (See Colour Section)|`[HASH]`|
|
|
|`$2F $XXXX`|Normally `/`, unknown, $XXXX is stored in little-endian|`/<$XX><$XX>`|
|
|
|`$3B $XX`|Show character name in dialoague box (see Character section)|`[CHAR]`|
|
|
|`$44 $XXXXXXXX`|Normally `D`, jump to new text with given Script Text (see above)|`[INDEX]`|
|
|
|`$52 $XXXX`|Normally `R`, set textbox? If `$XXXX` is not `$3000` then it will not point to the speaker|[BOX]|
|
|
|`$XX $80`|Print $XX number of bytes|`[LEN]`|
|
|
|`$FF`|End text?|`[END]`|
|
|
|`$81A5`|Normally `▼`, wait for player input|`[WAIT]`|
|
|
|`$FFFD $XX`|Pause printing text for $XX frames(?)|`[PAUSE]`|
|
|
|
|
`string.py` can be used to calculate a new [LEN] value.
|
|
|
|
#### Colours
|
|
The value of the `$23` Colour control code translates to the ASCII values of the two bytes after the code.
|
|
White is the default colour for text.
|
|
|
|
|Hex values|ASCII|Meaning|Colour code|
|
|
|---|---|---|---|
|
|
|`$77 $68`|`wh`|White| |
|
|
|`$67 $72`|`gr`|Green| |
|
|
|`$62 $6C`|`bl`|Blue| |
|
|
|`$70 $69`|`pi`|Pink| |
|
|
|`$79 $6C`|`yl`|Yellow| |
|
|
|`$72 $65`|`re`|Red| |
|
|
|`$62 $6B`|`bk`|Black| |
|
|
|`$67 $6C`|`gl`|Gray| |
|
|
|`$63 $79`|`cy`|Cyan| |
|
|
|
|
|
|
#### Characters
|
|
The value of the `$3B` Character control code comes from the index value from a list of pointers.
|
|
These pointers are found at $2298E0 in `SLPM_663.60` and `pointer.py` can be used to extract this list.
|
|
|
|
| Value | Original Text | Translation |
|
|
|---|---|---|
|
|
| $0 | アドル | Adol |
|
|
| $1 | ドギ | Dogi |
|
|
| $2 | ニーナ | Niena |
|
|
| $3 | テラ | Terra |
|
|
| $4 | マーシャ | Massea |
|
|
| $5 | スタン | Stein |
|
|
| $6 | ドーマン | Doman |
|
|
| $7 | リジェ | Rizze |
|
|
| $8 | ジャビル | Jabir |
|
|
| $9 | エフィ | Effey |
|
|
| $A | ケフィン王 | King Kefin |
|
|
| $B | アルガ | Alga |
|
|
| $C | ディオス | Dios |
|
|
| $D | ノティス | Nottis |
|
|
| $E | チェイス | Chase |
|
|
| $F | アイシャ | Aisha |
|
|
| $10 | ウイリー | Willy |
|
|
| $11 | ムバーハ | Mubaja |
|
|
| $12 | バルク | Baruq |
|
|
| $13 | アビス | Abyss |
|
|
| $14 | カリオン | Karion |
|
|
| $15 | 鍛冶屋 | Blacksmith |
|
|
| $16 | 水夫 | Sailor |
|
|
| $17 | 執事 | Butler |
|
|
| $18 | メイド | Maid |
|
|
| $19 | 下級兵士 | Foot Soldier |
|
|
| $1A | 兵士 | Soldier |
|
|
| $1B | 冒険家A | Adventurer A |
|
|
| $1C | 冒険家B | Adventurer B |
|
|
| $1D | 商人A | Merchant A |
|
|
| $1E | 商人B | Merchant B |
|
|
| $1F | コボルト | Kobold |
|
|
| $20 | 砂漠おばあさん | Desert Old Woman |
|
|
| $21 | 砂漠おじいさん | Desert Old Man |
|
|
| $22 | 砂漠女 | Desert Woman |
|
|
| $23 | 砂漠男A | Desert Man A |
|
|
| $24 | 砂漠男B | Desert Man B |
|
|
| $25 | 砂漠女の子 | Desert Girl |
|
|
| $26 | 砂漠男の子 | Desert Boy |
|
|
| $27 | ケフィン男A | Kefin Man A |
|
|
| $28 | ケフィン男B | Kefin Man B |
|
|
| $29 | ケフィン女A | Kefin Woman A |
|
|
| $2A | ケフィン女B | Kefin Woman B |
|
|
| $2B | レジスタンスA | Rebel A |
|
|
| $2C | レジスタンスB | Rebel B |
|
|
| $2D | おじさんA | Man A |
|
|
| $2E | おじさんB | Man B |
|
|
| $2F | おばさん | Woman |
|
|
| $30 | 街男A | Villager Man A |
|
|
| $31 | 街男B | Villager Man B |
|
|
| $32 | 街娘A | Villager Girl A |
|
|
| $33 | 街娘B | Villager Girl B |
|
|
| $34 | おばあさん | Old Woman |
|
|
| $35 | おじいさん | Old Man |
|
|
| $36 | 男の子A | Boy A |
|
|
| $37 | 男の子B | Boy B |
|
|
| $38 | 女の子A | Girl A |
|
|
| $39 | 犬 | Dog |
|
|
| $3A | 女の子B | Girl B |
|
|
| $3B | 誘拐スタン | Kidnapped Stein |
|
|
| $3C | ノティス&ディオス | Noties & Deios |
|
|
| $40 | 綺麗な女性 | Beautiful Woman |
|
|
| $41 | 女の子 | Girl |
|
|
| $42 | 乱暴者A | Thug A |
|
|
| $43 | 乱暴者B | Thug B |
|
|
| $44 | 謎の声 | Mysterious Voice |
|
|
| $45 | 謎の男 | Mysterious Man |
|
|
| $46 | 大男 | Big Man |
|
|
| $47 | おばさん | Woman |
|