======== Setup Files ======== ===== Overall File Structure ===== ^ Address ^ Value/Syntax ^ Description ^ | 0x00 | 01 01 | Possibly File Start? | | | | Voxel Count | | | | Objects | | | | Cameras | | | | Lighting | | -0x01 | 00 | Possibly File End? | ===== Voxel Count Structure ===== ^ Address ^ Value/Syntax ^ Description ^ | 0x00 | XX XX XX XX | Negative X Voxel Count | | 0x04 | YY YY YY YY | Negative Y Voxel Count | | 0x08 | ZZ ZZ ZZ ZZ | Negative Z Voxel Count | | 0x0C | XX XX XX XX | Positive X Voxel Count | | 0x10 | YY YY YY YY | Positive Y Voxel Count | | 0x14 | ZZ ZZ ZZ ZZ | Positive Z Voxel Count | ===== Objects Structure ===== ==== Voxel Structure ==== ^ Address ^ Value/Syntax ^ Description ^ | 0x00 | 03 0A | Indicates The Start Of A Voxel With Objects | | 0x02 | NN | Number Of Complex Objects (Objects With 20 Bytes) | | 0x03 | 0B | Indicates Start Of Complex Object List | | | | Complex Object List | | +0x01 | 08 | End Of Complex Object List | | +0x02 | NN | Number Of Simple Object List (Objects With 12 Bytes) | | +0x03 | 09 | If Number Of Simple Objects > 0, Indicates Start Of Simple Object List | | | | Simple Object List | ''Voxels Are Separated By 0x01. Empty voxels will not have the above after the 0x01'' Here are the lists of known objects with their script ids and object ids: [[banjo_kazooie:object_ids]] ==== Known Complex Object Structures ==== === Actor Structure === Actors: Objects that are given scripts to follow, typically involving multiple states. These will have a 2-byte Object Id and a 2-byte Script Id. ^ Address ^ Value/Syntax ^ Description ^ | 0x00 | XX XX | X Position | | 0x02 | YY YY | Y Position | | 0x04 | ZZ ZZ | Z Position | | 0x06 | SS SS | Script Id | | 0x08 | OO OO | Object Id | | 0x0A | UU | Unknown Byte | | 0x0B | UU | Unknown Byte | | 0x0C | RR | Rotation >> 1 (Y Axis) | | 0x0D | UU | Unknown Byte | | 0x0E | SS SS | Size | | 0x10 | CCC NNN | Nodes (C=Current, N=Next) | | 0x13 | 40 | End Of Object Indicator | === Timed Structure === Timed: Objects that perform follow a script, but are limited on how long their use is. These will have a 2-byte Object Id and a 2-byte Script Id. ^ Address ^ Value/Syntax ^ Description ^ | 0x00 | XX XX | X Position | | 0x02 | YY YY | Y Position | | 0x04 | ZZ ZZ | Z Position | | 0x06 | SS SS | Script Id | | 0x08 | OO OO | Object Id | | 0x0A | UU | Unknown Byte | | 0x0B | UU | Unknown Byte | | 0x0C | TT | Timer | | 0x0D | UU | Unknown Byte | | 0x0E | SS SS | Size | | 0x10 | CCC NNN | Nodes (C=Current, N=Next) | | 0x13 | 40 | End Of Object Indicator | === Script Structure === Script: Objects that cause another object or set of objects to perform actions. ^ Address ^ Value/Syntax ^ Description ^ | 0x00 | XX XX | X Position | | 0x02 | YY YY | Y Position | | 0x04 | ZZ ZZ | Z Position | | 0x06 | SS SS | Script Id | | 0x08 | OO OO | Object Id | | 0x0A | UU | Unknown Byte | | 0x0B | UU | Unknown Byte | | 0x0C | UU | Unknown Byte | | 0x0D | UU | Unknown Byte | | 0x0E | UU | Unknown Byte | | 0x0F | UU | Unknown Byte | | 0x10 | CCC NNN | Nodes (C=Current, N=Next) | | 0x13 | 40 | End Of Object Indicator | === Radius Structure === Radius: Objects that trigger when Banjo-Kazooie enter their radius. These will have a 1-byte Object Id and a 2-byte Associated Id (used for flag ids, warp ids, etc) ^ Address ^ Value/Syntax ^ Description ^ | 0x00 | XX XX | X Position | | 0x02 | YY YY | Y Position | | 0x04 | ZZ ZZ | Z Position | | 0x06 | RR | Radius >> 1 | | 0x07 | OO | Object Id | | 0x08 | AA AA | Associated Id (For Stuff Like Flags) | | 0x0A | UU | Unknown Byte | | 0x0B | UU | Unknown Byte | | 0x0C | UU | Unknown Byte | | 0x0D | UU | Unknown Byte | | 0x0E | UU | Unknown Byte | | 0x0F | UU | Unknown Byte | | 0x10 | CCC NNN | Nodes (C=Current, N=Next) | | 0x13 | 40 | End Of Object Indicator | ==== Known Simple Object Structures ==== === Sprite Structure === Sprites: 2D Objects that will face the camera at all times (aka Billboarding). Sprites contain information about their id, RGB values, their scale, whether they are mirrored or not, their position and which "frame". The sprite id has no offset in it's declaration. However while loading the sprite asset an offset of 0x572 is added on top of the id. The 12 bytes contain this information in the following parts: The first 4 bytes contain the object id, RGB, scale and whether the sprite is mirrored or not: The next 6 bytes are 3 s16's to describe the position (XYZ) The last 2 bytes mainly define the frame ^ Address ^ Value/Syntax ^ Description ^ | 0x00 | SSSS SSSS SSSS PRRR | Sprite id, padding, RGB red | | 0x02 | GGGB BBSS SSSS SSMP | RGB green, RGB blue, scale, is mirror, padding | | 0x04 | XX XX | X Position | | 0x06 | YY YY | Y Position | | 0x08 | ZZ ZZ | Z Position | | 0x0A | FFFF FPPP PPPP PPPP | Frame, padding | Example(s) for the music notes on the shelve in Nabnuts house in autumn: {{:banjo_kazooie:bk_notes_nabnut_house_autumn.png?400|}} Bytes in level setup: ''0x16 0x40 0x00 0xB4 0x01 0x20 0x01 0x9D 0xFE 0x9B 0x4A 0xF0'' First 4 bytes are ''0x16 0x40 0x00 0xB4'' in hex or ''00010110 01000000 00000000 10110100'' in binary * 0x164 = object id = Music Note (0x6D6 with offset) * 0b0 = padding * 0b000 = RGB red * 0b000 = RGB green * 0b000 = RGB blue * 0b00101101 = scale * 0b0 = is mirrored * 0b0 = padding Next 6 bytes are the position: * 0x0120 = X = 288 * 0x019D = Y = 413 * 0xFE9B = Z = -357 Last 2 bytes are ''0x4A 0xF0'' in hex or ''01001010 11110000'' in binary * 0b01001 = frame * 0b010111100 = padding * 0b0 = isModelProp -> This is false for all "Sprite structures" * 0b0 = isActorProp -> This is false for all "Simple Object structures" Bytes in level setup: ''0x16 0x40 0x00 0xB6 0x01 0x7E 0x01 0x9D 0xFE 0xD8 0x21 0x10'' First 4 bytes are ''0x16 0x40 0x00 0xB6'' in hex or ''00010110 01000000 00000000 10110110'' in binary * 0x164 = object id = Music Note * 0b0 = padding * 0b000 = RGB red * 0b000 = RGB green * 0b000 = RGB blue * 0b00101101 = scale * 0b1 = is mirrored * 0b0 = padding Next 6 bytes are the position: * 0x017E = X = 382 * 0x019D = Y = 413 * 0xFED8 = Z = -296 Last 2 bytes are ''0x21 0x10'' in hex or ''00100001 00010000'' in binary * 0b001000 = frame * 0b01000100 = padding * 0b0 = isModelProp -> This is false for all "Sprite structures" * 0b0 = isActorProp -> This is false for all "Simple Object structures" Bytes in level setup: ''0x16 0x40 0x00 0xB4 0x01 0xD7 0x01 0x9D 0xFF 0x15 0x1D 0xD0'' First 4 bytes are ''0x16 0x40 0x00 0xB4'' in hex or ''00010110 01000000 00000000 10110100'' in binary * 0x164 = object id = Music Note * 0b0 = padding * 0b000 = RGB red * 0b000 = RGB green * 0b000 = RGB blue * 0b00101101 = scale * 0b0 = is mirrored * 0b0 = padding Next 6 bytes are the position: * 0x01D7 = X = 471 * 0x019D = Y = 413 * 0xFF15 = Z = -235 Last 2 bytes are ''0x1D 0xD0'' in hex or ''00011101 11010000'' in binary * 0b000111 = frame * 0b01110100 = padding * 0b0 = isModelProp -> This is false for all "Sprite structures" * 0b0 = isActorProp -> This is false for all "Simple Object structures" === Model Structure === Models: Objects that have a model ID associated with it which are placed in the map. The Model ID has no offset in it's declaration. However while loading the model asset an offset of 0x2D1 is added to the id. ^ Address ^ Value/Syntax ^ Description ^ | 0x00 | MMMM MMMM MMMM PPPP | Model Id, padding| | 0x02 | PP | Pitch | | 0x03 | RR | Roll | | 0x04 | XX XX | X Position | | 0x06 | YY YY | Y Position | | 0x08 | ZZ ZZ | Z Position | | 0x0A | SS | Scale | | 0x0B | UU | Padding | The 12 bytes contain this information in the following parts: The first 12 bits are the model id padded with 4 bits to create 2 byte. The next 6 bytes are 3 s16's to describe the position (XYZ) The last 2 bytes mainly define the scale of the model Example(s) for the dust bins next to banjos house in Spiral Mountain: {{:banjo_kazooie:bk_dust_bins_sm.png?400|}} Bytes in level setup: ''0x01, 0xC4, 0x01, 0x2B, 0x13, 0x02, 0xFE, 0x30, 0x1A, 0xE9, 0x32, 0xD2'' First 2 bytes are ''0x01 0xC4'' in hex or ''00000001 11000100'' in binary * 0x1C = model id = Dust bin (0x2ED with offset) * 0b0100 = padding Next 2 bytes are pitch and roll which are used for the rotation of the model: * 0x01 = Pitch * 0x2B = Roll Next 6 bytes are the position: * 0x1302 = X = 4866 * 0xFE30 = Y = -464 * 0x1AE9 = Z = 6889 The last 2 bytes contain the scale and padding bits: * 0x32 = scale (50) * 0b110100 = padding * 0b1 = isModelProp => This is true for all "Model structures" * 0b0 = isActorProp => This is false for all "Simple Object structures" Bytes in level setup: ''0x01, 0xC4, 0x41, 0x00, 0x12, 0x81, 0xFE, 0x11, 0x1A, 0x3A, 0x32, 0x52'' First 2 bytes are ''0x01 0xC4'' in hex or ''00000001 11000100'' in binary * 0x1C = model id = Dust bin (0x2ED with offset) * 0b0100 = padding Next 2 bytes are pitch and roll which are used for the rotation of the model: * 0x41 = Pitch * 0x00 = Roll Next 6 bytes are the position: * 0x1281 = X = 4737 * 0xFE11 = Y = -495 * 0x1A3A = Z = 6714 The last 2 bytes contain the scale and padding bits: * 0x32 = scale (50) * 0b010100 = padding * 0b1 = isModelProp => This is true for all "Model structures" * 0b0 = isActorProp => This is false for all "Simple Object structures" Bytes in level setup: ''0x01, 0xC4, 0x00, 0x01, 0x12, 0x3A, 0xFE, 0x0E, 0x1A, 0xF0, 0x32, 0xD2'' First 2 bytes are ''0x01 0xC4'' in hex or ''00000001 11000100'' in binary * 0x1C = model id = Dust bin (0x2ED with offset) * 0b0100 = padding Next 2 bytes are pitch and roll which are used for the rotation of the model: * 0x00 = Pitch * 0x01 = Roll Next 6 bytes are the position: * 0x123A = X = 4666 * 0xFE0E = Y = -498 * 0x1AF0 = Z = 6896 The last 2 bytes contain the scale and padding bits: * 0x32 = scale (50) * 0b110100 = padding * 0b1 = isModelProp => This is true for all "Model structures" * 0b0 = isActorProp => This is false for all "Simple Object structures" ===== Camera Structure ===== ^ Address ^ Value/Syntax ^ Description ^ | 0x00 | 00 03 | Camera Section Start | | 0x02 | | List Of Cameras | ==== Known Camera Structures ==== === Camera Type 0 Structure === ^ Address ^ Value/Syntax ^ Description ^ | 0x00 | 01 | Start Of Camera | | 0x01 | II II | Camera Id | | 0x03 | 02 | Unknown | | 0x04 | 00 | Camera End | === Camera Type 1 Structure === ^ Address ^ Value/Syntax ^ Description ^ | 0x00 | 01 | Start Of Camera | | 0x01 | II II | Camera Id | | 0x03 | 02 | Unknown | | 0x04 | 01 | Camera Type | | 0x05 | 01 | Indicates Section One | | 0x06 | XX XX XX XX | X Position (Float) | | 0x0A | YY YY YY YY | Y Position (Float) | | 0x0E | ZZ ZZ ZZ ZZ | Z Position (Float) | | 0x12 | 02 | Indicates Section Two | | 0x13 | HH HH HH HH | Horizontal Speed (Float) | | 0x17 | VV VV VV VV | Vertical Speed (Float) | | 0x1B | 03 | Indicates Section Three | | 0x1C | RR RR RR RR | Rotation (Float) | | 0x20 | AA AA AA AA | Acceleration (Float) | | 0x24 | 04 | Indicates Section Four | | 0x25 | PP PP PP PP | Pitch (Float) | | 0x29 | YY YY YY YY | Yaw (Float) | | 0x2D | RR RR RR RR | Roll (Float) | | 0x31 | 05 | Indicates Section Five | | 0x32 | UU UU UU UU | Unknown (Float) | | 0x36 | 00 | Camera End | === Camera Type 2 Structure === ^ Address ^ Value/Syntax ^ Description ^ | 0x00 | 01 | Start Of Camera | | 0x01 | II II | Camera Id | | 0x03 | 02 | Unknown | | 0x04 | 01 | Camera Type | | 0x05 | 01 | Indicates Section One | | 0x06 | XX XX XX XX | X Position (Float) | | 0x0A | YY YY YY YY | Y Position (Float) | | 0x0E | ZZ ZZ ZZ ZZ | Z Position (Float) | | 0x12 | 02 | Indicates Section Two | | 0x13 | PP PP PP PP | Pitch (Float) | | 0x17 | YY YY YY YY | Yaw (Float) | | 0x1B | RR RR RR RR | Roll (Float) | | 0x1F | 00 | Camera End | === Camera Type 3 Structure === ^ Address ^ Value/Syntax ^ Description ^ | 0x00 | 01 | Start Of Camera | | 0x01 | II II | Camera Id | | 0x03 | 02 | Unknown | | 0x04 | 01 | Camera Type | | 0x05 | 01 | Indicates Section One | | 0x06 | XX XX XX XX | X Position (Float) | | 0x0A | YY YY YY YY | Y Position (Float) | | 0x0E | ZZ ZZ ZZ ZZ | Z Position (Float) | | 0x12 | 02 | Indicates Section Two | | 0x13 | HH HH HH HH | Horizontal Speed (Float) | | 0x17 | VV VV VV VV | Vertical Speed (Float) | | 0x1B | 03 | Indicates Section Three | | 0x1C | RR RR RR RR | Rotation (Float) | | 0x20 | AA AA AA AA | Acceleration (Float) | | 0x24 | 04 | Indicates Section Four | | 0x25 | PP PP PP PP | Pitch (Float) | | 0x29 | YY YY YY YY | Yaw (Float) | | 0x2D | RR RR RR RR | Roll (Float) | | 0x31 | 05 | Indicates Section Five | | 0x32 | UU UU UU UU | Unknown (Float) | | 0x36 | 06 | Indicates Section Six | | 0x37 | CC CC CC CC | Close Distance (Float) | | 0x3B | FF FF FF FF | Far Distance (Float) | | 0x3F | 00 | Camera End | === Camera Type 4 Structure === ^ Address ^ Value/Syntax ^ Description ^ | 0x00 | 01 | Start Of Camera | | 0x01 | II II | Camera Id | | 0x03 | 02 | Unknown | | 0x04 | 01 | Camera Type | | 0x05 | 01 | Indicates Section One | | 0x06 | UU UU UU UU | Unknown (Float) | | 0x0A | 00 | Camera End | ===== Lighting Structure ===== ^ Address ^ Value/Syntax ^ Description ^ | 0x00 | 00 04 | Start Of Lighting Section | | 0x02 | | List Of Lightings | | -0x01 | | End Of Lighting Section | ==== Lighting Structure ==== ^ Address ^ Value/Syntax ^ Description ^ | 0x00 | 01 | Section One Header | | 0x01 | 02 | Section Two Header | | 0x02 | XX XX XX XX | X Position (Float) | | 0x06 | YY YY YY YY | Y Position (Float) | | 0x0A | ZZ ZZ ZZ ZZ | Z Position (Float) | | 0x0E | 03 | Section Three Header | | 0x0F | UU UU UU UU | Unknown (Float) | | 0x13 | UU UU UU UU | Unknown (Float) | | 0x17 | 04 | Section Four Header | | 0x18 | 00 00 00 RR | Red | | 0x1C | 00 00 00 GG | Green | | 0x20 | 00 00 00 BB | Blue |