Vagrant Story/SHP files

From Data Crystal
< Vagrant Story
Revision as of 10:28, 13 April 2013 by Jinn (talk | contribs)
Jump to navigation Jump to search

This is a sub-page of Vagrant Story.

These files are used to store 3d models for characters and some props which aren't a part of the map data. All values are in hex.

Format

$0      $4      signiture "H01"
$4      $1      number of joints in the skeleton
$5      $1      number of groups
$5      $1      number of groups
$6      $2      number of triangles in the first polygon group
$8      $2      number of quads in the second polygon group
$A      $2      number of nemain polygons (which are further grouped into triangles and quads)
for $8 Texture Map Overlay Rectangles (Overlays are taken from ETM files)
        +$0     $1      x
        +$1     $1      y
        +$2     $1      width
        +$3     $1      height
$2C     $24     Unknown
$50     $6      collision size and height (shape is a cylinder)
$56     $2      menu position Y
$58     $C      Unknown
$64     $2      Shadow radius
$66     $2      Shadow size increase rate
$68     $2      Shadow size decrease rate
$6A     $4      Unknown
$6E     $2      Menu scale
$70     $2      Unknown
$72     $2      Target sphere position Y
$74     $8      Unknown
for $C entries
        +$0     $4      LBA XX_BTX.SEQ  (battle animations first one is actually XX_COM.SEQ)
for $C entries
        +$0     $2      chain attack animation ID
for 4 entries
        +$0     $4      LBA XXSP0X.SEQ (special attack animations)
$C2     $20     unknown (probably more LBA tables, there are also special attack ids stored here.)
$F4     $4      pointer to magic effects section (relative to offset $F8)
for $18 entries
        +$0     $2      unknown (noticeable effects when casting spells)
$128    $4      relative pointer to AKAO section (relative to offset $F8)
$12C    $4      relative pointer to groups section (relative to offset $F8)
$130    $4      relative pointer to vertex section (relative to offset $F8)
$134    $4      relative pointer to polygon section (relative to offset $F8)
+       joint section
        for number of joints in skeleton
                JOINT_DATA
                $0     $4      size of bone
                $4     $1      parent joint ID
                $0     $1      unknown
                $0     $4      mountable joint ID
                $0     $9      unknown
+       group section
        for number of groups
                GROUP_DATA
                $0     $2      joint group is asigned to
                $2     $2      last vertex in this group
                (the next vertex will become the first vertex for the next group)
+       vertex section
        (note that the number of vertices must be obtained by parsing the group section)
        for number of vertices
                VERTEX_DATA
                $0      $2      x co-ordinate
                $2      $2      y co-ordinate
                $4      $2      z co-ordinate
                $6      $2      zero padding to 8 byte alignment
+       polygon section
        for number of triangles in first polygon group
                TRIANGLE_DATA
                Triangle vertices are arranged in anti-clockwise order
                $0      $1      polygon type ID ($24 = triangle $2C = quad)
                $1      $1      size in bytes of the polygon data
                $2      $1      0x40 => one-sided, 0x50 => double-sided
                $3      $1      unknown (probably alpha transparency)
                $4      $2      vertex 1 index*4
                $6      $2      vertex 2 index*4
                $8      $2      vertex 3 index*4
                $A      $1      u 1 co-ordinate
                $B      $1      v 1 co-ordinate
                $C      $1      u 2 co-ordinate
                $D      $1      v 2 co-ordinate
                $E      $1      u 3 co-ordinate
                $F      $1      v 3 co-ordinate
        for number of quads in second polygon group 
                QUAD_DATA
                Quad vertices are arranged in standard TMD order
                $0      $1      polygon type ID ($24 = triangle $2C = quad)
                $1      $1      size in bytes of the polygon data
                $2      $1      0x40 => one-sided, 0x50 => double-sided
                $3      $1      unknown (probably alpha transparency)
                $4      $2      vertex 1 index*4
                $6      $2      vertex 2 index*4
                $8      $2      vertex 3 index*4
                $A      $2      vertex 4 index*4
                $C      $1      u 1 co-ordinate
                $D      $1      v 1 co-ordinate
                $E      $1      u 2 co-ordinate
                $F      $1      v 2 co-ordinate
                $10     $1      u 3 co-ordinate
                $11     $1      v 3 co-ordinate
                $12     $1      u 4 co-ordinate
                $13     $1      v 4 co-ordinate
        for number of polygons
                $0      $10 or $14      POLYGON_DATA or QUAD_DATA as above
+       AKAO section
        $0      $4      maximum number of AKAO frames
        for     maximum number of AKAO frames
                $0      $4      relative pointer to AKAO frame
        for actual number of AKAO frames
                $0      $?      AKAO frame data
+       magic effect section
        $0      $4      unknown
        $4      $4      size of magic effect section (doesnt include this 8 byte header)
        $8      $12     unknown
        for num magic effects
                $0      $2      relative pointer to magic effect data
        (note that pointers descend but the magic effect data ascends with blank data between them)
        for num magic effects
                $0      $4      magic effect data (unknown)
+       texture map section
        There is no pointer to the texture map section you must walk the file by going to the
        magic effects section and reading the size of that section. then add 8 (number of bytes in
        the magic section header
        $0      $4      size of texture map in bytes
        $4      $1      unknown
        $5      $1      half the width in pixels
        $6      $1      half the height in pixels
        $7      $1      number of colours per pallet
        for 2 pallets
                for number of colours per pallet
                        $0      $2      colour data
                                        most significant bit is alhpa used to set transparency
                                        next comes 5 bits each for blue, green and red
        for height in pixels
                for width in pixels
                        $0      $1      CLUT colour reference
        $0      $?      unknown texture footer (may or may not be present)

Todo

Some SHP files seem to have a different polygon section, e.g. the first one being 26.SHP, and all files from B1.SHP to C3.SHP (need to complete this list). It should be found out what these SHP actually represent in-game, to understand the unknown polygon section afterwards.