User Tools

Site Tools


kirby64_the_crystal_shards:level_settings_blocks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
kirby64_the_crystal_shards:level_settings_blocks [2020/05/10 23:45]
jesusyoshi54 [Path Nodes]
kirby64_the_crystal_shards:level_settings_blocks [2020/05/27 12:19] (current)
jesusyoshi54
Line 1: Line 1:
 ====== Level Settings Block ====== ====== Level Settings Block ======
 Every Area has its own Level Settings Block defined inside the Main Stage Table (see: [[kirby64_the_crystal_shards:​levels|]]). Every Area has its own Level Settings Block defined inside the Main Stage Table (see: [[kirby64_the_crystal_shards:​levels|]]).
-The level settings block defines the camera, collision, and entities spawned inside the stage. The Basic Structure of the Level Settings Block is as follows.+The level settings block defines the camera, pathing, collision, and entities spawned inside the stage. The Basic Structure of the Level Settings Block is as follows. 
 ===== Level Settings Layout ===== ===== Level Settings Layout =====
  
Line 10: Line 11:
   - Triangle Groups/​Cells   - Triangle Groups/​Cells
   - Surface Normals Groups/​Cells   - Surface Normals Groups/​Cells
-  - Dynamic Geometry Lists 
-  - Dynamic Geometry Groups 
   - Water Data   - Water Data
   - Water Normals   - Water Normals
 +  - Destructable Geometry Groups
 +  - Destructable Geometry Indices
   - Collision Header (referred to by Main Header[0])   - Collision Header (referred to by Main Header[0])
   - Pathing Nodes   - Pathing Nodes
-  - Kirby Node Params ​& Camera ​Nodes+  - Kirby Node Data & Camera ​Node Data
   - Node Connections   - Node Connections
   - Unk Bytes   - Unk Bytes
Line 26: Line 27:
 ==== Main Header ==== ==== Main Header ====
  
-The main header contains references to the three main sections of the level settings block: Collision, ​Camera ​and the Entity List.+The main header contains references to the three main sections of the level settings block: Collision, ​Nodes and the Entity List.
 <code c> <code c>
 struct Main_Header struct Main_Header
 { {
 /​*0x00*/ ​   struct Collision_Header ​   *Collision_Header;​ /​*0x00*/ ​   struct Collision_Header ​   *Collision_Header;​
-/​*0x04*/ ​   struct Node_Header ​   *Node_Header;​ +/​*0x04*/ ​   struct Node_Header ​        ​*Node_Header;​ 
-/​*0x08*/ ​   struct Entities ​   (*Entity_IDs)[];​+/​*0x08*/ ​   struct Entities ​           (*Entity_IDs)[]
 +/​*0x0C*/ ​   int                        padding;
 }; };
 </​code>​ </​code>​
Line 44: Line 46:
 Vertices are made up of unsorted s16 tripets of x, y and z position. Vertices are made up of unsorted s16 tripets of x, y and z position.
  
-The vertex array starts with a 0x270F triplet and ends with a single 0x9999.+The vertex array starts with a 0x270F triplet and optionally ​ends with a single 0x9999. This is assumed to be 
 +for 4 byte alignment of the following sections.
  
 ==== Triangles ==== ==== Triangles ====
Line 53: Line 56:
 struct Col_Triangle struct Col_Triangle
 { {
-/*0x0*/ u16        Vertex[3];+/*0x0*/ u16    Vertex[3];
 /*0x6*/ u16    ​Polygon_Number;​ /*0x6*/ u16    ​Polygon_Number;​
-/*0x8*/ u16        ​Solidity_Type; //(1 forward norm, 2 back norm, 4 no shadow, 8 non solid) +/*0x8*/ u16    ​Normal_Type         //(1 forward norm, 2 back norm, 4 no shadow, 8 non solid) 
-/*0xA*/ u16    Destructable_Group_Index+/*0xA*/ u16    Collision_Type_Index//based on col type this num references array pos 
-/*0xC*/ u16    ​Break_Particle;​ //(seen in DEDEDE hammer break) +/*0xC*/ u16    ​Break_Particle; ​      ​//(seen in DEDEDE hammer break) 
-/*0xE*/ u16    ​Halt_Movement;​ //warp related? Maybe dest (kirby cant move while on top of this if 1) +/*0xE*/ u16    ​Halt_Movement; ​       //Stops kirby from moving/​triggers automatic behavior. 
-/​*0x10*/​ s16  ​  ​Col_Param1;​ //Amount to move kirby while on certain col types or Break Condition +/​*0x10*/​ s16  ​  ​Col_Param1; ​          ​//ex.Amount to move kirby while on certain col types or Break Condition 
-/​*0x12*/​ u16  ​  ​Collision_Type;​ //see col type list+/​*0x12*/​ u16  ​  ​Collision_Type; ​      ​//see col type list
 }; };
 </​code>​ </​code>​
 The following is a list of Collision_Type values known. The following is a list of Collision_Type values known.
 +  * 0x0 - default
   * 0x1 - wall ladder   * 0x1 - wall ladder
   * 0x2 - rope   * 0x2 - rope
