OBD:CRSA: Difference between revisions

From OniGalore
Jump to navigation Jump to search
m (design)
Line 1: Line 1:
{{OBD_File_Header|align=right|type=CRSA|prev=CONS|next=DOOR|name=Corpse Array|family=Level|onistuff=crsa}}
{{OBD_File_Header | type=CRSA | prev=CONS | next=DOOR | name=Corpse Array | family=Level | align=center}}
'''[[OBD_Talk:CRSA|OLD VERSION MOVED HERE]]'''




==CRSA - Corpse Array==
The first image shows the header and the beginning of the first element. The second image the end of it.
Related :
[[OBD:File types|File types]]
[[OBD:File types/Level|Level files]]
[[OBD:Oni Binary Data|Oni Binary Data]]


A '''CRSA''' file consists of
*a 32-byte header that specifies the size ''S'' and the capacity ''C'' of the corpse array
*''S'' corpse chunks with actual corpse data (1100 bytes each)
*(''C'' - ''S'') unused corpse chunks integrally set to 0 (1100 bytes each)
The capacity ''C'' is always 20. The size of a chunk is not specified in the header : it's fixed by the "universal" bone count in Oni (19 bones).
*the resulting file is completed to a 32-byte multiple with the 0xADDE blank filler


Since the capacity of the array is always the same (20 corpses), CRSA files are all the same size (0x5620 bytes) : actual arrays take up 0x5610 bytes, and the last 16 bytes are filled with the blank filler 0xADDE.
[[image:crsa_a.gif]]
===Header===
 
;What's in the header?
 
*File ID and level ID as usual : 4 bytes each
[[image:crsa_m.gif]]
*A blank field filled with 0xADDE (dead) : 12 bytes
 
*Array size (number of corpses) duplicated : 2*4 bytes
 
