20,136
edits
m (link fix) |
(general rewrite, adding in the knowledge I've gained so far; removed list of types that link to other types as it seems useless) |
||
| Line 1: | Line 1: | ||
{{finish}} | |||
{{OBD Home}} | {{OBD Home}} | ||
Following are the formats used for the various data fields in Oni's [[OBD:File types|resource types]]. | |||
Following are the formats used for the various data fields in Oni's [[OBD:File types| | |||
{{TOClimit}} | {{TOClimit}} | ||
== | ==Resource links== | ||
Links between resources are very common in the data and take four forms. | |||
===Links by index number=== | |||
Probably the most common form of inter-resource linking is to store the index number of the connected resource in a 32-bit int. "Index number" is defined as the position of the resource in the [[dat#Instance descriptors|instance descriptor table]]. These index numbers were left-shifted by 8 bits in memory in order to leave room for a bit that could be set at runtime indicating the resource had been loaded. Even though this bit had no relevance when the data was stored on disk, the ints were written to disk as-is. See [[dat#Data block|here]] for elaboration, or see {{SectionLink|OBD:ONCC|Body settings}} for several examples. | |||
- | ===Links by name=== | ||
Many fields store the name of the connected resource as a string which is then looked up at runtime when needed or upon level-load. Search [[OBD:ONCC]] for the word "reference" to find several examples. | |||
===Links by ID=== | ===Links by ID=== | ||
Not to be confused with links by index number (even though we sometimes call that the instance ID). Various systems have their own set of ID numbers: vocalizations, melee profiles, combat behavior profiles, etc. These are not generally links to level file resources but rather lookups to hardcoded tables. | |||
===Raw/separate file offsets=== | |||
These are 32-bit ints telling the engine how far to index into the raw or separate file to find some data which is part of an instance. As long as the file never exceeds 4 GB then there can't be any issues with using a 32-bit offset. Note the [[Raw#File storage|differences in raw/separate utilization]] between engine versions. | |||
-- | ==Strings== | ||
Strings are generally stored in fixed-size buffers. The sizes of these buffers are listed below. The strings used for dialogue subtitles and for messages are not fixed-size; they are stored in a contiguous chunk in the raw file, with the offsets for each string found in an array in [[SUBT]]. Each string's length is not known in advance, but only by reading it as a C string and encountering the null terminator at the end. | |||
===16 chars=== | ===16 chars=== | ||
*[[ | *[[ONCC]] | ||
*[[ONCP]] | *[[ONCP]] | ||
*[[ONIA]] | *[[ONIA]] | ||
*[[PAR3]] ([[BINA]] raw/separate file part) | |||
*[[TRAM]] | *[[TRAM]] | ||
*[[TRAM]] (particle part) | *[[TRAM]] (particle part) | ||
===32 chars=== | ===32 chars=== | ||
*[[AGDB]] raw/separate file parts | *[[AGDB]] raw/separate file parts | ||
| Line 91: | Line 55: | ||
*[[TRIG]] | *[[TRIG]] | ||
*[[TURR]] | *[[TURR]] | ||
===48 chars=== | ===48 chars=== | ||
*[[FURN]] ([[BINA]] raw/sep part) | *[[FURN]] ([[BINA]] raw/sep part) | ||
| Line 96: | Line 61: | ||
*[[ENVP]] | *[[ENVP]] | ||
*[[ONGS]]? | *[[ONGS]]? | ||
===63 chars=== | ===63 chars=== | ||
*[[CONS]] ([[BINA]] raw/sep part) | *[[CONS]] ([[BINA]] raw/sep part) | ||
| Line 102: | Line 68: | ||
*[[TRIG]] ([[BINA]] raw/sep part) | *[[TRIG]] ([[BINA]] raw/sep part) | ||
*[[TURR]] ([[BINA]] raw/sep part) | *[[TURR]] ([[BINA]] raw/sep part) | ||
===64 chars=== | ===64 chars=== | ||
*[[AITR]] | *[[AITR]] | ||
| Line 120: | Line 87: | ||
*[[TURR]] | *[[TURR]] | ||
*[[WMM_]] | *[[WMM_]] | ||
===68 chars=== | ===68 chars=== | ||
*[[DOOR]] ([[BINA]] raw/sep part) | *[[DOOR]] ([[BINA]] raw/sep part) | ||
===128 chars=== | ===128 chars=== | ||
*[[FLAG]] ([[BINA]] raw/sep part) | *[[FLAG]] ([[BINA]] raw/sep part) | ||
| Line 130: | Line 99: | ||
*[[TStr]] | *[[TStr]] | ||
*[[TXMP]] | *[[TXMP]] | ||
===132 chars=== | ===132 chars=== | ||
*[[ONIE]] ([[BINA]] raw/sep part) | *[[ONIE]] ([[BINA]] raw/sep part) | ||
===160 chars=== | ===160 chars=== | ||
*[[CRSA]] | *[[CRSA]] | ||
===256 chars=== | ===256 chars=== | ||
*[[WMDD]] | *[[WMDD]] | ||
===364 chars=== | ===364 chars=== | ||
*[[IGSt]] | *[[IGSt]] | ||
==Floating-point numbers== | |||
===Float=== | |||
Floats are stored in the standard 4-byte IEEE format, so reading them directly into the memory of a float_t works. These are used for many amounts where floating-point precision is needed, such as percentages, distances and angles. | |||
===Vector=== | ===Vector=== | ||
3 floats | Simply a struct of 3 floats stored contiguously. Vectors are used for 3D coordinates of polygons and normals, as well as for scaling. | ||
===AABB=== | ===AABB=== | ||
;Axis-aligned bounding box | ;Axis-aligned bounding box | ||
| Line 163: | Line 134: | ||
4 floats define an oriented plane in 3D | 4 floats define an oriented plane in 3D | ||
:(see [[PLEA]] for algorithm) | :(see [[PLEA]] for algorithm) | ||
===Quaternion=== | ===Quaternion=== | ||
4 floats define a [[wikipedia:Quaternion|quaternion]] | 4 floats define a [[wikipedia:Quaternion|quaternion]] | ||
| Line 189: | Line 161: | ||
*[[TURR]] | *[[TURR]] | ||
==Integers== | |||
These are also stored in the standard IEEE format. Most integers in the game data are read as unsigned, but one known exception is the quantized Euler angles in [[TRAM]]. | |||
===char=== | ===char=== | ||
Are single-byte ints ever used? | |||
===short=== | ===short=== | ||
16-bit ints are used throughout the game data to save space when 32-bit capacity is not needed. | |||
===short with high bit=== | ===short with high bit=== | ||
Used as a simple flag? (in a few places... not sure... ^^ ) (OFGA) | |||
===int=== | |||
Used throughout the game data wherever values were expected to at least potentially exceed 16-bit limits. | |||
===long=== | ===long=== | ||
64-bit ints are found in many places where extra-large numbers were anticipated, such as [[dat#Header|the checksum field]] in the .dat's header. | |||
===long with high bit=== | ===long with high bit=== | ||
The lower bits are used for an ID, the high bit is a flag | The lower bits are used for an ID, the high bit is a flag. | ||
: | :Used in: | ||
*[[ABNA]] | *[[ABNA]] | ||
*[[AGQC]] | *[[AGQC]] | ||
| Line 213: | Line 190: | ||
*[[QTNA]] | *[[QTNA]] | ||
*... | *... | ||
===long with high byte=== | ===long with high byte=== | ||
The lower bytes are used for an ID, the high byte is a group ID | The lower bytes are used for an ID, the high byte is a group ID. | ||
: | :Used for [[MELE]] moves | ||
=== | |||
===Quantized float=== | |||
Used for quantized Euler angles in [[TRAM]]. | |||
===other stuff=== | ===other stuff=== | ||
Lots of funny stuff in [[PAR3]], maybe... | |||
: | :Funny stuff in [[OTLF]], too... | ||
==Bitsets== | |||
The most common size of a bitset, aka flagset, is 32 bits. | |||
===1 byte=== | ===1 byte=== | ||
===2 bytes=== | ===2 bytes=== | ||
===4 bytes=== | ===4 bytes=== | ||
===8 bytes=== | ===8 bytes=== | ||
Used for [[dat#Instance descriptors|the instance descriptor flags]] in the .dat and for keypress events in [[FILM]]. Used for storing flags for AI behaviors in [[ONCC]]. | |||
==Misc.== | |||
==Misc== | |||
===32-bit color=== | ===32-bit color=== | ||
stored as BB GG RR AA (byte swapped) | stored as BB GG RR AA (byte swapped) | ||
: | :Used in: | ||
*[[AGQG]] | *[[AGQG]] | ||
*[[IGSt]]? | *[[IGSt]]? | ||
| Line 242: | Line 220: | ||
*[[ONWC]] | *[[ONWC]] | ||
*[[WMDD]] | *[[WMDD]] | ||
===4-character codes=== | ===4-character codes=== | ||
4CCs for short, also known as tags to many game modders, are used to announce [[dat#Header|the packing version]] of .dat files, to label template descriptors in the same, and in various BINA raw/sep parts. | |||
===[[OBD:AKVA/0x24]] | |||
===Pathfinding grids=== | |||
See [[OBD:AKVA/0x24]]. | |||
{{OBD}} | {{OBD}} | ||