Difference between revisions of "Script.cpt.html"

From Chrono Compendium
Jump to: navigation, search
(Created page with "This filetype is somewhat deceptively named, as these files contain other resources in addition to the dialogue script for the given room. The base filetype is cpt, with the s...")
 
 
Line 14: Line 14:
 
<td>001
 
<td>001
 
</td>
 
</td>
<td>CLUT to be applied to the backgrounds in the corresponding <a href="/Wiki/Rgfx" title="Rgfx">rgfx</a> file.
+
<td>CLUT to be applied to the backgrounds in the corresponding rgfx file.
 
</td></tr>
 
</td></tr>
 
<tr>
 
<tr>
Line 29: Line 29:
 
<td>004
 
<td>004
 
</td>
 
</td>
<td>triangle setup of the <a href="/Wiki/Walkmesh" title="Walkmesh">walkmesh</a>.
+
<td>triangle setup of the walkmesh.
 
</td></tr>
 
</td></tr>
 
<tr>
 
<tr>
Line 49: Line 49:
 
<td>008
 
<td>008
 
</td>
 
</td>
<td>LZSS-compressed dialogue script for that room in <a href="/Wiki/Chrono_Cross_Relative_Alphabet" title="Chrono Cross Relative Alphabet">relative alphabet</a>.[2]
+
<td>LZSS-compressed dialogue script for that room in Chrono Cross Relative Alphabet.[2]
 
</td></tr>
 
</td></tr>
 
<tr>
 
<tr>
Line 64: Line 64:
 
<td>011+
 
<td>011+
 
</td>
 
</td>
<td>Models with 12-byte headers. The first 4 header bytes are an EOF pointer. The others are VRAM coordinates in the following order: image X, image y, CLUT X, CLUT Y. The coordinates match up with the coordinates of the (first) texture that belongs to this model from the corresponding .<a href="/Wiki/Rgfx" title="Rgfx">rgfx</a> file.
+
<td>Models with 12-byte headers. The first 4 header bytes are an EOF pointer. The others are VRAM coordinates in the following order: image X, image y, CLUT X, CLUT Y. The coordinates match up with the coordinates of the (first) texture that belongs to this model from the corresponding rgfx file.
 
</td></tr></table>
 
</td></tr></table>
 
<p>[1]How the background assembly data works:<br>
 
<p>[1]How the background assembly data works:<br>

Latest revision as of 12:30, 27 March 2016

This filetype is somewhat deceptively named, as these files contain other resources in addition to the dialogue script for the given room. The base filetype is cpt, with the subfiles inside consistently arranged as follows:

Subfile Contents
000 small, may be basic setup (camera zoom, scaling, slope, depth...)
001 CLUT to be applied to the backgrounds in the corresponding rgfx file.
002 small, LZSS (usually 73 73 7A 6C 00 00 00 00 00 00 00 00 00 00 77 77, which should indicate an empty file)
003 LZSS-compressed fieldscript for that room
004 triangle setup of the walkmesh.
005 vertex array of the walkmesh.
006 Defines whether or not movement through a location activates the ladder animation. Might also govern other special movement animations if there are any.
007 LZSS compressed. It is the background assembly[1] data.
008 LZSS-compressed dialogue script for that room in Chrono Cross Relative Alphabet.[2]
009 sound data with header (header: "yos1" + 4-byte unknown + 4-byte entry count + table of 4-byte pointers to beginnings of sounds (add 12 bytes for actual location) + EOF pointer) One tested file contained only the header without AKAO blocks.
010 also sound data with header. Again, one tested file (demo location) contained only the header, and files corresponding to subrooms of the same location, frex Arni(Home), may contain identical data (however, tests show that this is NOT the location BGM sequence or instrument data).
011+ Models with 12-byte headers. The first 4 header bytes are an EOF pointer. The others are VRAM coordinates in the following order: image X, image y, CLUT X, CLUT Y. The coordinates match up with the coordinates of the (first) texture that belongs to this model from the corresponding rgfx file.

[1]How the background assembly data works:
Header: uNumLayers (8 bytes) aRange[uNumLayers + 1] (8 bytes each)

The aRange is a serie of index into the array of elements that direcly follow the header (stride is obviously 0xC). To get the actual offset for an element, the formula is simply (id * 0xC + uNumLayers * 4 + 4). When the game want to draw layer 3, it will draw the elements from aRange[3] to aRange[4] from the array. The first aRange is always 0x0, as the first layer always start at the id 0, and the aRange size if [uNumLayers + 1] and not [uNumLayers] as it would require the range of the last layer in the data.

The tile data is dec12 bytes each.

XX XX YY YY UU UU VV CC AA ?? ?? LL
UU UU = U/2 + TPX (texture page x coordinate)
VV VV = V (It seems this value is always V, since texture page y coordinate is always 256 from those examples)
UU UU = U/2 ADD TPX (texture page x coordinate)
VV CC = V ADD (CLUT offset - 0x70000)
AA - Possibly alpha blending (0x20 for normal tiles)
LL - It seems to be the layer index, a smaller value will make it displayed in front of those have larger values.

Animations are performed by activating/deactivating overlapping background layers in a cycle.

[2]The script blocks come with a header of 8 bytes per message. The first two bytes point to the text, the next four define the size of the dialogue box, and the last two may indicate whether or not the message contains command bytecodes:

  • 00 - End of string.
  • 01 - Next line.
  • 02 - Next page (clear the dialogue box and start a new page).
  • 03 - Pause, wait for player to press confirm button.
  • 04 xx - Next character display after xx. Basically, it is used for a short pause.
  • 05 xx - Change text speed to xx. According to Yazoo's CC Tools, xx=FF means auto accent? I don't know whether it is a typo but I think FF means "display all immediately with out delay".
  • 06 xx - Close the dialogue box after xx.
  • 07 xx xx - Display an item name. xx xx is the index.
  • 08 xx - Character No.xx's name.
  • 08 82 - Serge's nickname (perhaps only used in JPN version)
  • 09 - No clue.
  • 0A xx - It seems it is used to display a number, perhaps a variable indexed by xx.
  • 0B xx - Similar to above.
  • 0C - No clue.
  • 0D - No clue.
  • 0E xx - Change text color. xx=00 means white, xx=01 means blue, etc.
  • 0F - No clue.
  • 10 XX '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' "00..." - Input decimal number, digits is specified by XX. "00..." is initial value, usually 0s.
  • 11 - No clue.
  • 12 xx - Auto accent.
  • 13 - No clue.
  • 14 - No clue.
  • 15 xx - A character's name. Maybe the value will be set by the field script. I always see a zero for xx. Maybe that is used when a key character is in the team(special dialogue).
  • 16 xx - No clue. According to Yazoo's CC Tools, it takes one parameter.
  • 17 xx - Same as above.
  • 18 xx - Team member xx's name.
  • 19 xx - Used to display a string(someting's name). Given by the field script.
  • 1A - No clue.
  • 1B xx - According to Yazoo's CC Tools, it displays a PSX button.
  • 1C xx - Change case. xx=00 means no case, x=01 means capitalized, x=02 means lowercase. Other values will freeze the game.
  • 1D - No clue.
  • 1E xx - According to Yazoo's CC Tools, 1E 00 means name suffix?
  • 1F - No clue, used quite often by auto accent key words. Maybe it's just a placeholder?