Sonic Adventure 2/Level Data Formats
From Sonic Retro
SCHG: Sonic Adventure 2 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Dreamcast GameCube PC | ||||||||||||
|
LandTable header format
This struct defines the number of models and animations in the level, the location of the corresponding lists, and the texture list used. The name comes from the label in the DLL Export table of various DLLs in the PC versions of Sonic Adventure DX and Sonic Adventure 2.
Offset | Type | Description |
---|---|---|
0 | Short | COL Count |
2 | Short | Chunk Model Count |
4 | Int? | Unknown |
8 | Int? | Unknown |
C | Float | Unknown, usually 3000 |
10 | Pointer | COL List |
14 | Int? | Unknown |
18 | Pointer | Texture file name. Optional.
If not null, a PVM with this name will be loaded to the address pointed to by the texture list pointer. |
1C | Pointer | Texture List |
The number of models indicated by the Chunk Model Count will be using the Chunk Model, and any models after that will be using the Basic Model. Generally, the visible models are nonsolid chunk models, and collision is solid basic models. In Battle, the main LandTables use a new model format in place of the Chunk Model.
COL Format
The name COL is an antiquated misnomer, but for lack of a better name, it stuck. This data struct is a reference for loading a level model. It's 0x20 bytes long and works as follows:
Offset | Type | Description |
---|---|---|
0 | Float[3] | Center of collision sphere |
C | Float | Radius of collision sphere |
10 | Pointer | Model (OBJECT Struct) |
14 | 8 Bytes | Padding? |
1C | Int | Surface Flags (see below) |
Surface Flags
These flags are not entirely figured out yet, but here's what is known for sure:
0x00000001 = Solid
0x00000002 = Water (ignores Solid bit)
0x00000004 = Ice
0x00000008 = Slow
0x00000010 = Less Slow
0x00000020 = Diggable
0x00000080 = Cannot Climb
0x00000100 = Ignore Slope
0x00000400 = Hurt
0x00001000 = Cannot Land Or Climb
0x00002000 = Other Water, Cannot Swim
0x00008000 = Don't Cast Shadow
0x00100000 = Something Weird
0x00400000 = Cannot Land 2
0x01000000 = Very Weird Collision
0x08000000 = Slow, Fall Off Edge, Cannot Climb
0x80000000 = Visible
Dreamcast Lighting Data
0x20 bytes long. This is for lighting stored in stgXX_light.bin files. It begins with a direction vector (can be any length) followed by a float related to color multiplication and an ARGB color in floats. Direction vector should be thought of as moving from the point provided towards 0,0,0. Colors and/or multipliers should use the range 0-1F. Seems to always contain 12 sections.
Number | Type | Description |
---|---|---|
0 | Float | X Vector Component |
4 | Float | Y Vector Component |
8 | Float | Z Vector Component |
C | Float | Color Multiplier |
10 | Float | Alpha (Color Multiplier) |
14 | Float | Red |
18 | Float | Green |
1C | Float | Blue |
Gamecube Lighting Data
0x30 bytes long. This is for lighting stored in stgXX_light_gc.bin files. Seemingly a way to extend the original lighting format using many of the same principles. Unlike dreamcast lighting, it can hold 2 colors and does not use a multiplier value, instead relying solely on the color values for both. The first color is the directional while the second is the ambient. Following this is a u32 int flag which should be set to 0 unless you wish to ignore the data for that struct and use what the game loads for the dreamcast version of the file from that section instead. If the dreamcast file does not exist, parts of objects in that section that receive lighting will black from lack of lighting. Seems to always contain 12 sections to match with what it can override from its DC counterpart.
Number | Type | Description |
---|---|---|
0 | Float | X Vector Component |
4 | Float | Y Vector Component |
8 | Float | Z Vector Component |
C | Float | Red (Directional) |
10 | Float | Green (Directional) |
14 | Float | Blue (Directional) |
18 | Float | Red (Ambient) |
1C | Float | Green (Ambient) |
20 | Float | Blue (Ambient) |
24 | U32 Int | DC override flag |
28 | U32 Int | Unused? Leaving as 0 seems fine. |
2C | U32 Unk | Unknown value; Leaving as 0 seems fine. |