Sonic Heroes/Visibility Editing
From Sonic Retro
Revision as of 00:39, 19 February 2017 by Crazy Muzzarino (talk | contribs) (Forgot that it was good grammar.)
SCHG: Sonic Heroes |
---|
Main Article |
Mechanic Editing |
DOL Editing |
Model Editing |
Collision Format Model Format |
Level Editing |
Camera Editing |
Particle Editing |
Particle Editing |
Sound Editing |
Music List |
SCHG How-Tos |
Custom Object Material Effect Tutorial |
Visibility data for level models is set in sLL_blk.bin files located in the dvdroot folder. They are big endian binary files which define boundary boxes. When the camera is inside the box, the specified chunk of level geometry is rendered.
File Layout
Each sLL_blk.bin file contains 64 entries for boundary boxes. Most levels are split into fewer chunks, so the majority of those entries is left unused.
Each entry is 0x1B bytes long and is set like this:
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Offset | Type | Description |
---|---|---|
0x00 | Long | Chunk number (-1 for blank entry) |
0x04 | Long | Minimum X |
0x08 | Long | Minimum Y |
0x0C | Long | Minimum Z |
0x10 | Long | Maximum X |
0x14 | Long | Maximum Y |
0x18 | Long | Maximum Z |
The XYZ coordinates for the maximum and minimum of the boundary boxes are not floats. Each 4 byte value is split into a 2 byte flag and a 2 byte integer:
- The first 2 bytes are a signing flag:
- If it's set to 0, the second 2 bytes are an unsigned integer; the coordinate will be positive.
- If it's set to -1, the second 2 bytes are a signed integer; the coordinate will be negative.
- The value of the second 2 bytes is then loaded as a coordinate.
- Note: if the flag is set to -1, the value will always be read negative. So 0xFFFF is -1, 0xFFFE is -2 and so on. 0x0001 is -65535 and 0x0000 is -65536. A simple way to figure this out is to subtract the value as an unsigned integer from 65536.
This means that 65536 units to either positive or negative directions in any of the three axes is the maximum distance for the game to be able to render the level model. It is possible to pass those distances with the characters, though.
The minimum value for each coordinate must be lower than the maximum, but the minimum doesn't have to be positive or the maximum negative.
The same chunk can be specified to load from more than one entry, and multiple chunks can be loaded at the same time from overlapping boxes.