*Array capacity (maximum number of corpses, always 20) : another 4 bytes
{{Table}}
The total size of a header is thus 0x20 = 32 bytes.
{{OBDth}}
;Example:'''00565-.CRSA''' in '''level3_Final.dat'''
{{OBDtr| 0x000 | res_id  |FF0000| 01 35 02 00 | 565        | 00565-.CRSA }}
{|border=1 cellspacing=0 style="white-space:nowrap;background:#ffeedd" width=100%
{{OBDtr| 0x004 | lev_id  |FFFF00| 01 00 00 06 | 3          | level 3 }}
|+Header of the Corpse Array file
{{OBDtr| 0x008 | char[12] |00FF00| AD DE      | dead      | unused }}
|-style="background:#ffddbb"
{{OBDtr| 0x014 | int32    |00FFFF| 11 00 00 00 | 17        | array size }}
!Offset
{{OBDtr| 0x018 | int32    |FF00FF| 11 00 00 00 | 17        | array size again }}
!Raw hex/string
{{OBDtr| 0x01C | int32    |FF8000| 14 00 00 00 | 20        | array capacity }}
!Value
{{OBDtrBK}}
!Meaning
 
|-align=center
{{OBDtr2|0x000 | char[160]|FFC8C8| _lvl_3_Intro...          | space for notes; probably the name of the source file }}
|0x00
{{OBDtr| 0x0A0 | link    |FFFFC8| 01 36 02 00 | 566        | link to 00566-TCTF_lite_1.[[OBD:ONCC|ONCC]] }}
| BGCOLOR="#FF0000"|01 35 02 00
{{OBDtr| 0x0A4 | float    |C8FFC8| C1 74 66 3F | 0.900219  | transformation matrix of the pelvis, xx term }}
|565
{{OBDtr| 0x0A8 | float    |C8FFC8| 00 78 3E 3D | 0.046501  | transformation matrix of the pelvis, xy term }}
|align=left|File ID for 00565-.CRSA
{{OBDtr| 0x0AC | float    |C8FFC8| 45 AB DD 3E | 0.432947  | transformation matrix of the pelvis, xz term }}
|-align=center
{{OBDtr| 0x0B0 | float    |C8FFC8| A6 8B 7D 3D | 0.061901  | transformation matrix of the pelvis, yx term }}
|0x04
{{OBDtr| 0x0B4 | float    |C8FFC8| 19 73 7F BF | -0.997850  | transformation matrix of the pelvis, yy term }}
| BGCOLOR="#FFFF00" |01 00 00 06
{{OBDtr| 0x0B8 | float    |C8FFC8| EE 67 B0 BC | 0.021534  | transformation matrix of the pelvis, yz term }}
|3
{{OBDtr| 0x0BC | float    |C8FFC8| 03 AE DC 3E | 0.431015  | transformation matrix of the pelvis, zx term }}
|align=left|Level ID
{{OBDtr| 0x0C0 | float    |C8FFC8| 82 2C 3D 3D | 0.0461850  | transformation matrix of the pelvis, zy term }}
|-align=center
{{OBDtr| 0x0C4 | float    |C8FFC8| 8D B2 66 BF | -0.901162  | transformation matrix of the pelvis, zz term }}
|0x08<br>0x0C<br>0x010
{{OBDtr| 0x0C8 | float    |C8FFC8| C5 FA E7 41 | 28.997446  | x-position of the pelvis }}
| BGCOLOR="#00FF00" |AD DE AD DE<br>AD DE AD DE<br>AD DE AD DE
{{OBDtr| 0x0CC | float    |C8FFC8| 2E 2B CB C1 | -25.396084 | y-position (height) of the pelvis }}
|DEAD
{{OBDtr| 0x0D0 | float    |C8FFC8| 58 B4 45 C1 | -12.356529 | z-position of the pelvis }}
|align=left|blank filler
|-
|-align=center
|colspan=6| After the pelvis follows the data (same structure as the light green coloured fields) for the other 18 bodyparts (see [[OBD:TRIA#Bones|TRIA]] file). The end of every element contains the bounding box data (see rows below).
|0x14
{{OBDtr| 0x434 | float    |C8FFFF| D4 22 8C 41 | 17.517006  | minimal x-position of the bounding box }}
| BGCOLOR="#00FFFF" |11 00 00 00
{{OBDtr| 0x438 | float    |C8FFFF| 95 50 E9 C1 | -29.164347 | minimal y-position (height) of the bounding box }}
|17
{{OBDtr| 0x43C | float    |C8FFFF| BC 31 9C C1 | -19.524284 | minimal z-position of the bounding box }}
|align=left|17 corpses (array size)
{{OBDtr| 0x440 | float    |C8FFFF| 75 E6 14 42 | 37.225056  | maximal x-position of the bounding box }}
|-align=center
{{OBDtr| 0x444 | float    |C8FFFF| 2E 20 B1 C1 | -22.140713 | maximal y-position (height) of the bounding box }}
|0x18
{{OBDtr| 0x448 | float    |C8FFFF| 07 B1 D3 C0 | -6.615360  | maximal z-position of the bounding box }}
| BGCOLOR="#FF00FF" |11 00 00 00
|17
|align=left|17 corpses (array size again)
|-align=center
|0x1C
| BGCOLOR="#FF8000" |14 00 00 00
|20
|align=left|Room for 20 corpses (array capacity)
|}
|}


===Corpses===
They make up the actual array. They follow the header directly
;What's in a corpse?
*A space for notes (160 bytes) : often the name of the file the corpse was taken from when packing the array.
*A link to the [[OBD:ONCC|ONCC]] (model that should be used for the corpse) : that's 4 bytes as usual.
*Then, 19 bones, each of them defined by absolute position and transformation matrix<br>Every bone is (3*3 + 3)*4 = 48 bytes, so that's 19*48 = 912 bytes.
*Finally, an axis-aligned bounding box (2*3*4 = 24 bytes)
The total size of a corpse is thus 1100 bytes.


;What's in a bone?
;What's in a bone?
Line 85: Line 57:


Reminder : the 2nd coordinate of '''R''' is the height; same for '''x''', '''y''' and '''z'''.
Reminder : the 2nd coordinate of '''R''' is the height; same for '''x''', '''y''' and '''z'''.
;Example:first corpse of '''00565-.CRSA''' in '''level3_Final.dat'''.
:Offsets are measured from the start of the corpse chunk : add 0x20 for the offset from the start of file.
{|border=1 cellspacing=0 style="white-space:nowrap;background:#ffeedd" width=100%
|+Notes and ONCC link
|-style="background:#ffddbb"
!Offset
!Raw hex
!Value
!Meaning
|-align=center
|0x00
|colspan=2 BGCOLOR="#FFC8C8"|_lvl_3_Intro_TCL_A_corpse.dat
|align=left|probably the name of the source file
|-align=center
|0xC0
| BGCOLOR="#FFFFC8"|01 36 02 00
|566
|align=left|Link to 00566-TCTF_lite_1.[[OBD:ONCC|ONCC]]
|}
{|border=1 cellspacing=0 style="white-space:nowrap;background:#ffeedd" width=100% BGCOLOR="#FFDDBB"
|+Bone orientation and position
|-style="background:#ffddbb"
!Offset
!Bone
!Raw hex
!Value/Meaning
|-align=center
|0xA4<br>0xB0<br>0xBC<br>0xC8
|Pelvis
|BGCOLOR="#C8FFC8"|C1 74 66 3F 00 78 3E 3D 45 AB DD 3E<br>A6 8B 7D 3D 19 73 7F BF EE 67 B0 BC<br>03 AE DC 3E 82 2C 3D 3D 8D B2 66 BF<br>C5 FA E7 41 2E 2B CB C1 58 B4 45 C1
|align=left|'''x''' = (0.900219, 0.046501, 0.432947)<br>'''y''' =  (0.061901, -0.997850, -0.021534)<br>'''z''' = (0.431015, 0.0461850, -0.901162)<br>'''R''' = (28.997446, -25.396084, -12.356529)
|-align=center
|0xD4<br>0xE0<br>0xEC<br>0xF8
|Lt Thigh
|BGCOLOR="#C8FFFF" |...
|align=left|'''x''' = (, , )<br>'''y''' =  (, , )<br>'''z''' = (, , )<br>'''R''' = (, , )
|-align=center
|0x104<br>0x110<br>0x11C<br>0x128
|Lt Calf
|BGCOLOR="#FFC8FF" |...
|align=left|'''x''' = (, , )<br>'''y''' =  (, , )<br>'''z''' = (, , )<br>'''R''' = (, , )
|-align=center
|0x134<br>0x140<br>0x14C<br>0x158
|Lt Foot
|BGCOLOR="#FFC800" |...
|align=left|'''x''' = (, , )<br>'''y''' =  (, , )<br>'''z''' = (, , )<br>'''R''' = (, , )
|-align=center
|0x164<br>0x170<br>0x17C<br>0x188
|Rt Thigh
| BGCOLOR="#C800C8" |...
|align=left|'''x''' = (, , )<br>'''y''' =  (, , )<br>'''z''' = (, , )<br>'''R''' = (, , )
|-align=center
|0x194<br>0x1A0<br>0x1AC<br>0x1B8
|Rt Calf
| BGCOLOR="#C87C64"|...
|align=left|'''x''' = (, , )<br>'''y''' =  (, , )<br>'''z''' = (, , )<br>'''R''' = (, , )
|-align=center
|0x1C4<br>0x1D0<br>0x1DC<br>0x1E8
|Rt Foot
| BGCOLOR="#B0C3D4" |...
|align=left|'''x''' = (, , )<br>'''y''' =  (, , )<br>'''z''' = (, , )<br>'''R''' = (, , )
|-align=center
|0x1F4<br>0x200<br>0x20C<br>0x218
|Mid
| BGCOLOR="#E7CEA5" |...
|align=left|'''x''' = (, , )<br>'''y''' =  (, , )<br>'''z''' = (, , )<br>'''R''' = (, , )
|-align=center
|0x224<br>0x230<br>0x23C<br>0x248
|Chest
| BGCOLOR="#FFDDDD"|...
|align=left|'''x''' = (, , )<br>'''y''' =  (, , )<br>'''z''' = (, , )<br>'''R''' = (, , )
|-align=center
|0x254<br>0x260<br>0x26C<br>0x278
|Neck
| BGCOLOR="#64AAAA" |...
|align=left|'''x''' = (, , )<br>'''y''' =  (, , )<br>'''z''' = (, , )<br>'''R''' = (, , )
|-align=center
|0x284<br>0x290<br>0x29C<br>0x2A8
|Head
| BGCOLOR="#EBEBEB" |...
|align=left|'''x''' = (, , )<br>'''y''' =  (, , )<br>'''z''' = (, , )<br>'''R''' = (, , )
|-align=center
|0x2B4<br>0x2C0<br>0x2CC<br>0x2D8
|Lt Shoulder
| BGCOLOR="#8C8CCC" |...
|align=left|'''x''' = (, , )<br>'''y''' =  (, , )<br>'''z''' = (, , )<br>'''R''' = (, , )
|-align=center
|0x2E4<br>0x2F0<br>0x2FC<br>0x308
|Lt Arm
| BGCOLOR="#FF00C8"|...
|align=left|'''x''' = (, , )<br>'''y''' =  (, , )<br>'''z''' = (, , )<br>'''R''' = (, , )
|-align=center
|0x314<br>0x320<br>0x32C<br>0x338
|Lt Wrist
| BGCOLOR="#F0F096"|...
|align=left|'''x''' = (, , )<br>'''y''' =  (, , )<br>'''z''' = (, , )<br>'''R''' = (, , )
|-align=center
|0x344<br>0x350<br>0x35C<br>0x368
|Lt Fist
| BGCOLOR="#00C864"|...
|align=left|'''x''' = (, , )<br>'''y''' =  (, , )<br>'''z''' = (, , )<br>'''R''' = (, , )
|-align=center
|0x374<br>0x380<br>0x38C<br>0x398
|Rt Shoulder
| BGCOLOR="#00C8FF"|...
|align=left|'''x''' = (, , )<br>'''y''' =  (, , )<br>'''z''' = (, , )<br>'''R''' = (, , )
|-align=center
|0x3A4<br>0x3B0<br>0x3BC<br>0x3C8
|Rt Arm
| BGCOLOR="#C80040"|...
|align=left|'''x''' = (, , )<br>'''y''' =  (, , )<br>'''z''' = (, , )<br>'''R''' = (, , )
|-align=center
|0x3D4<br>0x3E0<br>0x3EC<br>0x3F8
|Rt Wrist
| BGCOLOR="#FFCD96"|...
|align=left|'''x''' = (, , )<br>'''y''' =  (, , )<br>'''z''' = (, , )<br>'''R''' = (, , )
|-align=center
|0x404<br>0x410<br>0x41C<br>0x428
|Rt Fist
| BGCOLOR="#C8C864"|...
|align=left|'''x''' = (, , )<br>'''y''' =  (, , )<br>'''z''' = (, , )<br>'''R''' = (, , )
|}
{|border=1 cellspacing=0 style="white-space:nowrap;background:#ffeedd" width=100%
|+Axis-aligned bounding box
|-style="background:#ffddbb"
!Offset
!Raw hex
!Value
!Meaning
|-align=center
|0x434
| BGCOLOR="#0096C8" |D4 22 8C 41 95 50 E9 C1 BC 31 9C C1
|(17.517006, -29.164347, -19.524284)
|"minimal" corner of the AABB
|-align=center
|0x440
| BGCOLOR="#0096C8"|75 E6 14 42 2E 20 B1 C1 07 B1 D3 C0
|(37.225056, -22.140713, -6.615360)
|"maximal" corner of the AABB
|}
----
==Screenshot==
The example is the same as above : '''00565-.CRSA''' in '''level3_Final.dat'''
The first corpse chunk has been outlined in black.
http://www6.fh-eberswalde.de/user/dkriesch/onistuff/images/crsa_a.gif




----
{{OBD_File_Footer | type=CRSA | prev=CONS | next=DOOR | name=Corpse Array | family=Level}}
----
{{OBD_File_Footer|type=CRSA|prev=CONS|next=DOOR|name=Corpse Array}}

Revision as of 20:17, 17 September 2007

ONI BINARY DATA
CONS << Other file types >> DOOR
CRSA : Corpse Array
switch to XML:CRSA page
Overview @ Oni Stuff
OBD.png


The first image shows the header and the beginning of the first element. The second image the end of it.


Crsa a.gif


Crsa m.gif


Offset Type Raw Hex Value Description
0x000 res_id 01 35 02 00 565 00565-.CRSA
0x004 lev_id 01 00 00 06 3 level 3
0x008 char[12] AD DE dead unused
0x014 int32 11 00 00 00 17 array size
0x018 int32 11 00 00 00 17 array size again
0x01C int32 14 00 00 00 20 array capacity
First element (black outline)
0x000 char[160] _lvl_3_Intro... space for notes; probably the name of the source file
0x0A0 link 01 36 02 00 566 link to 00566-TCTF_lite_1.ONCC
0x0A4 float C1 74 66 3F 0.900219 transformation matrix of the pelvis, xx term
0x0A8 float 00 78 3E 3D 0.046501 transformation matrix of the pelvis, xy term
0x0AC float 45 AB DD 3E 0.432947 transformation matrix of the pelvis, xz term
0x0B0 float A6 8B 7D 3D 0.061901 transformation matrix of the pelvis, yx term
0x0B4 float 19 73 7F BF -0.997850 transformation matrix of the pelvis, yy term
0x0B8 float EE 67 B0 BC 0.021534 transformation matrix of the pelvis, yz term
0x0BC float 03 AE DC 3E 0.431015 transformation matrix of the pelvis, zx term
0x0C0 float 82 2C 3D 3D 0.0461850 transformation matrix of the pelvis, zy term
0x0C4 float 8D B2 66 BF -0.901162 transformation matrix of the pelvis, zz term
0x0C8 float C5 FA E7 41 28.997446 x-position of the pelvis
0x0CC float 2E 2B CB C1 -25.396084 y-position (height) of the pelvis
0x0D0 float 58 B4 45 C1 -12.356529 z-position of the pelvis
After the pelvis follows the data (same structure as the light green coloured fields) for the other 18 bodyparts (see TRIA file). The end of every element contains the bounding box data (see rows below).
0x434 float D4 22 8C 41 17.517006 minimal x-position of the bounding box
0x438 float 95 50 E9 C1 -29.164347 minimal y-position (height) of the bounding box
0x43C float BC 31 9C C1 -19.524284 minimal z-position of the bounding box
0x440 float 75 E6 14 42 37.225056 maximal x-position of the bounding box
0x444 float 2E 20 B1 C1 -22.140713 maximal y-position (height) of the bounding box
0x448 float 07 B1 D3 C0 -6.615360 maximal z-position of the bounding box


What's in a bone?
The transformation matrix and the offset.
The transformation matrix can define rotation, stretching, mirroring etc, in the following way.
It can be seen as three 3D vectors x, y and z (see table below).
If a bone mesh has a vertex at (x, y, z) in its native coordinates,
then the actual position of that vertex in the level will be R + x x + y y + z z
That's the transformation defined by the matrix and the offset R.

Reminder : the 2nd coordinate of R is the height; same for x, y and z.


ONI BINARY DATA
CONS << Other file types >> DOOR
CRSA : Corpse Array
Level file