Line 80: Line 84:
 ==== Triangle Normals ==== ==== Triangle Normals ====
  
-Triangle normals are stored as a F32 array of 4 values. The first three values are the surface normals while the last is the origin offset. Together the normals should solve the plane equation (see:​[[http://​mathworld.wolfram.com/​Plane.html|link]]).+Triangle normals are stored as a F32 array of 4 values. The first three values are the surface normals while the last is the origin offset. 
 +Together the normals should solve the plane equation (see:​[[http://​mathworld.wolfram.com/​Plane.html|link]]).
  
-The list of normals always starts with (-1,​-2,​-3,​-4) and is used to refer to walls, only floor and ceilings have their normals listed. ​The actual value of the first set of normal is not known to have any significance. ​Redundant normals are not repeated, but are just referenced multiple times (e.g. two triangles with norm Y==1 and offset==0 share their normal).+The list of normals always starts with (-1,​-2,​-3,​-4) and is used to refer to walls, only solid collision has its normals listed. 
 +Redundant normals are not repeated, but are just referenced multiple times (e.g. two triangles with norm Y==1 and offset==0 share their normal).
  
 <code c> <code c>
Line 98: Line 104:
 The triangle group list begins with a flag of 0x8192 and ends with 0x9999. Each triangle group is a u16 list of indices to the triangle struct array. The triangle group list begins with a flag of 0x8192 and ends with 0x9999. Each triangle group is a u16 list of indices to the triangle struct array.
  
-Each triangle group represents one polygon index (0x6 in tri struct). The groups are defined by setting the msb at the last triangle in that group. This means any coplanar, connected N-gon will be a single polygon group. Triangle groups are searched in reverse order.+Each triangle group represents one polygon index (0x6 in tri struct). The groups are defined by setting the msb at the last triangle in that group. This means any coplanar, connected N-gon will be a single polygon group.
  
 There should be an equal amount of items in the triangle list and triangle group list. There should be an equal amount of items in the triangle list and triangle group list.
Line 112: Line 118:
 { {
 /​*0x0*/ ​ u16  Normal_Index;​ /​*0x0*/ ​ u16  Normal_Index;​
-/​*0x2*/ ​ u16  ​Triangle_Index;+/​*0x2*/ ​ u16  ​Next_Norm_Group; 
 +/​*0x4*/ ​ u16  Unk; 
 +/​*0x6*/ ​ u16  Tri_Cell_Index
 }; };
 </​code>​ </​code>​
-==== Dynamic ​Geometry ​Lists ====+==== Destructable ​Geometry ​Groups ​====
  
-DynGeo ​list is referenced by certain collision types using 0xA inside the col tri struct. This is so instead of destroying one triangle, all connected geometry is edited as a single rigid body.+Destructable Geo list is referenced by certain collision types using 0xA inside the col tri struct. 
 +This is so instead of destroying one triangle, all connected geometry is edited as a single rigid body.
  
-When a triangle is going to be edited, 0xA of the tri struct references the index into this list. This list will then tell the game the index to the array of dynamic ​geo groups ​and the number of members in that array.+When a triangle is going to be edited, 0xA of the tri struct references the index into this list. 
 +This list will then tell the game the index to the array of destructable ​geo indices ​and the number of members in that array.
  
 <code c> <code c>
Line 130: Line 140:
 </​code>​ </​code>​
  
-The dynamic geo list usually ends with 0x9999, but it is not necessary.+The dynamic geo list usually ends with 0x9999, but it is not necessary. Potentially for alignment.
 The dynamic geo list can also be null, in that case the col header will have a null ptr to match. The dynamic geo list can also be null, in that case the col header will have a null ptr to match.
-==== Dynamic Geometry Groups ==== 
  
-Dynamic geometry groups are an array of u16 indices that reference the tri struct array.+==== Destructable Geometry Indices ====
  
-When a triangle is being edited, 0xA in the tri struct points to the dynamic ​geometry ​list. From there an index to this dynamic geometry group list is given, and the number ​of members in that list.+Destructable ​geometry ​indices are an array of u16 indices ​that reference the tri struct array.
  
-The dynamic geomtry group only has the references ​to trianglesThe transformation (usually destruction) ​is applied based on col type or specific code.+When a triangle is being edited, 0xA in the tri struct points ​to the destructable geometry group. 
 +From there an index to this destructable geometry index list is given, and the number of members in that list.
  
-The dynamic geo geoup array usually ends with 0x9999, but its not necessary.+The dynamic geomtry group only has the references to triangles. 
 +The transformation (only destruction?​) is applied based on col type or specific code. 
 + 
 +The dynamic geo geoup array usually ends with 0x9999, but its not necessary. Possibly for alignment.
 This list can also be null, and will have a null ptr in the col header to match. This list can also be null, and will have a null ptr in the col header to match.
 ==== Water Data ==== ==== Water Data ====
Line 146: Line 159:
 Water data is an array of water structs that will determine how kirby collides with water. Water data is an array of water structs that will determine how kirby collides with water.
 Normals and a bounding box are used instead of polygons to determine collision. First kirby has to be inside the bounding box inside the water data struct. Normals and a bounding box are used instead of polygons to determine collision. First kirby has to be inside the bounding box inside the water data struct.
-Then the normals are used. Normals are different than collision triangle geometry in that they define an infinite plane. The normal planes intersect to create a closed surface which is used as the collision check+Then the normals are used. Normals are different than collision triangle geometry in that they define an infinite plane. 
- +The normal planes intersect to create a closed surface which is used as the collision check.
-The bytes inside the water data struct act as bools.+
  
 <code c> <code c>
Line 169: Line 181:
  
 Works exactly like floats for other collision triangles. Works exactly like floats for other collision triangles.
-Lead by a (1,2,3,4) the followed by (3*norms,​origin offset).+Lead by a (1,2,3,4) the followed by (3*norms,​origin offset). See struct Normal.
 Follows all the conventions for normals that you'd expect, including n * r = -offset. Follows all the conventions for normals that you'd expect, including n * r = -offset.
  
Line 176: Line 188:
 ==== Collision Header ==== ==== Collision Header ====
  
-The collision header is referred to by the first index inside the main header. The collision header has the following format.+The collision header is referred to by the first index inside the main header. 
 +The collision header has the following format. 
 <code c> <code c>
 struct Collision_Header struct Collision_Header
Line 199: Line 213:
 }; };
 </​code>​ </​code>​
 +
 +After the level loads the pointers are converted from offsets in the Level Settings Block to virtual addresses in a different RAM
 +location accompanied by other collision data generated.
  
 ===== Node_Header ===== ===== Node_Header =====
Line 224: Line 241:
 struct Path_Node_Header struct Path_Node_Header
 { {
-/​*0x0*/ ​   struct Kirby_Node   ​*Kirby_Node;​+/​*0x0*/ ​   struct Kirby_Node       ​*Kirby_Node;​
 /​*0x4*/​  ​  ​struct Path_Node_Footer ​   *Path_Node_Footer;​ /​*0x4*/​  ​  ​struct Path_Node_Footer ​   *Path_Node_Footer;​
 /​*0x8*/​  ​  ​struct Node_Connecters ​    ​(*Node_Connections)[];​ /​*0x8*/​  ​  ​struct Node_Connecters ​    ​(*Node_Connections)[];​
Line 234: Line 251:
 ==== Path Nodes ==== ==== Path Nodes ====
  
-Path nodes are made up of 3 parts. A footer, a position matrix, and boundary matrix.+Path nodes are made up of 3 mandatory ​parts, and one optional part. A footer, a position matrix, and the boundary matrix ​are required. 
 +The optional section has unknown use.
  
 The path node footer contains pointers to the other sections, as well as important data for those sections. The path node footer contains pointers to the other sections, as well as important data for those sections.
Line 245: Line 263:
  
 All together these sections create a path which kirby will walk along when you push right/left. All together these sections create a path which kirby will walk along when you push right/left.
-Theyre ordered in the rom as: Position matrix, boundary matrix, path node footer.+Theyre ordered in the rom as: Position matrix, boundary ​matrix, unknown path matrix, path node footer.
  
 <code c> <code c>
Line 253: Line 271:
 /​*0x04*/ ​   u32    Num_Node_Sections;​ /​*0x04*/ ​   u32    Num_Node_Sections;​
 /​*0x08*/ ​   Vec3f  (*Position_Matrix)[];​ /​*0x08*/ ​   Vec3f  (*Position_Matrix)[];​
-/​*0x0C*/ ​   f32    ​Inverse_H_Speed;+/​*0x0C*/ ​   f32    ​Node_Length;
 /​*0x10*/ ​   f32    (*Boundary_Matrix)[];​ /​*0x10*/ ​   f32    (*Boundary_Matrix)[];​
 /​*0x14*/ ​   f32    (*Unk)[][5];​ /​*0x14*/ ​   f32    (*Unk)[][5];​
Line 260: Line 278:
  
 The unknown section is almost always null. All that is known is that it follows the boundary matrix and is an areay of 5 floats, with length of Num_Node_Sections-1. The unknown section is almost always null. All that is known is that it follows the boundary matrix and is an areay of 5 floats, with length of Num_Node_Sections-1.
 +The number of Position_Matrices is extended by FlagUnk/​0x100.
 +Since its always 0x0 or 0x200 depending on the unk section it is only ever extended by 2.
  
 ==== Camera&​Kirby Nodes ==== ==== Camera&​Kirby Nodes ====
  
 These nodes tell the game how to move the camera with respect to the path nodes. These nodes tell the game how to move the camera with respect to the path nodes.
-There are settings for kirby'​s graphics ​(possibly lots of other things aswell) ​as he progresses through the level, as well as camera movement.+There are settings for kirby'​s graphics, and warps as he progresses through the level, as well as camera movement.
  
-Thr flag in 0xE of Kirby_Node determines if 0x10 or 0x4 is read. A value of 0x10 reads unused3, and a value of 0x1 reads the warp.+Thr flag in 0xE of Kirby_Node determines if 0x10 or 0x4 is read. 
 +A value of 0x10 reads unused3, and a value of 0x1 reads the warp
 +This wholly seems useless outside of setting up warps. Very likely to be old code left in.
  
-The unused3 and unused4 code is read by the game, but seems to do nothing. Its possibly code that was removed after a beta. 
 Opt_1 and opt_2 are used only in 5-5-1. Opt_1 and opt_2 are used only in 5-5-1.
  
Line 275: Line 296:
 { {
 /​*0x00*/​ u8 ​     Node_Number;​ /​*0x00*/​ u8 ​     Node_Number;​
-/​*0x01*/ ​       u8      Padding; +/​*0x01*/ ​   u8      Padding; 
-/​*0x02*/ ​       u16     unk2;+/​*0x02*/ ​   u16     unk2;
 /​*0x04*/​ struct Level    Warps; /​*0x04*/​ struct Level    Warps;
-/​*0x08*/​ u8 unused;​ +/​*0x08*/​ u8 ​  unused; 
-/​*0x09*/​ u8 Shade_Left;​ +/​*0x09*/​ u8 ​  Shade_Left;​ 
-/​*0x0A*/​ u8 Shade_Center;​ +/​*0x0A*/​ u8     ​Shade_Center;​ 
-/​*0x0B*/​ u8 Shade_Right;​ +/​*0x0B*/​ u8 ​  Shade_Right;​ 
-/​*0x0C*/​ u16 unused2;​ +/​*0x0C*/​ u16 ​  unused2; 
-/​*0x0E*/​ u16 Unkflag;​+/​*0x0E*/​ u16     ​Unkflag;
 /​*0x10*/​ s16 ​    ​unused3;​ /​*0x10*/​ s16 ​    ​unused3;​
-/​*0x12*/ ​       s16     ​unused4;​+/​*0x12*/ ​   s16     ​unused4;​
 /​*0x14*/​ f32 ​    ​opt_1;​ /​*0x14*/​ f32 ​    ​opt_1;​
 /​*0x18*/​ f32 ​    ​opt_2;​ /​*0x18*/​ f32 ​    ​opt_2;​
 /​*0x1C*/​ u32 ​    ​unused5;​ /​*0x1C*/​ u32 ​    ​unused5;​
-/​*0x20*/ ​       struct Camera_Node ​   Camera;+/​*0x20*/ ​   struct Camera_Node ​   Camera;
 }; };
 </​code>​ </​code>​
Line 308: Line 329:
 /​*0x0C*/ ​  ​f32 ​   X_Focus_Pos;​ /​*0x0C*/ ​  ​f32 ​   X_Focus_Pos;​
 /​*0x10*/ ​  ​f32 ​   Y_Focus_Pos;​ /​*0x10*/ ​  ​f32 ​   Y_Focus_Pos;​
-/​*0x14*/ ​  ​f32 ​   Flag; //always ​9999?+/​*0x14*/ ​  ​f32 ​   Flag; //usually ​9999
 /​*0x18*/ ​  ​f32 ​   Near_Clip_Plane;​ /​*0x18*/ ​  ​f32 ​   Near_Clip_Plane;​
 /​*0x1C*/ ​  ​f32 ​   Far_Clip_Plane;​ /​*0x1C*/ ​  ​f32 ​   Far_Clip_Plane;​
Line 320: Line 341:
 /​*0x50*/ ​  ​f32 ​   Unk7; /​*0x50*/ ​  ​f32 ​   Unk7;
 /​*0x54*/ ​  ​f32 ​   Cam_Y_Pos_Locked;​ /​*0x54*/ ​  ​f32 ​   Cam_Y_Pos_Locked;​
-/​*0x58*/ ​  ​f32[2] Flag2; //a 9999 pair+/​*0x58*/ ​  ​f32[2] Flag2; //mostly ​a 9999 pair
 /​*0x60*/ ​  ​f32 ​   Focus_Y_Above;​ //while 0x6 is true /​*0x60*/ ​  ​f32 ​   Focus_Y_Above;​ //while 0x6 is true
 /​*0x64*/ ​  ​f32 ​   Focus_Y_Below;​ //while 0x6 is true /​*0x64*/ ​  ​f32 ​   Focus_Y_Below;​ //while 0x6 is true
Line 336: Line 357:
 struct Node_Connectors struct Node_Connectors
 { {
-/​*0x00*/ ​   u16     Unused //Not entirely sure+/​*0x00*/ ​   u16     Go_Backwards;
 /​*0x02*/ ​   u16     ​Current_Node;​ /​*0x02*/ ​   u16     ​Current_Node;​
-/​*0x04*/ ​   u16     Unused2; //Not sure +/​*0x04*/ ​   u16     Connected_Node; //Not sure 
-/​*0x06*/ ​   u16     Connected_Node;+/​*0x06*/ ​   u16     Go_Foward;
 }; };
 </​code>​ </​code>​
 +
 +Basically if a node is connected on both ends to the same node, there is only one
 +node connector. In this case Go_Forward is used to determine if kirby should be allowed to pass
 +or not. On the other hand Go_Backwards only allows movement through when 0.
 +If there are two connections than backand front connect to different nodes. In that case the first
 +determines backwards connection while the second determines forwards. Go_Backwards now determines all movement,
 +with the same effect as the single node.
 +
 ===== Entity List ===== ===== Entity List =====
-The entity list is an array of structs ​ehich spawn objects as kirby gets in range. It is terminated by an 0x99999999 marker. +The entity list is an array of structs ​which spawn objects as kirby gets in range. It is terminated by an 0x99999999 marker. 
-See [[kirby64_the_crystal_shards:​entity_ids|]] for more info+See [[kirby64_the_crystal_shards:​entity_ids|]] for more info
 +This section is optional and if a not pointed to in the main header will not be used.
kirby64_the_crystal_shards/level_settings_blocks.1589154314.txt.gz · Last modified: 2020/05/10 23:45 by jesusyoshi54